12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- (function(k){var g,c,b;(function(){var a={},d={};g=function(b,d,f){a[b]={deps:d,callback:f}};b=c=function(h){function n(a){if("."!==a.charAt(0))return a;a=a.split("/");for(var e=h.split("/").slice(0,-1),b=0,f=a.length;b<f;b++){var d=a[b];".."===d?e.pop():"."!==d&&e.push(d)}return e.join("/")}b._eak_seen=a;if(d[h])return d[h];d[h]={};if(!a[h])throw Error("Could not find module "+h);for(var f=a[h],l=f.deps,f=f.callback,q=[],g,m=0,p=l.length;m<p;m++)"exports"===l[m]?q.push(g={}):q.push(c(n(l[m])));l=
- f.apply(this,q);return d[h]=g||l}})();g("promise/all",["./utils","exports"],function(a,b){var h=a.isArray,c=a.isFunction;b.all=function(a){if(!h(a))throw new TypeError("You must pass an array to all.");return new this(function(b,d){function h(e){return function(a){g[e]=a;0===--p&&b(g)}}var g=[],p=a.length,r;0===p&&b([]);for(var e=0;e<a.length;e++)(r=a[e])&&c(r.then)?r.then(h(e),d):(g[e]=r,0===--p&&b(g))})}});g("promise/asap",["exports"],function(a){function b(){return function(){process.nextTick(f)}}
- function h(){var a=0,e=new q(f),b=document.createTextNode("");e.observe(b,{characterData:!0});return function(){b.data=a=++a%2}}function c(){return function(){g.setTimeout(f,1)}}function f(){for(var a=0;a<m.length;a++){var e=m[a];(0,e[0])(e[1])}m=[]}var l="undefined"!==typeof window?window:{},q=l.MutationObserver||l.WebKitMutationObserver,g="undefined"!==typeof k?k:void 0===this?window:this,m=[],p;p="undefined"!==typeof process&&"[object process]"==={}.toString.call(process)?b():q?h():c();a.asap=
- function(a,e){1===m.push([a,e])&&p()}});g("promise/config",["exports"],function(a){var b={instrument:!1};a.config=b;a.configure=function(a,c){if(2===arguments.length)b[a]=c;else return b[a]}});g("promise/polyfill",["./promise","./utils","exports"],function(a,b,h){var c=a.Promise,f=b.isFunction;h.polyfill=function(){var a;a="undefined"!==typeof k?k:"undefined"!==typeof window&&window.document?window:self;"Promise"in a&&"resolve"in a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&
- function(){var b;new a.Promise(function(a){b=a});return f(b)}()||(a.Promise=c)}});g("promise/promise","./config ./utils ./all ./race ./resolve ./reject ./asap exports".split(" "),function(a,b,h,c,f,l,g,k){function m(e){if(!w(e))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof m))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=
- [];p(e,this)}function p(e,a){function b(e){u(a,e)}function f(e){t(a,e)}try{e(b,f)}catch(d){f(d)}}function r(e,a,b,f){var d=w(b),c,h,l,s;if(d)try{c=b(f),l=!0}catch(g){s=!0,h=g}else c=f,l=!0;A(a,c)||(d&&l?u(a,c):s?t(a,h):e===x?u(a,c):e===y&&t(a,c))}function e(e,a,b,f){e=e._subscribers;var d=e.length;e[d]=a;e[d+x]=b;e[d+y]=f}function s(e,a){for(var b,f,d=e._subscribers,c=e._detail,h=0;h<d.length;h+=3)b=d[h],f=d[h+a],r(a,b,f,c);e._subscribers=null}function A(e,a){var b=null,f;try{if(e===a)throw new TypeError("A promises callback cannot return that same promise.");
- if(E(a)&&(b=a.then,w(b)))return b.call(a,function(b){if(f)return!0;f=!0;a!==b?u(e,b):z(e,b)},function(a){if(f)return!0;f=!0;t(e,a)}),!0}catch(d){if(f)return!0;t(e,d);return!0}return!1}function u(e,a){e===a?z(e,a):A(e,a)||z(e,a)}function z(e,a){e._state===B&&(e._state=C,e._detail=a,v.async(F,e))}function t(e,a){e._state===B&&(e._state=C,e._detail=a,v.async(G,e))}function F(e){s(e,e._state=x)}function G(e){s(e,e._state=y)}var v=a.config,E=b.objectOrFunction,w=b.isFunction;a=h.all;c=c.race;f=f.resolve;
- l=l.reject;v.async=g.asap;var B=void 0,C=0,x=1,y=2;m.prototype={constructor:m,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(a,b){var f=this,d=new this.constructor(function(){});if(this._state){var c=arguments;v.async(function(){r(f._state,d,c[f._state-1],f._detail)})}else e(this,d,a,b);return d},"catch":function(e){return this.then(null,e)}};m.all=a;m.race=c;m.resolve=f;m.reject=l;k.Promise=m});g("promise/race",["./utils","exports"],function(a,b){var c=a.isArray;b.race=function(a){if(!c(a))throw new TypeError("You must pass an array to race.");
- return new this(function(b,d){for(var c,h=0;h<a.length;h++)(c=a[h])&&"function"===typeof c.then?c.then(b,d):b(c)})}});g("promise/reject",["exports"],function(a){a.reject=function(a){return new this(function(b,c){c(a)})}});g("promise/resolve",["exports"],function(a){a.resolve=function(a){return a&&"object"===typeof a&&a.constructor===this?a:new this(function(b){b(a)})}});g("promise/utils",["exports"],function(a){function b(a){return"function"===typeof a}var c=Date.now||function(){return(new Date).getTime()};
- a.objectOrFunction=function(a){return b(a)||"object"===typeof a&&null!==a};a.isFunction=b;a.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)};a.now=c});c("promise/polyfill").polyfill();cc.Promise=Promise;cc.Defer=function(){var a=this;this.promise=new Promise(function(b,c){a.resolve=b;a.reject=c})};cc.Defer.create=function(){return new cc.Defer}})(this);(function(k){function g(){this._events=this._events||{};this._maxListeners=this._maxListeners||void 0}g.EventEmitter=g;g.prototype._events=void 0;g.prototype._maxListeners=void 0;g.defaultMaxListeners=10;g.prototype.setMaxListeners=function(c){if(!cc.isNumber(c)||0>c||isNaN(c))throw TypeError("n must be a positive number");this._maxListeners=c;return this};g.prototype.emit=function(c){var b,a,d,h;this._events||(this._events={});if("error"===c&&!this._events.error){b=arguments[1];if(b instanceof Error)throw b;
- throw Error('Uncaught, unspecified "error" event.');}a=this._events[c];if(cc.isUndefined(a))return!1;if(cc.isFunction(a))switch(arguments.length){case 1:a.call(this);break;case 2:a.call(this,arguments[1]);break;case 3:a.call(this,arguments[1],arguments[2]);break;default:b=arguments.length;d=Array(b-1);for(h=1;h<b;h++)d[h-1]=arguments[h];a.apply(this,d)}else if(cc.isObject(a)){b=arguments.length;d=Array(b-1);for(h=1;h<b;h++)d[h-1]=arguments[h];a=a.slice();b=a.length;for(h=0;h<b;h++)a[h].apply(this,
- d)}return!0};g.prototype.addListener=function(c,b){var a;if(!cc.isFunction(b))throw TypeError("listener must be a function");this._events||(this._events={});this._events.newListener&&this.emit("newListener",c,cc.isFunction(b.listener)?b.listener:b);this._events[c]?cc.isObject(this._events[c])?this._events[c].push(b):this._events[c]=[this._events[c],b]:this._events[c]=b;cc.isObject(this._events[c])&&!this._events[c].warned&&(a=cc.isUndefined(this._maxListeners)?g.defaultMaxListeners:this._maxListeners)&&
- 0<a&&this._events[c].length>a&&(this._events[c].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[c].length),console.trace());return this};g.prototype.on=g.prototype.addListener;g.prototype.once=function(c,b){function a(){this.removeListener(c,a);d||(d=!0,b.apply(this,arguments))}if(!cc.isFunction(b))throw TypeError("listener must be a function");var d=!1;a.listener=b;this.on(c,a);
- return this};g.prototype.removeListener=function(c,b){var a,d,h;if(!cc.isFunction(b))throw TypeError("listener must be a function");if(!this._events||!this._events[c])return this;a=this._events[c];h=a.length;d=-1;if(a===b||cc.isFunction(a.listener)&&a.listener===b)delete this._events[c],this._events.removeListener&&this.emit("removeListener",c,b);else if(cc.isObject(a)){for(;0<h--;)if(a[h]===b||a[h].listener&&a[h].listener===b){d=h;break}if(0>d)return this;1===a.length?(a.length=0,delete this._events[c]):
- a.splice(d,1);this._events.removeListener&&this.emit("removeListener",c,b)}return this};g.prototype.removeAllListeners=function(c){var b;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[c]&&delete this._events[c],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);this.removeAllListeners("removeListener");this._events={};return this}b=this._events[c];if(cc.isFunction(b))this.removeListener(c,
- b);else if(Array.isArray(b))for(;b.length;)this.removeListener(c,b[b.length-1]);delete this._events[c];return this};g.prototype.listeners=function(c){return this._events&&this._events[c]?cc.isFunction(this._events[c])?[this._events[c]]:this._events[c].slice():[]};g.listenerCount=function(c,b){return c._events&&c._events[b]?cc.isFunction(c._events[b])?1:c._events[b].length:0};cc.EventEmitter=g;cc.EventEmitter.create=function(){return new g}})(this);(function(k){function g(e){return Array.isArray(e)}function c(e){return"string"===typeof e}function b(e){return"object"===typeof e&&null!==e}function a(e){return e.replace(/\-(\w)/ig,function(e,a){return a.toUpperCase()})}Object.defineProperty(cc,"exports",{get:function(){return k},set:function(e){cc.mixin(k,e)},enumerable:!0,configurable:!1});k.console||(k.console={log:cc.log,error:cc.log,trace:cc.log,warn:cc.log});"undefined"==typeof navigator&&(cc.navigator?k.navigator=cc.navigator:(k.navigator=
- {},navigator.userAgent="Cocos2dx Mac OSX"));var d=0<=navigator.userAgent.indexOf("Mac OSX"),h=0>navigator.userAgent.indexOf("Cocos2dx"),n=0<=navigator.userAgent.indexOf("Android"),f=0<=navigator.userAgent.indexOf("iOS");cc.isOSX=d;cc.isHtml5=h;cc.isAndroid=n;cc.isIOS=f;cc.isOpenGL=cc.sys.capabilities.opengl;cc.isOpenGL||(cc.TransitionCrossFade=cc.TransitionFadeBL=cc.TransitionFadeTR=cc.TransitionFade);cc.mixin=function(e,a,b){b=b||function(e,a){if("undefined"===typeof e)return a};!0==b&&(b=function(e,
- a){return a});for(var f in a){var d=b(e[f],a[f],f,e,a);"undefined"!==typeof d&&(e[f]=d)}return e};cc.isArray=g;cc.isBoolean=function(e){return"boolean"===typeof e};cc.isNull=function(e){return null===e};cc.isNullOrUndefined=function(e){return null==e};cc.isNumber=function(e){return"number"===typeof e};cc.isString=c;cc.isSymbol=function(e){return"symbol"===typeof e};cc.isUndefined=function(e){return void 0===e};cc.isRegExp=function(e){return b(e)&&"[object RegExp]"===objectToString(e)};cc.isObject=
- b;cc.isDate=function(e){return b(e)&&"[object Date]"===objectToString(e)};cc.isError=function(e){return b(e)&&("[object Error]"===objectToString(e)||e instanceof Error)};cc.isFunction=function(e){return"function"===typeof e};cc.random=function(e,a){if("number"===typeof e)return a=a||0,0|e+Math.random()*(a-e);if(e instanceof Array){var b=e.length;return null==a?e[0|Math.random()*b]:cc.arrayShuffle(e.slice(0)).slice(0,a)}return Math.random()};cc.tmpl=function(a,b,f){return a=a.replace(/\{([^\{\}]*)\}/g,
- function(a,e){if(!e)return"";try{var d=(new Function("data","with(data){return ("+e+");}"))(b);return f?f(d,e):d}catch(c){return a}})};cc.arrayShuffle=function(a){for(var b=a.length-1;0<b;b--){var f=0|Math.random()*(b+1),d=a[b];a[b]=a[f];a[f]=d}return a};cc.StringToArray||(cc.StringToArray=function(a){return a.trim().split(/\s*,\s*/).map(function(a){return parseInt(a)})});var l={aqua:"#00FFFF",black:"#000000",blue:"#0000FF",fuchsia:"#00ff00",grey:"#808080",gray:"#808080",green:"#008000",lime:"#00FF00",
- maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#FF0000",silver:"#C0C0C0",teal:"#008080",white:"#FFFFFF",yellow:"#FFFF00"},q=/^aqua$|^black$|^blue$|^fuchsia$|^grey|^gray$|^green$|^lime$|^maroon$|^navy$|^olive$|^purple$|^red$|^silver$|^teal$|^white$|^yellow$|^rgb\(.*?\)$|^rgba\(.*?\)$|^#[0-9a-fA-F]{3}$|^#[0-9a-fA-F]{6}$/;cc.isColorString=function(a){a=a.trim();return q.test(a)};var D=cc.hexToColor;cc.hexToColor=function(a){a=a.trim();if("#"===a[0])4===a.length&&(a=a.replace(/([^#])/g,
- "$1$1"));else{if("transparent"==a)return cc.color(0,0,0,0);if(/^rgba?\(/.test(a))return a=a.replace(/^rgba?\(/,""),a=cc.StringToArray(a),4>a.length&&(a[3]=255),cc.color.apply(null,a);a=l[a]}return D(a)};cc.fontFamily={_fonts:{},add:function(a,b){this._fonts[a]=b}};cc.textureCache.getTextureForKey||(cc.textureCache.getTextureForKey=cc.textureCache.textureForKey);cc.getSpriteFrame=function(a,b){var f=cc.spriteFrameCache.getSpriteFrame(a);if(!b&&!f){var d=cc.textureCache.getTextureForKey(a);d||(d=cc.textureCache.addImage(a));
- d&&(f=d.getContentSize(),f=cc.SpriteFrame.create(d,cc.rect(0,0,f.width,f.height)))}return f};cc.createSprite=function(a,b){"object"!==typeof a||a instanceof cc.Sprite||null!=b||(b=a,a.texture?(a=a.texture,delete b.texture):a=cc.Sprite.create());b=b||{};if("string"===typeof a)if("@"===a[0])a=cc.LabelTTF.create(a.slice(1));else if(/\.plist$/.test(a))a=cc.ParticleSystem.create(a);else{var f=cc.getSpriteFrame(a);a=cc.Sprite.create();f&&a.initWithSpriteFrame(f)}a.setCascadeOpacityEnabled&&a.setCascadeOpacityEnabled(!0);
- a.attr(b);return a};cc.makePoint2D=function(a){return g(a)?cc.p(a[0],a[1]):cc.p(a.x,a.y)};cc.makeSize2D=function(a){return g(a)?cc.size(a[0],a[1]):cc.size(a.width,a.height)};h||(cc.LabelTTF.prototype.setColor=function(a){this.getChildren()[0].setColor(a)},cc.LabelTTF.prototype.getColor=function(){return this.getChildren()[0].getColor()});cc.Node.prototype._attr=cc.Node.prototype.attr;var m={xy:{get:function(a){return cc.p(a.x,a.y)},set:function(a,b){b=cc.makePoint2D(b);a.attr({x:b.x,y:b.y})}},zOrder:{get:function(a){return a.zIndex},
- set:function(a,b){a.zIndex=b}},anchor:{get:function(a){return cc.p(a.anchorX,a.anchorY)},set:function(a,b){b=cc.makePoint2D(b);a.attr({anchorX:b.x,anchorY:b.y})}},size:{get:function(a){return cc.size(a.width,a.height)},set:function(a,b){b=cc.makeSize2D(b);a.attr({width:b.width,height:b.height});a.setDimensions&&a.setDimensions(b)}},texture:{get:function(a){return a.texture},set:function(a,b){b=b.trim();var f=b.match(/(.*)\s*(?:rect\((.*)\))/),d=null;f&&(b=f[1].trim(),d=cc.StringToArray(f[2]),d=cc.rect.apply(null,
- d));a.initWithSpriteFrame(cc.getSpriteFrame(b));d&&a.setTextureRect&&a.setTextureRect(d)}},color:{get:function(a){return a.getColor()},set:function(a,b){a.setColor(cc.color(b))}},background:{get:function(a){return a.__backgroundElement},set:function(a,b){var f=a.__backgroundElement;f&&f.removeFromParent(!0);f=a.attr("size");if(!c(b)||cc.isColorString(b)){b=cc.color(b);var d=cc.LayerColor.create(b);d.setLocalZOrder(-1);d.attr({size:f});a.addChild(d);a.__backgroundElement=d}else f=cc.createSprite(b,
- {xy:[f.width/2,f.height/2],zIndex:-1}),a.addChild(f),a.__backgroundElement=f}},fontFamily:{get:function(a){return a.__fontFamilyName||a.fontName},set:function(a,b){b in cc.fontFamily._fonts?(a.fontName=cc.fontFamily._fonts[b],a.__fontFamilyName=b):a.fontName=b}},textAlign:{set:function(a,b){if(a&&a.setHorizontalAlignment){var f={center:cc.TEXT_ALIGNMENT_CENTER,left:cc.TEXT_ALIGNMENT_LEFT,right:cc.TEXT_ALIGNMENT_RIGHT};"string"===typeof b&&(b=f[b]);a.setHorizontalAlignment(b);return!0}return!1},get:function(a){if(a&&
- a.getHorizontalAlignment)return a.getHorizontalAlignment()}},vAlign:{set:function(a,b){if(a&&a.setVerticalAlignment){var f={middle:cc.VERTICAL_TEXT_ALIGNMENT_CENTER,top:cc.VERTICAL_TEXT_ALIGNMENT_TOP,bottom:cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM};"string"===typeof b&&(b=f[b]);a.setVerticalAlignment(b);return!0}return!1},get:function(a){if(a&&a.getVerticalAlignment)return a.getVerticalAlignment()}}};cc.Node.prototype.attr=function(b,f){if(c(b)){if(1>=arguments.length)return b in m?m[b].get(this):this[b];
- var d=b;b={};b[d]=f}for(var h in b)h=a(h),"background"!=h&&(h in m?m[h].set(this,b[h]):this[h]=b[h]);"background"in b&&m.background.set(this,b.background)};cc.showMessage=function(a,b,f,d){f=f||250;d=d||80;var c=cc.LayerColor.create(cc.color("rgba(0,0,0,192)")),h=cc.director.getWinSize();c.setContentSize(f,d);c.setPosition(h.width/2-f/2,h.height/2-d/2);a.addChild(c,9999);a=cc.createSprite("@"+b,{xy:[f/2,d/2],fontSize:26});c.addChild(a);return c};cc.mixin(cc.game,new cc.EventEmitter);cc.eventManager.addCustomListener(cc.game.EVENT_HIDE,
- function(){cc.game.emit("hide")});cc.eventManager.addCustomListener(cc.game.EVENT_SHOW,function(){cc.game.emit("show")});cc.Sprite.prototype.setShaderProgram&&!cc.Sprite.prototype.setGLProgram&&(cc.Sprite.prototype.setGLProgram=cc.Sprite.prototype.setShaderProgram);if(cc.isOpenGL&&!cc.gray){cc.GLProgram.createWithByteArrays||(cc.GLProgram.createWithByteArrays=function(a,b){var f=cc.GLProgram.create();f.initWithVertexShaderByteArray(a,b);f.link();f.updateUniforms();setTimeout(function(){f.link();f.updateUniforms()},
- 0);return f});var p="varying vec4 v_fragmentColor;\nvarying vec2 v_texCoord;\n"+(h?"uniform sampler2D CC_Texture0;\n":"")+"void main()\n{\n\tvec4 v_orColor \x3d v_fragmentColor * texture2D(CC_Texture0, v_texCoord);\n\tfloat gray \x3d dot(v_orColor.rgb, vec3(0.299, 0.587, 0.114));\n\tgl_FragColor \x3d vec4(gray, gray, gray, v_orColor.a);\n}\n",r="attribute vec4 a_position;\nattribute vec2 a_texCoord;\nattribute vec4 a_color;\n\nvarying vec4 v_fragmentColor;\nvarying vec2 v_texCoord;\n\nvoid main()\n{\ngl_Position \x3d "+
- (h?"(CC_PMatrix * CC_MVMatrix)":"CC_PMatrix")+" * a_position;\nv_fragmentColor \x3d a_color;\nv_texCoord \x3d a_texCoord;\n}";cc.gray=function(a){if(a.fontName)a.__prevColor=a.attr("color"),a.attr("color","gray");else{var b=cc.GLProgram.createWithByteArrays(r,p);b.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);b.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);b.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);a.setGLProgram(b)}};cc.ungray=function(a){if(a.fontName)a.attr("color",
- a.__prevColor);else{var b=cc.GLProgram.createWithByteArrays(cc.SHADER_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_POSITION_TEXTURE_COLOR_FRAG);b.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);b.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);b.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);a.setGLProgram(b)}}}else cc.gray=function(){cc.log("Do not support shader in this display mode.")},cc.ungray=function(){cc.log("Do not support shader in this display mode.")}})(this);(function(k){var g=0,c=[];cc.postMessage||(cc.postMessage=function(a){a=JSON.parse(a);a.error="native interface not found, ignored.";b.onmessage(JSON.stringify(a))});var b={};Object.defineProperty(b,"onmessage",{value:function(a){if((a=JSON.parse(a))&&"2.0"==a.jsonrpc){var b=c[a.id];b&&b(a)}else a&&"weizoo"==a.protocal&&(a=decodeURIComponent(a.code))&&(new Function(a))()},enumerable:!1,writable:!1,configurable:!1});b.call=function(a,b){var h=cc.Defer.create();b=b||{};var n={jsonrpc:"2.0",method:a,
- params:b,id:g++};c[n.id]=function(a){a.error?h.reject(a.error):h.resolve(a.result)};cc.postMessage(JSON.stringify(n));return h.promise};cc.isHtml5||(k.open=function(a){cc.isAndroid&&!/^(http(s)?|file):\/\//.test(a)&&(a="file:///android_asset/"+a);b.call("open",{url:a})},k.close=function(a){});cc.native=b})(this);(function(k){k=cc.Class.extend({ctor:function(b,a){this.name=b;this.salt=a||"weizoo"},getRootKey:function(){return[this.salt,this.name].join("::")},get:function(b,a){var d=cc.sys.localStorage.getItem(this.getRootKey())||"{}",d=JSON.parse(d);return null==b?d:null!=d[b]?d[b]:a},set:function(b,a){var d=this.get();d[b]=a;cc.sys.localStorage.setItem(this.getRootKey(),JSON.stringify(d))}});var g=new k("gameSettings"),c=new k("userData");cc.Storage=k;cc.userData=c;cc.gameSettings=g})(this);cc.isHtml5||(cc.SHADER_POSITION_UCOLOR_FRAG="varying vec4 v_fragmentColor;\nvoid main() \n{ \n gl_FragColor \x3d v_fragmentColor; \n}\n",cc.SHADER_POSITION_UCOLOR_VERT="attribute vec4 a_position;\nuniform vec4 u_color;\nuniform u_pointSize;\nvarying vec4 v_fragmentColor; \nvoid main(void) \n{\n gl_Position \x3d CC_PMatrix * a_position; \n gl_PointSize \x3d u_pointSize; \n v_fragmentColor \x3d u_color; \n}",cc.SHADER_POSITION_COLOR_FRAG=
- "varying vec4 v_fragmentColor; \nvoid main() \n{ \n gl_FragColor \x3d v_fragmentColor; \n} ",cc.SHADER_POSITION_COLOR_VERT="attribute vec4 a_position;\nattribute vec4 a_color;\nvarying vec4 v_fragmentColor;\nvoid main()\n{\n gl_Position \x3d CC_PMatrix * a_position; \n v_fragmentColor \x3d a_color; \n}",cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_FRAG="// #extension GL_OES_standard_derivatives : enable\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvoid main()\t\n{ \n// #if defined GL_OES_standard_derivatives\t\n// gl_FragColor \x3d v_color*smoothstep(0.0, length(fwidth(v_texcoord)), 1.0 - length(v_texcoord)); \n// #else\t\ngl_FragColor \x3d v_color * step(0.0, 1.0 - length(v_texcoord)); \n// #endif \n}",
- cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_VERT="attribute vec4 a_position; \nattribute vec2 a_texcoord; \nattribute vec4 a_color;\t\nvarying vec4 v_color; \nvarying vec2 v_texcoord;\t\nvoid main() \n{ \n v_color \x3d a_color;//vec4(a_color.rgb * a_color.a, a_color.a); \n v_texcoord \x3d a_texcoord; \n gl_Position \x3d CC_PMatrix * a_position; \n}",cc.SHADER_POSITION_TEXTURE_FRAG="varying vec2 v_texCoord; \nvoid main() \n{ \n gl_FragColor \x3d texture2D(CC_Texture0, v_texCoord); \n}",
- cc.SHADER_POSITION_TEXTURE_VERT="attribute vec4 a_position; \nattribute vec2 a_texCoord; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_Position \x3d CC_PMatrix * a_position; \n v_texCoord \x3d a_texCoord; \n}",cc.SHADER_POSITION_TEXTURE_UCOLOR_FRAG="uniform vec4 u_color; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_FragColor \x3d texture2D(CC_Texture0, v_texCoord) * u_color; \n}",cc.SHADER_POSITION_TEXTURE_UCOLOR_VERT="attribute vec4 a_position;\nattribute vec2 a_texCoord; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_Position \x3d CC_PMatrix * a_position; \n v_texCoord \x3d a_texCoord; \n}",
- cc.SHADER_POSITION_TEXTURE_A8COLOR_FRAG="varying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_FragColor \x3d vec4( v_fragmentColor.rgb, \n v_fragmentColor.a * texture2D(CC_Texture0, v_texCoord).a \n ); \n}",cc.SHADER_POSITION_TEXTURE_A8COLOR_VERT="attribute vec4 a_position; \nattribute vec2 a_texCoord; \nattribute vec4 a_color; \nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_Position \x3d CC_PMatrix * a_position; \n v_fragmentColor \x3d a_color; \n v_texCoord \x3d a_texCoord; \n}",
- cc.SHADER_POSITION_TEXTURE_COLOR_FRAG="varying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_FragColor \x3d v_fragmentColor * texture2D(CC_Texture0, v_texCoord); \n}",cc.SHADER_POSITION_TEXTURE_COLOR_VERT="attribute vec4 a_position; \nattribute vec2 a_texCoord; \nattribute vec4 a_color; \nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_Position \x3d CC_PMatrix * a_position; \n v_fragmentColor \x3d a_color; \n v_texCoord \x3d a_texCoord; \n}",
- cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG="varying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nuniform float CC_alpha_value; \nvoid main() \n{ \n vec4 texColor \x3d texture2D(CC_Texture0, v_texCoord); \n // mimic: glAlphaFunc(GL_GREATER) \n //pass if ( incoming_pixel \x3e\x3d CC_alpha_value ) \x3d\x3e fail if incoming_pixel \x3c CC_alpha_value \n if ( texColor.a \x3c\x3d CC_alpha_value ) \n discard; \n gl_FragColor \x3d texColor * v_fragmentColor; \n}",
- cc.SHADEREX_SWITCHMASK_FRAG="varying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nuniform sampler2D u_texture; \nuniform sampler2D u_mask; \nvoid main() \n{ \n vec4 texColor \x3d texture2D(u_texture, v_texCoord); \n vec4 maskColor \x3d texture2D(u_mask, v_texCoord); \n vec4 finalColor \x3d vec4(texColor.r, texColor.g, texColor.b, maskColor.a * texColor.a); \n gl_FragColor \x3d v_fragmentColor * finalColor; \n}");(function(k){var g=cc.Sprite.extend({ctor:function(c){this.contentSprite=this;c instanceof cc.Node?(this._super(),c.attr({xy:[0,0],anchor:[0,0]}),this.addChild(c),this.setContentSize(c.getContentSize()),this.contentSprite=c):(this._super(),this.attr("texture",c));this._enabled=!0;var b=!1;cc.mixin(this,new cc.EventEmitter);var a=!1,d=this;this.on("touchstart",function(c){!d._enabled||a?c.preventDefault():b||(c=d.getScaleY(),d.setScale(0.95*c),a=b=!0,setTimeout(function(){a=!1},300))});this.on("touchend",
- function(){if(b){var a=d.getScaleY();d.setScale(a/0.95);b=!1}});cc._canvas&&cc._canvas.style&&(this.on("mouseenter",function(){d._enabled&&(cc._canvas.style.cursor="pointer")}),this.on("mouseleave",function(){d._enabled&&(cc._canvas.style.cursor="")}));Object.defineProperty(this,"disabled",{get:function(){return!this._enabled},set:function(a){this._enabled=!a;a?cc.gray(this.contentSprite):cc.ungray(this.contentSprite)},enumerable:!0,configurable:!1})}});g.create=function(c,b){var a=new g(c);b&&a.attr(b);
- return a};cc.Button=g})(this);(function(k){function g(){}var c=function(b,a,d){var c=[],g=0;a=a||0;var f=!1,l=!1;null==d&&(d=99999,l=!0);a>d&&(f=d,d=a,a=f,f=!0);d=d-a+1;do{var q=b.replace("%d",a+g);if(q=cc.getSpriteFrame(q,l))c.push(q);else break}while(++g<d);f&&c.reverse();return c};cc.mixin(g.prototype,{getActionList:function(){return this.__actions=this.__actions||[]},getAction:function(){this.__spawn=this.__spawn||[];0<this.getActionList().length&&this.spawn();if(1<this.__spawn.length)return cc.Spawn.create.apply(cc.Spawn,
- this.__spawn);if(1==this.__spawn.length)return this.__spawn[0]},addAction:function(b,a,d,c){var n;b instanceof g&&(b=b.getAction());if(b instanceof cc.Action)c=d,d=a,n=[b];else{for(var f=a.length-1;0<=f&&void 0===a[f];f--);a.length=f+1;n=[b.create.apply(b,a)]}if(d){for(var l=[].slice.call(arguments,3),f=l.length-1;0<=f&&void 0===l[f];f--);l.length=f+1;n[0]=d.create.apply(d,[n[0]].concat(l))}f=this.getActionList();f.push.apply(f,n);return this},delay:function(b){return this.addAction(cc.DelayTime,
- [b])},repeat:function(b,a){b=b||9999999;a=a||0;var d=this.getActionList();if(0<d.length){var c=cc.Sequence.create.apply(cc.Sequence,d.slice(-a)),c=cc.Repeat.create(c,b);d.length=0==a?0:d.length-a;d.push(c)}return this},reverse:function(){var b=this.getActionList();0<b.length&&b.push(b[b.length-1].reverse());return this},reverseAll:function(){var b=this.getActionList();if(0<b.length){var a=cc.Sequence.create.apply(cc.Sequence,b);b.push(a.reverse())}return this},then:function(b){b=cc.CallFunc.create(b,
- this);this.getActionList().push(b);return this},bezierBy:function(b,a,d,c){return this.addAction(cc.BezierBy,[b,a],d,c)},bezierTo:function(b,a,d,c){return this.addAction(cc.BezierTo,[b,a],d,c)},blink:function(b,a,d,c){return this.addAction(cc.Blink,[b,a],d,c)},fadeIn:function(b,a,d){return this.addAction(cc.FadeIn,[b],a,d)},fadeOut:function(b,a,d){return this.addAction(cc.FadeOut,[b],a,d)},fadeTo:function(b,a,d,c){return this.addAction(cc.FadeTo,[b,a],d,c)},jumpBy:function(b,a,d,c,g,f){return this.addAction(cc.JumpBy,
- [b,a,d,c||1],g,f)},jumpTo:function(b,a,d,c,g,f){return this.addAction(cc.JumpTo,[b,a,d,c||1],g,f)},moveBy:function(b,a,c,h){return this.addAction(cc.MoveBy,[b,a],c,h)},moveTo:function(b,a,c,h){return this.addAction(cc.MoveTo,[b,a],c,h)},rotateBy:function(b,a,c,h,g){return this.addAction(cc.RotateBy,[b,a,c],h,g)},rotateTo:function(b,a,c,h,g){return this.addAction(cc.RotateTo,[b,a,c],h,g)},scaleBy:function(b,a,c,h,g){return this.addAction(cc.ScaleBy,[b,a,c],h,g)},scaleTo:function(b,a,c,h,g){return this.addAction(cc.ScaleTo,
- [b,a,c],h,g)},skewBy:function(b,a,c,h,g){return this.addAction(cc.SkewBy,[b,a,c],h,g)},skewTo:function(b,a,c,h,g){return this.addAction(cc.SkewTo,[b,a,c],h,g)},tintBy:function(b,a,c,h,g,f){return this.addAction(cc.TintBy,[b,a,c,h],g,f)},tintTo:function(b,a,c,h,g,f){return this.addAction(cc.TintTo,[b,a,c,h],g,f)},animate:function(b){var a=[].slice.call(arguments,1),a=/%d/.test(a[0])?c.apply(null,a):a.map(function(a){return cc.getSpriteFrame(a)}),a=cc.Animation.create(a,b/a.length);this.getActionList().push(cc.Animate.create(a));
- return this},spawn:function(){this.__spawn=this.__spawn||[];var b=this.getActionList();if(0<b.length){var a=b[0];1<b.length&&(a=cc.Sequence.create.apply(cc.Sequence,b));this.__spawn.push(a);b.length=0}return this}});g.prototype.play=g.prototype.addAction;cc.mixin(cc.Node.prototype,new g);cc.AnimationFragement=g;cc.AnimationFragement.create=function(){return new cc.AnimationFragement};cc.Node.prototype.act=function(){var b=this.getAction();b&&(this.runAction(b),this.getActionList().length=0,this.__spawn.length=
- 0)}})(this);(function(k){function g(a,b,c,d,g,p){h?setTimeout(function(){cc.director.getScheduler().scheduleCallbackForTarget(a,b,c/1E3,d,g,p)},0):(cc.director.getScheduler().unscheduleCallbackForTarget(a,b),cc.director.getScheduler().scheduleCallbackForTarget(a,b,c/1E3,d,g,p));n.push(b);return n.length-1}function c(a,b,c,d){b.type=a;b.target=c;c.emit(a,b)}function b(a,b,d){var h=b.getLocation(),g=a.__touchTargets;b.returnValue=!0;for(var p=0;p<g.length;p++){var k=g[p],e=k.convertToNodeSpace(h),n=k.getContentSize(),
- n=cc.rect(0,0,n.width,n.height);if(k===a||cc.rectContainsPoint(n,e))return b.returnValue=!0,b.preventDefault=function(){b.returnValue=!1},"touchstart"===d&&(a.__touchedTarget=k,a.__currentTarget=k),"mousemove"===d&&(a.__mouseoverTarget!==k&&(a.__mouseoverTarget&&c("mouseleave",b,a.__mouseoverTarget,a),c("mouseenter",b,k,a)),a.__mouseoverTarget=k,c("mousemove",b,k,a)),"touchmove"===d&&k!==a.__currentTarget&&(a.__currentTarget&&c("touchleave",b,a.__currentTarget,a),c("touchenter",b,k,a),a.__currentTarget=
- k),a.__touchedTarget&&"touchmove"===d&&k!==a.__touchedTarget&&(c("touchend",b,a.__touchedTarget,a),a.__moved=!0,delete a.__touchedTarget),c(d,b,k,a),b.returnValue}!a.__touchedTarget||"touchmove"!==d&&"touchend"!==d||(c("touchend",b,a.__touchedTarget,a),a.__currentTarget&&(c("touchleave",b,a.__currentTarget,a),delete a.__currentTarget),a.__moved=!0,delete a.__touchedTarget);a.__mouseoverTarget&&(c("mouseleave",b,a.__mouseoverTarget,a),delete a.__mouseoverTarget);return!1}var a=cc.Layer.prototype.onEnter,
- d=cc.Layer.prototype.onExit,h=cc.isHtml5,n=[null];cc.Layer.prototype.setTimeout=function(a,b){return g(this||k,a,b||0,0,0,!1)};cc.Layer.prototype.setInterval=function(a,b){return g(this||k,a,b||0,cc.REPEAT_FOREVER,0,!1)};cc.Layer.prototype.clearAllTimers=function(){var a=this||k;cc.director.getScheduler().unscheduleAllCallbacksForTarget(a)};cc.Layer.prototype.clearInterval=cc.Layer.prototype.clearTimeout=function(a){var b=this||k,c=n[a];null!=c&&(cc.director.getScheduler().unscheduleCallbackForTarget(b,
- c),n[a]=null)};cc.Layer.prototype.getContext=function(){this.__contextDefer||(this.__contextDefer=cc.Defer.create());return this.__contextDefer.promise};cc.Layer.prototype.onEnter=function(){this.__contextDefer||(this.__contextDefer=cc.Defer.create());var b=this;!this.__initedKeyback&&this.backClicked&&cc._EventListenerKeyboard&&(this.__initedKeyback=!0,cc.eventManager.addListener({event:cc.EventListener.KEYBOARD,onKeyReleased:function(a,c){a==cc.KEY.back&&b.setTimeout(function(){b.backClicked()},
- 300)}},this));if(this.backClicked&&"undefined"!==typeof history){history.pushState({},"");var c=function(a){b.backClicked()};this.__pushState=c;window.addEventListener("popstate",c)}this.__contextDefer.resolve(cc.director.getRunningScene());return a.apply(this,arguments)};cc.Layer.prototype.onExit=function(){this.backClicked&&"undefined"!==typeof history&&this.__pushState&&(window.removeEventListener("popstate",this.__pushState),this.__pushState=null);if(this.__retainedTargets)for(var a=0;a<this.__retainedTargets.length;a++)this.__retainedTargets[a].release();
- this.clearAllTimers();return d.apply(this,arguments)};cc.Layer.prototype.retainTarget=function(a){this.__retainedTargets=this.__retainedTargets||[];this.__retainedTargets.push(a);a.retain()};cc.Layer.prototype.addChildToBatch=function(a,b){var c;this.__batchNodes=this.__batchNodes||{};this.__batchNodes[b]?c=this.__batchNodes[b]:(c=cc.SpriteBatchNode.create(b),this.__batchNodes[b]=c,c.setLocalZOrder(a.getLocalZOrder()),c.setGlobalZOrder(a.getGlobalZOrder()),this.addChild(c));c.addChild(a)};cc.Layer.prototype.publish=
- function(){var a=[].slice.apply(arguments);this.getContext().then(function(b){b.__pubsubEmitter||(b.__pubsubEmitter=new cc.EventEmitter);b.setTimeout(function(){b.__pubsubEmitter.emit.apply(b,a)},0)})};cc.Layer.prototype.subscribe=function(){var a=[].slice.apply(arguments);this.getContext().then(function(b){b.__pubsubEmitter||(b.__pubsubEmitter=new cc.EventEmitter);b.__pubsubEmitter.on.apply(b,a)})};cc.Layer.prototype.unsubscribe=function(){var a=[].slice.apply(arguments);this.getContext().then(function(b){b.__pubsubEmitter||
- (b.__pubsubEmitter=new cc.EventEmitter);b.__pubsubEmitter.removeListener.apply(b,a)})};cc.Layer.prototype.setBackground=function(a){if(cc.isColorString(a))a=cc.LayerColor.create(cc.color(a)),this.addChild(a,-1);else{var b=this.attr("size");a=cc.createSprite(a,{xy:[b.width/2,b.height/2],zIndex:-1});this.addChild(a)}};cc.mixin(cc.Layer.prototype,{__clickAndMove:!0,setClickAndMove:function(a){this.__clickAndMove=a}});cc.Layer.prototype.delegate=function(a,b,c){this.__touchTargets||this.registerDelegator(!0);
- 0>this.__touchTargets.indexOf(a)&&(a.on||cc.mixin(a,new cc.EventEmitter),this.__touchTargets.unshift(a),this.__touchTargets.sort(function(a,b){return b.getGlobalZOrder()-a.getGlobalZOrder()||b.getLocalZOrder()-a.getLocalZOrder()}));if(b)if(cc.isString(b)){var d=b.split(",");d.forEach(function(b){a.on(b.trim(),c)})}else for(var g in b)cc.isFunction(b[g])?(d=g.split(","),c=b[g],d.forEach(function(b){a.on(b.trim(),c)})):a[g]=b[g]};cc.Layer.prototype.undelegate=function(a,b){if(this.__touchTargets){var c=
- this.__touchTargets.indexOf(a);0<=c&&(b?a.removeAllListeners(b):(this.__touchTargets.splice(c,1),a.removeAllListeners()))}};cc.Layer.prototype.registerDelegator=function(a){cc.assert(!this.__touchTargets,"The delegator has already registered!");this.__touchTargets=[];var c=this;cc.eventManager.addListener({event:cc.EventListener.TOUCH_ONE_BY_ONE,swallowTouches:a,onTouchBegan:function(a,d){var f=c.attr("size");c.__beginTouchPoint=a.getLocation();var g=c.convertToNodeSpace(c.__beginTouchPoint);return cc.rectContainsPoint(cc.rect(0,
- 0,f.width,f.height),g)?b(c,a,"touchstart"):!1},onTouchMoved:function(a,d){var f=c.attr("size"),g=a.getLocation(),g=cc.p(g.x-c.__beginTouchPoint.x,g.y-c.__beginTouchPoint.y);!c.__clickAndMove&&(Math.abs(g.x)>=Math.min(15,f.width/30)||Math.abs(g.y)>=Math.min(15,f.height/30))&&(c.__moved=!0);return b(c,a,"touchmove")},onTouchEnded:function(a,d){var f=b(c,a,"touchend");c.__moved||b(c,a,"click");c.__moved=!1;return f}},this);cc.eventManager.addListener({event:cc.EventListener.MOUSE,onMouseMove:function(a){return b(c,
- a,"mousemove")}},this)};cc.Layer.prototype.pauseEvent=function(){cc.eventManager.pauseTarget(this)};cc.Layer.prototype.resumeEvent=function(){cc.eventManager.resumeTarget(this)};cc.Layer.prototype.getExtras=function(){return cc.director.getRunningScene().__extraData}})(this);(function(k){cc.Scene.prototype.reload=function(){var b=new this.constructor;cc.director.runScene(b)};var g=cc.Scene.prototype.onEnter,c=cc.Scene.prototype.onExit;cc.Scene.prototype.onEnter=function(){this.autoReload&&(this.__entered?this.reload():this.__entered=!0);return g.apply(this,arguments)};cc.Scene.prototype.onExit=function(){return c.apply(this,arguments)};cc.Scene.prototype.putExtra=function(b,a){this.__extraData=this.__extraData||{};1<arguments.length?this.__extraData[b]=a:cc.mixin(this.__extraData,
- b)}})(this);(function(k){var g=cc.Layer.extend({ctor:function(c,b){this._super();this.cellSize=cc.size(c,b);this._tiles={}},setTileAt:function(c,b,a,d,g){var k=cc.p(b,a);d="object"==typeof a?a:cc.p(d,g);k=this.tileToLocation(k);c.attr(cc.pAdd(k,d));this.addChild(c);this._tiles[[b,a]]=c},getTileAt:function(c,b){return this._tiles[[c,b]]},removeTileAt:function(c,b){var a=this._tiles[[c,b]];a&&a.removeFromParent(!0);delete this._tiles[[c,b]]},locationToTile:function(c){var b=this.getScaleX(),a=this.getScaleY(),
- d=this.cellSize;return cc.p(0|c.x/(d.width*b),0|c.y/(d.height*a))},tileToLocation:function(c){var b=this.getScaleX(),a=this.getScaleY(),d=this.cellSize;return cc.p((0.5+c.x)*d.width*b,(0.5+c.y)*d.height*a)}});g.create=function(c,b){return new g(c,b)};cc.TileLayer=g})(this);
|