var cc=cc||{};cc._tmp=cc._tmp||{},cc._LogInfos={},window._p,_p=window,_p.DeviceOrientationEvent,_p.DeviceMotionEvent,_p=Object.prototype,_p._super,_p.ctor,delete window._p,cc.newElement=function(e){return document.createElement(e)},cc._addEventListener=function(e,t,n,r){e.addEventListener(t,n,r)},cc.each=function(e,t,n){if(!e)return;if(e instanceof Array){for(var r=0,i=e.length;r0&&(e=e.substring(0,n));var r=/(\/|\\\\)([^(\/|\\\\)]+)$/g,i=r.exec(e.replace(/(\/|\\\\)$/,""));if(!i)return null;var s=i[2];return t&&e.substring(e.length-t.length).toLowerCase()==t.toLowerCase()?s.substring(0,s.length-t.length):s},dirname:function(e){return e.replace(/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,"$2")},changeExtname:function(e,t){t=t||"";var n=e.indexOf("?"),r="";return n>0&&(r=e.substring(n),e=e.substring(0,n)),n=e.lastIndexOf("."),n<0?e+t+r:e.substring(0,n)+t+r},changeBasename:function(e,t,n){if(t.indexOf(".")==0)return this.changeExtname(e,t);var r=e.indexOf("?"),i="",s=n?this.extname(e):"";return r>0&&(i=e.substring(r),e=e.substring(0,r)),r=e.lastIndexOf("/"),r=r<=0?0:r+1,e.substring(0,r)+t+s+i}},cc.loader={_jsCache:{},_register:{},_langPathCache:{},_aliases:{},resPath:"",cache:{},getXMLHttpRequest:function(){return window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP")},_getArgs4Js:function(e){var t=e[0],n=e[1],r=e[2],i=["",null,null];if(e.length===1)i[1]=t instanceof Array?t:[t];else if(e.length===2)typeof n=="function"?(i[1]=t instanceof Array?t:[t],i[2]=n):(i[0]=t||"",i[1]=n instanceof Array?n:[n]);else{if(e.length!==3)throw"arguments error to load js!";i[0]=t||"",i[1]=n instanceof Array?n:[n],i[2]=r}return i},loadJs:function(e,t,n){var r=this,i=r._jsCache,s=r._getArgs4Js(arguments);navigator.userAgent.indexOf("Trident/5")>-1?r._loadJs4Dependency(s[0],s[1],0,s[2]):cc.async.map(s[1],function(e,t,n){var o=cc.path.join(s[0],e);if(i[o])return n(null);r._createScript(o,!1,n)},s[2])},loadJsWithImg:function(e,t,n){var r=this,i=r._loadJsImg(),s=r._getArgs4Js(arguments);this.loadJs(s[0],s[1],function(e){if(e)throw e;i.parentNode.removeChild(i),s[2]&&s[2]()})},_createScript:function(e,t,n){var r=document,i=this,s=cc.newElement("script");s.async=t,s.src=e,i._jsCache[e]=!0,cc._addEventListener(s,"load",function(){this.removeEventListener("load",arguments.callee,!1),n()},!1),cc._addEventListener(s,"error",function(){n("Load "+e+" failed!")},!1),r.body.appendChild(s)},_loadJs4Dependency:function(e,t,n,r){if(n>=t.length){r&&r();return}var i=this;i._createScript(cc.path.join(e,t[n]),!1,function(s){if(s)return r(s);i._loadJs4Dependency(e,t,n+1,r)})},_loadJsImg:function(){var e=document,t=e.getElementById("cocos2d_loadJsImg");if(!t){t=cc.newElement("img"),cc._loadingImage&&(t.src=cc._loadingImage);var n=e.getElementById(cc.game.config.id);n.style.backgroundColor="transparent",n.parentNode.appendChild(t);var r=getComputedStyle?getComputedStyle(n):n.currentStyle;r||(r={width:n.width,height:n.height}),t.style.left=n.offsetLeft+(parseFloat(r.width)-t.width)/2+"px",t.style.top=n.offsetTop+(parseFloat(r.height)-t.height)/2+"px",t.style.position="absolute"}return t},loadTxt:function(e,t){var n=this.getXMLHttpRequest(),r="load "+e+" failed!";n.open("GET",e,!0),/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)?(n.setRequestHeader("Accept-Charset","utf-8"),n.onreadystatechange=function(){n.readyState==4&&n.status==200?t(null,n.responseText):t(r)}):(n.overrideMimeType&&n.overrideMimeType("text/plain; charset=utf-8"),n.onload=function(){n.readyState==4&&n.status==200?t(null,n.responseText):t(r)}),n.send(null)},_loadTxtSync:function(e){var t=this.getXMLHttpRequest();return t.open("GET",e,!1),/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)?t.setRequestHeader("Accept-Charset","utf-8"):t.overrideMimeType&&t.overrideMimeType("text/plain; charset=utf-8"),t.send(null),!t.readyState==4||t.status!=200?null:t.responseText},loadJson:function(e,t){this.loadTxt(e,function(n,r){try{n?t(n):t(null,JSON.parse(r))}catch(i){throw"load json ["+e+"] failed : "+i}})},_checkIsImageURL:function(e){var t=/(\.png)|(\.jpg)|(\.bmp)|(\.jpeg)|(\.gif)/.exec(e);return t!=null},loadImg:function(e,t,n){var r={isCrossOrigin:!0};n!==undefined?r.isCrossOrigin=t.isCrossOrigin==null?r.isCrossOrigin:t.isCrossOrigin:t!==undefined&&(n=t);var i=new Image;return r.isCrossOrigin&&location.origin!="file://"&&(i.crossOrigin="Anonymous"),cc._addEventListener(i,"load",function(){this.removeEventListener("load",arguments.callee,!1),this.removeEventListener("error",arguments.callee,!1),n&&n(null,i)}),cc._addEventListener(i,"error",function(){this.removeEventListener("error",arguments.callee,!1),n&&n("load image failed")}),i.src=e,i},_loadResIterator:function(e,t,n){var r=this,i=null,s=e.type;s?(s="."+s.toLowerCase(),i=e.src?e.src:e.name+s):(i=e,s=cc.path.extname(i));var o=r.cache[i];if(o)return n(null,o);var u=r._register[s.toLowerCase()];if(!u)return cc.error("loader for ["+s+"] not exists!"),n();var a=u.getBasePath?u.getBasePath():r.resPath,f=r.getUrl(a,i);u.load(f,i,e,function(e,t){e?(cc.log(e),r.cache[i]=null,delete r.cache[i],n()):(r.cache[i]=t,n(null,t))})},getUrl:function(e,t){var n=this,r=n._langPathCache,i=cc.path;if(e!==undefined&&t===undefined){t=e;var s=i.extname(t);s=s?s.toLowerCase():"";var o=n._register[s];o?e=o.getBasePath?o.getBasePath():n.resPath:e=n.resPath}return t=cc.path.join(e||"",t),t},load:function(e,t,n){if(n!==undefined)typeof t=="function"&&(t={trigger:t});else if(t!==undefined)typeof t=="function"&&(n=t,t={});else{if(e===undefined)throw"arguments error!";t={}}t.cb=function(e,t){e&&cc.log(e),n&&n(t)},e instanceof Array||(e=[e]),t.iterator=this._loadResIterator,t.iteratorTarget=this,cc.async.map(e,t)},_handleAliases:function(e,t){var n=this,r=n._aliases,i=[];for(var s in e){var o=e[s];r[s]=o,i.push(o)}this.load(i,t)},loadAliases:function(e,t){var n=this,r=n.getRes(e);r?n._handleAliases(r.filenames,t):n.load(e,function(e){n._handleAliases(e[0].filenames,t)})},register:function(e,t){if(!e||!t)return;var n=this;if(typeof e=="string")return this._register[e.trim().toLowerCase()]=t;for(var r=0,i=e.length;r0&&(a=f[0].toLowerCase(),a=="micromessenger"?a=n.BROWSER_TYPE_WECHAT:a==="safari"&&u.match(/android.*applewebkit/)?a=n.BROWSER_TYPE_ANDROID:a=="trident"&&(a=n.BROWSER_TYPE_IE)),n.browserType=a;var l=cc.newElement("Canvas");cc._supportRender=!0,n._canUseCanvasNewBlendModes=function(){var e=document.createElement("canvas");e.width=1,e.height=1;var t=e.getContext("2d");return t.fillStyle="#000",t.fillRect(0,0,1,1),t.globalCompositeOperation="multiply",t.fillStyle="#fff",t.fillRect(0,0,1,1),t.getImageData(0,0,1,1).data[0]===0},n._supportCanvasNewBlendModes=n._canUseCanvasNewBlendModes();try{l.getContext("2d")}catch(c){cc._supportRender=!1}try{var h=n.localStorage=r.localStorage;h.setItem("storage",""),h.removeItem("storage"),h=null}catch(c){(c.name==="SECURITY_ERR"||c.name==="QuotaExceededError")&&cc.warn("Warning: localStorage isn't enabled. Please confirm browser cookie or privacy option"),n.localStorage=function(){}}var p=n.capabilities={canvas:!0};o.ontouchstart!==undefined||i.msPointerEnabled?p.touches=!0:o.onmouseup!==undefined&&(p.mouse=!0),o.onkeyup!==undefined&&(p.keyboard=!0);if(r.DeviceMotionEvent||r.DeviceOrientationEvent)p.accelerometer=!0;var d=u.match(/(iPad|iPhone|iPod)/i)?!0:!1,v=u.match(/android/i)||i.platform.match(/android/i)?!0:!1,m=n.OS_UNKNOWN;i.appVersion.indexOf("Win")!=-1?m=n.OS_WINDOWS:d?m=n.OS_IOS:i.appVersion.indexOf("Mac")!=-1?m=n.OS_OSX:i.appVersion.indexOf("X11")!=-1?m=n.OS_UNIX:i.appVersion.indexOf("Linux")!=-1?m=n.OS_LINUX:v&&(m=n.OS_ANDROID),n.os=m},cc.ORIENTATION_PORTRAIT=0,cc.ORIENTATION_PORTRAIT_UPSIDE_DOWN=1,cc.ORIENTATION_LANDSCAPE_LEFT=2,cc.ORIENTATION_LANDSCAPE_RIGHT=3,cc._drawingUtil=null,cc._renderContext=null,cc._canvas=null,cc._gameDiv=null,cc._rendererInitialized=!1,cc._setupCalled=!1,cc._setup=function(e,t,n){if(cc._setupCalled)return;cc._setupCalled=!0;var r=window;r.requestAnimFrame=r.requestAnimationFrame||r.webkitRequestAnimationFrame||r.mozRequestAnimationFrame||r.oRequestAnimationFrame||r.msRequestAnimationFrame;var i=cc.$(e)||cc.$("#"+e),s,o,u;i.tagName=="CANVAS"?(t=t||i.width,n=n||i.height,o=cc.container=cc.newElement("DIV"),s=cc._canvas=i,s.parentNode.insertBefore(o,s),s.appendTo(o),o.setAttribute("id","Cocos2dGameContainer")):(i.tagName!="DIV"&&cc.log("Warning: target element is not a DIV or CANVAS"),t=t||i.clientWidth,n=n||i.clientHeight,o=cc.container=i,s=cc._canvas=cc.$(cc.newElement("CANVAS")),i.appendChild(s)),s.addClass("gameCanvas"),s.setAttribute("width",t||480),s.setAttribute("height",n||320),s.setAttribute("tabindex",99),s.style.outline="none",u=o.style,u.width=(t||480)+"px",u.height=(n||320)+"px",u.margin="0 auto",u.position="relative",u.overflow="hidden",o.top="100%",cc._renderContext=s.getContext("2d"),cc._mainRenderContextBackup=cc._renderContext,cc._renderContext.translate(0,s.height),cc._drawingUtil=cc.DrawingPrimitiveCanvas?new cc.DrawingPrimitiveCanvas(cc._renderContext):null,cc._gameDiv=o,cc._setContextMenuEnable(!1);if(cc.sys.isMobile){var a=cc.newElement("style");a.type="text/css",document.body.appendChild(a),a.textContent="body,canvas,div{ -moz-user-select: none;-webkit-user-select: none;-ms-user-select: none;-khtml-user-select: none;-webkit-tap-highlight-color:rgba(0,0,0,0);}"}cc.view=cc.EGLView._getInstance(),cc.inputManager.registerSystemEvent(cc._canvas),cc.director=cc.Director._getInstance(),cc.director.setOpenGLView&&cc.director.setOpenGLView(cc.view),cc.winSize=cc.director.getWinSize(),cc.saxParser=new cc.SAXParser,cc.plistParser=new cc.PlistParser},cc._isContextMenuEnable=!1,cc._setContextMenuEnable=function(e){cc._isContextMenuEnable=e,cc._canvas.oncontextmenu=function(){if(!cc._isContextMenuEnable)return!1}},cc.game={EVENT_HIDE:"game_on_hide",EVENT_SHOW:"game_on_show",_eventHide:null,_eventShow:null,_onBeforeStartArr:[],CONFIG_KEY:{engineDir:"engineDir",dependencies:"dependencies",showFPS:"showFPS",frameRate:"frameRate",id:"id",jsList:"jsList",classReleaseMode:"classReleaseMode"},_prepareCalled:!1,_prepared:!1,_paused:!0,_intervalId:null,config:null,onStart:null,onStop:null,setFrameRate:function(e){var t=this,n=t.config,r=t.CONFIG_KEY;n[r.frameRate]=e,t._intervalId&&clearInterval(t._intervalId),t._paused=!0,t._runMainLoop()},_runMainLoop:function(){var e=this,t,n=e.config,r=e.CONFIG_KEY,i=window,s=n[r.frameRate],o=cc.director;o.setDisplayStats(n[r.showFPS]),i.requestAnimFrame&&s==60?(t=function(){e._paused||(o.mainLoop(),i.requestAnimFrame(t))},i.requestAnimFrame(t)):(t=function(){o.mainLoop()},e._intervalId=setInterval(t,1e3/s)),e._paused=!1},run:function(e){var t=this,n=function(){e&&(t.config[t.CONFIG_KEY.id]=e),t._prepareCalled?cc._supportRender&&(t._checkPrepare=setInterval(function(){t._prepared&&(cc._setup(t.config[t.CONFIG_KEY.id]),t._runMainLoop(),t._eventHide=t._eventHide||new cc.EventCustom(t.EVENT_HIDE),t._eventHide.setUserData(t),t._eventShow=t._eventShow||new cc.EventCustom(t.EVENT_SHOW),t._eventShow.setUserData(t),t.onStart(),clearInterval(t._checkPrepare))},10)):t.prepare(function(){cc._supportRender&&(cc._setup(t.config[t.CONFIG_KEY.id]),t._runMainLoop(),t._eventHide=t._eventHide||new cc.EventCustom(t.EVENT_HIDE),t._eventHide.setUserData(t),t._eventShow=t._eventShow||new cc.EventCustom(t.EVENT_SHOW),t._eventShow.setUserData(t),t.onStart())})};document.body?n():cc._addEventListener(window,"load",function(){this.removeEventListener("load",arguments.callee,!1),n()},!1)},_initConfig:function(){var e=this,t=e.CONFIG_KEY,n=function(e){return e[t.engineDir]=e[t.engineDir]||"frameworks/cocos2d-html5",e[t.frameRate]=e[t.frameRate]||60,e};if(document.ccConfig)e.config=n(document.ccConfig);else try{var r=document.getElementsByTagName("script");for(var i=0;i=t.x||e.y>=t.y||e.x+e.width<=t.x+t.width||e.y+e.height<=t.y+t.height)},cc.rectGetMaxX=function(e){return e.x+e.width},cc.rectGetMidX=function(e){return e.x+e.width/2},cc.rectGetMinX=function(e){return e.x},cc.rectGetMaxY=function(e){return e.y+e.height},cc.rectGetMidY=function(e){return e.y+e.height/2},cc.rectGetMinY=function(e){return e.y},cc.rectContainsPoint=function(e,t){return t.x>=cc.rectGetMinX(e)&&t.x<=cc.rectGetMaxX(e)&&t.y>=cc.rectGetMinY(e)&&t.y<=cc.rectGetMaxY(e)},cc.rectIntersectsRect=function(e,t){var n=e.x+e.width,r=e.y+e.height,i=t.x+t.width,s=t.y+t.height;return!(n>16,r=(t>>8)%256,i=t%256;return cc.color(n,r,i)},cc.colorToHex=function(e){var t=e.r.toString(16),n=e.g.toString(16),r=e.b.toString(16);return"#"+(e.r<16?"0"+t:t)+(e.g<16?"0"+n:n)+(e.b<16?"0"+r:r)},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|Math.random()*10)},__getKey:function(){return this.__currId++,"key_"+this.__currId},setObject:function(e,t){if(t==null)return;var n=this.__getKey();this._keyMapTb[n]=t,this._valueMapTb[n]=e},objectForKey:function(e){if(e==null)return null;var t=this._keyMapTb;for(var n in t)if(t[n]===e)return this._valueMapTb[n];return null},valueForKey:function(e){return this.objectForKey(e)},removeObjectForKey:function(e){if(e==null)return;var t=this._keyMapTb;for(var n in t)if(t[n]===e){delete this._valueMapTb[n],delete t[n];return}},removeObjectsForKeys:function(e){if(e==null)return;for(var t=0;t0&&this.setDesignResolutionSize(e,t,this._resolutionPolicy)},resizeWithBrowserSize:function(e){var t,n=this;e?n.__resizeWithBrowserSize||(n.__resizeWithBrowserSize=!0,t=n._resizeEvent.bind(n),cc._addEventListener(window,"resize",t,!1)):n.__resizeWithBrowserSize&&(n.__resizeWithBrowserSize=!0,t=n._resizeEvent.bind(n),window.removeEventListener("resize",t,!1))},setResizeCallback:function(e){if(typeof e=="function"||e==null)this._resizeCallback=e},_initFrameSize:function(){var e=this._frameSize;e.width=this._frame.clientWidth,e.height=this._frame.clientHeight},_adjustSizeKeepCanvasSize:function(){var e=this._originalDesignResolutionSize.width,t=this._originalDesignResolutionSize.height;e>0&&this.setDesignResolutionSize(e,t,this._resolutionPolicy)},_setViewPortMeta:function(e,t){if(this._isAdjustViewPort){var n={"user-scalable":"no","maximum-scale":"1.0","initial-scale":"1.0"},r=document.getElementsByName("viewport"),i,s;r.length==0?(i=cc.newElement("meta"),i.name="viewport",i.content="",document.head.appendChild(i)):i=r[0];if(cc.sys.isMobile&&cc.sys.browserType==cc.sys.BROWSER_TYPE_FIREFOX){i.content="initial-scale:1";return}s=i.content;for(var o in n){var u=new RegExp(o);u.test(s)||(s+=(s==""?"":",")+o+"="+n[o])}i.content=s}},_setScaleXYForRenderTexture:function(){var e=cc.contentScaleFactor();this._scaleX=e,this._scaleY=e},_resetScale:function(){this._scaleX=this._originalScaleX,this._scaleY=this._originalScaleY},_adjustSizeToBrowser:function(){},initialize:function(){this._initialized=!0},adjustViewPort:function(e){this._isAdjustViewPort=e},enableRetina:function(e){this._retinaEnabled=e?!0:!1},isRetinaEnabled:function(){return this._retinaEnabled},enableAutoFullScreen:function(e){this._autoFullScreen=e?!0:!1},isAutoFullScreenEnabled:function(){return this._autoFullScreen},end:function(){},isOpenGLReady:function(){return this._hDC!=null&&this._hRC!=null},setFrameZoomFactor:function(e){this._frameZoomFactor=e,this.centerWindow(),cc.director.setProjection(cc.director.getProjection())},swapBuffers:function(){},setIMEKeyboardState:function(e){},setContentTranslateLeftTop:function(e,t){this._contentTranslateLeftTop={left:e,top:t}},getContentTranslateLeftTop:function(){return this._contentTranslateLeftTop},getFrameSize:function(){return cc.size(this._frameSize.width,this._frameSize.height)},setFrameSize:function(e,t){this._frameSize.width=e,this._frameSize.height=t,this._frame.style.width=e+"px",this._frame.style.height=t+"px",this._resizeEvent(),cc.director.setProjection(cc.director.getProjection())},centerWindow:function(){},getVisibleSize:function(){return cc.size(this._visibleRect.width,this._visibleRect.height)},getVisibleOrigin:function(){return cc.p(this._visibleRect.x,this._visibleRect.y)},canSetContentScaleFactor:function(){return!0},getResolutionPolicy:function(){return this._resolutionPolicy},setResolutionPolicy:function(e){var t=this;if(e instanceof cc.ResolutionPolicy)t._resolutionPolicy=e;else{var n=cc.ResolutionPolicy;e===n.EXACT_FIT&&(t._resolutionPolicy=t._rpExactFit),e===n.SHOW_ALL&&(t._resolutionPolicy=t._rpShowAll),e===n.NO_BORDER&&(t._resolutionPolicy=t._rpNoBorder),e===n.FIXED_HEIGHT&&(t._resolutionPolicy=t._rpFixedHeight),e===n.FIXED_WIDTH&&(t._resolutionPolicy=t._rpFixedWidth)}},setDesignResolutionSize:function(e,t,n){if(isNaN(e)||e==0||isNaN(t)||t==0){cc.log(cc._LogInfos.EGLView_setDesignResolutionSize);return}var r=this;r.setResolutionPolicy(n);var i=r._resolutionPolicy;if(!i){cc.log(cc._LogInfos.EGLView_setDesignResolutionSize_2);return}i.preApply(r);var s=r._frameSize.width,o=r._frameSize.height;cc.sys.isMobile&&r._setViewPortMeta(r._frameSize.width,r._frameSize.height),r._initFrameSize();if(n==r._resolutionPolicy&&e==r._originalDesignResolutionSize.width&&t==r._originalDesignResolutionSize.height&&s==r._frameSize.width&&o==r._frameSize.height)return;r._designResolutionSize=cc.size(e,t),r._originalDesignResolutionSize=cc.size(e,t);var u=i.apply(r,r._designResolutionSize);u.scale&&u.scale.length==2&&(r._scaleX=u.scale[0],r._scaleY=u.scale[1]);if(u.viewport){var a=r._viewPortRect=u.viewport,f=r._visibleRect;f.width=cc._canvas.width/r._scaleX,f.height=cc._canvas.height/r._scaleY,f.x=-a.x/r._scaleX,f.y=-a.y/r._scaleY}var l=cc.director;cc.winSize.width=l._winSizeInPoints.width=r._visibleRect.width,cc.winSize.height=l._winSizeInPoints.height=r._visibleRect.height,i.postApply(r),r._originalScaleX=r._scaleX,r._originalScaleY=r._scaleY,cc.DOM&&cc.DOM._resetEGLViewDiv(),cc.visibleRect&&cc.visibleRect.init(r._visibleRect)},getDesignResolutionSize:function(){return cc.size(this._designResolutionSize.width,this._designResolutionSize.height)},setViewPortInPoints:function(e,t,n,r){var i=this._frameZoomFactor,s=this._scaleX,o=this._scaleY;cc._renderContext.viewport(e*s*i+this._viewPortRect.x*i,t*o*i+this._viewPortRect.y*i,n*s*i,r*o*i)},setScissorInPoints:function(e,t,n,r){var i=this._frameZoomFactor,s=this._scaleX,o=this._scaleY;cc._renderContext.scissor(e*s*i+this._viewPortRect.x*i,t*o*i+this._viewPortRect.y*i,n*s*i,r*o*i)},isScissorEnabled:function(){var e=cc._renderContext;return e.isEnabled(e.SCISSOR_TEST)},getScissorRect:function(){var e=cc._renderContext,t=this._scaleX,n=this._scaleY,r=e.getParameter(e.SCISSOR_BOX);return cc.rect((r[0]-this._viewPortRect.x)/t,(r[1]-this._viewPortRect.y)/n,r[2]/t,r[3]/n)},setViewName:function(e){e!=null&&e.length>0&&(this._viewName=e)},getViewName:function(){return this._viewName},getViewPortRect:function(){return this._viewPortRect},getScaleX:function(){return this._scaleX},getScaleY:function(){return this._scaleY},getDevicePixelRatio:function(){return this._devicePixelRatio},convertToLocationInView:function(e,t,n){return{x:this._devicePixelRatio*(e-n.left),y:this._devicePixelRatio*(n.top+n.height-t)}},_convertMouseToLocationInView:function(e,t){var n=this._viewPortRect,r=this;e.x=(r._devicePixelRatio*(e.x-t.left)-n.x)/r._scaleX,e.y=(r._devicePixelRatio*(t.top+t.height-e.y)-n.y)/r._scaleY},_convertTouchesWithScale:function(e){var t=this._viewPortRect,n=this._scaleX,r=this._scaleY,i,s,o;for(var u=0;u>=1}return-1},_removeUsedIndexBit:function(e){if(e<0||e>=this._maxTouches)return;var t=1<0){this._glView._convertTouchesWithScale(s);var l=new cc.EventTouch(s);l._eventCode=cc.EventTouch.EventCode.BEGAN,cc.eventManager.dispatchEvent(l)}},handleTouchesMove:function(e){var t,n,r,i=[],s=this._touches;for(var o=0,u=e.length;o0){this._glView._convertTouchesWithScale(i);var a=new cc.EventTouch(i);a._eventCode=cc.EventTouch.EventCode.MOVED,cc.eventManager.dispatchEvent(a)}},handleTouchesEnd:function(e){var t=this.getSetOfTouchesEndOrCancel(e);if(t.length>0){this._glView._convertTouchesWithScale(t);var n=new cc.EventTouch(t);n._eventCode=cc.EventTouch.EventCode.ENDED,cc.eventManager.dispatchEvent(n)}},handleTouchesCancel:function(e){var t=this.getSetOfTouchesEndOrCancel(e);if(t.length>0){this._glView._convertTouchesWithScale(t);var n=new cc.EventTouch(t);n._eventCode=cc.EventTouch.EventCode.CANCELLED,cc.eventManager.dispatchEvent(n)}},getSetOfTouchesEndOrCancel:function(e){var t,n,r,i=[],s=this._touches,o=this._touchesIntegerDict;for(var u=0,a=e.length;u=0;i--)if(n[i].getId()==r){t=n[i];break}return t||(t=e),t},setPreTouch:function(e){var t=!1,n=this._preTouchPool,r=e.getId();for(var i=n.length-1;i>=0;i--)if(n[i].getId()==r){n[i]=e,t=!0;break}t||(n.length<=50?n.push(e):(n[this._preTouchPoolPointer]=e,this._preTouchPoolPointer=(this._preTouchPoolPointer+1)%50))},getTouchByXY:function(e,t,n){var r=this._preTouchPoint,i=this._glView.convertToLocationInView(e,t,n),s=new cc.Touch(i.x,i.y);return s._setPrevPoint(r.x,r.y),r.x=i.x,r.y=i.y,s},getMouseEvent:function(e,t,n){var r=this._prevMousePoint;this._glView._convertMouseToLocationInView(e,t);var i=new cc.EventMouse(n);return i.setLocation(e.x,e.y),i._setPrevCursor(r.x,r.y),r.x=e.x,r.y=e.y,i},getPointByEvent:function(e,t){return e.pageX!=null?{x:e.pageX,y:e.pageY}:(t.left-=document.body.scrollLeft,t.top-=document.body.scrollTop,{x:e.clientX,y:e.clientY})},getTouchesByEvent:function(e,t){var n=[],r=this._glView,i,s,o,u=this._preTouchPoint,a=e.changedTouches.length;for(var f=0;fthis._accelInterval&&(this._accelCurTime-=this._accelInterval,cc.eventManager.dispatchEvent(new cc.EventAcceleration(this._acceleration))),this._accelCurTime+=e}},cc.AffineTransform=function(e,t,n,r,i,s){this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=s},cc.affineTransformMake=function(e,t,n,r,i,s){return{a:e,b:t,c:n,d:r,tx:i,ty:s}},cc.pointApplyAffineTransform=function(e,t){return{x:t.a*e.x+t.c*e.y+t.tx,y:t.b*e.x+t.d*e.y+t.ty}},cc._pointApplyAffineTransform=function(e,t,n){return{x:n.a*e+n.c*t+n.tx,y:n.b*e+n.d*t+n.ty}},cc.sizeApplyAffineTransform=function(e,t){return{width:t.a*e.width+t.c*e.height,height:t.b*e.width+t.d*e.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(e,t){var n=cc.rectGetMinY(e),r=cc.rectGetMinX(e),i=cc.rectGetMaxX(e),s=cc.rectGetMaxY(e),o=cc._pointApplyAffineTransform(r,n,t),u=cc._pointApplyAffineTransform(i,n,t),a=cc._pointApplyAffineTransform(r,s,t),f=cc._pointApplyAffineTransform(i,s,t),l=Math.min(o.x,u.x,a.x,f.x),c=Math.max(o.x,u.x,a.x,f.x),h=Math.min(o.y,u.y,a.y,f.y),p=Math.max(o.y,u.y,a.y,f.y);return cc.rect(l,h,c-l,p-h)},cc._rectApplyAffineTransformIn=function(e,t){var n=cc.rectGetMinY(e),r=cc.rectGetMinX(e),i=cc.rectGetMaxX(e),s=cc.rectGetMaxY(e),o=cc._pointApplyAffineTransform(r,n,t),u=cc._pointApplyAffineTransform(i,n,t),a=cc._pointApplyAffineTransform(r,s,t),f=cc._pointApplyAffineTransform(i,s,t),l=Math.min(o.x,u.x,a.x,f.x),c=Math.max(o.x,u.x,a.x,f.x),h=Math.min(o.y,u.y,a.y,f.y),p=Math.max(o.y,u.y,a.y,f.y);return e.x=l,e.y=h,e.width=c-l,e.height=p-h,e},cc.affineTransformTranslate=function(e,t,n){return{a:e.a,b:e.b,c:e.c,d:e.d,tx:e.tx+e.a*t+e.c*n,ty:e.ty+e.b*t+e.d*n}},cc.affineTransformScale=function(e,t,n){return{a:e.a*t,b:e.b*t,c:e.c*n,d:e.d*n,tx:e.tx,ty:e.ty}},cc.affineTransformRotate=function(e,t){var n=Math.sin(t),r=Math.cos(t);return{a:e.a*r+e.c*n,b:e.b*r+e.d*n,c:e.c*r-e.a*n,d:e.d*r-e.b*n,tx:e.tx,ty:e.ty}},cc.affineTransformConcat=function(e,t){return{a:e.a*t.a+e.b*t.c,b:e.a*t.b+e.b*t.d,c:e.c*t.a+e.d*t.c,d:e.c*t.b+e.d*t.d,tx:e.tx*t.a+e.ty*t.c+t.tx,ty:e.tx*t.b+e.ty*t.d+t.ty}},cc.affineTransformEqualToTransform=function(e,t){return e.a===t.a&&e.b===t.b&&e.c===t.c&&e.d===t.d&&e.tx===t.tx&&e.ty===t.ty},cc.affineTransformInvert=function(e){var t=1/(e.a*e.d-e.b*e.c);return{a:t*e.d,b:-t*e.b,c:-t*e.c,d:t*e.a,tx:t*(e.c*e.ty-e.d*e.tx),ty:t*(e.b*e.tx-e.a*e.ty)}},cc.POINT_EPSILON=parseFloat("1.192092896e-07F"),cc.pNeg=function(e){return cc.p(-e.x,-e.y)},cc.pAdd=function(e,t){return cc.p(e.x+t.x,e.y+t.y)},cc.pSub=function(e,t){return cc.p(e.x-t.x,e.y-t.y)},cc.pMult=function(e,t){return cc.p(e.x*t,e.y*t)},cc.pMidpoint=function(e,t){return cc.pMult(cc.pAdd(e,t),.5)},cc.pDot=function(e,t){return e.x*t.x+e.y*t.y},cc.pCross=function(e,t){return e.x*t.y-e.y*t.x},cc.pPerp=function(e){return cc.p(-e.y,e.x)},cc.pRPerp=function(e){return cc.p(e.y,-e.x)},cc.pProject=function(e,t){return cc.pMult(t,cc.pDot(e,t)/cc.pDot(t,t))},cc.pRotate=function(e,t){return cc.p(e.x*t.x-e.y*t.y,e.x*t.y+e.y*t.x)},cc.pUnrotate=function(e,t){return cc.p(e.x*t.x+e.y*t.y,e.y*t.x-e.x*t.y)},cc.pLengthSQ=function(e){return cc.pDot(e,e)},cc.pDistanceSQ=function(e,t){return cc.pLengthSQ(cc.pSub(e,t))},cc.pLength=function(e){return Math.sqrt(cc.pLengthSQ(e))},cc.pDistance=function(e,t){return cc.pLength(cc.pSub(e,t))},cc.pNormalize=function(e){return cc.pMult(e,1/cc.pLength(e))},cc.pForAngle=function(e){return cc.p(Math.cos(e),Math.sin(e))},cc.pToAngle=function(e){return Math.atan2(e.y,e.x)},cc.clampf=function(e,t,n){if(t>n){var r=t;t=n,n=r}return e=0&&i.x<=1&&i.y>=0&&i.y<=1?!0:!1},cc.pIntersectPoint=function(e,t,n,r){var i=cc.p(0,0);if(cc.pLineIntersect(e,t,n,r,i)){var s=cc.p(0,0);return s.x=e.x+i.x*(t.x-e.x),s.y=e.y+i.x*(t.y-e.y),s}return cc.p(0,0)},cc.pSameAs=function(e,t){return e!=null&&t!=null?e.x==t.x&&e.y==t.y:!1},cc.pZeroIn=function(e){e.x=0,e.y=0},cc.pIn=function(e,t){e.x=t.x,e.y=t.y},cc.pMultIn=function(e,t){e.x*=t,e.y*=t},cc.pSubIn=function(e,t){e.x-=t.x,e.y-=t.y},cc.pAddIn=function(e,t){e.x+=t.x,e.y+=t.y},cc.pNormalizeIn=function(e){cc.pMultIn(e,1/Math.sqrt(e.x*e.x+e.y*e.y))},cc.Touch=cc.Class.extend({_point:null,_prevPoint:null,_id:0,_startPointCaptured:!1,_startPoint:null,ctor:function(e,t,n){this._point=cc.p(e||0,t||0),this._id=n||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,t,n){this._prevPoint=this._point,this._point=cc.p(t||0,n||0),this._id=e,this._startPointCaptured||(this._startPoint=cc.p(this._point),this._startPointCaptured=!0)},_setPoint:function(e,t){t===undefined?(this._point.x=e.x,this._point.y=e.y):(this._point.x=e,this._point.y=t)},_setPrevPoint:function(e,t){t===undefined?this._prevPoint=cc.p(e.x,e.y):this._prevPoint=cc.p(e||0,t||0)}}),cc.Event=cc.Class.extend({_type:0,_isStopped:!1,_currentTarget:null,_setCurrentTarget:function(e){this._currentTarget=e},ctor:function(e){this._type=e},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(e){cc.Event.prototype.ctor.call(this,cc.Event.CUSTOM),this._eventName=e},setUserData:function(e){this._userData=e},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(e){cc.Event.prototype.ctor.call(this,cc.Event.MOUSE),this._eventType=e},setScrollData:function(e,t){this._scrollX=e,this._scrollY=t},getScrollX:function(){return this._scrollX},getScrollY:function(){return this._scrollY},setLocation:function(e,t){this._x=e,this._y=t},getLocation:function(){return{x:this._x,y:this._y}},getLocationInView:function(){return{x:this._x,y:cc.view._designResolutionSize.height-this._y}},_setPrevCursor:function(e,t){this._prevX=e,this._prevY=t},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(e){this._button=e},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(e){cc.Event.prototype.ctor.call(this,cc.Event.TOUCH),this._touches=e||[]},getEventCode:function(){return this._eventCode},getTouches:function(){return this._touches},_setEventCode:function(e){this._eventCode=e},_setTouches:function(e){this._touches=e}}),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,t,n){this._onEvent=n,this._type=e||0,this._listenerID=t||""},_setPaused:function(e){this._paused=e},_isPaused:function(){return this._paused},_setRegistered:function(e){this._registered=e},_isRegistered:function(){return this._registered},_getType:function(){return this._type},_getListenerID:function(){return this._listenerID},_setFixedPriority:function(e){this._fixedPriority=e},_getFixedPriority:function(){return this._fixedPriority},_setSceneGraphPriority:function(e){this._node=e},_getSceneGraphPriority:function(){return this._node},checkAvailable:function(){return this._onEvent!=null},clone:function(){return null},setEnabled:function(e){this._isEnabled=e},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,t){this._onCustomEvent=t;var n=this,r=function(e){n._onCustomEvent!=null&&n._onCustomEvent(e)};cc.EventListener.prototype.ctor.call(this,cc.EventListener.CUSTOM,e,r)},checkAvailable:function(){return cc.EventListener.prototype.checkAvailable.call(this)&&this._onCustomEvent!=null},clone:function(){return new cc._EventListenerCustom(this._listenerID,this._onCustomEvent)}}),cc._EventListenerCustom.create=function(e,t){return new cc._EventListenerCustom(e,t)},cc._EventListenerMouse=cc.EventListener.extend({onMouseDown:null,onMouseUp:null,onMouseMove:null,onMouseScroll:null,ctor:function(){var e=this,t=function(t){var n=cc.EventMouse;switch(t._eventType){case n.DOWN:e.onMouseDown&&e.onMouseDown(t);break;case n.UP:e.onMouseUp&&e.onMouseUp(t);break;case n.MOVE:e.onMouseMove&&e.onMouseMove(t);break;case n.SCROLL:e.onMouseScroll&&e.onMouseScroll(t);break;default:}};cc.EventListener.prototype.ctor.call(this,cc.EventListener.MOUSE,cc._EventListenerMouse.LISTENER_ID,t)},clone:function(){var e=new cc._EventListenerMouse;return e.onMouseDown=this.onMouseDown,e.onMouseUp=this.onMouseUp,e.onMouseMove=this.onMouseMove,e.onMouseScroll=this.onMouseScroll,e},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(e){this.swallowTouches=e},clone:function(){var e=new cc._EventListenerTouchOneByOne;return e.onTouchBegan=this.onTouchBegan,e.onTouchMoved=this.onTouchMoved,e.onTouchEnded=this.onTouchEnded,e.onTouchCancelled=this.onTouchCancelled,e.swallowTouches=this.swallowTouches,e},checkAvailable:function(){return this.onTouchBegan?!0:(cc.log(cc._LogInfos._EventListenerTouchOneByOne_checkAvailable),!1)}}),cc._EventListenerTouchOneByOne.LISTENER_ID="__cc_touch_one_by_one",cc._EventListenerTouchOneByOne.create=function(){return new cc._EventListenerTouchOneByOne},cc._EventListenerTouchAllAtOnce=cc.EventListener.extend({onTouchesBegan:null,onTouchesMoved:null,onTouchesEnded:null,onTouchesCancelled:null,ctor:function(){cc.EventListener.prototype.ctor.call(this,cc.EventListener.TOUCH_ALL_AT_ONCE,cc._EventListenerTouchAllAtOnce.LISTENER_ID,null)},clone:function(){var e=new cc._EventListenerTouchAllAtOnce;return e.onTouchesBegan=this.onTouchesBegan,e.onTouchesMoved=this.onTouchesMoved,e.onTouchesEnded=this.onTouchesEnded,e.onTouchesCancelled=this.onTouchesCancelled,e},checkAvailable:function(){return this.onTouchesBegan==null&&this.onTouchesMoved==null&&this.onTouchesEnded==null&&this.onTouchesCancelled==null?(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(e){cc.assert(e&&e.event,cc._LogInfos.EventListener_create);var t=e.event;delete e.event;var n=null;t===cc.EventListener.TOUCH_ONE_BY_ONE?n=new cc._EventListenerTouchOneByOne:t===cc.EventListener.TOUCH_ALL_AT_ONCE?n=new cc._EventListenerTouchAllAtOnce:t===cc.EventListener.MOUSE?n=new cc._EventListenerMouse:t===cc.EventListener.CUSTOM?(n=new cc._EventListenerCustom(e.eventName,e.callback),delete e.eventName,delete e.callback):t===cc.EventListener.KEYBOARD?n=new cc._EventListenerKeyboard:t===cc.EventListener.ACCELERATION&&(n=new cc._EventListenerAcceleration(e.callback),delete e.callback);for(var r in e)n[r]=e[r];return n},cc.copyArray=function(e){var t,n=e.length,r=new Array(n);for(t=0;t=0)break;++r}t.gt0Index=r},_sortListenersOfFixedPriorityAsc:function(e,t){return e._getFixedPriority()-t._getFixedPriority()},_onUpdateListeners:function(e){var t=this._listenersMap[e];if(!t)return;var n=t.getFixedPriorityListeners(),r=t.getSceneGraphPriorityListeners(),i,s;if(r)for(i=0;i0,cc._LogInfos.EventManager__updateListeners),e.getType()==cc.Event.TOUCH?(this._onUpdateListeners(cc._EventListenerTouchOneByOne.LISTENER_ID),this._onUpdateListeners(cc._EventListenerTouchAllAtOnce.LISTENER_ID)):this._onUpdateListeners(cc.__getListenerID(e));if(t>1)return;cc.assert(t==1,cc._LogInfos.EventManager__updateListeners_2);var n=this._listenersMap,r=this._priorityDirtyFlagMap;for(var i in n)n[i].empty()&&(delete r[i],delete n[i]);var s=this._toAddedListeners;if(s.length!==0){for(var o=0,u=s.length;o0&&(s=e._claimedTouches.indexOf(r))!=-1&&(i=!0,o===u.MOVED&&e.onTouchMoved?e.onTouchMoved(r,n):o===u.ENDED?(e.onTouchEnded&&e.onTouchEnded(r,n),e._registered&&e._claimedTouches.splice(s,1)):o===u.CANCELLED&&(e.onTouchCancelled&&e.onTouchCancelled(r,n),e._registered&&e._claimedTouches.splice(s,1))),n.isStopped()?(cc.eventManager._updateListeners(n),!0):i&&e._registered&&e.swallowTouches?(t.needsMutableSet&&t.touches.splice(r,1),!0):!1},_dispatchTouchEvent:function(e){this._sortEventListeners(cc._EventListenerTouchOneByOne.LISTENER_ID),this._sortEventListeners(cc._EventListenerTouchAllAtOnce.LISTENER_ID);var t=this._getListeners(cc._EventListenerTouchOneByOne.LISTENER_ID),n=this._getListeners(cc._EventListenerTouchAllAtOnce.LISTENER_ID);if(null==t&&null==n)return;var r=e.getTouches(),i=cc.copyArray(r),s={event:e,needsMutableSet:t&&n,touches:i,selTouch:null};if(t)for(var o=0;o0){this._dispatchEventToListeners(n,this._onTouchesEventCallback,{event:e,touches:i});if(e.isStopped())return}this._updateListeners(e)},_onTouchesEventCallback:function(e,t){if(!e._registered)return!1;var n=cc.EventTouch.EventCode,r=t.event,i=t.touches,s=r.getEventCode();return r._setCurrentTarget(e._node),s==n.BEGAN&&e.onTouchesBegan?e.onTouchesBegan(i,r):s==n.MOVED&&e.onTouchesMoved?e.onTouchesMoved(i,r):s==n.ENDED&&e.onTouchesEnded?e.onTouchesEnded(i,r):s==n.CANCELLED&&e.onTouchesCancelled&&e.onTouchesCancelled(i,r),r.isStopped()?(cc.eventManager._updateListeners(r),!0):!1},_associateNodeAndEventListener:function(e,t){var n=this._nodeListenersMap[e.__instanceId];n||(n=[],this._nodeListenersMap[e.__instanceId]=n),n.push(t)},_dissociateNodeAndEventListener:function(e,t){var n=this._nodeListenersMap[e.__instanceId];n&&(cc.arrayRemoveObject(n,t),n.length===0&&delete this._nodeListenersMap[e.__instanceId])},_dispatchEventToListeners:function(e,t,n){var r=!1,i=e.getFixedPriorityListeners(),s=e.getSceneGraphPriorityListeners(),o=0,u,a;if(i&&i.length!==0)for(;o0){var u;for(;r-1&&this._detachChild(e,t),this.setNodeDirty()},removeChildByTag:function(e,t){e===cc.NODE_TAG_INVALID&&cc.log(cc._LogInfos.Node_removeChildByTag);var n=this.getChildByTag(e);n==null?cc.log(cc._LogInfos.Node_removeChildByTag_2,e):this.removeChild(n,t)},removeAllChildrenWithCleanup:function(e){cc.log(cc._LogInfos.Node_removeAllChildrenWithCleanup),this.removeAllChildren(e)},removeAllChildren:function(e){var t=this._children;if(t!=null){e==null&&(e=!0);for(var n=0;n=0){if(i._localZOrder=0,cc._LogInfos.Node_schedule_2),n=n==null?cc.REPEAT_FOREVER:n,r=r||0,this.scheduler.scheduleCallbackForTarget(this,e,t,n,r,!this._running)},scheduleOnce:function(e,t){this.schedule(e,0,0,t)},unschedule:function(e){if(!e)return;this.scheduler.unscheduleCallbackForTarget(this,e)},unscheduleAllCallbacks:function(){this.scheduler.unscheduleAllCallbacksForTarget(this)},resumeSchedulerAndActions:function(){cc.log(cc._LogInfos.Node_resumeSchedulerAndActions),this.resume()},resume:function(){this.scheduler.resumeTarget(this),this.actionManager&&this.actionManager.resumeTarget(this),cc.eventManager.resumeTarget(this)},pauseSchedulerAndActions:function(){cc.log(cc._LogInfos.Node_pauseSchedulerAndActions),this.pause()},pause:function(){this.scheduler.pauseTarget(this),this.actionManager&&this.actionManager.pauseTarget(this),cc.eventManager.pauseTarget(this)},setAdditionalTransform:function(e){this._additionalTransform=e,this._transformDirty=!0,this._additionalTransformDirty=!0},parentToNodeTransform:function(){return this._inverseDirty&&(this._inverse=cc.affineTransformInvert(this.nodeToParentTransform()),this._inverseDirty=!1),this._inverse},nodeToWorldTransform:function(){var e=this.nodeToParentTransform();for(var t=this._parent;t!=null;t=t.parent)e=cc.affineTransformConcat(e,t.nodeToParentTransform());return e},worldToNodeTransform:function(){return cc.affineTransformInvert(this.nodeToWorldTransform())},convertToNodeSpace:function(e){return cc.pointApplyAffineTransform(e,this.worldToNodeTransform())},convertToWorldSpace:function(e){return e=e||cc.p(0,0),cc.pointApplyAffineTransform(e,this.nodeToWorldTransform())},convertToNodeSpaceAR:function(e){return cc.pSub(this.convertToNodeSpace(e),this._anchorPointInPoints)},convertToWorldSpaceAR:function(e){e=e||cc.p(0,0);var t=cc.pAdd(e,this._anchorPointInPoints);return this.convertToWorldSpace(t)},_convertToWindowSpace:function(e){var t=this.convertToWorldSpace(e);return cc.director.convertToUI(t)},convertTouchToNodeSpace:function(e){var t=e.getLocation();return this.convertToNodeSpace(t)},convertTouchToNodeSpaceAR:function(e){var t=e.getLocation();return t=cc.director.convertToGL(t),this.convertToNodeSpaceAR(t)},update:function(e){this._componentContainer&&!this._componentContainer.isEmpty()&&this._componentContainer.visit(e)},updateTransform:function(){this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.updateTransform)},retain:function(){},release:function(){},getComponent:function(e){return this._componentContainer.getComponent(e)},addComponent:function(e){this._componentContainer.add(e)},removeComponent:function(e){return this._componentContainer.remove(e)},removeAllComponents:function(){this._componentContainer.removeAll()},grid:null,ctor:null,visit:null,transform:null,nodeToParentTransform:null,_setNodeDirtyForCache:function(){if(this._cacheDirty===!1){this._cacheDirty=!0;var e=this._cachedParent;e&&e!=this&&e._setNodeDirtyForCache()}},_setCachedParent:function(e){if(this._cachedParent==e)return;this._cachedParent=e;var t=this._children;for(var n=0,r=t.length;n0){t.sortAllChildren();for(r=0;r-0.000001?1e-6:i,f=s<1e-6&&s>-0.000001?1e-6:s;if(e._skewX||e._skewY){var l=Math.tan(-e._skewX*Math.PI/180),c=Math.tan(-e._skewY*Math.PI/180);l===Infinity&&(l=99999999),c===Infinity&&(c=99999999);var h=u*l*a,p=o*c*f;t.a=n+ -r*c,t.b=n*l+ -r,t.c=r+n*c,t.d=r*l+n,t.tx+=n*h+ -r*p,t.ty+=r*h+n*p}if(i!==1||s!==1)t.a*=a,t.c*=a,t.b*=f,t.d*=f;t.tx+=n*-o*a+ -r*u*f,t.ty-=r*-o*a+n*u*f,e._ignoreAnchorPointForPosition&&(t.tx+=o,t.ty+=u),e._additionalTransformDirty&&(e._transform=cc.AffineTransformConcat(t,e._additionalTransform),e._additionalTransformDirty=!1),e._transformDirty=!1}return e._transform},_p=null,cc.assert(typeof cc._tmp.PrototypeCCNode=="function",cc._LogInfos.MissingFile,"BaseNodesPropertyDefine.js"),cc._tmp.PrototypeCCNode(),delete cc._tmp.PrototypeCCNode,cc.Node.ON_ENTER=0,cc.Node.ON_EXIT=1,cc.Node.ON_ENTER_TRANSITION_DID_FINISH=2,cc.Node.ON_EXIT_TRANSITOIN_DID_START=3,cc.Node.ON_CLEAN_UP=4,cc._tmp.PrototypeTexture2D=function(){var e=cc.Texture2D;e.PVRImagesHavePremultipliedAlpha=function(e){cc.PVRHaveAlphaPremultiplied_=e},e.PIXEL_FORMAT_RGBA8888=2,e.PIXEL_FORMAT_RGB888=3,e.PIXEL_FORMAT_RGB565=4,e.PIXEL_FORMAT_A8=5,e.PIXEL_FORMAT_I8=6,e.PIXEL_FORMAT_AI88=7,e.PIXEL_FORMAT_RGBA4444=8,e.PIXEL_FORMAT_RGB5A1=7,e.PIXEL_FORMAT_PVRTC4=9,e.PIXEL_FORMAT_PVRTC2=10,e.PIXEL_FORMAT_DEFAULT=e.PIXEL_FORMAT_RGBA8888;var t=cc.Texture2D._M={};t[e.PIXEL_FORMAT_RGBA8888]="RGBA8888",t[e.PIXEL_FORMAT_RGB888]="RGB888",t[e.PIXEL_FORMAT_RGB565]="RGB565",t[e.PIXEL_FORMAT_A8]="A8",t[e.PIXEL_FORMAT_I8]="I8",t[e.PIXEL_FORMAT_AI88]="AI88",t[e.PIXEL_FORMAT_RGBA4444]="RGBA4444",t[e.PIXEL_FORMAT_RGB5A1]="RGB5A1",t[e.PIXEL_FORMAT_PVRTC4]="PVRTC4",t[e.PIXEL_FORMAT_PVRTC2]="PVRTC2";var n=cc.Texture2D._B={};n[e.PIXEL_FORMAT_RGBA8888]=32,n[e.PIXEL_FORMAT_RGB888]=24,n[e.PIXEL_FORMAT_RGB565]=16,n[e.PIXEL_FORMAT_A8]=8,n[e.PIXEL_FORMAT_I8]=8,n[e.PIXEL_FORMAT_AI88]=16,n[e.PIXEL_FORMAT_RGBA4444]=16,n[e.PIXEL_FORMAT_RGB5A1]=16,n[e.PIXEL_FORMAT_PVRTC4]=4,n[e.PIXEL_FORMAT_PVRTC2]=3;var r=cc.Texture2D.prototype;r.name,cc.defineGetterSetter(r,"name",r.getName),r.pixelFormat,cc.defineGetterSetter(r,"pixelFormat",r.getPixelFormat),r.pixelsWidth,cc.defineGetterSetter(r,"pixelsWidth",r.getPixelsWide),r.pixelsHeight,cc.defineGetterSetter(r,"pixelsHeight",r.getPixelsHigh),r.width,cc.defineGetterSetter(r,"width",r._getWidth),r.height,cc.defineGetterSetter(r,"height",r._getHeight),e.defaultPixelFormat=e.PIXEL_FORMAT_DEFAULT},cc._tmp.PrototypeTextureAtlas=function(){var e=cc.TextureAtlas.prototype;e.totalQuads,cc.defineGetterSetter(e,"totalQuads",e.getTotalQuads),e.capacity,cc.defineGetterSetter(e,"capacity",e.getCapacity),e.quads,cc.defineGetterSetter(e,"quads",e.getQuads,e.setQuads)},cc.ALIGN_CENTER=51,cc.ALIGN_TOP=19,cc.ALIGN_TOP_RIGHT=18,cc.ALIGN_RIGHT=50,cc.ALIGN_BOTTOM_RIGHT=34,cc.ALIGN_BOTTOM=35,cc.ALIGN_BOTTOM_LEFT=33,cc.ALIGN_LEFT=49,cc.ALIGN_TOP_LEFT=17,cc.PVRHaveAlphaPremultiplied_=!1,cc.Texture2D=cc.Class.extend({_contentSize:null,_isLoaded:!1,_htmlElementObj:null,_loadedEventListeners:null,url:null,ctor:function(){this._contentSize=cc.size(0,0),this._isLoaded=!1,this._htmlElementObj=null},getPixelsWide:function(){return this._contentSize.width},getPixelsHigh:function(){return this._contentSize.height},getContentSize:function(){var e=cc.contentScaleFactor();return cc.size(this._contentSize.width/e,this._contentSize.height/e)},_getWidth:function(){return this._contentSize.width/cc.contentScaleFactor()},_getHeight:function(){return this._contentSize.height/cc.contentScaleFactor()},getContentSizeInPixels:function(){return this._contentSize},initWithElement:function(e){if(!e)return;this._htmlElementObj=e},getHtmlElementObj:function(){return this._htmlElementObj},isLoaded:function(){return this._isLoaded},handleLoadedTexture:function(){var e=this;if(e._isLoaded)return;if(!e._htmlElementObj){var t=cc.loader.getRes(e.url);if(!t)return;e.initWithElement(t)}e._isLoaded=!0;var n=e._htmlElementObj;e._contentSize.width=n.width,e._contentSize.height=n.height,e._callLoadedEventCallbacks()},description:function(){return""},initWithData:function(e,t,n,r,i){return!1},initWithImage:function(e){return!1},initWithString:function(e,t,n,r,i,s){return!1},releaseTexture:function(){},getName:function(){return null},getMaxS:function(){return 1},setMaxS:function(e){},getMaxT:function(){return 1},setMaxT:function(e){},getPixelFormat:function(){return null},getShaderProgram:function(){return null},setShaderProgram:function(e){},hasPremultipliedAlpha:function(){return!1},hasMipmaps:function(){return!1},releaseData:function(e){e=null},keepData:function(e,t){return e},drawAtPoint:function(e){},drawInRect:function(e){},initWithETCFile:function(e){return cc.log(cc._LogInfos.Texture2D_initWithETCFile),!1},initWithPVRFile:function(e){return cc.log(cc._LogInfos.Texture2D_initWithPVRFile),!1},initWithPVRTCData:function(e,t,n,r,i,s){return cc.log(cc._LogInfos.Texture2D_initWithPVRTCData),!1},setTexParameters:function(e){},setAntiAliasTexParameters:function(){},setAliasTexParameters:function(){},generateMipmap:function(){},stringForFormat:function(){return""},bitsPerPixelForFormat:function(e){return-1},addLoadedEventListener:function(e,t){this._loadedEventListeners||(this._loadedEventListeners=[]),this._loadedEventListeners.push({eventCallback:e,eventTarget:t})},removeLoadedEventListener:function(e){if(!this._loadedEventListeners)return;var t=this._loadedEventListeners;for(var n=0;n"},textureForKey:function(e){return this._textures[e]||this._textures[cc.loader._aliases[e]]},getKeyByTexture:function(e){for(var t in this._textures)if(this._textures[t]==e)return t;return null},_generalTextureKey:function(){return this._textureKeySeq++,"_textureKey_"+this._textureKeySeq},getTextureColors:function(e){var t=this.getKeyByTexture(e);return t||(e instanceof HTMLImageElement?t=e.src:t=this._generalTextureKey()),this._textureColorsCache[t]||(this._textureColorsCache[t]=cc.generateTextureCacheForColor(e)),this._textureColorsCache[t]},addPVRImage:function(e){cc.log(cc._LogInfos.textureCache_addPVRImage)},removeAllTextures:function(){var e=this._textures;for(var t in e)e[t]&&e[t].releaseTexture();this._textures={}},removeTexture:function(e){if(!e)return;var t=this._textures;for(var n in t)t[n]==e&&(t[n].releaseTexture(),delete t[n])},removeTextureForKey:function(e){if(e==null)return;this._textures[e]&&delete this._textures[e]},cacheImage:function(e,t){if(t instanceof cc.Texture2D){this._textures[e]=t;return}var n=new cc.Texture2D;n.initWithElement(t),n.handleLoadedTexture(),this._textures[e]=n},addUIImage:function(e,t){cc.assert(e,cc._LogInfos.textureCache_addUIImage_2);if(t&&this._textures[t])return this._textures[t];var n=new cc.Texture2D;return n.initWithImage(e),t!=null&&n!=null?this._textures[t]=n:cc.log(cc._LogInfos.textureCache_addUIImage),n},_clear:function(){this._textures={},this._textureColorsCache={},this._textureKeySeq=0|Math.random()*1e3,this._loadedTexturesBefore={}}};var _p=cc.textureCache;_p.handleLoadedTexture=function(e){var t=this._textures,n=t[e];n||(n=t[e]=new cc.Texture2D,n.url=e),n.handleLoadedTexture()},_p.addImage=function(e,t,n){cc.assert(e,cc._LogInfos.Texture2D_addImage);var r=this._textures,i=r[e]||r[cc.loader._aliases[e]];return i?(t&&t.call(n),i):(i=r[e]=new cc.Texture2D,i.url=e,cc.loader.getRes(e)?i.handleLoadedTexture():cc.loader._checkIsImageURL(e)?cc.loader.load(e,function(e){t&&t.call(n)}):cc.loader.cache[e]=cc.loader.loadImg(e,function(n,r){if(n)return t?t(n):n;cc.textureCache.handleLoadedTexture(e),t&&t(null,r)}),i)},_p=null,cc.Scene=cc.Node.extend({_className:"Scene",ctor:function(){cc.Node.prototype.ctor.call(this),this._ignoreAnchorPointForPosition=!0,this.setAnchorPoint(.5,.5),this.setContentSize(cc.director.getWinSize())}}),cc.Scene.create=function(){return new cc.Scene},cc.LoaderScene=cc.Scene.extend({_interval:null,_length:0,_count:0,_label:null,_className:"LoaderScene",init:function(){var e=this,t=160,n=200,r=e._bgLayer=cc.LayerColor.create(cc.color(255,255,255,1));r.setPosition(cc.visibleRect.bottomLeft),e.addChild(r,0);var i=24,s=-n/2+100;cc._loaderImage&&(cc.loader.loadImg(cc._loaderImage,{isCrossOrigin:!1},function(r,i){t=i.width,n=i.height,e._initStage(i,cc.visibleRect.center)}),i=14,s=-n/2-10);var o=e._label=cc.LabelTTF.create("Loading... 0%","Arial",i);return o.setPosition(cc.pAdd(cc.visibleRect.center,cc.p(0,s))),o.setColor(cc.color(180,180,180)),r.addChild(this._label,10),!0},_initStage:function(e,t){var n=this,r=n._texture2d=new cc.Texture2D;r.initWithElement(e),r.handleLoadedTexture();var i=n._logo=cc.Sprite.create(r);i.setScale(cc.contentScaleFactor()),i.x=t.x,i.y=t.y,n._bgLayer.addChild(i,10)},onEnter:function(){var e=this;cc.Node.prototype.onEnter.call(e),e.schedule(e._startLoading,.3)},onExit:function(){cc.Node.prototype.onExit.call(this);var e="Loading... 0%";this._label.setString(e)},initWithResources:function(e,t){typeof e=="string"&&(e=[e]),this.resources=e||[],this.cb=t},_startLoading:function(){var e=this;e.unschedule(e._startLoading);var t=e.resources;e._length=t.length,e._count=0,cc.loader.load(t,function(t,n){e._count=n},function(){e.cb&&e.cb()}),e.schedule(e._updatePercent)},_updatePercent:function(){var e=this,t=e._count,n=e._length,r=t/n*100|0;r=Math.min(r,100),e._label.setString("Loading... "+r+"%"),t>=n&&e.unschedule(e._updatePercent)}}),cc.LoaderScene.preload=function(e,t){var n=cc;return n.loaderScene||(n.loaderScene=new cc.LoaderScene,n.loaderScene.init()),n.loaderScene.initWithResources(e,t),cc.director.runScene(n.loaderScene),n.loaderScene},cc._tmp.PrototypeLayerColor=function(){var e=cc.LayerColor.prototype;cc.defineGetterSetter(e,"width",e._getWidth,e._setWidth),cc.defineGetterSetter(e,"height",e._getHeight,e._setHeight)},cc._tmp.PrototypeLayerGradient=function(){var e=cc.LayerGradient.prototype;e.startColor,cc.defineGetterSetter(e,"startColor",e.getStartColor,e.setStartColor),e.endColor,cc.defineGetterSetter(e,"endColor",e.getEndColor,e.setEndColor),e.startOpacity,cc.defineGetterSetter(e,"startOpacity",e.getStartOpacity,e.setStartOpacity),e.endOpacity,cc.defineGetterSetter(e,"endOpacity",e.getEndOpacity,e.setEndOpacity),e.vector,cc.defineGetterSetter(e,"vector",e.getVector,e.setVector)},cc.Layer=cc.Node.extend({_isBaked:!1,_bakeSprite:null,_className:"Layer",ctor:function(){var e=cc.Node.prototype;e.ctor.call(this),this._ignoreAnchorPointForPosition=!0,e.setAnchorPoint.call(this,.5,.5),e.setContentSize.call(this,cc.winSize)},init:function(){var e=this;return e._ignoreAnchorPointForPosition=!0,e.setAnchorPoint(.5,.5),e.setContentSize(cc.winSize),e.cascadeOpacity=!1,e.cascadeColor=!1,!0},bake:null,unbake:null,isBaked:function(){return this._isBaked},visit:null}),cc.Layer.create=function(){return new cc.Layer};var p=cc.Layer.prototype;p.bake=function(){if(!this._isBaked){this._isBaked=this._cacheDirty=!0,this._cachedParent=this;var e=this._children;for(var t=0,n=e.length;t0){r.sortAllChildren();for(n=0;n0&&e[e.length-1]==null&&cc.log(cc._LogInfos.LayerMultiplex_initWithLayers),this._layers=e,this._enabledLayer=0,this.addChild(this._layers[this._enabledLayer]),!0},switchTo:function(e){if(e>=this._layers.length){cc.log(cc._LogInfos.LayerMultiplex_switchTo);return}this.removeChild(this._layers[this._enabledLayer],!0),this._enabledLayer=e,this.addChild(this._layers[e])},switchToAndReleaseMe:function(e){if(e>=this._layers.length){cc.log(cc._LogInfos.LayerMultiplex_switchToAndReleaseMe);return}this.removeChild(this._layers[this._enabledLayer],!0),this._layers[this._enabledLayer]=null,this._enabledLayer=e,this.addChild(this._layers[e])},addLayer:function(e){if(!e){cc.log(cc._LogInfos.LayerMultiplex_addLayer);return}this._layers.push(e)}}),cc.LayerMultiplex.create=function(){return new cc.LayerMultiplex(Array.prototype.slice.call(arguments))},cc._tmp.PrototypeSprite=function(){var e=cc.Sprite.prototype;cc.defineGetterSetter(e,"opacityModifyRGB",e.isOpacityModifyRGB,e.setOpacityModifyRGB),cc.defineGetterSetter(e,"opacity",e.getOpacity,e.setOpacity),cc.defineGetterSetter(e,"color",e.getColor,e.setColor),e.dirty,e.flippedX,cc.defineGetterSetter(e,"flippedX",e.isFlippedX,e.setFlippedX),e.flippedY,cc.defineGetterSetter(e,"flippedY",e.isFlippedY,e.setFlippedY),e.offsetX,cc.defineGetterSetter(e,"offsetX",e._getOffsetX),e.offsetY,cc.defineGetterSetter(e,"offsetY",e._getOffsetY),e.atlasIndex,e.texture,cc.defineGetterSetter(e,"texture",e.getTexture,e.setTexture),e.textureRectRotated,cc.defineGetterSetter(e,"textureRectRotated",e.isTextureRectRotated),e.textureAtlas,e.batchNode,cc.defineGetterSetter(e,"batchNode",e.getBatchNode,e.setBatchNode),e.quad,cc.defineGetterSetter(e,"quad",e.getQuad)},cc.generateTintImageWithMultiply=function(e,t,n,r){r=r||cc.newElement("canvas"),n=n||cc.rect(0,0,e.width,e.height);var i=r.getContext("2d");return r.width!=n.width||r.height!=n.height?(r.width=n.width,r.height=n.height):i.globalCompositeOperation="source-over",i.fillStyle="rgb("+t.r+","+t.g+","+t.b+")",i.fillRect(0,0,n.width,n.height),i.globalCompositeOperation="multiply",i.drawImage(e,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.globalCompositeOperation="destination-atop",i.drawImage(e,n.x,n.y,n.width,n.height,0,0,n.width,n.height),r},cc.generateTintImage=function(e,t,n,r,i){r||(r=cc.rect(0,0,e.width,e.height));var s=n.r/255,o=n.g/255,u=n.b/255,a=Math.min(r.width,t[0].width),f=Math.min(r.height,t[0].height),l=i,c;l?(c=l.getContext("2d"),c.clearRect(0,0,a,f)):(l=cc.newElement("canvas"),l.width=a,l.height=f,c=l.getContext("2d")),c.save(),c.globalCompositeOperation="lighter";var h=c.globalAlpha;return s>0&&(c.globalAlpha=s*h,c.drawImage(t[0],r.x,r.y,a,f,0,0,a,f)),o>0&&(c.globalAlpha=o*h,c.drawImage(t[1],r.x,r.y,a,f,0,0,a,f)),u>0&&(c.globalAlpha=u*h,c.drawImage(t[2],r.x,r.y,a,f,0,0,a,f)),s+o+u<1&&(c.globalAlpha=h,c.drawImage(t[3],r.x,r.y,a,f,0,0,a,f)),c.restore(),l},cc.generateTextureCacheForColor=function(e){function n(){var n=cc.generateTextureCacheForColor,r=e.width,i=e.height;t[0].width=r,t[0].height=i,t[1].width=r,t[1].height=i,t[2].width=r,t[2].height=i,t[3].width=r,t[3].height=i,n.canvas.width=r,n.canvas.height=i;var s=n.canvas.getContext("2d");s.drawImage(e,0,0),n.tempCanvas.width=r,n.tempCanvas.height=i;var o=s.getImageData(0,0,r,i).data;for(var u=0;u<4;u++){var a=t[u].getContext("2d");a.getImageData(0,0,r,i).data,n.tempCtx.drawImage(e,0,0);var f=n.tempCtx.getImageData(0,0,r,i),l=f.data;for(var c=0;c=0){if(i._localZOrder0?e.initWithFile(arguments[0],arguments[1]):(cc.Node.prototype.init.call(e),e.dirty=e._recursiveDirty=!1,e._opacityModifyRGB=!0,e._blendFunc.src=cc.BLEND_SRC,e._blendFunc.dst=cc.BLEND_DST,e.texture=null,e._textureLoaded=!0,e._flippedX=e._flippedY=!1,e.anchorX=.5,e.anchorY=.5,e._offsetPosition.x=0,e._offsetPosition.y=0,e._hasChildren=!1,e.setTextureRect(cc.rect(0,0,0,0),!1,cc.size(0,0)),!0)},_p.initWithTexture=function(e,t,n){var r=this;cc.assert(arguments.length!=0,cc._LogInfos.CCSpriteBatchNode_initWithTexture),n=n||!1;if(n&&e.isLoaded()){var i=e.getHtmlElementObj();i=cc.cutRotateImageToCanvas(i,t);var s=new cc.Texture2D;s.initWithElement(i),s.handleLoadedTexture(),e=s,r._rect=cc.rect(0,0,t.width,t.height)}if(!cc.Node.prototype.init.call(r))return!1;r._batchNode=null,r._recursiveDirty=!1,r.dirty=!1,r._opacityModifyRGB=!0,r._blendFunc.src=cc.BLEND_SRC,r._blendFunc.dst=cc.BLEND_DST,r._flippedX=r._flippedY=!1,r.anchorX=.5,r.anchorY=.5,r._offsetPosition.x=0,r._offsetPosition.y=0,r._hasChildren=!1;var o=e.isLoaded();r._textureLoaded=o;if(!o)return r._rectRotated=n,t&&(r._rect.x=t.x,r._rect.y=t.y,r._rect.width=t.width,r._rect.height=t.height),e.addLoadedEventListener(r._textureLoadedCallback,r),!0;t||(t=cc.rect(0,0,e.width,e.height));if(e&&e.url){var u=t.x+t.width,a=t.y+t.height;u>e.width&&cc.error(cc._LogInfos.RectWidth,e.url),a>e.height&&cc.error(cc._LogInfos.RectHeight,e.url)}return r._originalTexture=e,r.texture=e,r.setTextureRect(t,n),r.batchNode=null,!0},_p._textureLoadedCallback=function(e){var t=this;if(t._textureLoaded)return;t._textureLoaded=!0;var n=t._rect;n?cc._rectEqualToZero(n)&&(n.width=e.width,n.height=e.height):n=cc.rect(0,0,e.width,e.height),t._originalTexture=e,t.texture=e,t.setTextureRect(n,t._rectRotated),t.batchNode=t._batchNode,t._callLoadedEventCallbacks()},_p.setTextureRect=function(e,t,n){var r=this;r._rectRotated=t||!1,r.setContentSize(n||e),r.setVertexRect(e);var i=r._textureRect_Canvas,s=cc.contentScaleFactor();i.x=0|e.x*s,i.y=0|e.y*s,i.width=0|e.width*s,i.height=0|e.height*s,i.validRect=!(i.width===0||i.height===0||i.x<0||i.y<0);var o=r._unflippedOffsetPositionFromCenter;r._flippedX&&(o.x=-o.x),r._flippedY&&(o.y=-o.y),r._offsetPosition.x=o.x+(r._contentSize.width-r._rect.width)/2,r._offsetPosition.y=o.y+(r._contentSize.height-r._rect.height)/2,r._batchNode&&(r.dirty=!0)},_p.updateTransform=function(){var e=this;if(e.dirty){var t=e._parent;!e._visible||t&&t!=e._batchNode&&t._shouldBeHidden?e._shouldBeHidden=!0:(e._shouldBeHidden=!1,!t||t==e._batchNode?e._transformToBatch=e.nodeToParentTransform():e._transformToBatch=cc.affineTransformConcat(e.nodeToParentTransform(),t._transformToBatch)),e._recursiveDirty=!1,e.dirty=!1}e._hasChildren&&e._arrayMakeObjectsPerformSelector(e._children,cc.Node.StateCallbackType.updateTransform)},_p.addChild=function(e,t,n){cc.assert(e,cc._LogInfos.CCSpriteBatchNode_addChild_2),t==null&&(t=e._localZOrder),n==null&&(n=e.tag),cc.Node.prototype.addChild.call(this,e,t,n),this._hasChildren=!0},_p.setOpacity=function(e){cc.Node.prototype.setOpacity.call(this,e),this._setNodeDirtyForCache()},_p.setColor=function(e){var t=this,n=t.color;if(n.r===e.r&&n.g===e.g&&n.b===e.b)return;cc.Node.prototype.setColor.call(t,e)},_p.updateDisplayedColor=function(e){var t=this;cc.Node.prototype.updateDisplayedColor.call(t,e),t._changeTextureColor(),t._setNodeDirtyForCache()},_p.setSpriteFrame=function(e){var t=this;typeof e=="string"&&(e=cc.spriteFrameCache.getSpriteFrame(e),cc.assert(e,cc._LogInfos.CCSpriteBatchNode_setSpriteFrame)),t.setNodeDirty(!0);var n=e.getOffset();t._unflippedOffsetPositionFromCenter.x=n.x,t._unflippedOffsetPositionFromCenter.y=n.y,t._rectRotated=e.isRotated();var r=e.getTexture(),i=e.textureLoaded();i||(t._textureLoaded=!1,e.addLoadedEventListener(function(e){t._textureLoaded=!0;var n=e.getTexture();n!=t._texture&&(t.texture=n),t.setTextureRect(e.getRect(),e.isRotated(),e.getOriginalSize()),t._callLoadedEventCallbacks()},t)),r!=t._texture&&(t.texture=r),t._rectRotated&&(t._originalTexture=r),t.setTextureRect(e.getRect(),t._rectRotated,e.getOriginalSize()),t._colorized=!1;if(i){var s=t.color;(s.r!==255||s.g!==255||s.b!==255)&&t._changeTextureColor()}},_p.isFrameDisplayed=function(e){return e.getTexture()!=this._texture?!1:cc.rectEqualToRect(e.getRect(),this._rect)},_p.setBatchNode=function(e){var t=this;t._batchNode=e,t._batchNode?(t._transformToBatch=cc.affineTransformIdentity(),t.textureAtlas=t._batchNode.textureAtlas):(t.atlasIndex=cc.Sprite.INDEX_NOT_INITIALIZED,t.textureAtlas=null,t._recursiveDirty=!1,t.dirty=!1)},_p.setTexture=function(e){var t=this;if(e&&typeof e=="string"){e=cc.textureCache.addImage(e),t.setTexture(e);var n=e.getContentSize();t.setTextureRect(cc.rect(0,0,n.width,n.height));return}cc.assert(!e||e instanceof cc.Texture2D,cc._LogInfos.CCSpriteBatchNode_setTexture),t._texture!=e&&(e&&e.getHtmlElementObj()instanceof HTMLImageElement&&(t._originalTexture=e),t._texture=e)},_p.draw=function(e){var t=this;if(!t._textureLoaded)return;var n=e||cc._renderContext;t._isLighterMode&&(n.globalCompositeOperation="lighter");var r=cc.view.getScaleX(),i=cc.view.getScaleY();n.globalAlpha=t._displayedOpacity/255;var s=t._rect,o=t._contentSize,u=t._offsetPosition,a=t._drawSize_Canvas,f=0|u.x,l=-u.y-s.height,c=t._textureRect_Canvas;a.width=s.width*r,a.height=s.height*i;if(t._flippedX||t._flippedY)n.save(),t._flippedX&&(f=-u.x-s.width,n.scale(-1,1)),t._flippedY&&(l=u.y,n.scale(1,-1));f*=r,l*=i;if(t._texture&&c.validRect){var h=t._texture.getHtmlElementObj();t._colorized?n.drawImage(h,0,0,c.width,c.height,f,l,a.width,a.height):n.drawImage(h,c.x,c.y,c.width,c.height,f,l,a.width,a.height)}else if(!t._texture&&c.validRect){var p=t.color;n.fillStyle="rgba("+p.r+","+p.g+","+p.b+",1)",n.fillRect(f,l,o.width*r,o.height*i)}(t._flippedX||t._flippedY)&&n.restore(),cc.g_NumberOfDraws++},cc.sys._supportCanvasNewBlendModes||(_p._changeTextureColor=function(){var e,t=this._texture,n=this._textureRect_Canvas;if(t&&n.validRect&&this._originalTexture){e=t.getHtmlElementObj();if(!e)return;var r=cc.textureCache.getTextureColors(this._originalTexture.getHtmlElementObj());r&&(this._colorized=!0,e instanceof HTMLCanvasElement&&!this._rectRotated&&!this._newTextureWhenChangeColor?cc.generateTintImage(e,r,this._displayedColor,n,e):(e=cc.generateTintImage(e,r,this._displayedColor,n),t=new cc.Texture2D,t.initWithElement(e),t.handleLoadedTexture(),this.texture=t))}}),delete _p,cc.assert(typeof cc._tmp.PrototypeSprite=="function",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,t,n){this._spriteFrame=e||null,this._delayPerUnit=t||0,this._userInfo=n||null},clone:function(){var e=new cc.AnimationFrame;return e.initWithSpriteFrame(this._spriteFrame.clone(),this._delayPerUnit,this._userInfo),e},copyWithZone:function(e){return cc.clone(this)},copy:function(e){var t=new cc.AnimationFrame;return t.initWithSpriteFrame(this._spriteFrame.clone(),this._delayPerUnit,this._userInfo),t},initWithSpriteFrame:function(e,t,n){return this._spriteFrame=e,this._delayPerUnit=t,this._userInfo=n,!0},getSpriteFrame:function(){return this._spriteFrame},setSpriteFrame:function(e){this._spriteFrame=e},getDelayUnits:function(){return this._delayPerUnit},setDelayUnits:function(e){this._delayPerUnit=e},getUserInfo:function(){return this._userInfo},setUserInfo:function(e){this._userInfo=e}}),cc.AnimationFrame.create=function(e,t,n){return new cc.AnimationFrame(e,t,n)},cc.Animation=cc.Class.extend({_frames:null,_loops:0,_restoreOriginalFrame:!1,_duration:0,_delayPerUnit:0,_totalDelayUnits:0,ctor:function(e,t,n){this._frames=[];if(e===undefined)this.initWithSpriteFrames(null,0);else{var r=e[0];r&&(r instanceof cc.SpriteFrame?this.initWithSpriteFrames(e,t,n):r instanceof cc.AnimationFrame&&this.initWithAnimationFrames(e,t,n))}},getFrames:function(){return this._frames},setFrames:function(e){this._frames=e},addSpriteFrame:function(e){var t=new cc.AnimationFrame;t.initWithSpriteFrame(e,1,null),this._frames.push(t),this._totalDelayUnits++},addSpriteFrameWithFile:function(e){var t=cc.textureCache.addImage(e),n=cc.rect(0,0,0,0);n.width=t.width,n.height=t.height;var r=cc.SpriteFrame.create(t,n);this.addSpriteFrame(r)},addSpriteFrameWithTexture:function(e,t){var n=cc.SpriteFrame.create(e,t);this.addSpriteFrame(n)},initWithAnimationFrames:function(e,t,n){cc.arrayVerifyType(e,cc.AnimationFrame),this._delayPerUnit=t,this._loops=n===undefined?1:n,this._totalDelayUnits=0;var r=this._frames;r.length=0;for(var i=0;ie.width&&cc.error(cc._LogInfos.RectWidth,e.url),o>e.height&&cc.error(cc._LogInfos.RectHeight,e.url)}return this._rectInPixels=t,this._rect=cc.rectPixelsToPoints(t),this._offsetInPixels.x=r.x,this._offsetInPixels.y=r.y,cc._pointPixelsToPointsOut(r,this._offset),this._originalSizeInPixels.width=i.width,this._originalSizeInPixels.height=i.height,cc._sizePixelsToPointsOut(i,this._originalSize),this._rotated=n,!0}}),cc.SpriteFrame.create=function(e,t,n,r,i){return new cc.SpriteFrame(e,t,n,r,i)},cc.SpriteFrame._frameWithTextureForCanvas=function(e,t,n,r,i){var s=new cc.SpriteFrame;return s._texture=e,s._rectInPixels=t,s._rect=cc.rectPixelsToPoints(t),s._offsetInPixels.x=r.x,s._offsetInPixels.y=r.y,cc._pointPixelsToPointsOut(s._offsetInPixels,s._offset),s._originalSizeInPixels.width=i.width,s._originalSizeInPixels.height=i.height,cc._sizePixelsToPointsOut(s._originalSizeInPixels,s._originalSize),s._rotated=n,s},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(e){var t=this._CCNS_REG2.exec(e);return t?cc.rect(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3]),parseFloat(t[4])):cc.rect(0,0,0,0)},_pointFromString:function(e){var t=this._CCNS_REG1.exec(e);return t?cc.p(parseFloat(t[1]),parseFloat(t[2])):cc.p(0,0)},_sizeFromString:function(e){var t=this._CCNS_REG1.exec(e);return t?cc.size(parseFloat(t[1]),parseFloat(t[2])):cc.size(0,0)},_getFrameConfig:function(e){var t=cc.loader.getRes(e);cc.assert(t,cc._LogInfos.spriteFrameCache__getFrameConfig_2,e),cc.loader.release(e);if(t._inited)return this._frameConfigCache[e]=t,t;var n=t.frames,r=t.metadata||t.meta,i={},s={},o=0;if(r){var u=r.format;o=u.length<=1?parseInt(u):u,s.image=r.textureFileName||r.textureFileName||r.image}for(var a in n){var f=n[a];if(!f)continue;var l={};if(o==0){l.rect=cc.rect(f.x,f.y,f.width,f.height),l.rotated=!1,l.offset=cc.p(f.offsetX,f.offsetY);var c=f.originalWidth,h=f.originalHeight;(!c||!h)&&cc.log(cc._LogInfos.spriteFrameCache__getFrameConfig),c=Math.abs(c),h=Math.abs(h),l.size=cc.size(c,h)}else if(o==1||o==2)l.rect=this._rectFromString(f.frame),l.rotated=f.rotated||!1,l.offset=this._pointFromString(f.offset),l.size=this._sizeFromString(f.sourceSize);else if(o==3){var p=this._sizeFromString(f.spriteSize),d=this._rectFromString(f.textureRect);p&&(d=cc.rect(d.x,d.y,p.width,p.height)),l.rect=d,l.rotated=f.textureRotated||!1,l.offset=this._pointFromString(f.spriteOffset),l.size=this._sizeFromString(f.spriteSourceSize),l.aliases=f.aliases}else{var v=f.frame,m=f.sourceSize;a=f.filename||a,l.rect=cc.rect(v.x,v.y,v.w,v.h),l.rotated=f.rotated||!1,l.offset=cc.p(0,0),l.size=cc.size(m.w,m.h)}i[a]=l}var g=this._frameConfigCache[e]={_inited:!0,frames:i,meta:s};return g},addSpriteFrames:function(e,t){cc.assert(e,cc._LogInfos.spriteFrameCache_addSpriteFrames_2);var n=this._frameConfigCache[e]||cc.loader.getRes(e);if(!n||!n.frames)return;var r=this,i=r._frameConfigCache[e]||r._getFrameConfig(e),s=i.frames,o=i.meta;if(!t){var u=cc.path.changeBasename(e,o.image||".png");t=cc.textureCache.addImage(u)}else t instanceof cc.Texture2D||(typeof t=="string"?t=cc.textureCache.addImage(t):cc.assert(0,cc._LogInfos.spriteFrameCache_addSpriteFrames_3));var a=r._spriteFramesAliases,f=r._spriteFrames;for(var l in s){var c=s[l],h=f[l];if(!h){h=cc.SpriteFrame.create(t,c.rect,c.rotated,c.offset,c.size);var p=c.aliases;if(p)for(var d=0,v=p.length;dcc.DIRECTOR_FPS_INTERVAL&&(this._SPFLabel.string=this._secondsPerFrame.toFixed(3),this._frameRate=this._frames/this._accumDt,this._frames=0,this._accumDt=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(e){this._displayStats=e},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(e){cc.assert(this._runningScene,cc._LogInfos.Director_popToSceneStackLevel_2);var t=this._scenesStack,n=t.length;if(n==0){this.end();return}if(e>n)return;while(n>e){var r=t.pop();r.running&&(r.onExitTransitionDidStart(),r.onExit()),r.cleanup(),n--}this._nextScene=t[t.length-1],this._sendCleanupToScene=!1},getScheduler:function(){return this._scheduler},setScheduler:function(e){this._scheduler!=e&&(this._scheduler=e)},getActionManager:function(){return this._actionManager},setActionManager:function(e){this._actionManager!=e&&(this._actionManager=e)},getDeltaTime:function(){return this._deltaTime},_createStatsLabel:null,_calculateMPF:function(){var e=Date.now();this._secondsPerFrame=(e-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(e){this._animationInterval=e,this.invalid||(this.stopAnimation(),this.startAnimation())}}),cc.Director.sharedDirector=null,cc.Director.firstUseDirector=!0,cc.Director._getInstance=function(){return cc.Director.firstUseDirector&&(cc.Director.firstUseDirector=!1,cc.Director.sharedDirector=new cc.DisplayLinkDirector,cc.Director.sharedDirector.init()),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;var _p=cc.Director.prototype;_p.setProjection=function(e){this._projection=e,cc.eventManager.dispatchEvent(this._eventProjectionChanged)},_p.setDepthTest=function(){},_p.setOpenGLView=function(e){this._winSizeInPoints.width=cc._canvas.width,this._winSizeInPoints.height=cc._canvas.height,this._openGLView=e||cc.view,cc.eventManager&&cc.eventManager.setEnabled(!0)},_p._clear=function(){var e=this._openGLView.getViewPortRect();cc._renderContext.clearRect(-e.x,e.y,e.width,-e.height)},_p._createStatsLabel=function(){var e=this,t=0;e._winSizeInPoints.width>e._winSizeInPoints.height?t=0|e._winSizeInPoints.height/320*24:t=0|e._winSizeInPoints.width/320*24,e._FPSLabel=cc.LabelTTF.create("000.0","Arial",t),e._SPFLabel=cc.LabelTTF.create("0.000","Arial",t),e._drawsLabel=cc.LabelTTF.create("0000","Arial",t);var n=cc.DIRECTOR_STATS_POSITION;e._drawsLabel.setPosition(e._drawsLabel.width/2+n.x,e._drawsLabel.height*5/2+n.y),e._SPFLabel.setPosition(e._SPFLabel.width/2+n.x,e._SPFLabel.height*3/2+n.y),e._FPSLabel.setPosition(e._FPSLabel.width/2+n.x,e._FPSLabel.height/2+n.y)},_p.getVisibleSize=function(){return this.getWinSize()},_p.getVisibleOrigin=function(){return cc.p(0,0)},cc.PRIORITY_NON_SYSTEM=cc.PRIORITY_SYSTEM+1,cc.arrayVerifyType=function(e,t){if(e&&e.length>0)for(var n=0;n0,s._repeat=r==null?cc.REPEAT_FOREVER:r,s._runForever=s._repeat==cc.REPEAT_FOREVER},_doCallback:function(){var e=this;typeof e._callback=="string"?e._target[e._callback](e._elapsed):e._callback.call(e._target,e._elapsed)},update:function(e){var t=this;if(t._elapsed==-1)t._elapsed=0,t._timesExecuted=0;else{var n=t._target,r=t._callback;t._elapsed+=e,t._runForever&&!t._useDelay?t._elapsed>=t._interval&&(n&&r&&t._doCallback(),t._elapsed=0):(t._useDelay?t._elapsed>=t._delay&&(n&&r&&t._doCallback(),t._elapsed=t._elapsed-t._delay,t._timesExecuted+=1,t._useDelay=!1):t._elapsed>=t._interval&&(n&&r&&t._doCallback(),t._elapsed=0,t._timesExecuted+=1),t._timesExecuted>t._repeat&&cc.director.getScheduler().unscheduleCallbackForTarget(n,r))}}}),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(){var e=this;e._timeScale=1,e._updates=[[],[],[]],e._hashForUpdates={},e._arrayForUpdates=[],e._hashForTimers={},e._arrayForTimers=[],e._currentTarget=null,e._currentTargetSalvaged=!1,e._updateHashLocked=!1},_removeHashElement:function(e){delete this._hashForTimers[e.target.__instanceId],cc.arrayRemoveObject(this._arrayForTimers,e),e.Timer=null,e.target=null,e=null},_removeUpdateFromHash:function(e){var t=this,n=t._hashForUpdates[e.target.__instanceId];n&&(cc.arrayRemoveObject(n.list,n.entry),delete t._hashForUpdates[n.target.__instanceId],cc.arrayRemoveObject(t._arrayForUpdates,n),n.entry=null,n.target=null)},_priorityIn:function(e,t,n,r){var i=this,s=new cc.ListEntry(null,null,t,n,r,!1);if(!e)e=[],e.push(s);else{var o=e.length-1;for(var u=0;u<=o;u++)if(n=0;o++){var a=t._updates[o];for(var f=0,l=a.length;f=s&&r.timerIndex--,i.length==0&&(n._currentTarget==r?n._currentTargetSalvaged=!0:n._removeHashElement(r));return}}}},unscheduleUpdateForTarget:function(e){if(e==null)return;var t=this,n=t._hashForUpdates[e.__instanceId];n!=null&&(t._updateHashLocked?n.entry.markedForDeletion=!0:t._removeUpdateFromHash(n.entry))},unscheduleAllCallbacksForTarget:function(e){if(e==null)return;var t=this,n=t._hashForTimers[e.__instanceId];if(n){var r=n.timers;!n.currentTimerSalvaged&&r.indexOf(n.currentTimer)>=0&&(n.currentTimerSalvaged=!0),r.length=0,t._currentTarget==n?t._currentTargetSalvaged=!0:t._removeHashElement(n)}t.unscheduleUpdateForTarget(e)},unscheduleAllCallbacks:function(){this.unscheduleAllCallbacksWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM)},unscheduleAllCallbacksWithMinPriority:function(e){var t=this,n=t._arrayForTimers,r=t._updates;for(var i=0,s=n.length;i=0;i--){if(i==1&&e>0||i==0&&e>=0)continue;var o=r[i];for(var u=0,a=o.length;u=i&&i>0)return i+1;if(nt){u!=-1&&(s=!0);break}u=a,p=e.substr(a)}if(s)return u;p=e.substr(0,r),u=r;while(f=c.exec(p)){u=f[1].length,p=f[1],o=this._measure(p);if(o"},setColor:null,_setColorsString:null,updateDisplayedColor:null,setOpacity:null,updateDisplayedOpacity:null,updateDisplayedOpacityForCanvas:function(e){cc.Node.prototype.updateDisplayedOpacity.call(this,e),this._setColorsString()},getString:function(){return this._string},getHorizontalAlignment:function(){return this._hAlignment},getVerticalAlignment:function(){return this._vAlignment},getDimensions:function(){return cc.size(this._dimensions)},getFontSize:function(){return this._fontSize},getFontName:function(){return this._fontName},initWithString:function(e,t,n,r,i,s){var o;return e?o=e+"":o="",n=n||16,r=r||cc.size(0,n),i=i||cc.TEXT_ALIGNMENT_LEFT,s=s||cc.VERTICAL_TEXT_ALIGNMENT_TOP,this._opacityModifyRGB=!1,this._dimensions=cc.size(r.width,r.height),this._fontName=t||"Arial",this._hAlignment=i,this._vAlignment=s,this._fontSize=n,this._fontStyleStr=this._fontSize+"px '"+t+"'",this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(t,this._fontSize),this.string=o,this._setColorsString(),this._updateTexture(),this._needUpdateTexture=!1,!0},initWithStringAndTextDefinition:null,setTextDefinition:function(e){e&&this._updateWithTextDefinition(e,!0)},getTextDefinition:function(){return this._prepareTextDefinition(!1)},enableShadow:function(e,t,n,r){n=n||.5,!1===this._shadowEnabled&&(this._shadowEnabled=!0);var i=this._shadowOffset;if(i&&i.x!=e||i._y!=t)i.x=e,i.y=t;this._shadowOpacity!=n&&(this._shadowOpacity=n),this._setColorsString(),this._shadowBlur!=r&&(this._shadowBlur=r),this._needUpdateTexture=!0},_getShadowOffsetX:function(){return this._shadowOffset.x},_setShadowOffsetX:function(e){!1===this._shadowEnabled&&(this._shadowEnabled=!0),this._shadowOffset.x!=e&&(this._shadowOffset.x=e,this._needUpdateTexture=!0)},_getShadowOffsetY:function(){return this._shadowOffset._y},_setShadowOffsetY:function(e){!1===this._shadowEnabled&&(this._shadowEnabled=!0),this._shadowOffset._y!=e&&(this._shadowOffset._y=e,this._needUpdateTexture=!0)},_getShadowOffset:function(){return cc.p(this._shadowOffset.x,this._shadowOffset.y)},_setShadowOffset:function(e){!1===this._shadowEnabled&&(this._shadowEnabled=!0);if(this._shadowOffset.x!=e.x||this._shadowOffset.y!=e.y)this._shadowOffset.x=e.x,this._shadowOffset.y=e.y,this._needUpdateTexture=!0},_getShadowOpacity:function(){return this._shadowOpacity},_setShadowOpacity:function(e){!1===this._shadowEnabled&&(this._shadowEnabled=!0),this._shadowOpacity!=e&&(this._shadowOpacity=e,this._setColorsString(),this._needUpdateTexture=!0)},_getShadowBlur:function(){return this._shadowBlur},_setShadowBlur:function(e){!1===this._shadowEnabled&&(this._shadowEnabled=!0),this._shadowBlur!=e&&(this._shadowBlur=e,this._needUpdateTexture=!0)},disableShadow:function(){this._shadowEnabled&&(this._shadowEnabled=!1,this._needUpdateTexture=!0)},enableStroke:function(e,t){this._strokeEnabled===!1&&(this._strokeEnabled=!0);var n=this._strokeColor;if(n.r!==e.r||n.g!==e.g||n.b!==e.b)n.r=e.r,n.g=e.g,n.b=e.b,this._setColorsString();this._strokeSize!==t&&(this._strokeSize=t||0),this._needUpdateTexture=!0},_getStrokeStyle:function(){return this._strokeColor},_setStrokeStyle:function(e){this._strokeEnabled===!1&&(this._strokeEnabled=!0);var t=this._strokeColor;if(t.r!==e.r||t.g!==e.g||t.b!==e.b)t.r=e.r,t.g=e.g,t.b=e.b,this._setColorsString(),this._needUpdateTexture=!0},_getLineWidth:function(){return this._strokeSize},_setLineWidth:function(e){this._strokeEnabled===!1&&(this._strokeEnabled=!0),this._strokeSize!==e&&(this._strokeSize=e||0,this._needUpdateTexture=!0)},disableStroke:function(){this._strokeEnabled&&(this._strokeEnabled=!1,this._needUpdateTexture=!0)},setFontFillColor:null,_getFillStyle:function(){return this._textFillColor},_updateWithTextDefinition:function(e,t){e.fontDimensions?(this._dimensions.width=e.boundingWidth,this._dimensions.height=e.boundingHeight):(this._dimensions.width=0,this._dimensions.height=0),this._hAlignment=e.textAlign,this._vAlignment=e.verticalAlign,this._fontName=e.fontName,this._fontSize=e.fontSize||12,this._fontStyleStr=this._fontSize+"px '"+this._fontName+"'",this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(this._fontName,this._fontSize),e.shadowEnabled&&this.enableShadow(e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity,e.shadowBlur),e.strokeEnabled&&this.enableStroke(e.strokeStyle,e.lineWidth),this.setFontFillColor(e.fillStyle),t&&this._updateTexture()},_prepareTextDefinition:function(e){var t=new cc.FontDefinition;e?(t.fontSize=this._fontSize,t.boundingWidth=cc.contentScaleFactor()*this._dimensions.width,t.boundingHeight=cc.contentScaleFactor()*this._dimensions.height):(t.fontSize=this._fontSize,t.boundingWidth=this._dimensions.width,t.boundingHeight=this._dimensions.height),t.fontName=this._fontName,t.textAlign=this._hAlignment,t.verticalAlign=this._vAlignment;if(this._strokeEnabled){t.strokeEnabled=!0;var n=this._strokeColor;t.strokeStyle=cc.color(n.r,n.g,n.b),t.lineWidth=this._strokeSize}else t.strokeEnabled=!1;this._shadowEnabled?(t.shadowEnabled=!0,t.shadowBlur=this._shadowBlur,t.shadowOpacity=this._shadowOpacity,t.shadowOffsetX=(e?cc.contentScaleFactor():1)*this._shadowOffset.x,t.shadowOffsetY=(e?cc.contentScaleFactor():1)*this._shadowOffset.y):t._shadowEnabled=!1;var r=this._textFillColor;return t.fillStyle=cc.color(r.r,r.g,r.b),t},_fontClientHeight:18,setString:function(e){e=String(e),this._originalText!=e&&(this._originalText=e+"",this._updateString(),this._needUpdateTexture=!0)},_updateString:function(){this._string=this._originalText},setHorizontalAlignment:function(e){e!==this._hAlignment&&(this._hAlignment=e,this._needUpdateTexture=!0)},setVerticalAlignment:function(e){e!=this._vAlignment&&(this._vAlignment=e,this._needUpdateTexture=!0)},setDimensions:function(e,t){var n;t===undefined?(n=e.width,t=e.height):n=e;if(n!=this._dimensions.width||t!=this._dimensions .height)this._dimensions.width=n,this._dimensions.height=t,this._updateString(),this._needUpdateTexture=!0},_getBoundingWidth:function(){return this._dimensions.width},_setBoundingWidth:function(e){e!=this._dimensions.width&&(this._dimensions.width=e,this._updateString(),this._needUpdateTexture=!0)},_getBoundingHeight:function(){return this._dimensions.height},_setBoundingHeight:function(e){e!=this._dimensions.height&&(this._dimensions.height=e,this._updateString(),this._needUpdateTexture=!0)},setFontSize:function(e){this._fontSize!==e&&(this._fontSize=e,this._fontStyleStr=e+"px '"+this._fontName+"'",this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(this._fontName,e),this._needUpdateTexture=!0)},setFontName:function(e){this._fontName&&this._fontName!=e&&(this._fontName=e,this._fontStyleStr=this._fontSize+"px '"+e+"'",this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(e,this._fontSize),this._needUpdateTexture=!0)},_getFont:function(){return this._fontStyleStr},_setFont:function(e){var t=cc.LabelTTF._fontStyleRE.exec(e);t&&(this._fontSize=parseInt(t[1]),this._fontName=t[2],this._fontStyleStr=e,this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(this._fontName,this._fontSize),this._needUpdateTexture=!0)},_drawTTFInCanvas:function(e){if(!e)return;var t=this._strokeShadowOffsetX,n=this._strokeShadowOffsetY,r=this._contentSize.height-n,i=this._vAlignment,s=this._hAlignment,o=this._fontClientHeight,u=this._strokeSize;e.setTransform(1,0,0,1,0+t*.5,r+n*.5),e.font!=this._fontStyleStr&&(e.font=this._fontStyleStr),e.fillStyle=this._fillColorStr;var a=0,f=0,l=this._strokeEnabled;l&&(e.lineWidth=u*2,e.strokeStyle=this._strokeColorStr);if(this._shadowEnabled){var c=this._shadowOffset;e.shadowColor=this._shadowColorStr,e.shadowOffsetX=c.x,e.shadowOffsetY=-c.y,e.shadowBlur=this._shadowBlur}e.textBaseline=cc.LabelTTF._textBaseline[i],e.textAlign=cc.LabelTTF._textAlign[s];var h=this._contentSize.width-t;s===cc.TEXT_ALIGNMENT_RIGHT?a+=h:s===cc.TEXT_ALIGNMENT_CENTER?a+=h/2:a+=0;if(this._isMultiLine){var p=this._strings.length;i===cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM?f=o+r-o*p:i===cc.VERTICAL_TEXT_ALIGNMENT_CENTER&&(f=o/2+(r-o*p)/2);for(var d=0;d0&&(this._isMultiLine=!0);var u,a=0,f=0;this._strokeEnabled&&(a=f=this._strokeSize*2);if(this._shadowEnabled){var l=this._shadowOffset;a+=Math.abs(l.x)*2,f+=Math.abs(l.y)*2}e===0?this._isMultiLine?u=cc.size(0|Math.max.apply(Math,r)+a,0|this._fontClientHeight*this._strings.length+f):u=cc.size(0|this._measure(this._string)+a,0|this._fontClientHeight+f):this._dimensions.height===0?this._isMultiLine?u=cc.size(0|e+a,0|this._fontClientHeight*this._strings.length+f):u=cc.size(0|e+a,0|this._fontClientHeight+f):u=cc.size(0|e+a,0|this._dimensions.height+f),this.setContentSize(u),this._strokeShadowOffsetX=a,this._strokeShadowOffsetY=f;var c=this._anchorPoint;this._anchorPointInPoints.x=a*.5+(u.width-a)*c.x,this._anchorPointInPoints.y=f*.5+(u.height-f)*c.y},getContentSize:function(){return this._needUpdateTexture&&this._updateTTF(),cc.Sprite.prototype.getContentSize.call(this)},_getWidth:function(){return this._needUpdateTexture&&this._updateTTF(),cc.Sprite.prototype._getWidth.call(this)},_getHeight:function(){return this._needUpdateTexture&&this._updateTTF(),cc.Sprite.prototype._getHeight.call(this)},_updateTexture:function(){var e=this._getLabelContext(),t=this._labelCanvas,n=this._contentSize;if(this._string.length===0)return t.width=1,t.height=n.height,this.setTextureRect(cc.rect(0,0,1,n.height)),!0;e.font=this._fontStyleStr,this._updateTTF();var r=n.width,i=n.height,s=t.width==r&&t.height==i;return t.width=r,t.height=i,s&&e.clearRect(0,0,r,i),this._drawTTFInCanvas(e),this._texture&&this._texture.handleLoadedTexture(),this.setTextureRect(cc.rect(0,0,r,i)),!0},visit:function(e){if(!this._string||this._string=="")return;this._needUpdateTexture&&(this._needUpdateTexture=!1,this._updateTexture());var t=e||cc._renderContext;cc.Sprite.prototype.visit.call(this,t)},draw:null,_setTextureCoords:function(e){var t=this._batchNode?this.textureAtlas.texture:this._texture;if(!t)return;var n=t.pixelsWidth,r=t.pixelsHeight,i,s,o,u,a,f=this._quad;this._rectRotated?(cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?(i=(2*e.x+1)/(2*n),s=i+(e.height*2-2)/(2*n),o=(2*e.y+1)/(2*r),u=o+(e.width*2-2)/(2*r)):(i=e.x/n,s=(e.x+e.height)/n,o=e.y/r,u=(e.y+e.width)/r),this._flippedX&&(a=o,o=u,u=a),this._flippedY&&(a=i,i=s,s=a),f.bl.texCoords.u=i,f.bl.texCoords.v=o,f.br.texCoords.u=i,f.br.texCoords.v=u,f.tl.texCoords.u=s,f.tl.texCoords.v=o,f.tr.texCoords.u=s,f.tr.texCoords.v=u):(cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?(i=(2*e.x+1)/(2*n),s=i+(e.width*2-2)/(2*n),o=(2*e.y+1)/(2*r),u=o+(e.height*2-2)/(2*r)):(i=e.x/n,s=(e.x+e.width)/n,o=e.y/r,u=(e.y+e.height)/r),this._flippedX&&(a=i,i=s,s=a),this._flippedY&&(a=o,o=u,u=a),f.bl.texCoords.u=i,f.bl.texCoords.v=u,f.br.texCoords.u=s,f.br.texCoords.v=u,f.tl.texCoords.u=i,f.tl.texCoords.v=o,f.tr.texCoords.u=s,f.tr.texCoords.v=o),this._quadDirty=!0}});var _p=cc.LabelTTF.prototype;_p.setColor=function(e){cc.Node.prototype.setColor.call(this,e),this._setColorsString()},_p._setColorsString=function(){this._needUpdateTexture=!0;var e=this._displayedColor,t=this._displayedOpacity,n=this._strokeColor,r=this._textFillColor;this._shadowColorStr="rgba("+(0|e.r*.5)+","+(0|e.g*.5)+","+(0|e.b*.5)+","+this._shadowOpacity+")",this._fillColorStr="rgba("+(0|e.r/255*r.r)+","+(0|e.g/255*r.g)+","+(0|e.b/255*r.b)+", "+t/255+")",this._strokeColorStr="rgba("+(0|e.r/255*n.r)+","+(0|e.g/255*n.g)+","+(0|e.b/255*n.b)+", "+t/255+")"},_p.updateDisplayedColor=function(e){cc.Node.prototype.updateDisplayedColor.call(this,e),this._setColorsString()},_p.setOpacity=function(e){if(this._opacity===e)return;cc.Sprite.prototype.setOpacity.call(this,e),this._setColorsString(),this._needUpdateTexture=!0},_p.updateDisplayedOpacity=cc.Sprite.prototype.updateDisplayedOpacity,_p.initWithStringAndTextDefinition=function(e,t){return this._updateWithTextDefinition(t,!1),this.string=e,!0},_p.setFontFillColor=function(e){var t=this._textFillColor;if(t.r!=e.r||t.g!=e.g||t.b!=e.b)t.r=e.r,t.g=e.g,t.b=e.b,this._setColorsString(),this._needUpdateTexture=!0},_p.draw=cc.Sprite.prototype.draw,_p.setTextureRect=function(e,t,n){this._rectRotated=t||!1,n=n||e,this.setContentSize(n),this.setVertexRect(e);var r=this._textureRect_Canvas;r.x=e.x,r.y=e.y,r.width=e.width,r.height=e.height,r.validRect=!(r.width===0||r.height===0||r.x<0||r.y<0);var i=this._unflippedOffsetPositionFromCenter;this._flippedX&&(i.x=-i.x),this._flippedY&&(i.y=-i.y),this._offsetPosition.x=i.x+(this._contentSize.width-this._rect.width)/2,this._offsetPosition.y=i.y+(this._contentSize.height-this._rect.height)/2,this._batchNode&&(this.dirty=!0)},_p=null,cc.assert(typeof cc._tmp.PrototypeLabelTTF=="function",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(e,t,n,r,i,s){return new cc.LabelTTF(e,t,n,r,i,s)},cc.USE_LA88_LABELS?cc.LabelTTF._SHADER_PROGRAM=cc.SHADER_POSITION_TEXTURECOLOR:cc.LabelTTF._SHADER_PROGRAM=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(e,t){var n=cc.LabelTTF.__fontHeightCache[e+"."+t];if(n>0)return n;var r=cc.LabelTTF.__labelHeightDiv;return r.innerHTML="ajghl~!",r.style.fontFamily=e,r.style.fontSize=t+"px",n=r.clientHeight,cc.LabelTTF.__fontHeightCache[e+"."+t]=n,r.innerHTML="",n},cc.LabelTTF.__fontHeightCache={},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,t){for(var n=0;n=e&&t.actionIndex--,t.actions.length==0&&(this._currentTarget==t?this._currentTargetSalvaged=!0:this._deleteHashElement(t))},_deleteHashElement:function(e){e&&(delete this._hashTargets[e.target.__instanceId],cc.arrayRemoveObject(this._arrayTargets,e),e.actions=null,e.target=null)},_actionAllocWithHashElement:function(e){e.actions==null&&(e.actions=[])},update:function(e){var t=this._arrayTargets,n;for(var r=0;r=this._duration},_cloneDecoration:function(e){e._repeatForever=this._repeatForever,e._speed=this._speed,e._times=this._times,e._easeList=this._easeList,e._speedMethod=this._speedMethod,e._repeatMethod=this._repeatMethod},_reverseEaseList:function(e){if(this._easeList){e._easeList=[];for(var t=0;t1.192092896e-7?this._duration:1.192092896e-7);t=1>t?t:1,this.update(t>0?t:0),this._repeatMethod&&this._times>1&&this.isDone()&&(this._repeatForever||this._times--,this.startWithTarget(this.target),this.step(this._elapsed-this._duration))},startWithTarget:function(e){cc.Action.prototype.startWithTarget.call(this,e),this._elapsed=0,this._firstTick=!0},reverse:function(){return cc.log("cc.IntervalAction: reverse not implemented."),null},setAmplitudeRate:function(e){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(e){return e<=0?(cc.log("The speed parameter error"),this):(this._speedMethod=!0,this._speed*=e,this)},getSpeed:function(){return this._speed},setSpeed:function(e){return this._speed=e,this},repeat:function(e){return e=Math.round(e),isNaN(e)||e<1?(cc.log("The repeat parameter error"),this):(this._repeatMethod=!0,this._times*=e,this)},repeatForever:function(){return this._repeatMethod=!0,this._times=this.MAX_VALUE,this._repeatForever=!0,this}}),cc.ActionInterval.create=function(e){return new cc.ActionInterval(e)},cc.Sequence=cc.ActionInterval.extend({_actions:null,_split:null,_last:0,ctor:function(e){cc.ActionInterval.prototype.ctor.call(this),this._actions=[];var t=e instanceof Array?e:arguments,n=t.length-1;n>=0&&t[n]==null&&cc.log("parameters should not be ending with null in Javascript");if(n>=0){var r=t[0],i;for(var s=1;s0&&t[t.length-1]==null&&cc.log("parameters should not be ending with null in Javascript");var n=t[0];for(var r=1;r=i){while(e>i&&this._total=1&&this._total=0&&t[n]==null&&cc.log("parameters should not be ending with null in Javascript");if(n>=0){var r=t[0],i;for(var s=1;si?this._two=cc.Sequence._actionOneTwo(t,cc.DelayTime.create(r-i)):r0&&t[t.length-1]==null&&cc.log("parameters should not be ending with null in Javascript");var n=t[0];for(var r=1;r180&&(n-=360),n<-180&&(n+=360),this._startAngleX=t,this._diffAngleX=n,this._startAngleY=e.rotationY%360;var r=this._dstAngleY-this._startAngleY;r>180&&(r-=360),r<-180&&(r+=360),this._diffAngleY=r},reverse:function(){cc.log("cc.RotateTo.reverse(): it should be overridden in subclass.")},update:function(e){e=this._computeEaseTime(e),this.target&&(this.target.rotationX=this._startAngleX+this._diffAngleX*e,this.target.rotationY=this._startAngleY+this._diffAngleY*e)}}),cc.RotateTo.create=function(e,t,n){return new cc.RotateTo(e,t,n)},cc.RotateBy=cc.ActionInterval.extend({_angleX:0,_startAngleX:0,_angleY:0,_startAngleY:0,ctor:function(e,t,n){cc.ActionInterval.prototype.ctor.call(this),t!==undefined&&this.initWithDuration(e,t,n)},initWithDuration:function(e,t,n){return cc.ActionInterval.prototype.initWithDuration.call(this,e)?(this._angleX=t||0,this._angleY=n||this._angleX,!0):!1},clone:function(){var e=new cc.RotateBy;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._angleX,this._angleY),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e),this._startAngleX=e.rotationX,this._startAngleY=e.rotationY},update:function(e){e=this._computeEaseTime(e),this.target&&(this.target.rotationX=this._startAngleX+this._angleX*e,this.target.rotationY=this._startAngleY+this._angleY*e)},reverse:function(){var e=cc.RotateBy.create(this._duration,-this._angleX,-this._angleY);return this._cloneDecoration(e),this._reverseEaseList(e),e}}),cc.RotateBy.create=function(e,t,n){return new cc.RotateBy(e,t,n)},cc.MoveBy=cc.ActionInterval.extend({_positionDelta:null,_startPosition:null,_previousPosition:null,ctor:function(e,t,n){cc.ActionInterval.prototype.ctor.call(this),this._positionDelta=cc.p(0,0),this._startPosition=cc.p(0,0),this._previousPosition=cc.p(0,0),t!==undefined&&this.initWithDuration(e,t,n)},initWithDuration:function(e,t,n){return cc.ActionInterval.prototype.initWithDuration.call(this,e)?(t.x!==undefined&&(n=t.y,t=t.x),this._positionDelta.x=t,this._positionDelta.y=n,!0):!1},clone:function(){var e=new cc.MoveBy;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._positionDelta),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e);var t=e.getPositionX(),n=e.getPositionY();this._previousPosition.x=t,this._previousPosition.y=n,this._startPosition.x=t,this._startPosition.y=n},update:function(e){e=this._computeEaseTime(e);if(this.target){var t=this._positionDelta.x*e,n=this._positionDelta.y*e,r=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var i=this.target.getPositionX(),s=this.target.getPositionY(),o=this._previousPosition;r.x=r.x+i-o.x,r.y=r.y+s-o.y,t+=r.x,n+=r.y,o.x=t,o.y=n,this.target.setPosition(t,n)}else this.target.setPosition(r.x+t,r.y+n)}},reverse:function(){var e=cc.MoveBy.create(this._duration,cc.p(-this._positionDelta.x,-this._positionDelta.y));return this._cloneDecoration(e),this._reverseEaseList(e),e}}),cc.MoveBy.create=function(e,t,n){return new cc.MoveBy(e,t,n)},cc.MoveTo=cc.MoveBy.extend({_endPosition:null,ctor:function(e,t,n){cc.MoveBy.prototype.ctor.call(this),this._endPosition=cc.p(0,0),t!==undefined&&this.initWithDuration(e,t,n)},initWithDuration:function(e,t,n){return cc.MoveBy.prototype.initWithDuration.call(this,e,t,n)?(t.x!==undefined&&(n=t.y,t=t.x),this._endPosition.x=t,this._endPosition.y=n,!0):!1},clone:function(){var e=new cc.MoveTo;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._endPosition),e},startWithTarget:function(e){cc.MoveBy.prototype.startWithTarget.call(this,e),this._positionDelta.x=this._endPosition.x-e.getPositionX(),this._positionDelta.y=this._endPosition.y-e.getPositionY()}}),cc.MoveTo.create=function(e,t,n){return new cc.MoveTo(e,t,n)},cc.SkewTo=cc.ActionInterval.extend({_skewX:0,_skewY:0,_startSkewX:0,_startSkewY:0,_endSkewX:0,_endSkewY:0,_deltaX:0,_deltaY:0,ctor:function(e,t,n){cc.ActionInterval.prototype.ctor.call(this),n!==undefined&&this.initWithDuration(e,t,n)},initWithDuration:function(e,t,n){var r=!1;return cc.ActionInterval.prototype.initWithDuration.call(this,e)&&(this._endSkewX=t,this._endSkewY=n,r=!0),r},clone:function(){var e=new cc.SkewTo;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._endSkewX,this._endSkewY),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e),this._startSkewX=e.skewX%180,this._deltaX=this._endSkewX-this._startSkewX,this._deltaX>180&&(this._deltaX-=360),this._deltaX<-180&&(this._deltaX+=360),this._startSkewY=e.skewY%360,this._deltaY=this._endSkewY-this._startSkewY,this._deltaY>180&&(this._deltaY-=360),this._deltaY<-180&&(this._deltaY+=360)},update:function(e){e=this._computeEaseTime(e),this.target.skewX=this._startSkewX+this._deltaX*e,this.target.skewY=this._startSkewY+this._deltaY*e}}),cc.SkewTo.create=function(e,t,n){return new cc.SkewTo(e,t,n)},cc.SkewBy=cc.SkewTo.extend({ctor:function(e,t,n){cc.SkewTo.prototype.ctor.call(this),n!== undefined&&this.initWithDuration(e,t,n)},initWithDuration:function(e,t,n){var r=!1;return cc.SkewTo.prototype.initWithDuration.call(this,e,t,n)&&(this._skewX=t,this._skewY=n,r=!0),r},clone:function(){var e=new cc.SkewBy;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._skewX,this._skewY),e},startWithTarget:function(e){cc.SkewTo.prototype.startWithTarget.call(this,e),this._deltaX=this._skewX,this._deltaY=this._skewY,this._endSkewX=this._startSkewX+this._deltaX,this._endSkewY=this._startSkewY+this._deltaY},reverse:function(){var e=cc.SkewBy.create(this._duration,-this._skewX,-this._skewY);return this._cloneDecoration(e),this._reverseEaseList(e),e}}),cc.SkewBy.create=function(e,t,n){return new cc.SkewBy(e,t,n)},cc.JumpBy=cc.ActionInterval.extend({_startPosition:null,_delta:null,_height:0,_jumps:0,_previousPosition:null,ctor:function(e,t,n,r,i){cc.ActionInterval.prototype.ctor.call(this),this._startPosition=cc.p(0,0),this._previousPosition=cc.p(0,0),this._delta=cc.p(0,0),r!==undefined&&this.initWithDuration(e,t,n,r,i)},initWithDuration:function(e,t,n,r,i){return cc.ActionInterval.prototype.initWithDuration.call(this,e)?(i===undefined&&(i=r,r=n,n=t.y,t=t.x),this._delta.x=t,this._delta.y=n,this._height=r,this._jumps=i,!0):!1},clone:function(){var e=new cc.JumpBy;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._delta,this._height,this._jumps),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e);var t=e.getPositionX(),n=e.getPositionY();this._previousPosition.x=t,this._previousPosition.y=n,this._startPosition.x=t,this._startPosition.y=n},update:function(e){e=this._computeEaseTime(e);if(this.target){var t=e*this._jumps%1,n=this._height*4*t*(1-t);n+=this._delta.y*e;var r=this._delta.x*e,i=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var s=this.target.getPositionX(),o=this.target.getPositionY(),u=this._previousPosition;i.x=i.x+s-u.x,i.y=i.y+o-u.y,r+=i.x,n+=i.y,u.x=r,u.y=n,this.target.setPosition(r,n)}else this.target.setPosition(i.x+r,i.y+n)}},reverse:function(){var e=cc.JumpBy.create(this._duration,cc.p(-this._delta.x,-this._delta.y),this._height,this._jumps);return this._cloneDecoration(e),this._reverseEaseList(e),e}}),cc.JumpBy.create=function(e,t,n,r,i){return new cc.JumpBy(e,t,n,r,i)},cc.JumpTo=cc.JumpBy.extend({_endPosition:null,ctor:function(e,t,n,r,i){cc.JumpBy.prototype.ctor.call(this),this._endPosition=cc.p(0,0),r!==undefined&&this.initWithDuration(e,t,n,r,i)},initWithDuration:function(e,t,n,r,i){return cc.JumpBy.prototype.initWithDuration.call(this,e,t,n,r,i)?(i===undefined&&(n=t.y,t=t.x),this._endPosition.x=t,this._endPosition.y=n,!0):!1},startWithTarget:function(e){cc.JumpBy.prototype.startWithTarget.call(this,e),this._delta.x=this._endPosition.x-this._startPosition.x,this._delta.y=this._endPosition.y-this._startPosition.y},clone:function(){var e=new cc.JumpTo;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._endPosition,this._height,this._jumps),e}}),cc.JumpTo.create=function(e,t,n,r,i){return new cc.JumpTo(e,t,n,r,i)},cc.bezierAt=function(e,t,n,r,i){return Math.pow(1-i,3)*e+3*i*Math.pow(1-i,2)*t+3*Math.pow(i,2)*(1-i)*n+Math.pow(i,3)*r},cc.BezierBy=cc.ActionInterval.extend({_config:null,_startPosition:null,_previousPosition:null,ctor:function(e,t){cc.ActionInterval.prototype.ctor.call(this),this._config=[],this._startPosition=cc.p(0,0),this._previousPosition=cc.p(0,0),t&&this.initWithDuration(e,t)},initWithDuration:function(e,t){return cc.ActionInterval.prototype.initWithDuration.call(this,e)?(this._config=t,!0):!1},clone:function(){var e=new cc.BezierBy;this._cloneDecoration(e);var t=[];for(var n=0;nt/2}},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e),this._originalState=e.visible},stop:function(){this.target.visible=this._originalState,cc.ActionInterval.prototype.stop.call(this)},reverse:function(){var e=cc.Blink.create(this._duration,this._times);return this._cloneDecoration(e),this._reverseEaseList(e),e}}),cc.Blink.create=function(e,t){return new cc.Blink(e,t)},cc.FadeTo=cc.ActionInterval.extend({_toOpacity:0,_fromOpacity:0,ctor:function(e,t){cc.ActionInterval.prototype.ctor.call(this),t!==undefined&&this.initWithDuration(e,t)},initWithDuration:function(e,t){return cc.ActionInterval.prototype.initWithDuration.call(this,e)?(this._toOpacity=t,!0):!1},clone:function(){var e=new cc.FadeTo;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._toOpacity),e},update:function(e){e=this._computeEaseTime(e);var t=this._fromOpacity!==undefined?this._fromOpacity:255;this.target.opacity=t+(this._toOpacity-t)*e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e),this._fromOpacity=e.opacity}}),cc.FadeTo.create=function(e,t){return new cc.FadeTo(e,t)},cc.FadeIn=cc.FadeTo.extend({_reverseAction:null,ctor:function(e){cc.FadeTo.prototype.ctor.call(this),e&&this.initWithDuration(e,255)},reverse:function(){var e=new cc.FadeOut;return e.initWithDuration(this._duration,0),this._cloneDecoration(e),this._reverseEaseList(e),e},clone:function(){var e=new cc.FadeIn;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._toOpacity),e},startWithTarget:function(e){this._reverseAction&&(this._toOpacity=this._reverseAction._fromOpacity),cc.FadeTo.prototype.startWithTarget.call(this,e)}}),cc.FadeIn.create=function(e){return new cc.FadeIn(e)},cc.FadeOut=cc.FadeTo.extend({ctor:function(e){cc.FadeTo.prototype.ctor.call(this),e&&this.initWithDuration(e,0)},reverse:function(){var e=new cc.FadeIn;return e._reverseAction=this,e.initWithDuration(this._duration,255),this._cloneDecoration(e),this._reverseEaseList(e),e},clone:function(){var e=new cc.FadeOut;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._toOpacity),e}}),cc.FadeOut.create=function(e){return new cc.FadeOut(e)},cc.TintTo=cc.ActionInterval.extend({_to:null,_from:null,ctor:function(e,t,n,r){cc.ActionInterval.prototype.ctor.call(this),this._to=cc.color(0,0,0),this._from=cc.color(0,0,0),r!==undefined&&this.initWithDuration(e,t,n,r)},initWithDuration:function(e,t,n,r){return cc.ActionInterval.prototype.initWithDuration.call(this,e)?(this._to=cc.color(t,n,r),!0):!1},clone:function(){var e=new cc.TintTo;this._cloneDecoration(e);var t=this._to;return e.initWithDuration(this._duration,t.r,t.g,t.b),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e),this._from=this.target.color},update:function(e){e=this._computeEaseTime(e);var t=this._from,n=this._to;t&&(this.target.color=cc.color(t.r+(n.r-t.r)*e,t.g+(n.g-t.g)*e,t.b+(n.b-t.b)*e))}}),cc.TintTo.create=function(e,t,n,r){return new cc.TintTo(e,t,n,r)},cc.TintBy=cc.ActionInterval.extend({_deltaR:0,_deltaG:0,_deltaB:0,_fromR:0,_fromG:0,_fromB:0,ctor:function(e,t,n,r){cc.ActionInterval.prototype.ctor.call(this),r!==undefined&&this.initWithDuration(e,t,n,r)},initWithDuration:function(e,t,n,r){return cc.ActionInterval.prototype.initWithDuration.call(this,e)?(this._deltaR=t,this._deltaG=n,this._deltaB=r,!0):!1},clone:function(){var e=new cc.TintBy;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._deltaR,this._deltaG,this._deltaB),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e);var t=e.color;this._fromR=t.r,this._fromG=t.g,this._fromB=t.b},update:function(e){e=this._computeEaseTime(e),this.target.color=cc.color(this._fromR+this._deltaR*e,this._fromG+this._deltaG*e,this._fromB+this._deltaB*e)},reverse:function(){var e=cc.TintBy.create(this._duration,-this._deltaR,-this._deltaG,-this._deltaB);return this._cloneDecoration(e),this._reverseEaseList(e),e}}),cc.TintBy.create=function(e,t,n,r){return new cc.TintBy(e,t,n,r)},cc.DelayTime=cc.ActionInterval.extend({update:function(e){},reverse:function(){var e=cc.DelayTime.create(this._duration);return this._cloneDecoration(e),this._reverseEaseList(e),e},clone:function(){var e=new cc.DelayTime;return this._cloneDecoration(e),e.initWithDuration(this._duration),e}}),cc.DelayTime.create=function(e){return new cc.DelayTime(e)},cc.ReverseTime=cc.ActionInterval.extend({_other:null,ctor:function(e){cc.ActionInterval.prototype.ctor.call(this),this._other=null,e&&this.initWithAction(e)},initWithAction:function(e){if(!e)throw"cc.ReverseTime.initWithAction(): action must be non null";if(e==this._other)throw"cc.ReverseTime.initWithAction(): the action was already passed in.";return cc.ActionInterval.prototype.initWithDuration.call(this,e._duration)?(this._other=e,!0):!1},clone:function(){var e=new cc.ReverseTime;return this._cloneDecoration(e),e.initWithAction(this._other.clone()),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e),this._other.startWithTarget(e)},update:function(e){e=this._computeEaseTime(e),this._other&&this._other.update(1-e)},reverse:function(){return this._other.clone()},stop:function(){this._other.stop(),cc.Action.prototype.stop.call(this)}}),cc.ReverseTime.create=function(e){return new cc.ReverseTime(e)},cc.Animate=cc.ActionInterval.extend({_animation:null,_nextFrame:0,_origFrame:null,_executedLoops:0,_splitTimes:null,ctor:function(e){cc.ActionInterval.prototype.ctor.call(this),this._splitTimes=[],e&&this.initWithAnimation(e)},getAnimation:function(){return this._animation},setAnimation:function(e){this._animation=e},initWithAnimation:function(e){if(!e)throw"cc.Animate.initWithAnimation(): animation must be non-NULL";var t=e.getDuration();if(this.initWithDuration(t*e.getLoops())){this._nextFrame=0,this.setAnimation(e),this._origFrame=null,this._executedLoops=0;var n=this._splitTimes;n.length=0;var r=0,i=t/e.getTotalDelayUnits(),s=e.getFrames();cc.arrayVerifyType(s,cc.AnimationFrame);for(var o=0;othis._executedLoops&&(this._nextFrame=0,this._executedLoops++),e%=1}var n=this._animation.getFrames(),r=n.length,i=this._splitTimes;for(var s=this._nextFrame;s0)for(var r=t.length-1;r>=0;r--){var i=t[r];if(!i)break;n.push(i.clone())}var s=cc.Animation.create(n,e.getDelayPerUnit(),e.getLoops());s.setRestoreOriginalFrame(e.getRestoreOriginalFrame());var o=cc.Animate.create(s);return this._cloneDecoration(o),this._reverseEaseList(o),o},stop:function(){this._animation.getRestoreOriginalFrame()&&this.target&&this.target.setSpriteFrame(this._origFrame),cc.Action.prototype.stop.call(this)}}),cc.Animate.create=function(e){return new cc.Animate(e)},cc.TargetedAction=cc.ActionInterval.extend({_action:null,_forcedTarget:null,ctor:function(e,t){cc.ActionInterval.prototype.ctor.call(this),t&&this.initWithTarget(e,t)},initWithTarget:function(e,t){return this.initWithDuration(t._duration)?(this._forcedTarget=e,this._action=t,!0):!1},clone:function(){var e=new cc.TargetedAction;return this._cloneDecoration(e),e.initWithTarget(this._forcedTarget,this._action.clone()),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e),this._action.startWithTarget(this._forcedTarget)},stop:function(){this._action.stop()},update:function(e){e=this._computeEaseTime(e),this._action.update(e)},getForcedTarget:function(){return this._forcedTarget},setForcedTarget:function(e){this._forcedTarget!=e&&(this._forcedTarget=e)}}),cc.TargetedAction.create=function(e,t){return new cc.TargetedAction(e,t)},cc.ActionInstant=cc.FiniteTimeAction.extend({isDone:function(){return!0},step:function(e){this.update(1)},update:function(e){},reverse:function(){return this.clone()},clone:function(){return new cc.ActionInstant}}),cc.CallFunc=cc.ActionInstant.extend({_selectorTarget:null,_callFunc:null,_function:null,_data:null,ctor:function(e,t,n){cc.FiniteTimeAction.prototype.ctor.call(this),e!==undefined&&(t===undefined?this.initWithFunction(e):this.initWithFunction(e,t,n))},initWithFunction:function(e,t,n){return t?(this._data=n,this._callFunc=e,this._selectorTarget=t):e&&(this._function=e),!0},execute:function(){this._callFunc!=null?this._callFunc.call(this._selectorTarget,this.target,this._data):this._function&&this._function.call(null,this.target)},update:function(e){this.execute()},getTargetCallback:function(){return this._selectorTarget},setTargetCallback:function(e){e!=this._selectorTarget&&(this._selectorTarget&&(this._selectorTarget=null),this._selectorTarget=e)},clone:function(){var e=new cc.CallFunc;return this._selectorTarget?e.initWithFunction(this._callFunc,this._selectorTarget,this._data):this._function&&e.initWithFunction(this._function),e}}),cc.CallFunc.create=function(e,t,n){return new cc.CallFunc(e,t,n)},cc.ActionCamera=cc.ActionInterval.extend({_centerXOrig:0,_centerYOrig:0,_centerZOrig:0,_eyeXOrig:0,_eyeYOrig:0,_eyeZOrig:0,_upXOrig:0,_upYOrig:0,_upZOrig:0,ctor:function(){var e=this;cc.ActionInterval.prototype.ctor.call(e),e._centerXOrig=0,e._centerYOrig=0,e._centerZOrig=0,e._eyeXOrig=0,e._eyeYOrig=0,e._eyeZOrig=0,e._upXOrig=0,e._upYOrig=0,e._upZOrig=0},startWithTarget:function(e){var t=this;cc.ActionInterval.prototype.startWithTarget.call(t,e);var n=e.getCamera(),r=n.getCenter();t._centerXOrig=r.x,t._centerYOrig=r.y,t._centerZOrig=r.z;var i=n.getEye();t._eyeXOrig=i.x,t._eyeYOrig=i.y,t._eyeZOrig=i.z;var s=n.getUp();t._upXOrig=s.x,t._upYOrig=s.y,t._upZOrig=s.z},clone:function(){return new cc.ActionCamera},reverse:function(){return cc.ReverseTime.create(this)}}),cc.OrbitCamera=cc.ActionCamera.extend({_radius:0,_deltaRadius:0,_angleZ:0,_deltaAngleZ:0,_angleX:0,_deltaAngleX:0,_radZ:0,_radDeltaZ:0,_radX:0,_radDeltaX:0,ctor:function(e,t,n,r,i,s,o){cc.ActionCamera.prototype.ctor.call(this),o!==undefined&&this.initWithDuration(e,t,n,r,i,s,o)},initWithDuration:function(e,t,n,r,i,s,o){if(cc.ActionInterval.prototype.initWithDuration.call(this,e)){var u=this;return u._radius=t,u._deltaRadius=n,u._angleZ=r,u._deltaAngleZ=i,u._angleX=s,u._deltaAngleX=o,u._radDeltaZ=cc.degreesToRadians(i),u._radDeltaX=cc.degreesToRadians(o),!0}return!1},sphericalRadius:function(){var e,t,n,r=this.target.getCamera(),i=r.getEye(),s=r.getCenter(),o=i.x-s.x,u=i.y-s.y,a=i.z-s.z,f=Math.sqrt(Math.pow(o,2)+Math.pow(u,2)+Math.pow(a,2)),l=Math.sqrt(Math.pow(o,2)+Math.pow(u,2));return l===0&&(l=cc.FLT_EPSILON),f===0&&(f=cc.FLT_EPSILON),t=Math.acos(a/f),o<0?n=Math.PI-Math.asin(u/l):n=Math.asin(u/l),e=f/cc.Camera.getZEye(),{newRadius:e,zenith:t,azimuth:n}},startWithTarget:function(e){var t=this;cc.ActionInterval.prototype.startWithTarget.call(t,e);var n=t.sphericalRadius();isNaN(t._radius)&&(t._radius=n.newRadius),isNaN(t._angleZ)&&(t._angleZ=cc.radiansToDegrees(n.zenith)),isNaN(t._angleX)&&(t._angleX=cc.radiansToDegrees(n.azimuth)),t._radZ=cc.degreesToRadians(t._angleZ),t._radX=cc.degreesToRadians(t._angleX)},clone:function(){var e=new cc.OrbitCamera,t=this;return e.initWithDuration(t._duration,t._radius,t._deltaRadius,t._angleZ,t._deltaAngleZ,t._angleX,t._deltaAngleX),e},update:function(e){e=this._computeEaseTime(e);var t=(this._radius+this._deltaRadius*e)*cc.Camera.getZEye(),n=this._radZ+this._radDeltaZ*e,r=this._radX+this._radDeltaX*e,i=Math.sin(n)*Math.cos(r)*t+this._centerXOrig,s=Math.sin(n)*Math.sin(r)*t+this._centerYOrig,o=Math.cos(n)*t+this._centerZOrig;this.target.getCamera().setEye(i,s,o)}}),cc.OrbitCamera.create=function(e,t,n,r,i,s,o){return new cc.OrbitCamera(e,t,n,r,i,s,o)},cc.ActionEase=cc.ActionInterval.extend({_inner:null,ctor:function(e){cc.ActionInterval.prototype.ctor.call(this),e&&this.initWithAction(e)},initWithAction:function(e){if(!e)throw"cc.ActionEase.initWithAction(): action must be non nil";return this.initWithDuration(e.getDuration())?(this._inner=e,!0):!1},clone:function(){var e=new cc.ActionEase;return e.initWithAction(this._inner.clone()),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e),this._inner.startWithTarget(this.target)},stop:function(){this._inner.stop(),cc.ActionInterval.prototype.stop.call(this)},update:function(e){this._inner.update(e)},reverse:function(){return cc.ActionEase.create(this._inner.reverse())},getInnerAction:function(){return this._inner}}),cc.ActionEase.create=function(e){return new cc.ActionEase(e)},cc.EaseRateAction=cc.ActionEase.extend({_rate:0,ctor:function(e,t){cc.ActionEase.prototype.ctor.call(this),t!==undefined&&this.initWithAction(e,t)},setRate:function(e){this._rate=e},getRate:function(){return this._rate},initWithAction:function(e,t){return cc.ActionEase.prototype.initWithAction.call(this,e)?(this._rate=t,!0):!1},clone:function(){var e=new cc.EaseRateAction;return e.initWithAction(this._inner.clone(),this._rate),e},reverse:function(){return cc.EaseRateAction.create(this._inner.reverse(),1/this._rate)}}),cc.EaseRateAction.create=function(e,t){return new cc.EaseRateAction(e,t)},cc.EaseIn=cc.EaseRateAction.extend({update:function(e){this._inner.update(Math.pow(e,this._rate))},reverse:function(){return cc.EaseIn.create(this._inner.reverse(),1/this._rate)},clone:function(){var e=new cc.EaseIn;return e.initWithAction(this._inner.clone(),this._rate),e}}),cc.EaseIn.create=function(e,t){return new cc.EaseIn(e,t)},cc.easeIn=function(e){return{_rate:e,easing:function(e){return Math.pow(e,this._rate)},reverse:function(){return cc.easeIn(1/this._rate)}}},cc.EaseOut=cc.EaseRateAction.extend({update:function(e){this._inner.update(Math.pow(e,1/this._rate))},reverse:function(){return cc.EaseOut.create(this._inner.reverse(),1/this._rate)},clone:function(){var e=new cc.EaseOut;return e.initWithAction(this._inner.clone(),this._rate),e}}),cc.EaseOut.create=function(e,t){return new cc.EaseOut(e,t)},cc.easeOut=function(e){return{_rate:e,easing:function(e){return Math.pow(e,1/this._rate)},reverse:function(){return cc.easeOut(1/this._rate)}}},cc.EaseInOut=cc.EaseRateAction.extend({update:function(e){e*=2,e<1?this._inner.update(.5*Math.pow(e,this._rate)):this._inner.update(1-.5*Math.pow(2-e,this._rate))},clone:function(){var e=new cc.EaseInOut;return e.initWithAction(this._inner.clone(),this._rate),e},reverse:function(){return cc.EaseInOut.create(this._inner.reverse(),this._rate)}}),cc.EaseInOut.create=function(e,t){return new cc.EaseInOut(e,t)},cc.easeInOut=function(e){return{_rate:e,easing:function(e){return e*=2,e<1?.5*Math.pow(e,this._rate):1-.5*Math.pow(2-e,this._rate)},reverse:function(){return cc.easeInOut(this._rate)}}},cc.EaseExponentialIn=cc.ActionEase.extend({update:function(e){this._inner.update(e===0?0:Math.pow(2,10*(e-1)))},reverse:function(){return cc.EaseExponentialOut.create(this._inner.reverse())},clone:function(){var e=new cc.EaseExponentialIn;return e.initWithAction(this._inner.clone()),e}}),cc.EaseExponentialIn.create=function(e){return new cc.EaseExponentialIn(e)},cc._easeExponentialInObj={easing:function(e){return e===0?0:Math.pow(2,10*(e-1))},reverse:function(){return cc._easeExponentialOutObj}},cc.easeExponentialIn=function(){return cc._easeExponentialInObj},cc.EaseExponentialOut=cc.ActionEase.extend({update:function(e){this._inner.update(e==1?1:-Math.pow(2,-10*e)+1)},reverse:function(){return cc.EaseExponentialIn.create(this._inner.reverse())},clone:function(){var e=new cc.EaseExponentialOut;return e.initWithAction(this._inner.clone()),e}}),cc.EaseExponentialOut.create=function(e){return new cc.EaseExponentialOut(e)},cc._easeExponentialOutObj={easing:function(e){return e==1?1:-Math.pow(2,-10*e)+1},reverse:function(){return cc._easeExponentialInObj}},cc.easeExponentialOut=function(){return cc._easeExponentialOutObj},cc.EaseExponentialInOut=cc.ActionEase.extend({update:function(e){e!=1&&e!==0&&(e*=2,e<1?e=.5*Math.pow(2,10*(e-1)):e=.5*(-Math.pow(2,-10*(e-1))+2)),this._inner.update(e)},reverse:function(){return cc.EaseExponentialInOut.create(this._inner.reverse())},clone:function(){var e=new cc.EaseExponentialInOut;return e.initWithAction(this._inner.clone()),e}}),cc.EaseExponentialInOut.create=function(e){return new cc.EaseExponentialInOut(e)},cc._easeExponentialInOutObj={easing:function(e){return e!==1&&e!==0?(e*=2,e<1?.5*Math.pow(2,10*(e-1)):.5*(-Math.pow(2,-10*(e-1))+2)):e},reverse:function(){return cc._easeExponentialInOutObj}},cc.easeExponentialInOut=function(){return cc._easeExponentialInOutObj},cc.EaseSineIn=cc.ActionEase.extend({update:function(e){e=e===0||e===1?e:-1*Math.cos(e*Math.PI/2)+1,this._inner.update(e)},reverse:function(){return cc.EaseSineOut.create(this._inner.reverse())},clone:function(){var e=new cc.EaseSineIn;return e.initWithAction(this._inner.clone()),e}}),cc.EaseSineIn.create=function(e){return new cc.EaseSineIn(e)},cc._easeSineInObj={easing:function(e){return e===0||e===1?e:-1*Math.cos(e*Math.PI/2)+1},reverse:function(){return cc._easeSineOutObj}},cc.easeSineIn=function(){return cc._easeSineInObj},cc.EaseSineOut=cc.ActionEase.extend({update:function(e){e=e===0||e===1?e:Math.sin(e*Math.PI/2),this._inner.update(e)},reverse:function(){return cc.EaseSineIn.create(this._inner.reverse())},clone:function(){var e=new cc.EaseSineOut;return e.initWithAction(this._inner.clone()),e}}),cc.EaseSineOut.create=function(e){return new cc.EaseSineOut(e)},cc._easeSineOutObj={easing:function(e){return e===0||e==1?e:Math.sin(e*Math.PI/2)},reverse:function(){return cc._easeSineInObj}},cc.easeSineOut=function(){return cc._easeSineOutObj},cc.EaseSineInOut=cc.ActionEase.extend({update:function(e){e=e===0||e===1?e:-0.5*(Math.cos(Math.PI*e)-1),this._inner.update(e)},clone:function(){var e=new cc.EaseSineInOut;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseSineInOut.create(this._inner.reverse())}}),cc.EaseSineInOut.create=function(e){return new cc.EaseSineInOut(e)},cc._easeSineInOutObj={easing:function(e){return e===0||e===1?e:-0.5*(Math.cos(Math.PI*e)-1)},reverse:function(){return cc._easeSineInOutObj}},cc.easeSineInOut=function(){return cc._easeSineInOutObj},cc.EaseElastic=cc.ActionEase.extend({_period:.3,ctor:function(e,t){cc.ActionEase.prototype.ctor.call(this),e&&this.initWithAction(e,t)},getPeriod:function(){return this._period},setPeriod:function(e){this._period=e},initWithAction:function(e,t){return cc.ActionEase.prototype.initWithAction.call(this,e),this._period=t==null?.3:t,!0},reverse:function(){return cc.log("cc.EaseElastic.reverse(): it should be overridden in subclass."),null},clone:function(){var e=new cc.EaseElastic;return e.initWithAction(this._inner.clone(),this._period),e}}),cc.EaseElastic.create=function(e,t){return new cc.EaseElastic(e,t)},cc.EaseElasticIn=cc.EaseElastic.extend({update:function(e){var t=0;if(e===0||e===1)t=e;else{var n=this._period/4;e-=1,t=-Math.pow(2,10*e)*Math.sin((e-n)*Math.PI*2/this._period)}this._inner.update(t)},reverse:function(){return cc.EaseElasticOut.create(this._inner.reverse(),this._period)},clone:function(){var e=new cc.EaseElasticIn;return e.initWithAction(this._inner.clone(),this._period),e}}),cc.EaseElasticIn.create=function(e,t){return new cc.EaseElasticIn(e,t)},cc._easeElasticInObj={easing:function(e){return e===0||e===1?e:(e-=1,-Math.pow(2,10*e)*Math.sin((e-.075)*Math.PI*2/.3))},reverse:function(){return cc._easeElasticOutObj}},cc.easeElasticIn=function(e){return e&&e!==.3?{_period:e,easing:function(e){return e===0||e===1?e:(e-=1,-Math.pow(2,10*e)*Math.sin((e-this._period/4)*Math.PI*2/this._period))},reverse:function(){return cc.easeElasticOut(this._period)}}:cc._easeElasticInObj},cc.EaseElasticOut=cc.EaseElastic.extend({update:function(e){var t=0;if(e===0||e==1)t=e;else{var n=this._period/4;t=Math.pow(2,-10*e)*Math.sin((e-n)*Math.PI*2/this._period)+1}this._inner.update(t)},reverse:function(){return cc.EaseElasticIn.create(this._inner.reverse(),this._period)},clone:function(){var e=new cc.EaseElasticOut;return e.initWithAction(this._inner.clone(),this._period),e}}),cc.EaseElasticOut.create=function(e,t){return new cc.EaseElasticOut(e,t)},cc._easeElasticOutObj={easing:function(e){return e===0||e===1?e:Math.pow(2,-10*e)*Math.sin((e-.075)*Math.PI*2/.3)+1},reverse:function(){return cc._easeElasticInObj}},cc.easeElasticOut=function(e){return e&&e!==.3?{_period:e,easing:function(e){return e===0||e===1?e:Math.pow(2,-10*e)*Math.sin((e-this._period/4)*Math.PI*2/this._period)+1},reverse:function(){return cc.easeElasticIn(this._period)}}:cc._easeElasticOutObj},cc.EaseElasticInOut=cc.EaseElastic.extend({update:function(e){var t=0,n=this._period;if(e===0||e==1)t=e;else{e*=2,n||(n=this._period=.3*1.5);var r=n/4;e-=1,e<0?t=-0.5*Math.pow(2,10*e)*Math.sin((e-r)*Math.PI*2/n):t=Math.pow(2,-10*e)*Math.sin((e-r)*Math.PI*2/n)*.5+1}this._inner.update(t)},reverse:function(){return cc.EaseElasticInOut.create(this._inner.reverse(),this._period)},clone:function(){var e=new cc.EaseElasticInOut;return e.initWithAction(this._inner.clone(),this._period),e}}),cc.EaseElasticInOut.create=function(e,t){return new cc.EaseElasticInOut(e,t)},cc.easeElasticInOut=function(e){return e=e||.3,{_period:e,easing:function(e){var t=0,n=this._period;if(e===0||e===1)t=e;else{e*=2,n||(n=this._period=.3*1.5);var r=n/4;e-=1,e<0?t=-0.5*Math.pow(2,10*e)*Math.sin((e-r)*Math.PI*2/n):t=Math.pow(2,-10*e)*Math.sin((e-r)*Math.PI*2/n)*.5+1}return t},reverse:function(){return cc.easeElasticInOut(this._period)}}},cc.EaseBounce=cc.ActionEase.extend({bounceTime:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?(e-=1.5/2.75,7.5625*e*e+.75):e<2.5/2.75?(e-=2.25/2.75,7.5625*e*e+.9375):(e-=2.625/2.75,7.5625*e*e+.984375)},clone:function(){var e=new cc.EaseBounce;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseBounce.create(this._inner.reverse())}}),cc.EaseBounce.create=function(e){return new cc.EaseBounce(e)},cc.EaseBounceIn=cc.EaseBounce.extend({update:function(e){var t=1-this.bounceTime(1-e);this._inner.update(t)},reverse:function(){return cc.EaseBounceOut.create(this._inner.reverse())},clone:function(){var e=new cc.EaseBounceIn;return e.initWithAction(this._inner.clone()),e}}),cc.EaseBounceIn.create=function(e){return new cc.EaseBounceIn(e)},cc._bounceTime=function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?(e-=1.5/2.75,7.5625*e*e+.75):e<2.5/2.75?(e-=2.25/2.75,7.5625*e*e+.9375):(e-=2.625/2.75,7.5625*e*e+.984375)},cc._easeBounceInObj={easing:function(e){return 1-cc._bounceTime(1-e)},reverse:function(){return cc._easeBounceOutObj}},cc.easeBounceIn=function(){return cc._easeBounceInObj},cc.EaseBounceOut=cc.EaseBounce.extend({update:function(e){var t=this.bounceTime(e);this._inner.update(t)},reverse:function(){return cc.EaseBounceIn.create(this._inner.reverse())},clone:function(){var e=new cc.EaseBounceOut;return e.initWithAction(this._inner.clone()),e}}),cc.EaseBounceOut.create=function(e){return new cc.EaseBounceOut(e)},cc._easeBounceOutObj={easing:function(e){return cc._bounceTime(e)},reverse:function(){return cc._easeBounceInObj}},cc.easeBounceOut=function(){return cc._easeBounceOutObj},cc.EaseBounceInOut=cc.EaseBounce.extend({update:function(e){var t=0;e<.5?(e*=2,t=(1-this.bounceTime(1-e))*.5):t=this.bounceTime(e*2-1)*.5+.5,this._inner.update(t)},clone:function(){var e=new cc.EaseBounceInOut;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseBounceInOut.create(this._inner.reverse())}}),cc.EaseBounceInOut.create=function(e){return new cc.EaseBounceInOut(e)},cc._easeBounceInOutObj={easing:function(e){var t;return e<.5?(e*=2,t=(1-cc._bounceTime(1-e))*.5):t=cc._bounceTime(e*2-1)*.5+.5,t},reverse:function(){return cc._easeBounceInOutObj}},cc.easeBounceInOut=function(){return cc._easeBounceInOutObj},cc.EaseBackIn=cc.ActionEase.extend({update:function(e){var t=1.70158;e=e===0||e==1?e:e*e*((t+1)*e-t),this._inner.update(e)},reverse:function(){return cc.EaseBackOut.create(this._inner.reverse())},clone:function(){var e=new cc.EaseBackIn;return e.initWithAction(this._inner.clone()),e}}),cc.EaseBackIn.create=function(e){return new cc.EaseBackIn(e)},cc._easeBackInObj={easing:function(e){var t=1.70158;return e===0||e===1?e:e*e*((t+1)*e-t)},reverse:function(){return cc._easeBackOutObj}},cc.easeBackIn=function(){return cc._easeBackInObj},cc.EaseBackOut=cc.ActionEase.extend({update:function(e){var t=1.70158;e-=1,this._inner.update(e*e*((t+1)*e+t)+1)},reverse:function(){return cc.EaseBackIn.create(this._inner.reverse())},clone:function(){var e=new cc.EaseBackOut;return e.initWithAction(this._inner.clone()),e}}),cc.EaseBackOut.create=function(e){return new cc.EaseBackOut(e)},cc._easeBackOutObj={easing:function(e){var t=1.70158;return e-=1,e*e*((t+1)* e+t)+1},reverse:function(){return cc._easeBackInObj}},cc.easeBackOut=function(){return cc._easeBackOutObj},cc.EaseBackInOut=cc.ActionEase.extend({update:function(e){var t=2.5949095;e*=2,e<1?this._inner.update(e*e*((t+1)*e-t)/2):(e-=2,this._inner.update(e*e*((t+1)*e+t)/2+1))},clone:function(){var e=new cc.EaseBackInOut;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseBackInOut.create(this._inner.reverse())}}),cc.EaseBackInOut.create=function(e){return new cc.EaseBackInOut(e)},cc._easeBackInOutObj={easing:function(e){var t=2.5949095;return e*=2,e<1?e*e*((t+1)*e-t)/2:(e-=2,e*e*((t+1)*e+t)/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(e){cc.ActionEase.prototype.ctor.call(this,e)},_updateTime:function(e,t,n,r,i){return Math.pow(1-i,3)*e+3*i*Math.pow(1-i,2)*t+3*Math.pow(i,2)*(1-i)*n+Math.pow(i,3)*r},update:function(e){var t=this._updateTime(this._p0,this._p1,this._p2,this._p3,e);this._inner.update(t)},clone:function(){var e=new cc.EaseBezierAction;return e.initWithAction(this._inner.clone()),e.setBezierParamer(this._p0,this._p1,this._p2,this._p3),e},reverse:function(){var e=cc.EaseBezierAction.create(this._inner.reverse());return e.setBezierParamer(this._p3,this._p2,this._p1,this._p0),e},setBezierParamer:function(e,t,n,r){this._p0=e||0,this._p1=t||0,this._p2=n||0,this._p3=r||0}}),cc.EaseBezierAction.create=function(e){return new cc.EaseBezierAction(e)},cc.easeBezierAction=function(e,t,n,r){return{easing:function(i){return cc.EaseBezierAction.prototype._updateTime(e,t,n,r,i)},reverse:function(){return cc.easeBezierAction(r,n,t,e)}}},cc.EaseQuadraticActionIn=cc.ActionEase.extend({_updateTime:function(e){return Math.pow(e,2)},update:function(e){this._inner.update(this._updateTime(e))},clone:function(){var e=new cc.EaseQuadraticActionIn;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseQuadraticActionIn.create(this._inner.reverse())}}),cc.EaseQuadraticActionIn.create=function(e){return new cc.EaseQuadraticActionIn(e)},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(e){return-e*(e-2)},update:function(e){this._inner.update(this._updateTime(e))},clone:function(){var e=new cc.EaseQuadraticActionOut;return e.initWithAction(),e},reverse:function(){return cc.EaseQuadraticActionOut.create(this._inner.reverse())}}),cc.EaseQuadraticActionOut.create=function(e){return new cc.EaseQuadraticActionOut(e)},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(e){var t=e;return e*=2,e<1?t=e*e*.5:(--e,t=-0.5*(e*(e-2)-1)),t},update:function(e){this._inner.update(this._updateTime(e))},clone:function(){var e=new cc.EaseQuadraticActionInOut;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseQuadraticActionInOut.create(this._inner.reverse())}}),cc.EaseQuadraticActionInOut.create=function(e){return new cc.EaseQuadraticActionInOut(e)},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(e){return e*e*e*e},update:function(e){this._inner.update(this._updateTime(e))},clone:function(){var e=new cc.EaseQuarticActionIn;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseQuarticActionIn.create(this._inner.reverse())}}),cc.EaseQuarticActionIn.create=function(e){return new cc.EaseQuarticActionIn(e)},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(e){return e-=1,-(e*e*e*e-1)},update:function(e){this._inner.update(this._updateTime(e))},clone:function(){var e=new cc.EaseQuarticActionOut;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseQuarticActionOut.create(this._inner.reverse())}}),cc.EaseQuarticActionOut.create=function(e){return new cc.EaseQuarticActionOut(e)},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(e){return e*=2,e<1?.5*e*e*e*e:(e-=2,-0.5*(e*e*e*e-2))},update:function(e){this._inner.update(this._updateTime(e))},clone:function(){var e=new cc.EaseQuarticActionInOut;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseQuarticActionInOut.create(this._inner.reverse())}}),cc.EaseQuarticActionInOut.create=function(e){return new cc.EaseQuarticActionInOut(e)},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(e){return e*e*e*e*e},update:function(e){this._inner.update(this._updateTime(e))},clone:function(){var e=new cc.EaseQuinticActionIn;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseQuinticActionIn.create(this._inner.reverse())}}),cc.EaseQuinticActionIn.create=function(e){return new cc.EaseQuinticActionIn(e)},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(e){return e-=1,e*e*e*e*e+1},update:function(e){this._inner.update(this._updateTime(e))},clone:function(){var e=new cc.EaseQuinticActionOut;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseQuinticActionOut.create(this._inner.reverse())}}),cc.EaseQuinticActionOut.create=function(e){return new cc.EaseQuinticActionOut(e)},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(e){return e*=2,e<1?.5*e*e*e*e*e:(e-=2,.5*(e*e*e*e*e+2))},update:function(e){this._inner.update(this._updateTime(e))},clone:function(){var e=new cc.EaseQuinticActionInOut;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseQuinticActionInOut.create(this._inner.reverse())}}),cc.EaseQuinticActionInOut.create=function(e){return new cc.EaseQuinticActionInOut(e)},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(e){return-1*(Math.sqrt(1-e*e)-1)},update:function(e){this._inner.update(this._updateTime(e))},clone:function(){var e=new cc.EaseCircleActionIn;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseCircleActionIn.create(this._inner.reverse())}}),cc.EaseCircleActionIn.create=function(e){return new cc.EaseCircleActionIn(e)},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(e){return e-=1,Math.sqrt(1-e*e)},update:function(e){this._inner.update(this._updateTime(e))},clone:function(){var e=new cc.EaseCircleActionOut;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseCircleActionOut.create(this._inner.reverse())}}),cc.EaseCircleActionOut.create=function(e){return new cc.EaseCircleActionOut(e)},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(e){return e*=2,e<1?-0.5*(Math.sqrt(1-e*e)-1):(e-=2,.5*(Math.sqrt(1-e*e)+1))},update:function(e){this._inner.update(this._updateTime(e))},clone:function(){var e=new cc.EaseCircleActionInOut;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseCircleActionInOut.create(this._inner.reverse())}}),cc.EaseCircleActionInOut.create=function(e){return new cc.EaseCircleActionInOut(e)},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(e){return e*e*e},update:function(e){this._inner.update(this._updateTime(e))},clone:function(){var e=new cc.EaseCubicActionIn;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseCubicActionIn.create(this._inner.reverse())}}),cc.EaseCubicActionIn.create=function(e){return new cc.EaseCubicActionIn(e)},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(e){return e-=1,e*e*e+1},update:function(e){this._inner.update(this._updateTime(e))},clone:function(){var e=new cc.EaseCubicActionOut;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseCubicActionOut.create(this._inner.reverse())}}),cc.EaseCubicActionOut.create=function(e){return new cc.EaseCubicActionOut(e)},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(e){return e*=2,e<1?.5*e*e*e:(e-=2,.5*(e*e*e+2))},update:function(e){this._inner.update(this._updateTime(e))},clone:function(){var e=new cc.EaseCubicActionInOut;return e.initWithAction(this._inner.clone()),e},reverse:function(){return cc.EaseCubicActionInOut.create(this._inner.reverse())}}),cc.EaseCubicActionInOut.create=function(e){return new cc.EaseCubicActionInOut(e)},cc._easeCubicActionInOut={easing:cc.EaseCubicActionInOut.prototype._updateTime,reverse:function(){return cc._easeCubicActionInOut}},cc.easeCubicActionInOut=function(){return cc._easeCubicActionInOut},cc.cardinalSplineAt=function(e,t,n,r,i,s){var o=s*s,u=o*s,a=(1-i)/2,f=a*(-u+2*o-s),l=a*(-u+o)+(2*u-3*o+1),c=a*(u-2*o+s)+(-2*u+3*o),h=a*(u-o),p=e.x*f+t.x*l+n.x*c+r.x*h,d=e.y*f+t.y*l+n.y*c+r.y*h;return cc.p(p,d)},cc.reverseControlPoints=function(e){var t=[];for(var n=e.length-1;n>=0;n--)t.push(cc.p(e[n].x,e[n].y));return t},cc.copyControlPoints=function(e){var t=[];for(var n=0;n