cocos2d-3.0rc1.canvas.v2.min.js 272 KB

123456789
  1. 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;r<i;r++)if(t.call(n,e[r],r)===!1)return}else for(var s in e)if(t.call(n,e[s],s)===!1)return},cc.isCrossOrigin=function(e){if(!e)return cc.log("invalid URL"),!1;var t=e.indexOf("://");if(t==-1)return!1;var n=e.indexOf("/",t+3),r=n==-1?e:e.substring(0,n);return r!=location.origin},cc.async={_counterFunc:function(e){var t=this.counter;if(t.err)return;var n=t.length,r=t.results,i=t.option,s=i.cb,o=i.cbTarget,u=i.trigger,a=i.triggerTarget;if(e){t.err=e;if(s)return s.call(o,e);return}var f=Array.apply(null,arguments).slice(1),l=f.length;l==0?f=null:l==1&&(f=f[0]),r[this.index]=f,t.count--,u&&u.call(a,f,n-t.count,n),t.count==0&&s&&s.apply(o,[null,r])},_emptyFunc:function(){},parallel:function(e,t,n){var r=cc.async;if(n!==undefined)typeof t=="function"&&(t={trigger:t}),t.cb=n||t.cb;else if(t!==undefined)typeof t=="function"&&(t={cb:t});else{if(e===undefined)throw"arguments error!";t={}}var i=e instanceof Array,s=i?e.length:Object.keys(e).length;if(s==0){t.cb&&t.cb.call(t.cbTarget,null);return}var o=i?[]:{},u={length:s,count:s,option:t,results:o};cc.each(e,function(e,n){if(u.err)return!1;var i=!t.cb&&!t.trigger?r._emptyFunc:r._counterFunc.bind({counter:u,index:n});e(i,n)})},map:function(e,t,n){var r=this,i=arguments.length;typeof t=="function"&&(t={iterator:t});if(i===3)t.cb=n||t.cb;else if(i<2)throw"arguments error!";typeof t=="function"&&(t={iterator:t});if(n!==undefined)t.cb=n||t.cb;else if(e===undefined)throw"arguments error!";var s=e instanceof Array,o=s?e.length:Object.keys(e).length;if(o===0){t.cb&&t.cb.call(t.cbTarget,null);return}var u=s?[]:{},a={length:o,count:o,option:t,results:u};cc.each(e,function(e,n){if(a.err)return!1;var i=t.cb?r._counterFunc.bind({counter:a,index:n}):r._emptyFunc;t.iterator.call(t.iteratorTarget,e,n,i)})}},cc.path={join:function(){var e=arguments.length,t="";for(var n=0;n<e;n++)t=(t+(t==""?"":"/")+arguments[n]).replace(/(\/|\\\\)$/,"");return t},extname:function(e){var t=/(\.[^\.\/\?\\]*)(\?.*)?$/.exec(e);return t?t[1]:null},mainFileName:function(e){if(e){var t=e.lastIndexOf(".");if(t!==-1)return e.substring(0,t)}return e},basename:function(e,t){var n=e.indexOf("?");n>0&&(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;r<i;r++)n._register["."+e[r].trim().toLowerCase()]=t},getRes:function(e){return this.cache[e]||this.cache[this._aliases[e]]},release:function(e){var t=this.cache,n=this._aliases;delete t[e],delete t[n[e]],delete n[e]},releaseAll:function(){var e=this.cache,t=this._aliases;for(var n in e)delete e[n];for(var n in t)delete t[n]}},function(){var e=window,t,n,r="undefined";typeof document.hidden!==r?(t="hidden",n="visibilitychange"):typeof document.mozHidden!==r?(t="mozHidden",n="mozvisibilitychange"):typeof document.msHidden!==r?(t="msHidden",n="msvisibilitychange"):typeof document.webkitHidden!==r&&(t="webkitHidden",n="webkitvisibilitychange");var i=function(){cc.eventManager&&cc.game._eventHide&&cc.eventManager.dispatchEvent(cc.game._eventHide)},s=function(){cc.eventManager&&cc.game._eventShow&&cc.eventManager.dispatchEvent(cc.game._eventShow)};t?cc._addEventListener(document,n,function(){document[t]?i():s()},!1):(cc._addEventListener(e,"blur",i,!1),cc._addEventListener(e,"focus",s,!1)),"onpageshow"in window&&"onpagehide"in window&&(cc._addEventListener(e,"pagehide",i,!1),cc._addEventListener(e,"pageshow",s,!1)),e=null,n=null}(),cc.log=function(){return console.log.apply(console,arguments)},cc.warn=function(){return console.warn.apply(console,arguments)},cc.error=function(){return console.error.apply(console,arguments)},cc.assert=function(){return console.assert.apply(console,arguments)},cc._initSys=function(e,t){var n=cc.sys={};n.OS_WINDOWS="Windows",n.OS_IOS="iOS",n.OS_OSX="OS X",n.OS_UNIX="UNIX",n.OS_LINUX="Linux",n.OS_ANDROID="Android",n.OS_UNKNOWN="Unknown",n.BROWSER_TYPE_WECHAT="wechat",n.BROWSER_TYPE_ANDROID="androidbrowser",n.BROWSER_TYPE_IE="ie",n.BROWSER_TYPE_QQ="qqbrowser",n.BROWSER_TYPE_MOBILE_QQ="mqqbrowser",n.BROWSER_TYPE_UC="ucbrowser",n.BROWSER_TYPE_360="360browser",n.BROWSER_TYPE_BAIDU_APP="baiduboxapp",n.BROWSER_TYPE_BAIDU="baidubrowser",n.BROWSER_TYPE_MAXTHON="maxthon",n.BROWSER_TYPE_OPERA="opera",n.BROWSER_TYPE_MIUI="miuibrowser",n.BROWSER_TYPE_FIREFOX="firefox",n.BROWSER_TYPE_SAFARI="safari",n.BROWSER_TYPE_CHROME="chrome",n.BROWSER_TYPE_UNKNOWN="unknown";var r=window,i=r.navigator,s=document,o=s.documentElement,u=i.userAgent.toLowerCase();n.isMobile=u.indexOf("mobile")!=-1||u.indexOf("android")!=-1;var a=n.BROWSER_TYPE_UNKNOWN,f=u.match(/micromessenger|qqbrowser|mqqbrowser|ucbrowser|360browser|baiduboxapp|baidubrowser|maxthon|trident|opera|miuibrowser|firefox/i)||u.match(/chrome|safari/i);f&&f.length>0&&(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<r.length;i++){var s=r[i].getAttribute("cocos");if(s==""||s)break}var o,u,a;i<r.length&&(o=r[i].src,o&&(a=/(.*)\//.exec(o)[0],cc.loader.resPath=a,o=cc.path.join(a,"project.json")),u=cc.loader._loadTxtSync(o)),u||(u=cc.loader._loadTxtSync("project.json"));var f=JSON.parse(u);e.config=n(f||{})}catch(l){cc.log("Failed to read or parse project.json"),e.config=n({})}cc._initSys(e.config,t)},_jsAddedCache:{},_getJsListOfModule:function(e,t,n){var r=this._jsAddedCache;if(r[t])return null;n=n||"";var i=[],s=e[t];if(!s)throw"can not find module ["+t+"]";var o=cc.path;for(var u=0,a=s.length;u<a;u++){var f=s[u];if(r[f])continue;var l=o.extname(f);if(!l){var c=this._getJsListOfModule(e,f,n);c&&(i=i.concat(c))}else l.toLowerCase()==".js"&&i.push(o.join(n,f));r[f]=1}return i},prepare:function(e){var t=this,n=t.config,r=t.CONFIG_KEY,i=n[r.engineDir],s=cc.loader;if(!cc._supportRender){cc.error("Can not support render!");return}t._prepareCalled=!0;var o=n[r.jsList]||[];if(cc.Class)s.loadJsWithImg("",o,function(n){if(n)throw n;t._prepared=!0,e&&e()});else{var u=cc.path.join(i,"moduleConfig.json");s.loadJson(u,function(r,s){if(r)throw r;var u=n.modules||[],a=s.module,f=[];for(var l=0,c=u.length;l<c;l++){var h=t._getJsListOfModule(a,u[l],i);h&&(f=f.concat(h))}f=f.concat(o),cc.loader.loadJsWithImg(f,function(n){if(n)throw n;t._prepared=!0,e&&e()})})}}},cc.game._initConfig(),cc.loader.loadBinary=function(e,t){var n=this,r=this.getXMLHttpRequest(),i="load "+e+" failed!";r.open("GET",e,!0),/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)?(r.setRequestHeader("Accept-Charset","x-user-defined"),r.onreadystatechange=function(){if(r.readyState==4&&r.status==200){var e=cc._convertResponseBodyToText(r.responseBody);t(null,n._str2Uint8Array(e))}else t(i)}):(r.overrideMimeType&&r.overrideMimeType("text/plain; charset=x-user-defined"),r.onload=function(){r.readyState==4&&r.status==200?t(null,n._str2Uint8Array(r.responseText)):t(i)}),r.send(null)},cc.loader._str2Uint8Array=function(e){if(!e)return null;var t=new Uint8Array(e.length);for(var n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t},cc.loader.loadBinarySync=function(e){var t=this,n=this.getXMLHttpRequest(),r="load "+e+" failed!";n.open("GET",e,!1);var i=null;if(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)){n.setRequestHeader("Accept-Charset","x-user-defined"),n.send(null);if(n.status!=200)return cc.log(r),null;var s=cc._convertResponseBodyToText(n.responseBody);s&&(i=t._str2Uint8Array(s))}else{n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null);if(n.status!=200)return cc.log(r),null;i=this._str2Uint8Array(n.responseText)}return i};var Uint8Array=Uint8Array||Array;if(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)){var IEBinaryToArray_ByteStr_Script='<!-- IEBinaryToArray_ByteStr -->\r\nFunction IEBinaryToArray_ByteStr(Binary)\r\n IEBinaryToArray_ByteStr = CStr(Binary)\r\nEnd Function\r\nFunction IEBinaryToArray_ByteStr_Last(Binary)\r\n Dim lastIndex\r\n lastIndex = LenB(Binary)\r\n if lastIndex mod 2 Then\r\n IEBinaryToArray_ByteStr_Last = Chr( AscB( MidB( Binary, lastIndex, 1 ) ) )\r\n Else\r\n IEBinaryToArray_ByteStr_Last = ""\r\n End If\r\nEnd Function\r\n',myVBScript=cc.newElement("script");myVBScript.type="text/vbscript",myVBScript.textContent=IEBinaryToArray_ByteStr_Script,document.body.appendChild(myVBScript),cc._convertResponseBodyToText=function(e){var t={};for(var n=0;n<256;n++)for(var r=0;r<256;r++)t[String.fromCharCode(n+r*256)]=String.fromCharCode(n)+String.fromCharCode(r);var i=IEBinaryToArray_ByteStr(e),s=IEBinaryToArray_ByteStr_Last(e);return i.replace(/[\s\S]/g,function(e){return t[e]})+s}}var cc=cc||{};cc._loadingImage=cc._fpsImage=cc._loaderImage="";var cc=cc||{},ClassManager={id:0|Math.random()*998,instanceId:0|Math.random()*998,compileSuper:function(e,t,n){var r=e.toString(),i=r.indexOf("("),s=r.indexOf(")"),o=r.substring(i+1,s);o=o.trim();var u=r.indexOf("{"),a=r.lastIndexOf("}"),r=r.substring(u+1,a);while(r.indexOf("this._super")!=-1){var f=r.indexOf("this._super"),l=r.indexOf("(",f),c=r.indexOf(")",l),h=r.substring(l+1,c);h=h.trim();var p=h?",":"";r=r.substring(0,f)+"ClassManager["+n+"]."+t+".call(this"+p+r.substring(l+1)}return Function(o,r)},getNewID:function(){return this.id++},getNewInstanceId:function(){return this.instanceId++}};ClassManager.compileSuper.ClassManager=ClassManager,function(){var e=/\b_super\b/,t=cc.game.config,n=t[cc.game.CONFIG_KEY.classReleaseMode];n&&console.log("release Mode"),cc.Class=function(){},cc.Class.extend=function(t){function u(){this.__instanceId=ClassManager.getNewInstanceId(),this.ctor&&this.ctor.apply(this,arguments)}var r=this.prototype,i=Object.create(r),s=ClassManager.getNewID();ClassManager[s]=r;var o={writable:!0,enumerable:!1,configurable:!0};i.__instanceId=null,u.id=s,o.value=s,Object.defineProperty(i,"__pid",o),u.prototype=i,o.value=u,Object.defineProperty(u.prototype,"constructor",o),this.__getters__&&(u.__getters__=cc.clone(this.__getters__)),this.__setters__&&(u.__setters__=cc.clone(this.__setters__));for(var a=0,f=arguments.length;a<f;++a){var l=arguments[a];for(var c in l){var h=typeof l[c]=="function",p=typeof r[c]=="function",d=e.test(l[c]);n&&h&&p&&d?(o.value=ClassManager.compileSuper(l[c],c,s),Object.defineProperty(i,c,o)):h&&p&&d?(o.value=function(e,t){return function(){var n=this._super;this._super=r[e];var i=t.apply(this,arguments);return this._super=n,i}}(c,l[c]),Object.defineProperty(i,c,o)):h?(o.value=l[c],Object.defineProperty(i,c,o)):i[c]=l[c];if(h){var v,m,g;if(this.__getters__&&this.__getters__[c]){g=this.__getters__[c];for(var y in this.__setters__)if(this.__setters__[y]==g){m=y;break}cc.defineGetterSetter(i,g,l[c],l[m]?l[m]:i[m],c,m)}if(this.__setters__&&this.__setters__[c]){g=this.__setters__[c];for(var y in this.__getters__)if(this.__getters__[y]==g){v=y;break}cc.defineGetterSetter(i,g,l[v]?l[v]:i[v],l[c],v,c)}}}}return u.extend=cc.Class.extend,u.implement=function(e){for(var t in e)i[t]=e[t]},u},Function.prototype.bind=Function.prototype.bind||function(e){var t=this;return function(){var n=Array.prototype.slice.call(arguments);return t.apply(e||null,n)}}}(),cc.defineGetterSetter=function(e,t,n,r,i,s){if(e.__defineGetter__)n&&e.__defineGetter__(t,n),r&&e.__defineSetter__(t,r);else{if(!Object.defineProperty)throw new Error("browser does not support getters");var o={enumerable:!1,configurable:!0};n&&(o.get=n),r&&(o.set=r),Object.defineProperty(e,t,o)}if(!i&&!s){var u=n!=null,a=r!=undefined,f=Object.getOwnPropertyNames(e);for(var l=0;l<f.length;l++){var c=f[l];if((e.__lookupGetter__?e.__lookupGetter__(c):Object.getOwnPropertyDescriptor(e,c))||typeof e[c]!="function")continue;var h=e[c];if(u&&h===n){i=c;if(!a||s)break}if(a&&h===r){s=c;if(!u||i)break}}}var p=e.constructor;i&&(p.__getters__||(p.__getters__={}),p.__getters__[i]=t),s&&(p.__setters__||(p.__setters__={}),p.__setters__[s]=t)},cc.clone=function(e){var t=e.constructor?new e.constructor:{};for(var n in e){var r=e[n];typeof r!="object"||!r||r instanceof cc.Node||r instanceof HTMLElement?t[n]=r:t[n]=cc.clone(r)}return t},cc.Point=function(e,t){this.x=e||0,this.y=t||0},cc.p=function(e,t){return e==undefined?{x:0,y:0}:t==undefined?{x:e.x,y:e.y}:{x:e,y:t}},cc.pointEqualToPoint=function(e,t){return e&&t&&e.x===t.x&&e.y===t.y},cc.Size=function(e,t){this.width=e||0,this.height=t||0},cc.size=function(e,t){return e===undefined?{width:0,height:0}:t===undefined?{width:e.width,height:e.height}:{width:e,height:t}},cc.sizeEqualToSize=function(e,t){return e&&t&&e.width==t.width&&e.height==t.height},cc.Rect=function(e,t,n,r){this.x=e||0,this.y=t||0,this.width=n||0,this.height=r||0},cc.rect=function(e,t,n,r){return e===undefined?{x:0,y:0,width:0,height:0}:t===undefined?{x:e.x,y:e.y,width:e.width,height:e.height}:{x:e,y:t,width:n,height:r}},cc.rectEqualToRect=function(e,t){return e&&t&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height},cc._rectEqualToZero=function(e){return e&&e.x===0&&e.y===0&&e.width===0&&e.height===0},cc.rectContainsRect=function(e,t){return!e||!t?!1:!(e.x>=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<t.x||i<e.x||r<t.y||s<e.y)},cc.rectOverlapsRect=function(e,t){return!(e.x+e.width<t.x||t.x+t.width<e.x||e.y+e.height<t.y||t.y+t.height<e.y)},cc.rectUnion=function(e,t){var n=cc.rect(0,0,0,0);return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.width=Math.max(e.x+e.width,t.x+t.width)-n.x,n.height=Math.max(e.y+e.height,t.y+t.height)-n.y,n},cc.rectIntersection=function(e,t){var n=cc.rect(Math.max(cc.rectGetMinX(e),cc.rectGetMinX(t)),Math.max(cc.rectGetMinY(e),cc.rectGetMinY(t)),0,0);return n.width=Math.min(cc.rectGetMaxX(e),cc.rectGetMaxX(t))-cc.rectGetMinX(n),n.height=Math.min(cc.rectGetMaxY(e),cc.rectGetMaxY(t))-cc.rectGetMinY(n),n},cc.visibleRect={topLeft:cc.p(0,0),topRight:cc.p(0,0),top:cc.p(0,0),bottomLeft:cc.p(0,0),bottomRight:cc.p(0,0),bottom:cc.p(0,0),center:cc.p(0,0),left:cc.p(0,0),right:cc.p(0,0),width:0,height:0,init:function(e){var t=this.width=e.width,n=this.height=e.height,r=e.x,i=e.y,s=i+n,o=r+t;this.topLeft.x=r,this.topLeft.y=s,this.topRight.x=o,this.topRight.y=s,this.top.x=r+t/2,this.top.y=s,this.bottomLeft.x=r,this.bottomLeft.y=i,this.bottomRight.x=o,this.bottomRight.y=i,this.bottom.x=r+t/2,this.bottom.y=i,this.center.x=r+t/2,this.center.y=i+n/2,this.left.x=r,this.left.y=i+n/2,this.right.x=o,this.right.y=i+n/2}},cc.SAXParser=cc.Class.extend({_parser:null,_isSupportDOMParser:null,ctor:function(){window.DOMParser?(this._isSupportDOMParser=!0,this._parser=new DOMParser):this._isSupportDOMParser=!1},parse:function(e){return this._parseXML(e)},_parseXML:function(e){var t;return this._isSupportDOMParser?t=this._parser.parseFromString(e,"text/xml"):(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)),t}}),cc.PlistParser=cc.SAXParser.extend({parse:function(e){var t=this._parseXML(e),n=t.documentElement;if(n.tagName!="plist")throw"Not a plist file!";var r=null;for(var i=0,s=n.childNodes.length;i<s;i++){r=n.childNodes[i];if(r.nodeType==1)break}return t=null,this._parseNode(r)},_parseNode:function(e){var t=null,n=e.tagName;if(n=="dict")t=this._parseDict(e);else if(n=="array")t=this._parseArray(e);else if(n=="string")if(e.childNodes.length==1)t=e.firstChild.nodeValue;else{t="";for(var r=0;r<e.childNodes.length;r++)t+=e.childNodes[r].nodeValue}else n=="false"?t=!1:n=="true"?t=!0:n=="real"?t=parseFloat(e.firstChild.nodeValue):n=="integer"&&(t=parseInt(e.firstChild.nodeValue,10));return t},_parseArray:function(e){var t=[];for(var n=0,r=e.childNodes.length;n<r;n++){var i=e.childNodes[n];if(i.nodeType!=1)continue;t.push(this._parseNode(i))}return t},_parseDict:function(e){var t={},n=null;for(var r=0,i=e.childNodes.length;r<i;r++){var s=e.childNodes[r];if(s.nodeType!=1)continue;s.tagName=="key"?n=s.firstChild.nodeValue:t[n]=this._parseNode(s)}return t}}),cc._txtLoader={load:function(e,t,n,r){cc.loader.loadTxt(e,r)}},cc.loader.register(["txt","xml","vsh","fsh","atlas"],cc._txtLoader),cc._jsonLoader={load:function(e,t,n,r){cc.loader.loadJson(e,r)}},cc.loader.register(["json","ExportJson"],cc._jsonLoader),cc._imgLoader={load:function(e,t,n,r){cc.loader.cache[t]=cc.loader.loadImg(e,function(e,n){if(e)return r(e);cc.textureCache.handleLoadedTexture(t),r(null,n)})}},cc.loader.register(["png","jpg","bmp","jpeg","gif","ico"],cc._imgLoader),cc._serverImgLoader={load:function(e,t,n,r){cc.loader.cache[t]=cc.loader.loadImg(n.src,function(e,n){if(e)return r(e);cc.textureCache.handleLoadedTexture(t),r(null,n)})}},cc.loader.register(["serverImg"],cc._serverImgLoader),cc._plistLoader={load:function(e,t,n,r){cc.loader.loadTxt(e,function(e,t){if(e)return r(e);r(null,cc.plistParser.parse(t))})}},cc.loader.register(["plist"],cc._plistLoader),cc._fontLoader={TYPE:{".eot":"embedded-opentype",".ttf":"truetype",".woff":"woff",".svg":"svg"},_loadFont:function(e,t,n){var r=document,i=cc.path,s=this.TYPE,o=cc.newElement("style");o.type="text/css",r.body.appendChild(o);var u="@font-face { font-family:"+e+"; src:";if(t instanceof Array)for(var a=0,f=t.length;a<f;a++){var l=t[a];n=i.extname(l).toLowerCase(),u+="url('"+t[a]+"') format('"+s[n]+"')",u+=a==f-1?";":","}else u+="url('"+t+"') format('"+s[n]+"');";o.textContent+=u+"};";var c=cc.newElement("div"),h=c.style;h.fontFamily=e,c.innerHTML=".",h.position="absolute",h.left="-100px",h.top="-100px",r.body.appendChild(c)},load:function(e,t,n,r){var i=this,s=n.type,o=n.name,u=n.srcs;typeof n=="string"?(s=cc.path.extname(n),o=cc.path.basename(n,s),i._loadFont(o,n,s)):i._loadFont(o,u),r(null,!0)}},cc.loader.register(["font","eot","ttf","woff","svg"],cc._fontLoader),cc._binaryLoader={load:function(e,t,n,r){cc.loader.loadBinary(e,r)}},window.CocosEngine=cc.ENGINE_VERSION="Cocos2d-html5 v3.0 RC1",cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL=0,cc.DIRECTOR_STATS_POSITION=cc.p(0,0),cc.DIRECTOR_FPS_INTERVAL=.5,cc.COCOSNODE_RENDER_SUBPIXEL=1,cc.SPRITEBATCHNODE_RENDER_SUBPIXEL=1,cc.OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA=0,cc.TEXTURE_ATLAS_USE_TRIANGLE_STRIP=0,cc.TEXTURE_ATLAS_USE_VAO=0,cc.TEXTURE_NPOT_SUPPORT=0,cc.RETINA_DISPLAY_SUPPORT=1,cc.RETINA_DISPLAY_FILENAME_SUFFIX="-hd",cc.USE_LA88_LABELS=1,cc.IS_RETINA_DISPLAY_SUPPORTED=1,cc.DEFAULT_ENGINE=cc.ENGINE_VERSION+"-canvas",cc.ENABLE_STACKABLE_ACTIONS=1,cc.ENABLE_GL_STATE_CACHE=1,cc.$=function(e){var t=this==cc?document:this,n=e instanceof HTMLElement?e:t.querySelector(e);return n&&(n.find=n.find||cc.$,n.hasClass=n.hasClass||function(e){return this.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},n.addClass=n.addClass||function(e){return this.hasClass(e)||(this.className&&(this.className+=" "),this.className+=e),this},n.removeClass=n.removeClass||function(e){return this.hasClass(e)&&(this.className=this.className.replace(e,"")),this},n.remove=n.remove||function(){return this.parentNode&&this.parentNode.removeChild(this),this},n.appendTo=n.appendTo||function(e){return e.appendChild(this),this},n.prependTo=n.prependTo||function(e){return e.childNodes[0]?e.insertBefore(this,e.childNodes[0]):e.appendChild(this),this},n.transforms=n.transforms||function(){return this.style[cc.$.trans]=cc.$.translate(this.position)+cc.$.rotate(this.rotation)+cc.$.scale(this.scale)+cc.$.skew(this.skew),this},n.position=n.position||{x:0,y:0},n.rotation=n.rotation||0,n.scale=n.scale||{x:1,y:1},n.skew=n.skew||{x:0,y:0},n.translates=function(e,t){return this.position.x=e,this.position.y=t,this.transforms(),this},n.rotate=function(e){return this.rotation=e,this.transforms(),this},n.resize=function(e,t){return this.scale.x=e,this.scale.y=t,this.transforms(),this},n.setSkew=function(e,t){return this.skew.x=e,this.skew.y=t,this.transforms(),this}),n};switch(cc.sys.browserType){case cc.sys.BROWSER_TYPE_FIREFOX:cc.$.pfx="Moz",cc.$.hd=!0;break;case cc.sys.BROWSER_TYPE_CHROME:case cc.sys.BROWSER_TYPE_SAFARI:cc.$.pfx="webkit",cc.$.hd=!0;break;case cc.sys.BROWSER_TYPE_OPERA:cc.$.pfx="O",cc.$.hd=!1;break;case cc.sys.BROWSER_TYPE_IE:cc.$.pfx="ms",cc.$.hd=!1;break;default:cc.$.pfx="webkit",cc.$.hd=!0}cc.$.trans=cc.$.pfx+"Transform",cc.$.translate=cc.$.hd?function(e){return"translate3d("+e.x+"px, "+e.y+"px, 0) "}:function(e){return"translate("+e.x+"px, "+e.y+"px) "},cc.$.rotate=cc.$.hd?function(e){return"rotateZ("+e+"deg) "}:function(e){return"rotate("+e+"deg) "},cc.$.scale=function(e){return"scale("+e.x+", "+e.y+") "},cc.$.skew=function(e){return"skewX("+ -e.x+"deg) skewY("+e.y+"deg)"},cc.$new=function(e){return cc.$(document.createElement(e))},cc.$.findpos=function(e){var t=0,n=0;do t+=e.offsetLeft,n+=e.offsetTop;while(e=e.offsetParent);return{x:t,y:n}},cc.INVALID_INDEX=-1,cc.PI=Math.PI,cc.FLT_MAX=parseFloat("3.402823466e+38F"),cc.FLT_MIN=parseFloat("1.175494351e-38F"),cc.RAD=cc.PI/180,cc.DEG=180/cc.PI,cc.UINT_MAX=4294967295,cc.swap=function(e,t,n){if(typeof n=="object"&&typeof n.x!="undefined"&&typeof n.y!="undefined"
  2. ){var r=n[e];n[e]=n[t],n[t]=r}else cc.log(cc._LogInfos.swap)},cc.lerp=function(e,t,n){return e+(t-e)*n},cc.rand=function(){return Math.random()*16777215},cc.randomMinus1To1=function(){return(Math.random()-.5)*2},cc.random0To1=Math.random,cc.degreesToRadians=function(e){return e*cc.RAD},cc.radiansToDegrees=function(e){return e*cc.DEG},cc.radiansToDegress=function(e){return cc.log(cc._LogInfos.radiansToDegress),e*cc.DEG},cc.REPEAT_FOREVER=Number.MAX_VALUE-1,cc.BLEND_SRC=cc.OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA?1:770,cc.BLEND_DST=771,cc.nodeDrawSetup=function(e){e._shaderProgram&&(e._shaderProgram.use(),e._shaderProgram.setUniformForModelViewAndProjectionMatrixWithMat4())},cc.FLT_EPSILON=1.192092896e-7,cc.contentScaleFactor=cc.IS_RETINA_DISPLAY_SUPPORTED?function(){return cc.director.getContentScaleFactor()}:function(){return 1},cc.pointPointsToPixels=function(e){var t=cc.contentScaleFactor();return cc.p(e.x*t,e.y*t)},cc.pointPixelsToPoints=function(e){var t=cc.contentScaleFactor();return cc.p(e.x/t,e.y/t)},cc._pointPixelsToPointsOut=function(e,t){var n=cc.contentScaleFactor();t.x=e.x/n,t.y=e.y/n},cc.sizePointsToPixels=function(e){var t=cc.contentScaleFactor();return cc.size(e.width*t,e.height*t)},cc.sizePixelsToPoints=function(e){var t=cc.contentScaleFactor();return cc.size(e.width/t,e.height/t)},cc._sizePixelsToPointsOut=function(e,t){var n=cc.contentScaleFactor();t.width=e.width/n,t.height=e.height/n},cc.rectPixelsToPoints=cc.IS_RETINA_DISPLAY_SUPPORTED?function(e){var t=cc.contentScaleFactor();return cc.rect(e.x/t,e.y/t,e.width/t,e.height/t)}:function(e){return e},cc.rectPointsToPixels=cc.IS_RETINA_DISPLAY_SUPPORTED?function(e){var t=cc.contentScaleFactor();return cc.rect(e.x*t,e.y*t,e.width*t,e.height*t)}:function(e){return e},cc.ONE=1,cc.ZERO=0,cc.SRC_ALPHA=770,cc.SRC_ALPHA_SATURATE=776,cc.SRC_COLOR=768,cc.DST_ALPHA=772,cc.DST_COLOR=774,cc.ONE_MINUS_SRC_ALPHA=771,cc.ONE_MINUS_SRC_COLOR=769,cc.ONE_MINUS_DST_ALPHA=773,cc.ONE_MINUS_DST_COLOR=775,cc.ONE_MINUS_CONSTANT_ALPHA=32772,cc.ONE_MINUS_CONSTANT_COLOR=32770,cc.DEVICE_ORIENTATION_PORTRAIT=0,cc.DEVICE_ORIENTATION_LANDSCAPE_LEFT=1,cc.DEVICE_ORIENTATION_PORTRAIT_UPSIDE_DOWN=2,cc.DEVICE_ORIENTATION_LANDSCAPE_RIGHT=3,cc.DEVICE_MAX_ORIENTATIONS=2,cc.VERTEX_ATTRIB_FLAG_NONE=0,cc.VERTEX_ATTRIB_FLAG_POSITION=1,cc.VERTEX_ATTRIB_FLAG_COLOR=2,cc.VERTEX_ATTRIB_FLAG_TEX_COORDS=4,cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX=cc.VERTEX_ATTRIB_FLAG_POSITION|cc.VERTEX_ATTRIB_FLAG_COLOR|cc.VERTEX_ATTRIB_FLAG_TEX_COORDS,cc.VERTEX_ATTRIB_POSITION=0,cc.VERTEX_ATTRIB_COLOR=1,cc.VERTEX_ATTRIB_TEX_COORDS=2,cc.VERTEX_ATTRIB_MAX=3,cc.UNIFORM_PMATRIX=0,cc.UNIFORM_MVMATRIX=1,cc.UNIFORM_MVPMATRIX=2,cc.UNIFORM_TIME=3,cc.UNIFORM_SINTIME=4,cc.UNIFORM_COSTIME=5,cc.UNIFORM_RANDOM01=6,cc.UNIFORM_SAMPLER=7,cc.UNIFORM_MAX=8,cc.SHADER_POSITION_TEXTURECOLOR="ShaderPositionTextureColor",cc.SHADER_POSITION_TEXTURECOLORALPHATEST="ShaderPositionTextureColorAlphaTest",cc.SHADER_POSITION_COLOR="ShaderPositionColor",cc.SHADER_POSITION_TEXTURE="ShaderPositionTexture",cc.SHADER_POSITION_TEXTURE_UCOLOR="ShaderPositionTexture_uColor",cc.SHADER_POSITION_TEXTUREA8COLOR="ShaderPositionTextureA8Color",cc.SHADER_POSITION_UCOLOR="ShaderPosition_uColor",cc.SHADER_POSITION_LENGTHTEXTURECOLOR="ShaderPositionLengthTextureColor",cc.UNIFORM_PMATRIX_S="CC_PMatrix",cc.UNIFORM_MVMATRIX_S="CC_MVMatrix",cc.UNIFORM_MVPMATRIX_S="CC_MVPMatrix",cc.UNIFORM_TIME_S="CC_Time",cc.UNIFORM_SINTIME_S="CC_SinTime",cc.UNIFORM_COSTIME_S="CC_CosTime",cc.UNIFORM_RANDOM01_S="CC_Random01",cc.UNIFORM_SAMPLER_S="CC_Texture0",cc.UNIFORM_ALPHA_TEST_VALUE_S="CC_alpha_value",cc.ATTRIBUTE_NAME_COLOR="a_color",cc.ATTRIBUTE_NAME_POSITION="a_position",cc.ATTRIBUTE_NAME_TEX_COORD="a_texCoord",cc.ITEM_SIZE=32,cc.CURRENT_ITEM=3233828865,cc.ZOOM_ACTION_TAG=3233828866,cc.NORMAL_TAG=8801,cc.SELECTED_TAG=8802,cc.DISABLE_TAG=8803,cc._tmp.PrototypeColor=function(){var e=cc.color;e._getWhite=function(){return e(255,255,255)},e._getYellow=function(){return e(255,255,0)},e._getBlue=function(){return e(0,0,255)},e._getGreen=function(){return e(0,255,0)},e._getRed=function(){return e(255,0,0)},e._getMagenta=function(){return e(255,0,255)},e._getBlack=function(){return e(0,0,0)},e._getOrange=function(){return e(255,127,0)},e._getGray=function(){return e(166,166,166)},e.WHITE,cc.defineGetterSetter(e,"WHITE",e._getWhite),e.YELLOW,cc.defineGetterSetter(e,"YELLOW",e._getYellow),e.BLUE,cc.defineGetterSetter(e,"BLUE",e._getBlue),e.GREEN,cc.defineGetterSetter(e,"GREEN",e._getGreen),e.RED,cc.defineGetterSetter(e,"RED",e._getRed),e.MAGENTA,cc.defineGetterSetter(e,"MAGENTA",e._getMagenta),e.BLACK,cc.defineGetterSetter(e,"BLACK",e._getBlack),e.ORANGE,cc.defineGetterSetter(e,"ORANGE",e._getOrange),e.GRAY,cc.defineGetterSetter(e,"GRAY",e._getGray)},cc.Color=function(e,t,n,r){this.r=e||0,this.g=t||0,this.b=n||0,this.a=r||255},cc.color=function(e,t,n,r){return e===undefined?{r:0,g:0,b:0,a:255}:typeof e=="string"?cc.hexToColor(e):typeof e=="object"?{r:e.r,g:e.g,b:e.b,a:e.a||255}:{r:e,g:t,b:n,a:r||255}},cc.colorEqual=function(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b},cc.Acceleration=function(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.timestamp=r||0},cc.Vertex2F=function(e,t){this.x=e||0,this.y=t||0},cc.vertex2=function(e,t){return new cc.Vertex2F(e,t)},cc.Vertex3F=function(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0},cc.vertex3=function(e,t,n){return new cc.Vertex3F(e,t,n)},cc.Tex2F=function(e,t){this.u=e||0,this.v=t||0},cc.tex2=function(e,t){return new cc.Tex2F(e,t)},cc.BlendFunc=function(e,t){this.src=e,this.dst=t},cc.blendFuncDisable=function(){return new cc.BlendFunc(cc.ONE,cc.ZERO)},cc.hexToColor=function(e){e=e.replace(/^#?/,"0x");var t=parseInt(e),n=t>>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;t<e.length;t++)this.removeObjectForKey(e[t])},allKeys:function(){var e=[],t=this._keyMapTb;for(var n in t)e.push(t[n]);return e},removeAllObjects:function(){this._keyMapTb={},this._valueMapTb={}},count:function(){return this.allKeys().length}}),cc.FontDefinition=function(){var e=this;e.fontName="Arial",e.fontSize=12,e.textAlign=cc.TEXT_ALIGNMENT_CENTER,e.verticalAlign=cc.VERTICAL_TEXT_ALIGNMENT_TOP,e.fillStyle=cc.color(255,255,255,255),e.boundingWidth=0,e.boundingHeight=0,e.strokeEnabled=!1,e.strokeStyle=cc.color(255,255,255,255),e.lineWidth=1,e.shadowEnabled=!1,e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,e.shadowOpacity=1},cc.assert(typeof cc._tmp.PrototypeColor=="function",cc._LogInfos.MissingFile,"CCTypesPropertyDefine.js"),cc._tmp.PrototypeColor(),delete cc._tmp.PrototypeColor,cc.Touches=[],cc.TouchesIntergerDict={},cc.EGLView=cc.Class.extend({_delegate:null,_frameSize:null,_designResolutionSize:null,_originalDesignResolutionSize:null,_viewPortRect:null,_visibleRect:null,_retinaEnabled:!1,_autoFullScreen:!0,_devicePixelRatio:1,_viewName:"",_resizeCallback:null,_scaleX:1,_originalScaleX:1,_scaleY:1,_originalScaleY:1,_indexBitsUsed:0,_maxTouches:5,_resolutionPolicy:null,_rpExactFit:null,_rpShowAll:null,_rpNoBorder:null,_rpFixedHeight:null,_rpFixedWidth:null,_initialized:!1,_captured:!1,_wnd:null,_hDC:null,_hRC:null,_supportTouch:!1,_contentTranslateLeftTop:null,_frame:null,_frameZoomFactor:1,__resizeWithBrowserSize:!1,_isAdjustViewPort:!0,ctor:function(){var e=this,t=document,n=cc.ContainerStrategy,r=cc.ContentStrategy;e._frame=cc.container.parentNode===t.body?t.documentElement:cc.container.parentNode,e._frameSize=cc.size(0,0),e._initFrameSize();var i=cc._canvas.width,s=cc._canvas.height;e._designResolutionSize=cc.size(i,s),e._originalDesignResolutionSize=cc.size(i,s),e._viewPortRect=cc.rect(0,0,i,s),e._visibleRect=cc.rect(0,0,i,s),e._contentTranslateLeftTop={left:0,top:0},e._viewName="Cocos2dHTML5";var o=cc.sys;e.enableRetina(o.os==o.OS_IOS||o.os==o.OS_OSX),cc.visibleRect&&cc.visibleRect.init(e._visibleRect),e._rpExactFit=new cc.ResolutionPolicy(n.EQUAL_TO_FRAME,r.EXACT_FIT),e._rpShowAll=new cc.ResolutionPolicy(n.PROPORTION_TO_FRAME,r.SHOW_ALL),e._rpNoBorder=new cc.ResolutionPolicy(n.EQUAL_TO_FRAME,r.NO_BORDER),e._rpFixedHeight=new cc.ResolutionPolicy(n.EQUAL_TO_FRAME,r.FIXED_HEIGHT),e._rpFixedWidth=new cc.ResolutionPolicy(n.EQUAL_TO_FRAME,r.FIXED_WIDTH),e._hDC=cc._canvas,e._hRC=cc._renderContext},_resizeEvent:function(){var e=this._originalDesignResolutionSize.width,t=this._originalDesignResolutionSize.height;this._resizeCallback&&(this._initFrameSize(),this._resizeCallback.call()),e>0&&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<e.length;u++)i=e[u],s=i._point,o=i._prevPoint,i._setPoint((s.x-t.x)/n,(s.y-t.y)/r),i._setPrevPoint((o.x-t.x)/n,(o.y-t.y)/r)}}),cc.EGLView._getInstance=function(){return this._instance||(this._instance=this._instance||new cc.EGLView,this._instance.initialize()),this._instance},cc.ContainerStrategy=cc.Class.extend({preApply:function(e){},apply:function(e,t){},postApply:function(e){},_setupContainer:function(e,t,n){var r=e._frame;cc.view._autoFullScreen&&cc.sys.isMobile&&r==document.documentElement&&cc.screen.autoFullScreen(r);var i=cc._canvas,s=cc.container;s.style.width=i.style.width=t+"px",s.style.height=i.style.height=n+"px";var o=e._devicePixelRatio=1;e.isRetinaEnabled()&&(o=e._devicePixelRatio=window.devicePixelRatio||1),i.width=t*o,i.height=n*o;var u=document.body,a;u&&(a=u.style)&&(a.paddingTop=a.paddingTop||"0px",a.paddingRight=a.paddingRight||"0px",a.paddingBottom=a.paddingBottom||"0px",a.paddingLeft=a.paddingLeft||"0px",a.borderTop=a.borderTop||"0px",a.borderRight=a.borderRight||"0px",a.borderBottom=a.borderBottom||"0px",a.borderLeft=a.borderLeft||"0px",a.marginTop=a.marginTop||"0px",a.marginRight=a.marginRight||"0px",a.marginBottom=a.marginBottom||"0px",a.marginLeft=a.marginLeft||"0px")},_fixContainer:function(){document.body.insertBefore(cc.container,document.body.firstChild);var e=document.body.style;e.width=window.innerWidth+"px",e.height=window.innerHeight+"px",e.overflow="hidden";var t=cc.container.style;t.position="fixed",t.left=t.top="0px",document.body.scrollTop=0}}),cc.ContentStrategy=cc.Class.extend({_result:{scale:[1,1],viewport:null},_buildResult:function(e,t,n,r,i,s){Math.abs(e-n)<2&&(n=e),Math.abs(t-r)<2&&(r=t);var o=cc.rect(Math.round((e-n)/2),Math.round((t-r)/2),n,r);return cc._renderContext.translate(o.x,o.y+r),this._result.scale=[i,s],this._result.viewport=o,this._result},preApply:function(e){},apply:function(e,t){return{scale:[1,1]}},postApply:function(e){}}),function(){var e=cc.ContainerStrategy.extend({apply:function(e){this._setupContainer(e,e._frameSize.width,e._frameSize.height)}}),t=cc.ContainerStrategy.extend({apply:function(e,t){var n=e._frameSize.width,r=e._frameSize.height,i=cc.container.style,s=t.width,o=t.height,u=n/s,a=r/o,f,l;u<a?(f=n,l=o*u):(f=s*a,l=r);var c=Math.round((n-f)/2),h=Math.round((r-l)/2);f=n-2*c,l=r-2*h,this._setupContainer(e,f,l),i.marginLeft=c+"px",i.marginRight=c+"px",i.marginTop=h+"px",i.marginBottom=h+"px"}}),n=e.extend({preApply:function(e){this._super(e),e._frame=document.documentElement},apply:function(e){this._super(e),this._fixContainer()}}),r=t.extend({preApply:function(e){this._super(e),e._frame=document.documentElement},apply:function(e,t){this._super(e,t),this._fixContainer()}}),i=cc.ContainerStrategy.extend({apply:function(e){this._setupContainer(e,cc._canvas.width,cc._canvas.height)}});cc.ContainerStrategy.EQUAL_TO_FRAME=new e,cc.ContainerStrategy.PROPORTION_TO_FRAME=new t,cc.ContainerStrategy.ORIGINAL_CONTAINER=new i;var s=cc.ContentStrategy.extend({apply:function(e,t){var n=cc._canvas.width,r=cc._canvas.height,i=n/t.width,s=r/t.height;return this._buildResult(n,r,n,r,i,s)}}),o=cc.ContentStrategy.extend({apply:function(e,t){var n=cc._canvas.width,r=cc._canvas.height,i=t.width,s=t.height,o=n/i,u=r/s,a=0,f,l;return o<u?(a=o,f=n,l=s*a):(a=u,f=i*a,l=r),this._buildResult(n,r,f,l,a,a)}}),u=cc.ContentStrategy.extend({apply:function(e,t){var n=cc._canvas.width,r=cc._canvas.height,i=t.width,s=t.height,o=n/i,u=r/s,a,f,l;return o<u?(a=u,f=i*a,l=r):(a=o,f=n,l=s*a),this._buildResult(n,r,f,l,a,a)}}),a=cc.ContentStrategy.extend({apply:function(e,t){var n=cc._canvas.width,r=cc._canvas.height,i=t.height,s=r/i,o=n,u=r;return this._buildResult(n,r,o,u,s,s)},postApply:function(e){cc.director._winSizeInPoints=e.getVisibleSize()}}),f=cc.ContentStrategy.extend({apply:function(e,t){var n=cc._canvas.width,r=cc._canvas.height,i=t.width,s=n/i,o=n,u=r;return this._buildResult(n,r,o,u,s,s)},postApply:function(e){cc.director._winSizeInPoints=e.getVisibleSize()}});cc.ContentStrategy.EXACT_FIT=new s,cc.ContentStrategy.SHOW_ALL=new o,cc.ContentStrategy.NO_BORDER=new u,cc.ContentStrategy.FIXED_HEIGHT=new a,cc.ContentStrategy.FIXED_WIDTH=new f}(),cc.ResolutionPolicy=cc.Class.extend({_containerStrategy:null,_contentStrategy:null,ctor:function(e,t){this.setContainerStrategy(e),this.setContentStrategy(t)},preApply:function(e){this._containerStrategy.preApply(e),this._contentStrategy.preApply(e)},apply:function(e,t){return this._containerStrategy.apply(e,t),this._contentStrategy.apply(e,t)},postApply:function(e){this._containerStrategy.postApply(e),this._contentStrategy.postApply(e)},setContainerStrategy:function(e){e instanceof cc.ContainerStrategy&&(this._containerStrategy=e)},setContentStrategy:function(e){e instanceof cc.ContentStrategy&&(this._contentStrategy=e)}}),cc.ResolutionPolicy.EXACT_FIT=0,cc.ResolutionPolicy.NO_BORDER=1,cc.ResolutionPolicy.SHOW_ALL=2,cc.ResolutionPolicy.FIXED_HEIGHT=3,cc.ResolutionPolicy.FIXED_WIDTH=4,cc.ResolutionPolicy.UNKNOWN=5,cc.UIInterfaceOrientationLandscapeLeft=-90,cc.UIInterfaceOrientationLandscapeRight=90,cc.UIInterfaceOrientationPortraitUpsideDown=180,cc.UIInterfaceOrientationPortrait=0,cc.inputManager={_mousePressed:!1,_isRegisterEvent:!1,_preTouchPoint:cc.p(0,0),_prevMousePoint:cc.p(0,0),_preTouchPool:[],_preTouchPoolPointer:0,_touches:[],_touchesIntegerDict:{},_indexBitsUsed:0,_maxTouches:5,_accelEnabled:!1,_accelInterval:1/30,_accelMinus:1,_accelCurTime:0,_acceleration:null,_accelDeviceEvent:null,_getUnUsedIndex:function(){var e=this._indexBitsUsed;for(var t=0;t<this._maxTouches;t++){if(!(e&1))return this._indexBitsUsed|=1<<t,t;e>>=1}return-1},_removeUsedIndexBit:function(e){if(e<0||e>=this._maxTouches)return;var t=1<<e;t=~t,this._indexBitsUsed&=t},_glView:null,handleTouchesBegin:function(e){var t,n,r,i,s=[],o=this._touchesIntegerDict;for(var u=0,a=e.length;u<a;u++){t=e[u],i=t.getID(),n=o[i];if(n==null){var f=this._getUnUsedIndex();if(f==-1){cc.log(cc._LogInfos.inputManager_handleTouchesBegin,f);continue}r=this._touches[f]=t,o[i]=f,s.push(r)}}if(s.length>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;o<u;o++){t=e[o],r=t.getID(),n=this._touchesIntegerDict[r];if(n==null)continue;s[n]&&(s[n]._setPoint(t._point),s[n]._setPrevPoint(t._prevPoint),i.push(s[n]))}if(i.length>0){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<a;u++){t=e[u],r=t.getID(),n=o[r];if(n==null)continue;s[n]&&(s[n]._setPoint(t._point),s[n]._setPrevPoint(t._prevPoint),i.push(s[n]),this._removeUsedIndexBit(n),delete o[r])}return i},getHTMLElementPosition:function(e){var t=document.documentElement,n=window,r=null;return typeof e.getBoundingClientRect=="function"?r=e.getBoundingClientRect():e instanceof HTMLCanvasElement?r={left:0,top:0,width:e.width,height:e.height}:r={left:0,top:0,width:parseInt(e.style.width),height:parseInt(e.style.height)},{left:r.left+n.pageXOffset-t.clientLeft,top:r.top+n.pageYOffset-t.clientTop,width:r.width,height:r.height}},getPreTouch:function(e){var t=null,n=this._preTouchPool,r=e.getId();for(var i=n.length-1;i>=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;f<a;f++){i=e.changedTouches[f];if(i){var l;cc.sys.BROWSER_TYPE_FIREFOX===cc.sys.browserType?l=r.convertToLocationInView(i.pageX,i.pageY,t):l=r.convertToLocationInView(i.clientX,i.clientY,t),i.identifier!=null?(s=new cc.Touch(l.x,l.y,i.identifier),o=this.getPreTouch(s).getLocation(),s._setPrevPoint(o.x,o.y),this.setPreTouch(s)):(s=new cc.Touch(l.x,l.y),s._setPrevPoint(u.x,u.y)),u.x=l.x,u.y=l.y,n.push(s)}}return n},registerSystemEvent:function(e){if(this._isRegisterEvent)return;var t=this._glView=cc.view,n=this,r="mouse"in cc.sys.capabilities,i="touches"in cc.sys.capabilities;r&&(cc._addEventListener(window,"mousedown",function(){n._mousePressed=!0},!1),cc._addEventListener(window,"mouseup",function(t){var r=n._mousePressed;n._mousePressed=!1;if(!r)return;var s=n.getHTMLElementPosition(e),o=n.getPointByEvent(t,s);if(!cc.rectContainsPoint(new cc.Rect(s.left,s.top,s.width,s.height),o)){i||n.handleTouchesEnd([n.getTouchByXY(o.x,o.y,s)]);var u=n.getMouseEvent(o,s,cc.EventMouse.UP);u.setButton(t.button),cc.eventManager.dispatchEvent(u)}},!1),cc._addEventListener(e,"mousedown",function(t){n._mousePressed=!0;var r=n.getHTMLElementPosition(e),s=n.getPointByEvent(t,r);i||n.handleTouchesBegin([n.getTouchByXY(s.x,s.y,r)]);var o=n.getMouseEvent(s,r,cc.EventMouse.DOWN);o.setButton(t.button),cc.eventManager.dispatchEvent(o),t.stopPropagation(),t.preventDefault(),e.focus()},!1),cc._addEventListener(e,"mouseup",function(t){n._mousePressed=!1;var r=n.getHTMLElementPosition(e),s=n.getPointByEvent(t,r);i||n.handleTouchesEnd([n.getTouchByXY(s.x,s.y,r)]);var o=n.getMouseEvent(s,r,cc.EventMouse.UP);o.setButton(t.button),cc.eventManager.dispatchEvent(o),t.stopPropagation(),t.preventDefault()},!1),cc._addEventListener(e,"mousemove",function(t){var r=n.getHTMLElementPosition(e),s=n.getPointByEvent(t,r);i||n.handleTouchesMove([n.getTouchByXY(s.x,s.y,r)]);var o=n.getMouseEvent(s,r,cc.EventMouse.MOVE);n._mousePressed?o.setButton(t.button):o.setButton(null),cc.eventManager.dispatchEvent(o),t.stopPropagation(),t.preventDefault()},!1),cc._addEventListener(e,"mousewheel",function(t){var r=n.getHTMLElementPosition(e),i=n.getPointByEvent(t,r),s=n.getMouseEvent(i,r,cc.EventMouse.SCROLL);s.setButton(t.button),s.setScrollData(0,t.wheelDelta),cc.eventManager.dispatchEvent(s),t.stopPropagation(),t.preventDefault()},!1),cc._addEventListener(e,"DOMMouseScroll",function(t){var r=n.getHTMLElementPosition(e),i=n.getPointByEvent(t,r),s=n.getMouseEvent(i,r,cc.EventMouse.SCROLL);s.setButton(t.button),s.setScrollData(0,t.detail*-120),cc.eventManager.dispatchEvent(s),t.stopPropagation(),t.preventDefault()},!1));if(window.navigator.msPointerEnabled){var s={MSPointerDown:n.handleTouchesBegin,MSPointerMove:n.handleTouchesMove,MSPointerUp:n.handleTouchesEnd,MSPointerCancel:n.handleTouchesCancel};for(var o in s)(function(t,r){cc._addEventListener(e,t,function(t){var i=n.getHTMLElementPosition(e);i.left-=document.documentElement.scrollLeft,i.top-=document.documentElement.scrollTop,r.call(n,[n.getTouchByXY(t.clientX,t.clientY,i)]),t.stopPropagation()},!1)})(o,s[o])}i&&(cc._addEventListener(e,"touchstart",function(t){if(!t.changedTouches)return;var r=n.getHTMLElementPosition(e);r.left-=document.body.scrollLeft,r.top-=document.body.scrollTop,n.handleTouchesBegin(n.getTouchesByEvent(t,r)),t.stopPropagation(),t.preventDefault(),e.focus()},!1),cc._addEventListener(e,"touchmove",function(t){if(!t.changedTouches)return;var r=n.getHTMLElementPosition(e);r.left-=document.body.scrollLeft,r.top-=document.body.scrollTop,n.handleTouchesMove(n.getTouchesByEvent(t,r)),t.stopPropagation(),t.preventDefault()},!1),cc._addEventListener(e,"touchend",function(t){if(!t.changedTouches)return;var r=n.getHTMLElementPosition(e);r.left-=document.body.scrollLeft,r.top-=document.body.scrollTop,n.handleTouchesEnd(n.getTouchesByEvent(t,r)),t.stopPropagation(),t.preventDefault()},!1),cc._addEventListener(e,"touchcancel",function(r){if(!r.changedTouches)return;var i=n.getHTMLElementPosition(e);i.left-=document.body.scrollLeft,i.top-=document.body.scrollTop,t.handleTouchesCancel(n.getTouchesByEvent(r,i)),r.stopPropagation(),r.preventDefault()},!1)),this._registerKeyboardEvent(),this._registerAccelerometerEvent(),this._isRegisterEvent=!0},_registerKeyboardEvent:function(){},_registerAccelerometerEvent:function(){},update:function(e){this._accelCurTime>this._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<t?t:e<n?e:n},cc.pClamp=function(e,t,n){return cc.p(cc.clampf(e.x,t.x,n.x),cc.clampf(e.y,t.y,n.y))},cc.pFromSize=function(e){return cc.p(e.width,e.height)},cc.pCompOp=function(e,t){return cc.p(t(e.x),t(e.y))},cc.pLerp=function(e,t,n){return cc.pAdd(cc.pMult(e,1-n),cc.pMult(t,n))},cc.pFuzzyEqual=function(e,t,n){return e.x-n<=t.x&&t.x<=e.x+n&&e.y-n<=t.y&&t.y<=e.y+n?!0:!1},cc.pCompMult=function(
  3. e,t){return cc.p(e.x*t.x,e.y*t.y)},cc.pAngleSigned=function(e,t){var n=cc.pNormalize(e),r=cc.pNormalize(t),i=Math.atan2(n.x*r.y-n.y*r.x,cc.pDot(n,r));return Math.abs(i)<cc.POINT_EPSILON?0:i},cc.pAngle=function(e,t){var n=Math.acos(cc.pDot(cc.pNormalize(e),cc.pNormalize(t)));return Math.abs(n)<cc.POINT_EPSILON?0:n},cc.pRotateByAngle=function(e,t,n){var r=cc.pSub(e,t),i=Math.cos(n),s=Math.sin(n),o=r.x;return r.x=o*i-r.y*s+t.x,r.y=o*s+r.y*i+t.y,r},cc.pLineIntersect=function(e,t,n,r,i){if(e.x==t.x&&e.y==t.y||n.x==r.x&&n.y==r.y)return!1;var s=t.x-e.x,o=t.y-e.y,u=r.x-n.x,a=r.y-n.y,f=e.x-n.x,l=e.y-n.y,c=a*s-u*o;return i.x=u*l-a*f,i.y=s*l-o*f,c==0?i.x==0||i.y==0?!0:!1:(i.x=i.x/c,i.y=i.y/c,!0)},cc.pSegmentIntersect=function(e,t,n,r){var i=cc.p(0,0);return cc.pLineIntersect(e,t,n,r,i)&&i.x>=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<n;t+=1)r[t]=e[t];return r},cc._EventListenerVector=cc.Class.extend({_fixedListeners:null,_sceneGraphListeners:null,gt0Index:0,ctor:function(){this._fixedListeners=[],this._sceneGraphListeners=[]},size:function(){return this._fixedListeners.length+this._sceneGraphListeners.length},empty:function(){return this._fixedListeners.length===0&&this._sceneGraphListeners.length===0},push:function(e){e._getFixedPriority()==0?this._sceneGraphListeners.push(e):this._fixedListeners.push(e)},clearSceneGraphListeners:function(){this._sceneGraphListeners.length=0},clearFixedListeners:function(){this._fixedListeners.length=0},clear:function(){this._sceneGraphListeners.length=0,this._fixedListeners.length=0},getFixedPriorityListeners:function(){return this._fixedListeners},getSceneGraphPriorityListeners:function(){return this._sceneGraphListeners}}),cc.__getListenerID=function(e){var t=cc.Event,n=e.getType();return n===t.ACCELERATION?cc._EventListenerAcceleration.LISTENER_ID:n===t.CUSTOM?e.getEventName():n===t.KEYBOARD?cc._EventListenerKeyboard.LISTENER_ID:n===t.MOUSE?cc._EventListenerMouse.LISTENER_ID:(n===t.TOUCH&&cc.log(cc._LogInfos.__getListenerID),"")},cc.eventManager={DIRTY_NONE:0,DIRTY_FIXED_PRIORITY:1,DIRTY_SCENE_GRAPH_PRIORITY:2,DIRTY_ALL:3,_listenersMap:{},_priorityDirtyFlagMap:{},_nodeListenersMap:{},_nodePriorityMap:{},_globalZOrderNodeMap:{},_toAddedListeners:[],_dirtyNodes:[],_inDispatch:0,_isEnabled:!1,_nodePriorityIndex:0,_internalCustomListenerIDs:[cc.game.EVENT_HIDE,cc.game.EVENT_SHOW],_setDirtyForNode:function(e){this._nodeListenersMap[e.__instanceId]!=null&&this._dirtyNodes.push(e);var t=e.getChildren();for(var n=0,r=t.length;n<r;n++)this._setDirtyForNode(t[n])},pauseTarget:function(e,t){var n=this._nodeListenersMap[e.__instanceId],r,i;if(n)for(r=0,i=n.length;r<i;r++)n[r]._setPaused(!0);if(t===!0){var s=e.getChildren();for(r=0,i=s.length;r<i;r++)this.pauseTarget(s[r],!0)}},resumeTarget:function(e,t){var n=this._nodeListenersMap[e.__instanceId],r,i;if(n)for(r=0,i=n.length;r<i;r++)n[r]._setPaused(!1);this._setDirtyForNode(e);if(t===!0){var s=e.getChildren();for(r=0,i=s.length;r<i;r++)this.resumeTarget(s[r],!0)}},_addListener:function(e){this._inDispatch===0?this._forceAddEventListener(e):this._toAddedListeners.push(e)},_forceAddEventListener:function(e){var t=e._getListenerID(),n=this._listenersMap[t];n||(n=new cc._EventListenerVector,this._listenersMap[t]=n),n.push(e);if(e._getFixedPriority()==0){this._setDirty(t,this.DIRTY_SCENE_GRAPH_PRIORITY);var r=e._getSceneGraphPriority();r==null&&cc.log(cc._LogInfos.eventManager__forceAddEventListener),this._associateNodeAndEventListener(r,e),r.isRunning()&&this.resumeTarget(r)}else this._setDirty(t,this.DIRTY_FIXED_PRIORITY)},_getListeners:function(e){return this._listenersMap[e]},_updateDirtyFlagForSceneGraph:function(){if(this._dirtyNodes.length==0)return;var e=this._dirtyNodes,t,n,r=this._nodeListenersMap;for(var i=0,s=e.length;i<s;i++){t=r[e[i].__instanceId];if(t)for(var o=0,u=t.length;o<u;o++)n=t[o],n&&this._setDirty(n._getListenerID(),this.DIRTY_SCENE_GRAPH_PRIORITY)}this._dirtyNodes.length=0},_removeAllListenersInVector:function(e){if(!e)return;var t;for(var n=0;n<e.length;)t=e[n],t._setRegistered(!1),t._getSceneGraphPriority()!=null&&(this._dissociateNodeAndEventListener(t._getSceneGraphPriority(),t),t._setSceneGraphPriority(null)),this._inDispatch===0?cc.arrayRemoveObject(e,t):++n},_removeListenersForListenerID:function(e){var t=this._listenersMap[e],n;if(t){var r=t.getFixedPriorityListeners(),i=t.getSceneGraphPriorityListeners();this._removeAllListenersInVector(i),this._removeAllListenersInVector(r),delete this._priorityDirtyFlagMap[e],this._inDispatch||(t.clear(),delete this._listenersMap[e])}var s=this._toAddedListeners,o;for(n=0;n<s.length;)o=s[n],o&&o._getListenerID()==e?cc.arrayRemoveObject(s,o):++n},_sortEventListeners:function(e){var t=this.DIRTY_NONE,n=this._priorityDirtyFlagMap;n[e]&&(t=n[e]);if(t!=this.DIRTY_NONE){n[e]=this.DIRTY_NONE,t&this.DIRTY_FIXED_PRIORITY&&this._sortListenersOfFixedPriority(e);if(t&this.DIRTY_SCENE_GRAPH_PRIORITY){var r=cc.director.getRunningScene();r?this._sortListenersOfSceneGraphPriority(e,r):n[e]=this.DIRTY_SCENE_GRAPH_PRIORITY}}},_sortListenersOfSceneGraphPriority:function(e,t){var n=this._getListeners(e);if(!n)return;var r=n.getSceneGraphPriorityListeners();if(!r||r.length===0)return;this._nodePriorityIndex=0,this._nodePriorityMap={},this._visitTarget(t,!0),n.getSceneGraphPriorityListeners().sort(this._sortEventListenersOfSceneGraphPriorityDes)},_sortEventListenersOfSceneGraphPriorityDes:function(e,t){var n=cc.eventManager._nodePriorityMap;return n[t._getSceneGraphPriority().__instanceId]-n[e._getSceneGraphPriority().__instanceId]},_sortListenersOfFixedPriority:function(e){var t=this._listenersMap[e];if(!t)return;var n=t.getFixedPriorityListeners();if(!n||n.length===0)return;n.sort(this._sortListenersOfFixedPriorityAsc);var r=0;for(var i=n.length;r<i;){if(n[r]._getFixedPriority()>=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;i<r.length;)s=r[i],s._isRegistered()?++i:cc.arrayRemoveObject(r,s);if(n)for(i=0;i<n.length;)s=n[i],s._isRegistered()?++i:cc.arrayRemoveObject(n,s);r&&r.length===0&&t.clearSceneGraphListeners(),n&&n.length===0&&t.clearFixedListeners()},_updateListeners:function(e){var t=this._inDispatch;cc.assert(t>0,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;o<u;o++)this._forceAddEventListener(s[o]);this._toAddedListeners.length=0}},_onTouchEventCallback:function(e,t){if(!e._isRegistered)return!1;var n=t.event,r=t.selTouch;n._setCurrentTarget(e._node);var i=!1,s,o=n.getEventCode(),u=cc.EventTouch.EventCode;return o==u.BEGAN?e.onTouchBegan&&(i=e.onTouchBegan(r,n),i&&e._registered&&e._claimedTouches.push(r)):e._claimedTouches.length>0&&(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;o<r.length;o++){s.selTouch=r[o],this._dispatchEventToListeners(t,this._onTouchEventCallback,s);if(e.isStopped())return}if(n&&i.length>0){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(;o<e.gt0Index;++o){a=i[o];if(a.isEnabled()&&!a._isPaused()&&a._isRegistered()&&t(a,n)){r=!0;break}}if(s&&!r)for(u=0;u<s.length;u++){a=s[u];if(a.isEnabled()&&!a._isPaused()&&a._isRegistered()&&t(a,n)){r=!0;break}}if(i&&!r)for(;o<i.length;++o){a=i[o];if(a.isEnabled()&&!a._isPaused()&&a._isRegistered()&&t(a,n)){r=!0;break}}},_setDirty:function(e,t){var n=this._priorityDirtyFlagMap;n[e]==null?n[e]=t:n[e]=t|n[e]},_visitTarget:function(e,t){var n=e.getChildren(),r=0,i=n.length,s=this._globalZOrderNodeMap,o=this._nodeListenersMap;if(i>0){var u;for(;r<i;r++){u=n[r];if(!(u&&u.getLocalZOrder()<0))break;this._visitTarget(u,!1)}o[e.__instanceId]!=null&&(s[e.getGlobalZOrder()]||(s[e.getGlobalZOrder()]=[]),s[e.getGlobalZOrder()].push(e.__instanceId));for(;r<i;r++)u=n[r],u&&this._visitTarget(u,!1)}else o[e.__instanceId]!=null&&(s[e.getGlobalZOrder()]||(s[e.getGlobalZOrder()]=[]),s[e.getGlobalZOrder()].push(e.__instanceId));if(t){var a=[];for(var f in s)a.push(f);a.sort(this._sortNumberAsc);var l=a.length,c,h,p=this._nodePriorityMap;for(r=0;r<l;r++){c=s[a[r]];for(h=0;h<c.length;h++)p[c[h]]=++this._nodePriorityIndex}this._globalZOrderNodeMap={}}},_sortNumberAsc:function(e,t){return e-t},addListener:function(e,t){cc.assert(e&&t,cc._LogInfos.eventManager_addListener_2);if(e instanceof cc.EventListener){if(e._isRegistered()){cc.log(cc._LogInfos.eventManager_addListener_4);return}}else cc.assert(typeof t!="number",cc._LogInfos.eventManager_addListener_3),e=cc.EventListener.create(e);if(!e.checkAvailable())return;if(typeof t=="number"){if(t==0){cc.log(cc._LogInfos.eventManager_addListener);return}e._setSceneGraphPriority(null),e._setFixedPriority(t),e._setRegistered(!0),e._setPaused(!1),this._addListener(e)}else e._setSceneGraphPriority(t),e._setFixedPriority(0),e._setRegistered(!0),this._addListener(e)},addCustomListener:function(e,t){var n=cc._EventListenerCustom.create(e,t);return this.addListener(n,1),n},removeListener:function(e){if(e==null)return;var t,n=this._listenersMap;for(var r in n){var i=n[r],s=i.getFixedPriorityListeners(),o=i.getSceneGraphPriorityListeners();t=this._removeListenerInVector(o,e),t?this._setDirty(e._getListenerID(),this.DIRTY_SCENE_GRAPH_PRIORITY):(t=this._removeListenerInVector(s,e),t&&this._setDirty(e._getListenerID(),this.DIRTY_FIXED_PRIORITY)),i.empty()&&(delete this._priorityDirtyFlagMap[e._getListenerID()],delete n[r]);if(t)break}if(!t){var u=this._toAddedListeners;for(var a=0,f=u.length;a<f;a++){var l=u[a];if(l==e){cc.arrayRemoveObject(u,l);break}}}},_removeListenerInVector:function(e,t){if(e==null)return!1;for(var n=0,r=e.length;n<r;n++){var i=e[n];if(i==t)return i._setRegistered(!1),i._getSceneGraphPriority()!=null&&(this._dissociateNodeAndEventListener(i._getSceneGraphPriority(),i),i._setSceneGraphPriority(null)),this._inDispatch==0&&cc.arrayRemoveObject(e,i),!0}return!1},removeListeners:function(e,t){var n=this;if(e instanceof cc.Node){delete n._nodePriorityMap[e.__instanceId],cc.arrayRemoveObject(n._dirtyNodes,e);var r=n._nodeListenersMap[e.__instanceId];if(!r)return;var i=cc.copyArray(r),s;for(s=0;s<i.length;s++)n.removeListener(i[s]);i.length=0;var o=n._toAddedListeners;for(s=0;s<o.length;){var u=o[s];u._getSceneGraphPriority()==e?(u._setSceneGraphPriority(null),u._setRegistered(!1),o.splice(s,1)):++s}if(t===!0){var a=e.getChildren(),f;for(s=0,f=a.length;s<f;s++)n.removeListeners(a[s],!0)}}else e==cc.EventListener.TOUCH_ONE_BY_ONE?n._removeListenersForListenerID(cc._EventListenerTouchOneByOne.LISTENER_ID):e==cc.EventListener.TOUCH_ALL_AT_ONCE?n._removeListenersForListenerID(cc._EventListenerTouchAllAtOnce.LISTENER_ID):e==cc.EventListener.MOUSE?n._removeListenersForListenerID(cc._EventListenerMouse.LISTENER_ID):e==cc.EventListener.ACCELERATION?n._removeListenersForListenerID(cc._EventListenerAcceleration.LISTENER_ID):e==cc.EventListener.KEYBOARD?n._removeListenersForListenerID(cc._EventListenerKeyboard.LISTENER_ID):cc.log(cc._LogInfos.eventManager_removeListeners)},removeCustomListeners:function(e){this._removeListenersForListenerID(e)},removeAllListeners:function(){var e=this._listenersMap,t=this._internalCustomListenerIDs;for(var n in e)t.indexOf(n)===-1&&this._removeListenersForListenerID(n)},setPriority:function(e,t){if(e==null)return;var n=this._listenersMap;for(var r in n){var i=n[r],s=i.getFixedPriorityListeners();if(s){var o=s.indexOf(e);if(o!=-1){e._getSceneGraphPriority()!=null&&cc.log(cc._LogInfos.eventManager_setPriority),e._getFixedPriority()!==t&&(e._setFixedPriority(t),this._setDirty(e._getListenerID(),this.DIRTY_FIXED_PRIORITY));return}}}},setEnabled:function(e){this._isEnabled=e},isEnabled:function(){return this._isEnabled},dispatchEvent:function(e){if(!this._isEnabled)return;this._updateDirtyFlagForSceneGraph(),this._inDispatch++;if(!e||!e.getType)throw"event is undefined";if(e.getType()==cc.Event.TOUCH){this._dispatchTouchEvent(e),this._inDispatch--;return}var t=cc.__getListenerID(e);this._sortEventListeners(t);var n=this._listenersMap[t];n!=null&&this._dispatchEventToListeners(n,this._onListenerCallback,e),this._updateListeners(e),this._inDispatch--},_onListenerCallback:function(e,t){return t._setCurrentTarget(e._getSceneGraphPriority()),e._onEvent(t),t.isStopped()},dispatchCustomEvent:function(e,t){var n=new cc.EventCustom(e);n.setUserData(t),this.dispatchEvent(n)}},cc._tmp.PrototypeCCNode=function(){var e=cc.Node.prototype;cc.defineGetterSetter(e,"x",e.getPositionX,e.setPositionX),cc.defineGetterSetter(e,"y",e.getPositionY,e.setPositionY),e.width,cc.defineGetterSetter(e,"width",e._getWidth,e._setWidth),e.height,cc.defineGetterSetter(e,"height",e._getHeight,e._setHeight),e.anchorX,cc.defineGetterSetter(e,"anchorX",e._getAnchorX,e._setAnchorX),e.anchorY,cc.defineGetterSetter(e,"anchorY",e._getAnchorY,e._setAnchorY),e.skewX,cc.defineGetterSetter(e,"skewX",e.getSkewX,e.setSkewX),e.skewY,cc.defineGetterSetter(e,"skewY",e.getSkewY,e.setSkewY),e.zIndex,cc.defineGetterSetter(e,"zIndex",e.getLocalZOrder,e.setLocalZOrder),e.vertexZ,cc.defineGetterSetter(e,"vertexZ",e.getVertexZ,e.setVertexZ),e.rotation,cc.defineGetterSetter(e,"rotation",e.getRotation,e.setRotation),e.rotationX,cc.defineGetterSetter(e,"rotationX",e.getRotationX,e.setRotationX),e.rotationY,cc.defineGetterSetter(e,"rotationY",e.getRotationY,e.setRotationY),e.scale,cc.defineGetterSetter(e,"scale",e.getScale,e.setScale),e.scaleX,cc.defineGetterSetter(e,"scaleX",e.getScaleX,e.setScaleX),e.scaleY,cc.defineGetterSetter(e,"scaleY",e.getScaleY,e.setScaleY),e.children,cc.defineGetterSetter(e,"children",e.getChildren),e.childrenCount,cc.defineGetterSetter(e,"childrenCount",e.getChildrenCount),e.parent,cc.defineGetterSetter(e,"parent",e.getParent,e.setParent),e.visible,cc.defineGetterSetter(e,"visible",e.isVisible,e.setVisible),e.running,cc.defineGetterSetter(e,"running",e.isRunning),e.ignoreAnchor,cc.defineGetterSetter(e,"ignoreAnchor",e.isIgnoreAnchorPointForPosition,e.ignoreAnchorPointForPosition),e.tag,e.userData,e.userObject,e.arrivalOrder,e.actionManager,cc.defineGetterSetter(e,"actionManager",e.getActionManager,e.setActionManager),e.scheduler,cc.defineGetterSetter(e,"scheduler",e.getScheduler,e.setScheduler),e.shaderProgram,cc.defineGetterSetter(e,"shaderProgram",e.getShaderProgram,e.setShaderProgram),e.glServerState,cc.defineGetterSetter(e,"glServerState",e.getGLServerState,e.setGLServerState),e.opacity,cc.defineGetterSetter(e,"opacity",e.getOpacity,e.setOpacity),e.opacityModifyRGB,cc.defineGetterSetter(e,"opacityModifyRGB",e.isOpacityModifyRGB,e.setOpacityModifyRGB),e.cascadeOpacity,cc.defineGetterSetter(e,"cascadeOpacity",e.isCascadeOpacityEnabled,e.setCascadeOpacityEnabled),e.color,cc.defineGetterSetter(e,"color",e.getColor,e.setColor),e.cascadeColor,cc.defineGetterSetter(e,"cascadeColor",e.isCascadeColorEnabled,e.setCascadeColorEnabled)},cc.NODE_TAG_INVALID=-1,cc.s_globalOrderOfArrival=1,cc.Node=cc.Class.extend({_localZOrder:0,_globalZOrder:0,_vertexZ:0,_rotationX:0,_rotationY:0,_scaleX:1,_scaleY:1,_position:null,_skewX:0,_skewY:0,_children:null,_visible:!0,_anchorPoint:null,_anchorPointInPoints:null,_contentSize:null,_running:!1,_parent:null,_ignoreAnchorPointForPosition:!1,tag:cc.NODE_TAG_INVALID,userData:null,userObject:null,_transformDirty:!0,_inverseDirty:!0,_cacheDirty:!0,_cachedParent:null,_transformGLDirty:null,_transform:null,_inverse:null,_reorderChildDirty:!1,_shaderProgram:null,arrivalOrder:0,_actionManager:null,_scheduler:null,_eventDispatcher:null,_initializedNode:!1,_additionalTransformDirty:!1,_additionalTransform:null,_componentContainer:null,_isTransitionFinished:!1,_rotationRadiansX:0,_rotationRadiansY:0,_className:"Node",_showNode:!1,_name:"",_displayedOpacity:255,_realOpacity:255,_displayedColor:null,_realColor:null,_cascadeColorEnabled:!1,_cascadeOpacityEnabled:!1,_usingNormalizedPosition:!1,_hashOfName:0,_initNode:function(){var e=this;e._anchorPoint=cc.p(0,0),e._anchorPointInPoints=cc.p(0,0),e._contentSize=cc.size(0,0),e._position=cc.p(0,0),e._children=[],e._transform={a:1,b:0,c:0,d:1,tx:0,ty:0};var t=cc.director;e._actionManager=t.getActionManager(),e._scheduler=t.getScheduler(),e._initializedNode=!0,e._additionalTransform=cc.affineTransformMakeIdentity(),cc.ComponentContainer&&(e._componentContainer=new cc.ComponentContainer(e)),this._displayedOpacity=255,this._realOpacity=255,this._displayedColor=cc.color(255,255,255,255),this._realColor=cc.color(255,255,255,255),this._cascadeColorEnabled=!1,this._cascadeOpacityEnabled=!1},init:function(){return this._initializedNode===!1&&this._initNode(),!0},_arrayMakeObjectsPerformSelector:function(e,t){if(!e||e.length===0)return;var n,r=e.length,i,s=cc.Node.StateCallbackType;switch(t){case s.onEnter:for(n=0;n<r;n++)i=e[n],i&&i.onEnter();break;case s.onExit:for(n=0;n<r;n++)i=e[n],i&&i.onExit();break;case s.onEnterTransitionDidFinish:for(n=0;n<r;n++)i=e[n],i&&i.onEnterTransitionDidFinish();break;case s.cleanup:for(n=0;n<r;n++)i=e[n],i&&i.cleanup();break;case s.updateTransform:for(n=0;n<r;n++)i=e[n],i&&i.updateTransform();break;case s.onExitTransitionDidStart:for(n=0;n<r;n++)i=e[n],i&&i.onExitTransitionDidStart();break;case s.sortAllChildren:for(n=0;n<r;n++)i=e[n],i&&i.sortAllChildren();break;default:cc.assert(0,cc._LogInfos.Node__arrayMakeObjectsPerformSelector)}},setNodeDirty:null,attr:function(e){for(var t in e)this[t]=e[t]},getSkewX:function(){return this._skewX},setSkewX:function(e){this._skewX=e,this.setNodeDirty()},getSkewY:function(){return this._skewY},setSkewY:function(e){this._skewY=e,this.setNodeDirty()},setLocalZOrder:function(e){this._localZOrder=e,this._parent&&this._parent.reorderChild(this,e),cc.eventManager._setDirtyForNode(this)},_setLocalZOrder:function(e){this._localZOrder=e},getLocalZOrder:function(){return this._localZOrder},getZOrder:function(){return cc.log(cc._LogInfos.Node_getZOrder),this.getLocalZOrder()},setZOrder:function(e){cc.log(cc._LogInfos.Node_setZOrder),this.setLocalZOrder(e)},setGlobalZOrder:function(e){this._globalZOrder!=e&&(this._globalZOrder=e,cc.eventManager._setDirtyForNode(this))},getGlobalZOrder:function(){return this._globalZOrder},getVertexZ:function(){return this._vertexZ},setVertexZ:function(e){this._vertexZ=e},getRotation:function(){return this._rotationX!==this._rotationY&&cc.log(cc._LogInfos.Node_getRotation),this._rotationX},setRotation:function(e){this._rotationX=this._rotationY=e,this._rotationRadiansX=this._rotationX*.017453292519943295,this._rotationRadiansY=this._rotationY*.017453292519943295,this.setNodeDirty()},getRotationX:function(){return this._rotationX},setRotationX:function(e){this._rotationX=e,this._rotationRadiansX=this._rotationX*.017453292519943295,this.setNodeDirty()},getRotationY:function(){return this._rotationY},setRotationY:function(e){this._rotationY=e,this._rotationRadiansY=this._rotationY*.017453292519943295,this.setNodeDirty()},getScale:function(){return this._scaleX!==this._scaleY&&cc.log(cc._LogInfos.Node_getScale),this._scaleX},setScale:function(e,t){this._scaleX=e,this._scaleY=t||t===0?t:e,this.setNodeDirty()},getScaleX:function(){return this._scaleX},setScaleX:function(e){this._scaleX=e,this.setNodeDirty()},getScaleY:function(){return this._scaleY},setScaleY:function(e){this._scaleY=e,this.setNodeDirty()},setPosition:function(e,t){var n=this._position;t===undefined?(n.x=e.x,n.y=e.y):(n.x=e,n.y=t),this.setNodeDirty()},getPosition:function(){return cc.p(this._position)},getPositionX:function(){return this._position.x},setPositionX:function(e){this._position.x=e,this.setNodeDirty()},getPositionY:function(){return this._position.y},setPositionY:function(e){this._position.y=e,this.setNodeDirty()},getChildrenCount:function(){return this._children.length},getChildren:function(){return this._children},isVisible:function(){return this._visible},setVisible:function(e){this._visible=e,this.setNodeDirty()},getAnchorPoint:function(){return cc.p(this._anchorPoint)},setAnchorPoint:function(e,t){var n=this._anchorPoint;if(t===undefined){if(e.x===n.x&&e.y===n.y)return;n.x=e.x,n.y=e.y}else{if(e===n.x&&t===n.y)return;n.x=e,n.y=t}var r=this._anchorPointInPoints,i=this._contentSize;r.x=i.width*n.x,r.y=i.height*n.y,this.setNodeDirty()},_getAnchor:function(){return this._anchorPoint},_setAnchor:function(e){var t=e.x,n=e.y;this._anchorPoint.x!==t&&(this._anchorPoint.x=t,this._anchorPointInPoints.x=this._contentSize.width*t),this._anchorPoint.y!==n&&(this._anchorPoint.y=n,this._anchorPointInPoints.y=this._contentSize.height*n),this.setNodeDirty()},_getAnchorX:function(){return this._anchorPoint.x},_setAnchorX:function(e){if(this._anchorPoint.x===e)return;this._anchorPoint.x=e,this._anchorPointInPoints.x=this._contentSize.width*e,this.setNodeDirty()},_getAnchorY:function(){return this._anchorPoint.y},_setAnchorY:function(e){if(this._anchorPoint.y===e)return;this._anchorPoint.y=e,this._anchorPointInPoints.y=this._contentSize.height*e,this.setNodeDirty()},getAnchorPointInPoints:function(){return cc.p(this._anchorPointInPoints)},_getWidth:function(){return this._contentSize.width},_setWidth:function(e){this._contentSize.width=e,this._anchorPointInPoints.x=e*this._anchorPoint.x,this.setNodeDirty()},_getHeight:function(){return this._contentSize.height},_setHeight:function(e){this._contentSize.height=e,
  4. this._anchorPointInPoints.y=e*this._anchorPoint.y,this.setNodeDirty()},getContentSize:function(){return cc.size(this._contentSize)},setContentSize:function(e,t){var n=this._contentSize;if(t===undefined){if(e.width===n.width&&e.height===n.height)return;n.width=e.width,n.height=e.height}else{if(e===n.width&&t===n.height)return;n.width=e,n.height=t}var r=this._anchorPointInPoints,i=this._anchorPoint;r.x=n.width*i.x,r.y=n.height*i.y,this.setNodeDirty()},isRunning:function(){return this._running},getParent:function(){return this._parent},setParent:function(e){this._parent=e},isIgnoreAnchorPointForPosition:function(){return this._ignoreAnchorPointForPosition},ignoreAnchorPointForPosition:function(e){e!=this._ignoreAnchorPointForPosition&&(this._ignoreAnchorPointForPosition=e,this.setNodeDirty())},getTag:function(){return this.tag},setTag:function(e){this.tag=e},setName:function(e){this._name},getName:function(){return this._name},getUserData:function(){return this.userData},setUserData:function(e){this.userData=e},getUserObject:function(){return this.userObject},setUserObject:function(e){this.userObject!=e&&(this.userObject=e)},getOrderOfArrival:function(){return this.arrivalOrder},setOrderOfArrival:function(e){this.arrivalOrder=e},getActionManager:function(){return this._actionManager||(this._actionManager=cc.director.getActionManager()),this._actionManager},setActionManager:function(e){this._actionManager!=e&&(this.stopAllActions(),this._actionManager=e)},getScheduler:function(){return this._scheduler||(this._scheduler=cc.director.getScheduler()),this._scheduler},setScheduler:function(e){this._scheduler!=e&&(this.unscheduleAllCallbacks(),this._scheduler=e)},getBoundingBox:function(){var e=cc.rect(0,0,this._contentSize.width,this._contentSize.height);return cc._rectApplyAffineTransformIn(e,this.nodeToParentTransform())},cleanup:function(){this.stopAllActions(),this.unscheduleAllCallbacks(),cc.eventManager.removeListeners(this),this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.cleanup)},getChildByTag:function(e){var t=this._children;if(t!=null)for(var n=0;n<t.length;n++){var r=t[n];if(r&&r.tag==e)return r}return null},getChildByName:function(e){if(!e)return cc.log("Invalid name"),null;var t=this._children;for(var n=0,r=t.length;n<r;n++)if(t[n]._name==e)return t[n];return null},addChild:function(e,t,n){var e=e,t=t===undefined?e._localZOrder:t,n,r,i=!1;switch(typeof n){case"undefined":n=undefined,r=e._name;break;case"string":r=n,n=undefined;break;case"number":i=!0,r=""}cc.assert(e,cc._LogInfos.Node_addChild_3),cc.assert(e._parent===null,"child already added. It can't be added again"),this.addChildHelper(e,t,n,r,i)},addChildHelper:function(e,t,n,r,i){this._children||(this._children=[]),this._insertChild(e,t),i?e.setTag(n):e.setName(r),e.setParent(this),e.setOrderOfArrival(this.s_globalOrderOfArrival++),this._running&&(e.onEnter(),this._isTransitionFinished&&e.onEnterTransitionDidFinish()),this._cascadeColorEnabled&&this._enableCascadeColor(),this._cascadeOpacityEnabled&&this._enableCascadeOpacity()},getName:function(){return this._name},setName:function(e){this._name=e},removeFromParent:function(e){this._parent&&(e==null&&(e=!0),this._parent.removeChild(this,e))},removeFromParentAndCleanup:function(e){cc.log(cc._LogInfos.Node_removeFromParentAndCleanup),this.removeFromParent(e)},removeChild:function(e,t){if(this._children.length===0)return;t==null&&(t=!0),this._children.indexOf(e)>-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<t.length;n++){var r=t[n];r&&(this._running&&(r.onExitTransitionDidStart(),r.onExit()),e&&r.cleanup(),r.parent=null)}this._children.length=0}},_detachChild:function(e,t){this._running&&(e.onExitTransitionDidStart(),e.onExit()),t&&e.cleanup(),e.parent=null,cc.arrayRemoveObject(this._children,e)},_insertChild:function(e,t){this._reorderChildDirty=!0,this._children.push(e),e._setLocalZOrder(t)},reorderChild:function(e,t){cc.assert(e,cc._LogInfos.Node_reorderChild),this._reorderChildDirty=!0,e.arrivalOrder=cc.s_globalOrderOfArrival,cc.s_globalOrderOfArrival++,e._setLocalZOrder(t),this.setNodeDirty()},sortAllChildren:function(){if(this._reorderChildDirty){var e=this._children,t=e.length,n,r,i;for(n=1;n<t;n++){i=e[n],r=n-1;while(r>=0){if(i._localZOrder<e[r]._localZOrder)e[r+1]=e[r];else{if(!(i._localZOrder===e[r]._localZOrder&&i.arrivalOrder<e[r].arrivalOrder))break;e[r+1]=e[r]}r--}e[r+1]=i}this._reorderChildDirty=!1}},draw:function(e){},transformAncestors:function(){this._parent!=null&&(this._parent.transformAncestors(),this._parent.transform())},onEnter:function(){this._isTransitionFinished=!1,this._running=!0,this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.onEnter),this.resume()},onEnterTransitionDidFinish:function(){this._isTransitionFinished=!0,this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.onEnterTransitionDidFinish)},onExitTransitionDidStart:function(){this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.onExitTransitionDidStart)},onExit:function(){this._running=!1,this.pause(),this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.onExit),this._componentContainer&&this._componentContainer.removeAll()},runAction:function(e){return cc.assert(e,cc._LogInfos.Node_runAction),this.actionManager.addAction(e,this,!this._running),e},stopAllActions:function(){this.actionManager&&this.actionManager.removeAllActionsFromTarget(this)},stopAction:function(e){this.actionManager.removeAction(e)},stopActionByTag:function(e){if(e===cc.ACTION_TAG_INVALID){cc.log(cc._LogInfos.Node_stopActionByTag);return}this.actionManager.removeActionByTag(e,this)},getActionByTag:function(e){return e===cc.ACTION_TAG_INVALID?(cc.log(cc._LogInfos.Node_getActionByTag),null):this.actionManager.getActionByTag(e,this)},getNumberOfRunningActions:function(){return this.actionManager.numberOfRunningActionsInTarget(this)},scheduleUpdate:function(){this.scheduleUpdateWithPriority(0)},scheduleUpdateWithPriority:function(e){this.scheduler.scheduleUpdateForTarget(this,e,!this._running)},unscheduleUpdate:function(){this.scheduler.unscheduleUpdateForTarget(this)},schedule:function(e,t,n,r){t=t||0,cc.assert(e,cc._LogInfos.Node_schedule),cc.assert(t>=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;n<r;n++)t[n]._setCachedParent(e)},getCamera:function(){return this._camera||(this._camera=new cc.Camera),this._camera},getGrid:function(){return this.grid},setGrid:function(e){this.grid=e},getShaderProgram:function(){return this._shaderProgram},setShaderProgram:function(e){this._shaderProgram=e},getGLServerState:function(){return this._glServerState},setGLServerState:function(e){this._glServerState=e},getBoundingBoxToWorld:function(){var e=cc.rect(0,0,this._contentSize.width,this._contentSize.height),t=this.nodeToWorldTransform();e=cc.rectApplyAffineTransform(e,this.nodeToWorldTransform());if(!this._children)return e;var n=this._children;for(var r=0;r<n.length;r++){var i=n[r];if(i&&i._visible){var s=i._getBoundingBoxToCurrentNode(t);s&&(e=cc.rectUnion(e,s))}}return e},_getBoundingBoxToCurrentNode:function(e){var t=cc.rect(0,0,this._contentSize.width,this._contentSize.height),n=e==null?this.nodeToParentTransform():cc.affineTransformConcat(this.nodeToParentTransform(),e);t=cc.rectApplyAffineTransform(t,n);if(!this._children)return t;var r=this._children;for(var i=0;i<r.length;i++){var s=r[i];if(s&&s._visible){var o=s._getBoundingBoxToCurrentNode(n);o&&(t=cc.rectUnion(t,o))}}return t},_updateColor:function(){},getOpacity:function(){return this._realOpacity},getDisplayedOpacity:function(){return this._displayedOpacity},setOpacity:function(e){this._displayedOpacity=this._realOpacity=e;var t=255,n=this._parent;n&&n.cascadeOpacity&&(t=n.getDisplayedOpacity()),this.updateDisplayedOpacity(t),this._displayedColor.a=this._realColor.a=e},updateDisplayedOpacity:function(e){this._displayedOpacity=this._realOpacity*e/255;if(this._cascadeOpacityEnabled){var t=this._children;for(var n=0;n<t.length;n++){var r=t[n];r&&r.updateDisplayedOpacity(this._displayedOpacity)}}},isCascadeOpacityEnabled:function(){return this._cascadeOpacityEnabled},setCascadeOpacityEnabled:function(e){if(this._cascadeOpacityEnabled===e)return;this._cascadeOpacityEnabled=e,e?this._enableCascadeOpacity():this._disableCascadeOpacity()},_enableCascadeOpacity:function(){var e=255,t=this._parent;t&&t.cascadeOpacity&&(e=t.getDisplayedOpacity()),this.updateDisplayedOpacity(e)},_disableCascadeOpacity:function(){this._displayedOpacity=this._realOpacity;var e=this._children;for(var t=0;t<e.length;t++){var n=e[t];n&&n.updateDisplayedOpacity(255)}},getColor:function(){var e=this._realColor;return cc.color(e.r,e.g,e.b,e.a)},getDisplayedColor:function(){var e=this._displayedColor;return cc.color(e.r,e.g,e.b,e.a)},setColor:function(e){var t=this._displayedColor,n=this._realColor;t.r=n.r=e.r,t.g=n.g=e.g,t.b=n.b=e.b;var r,i=this._parent;i&&i.cascadeColor?r=i.getDisplayedColor():r=cc.color.WHITE,this.updateDisplayedColor(r),e.a!==undefined&&!e.a_undefined&&this.setOpacity(e.a)},updateDisplayedColor:function(e){var t=this._displayedColor,n=this._realColor;t.r=0|n.r*e.r/255,t.g=0|n.g*e.g/255,t.b=0|n.b*e.b/255;if(this._cascadeColorEnabled){var r=this._children;for(var i=0;i<r.length;i++){var s=r[i];s&&s.updateDisplayedColor(t)}}},isCascadeColorEnabled:function(){return this._cascadeColorEnabled},setCascadeColorEnabled:function(e){if(this._cascadeColorEnabled===e)return;this._cascadeColorEnabled=e,this._cascadeColorEnabled?this._enableCascadeColor():this._disableCascadeColor()},_enableCascadeColor:function(){var e,t=this._parent;t&&t.cascadeColor?e=t.getDisplayedColor():e=cc.color.WHITE,this.updateDisplayedColor(e)},_disableCascadeColor:function(){var e=this._displayedColor,t=this._realColor;e.r=t.r,e.g=t.g,e.b=t.b;var n=this._children,r=cc.color.WHITE;for(var i=0;i<n.length;i++){var s=n[i];s&&s.updateDisplayedColor(r)}},setOpacityModifyRGB:function(e){},isOpacityModifyRGB:function(){return!1}}),cc.Node.create=function(){return new cc.Node},cc.Node.StateCallbackType={onEnter:1,onExit:2,cleanup:3,onEnterTransitionDidFinish:4,updateTransform:5,onExitTransitionDidStart:6,sortAllChildren:7};var _p=cc.Node.prototype;_p.ctor=function(){this._initNode()},_p.setNodeDirty=function(){var e=this;e._setNodeDirtyForCache(),e._transformDirty===!1&&(e._transformDirty=e._inverseDirty=!0)},_p.visit=function(e){var t=this;if(!t._visible)return;var n=e||cc._renderContext,r,i=t._children,s;n.save(),t.transform(n);var o=i.length;if(o>0){t.sortAllChildren();for(r=0;r<o;r++){s=i[r];if(!(s._localZOrder<0))break;s.visit(n)}t.draw(n);for(;r<o;r++)i[r].visit(n)}else t.draw(n);this._cacheDirty=!1,t.arrivalOrder=0,n.restore()},_p.transform=function(e){var t=e||cc._renderContext,n=cc.view,r=this.nodeToParentTransform();t.transform(r.a,r.c,r.b,r.d,r.tx*n.getScaleX(),-r.ty*n.getScaleY())},_p.nodeToParentTransform=function(){var e=this;if(e._transformDirty){var t=e._transform;t.tx=e._position.x,t.ty=e._position.y;var n=1,r=0;e._rotationX&&(n=Math.cos(e._rotationRadiansX),r=Math.sin(e._rotationRadiansX)),t.a=t.d=n,t.b=-r,t.c=r;var i=e._scaleX,s=e._scaleY,o=e._anchorPointInPoints.x,u=e._anchorPointInPoints.y,a=i<1e-6&&i>-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"<cc.Texture2D | width = "+this._contentSize.width+" height "+this._contentSize.height+">"},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<t.length;n++){var r=t[n];r.eventTarget==e&&t.splice(n,1)}},_callLoadedEventCallbacks:function(){if(!this._loadedEventListeners)return;var e=this._loadedEventListeners;for(var t=0,n=e.length;t<n;t++){var r=e[t];r.eventCallback.call(r.eventTarget,this)}e.length=0}}),cc.assert(typeof cc._tmp.PrototypeTexture2D=="function",cc._LogInfos.MissingFile,"TexturesPropertyDefine.js"),cc._tmp.PrototypeTexture2D(),delete cc._tmp.PrototypeTexture2D,cc.textureCache={_textures:{},_textureColorsCache:{},_textureKeySeq:0|Math.random()*1e3,_loadedTexturesBefore:{},_initializingRenderer:function(){var e,t=this._loadedTexturesBefore,n=this._textures;for(e in t){var r=t[e];r.handleLoadedTexture(),n[e]=r}this._loadedTexturesBefore={}},addPVRTCImage:function(e){cc.log(cc._LogInfos.textureCache_addPVRTCImage)},addETCImage:function(e){cc.log(cc._LogInfos.textureCache_addETCImage)},description:function(){return"<TextureCache | Number of textures = "+this._textures.length+">"},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;t<n;t++)e[t]._setCachedParent(this);this._bakeSprite||(this._bakeSprite=new cc.BakeSprite)}},p.unbake=function(){if(this._isBaked){this._isBaked=!1,this._cacheDirty=!0,this._cachedParent=null;var e=this._children;for(var t=0,n=e.length;t<n;t++)e[t]._setCachedParent(null)}},p.visit=function(e){if(!this._isBaked){cc.Node.prototype.visit.call(this,e);return}var t=e||cc._renderContext,n,r=this,i=r._children,s=i.length;if(!r._visible||s===0)return;var o=this._bakeSprite;t.save(),r.transform(t);if(this._cacheDirty){var u=this._getBoundingBoxForBake();u.width=0|u.width,u.height=0|u.height;var a=o.getCacheContext();o.resetCanvasSize(u.width,u.height),a.translate(0-u.x,u.height+u.y);var f=o.getAnchorPointInPoints();o.setPosition(f.x+u.x,f.y+u.y),r.sortAllChildren(),cc.view._setScaleXYForRenderTexture();for(n=0;n<s;n++)i[n].visit(a);cc.view._resetScale(),this._cacheDirty=!1}o.visit(t),r.arrivalOrder=0,t.restore()},p._getBoundingBoxForBake=function(){var e=null;if(!this._children||this._children.length===0)return cc.rect(0,0,10,10);var t=this._children;for(var n=0;n<t.length;n++){var r=t[n];if(r&&r._visible)if(e){var i=r._getBoundingBoxToCurrentNode();i&&(e=cc.rectUnion(e,i))}else e=r._getBoundingBoxToCurrentNode()}return e},p=null,cc.LayerColor=cc.Layer.extend({_blendFunc:null,_className:"LayerColor",getBlendFunc:function(){return this._blendFunc},changeWidthAndHeight:function(e,t){this.width=e,this.height=t},changeWidth:function(e){this.width=e},changeHeight:function(e){this.height=e},setOpacityModifyRGB:function(e){},isOpacityModifyRGB:function(){return!1},setColor:function(e){cc.Layer.prototype.setColor.call(this,e),this._updateColor()},setOpacity:function(e){cc.Layer.prototype.setOpacity.call(this,e),this._updateColor()},_isLighterMode:!1,ctor:null,init:function(e,t,n){var r=cc.director.getWinSize();e=e||cc.color(0,0,0,255),t=t===undefined?r.width:t,n=n===undefined?r.height:n;var i=this._displayedColor;i.r=e.r,i.g=e.g,i.b=e.b;var s=this._realColor;s.r=e.r,s.g=e.g,s.b=e.b,this._displayedOpacity=e.a,this._realOpacity=e.a;var o=cc.LayerColor.prototype;return o.setContentSize.call(this,t,n),o._updateColor.call(this),!0},setBlendFunc:function(e,t){var n=this;t===undefined?n._blendFunc=e:n._blendFunc={src:e,dst:t},n._isLighterMode=n._blendFunc&&n._blendFunc.src==1&&n._blendFunc.dst==771},_setWidth:null,_setHeight:null,_updateColor:null,updateDisplayedColor:function(e){cc.Layer.prototype.updateDisplayedColor.call(this,e),this._updateColor()},updateDisplayedOpacity:function(e){cc.Layer.prototype.updateDisplayedOpacity.call(this,e),this._updateColor()},draw:null}),cc.LayerColor.create=function(e,t,n){return new cc.LayerColor(e,t,n)};var _p=cc.LayerColor.prototype;_p.ctor=function(e,t,n){cc.Layer.prototype.ctor.call(this),this._blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST),cc.LayerColor.prototype.init.call(this,e,t,n)},_p._setWidth=cc.Layer.prototype._setWidth,_p._setHeight=cc.Layer.prototype._setHeight,_p._updateColor=function(){},_p.draw=function(e){var t=e||cc._renderContext,n=this,r=cc.view,i=n._displayedColor;t.fillStyle="rgba("+(0|i.r)+","+(0|i.g)+","+(0|i.b)+","+n._displayedOpacity/255+")",t.fillRect(0,0,n.width*r.getScaleX(),-n.height*r.getScaleY()),cc.g_NumberOfDraws++},_p.visit=function(e){if(!this._isBaked){cc.Node.prototype.visit.call(this,e);return}var t=e||cc._renderContext,n,r=this,i=r._children,s=i.length;if(!r._visible)return;var o=this._bakeSprite;t.save(),r.transform(t);if(this._cacheDirty){var u=this._getBoundingBoxForBake();u.width=0|u.width,u.height=0|u.height;var a=o.getCacheContext();o.resetCanvasSize(u.width,u.height);var f=o.getAnchorPointInPoints(),l=this._position;if(this._ignoreAnchorPointForPosition)a.translate(0-u.x+l.x,u.height+u.y-l.y),o.setPosition(f.x+u.x-l.x,f.y+u.y-l.y);else{var c=this.getAnchorPointInPoints(),h={x:l.x-c.x,y:l.y-c.y};a.translate(0-u.x+h.x,u.height+u.y-h.y),o.setPosition(f.x+u.x-h.x,f.y+u.y-h.y)}var p;cc.view._setScaleXYForRenderTexture();if(s>0){r.sortAllChildren();for(n=0;n<s;n++){p=i[n];if(!(p._localZOrder<0))break;p.visit(a)}r.draw(a);for(;n<s;n++)i[n].visit(a)}else r.draw(a);cc.view._resetScale(),this._cacheDirty=!1}o.visit(t),r.arrivalOrder=0,t.restore()},_p._getBoundingBoxForBake=function(){var e=cc.rect(0,0,this._contentSize.width,this._contentSize.height),t=this.nodeToWorldTransform();e=cc.rectApplyAffineTransform(e,this.nodeToWorldTransform());if(!this._children||this._children.length===0)return e;var n=this._children;for(var r=0;r<n.length;r++){var i=n[r];if(i&&i._visible){var s=i._getBoundingBoxToCurrentNode(t);e=cc.rectUnion(e,s)}}return e},_p=null,cc.assert(typeof cc._tmp.PrototypeLayerColor=="function",cc._LogInfos.MissingFile,"CCLayerPropertyDefine.js"),cc._tmp.PrototypeLayerColor(),delete cc._tmp.PrototypeLayerColor,cc.LayerGradient=cc.LayerColor.extend({_startColor:null,_endColor:null,_startOpacity:255,_endOpacity:255,_alongVector:null,_compressedInterpolation:!1,_gradientStartPoint:null,_gradientEndPoint:null,_className:"LayerGradient",ctor:function(e,t,n){var r=this;cc.LayerColor.prototype.ctor.call(r),r._startColor=cc.color(0,0,0,255),r._endColor=cc.color(0,0,0,255),r._alongVector=cc.p(0,-1),r._startOpacity=255,r._endOpacity=255,r._gradientStartPoint=cc.p(0,0),r._gradientEndPoint=cc.p(0,0),cc.LayerGradient.prototype.init.call(r,e,t,n)},init:function(e,t,n){e=e||cc.color(0,0,0,255),t=t||cc.color(0,0,0,255),n=n||cc.p(0,-1);var r=this,i=r._startColor,s=r._endColor;return i.r=e.r,i.g=e.g,i.b=e.b,r._startOpacity=e.a,s.r=t.r,s.g=t.g,s.b=t.b,r._endOpacity=t.a,r._alongVector=n,r._compressedInterpolation=!0,r._gradientStartPoint=cc.p(0,0),r._gradientEndPoint=cc.p(0,0),cc.LayerColor.prototype.init.call(r,cc.color(e.r,e.g,e.b,255)),cc.LayerGradient.prototype._updateColor.call(r),!0},setContentSize:function(e,t){cc.LayerColor.prototype.setContentSize.call(this,e,t),this._updateColor()},_setWidth:function(e){cc.LayerColor.prototype._setWidth.call(this,e),this._updateColor()},_setHeight:function(e){cc.LayerColor.prototype._setHeight.call(this,e),this._updateColor()},getStartColor:function(){return this._realColor},setStartColor:function(e){this.color=e},setEndColor:function(e){this._endColor=e,this._updateColor
  5. ()},getEndColor:function(){return this._endColor},setStartOpacity:function(e){this._startOpacity=e,this._updateColor()},getStartOpacity:function(){return this._startOpacity},setEndOpacity:function(e){this._endOpacity=e,this._updateColor()},getEndOpacity:function(){return this._endOpacity},setVector:function(e){this._alongVector.x=e.x,this._alongVector.y=e.y,this._updateColor()},getVector:function(){return cc.p(this._alongVector.x,this._alongVector.y)},isCompressedInterpolation:function(){return this._compressedInterpolation},setCompressedInterpolation:function(e){this._compressedInterpolation=e,this._updateColor()},_draw:null,_updateColor:null}),cc.LayerGradient.create=function(e,t,n){return new cc.LayerGradient(e,t,n)};var _p=cc.LayerGradient.prototype;_p.draw=function(e){var t=e||cc._renderContext,n=this;n._isLighterMode&&(t.globalCompositeOperation="lighter"),t.save();var r=n._displayedOpacity/255,i=cc.view.getScaleX(),s=cc.view.getScaleY(),o=n.width*i,u=n.height*s,a=t.createLinearGradient(n._gradientStartPoint.x*i,n._gradientStartPoint.y*s,n._gradientEndPoint.x*i,n._gradientEndPoint.y*s),f=n._displayedColor,l=n._endColor;a.addColorStop(0,"rgba("+Math.round(f.r)+","+Math.round(f.g)+","+Math.round(f.b)+","+(r*(n._startOpacity/255)).toFixed(4)+")"),a.addColorStop(1,"rgba("+Math.round(l.r)+","+Math.round(l.g)+","+Math.round(l.b)+","+(r*(n._endOpacity/255)).toFixed(4)+")"),t.fillStyle=a,t.fillRect(0,0,o,-u),n._rotation!=0&&t.rotate(n._rotationRadians),t.restore(),cc.g_NumberOfDraws++},_p._updateColor=function(){var e=this,t=e._alongVector,n=e.width*.5,r=e.height*.5;e._gradientStartPoint.x=n*-t.x+n,e._gradientStartPoint.y=r*t.y-r,e._gradientEndPoint.x=n*t.x+n,e._gradientEndPoint.y=r*-t.y-r},_p=null,cc.assert(typeof cc._tmp.PrototypeLayerGradient=="function",cc._LogInfos.MissingFile,"CCLayerPropertyDefine.js"),cc._tmp.PrototypeLayerGradient(),delete cc._tmp.PrototypeLayerGradient,cc.LayerMultiplex=cc.Layer.extend({_enabledLayer:0,_layers:null,_className:"LayerMultiplex",ctor:function(e){cc.Layer.prototype.ctor.call(this),e instanceof Array?cc.LayerMultiplex.prototype.initWithLayers.call(this,e):cc.LayerMultiplex.prototype.initWithLayers.call(this,Array.prototype.slice.call(arguments))},initWithLayers:function(e){return e.length>0&&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<o.length;c+=4)l[c]=u===0?o[c]:0,l[c+1]=u===1?o[c+1]:0,l[c+2]=u===2?o[c+2]:0,l[c+3]=o[c+3];a.putImageData(f,0,0)}e.onload=null}if(e.channelCache)return e.channelCache;var t=[cc.newElement("canvas"),cc.newElement("canvas"),cc.newElement("canvas"),cc.newElement("canvas")];try{n()}catch(r){e.onload=n}return e.channelCache=t,t},cc.generateTextureCacheForColor.canvas=cc.newElement("canvas"),cc.generateTextureCacheForColor.tempCanvas=cc.newElement("canvas"),cc.generateTextureCacheForColor.tempCtx=cc.generateTextureCacheForColor.tempCanvas.getContext("2d"),cc.cutRotateImageToCanvas=function(e,t){if(!e)return null;if(!t)return e;var n=cc.newElement("canvas");n.width=t.width,n.height=t.height;var r=n.getContext("2d");return r.translate(n.width/2,n.height/2),r.rotate(-1.5707963267948966),r.drawImage(e,t.x,t.y,t.height,t.width,-t.height/2,-t.width/2,t.height,t.width),n},cc.Sprite=cc.Node.extend({dirty:!1,atlasIndex:0,textureAtlas:null,_batchNode:null,_recursiveDirty:null,_hasChildren:null,_shouldBeHidden:!1,_transformToBatch:null,_blendFunc:null,_texture:null,_rect:null,_rectRotated:!1,_offsetPosition:null,_unflippedOffsetPositionFromCenter:null,_opacityModifyRGB:!1,_flippedX:!1,_flippedY:!1,_textureLoaded:!1,_loadedEventListeners:null,_newTextureWhenChangeColor:null,_className:"Sprite",textureLoaded:function(){return this._textureLoaded},addLoadedEventListener:function(e,t){this._loadedEventListeners||(this._loadedEventListeners=[]),this._loadedEventListeners.push({eventCallback:e,eventTarget:t})},_callLoadedEventCallbacks:function(){if(!this._loadedEventListeners)return;var e=this._loadedEventListeners;for(var t=0,n=e.length;t<n;t++){var r=e[t];r.eventCallback.call(r.eventTarget,this)}e.length=0},isDirty:function(){return this.dirty},setDirty:function(e){this.dirty=e},isTextureRectRotated:function(){return this._rectRotated},getAtlasIndex:function(){return this.atlasIndex},setAtlasIndex:function(e){this.atlasIndex=e},getTextureRect:function(){return cc.rect(this._rect.x,this._rect.y,this._rect.width,this._rect.height)},getTextureAtlas:function(){return this.textureAtlas},setTextureAtlas:function(e){this.textureAtlas=e},getOffsetPosition:function(){return cc.p(this._offsetPosition)},_getOffsetX:function(){return this._offsetPosition.x},_getOffsetY:function(){return this._offsetPosition.y},getBlendFunc:function(){return this._blendFunc},initWithSpriteFrame:function(e){cc.assert(e,cc._LogInfos.Sprite_initWithSpriteFrame),e.textureLoaded()||(this._textureLoaded=!1,e.addLoadedEventListener(this._spriteFrameLoadedCallback,this));var t=!1,n=this.initWithTexture(e.getTexture(),e.getRect(),t);return this.setSpriteFrame(e),n},_spriteFrameLoadedCallback:null,initWithSpriteFrameName:function(e){cc.assert(e,cc._LogInfos.Sprite_initWithSpriteFrameName);var t=cc.spriteFrameCache.getSpriteFrame(e);return cc.assert(t,e+cc._LogInfos.Sprite_initWithSpriteFrameName1),this.initWithSpriteFrame(t)},useBatchNode:function(e){this.textureAtlas=e.textureAtlas,this._batchNode=e},setVertexRect:function(e){this._rect.x=e.x,this._rect.y=e.y,this._rect.width=e.width,this._rect.height=e.height},sortAllChildren:function(){if(this._reorderChildDirty){var e=this._children,t=e.length,n,r,i;for(n=1;n<t;n++){i=e[n],r=n-1;while(r>=0){if(i._localZOrder<e[r]._localZOrder)e[r+1]=e[r];else{if(!(i._localZOrder===e[r]._localZOrder&&i.arrivalOrder<e[r].arrivalOrder))break;e[r+1]=e[r]}r--}e[r+1]=i}this._batchNode&&this._arrayMakeObjectsPerformSelector(e,cc.Node.StateCallbackType.sortAllChildren),this._reorderChildDirty=!1}},reorderChild:function(e,t){cc.assert(e,cc._LogInfos.Sprite_reorderChild_2);if(this._children.indexOf(e)===-1){cc.log(cc._LogInfos.Sprite_reorderChild);return}if(t===e.zIndex)return;this._batchNode&&!this._reorderChildDirty&&(this._setReorderChildDirtyRecursively(),this._batchNode.reorderBatch(!0)),cc.Node.prototype.reorderChild.call(this,e,t)},removeChild:function(e,t){this._batchNode&&this._batchNode.removeSpriteFromAtlas(e),cc.Node.prototype.removeChild.call(this,e,t)},removeAllChildren:function(e){var t=this._children,n=this._batchNode;if(n&&t!=null)for(var r=0,i=t.length;r<i;r++)n.removeSpriteFromAtlas(t[r]);cc.Node.prototype.removeAllChildren.call(this,e),this._hasChildren=!1},setDirtyRecursively:function(e){this._recursiveDirty=e,this.dirty=e;var t=this._children,n,r=t?t.length:0;for(var i=0;i<r;i++)n=t[i],n instanceof cc.Sprite&&n.setDirtyRecursively(!0)},setNodeDirty:function(e){cc.Node.prototype.setNodeDirty.call(this),!e&&this._batchNode&&!this._recursiveDirty&&(this._hasChildren?this.setDirtyRecursively(!0):(this._recursiveDirty=!0,this.dirty=!0))},ignoreAnchorPointForPosition:function(e){if(this._batchNode){cc.log(cc._LogInfos.Sprite_ignoreAnchorPointForPosition);return}cc.Node.prototype.ignoreAnchorPointForPosition.call(this,e)},setFlippedX:function(e){this._flippedX!=e&&(this._flippedX=e,this.setTextureRect(this._rect,this._rectRotated,this._contentSize),this.setNodeDirty(!0))},setFlippedY:function(e){this._flippedY!=e&&(this._flippedY=e,this.setTextureRect(this._rect,this._rectRotated,this._contentSize),this.setNodeDirty(!0))},isFlippedX:function(){return this._flippedX},isFlippedY:function(){return this._flippedY},setOpacityModifyRGB:null,isOpacityModifyRGB:function(){return this._opacityModifyRGB},updateDisplayedOpacity:null,setDisplayFrameWithAnimationName:function(e,t){cc.assert(e,cc._LogInfos.Sprite_setDisplayFrameWithAnimationName_3);var n=cc.animationCache.getAnimation(e);if(!n){cc.log(cc._LogInfos.Sprite_setDisplayFrameWithAnimationName);return}var r=n.getFrames()[t];if(!r){cc.log(cc._LogInfos.Sprite_setDisplayFrameWithAnimationName_2);return}this.setSpriteFrame(r.getSpriteFrame())},getBatchNode:function(){return this._batchNode},_setReorderChildDirtyRecursively:function(){if(!this._reorderChildDirty){this._reorderChildDirty=!0;var e=this._parent;while(e&&e!=this._batchNode)e._setReorderChildDirtyRecursively(),e=e.parent}},getTexture:function(){return this._texture},_quad:null,_quadWebBuffer:null,_quadDirty:!1,_colorized:!1,_isLighterMode:!1,_originalTexture:null,_textureRect_Canvas:null,_drawSize_Canvas:null,ctor:null,_softInit:function(e,t,n){if(e===undefined)cc.Sprite.prototype.init.call(this);else if(typeof e=="string")if(e[0]==="#"){var r=e.substr(1,e.length-1),i=cc.spriteFrameCache.getSpriteFrame(r);this.initWithSpriteFrame(i)}else cc.Sprite.prototype.init.call(this,e,t);else if(typeof e=="object")if(e instanceof cc.Texture2D)this.initWithTexture(e,t,n);else if(e instanceof cc.SpriteFrame)this.initWithSpriteFrame(e);else if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var s=new cc.Texture2D;s.initWithElement(e),s.handleLoadedTexture(),this.initWithTexture(s)}},getQuad:function(){return this._quad},setBlendFunc:null,init:null,initWithFile:function(e,t){cc.assert(e,cc._LogInfos.Sprite_initWithFile);var n=cc.textureCache.textureForKey(e);if(!n)return n=cc.textureCache.addImage(e),this.initWithTexture(n,t||cc.rect(0,0,n._contentSize.width,n._contentSize.height));if(!t){var r=n.getContentSize();t=cc.rect(0,0,r.width,r.height)}return this.initWithTexture(n,t)},initWithTexture:null,_textureLoadedCallback:null,setTextureRect:null,updateTransform:null,addChild:null,updateColor:function(){var e=this._displayedColor,t=this._displayedOpacity,n={r:e.r,g:e.g,b:e.b,a:t};this._opacityModifyRGB&&(n.r*=t/255,n.g*=t/255,n.b*=t/255);var r=this._quad;r.bl.colors=n,r.br.colors=n,r.tl.colors=n,r.tr.colors=n,this._batchNode&&(this.atlasIndex!=cc.Sprite.INDEX_NOT_INITIALIZED?this.textureAtlas.updateQuad(r,this.atlasIndex):this.dirty=!0),this._quadDirty=!0},setOpacity:null,setColor:null,updateDisplayedColor:null,setSpriteFrame:null,setDisplayFrame:function(e){cc.log(cc._LogInfos.Sprite_setDisplayFrame),this.setSpriteFrame(e)},isFrameDisplayed:null,displayFrame:function(){return cc.SpriteFrame.create(this._texture,cc.rectPointsToPixels(this._rect),this._rectRotated,cc.pointPointsToPixels(this._unflippedOffsetPositionFromCenter),cc.sizePointsToPixels(this._contentSize))},setBatchNode:null,setTexture:null,_updateBlendFunc:function(){if(this._batchNode){cc.log(cc._LogInfos.Sprite__updateBlendFunc);return}!this._texture||!this._texture.hasPremultipliedAlpha()?(this._blendFunc.src=cc.SRC_ALPHA,this._blendFunc.dst=cc.ONE_MINUS_SRC_ALPHA,this.opacityModifyRGB=!1):(this._blendFunc.src=cc.BLEND_SRC,this._blendFunc.dst=cc.BLEND_DST,this.opacityModifyRGB=!0)},_changeTextureColor:function(){var e,t=this._texture,n=this._textureRect_Canvas;if(t&&n.validRect&&this._originalTexture){e=t.getHtmlElementObj();if(!e)return;this._colorized=!0,e instanceof HTMLCanvasElement&&!this._rectRotated&&!this._newTextureWhenChangeColor?cc.generateTintImageWithMultiply(this._originalTexture._htmlElementObj,this._displayedColor,n,e):(e=cc.generateTintImageWithMultiply(this._originalTexture._htmlElementObj,this._displayedColor,n),t=new cc.Texture2D,t.initWithElement(e),t.handleLoadedTexture(),this.texture=t)}},_setTextureCoords:function(e){e=cc.rectPointsToPixels(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},draw:null}),cc.Sprite.create=function(e,t,n){return new cc.Sprite(e,t,n)},cc.Sprite.INDEX_NOT_INITIALIZED=-1;var _p=cc.Sprite.prototype;_p._spriteFrameLoadedCallback=function(e){var t=this;t.setNodeDirty(!0),t.setTextureRect(e.getRect(),e.isRotated(),e.getOriginalSize());var n=t.color;(n.r!==255||n.g!==255||n.b!==255)&&t._changeTextureColor(),t._callLoadedEventCallbacks()},_p.setOpacityModifyRGB=function(e){this._opacityModifyRGB!==e&&(this._opacityModifyRGB=e,this.setNodeDirty(!0))},_p.updateDisplayedOpacity=function(e){cc.Node.prototype.updateDisplayedOpacity.call(this,e),this._setNodeDirtyForCache()},_p.ctor=function(e,t,n){var r=this;cc.Node.prototype.ctor.call(r),r._shouldBeHidden=!1,r._offsetPosition=cc.p(0,0),r._unflippedOffsetPositionFromCenter=cc.p(0,0),r._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST},r._rect=cc.rect(0,0,0,0),r._newTextureWhenChangeColor=!1,r._textureLoaded=!0,r._textureRect_Canvas={x:0,y:0,width:0,height:0,validRect:!1},r._drawSize_Canvas=cc.size(0,0),r._softInit(e,t,n)},_p.setBlendFunc=function(e,t){var n=this._blendFunc;t===undefined?(n.src=e.src,n.dst=e.dst):(n.src=e,n.dst=t),this._isLighterMode=n&&(n.src==cc.SRC_ALPHA&&n.dst==cc.ONE||n.src==cc.ONE&&n.dst==cc.ONE)},_p.init=function(){var e=this;return arguments.length>0?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;i<e.length;i++){var s=e[i];r.push(s),this._totalDelayUnits+=s.getDelayUnits()}return!0},clone:function(){var e=new cc.Animation;return e.initWithAnimationFrames(this._copyFrames(),this._delayPerUnit,this._loops),e.setRestoreOriginalFrame(this._restoreOriginalFrame),e},copyWithZone:function(e){var t=new cc.Animation;return t.initWithAnimationFrames(this._copyFrames(),this._delayPerUnit,this._loops),t.setRestoreOriginalFrame(this._restoreOriginalFrame),t},_copyFrames:function(){var e=[];for(var t=0;t<this._frames.length;t++)e.push(this._frames[t].clone());return e},copy:function(e){return this.copyWithZone(null)},getLoops:function(){return this._loops},setLoops:function(e){this._loops=e},setRestoreOriginalFrame:function(e){this._restoreOriginalFrame=e},getRestoreOriginalFrame:function(){return this._restoreOriginalFrame},getDuration:function(){return this._totalDelayUnits*this._delayPerUnit},getDelayPerUnit:function(){return this._delayPerUnit},setDelayPerUnit:function(e){this._delayPerUnit=e},getTotalDelayUnits:function(){return this._totalDelayUnits},initWithSpriteFrames:function(e,t,n){cc.arrayVerifyType(e,cc.SpriteFrame),this._loops=n===undefined?1:n,this._delayPerUnit=t||0,this._totalDelayUnits=0;var r=this._frames;r.length=0;if(e){for(var i=0;i<e.length;i++){var s=e[i],o=new cc.AnimationFrame;o.initWithSpriteFrame(s,1,null),r.push(o)}this._totalDelayUnits+=e.length}return!0},retain:function(){},release:function(){}}),cc.Animation.create=function(e,t,n){return new cc.Animation(e,t,n)},cc.animationCache={_animations:{},addAnimation:function(e,t){this._animations[t]=e},removeAnimation:function(e){if(!e)return;this._animations[e]&&delete this._animations[e]},getAnimation:function(e){return this._animations[e]?this._animations[e]:null},_addAnimationsWithDictionary:function(e,t){var n=e.animations;if(!n){cc.log(cc._LogInfos.animationCache__addAnimationsWithDictionary);return}var r=1,i=e.properties;if(i){r=i["format"]!=null?parseInt(i.format):r;var s=i.spritesheets,o=cc.spriteFrameCache,u=cc.path;for(var a=0;a<s.length;a++)o.addSpriteFrames(u.changeBasename(t,s[a]))}switch(r){case 1:this._parseVersion1(n);break;case 2:this._parseVersion2(n);break;default:cc.log(cc._LogInfos.animationCache__addAnimationsWithDictionary_2)}},addAnimations:function(e){cc.assert(e,cc._LogInfos.animationCache_addAnimations_2);var t=cc.loader.getRes(e);if(!t){cc.log(cc._LogInfos.animationCache_addAnimations);return}this._addAnimationsWithDictionary(t,e)},_parseVersion1:function(e){var t=cc.spriteFrameCache;for(var n in e){var r=e[n],i=r.frames,s=parseFloat(r.delay)||0,o=null;if(!i){cc.log(cc._LogInfos.animationCache__parseVersion1,n);continue}var u=[];for(var a=0;a<i.length;a++){var f=t.getSpriteFrame(i[a]);if(!f){cc.log(cc._LogInfos.animationCache__parseVersion1_2,n,i[a]);continue}var l=new cc.AnimationFrame;l.initWithSpriteFrame(f,1,null),u.push(l)}if(u.length===0){cc.log(cc._LogInfos.animationCache__parseVersion1_3,n);continue}u.length!=i.length&&cc.log(cc._LogInfos.animationCache__parseVersion1_4,n),o=cc.Animation.create(u,s,1),cc.animationCache.addAnimation(o,n)}},_parseVersion2:function(e){var t=cc.spriteFrameCache;for(var n in e){var r=e[n],i=r.loop,s=parseInt(r.loops),o=i?cc.REPEAT_FOREVER:isNaN(s)?1:s,u=r.restoreOriginalFrame&&r["restoreOriginalFrame"]==1?!0:!1,a=r.frames;if(!a){cc.log(cc._LogInfos.animationCache__parseVersion2,n);continue}var f=[];for(var l=0;l<a.length;l++){var c=a[l],h=c.spriteframe,p=t.getSpriteFrame(h);if(!p){cc.log(cc._LogInfos.animationCache__parseVersion2_2,n,h);continue}var d=parseFloat(c.delayUnits)||0,v=c.notification,m=new cc.AnimationFrame;m.initWithSpriteFrame(p,d,v),f.push(m)}var g=parseFloat(r.delayPerUnit)||0,y=new cc.Animation;y.initWithAnimationFrames(f,g,o),y.setRestoreOriginalFrame(u),cc.animationCache.addAnimation(y,n)}},_clear:function(){this._animations={}}},cc.SpriteFrame=cc.Class.extend({_offset:null,_originalSize:null,_rectInPixels:null,_rotated:!1,_rect:null,_offsetInPixels:null,_originalSizeInPixels:null,_texture:null,_textureFilename:"",_textureLoaded:!1,_eventListeners:null,ctor:function(e,t,n,r,i){this._offset=cc.p(0,0),this._offsetInPixels=cc.p(0,0),this._originalSize=cc.size(0,0),this._rotated=!1,this._originalSizeInPixels=cc.size(0,0),this._textureFilename="",this._texture=null,this._textureLoaded=!1,e!==undefined&&t!==undefined&&(n===undefined||r===undefined||i===undefined?this.initWithTexture(e,t):this.initWithTexture(e,t,n,r,i))},textureLoaded:function(){return this._textureLoaded},addLoadedEventListener:function(e,t){this._eventListeners==null&&(this._eventListeners=[]),this._eventListeners.push({eventCallback:e,eventTarget:t})},_callLoadedEventCallbacks:function(){var e=this._eventListeners;if(!e)return;for(var t=0,n=e.length;t<n;t++){var r=e[t];r.eventCallback.call(r.eventTarget,this)}e.length=0},getRectInPixels:function(){var e=this._rectInPixels;return cc.rect(e.x,e.y,e.width,e.height)},setRectInPixels:function(e){this._rectInPixels||(this._rectInPixels=cc.rect(0,0,0,0)),this._rectInPixels.x=e.x,this._rectInPixels.y=e.y,this._rectInPixels.width=e.width,this._rectInPixels.height=e.height,this._rect=cc.rectPixelsToPoints(e)},isRotated:function(){return this._rotated},setRotated:function(e){this._rotated=e},getRect:function(){var e=this._rect;return cc.rect(e.x,e.y,e.width,e.height)},setRect:function(e){this._rect||(this._rect=cc.rect(0,0,0,0)),this._rect.x=e.x,this._rect.y=e.y,this._rect.width=e.width,this._rect.height=e.height,this._rectInPixels=cc.rectPointsToPixels(this._rect)},getOffsetInPixels:function(){return cc.p(this._offsetInPixels)},setOffsetInPixels:function(e){this._offsetInPixels.x=e.x,this._offsetInPixels.y=e.y,cc._pointPixelsToPointsOut(this._offsetInPixels,this._offset)},getOriginalSizeInPixels:function(){return cc.size(this._originalSizeInPixels)},setOriginalSizeInPixels:function(e){this._originalSizeInPixels.width=e.width,this._originalSizeInPixels.height=e.height},getOriginalSize:function(){return cc.size(this._originalSize)},setOriginalSize:function(e){this._originalSize.width=e.width,this._originalSize.height=e.height},getTexture:function(){if(this._texture)return this._texture;if(this._textureFilename!==""){var e=cc.textureCache.addImage(this._textureFilename);return e&&(this._textureLoaded=e.isLoaded()),e}return null},setTexture:function(e){if(this._texture!=e){var t=e.isLoaded();this._textureLoaded=t,this._texture=e,t||e.addLoadedEventListener(function(e){this._textureLoaded=!0;if(this._rotated){var t=e.getHtmlElementObj();t=cc.cutRotateImageToCanvas(t,this.getRect());var n=new cc.Texture2D;n.initWithElement(t),n.handleLoadedTexture(),this.setTexture(n);var r=this.getRect();this.setRect(cc.rect(0,0,r.width,r.height))}var i=this._rect;if(i.width===0&&i.height===0){var s=e.width,o=e.height;this._rect.width=s,this._rect.height=o,this._rectInPixels=cc.rectPointsToPixels(this._rect),this._originalSizeInPixels.width=this._rectInPixels.width,this._originalSizeInPixels.height=this._rectInPixels.height,this._originalSize.width=s,this._originalSize.height=o}this._callLoadedEventCallbacks()},this)}},getOffset:function(){return cc.p(this._offset)},setOffset:function(e){this._offset.x=e.x,this._offset.y=e.y},clone:function(){var e=new cc.SpriteFrame
  6. ;return e.initWithTexture(this._textureFilename,this._rectInPixels,this._rotated,this._offsetInPixels,this._originalSizeInPixels),e.setTexture(this._texture),e},copyWithZone:function(){var e=new cc.SpriteFrame;return e.initWithTexture(this._textureFilename,this._rectInPixels,this._rotated,this._offsetInPixels,this._originalSizeInPixels),e.setTexture(this._texture),e},copy:function(){return this.copyWithZone()},initWithTexture:function(e,t,n,r,i){arguments.length===2&&(t=cc.rectPointsToPixels(t)),r=r||cc.p(0,0),i=i||t,n=n||!1,typeof e=="string"?(this._texture=null,this._textureFilename=e):e instanceof cc.Texture2D&&this.setTexture(e),e=this.getTexture();if(e&&e.url){var s,o;n?(s=t.x+t.height,o=t.y+t.width):(s=t.x+t.width,o=t.y+t.height),s>e.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;d<v;d++){var m=p[d];a[m]&&cc.log(cc._LogInfos.spriteFrameCache_addSpriteFrames,m),a[m]=l}if(h.isRotated()){var g=h.getTexture();if(g.isLoaded()){var y=h.getTexture().getHtmlElementObj();y=cc.cutRotateImageToCanvas(y,h.getRectInPixels());var b=new cc.Texture2D;b.initWithElement(y),b.handleLoadedTexture(),h.setTexture(b);var w=h._rect;h.setRect(cc.rect(0,0,w.width,w.height))}}f[l]=h}}},_checkConflict:function(e){var t=e.frames;for(var n in t)this._spriteFrames[n]&&cc.log(cc._LogInfos.spriteFrameCache__checkConflict,n)},addSpriteFrame:function(e,t){this._spriteFrames[t]=e},removeSpriteFrames:function(){this._spriteFrames={},this._spriteFramesAliases={}},removeSpriteFrameByName:function(e){if(!e)return;this._spriteFramesAliases[e]&&delete this._spriteFramesAliases[e],this._spriteFrames[e]&&delete this._spriteFrames[e]},removeSpriteFramesFromFile:function(e){var t=this,n=t._spriteFrames,r=t._spriteFramesAliases,i=t._frameConfigCache[e];if(!i)return;var s=i.frames;for(var o in s)if(n[o]){delete n[o];for(var u in r)r[u]==o&&delete r[u]}},removeSpriteFramesFromTexture:function(e){var t=this,n=t._spriteFrames,r=t._spriteFramesAliases;for(var i in n){var s=n[i];if(s&&s.getTexture()==e){delete n[i];for(var o in r)r[o]==i&&delete r[o]}}},getSpriteFrame:function(e){var t=this,n=t._spriteFrames[e];if(!n){var r=t._spriteFramesAliases[e];r&&(n=t._spriteFrames[r.toString()],n||delete t._spriteFramesAliases[e])}return n},_clear:function(){this._spriteFrames={},this._spriteFramesAliases={},this._frameConfigCache={}}},cc.g_NumberOfDraws=0,cc.Director=cc.Class.extend({_landscape:!1,_nextDeltaTimeZero:!1,_paused:!1,_purgeDirectorInNextLoop:!1,_sendCleanupToScene:!1,_animationInterval:0,_oldAnimationInterval:0,_projection:0,_accumDt:0,_contentScaleFactor:1,_displayStats:!1,_deltaTime:0,_frameRate:0,_FPSLabel:null,_SPFLabel:null,_drawsLabel:null,_winSizeInPoints:null,_lastUpdate:null,_nextScene:null,_notificationNode:null,_openGLView:null,_scenesStack:null,_projectionDelegate:null,_runningScene:null,_frames:0,_totalFrames:0,_secondsPerFrame:0,_dirtyRegion:null,_scheduler:null,_actionManager:null,_eventProjectionChanged:null,_eventAfterDraw:null,_eventAfterVisit:null,_eventAfterUpdate:null,ctor:function(){var e=this;e._lastUpdate=Date.now(),cc.eventManager.addCustomListener(cc.game.EVENT_SHOW,function(){e._lastUpdate=Date.now()})},init:function(){return this._oldAnimationInterval=this._animationInterval=1/cc.defaultFPS,this._scenesStack=[],this._projection=cc.Director.PROJECTION_DEFAULT,this._projectionDelegate=null,this._accumDt=0,this._frameRate=0,this._displayStats=!1,this._totalFrames=this._frames=0,this._lastUpdate=Date.now(),this._paused=!1,this._purgeDirectorInNextLoop=!1,this._winSizeInPoints=cc.size(0,0),this._openGLView=null,this._contentScaleFactor=1,this._scheduler=new cc.Scheduler,this._actionManager=cc.ActionManager?new cc.ActionManager:null,this._scheduler.scheduleUpdateForTarget(this._actionManager,cc.Scheduler.PRIORITY_SYSTEM,!1),this._eventAfterDraw=new cc.EventCustom(cc.Director.EVENT_AFTER_DRAW),this._eventAfterDraw.setUserData(this),this._eventAfterVisit=new cc.EventCustom(cc.Director.EVENT_AFTER_VISIT),this._eventAfterVisit.setUserData(this),this._eventAfterUpdate=new cc.EventCustom(cc.Director.EVENT_AFTER_UPDATE),this._eventAfterUpdate.setUserData(this),this._eventProjectionChanged=new cc.EventCustom(cc.Director.EVENT_PROJECTION_CHANGED),this._eventProjectionChanged.setUserData(this),!0},calculateDeltaTime:function(){var e=Date.now();this._nextDeltaTimeZero?(this._deltaTime=0,this._nextDeltaTimeZero=!1):this._deltaTime=(e-this._lastUpdate)/1e3,this._lastUpdate=e},drawScene:function(){this.calculateDeltaTime(),this._paused||(this._scheduler.update(this._deltaTime),cc.eventManager.dispatchEvent(this._eventAfterUpdate)),this._clear(),this._nextScene&&this.setNextScene(),this._beforeVisitScene&&this._beforeVisitScene(),this._runningScene&&(this._runningScene.visit(),cc.eventManager.dispatchEvent(this._eventAfterVisit)),this._notificationNode&&this._notificationNode.visit(),this._displayStats&&this._showStats(),this._afterVisitScene&&this._afterVisitScene(),cc.eventManager.dispatchEvent(this._eventAfterDraw),this._totalFrames++,this._displayStats&&this._calculateMPF()},_beforeVisitScene:null,_afterVisitScene:null,end:function(){this._purgeDirectorInNextLoop=!0},getContentScaleFactor:function(){return this._contentScaleFactor},getNotificationNode:function(){return this._notificationNode},getWinSize:function(){return cc.size(this._winSizeInPoints)},getWinSizeInPixels:function(){return cc.size(this._winSizeInPoints.width*this._contentScaleFactor,this._winSizeInPoints.height*this._contentScaleFactor)},pause:function(){if(this._paused)return;this._oldAnimationInterval=this._animationInterval,this.setAnimationInterval(.25),this._paused=!0},popScene:function(){cc.assert(this._runningScene,cc._LogInfos.Director_popScene),this._scenesStack.pop();var e=this._scenesStack.length;e==0?this.end():(this._sendCleanupToScene=!0,this._nextScene=this._scenesStack[e-1])},purgeCachedData:function(){cc.animationCache._clear(),cc.spriteFrameCache._clear(),cc.textureCache._clear()},purgeDirector:function(){this.getScheduler().unscheduleAllCallbacks(),cc.eventManager&&cc.eventManager.setEnabled(!1),this._runningScene&&(this._runningScene.onExitTransitionDidStart(),this._runningScene.onExit(),this._runningScene.cleanup()),this._runningScene=null,this._nextScene=null,this._scenesStack.length=0,this.stopAnimation(),this.purgeCachedData()},pushScene:function(e){cc.assert(e,cc._LogInfos.Director_pushScene),this._sendCleanupToScene=!1,this._scenesStack.push(e),this._nextScene=e},runScene:function(e){cc.assert(e,cc._LogInfos.Director_pushScene);if(!this._runningScene)this.pushScene(e),this.startAnimation();else{var t=this._scenesStack.length;t===0?(this._sendCleanupToScene=!0,this._scenesStack[t]=e,this._nextScene=e):(this._sendCleanupToScene=!0,this._scenesStack[t-1]=e,this._nextScene=e)}},resume:function(){if(!this._paused)return;this.setAnimationInterval(this._oldAnimationInterval),this._lastUpdate=Date.now(),this._lastUpdate||cc.log(cc._LogInfos.Director_resume),this._paused=!1,this._deltaTime=0},setContentScaleFactor:function(e){e!=this._contentScaleFactor&&(this._contentScaleFactor=e,this._createStatsLabel())},setDefaultValues:function(){},setNextDeltaTimeZero:function(e){this._nextDeltaTimeZero=e},setNextScene:function(){var e=!1,t=!1;cc.TransitionScene&&(e=this._runningScene?this._runningScene instanceof cc.TransitionScene:!1,t=this._nextScene?this._nextScene instanceof cc.TransitionScene:!1);if(!t){var n=this._runningScene;n&&(n.onExitTransitionDidStart(),n.onExit()),this._sendCleanupToScene&&n&&n.cleanup()}this._runningScene=this._nextScene,this._nextScene=null,!e&&this._runningScene!=null&&(this._runningScene.onEnter(),this._runningScene.onEnterTransitionDidFinish())},setNotificationNode:function(e){this._notificationNode=e},getDelegate:function(){return this._projectionDelegate},setDelegate:function(e){this._projectionDelegate=e},_showStats:function(){this._frames++,this._accumDt+=this._deltaTime,this._FPSLabel&&this._SPFLabel&&this._drawsLabel?(this._accumDt>cc.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;n<e.length;n++)if(!(e[n]instanceof t))return cc.log(cc._LogInfos.arrayVerifyType),!1;return!0},cc.arrayRemoveObject=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]==t){e.splice(n,1);break}},cc.arrayRemoveArray=function(e,t){for(var n=0,r=t.length;n<r;n++)cc.arrayRemoveObject(e,t[n])},cc.arrayAppendObjectsToIndex=function(e,t,n){return e.splice.apply(e,[n,0].concat(t)),e},cc.ListEntry=function(e,t,n,r,i,s){this.prev=e,this.next=t,this.target=n,this.priority=r,this.paused=i,this.markedForDeletion=s},cc.HashUpdateEntry=function(e,t,n,r){this.list=e,this.entry=t,this.target=n,this.hh=r},cc.HashTimerEntry=function(e,t,n,r,i,s,o){var u=this;u.timers=e,u.target=t,u.timerIndex=n,u.currentTimer=r,u.currentTimerSalvaged=i,u.paused=s,u.hh=o},cc.Timer=cc.Class.extend({_interval:0,_callback:null,_target:null,_elapsed:0,_runForever:!1,_useDelay:!1,_timesExecuted:0,_repeat:0,_delay:0,getInterval:function(){return this._interval},setInterval:function(e){this._interval=e},getCallback:function(){return this._callback},ctor:function(e,t,n,r,i){var s=this;s._target=e,s._callback=t,s._elapsed=-1,s._interval=n||0,s._delay=i||0,s._useDelay=s._delay>0,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<e[u].priority){o=u;break}e.splice(u,0,s)}var a=new cc.HashUpdateEntry(e,s,t,null);return i._arrayForUpdates.push(a),i._hashForUpdates[t.__instanceId]=a,e},_appendIn:function(e,t,n){var r=this,i=new cc.ListEntry(null,null,t,0,n,!1);e.push(i);var s=new cc.HashUpdateEntry(e,i,t,null);r._arrayForUpdates.push(s),r._hashForUpdates[t.__instanceId]=s},setTimeScale:function(e){this._timeScale=e},getTimeScale:function(){return this._timeScale},update:function(e){var t=this,n=t._updates,r=t._arrayForTimers,i,s,o,u;t._updateHashLocked=!0,this._timeScale!=1&&(e*=this._timeScale);for(o=0,u=n.length;o<u&&o>=0;o++){var a=t._updates[o];for(var f=0,l=a.length;f<l;f++)i=a[f],!i.paused&&!i.markedForDeletion&&i.target.update(e)}for(o=0,u=r.length;o<u;o++){s=r[o];if(!s)break;t._currentTarget=s,t._currentTargetSalvaged=!1;if(!s.paused)for(s.timerIndex=0;s.timerIndex<s.timers.length;s.timerIndex++)s.currentTimer=s.timers[s.timerIndex],s.currentTimerSalvaged=!1,s.currentTimer.update(e),s.currentTimer=null;t._currentTargetSalvaged&&s.timers.length==0&&(t._removeHashElement(s),o--)}for(o=0,u=n.length;o<u;o++){var a=t._updates[o];for(var f=0,l=a.length;f<l;){i=a[f];if(!i)break;i.markedForDeletion?t._removeUpdateFromHash(i):f++}}t._updateHashLocked=!1,t._currentTarget=null},scheduleCallbackForTarget:function(e,t,n,r,i,s){cc.assert(t,cc._LogInfos.Scheduler_scheduleCallbackForTarget_2),cc.assert(e,cc._LogInfos.Scheduler_scheduleCallbackForTarget_3),n=n||0,r=r==null?cc.REPEAT_FOREVER:r,i=i||0,s=s||!1;var o=this,u,a=o._hashForTimers[e.__instanceId];a||(a=new cc.HashTimerEntry(null,e,0,null,null,s,null),o._arrayForTimers.push(a),o._hashForTimers[e.__instanceId]=a);if(a.timers==null)a.timers=[];else for(var f=0;f<a.timers.length;f++){u=a.timers[f];if(t==u._callback){cc.log(cc._LogInfos.Scheduler_scheduleCallbackForTarget,u.getInterval().toFixed(4),n.toFixed(4)),u._interval=n;return}}u=new cc.Timer(e,t,n,r,i),a.timers.push(u)},scheduleUpdateForTarget:function(e,t,n){if(e===null)return;var r=this,i=r._updates,s=r._hashForUpdates[e.__instanceId];if(s){s.entry.markedForDeletion=!1;return}t==0?r._appendIn(i[1],e,n):t<0?i[0]=r._priorityIn(i[0],e,t,n):i[2]=r._priorityIn(i[2],e,t,n)},unscheduleCallbackForTarget:function(e,t){if(e==null||t==null)return;var n=this,r=n._hashForTimers[e.__instanceId];if(r){var i=r.timers;for(var s=0,o=i.length;s<o;s++){var u=i[s];if(t==u._callback){u==r.currentTimer&&!r.currentTimerSalvaged&&(r.currentTimerSalvaged=!0),i.splice(s,1),r.timerIndex>=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<s;i++)t.unscheduleAllCallbacksForTarget(n[i].target);for(var i=2;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<a;u++)t.unscheduleUpdateForTarget(o[u].target)}},pauseAllTargets:function(){return this.pauseAllTargetsWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM)},pauseAllTargetsWithMinPriority:function(e){var t=[],n=this,r,i=n._arrayForTimers,s=n._updates;for(var o=0,u=i.length;o<u;o++)r=i[o],r&&(r.paused=!0,t.push(r.target));for(var o=0,u=s.length;o<u;o++){var a=s[o];for(var f=0,l=a.length;f<l;f++)r=a[f],r&&(r.paused=!0,t.push(r.target))}return t},resumeTargets:function(e){if(!e)return;for(var t=0;t<e.length;t++)this.resumeTarget(e[t])},pauseTarget:function(e){cc.assert(e,cc._LogInfos.Scheduler_pauseTarget);var t=this,n=t._hashForTimers[e.__instanceId];n&&(n.paused=!0);var r=t._hashForUpdates[e.__instanceId];r&&(r.entry.paused=!0)},resumeTarget:function(e){cc.assert(e,cc._LogInfos.Scheduler_resumeTarget);var t=this,n=t._hashForTimers[e.__instanceId];n&&(n.paused=!1);var r=t._hashForUpdates[e.__instanceId];r&&(r.entry.paused=!1)},isTargetPaused:function(e){cc.assert(e,cc._LogInfos.Scheduler_isTargetPaused);var t=this._hashForTimers[e.__instanceId];return t?t.paused:!1}}),cc.Scheduler.PRIORITY_SYSTEM=-2147483648,cc._tmp.PrototypeLabelTTF=function(){var e=cc.LabelTTF.prototype;cc.defineGetterSetter(e,"color",e.getColor,e.setColor),cc.defineGetterSetter(e,"opacity",e.getOpacity,e.setOpacity),e.string,cc.defineGetterSetter(e,"string",e.getString,e.setString),e.textAlign,cc.defineGetterSetter(e,"textAlign",e.getHorizontalAlignment,e.setHorizontalAlignment),e.verticalAlign,cc.defineGetterSetter(e,"verticalAlign",e.getVerticalAlignment,e.setVerticalAlignment),e.fontSize,cc.defineGetterSetter(e,"fontSize",e.getFontSize,e.setFontSize),e.fontName,cc.defineGetterSetter(e,"fontName",e.getFontName,e.setFontName),e.font,cc.defineGetterSetter(e,"font",e._getFont,e._setFont),e.boundingSize,e.boundingWidth,cc.defineGetterSetter(e,"boundingWidth",e._getBoundingWidth,e._setBoundingWidth),e.boundingHeight,cc.defineGetterSetter(e,"boundingHeight",e._getBoundingHeight,e._setBoundingHeight),e.fillStyle,cc.defineGetterSetter(e,"fillStyle",e._getFillStyle,e.setFontFillColor),e.strokeStyle,cc.defineGetterSetter(e,"strokeStyle",e._getStrokeStyle,e._setStrokeStyle),e.lineWidth,cc.defineGetterSetter(e,"lineWidth",e._getLineWidth,e._setLineWidth),e.shadowOffset,e.shadowOffsetX,cc.defineGetterSetter(e,"shadowOffsetX",e._getShadowOffsetX,e._setShadowOffsetX),e.shadowOffsetY,cc.defineGetterSetter(e,"shadowOffsetY",e._getShadowOffsetY,e._setShadowOffsetY),e.shadowOpacity,cc.defineGetterSetter(e,"shadowOpacity",e._getShadowOpacity,e._setShadowOpacity),e.shadowBlur,cc.defineGetterSetter(e,"shadowBlur",e._getShadowBlur,e._setShadowBlur)},cc.LabelTTF=cc.Sprite.extend({_dimensions:null,_hAlignment:cc.TEXT_ALIGNMENT_CENTER,_vAlignment:cc.VERTICAL_TEXT_ALIGNMENT_TOP,_fontName:null,_fontSize:0,_string:"",_originalText:null,_isMultiLine:!1,_fontStyleStr:null,_shadowEnabled:!1,_shadowOffset:null,_shadowOpacity:0,_shadowBlur:0,_shadowColorStr:null,_strokeEnabled:!1,_strokeColor:null,_strokeSize:0,_strokeColorStr:null,_textFillColor:null,_fillColorStr:null,_strokeShadowOffsetX:0,_strokeShadowOffsetY:0,_needUpdateTexture:!1,_labelCanvas:null,_labelContext:null,_lineWidths:null,_className:"LabelTTF",ctor:function(e,t,n,r,i,s){cc.Sprite.prototype.ctor.call(this),this._dimensions=cc.size(0,0),this._hAlignment=cc.TEXT_ALIGNMENT_LEFT,this._vAlignment=cc.VERTICAL_TEXT_ALIGNMENT_TOP,this._opacityModifyRGB=!1,this._fontStyleStr="",this._fontName="Arial",this._isMultiLine=!1,this._shadowEnabled=!1,this._shadowOffset=cc.p(0,0),this._shadowOpacity=0,this._shadowBlur=0,this._shadowColorStr="rgba(128, 128, 128, 0.5)",this._strokeEnabled=!1,this._strokeColor=cc.color(255,255,255,255),this._strokeSize=0,this._strokeColorStr="",this._textFillColor=cc.color(255,255,255,255),this._fillColorStr="rgba(255,255,255,1)",this._strokeShadowOffsetX=0,this._strokeShadowOffsetY=0,this._needUpdateTexture=!1,this._lineWidths=[],this._setColorsString(),t&&t instanceof cc.FontDefinition?this.initWithStringAndTextDefinition(e,t):cc.LabelTTF.prototype.initWithString.call(this,e,t,n,r,i,s)},init:function(){return this.initWithString(" ",this._fontName,this._fontSize)},_measureConfig:function(){this._getLabelContext().font=this._fontStyleStr},_measure:function(e){return this._getLabelContext().measureText(e).width},_checkNextline:function(e,t){var n=this._measure(e),r=Math.floor(e.length*t/n),i=e.indexOf("\n");if(r*.8>=i&&i>0)return i+1;if(n<t)return e.length;var s=!1,o=t+1,u=-1,a=r,f,l=cc.LabelTTF._checkRegEx,c=cc.LabelTTF._reverseCheckRegEx,h=cc.LabelTTF._checkEnRegEx,p=e.substr(r);while(f=l.exec(p)){a+=f[0].length;var d=e.substr(0,a);o=this._measure(d);if(f[2]=="\n"&&o<t){s=!0,u=a;break}if(o>t){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<t){h.test(f[2])&&u++;break}}return u||1},description:function(){return"<cc.LabelTTF | FontName ="+this._fontName+" FontSize = "+this._fontSize.toFixed(1)+">"},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
  7. .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;d<p;d++){var v=this._strings[d],m=-r+o*d+f;l&&e.strokeText(v,a,m),e.fillText(v,a,m)}}else i===cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM?(l&&e.strokeText(this._string,a,f),e.fillText(this._string,a,f)):i===cc.VERTICAL_TEXT_ALIGNMENT_TOP?(f-=r,l&&e.strokeText(this._string,a,f),e.fillText(this._string,a,f)):(f-=r*.5,l&&e.strokeText(this._string,a,f),e.fillText(this._string,a,f))},_getLabelContext:function(){if(this._labelContext)return this._labelContext;if(!this._labelCanvas){var e=cc.newElement("canvas"),t=new cc.Texture2D;t.initWithElement(e),this.texture=t,this._labelCanvas=e}return this._labelContext=this._labelCanvas.getContext("2d"),this._labelContext},_updateTTF:function(){var e=this._dimensions.width,t,n,r=this._lineWidths;r.length=0,this._isMultiLine=!1,this._measureConfig();if(e!==0){var i=this._string;this._strings=[];for(t=0,n=this._string.length;t<n;){var s=this._checkNextline(i.substr(t),e),o=i.substr(t,s);this._strings.push(o),t+=s}}else{this._strings=this._string.split("\n");for(t=0,n=this._strings.length;t<n;t++)r.push(this._measure(this._strings[t]))}this._strings.length>0&&(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.length;n++)if(t==e[n].target)return e[n];return null},ctor:function(){this._hashTargets={},this._arrayTargets=[],this._currentTarget=null,this._currentTargetSalvaged=!1},addAction:function(e,t,n){if(!e)throw"cc.ActionManager.addAction(): action must be non-null";if(!t)throw"cc.ActionManager.addAction(): action must be non-null";var r=this._hashTargets[t.__instanceId];r||(r=new cc.HashElement,r.paused=n,r.target=t,this._hashTargets[t.__instanceId]=r,this._arrayTargets.push(r)),this._actionAllocWithHashElement(r),r.actions.push(e),e.startWithTarget(t)},removeAllActions:function(){var e=this._arrayTargets;for(var t=0;t<e.length;t++){var n=e[t];n&&this.removeAllActionsFromTarget(n.target,!0)}},removeAllActionsFromTarget:function(e,t){if(e==null)return;var n=this._hashTargets[e.__instanceId];n&&(n.actions.indexOf(n.currentAction)!==-1&&!n.currentActionSalvaged&&(n.currentActionSalvaged=!0),n.actions.length=0,this._currentTarget==n&&!t?this._currentTargetSalvaged=!0:this._deleteHashElement(n))},removeAction:function(e){if(e==null)return;var t=e.getOriginalTarget(),n=this._hashTargets[t.__instanceId];if(n){for(var r=0;r<n.actions.length;r++)if(n.actions[r]==e){n.actions.splice(r,1);break}}else cc.log(cc._LogInfos.ActionManager_removeAction)},removeActionByTag:function(e,t){e==cc.ACTION_TAG_INVALID&&cc.log(cc._LogInfos.ActionManager_addAction),cc.assert(t,cc._LogInfos.ActionManager_addAction);var n=this._hashTargets[t.__instanceId];if(n){var r=n.actions.length;for(var i=0;i<r;++i){var s=n.actions[i];if(s&&s.getTag()===e&&s.getOriginalTarget()==t){this._removeActionAtIndex(i,n);break}}}},getActionByTag:function(e,t){e==cc.ACTION_TAG_INVALID&&cc.log(cc._LogInfos.ActionManager_getActionByTag);var n=this._hashTargets[t.__instanceId];if(n){if(n.actions!=null)for(var r=0;r<n.actions.length;++r){var i=n.actions[r];if(i&&i.getTag()===e)return i}cc.log(cc._LogInfos.ActionManager_getActionByTag_2,e)}return null},numberOfRunningActionsInTarget:function(e){var t=this._hashTargets[e.__instanceId];return t?t.actions?t.actions.length:0:0},pauseTarget:function(e){var t=this._hashTargets[e.__instanceId];t&&(t.paused=!0)},resumeTarget:function(e){var t=this._hashTargets[e.__instanceId];t&&(t.paused=!1)},pauseAllRunningActions:function(){var e=[],t=this._arrayTargets;for(var n=0;n<t.length;n++){var r=t[n];r&&!r.paused&&(r.paused=!0,e.push(r.target))}return e},resumeTargets:function(e){if(!e)return;for(var t=0;t<e.length;t++)e[t]&&this.resumeTarget(e[t])},purgeSharedManager:function(){cc.director.getScheduler().unscheduleUpdateForTarget(this)},_removeActionAtIndex:function(e,t){var n=t.actions[e];n==t.currentAction&&!t.currentActionSalvaged&&(t.currentActionSalvaged=!0),t.actions.splice(e,1),t.actionIndex>=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<t.length;r++){this._currentTarget=t[r],n=this._currentTarget;if(!n.paused)for(n.actionIndex=0;n.actionIndex<n.actions.length;n.actionIndex++){n.currentAction=n.actions[n.actionIndex];if(!n.currentAction)continue;n.currentActionSalvaged=!1,n.currentAction.step(e*(n.currentAction._speedMethod?n.currentAction._speed:1));if(n.currentActionSalvaged)n.currentAction=null;else if(n.currentAction.isDone()){n.currentAction.stop();var i=n.currentAction;n.currentAction=null,this.removeAction(i)}n.currentAction=null}this._currentTargetSalvaged&&n.actions.length===0&&this._deleteHashElement(n)}}}),cc.ACTION_TAG_INVALID=-1,cc.Action=cc.Class.extend({originalTarget:null,target:null,tag:cc.ACTION_TAG_INVALID,ctor:function(){this.originalTarget=null,this.target=null,this.tag=cc.ACTION_TAG_INVALID},copy:function(){return cc.log("copy is deprecated. Please use clone instead."),this.clone()},clone:function(){var e=new cc.Action;return e.originalTarget=null,e.target=null,e.tag=this.tag,e},isDone:function(){return!0},startWithTarget:function(e){this.originalTarget=e,this.target=e},stop:function(){this.target=null},step:function(e){cc.log("[Action step]. override me")},update:function(e){cc.log("[Action update]. override me")},getTarget:function(){return this.target},setTarget:function(e){this.target=e},getOriginalTarget:function(){return this.originalTarget},setOriginalTarget:function(e){this.originalTarget=e},getTag:function(){return this.tag},setTag:function(e){this.tag=e},retain:function(){},release:function(){}}),cc.Action.create=function(){return new cc.Action},cc.FiniteTimeAction=cc.Action.extend({_duration:0,ctor:function(){cc.Action.prototype.ctor.call(this),this._duration=0},getDuration:function(){return this._duration*(this._times||1)},setDuration:function(e){this._duration=e},reverse:function(){return cc.log("cocos2d: FiniteTimeAction#reverse: Implement me"),null},clone:function(){return new cc.FiniteTimeAction}}),cc.Speed=cc.Action.extend({_speed:0,_innerAction:null,ctor:function(e,t){cc.Action.prototype.ctor.call(this),this._speed=0,this._innerAction=null,e&&this.initWithAction(e,t)},getSpeed:function(){return this._speed},setSpeed:function(e){this._speed=e},initWithAction:function(e,t){if(!e)throw"cc.Speed.initWithAction(): action must be non nil";return this._innerAction=e,this._speed=t,!0},clone:function(){var e=new cc.Speed;return e.initWithAction(this._innerAction.clone(),this._speed),e},startWithTarget:function(e){cc.Action.prototype.startWithTarget.call(this,e),this._innerAction.startWithTarget(e)},stop:function(){this._innerAction.stop(),cc.Action.prototype.stop.call(this)},step:function(e){this._innerAction.step(e*this._speed)},isDone:function(){return this._innerAction.isDone()},reverse:function(){return cc.Speed.create(this._innerAction.reverse(),this._speed)},setInnerAction:function(e){this._innerAction!=e&&(this._innerAction=e)},getInnerAction:function(){return this._innerAction}}),cc.Speed.create=function(e,t){return new cc.Speed(e,t)},cc.Follow=cc.Action.extend({_followedNode:null,_boundarySet:!1,_boundaryFullyCovered:!1,_halfScreenSize:null,_fullScreenSize:null,leftBoundary:0,rightBoundary:0,topBoundary:0,bottomBoundary:0,_worldRect:null,ctor:function(e,t){cc.Action.prototype.ctor.call(this),this._followedNode=null,this._boundarySet=!1,this._boundaryFullyCovered=!1,this._halfScreenSize=null,this._fullScreenSize=null,this.leftBoundary=0,this.rightBoundary=0,this.topBoundary=0,this.bottomBoundary=0,this._worldRect=cc.rect(0,0,0,0),e&&(t?this.initWithTarget(e,t):this.initWithTarget(e))},clone:function(){var e=new cc.Follow,t=this._worldRect,n=new cc.Rect(t.x,t.y,t.width,t.height);return e.initWithTarget(this._followedNode,n),e},isBoundarySet:function(){return this._boundarySet},setBoudarySet:function(e){this._boundarySet=e},initWithTarget:function(e,t){if(!e)throw"cc.Follow.initWithAction(): followedNode must be non nil";var n=this;t=t||cc.rect(0,0,0,0),n._followedNode=e,n._worldRect=t,n._boundarySet=!cc._rectEqualToZero(t),n._boundaryFullyCovered=!1;var r=cc.director.getWinSize();return n._fullScreenSize=cc.p(r.width,r.height),n._halfScreenSize=cc.pMult(n._fullScreenSize,.5),n._boundarySet&&(n.leftBoundary=-(t.x+t.width-n._fullScreenSize.x),n.rightBoundary=-t.x,n.topBoundary=-t.y,n.bottomBoundary=-(t.y+t.height-n._fullScreenSize.y),n.rightBoundary<n.leftBoundary&&(n.rightBoundary=n.leftBoundary=(n.leftBoundary+n.rightBoundary)/2),n.topBoundary<n.bottomBoundary&&(n.topBoundary=n.bottomBoundary=(n.topBoundary+n.bottomBoundary)/2),n.topBoundary==n.bottomBoundary&&n.leftBoundary==n.rightBoundary&&(n._boundaryFullyCovered=!0)),!0},step:function(e){var t=this._followedNode.x,n=this._followedNode.y;t=this._halfScreenSize.x-t,n=this._halfScreenSize.y-n;if(this._boundarySet){if(this._boundaryFullyCovered)return;this.target.setPosition(cc.clampf(t,this.leftBoundary,this.rightBoundary),cc.clampf(n,this.bottomBoundary,this.topBoundary))}else this.target.setPosition(t,n)},isDone:function(){return!this._followedNode.running},stop:function(){this.target=null,cc.Action.prototype.stop.call(this)}}),cc.Follow.create=function(e,t){return new cc.Follow(e,t)},cc.ActionInterval=cc.FiniteTimeAction.extend({_elapsed:0,_firstTick:!1,_easeList:null,_times:1,_repeatForever:!1,_repeatMethod:!1,_speed:1,_speedMethod:!1,ctor:function(e){this._speed=1,this._times=1,this._repeatForever=!1,this.MAX_VALUE=2,this._repeatMethod=!1,this._speedMethod=!1,cc.FiniteTimeAction.prototype.ctor.call(this),e!==undefined&&this.initWithDuration(e)},getElapsed:function(){return this._elapsed},initWithDuration:function(e){return this._duration=e===0?cc.FLT_EPSILON:e,this._elapsed=0,this._firstTick=!0,!0},isDone:function(){return this._elapsed>=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;t<this._easeList.length;t++)e._easeList.push(this._easeList[t].reverse())}},clone:function(){var e=new cc.ActionInterval(this._duration);return this._cloneDecoration(e),e},easing:function(e){this._easeList?this._easeList.length=0:this._easeList=[];for(var t=0;t<arguments.length;t++)this._easeList.push(arguments[t]);return this},_computeEaseTime:function(e){var t=this._easeList;if(!t||t.length===0)return e;for(var n=0,r=t.length;n<r;n++)e=t[n].easing(e);return e},step:function(e){this._firstTick?(this._firstTick=!1,this._elapsed=0):this._elapsed+=e;var t=this._elapsed/(this._duration>1.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;s<n;s++)t[s]&&(i=r,r=cc.Sequence._actionOneTwo(i,t[s]));this.initWithTwoActions(r,t[n])}},initWithTwoActions:function(e,t){if(!e||!t)throw"cc.Sequence.initWithTwoActions(): arguments must all be non nil";var n=e._duration+t._duration;return this.initWithDuration(n),this._actions[0]=e,this._actions[1]=t,!0},clone:function(){var e=new cc.Sequence;return this._cloneDecoration(e),e.initWithTwoActions(this._actions[0].clone(),this._actions[1].clone()),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e),this._split=this._actions[0]._duration/this._duration,this._last=-1},stop:function(){this._last!==-1&&this._actions[this._last].stop(),cc.Action.prototype.stop.call(this)},update:function(e){e=this._computeEaseTime(e);var t,n=0,r=this._split,i=this._actions,s=this._last;e<r?(t=r!==0?e/r:1,n===0&&s===1&&(i[1].update(0),i[1].stop())):(n=1,t=r===1?1:(e-r)/(1-r),s===-1&&(i[0].startWithTarget(this.target),i[0].update(1),i[0].stop()),s||(i[0].update(1),i[0].stop()));if(s===n&&i[n].isDone())return;s!==n&&i[n].startWithTarget(this.target),i[n].update(t),this._last=n},reverse:function(){var e=cc.Sequence._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());return this._cloneDecoration(e),this._reverseEaseList(e),e}}),cc.Sequence.create=function(e){var t=e instanceof Array?e:arguments;t.length>0&&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<t.length;r++)t[r]&&(n=cc.Sequence._actionOneTwo(n,t[r]));return n},cc.Sequence._actionOneTwo=function(e,t){var n=new cc.Sequence;return n.initWithTwoActions(e,t),n},cc.Repeat=cc.ActionInterval.extend({_times:0,_total:0,_nextDt:0,_actionInstant:!1,_innerAction:null,ctor:function(e,t){cc.ActionInterval.prototype.ctor.call(this),t!==undefined&&this.initWithAction(e,t)},initWithAction:function(e,t){var n=e._duration*t;return this.initWithDuration(n)?(this._times=t,this._innerAction=e,e instanceof cc.ActionInstant&&(this._actionInstant=!0,this._times-=1),this._total=0,!0):!1},clone:function(){var e=new cc.Repeat;return this._cloneDecoration(e),e.initWithAction(this._innerAction.clone(),this._times),e},startWithTarget:function(e){this._total=0,this._nextDt=this._innerAction._duration/this._duration,cc.ActionInterval.prototype.startWithTarget.call(this,e),this._innerAction.startWithTarget(e)},stop:function(){this._innerAction.stop(),cc.Action.prototype.stop.call(this)},update:function(e){e=this._computeEaseTime(e);var t=this._innerAction,n=this._duration,r=this._times,i=this._nextDt;if(e>=i){while(e>i&&this._total<r)t.update(1),this._total++,t.stop(),t.startWithTarget(this.target),i+=t._duration/n,this._nextDt=i;e>=1&&this._total<r&&this._total++,this._actionInstant||(this._total===r?(t.update(1),t.stop()):t.update(e-(i-t._duration/n)))}else t.update(e*r%1)},isDone:function(){return this._total==this._times},reverse:function(){var e=cc.Repeat.create(this._innerAction.reverse(),this._times);return this._cloneDecoration(e),this._reverseEaseList(e),e},setInnerAction:function(e){this._innerAction!=e&&(this._innerAction=e)},getInnerAction:function(){return this._innerAction}}),cc.Repeat.create=function(e,t){return new cc.Repeat(e,t)},cc.RepeatForever=cc.ActionInterval.extend({_innerAction:null,ctor:function(e){cc.ActionInterval.prototype.ctor.call(this),this._innerAction=null,e&&this.initWithAction(e)},initWithAction:function(e){if(!e)throw"cc.RepeatForever.initWithAction(): action must be non null";return this._innerAction=e,!0},clone:function(){var e=new cc.RepeatForever;return this._cloneDecoration(e),e.initWithAction(this._innerAction.clone()),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e),this._innerAction.startWithTarget(e)},step:function(e){var t=this._innerAction;t.step(e),t.isDone()&&(t.startWithTarget(this.target),t.step(t.getElapsed()-t._duration))},isDone:function(){return!1},reverse:function(){var e=cc.RepeatForever.create(this._innerAction.reverse());return this._cloneDecoration(e),this._reverseEaseList(e),e},setInnerAction:function(e){this._innerAction!=e&&(this._innerAction=e)},getInnerAction:function(){return this._innerAction}}),cc.RepeatForever.create=function(e){return new cc.RepeatForever(e)},cc.Spawn=cc.ActionInterval.extend({_one:null,_two:null,ctor:function(e){cc.ActionInterval.prototype.ctor.call(this),this._one=null,this._two=null;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;s<n;s++)t[s]&&(i=r,r=cc.Spawn._actionOneTwo(i,t[s]));this.initWithTwoActions(r,t[n])}},initWithTwoActions:function(e,t){if(!e||!t)throw"cc.Spawn.initWithTwoActions(): arguments must all be non null";var n=!1,r=e._duration,i=t._duration;return this.initWithDuration(Math.max(r,i))&&(this._one=e,this._two=t,r>i?this._two=cc.Sequence._actionOneTwo(t,cc.DelayTime.create(r-i)):r<i&&(this._one=cc.Sequence._actionOneTwo(e,cc.DelayTime.create(i-r))),n=!0),n},clone:function(){var e=new cc.Spawn;return this._cloneDecoration(e),e.initWithTwoActions(this._one.clone(),this._two.clone()),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e),this._one.startWithTarget(e),this._two.startWithTarget(e)},stop:function(){this._one.stop(),this._two.stop(),cc.Action.prototype.stop.call(this)},update:function(e){e=this._computeEaseTime(e),this._one&&this._one.update(e),this._two&&this._two.update(e)},reverse:function(){var e=cc.Spawn._actionOneTwo(this._one.reverse(),this._two.reverse());return this._cloneDecoration(e),this._reverseEaseList(e),e}}),cc.Spawn.create=function(e){var t=e instanceof Array?e:arguments;t.length>0&&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<t.length;r++)t[r]!=null&&(n=cc.Spawn._actionOneTwo(n,t[r]));return n},cc.Spawn._actionOneTwo=function(e,t){var n=new cc.Spawn;return n.initWithTwoActions(e,t),n},cc.RotateTo=cc.ActionInterval.extend({_dstAngleX:0,_startAngleX:0,_diffAngleX:0,_dstAngleY:0,_startAngleY:0,_diffAngleY: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._dstAngleX=t||0,this._dstAngleY=n||this._dstAngleX,!0):!1},clone:function(){var e=new cc.RotateTo;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._dstAngleX,this._dstAngleY),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e);var t=e.rotationX%360,n=this._dstAngleX-t;n>180&&(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!==
  8. 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;n<this._config.length;n++){var r=this._config[n];t.push(cc.p(r.x,r.y))}return e.initWithDuration(this._duration,t),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._config,n=0,r=t[0].x,i=t[1].x,s=t[2].x,o=0,u=t[0].y,a=t[1].y,f=t[2].y,l=cc.bezierAt(n,r,i,s,e),c=cc.bezierAt(o,u,a,f,e),h=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var p=this.target.getPositionX(),d=this.target.getPositionY(),v=this._previousPosition;h.x=h.x+p-v.x,h.y=h.y+d-v.y,l+=h.x,c+=h.y,v.x=l,v.y=c,this.target.setPosition(l,c)}else this.target.setPosition(h.x+l,h.y+c)}},reverse:function(){var e=this._config,t=[cc.pAdd(e[1],cc.pNeg(e[2])),cc.pAdd(e[0],cc.pNeg(e[2])),cc.pNeg(e[2])],n=cc.BezierBy.create(this._duration,t);return this._cloneDecoration(n),this._reverseEaseList(n),n}}),cc.BezierBy.create=function(e,t){return new cc.BezierBy(e,t)},cc.BezierTo=cc.BezierBy.extend({_toConfig:null,ctor:function(e,t){cc.BezierBy.prototype.ctor.call(this),this._toConfig=[],t&&this.initWithDuration(e,t)},initWithDuration:function(e,t){return cc.ActionInterval.prototype.initWithDuration.call(this,e)?(this._toConfig=t,!0):!1},clone:function(){var e=new cc.BezierTo;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._toConfig),e},startWithTarget:function(e){cc.BezierBy.prototype.startWithTarget.call(this,e);var t=this._startPosition,n=this._toConfig,r=this._config;r[0]=cc.pSub(n[0],t),r[1]=cc.pSub(n[1],t),r[2]=cc.pSub(n[2],t)}}),cc.BezierTo.create=function(e,t){return new cc.BezierTo(e,t)},cc.ScaleTo=cc.ActionInterval.extend({_scaleX:1,_scaleY:1,_startScaleX:1,_startScaleY:1,_endScaleX:0,_endScaleY:0,_deltaX:0,_deltaY: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._endScaleX=t,this._endScaleY=n!=null?n:t,!0):!1},clone:function(){var e=new cc.ScaleTo;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._endScaleX,this._endScaleY),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e),this._startScaleX=e.scaleX,this._startScaleY=e.scaleY,this._deltaX=this._endScaleX-this._startScaleX,this._deltaY=this._endScaleY-this._startScaleY},update:function(e){e=this._computeEaseTime(e),this.target&&(this.target.scaleX=this._startScaleX+this._deltaX*e,this.target.scaleY=this._startScaleY+this._deltaY*e)}}),cc.ScaleTo.create=function(e,t,n){return new cc.ScaleTo(e,t,n)},cc.ScaleBy=cc.ScaleTo.extend({startWithTarget:function(e){cc.ScaleTo.prototype.startWithTarget.call(this,e),this._deltaX=this._startScaleX*this._endScaleX-this._startScaleX,this._deltaY=this._startScaleY*this._endScaleY-this._startScaleY},reverse:function(){var e=cc.ScaleBy.create(this._duration,1/this._endScaleX,1/this._endScaleY);return this._cloneDecoration(e),this._reverseEaseList(e),e},clone:function(){var e=new cc.ScaleBy;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._endScaleX,this._endScaleY),e}}),cc.ScaleBy.create=function(e,t,n){return new cc.ScaleBy(e,t,n)},cc.Blink=cc.ActionInterval.extend({_times:0,_originalState:!1,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._times=t,!0):!1},clone:function(){var e=new cc.Blink;return this._cloneDecoration(e),e.initWithDuration(this._duration,this._times),e},update:function(e){e=this._computeEaseTime(e);if(this.target&&!this.isDone()){var t=1/this._times,n=e%t;this.target.visible=n>t/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;o<s.length;o++){var u=s[o],a=r*i/t;r+=u.getDelayUnits(),n.push(a)}return!0}return!1},clone:function(){var e=new cc.Animate;return this._cloneDecoration(e),e.initWithAnimation(this._animation.clone()),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e),this._animation.getRestoreOriginalFrame()&&(this._origFrame=e.displayFrame()),this._nextFrame=0,this._executedLoops=0},update:function(e){e=this._computeEaseTime(e);if(e<1){e*=this._animation.getLoops();var t=0|e;t>this._executedLoops&&(this._nextFrame=0,this._executedLoops++),e%=1}var n=this._animation.getFrames(),r=n.length,i=this._splitTimes;for(var s=this._nextFrame;s<r;s++){if(!(i[s]<=e))break;this.target.setSpriteFrame(n[s].getSpriteFrame()),this._nextFrame=s+1}},reverse:function(){var e=this._animation,t=e.getFrames(),n=[];cc.arrayVerifyType(t,cc.AnimationFrame);if(t.length>0)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)*
  9. 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<e.length;n++)t.push(cc.p(e[n].x,e[n].y));return t},cc.getControlPointAt=function(e,t){var n=Math.min(e.length-1,Math.max(t,0));return e[n]},cc.reverseControlPointsInline=function(e){var t=e.length,n=0|t/2;for(var r=0;r<n;++r){var i=e[r];e[r]=e[t-r-1],e[t-r-1]=i}},cc.CardinalSplineTo=cc.ActionInterval.extend({_points:null,_deltaT:0,_tension:0,_previousPosition:null,_accumulatedDiff:null,ctor:function(e,t,n){cc.ActionInterval.prototype.ctor.call(this),this._points=[],n!==undefined&&this.initWithDuration(e,t,n)},initWithDuration:function(e,t,n){if(!t||t.length==0)throw"Invalid configuration. It must at least have one control point";return cc.ActionInterval.prototype.initWithDuration.call(this,e)?(this.setPoints(t),this._tension=n,!0):!1},clone:function(){var e=new cc.CardinalSplineTo;return e.initWithDuration(this._duration,cc.copyControlPoints(this._points),this._tension),e},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e),this._deltaT=1/(this._points.length-1),this._previousPosition=cc.p(this.target.getPositionX(),this.target.getPositionY()),this._accumulatedDiff=cc.p(0,0)},update:function(e){e=this._computeEaseTime(e);var t,n,r=this._points;if(e==1)t=r.length-1,n=1;else{var i=this._deltaT;t=0|e/i,n=(e-i*t)/i}var s=cc.cardinalSplineAt(cc.getControlPointAt(r,t-1),cc.getControlPointAt(r,t-0),cc.getControlPointAt(r,t+1),cc.getControlPointAt(r,t+2),this._tension,n);if(cc.ENABLE_STACKABLE_ACTIONS){var o,u;o=this.target.getPositionX()-this._previousPosition.x,u=this.target.getPositionY()-this._previousPosition.y;if(o!=0||u!=0){var a=this._accumulatedDiff;o=a.x+o,u=a.y+u,a.x=o,a.y=u,s.x+=o,s.y+=u}}this.updatePosition(s)},reverse:function(){var e=cc.reverseControlPoints(this._points);return cc.CardinalSplineTo.create(this._duration,e,this._tension)},updatePosition:function(e){this.target.setPosition(e),this._previousPosition=e},getPoints:function(){return this._points},setPoints:function(e){this._points=e}}),cc.CardinalSplineTo.create=function(e,t,n){return new cc.CardinalSplineTo(e,t,n)},cc.CardinalSplineBy=cc.CardinalSplineTo.extend({_startPosition:null,ctor:function(e,t,n){cc.CardinalSplineTo.prototype.ctor.call(this),this._startPosition=cc.p(0,0),n!==undefined&&this.initWithDuration(e,t,n)},startWithTarget:function(e){cc.CardinalSplineTo.prototype.startWithTarget.call(this,e),this._startPosition.x=e.getPositionX(),this._startPosition.y=e.getPositionY()},reverse:function(){var e=this._points.slice(),t,n=e[0];for(var r=1;r<e.length;++r)t=e[r],e[r]=cc.pSub(t,n),n=t;var i=cc.reverseControlPoints(e);n=i[i.length-1],i.pop(),n.x=-n.x,n.y=-n.y,i.unshift(n);for(var r=1;r<i.length;++r)t=i[r],t.x=-t.x,t.y=-t.y,t.x+=n.x,t.y+=n.y,i[r]=t,n=t;return cc.CardinalSplineBy.create(this._duration,i,this._tension)},updatePosition:function(e){var t=this._startPosition,n=e.x+t.x,r=e.y+t.y;this._previousPosition.x=n,this._previousPosition.y=r,this.target.setPosition(n,r)},clone:function(){var e=new cc.CardinalSplineBy;return e.initWithDuration(this._duration,cc.copyControlPoints(this._points),this._tension),e}}),cc.CardinalSplineBy.create=function(e,t,n){return new cc.CardinalSplineBy(e,t,n)},cc.CatmullRomTo=cc.CardinalSplineTo.extend({ctor:function(e,t){t&&this.initWithDuration(e,t)},initWithDuration:function(e,t){return cc.CardinalSplineTo.prototype.initWithDuration.call(this,e,t,.5)},clone:function(){var e=new cc.CatmullRomTo;return e.initWithDuration(this._duration,cc.copyControlPoints(this._points)),e}}),cc.CatmullRomTo.create=function(e,t){return new cc.CatmullRomTo(e,t)},cc.CatmullRomBy=cc.CardinalSplineBy.extend({ctor:function(e,t){cc.CardinalSplineBy.prototype.ctor.call(this),t&&this.initWithDuration(e,t)},initWithDuration:function(e,t){return cc.CardinalSplineTo.prototype.initWithDuration.call(this,e,t,.5)},clone:function(){var e=new cc.CatmullRomBy;return e.initWithDuration(this._duration,cc.copyControlPoints(this._points)),e}}),cc.CatmullRomBy.create=function(e,t){return new cc.CatmullRomBy(e,t)},cc.ActionTweenDelegate=cc.Class.extend({updateTweenAction:function(e,t){}}),cc.ActionTween=cc.ActionInterval.extend({key:"",from:0,to:0,delta:0,ctor:function(e,t,n,r){cc.ActionInterval.prototype.ctor.call(this),this.key="",r!==undefined&&this.initWithDuration(e,t,n,r)},initWithDuration:function(e,t,n,r){return cc.ActionInterval.prototype.initWithDuration.call(this,e)?(this.key=t,this.to=r,this.from=n,!0):!1},startWithTarget:function(e){if(!e||!e.updateTweenAction)throw"cc.ActionTween.startWithTarget(): target must be non-null, and target must implement updateTweenAction function";cc.ActionInterval.prototype.startWithTarget.call(this,e),this.delta=this.to-this.from},update:function(e){this.target.updateTweenAction(this.to-this.delta*(1-e),this.key)},reverse:function(){return cc.ActionTween.create(this.duration,this.key,this.to,this.from)},clone:function(){var e=new cc.ActionTween;return e.initWithDuration(this._duration,this.key,this.from,this.to),e}}),cc.ActionTween.create=function(e,t,n,r){var i=new cc.ActionTween;return i.initWithDuration(e,t,n,r)?i:null};