if(null===revision||"undefined"===typeof revision)var revision=1234;var cc=cc||{};cc._tmp=cc._tmp||{};cc._LogInfos={};var _p=window,_p=Object.prototype,_p=null;cc._drawingUtil=null;cc._renderContext=null;cc._supportRender=!1;cc._canvas=null;cc.container=null;cc._gameDiv=null;cc.each=function(a,b,c){if(a)if(a instanceof Array)for(var d=0,e=a.length;d<e&&!1!==b.call(c,a[d],d);d++);else for(d in a)if(!1===b.call(c,a[d],d))break}; cc.extend=function(a){var b=2<=arguments.length?Array.prototype.slice.call(arguments,1):[];cc.each(b,function(b){for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d])});return a};cc.inherits=function(a,b){function c(){}c.prototype=b.prototype;a.superClass_=b.prototype;a.prototype=new c;a.prototype.constructor=a};cc.isFunction=function(a){return"function"===typeof a};cc.isNumber=function(a){return"number"===typeof a||"[object Number]"===Object.prototype.toString.call(a)}; cc.isString=function(a){return"string"===typeof a||"[object String]"===Object.prototype.toString.call(a)};cc.isArray=function(a){return Array.isArray(a)||"object"===typeof a&&"[object Array]"===Object.prototype.toString.call(a)};cc.isUndefined=function(a){return"undefined"===typeof a};cc.isObject=function(a){return"object"===typeof a&&"[object Object]"===Object.prototype.toString.call(a)}; cc.isCrossOrigin=function(a){if(!a)return cc.log("invalid URL"),!1;var b=a.indexOf("://");if(-1===b)return!1;b=a.indexOf("/",b+3);return(-1===b?a:a.substring(0,b))!==location.origin}; cc.AsyncPool=function(a,b,c,d,e){var f=this;f._finished=!1;f._srcObj=a;f._limit=b;f._pool=[];f._iterator=c;f._iteratorTarget=e;f._onEnd=d;f._onEndTarget=e;f._results=a instanceof Array?[]:{};f._errors=a instanceof Array?[]:{};cc.each(a,function(a,b){f._pool.push({index:b,value:a})});f.size=f._pool.length;f.finishedSize=0;f._workingSize=0;f._limit=f._limit||f.size;f.onIterator=function(a,b){f._iterator=a;f._iteratorTarget=b};f.onEnd=function(a,b){f._onEnd=a;f._onEndTarget=b};f._handleItem=function(){var a= this;if(!(0===a._pool.length||a._workingSize>=a._limit)){var b=a._pool.shift(),c=b.value,d=b.index;a._workingSize++;a._iterator.call(a._iteratorTarget,c,d,function(b,c){if(!a._finished)if(b?a._errors[this.index]=b:a._results[this.index]=c,a.finishedSize++,a._workingSize--,a.finishedSize===a.size)a.onEnd(0===a._errors.length?null:a._errors,a._results);else a._handleItem()}.bind(b),a)}};f.flow=function(){if(0===this._pool.length)this._onEnd&&this._onEnd.call(this._onEndTarget,null,[]);else for(var a= 0;a<this._limit;a++)this._handleItem()};f.onEnd=function(a,b){f._finished=!0;if(f._onEnd){var c=f._onEnd,d=f._onEndTarget;f._onEnd=null;f._onEndTarget=null;c.call(d,a,b)}}}; cc.async={series:function(a,b,c){a=new cc.AsyncPool(a,1,function(a,b,f){a.call(c,f)},b,c);a.flow();return a},parallel:function(a,b,c){a=new cc.AsyncPool(a,0,function(a,b,f){a.call(c,f)},b,c);a.flow();return a},waterfall:function(a,b,c){var d=[],e=[null],f=new cc.AsyncPool(a,1,function(b,f,k){d.push(function(b){d=Array.prototype.slice.call(arguments,1);a.length-1===f&&(e=e.concat(d));k.apply(null,arguments)});b.apply(c,d)},function(a){if(b){if(a)return b.call(c,a);b.apply(c,e)}});f.flow();return f}, map:function(a,b,c,d){var e=b;"object"===typeof b&&(c=b.cb,d=b.iteratorTarget,e=b.iterator);a=new cc.AsyncPool(a,0,e,c,d);a.flow();return a},mapLimit:function(a,b,c,d,e){a=new cc.AsyncPool(a,b,c,d,e);a.flow();return a}}; cc.path={normalizeRE:/[^\.\/]+\/\.\.\//,join:function(){for(var a=arguments.length,b="",c=0;c<a;c++)b=(b+(""===b?"":"/")+arguments[c]).replace(/(\/|\\\\)$/,"");return b},extname:function(a){return(a=/(\.[^\.\/\?\\]*)(\?.*)?$/.exec(a))?a[1]:null},mainFileName:function(a){if(a){var b=a.lastIndexOf(".");if(-1!==b)return a.substring(0,b)}return a},basename:function(a,b){var c=a.indexOf("?");0<c&&(a=a.substring(0,c));c=/(\/|\\\\)([^(\/|\\\\)]+)$/g.exec(a.replace(/(\/|\\\\)$/,""));if(!c)return null;c=c[2]; return b&&a.substring(a.length-b.length).toLowerCase()===b.toLowerCase()?c.substring(0,c.length-b.length):c},dirname:function(a){return a.replace(/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,"$2")},changeExtname:function(a,b){b=b||"";var c=a.indexOf("?"),d="";0<c&&(d=a.substring(c),a=a.substring(0,c));c=a.lastIndexOf(".");return 0>c?a+b+d:a.substring(0,c)+b+d},changeBasename:function(a,b,c){if(0===b.indexOf("."))return this.changeExtname(a,b);var d=a.indexOf("?"),e="";c=c?this.extname(a):"";0<d&&(e=a.substring(d), a=a.substring(0,d));d=a.lastIndexOf("/");return a.substring(0,0>=d?0:d+1)+b+c+e},_normalize:function(a){var b=a=String(a);do b=a,a=a.replace(this.normalizeRE,"");while(b.length!==a.length);return a}}; cc.loader=function(){var a={},b={},c={},d={},e={},f=/^(?:https?|ftp):\/\/\S*$/i;return{resPath:"",audioPath:"",cache:{},getXMLHttpRequest:function(){var a=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP");void 0===a.ontimeout&&(a._timeoutId=-1);return a},_getArgs4Js:function(a){var b=a[0],c=a[1],d=a[2],e=["",null,null];if(1===a.length)e[1]=b instanceof Array?b:[b];else if(2===a.length)"function"===typeof c?(e[1]=b instanceof Array?b:[b],e[2]=c):(e[0]=b||"",e[1]=c instanceof Array?c:[c]);else if(3===a.length)e[0]=b||"",e[1]=c instanceof Array?c:[c],e[2]=d;else throw Error("arguments error to load js!");return e},isLoading:function(a){return void 0!==e[a]},loadJs:function(b,c,d){var e=this,f=e._getArgs4Js(arguments),p=f[0],r=f[1],f=f[2];-1<navigator.userAgent.indexOf("Trident/5")?e._loadJs4Dependency(p,r,0,f):cc.async.map(r,function(b,c,d){b=cc.path.join(p,b);if(a[b])return d(null);e._createScript(b,!1,d)},f)},loadJsWithImg:function(a,b,c){var d=this._loadJsImg(),e=this._getArgs4Js(arguments); this.loadJs(e[0],e[1],function(a){if(a)throw Error(a);d.parentNode.removeChild(d);if(e[2])e[2]()})},_createScript:function(b,c,d){var e=document,f=document.createElement("script");f.async=c;a[b]=!0;cc.game.config.noCache&&"string"===typeof b?this._noCacheRex.test(b)?f.src=b+"\x26_t\x3d"+(new Date-0):f.src=b+"?_t\x3d"+(new Date-0):this._noCacheRex.test(b)?f.src=b+"\x26_t\x3d"+revision:f.src=b+"?_t\x3d"+revision;f.addEventListener("load",function(){f.parentNode.removeChild(f);this.removeEventListener("load", arguments.callee,!1);d()},!1);f.addEventListener("error",function(){f.parentNode.removeChild(f);d("Load "+b+" failed!")},!1);e.body.appendChild(f)},_loadJs4Dependency:function(a,b,c,d){if(c>=b.length)d&&d();else{var e=this;e._createScript(cc.path.join(a,b[c]),!1,function(f){if(f)return d(f);e._loadJs4Dependency(a,b,c+1,d)})}},_loadJsImg:function(){var a=document,b=a.getElementById("cocos2d_loadJsImg");if(!b){b=document.createElement("img");cc._loadingImage&&(b.src=cc._loadingImage);a=a.getElementById(cc.game.config.id); a.style.backgroundColor="transparent";a.parentNode.appendChild(b);var c=getComputedStyle?getComputedStyle(a):a.currentStyle;c||(c={width:a.width,height:a.height});b.style.left=a.offsetLeft+(parseFloat(c.width)-b.width)/2+"px";b.style.top=a.offsetTop+(parseFloat(c.height)-b.height)/2+"px";b.style.position="absolute"}return b},loadTxt:function(a,b){if(cc._isNodeJs)require("fs").readFile(a,function(a,c){a?b(a):b(null,c.toString())});else{var c=this.getXMLHttpRequest(),d="load "+a+" failed!";c.open("GET", a,!0);/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)?(c.setRequestHeader("Accept-Charset","utf-8"),c.onreadystatechange=function(){4===c.readyState&&(200===c.status?b(null,c.responseText):b({status:c.status,errorMessage:d},null))}):(c.overrideMimeType&&c.overrideMimeType("text/plain; charset\x3dutf-8"),c.onload=function(){0<=c._timeoutId&&clearTimeout(c._timeoutId);4===c.readyState&&(200===c.status?b(null,c.responseText):b({status:c.status,errorMessage:d},null))},c.onerror= function(){b({status:c.status,errorMessage:d},null)},void 0===c.ontimeout&&(c._timeoutId=setTimeout(function(){c.ontimeout()},c.timeout)),c.ontimeout=function(){b({status:c.status,errorMessage:"Request timeout: "+d},null)});c.send(null)}},loadCsb:function(a,b){var c=cc.loader.getXMLHttpRequest(),d="load "+a+" failed!";c.open("GET",a,!0);c.responseType="arraybuffer";c.onload=function(){0<=c._timeoutId&&clearTimeout(c._timeoutId);var a=c.response;a&&(window.msg=a);4===c.readyState&&(200===c.status? b(null,c.response):b({status:c.status,errorMessage:d},null))};c.onerror=function(){b({status:c.status,errorMessage:d},null)};void 0===c.ontimeout&&(c._timeoutId=setTimeout(function(){c.ontimeout()},c.timeout));c.ontimeout=function(){b({status:c.status,errorMessage:"Request timeout: "+d},null)};c.send(null)},loadJson:function(a,b){this.loadTxt(a,function(c,d){if(c)b(c);else{try{var e=JSON.parse(d)}catch(f){throw Error("parse json ["+a+"] failed : "+f);}b(null,e)}})},_checkIsImageURL:function(a){return null!= /(\.png)|(\.jpg)|(\.bmp)|(\.jpeg)|(\.gif)/.exec(a)},loadImg:function(a,b,c){var d={isCrossOrigin:!0};void 0!==c?d.isCrossOrigin=void 0===b.isCrossOrigin?d.isCrossOrigin:b.isCrossOrigin:void 0!==b&&(c=b);var n=this.getRes(a);if(n)return c&&c(null,n),n;if(b=e[a])return b.callbacks.push(c),b.img;n=new Image;d.isCrossOrigin&&"file://"!==location.origin&&(n.crossOrigin="Anonymous");var p=function(){this.removeEventListener("load",p,!1);this.removeEventListener("error",s,!1);f.test(a)||(cc.loader.cache[a]= n);var b=e[a];if(b){for(var c=b.callbacks,d=0;d<c.length;++d){var h=c[d];h&&h(null,n)}b.img=null;delete e[a]}},r=this,s=function(){this.removeEventListener("error",s,!1);if(n.crossOrigin&&"anonymous"===n.crossOrigin.toLowerCase())d.isCrossOrigin=!1,r.release(a),cc.loader.loadImg(a,d,c);else{var b=e[a];if(b){for(var f=b.callbacks,h=0;h<f.length;++h){var p=f[h];p&&p("load image failed")}b.img=null;delete e[a]}}};e[a]={img:n,callbacks:c?[c]:[]};n.addEventListener("load",p);n.addEventListener("error", s);n.src=a;return n},_loadResIterator:function(a,c,d){var e=this,n=null,p=a.type;p?(p="."+p.toLowerCase(),n=a.src?a.src:a.name+p):(n=a,p=cc.path.extname(n));if(c=e.getRes(n))return d(null,c);c=null;p&&(c=b[p.toLowerCase()]);if(!c)return cc.error("loader for ["+p+"] not exists!"),d();p=n;f.test(n)||(p=c.getBasePath?c.getBasePath():e.resPath,p=-1!=n.indexOf("https://")?n:e.getUrl(p,n));n=n.split("?")[0];p=cc.game.config.noCache&&"string"===typeof p?e._noCacheRex.test(p)?p+("\x26_t\x3d"+(new Date-0)): p+("?_t\x3d"+(new Date-0)):e._noCacheRex.test(p)?p+("\x26_t\x3d"+revision):p+("?_t\x3d"+revision);c.load(p,n,a,function(a,b){a?(cc.log(a),e.cache[n]=null,delete e.cache[n],d({status:520,errorMessage:a,url:n},null)):(e.cache[n]=b,d(null,b))})},_noCacheRex:/\?/,getUrl:function(a,d){var e=cc.path;if(void 0!==a&&void 0===d){d=a;var f=e.extname(d),f=f?f.toLowerCase():"";a=(f=b[f])?f.getBasePath?f.getBasePath():this.resPath:this.resPath}d=cc.path.join(a||"",d);if(d.match(/[\/(\\\\)]lang[\/(\\\\)]/i)){if(c[d])return c[d]; e=e.extname(d)||"";d=c[d]=d.substring(0,d.length-e.length)+"_"+cc.sys.language+e}return d},load:function(a,b,c){var d=this,e=arguments.length;if(0===e)throw Error("arguments error!");3===e?"function"===typeof b&&(b="function"===typeof c?{trigger:b,cb:c}:{cb:b,cbTarget:c}):2===e?"function"===typeof b&&(b={cb:b}):1===e&&(b={});a instanceof Array||(a=[a]);e=new cc.AsyncPool(a,cc.CONCURRENCY_HTTP_REQUEST_COUNT,function(a,c,e,f){d._loadResIterator(a,c,function(a){var c=Array.prototype.slice.call(arguments, 1);b.trigger&&b.trigger.call(b.triggerTarget,c[0],f.size,f.finishedSize);e(a,c[0])})},b.cb,b.cbTarget);e.flow();return e},_handleAliases:function(a,b){var c=[],e;for(e in a){var f=a[e];d[e]=f;c.push(f)}this.load(c,b)},loadAliases:function(a,b){var c=this,d=c.getRes(a);d?c._handleAliases(d.filenames,b):c.load(a,function(a,d){c._handleAliases(d[0].filenames,b)})},register:function(a,c){if(a&&c){if("string"===typeof a)return b[a.trim().toLowerCase()]=c;for(var d=0,e=a.length;d<e;d++)b["."+a[d].trim().toLowerCase()]= c}},getRes:function(a){return this.cache[a]||this.cache[d[a]]},_getAliase:function(a){return d[a]},release:function(a){var b=this.cache,c=e[a];c&&(c.img=null,delete e[a]);delete b[a];delete b[d[a]];delete d[a]},releaseAll:function(){var a=this.cache,b;for(b in a)delete a[b];for(b in d)delete d[b]}}}(); cc.formatStr=function(){var a=arguments,b=a.length;if(1>b)return"";var c=a[0],d=!0;"object"===typeof c&&(d=!1);for(var e=1;e<b;++e){var f=a[e];if(d)for(;;){var g=null;if("number"===typeof f&&(g=c.match(/(%d)|(%s)/))){c=c.replace(/(%d)|(%s)/,f);break}c=(g=c.match(/%s/))?c.replace(/%s/,f):c+(" "+f);break}else c+=" "+f}return c}; (function(){function a(a){var b=cc.game.CONFIG_KEY,c=parseInt(a[b.renderMode])||0;if(isNaN(c)||2<c||0>c)a[b.renderMode]=0;cc._renderType=cc.game.RENDER_TYPE_CANVAS;cc._supportRender=!1;0===c?(a=-1,/iP(hone|od|ad)/.test(navigator.platform)&&(a=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),a=parseInt(a[1],10)),cc.sys.capabilities.opengl&&14>a?(cc._renderType=cc.game.RENDER_TYPE_WEBGL,cc._supportRender=!0):cc.sys.capabilities.canvas&&(cc._renderType=cc.game.RENDER_TYPE_CANVAS,cc._supportRender= !0)):1===c&&cc.sys.capabilities.canvas?(cc._renderType=cc.game.RENDER_TYPE_CANVAS,cc._supportRender=!0):2===c&&cc.sys.capabilities.opengl&&(cc._renderType=cc.game.RENDER_TYPE_WEBGL,cc._supportRender=!0)}function b(a,c,d){if(h[c])return null;d=d||"";var e=[],f=a[c];if(!f)throw Error("can not find module ["+c+"]");c=cc.path;for(var g=0,k=f.length;g<k;g++){var m=f[g];if(!h[m]){var x=c.extname(m);x?".js"===x.toLowerCase()&&e.push(c.join(d,m)):(x=b(a,m,d))&&(e=e.concat(x));h[m]=1}}return e}function c(a){cc._initDebugSetting&& cc._initDebugSetting(a[cc.game.CONFIG_KEY.debugMode]);cc._engineLoaded=!0;console.log(cc.ENGINE_VERSION);m&&m()}function d(a){var d=a[cc.game.CONFIG_KEY.engineDir],e=cc.loader;if(cc.Class)c(a);else{var f=cc.path.join(d,"moduleConfig.json");e.loadJson(f,function(e,f){if(e)throw Error(e);var g=a.modules||[],h=f.module,k=[];cc.sys.capabilities.opengl&&0>g.indexOf("base4webgl")?g.splice(0,0,"base4webgl"):0>g.indexOf("core")&&g.splice(0,0,"core");for(var m=0,r=g.length;m<r;m++){var s=b(h,g[m],d);s&&(k= k.concat(s))}cc.loader.loadJsWithImg(k,function(b){if(b)throw b;c(a)})})}}function e(){this.removeEventListener("load",e,!1);d(cc.game.config)}var f=document.createElement("canvas"),g=document.createElement("canvas");cc.create3DContext=function(a,b){for(var c=["webgl","experimental-webgl","webkit-3d","moz-webgl"],d=null,e=0;e<c.length;++e){try{d=a.getContext(c[e],b)}catch(f){}if(d)break}return d};(function(){cc.sys={};var a=cc.sys;a.LANGUAGE_ENGLISH="en";a.LANGUAGE_CHINESE="zh";a.LANGUAGE_FRENCH= "fr";a.LANGUAGE_ITALIAN="it";a.LANGUAGE_GERMAN="de";a.LANGUAGE_SPANISH="es";a.LANGUAGE_DUTCH="du";a.LANGUAGE_RUSSIAN="ru";a.LANGUAGE_KOREAN="ko";a.LANGUAGE_JAPANESE="ja";a.LANGUAGE_HUNGARIAN="hu";a.LANGUAGE_PORTUGUESE="pt";a.LANGUAGE_ARABIC="ar";a.LANGUAGE_NORWEGIAN="no";a.LANGUAGE_POLISH="pl";a.LANGUAGE_UNKNOWN="unkonwn";a.OS_IOS="iOS";a.OS_ANDROID="Android";a.OS_WINDOWS="Windows";a.OS_MARMALADE="Marmalade";a.OS_LINUX="Linux";a.OS_BADA="Bada";a.OS_BLACKBERRY="Blackberry";a.OS_OSX="OS X";a.OS_WP8= "WP8";a.OS_WINRT="WINRT";a.OS_UNKNOWN="Unknown";a.UNKNOWN=-1;a.WIN32=0;a.LINUX=1;a.MACOS=2;a.ANDROID=3;a.IPHONE=4;a.IPAD=5;a.BLACKBERRY=6;a.NACL=7;a.EMSCRIPTEN=8;a.TIZEN=9;a.WINRT=10;a.WP8=11;a.MOBILE_BROWSER=100;a.DESKTOP_BROWSER=101;a.BROWSER_TYPE_WECHAT="wechat";a.BROWSER_TYPE_ANDROID="androidbrowser";a.BROWSER_TYPE_IE="ie";a.BROWSER_TYPE_QQ="qqbrowser";a.BROWSER_TYPE_MOBILE_QQ="mqqbrowser";a.BROWSER_TYPE_UC="ucbrowser";a.BROWSER_TYPE_360="360browser";a.BROWSER_TYPE_BAIDU_APP="baiduboxapp";a.BROWSER_TYPE_BAIDU= "baidubrowser";a.BROWSER_TYPE_MAXTHON="maxthon";a.BROWSER_TYPE_OPERA="opera";a.BROWSER_TYPE_OUPENG="oupeng";a.BROWSER_TYPE_MIUI="miuibrowser";a.BROWSER_TYPE_FIREFOX="firefox";a.BROWSER_TYPE_SAFARI="safari";a.BROWSER_TYPE_CHROME="chrome";a.BROWSER_TYPE_LIEBAO="liebao";a.BROWSER_TYPE_QZONE="qzone";a.BROWSER_TYPE_SOUGOU="sogou";a.BROWSER_TYPE_UNKNOWN="unknown";a.isNative=!1;var b=window,c=b.navigator,d=document,e=d.documentElement,h=c.userAgent.toLowerCase();a.isMobile=/mobile|android|iphone|ipad/.test(h); a.platform=a.isMobile?a.MOBILE_BROWSER:a.DESKTOP_BROWSER;var k=c.language,k=(k=k?k:c.browserLanguage)?k.split("-")[0]:a.LANGUAGE_ENGLISH;a.language=k;var m=k=!1,x="",B=0,y=/android (\d+(?:\.\d+)+)/i.exec(h)||/android (\d+(?:\.\d+)+)/i.exec(c.platform);y&&(k=!0,x=y[1]||"",B=parseInt(x)||0);(y=/(iPad|iPhone|iPod).*OS ((\d+_?){2,3})/i.exec(h))?(m=!0,x=y[2]||"",B=parseInt(x)||0):/(iPhone|iPad|iPod)/.exec(c.platform)&&(m=!0,x="",B=0);y=a.OS_UNKNOWN;-1!==c.appVersion.indexOf("Win")?y=a.OS_WINDOWS:m?y=a.OS_IOS: -1!==c.appVersion.indexOf("Mac")?y=a.OS_OSX:-1!==c.appVersion.indexOf("X11")&&-1===c.appVersion.indexOf("Linux")?y=a.OS_UNIX:k?y=a.OS_ANDROID:-1!==c.appVersion.indexOf("Linux")&&(y=a.OS_LINUX);a.os=y;a.osVersion=x;a.osMainVersion=B;a.browserType=a.BROWSER_TYPE_UNKNOWN;(function(){var b=/qqbrowser|chrome|safari|firefox|opr|oupeng|opera/i,c=/micromessenger|mqqbrowser|sogou|qzone|liebao|ucbrowser|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|trident|miuibrowser/i.exec(h);c||(c=b.exec(h)); b=c?c[0]:a.BROWSER_TYPE_UNKNOWN;"micromessenger"===b?b=a.BROWSER_TYPE_WECHAT:"safari"===b&&h.match(/android.*applewebkit/)?b=a.BROWSER_TYPE_ANDROID:"trident"===b?b=a.BROWSER_TYPE_IE:"360 aphone"===b?b=a.BROWSER_TYPE_360:"mxbrowser"===b?b=a.BROWSER_TYPE_MAXTHON:"opr"===b&&(b=a.BROWSER_TYPE_OPERA);a.browserType=b})();a.browserVersion="";(function(){var b=/(msie |rv:|firefox|chrome|ucbrowser|oupeng|opera|opr|safari|miui)(mobile)?(browser)?\/?([\d.]+)/i,c=h.match(/(micromessenger|qq|mx|maxthon|baidu|sogou)(mobile)?(browser)?\/?([\d.]+)/i); c||(c=h.match(b));a.browserVersion=c?c[4]:""})();k=window.devicePixelRatio||1;a.windowPixelResolution={width:k*(window.innerWidth||document.documentElement.clientWidth),height:k*(window.innerHeight||document.documentElement.clientHeight)};a._checkWebGLRenderMode=function(){if(cc._renderType!==cc.game.RENDER_TYPE_WEBGL)throw Error("This feature supports WebGL render mode only.");};a._supportCanvasNewBlendModes=function(){var a=f;a.width=1;a.height=1;a=a.getContext("2d");a.fillStyle="#000";a.fillRect(0, 0,1,1);a.globalCompositeOperation="multiply";var b=g;b.width=1;b.height=1;var c=b.getContext("2d");c.fillStyle="#fff";c.fillRect(0,0,1,1);a.drawImage(b,0,0,1,1);return 0===a.getImageData(0,0,1,1).data[0]}();cc.sys.isMobile&&(k=document.createElement("style"),k.type="text/css",document.body.appendChild(k),k.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);}");try{var z=a.localStorage= b.localStorage;z.setItem("storage","");z.removeItem("storage");z=null}catch(C){z=function(){cc.warn("Warning: localStorage isn't enabled. Please confirm browser cookie or privacy option")},a.localStorage={getItem:z,setItem:z,removeItem:z,clear:z}}z=!!f.getContext("2d");k=!1;if(b.WebGLRenderingContext){m=document.createElement("CANVAS");try{var A=cc.create3DContext(m);A&&A.getShaderPrecisionFormat&&(k=!0);k&&a.os===a.OS_IOS&&9===a.osMainVersion&&(window.indexedDB||(k=!1));if(k&&a.os===a.OS_ANDROID){var D= parseFloat(a.browserVersion);switch(a.browserType){case a.BROWSER_TYPE_MOBILE_QQ:case a.BROWSER_TYPE_BAIDU:case a.BROWSER_TYPE_BAIDU_APP:k=6.2<=D?!0:!1;break;case a.BROWSER_TYPE_CHROME:k=30<=D?!0:!1;break;case a.BROWSER_TYPE_ANDROID:a.osMainVersion&&5<=a.osMainVersion&&(k=!0);break;case a.BROWSER_TYPE_UNKNOWN:case a.BROWSER_TYPE_360:case a.BROWSER_TYPE_MIUI:case a.BROWSER_TYPE_UC:k=!1}}}catch(F){}m=null}A=a.capabilities={canvas:z,opengl:k};if(void 0!==e.ontouchstart||void 0!==d.ontouchstart||c.msPointerEnabled)A.touches= !0;void 0!==e.onmouseup&&(A.mouse=!0);void 0!==e.onkeyup&&(A.keyboard=!0);if(b.DeviceMotionEvent||b.DeviceOrientationEvent)A.accelerometer=!0;a.garbageCollect=function(){};a.dumpRoot=function(){};a.restartVM=function(){};a.cleanScript=function(a){};a.isObjectValid=function(a){return a?!0:!1};a.dump=function(){var a;a=""+("isMobile : "+this.isMobile+"\r\n");a+="language : "+this.language+"\r\n";a+="browserType : "+this.browserType+"\r\n";a+="browserVersion : "+this.browserVersion+"\r\n";a+="capabilities : "+ JSON.stringify(this.capabilities)+"\r\n";a+="os : "+this.os+"\r\n";a+="osVersion : "+this.osVersion+"\r\n";a+="platform : "+this.platform+"\r\n";a+="Using "+(cc._renderType===cc.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n";cc.log(a)};a.openURL=function(a){window.open(a)};a.now=function(){return Date.now?Date.now():+new Date}})();g=f=null;cc.log=cc.warn=cc.error=cc.assert=function(){};var h={},k=!1,m=null;cc._engineLoaded=!1;cc.initEngine=function(b,c){if(k){var f=m;m=function(){f&&f(); c&&c()}}else m=c,!cc.game.config&&b?cc.game.config=b:cc.game.config||cc.game._loadConfig(),b=cc.game.config,a(b),document.body?d(b):cc._addEventListener(window,"load",e,!1),k=!0}})(); cc.game={DEBUG_MODE_NONE:0,DEBUG_MODE_INFO:1,DEBUG_MODE_WARN:2,DEBUG_MODE_ERROR:3,DEBUG_MODE_INFO_FOR_WEB_PAGE:4,DEBUG_MODE_WARN_FOR_WEB_PAGE:5,DEBUG_MODE_ERROR_FOR_WEB_PAGE:6,EVENT_HIDE:"game_on_hide",EVENT_SHOW:"game_on_show",EVENT_RESIZE:"game_on_resize",EVENT_RENDERER_INITED:"renderer_inited",RENDER_TYPE_CANVAS:0,RENDER_TYPE_WEBGL:1,RENDER_TYPE_OPENGL:2,_eventHide:null,_eventShow:null,CONFIG_KEY:{width:"width",height:"height",engineDir:"engineDir",modules:"modules",debugMode:"debugMode",exposeClassName:"exposeClassName", showFPS:"showFPS",frameRate:"frameRate",id:"id",renderMode:"renderMode",jsList:"jsList"},_paused:!0,_configLoaded:!1,_prepareCalled:!1,_prepared:!1,_rendererInitialized:!1,_renderContext:null,_intervalId:null,_lastTime:null,_frameTime:null,frame:null,container:null,canvas:null,config:null,onStart:null,onStop:null,setFrameRate:function(a){this.config[this.CONFIG_KEY.frameRate]=a;this._intervalId&&window.cancelAnimationFrame(this._intervalId);this._paused=!0;this._setAnimFrame();this._runMainLoop()}, step:function(){cc.director.mainLoop()},pause:function(){this._paused||(this._paused=!0,cc.audioEngine&&cc.audioEngine._pausePlaying(),this._intervalId&&window.cancelAnimationFrame(this._intervalId),this._intervalId=0)},resume:function(){this._paused&&(this._paused=!1,cc.audioEngine&&cc.audioEngine._resumePlaying(),this._runMainLoop())},isPaused:function(){return this._paused},restart:function(){cc.director.popToSceneStackLevel(0);cc.audioEngine&&cc.audioEngine.end();cc.game.onStart()},end:function(){close()}, prepare:function(a){var b=this,c=b.config,d=b.CONFIG_KEY;this._configLoaded?this._prepared?a&&a():this._prepareCalled||(cc._engineLoaded?(this._prepareCalled=!0,this._initRenderer(c[d.width],c[d.height]),cc.view=cc.EGLView._getInstance(),cc.director=cc.Director._getInstance(),cc.director.setOpenGLView&&cc.director.setOpenGLView(cc.view),cc.winSize=cc.director.getWinSize(),this._initEvents(),this._setAnimFrame(),this._runMainLoop(),(c=c[d.jsList])?cc.loader.loadJsWithImg(c,function(c){if(c)throw Error(c); b._prepared=!0;a&&a()}):a&&a()):cc.initEngine(this.config,function(){b.prepare(a)})):this._loadConfig(function(){b.prepare(a)})},run:function(a,b){"function"===typeof a?cc.game.onStart=a:(a&&("string"===typeof a?(cc.game.config||this._loadConfig(),cc.game.config[cc.game.CONFIG_KEY.id]=a):cc.game.config=a),"function"===typeof b&&(cc.game.onStart=b));this.prepare(cc.game.onStart&&cc.game.onStart.bind(cc.game))},_setAnimFrame:function(){this._lastTime=new Date;this._frameTime=1E3/cc.game.config[cc.game.CONFIG_KEY.frameRate]; cc.sys.os===cc.sys.OS_IOS&&cc.sys.browserType===cc.sys.BROWSER_TYPE_WECHAT||60!==cc.game.config[cc.game.CONFIG_KEY.frameRate]?(window.requestAnimFrame=this._stTime,window.cancelAnimationFrame=this._ctTime):(window.requestAnimFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||this._stTime,window.cancelAnimationFrame=window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.msCancelRequestAnimationFrame|| window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.oCancelAnimationFrame||this._ctTime)},_stTime:function(a){var b=(new Date).getTime(),c=Math.max(0,cc.game._frameTime-(b-cc.game._lastTime)),d=window.setTimeout(function(){a()},c);cc.game._lastTime=b+c;return d},_ctTime:function(a){window.clearTimeout(a)},_runMainLoop:function(){var a= this,b,c=cc.director;c.setDisplayStats(a.config[a.CONFIG_KEY.showFPS]);b=function(){a._paused||(c.mainLoop(),a._intervalId&&window.cancelAnimationFrame(a._intervalId),a._intervalId=window.requestAnimFrame(b))};window.requestAnimFrame(b);a._paused=!1},_loadConfig:function(a){var b=this.config||document.ccConfig;if(b)this._initConfig(b),a&&a();else{for(var c=document.getElementsByTagName("script"),d=0;d<c.length&&(b=c[d].getAttribute("cocos"),""!==b&&!b);d++);var e=this,b=function(b,c){var d=JSON.parse(c); e._initConfig(d);a&&a()};if(d<c.length){if(c=c[d].src)c=/(.*)\//.exec(c)[0],cc.loader.resPath=c,c=cc.path.join(c,"project.json");cc.loader.loadTxt(c,b)}}},_initConfig:function(a){var b=this.CONFIG_KEY,c=a[b.modules];a[b.showFPS]="undefined"===typeof a[b.showFPS]?!0:a[b.showFPS];a[b.engineDir]=a[b.engineDir]||"frameworks/cocos2d-html5";null==a[b.debugMode]&&(a[b.debugMode]=0);a[b.exposeClassName]=!!a[b.exposeClassName];a[b.frameRate]=a[b.frameRate]||60;null==a[b.renderMode]&&(a[b.renderMode]=0);null== a[b.registerSystemEvent]&&(a[b.registerSystemEvent]=!0);c&&0>c.indexOf("core")&&c.splice(0,0,"core");c&&(a[b.modules]=c);this.config=a;this._configLoaded=!0},_initRenderer:function(a,b){if(!this._rendererInitialized){if(!cc._supportRender)throw Error("The renderer doesn't support the renderMode "+this.config[this.CONFIG_KEY.renderMode]);var c=this.config[cc.game.CONFIG_KEY.id],d=window,c=cc.$(c)||cc.$("#"+c),e,f;"CANVAS"===c.tagName?(a=a||c.width,b=b||c.height,this.canvas=cc._canvas=e=c,this.container= cc.container=f=document.createElement("DIV"),e.parentNode&&e.parentNode.insertBefore(f,e)):("DIV"!==c.tagName&&cc.log("Warning: target element is not a DIV or CANVAS"),a=a||c.clientWidth,b=b||c.clientHeight,this.canvas=cc._canvas=e=document.createElement("CANVAS"),this.container=cc.container=f=document.createElement("DIV"),c.appendChild(f));f.setAttribute("id","Cocos2dGameContainer");f.appendChild(e);this.frame=f.parentNode===document.body?document.documentElement:f.parentNode;e.addClass("gameCanvas"); e.setAttribute("width",a||480);e.setAttribute("height",b||320);e.setAttribute("tabindex",99);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(this._renderContext=cc._renderContext=cc.webglContext=cc.create3DContext(e,{stencil:!0,alpha:!1}));this._renderContext?(cc.renderer=cc.rendererWebGL,d.gl=this._renderContext,cc.renderer.init(),cc._drawingUtil=new cc.DrawingPrimitiveWebGL(this._renderContext),cc.textureCache._initializingRenderer(),cc.glExt={},cc.glExt.instanced_arrays=d.gl.getExtension("ANGLE_instanced_arrays"), cc.glExt.element_uint=d.gl.getExtension("OES_element_index_uint")):(cc._renderType=cc.game.RENDER_TYPE_CANVAS,cc.renderer=cc.rendererCanvas,this._renderContext=cc._renderContext=new cc.CanvasContextWrapper(e.getContext("2d")),cc._drawingUtil=cc.DrawingPrimitiveCanvas?new cc.DrawingPrimitiveCanvas(this._renderContext):null);cc._gameDiv=f;cc.game.canvas.oncontextmenu=function(){if(!cc._isContextMenuEnable)return!1};this.dispatchEvent(this.EVENT_RENDERER_INITED,!0);this._rendererInitialized=!0}},_initEvents:function(){var a= window,b,c;this._eventHide=this._eventHide||new cc.EventCustom(this.EVENT_HIDE);this._eventHide.setUserData(this);this._eventShow=this._eventShow||new cc.EventCustom(this.EVENT_SHOW);this._eventShow.setUserData(this);this.config[this.CONFIG_KEY.registerSystemEvent]&&cc.inputManager.registerSystemEvent(this.canvas);cc.isUndefined(document.hidden)?cc.isUndefined(document.mozHidden)?cc.isUndefined(document.msHidden)?cc.isUndefined(document.webkitHidden)||(b="webkitHidden",c="webkitvisibilitychange"): (b="msHidden",c="msvisibilitychange"):(b="mozHidden",c="mozvisibilitychange"):(b="hidden",c="visibilitychange");var d=function(){},e=function(){};b?document.addEventListener(c,function(){},!1):(a.addEventListener("blur",d,!1),a.addEventListener("focus",e,!1));-1<navigator.userAgent.indexOf("MicroMessenger")&&(a.onfocus=function(){});"onpageshow"in window&&"onpagehide"in window&&(a.addEventListener("pagehide",d,!1),a.addEventListener("pageshow",e,!1))}}; Function.prototype.bind=Function.prototype.bind||function(a){if(!cc.isFunction(this))throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};d.prototype=this.prototype;e.prototype=new d;return e};cc.EventHelper=function(){}; cc.EventHelper.prototype={constructor:cc.EventHelper,apply:function(a){a.addEventListener=cc.EventHelper.prototype.addEventListener;a.hasEventListener=cc.EventHelper.prototype.hasEventListener;a.removeEventListener=cc.EventHelper.prototype.removeEventListener;a.dispatchEvent=cc.EventHelper.prototype.dispatchEvent},addEventListener:function(a,b,c){if("load"===a&&this._textureLoaded)setTimeout(function(){b.call(c)},0);else{void 0===this._listeners&&(this._listeners={});var d=this._listeners;void 0=== d[a]&&(d[a]=[]);this.hasEventListener(a,b,c)||d[a].push({callback:b,eventTarget:c})}},hasEventListener:function(a,b,c){if(void 0===this._listeners)return!1;var d=this._listeners;if(void 0!==d[a]){a=0;for(var e=d.length;a<e;a++){var f=d[a];if(f.callback===b&&f.eventTarget===c)return!0}}return!1},removeEventListener:function(a,b,c){if(void 0!==this._listeners&&(a=this._listeners[a],void 0!==a))for(var d=0;d<a.length;){var e=a[d];e.eventTarget===c&&e.callback===b?a.splice(d,1):d++}},removeEventTarget:function(a, b,c){if(void 0!==this._listeners&&(a=this._listeners[a],void 0!==a))for(b=0;b<a.length;)a[b].eventTarget===c?a.splice(b,1):b++},dispatchEvent:function(a,b){if(void 0!==this._listeners){null==b&&(b=!0);var c=this._listeners[a];if(void 0!==c){for(var d=[],e=c.length,f=0;f<e;f++)d[f]=c[f];for(f=0;f<e;f++)d[f].callback.call(d[f].eventTarget,this);b&&(c.length=0)}}}};cc.EventHelper.prototype.apply(cc.game);cc._LogInfos={ActionManager_addAction:"cc.ActionManager.addAction(): action must be non-null",ActionManager_removeAction:"cocos2d: removeAction: Target not found",ActionManager_removeActionByTag:"cc.ActionManager.removeActionByTag(): an invalid tag",ActionManager_removeActionByTag_2:"cc.ActionManager.removeActionByTag(): target must be non-null",ActionManager_getActionByTag:"cc.ActionManager.getActionByTag(): an invalid tag",ActionManager_getActionByTag_2:"cocos2d : getActionByTag(tag \x3d %s): Action not found", configuration_dumpInfo:"cocos2d: **** WARNING **** CC_ENABLE_PROFILERS is defined. Disable it when you finish profiling (from ccConfig.js)",configuration_loadConfigFile:"Expected 'data' dict, but not found. Config file: %s",configuration_loadConfigFile_2:"Please load the resource first : %s",Director_resume:"cocos2d: Director: Error in gettimeofday",Director_setProjection:"cocos2d: Director: unrecognized projection",Director_popToSceneStackLevel:"cocos2d: Director: unrecognized projection",Director_popToSceneStackLevel_2:"cocos2d: Director: Error in gettimeofday", Director_popScene:"running scene should not null",Director_pushScene:"the scene should not null",arrayVerifyType:"element type is wrong!",Scheduler_scheduleCallbackForTarget:"CCSheduler#scheduleCallback. Callback already scheduled. Updating interval from:%s to %s",Scheduler_scheduleCallbackForTarget_2:"cc.scheduler.scheduleCallbackForTarget(): callback_fn should be non-null.",Scheduler_scheduleCallbackForTarget_3:"cc.scheduler.scheduleCallbackForTarget(): target should be non-null.",Scheduler_pauseTarget:"cc.Scheduler.pauseTarget():target should be non-null", Scheduler_resumeTarget:"cc.Scheduler.resumeTarget():target should be non-null",Scheduler_isTargetPaused:"cc.Scheduler.isTargetPaused():target should be non-null",Node_getZOrder:"getZOrder is deprecated. Please use getLocalZOrder instead.",Node_setZOrder:"setZOrder is deprecated. Please use setLocalZOrder instead.",Node_getRotation:"RotationX !\x3d RotationY. Don't know which one to return",Node_getScale:"ScaleX !\x3d ScaleY. Don't know which one to return",Node_addChild:"An Node can't be added as a child of itself.", Node_addChild_2:"child already added. It can't be added again",Node_addChild_3:"child must be non-null",Node_removeFromParentAndCleanup:"removeFromParentAndCleanup is deprecated. Use removeFromParent instead",Node_boundingBox:"boundingBox is deprecated. Use getBoundingBox instead",Node_removeChildByTag:"argument tag is an invalid tag",Node_removeChildByTag_2:"cocos2d: removeChildByTag(tag \x3d %s): child not found!",Node_removeAllChildrenWithCleanup:"removeAllChildrenWithCleanup is deprecated. Use removeAllChildren instead", Node_stopActionByTag:"cc.Node.stopActionBy(): argument tag an invalid tag",Node_getActionByTag:"cc.Node.getActionByTag(): argument tag is an invalid tag",Node_resumeSchedulerAndActions:"resumeSchedulerAndActions is deprecated, please use resume instead.",Node_pauseSchedulerAndActions:"pauseSchedulerAndActions is deprecated, please use pause instead.",Node__arrayMakeObjectsPerformSelector:"Unknown callback function",Node_reorderChild:"cc.Node.reorderChild(): child must be non-null",Node_reorderChild_2:"cc.Node.reorderChild(): this child is not in children list", Node_runAction:"cc.Node.runAction(): action must be non-null",Node_schedule:"callback function must be non-null",Node_schedule_2:"interval must be positive",Node_initWithTexture:"cocos2d: Could not initialize cc.AtlasNode. Invalid Texture.",AtlasNode_updateAtlasValues:"cc.AtlasNode.updateAtlasValues(): Shall be overridden in subclasses",AtlasNode_initWithTileFile:"",AtlasNode__initWithTexture:"cocos2d: Could not initialize cc.AtlasNode. Invalid Texture.",_EventListenerKeyboard_checkAvailable:"cc._EventListenerKeyboard.checkAvailable(): Invalid EventListenerKeyboard!", _EventListenerTouchOneByOne_checkAvailable:"cc._EventListenerTouchOneByOne.checkAvailable(): Invalid EventListenerTouchOneByOne!",_EventListenerTouchAllAtOnce_checkAvailable:"cc._EventListenerTouchAllAtOnce.checkAvailable(): Invalid EventListenerTouchAllAtOnce!",_EventListenerAcceleration_checkAvailable:"cc._EventListenerAcceleration.checkAvailable(): _onAccelerationEvent must be non-nil",EventListener_create:"Invalid parameter.",__getListenerID:"Don't call this method if the event is for touch.", eventManager__forceAddEventListener:"Invalid scene graph priority!",eventManager_addListener:"0 priority is forbidden for fixed priority since it's used for scene graph based priority.",eventManager_removeListeners:"Invalid listener type!",eventManager_setPriority:"Can't set fixed priority with scene graph based listener.",eventManager_addListener_2:"Invalid parameters.",eventManager_addListener_3:"listener must be a cc.EventListener object when adding a fixed priority listener",eventManager_addListener_4:"The listener has been registered, please don't register it again.", LayerMultiplex_initWithLayers:"parameters should not be ending with null in Javascript",LayerMultiplex_switchTo:"Invalid index in MultiplexLayer switchTo message",LayerMultiplex_switchToAndReleaseMe:"Invalid index in MultiplexLayer switchTo message",LayerMultiplex_addLayer:"cc.Layer.addLayer(): layer should be non-null",EGLView_setDesignResolutionSize:"Resolution not valid",EGLView_setDesignResolutionSize_2:"should set resolutionPolicy",inputManager_handleTouchesBegin:"The touches is more than MAX_TOUCHES, nUnusedIndex \x3d %s", swap:"cc.swap is being modified from original macro, please check usage",checkGLErrorDebug:"WebGL error %s",animationCache__addAnimationsWithDictionary:"cocos2d: cc.AnimationCache: No animations were found in provided dictionary.",animationCache__addAnimationsWithDictionary_2:"cc.AnimationCache. Invalid animation format",animationCache_addAnimations:"cc.AnimationCache.addAnimations(): File could not be found",animationCache__parseVersion1:"cocos2d: cc.AnimationCache: Animation '%s' found in dictionary without any frames - cannot add to animation cache.", animationCache__parseVersion1_2:"cocos2d: cc.AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the cc.SpriteFrameCache. This frame will not be added to the animation.",animationCache__parseVersion1_3:"cocos2d: cc.AnimationCache: None of the frames for animation '%s' were found in the cc.SpriteFrameCache. Animation is not being added to the Animation Cache.",animationCache__parseVersion1_4:"cocos2d: cc.AnimationCache: An animation in your dictionary refers to a frame which is not in the cc.SpriteFrameCache. Some or all of the frames for the animation '%s' may be missing.", animationCache__parseVersion2:"cocos2d: CCAnimationCache: Animation '%s' found in dictionary without any frames - cannot add to animation cache.",animationCache__parseVersion2_2:"cocos2d: cc.AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the cc.SpriteFrameCache. This frame will not be added to the animation.",animationCache_addAnimations_2:"cc.AnimationCache.addAnimations(): Invalid texture file name",Sprite_ignoreAnchorPointForPosition:"cc.Sprite.ignoreAnchorPointForPosition(): it is invalid in cc.Sprite when using SpriteBatchNode", Sprite_setDisplayFrameWithAnimationName:"cc.Sprite.setDisplayFrameWithAnimationName(): Frame not found",Sprite_setDisplayFrameWithAnimationName_2:"cc.Sprite.setDisplayFrameWithAnimationName(): Invalid frame index",Sprite_setDisplayFrame:"setDisplayFrame is deprecated, please use setSpriteFrame instead.",Sprite__updateBlendFunc:"cc.Sprite._updateBlendFunc(): _updateBlendFunc doesn't work when the sprite is rendered using a cc.CCSpriteBatchNode",Sprite_initWithSpriteFrame:"cc.Sprite.initWithSpriteFrame(): spriteFrame should be non-null", Sprite_initWithSpriteFrameName:"cc.Sprite.initWithSpriteFrameName(): spriteFrameName should be non-null",Sprite_initWithSpriteFrameName1:" is null, please check.",Sprite_initWithFile:"cc.Sprite.initWithFile(): filename should be non-null",Sprite_setDisplayFrameWithAnimationName_3:"cc.Sprite.setDisplayFrameWithAnimationName(): animationName must be non-null",Sprite_addChild:"cc.Sprite.addChild(): cc.Sprite only supports cc.Sprites as children when using cc.SpriteBatchNode",Sprite_addChild_2:"cc.Sprite.addChild(): cc.Sprite only supports a sprite using same texture as children when using cc.SpriteBatchNode", Sprite_addChild_3:"cc.Sprite.addChild(): child should be non-null",Sprite_setTexture:"cc.Sprite.texture setter: Batched sprites should use the same texture as the batchnode",Sprite_updateQuadFromSprite:"cc.SpriteBatchNode.updateQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children",Sprite_insertQuadFromSprite:"cc.SpriteBatchNode.insertQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children",Sprite_addChild_4:"cc.SpriteBatchNode.addChild(): cc.SpriteBatchNode only supports cc.Sprites as children", Sprite_addChild_5:"cc.SpriteBatchNode.addChild(): cc.Sprite is not using the same texture",Sprite_initWithTexture:"Sprite.initWithTexture(): Argument must be non-nil ",Sprite_setSpriteFrame:"Invalid spriteFrameName",Sprite_setTexture_2:"Invalid argument: cc.Sprite.texture setter expects a CCTexture2D.",Sprite_updateQuadFromSprite_2:"cc.SpriteBatchNode.updateQuadFromSprite(): sprite should be non-null",Sprite_insertQuadFromSprite_2:"cc.SpriteBatchNode.insertQuadFromSprite(): sprite should be non-null", SpriteBatchNode_addSpriteWithoutQuad:"cc.SpriteBatchNode.addQuadFromSprite(): SpriteBatchNode only supports cc.Sprites as children",SpriteBatchNode_increaseAtlasCapacity:"cocos2d: CCSpriteBatchNode: resizing TextureAtlas capacity from %s to %s.",SpriteBatchNode_increaseAtlasCapacity_2:"cocos2d: WARNING: Not enough memory to resize the atlas",SpriteBatchNode_reorderChild:"cc.SpriteBatchNode.addChild(): Child doesn't belong to Sprite",SpriteBatchNode_removeChild:"cc.SpriteBatchNode.addChild(): sprite batch node should contain the child", SpriteBatchNode_addSpriteWithoutQuad_2:"cc.SpriteBatchNode.addQuadFromSprite(): child should be non-null",SpriteBatchNode_reorderChild_2:"cc.SpriteBatchNode.addChild(): child should be non-null",spriteFrameCache__getFrameConfig:"cocos2d: WARNING: originalWidth/Height not found on the cc.SpriteFrame. AnchorPoint won't work as expected. Regenrate the .plist",spriteFrameCache_addSpriteFrames:"cocos2d: WARNING: an alias with name %s already exists",spriteFrameCache__checkConflict:"cocos2d: WARNING: Sprite frame: %s has already been added by another source, please fix name conflit", spriteFrameCache_getSpriteFrame:"cocos2d: cc.SpriteFrameCahce: Frame %s not found",spriteFrameCache__getFrameConfig_2:"Please load the resource first : %s",spriteFrameCache_addSpriteFrames_2:"cc.SpriteFrameCache.addSpriteFrames(): plist should be non-null",spriteFrameCache_addSpriteFrames_3:"Argument must be non-nil",CCSpriteBatchNode_updateQuadFromSprite:"cc.SpriteBatchNode.updateQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children",CCSpriteBatchNode_insertQuadFromSprite:"cc.SpriteBatchNode.insertQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children", CCSpriteBatchNode_addChild:"cc.SpriteBatchNode.addChild(): cc.SpriteBatchNode only supports cc.Sprites as children",CCSpriteBatchNode_initWithTexture:"Sprite.initWithTexture(): Argument must be non-nil ",CCSpriteBatchNode_addChild_2:"cc.Sprite.addChild(): child should be non-null",CCSpriteBatchNode_setSpriteFrame:"Invalid spriteFrameName",CCSpriteBatchNode_setTexture:"Invalid argument: cc.Sprite texture setter expects a CCTexture2D.",CCSpriteBatchNode_updateQuadFromSprite_2:"cc.SpriteBatchNode.updateQuadFromSprite(): sprite should be non-null", CCSpriteBatchNode_insertQuadFromSprite_2:"cc.SpriteBatchNode.insertQuadFromSprite(): sprite should be non-null",CCSpriteBatchNode_addChild_3:"cc.SpriteBatchNode.addChild(): child should be non-null",TextureAtlas_initWithFile:"cocos2d: Could not open file: %s",TextureAtlas_insertQuad:"cc.TextureAtlas.insertQuad(): invalid totalQuads",TextureAtlas_initWithTexture:"cc.TextureAtlas.initWithTexture():texture should be non-null",TextureAtlas_updateQuad:"cc.TextureAtlas.updateQuad(): quad should be non-null", TextureAtlas_updateQuad_2:"cc.TextureAtlas.updateQuad(): Invalid index",TextureAtlas_insertQuad_2:"cc.TextureAtlas.insertQuad(): Invalid index",TextureAtlas_insertQuads:"cc.TextureAtlas.insertQuad(): Invalid index + amount",TextureAtlas_insertQuadFromIndex:"cc.TextureAtlas.insertQuadFromIndex(): Invalid newIndex",TextureAtlas_insertQuadFromIndex_2:"cc.TextureAtlas.insertQuadFromIndex(): Invalid fromIndex",TextureAtlas_removeQuadAtIndex:"cc.TextureAtlas.removeQuadAtIndex(): Invalid index",TextureAtlas_removeQuadsAtIndex:"cc.TextureAtlas.removeQuadsAtIndex(): index + amount out of bounds", TextureAtlas_moveQuadsFromIndex:"cc.TextureAtlas.moveQuadsFromIndex(): move is out of bounds",TextureAtlas_moveQuadsFromIndex_2:"cc.TextureAtlas.moveQuadsFromIndex(): Invalid newIndex",TextureAtlas_moveQuadsFromIndex_3:"cc.TextureAtlas.moveQuadsFromIndex(): Invalid oldIndex",textureCache_addPVRTCImage:"TextureCache:addPVRTCImage does not support on HTML5",textureCache_addETCImage:"TextureCache:addPVRTCImage does not support on HTML5",textureCache_textureForKey:"textureForKey is deprecated. Please use getTextureForKey instead.", textureCache_addPVRImage:"addPVRImage does not support on HTML5",textureCache_addUIImage:"cocos2d: Couldn't add UIImage in TextureCache",textureCache_dumpCachedTextureInfo:"cocos2d: '%s' id\x3d%s %s x %s",textureCache_dumpCachedTextureInfo_2:"cocos2d: '%s' id\x3d HTMLCanvasElement %s x %s",textureCache_dumpCachedTextureInfo_3:"cocos2d: TextureCache dumpDebugInfo: %s textures, HTMLCanvasElement for %s KB (%s MB)",textureCache_addUIImage_2:"cc.Texture.addUIImage(): image should be non-null",Texture2D_initWithETCFile:"initWithETCFile does not support on HTML5", Texture2D_initWithPVRFile:"initWithPVRFile does not support on HTML5",Texture2D_initWithPVRTCData:"initWithPVRTCData does not support on HTML5",Texture2D_addImage:"cc.Texture.addImage(): path should be non-null",Texture2D_initWithImage:"cocos2d: cc.Texture2D. Can't create Texture. UIImage is nil",Texture2D_initWithImage_2:"cocos2d: WARNING: Image (%s x %s) is bigger than the supported %s x %s",Texture2D_initWithString:"initWithString isn't supported on cocos2d-html5",Texture2D_initWithETCFile_2:"initWithETCFile does not support on HTML5", Texture2D_initWithPVRFile_2:"initWithPVRFile does not support on HTML5",Texture2D_initWithPVRTCData_2:"initWithPVRTCData does not support on HTML5",Texture2D_bitsPerPixelForFormat:"bitsPerPixelForFormat: %s, cannot give useful result, it's a illegal pixel format",Texture2D__initPremultipliedATextureWithImage:"cocos2d: cc.Texture2D: Using RGB565 texture since image has no alpha",Texture2D_addImage_2:"cc.Texture.addImage(): path should be non-null",Texture2D_initWithData:"NSInternalInconsistencyException", MissingFile:"Missing file: %s",radiansToDegress:"cc.radiansToDegress() should be called cc.radiansToDegrees()",RectWidth:"Rect width exceeds maximum margin: %s",RectHeight:"Rect height exceeds maximum margin: %s",EventManager__updateListeners:"If program goes here, there should be event in dispatch.",EventManager__updateListeners_2:"_inDispatch should be 1 here."}; cc._logToWebPage=function(a){if(cc._canvas){var b=cc._logList,c=document;if(!b){var d=c.createElement("Div"),b=d.style;d.setAttribute("id","logInfoDiv");cc._canvas.parentNode.appendChild(d);d.setAttribute("width","200");d.setAttribute("height",cc._canvas.height);b.zIndex="99999";b.position="absolute";b.top="0";b.left="0";b=cc._logList=c.createElement("textarea");c=b.style;b.setAttribute("rows","20");b.setAttribute("cols","30");b.setAttribute("disabled",!0);d.appendChild(b);c.backgroundColor="transparent"; c.borderBottom="1px solid #cccccc";c.borderRightWidth="0px";c.borderLeftWidth="0px";c.borderTopWidth="0px";c.borderTopStyle="none";c.borderRightStyle="none";c.borderLeftStyle="none";c.padding="0px";c.margin=0}b.value=b.value+a+"\r\n";b.scrollTop=b.scrollHeight}};cc._formatString=function(a){if(cc.isObject(a))try{return JSON.stringify(a)}catch(b){return""}else return a}; cc._initDebugSetting=function(a){var b=cc.game;if(a!==b.DEBUG_MODE_NONE){var c;a>b.DEBUG_MODE_ERROR?(c=cc._logToWebPage.bind(cc),cc.error=function(){c("ERROR : "+cc.formatStr.apply(cc,arguments))},cc.assert=function(a,b){if(!a&&b){for(var f=2;f<arguments.length;f++)b=b.replace(/(%s)|(%d)/,cc._formatString(arguments[f]));c("Assert: "+b)}},a!==b.DEBUG_MODE_ERROR_FOR_WEB_PAGE&&(cc.warn=function(){c("WARN : "+cc.formatStr.apply(cc,arguments))}),a===b.DEBUG_MODE_INFO_FOR_WEB_PAGE&&(cc.log=function(){c(cc.formatStr.apply(cc, arguments))})):console&&console.log.apply&&(cc.error=Function.prototype.bind.call(console.error,console),cc.assert=console.assert?Function.prototype.bind.call(console.assert,console):function(a,b){if(!a&&b){for(var c=2;c<arguments.length;c++)b=b.replace(/(%s)|(%d)/,cc._formatString(arguments[c]));throw Error(b);}},a!==b.DEBUG_MODE_ERROR&&(cc.warn=Function.prototype.bind.call(console.warn,console)),a===b.DEBUG_MODE_INFO&&(cc.log=Function.prototype.bind.call(console.log,console)))}};cc.loader.loadBinary=function(a,b){var c=this,d=this.getXMLHttpRequest(),e="load "+a+" failed!";d.open("GET",a,!0);cc.loader.loadBinary._IEFilter?(d.setRequestHeader("Accept-Charset","x-user-defined"),d.onreadystatechange=function(){if(4===d.readyState&&200===d.status){var a=cc._convertResponseBodyToText(d.responseBody);b(null,c._str2Uint8Array(a))}else b(e)}):(d.overrideMimeType&&d.overrideMimeType("text/plain; charset\x3dx-user-defined"),d.onload=function(){4===d.readyState&&200===d.status?b(null, c._str2Uint8Array(d.responseText)):b(e)});d.send(null)};cc.loader.loadBinary._IEFilter=/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)&&window.IEBinaryToArray_ByteStr&&window.IEBinaryToArray_ByteStr_Last;cc.loader._str2Uint8Array=function(a){if(!a)return null;for(var b=new Uint8Array(a.length),c=0;c<a.length;c++)b[c]=a.charCodeAt(c)&255;return b}; cc.loader.loadBinarySync=function(a){var b=this.getXMLHttpRequest();b.timeout=0;var c="load "+a+" failed!";b.open("GET",a,!1);a=null;if(cc.loader.loadBinary._IEFilter){b.setRequestHeader("Accept-Charset","x-user-defined");b.send(null);if(200!==b.status)return cc.log(c),null;(b=cc._convertResponseBodyToText(b.responseBody))&&(a=this._str2Uint8Array(b))}else{b.overrideMimeType&&b.overrideMimeType("text/plain; charset\x3dx-user-defined");b.send(null);if(200!==b.status)return cc.log(c),null;a=this._str2Uint8Array(b.responseText)}return a}; window.Uint8Array=window.Uint8Array||window.Array; if(cc.loader.loadBinary._IEFilter){var IEBinaryToArray_ByteStr_Script='\x3c!-- IEBinaryToArray_ByteStr --\x3e\r\nFunction IEBinaryToArray_ByteStr(Binary)\r\n IEBinaryToArray_ByteStr \x3d CStr(Binary)\r\nEnd Function\r\nFunction IEBinaryToArray_ByteStr_Last(Binary)\r\n Dim lastIndex\r\n lastIndex \x3d LenB(Binary)\r\n if lastIndex mod 2 Then\r\n IEBinaryToArray_ByteStr_Last \x3d Chr( AscB( MidB( Binary, lastIndex, 1 ) ) )\r\n Else\r\n IEBinaryToArray_ByteStr_Last \x3d ""\r\n End If\r\nEnd Function\r\n',myVBScript= document.createElement("script");myVBScript.type="text/vbscript";myVBScript.textContent=IEBinaryToArray_ByteStr_Script;document.body.appendChild(myVBScript);cc._convertResponseBodyToText=function(a){for(var b={},c=0;256>c;c++)for(var d=0;256>d;d++)b[String.fromCharCode(c+256*d)]=String.fromCharCode(c)+String.fromCharCode(d);c=IEBinaryToArray_ByteStr(a);a=IEBinaryToArray_ByteStr_Last(a);return c.replace(/[\s\S]/g,function(a){return b[a]})+a}};cc=cc||{};cc._loadingImage="data:image/gif;base64,R0lGODlhEAAQALMNAD8/P7+/vyoqKlVVVX9/fxUVFUBAQGBgYMDAwC8vL5CQkP///wAAAP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFAAANACwAAAAAEAAQAAAEO5DJSau9OOvNex0IMnDIsiCkiW6g6BmKYlBFkhSUEgQKlQCARG6nEBwOgl+QApMdCIRD7YZ5RjlGpCUCACH5BAUAAA0ALAAAAgAOAA4AAAQ6kLGB0JA4M7QW0hrngRllkYyhKAYqKUGguAws0ypLS8JxCLQDgXAIDg+FRKIA6v0SAECCBpXSkstMBAAh+QQFAAANACwAAAAACgAQAAAEOJDJORAac6K1kDSKYmydpASBUl0mqmRfaGTCcQgwcxDEke+9XO2WkxQSiUIuAQAkls0n7JgsWq8RACH5BAUAAA0ALAAAAAAOAA4AAAQ6kMlplDIzTxWC0oxwHALnDQgySAdBHNWFLAvCukc215JIZihVIZEogDIJACBxnCSXTcmwGK1ar1hrBAAh+QQFAAANACwAAAAAEAAKAAAEN5DJKc4RM+tDyNFTkSQF5xmKYmQJACTVpQSBwrpJNteZSGYoFWjIGCAQA2IGsVgglBOmEyoxIiMAIfkEBQAADQAsAgAAAA4ADgAABDmQSVZSKjPPBEDSGucJxyGA1XUQxAFma/tOpDlnhqIYN6MEAUXvF+zldrMBAjHoIRYLhBMqvSmZkggAIfkEBQAADQAsBgAAAAoAEAAABDeQyUmrnSWlYhMASfeFVbZdjHAcgnUQxOHCcqWylKEohqUEAYVkgEAMfkEJYrFA6HhKJsJCNFoiACH5BAUAAA0ALAIAAgAOAA4AAAQ3kMlJq704611SKloCAEk4lln3DQgyUMJxCBKyLAh1EMRR3wiDQmHY9SQslyIQUMRmlmVTIyRaIgA7"; cc._fpsImage="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAAgCAYAAAD9qabkAAAKQ2lDQ1BJQ0MgcHJvZmlsZQAAeNqdU3dYk/cWPt/3ZQ9WQtjwsZdsgQAiI6wIyBBZohCSAGGEEBJAxYWIClYUFRGcSFXEgtUKSJ2I4qAouGdBiohai1VcOO4f3Ke1fXrv7e371/u855zn/M55zw+AERImkeaiagA5UoU8Otgfj09IxMm9gAIVSOAEIBDmy8JnBcUAAPADeXh+dLA//AGvbwACAHDVLiQSx+H/g7pQJlcAIJEA4CIS5wsBkFIAyC5UyBQAyBgAsFOzZAoAlAAAbHl8QiIAqg0A7PRJPgUA2KmT3BcA2KIcqQgAjQEAmShHJAJAuwBgVYFSLALAwgCgrEAiLgTArgGAWbYyRwKAvQUAdo5YkA9AYACAmUIszAAgOAIAQx4TzQMgTAOgMNK/4KlfcIW4SAEAwMuVzZdL0jMUuJXQGnfy8ODiIeLCbLFCYRcpEGYJ5CKcl5sjE0jnA0zODAAAGvnRwf44P5Dn5uTh5mbnbO/0xaL+a/BvIj4h8d/+vIwCBAAQTs/v2l/l5dYDcMcBsHW/a6lbANpWAGjf+V0z2wmgWgrQevmLeTj8QB6eoVDIPB0cCgsL7SViob0w44s+/zPhb+CLfvb8QB7+23rwAHGaQJmtwKOD/XFhbnauUo7nywRCMW735yP+x4V//Y4p0eI0sVwsFYrxWIm4UCJNx3m5UpFEIcmV4hLpfzLxH5b9CZN3DQCshk/ATrYHtctswH7uAQKLDljSdgBAfvMtjBoLkQAQZzQyefcAAJO/+Y9AKwEAzZek4wAAvOgYXKiUF0zGCAAARKCBKrBBBwzBFKzADpzBHbzAFwJhBkRADCTAPBBCBuSAHAqhGJZBGVTAOtgEtbADGqARmuEQtMExOA3n4BJcgetwFwZgGJ7CGLyGCQRByAgTYSE6iBFijtgizggXmY4EImFINJKApCDpiBRRIsXIcqQCqUJqkV1II/ItchQ5jVxA+pDbyCAyivyKvEcxlIGyUQPUAnVAuagfGorGoHPRdDQPXYCWomvRGrQePYC2oqfRS+h1dAB9io5jgNExDmaM2WFcjIdFYIlYGibHFmPlWDVWjzVjHVg3dhUbwJ5h7wgkAouAE+wIXoQQwmyCkJBHWExYQ6gl7CO0EroIVwmDhDHCJyKTqE+0JXoS+cR4YjqxkFhGrCbuIR4hniVeJw4TX5NIJA7JkuROCiElkDJJC0lrSNtILaRTpD7SEGmcTCbrkG3J3uQIsoCsIJeRt5APkE+S+8nD5LcUOsWI4kwJoiRSpJQSSjVlP+UEpZ8yQpmgqlHNqZ7UCKqIOp9aSW2gdlAvU4epEzR1miXNmxZDy6Qto9XQmmlnafdoL+l0ugndgx5Fl9CX0mvoB+nn6YP0dwwNhg2Dx0hiKBlrGXsZpxi3GS+ZTKYF05eZyFQw1zIbmWeYD5hvVVgq9ip8FZHKEpU6lVaVfpXnqlRVc1U/1XmqC1SrVQ+rXlZ9pkZVs1DjqQnUFqvVqR1Vu6k2rs5Sd1KPUM9RX6O+X/2C+mMNsoaFRqCGSKNUY7fGGY0hFsYyZfFYQtZyVgPrLGuYTWJbsvnsTHYF+xt2L3tMU0NzqmasZpFmneZxzQEOxrHg8DnZnErOIc4NznstAy0/LbHWaq1mrX6tN9p62r7aYu1y7Rbt69rvdXCdQJ0snfU6bTr3dQm6NrpRuoW623XP6j7TY+t56Qn1yvUO6d3RR/Vt9KP1F+rv1u/RHzcwNAg2kBlsMThj8MyQY+hrmGm40fCE4agRy2i6kcRoo9FJoye4Ju6HZ+M1eBc+ZqxvHGKsNN5l3Gs8YWJpMtukxKTF5L4pzZRrmma60bTTdMzMyCzcrNisyeyOOdWca55hvtm82/yNhaVFnMVKizaLx5balnzLBZZNlvesmFY+VnlW9VbXrEnWXOss623WV2xQG1ebDJs6m8u2qK2brcR2m23fFOIUjynSKfVTbtox7PzsCuya7AbtOfZh9iX2bfbPHcwcEh3WO3Q7fHJ0dcx2bHC866ThNMOpxKnD6VdnG2ehc53zNRemS5DLEpd2lxdTbaeKp26fesuV5RruutK10/Wjm7ub3K3ZbdTdzD3Ffav7TS6bG8ldwz3vQfTw91jicczjnaebp8LzkOcvXnZeWV77vR5Ps5wmntYwbcjbxFvgvct7YDo+PWX6zukDPsY+Ap96n4e+pr4i3z2+I37Wfpl+B/ye+zv6y/2P+L/hefIW8U4FYAHBAeUBvYEagbMDawMfBJkEpQc1BY0FuwYvDD4VQgwJDVkfcpNvwBfyG/ljM9xnLJrRFcoInRVaG/owzCZMHtYRjobPCN8Qfm+m+UzpzLYIiOBHbIi4H2kZmRf5fRQpKjKqLupRtFN0cXT3LNas5Fn7Z72O8Y+pjLk722q2cnZnrGpsUmxj7Ju4gLiquIF4h/hF8ZcSdBMkCe2J5MTYxD2J43MC52yaM5zkmlSWdGOu5dyiuRfm6c7Lnnc8WTVZkHw4hZgSl7I/5YMgQlAvGE/lp25NHRPyhJuFT0W+oo2iUbG3uEo8kuadVpX2ON07fUP6aIZPRnXGMwlPUit5kRmSuSPzTVZE1t6sz9lx2S05lJyUnKNSDWmWtCvXMLcot09mKyuTDeR55m3KG5OHyvfkI/lz89sVbIVM0aO0Uq5QDhZML6greFsYW3i4SL1IWtQz32b+6vkjC4IWfL2QsFC4sLPYuHhZ8eAiv0W7FiOLUxd3LjFdUrpkeGnw0n3LaMuylv1Q4lhSVfJqedzyjlKD0qWlQyuCVzSVqZTJy26u9Fq5YxVhlWRV72qX1VtWfyoXlV+scKyorviwRrjm4ldOX9V89Xlt2treSrfK7etI66Trbqz3Wb+vSr1qQdXQhvANrRvxjeUbX21K3nShemr1js20zcrNAzVhNe1bzLas2/KhNqP2ep1/XctW/a2rt77ZJtrWv913e/MOgx0VO97vlOy8tSt4V2u9RX31btLugt2PGmIbur/mft24R3dPxZ6Pe6V7B/ZF7+tqdG9s3K+/v7IJbVI2jR5IOnDlm4Bv2pvtmne1cFoqDsJB5cEn36Z8e+NQ6KHOw9zDzd+Zf7f1COtIeSvSOr91rC2jbaA9ob3v6IyjnR1eHUe+t/9+7zHjY3XHNY9XnqCdKD3x+eSCk+OnZKeenU4/PdSZ3Hn3TPyZa11RXb1nQ8+ePxd07ky3X/fJ897nj13wvHD0Ivdi2yW3S609rj1HfnD94UivW2/rZffL7Vc8rnT0Tes70e/Tf/pqwNVz1/jXLl2feb3vxuwbt24m3Ry4Jbr1+Hb27Rd3Cu5M3F16j3iv/L7a/eoH+g/qf7T+sWXAbeD4YMBgz8NZD+8OCYee/pT/04fh0kfMR9UjRiONj50fHxsNGr3yZM6T4aeypxPPyn5W/3nrc6vn3/3i+0vPWPzY8Av5i8+/rnmp83Lvq6mvOscjxx+8znk98ab8rc7bfe+477rfx70fmSj8QP5Q89H6Y8en0E/3Pud8/vwv94Tz+4A5JREAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfcAgcQLxxUBNp/AAAQZ0lEQVR42u2be3QVVZbGv1N17829eRLyIKAEOiISEtPhJTJAYuyBDmhWjAEx4iAGBhxA4wABbVAMWUAeykMCM+HRTcBRWkNH2l5moS0LCCrQTkYeQWBQSCAIgYRXEpKbW/XNH5zS4noR7faPEeu31l0h4dSpvc+t/Z199jkFWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhY/H9D/MR9qfKnLj/00U71aqfJn9+HCkCR/Wk36ddsgyJ/1wF4fkDfqqm9/gPsUeTnVr6a2xlQfnxdI7zs0W7irzD17Ytb2WT7EeNv/r4ox1O3Quf2QP2pgt9utwfout4FQE8AVBSlnaRmfvAURQkg2RlAbwB9AThlW5L0GaiKojhJhgOIBqDa7XaPrusdPtr5kQwF0BVAAoBIABRCKDd5aFUhRDAAw57eAOwAhKIoupft3zoqhB1AqLwuHIBut9uFt02qqvqRDJR2dAEQJj/BAOjn56dqmma+xiaECAEQAWAggLsB6A6HQ2iaZggBhBAqgEAAnQB0kzaEmT4hAITT6VQ8Ho/HJAKKECJQtr8LwD1y/A1/vcdfEUIEyfZ9AcQbYvZ942Px88L2UwlJR0dH0EMPPbRj5syZPUeNGrXR7Xb/641xIwJ1XY9NSUlZm52dfW+XLl1w8uRJzJ8//+OGhoYJqqqe1TSt1Wsm9NN1PSIqKmr12rVrR5WUlHy1bdu2AQCumWc3IYRD1/UwVVXnFRQUTIuNjUVzczN2797dWFJSkq8oymZd15sAGAEnFEUJ1nX9nzIzM1dnZmZGh4SE4OTJk5g5c+Zf29vbp9pstrMej6fVOyhIhgAYU1hY+B+hoaGoqKg4XVlZea+XTULTNFdCQsLGiRMnPuR2u3UhBOV9eeDAAWXTpk095DUe6WsoyRE5OTlr0tLSAux2O/bs2cO5c+e+pijKUpIXSHaQVAGkvPLKK++6XK4OksJLCFlXV2cvKSlJBFAjhU+x2WwhHo9nUHp6+urMzMy7wsLCUF9fjxdffPHjxsbGiTab7WuPx9NiEutOuq4PyMjI+M+srKyYqKgoHD58GDNmzNjq8XhyVFU9b/q+LH7hBAEYu3PnTlZVVRFAGgCX6f/tAHoOHDjwa0p27txp/JO9e/f+QM7cipw9nfL3kQBKt2zZQpJ87rnn6mQmoHilw2EACs+cOUOSrK+vZ1NTE0nyo48+IoBpxswoBcMJ4Ndjx471kOTFixe5d+9ekqTH42H//v13A4jyzpAURfEH0H/OnDnthu1z5sw558MmFUCPWbNmnaMP3nrrLZoyDmP8Hl68eDFJ8siRI9/Yc+zYMQKYKdtAztrTrl27xptRXV1NAKMAOAyBBBA/Y8aMdpLs6Ojgxx9//E37+++//29yvFXppwvAwMcee8xjtDHsuXLlCqOjo//ia3wsfpkoALqFhoZuIckJEyackimm3dQmEMDUmpoakmRISMhhAHOHDx/eQJIbN24kgKEyMAHAFRMTs2XXrl1saWkhSZ0kp0+ffhrAr3wEW/S8efOukORLL72kA1gKYMPWrVtJkk899dRJAHeYrgsEsIQkjx8/TgDvAPjd448/3kaSb7zxBmUa7vC6z53BwcFbSHL9+vU6Sc6aNes8gF5ewWAH0PfVV18lSQL4DMBGIcQ6AKtcLleBFC2jXtFt8ODBe0iyoqKCAJYByC8qKmJDQwOzsrK+MAmqo1OnTveHhoa+GRkZ+XZkZOSWiIiIvzgcjk9mzpypkWRmZuZpmbYbGV4AgPnNzc1sa2sjgN0A5iQmJtaSZHl5OQHcb/K3s81mW0uSTU1NBFAFYFbfvn1Pk+Tbb79NAA8IIVzW42/hByA+Pz/fLR/2ZXIda05NI/z9/TeR5J49ewhgqlxTrtI0jY2NjQQw3zTLuWJiYjaUlJToS5Ys6fjkk080kwDEeAmADcA9GzZsIElGRUW9CyAWwLApU6Y0kOSKFSsog9QICGdERMTGsrIyZmVlEcC9AB4IDw/fTpLbtm0jgN94CUAnAJmVlZVcs2aNZ/LkyRdJcvbs2b4EwAkgZfPmzTxw4AABFAN4BkC6vFeUSewcAO5duXIlSTIhIaEawGMAxgKYAmAGgCS73e5vrKVk/yGythANYEhCQsIhkly+fDkBpKqqGmL6DgIALDKN/3yZpVWQZGVlJQE8aPI3KiMjo5okV61aRQAjAPQBMPfIkSN0u90EUCBtsPiFEwpgbn19PdetW2fM5N4zQ9ekpKQqkty0aRMBpMjiWM6JEydIkoqirJUFJ6iq6pAPVy8A6cZMehMBUACEuVyuFwG8HBwcPEIWx367ZMkSjSQXLVrUJouTRorrkAHdA8BdQogsAOsKCwtJkmPGjDkvMw2bDDo/ADEjRoz4XylyFbm5uY0mAbjLyyZ/AOOrq6tZVlbWsWDBgo69e/eyoqKCgwcPPg4gSQaoIRbp27dvN7KF+tLSUr28vJwFBQXtMpvpYRIM7+wrAkDeqVOnePbsWQIoNKfzpiXPg8uXLydJJicnNwF4f+nSpW6STEtLq5fjYwhk1wkTJtSQ5Ouvv04AqTKj+N2xY8dIkgEBAW/Ie1v8wncRegwZMmQvSfbr12+3Ua33WqPfOWbMmP0kWVpaSgCDZAqcfejQIWNZsEGKgvnh9gfQb9myZd8nAEJVVZtMkUNk8CcNHTq0liR1XWdYWNhmH1mJIme80OnTp18x1rp5eXkEsNJms92Fb7e/IgEsvHz5Mp999tkmAI/l5uZeMC0B7vEqqAYAyL106RJJsra2lpWVld+sucePH38ZQG+5NncBeOrgwYMkqbe3t/Po0aOsra011wAWyl0H7x0JJ4DE+fPnu0kyPT29DsDdUrBuyNKEEAkAdpw/f/6GeoEM8GUmfwEgPCIiopwkGxsbabPZPgOw6L777vvm4p49e26VGYjFLxUhhD+ApLKyMp44ccIoVnXybgbgzkcfffRzklyzZg0BDJYCMMmoCwQFBXkLgLGWvvcWAgBToSsKwNPTp09vMR7UuLi4rwH0lgU8c/Db5ezbeeTIkRWzZ8++aMxu+fn5BPCADBwHgP4LFy701NXVEUAJgAnPP/98kyxMNgHo53A4zH77BQQETMvPz7+Um5vbBuAlAFMSExPPmdbVL0qh8Acw8fDhw5SCchVAEYAVb775JknyhRdeaJYztHfxMwLAaqNwCGC2FArv8x0hAHKNLGPKlCme5OTk/Zs3bzb7O0wKiiG8KXl5ed8IxenTp0mSR48e1UmyW7duWywBuD2xyQcgFECgoih+8H1gyJgZV5Lkyy+/3CbTRIePtl2HDBmyw1QBHyGDdXZdXR1JUghRKkXBjOMHCoBdpr0L3nvvPZLkF198wejo6O0A4lVVDTb74HQ6AwD8Wq7Jh8rgGgDgQ13XjVR8qaxJuADMbmlpYXl5uV5UVNRWUFDgfv/993Vj/ZydnU1c37eHXML4S3viAcQqitJD2l104cIFY8lTKsXSBWBMVVWVcd9yed2A1NTUQ6Zl00CvLMMOoHdubm6zFIlWOf5+PsY/Kj09vdrU11QAwwGsv3jxIk21m2DZr10I0RXAuAcffPBgaWkpV69eTYfDcdiwUxY0w6xw+flX8L1xApjevXv3lREREaW6rofB93aPDUDQpEmTMgHgtddeqwBwEd/utZvpqK6uPgEAcXFxkA94NwB9unfvjrNnz4LklwDcf08iIqv66Zs2bXrl4YcfxooVKxAbG7uqrq5uAYA2TdOEqqpGYIi2tjbl6aeffu/YsWPv5uTk7JaC1wHg4Pnz542MwoVvTx+21dbWYvjw4WLixIl+2dnZ9lGjRgmSTE1NRUpKCkwFTGiaxtTU1OXTpk3707Bhw/6g67pDipnT4biuj7qut+Lbk3Vf1tTUXI9qu91Pjq1QFEUBgJaWFgBo8yGOQ8eNGxcAAOvXr/8QwBUfYygAKL169eoCABcuXACAWtn2hOGv0+kMNO1KiPDw8F4A4rZv3/7R1KlTR0+bNu1ht9u9r1+/fqitrQXJgwDarRC6/QjPzs4+QJIffPCB9/aQmSAA43ft2mW0e1QGoi8CAPyLsZccExNTC2BlRkbGRdOyYJCP2csBIN6UAZzCd7cBbQCijYp/dXU1ExMTz6SmptaMHj36f9LS0vYlJCRsl6mxIWSdu3fv/g5J7t+/nwC2AShMTk6+SJKff/45AWRLYbD7+fndAeDf5BJnLoCCyZMnt5JkdnZ2C4B/F0KEm1Pu+Pj4rST55ZdfEsBWAK+mpaVdMo3raDn7KwDuSEpK+m+S3LBhAwG8DuCtHTt2UBbpjgC408vvcFVV15HkuXPnjMp+p5uMf0RcXNyHJNnQ0EBVVfcCWBQXF3fG+Jv0yxABPwB5LS0tRmFxN4BlTzzxxGWSXLx4sS5F3GGFy+1Hp5SUlJq6ujoWFxdTpsZ2H+0iIyMj/0iSWVlZX5mr5jfJFroPGzasxlhTnjp1iiTZ3NxMl8tlrCd9pfa9SkpKSJI5OTmnZOageLUZZqxvfVFWVkZcPwdgNwnSCKPqb17jkmR8fPzfZMDZ5CRsFBmNI7h95s2b1yhT7/MAYmStwCx4vy0uLqa3v5qmEcCfvSr1QQAeXb16NY3Cm3HQ55133iGAp+SxZTNhKSkpfzUddkrFjYevzAQCeGjp0qXfsYckY2NjTwD4leGDLCL2HTdunNtoY+zWSHFcIHdsFCtcfuZ1vO9Eqs3m7/F47sb1k2qX/f3997W2tl7BjWfpBYDOzzzzzIVJkyZh0KBBCwEsB3AJvl9AETabLcDj8dwRFRW1ctasWb8JCgpSzp07d62wsPC/Wltb8xRFadR1/ZqPXYbgAQMGbI2Pjw/+6quv9ldVVT0r01ezuPRJSUn5Y9euXXVd11WzDaqq6kePHm3+7LPPRgO4KlNuxWazhXo8nuTk5OSXMjIyEl0uFxoaGtqKior+dPXq1VdUVT0jj7r68ieoT58+vx8yZMjdx48fP1JVVTVF9m20VW02WyfZf97YsWPjXS4X6urqWvPy8jYCWCyEuEDS8FdVFKWzruv//OSTTy5OTk7uqWkaPv3007qysrJ8RVH+LI8ym8/rB3Tu3HnRI488knLo0KG2ffv2ZQI4C98vP6mqqoZqmpaclpa2cOTIkX39/f3R0NDQUVxc/G5TU9PLqqrWa5rWLH1QVFUN0TStX1JSUvH48eP7BwYG4uDBg1cKCgpeBbBe2u+2Qug2EwD5N5sMPuNtMe8XP4TT6Qxoa2sbIGeXvUKIK7d4IISiKC5d1wPljOfA9bPwzYqiXNV13dd6Uqiq6qdpml2mpe02m63d4/G4vcTF5fF47LJf71nJA6BZVVW3pmntuPHlmAD5wk6Q9NnbHp9vHaqq6tA0zU/64PZhk1FfCZB9G/23ALiqKEqzD39tpvbGUqoFwFUhRLP3yzpCCDtJpxyXDulfG27+pqRR3DXsUWVd4Yq0x/taVQjhIhksC8L+ABpM9ljBf5sKwI8pIBr75L5E4vvu+UNeG/a+hv+AL7yFH8qPtOfHjtOP6V/Bja8D6z/B2Nys/1u9Xv33tLf4GfF/LC4GCJwByWIAAAAASUVORK5CYII\x3d"; cc._loaderImage="data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAAlAAD/4QMpaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjAtYzA2MCA2MS4xMzQ3NzcsIDIwMTAvMDIvMTItMTc6MzI6MDAgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjM4MDBEMDY2QTU1MjExRTFBQTAzQjEzMUNFNzMxRkQwIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjM4MDBEMDY1QTU1MjExRTFBQTAzQjEzMUNFNzMxRkQwIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCBDUzUgV2luZG93cyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkU2RTk0OEM4OERCNDExRTE5NEUyRkE3M0M3QkE1NTlEIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkU2RTk0OEM5OERCNDExRTE5NEUyRkE3M0M3QkE1NTlEIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+/+4ADkFkb2JlAGTAAAAAAf/bAIQADQkJCQoJDQoKDRMMCwwTFhENDREWGhUVFhUVGhkUFhUVFhQZGR0fIB8dGScnKionJzk4ODg5QEBAQEBAQEBAQAEODAwOEA4RDw8RFA4RDhQVERISERUfFRUXFRUfKB0ZGRkZHSgjJiAgICYjLCwoKCwsNzc1NzdAQEBAQEBAQEBA/8AAEQgAyACgAwEiAAIRAQMRAf/EALAAAAEFAQEAAAAAAAAAAAAAAAQAAgMFBgcBAQEAAwEBAAAAAAAAAAAAAAAAAQMEAgUQAAIBAgIEBwoLBgQGAwAAAAECAwAEEQUhMRIGQVFxsTITFGGBwdEiQlKSMzWRoeFicqKyI1NzFYJjJDQWB9KjVCbxwkNkJWXik3QRAAIBAgMFBQcDBQEAAAAAAAABAhEDIRIEMUFRcTJhwVIUBZGhsSJyEzOB0ULhYpIjUxX/2gAMAwEAAhEDEQA/AMJSpUqAVKlXuFAeUq9wpUB5XuFe4V6ooDzZHDox0CnGMinzwl7Z8NajaHeoO3vmTBZBtp9YUIqTEV5ROxHKnWRnaU8VRMhFBUjpV7hSoSeUq9pUB5Sr2lhQHlKvcK8oBV7hSFSRrtaKAZs07YNPM1pG2xJIAw1jSeandry/8X4m8VCKkWwaWwam7Xl/4v1W8VLtmX/i/VbxUoKkWwakSM407tmX/i/VbxUmzGwjQsjdY41IARie/U0IbZO0kNtCXnOCkEBeFu4KI3Bs7DNb27ya+jDx3kJeEnpJJEcQVbWDsk17u5urd591ucZkWhym2Vnd9RkCDEpFxDRpbw0bunu5mlp2De2FMLYXOD2wB2xbOeraUcYGJ72mlSUiqzzdzMd3Z3mixltA2yzcK/NlHM1DQyRXce1HocdNOEfJXZ88y9ZojOqhiBszIRiHQ8Y4cK5TvHuzLljHNMqxNoDjLFraHHnjPxcNCGVbxEUzYNTx5jZSxhpW6qTzlwJ+DCvO2Zf+L9VvFSgqyHYNLYNTdssPxfibxUu15f8Ai/VPiqCakOwa82DU/a8v/F+JvFTDdWPBL8R8VKCvYRYV5UzoMAy6QdIIqI0B4KJtxiRQwou16QoGUkntH5Tz0RbZbmF2hktraSVBo2lUkY8tDye0flPPXTslVUyiyVRsjqUOA4yMT8dW2ram2m6UVTNq9S7EIyUVJydMTn/6DnP+im9Wl+g5z/opvVrpteEhQWY4AaSTwAVf5WPiZh/9S5/zj7zltzlmYWkfWXNvJDGTgGcYDHirR7i7mSbwXParsFMrgb7w6jKw/wCmnc9I14kF3vpvCljbMyWMOJL4aEiB8qU/ObUK7HYWVrl1pFZWiCOCBQqKOLjPGTrNZZqKbUXVHq2nNwTuJRk1VpbgXN8s7Rk5ym0UQQzhIG2NAjhxHWbI+gCBVjBBFbwxwQqEiiUJGg1BVGAFe7dV28WYLYZFmF2Th1UD7JGjymGyn1iK5OyzIBGB1HgrLZhamzumQAGJwSqnSCh1q3GOCodxt4cxurdcpzuN4cyhiWaF5Bg09udUmnWw1H/jV9nFuJ7Quo+8h8peThFA+047vduyMtk7fYqTl07YFdfUufMPzT5p71UdtlmYXaGS2t3mQHAsgxANdadYJopLe4QS2867EsZ4QfCNYrCFbjdDPmgkYyWFxgVf04ifJf6ScNdRUW1XBb6FU5TjF5EpSSrGu/s5lN+g5z/opvVpfoOc/wCim9WtdHnatvObJXDW7xLGhB8nrPaY9/HCr+tEdPCVaSeDoYLnqF63lzW4/PFSW3ecxbI84VSzWUwUaSdg0DXXK5nvAipnd6qgKvWnQO7pri9ZUEmm3Vl2j1kr8pRlFRyquBNZjGxQ/S56Y1S2fu9OVueon11Szahoou06QoQUXadIVCD2FJJ7R+U89dMydv8Axdn+TH9muZye0flPPXQstlK5Tbka1gUjlC1q0vVLkeb6r+O3Tx9xcY1nt8c0NrZCyiOE1108NYjGv1joo7Js1jzKyScYLIvkzL6LDwHXVJksH9Sb49dKNq0tj1jA6uriOCL+02FWX7iVtZX1/AzaHTyeoauKn2MX9W79zebiZCuR5MjSrhfXuEtwTrUeZH+yNfdrRNcxI6IzhXlJEak6WIGJ2Rw4ChWnChndtlVBLMdQA0k1gbXNMzzDfDLs6mjaPKppJbWwJ1bOwwxw43OnHh71YT3DpfWUJmFlb5jHHDdeXBHIsrRea5TSqvxqG04cNN62vetoCS4tre5mgnkGE9q+3DKOkuI2WX6LDQRRHWDh1UCtwj7QRg2wdl8Djgw1qe7XvW0BQ3kfZ7mSLgU+T9E6RVbnuVrnWVSWqj+Lt8ZbRuHEdKPkYVcZ2MJY5fSGyeVar45+rkWQHAqccalPE5km1htWK5nK4Wnt5FuUBUwOMG4nGkA/BXUrW4S6torlOjMgcd/xVn7rLo7zKs0uEjCNeSvdwoBhgsZxX1l2j36k3Lu+uyprdj5Vs5A+i/lD48a0aaVJOPi7jB6lbzWozpjB48pf1NDXNN4vfl7+Z4BXS65pvF78vfzPAK71XTHmZ/S/yT+jvJ7L3fHytz1E+upbL+Qj5W56jfXWRnsIYKLtekKEFGWvSFQgyjk9o/Keet3YthlMP/5x9msJJ7R+U89biyb/AMXEv7gD6tadL1T+kwepRrC39ZkLDMbiwMvUHRPG0bjlGg8ore/23sxBldxfMPLupNhT8yL/AORNZbdzJ484scytxgLqJY5LZj6Q2sV5G1Vud1mjjyG0ij0NEGSZToKyhjtqw4waztuiXA3qKTbSxltfGhbZlE95ZtZqxVbgiOZhrER9ph3Svk9+pJILZ4Y4DGBFCUMKjRsGPobPFhUfW0NJmljE2xJcIrcI2vFUEln1lRXd6lrazXT9GCNpD+yNqoI7mOVduNw6nzlOIoPOUa6yye1XXcbMR5GdQ3xY0BSbj31/FcTQZirJ+q431q7anbHCTZ72Bw7lbPrKBMcBWNNgbMBBh+bsjBdni0VJ1lARZs6yWiupxCuMDy6KpS2IwOo6DTr3Mre3e5tZZVUM4ZBjqOOJoWO4jkXajcOOMHGgDISvWIrdAkKR80+TzVl908bPPL3LzxOuHdifxVfiTAg92qI/w+/8gGgSyN/mR7XPVlp0lF/3L3mbVKtu5Hjbk/8AHE2Fc03i9+Xv5ngFdKNc13i9+Xv5ngFaNV0x5nn+l/kn9HeEWXu+PlbnqJ9dS2Xu9OVueon11kZ7CGCjLXpCgxRlr0hUIPYUcntH5Tz1s8vb+Bt1/dqPirGSe0flPPWusG/g4Py15q06XqlyMWvVYQ+ruI9xJOqzO9hOto/sP8tbGOFIrmWeM7IuMDMnAXXQJOUjQeOsJk0nY96ip0CYunrjaHx1t+srPJUbXBm2LrFPikwTOb+T+VhbZxGMrDXp83x1QSy2tucJpUjPETp+Cn5/ftaRvKvtp3Kx48HG3erHMzOxZiWZtLMdJNQSbbL71Vk6yynViOkqnEEfOWtPbXi3EQkGg6mXiNckjeSJxJGxR10qw0GtxuxmvbImD4CZMFlA4fRfv0BqesqqzTMZNMEDbIHtHH2QeCiZJSqMQdOGiue53mz3czQwsRbIcNHnkec3c4qAMuriz68gTIToxwOOnlp0MjxMJYW741Gs3RVldtbygE/dMcHX/moDaxTiWNZB53B3arb8/wC+4SOF4sf/AKxU9kcBsfOGHfoUHtG/RbzY5Die5HHhXdvavqiZ9Q8Jdlq4/gbKua7xe/L38zwCuhpf2Uk/Zo50kmwJKIdogDjw1VzzeL35e/meAVp1LTgqY4nn+mRauzqmqwrjzCLL3fHytz1E+upLL+Qj5W56jfXWRnroYKLtekKEFF2vSFQg9hSSe0flPPWosm/hIfoLzVl5PaPynnrRWb/w0X0F5q06XqlyM2sVYx5gmbFre/t71NY2T+0h8VbSO5SWNJUOKSAMp7jDGspmMPaLRlXS6eWve1/FRO7WYdbZm1Y/eW/R7qHxHRXGojlm3ulid6aVbaW+OALvgCLq2Hm9WxHKWqjhj6xsK1e8dm15l4niG1LZkswGsxtrPeOmsvayBJA1VItlWjptLuTdPMo7LtjRDq9naK4+WF9IrUW7BaHOljGqVHB7w2hzVoZt87d8vaNYSLl02CcRsDEbJbj71Uu7UBkvJ7/D7q2QoDxySaAO8MTXdxRVMpRp5XZOWdF/ms7R5XdyKfKWJsO/5PhrG5XlNxmEywW6bTnTxAAcJNbGSMXkM1pjgbiNo1PziPJ+Os7u7m/6ReM00ZOgxSpqYYHT3wRXMKN4ll9zUG4bQfNshu8sZVuEA2hirA4qe/VOwwrVbzbww5mI44UKRRYkbWG0S3JWctbd7u5WFfOOLHiUdJqmaipfLsIsObhWe001lMkMVvJNjhghIALMcBxCs7fxXQmkupx1bXDswGPlaTidVaEyKNXkoo4eBV+Sq7L7Vs9zcBgeyQ4GQ/MB1crmoim2orezqcowTuSeEY48jQ7oZX2PLzdyLhNd6RjrEY6I7+uspvH78vfzPAK6UAAAFGAGgAcArmu8Xvy9/M8ArTfio24RW5nnaG67uou3H/KPuqT2X8hHytz1G+upLL3enK3PUb66ys9RDBRdr0hQgou06QqEGUkntH5Tz1e238vF9BeaqKT2j8p56vbb+Xi+gvNWjTdUuRn1XTHmTh8KrJTJlt8t1CPIY44cGnpJVjTJYkmjaN9Ib4u7V923njTethRauZJV3PaW1rfLIiXEDYg6R4VYc9CXW7thfOZbKdbGZtLW8uPVY/u3GrkNUkM9zlcxUjbhfWOA90cRq4gv4LhdqN+VToNYWmnRm9NNVWNTyHc6VWBv8wt4YeHqm6xyPmroq1Z7WGFLSxTq7WLSuPSdjrkfumq5yHXDUeA92oO2SKpVumNAaoJLMXH3myp0rpJ4uKhc3tbDM5BMri1zAj79j7KTiY8TcdBpcsith0286o+sPCagEX9Pzg4zXUCp6QYse8oouCG3tk6m1BYv05W6T+IdyolxbHDAAa2OgDlNCz3ryN2WxBd5PJMg1t81eId2ukqnLlTBbfcuY+9uJLiRcvtPvHdsHK+cfRHcHDWsyawjyy0WBcDI3lTP6TeIcFV+S5OmXx9bJg1048o8Cj0V8Jq2DVu09nL80up7OxHi+oal3P8AXB/IsZS8T/YOV65zvCcc7vfzPAK3ivWCz445zeH954BXOr6I8yfSfyz+jvCLP3fHytz1G+upLP3fHytz1E+usbPaQ0UXadIUIKLtekKhB7Ckk9o/Keer22/l4/oLzVRSe0flPPV7b/y8X0F5q0abqlyM+q6Y8yQsBTDMor1o8aiaE1pbluMqS3sbLLHIhSRQyngqukhaJ9uBjo+H5aOa3ao2t34qouRlLajTalGP8v0IY8ylXQ+PKPFU/bYXOLPge6CKia0LaxTOxHu1Q7cuBd9yPEJ7TbjXKO8CajbMIF6CNIeNvJHjqIWJ7tSpYkalqVblwIdyG+RGXur0hXYJFxal+Dhq5y3slkv3Y2pD0pTr+QUClpJRUdo9XW4OLrTHtM16cZLLWkeC7y4jvlNEpcRtw1Ux27Ci448NZrTFy3nn3IQWxlgGrDZ3pza7/M8ArZo+ArF5171uvp+CqdV0R5l/psUrs2vB3hdl7vTlbnqJ9dS2Xu+PlbnqJ9dY2eshooq16QoQUXa9IVCD2FLJ7RuU89WNtmUSQqkgYMgw0accKrpPaPynnrZWG4Vi+VWmY5tnMWXG+XrIYnA0rhj0mdcTgdNdwnKDqjmduM1SRR/qlr8/4KX6pa8T/BVzDuLZXudRZblmbxXcPUNPc3KqCIwrbOzgrHEnHjoyD+3eSXkht7DeKG4umDGOJVUklfouThXfmbnZ7Cvy1vt9pmv1W1+d8FL9VteJvgq5yrcOGfLmzHN80iyyETPbptAEFo2ZG8pmUa1OFNn3Ky6W/sbDKM5hv5bx2WTZA+7RF2y52WOPJTzE+z2Dy1vt9pT/AKpacTerS/U7Tib1a04/t7kDXPY03jhN0W6sQ7K7W3q2dnrMccaDy/8At80kuZfqWYxWNtlcvUPPhiGYhWDeUy7IwYU8xPs9g8tb7faUn6pacTerTxm9oOBvVq3v9z927aynuId44LiWKNnjhAXF2UYhRg516qpsryjLr21665zFLSTaK9U2GOA87SwqY37knRU+BzOzags0s1Oyr+BKM6sxwP6tSDPLMen6vy0rvdm3Sxlu7K/S7WDDrFUDUTxgnTU826eXW7KlxmqQuwDBXUKcD+1Xee/wXuKX5XDGWLapSVcOyhEM/seJ/V+WnjeGx4pPV+Wkm6kKZlFay3Jlt7iFpYZY8ASVK6DjtDDA0f8A0Tl340/1f8Ndx8xJVWXB0KbktFFpNzdVXAC/qOwA0CQni2flrO3Vwbm5lnI2TKxbDirX/wBE5d+NcfV/wVR7xZPa5U9utvI8nWhmbbw0YEAYYAVxfhfy5rlKR4Fulu6X7mW1mzT8S4Yis/5CPlbnqJ9dSWfu9OVueon11mZvQ2i7XpChKKtekKhBlNJ7R+U89bDfGTb3a3ZX0Lcj6kdY+T2j8p560288m1kWQr6MJ+ylSAr+2cnV5renjs3H1loX+3j9XvbbtxLN9lqW4UnV5jdnjtXHxihtyZNjeSBu5J9k1BJe7xy7W5CJ/wCzuD/mTVTf2+fq97LJuLrPsNRueS7W6aJ/38x+vLVXuY+xvHaNxbf2GoCezf8A36j/APsSf8w1sLnqczTefJluYoLm5uo5F61sBshItP1cNFYe1f8A3ir/APfE/wCZUe9bB94r5jwuPsrQFhmG4l/Z2M17HdW90tuu3IkTHaCjWdIw0VVZdks9/C06yJFEp2dp+E1bbqybGTZ8vpQD7L1XRv8A7blT96Oda7tpNuuNE37Cq9KSisjyuUoxrStKllHbLlWTXsMs8chuSuwEPDqwoLe5y+YRE/gLzmqRekvKKtd4327yM/ulHxmrHJStySWVRyrjxKI2XC/CTlnlPPKTpTdFbP0L1bgrf5Lp0G3dPhQHwV0S1lzBsns3sESR8Crh9WAJGjSOKuU3E+zdZQ3oJh8IArdZXFDmOTpHa3i2+YrI2KtKy4ricBsBuHHgFXSo440+Wa2qqxjvM9uMoy+WvzWpLCWWWE28HxL6e43ojgkeSCBY1Ri5BGIUDT51cl3vm276BBqSEH4WbxV0tlkyXJcxTMb+OW6uY9mGHrCzDQwwAbTp2uKuTZ9N1uYsfRRR8WPhrm419mSSjRyiqxVK7y23B/ftuTm2oSdJyzNVw3BFn7vTlbnqF9dS2fu9OVueon11lZuQ2iLdsGFD05H2dNQGV0ntG5Tz1dWm9N1b2kVq8EVwsI2UaQaQOKhmitZGLOmk68DhSFvY+gfWNSAg7z3Qvo7yKCKIohiaNR5LKxx8qpxvjcqS0VpbxvwOAcRQPZ7D0G9Y0uz2HoH1jUCpLY7zXlpbm3eKO5QuzjrBqZji3x17PvNcyT288VvDBJbMWUovS2hslW7mFQ9nsPQPrGl2ew9A+saCod/WNxtbYsrfb17WBxx5ddD2281xC88klvDcSXEnWuzrqOGGC9zRUPZ7D0G9Y0uzWHoH1jQVCLreq6ntZbaO3it1mGy7RjTs1X2mYy20ZiCq8ZOODcdEdmsPQb1jS7PYegfWNdJuLqnQiSUlRqpFLmryxtH1Ma7Qw2gNNPOdSt0oI27p007s9h6B9Y0uz2HoH1jXX3Z+I4+1b8IJdX89xLHKQFMXQUahpxoiPN5P+onfU+A0/s9h6DesaXZ7D0D6xpG7OLbUtu0StW5JJx2bBsmbtiSiEk+cxoCWWSaVpZOk2vDVo0VYdnsPQb1jSNvZcCH1jSd2c+p1XAmFqEOmOPEfaH+BQd1ueo211IzrgFUYKNAAqI1WztCpUqVCRUqVKgFSpUqAVKlSoBUqVKgFSpUqAVKlSoBUqVKgFSpUqAVKlSoD/9k\x3d";cc=cc||{}; cc.defineGetterSetter=function(a,b,c,d,e,f){if(a.__defineGetter__)c&&a.__defineGetter__(b,c),d&&a.__defineSetter__(b,d);else if(Object.defineProperty){var g={enumerable:!1,configurable:!0};c&&(g.get=c);d&&(g.set=d);Object.defineProperty(a,b,g)}else throw Error("browser does not support getters");if(!e&&!f)for(var g=null!=c,h=void 0!=d,k=Object.getOwnPropertyNames(a),m=0;m<k.length;m++){var n=k[m];if((a.__lookupGetter__?!a.__lookupGetter__(n):!Object.getOwnPropertyDescriptor(a,n))&&"function"===typeof a[n]){var p= a[n];if(g&&p===c&&(e=n,!h||f))break;if(h&&p===d&&(f=n,!g||e))break}}a=a.constructor;e&&(a.__getters__||(a.__getters__={}),a.__getters__[e]=b);f&&(a.__setters__||(a.__setters__={}),a.__setters__[f]=b)};cc.clone=function(a){var b=a.constructor?new a.constructor:{},c;for(c in a){var d=a[c];b[c]="object"!==typeof d||!d||d instanceof cc.Node||d instanceof HTMLElement?d:cc.clone(d)}return b};cc.inject=function(a,b){for(var c in a)b[c]=a[c]}; var ClassManager={id:0|998*Math.random(),instanceId:0|998*Math.random(),getNewID:function(){return this.id++},getNewInstanceId:function(){return this.instanceId++}}; (function(){var a=/\b_super\b/;cc.Class=function(){};cc.Class.extend=function(b){var c=this.prototype,d=Object.create(c),e={writable:!0,enumerable:!1,configurable:!0},f;cc.game.config&&cc.game.config[cc.game.CONFIG_KEY.exposeClassName]?(f="(function "+(b._className||"Class")+" (arg0, arg1, arg2, arg3, arg4, arg5) {\n",f+=" this.__instanceId \x3d ClassManager.getNewInstanceId();\n if (this.ctor) {\n",f+=" switch (arguments.length) {\n",f+=" case 0: this.ctor(); break;\n",f+=" case 1: this.ctor(arg0); break;\n", f+=" case 3: this.ctor(arg0, arg1, arg2); break;\n",f+=" case 4: this.ctor(arg0, arg1, arg2, arg3); break;\n",f+=" case 5: this.ctor(arg0, arg1, arg2, arg3, arg4); break;\n",f+=" default: this.ctor.apply(this, arguments);\n",f+=" }\n",f+=" }\n",f+="})",f=eval(f)):f=function(a,b,c,d,e){this.__instanceId=ClassManager.getNewInstanceId();if(this.ctor)switch(arguments.length){case 0:this.ctor();break;case 1:this.ctor(a);break;case 2:this.ctor(a,b);break;case 3:this.ctor(a, b,c);break;case 4:this.ctor(a,b,c,d);break;case 5:this.ctor(a,b,c,d,e);break;default:this.ctor.apply(this,arguments)}};e.value=ClassManager.getNewID();Object.defineProperty(d,"__pid",e);f.prototype=d;e.value=f;Object.defineProperty(d,"constructor",e);this.__getters__&&(f.__getters__=cc.clone(this.__getters__));this.__setters__&&(f.__setters__=cc.clone(this.__setters__));for(var g=0,h=arguments.length;g<h;++g){var k=arguments[g],m;for(m in k){var n="function"===typeof k[m],p="function"===typeof c[m], r=a.test(k[m]);n&&p&&r?(e.value=function(a,b){return function(){var d=this._super;this._super=c[a];var e=b.apply(this,arguments);this._super=d;return e}}(m,k[m]),Object.defineProperty(d,m,e)):n?(e.value=k[m],Object.defineProperty(d,m,e)):d[m]=k[m];if(n){var s,u;if(this.__getters__&&this.__getters__[m]){var n=this.__getters__[m],t;for(t in this.__setters__)if(this.__setters__[t]===n){u=t;break}cc.defineGetterSetter(d,n,k[m],k[u]?k[u]:d[u],m,u)}if(this.__setters__&&this.__setters__[m]){n=this.__setters__[m]; for(t in this.__getters__)if(this.__getters__[t]===n){s=t;break}cc.defineGetterSetter(d,n,k[s]?k[s]:d[s],k[m],s,m)}}}}f.extend=cc.Class.extend;f.implement=function(a){for(var b in a)d[b]=a[b]};return f}})();cc=cc||{};cc._tmp=cc._tmp||{};cc.associateWithNative=function(a,b){}; cc.KEY={none:0,back:6,menu:18,backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,pause:19,capslock:20,escape:27,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,select:41,insert:45,Delete:46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,num0:96,num1:97,num2:98,num3:99,num4:100,num5:101,num6:102,num7:103,num8:104,num9:105,"*":106,"+":107, "-":109,numdel:110,"/":111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,numlock:144,scrolllock:145,";":186,semicolon:186,equal:187,"\x3d":187,",":188,comma:188,dash:189,".":190,period:190,forwardslash:191,grave:192,"[":219,openbracket:219,backslash:220,"]":221,closebracket:221,quote:222,dpadLeft:1E3,dpadRight:1001,dpadUp:1003,dpadDown:1004,dpadCenter:1005};cc.FMT_JPG=0;cc.FMT_PNG=1;cc.FMT_TIFF=2;cc.FMT_RAWDATA=3;cc.FMT_WEBP=4;cc.FMT_UNKNOWN=5; cc.getImageFormatByData=function(a){return 8<a.length&&137===a[0]&&80===a[1]&&78===a[2]&&71===a[3]&&13===a[4]&&10===a[5]&&26===a[6]&&10===a[7]?cc.FMT_PNG:2<a.length&&(73===a[0]&&73===a[1]||77===a[0]&&77===a[1]||255===a[0]&&216===a[1])?cc.FMT_TIFF:cc.FMT_UNKNOWN};cc.Point=function(a,b){this.x=a||0;this.y=b||0};cc.p=function(a,b){return void 0===a?{x:0,y:0}:void 0===b?{x:a.x,y:a.y}:{x:a,y:b}};cc.pointEqualToPoint=function(a,b){return a&&b&&a.x===b.x&&a.y===b.y};cc.Size=function(a,b){this.width=a||0;this.height=b||0};cc.size=function(a,b){return void 0===a?{width:0,height:0}:void 0===b?{width:a.width,height:a.height}:{width:a,height:b}};cc.sizeEqualToSize=function(a,b){return a&&b&&a.width===b.width&&a.height===b.height}; cc.Rect=function(a,b,c,d){this.x=a||0;this.y=b||0;this.width=c||0;this.height=d||0};cc.rect=function(a,b,c,d){return void 0===a?{x:0,y:0,width:0,height:0}:void 0===b?{x:a.x,y:a.y,width:a.width,height:a.height}:{x:a,y:b,width:c,height:d}};cc.rectEqualToRect=function(a,b){return a&&b&&a.x===b.x&&a.y===b.y&&a.width===b.width&&a.height===b.height};cc._rectEqualToZero=function(a){return a&&0===a.x&&0===a.y&&0===a.width&&0===a.height}; cc.rectContainsRect=function(a,b){return a&&b?!(a.x>=b.x||a.y>=b.y||a.x+a.width<=b.x+b.width||a.y+a.height<=b.y+b.height):!1};cc.rectGetMaxX=function(a){return a.x+a.width};cc.rectGetMidX=function(a){return a.x+a.width/2};cc.rectGetMinX=function(a){return a.x};cc.rectGetMaxY=function(a){return a.y+a.height};cc.rectGetMidY=function(a){return a.y+a.height/2};cc.rectGetMinY=function(a){return a.y}; cc.rectContainsPoint=function(a,b){return b.x>=cc.rectGetMinX(a)&&b.x<=cc.rectGetMaxX(a)&&b.y>=cc.rectGetMinY(a)&&b.y<=cc.rectGetMaxY(a)};cc.rectIntersectsRect=function(a,b){var c=a.y+a.height,d=b.x+b.width,e=b.y+b.height;return!(a.x+a.width<b.x||d<a.x||c<b.y||e<a.y)};cc.rectOverlapsRect=function(a,b){return!(a.x+a.width<b.x||b.x+b.width<a.x||a.y+a.height<b.y||b.y+b.height<a.y)}; cc.rectUnion=function(a,b){var c=cc.rect(0,0,0,0);c.x=Math.min(a.x,b.x);c.y=Math.min(a.y,b.y);c.width=Math.max(a.x+a.width,b.x+b.width)-c.x;c.height=Math.max(a.y+a.height,b.y+b.height)-c.y;return c};cc.rectIntersection=function(a,b){var c=cc.rect(Math.max(cc.rectGetMinX(a),cc.rectGetMinX(b)),Math.max(cc.rectGetMinY(a),cc.rectGetMinY(b)),0,0);c.width=Math.min(cc.rectGetMaxX(a),cc.rectGetMaxX(b))-cc.rectGetMinX(c);c.height=Math.min(cc.rectGetMaxY(a),cc.rectGetMaxY(b))-cc.rectGetMinY(c);return c};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(a){return this._parseXML(a)},_parseXML:function(a){var b;this._isSupportDOMParser?b=this._parser.parseFromString(a,"text/xml"):(b=new ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a));return b}}); cc.PlistParser=cc.SAXParser.extend({parse:function(a){a=this._parseXML(a).documentElement;if("plist"!==a.tagName)return cc.warn("Not a plist file!"),{};for(var b=null,c=0,d=a.childNodes.length;c<d&&(b=a.childNodes[c],1!==b.nodeType);c++);return this._parseNode(b)},_parseNode:function(a){var b=null,c=a.tagName;if("dict"===c)b=this._parseDict(a);else if("array"===c)b=this._parseArray(a);else if("string"===c)if(1===a.childNodes.length)b=a.firstChild.nodeValue;else for(b="",c=0;c<a.childNodes.length;c++)b+= a.childNodes[c].nodeValue;else"false"===c?b=!1:"true"===c?b=!0:"real"===c?b=parseFloat(a.firstChild.nodeValue):"integer"===c&&(b=parseInt(a.firstChild.nodeValue,10));return b},_parseArray:function(a){for(var b=[],c=0,d=a.childNodes.length;c<d;c++){var e=a.childNodes[c];1===e.nodeType&&b.push(this._parseNode(e))}return b},_parseDict:function(a){for(var b={},c=null,d=0,e=a.childNodes.length;d<e;d++){var f=a.childNodes[d];1===f.nodeType&&("key"===f.tagName?c=f.firstChild.nodeValue:b[c]=this._parseNode(f))}return b}}); cc.saxParser=new cc.SAXParser;cc.plistParser=new cc.PlistParser;cc._txtLoader={load:function(a,b,c,d){cc.loader.loadTxt(a,d)}};cc.loader.register(["txt","xml","vsh","fsh","atlas"],cc._txtLoader);cc._jsonLoader={load:function(a,b,c,d){cc.loader.loadJson(a,d)}};cc.loader.register(["json","ExportJson"],cc._jsonLoader);cc._jsLoader={load:function(a,b,c,d){cc.loader.loadJs(a,d)}};cc.loader.register(["js"],cc._jsLoader); cc._imgLoader={load:function(a,b,c,d){c=cc.loader.isLoading(a)?d:function(a,c){if(a)return d(a);cc.loader.cache[b]=c;cc.textureCache.handleLoadedTexture(b);d(null,c)};cc.loader.loadImg(a,c)}};cc.loader.register("png jpg bmp jpeg gif ico tiff webp".split(" "),cc._imgLoader);cc._serverImgLoader={load:function(a,b,c,d){cc._imgLoader.load(c.src,b,c,d)}};cc.loader.register(["serverImg"],cc._serverImgLoader); cc._plistLoader={load:function(a,b,c,d){cc.loader.loadTxt(a,function(a,b){if(a)return d(a);d(null,cc.plistParser.parse(b))})}};cc.loader.register(["plist"],cc._plistLoader); cc._fontLoader={TYPE:{".eot":"embedded-opentype",".ttf":"truetype",".ttc":"truetype",".woff":"woff",".svg":"svg"},_loadFont:function(a,b,c){var d=document,e=cc.path,f=this.TYPE,g=document.createElement("style");g.type="text/css";d.body.appendChild(g);var h="",h=isNaN(a-0)?h+("@font-face { font-family:"+a+"; src:"):h+("@font-face { font-family:'"+a+"'; src:");if(b instanceof Array)for(var k=0,m=b.length;k<m;k++)c=e.extname(b[k]).toLowerCase(),h+="url('"+b[k]+"') format('"+f[c]+"')",h+=k===m-1?";": ",";else c=c.toLowerCase(),h+="url('"+b+"') format('"+f[c]+"');";g.textContent+=h+"}";b=document.createElement("div");c=b.style;c.fontFamily=a;b.innerHTML=".";c.position="absolute";c.left="-100px";c.top="-100px";d.body.appendChild(b)},load:function(a,b,c,d){b=c.type;a=c.name;b=c.srcs;cc.isString(c)?(b=cc.path.extname(c),a=cc.path.basename(c,b),this._loadFont(a,c,b)):this._loadFont(a,b);document.fonts?document.fonts.load("1em "+a).then(function(){d(null,!0)},function(a){d(a)}):d(null,!0)}}; cc.loader.register("font eot ttf woff svg ttc".split(" "),cc._fontLoader);cc._binaryLoader={load:function(a,b,c,d){cc.loader.loadBinary(a,d)}};cc._csbLoader={load:function(a,b,c,d){cc.loader.loadCsb(a,d)}};cc.loader.register(["csb"],cc._csbLoader);window.CocosEngine=cc.ENGINE_VERSION="Cocos2d-JS v3.14";cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL=1;cc.DIRECTOR_STATS_POSITION=cc.p(0,0);cc.DIRECTOR_FPS_INTERVAL=0.5;cc.COCOSNODE_RENDER_SUBPIXEL=1;cc.SPRITEBATCHNODE_RENDER_SUBPIXEL=1;cc.OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA=1;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.SPRITE_DEBUG_DRAW=0; cc.SPRITEBATCHNODE_DEBUG_DRAW=0;cc.LABELBMFONT_DEBUG_DRAW=0;cc.LABELATLAS_DEBUG_DRAW=0;cc.DRAWNODE_TOTAL_VERTICES=2E4;cc.IS_RETINA_DISPLAY_SUPPORTED=0;cc.DEFAULT_ENGINE=cc.ENGINE_VERSION+"-canvas";cc.ENABLE_STACKABLE_ACTIONS=1;cc.ENABLE_GL_STATE_CACHE=1;cc.$=function(a){var b=this===cc?document:this;if(a=a instanceof HTMLElement?a:b.querySelector(a))a.find=a.find||cc.$,a.hasClass=a.hasClass||function(a){return this.className.match(RegExp("(\\s|^)"+a+"(\\s|$)"))},a.addClass=a.addClass||function(a){this.hasClass(a)||(this.className&&(this.className+=" "),this.className+=a);return this},a.removeClass=a.removeClass||function(a){this.hasClass(a)&&(this.className=this.className.replace(a,""));return this},a.remove=a.remove||function(){this.parentNode&& this.parentNode.removeChild(this);return this},a.appendTo=a.appendTo||function(a){a.appendChild(this);return this},a.prependTo=a.prependTo||function(a){a.childNodes[0]?a.insertBefore(this,a.childNodes[0]):a.appendChild(this);return this},a.transforms=a.transforms||function(){this.style[cc.$.trans]=cc.$.translate(this.position)+cc.$.rotate(this.rotation)+cc.$.scale(this.scale)+cc.$.skew(this.skew);return this},a.position=a.position||{x:0,y:0},a.rotation=a.rotation||0,a.scale=a.scale||{x:1,y:1},a.skew= a.skew||{x:0,y:0},a.translates=function(a,b){this.position.x=a;this.position.y=b;this.transforms();return this},a.rotate=function(a){this.rotation=a;this.transforms();return this},a.resize=function(a,b){this.scale.x=a;this.scale.y=b;this.transforms();return this},a.setSkew=function(a,b){this.skew.x=a;this.skew.y=b;this.transforms();return this};return a}; 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(a){return"translate3d("+a.x+"px, "+a.y+"px, 0) "}:function(a){return"translate("+a.x+"px, "+a.y+"px) "};cc.$.rotate=cc.$.hd?function(a){return"rotateZ("+a+"deg) "}:function(a){return"rotate("+a+"deg) "};cc.$.scale=function(a){return"scale("+a.x+", "+a.y+") "};cc.$.skew=function(a){return"skewX("+-a.x+"deg) skewY("+a.y+"deg)"};cc.$new=function(a){return cc.$(document.createElement(a))}; cc.$.findpos=function(a){var b=0,c=0;do b+=a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent);return{x:b,y:c}};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(a,b,c){if(!cc.isObject(c)||cc.isUndefined(c.x)||cc.isUndefined(c.y))cc.log(cc._LogInfos.swap);else{var d=c[a];c[a]=c[b];c[b]=d}};cc.lerp=function(a,b,c){return a+(b-a)*c};cc.rand=function(){return 16777215*Math.random()};cc.randomMinus1To1=function(){return 2*(Math.random()-0.5)};cc.random0To1=Math.random; cc.degreesToRadians=function(a){return a*cc.RAD};cc.radiansToDegrees=function(a){return a*cc.DEG};cc.radiansToDegress=function(a){cc.log(cc._LogInfos.radiansToDegress);return a*cc.DEG};cc.REPEAT_FOREVER=Number.MAX_VALUE-1;cc.nodeDrawSetup=function(a){a._shaderProgram&&(a._shaderProgram.use(),a._shaderProgram.setUniformForModelViewAndProjectionMatrixWithMat4())};cc.enableDefaultGLStates=function(){};cc.disableDefaultGLStates=function(){};cc.incrementGLDraws=function(a){cc.g_NumberOfDraws+=a}; cc.FLT_EPSILON=1.192092896E-7;cc.contentScaleFactor=cc.IS_RETINA_DISPLAY_SUPPORTED?function(){return cc.director._contentScaleFactor}:function(){return 1};cc.pointPointsToPixels=function(a){var b=cc.contentScaleFactor();return cc.p(a.x*b,a.y*b)};cc.pointPixelsToPoints=function(a){var b=cc.contentScaleFactor();return cc.p(a.x/b,a.y/b)};cc._pointPixelsToPointsOut=function(a,b){var c=cc.contentScaleFactor();b.x=a.x/c;b.y=a.y/c}; cc.sizePointsToPixels=function(a){var b=cc.contentScaleFactor();return cc.size(a.width*b,a.height*b)};cc.sizePixelsToPoints=function(a){var b=cc.contentScaleFactor();return cc.size(a.width/b,a.height/b)};cc._sizePixelsToPointsOut=function(a,b){var c=cc.contentScaleFactor();b.width=a.width/c;b.height=a.height/c};cc.rectPixelsToPoints=cc.IS_RETINA_DISPLAY_SUPPORTED?function(a){var b=cc.contentScaleFactor();return cc.rect(a.x/b,a.y/b,a.width/b,a.height/b)}:function(a){return a}; cc.rectPointsToPixels=cc.IS_RETINA_DISPLAY_SUPPORTED?function(a){var b=cc.contentScaleFactor();return cc.rect(a.x*b,a.y*b,a.width*b,a.height*b)}:function(a){return a};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.LINEAR=9729;cc.REPEAT=10497; cc.CLAMP_TO_EDGE=33071;cc.MIRRORED_REPEAT=33648;cc.BLEND_SRC=cc.SRC_ALPHA;cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){cc._renderType===cc.game.RENDER_TYPE_WEBGL&&cc.OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA&&(cc.BLEND_SRC=cc.ONE)});cc.BLEND_DST=cc.ONE_MINUS_SRC_ALPHA;cc.checkGLErrorDebug=function(){if(cc.renderMode===cc.game.RENDER_TYPE_WEBGL){var a=cc._renderContext.getError();a&&cc.log(cc._LogInfos.checkGLErrorDebug,a)}};cc.ORIENTATION_PORTRAIT=1; cc.ORIENTATION_LANDSCAPE=2;cc.ORIENTATION_AUTO=3;cc.CONCURRENCY_HTTP_REQUEST_COUNT=cc.sys.isMobile?20:200;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.GL_ALL=0;cc.VERTEX_ATTRIB_POSITION=0;cc.VERTEX_ATTRIB_COLOR=1;cc.VERTEX_ATTRIB_TEX_COORDS=2;cc.VERTEX_ATTRIB_MAX=7;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_SPRITE_POSITION_TEXTURECOLOR="ShaderSpritePositionTextureColor";cc.SHADER_SPRITE_POSITION_TEXTURECOLOR_GRAY="ShaderSpritePositionTextureColorGray";cc.SHADER_POSITION_TEXTURECOLORALPHATEST="ShaderPositionTextureColorAlphaTest"; cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST="ShaderSpritePositionTextureColorAlphaTest";cc.SHADER_POSITION_COLOR="ShaderPositionColor";cc.SHADER_SPRITE_POSITION_COLOR="ShaderSpritePositionColor";cc.SHADER_POSITION_TEXTURE="ShaderPositionTexture";cc.SHADER_POSITION_TEXTURE_UCOLOR="ShaderPositionTextureUColor";cc.SHADER_POSITION_TEXTUREA8COLOR="ShaderPositionTextureA8Color";cc.SHADER_POSITION_UCOLOR="ShaderPositionUColor";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.ATTRIBUTE_NAME_MVMAT="a_mvMatrix";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.arrayVerifyType=function(a,b){if(a&&0<a.length)for(var c=0;c<a.length;c++)if(!(a[c]instanceof b))return cc.log("element type is wrong!"),!1;return!0};cc.arrayRemoveObject=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b){a.splice(c,1);break}};cc.arrayRemoveArray=function(a,b){for(var c=0,d=b.length;c<d;c++)cc.arrayRemoveObject(a,b[c])}; cc.arrayAppendObjectsToIndex=function(a,b,c){a.splice.apply(a,[c,0].concat(b));return a};cc.copyArray=function(a){var b,c=a.length,d=Array(c);for(b=0;b<c;b+=1)d[b]=a[b];return d};cc.Color=function(a,b,c,d){this._val=((a||0)<<24>>>0)+((b||0)<<16)+((c||0)<<8)+(d||0)};_p=cc.Color.prototype;_p._getR=function(){return(this._val&4278190080)>>>24};_p._setR=function(a){this._val=this._val&16777215|a<<24>>>0};_p._getG=function(){return(this._val&16711680)>>16};_p._setG=function(a){this._val=this._val&4278255615|a<<16};_p._getB=function(){return(this._val&65280)>>8};_p._setB=function(a){this._val=this._val&4294902015|a<<8};_p._getA=function(){return this._val&255}; _p._setA=function(a){this._val=this._val&4294967040|a};cc.defineGetterSetter(_p,"r",_p._getR,_p._setR);cc.defineGetterSetter(_p,"g",_p._getG,_p._setG);cc.defineGetterSetter(_p,"b",_p._getB,_p._setB);cc.defineGetterSetter(_p,"a",_p._getA,_p._setA);cc.color=function(a,b,c,d){return void 0===a?new cc.Color(0,0,0,255):"object"===typeof a?new cc.Color(a.r,a.g,a.b,null==a.a?255:a.a):"string"===typeof a?cc.hexToColor(a):new cc.Color(a,b,c,null==d?255:d)}; cc.colorEqual=function(a,b){return a.r===b.r&&a.g===b.g&&a.b===b.b};cc.Acceleration=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.timestamp=d||0};cc.Vertex2F=function(a,b,c,d){this._arrayBuffer=c||new ArrayBuffer(cc.Vertex2F.BYTES_PER_ELEMENT);this._offset=d||0;this._view=new Float32Array(this._arrayBuffer,this._offset,2);this._view[0]=a||0;this._view[1]=b||0};cc.Vertex2F.BYTES_PER_ELEMENT=8;_p=cc.Vertex2F.prototype;_p._getX=function(){return this._view[0]}; _p._setX=function(a){this._view[0]=a};_p._getY=function(){return this._view[1]};_p._setY=function(a){this._view[1]=a};cc.defineGetterSetter(_p,"x",_p._getX,_p._setX);cc.defineGetterSetter(_p,"y",_p._getY,_p._setY);cc.Vertex3F=function(a,b,c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.Vertex3F.BYTES_PER_ELEMENT);this._offset=e||0;this._view=new Float32Array(this._arrayBuffer,this._offset,3);this._view[0]=a||0;this._view[1]=b||0;this._view[2]=c||0};cc.Vertex3F.BYTES_PER_ELEMENT=12;_p=cc.Vertex3F.prototype; _p._getX=function(){return this._view[0]};_p._setX=function(a){this._view[0]=a};_p._getY=function(){return this._view[1]};_p._setY=function(a){this._view[1]=a};_p._getZ=function(){return this._view[2]};_p._setZ=function(a){this._view[2]=a};cc.defineGetterSetter(_p,"x",_p._getX,_p._setX);cc.defineGetterSetter(_p,"y",_p._getY,_p._setY);cc.defineGetterSetter(_p,"z",_p._getZ,_p._setZ); cc.Tex2F=function(a,b,c,d){this._arrayBuffer=c||new ArrayBuffer(cc.Tex2F.BYTES_PER_ELEMENT);this._offset=d||0;this._view=new Float32Array(this._arrayBuffer,this._offset,2);this._view[0]=a||0;this._view[1]=b||0};cc.Tex2F.BYTES_PER_ELEMENT=8;_p=cc.Tex2F.prototype;_p._getU=function(){return this._view[0]};_p._setU=function(a){this._view[0]=a};_p._getV=function(){return this._view[1]};_p._setV=function(a){this._view[1]=a};cc.defineGetterSetter(_p,"u",_p._getU,_p._setU); cc.defineGetterSetter(_p,"v",_p._getV,_p._setV); cc.Quad2=function(a,b,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.Quad2.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;var g=cc.Vertex2F.BYTES_PER_ELEMENT;this._tl=a?new cc.Vertex2F(a.x,a.y,e,f):new cc.Vertex2F(0,0,e,f);f+=g;this._tr=b?new cc.Vertex2F(b.x,b.y,e,f):new cc.Vertex2F(0,0,e,f);f+=g;this._bl=c?new cc.Vertex2F(c.x,c.y,e,f):new cc.Vertex2F(0,0,e,f);f+=g;this._br=d?new cc.Vertex2F(d.x,d.y,e,f):new cc.Vertex2F(0,0,e,f)};cc.Quad2.BYTES_PER_ELEMENT=32;_p=cc.Quad2.prototype; _p._getTL=function(){return this._tl};_p._setTL=function(a){this._tl._view[0]=a.x;this._tl._view[1]=a.y};_p._getTR=function(){return this._tr};_p._setTR=function(a){this._tr._view[0]=a.x;this._tr._view[1]=a.y};_p._getBL=function(){return this._bl};_p._setBL=function(a){this._bl._view[0]=a.x;this._bl._view[1]=a.y};_p._getBR=function(){return this._br};_p._setBR=function(a){this._br._view[0]=a.x;this._br._view[1]=a.y};cc.defineGetterSetter(_p,"tl",_p._getTL,_p._setTL); cc.defineGetterSetter(_p,"tr",_p._getTR,_p._setTR);cc.defineGetterSetter(_p,"bl",_p._getBL,_p._setBL);cc.defineGetterSetter(_p,"br",_p._getBR,_p._setBR); cc.Quad3=function(a,b,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.Quad3.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;var g=cc.Vertex3F.BYTES_PER_ELEMENT;this.bl=a?new cc.Vertex3F(a.x,a.y,a.z,e,f):new cc.Vertex3F(0,0,0,e,f);f+=g;this.br=b?new cc.Vertex3F(b.x,b.y,b.z,e,f):new cc.Vertex3F(0,0,0,e,f);f+=g;this.tl=c?new cc.Vertex3F(c.x,c.y,c.z,e,f):new cc.Vertex3F(0,0,0,e,f);f+=g;this.tr=d?new cc.Vertex3F(d.x,d.y,d.z,e,f):new cc.Vertex3F(0,0,0,e,f)}; cc.Quad3.BYTES_PER_ELEMENT=48;cc.V3F_C4B_T2F=function(a,b,c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.V3F_C4B_T2F.BYTES_PER_ELEMENT);this._offset=e||0;d=this._arrayBuffer;e=this._offset;this._vertices=a?new cc.Vertex3F(a.x,a.y,a.z,d,e):new cc.Vertex3F(0,0,0,d,e);e+=cc.Vertex3F.BYTES_PER_ELEMENT;this._colors=b?new cc._WebGLColor(b.r,b.g,b.b,b.a,d,e):new cc._WebGLColor(0,0,0,0,d,e);e+=cc._WebGLColor.BYTES_PER_ELEMENT;this._texCoords=c?new cc.Tex2F(c.u,c.v,d,e):new cc.Tex2F(0,0,d,e)}; cc.V3F_C4B_T2F.BYTES_PER_ELEMENT=24;_p=cc.V3F_C4B_T2F.prototype;_p._getVertices=function(){return this._vertices};_p._setVertices=function(a){var b=this._vertices;b._view[0]=a.x;b._view[1]=a.y;b._view[2]=a.z};_p._getColor=function(){return this._colors};_p._setColor=function(a){var b=this._colors;b._view[0]=a.r;b._view[1]=a.g;b._view[2]=a.b;b._view[3]=a.a};_p._getTexCoords=function(){return this._texCoords};_p._setTexCoords=function(a){this._texCoords._view[0]=a.u;this._texCoords._view[1]=a.v}; cc.defineGetterSetter(_p,"vertices",_p._getVertices,_p._setVertices);cc.defineGetterSetter(_p,"colors",_p._getColor,_p._setColor);cc.defineGetterSetter(_p,"texCoords",_p._getTexCoords,_p._setTexCoords); cc.V3F_C4B_T2F_Quad=function(a,b,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;var g=cc.V3F_C4B_T2F.BYTES_PER_ELEMENT;this._tl=a?new cc.V3F_C4B_T2F(a.vertices,a.colors,a.texCoords,e,f):new cc.V3F_C4B_T2F(null,null,null,e,f);f+=g;this._bl=b?new cc.V3F_C4B_T2F(b.vertices,b.colors,b.texCoords,e,f):new cc.V3F_C4B_T2F(null,null,null,e,f);f+=g;this._tr=c?new cc.V3F_C4B_T2F(c.vertices,c.colors,c.texCoords,e,f):new cc.V3F_C4B_T2F(null, null,null,e,f);f+=g;this._br=d?new cc.V3F_C4B_T2F(d.vertices,d.colors,d.texCoords,e,f):new cc.V3F_C4B_T2F(null,null,null,e,f)};cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT=96;_p=cc.V3F_C4B_T2F_Quad.prototype;_p._getTL=function(){return this._tl};_p._setTL=function(a){var b=this._tl;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getBL=function(){return this._bl};_p._setBL=function(a){var b=this._bl;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getTR=function(){return this._tr}; _p._setTR=function(a){var b=this._tr;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getBR=function(){return this._br};_p._setBR=function(a){var b=this._br;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getArrayBuffer=function(){return this._arrayBuffer};cc.defineGetterSetter(_p,"tl",_p._getTL,_p._setTL);cc.defineGetterSetter(_p,"tr",_p._getTR,_p._setTR);cc.defineGetterSetter(_p,"bl",_p._getBL,_p._setBL);cc.defineGetterSetter(_p,"br",_p._getBR,_p._setBR); cc.defineGetterSetter(_p,"arrayBuffer",_p._getArrayBuffer,null);cc.V3F_C4B_T2F_QuadZero=function(){return new cc.V3F_C4B_T2F_Quad}; cc.V3F_C4B_T2F_QuadCopy=function(a){if(!a)return cc.V3F_C4B_T2F_QuadZero();var b=a.tl,c=a.bl,d=a.tr;a=a.br;return{tl:{vertices:{x:b.vertices.x,y:b.vertices.y,z:b.vertices.z},colors:{r:b.colors.r,g:b.colors.g,b:b.colors.b,a:b.colors.a},texCoords:{u:b.texCoords.u,v:b.texCoords.v}},bl:{vertices:{x:c.vertices.x,y:c.vertices.y,z:c.vertices.z},colors:{r:c.colors.r,g:c.colors.g,b:c.colors.b,a:c.colors.a},texCoords:{u:c.texCoords.u,v:c.texCoords.v}},tr:{vertices:{x:d.vertices.x,y:d.vertices.y,z:d.vertices.z}, colors:{r:d.colors.r,g:d.colors.g,b:d.colors.b,a:d.colors.a},texCoords:{u:d.texCoords.u,v:d.texCoords.v}},br:{vertices:{x:a.vertices.x,y:a.vertices.y,z:a.vertices.z},colors:{r:a.colors.r,g:a.colors.g,b:a.colors.b,a:a.colors.a},texCoords:{u:a.texCoords.u,v:a.texCoords.v}}}};cc.V3F_C4B_T2F_QuadsCopy=function(a){if(!a)return[];for(var b=[],c=0;c<a.length;c++)b.push(cc.V3F_C4B_T2F_QuadCopy(a[c]));return b}; cc.V2F_C4B_T2F=function(a,b,c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.V2F_C4B_T2F.BYTES_PER_ELEMENT);this._offset=e||0;d=this._arrayBuffer;e=this._offset;this._vertices=a?new cc.Vertex2F(a.x,a.y,d,e):new cc.Vertex2F(0,0,d,e);e+=cc.Vertex2F.BYTES_PER_ELEMENT;this._colors=b?new cc._WebGLColor(b.r,b.g,b.b,b.a,d,e):new cc._WebGLColor(0,0,0,0,d,e);e+=cc._WebGLColor.BYTES_PER_ELEMENT;this._texCoords=c?new cc.Tex2F(c.u,c.v,d,e):new cc.Tex2F(0,0,d,e)};cc.V2F_C4B_T2F.BYTES_PER_ELEMENT=20;_p=cc.V2F_C4B_T2F.prototype; _p._getVertices=function(){return this._vertices};_p._setVertices=function(a){this._vertices._view[0]=a.x;this._vertices._view[1]=a.y};_p._getColor=function(){return this._colors};_p._setColor=function(a){var b=this._colors;b._view[0]=a.r;b._view[1]=a.g;b._view[2]=a.b;b._view[3]=a.a};_p._getTexCoords=function(){return this._texCoords};_p._setTexCoords=function(a){this._texCoords._view[0]=a.u;this._texCoords._view[1]=a.v};cc.defineGetterSetter(_p,"vertices",_p._getVertices,_p._setVertices); cc.defineGetterSetter(_p,"colors",_p._getColor,_p._setColor);cc.defineGetterSetter(_p,"texCoords",_p._getTexCoords,_p._setTexCoords); cc.V2F_C4B_T2F_Triangle=function(a,b,c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.V2F_C4B_T2F_Triangle.BYTES_PER_ELEMENT);this._offset=e||0;d=this._arrayBuffer;e=this._offset;var f=cc.V2F_C4B_T2F.BYTES_PER_ELEMENT;this._a=a?new cc.V2F_C4B_T2F(a.vertices,a.colors,a.texCoords,d,e):new cc.V2F_C4B_T2F(null,null,null,d,e);e+=f;this._b=b?new cc.V2F_C4B_T2F(b.vertices,b.colors,b.texCoords,d,e):new cc.V2F_C4B_T2F(null,null,null,d,e);e+=f;this._c=c?new cc.V2F_C4B_T2F(c.vertices,c.colors,c.texCoords,d,e): new cc.V2F_C4B_T2F(null,null,null,d,e)};cc.V2F_C4B_T2F_Triangle.BYTES_PER_ELEMENT=60;_p=cc.V2F_C4B_T2F_Triangle.prototype;_p._getA=function(){return this._a};_p._setA=function(a){var b=this._a;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getB=function(){return this._b};_p._setB=function(a){var b=this._b;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getC=function(){return this._c}; _p._setC=function(a){var b=this._c;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};cc.defineGetterSetter(_p,"a",_p._getA,_p._setA);cc.defineGetterSetter(_p,"b",_p._getB,_p._setB);cc.defineGetterSetter(_p,"c",_p._getC,_p._setC);cc.vertex2=function(a,b){return new cc.Vertex2F(a,b)};cc.vertex3=function(a,b,c){return new cc.Vertex3F(a,b,c)};cc.tex2=function(a,b){return new cc.Tex2F(a,b)};cc.BlendFunc=function(a,b){this.src=a;this.dst=b}; cc.blendFuncDisable=function(){return new cc.BlendFunc(cc.ONE,cc.ZERO)};cc.hexToColor=function(a){a=a.replace(/^#?/,"0x");a=parseInt(a);return new cc.Color(a>>16,(a>>8)%256,a%256)};cc.colorToHex=function(a){var b=a.r.toString(16),c=a.g.toString(16),d=a.b.toString(16);return"#"+(16>a.r?"0"+b:b)+(16>a.g?"0"+c:c)+(16>a.b?"0"+d:d)};cc.TEXT_ALIGNMENT_LEFT=0;cc.TEXT_ALIGNMENT_CENTER=1;cc.TEXT_ALIGNMENT_RIGHT=2;cc.VERTICAL_TEXT_ALIGNMENT_TOP=0;cc.VERTICAL_TEXT_ALIGNMENT_CENTER=1; cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM=2; cc._Dictionary=cc.Class.extend({_keyMapTb:null,_valueMapTb:null,__currId:0,ctor:function(){this._keyMapTb={};this._valueMapTb={};this.__currId=2<<(0|10*Math.random())},__getKey:function(){this.__currId++;return"key_"+this.__currId},setObject:function(a,b){if(null!=b){var c=this.__getKey();this._keyMapTb[c]=b;this._valueMapTb[c]=a}},objectForKey:function(a){if(null==a)return null;var b=this._keyMapTb,c;for(c in b)if(b[c]===a)return this._valueMapTb[c];return null},valueForKey:function(a){return this.objectForKey(a)}, removeObjectForKey:function(a){if(null!=a){var b=this._keyMapTb,c;for(c in b)if(b[c]===a){delete this._valueMapTb[c];delete b[c];break}}},removeObjectsForKeys:function(a){if(null!=a)for(var b=0;b<a.length;b++)this.removeObjectForKey(a[b])},allKeys:function(){var a=[],b=this._keyMapTb,c;for(c in b)a.push(b[c]);return a},removeAllObjects:function(){this._keyMapTb={};this._valueMapTb={}},count:function(){return this.allKeys().length}}); cc.FontDefinition=function(a){this.fontName="Arial";this.fontSize=12;this.textAlign=cc.TEXT_ALIGNMENT_CENTER;this.verticalAlign=cc.VERTICAL_TEXT_ALIGNMENT_TOP;this.fillStyle=cc.color(255,255,255,255);this.boundingHeight=this.boundingWidth=0;this.strokeEnabled=!1;this.strokeStyle=cc.color(255,255,255,255);this.lineWidth=1;this.fontWeight=this.fontStyle=this.lineHeight="normal";this.shadowEnabled=!1;this.shadowBlur=this.shadowOffsetY=this.shadowOffsetX=0;this.shadowOpacity=1;if(a&&a instanceof Object)for(var b in a)this[b]= a[b]};cc.FontDefinition.prototype._getCanvasFontStr=function(){return this.fontStyle+" "+this.fontWeight+" "+this.fontSize+"px/"+(this.lineHeight.charAt?this.lineHeight:this.lineHeight+"px")+" '"+this.fontName+"'"}; cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(cc._WebGLColor=function(a,b,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc._WebGLColor.BYTES_PER_ELEMENT);this._offset=f||0;this._view=new Uint8Array(this._arrayBuffer,this._offset,4);this._view[0]=a||0;this._view[1]=b||0;this._view[2]=c||0;this._view[3]=null==d?255:d;void 0===d&&(this.a_undefined=!0)},cc._WebGLColor.BYTES_PER_ELEMENT=4,_p=cc._WebGLColor.prototype,_p._getR=function(){return this._view[0]}, _p._setR=function(a){this._view[0]=0>a?0:a},_p._getG=function(){return this._view[1]},_p._setG=function(a){this._view[1]=0>a?0:a},_p._getB=function(){return this._view[2]},_p._setB=function(a){this._view[2]=0>a?0:a},_p._getA=function(){return this._view[3]},_p._setA=function(a){this._view[3]=0>a?0:a},cc.defineGetterSetter(_p,"r",_p._getR,_p._setR),cc.defineGetterSetter(_p,"g",_p._getG,_p._setG),cc.defineGetterSetter(_p,"b",_p._getB,_p._setB),cc.defineGetterSetter(_p,"a",_p._getA,_p._setA))});_p=cc.color; _p._getWhite=function(){return cc.color(255,255,255)};_p._getYellow=function(){return cc.color(255,255,0)};_p._getBlue=function(){return cc.color(0,0,255)};_p._getGreen=function(){return cc.color(0,255,0)};_p._getRed=function(){return cc.color(255,0,0)};_p._getMagenta=function(){return cc.color(255,0,255)};_p._getBlack=function(){return cc.color(0,0,0)};_p._getOrange=function(){return cc.color(255,127,0)};_p._getGray=function(){return cc.color(166,166,166)};cc.defineGetterSetter(_p,"WHITE",_p._getWhite); cc.defineGetterSetter(_p,"YELLOW",_p._getYellow);cc.defineGetterSetter(_p,"BLUE",_p._getBlue);cc.defineGetterSetter(_p,"GREEN",_p._getGreen);cc.defineGetterSetter(_p,"RED",_p._getRed);cc.defineGetterSetter(_p,"MAGENTA",_p._getMagenta);cc.defineGetterSetter(_p,"BLACK",_p._getBlack);cc.defineGetterSetter(_p,"ORANGE",_p._getOrange);cc.defineGetterSetter(_p,"GRAY",_p._getGray);cc.BlendFunc._disable=function(){return new cc.BlendFunc(cc.ONE,cc.ZERO)}; cc.BlendFunc._alphaPremultiplied=function(){return new cc.BlendFunc(cc.ONE,cc.ONE_MINUS_SRC_ALPHA)};cc.BlendFunc._alphaNonPremultiplied=function(){return new cc.BlendFunc(cc.SRC_ALPHA,cc.ONE_MINUS_SRC_ALPHA)};cc.BlendFunc._additive=function(){return new cc.BlendFunc(cc.SRC_ALPHA,cc.ONE)};cc.defineGetterSetter(cc.BlendFunc,"DISABLE",cc.BlendFunc._disable);cc.defineGetterSetter(cc.BlendFunc,"ALPHA_PREMULTIPLIED",cc.BlendFunc._alphaPremultiplied); cc.defineGetterSetter(cc.BlendFunc,"ALPHA_NON_PREMULTIPLIED",cc.BlendFunc._alphaNonPremultiplied);cc.defineGetterSetter(cc.BlendFunc,"ADDITIVE",cc.BlendFunc._additive);cc.Touches=[];cc.TouchesIntergerDict={};cc.DENSITYDPI_DEVICE="device-dpi";cc.DENSITYDPI_HIGH="high-dpi";cc.DENSITYDPI_MEDIUM="medium-dpi";cc.DENSITYDPI_LOW="low-dpi";var __BrowserGetter={init:function(){this.html=document.getElementsByTagName("html")[0]},availWidth:function(a){return a&&a!==this.html?a.clientWidth:window.innerWidth},availHeight:function(a){return a&&a!==this.html?a.clientHeight:window.innerHeight},meta:{width:"device-width"},adaptationType:cc.sys.browserType}; -1<window.navigator.userAgent.indexOf("OS 8_1_")&&(__BrowserGetter.adaptationType=cc.sys.BROWSER_TYPE_MIUI);cc.sys.os===cc.sys.OS_IOS&&(__BrowserGetter.adaptationType=cc.sys.BROWSER_TYPE_SAFARI); switch(__BrowserGetter.adaptationType){case cc.sys.BROWSER_TYPE_SAFARI:__BrowserGetter.meta["minimal-ui"]="true";__BrowserGetter.availWidth=function(a){return a.clientWidth};__BrowserGetter.availHeight=function(a){return a.clientHeight};break;case cc.sys.BROWSER_TYPE_CHROME:__BrowserGetter.__defineGetter__("target-densitydpi",function(){return cc.view._targetDensityDPI});case cc.sys.BROWSER_TYPE_SOUGOU:case cc.sys.BROWSER_TYPE_UC:__BrowserGetter.availWidth=function(a){return a.clientWidth};__BrowserGetter.availHeight= function(a){return a.clientHeight};break;case cc.sys.BROWSER_TYPE_MIUI:__BrowserGetter.init=function(a){if(!a.__resizeWithBrowserSize){var b=function(){a.setDesignResolutionSize(a._designResolutionSize.width,a._designResolutionSize.height,a._resolutionPolicy);window.removeEventListener("resize",b,!1)};window.addEventListener("resize",b,!1)}}}var _scissorRect=null; cc.EGLView=cc.Class.extend({_delegate:null,_frameSize:null,_designResolutionSize:null,_originalDesignResolutionSize:null,_viewPortRect:null,_visibleRect:null,_retinaEnabled:!1,_autoFullScreen:!1,_devicePixelRatio:1,_viewName:"",_resizeCallback:null,_orientationChanging:!0,_scaleX:1,_originalScaleX:1,_scaleY:1,_originalScaleY:1,_isRotated:!1,_orientation:3,_resolutionPolicy:null,_rpExactFit:null,_rpShowAll:null,_rpNoBorder:null,_rpFixedHeight:null,_rpFixedWidth:null,_initialized:!1,_contentTranslateLeftTop:null, _frame:null,_frameZoomFactor:1,__resizeWithBrowserSize:!1,_isAdjustViewPort:!0,_targetDensityDPI:null,ctor:function(){var a=document,b=cc.ContainerStrategy,c=cc.ContentStrategy;__BrowserGetter.init(this);this._frame=cc.container.parentNode===a.body?a.documentElement:cc.container.parentNode;this._frameSize=cc.size(0,0);this._initFrameSize();var a=cc._canvas.width,d=cc._canvas.height;this._designResolutionSize=cc.size(a,d);this._originalDesignResolutionSize=cc.size(a,d);this._viewPortRect=cc.rect(0, 0,a,d);this._visibleRect=cc.rect(0,0,a,d);this._contentTranslateLeftTop={left:0,top:0};this._viewName="Cocos2dHTML5";a=cc.sys;this.enableRetina(a.os===a.OS_IOS||a.os===a.OS_OSX);this.enableAutoFullScreen(a.isMobile&&a.browserType!==a.BROWSER_TYPE_BAIDU);cc.visibleRect&&cc.visibleRect.init(this._visibleRect);this._rpExactFit=new cc.ResolutionPolicy(b.EQUAL_TO_FRAME,c.EXACT_FIT);this._rpShowAll=new cc.ResolutionPolicy(b.PROPORTION_TO_FRAME,c.SHOW_ALL);this._rpNoBorder=new cc.ResolutionPolicy(b.EQUAL_TO_FRAME, c.NO_BORDER);this._rpFixedHeight=new cc.ResolutionPolicy(b.EQUAL_TO_FRAME,c.FIXED_HEIGHT);this._rpFixedWidth=new cc.ResolutionPolicy(b.EQUAL_TO_FRAME,c.FIXED_WIDTH);this._targetDensityDPI=cc.DENSITYDPI_HIGH},_resizeEvent:function(){var a;a=this.setDesignResolutionSize?this:cc.view;var b=a._frameSize.width,c=a._frameSize.height,d=a._isRotated;a._initFrameSize();if(a._isRotated!==d||a._frameSize.width!==b||a._frameSize.height!==c)b=a._originalDesignResolutionSize.width,c=a._originalDesignResolutionSize.height, 0<b&&a.setDesignResolutionSize(b,c,a._resolutionPolicy),cc.eventManager.dispatchCustomEvent("canvas-resize"),a._resizeCallback&&a._resizeCallback.call()},_orientationChange:function(){cc.view._orientationChanging=!0;cc.view._resizeEvent()},setTargetDensityDPI:function(a){this._targetDensityDPI=a;this._adjustViewportMeta()},getTargetDensityDPI:function(){return this._targetDensityDPI},resizeWithBrowserSize:function(a){a?this.__resizeWithBrowserSize||(this.__resizeWithBrowserSize=!0,window.addEventListener("resize", this._resizeEvent),window.addEventListener("orientationchange",this._orientationChange)):this.__resizeWithBrowserSize&&(this.__resizeWithBrowserSize=!1,window.removeEventListener("resize",this._resizeEvent),window.removeEventListener("orientationchange",this._orientationChange))},setResizeCallback:function(a){if("function"===typeof a||null==a)this._resizeCallback=a},setOrientation:function(a){if(a&=cc.ORIENTATION_AUTO)this._orientation=a,this.setDesignResolutionSize(this._originalDesignResolutionSize.width, this._originalDesignResolutionSize.height,this._resolutionPolicy)},setDocumentPixelWidth:function(a){this._setViewportMeta({width:a},!0);document.documentElement.style.width=a+"px";document.body.style.width="100%";this.setDesignResolutionSize(this._designResolutionSize.width,this._designResolutionSize.height,this._resolutionPolicy)},_initFrameSize:function(){var a=this._frameSize,b=__BrowserGetter.availWidth(this._frame),c=__BrowserGetter.availHeight(this._frame),d=b>=c;!this._orientationChanging|| !cc.sys.isMobile||d&&this._orientation&cc.ORIENTATION_LANDSCAPE||!d&&this._orientation&cc.ORIENTATION_PORTRAIT?(a.width=b,a.height=c,cc.container.style["-webkit-transform"]="rotate(0deg)",cc.container.style.transform="rotate(0deg)",this._isRotated=!1):(a.width=c,a.height=b,cc.container.style["-webkit-transform"]="rotate(90deg)",cc.container.style.transform="rotate(90deg)",cc.container.style["-webkit-transform-origin"]="0px 0px 0px",cc.container.style.transformOrigin="0px 0px 0px",this._isRotated= !0);setTimeout(function(){cc.view._orientationChanging=!1},1E3)},_adjustSizeKeepCanvasSize:function(){var a=this._originalDesignResolutionSize.width,b=this._originalDesignResolutionSize.height;0<a&&this.setDesignResolutionSize(a,b,this._resolutionPolicy)},_setViewportMeta:function(a,b){var c=document.getElementById("cocosMetaElement");c&&b&&document.head.removeChild(c);var d=document.getElementsByName("viewport"),d=d?d[0]:null,e,f,g;e=d?d.content:"";c=c||document.createElement("meta");c.id="cocosMetaElement"; c.name="viewport";c.content="";for(f in a)-1==e.indexOf(f)?e+=","+f+"\x3d"+a[f]:b&&(g=RegExp(f+"s*\x3ds*[^,]+"),e.replace(g,f+"\x3d"+a[f]));/^,/.test(e)&&(e=e.substr(1));c.content=e;d&&(d.content=e);document.head.appendChild(c)},_adjustViewportMeta:function(){this._isAdjustViewPort&&(this._setViewportMeta(__BrowserGetter.meta,!1),this._isAdjustViewPort=!1)},_setScaleXYForRenderTexture:function(){var a=cc.contentScaleFactor();this._scaleY=this._scaleX=a},_resetScale:function(){this._scaleX=this._originalScaleX; this._scaleY=this._originalScaleY},_adjustSizeToBrowser:function(){},initialize:function(){this._initialized=!0},adjustViewPort:function(a){this._isAdjustViewPort=a},enableRetina:function(a){this._retinaEnabled=!!a},isRetinaEnabled:function(){return this._retinaEnabled},enableAutoFullScreen:function(a){a&&a!==this._autoFullScreen&&cc.sys.isMobile&&this._frame===document.documentElement?(this._autoFullScreen=!0,cc.screen.autoFullScreen(this._frame)):this._autoFullScreen=!1},isAutoFullScreenEnabled:function(){return this._autoFullScreen}, end:function(){},isOpenGLReady:function(){return cc.game.canvas&&cc._renderContext},setFrameZoomFactor:function(a){this._frameZoomFactor=a;this.centerWindow();cc.director.setProjection(cc.director.getProjection())},swapBuffers:function(){},setIMEKeyboardState:function(a){},setContentTranslateLeftTop:function(a,b){this._contentTranslateLeftTop={left:a,top:b}},getContentTranslateLeftTop:function(){return this._contentTranslateLeftTop},getCanvasSize:function(){return cc.size(cc._canvas.width,cc._canvas.height)}, getFrameSize:function(){return cc.size(this._frameSize.width,this._frameSize.height)},setFrameSize:function(a,b){this._frameSize.width=a;this._frameSize.height=b;this._frame.style.width=a+"px";this._frame.style.height=b+"px";this._resizeEvent();cc.director.setProjection(cc.director.getProjection())},centerWindow:function(){},getVisibleSize:function(){return cc.size(this._visibleRect.width,this._visibleRect.height)},getVisibleSizeInPixel:function(){return cc.size(this._visibleRect.width*this._scaleX, this._visibleRect.height*this._scaleY)},getVisibleOrigin:function(){return cc.p(this._visibleRect.x,this._visibleRect.y)},getVisibleOriginInPixel:function(){return cc.p(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},canSetContentScaleFactor:function(){return!0},getResolutionPolicy:function(){return this._resolutionPolicy},setResolutionPolicy:function(a){if(a instanceof cc.ResolutionPolicy)this._resolutionPolicy=a;else{var b=cc.ResolutionPolicy;a===b.EXACT_FIT&&(this._resolutionPolicy= this._rpExactFit);a===b.SHOW_ALL&&(this._resolutionPolicy=this._rpShowAll);a===b.NO_BORDER&&(this._resolutionPolicy=this._rpNoBorder);a===b.FIXED_HEIGHT&&(this._resolutionPolicy=this._rpFixedHeight);a===b.FIXED_WIDTH&&(this._resolutionPolicy=this._rpFixedWidth)}},setDesignResolutionSize:function(a,b,c){if(0<a||0<b)if(this.setResolutionPolicy(c),(c=this._resolutionPolicy)&&c.preApply(this),cc.sys.isMobile&&this._adjustViewportMeta(),this._orientationChanging=!0,this._initFrameSize(),c){this._originalDesignResolutionSize.width= this._designResolutionSize.width=a;this._originalDesignResolutionSize.height=this._designResolutionSize.height=b;var d=c.apply(this,this._designResolutionSize);d.scale&&2===d.scale.length&&(this._scaleX=d.scale[0],this._scaleY=d.scale[1]);d.viewport&&(a=this._viewPortRect,b=this._visibleRect,d=d.viewport,a.x=d.x,a.y=d.y,a.width=d.width,a.height=d.height,b.x=-a.x/this._scaleX,b.y=-a.y/this._scaleY,b.width=cc._canvas.width/this._scaleX,b.height=cc._canvas.height/this._scaleY,cc._renderContext.setOffset&& cc._renderContext.setOffset(a.x,-a.y));a=cc.director;a._winSizeInPoints.width=this._designResolutionSize.width;a._winSizeInPoints.height=this._designResolutionSize.height;c.postApply(this);cc.winSize.width=a._winSizeInPoints.width;cc.winSize.height=a._winSizeInPoints.height;cc._renderType===cc.game.RENDER_TYPE_WEBGL?a.setGLDefaultValues():cc._renderType===cc.game.RENDER_TYPE_CANVAS&&(cc.renderer._allNeedDraw=!0);this._originalScaleX=this._scaleX;this._originalScaleY=this._scaleY;cc.visibleRect&&cc.visibleRect.init(this._visibleRect)}else cc.log(cc._LogInfos.EGLView_setDesignResolutionSize_2); else cc.log(cc._LogInfos.EGLView_setDesignResolutionSize)},getDesignResolutionSize:function(){return cc.size(this._designResolutionSize.width,this._designResolutionSize.height)},setRealPixelResolution:function(a,b,c){this._setViewportMeta({width:a},!0);document.documentElement.style.width=a+"px";document.body.style.width="100%";this.setDesignResolutionSize(a,b,c)},setViewPortInPoints:function(a,b,c,d){var e=this._frameZoomFactor,f=this._scaleX,g=this._scaleY;cc._renderContext.viewport(a*f*e+this._viewPortRect.x* e,b*g*e+this._viewPortRect.y*e,c*f*e,d*g*e)},setScissorInPoints:function(a,b,c,d){var e=this._frameZoomFactor,f=this._scaleX,g=this._scaleY;a=Math.ceil(a*f*e+this._viewPortRect.x*e);b=Math.ceil(b*g*e+this._viewPortRect.y*e);c=Math.ceil(c*f*e);d=Math.ceil(d*g*e);_scissorRect||(e=gl.getParameter(gl.SCISSOR_BOX),_scissorRect=cc.rect(e[0],e[1],e[2],e[3]));if(_scissorRect.x!=a||_scissorRect.y!=b||_scissorRect.width!=c||_scissorRect.height!=d)_scissorRect.x=a,_scissorRect.y=b,_scissorRect.width=c,_scissorRect.height= d,cc._renderContext.scissor(a,b,c,d)},isScissorEnabled:function(){return cc._renderContext.isEnabled(gl.SCISSOR_TEST)},getScissorRect:function(){if(!_scissorRect){var a=gl.getParameter(gl.SCISSOR_BOX);_scissorRect=cc.rect(a[0],a[1],a[2],a[3])}var a=this._scaleX,b=this._scaleY;return cc.rect((_scissorRect.x-this._viewPortRect.x)/a,(_scissorRect.y-this._viewPortRect.y)/b,_scissorRect.width/a,_scissorRect.height/b)},setViewName:function(a){null!=a&&0<a.length&&(this._viewName=a)},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(a,b,c){a=this._devicePixelRatio*(a-c.left);b=this._devicePixelRatio*(c.top+c.height-b);return this._isRotated?{x:this._viewPortRect.width-b,y:a}:{x:a,y:b}},_convertMouseToLocationInView:function(a,b){var c=this._viewPortRect;a.x=(this._devicePixelRatio*(a.x-b.left)-c.x)/ this._scaleX;a.y=(this._devicePixelRatio*(b.top+b.height-a.y)-c.y)/this._scaleY},_convertPointWithScale:function(a){var b=this._viewPortRect;a.x=(a.x-b.x)/this._scaleX;a.y=(a.y-b.y)/this._scaleY},_convertTouchesWithScale:function(a){for(var b=this._viewPortRect,c=this._scaleX,d=this._scaleY,e,f,g=0;g<a.length;g++)e=a[g],f=e._point,e=e._prevPoint,f.x=(f.x-b.x)/c,f.y=(f.y-b.y)/d,e.x=(e.x-b.x)/c,e.y=(e.y-b.y)/d}}); cc.EGLView._getInstance=function(){this._instance||(this._instance=this._instance||new cc.EGLView,this._instance.initialize());return this._instance}; cc.ContainerStrategy=cc.Class.extend({preApply:function(a){},apply:function(a,b){},postApply:function(a){},_setupContainer:function(a,b,c){var d=cc.game.canvas,e=cc.game.container;cc.sys.isMobile&&(document.body.style.width=(a._isRotated?c:b)+"px",document.body.style.height=(a._isRotated?b:c)+"px");e.style.width=d.style.width=b+"px";e.style.height=d.style.height=c+"px";e=a._devicePixelRatio=1;a.isRetinaEnabled()&&(e=a._devicePixelRatio=Math.min(2,window.devicePixelRatio||1));d.width=b*e;d.height= c*e;cc._renderContext.resetCache&&cc._renderContext.resetCache()},_fixContainer:function(){document.body.insertBefore(cc.container,document.body.firstChild);var a=document.body.style;a.width=window.innerWidth+"px";a.height=window.innerHeight+"px";a.overflow="hidden";a=cc.container.style;a.position="fixed";a.left=a.top="0px";document.body.scrollTop=0}}); cc.ContentStrategy=cc.Class.extend({_result:{scale:[1,1],viewport:null},_buildResult:function(a,b,c,d,e,f){2>Math.abs(a-c)&&(c=a);2>Math.abs(b-d)&&(d=b);a=cc.rect(Math.round((a-c)/2),Math.round((b-d)/2),c,d);this._result.scale=[e,f];this._result.viewport=a;return this._result},preApply:function(a){},apply:function(a,b){return{scale:[1,1]}},postApply:function(a){}}); (function(){var a=cc.ContainerStrategy.extend({apply:function(a){var b=a._frameSize.height,c=cc.container.style;this._setupContainer(a,a._frameSize.width,a._frameSize.height);a._isRotated?c.marginLeft=b+"px":c.margin="0px"}}),b=cc.ContainerStrategy.extend({apply:function(a,b){var c=a._frameSize.width,d=a._frameSize.height,e=cc.container.style,n=b.width,p=b.height,r=c/n,s=d/p,u,t;r<s?(u=c,t=p*r):(u=n*s,t=d);n=Math.round((c-u)/2);t=Math.round((d-t)/2);this._setupContainer(a,c-2*n,d-2*t);a._isRotated? e.marginLeft=d+"px":e.margin="0px";e.paddingLeft=n+"px";e.paddingRight=n+"px";e.paddingTop=t+"px";e.paddingBottom=t+"px"}});a.extend({preApply:function(a){this._super(a);a._frame=document.documentElement},apply:function(a){this._super(a);this._fixContainer()}});b.extend({preApply:function(a){this._super(a);a._frame=document.documentElement},apply:function(a,b){this._super(a,b);this._fixContainer()}});var c=cc.ContainerStrategy.extend({apply:function(a){this._setupContainer(a,cc._canvas.width,cc._canvas.height)}}); cc.ContainerStrategy.EQUAL_TO_FRAME=new a;cc.ContainerStrategy.PROPORTION_TO_FRAME=new b;cc.ContainerStrategy.ORIGINAL_CONTAINER=new c;var a=cc.ContentStrategy.extend({apply:function(a,b){var c=cc._canvas.width,d=cc._canvas.height;return this._buildResult(c,d,c,d,c/b.width,d/b.height)}}),b=cc.ContentStrategy.extend({apply:function(a,b){var c=cc._canvas.width,d=cc._canvas.height,e=b.width,n=b.height,p=c/e,r=d/n,s=0,u,t;p<r?(s=p,u=c,t=n*s):(s=r,u=e*s,t=d);return this._buildResult(c,d,u,t,s,s)}}),c= cc.ContentStrategy.extend({apply:function(a,b){var c=cc._canvas.width,d=cc._canvas.height,e=b.width,n=b.height,p=c/e,r=d/n,s,u,t;p<r?(s=r,u=e*s,t=d):(s=p,u=c,t=n*s);return this._buildResult(c,d,u,t,s,s)}}),d=cc.ContentStrategy.extend({apply:function(a,b){var c=cc._canvas.width,d=cc._canvas.height,e=d/b.height;return this._buildResult(c,d,c,d,e,e)},postApply:function(a){cc.director._winSizeInPoints=a.getVisibleSize()}}),e=cc.ContentStrategy.extend({apply:function(a,b){var c=cc._canvas.width,d=cc._canvas.height, e=c/b.width;return this._buildResult(c,d,c,d,e,e)},postApply:function(a){cc.director._winSizeInPoints=a.getVisibleSize()}});cc.ContentStrategy.EXACT_FIT=new a;cc.ContentStrategy.SHOW_ALL=new b;cc.ContentStrategy.NO_BORDER=new c;cc.ContentStrategy.FIXED_HEIGHT=new d;cc.ContentStrategy.FIXED_WIDTH=new e})(); cc.ResolutionPolicy=cc.Class.extend({_containerStrategy:null,_contentStrategy:null,ctor:function(a,b){this.setContainerStrategy(a);this.setContentStrategy(b)},preApply:function(a){this._containerStrategy.preApply(a);this._contentStrategy.preApply(a)},apply:function(a,b){this._containerStrategy.apply(a,b);return this._contentStrategy.apply(a,b)},postApply:function(a){this._containerStrategy.postApply(a);this._contentStrategy.postApply(a)},setContainerStrategy:function(a){a instanceof cc.ContainerStrategy&& (this._containerStrategy=a)},setContentStrategy:function(a){a instanceof cc.ContentStrategy&&(this._contentStrategy=a)}});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.screen={_supportsFullScreen:!1,_preOnFullScreenChange:null,_touchEvent:"",_fn:null,_fnMap:[["requestFullscreen","exitFullscreen","fullscreenchange","fullscreenEnabled","fullscreenElement"],["requestFullScreen","exitFullScreen","fullScreenchange","fullScreenEnabled","fullScreenElement"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitfullscreenchange","webkitIsFullScreen","webkitCurrentFullScreenElement"],["mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozFullScreen", "mozFullScreenElement"],["msRequestFullscreen","msExitFullscreen","MSFullscreenChange","msFullscreenEnabled","msFullscreenElement"]],init:function(){this._fn={};var a,b,c=this._fnMap,d;a=0;for(l=c.length;a<l;a++)if((b=c[a])&&b[1]in document){a=0;for(d=b.length;a<d;a++)this._fn[c[0][a]]=b[a];break}this._supportsFullScreen="undefined"!==typeof this._fn.requestFullscreen;this._touchEvent="ontouchstart"in window?"touchstart":"mousedown"},fullScreen:function(){return this._supportsFullScreen?void 0=== document[this._fn.fullscreenElement]||null===document[this._fn.fullscreenElement]?!1:!0:!1},requestFullScreen:function(a,b){if(this._supportsFullScreen){a=a||document.documentElement;if(b){var c=this._fn.fullscreenchange;this._preOnFullScreenChange&&document.removeEventListener(c,this._preOnFullScreenChange);this._preOnFullScreenChange=b;document.addEventListener(c,b,!1)}return a[this._fn.requestFullscreen]()}},exitFullScreen:function(){return this._supportsFullScreen?document[this._fn.exitFullscreen](): !0},autoFullScreen:function(a,b){function c(){d.removeEventListener(e._touchEvent,c);e.requestFullScreen(a,b)}a=a||document.body;var d=cc.game.canvas||a,e=this;this.requestFullScreen(a,b);d.addEventListener(this._touchEvent,c)}};cc.screen.init();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(a){var b=this.width=a.width,c=this.height=a.height,d=a.x;a=a.y;var e=a+c,f=d+b;this.topLeft.x=d;this.topLeft.y=e;this.topRight.x=f;this.topRight.y=e;this.top.x=d+b/2;this.top.y=e;this.bottomLeft.x=d;this.bottomLeft.y=a;this.bottomRight.x=f;this.bottomRight.y=a;this.bottom.x=d+b/2;this.bottom.y= a;this.center.x=d+b/2;this.center.y=a+c/2;this.left.x=d;this.left.y=a+c/2;this.right.x=f;this.right.y=a+c/2}};cc.UIInterfaceOrientationLandscapeLeft=-90;cc.UIInterfaceOrientationLandscapeRight=90;cc.UIInterfaceOrientationPortraitUpsideDown=180;cc.UIInterfaceOrientationPortrait=0; cc.inputManager={TOUCH_TIMEOUT:5E3,_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(){for(var a=this._indexBitsUsed,b=cc.sys.now(),c=0;c<this._maxTouches;c++){if(a&1){var d=this._touches[c];if(b-d._lastModified>this.TOUCH_TIMEOUT)return this._removeUsedIndexBit(c), delete this._touchesIntegerDict[d.getID()],c}else return this._indexBitsUsed|=1<<c,c;a>>=1}return-1},_removeUsedIndexBit:function(a){0>a||a>=this._maxTouches||(a=~(1<<a),this._indexBitsUsed&=a)},_glView:null,handleTouchesBegin:function(a){for(var b,c,d,e=[],f=this._touchesIntegerDict,g=cc.sys.now(),h=0,k=a.length;h<k;h++)if(b=a[h],d=b.getID(),c=f[d],null==c){var m=this._getUnUsedIndex();-1===m?cc.log(cc._LogInfos.inputManager_handleTouchesBegin,m):(c=this._touches[m]=new cc.Touch(b._point.x,b._point.y, b.getID()),c._lastModified=g,c._setPrevPoint(b._prevPoint),f[d]=m,e.push(c))}0<e.length&&(this._glView._convertTouchesWithScale(e),a=new cc.EventTouch(e),a._eventCode=cc.EventTouch.EventCode.BEGAN,cc.eventManager.dispatchEvent(a))},handleTouchesMove:function(a){for(var b,c,d=[],e=this._touches,f=cc.sys.now(),g=0,h=a.length;g<h;g++)b=a[g],c=b.getID(),c=this._touchesIntegerDict[c],null!=c&&e[c]&&(e[c]._setPoint(b._point),e[c]._setPrevPoint(b._prevPoint),e[c]._lastModified=f,d.push(e[c]));0<d.length&& (this._glView._convertTouchesWithScale(d),a=new cc.EventTouch(d),a._eventCode=cc.EventTouch.EventCode.MOVED,cc.eventManager.dispatchEvent(a))},handleTouchesEnd:function(a){a=this.getSetOfTouchesEndOrCancel(a);0<a.length&&(this._glView._convertTouchesWithScale(a),a=new cc.EventTouch(a),a._eventCode=cc.EventTouch.EventCode.ENDED,cc.eventManager.dispatchEvent(a))},handleTouchesCancel:function(a){a=this.getSetOfTouchesEndOrCancel(a);0<a.length&&(this._glView._convertTouchesWithScale(a),a=new cc.EventTouch(a), a._eventCode=cc.EventTouch.EventCode.CANCELLED,cc.eventManager.dispatchEvent(a))},getSetOfTouchesEndOrCancel:function(a){for(var b,c,d,e=[],f=this._touches,g=this._touchesIntegerDict,h=0,k=a.length;h<k;h++)b=a[h],d=b.getID(),c=g[d],null!=c&&f[c]&&(f[c]._setPoint(b._point),f[c]._setPrevPoint(b._prevPoint),e.push(f[c]),this._removeUsedIndexBit(c),delete g[d]);return e},getHTMLElementPosition:function(a){var b=document.documentElement,c=window,d=null,d=cc.isFunction(a.getBoundingClientRect)?a.getBoundingClientRect(): {left:0,top:0,width:parseInt(a.style.width),height:parseInt(a.style.height)};return{left:d.left+c.pageXOffset-b.clientLeft,top:d.top+c.pageYOffset-b.clientTop,width:d.width,height:d.height}},getPreTouch:function(a){for(var b=null,c=this._preTouchPool,d=a.getID(),e=c.length-1;0<=e;e--)if(c[e].getID()===d){b=c[e];break}b||(b=a);return b},setPreTouch:function(a){for(var b=!1,c=this._preTouchPool,d=a.getID(),e=c.length-1;0<=e;e--)if(c[e].getID()===d){c[e]=a;b=!0;break}b||(50>=c.length?c.push(a):(c[this._preTouchPoolPointer]= a,this._preTouchPoolPointer=(this._preTouchPoolPointer+1)%50))},getTouchByXY:function(a,b,c){var d=this._preTouchPoint;a=this._glView.convertToLocationInView(a,b,c);b=new cc.Touch(a.x,a.y);b._setPrevPoint(d.x,d.y);d.x=a.x;d.y=a.y;return b},getMouseEvent:function(a,b,c){var d=this._prevMousePoint;this._glView._convertMouseToLocationInView(a,b);b=new cc.EventMouse(c);b.setLocation(a.x,a.y);b._setPrevCursor(d.x,d.y);d.x=a.x;d.y=a.y;return b},getPointByEvent:function(a,b){if(null!=a.pageX)return{x:a.pageX, y:a.pageY};b.left-=document.body.scrollLeft;b.top-=document.body.scrollTop;return{x:a.clientX,y:a.clientY}},getTouchesByEvent:function(a,b){for(var c=[],d=this._glView,e,f,g=this._preTouchPoint,h=a.changedTouches.length,k=0;k<h;k++)if(e=a.changedTouches[k]){var m;m=cc.sys.BROWSER_TYPE_FIREFOX===cc.sys.browserType?d.convertToLocationInView(e.pageX,e.pageY,b):d.convertToLocationInView(e.clientX,e.clientY,b);null!=e.identifier?(e=new cc.Touch(m.x,m.y,e.identifier),f=this.getPreTouch(e).getLocation(), e._setPrevPoint(f.x,f.y),this.setPreTouch(e)):(e=new cc.Touch(m.x,m.y),e._setPrevPoint(g.x,g.y));g.x=m.x;g.y=m.y;c.push(e)}return c},registerSystemEvent:function(a){if(!this._isRegisterEvent){this._glView=cc.view;var b=this,c="mouse"in cc.sys.capabilities,d="touches"in cc.sys.capabilities,e=!1;cc.sys.isMobile&&(e=!0);c&&(window.addEventListener("mousedown",function(){b._mousePressed=!0},!1),window.addEventListener("mouseup",function(c){if(!e){var d=b._mousePressed;b._mousePressed=!1;if(d){var d=b.getHTMLElementPosition(a), f=b.getPointByEvent(c,d);cc.rectContainsPoint(new cc.Rect(d.left,d.top,d.width,d.height),f)||(b.handleTouchesEnd([b.getTouchByXY(f.x,f.y,d)]),d=b.getMouseEvent(f,d,cc.EventMouse.UP),d.setButton(c.button),cc.eventManager.dispatchEvent(d))}}},!1),a.addEventListener("mousedown",function(c){if(!e){b._mousePressed=!0;var d=b.getHTMLElementPosition(a),f=b.getPointByEvent(c,d);b.handleTouchesBegin([b.getTouchByXY(f.x,f.y,d)]);d=b.getMouseEvent(f,d,cc.EventMouse.DOWN);d.setButton(c.button);cc.eventManager.dispatchEvent(d); c.stopPropagation();c.preventDefault();a.focus()}},!1),a.addEventListener("mouseup",function(c){if(!e){b._mousePressed=!1;var d=b.getHTMLElementPosition(a),f=b.getPointByEvent(c,d);b.handleTouchesEnd([b.getTouchByXY(f.x,f.y,d)]);d=b.getMouseEvent(f,d,cc.EventMouse.UP);d.setButton(c.button);cc.eventManager.dispatchEvent(d);c.stopPropagation();c.preventDefault()}},!1),a.addEventListener("mousemove",function(c){if(!e){var d=b.getHTMLElementPosition(a),f=b.getPointByEvent(c,d);b.handleTouchesMove([b.getTouchByXY(f.x, f.y,d)]);d=b.getMouseEvent(f,d,cc.EventMouse.MOVE);b._mousePressed?d.setButton(c.button):d.setButton(null);cc.eventManager.dispatchEvent(d);c.stopPropagation();c.preventDefault()}},!1),a.addEventListener("mousewheel",function(c){var d=b.getHTMLElementPosition(a),e=b.getPointByEvent(c,d),d=b.getMouseEvent(e,d,cc.EventMouse.SCROLL);d.setButton(c.button);d.setScrollData(0,c.wheelDelta);cc.eventManager.dispatchEvent(d);c.stopPropagation();c.preventDefault()},!1),a.addEventListener("DOMMouseScroll",function(c){var d= b.getHTMLElementPosition(a),e=b.getPointByEvent(c,d),d=b.getMouseEvent(e,d,cc.EventMouse.SCROLL);d.setButton(c.button);d.setScrollData(0,-120*c.detail);cc.eventManager.dispatchEvent(d);c.stopPropagation();c.preventDefault()},!1));if(window.navigator.msPointerEnabled){var c={MSPointerDown:b.handleTouchesBegin,MSPointerMove:b.handleTouchesMove,MSPointerUp:b.handleTouchesEnd,MSPointerCancel:b.handleTouchesCancel},f;for(f in c)(function(c,d){a.addEventListener(c,function(c){var e=b.getHTMLElementPosition(a); e.left-=document.documentElement.scrollLeft;e.top-=document.documentElement.scrollTop;d.call(b,[b.getTouchByXY(c.clientX,c.clientY,e)]);c.stopPropagation()},!1)})(f,c[f])}d&&(a.addEventListener("touchstart",function(c){if(c.changedTouches){var d=b.getHTMLElementPosition(a);d.left-=document.body.scrollLeft;d.top-=document.body.scrollTop;b.handleTouchesBegin(b.getTouchesByEvent(c,d));c.stopPropagation();c.preventDefault();a.focus()}},!1),a.addEventListener("touchmove",function(c){if(c.changedTouches){var d= b.getHTMLElementPosition(a);d.left-=document.body.scrollLeft;d.top-=document.body.scrollTop;b.handleTouchesMove(b.getTouchesByEvent(c,d));c.stopPropagation();c.preventDefault()}},!1),a.addEventListener("touchend",function(c){if(c.changedTouches){var d=b.getHTMLElementPosition(a);d.left-=document.body.scrollLeft;d.top-=document.body.scrollTop;b.handleTouchesEnd(b.getTouchesByEvent(c,d));c.stopPropagation();c.preventDefault()}},!1),a.addEventListener("touchcancel",function(c){if(c.changedTouches){var d= b.getHTMLElementPosition(a);d.left-=document.body.scrollLeft;d.top-=document.body.scrollTop;b.handleTouchesCancel(b.getTouchesByEvent(c,d));c.stopPropagation();c.preventDefault()}},!1));this._registerKeyboardEvent();this._registerAccelerometerEvent();this._isRegisterEvent=!0}},_registerKeyboardEvent:function(){},_registerAccelerometerEvent:function(){},update:function(a){this._accelCurTime>this._accelInterval&&(this._accelCurTime-=this._accelInterval,cc.eventManager.dispatchEvent(new cc.EventAcceleration(this._acceleration))); this._accelCurTime+=a}};_p=cc.inputManager;_p.setAccelerometerEnabled=function(a){this._accelEnabled!==a&&(this._accelEnabled=a,a=cc.director.getScheduler(),this._accelCurTime=0,a.scheduleUpdate(this))};_p.setAccelerometerInterval=function(a){this._accelInterval!==a&&(this._accelInterval=a)}; _p._registerKeyboardEvent=function(){cc._canvas.addEventListener("keydown",function(a){cc.eventManager.dispatchEvent(new cc.EventKeyboard(a.keyCode,!0));a.stopPropagation();a.preventDefault()},!1);cc._canvas.addEventListener("keyup",function(a){cc.eventManager.dispatchEvent(new cc.EventKeyboard(a.keyCode,!1));a.stopPropagation();a.preventDefault()},!1)}; _p._registerAccelerometerEvent=function(){var a=window;this._acceleration=new cc.Acceleration;this._accelDeviceEvent=a.DeviceMotionEvent||a.DeviceOrientationEvent;cc.sys.browserType===cc.sys.BROWSER_TYPE_MOBILE_QQ&&(this._accelDeviceEvent=window.DeviceOrientationEvent);var b=this._accelDeviceEvent===a.DeviceMotionEvent?"devicemotion":"deviceorientation",c=navigator.userAgent;if(/Android/.test(c)||/Adr/.test(c)&&cc.sys.browserType===cc.BROWSER_TYPE_UC)this._minus=-1;a.addEventListener(b,this.didAccelerate.bind(this), !1)}; _p.didAccelerate=function(a){var b=window;if(this._accelEnabled){var c=this._acceleration,d,e,f;this._accelDeviceEvent===window.DeviceMotionEvent?(f=a.accelerationIncludingGravity,d=this._accelMinus*f.x*0.1,e=this._accelMinus*f.y*0.1,f=0.1*f.z):(d=a.gamma/90*0.981,e=0.981*-(a.beta/90),f=a.alpha/90*0.981);c.x=d;c.y=e;c.z=f;c.timestamp=a.timeStamp||Date.now();a=c.x;b.orientation===cc.UIInterfaceOrientationLandscapeRight?(c.x=-c.y,c.y=a):b.orientation===cc.UIInterfaceOrientationLandscapeLeft?(c.x=c.y, c.y=-a):b.orientation===cc.UIInterfaceOrientationPortraitUpsideDown&&(c.x=-c.x,c.y=-c.y)}};delete _p;cc.AffineTransform=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.tx=e;this.ty=f};cc.affineTransformMake=function(a,b,c,d,e,f){return{a:a,b:b,c:c,d:d,tx:e,ty:f}};cc.pointApplyAffineTransform=function(a,b,c){var d;void 0===c?(c=b,d=a.x,a=a.y):(d=a,a=b);return{x:c.a*d+c.c*a+c.tx,y:c.b*d+c.d*a+c.ty}};cc._pointApplyAffineTransform=function(a,b,c){return cc.pointApplyAffineTransform(a,b,c)}; cc.sizeApplyAffineTransform=function(a,b){return{width:b.a*a.width+b.c*a.height,height:b.b*a.width+b.d*a.height}};cc.affineTransformMakeIdentity=function(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}};cc.affineTransformIdentity=function(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}}; cc.rectApplyAffineTransform=function(a,b){var c=cc.rectGetMinY(a),d=cc.rectGetMinX(a),e=cc.rectGetMaxX(a),f=cc.rectGetMaxY(a),g=cc.pointApplyAffineTransform(d,c,b),c=cc.pointApplyAffineTransform(e,c,b),d=cc.pointApplyAffineTransform(d,f,b),h=cc.pointApplyAffineTransform(e,f,b),e=Math.min(g.x,c.x,d.x,h.x),f=Math.max(g.x,c.x,d.x,h.x),k=Math.min(g.y,c.y,d.y,h.y),g=Math.max(g.y,c.y,d.y,h.y);return cc.rect(e,k,f-e,g-k)}; cc._rectApplyAffineTransformIn=function(a,b){var c=cc.rectGetMinY(a),d=cc.rectGetMinX(a),e=cc.rectGetMaxX(a),f=cc.rectGetMaxY(a),g=cc.pointApplyAffineTransform(d,c,b),c=cc.pointApplyAffineTransform(e,c,b),d=cc.pointApplyAffineTransform(d,f,b),h=cc.pointApplyAffineTransform(e,f,b),e=Math.min(g.x,c.x,d.x,h.x),f=Math.max(g.x,c.x,d.x,h.x),k=Math.min(g.y,c.y,d.y,h.y),g=Math.max(g.y,c.y,d.y,h.y);a.x=e;a.y=k;a.width=f-e;a.height=g-k;return a}; cc.affineTransformTranslate=function(a,b,c){return{a:a.a,b:a.b,c:a.c,d:a.d,tx:a.tx+a.a*b+a.c*c,ty:a.ty+a.b*b+a.d*c}};cc.affineTransformScale=function(a,b,c){return{a:a.a*b,b:a.b*b,c:a.c*c,d:a.d*c,tx:a.tx,ty:a.ty}};cc.affineTransformRotate=function(a,b){var c=Math.sin(b),d=Math.cos(b);return{a:a.a*d+a.c*c,b:a.b*d+a.d*c,c:a.c*d-a.a*c,d:a.d*d-a.b*c,tx:a.tx,ty:a.ty}}; cc.affineTransformConcat=function(a,b){return{a:a.a*b.a+a.b*b.c,b:a.a*b.b+a.b*b.d,c:a.c*b.a+a.d*b.c,d:a.c*b.b+a.d*b.d,tx:a.tx*b.a+a.ty*b.c+b.tx,ty:a.tx*b.b+a.ty*b.d+b.ty}};cc.affineTransformConcatIn=function(a,b){var c=a.a,d=a.b,e=a.c,f=a.d,g=a.tx,h=a.ty;a.a=c*b.a+d*b.c;a.b=c*b.b+d*b.d;a.c=e*b.a+f*b.c;a.d=e*b.b+f*b.d;a.tx=g*b.a+h*b.c+b.tx;a.ty=g*b.b+h*b.d+b.ty;return a};cc.affineTransformEqualToTransform=function(a,b){return a.a===b.a&&a.b===b.b&&a.c===b.c&&a.d===b.d&&a.tx===b.tx&&a.ty===b.ty}; cc.affineTransformInvert=function(a){var b=1/(a.a*a.d-a.b*a.c);return{a:b*a.d,b:-b*a.b,c:-b*a.c,d:b*a.a,tx:b*(a.c*a.ty-a.d*a.tx),ty:b*(a.b*a.tx-a.a*a.ty)}};cc.affineTransformInvertOut=function(a,b){var c=a.a,d=a.b,e=a.c,f=a.d,g=1/(c*f-d*e);b.a=g*f;b.b=-g*d;b.c=-g*e;b.d=g*c;b.tx=g*(e*a.ty-f*a.tx);b.ty=g*(d*a.tx-c*a.ty)};cc.POINT_EPSILON=parseFloat("1.192092896e-07F");cc.pNeg=function(a){return cc.p(-a.x,-a.y)};cc.pAdd=function(a,b){return cc.p(a.x+b.x,a.y+b.y)};cc.pSub=function(a,b){return cc.p(a.x-b.x,a.y-b.y)};cc.pMult=function(a,b){return cc.p(a.x*b,a.y*b)};cc.pMidpoint=function(a,b){return cc.pMult(cc.pAdd(a,b),0.5)};cc.pDot=function(a,b){return a.x*b.x+a.y*b.y};cc.pCross=function(a,b){return a.x*b.y-a.y*b.x};cc.pPerp=function(a){return cc.p(-a.y,a.x)};cc.pRPerp=function(a){return cc.p(a.y,-a.x)}; cc.pProject=function(a,b){return cc.pMult(b,cc.pDot(a,b)/cc.pDot(b,b))};cc.pRotate=function(a,b){return cc.p(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x)};cc.pUnrotate=function(a,b){return cc.p(a.x*b.x+a.y*b.y,a.y*b.x-a.x*b.y)};cc.pLengthSQ=function(a){return cc.pDot(a,a)};cc.pDistanceSQ=function(a,b){return cc.pLengthSQ(cc.pSub(a,b))};cc.pLength=function(a){return Math.sqrt(cc.pLengthSQ(a))};cc.pDistance=function(a,b){return cc.pLength(cc.pSub(a,b))}; cc.pNormalize=function(a){var b=cc.pLength(a);return 0===b?cc.p(a):cc.pMult(a,1/b)};cc.pForAngle=function(a){return cc.p(Math.cos(a),Math.sin(a))};cc.pToAngle=function(a){return Math.atan2(a.y,a.x)};cc.clampf=function(a,b,c){if(b>c){var d=b;b=c;c=d}return a<b?b:a<c?a:c};cc.pClamp=function(a,b,c){return cc.p(cc.clampf(a.x,b.x,c.x),cc.clampf(a.y,b.y,c.y))};cc.pFromSize=function(a){return cc.p(a.width,a.height)};cc.pCompOp=function(a,b){return cc.p(b(a.x),b(a.y))}; cc.pLerp=function(a,b,c){return cc.pAdd(cc.pMult(a,1-c),cc.pMult(b,c))};cc.pFuzzyEqual=function(a,b,c){return a.x-c<=b.x&&b.x<=a.x+c&&a.y-c<=b.y&&b.y<=a.y+c?!0:!1};cc.pCompMult=function(a,b){return cc.p(a.x*b.x,a.y*b.y)};cc.pAngleSigned=function(a,b){var c=cc.pNormalize(a),d=cc.pNormalize(b),c=Math.atan2(c.x*d.y-c.y*d.x,cc.pDot(c,d));return Math.abs(c)<cc.POINT_EPSILON?0:c};cc.pAngle=function(a,b){var c=Math.acos(cc.pDot(cc.pNormalize(a),cc.pNormalize(b)));return Math.abs(c)<cc.POINT_EPSILON?0:c}; cc.pRotateByAngle=function(a,b,c){a=cc.pSub(a,b);var d=Math.cos(c);c=Math.sin(c);var e=a.x;a.x=e*d-a.y*c+b.x;a.y=e*c+a.y*d+b.y;return a};cc.pLineIntersect=function(a,b,c,d,e){if(a.x===b.x&&a.y===b.y||c.x===d.x&&c.y===d.y)return!1;var f=b.x-a.x;b=b.y-a.y;var g=d.x-c.x;d=d.y-c.y;var h=a.x-c.x;a=a.y-c.y;c=d*f-g*b;e.x=g*a-d*h;e.y=f*a-b*h;if(0===c)return 0===e.x||0===e.y?!0:!1;e.x/=c;e.y/=c;return!0}; cc.pSegmentIntersect=function(a,b,c,d){var e=cc.p(0,0);return cc.pLineIntersect(a,b,c,d,e)&&0<=e.x&&1>=e.x&&0<=e.y&&1>=e.y?!0:!1};cc.pIntersectPoint=function(a,b,c,d){var e=cc.p(0,0);return cc.pLineIntersect(a,b,c,d,e)?(c=cc.p(0,0),c.x=a.x+e.x*(b.x-a.x),c.y=a.y+e.x*(b.y-a.y),c):cc.p(0,0)};cc.pSameAs=function(a,b){return null!=a&&null!=b?a.x===b.x&&a.y===b.y:!1};cc.pZeroIn=function(a){a.x=0;a.y=0};cc.pIn=function(a,b){a.x=b.x;a.y=b.y};cc.pMultIn=function(a,b){a.x*=b;a.y*=b}; cc.pSubIn=function(a,b){a.x-=b.x;a.y-=b.y};cc.pAddIn=function(a,b){a.x+=b.x;a.y+=b.y};cc.pNormalizeIn=function(a){cc.pMultIn(a,1/Math.sqrt(a.x*a.x+a.y*a.y))};cc.vertexLineToPolygon=function(a,b,c,d,e){e+=d;if(!(1>=e)){b*=0.5;for(var f,g=e-1,h=d;h<e;h++){f=2*h;var k=cc.p(a[2*h],a[2*h+1]),m;if(0===h)m=cc.pPerp(cc.pNormalize(cc.pSub(k,cc.p(a[2*(h+1)],a[2*(h+1)+1]))));else if(h===g)m=cc.pPerp(cc.pNormalize(cc.pSub(cc.p(a[2*(h-1)],a[2*(h-1)+1]),k)));else{m=cc.p(a[2*(h-1)],a[2*(h-1)+1]);var n=cc.p(a[2*(h+1)],a[2*(h+1)+1]),p=cc.pNormalize(cc.pSub(n,k)),r=cc.pNormalize(cc.pSub(m,k)),s=Math.acos(cc.pDot(p,r));m=s<cc.degreesToRadians(70)?cc.pPerp(cc.pNormalize(cc.pMidpoint(p, r))):s<cc.degreesToRadians(170)?cc.pNormalize(cc.pMidpoint(p,r)):cc.pPerp(cc.pNormalize(cc.pSub(n,m)))}m=cc.pMult(m,b);c[2*f]=k.x+m.x;c[2*f+1]=k.y+m.y;c[2*(f+1)]=k.x-m.x;c[2*(f+1)+1]=k.y-m.y}for(h=0===d?0:d-1;h<g;h++)f=2*h,a=f+2,b=cc.vertex2(c[2*f],c[2*f+1]),e=cc.vertex2(c[2*(f+1)],c[2*(f+1)+1]),f=cc.vertex2(c[2*a],c[2*a]),d=cc.vertex2(c[2*(a+1)],c[2*(a+1)+1]),b=!cc.vertexLineIntersect(b.x,b.y,d.x,d.y,e.x,e.y,f.x,f.y),!b.isSuccess&&(0>b.value||1<b.value)&&(b.isSuccess=!0),b.isSuccess&&(c[2*a]=d.x, c[2*a+1]=d.y,c[2*(a+1)]=f.x,c[2*(a+1)+1]=f.y)}};cc.vertexLineIntersect=function(a,b,c,d,e,f,g,h){if(a===c&&b===d||e===g&&f===h)return{isSuccess:!1,value:0};c-=a;d-=b;e-=a;f-=b;g-=a;h-=b;a=Math.sqrt(c*c+d*d);c/=a;d/=a;b=e*c+f*d;f=f*c-e*d;e=b;b=g*c+h*d;h=h*c-g*d;g=b;return f===h?{isSuccess:!1,value:0}:{isSuccess:!0,value:(g+(e-g)*h/(h-f))/a}};cc.vertexListIsClockwise=function(a){for(var b=0,c=a.length;b<c;b++){var d=a[(b+1)%c],e=a[(b+2)%c];if(0<cc.pCross(cc.pSub(d,a[b]),cc.pSub(e,d)))return!1}return!0};cc.CGAffineToGL=function(a,b){b[2]=b[3]=b[6]=b[7]=b[8]=b[9]=b[11]=b[14]=0;b[10]=b[15]=1;b[0]=a.a;b[4]=a.c;b[12]=a.tx;b[1]=a.b;b[5]=a.d;b[13]=a.ty};cc.GLToCGAffine=function(a,b){b.a=a[0];b.c=a[4];b.tx=a[12];b.b=a[1];b.d=a[5];b.ty=a[13]};cc.Touch=cc.Class.extend({_lastModified:0,_point:null,_prevPoint:null,_id:0,_startPointCaptured:!1,_startPoint:null,ctor:function(a,b,c){this.setTouchInfo(c,a,b)},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(){cc.log("getId is deprecated. Please use getID instead.");return this._id},setTouchInfo:function(a,b,c){this._prevPoint=this._point;this._point=cc.p(b||0,c||0);this._id=a;this._startPointCaptured|| (this._startPoint=cc.p(this._point),cc.view._convertPointWithScale(this._startPoint),this._startPointCaptured=!0)},_setPoint:function(a,b){void 0===b?(this._point.x=a.x,this._point.y=a.y):(this._point.x=a,this._point.y=b)},_setPrevPoint:function(a,b){this._prevPoint=void 0===b?cc.p(a.x,a.y):cc.p(a||0,b||0)}});cc.Event=cc.Class.extend({_type:0,_isStopped:!1,_currentTarget:null,_setCurrentTarget:function(a){this._currentTarget=a},ctor:function(a){this._type=a},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.FOCUS=4;cc.Event.CUSTOM=6; cc.EventCustom=cc.Event.extend({_eventName:null,_userData:null,ctor:function(a){cc.Event.prototype.ctor.call(this,cc.Event.CUSTOM);this._eventName=a},setUserData:function(a){this._userData=a},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(a){cc.Event.prototype.ctor.call(this,cc.Event.MOUSE);this._eventType=a},setScrollData:function(a,b){this._scrollX=a;this._scrollY=b},getScrollX:function(){return this._scrollX},getScrollY:function(){return this._scrollY},setLocation:function(a,b){this._x=a;this._y=b},getLocation:function(){return{x:this._x,y:this._y}},getLocationInView:function(){return{x:this._x,y:cc.view._designResolutionSize.height- this._y}},_setPrevCursor:function(a,b){this._prevX=a;this._prevY=b},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(a){this._button=a},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(a){cc.Event.prototype.ctor.call(this,cc.Event.TOUCH);this._touches=a||[]},getEventCode:function(){return this._eventCode},getTouches:function(){return this._touches},_setEventCode:function(a){this._eventCode=a},_setTouches:function(a){this._touches=a}});cc.EventTouch.MAX_TOUCHES=5;cc.EventTouch.EventCode={BEGAN:0,MOVED:1,ENDED:2,CANCELLED:3}; cc.EventFocus=cc.Event.extend({_widgetGetFocus:null,_widgetLoseFocus:null,ctor:function(a,b){cc.Event.prototype.ctor.call(this,cc.Event.FOCUS);this._widgetGetFocus=b;this._widgetLoseFocus=a}});cc.EventListener=cc.Class.extend({_onEvent:null,_type:0,_listenerID:null,_registered:!1,_fixedPriority:0,_node:null,_paused:!0,_isEnabled:!0,ctor:function(a,b,c){this._onEvent=c;this._type=a||0;this._listenerID=b||""},_setPaused:function(a){this._paused=a},_isPaused:function(){return this._paused},_setRegistered:function(a){this._registered=a},_isRegistered:function(){return this._registered},_getType:function(){return this._type},_getListenerID:function(){return this._listenerID},_setFixedPriority:function(a){this._fixedPriority= a},_getFixedPriority:function(){return this._fixedPriority},_setSceneGraphPriority:function(a){this._node=a},_getSceneGraphPriority:function(){return this._node},checkAvailable:function(){return null!==this._onEvent},clone:function(){return null},setEnabled:function(a){this._isEnabled=a},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=6;cc.EventListener.FOCUS=7;cc.EventListener.CUSTOM=8; cc._EventListenerCustom=cc.EventListener.extend({_onCustomEvent:null,ctor:function(a,b){this._onCustomEvent=b;var c=this;cc.EventListener.prototype.ctor.call(this,cc.EventListener.CUSTOM,a,function(a){null!==c._onCustomEvent&&c._onCustomEvent(a)})},checkAvailable:function(){return cc.EventListener.prototype.checkAvailable.call(this)&&null!==this._onCustomEvent},clone:function(){return new cc._EventListenerCustom(this._listenerID,this._onCustomEvent)}}); cc._EventListenerCustom.create=function(a,b){return new cc._EventListenerCustom(a,b)}; cc._EventListenerMouse=cc.EventListener.extend({onMouseDown:null,onMouseUp:null,onMouseMove:null,onMouseScroll:null,ctor:function(){var a=this;cc.EventListener.prototype.ctor.call(this,cc.EventListener.MOUSE,cc._EventListenerMouse.LISTENER_ID,function(b){var c=cc.EventMouse;switch(b._eventType){case c.DOWN:if(a.onMouseDown)a.onMouseDown(b);break;case c.UP:if(a.onMouseUp)a.onMouseUp(b);break;case c.MOVE:if(a.onMouseMove)a.onMouseMove(b);break;case c.SCROLL:if(a.onMouseScroll)a.onMouseScroll(b)}})}, clone:function(){var a=new cc._EventListenerMouse;a.onMouseDown=this.onMouseDown;a.onMouseUp=this.onMouseUp;a.onMouseMove=this.onMouseMove;a.onMouseScroll=this.onMouseScroll;return a},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(a){this.swallowTouches=a},isSwallowTouches:function(){return this.swallowTouches},clone:function(){var a=new cc._EventListenerTouchOneByOne; a.onTouchBegan=this.onTouchBegan;a.onTouchMoved=this.onTouchMoved;a.onTouchEnded=this.onTouchEnded;a.onTouchCancelled=this.onTouchCancelled;a.swallowTouches=this.swallowTouches;return a},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 a=new cc._EventListenerTouchAllAtOnce;a.onTouchesBegan=this.onTouchesBegan;a.onTouchesMoved=this.onTouchesMoved;a.onTouchesEnded=this.onTouchesEnded;a.onTouchesCancelled=this.onTouchesCancelled;return a}, checkAvailable:function(){return null===this.onTouchesBegan&&null===this.onTouchesMoved&&null===this.onTouchesEnded&&null===this.onTouchesCancelled?(cc.log(cc._LogInfos._EventListenerTouchAllAtOnce_checkAvailable),!1):!0}});cc._EventListenerTouchAllAtOnce.LISTENER_ID="__cc_touch_all_at_once";cc._EventListenerTouchAllAtOnce.create=function(){return new cc._EventListenerTouchAllAtOnce}; cc.EventListener.create=function(a){cc.assert(a&&a.event,cc._LogInfos.EventListener_create);var b=a.event;delete a.event;var c=null;b===cc.EventListener.TOUCH_ONE_BY_ONE?c=new cc._EventListenerTouchOneByOne:b===cc.EventListener.TOUCH_ALL_AT_ONCE?c=new cc._EventListenerTouchAllAtOnce:b===cc.EventListener.MOUSE?c=new cc._EventListenerMouse:b===cc.EventListener.CUSTOM?(c=new cc._EventListenerCustom(a.eventName,a.callback),delete a.eventName,delete a.callback):b===cc.EventListener.KEYBOARD?c=new cc._EventListenerKeyboard: b===cc.EventListener.ACCELERATION?(c=new cc._EventListenerAcceleration(a.callback),delete a.callback):b===cc.EventListener.FOCUS&&(c=new cc._EventListenerFocus);for(var d in a)c[d]=a[d];return c}; cc._EventListenerFocus=cc.EventListener.extend({clone:function(){var a=new cc._EventListenerFocus;a.onFocusChanged=this.onFocusChanged;return a},checkAvailable:function(){return this.onFocusChanged?!0:(cc.log("Invalid EventListenerFocus!"),!1)},onFocusChanged:null,ctor:function(){cc.EventListener.prototype.ctor.call(this,cc.EventListener.FOCUS,cc._EventListenerFocus.LISTENER_ID,function(a){if(this.onFocusChanged)this.onFocusChanged(a._widgetLoseFocus,a._widgetGetFocus)})}}); cc._EventListenerFocus.LISTENER_ID="__cc_focus_event";(function(){function a(a){var c=cc.Event,d=a._type;if(d===c.ACCELERATION)return cc._EventListenerAcceleration.LISTENER_ID;if(d===c.CUSTOM)return a._eventName;if(d===c.KEYBOARD)return cc._EventListenerKeyboard.LISTENER_ID;if(d===c.MOUSE)return cc._EventListenerMouse.LISTENER_ID;if(d===c.FOCUS)return cc._EventListenerFocus.LISTENER_ID;d===c.TOUCH&&cc.log(cc._LogInfos.__getListenerID);return""}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 0===this._fixedListeners.length&&0===this._sceneGraphListeners.length},push:function(a){0===a._getFixedPriority()?this._sceneGraphListeners.push(a):this._fixedListeners.push(a)},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.eventManager={DIRTY_NONE:0,DIRTY_FIXED_PRIORITY:1,DIRTY_SCENE_GRAPH_PRIORITY:2,DIRTY_ALL:3,_listenersMap:{},_priorityDirtyFlagMap:{},_nodeListenersMap:{},_nodePriorityMap:{},_globalZOrderNodeMap:{},_toAddedListeners:[],_toRemovedListeners:[],_dirtyNodes:[],_inDispatch:0,_isEnabled:!1,_nodePriorityIndex:0,_internalCustomListenerIDs:[cc.game.EVENT_HIDE, cc.game.EVENT_SHOW],_setDirtyForNode:function(a){null!=this._nodeListenersMap[a.__instanceId]&&this._dirtyNodes.push(a);a=a.getChildren();for(var c=0,d=a.length;c<d;c++)this._setDirtyForNode(a[c])},pauseTarget:function(a,c){var d=this._nodeListenersMap[a.__instanceId],e,f;if(d)for(e=0,f=d.length;e<f;e++)d[e]._setPaused(!0);if(!0===c)for(d=a.getChildren(),e=0,f=d.length;e<f;e++)this.pauseTarget(d[e],!0)},resumeTarget:function(a,c){var d=this._nodeListenersMap[a.__instanceId],e,f;if(d)for(e=0,f=d.length;e< f;e++)d[e]._setPaused(!1);this._setDirtyForNode(a);if(!0===c)for(d=a.getChildren(),e=0,f=d.length;e<f;e++)this.resumeTarget(d[e],!0)},_addListener:function(a){0===this._inDispatch?this._forceAddEventListener(a):this._toAddedListeners.push(a)},_forceAddEventListener:function(a){var c=a._getListenerID(),d=this._listenersMap[c];d||(d=new cc._EventListenerVector,this._listenersMap[c]=d);d.push(a);0===a._getFixedPriority()?(this._setDirty(c,this.DIRTY_SCENE_GRAPH_PRIORITY),c=a._getSceneGraphPriority(), null===c?cc.log(cc._LogInfos.eventManager__forceAddEventListener):(this._associateNodeAndEventListener(c,a),c.isRunning()&&this.resumeTarget(c))):this._setDirty(c,this.DIRTY_FIXED_PRIORITY)},_getListeners:function(a){return this._listenersMap[a]},_updateDirtyFlagForSceneGraph:function(){if(0!==this._dirtyNodes.length){for(var a=this._dirtyNodes,c,d,e=this._nodeListenersMap,f=0,g=a.length;f<g;f++)if(c=e[a[f].__instanceId])for(var h=0,k=c.length;h<k;h++)(d=c[h])&&this._setDirty(d._getListenerID(),this.DIRTY_SCENE_GRAPH_PRIORITY); this._dirtyNodes.length=0}},_removeAllListenersInVector:function(a){if(a)for(var c,d=0;d<a.length;)c=a[d],c._setRegistered(!1),null!=c._getSceneGraphPriority()&&(this._dissociateNodeAndEventListener(c._getSceneGraphPriority(),c),c._setSceneGraphPriority(null)),0===this._inDispatch?cc.arrayRemoveObject(a,c):++d},_removeListenersForListenerID:function(a){var c=this._listenersMap[a];if(c){var d=c.getFixedPriorityListeners(),e=c.getSceneGraphPriorityListeners();this._removeAllListenersInVector(e);this._removeAllListenersInVector(d); delete this._priorityDirtyFlagMap[a];this._inDispatch||(c.clear(),delete this._listenersMap[a])}d=this._toAddedListeners;for(c=0;c<d.length;)(e=d[c])&&e._getListenerID()===a?cc.arrayRemoveObject(d,e):++c},_sortEventListeners:function(a){var c=this.DIRTY_NONE,d=this._priorityDirtyFlagMap;d[a]&&(c=d[a]);c!==this.DIRTY_NONE&&(d[a]=this.DIRTY_NONE,c&this.DIRTY_FIXED_PRIORITY&&this._sortListenersOfFixedPriority(a),c&this.DIRTY_SCENE_GRAPH_PRIORITY&&((c=cc.director.getRunningScene())?this._sortListenersOfSceneGraphPriority(a, c):d[a]=this.DIRTY_SCENE_GRAPH_PRIORITY))},_sortListenersOfSceneGraphPriority:function(a,c){var d=this._getListeners(a);if(d){var e=d.getSceneGraphPriorityListeners();e&&0!==e.length&&(this._nodePriorityIndex=0,this._nodePriorityMap={},this._visitTarget(c,!0),d.getSceneGraphPriorityListeners().sort(this._sortEventListenersOfSceneGraphPriorityDes))}},_sortEventListenersOfSceneGraphPriorityDes:function(a,c){var d=cc.eventManager._nodePriorityMap,e=a._getSceneGraphPriority(),f=c._getSceneGraphPriority(); return c&&f&&d[f.__instanceId]?a&&e&&d[e.__instanceId]?d[c._getSceneGraphPriority().__instanceId]-d[a._getSceneGraphPriority().__instanceId]:1:-1},_sortListenersOfFixedPriority:function(a){if(a=this._listenersMap[a]){var c=a.getFixedPriorityListeners();if(c&&0!==c.length){c.sort(this._sortListenersOfFixedPriorityAsc);for(var d=0,e=c.length;d<e&&!(0<=c[d]._getFixedPriority());)++d;a.gt0Index=d}}},_sortListenersOfFixedPriorityAsc:function(a,c){return a._getFixedPriority()-c._getFixedPriority()},_onUpdateListeners:function(a){var c= a.getFixedPriorityListeners(),d=a.getSceneGraphPriorityListeners(),e,f,g=this._toRemovedListeners;if(d)for(e=0;e<d.length;)f=d[e],f._isRegistered()?++e:(cc.arrayRemoveObject(d,f),f=g.indexOf(f),-1!==f&&g.splice(f,1));if(c)for(e=0;e<c.length;)f=c[e],f._isRegistered()?++e:(cc.arrayRemoveObject(c,f),f=g.indexOf(f),-1!==f&&g.splice(f,1));d&&0===d.length&&a.clearSceneGraphListeners();c&&0===c.length&&a.clearFixedListeners()},frameUpdateListeners:function(){var a=this._listenersMap,c=this._priorityDirtyFlagMap, d;for(d in a)a[d].empty()&&(delete c[d],delete a[d]);a=this._toAddedListeners;if(0!==a.length){c=0;for(d=a.length;c<d;c++)this._forceAddEventListener(a[c]);a.length=0}0!==this._toRemovedListeners.length&&this._cleanToRemovedListeners()},_updateTouchListeners:function(a){a=this._inDispatch;cc.assert(0<a,cc._LogInfos.EventManager__updateListeners);if(!(1<a)){var c;(c=this._listenersMap[cc._EventListenerTouchOneByOne.LISTENER_ID])&&this._onUpdateListeners(c);(c=this._listenersMap[cc._EventListenerTouchAllAtOnce.LISTENER_ID])&& this._onUpdateListeners(c);cc.assert(1===a,cc._LogInfos.EventManager__updateListeners_2);a=this._toAddedListeners;if(0!==a.length){c=0;for(var d=a.length;c<d;c++)this._forceAddEventListener(a[c]);a.length=0}0!==this._toRemovedListeners.length&&this._cleanToRemovedListeners()}},_cleanToRemovedListeners:function(){for(var a=this._toRemovedListeners,c=0;c<a.length;c++){var d=a[c],e=this._listenersMap[d._getListenerID()];if(e){var f=e.getFixedPriorityListeners(),g=e.getSceneGraphPriorityListeners();g&& (e=g.indexOf(d),-1!==e&&g.splice(e,1));f&&(e=f.indexOf(d),-1!==e&&f.splice(e,1))}}a.length=0},_onTouchEventCallback:function(a,c){if(!a._isRegistered)return!1;var d=c.event,e=c.selTouch;d._setCurrentTarget(a._node);var f=!1,g,h=d.getEventCode(),k=cc.EventTouch.EventCode;if(h===k.BEGAN)a.onTouchBegan&&(f=a.onTouchBegan(e,d))&&a._registered&&a._claimedTouches.push(e);else if(0<a._claimedTouches.length&&-1!==(g=a._claimedTouches.indexOf(e)))if(f=!0,h===k.MOVED&&a.onTouchMoved)a.onTouchMoved(e,d);else if(h=== k.ENDED){if(a.onTouchEnded)a.onTouchEnded(e,d);a._registered&&a._claimedTouches.splice(g,1)}else if(h===k.CANCELLED){if(a.onTouchCancelled)a.onTouchCancelled(e,d);a._registered&&a._claimedTouches.splice(g,1)}return d.isStopped()?(cc.eventManager._updateTouchListeners(d),!0):f&&a._registered&&a.swallowTouches?(c.needsMutableSet&&c.touches.splice(e,1),!0):!1},_dispatchTouchEvent:function(a){this._sortEventListeners(cc._EventListenerTouchOneByOne.LISTENER_ID);this._sortEventListeners(cc._EventListenerTouchAllAtOnce.LISTENER_ID); var c=this._getListeners(cc._EventListenerTouchOneByOne.LISTENER_ID),d=this._getListeners(cc._EventListenerTouchAllAtOnce.LISTENER_ID);if(null!==c||null!==d){var e=a.getTouches(),f=cc.copyArray(e),g={event:a,needsMutableSet:c&&d,touches:f,selTouch:null};if(c)for(var h=0;h<e.length;h++)if(g.selTouch=e[h],this._dispatchEventToListeners(c,this._onTouchEventCallback,g),a.isStopped())return;if(d&&0<f.length&&(this._dispatchEventToListeners(d,this._onTouchesEventCallback,{event:a,touches:f}),a.isStopped()))return; this._updateTouchListeners(a)}},_onTouchesEventCallback:function(a,c){if(!a._registered)return!1;var d=cc.EventTouch.EventCode,e=c.event,f=c.touches,g=e.getEventCode();e._setCurrentTarget(a._node);if(g===d.BEGAN&&a.onTouchesBegan)a.onTouchesBegan(f,e);else if(g===d.MOVED&&a.onTouchesMoved)a.onTouchesMoved(f,e);else if(g===d.ENDED&&a.onTouchesEnded)a.onTouchesEnded(f,e);else if(g===d.CANCELLED&&a.onTouchesCancelled)a.onTouchesCancelled(f,e);return e.isStopped()?(cc.eventManager._updateTouchListeners(e), !0):!1},_associateNodeAndEventListener:function(a,c){var d=this._nodeListenersMap[a.__instanceId];d||(d=[],this._nodeListenersMap[a.__instanceId]=d);d.push(c)},_dissociateNodeAndEventListener:function(a,c){var d=this._nodeListenersMap[a.__instanceId];d&&(cc.arrayRemoveObject(d,c),0===d.length&&delete this._nodeListenersMap[a.__instanceId])},_dispatchEventToListeners:function(a,c,d){var e=!1,f=a.getFixedPriorityListeners(),g=a.getSceneGraphPriorityListeners(),h=0,k;if(f&&0!==f.length)for(;h<a.gt0Index;++h)if(k= f[h],k.isEnabled()&&!k._isPaused()&&k._isRegistered()&&c(k,d)){e=!0;break}if(g&&!e)for(a=0;a<g.length;a++)if(k=g[a],k.isEnabled()&&!k._isPaused()&&k._isRegistered()&&c(k,d)){e=!0;break}if(f&&!e)for(;h<f.length&&(k=f[h],!k.isEnabled()||k._isPaused()||!k._isRegistered()||!c(k,d));++h);},_setDirty:function(a,c){var d=this._priorityDirtyFlagMap;d[a]=null==d[a]?c:c|d[a]},_visitTarget:function(a,c){var d=a.getChildren(),e=0,f=d.length,g=this._globalZOrderNodeMap,h=this._nodeListenersMap;if(0<f){for(var k;e< f;e++)if((k=d[e])&&0>k.getLocalZOrder())this._visitTarget(k,!1);else break;null!=h[a.__instanceId]&&(g[a.getGlobalZOrder()]||(g[a.getGlobalZOrder()]=[]),g[a.getGlobalZOrder()].push(a.__instanceId));for(;e<f;e++)(k=d[e])&&this._visitTarget(k,!1)}else null!=h[a.__instanceId]&&(g[a.getGlobalZOrder()]||(g[a.getGlobalZOrder()]=[]),g[a.getGlobalZOrder()].push(a.__instanceId));if(c){var d=[],m;for(m in g)d.push(m);d.sort(this._sortNumberAsc);m=d.length;k=this._nodePriorityMap;for(e=0;e<m;e++)for(f=g[d[e]], h=0;h<f.length;h++)k[f[h]]=++this._nodePriorityIndex;this._globalZOrderNodeMap={}}},_sortNumberAsc:function(a,c){return a-c},addListener:function(a,c){cc.assert(a&&c,cc._LogInfos.eventManager_addListener_2);if(!(a instanceof cc.EventListener))cc.assert(!cc.isNumber(c),cc._LogInfos.eventManager_addListener_3),a=cc.EventListener.create(a);else if(a._isRegistered()){cc.log(cc._LogInfos.eventManager_addListener_4);return}if(a.checkAvailable()){if(cc.isNumber(c)){if(0===c){cc.log(cc._LogInfos.eventManager_addListener); return}a._setSceneGraphPriority(null);a._setFixedPriority(c);a._setRegistered(!0);a._setPaused(!1)}else a._setSceneGraphPriority(c),a._setFixedPriority(0),a._setRegistered(!0);this._addListener(a);return a}},addCustomListener:function(a,c){var d=new cc._EventListenerCustom(a,c);this.addListener(d,1);return d},removeListener:function(a){if(null!=a){var c,d=this._listenersMap,e;for(e in d){var f=d[e],g=f.getFixedPriorityListeners();c=f.getSceneGraphPriorityListeners();(c=this._removeListenerInVector(c, a))?this._setDirty(a._getListenerID(),this.DIRTY_SCENE_GRAPH_PRIORITY):(c=this._removeListenerInVector(g,a))&&this._setDirty(a._getListenerID(),this.DIRTY_FIXED_PRIORITY);f.empty()&&(delete this._priorityDirtyFlagMap[a._getListenerID()],delete d[e]);if(c)break}if(!c)for(d=this._toAddedListeners,e=0,f=d.length;e<f;e++)if(g=d[e],g===a){cc.arrayRemoveObject(d,g);g._setRegistered(!1);break}}},_removeListenerInCallback:function(a,c){if(null==a)return!1;for(var d=0,e=a.length;d<e;d++){var f=a[d];if(f._onCustomEvent=== c||f._onEvent===c)return f._setRegistered(!1),null!=f._getSceneGraphPriority()&&(this._dissociateNodeAndEventListener(f._getSceneGraphPriority(),f),f._setSceneGraphPriority(null)),0===this._inDispatch&&cc.arrayRemoveObject(a,f),!0}return!1},_removeListenerInVector:function(a,c){if(null==a)return!1;for(var d=0,e=a.length;d<e;d++){var f=a[d];if(f===c)return f._setRegistered(!1),null!=f._getSceneGraphPriority()&&(this._dissociateNodeAndEventListener(f._getSceneGraphPriority(),f),f._setSceneGraphPriority(null)), 0===this._inDispatch?cc.arrayRemoveObject(a,f):this._toRemovedListeners.push(f),!0}return!1},removeListeners:function(a,c){if(a instanceof cc.Node){delete this._nodePriorityMap[a.__instanceId];cc.arrayRemoveObject(this._dirtyNodes,a);var d=this._nodeListenersMap[a.__instanceId];if(d){for(var e=cc.copyArray(d),d=0;d<e.length;d++)this.removeListener(e[d]);e.length=0}e=this._toAddedListeners;for(d=0;d<e.length;){var f=e[d];f._getSceneGraphPriority()===a?(f._setSceneGraphPriority(null),f._setRegistered(!1), e.splice(d,1)):++d}if(!0===c)for(e=a.getChildren(),d=0,f=e.length;d<f;d++)this.removeListeners(e[d],!0)}else a===cc.EventListener.TOUCH_ONE_BY_ONE?this._removeListenersForListenerID(cc._EventListenerTouchOneByOne.LISTENER_ID):a===cc.EventListener.TOUCH_ALL_AT_ONCE?this._removeListenersForListenerID(cc._EventListenerTouchAllAtOnce.LISTENER_ID):a===cc.EventListener.MOUSE?this._removeListenersForListenerID(cc._EventListenerMouse.LISTENER_ID):a===cc.EventListener.ACCELERATION?this._removeListenersForListenerID(cc._EventListenerAcceleration.LISTENER_ID): a===cc.EventListener.KEYBOARD?this._removeListenersForListenerID(cc._EventListenerKeyboard.LISTENER_ID):cc.log(cc._LogInfos.eventManager_removeListeners)},removeCustomListeners:function(a){this._removeListenersForListenerID(a)},removeAllListeners:function(){var a=this._listenersMap,c=this._internalCustomListenerIDs,d;for(d in a)-1===c.indexOf(d)&&this._removeListenersForListenerID(d)},setPriority:function(a,c){if(null!=a){var d=this._listenersMap,e;for(e in d){var f=d[e].getFixedPriorityListeners(); if(f&&-1!==f.indexOf(a)){null!=a._getSceneGraphPriority()&&cc.log(cc._LogInfos.eventManager_setPriority);a._getFixedPriority()!==c&&(a._setFixedPriority(c),this._setDirty(a._getListenerID(),this.DIRTY_FIXED_PRIORITY));break}}}},setEnabled:function(a){this._isEnabled=a},isEnabled:function(){return this._isEnabled},dispatchEvent:function(b){if(this._isEnabled){this._updateDirtyFlagForSceneGraph();this._inDispatch++;if(!b||!b.getType)throw Error("event is undefined");if(b._type===cc.Event.TOUCH)this._dispatchTouchEvent(b); else{var c=a(b);this._sortEventListeners(c);if(c=this._listenersMap[c])this._dispatchEventToListeners(c,this._onListenerCallback,b),this._onUpdateListeners(c)}this._inDispatch--}},_onListenerCallback:function(a,c){c._setCurrentTarget(a._getSceneGraphPriority());a._onEvent(c);return c.isStopped()},dispatchCustomEvent:function(a,c){var d=new cc.EventCustom(a);d.setUserData(c);this.dispatchEvent(d)}}})();cc.EventAcceleration=cc.Event.extend({_acc:null,ctor:function(a){cc.Event.prototype.ctor.call(this,cc.Event.ACCELERATION);this._acc=a}});cc.EventKeyboard=cc.Event.extend({_keyCode:0,_isPressed:!1,ctor:function(a,b){cc.Event.prototype.ctor.call(this,cc.Event.KEYBOARD);this._keyCode=a;this._isPressed=b}}); cc._EventListenerAcceleration=cc.EventListener.extend({_onAccelerationEvent:null,ctor:function(a){this._onAccelerationEvent=a;var b=this;cc.EventListener.prototype.ctor.call(this,cc.EventListener.ACCELERATION,cc._EventListenerAcceleration.LISTENER_ID,function(a){b._onAccelerationEvent(a._acc,a)})},checkAvailable:function(){cc.assert(this._onAccelerationEvent,cc._LogInfos._EventListenerAcceleration_checkAvailable);return!0},clone:function(){return new cc._EventListenerAcceleration(this._onAccelerationEvent)}}); cc._EventListenerAcceleration.LISTENER_ID="__cc_acceleration";cc._EventListenerAcceleration.create=function(a){return new cc._EventListenerAcceleration(a)}; cc._EventListenerKeyboard=cc.EventListener.extend({onKeyPressed:null,onKeyReleased:null,ctor:function(){var a=this;cc.EventListener.prototype.ctor.call(this,cc.EventListener.KEYBOARD,cc._EventListenerKeyboard.LISTENER_ID,function(b){if(b._isPressed){if(a.onKeyPressed)a.onKeyPressed(b._keyCode,b)}else if(a.onKeyReleased)a.onKeyReleased(b._keyCode,b)})},clone:function(){var a=new cc._EventListenerKeyboard;a.onKeyPressed=this.onKeyPressed;a.onKeyReleased=this.onKeyReleased;return a},checkAvailable:function(){return null=== this.onKeyPressed&&null===this.onKeyReleased?(cc.log(cc._LogInfos._EventListenerKeyboard_checkAvailable),!1):!0}});cc._EventListenerKeyboard.LISTENER_ID="__cc_keyboard";cc._EventListenerKeyboard.create=function(){return new cc._EventListenerKeyboard};var GlobalVertexBuffer=function(){var a=function(a,c){this.gl=a;this.vertexBuffer=a.createBuffer();this.size=888;this.byteLength=c||3552*cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this.data=new ArrayBuffer(this.byteLength);this.dataArray=new Float32Array(this.data);a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer);a.bufferData(a.ARRAY_BUFFER,this.dataArray,a.DYNAMIC_DRAW);this._dirty=!1;this._spaces={0:this.byteLength}};a.prototype={constructor:a,allocBuffer:function(a,c){var d=this._spaces[a];return d&& d>=c?(delete this._spaces[a],d>c&&(this._spaces[a+c]=d-c),!0):!1},requestBuffer:function(a){var c,d,e;for(c in this._spaces)if(d=parseInt(c),e=this._spaces[c],e>=a&&this.allocBuffer(d,a))return d;return-1},freeBuffer:function(a,c){var d=this._spaces,e,f;for(f in d){e=parseInt(f);if(e>a)break;if(e+d[f]>=a){c=c+a-e;a=e;break}}d=a+c;this._spaces[d]&&(c+=this._spaces[d],delete this._spaces[d]);this._spaces[a]=c},setDirty:function(){this._dirty=!0},update:function(){this._dirty&&(this.gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer),this.gl.bufferSubData(gl.ARRAY_BUFFER,0,this.dataArray),this._dirty=!1)},updateSubData:function(a,c){this.gl.bindBuffer(gl.ARRAY_BUFFER,this.vertexBuffer);this.gl.bufferSubData(gl.ARRAY_BUFFER,a,c)},destroy:function(){this.gl.deleteBuffer(this.vertexBuffer);this.vertexBuffer=this.texCoords=this.colors=this.positions=this.data=null}};return a}();cc.rendererCanvas={childrenOrderDirty:!0,assignedZ:0,assignedZStep:1E-4,_transformNodePool:[],_renderCmds:[],_isCacheToCanvasOn:!1,_cacheToCanvasCmds:{},_cacheInstanceIds:[],_currentID:0,_clearColor:cc.color(),_clearFillStyle:"rgb(0, 0, 0)",_dirtyRegion:null,_allNeedDraw:!0,_enableDirtyRegion:!1,_debugDirtyRegion:!1,_canUseDirtyRegion:!1,_dirtyRegionCountThreshold:10,getRenderCmd:function(a){return a._createRenderCmd()},enableDirtyRegion:function(a){this._enableDirtyRegion=a},isDirtyRegionEnabled:function(){return this._enableDirtyRegion}, setDirtyRegionCountThreshold:function(a){this._dirtyRegionCountThreshold=a},_collectDirtyRegion:function(){var a=this._renderCmds,b,c,d=this._dirtyRegion,e=0,f=!0,g=cc.Node.CanvasRenderCmd.RegionStatus;b=0;for(c=a.length;b<c;b++){var h=a[b],k=h._oldRegion,m=h._currentRegion;h._regionFlag>g.NotDirty&&(++e,e>this._dirtyRegionCountThreshold&&(f=!1),f&&(!m.isEmpty()&&d.addRegion(m),h._regionFlag>g.Dirty&&!k.isEmpty()&&d.addRegion(k)),h._regionFlag=g.NotDirty)}return f},_beginDrawDirtyRegion:function(a){var b= a.getContext(),c=this._dirtyRegion.getDirtyRegions();b.save();a.setTransform({a:1,b:0,c:0,d:1,tx:0,ty:0},a._scaleX,a._scaleY);b.beginPath();a=0;for(var d=c.length;a<d;++a){var e=c[a];b.rect(e._minX,-e._maxY,e._width,e._height)}b.clip()},_endDrawDirtyRegion:function(a){a.restore()},_debugDrawDirtyRegion:function(a){if(this._debugDirtyRegion){var b=a.getContext(),c=this._dirtyRegion.getDirtyRegions();a.setTransform({a:1,b:0,c:0,d:1,tx:0,ty:0},a._scaleX,a._scaleY);b.beginPath();a=0;for(var d=c.length;a< d;++a){var e=c[a];b.rect(e._minX,-e._maxY,e._width,e._height)}c=b.fillStyle;b.fillStyle="green";b.fill();b.fillStyle=c}},rendering:function(a){var b=this._dirtyRegion=this._dirtyRegion||new cc.DirtyRegion,c=cc._canvas;a=a||cc._renderContext;var d=a.getContext(),e=cc.view.getScaleX(),f=cc.view.getScaleY();a.setViewScale(e,f);a.computeRealOffsetY();var g=this._dirtyRegion.getDirtyRegions(),h=this._renderCmds,k,m=this._allNeedDraw||!this._enableDirtyRegion||!this._canUseDirtyRegion;k=!0;m||(k=this._collectDirtyRegion()); (m=m||!k)||this._beginDrawDirtyRegion(a);d.setTransform(1,0,0,1,0,0);d.clearRect(0,0,c.width,c.height);if(0!==this._clearColor.r||0!==this._clearColor.g||0!==this._clearColor.b)a.setFillStyle(this._clearFillStyle),a.setGlobalAlpha(this._clearColor.a),d.fillRect(0,0,c.width,c.height);c=0;for(k=h.length;c<k;c++){var n=h[c],p=!1,r=n._currentRegion;if(!r||m)p=!0;else for(var s=0,u=g.length;s<u;++s)if(g[s].intersects(r)){p=!0;break}p&&n.rendering(a,e,f)}m||(this._debugDrawDirtyRegion(a),this._endDrawDirtyRegion(d)); b.clear();this._allNeedDraw=!1},_renderingToCacheCanvas:function(a,b,c,d){a||cc.log("The context of RenderTexture is invalid.");c=cc.isUndefined(c)?1:c;d=cc.isUndefined(d)?1:d;b=b||this._currentID;var e,f=this._cacheToCanvasCmds[b],g;a.computeRealOffsetY();e=0;for(g=f.length;e<g;e++)f[e].rendering(a,c,d);this._removeCache(b);a=this._cacheInstanceIds;0===a.length?this._isCacheToCanvasOn=!1:this._currentID=a[a.length-1]},_turnToCacheMode:function(a){this._isCacheToCanvasOn=!0;a=a||0;this._cacheToCanvasCmds[a]= [];-1===this._cacheInstanceIds.indexOf(a)&&this._cacheInstanceIds.push(a);this._currentID=a},_turnToNormalMode:function(){this._isCacheToCanvasOn=!1},_removeCache:function(a){a=a||this._currentID;var b=this._cacheToCanvasCmds[a];b&&(b.length=0,delete this._cacheToCanvasCmds[a]);cc.arrayRemoveObject(this._cacheInstanceIds,a)},resetFlag:function(){this.childrenOrderDirty=!1;this._transformNodePool.length=0},transform:function(){var a=this._transformNodePool;a.sort(this._sortNodeByLevelAsc);for(var b= 0,c=a.length;b<c;b++)0!==a[b]._dirtyFlag&&a[b].updateStatus();a.length=0},transformDirty:function(){return 0<this._transformNodePool.length},_sortNodeByLevelAsc:function(a,b){return a._curLevel-b._curLevel},pushDirtyNode:function(a){this._transformNodePool.push(a)},clear:function(){},clearRenderCommands:function(){this._renderCmds.length=0;this._cacheInstanceIds.length=0;this._isCacheToCanvasOn=!1;this._canUseDirtyRegion=this._allNeedDraw=!0},pushRenderCommand:function(a){if(a.needDraw())if(a._canUseDirtyRegion|| (this._canUseDirtyRegion=!1),this._isCacheToCanvasOn){var b=this._cacheToCanvasCmds[this._currentID];-1===b.indexOf(a)&&b.push(a)}else-1===this._renderCmds.indexOf(a)&&this._renderCmds.push(a)}}; (function(){cc.CanvasContextWrapper=function(a){this._context=a;this._saveCount=0;this._currentAlpha=a.globalAlpha;this._currentCompositeOperation=a.globalCompositeOperation;this._currentFillStyle=a.fillStyle;this._currentStrokeStyle=a.strokeStyle;this._offsetY=this._offsetX=0;this._realOffsetY=this.height;this._armatureMode=0};var a=cc.CanvasContextWrapper.prototype;a.resetCache=function(){var a=this._context;this._currentAlpha=a.globalAlpha;this._currentCompositeOperation=a.globalCompositeOperation; this._currentFillStyle=a.fillStyle;this._currentStrokeStyle=a.strokeStyle;this._realOffsetY=this._context.canvas.height+this._offsetY};a.setOffset=function(a,c){this._offsetX=a;this._offsetY=c;this._realOffsetY=this._context.canvas.height+this._offsetY};a.computeRealOffsetY=function(){this._realOffsetY=this._context.canvas.height+this._offsetY};a.setViewScale=function(a,c){this._scaleX=a;this._scaleY=c};a.getContext=function(){return this._context};a.save=function(){this._context.save();this._saveCount++}; a.restore=function(){this._context.restore();this._saveCount--};a.setGlobalAlpha=function(a){0<this._saveCount?this._context.globalAlpha=a:this._currentAlpha!==a&&(this._currentAlpha=a,this._context.globalAlpha=a)};a.setCompositeOperation=function(a){0<this._saveCount?this._context.globalCompositeOperation=a:this._currentCompositeOperation!==a&&(this._currentCompositeOperation=a,this._context.globalCompositeOperation=a)};a.setFillStyle=function(a){0<this._saveCount?this._context.fillStyle=a:this._currentFillStyle!== a&&(this._currentFillStyle=a,this._context.fillStyle=a)};a.setStrokeStyle=function(a){0<this._saveCount?this._context.strokeStyle=a:this._currentStrokeStyle!==a&&(this._currentStrokeStyle=a,this._context.strokeStyle=a)};a.setTransform=function(a,c,d){0<this._armatureMode?(this.restore(),this.save(),this._context.transform(a.a*c,-a.b*d,-a.c*c,a.d*d,a.tx*c,-(a.ty*d))):this._context.setTransform(a.a*c,-a.b*d,-a.c*c,a.d*d,this._offsetX+a.tx*c,this._realOffsetY-a.ty*d)};a._switchToArmatureMode=function(a, c,d,e){a?(this._armatureMode++,this._context.setTransform(c.a,c.c,c.b,c.d,this._offsetX+c.tx*d,this._realOffsetY-c.ty*e),this.save()):(this._armatureMode--,this.restore())}})();cc.rendererWebGL=function(){var a={texture:null,blendSrc:null,blendDst:null,shader:null},b=null,c=null,d=0,e=0,f=null,g=0,h=null,k=null;return{mat4Identity:null,childrenOrderDirty:!0,assignedZ:0,assignedZStep:0.01,_transformNodePool:[],_renderCmds:[],_isCacheToBufferOn:!1,_cacheToBufferCmds:{},_cacheInstanceIds:[],_currentID:0,_clearColor:cc.color(),init:function(){var a=cc._renderContext;a.disable(a.CULL_FACE);a.disable(a.DEPTH_TEST);this.mat4Identity=new cc.math.Matrix4;this.mat4Identity.identity(); a=cc._renderContext;null===b&&(c=a.createBuffer(),b=a.createBuffer());a=cc._renderContext;if(b){a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,b);for(var e=new Uint16Array(3E3),p=0,r=0;3E3>r;r+=6)e[r]=p+0,e[r+1]=p+1,e[r+2]=p+2,e[r+3]=p+1,e[r+4]=p+2,e[r+5]=p+3,p+=4;a.bufferData(a.ELEMENT_ARRAY_BUFFER,e,a.STATIC_DRAW)}c&&(g=12E3,f=new ArrayBuffer(4*g),h=new Float32Array(f),k=new Uint32Array(f),a.bindBuffer(a.ARRAY_BUFFER,c),a.bufferData(a.ARRAY_BUFFER,h,a.DYNAMIC_DRAW));d=2E3},getVertexSize:function(){return d}, getRenderCmd:function(a){return a._createRenderCmd()},_turnToCacheMode:function(a){this._isCacheToBufferOn=!0;a=a||0;this._cacheToBufferCmds[a]?this._cacheToBufferCmds[a].length=0:this._cacheToBufferCmds[a]=[];-1===this._cacheInstanceIds.indexOf(a)&&this._cacheInstanceIds.push(a);this._currentID=a},_turnToNormalMode:function(){this._isCacheToBufferOn=!1},_removeCache:function(a){a=a||this._currentID;var b=this._cacheToBufferCmds[a];b&&(b.length=0,delete this._cacheToBufferCmds[a]);cc.arrayRemoveObject(this._cacheInstanceIds, a)},_renderingToBuffer:function(a){a=a||this._currentID;this.rendering(cc._renderContext,this._cacheToBufferCmds[a]);this._removeCache(a);a=this._cacheInstanceIds;0===a.length?this._isCacheToBufferOn=!1:this._currentID=a[a.length-1]},resetFlag:function(){this.childrenOrderDirty&&(this.childrenOrderDirty=!1);this._transformNodePool.length=0},transform:function(){var a=this._transformNodePool;a.sort(this._sortNodeByLevelAsc);var b,c,d;b=0;for(c=a.length;b<c;b++)d=a[b],d.updateStatus();a.length=0},transformDirty:function(){return 0< this._transformNodePool.length},_sortNodeByLevelAsc:function(a,b){return a._curLevel-b._curLevel},pushDirtyNode:function(a){this._transformNodePool.push(a)},clearRenderCommands:function(){this._renderCmds.length=0},clear:function(){var a=cc._renderContext;a.clearColor(this._clearColor.r/255,this._clearColor.g/255,this._clearColor.b/255,this._clearColor.a/255);a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT)},setDepthTest:function(a){var b=cc._renderContext;a?(b.clearDepth(1),b.enable(b.DEPTH_TEST), b.depthFunc(b.LEQUAL)):b.disable(b.DEPTH_TEST)},pushRenderCommand:function(a){if(a.needDraw())if(this._isCacheToBufferOn){var b=this._cacheToBufferCmds[this._currentID];-1===b.indexOf(a)&&b.push(a)}else-1===this._renderCmds.indexOf(a)&&this._renderCmds.push(a)},_increaseBatchingSize:function(a){e+=a},_uploadBufferData:function(b){e>=d&&this._batchRendering();var c=b._node,f=c._texture||(c._spriteFrame?c._spriteFrame._texture:null);if(f){var g=c._blendFunc.src,c=c._blendFunc.dst,s=b._shaderProgram; if(a.texture!==f||a.blendSrc!==g||a.blendDst!==c||a.shader!==s)this._batchRendering(),a.texture=f,a.blendSrc=g,a.blendDst=c,a.shader=s;b=b.uploadData(h,k,6*e);0<b&&(e+=b)}},_batchRendering:function(){if(0!==e&&a.texture){var f=cc._renderContext,g=a.texture,k=a.shader,r=e/4;k&&(k.use(),k._updateProjectionUniform());cc.glBlendFunc(a.blendSrc,a.blendDst);cc.glBindTexture2DN(0,g);f.bindBuffer(f.ARRAY_BUFFER,c);e>0.5*d?f.bufferData(f.ARRAY_BUFFER,h,f.DYNAMIC_DRAW):(g=h.subarray(0,6*e),f.bufferData(f.ARRAY_BUFFER, g,f.DYNAMIC_DRAW));f.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);f.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);f.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);f.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,f.FLOAT,!1,24,0);f.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,f.UNSIGNED_BYTE,!0,24,12);f.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,f.FLOAT,!1,24,16);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,b);f.drawElements(f.TRIANGLES,6*r,f.UNSIGNED_SHORT,0);cc.g_NumberOfDraws++;e=0}}, rendering:function(b,c){var d=c||this._renderCmds,f,g,h,k=b||cc._renderContext;k.bindBuffer(gl.ARRAY_BUFFER,null);f=0;for(g=d.length;f<g;++f)h=d[f],h.uploadData?this._uploadBufferData(h):(0<e&&this._batchRendering(),h.rendering(k));this._batchRendering();a.texture=null}}}();var Region=function(){this._area=this._height=this._width=this._maxY=this._maxX=this._minY=this._minX=0},regionProto=Region.prototype,regionPool=[];function regionCreate(){var a=regionPool.pop();a||(a=new Region);return a}function regionRelease(a){regionPool.push(a)}regionProto.setTo=function(a,b,c,d){this._minX=a;this._minY=b;this._maxX=c;this._maxY=d;this.updateArea();return this}; regionProto.intValues=function(){this._minX=Math.floor(this._minX);this._minY=Math.floor(this._minY);this._maxX=Math.ceil(this._maxX);this._maxY=Math.ceil(this._maxY);this.updateArea()};regionProto.updateArea=function(){this._width=this._maxX-this._minX;this._height=this._maxY-this._minY;this._area=this._width*this._height}; regionProto.union=function(a){0>=this._width||0>=this._height?this.setTo(a._minX,a._minY,a._maxX,a._maxY):(this._minX>a._minX&&(this._minX=a._minX),this._minY>a._minY&&(this._minY=a._minY),this._maxX<a._maxX&&(this._maxX=a._maxX),this._maxY<a._maxY&&(this._maxY=a._maxY),this.updateArea())};regionProto.setEmpty=function(){this._area=this._height=this._width=this._maxY=this._maxX=this._minY=this._minX=0};regionProto.isEmpty=function(){return 0>=this._width||0>=this._height}; regionProto.intersects=function(a){if(0>=this._width||0>=this._height||0>=a._width||0>=a._height)return!1;var b=this._minX>a._minX?this._minX:a._minX,c=this._maxX<a._maxX?this._maxX:a._maxX;if(b>c)return!1;b=this._minY>a._minY?this._minY:a._minY;c=this._maxY<a._maxY?this._maxY:a._maxY;return b<=c}; regionProto.updateRegion=function(a,b){if(0==a.width||0==a.height)this.setEmpty();else{var c=b.a,d=b.b,e=b.c,f=b.d,g=b.tx,h=b.ty,k=a.x,m=a.y,n=k+a.width,p=m+a.height,r,s,u;if(1==c&&0==d&&0==e&&1==f)r=k+g-1,s=m+h-1,u=n+g+1,m=p+h+1;else{r=c*k+e*m+g;s=d*k+f*m+h;u=c*n+e*m+g;var m=d*n+f*m+h,t=c*n+e*p+g,n=d*n+f*p+h,g=c*k+e*p+g,h=d*k+f*p+h,p=0;r>u&&(p=r,r=u,u=p);t>g&&(p=t,t=g,g=p);r=(r<t?r:t)-1;u=(u>g?u:g)+1;s>m&&(p=s,s=m,m=p);n>h&&(p=n,n=h,h=p);s=(s<n?s:n)-1;m=(m>h?m:h)+1}this._minX=r;this._minY=s;this._maxX= u;this._maxY=m;this._width=u-r;this._height=m-s;this._area=this._width*this._height}};function unionArea(a,b){return((a._maxX>b._maxX?a._maxX:b._maxX)-(a._minX<b._minX?a._minX:b._minX))*((a._maxY>b._maxY?a._maxY:b._maxY)-(a._minY<b._minY?a._minY:b._minY))}var DirtyRegion=function(){this.dirtyList=[];this.hasClipRect=!1;this.clipArea=this.clipHeight=this.clipWidth=0;this.clipRectChanged=!1},dirtyRegionProto=DirtyRegion.prototype; dirtyRegionProto.setClipRect=function(a,b){this.clipRectChanged=this.hasClipRect=!0;this.clipWidth=Math.ceil(a);this.clipHeight=Math.ceil(b);this.clipArea=this.clipWidth*this.clipHeight}; dirtyRegionProto.addRegion=function(a){var b=a._minX,c=a._minY,d=a._maxX;a=a._maxY;this.hasClipRect&&(0>b&&(b=0),0>c&&(c=0),d>this.clipWidth&&(d=this.clipWidth),a>this.clipHeight&&(a=this.clipHeight));if(b>=d||c>=a)return!1;if(this.clipRectChanged)return!0;var e=this.dirtyList,f=regionCreate();e.push(f.setTo(b,c,d,a));this.mergeDirtyList(e);return!0};dirtyRegionProto.clear=function(){for(var a=this.dirtyList,b=a.length,c=0;c<b;c++)regionRelease(a[c]);a.length=0}; dirtyRegionProto.getDirtyRegions=function(){var a=this.dirtyList;if(this.clipRectChanged){this.clipRectChanged=!1;this.clear();var b=regionCreate();a.push(b.setTo(0,0,this.clipWidth,this.clipHeight))}else for(;this.mergeDirtyList(a););a=this.dirtyList.length;if(0<a)for(b=0;b<a;b++)this.dirtyList[b].intValues();return this.dirtyList}; dirtyRegionProto.mergeDirtyList=function(a){var b=a.length;if(2>b)return!1;for(var c=this.hasClipRect,d=3<b?Number.POSITIVE_INFINITY:0,e=0,f=0,g=0,h=0;h<b-1;h++){var k=a[h];c&&(g+=k.area);for(var m=h+1;m<b;m++){var n=a[m],n=unionArea(k,n)-k.area-n.area;d>n&&(e=h,f=m,d=n)}}c&&0.95<g/this.clipArea&&(this.clipRectChanged=!0);return e!=f?(b=a[f],a[e].union(b),regionRelease(b),a.splice(f,1),!0):!1};cc.Region=Region;cc.DirtyRegion=DirtyRegion;cc._tmp.PrototypeCCNode=function(){var a=cc.Node.prototype;cc.defineGetterSetter(a,"x",a.getPositionX,a.setPositionX);cc.defineGetterSetter(a,"y",a.getPositionY,a.setPositionY);cc.defineGetterSetter(a,"width",a._getWidth,a._setWidth);cc.defineGetterSetter(a,"height",a._getHeight,a._setHeight);cc.defineGetterSetter(a,"anchorX",a._getAnchorX,a._setAnchorX);cc.defineGetterSetter(a,"anchorY",a._getAnchorY,a._setAnchorY);cc.defineGetterSetter(a,"skewX",a.getSkewX,a.setSkewX);cc.defineGetterSetter(a,"skewY", a.getSkewY,a.setSkewY);cc.defineGetterSetter(a,"zIndex",a.getLocalZOrder,a.setLocalZOrder);cc.defineGetterSetter(a,"vertexZ",a.getVertexZ,a.setVertexZ);cc.defineGetterSetter(a,"rotation",a.getRotation,a.setRotation);cc.defineGetterSetter(a,"rotationX",a.getRotationX,a.setRotationX);cc.defineGetterSetter(a,"rotationY",a.getRotationY,a.setRotationY);cc.defineGetterSetter(a,"scale",a.getScale,a.setScale);cc.defineGetterSetter(a,"scaleX",a.getScaleX,a.setScaleX);cc.defineGetterSetter(a,"scaleY",a.getScaleY, a.setScaleY);cc.defineGetterSetter(a,"children",a.getChildren);cc.defineGetterSetter(a,"childrenCount",a.getChildrenCount);cc.defineGetterSetter(a,"parent",a.getParent,a.setParent);cc.defineGetterSetter(a,"visible",a.isVisible,a.setVisible);cc.defineGetterSetter(a,"running",a.isRunning);cc.defineGetterSetter(a,"ignoreAnchor",a.isIgnoreAnchorPointForPosition,a.ignoreAnchorPointForPosition);cc.defineGetterSetter(a,"actionManager",a.getActionManager,a.setActionManager);cc.defineGetterSetter(a,"scheduler", a.getScheduler,a.setScheduler);cc.defineGetterSetter(a,"shaderProgram",a.getShaderProgram,a.setShaderProgram);cc.defineGetterSetter(a,"opacity",a.getOpacity,a.setOpacity);cc.defineGetterSetter(a,"opacityModifyRGB",a.isOpacityModifyRGB);cc.defineGetterSetter(a,"cascadeOpacity",a.isCascadeOpacityEnabled,a.setCascadeOpacityEnabled);cc.defineGetterSetter(a,"color",a.getColor,a.setColor);cc.defineGetterSetter(a,"cascadeColor",a.isCascadeColorEnabled,a.setCascadeColorEnabled)};cc.NODE_TAG_INVALID=-1;cc.s_globalOrderOfArrival=1; cc.Node=cc.Class.extend({_localZOrder:0,_globalZOrder:0,_vertexZ:0,_customZ:NaN,_rotationX:0,_rotationY:0,_scaleX:1,_scaleY:1,_position:null,_normalizedPosition:null,_usingNormalizedPosition:!1,_normalizedPositionDirty:!1,_skewX:0,_skewY:0,_children:null,_visible:!0,_anchorPoint:null,_contentSize:null,_running:!1,_parent:null,_ignoreAnchorPointForPosition:!1,tag:cc.NODE_TAG_INVALID,userData:null,userObject:null,_reorderChildDirty:!1,arrivalOrder:0,_actionManager:null,_scheduler:null,_additionalTransformDirty:!1, _additionalTransform:null,_componentContainer:null,_isTransitionFinished:!1,_className:"Node",_showNode:!1,_name:"",_realOpacity:255,_realColor:null,_cascadeColorEnabled:!1,_cascadeOpacityEnabled:!1,_renderCmd:null,ctor:function(){this._anchorPoint=cc.p(0,0);this._contentSize=cc.size(0,0);this._position=cc.p(0,0);this._normalizedPosition=cc.p(0,0);this._children=[];this._additionalTransform=cc.affineTransformMakeIdentity();cc.ComponentContainer&&(this._componentContainer=new cc.ComponentContainer(this)); this._realColor=cc.color(255,255,255,255);this._renderCmd=this._createRenderCmd()},init:function(){return!0},attr:function(a){for(var b in a)this[b]=a[b]},getSkewX:function(){return this._skewX},setSkewX:function(a){this._skewX=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getSkewY:function(){return this._skewY},setSkewY:function(a){this._skewY=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},setLocalZOrder:function(a){this._parent?this._parent.reorderChild(this, a):this._localZOrder=a;cc.eventManager._setDirtyForNode(this)},_setLocalZOrder:function(a){this._localZOrder=a},getLocalZOrder:function(){return this._localZOrder},getZOrder:function(){cc.log(cc._LogInfos.Node_getZOrder);return this.getLocalZOrder()},setZOrder:function(a){cc.log(cc._LogInfos.Node_setZOrder);this.setLocalZOrder(a)},setGlobalZOrder:function(a){this._globalZOrder!==a&&(this._globalZOrder=a,cc.eventManager._setDirtyForNode(this))},getGlobalZOrder:function(){return this._globalZOrder}, getVertexZ:function(){return this._vertexZ},setVertexZ:function(a){this._customZ=this._vertexZ=a},getRotation:function(){this._rotationX!==this._rotationY&&cc.log(cc._LogInfos.Node_getRotation);return this._rotationX},setRotation:function(a){this._rotationX=this._rotationY=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getRotationX:function(){return this._rotationX},setRotationX:function(a){this._rotationX=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getRotationY:function(){return this._rotationY}, setRotationY:function(a){this._rotationY=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getScale:function(){this._scaleX!==this._scaleY&&cc.log(cc._LogInfos.Node_getScale);return this._scaleX},setScale:function(a,b){this._scaleX=a;this._scaleY=b||0===b?b:a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getScaleX:function(){return this._scaleX},setScaleX:function(a){this._scaleX=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getScaleY:function(){return this._scaleY}, setScaleY:function(a){this._scaleY=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},setPosition:function(a,b){var c=this._position;if(void 0===b){if(c.x===a.x&&c.y===a.y)return;c.x=a.x;c.y=a.y}else{if(c.x===a&&c.y===b)return;c.x=a;c.y=b}this._usingNormalizedPosition=!1;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},setNormalizedPosition:function(a,b){var c=this._normalizedPosition;void 0===b?(c.x=a.x,c.y=a.y):(c.x=a,c.y=b);this._normalizedPositionDirty=this._usingNormalizedPosition= !0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getPosition:function(){return cc.p(this._position)},getNormalizedPosition:function(){return cc.p(this._normalizedPosition)},getPositionX:function(){return this._position.x},setPositionX:function(a){this._position.x=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getPositionY:function(){return this._position.y},setPositionY:function(a){this._position.y=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)}, getChildrenCount:function(){return this._children.length},getChildren:function(){return this._children},isVisible:function(){return this._visible},setVisible:function(a){this._visible!==a&&(this._visible=a,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty),cc.renderer.childrenOrderDirty=!0)},getAnchorPoint:function(){return cc.p(this._anchorPoint)},setAnchorPoint:function(a,b){var c=this._anchorPoint;if(void 0===b){if(a.x===c.x&&a.y===c.y)return;c.x=a.x;c.y=a.y}else{if(a===c.x&&b=== c.y)return;c.x=a;c.y=b}this._renderCmd._updateAnchorPointInPoint()},_getAnchorX:function(){return this._anchorPoint.x},_setAnchorX:function(a){this._anchorPoint.x!==a&&(this._anchorPoint.x=a,this._renderCmd._updateAnchorPointInPoint())},_getAnchorY:function(){return this._anchorPoint.y},_setAnchorY:function(a){this._anchorPoint.y!==a&&(this._anchorPoint.y=a,this._renderCmd._updateAnchorPointInPoint())},getAnchorPointInPoints:function(){return this._renderCmd.getAnchorPointInPoints()},_getWidth:function(){return this._contentSize.width}, _setWidth:function(a){this._contentSize.width=a;this._renderCmd._updateAnchorPointInPoint()},_getHeight:function(){return this._contentSize.height},_setHeight:function(a){this._contentSize.height=a;this._renderCmd._updateAnchorPointInPoint()},getContentSize:function(){return cc.size(this._contentSize)},setContentSize:function(a,b){var c=this._contentSize;if(void 0===b){if(a.width===c.width&&a.height===c.height)return;c.width=a.width;c.height=a.height}else{if(a===c.width&&b===c.height)return;c.width= a;c.height=b}this._renderCmd._updateAnchorPointInPoint()},isRunning:function(){return this._running},getParent:function(){return this._parent},setParent:function(a){this._parent=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},isIgnoreAnchorPointForPosition:function(){return this._ignoreAnchorPointForPosition},ignoreAnchorPointForPosition:function(a){a!==this._ignoreAnchorPointForPosition&&(this._ignoreAnchorPointForPosition=a,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty))}, getTag:function(){return this.tag},setTag:function(a){this.tag=a},setName:function(a){this._name=a},getName:function(){return this._name},getUserData:function(){return this.userData},setUserData:function(a){this.userData=a},getUserObject:function(){return this.userObject},setUserObject:function(a){this.userObject!==a&&(this.userObject=a)},getOrderOfArrival:function(){return this.arrivalOrder},setOrderOfArrival:function(a){this.arrivalOrder=a},getActionManager:function(){return this._actionManager|| cc.director.getActionManager()},setActionManager:function(a){this._actionManager!==a&&(this.stopAllActions(),this._actionManager=a)},getScheduler:function(){return this._scheduler||cc.director.getScheduler()},setScheduler:function(a){this._scheduler!==a&&(this.unscheduleAllCallbacks(),this._scheduler=a)},boundingBox:function(){cc.log(cc._LogInfos.Node_boundingBox);return this.getBoundingBox()},getBoundingBox:function(){var a=cc.rect(0,0,this._contentSize.width,this._contentSize.height);return cc._rectApplyAffineTransformIn(a, this.getNodeToParentTransform())},cleanup:function(){this.stopAllActions();this.unscheduleAllCallbacks();cc.eventManager.removeListeners(this)},getChildByTag:function(a){var b=this._children;if(null!==b)for(var c=0;c<b.length;c++){var d=b[c];if(d&&d.tag===a)return d}return null},getChildByName:function(a){if(!a)return cc.log("Invalid name"),null;for(var b=this._children,c=0,d=b.length;c<d;c++)if(b[c]._name===a)return b[c];return null},addChild:function(a,b,c){b=void 0===b?a._localZOrder:b;var d,e= !1;void 0===c?d=a._name:"string"===typeof c?(d=c,c=void 0):"number"===typeof c&&(e=!0,d="");cc.assert(a,cc._LogInfos.Node_addChild_3);cc.assert(null===a._parent,"child already added. It can't be added again");this._addChildHelper(a,b,c,d,e)},_addChildHelper:function(a,b,c,d,e){this._children||(this._children=[]);this._insertChild(a,b);e?a.setTag(c):a.setName(d);a.setParent(this);a.setOrderOfArrival(cc.s_globalOrderOfArrival++);this._running&&(a._performRecursive(cc.Node._stateCallbackType.onEnter), this._isTransitionFinished&&a._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish));a._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);this._cascadeColorEnabled&&a._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty);this._cascadeOpacityEnabled&&a._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty)},removeFromParent:function(a){this._parent&&(void 0===a&&(a=!0),this._parent.removeChild(this,a))},removeFromParentAndCleanup:function(a){cc.log(cc._LogInfos.Node_removeFromParentAndCleanup); this.removeFromParent(a)},removeChild:function(a,b){0!==this._children.length&&(void 0===b&&(b=!0),-1<this._children.indexOf(a)&&this._detachChild(a,b),cc.renderer.childrenOrderDirty=!0)},removeChildByTag:function(a,b){a===cc.NODE_TAG_INVALID&&cc.log(cc._LogInfos.Node_removeChildByTag);var c=this.getChildByTag(a);c?this.removeChild(c,b):cc.log(cc._LogInfos.Node_removeChildByTag_2,a)},removeAllChildrenWithCleanup:function(a){this.removeAllChildren(a)},removeAllChildren:function(a){var b=this._children; if(null!==b){void 0===a&&(a=!0);for(var c=0;c<b.length;c++){var d=b[c];d&&(this._running&&(d._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),d._performRecursive(cc.Node._stateCallbackType.onExit)),a&&d._performRecursive(cc.Node._stateCallbackType.cleanup),d.parent=null,d._renderCmd.detachFromParent())}this._children.length=0;cc.renderer.childrenOrderDirty=!0}},_detachChild:function(a,b){this._running&&(a._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart), a._performRecursive(cc.Node._stateCallbackType.onExit));b&&a._performRecursive(cc.Node._stateCallbackType.cleanup);a.parent=null;a._renderCmd.detachFromParent();cc.arrayRemoveObject(this._children,a)},_insertChild:function(a,b){cc.renderer.childrenOrderDirty=this._reorderChildDirty=!0;this._children.push(a);a._setLocalZOrder(b)},setNodeDirty:function(){this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},reorderChild:function(a,b){cc.assert(a,cc._LogInfos.Node_reorderChild);-1===this._children.indexOf(a)? cc.log(cc._LogInfos.Node_reorderChild_2):b!==a.zIndex&&(cc.renderer.childrenOrderDirty=this._reorderChildDirty=!0,a.arrivalOrder=cc.s_globalOrderOfArrival,cc.s_globalOrderOfArrival++,a._setLocalZOrder(b),this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.orderDirty))},sortAllChildren:function(){if(this._reorderChildDirty){var a=this._children,b=a.length,c,d,e;for(c=1;c<b;c++){e=a[c];for(d=c-1;0<=d;){if(e._localZOrder<a[d]._localZOrder)a[d+1]=a[d];else if(e._localZOrder===a[d]._localZOrder&&e.arrivalOrder< a[d].arrivalOrder)a[d+1]=a[d];else break;d--}a[d+1]=e}this._reorderChildDirty=!1}},draw:function(a){},transformAncestors:function(){null!==this._parent&&(this._parent.transformAncestors(),this._parent.transform())},onEnter:function(){this._isTransitionFinished=!1;this._running=!0;this.resume()},_performRecursive:function(a){var b=cc.Node._stateCallbackType;if(!(a>=b.max)){var c=0,d,e,f,g,h,k=cc.Node._performStacks[cc.Node._performing];k||(k=[],cc.Node._performStacks.push(k));k.length=0;cc.Node._performing++; for(f=k[0]=this;f;){if((d=f._children)&&0<d.length)for(g=0,h=d.length;g<h;++g)e=d[g],k.push(e);if((d=f._protectedChildren)&&0<d.length)for(g=0,h=d.length;g<h;++g)e=d[g],k.push(e);c++;f=k[c]}for(g=k.length-1;0<=g;--g)if(f=k[g],k[g]=null,f)switch(a){case b.onEnter:f.onEnter();break;case b.onExit:f.onExit();break;case b.onEnterTransitionDidFinish:f.onEnterTransitionDidFinish();break;case b.cleanup:f.cleanup();break;case b.onExitTransitionDidStart:f.onExitTransitionDidStart()}cc.Node._performing--}}, onEnterTransitionDidFinish:function(){this._isTransitionFinished=!0},onExitTransitionDidStart:function(){},onExit:function(){this._running=!1;this.pause();this.removeAllComponents()},runAction:function(a){cc.assert(a,cc._LogInfos.Node_runAction);this.actionManager.addAction(a,this,!this._running);return a},stopAllActions:function(){this.actionManager&&this.actionManager.removeAllActionsFromTarget(this)},stopAction:function(a){this.actionManager.removeAction(a)},stopActionByTag:function(a){a===cc.ACTION_TAG_INVALID? cc.log(cc._LogInfos.Node_stopActionByTag):this.actionManager.removeActionByTag(a,this)},getActionByTag:function(a){return a===cc.ACTION_TAG_INVALID?(cc.log(cc._LogInfos.Node_getActionByTag),null):this.actionManager.getActionByTag(a,this)},getNumberOfRunningActions:function(){return this.actionManager.numberOfRunningActionsInTarget(this)},scheduleUpdate:function(){this.scheduleUpdateWithPriority(0)},scheduleUpdateWithPriority:function(a){this.scheduler.scheduleUpdate(this,a,!this._running)},unscheduleUpdate:function(){this.scheduler.unscheduleUpdate(this)}, schedule:function(a,b,c,d,e){var f=arguments.length;"function"===typeof a?1===f?(b=0,c=cc.REPEAT_FOREVER,d=0,e=this.__instanceId):2===f?"number"===typeof b?(c=cc.REPEAT_FOREVER,d=0,e=this.__instanceId):(e=b,b=0,c=cc.REPEAT_FOREVER,d=0):3===f?("string"===typeof c?(e=c,c=cc.REPEAT_FOREVER):e=this.__instanceId,d=0):4===f&&(e=this.__instanceId):1===f?(b=0,c=cc.REPEAT_FOREVER,d=0):2===f&&(c=cc.REPEAT_FOREVER,d=0);cc.assert(a,cc._LogInfos.Node_schedule);cc.assert(0<=b,cc._LogInfos.Node_schedule_2);b=b|| 0;c=isNaN(c)?cc.REPEAT_FOREVER:c;this.scheduler.schedule(a,this,b,c,d||0,!this._running,e)},scheduleOnce:function(a,b,c){void 0===c&&(c=this.__instanceId);this.schedule(a,0,0,b,c)},unschedule:function(a){a&&this.scheduler.unschedule(a,this)},unscheduleAllCallbacks:function(){this.scheduler.unscheduleAllForTarget(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(a){if(void 0===a)return this._additionalTransformDirty=!1;this._additionalTransform=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);this._additionalTransformDirty=!0},getParentToNodeTransform:function(){return this._renderCmd.getParentToNodeTransform()}, parentToNodeTransform:function(){return this.getParentToNodeTransform()},getNodeToWorldTransform:function(){for(var a=this.getNodeToParentTransform(),b=this._parent;null!==b;b=b.parent)a=cc.affineTransformConcat(a,b.getNodeToParentTransform());return a},nodeToWorldTransform:function(){return this.getNodeToWorldTransform()},getWorldToNodeTransform:function(){return cc.affineTransformInvert(this.getNodeToWorldTransform())},worldToNodeTransform:function(){return this.getWorldToNodeTransform()},convertToNodeSpace:function(a){return cc.pointApplyAffineTransform(a, this.getWorldToNodeTransform())},convertToWorldSpace:function(a){a=a||cc.p(0,0);return cc.pointApplyAffineTransform(a,this.getNodeToWorldTransform())},convertToNodeSpaceAR:function(a){return cc.pSub(this.convertToNodeSpace(a),this._renderCmd.getAnchorPointInPoints())},convertToWorldSpaceAR:function(a){a=a||cc.p(0,0);a=cc.pAdd(a,this._renderCmd.getAnchorPointInPoints());return this.convertToWorldSpace(a)},_convertToWindowSpace:function(a){a=this.convertToWorldSpace(a);return cc.director.convertToUI(a)}, convertTouchToNodeSpace:function(a){a=a.getLocation();return this.convertToNodeSpace(a)},convertTouchToNodeSpaceAR:function(a){a=cc.director.convertToGL(a.getLocation());return this.convertToNodeSpaceAR(a)},update:function(a){this._componentContainer&&!this._componentContainer.isEmpty()&&this._componentContainer.visit(a)},updateTransform:function(){for(var a=this._children,b=0;b<a.length;b++)varnode=a[b]},retain:function(){},release:function(){},getComponent:function(a){return this._componentContainer? this._componentContainer.getComponent(a):null},addComponent:function(a){this._componentContainer&&this._componentContainer.add(a)},removeComponent:function(a){return this._componentContainer?this._componentContainer.remove(a):!1},removeAllComponents:function(){this._componentContainer&&this._componentContainer.removeAll()},grid:null,visit:function(a){if(this._visible){var b=cc.renderer,c=this._renderCmd;c.visit(a&&a._renderCmd);var d=this._children,e=d.length,f;if(0<e){this._reorderChildDirty&&this.sortAllChildren(); for(a=0;a<e;a++)if(f=d[a],0>f._localZOrder)f.visit(this);else break;for(b.pushRenderCommand(c);a<e;a++)d[a].visit(this)}else b.pushRenderCommand(c);c._dirtyFlag=0}},transform:function(a,b){this._renderCmd.transform(a,b)},nodeToParentTransform:function(){return this.getNodeToParentTransform()},getNodeToParentTransform:function(a){var b=this._renderCmd.getNodeToParentTransform();if(a)for(var b={a:b.a,b:b.b,c:b.c,d:b.d,tx:b.tx,ty:b.ty},c=this._parent;null!=c&&c!=a;c=c.getParent())cc.affineTransformConcatIn(b, c.getNodeToParentTransform());return b},getNodeToParentAffineTransform:function(a){return this.getNodeToParentTransform(a)},getCamera:function(){return null},getGrid:function(){return this.grid},setGrid:function(a){this.grid=a},getShaderProgram:function(){return this._renderCmd.getShaderProgram()},setShaderProgram:function(a){this._renderCmd.setShaderProgram(a)},getGLServerState:function(){return 0},setGLServerState:function(a){},getBoundingBoxToWorld:function(){var a=cc.rect(0,0,this._contentSize.width, this._contentSize.height),b=this.getNodeToWorldTransform(),a=cc.rectApplyAffineTransform(a,b);if(!this._children)return a;for(var c=this._children,d=0;d<c.length;d++){var e=c[d];e&&e._visible&&(e=e._getBoundingBoxToCurrentNode(b))&&(a=cc.rectUnion(a,e))}return a},_getBoundingBoxToCurrentNode:function(a){var b=cc.rect(0,0,this._contentSize.width,this._contentSize.height);a=void 0===a?this.getNodeToParentTransform():cc.affineTransformConcat(this.getNodeToParentTransform(),a);b=cc.rectApplyAffineTransform(b, a);if(!this._children)return b;for(var c=this._children,d=0;d<c.length;d++){var e=c[d];e&&e._visible&&(e=e._getBoundingBoxToCurrentNode(a))&&(b=cc.rectUnion(b,e))}return b},getOpacity:function(){return this._realOpacity},getDisplayedOpacity:function(){return this._renderCmd.getDisplayedOpacity()},setOpacity:function(a){this._realOpacity=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty)},updateDisplayedOpacity:function(a){this._renderCmd._updateDisplayOpacity(a)},isCascadeOpacityEnabled:function(){return this._cascadeOpacityEnabled}, setCascadeOpacityEnabled:function(a){this._cascadeOpacityEnabled!==a&&(this._cascadeOpacityEnabled=a,this._renderCmd.setCascadeOpacityEnabledDirty())},getColor:function(){var a=this._realColor;return cc.color(a.r,a.g,a.b,a.a)},getDisplayedColor:function(){return this._renderCmd.getDisplayedColor()},setColor:function(a){var b=this._realColor;b.r=a.r;b.g=a.g;b.b=a.b;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty)},updateDisplayedColor:function(a){this._renderCmd._updateDisplayColor(a)}, isCascadeColorEnabled:function(){return this._cascadeColorEnabled},setCascadeColorEnabled:function(a){this._cascadeColorEnabled!==a&&(this._cascadeColorEnabled=a,this._renderCmd.setCascadeColorEnabledDirty())},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.Node.CanvasRenderCmd(this):new cc.Node.WebGLRenderCmd(this)},enumerateChildren:function(a,b){cc.assert(a&&0!=a.length,"Invalid name"); cc.assert(null!=b,"Invalid callback function");var c=a.length,d=0,e=c,f=!1;2<c&&"/"===a[0]&&"/"===a[1]&&(f=!0,d=2,e-=2);var g=!1;3<c&&"/"===a[c-3]&&"."===a[c-2]&&"."===a[c-1]&&(g=!0,e-=3);c=a.substr(d,e);g&&(c="[[:alnum:]]+/"+c);f?this.doEnumerateRecursive(this,c,b):this.doEnumerate(c,b)},doEnumerateRecursive:function(a,b,c){var d=!1;if(a.doEnumerate(b,c))d=!0;else for(var e=a.getChildren(),f=e.length,g=0;g<f;g++)if(a=e[g],this.doEnumerateRecursive(a,b,c)){d=!0;break}return d},doEnumerate:function(a, b){var c=a.indexOf("/"),d=a,e=!1;-1!==c&&(d=a.substr(0,c),e=!0);for(var c=!1,f,g=this._children,h=g.length,k=0;k<h;k++)if(f=g[k],-1!==f._name.indexOf(d))if(e){if(c=f.doEnumerate(a,b))break}else if(b(f)){c=!0;break}return c}});cc.Node.create=function(){return new cc.Node};cc.Node._stateCallbackType={onEnter:1,onExit:2,cleanup:3,onEnterTransitionDidFinish:4,onExitTransitionDidStart:5,max:6};cc.Node._performStacks=[[]];cc.Node._performing=0; cc.assert(cc.isFunction(cc._tmp.PrototypeCCNode),cc._LogInfos.MissingFile,"BaseNodesPropertyDefine.js");cc._tmp.PrototypeCCNode();delete cc._tmp.PrototypeCCNode;cc.CustomRenderCmd=function(a,b){this._needDraw=!0;this._target=a;this._callback=b};cc.CustomRenderCmd.prototype.rendering=function(a,b,c){this._callback&&this._callback.call(this._target,a,b,c)};cc.CustomRenderCmd.prototype.needDraw=function(){return this._needDraw};var dirtyFlags=cc.Node._dirtyFlags={transformDirty:1,visibleDirty:2,colorDirty:4,opacityDirty:8,cacheDirty:16,orderDirty:32,textDirty:64,gradientDirty:128,textureDirty:256,contentDirty:512,COUNT:10,all:1023},ONE_DEGREE=Math.PI/180; function transformChildTree(a){var b=1,c,d,e,f,g,h=cc.Node._performStacks[cc.Node._performing];h||(h=[],cc.Node._performStacks.push(h));h.length=0;cc.Node._performing++;for(h[0]=a;b;)if(b--,d=h[b],h[b]=null,d){if((c=d._children)&&0<c.length)for(e=d._renderCmd,f=0,g=c.length;f<g;++f)a=c[f],h[b]=a,b++,a._renderCmd.transform(e);if((c=d._protectedChildren)&&0<c.length)for(e=d._renderCmd,f=0,g=c.length;f<g;++f)a=c[f],h[b]=a,b++,a._renderCmd.transform(e)}cc.Node._performing--} cc.Node.RenderCmd=function(a){this._node=a;this._anchorPointInPoints={x:0,y:0};this._displayedColor=cc.color(255,255,255,255)}; cc.Node.RenderCmd.prototype={constructor:cc.Node.RenderCmd,_needDraw:!1,_dirtyFlag:1,_curLevel:-1,_displayedOpacity:255,_cascadeColorEnabledDirty:!1,_cascadeOpacityEnabledDirty:!1,_transform:null,_worldTransform:null,_inverse:null,needDraw:function(){return this._needDraw},getAnchorPointInPoints:function(){return cc.p(this._anchorPointInPoints)},getDisplayedColor:function(){var a=this._displayedColor;return cc.color(a.r,a.g,a.b,a.a)},getDisplayedOpacity:function(){return this._displayedOpacity},setCascadeColorEnabledDirty:function(){this._cascadeColorEnabledDirty= !0;this.setDirtyFlag(cc.Node._dirtyFlags.colorDirty)},setCascadeOpacityEnabledDirty:function(){this._cascadeOpacityEnabledDirty=!0;this.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty)},getParentToNodeTransform:function(){this._inverse||(this._inverse={a:1,b:0,c:0,d:1,tx:0,ty:0});this._dirtyFlag&cc.Node._dirtyFlags.transformDirty&&cc.affineTransformInvertOut(this.getNodeToParentTransform(),this._inverse);return this._inverse},detachFromParent:function(){},_updateAnchorPointInPoint:function(){var a= this._anchorPointInPoints,b=this._node._contentSize,c=this._node._anchorPoint;a.x=b.width*c.x;a.y=b.height*c.y;this.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},setDirtyFlag:function(a){0===this._dirtyFlag&&0!==a&&cc.renderer.pushDirtyNode(this);this._dirtyFlag|=a},getParentRenderCmd:function(){return this._node&&this._node._parent&&this._node._parent._renderCmd?this._node._parent._renderCmd:null},transform:function(a,b){this._transform||(this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0},this._worldTransform= {a:1,b:0,c:0,d:1,tx:0,ty:0});var c=this._node,d=a?a._worldTransform:null,e=this._transform,f=this._worldTransform;if(c._usingNormalizedPosition&&c._parent){var g=c._parent._contentSize;c._position.x=c._normalizedPosition.x*g.width;c._position.y=c._normalizedPosition.y*g.height;c._normalizedPositionDirty=!1}var h=c._rotationX||c._rotationY,k=c._skewX||c._skewY,m=c._scaleX,n=c._scaleY,g=this._anchorPointInPoints.x,p=this._anchorPointInPoints.y,r=1,s=0,u=0,t=1;if(h||k){e.tx=c._position.x;e.ty=c._position.y; h&&(r=c._rotationX*ONE_DEGREE,u=Math.sin(r),t=Math.cos(r),c._rotationY===c._rotationX?(r=t,s=-u):(s=c._rotationY*ONE_DEGREE,r=Math.cos(s),s=-Math.sin(s)));e.a=r*=m;e.b=s*=m;e.c=u*=n;e.d=t*=n;k&&(k=Math.tan(c._skewX*ONE_DEGREE),m=Math.tan(c._skewY*ONE_DEGREE),Infinity===k&&(k=99999999),Infinity===m&&(m=99999999),e.a=r+u*m,e.b=s+t*m,e.c=u+r*k,e.d=t+s*k);if(g||p)e.tx-=e.a*g+e.c*p,e.ty-=e.b*g+e.d*p,c._ignoreAnchorPointForPosition&&(e.tx+=g,e.ty+=p);c._additionalTransformDirty&&cc.affineTransformConcatIn(e, c._additionalTransform);d?(f.a=e.a*d.a+e.b*d.c,f.b=e.a*d.b+e.b*d.d,f.c=e.c*d.a+e.d*d.c,f.d=e.c*d.b+e.d*d.d,f.tx=d.a*e.tx+d.c*e.ty+d.tx,f.ty=d.d*e.ty+d.ty+d.b*e.tx):(f.a=e.a,f.b=e.b,f.c=e.c,f.d=e.d,f.tx=e.tx,f.ty=e.ty)}else{e.a=m;e.b=0;e.c=0;e.d=n;e.tx=c._position.x;e.ty=c._position.y;if(g||p)e.tx-=e.a*g,e.ty-=e.d*p,c._ignoreAnchorPointForPosition&&(e.tx+=g,e.ty+=p);c._additionalTransformDirty&&cc.affineTransformConcatIn(e,c._additionalTransform);d?(f.a=e.a*d.a+e.b*d.c,f.b=e.a*d.b+e.b*d.d,f.c=e.c* d.a+e.d*d.c,f.d=e.c*d.b+e.d*d.d,f.tx=e.tx*d.a+e.ty*d.c+d.tx,f.ty=e.tx*d.b+e.ty*d.d+d.ty):(f.a=e.a,f.b=e.b,f.c=e.c,f.d=e.d,f.tx=e.tx,f.ty=e.ty)}this._updateCurrentRegions&&(this._updateCurrentRegions(),this._notifyRegionStatus&&this._notifyRegionStatus(cc.Node.CanvasRenderCmd.RegionStatus.DirtyDouble));b&&transformChildTree(c);this._cacheDirty=!0},getNodeToParentTransform:function(){(!this._transform||this._dirtyFlag&cc.Node._dirtyFlags.transformDirty)&&this.transform();return this._transform},visit:function(a){var b= this._node,c=cc.renderer;if(a=a||this.getParentRenderCmd())this._curLevel=a._curLevel+1;isNaN(b._customZ)&&(b._vertexZ=c.assignedZ,c.assignedZ+=c.assignedZStep);this._syncStatus(a)},_updateDisplayColor:function(a){var b=this._node,c=this._displayedColor,d=b._realColor,e;this._notifyRegionStatus&&this._notifyRegionStatus(cc.Node.CanvasRenderCmd.RegionStatus.Dirty);if(this._cascadeColorEnabledDirty&&!b._cascadeColorEnabled){c.r=d.r;c.g=d.g;c.b=d.b;c=new cc.Color(255,255,255,255);a=b._children;b=0;for(d= a.length;b<d;b++)(e=a[b])&&e._renderCmd&&e._renderCmd._updateDisplayColor(c);this._cascadeColorEnabledDirty=!1}else if(void 0===a&&(a=(a=b._parent)&&a._cascadeColorEnabled?a.getDisplayedColor():cc.color.WHITE),c.r=0|d.r*a.r/255,c.g=0|d.g*a.g/255,c.b=0|d.b*a.b/255,b._cascadeColorEnabled)for(a=b._children,b=0,d=a.length;b<d;b++)(e=a[b])&&e._renderCmd&&(e._renderCmd._updateDisplayColor(c),e._renderCmd._updateColor());this._dirtyFlag&=~dirtyFlags.colorDirty},_updateDisplayOpacity:function(a){var b=this._node, c,d;this._notifyRegionStatus&&this._notifyRegionStatus(cc.Node.CanvasRenderCmd.RegionStatus.Dirty);if(this._cascadeOpacityEnabledDirty&&!b._cascadeOpacityEnabled){this._displayedOpacity=b._realOpacity;c=b._children;a=0;for(b=c.length;a<b;a++)(d=c[a])&&d._renderCmd&&d._renderCmd._updateDisplayOpacity(255);this._cascadeOpacityEnabledDirty=!1}else if(void 0===a&&(c=b._parent,a=255,c&&c._cascadeOpacityEnabled&&(a=c.getDisplayedOpacity())),this._displayedOpacity=b._realOpacity*a/255,b._cascadeOpacityEnabled)for(c= b._children,a=0,b=c.length;a<b;a++)(d=c[a])&&d._renderCmd&&(d._renderCmd._updateDisplayOpacity(this._displayedOpacity),d._renderCmd._updateColor());this._dirtyFlag&=~dirtyFlags.opacityDirty},_syncDisplayColor:function(a){var b=this._node,c=this._displayedColor,d=b._realColor;void 0===a&&(a=(a=b._parent)&&a._cascadeColorEnabled?a.getDisplayedColor():cc.color.WHITE);c.r=0|d.r*a.r/255;c.g=0|d.g*a.g/255;c.b=0|d.b*a.b/255},_syncDisplayOpacity:function(a){var b=this._node;if(void 0===a){var c=b._parent; a=255;c&&c._cascadeOpacityEnabled&&(a=c.getDisplayedOpacity())}this._displayedOpacity=b._realOpacity*a/255},_updateColor:function(){},updateStatus:function(){var a=this._dirtyFlag,b=a&dirtyFlags.colorDirty,c=a&dirtyFlags.opacityDirty;a&dirtyFlags.contentDirty&&(this._notifyRegionStatus&&this._notifyRegionStatus(cc.Node.CanvasRenderCmd.RegionStatus.Dirty),this._dirtyFlag&=~dirtyFlags.contentDirty);b&&this._updateDisplayColor();c&&this._updateDisplayOpacity();(b||c)&&this._updateColor();a&dirtyFlags.transformDirty&& (this.transform(this.getParentRenderCmd(),!0),this._dirtyFlag&=~dirtyFlags.transformDirty);a&dirtyFlags.orderDirty&&(this._dirtyFlag&=~dirtyFlags.orderDirty)},_syncStatus:function(a){var b=this._dirtyFlag,c=a?a._node:null;c&&c._cascadeColorEnabled&&a._dirtyFlag&dirtyFlags.colorDirty&&(b|=dirtyFlags.colorDirty);c&&c._cascadeOpacityEnabled&&a._dirtyFlag&dirtyFlags.opacityDirty&&(b|=dirtyFlags.opacityDirty);a&&a._dirtyFlag&dirtyFlags.transformDirty&&(b|=dirtyFlags.transformDirty);this._dirtyFlag=b;var c= b&dirtyFlags.colorDirty,d=b&dirtyFlags.opacityDirty;c&&this._syncDisplayColor();d&&this._syncDisplayOpacity();(c||d)&&this._updateColor();b&dirtyFlags.transformDirty&&this.transform(a);b&dirtyFlags.orderDirty&&(this._dirtyFlag&=~dirtyFlags.orderDirty)}};cc.Node.RenderCmd.prototype.originTransform=cc.Node.RenderCmd.prototype.transform;cc.Node.RenderCmd.prototype.originUpdateStatus=cc.Node.RenderCmd.prototype.updateStatus;cc.Node.RenderCmd.prototype._originSyncStatus=cc.Node.RenderCmd.prototype._syncStatus; (function(){cc.Node.CanvasRenderCmd=function(a){this._node=a;this._anchorPointInPoints={x:0,y:0};this._displayedColor=cc.color(255,255,255,255);this._cachedParent=null;this._cacheDirty=!1;this._currentRegion=new cc.Region;this._oldRegion=new cc.Region;this._regionFlag=0;this._canUseDirtyRegion=!1};cc.Node.CanvasRenderCmd.RegionStatus={NotDirty:0,Dirty:1,DirtyDouble:2};var a=cc.Node.CanvasRenderCmd.prototype=Object.create(cc.Node.RenderCmd.prototype);a.constructor=cc.Node.CanvasRenderCmd;a._rootCtor= cc.Node.CanvasRenderCmd;a._notifyRegionStatus=function(a){this._needDraw&&this._regionFlag<a&&(this._regionFlag=a)};var b=new cc.Rect;a.getLocalBB=function(){var a=this._node;b.x=b.y=0;b.width=a._contentSize.width;b.height=a._contentSize.height;return b};a._updateCurrentRegions=function(){var a=this._currentRegion;this._currentRegion=this._oldRegion;this._oldRegion=a;cc.Node.CanvasRenderCmd.RegionStatus.DirtyDouble!==this._regionFlag||this._currentRegion.isEmpty()||this._oldRegion.union(this._currentRegion); this._currentRegion.updateRegion(this.getLocalBB(),this._worldTransform)};a.setDirtyFlag=function(a,b){cc.Node.RenderCmd.prototype.setDirtyFlag.call(this,a,b);this._setCacheDirty(b);this._cachedParent&&this._cachedParent.setDirtyFlag(a,!0)};a._setCacheDirty=function(){if(!1===this._cacheDirty){this._cacheDirty=!0;var a=this._cachedParent;a&&a!==this&&a._setNodeDirtyForCache&&a._setNodeDirtyForCache()}};a._setCachedParent=function(a){if(this._cachedParent!==a){this._cachedParent=a;for(var b=this._node._children, e=0,f=b.length;e<f;e++)b[e]._renderCmd._setCachedParent(a)}};a.detachFromParent=function(){this._cachedParent=null;for(var a=this._node._children,b,e=0,f=a.length;e<f;e++)(b=a[e])&&b._renderCmd&&b._renderCmd.detachFromParent()};a.setShaderProgram=function(a){};a.getShaderProgram=function(){return null};cc.Node.CanvasRenderCmd._getCompositeOperationByBlendFunc=function(a){return a?a.src===cc.SRC_ALPHA&&a.dst===cc.ONE||a.src===cc.ONE&&a.dst===cc.ONE?"lighter":a.src===cc.ZERO&&a.dst===cc.SRC_ALPHA?"destination-in": a.src===cc.ZERO&&a.dst===cc.ONE_MINUS_SRC_ALPHA?"destination-out":"source-over":"source-over"}})();(function(){cc.Node.WebGLRenderCmd=function(a){this._node=a;this._anchorPointInPoints={x:0,y:0};this._displayedColor=cc.color(255,255,255,255);this._shaderProgram=null};var a=cc.Node.WebGLRenderCmd.prototype=Object.create(cc.Node.RenderCmd.prototype);a.constructor=cc.Node.WebGLRenderCmd;a._rootCtor=cc.Node.WebGLRenderCmd;a._updateColor=function(){};a.setShaderProgram=function(a){this._shaderProgram=a};a.getShaderProgram=function(){return this._shaderProgram}})();cc.AtlasNode=cc.Node.extend({textureAtlas:null,quadsToDraw:0,_itemsPerRow:0,_itemsPerColumn:0,_itemWidth:0,_itemHeight:0,_opacityModifyRGB:!1,_blendFunc:null,_ignoreContentScaleFactor:!1,_className:"AtlasNode",_texture:null,_textureForCanvas:null,ctor:function(a,b,c,d){cc.Node.prototype.ctor.call(this);this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};this._ignoreContentScaleFactor=!1;void 0!==d&&this.initWithTileFile(a,b,c,d)},_createRenderCmd:function(){this._renderCmd=cc._renderType===cc.game.RENDER_TYPE_CANVAS? new cc.AtlasNode.CanvasRenderCmd(this):new cc.AtlasNode.WebGLRenderCmd(this)},updateAtlasValues:function(){cc.log(cc._LogInfos.AtlasNode_updateAtlasValues)},getColor:function(){return this._opacityModifyRGB?this._renderCmd._colorUnmodified:cc.Node.prototype.getColor.call(this)},setOpacityModifyRGB:function(a){var b=this.color;this._opacityModifyRGB=a;this.setColor(b)},isOpacityModifyRGB:function(){return this._opacityModifyRGB},getBlendFunc:function(){return this._blendFunc},setBlendFunc:function(a, b){this._blendFunc=void 0===b?a:{src:a,dst:b}},setTextureAtlas:function(a){this.textureAtlas=a},getTextureAtlas:function(){return this.textureAtlas},getQuadsToDraw:function(){return this.quadsToDraw},setQuadsToDraw:function(a){this.quadsToDraw=a},initWithTileFile:function(a,b,c,d){if(!a)throw Error("cc.AtlasNode.initWithTileFile(): title should not be null");a=cc.textureCache.addImage(a);return this.initWithTexture(a,b,c,d)},initWithTexture:function(a,b,c,d){return this._renderCmd.initWithTexture(a, b,c,d)},setColor:function(a){this._renderCmd.setColor(a)},setOpacity:function(a){this._renderCmd.setOpacity(a)},getTexture:function(){return this._texture},setTexture:function(a){this._texture=a},_setIgnoreContentScaleFactor:function(a){this._ignoreContentScaleFactor=a}});_p=cc.AtlasNode.prototype;cc.defineGetterSetter(_p,"opacity",_p.getOpacity,_p.setOpacity);cc.defineGetterSetter(_p,"color",_p.getColor,_p.setColor);cc.defineGetterSetter(_p,"texture",_p.getTexture,_p.setTexture);cc.EventHelper.prototype.apply(_p); cc.AtlasNode.create=function(a,b,c,d){return new cc.AtlasNode(a,b,c,d)};(function(){cc.AtlasNode.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1;this._colorUnmodified=cc.color.WHITE;this._textureToRender=null};var a=cc.AtlasNode.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.AtlasNode.CanvasRenderCmd;a.initWithTexture=function(a,c,d,e){var f=this._node;f._itemWidth=c;f._itemHeight=d;f._opacityModifyRGB=!0;f._texture=a;if(!f._texture)return cc.log(cc._LogInfos.AtlasNode__initWithTexture),!1;this._textureToRender= a;this._calculateMaxItems();f.quadsToDraw=e;return!0};a.setColor=function(a){var c=this._node._realColor;if(c.r!==a.r||c.g!==a.g||c.b!==a.b)this._colorUnmodified=a,this._changeTextureColor()};a._changeTextureColor=function(){var a=this._node._texture,c=this._colorUnmodified,d=a.getHtmlElementObj(),d=cc.rect(0,0,d.width,d.height);a===this._textureToRender?this._textureToRender=a._generateColorTexture(c.r,c.g,c.b,d):a._generateColorTexture(c.r,c.g,c.b,d,this._textureToRender.getHtmlElementObj())};a.setOpacity= function(a){cc.Node.prototype.setOpacity.call(this._node,a)};a._calculateMaxItems=function(){var a=this._node,c=a._texture.getContentSize();a._itemsPerColumn=0|c.height/a._itemHeight;a._itemsPerRow=0|c.width/a._itemWidth}})();(function(){cc.AtlasNode.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._textureAtlas=null;this._colorUnmodified=cc.color.WHITE;this._uniformColor=this._colorF32Array=null;this._matrix=new cc.math.Matrix4;this._matrix.identity();this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURE_UCOLOR);this._uniformColor=cc._renderContext.getUniformLocation(this._shaderProgram.getProgram(),"u_color")};var a=cc.AtlasNode.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype); a.constructor=cc.AtlasNode.WebGLRenderCmd;a._updateBlendFunc=function(){var a=this._node;this._textureAtlas.texture.hasPremultipliedAlpha()||(a._blendFunc.src=cc.SRC_ALPHA,a._blendFunc.dst=cc.ONE_MINUS_SRC_ALPHA)};a._updateOpacityModifyRGB=function(){this._node._opacityModifyRGB=this._textureAtlas.texture.hasPremultipliedAlpha()};a.rendering=function(a){a=a||cc._renderContext;var c=this._node,d=this._worldTransform;this._matrix.mat[0]=d.a;this._matrix.mat[4]=d.c;this._matrix.mat[12]=d.tx;this._matrix.mat[1]= d.b;this._matrix.mat[5]=d.d;this._matrix.mat[13]=d.ty;this._shaderProgram.use();this._shaderProgram._setUniformForMVPMatrixWithMat4(this._matrix);cc.glBlendFunc(c._blendFunc.src,c._blendFunc.dst);this._uniformColor&&this._colorF32Array&&(a.uniform4fv(this._uniformColor,this._colorF32Array),this._textureAtlas.drawNumberOfQuads(c.quadsToDraw,0))};a.initWithTexture=function(a,c,d,e){var f=this._node;f._itemWidth=c;f._itemHeight=d;this._colorUnmodified=cc.color.WHITE;f._opacityModifyRGB=!0;f._blendFunc.src= cc.BLEND_SRC;f._blendFunc.dst=cc.BLEND_DST;c=f._realColor;this._colorF32Array=new Float32Array([c.r/255,c.g/255,c.b/255,f._realOpacity/255]);this._textureAtlas=new cc.TextureAtlas;this._textureAtlas.initWithTexture(a,e);if(!this._textureAtlas)return cc.log(cc._LogInfos.AtlasNode__initWithTexture),!1;this._updateBlendFunc();this._updateOpacityModifyRGB();this._calculateMaxItems();f.quadsToDraw=e;return!0};a.setColor=function(a){var c=cc.color(a.r,a.g,a.b),d=this._node;this._colorUnmodified=a;a=this._displayedOpacity; d._opacityModifyRGB&&(c.r=c.r*a/255,c.g=c.g*a/255,c.b=c.b*a/255);cc.Node.prototype.setColor.call(d,c)};a.setOpacity=function(a){var c=this._node;cc.Node.prototype.setOpacity.call(c,a);c._opacityModifyRGB&&(c.color=this._colorUnmodified)};a._updateColor=function(){if(this._colorF32Array){var a=this._displayedColor;this._colorF32Array[0]=a.r/255;this._colorF32Array[1]=a.g/255;this._colorF32Array[2]=a.b/255;this._colorF32Array[3]=this._displayedOpacity/255}};a.getTexture=function(){return this._textureAtlas.texture}; a.setTexture=function(a){this._textureAtlas.texture=a;this._updateBlendFunc();this._updateOpacityModifyRGB()};a._calculateMaxItems=function(){var a=this._node,c=this._textureAtlas.texture,d=c.getContentSize();a._ignoreContentScaleFactor&&(d=c.getContentSizeInPixels());a._itemsPerColumn=0|d.height/a._itemHeight;a._itemsPerRow=0|d.width/a._itemWidth}})();cc._tmp.WebGLTexture2D=function(){cc.Texture2D=cc.Class.extend({_pVRHaveAlphaPremultiplied:!0,_pixelFormat:null,_pixelsWide:0,_pixelsHigh:0,_name:"",_contentSize:null,maxS:0,maxT:0,_hasPremultipliedAlpha:!1,_hasMipmaps:!1,shaderProgram:null,_textureLoaded:!1,_htmlElementObj:null,_webTextureObj:null,url:null,ctor:function(){this._contentSize=cc.size(0,0);this._pixelFormat=cc.Texture2D.defaultPixelFormat},releaseTexture:function(){this._webTextureObj&&cc._renderContext.deleteTexture(this._webTextureObj); cc.loader.release(this.url)},getPixelFormat:function(){return this._pixelFormat},getPixelsWide:function(){return this._pixelsWide},getPixelsHigh:function(){return this._pixelsHigh},getName:function(){return this._webTextureObj},getContentSize:function(){return cc.size(this._contentSize.width/cc.contentScaleFactor(),this._contentSize.height/cc.contentScaleFactor())},_getWidth:function(){return this._contentSize.width/cc.contentScaleFactor()},_getHeight:function(){return this._contentSize.height/cc.contentScaleFactor()}, getContentSizeInPixels:function(){return this._contentSize},getMaxS:function(){return this.maxS},setMaxS:function(a){this.maxS=a},getMaxT:function(){return this.maxT},setMaxT:function(a){this.maxT=a},getShaderProgram:function(){return this.shaderProgram},setShaderProgram:function(a){this.shaderProgram=a},hasPremultipliedAlpha:function(){return this._hasPremultipliedAlpha},hasMipmaps:function(){return this._hasMipmaps},description:function(){return"\x3ccc.Texture2D | Name \x3d "+this._name+" | Dimensions \x3d "+ this._pixelsWide+" x "+this._pixelsHigh+" | Coordinates \x3d ("+this.maxS+", "+this.maxT+")\x3e"},releaseData:function(a){},keepData:function(a,b){return a},initWithData:function(a,b,c,d,e){var f=cc.Texture2D,g=cc._renderContext,h=g.RGBA,k=g.UNSIGNED_BYTE,m=c*cc.Texture2D._B[b]/8;0===m%8?g.pixelStorei(g.UNPACK_ALIGNMENT,8):0===m%4?g.pixelStorei(g.UNPACK_ALIGNMENT,4):0===m%2?g.pixelStorei(g.UNPACK_ALIGNMENT,2):g.pixelStorei(g.UNPACK_ALIGNMENT,1);this._webTextureObj=g.createTexture();cc.glBindTexture2D(this); g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,g.LINEAR);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,g.LINEAR);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE);switch(b){case f.PIXEL_FORMAT_RGBA8888:h=g.RGBA;break;case f.PIXEL_FORMAT_RGB888:h=g.RGB;break;case f.PIXEL_FORMAT_RGBA4444:k=g.UNSIGNED_SHORT_4_4_4_4;break;case f.PIXEL_FORMAT_RGB5A1:k=g.UNSIGNED_SHORT_5_5_5_1;break;case f.PIXEL_FORMAT_RGB565:k=g.UNSIGNED_SHORT_5_6_5; break;case f.PIXEL_FORMAT_AI88:h=g.LUMINANCE_ALPHA;break;case f.PIXEL_FORMAT_A8:h=g.ALPHA;break;case f.PIXEL_FORMAT_I8:h=g.LUMINANCE;break;default:cc.assert(0,cc._LogInfos.Texture2D_initWithData)}g.texImage2D(g.TEXTURE_2D,0,h,c,d,0,h,k,a);this._contentSize.width=e.width;this._contentSize.height=e.height;this._pixelsWide=c;this._pixelsHigh=d;this._pixelFormat=b;this.maxS=e.width/c;this.maxT=e.height/d;this._hasMipmaps=this._hasPremultipliedAlpha=!1;this.shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURE); return this._textureLoaded=!0},drawAtPoint:function(a){var b=[0,this.maxT,this.maxS,this.maxT,0,0,this.maxS,0],c=cc._renderContext,d=this._pixelsWide*this.maxS,e=this._pixelsHigh*this.maxT;a=[a.x,a.y,0,d+a.x,a.y,0,a.x,e+a.y,0,d+a.x,e+a.y,0];this._shaderProgram.use();this._shaderProgram.setUniformsForBuiltins();cc.glBindTexture2D(this);c.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);c.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);c.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,c.FLOAT, !1,0,a);c.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,c.FLOAT,!1,0,b);c.drawArrays(c.TRIANGLE_STRIP,0,4)},drawInRect:function(a){var b=[0,this.maxT,this.maxS,this.maxT,0,0,this.maxS,0];a=[a.x,a.y,a.x+a.width,a.y,a.x,a.y+a.height,a.x+a.width,a.y+a.height];this._shaderProgram.use();this._shaderProgram.setUniformsForBuiltins();cc.glBindTexture2D(this);var c=cc._renderContext;c.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);c.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);c.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION, 2,c.FLOAT,!1,0,a);c.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,c.FLOAT,!1,0,b);c.drawArrays(c.TRIANGLE_STRIP,0,4)},initWithImage:function(a){if(null==a)return cc.log(cc._LogInfos.Texture2D_initWithImage),!1;var b=a.getWidth(),c=a.getHeight(),d=cc.configuration.getMaxTextureSize();if(b>d||c>d)return cc.log(cc._LogInfos.Texture2D_initWithImage_2,b,c,d,d),!1;this._textureLoaded=!0;return this._initPremultipliedATextureWithImage(a,b,c)},initWithElement:function(a){a&&(this._webTextureObj=cc._renderContext.createTexture(), this._htmlElementObj=a,this._hasPremultipliedAlpha=this._textureLoaded=!0)},getHtmlElementObj:function(){return this._htmlElementObj},isLoaded:function(){return this._textureLoaded},handleLoadedTexture:function(a){a=void 0!==a?a:this._hasPremultipliedAlpha;if(cc.game._rendererInitialized){if(!this._htmlElementObj){var b=cc.loader.getRes(this.url);if(!b)return;this.initWithElement(b)}this._htmlElementObj.width&&this._htmlElementObj.height&&(b=cc._renderContext,cc.glBindTexture2D(this),b.pixelStorei(b.UNPACK_ALIGNMENT, 4),a&&b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,this._htmlElementObj),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE),this.shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURE),cc.glBindTexture2D(null),a&&b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0),b=this._htmlElementObj.height,this._pixelsWide=this._contentSize.width=this._htmlElementObj.width,this._pixelsHigh=this._contentSize.height=b,this._pixelFormat=cc.Texture2D.PIXEL_FORMAT_RGBA8888,this.maxT=this.maxS=1,this._hasPremultipliedAlpha=a,this._hasMipmaps=!1,this.dispatchEvent("load"))}},initWithString:function(a,b,c,d,e,f){cc.log(cc._LogInfos.Texture2D_initWithString);return null},initWithETCFile:function(a){cc.log(cc._LogInfos.Texture2D_initWithETCFile_2);return!1},initWithPVRFile:function(a){cc.log(cc._LogInfos.Texture2D_initWithPVRFile_2); return!1},initWithPVRTCData:function(a,b,c,d,e,f){cc.log(cc._LogInfos.Texture2D_initWithPVRTCData_2);return!1},setTexParameters:function(a,b,c,d){var e=cc._renderContext;void 0!==b&&(a={minFilter:a,magFilter:b,wrapS:c,wrapT:d});cc.assert(this._pixelsWide===cc.NextPOT(this._pixelsWide)&&this._pixelsHigh===cc.NextPOT(this._pixelsHigh)||a.wrapS===e.CLAMP_TO_EDGE&&a.wrapT===e.CLAMP_TO_EDGE,"WebGLRenderingContext.CLAMP_TO_EDGE should be used in NPOT textures");cc.glBindTexture2D(this);e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER,a.minFilter);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,a.magFilter);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,a.wrapS);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,a.wrapT)},setAntiAliasTexParameters:function(){var a=cc._renderContext;cc.glBindTexture2D(this);this._hasMipmaps?a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR_MIPMAP_NEAREST):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR)}, setAliasTexParameters:function(){var a=cc._renderContext;cc.glBindTexture2D(this);this._hasMipmaps?a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST_MIPMAP_NEAREST):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST)},generateMipmap:function(){cc.assert(this._pixelsWide===cc.NextPOT(this._pixelsWide)&&this._pixelsHigh===cc.NextPOT(this._pixelsHigh),"Mimpap texture only works in POT textures");cc.glBindTexture2D(this); cc._renderContext.generateMipmap(cc._renderContext.TEXTURE_2D);this._hasMipmaps=!0},stringForFormat:function(){return cc.Texture2D._M[this._pixelFormat]},bitsPerPixelForFormat:function(a){a=a||this._pixelFormat;var b=cc.Texture2D._B[a];if(null!=b)return b;cc.log(cc._LogInfos.Texture2D_bitsPerPixelForFormat,a);return-1},_initPremultipliedATextureWithImage:function(a,b,c){var d=cc.Texture2D,e=a.getData(),f=null,f=null,g=a.hasAlpha(),h=cc.size(a.getWidth(),a.getHeight()),k=d.defaultPixelFormat,m=a.getBitsPerComponent(); g||(8<=m?k=d.PIXEL_FORMAT_RGB888:(cc.log(cc._LogInfos.Texture2D__initPremultipliedATextureWithImage),k=d.PIXEL_FORMAT_RGB565));var n=b*c;if(k===d.PIXEL_FORMAT_RGB565)if(g)for(e=new Uint16Array(b*c),f=a.getData(),m=0;m<n;++m)e[m]=(f[m]>>0&255)>>3<<11|(f[m]>>8&255)>>2<<5|(f[m]>>16&255)>>3<<0;else for(e=new Uint16Array(b*c),f=a.getData(),m=0;m<n;++m)e[m]=(f[m]&255)>>3<<11|(f[m]&255)>>2<<5|(f[m]&255)>>3<<0;else if(k===d.PIXEL_FORMAT_RGBA4444)for(e=new Uint16Array(b*c),f=a.getData(),m=0;m<n;++m)e[m]=(f[m]>> 0&255)>>4<<12|(f[m]>>8&255)>>4<<8|(f[m]>>16&255)>>4<<4|(f[m]>>24&255)>>4<<0;else if(k===d.PIXEL_FORMAT_RGB5A1)for(e=new Uint16Array(b*c),f=a.getData(),m=0;m<n;++m)e[m]=(f[m]>>0&255)>>3<<11|(f[m]>>8&255)>>3<<6|(f[m]>>16&255)>>3<<1|(f[m]>>24&255)>>7<<0;else if(k===d.PIXEL_FORMAT_A8)for(e=new Uint8Array(b*c),f=a.getData(),m=0;m<n;++m)e[m]=f>>24&255;if(g&&k===d.PIXEL_FORMAT_RGB888)for(f=a.getData(),e=new Uint8Array(b*c*3),m=0;m<n;++m)e[3*m]=f>>0&255,e[3*m+1]=f>>8&255,e[3*m+2]=f>>16&255;this.initWithData(e, k,b,c,h);a.getData();this._hasPremultipliedAlpha=a.isPremultipliedAlpha();return!0},addLoadedEventListener:function(a,b){this.addEventListener("load",a,b)},removeLoadedEventListener:function(a){this.removeEventTarget("load",a)}})}; cc._tmp.WebGLTextureAtlas=function(){var a=cc.TextureAtlas.prototype;a._setupVBO=function(){var a=cc._renderContext;this._buffersVBO[0]=a.createBuffer();this._buffersVBO[1]=a.createBuffer();this._quadsWebBuffer=a.createBuffer();this._mapBuffers()};a._mapBuffers=function(){var a=cc._renderContext;a.bindBuffer(a.ARRAY_BUFFER,this._quadsWebBuffer);a.bufferData(a.ARRAY_BUFFER,this._quadsArrayBuffer,a.DYNAMIC_DRAW);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._buffersVBO[1]);a.bufferData(a.ELEMENT_ARRAY_BUFFER, this._indices,a.STATIC_DRAW)};a.drawNumberOfQuads=function(a,c){c=c||0;if(0!==a&&this.texture&&this.texture.isLoaded()){var d=cc._renderContext;cc.glBindTexture2D(this.texture);d.bindBuffer(d.ARRAY_BUFFER,this._quadsWebBuffer);this.dirty&&(d.bufferData(d.ARRAY_BUFFER,this._quadsArrayBuffer,d.DYNAMIC_DRAW),this.dirty=!1);d.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);d.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);d.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);d.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION, 3,d.FLOAT,!1,24,0);d.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,d.UNSIGNED_BYTE,!0,24,12);d.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,d.FLOAT,!1,24,16);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,this._buffersVBO[1]);cc.TEXTURE_ATLAS_USE_TRIANGLE_STRIP?d.drawElements(d.TRIANGLE_STRIP,6*a,d.UNSIGNED_SHORT,6*c*this._indices.BYTES_PER_ELEMENT):d.drawElements(d.TRIANGLES,6*a,d.UNSIGNED_SHORT,6*c*this._indices.BYTES_PER_ELEMENT);cc.g_NumberOfDraws++}}}; cc._tmp.WebGLTextureCache=function(){var a=cc.textureCache;a.handleLoadedTexture=function(a){var c=this._textures,d;cc.game._rendererInitialized||(c=this._loadedTexturesBefore);d=c[a];d||(d=c[a]=new cc.Texture2D,d.url=a);".png"===cc.path.extname(a)?d.handleLoadedTexture(!0):d.handleLoadedTexture()};a.addImage=function(a,c,d){cc.assert(a,cc._LogInfos.Texture2D_addImage_2);var e=this._textures;cc.game._rendererInitialized||(e=this._loadedTexturesBefore);var f=e[a]||e[cc.loader._getAliase(a)];if(f)return f.isLoaded()? c&&c.call(d,f):f.addEventListener("load",function(){c&&c.call(d,f)},d),f;f=e[a]=new cc.Texture2D;f.url=a;var g=cc.loader.getBasePath?cc.loader.getBasePath():cc.loader.resPath;cc.loader.loadImg(cc.path.join(g||"",a),function(f,g){if(f)return c&&c.call(d,f);cc.loader.cache[a]||(cc.loader.cache[a]=g);cc.textureCache.handleLoadedTexture(a);var m=e[a];c&&c.call(d,m)});return f};a.addImageAsync=a.addImage;a=null};cc._tmp.PrototypeTexture2D=function(){var a=cc.Texture2D;a.PVRImagesHavePremultipliedAlpha=function(a){cc.PVRHaveAlphaPremultiplied_=a};a.PIXEL_FORMAT_RGBA8888=2;a.PIXEL_FORMAT_RGB888=3;a.PIXEL_FORMAT_RGB565=4;a.PIXEL_FORMAT_A8=5;a.PIXEL_FORMAT_I8=6;a.PIXEL_FORMAT_AI88=7;a.PIXEL_FORMAT_RGBA4444=8;a.PIXEL_FORMAT_RGB5A1=7;a.PIXEL_FORMAT_PVRTC4=9;a.PIXEL_FORMAT_PVRTC2=10;a.PIXEL_FORMAT_DEFAULT=a.PIXEL_FORMAT_RGBA8888;a.defaultPixelFormat=a.PIXEL_FORMAT_DEFAULT;var b=cc.Texture2D._M={};b[a.PIXEL_FORMAT_RGBA8888]= "RGBA8888";b[a.PIXEL_FORMAT_RGB888]="RGB888";b[a.PIXEL_FORMAT_RGB565]="RGB565";b[a.PIXEL_FORMAT_A8]="A8";b[a.PIXEL_FORMAT_I8]="I8";b[a.PIXEL_FORMAT_AI88]="AI88";b[a.PIXEL_FORMAT_RGBA4444]="RGBA4444";b[a.PIXEL_FORMAT_RGB5A1]="RGB5A1";b[a.PIXEL_FORMAT_PVRTC4]="PVRTC4";b[a.PIXEL_FORMAT_PVRTC2]="PVRTC2";b=cc.Texture2D._B={};b[a.PIXEL_FORMAT_RGBA8888]=32;b[a.PIXEL_FORMAT_RGB888]=24;b[a.PIXEL_FORMAT_RGB565]=16;b[a.PIXEL_FORMAT_A8]=8;b[a.PIXEL_FORMAT_I8]=8;b[a.PIXEL_FORMAT_AI88]=16;b[a.PIXEL_FORMAT_RGBA4444]= 16;b[a.PIXEL_FORMAT_RGB5A1]=16;b[a.PIXEL_FORMAT_PVRTC4]=4;b[a.PIXEL_FORMAT_PVRTC2]=3;a=cc.Texture2D.prototype;cc.defineGetterSetter(a,"name",a.getName);cc.defineGetterSetter(a,"pixelFormat",a.getPixelFormat);cc.defineGetterSetter(a,"pixelsWidth",a.getPixelsWide);cc.defineGetterSetter(a,"pixelsHeight",a.getPixelsHigh);cc.defineGetterSetter(a,"width",a._getWidth);cc.defineGetterSetter(a,"height",a._getHeight)}; cc._tmp.PrototypeTextureAtlas=function(){var a=cc.TextureAtlas.prototype;cc.defineGetterSetter(a,"totalQuads",a.getTotalQuads);cc.defineGetterSetter(a,"capacity",a.getCapacity);cc.defineGetterSetter(a,"quads",a.getQuads,a.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.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_CANVAS){var a={_contentSize:null,_textureLoaded:!1,_htmlElementObj:null,url:null,_pattern:null,ctor:function(){this._contentSize=cc.size(0,0);this._textureLoaded=!1;this._htmlElementObj=null;this._pattern="";this._pixelsHigh=this._pixelsWide=0},getPixelsWide:function(){return this._pixelsWide},getPixelsHigh:function(){return this._pixelsHigh},getContentSize:function(){var a=cc.contentScaleFactor(); return cc.size(this._contentSize.width/a,this._contentSize.height/a)},_getWidth:function(){return this._contentSize.width/cc.contentScaleFactor()},_getHeight:function(){return this._contentSize.height/cc.contentScaleFactor()},getContentSizeInPixels:function(){return this._contentSize},initWithElement:function(a){a&&(this._htmlElementObj=a,this._pixelsWide=this._contentSize.width=a.width,this._pixelsHigh=this._contentSize.height=a.height,this._textureLoaded=!0)},getHtmlElementObj:function(){return this._htmlElementObj}, isLoaded:function(){return this._textureLoaded},handleLoadedTexture:function(){if(!this._textureLoaded){if(!this._htmlElementObj){var a=cc.loader.getRes(this.url);if(!a)return;this.initWithElement(a)}a=this._htmlElementObj;this._pixelsWide=this._contentSize.width=a.width;this._pixelsHigh=this._contentSize.height=a.height;this.dispatchEvent("load")}},description:function(){return"\x3ccc.Texture2D | width \x3d "+this._contentSize.width+" height "+this._contentSize.height+"\x3e"},initWithData:function(a, c,d,e,f){return!1},initWithImage:function(a){return!1},initWithString:function(a,c,d,e,f,g){return!1},releaseTexture:function(){cc.loader.release(this.url)},getName:function(){return null},getMaxS:function(){return 1},setMaxS:function(a){},getMaxT:function(){return 1},setMaxT:function(a){},getPixelFormat:function(){return null},getShaderProgram:function(){return null},setShaderProgram:function(a){},hasPremultipliedAlpha:function(){return!1},hasMipmaps:function(){return!1},releaseData:function(a){}, keepData:function(a,c){return a},drawAtPoint:function(a){},drawInRect:function(a){},initWithETCFile:function(a){cc.log(cc._LogInfos.Texture2D_initWithETCFile);return!1},initWithPVRFile:function(a){cc.log(cc._LogInfos.Texture2D_initWithPVRFile);return!1},initWithPVRTCData:function(a,c,d,e,f,g){cc.log(cc._LogInfos.Texture2D_initWithPVRTCData);return!1},setTexParameters:function(a,c,d,e){void 0!==c&&(a={minFilter:a,magFilter:c,wrapS:d,wrapT:e});this._pattern=a.wrapS===cc.REPEAT&&a.wrapT===cc.REPEAT? "repeat":a.wrapS===cc.REPEAT?"repeat-x":a.wrapT===cc.REPEAT?"repeat-y":""},setAntiAliasTexParameters:function(){},setAliasTexParameters:function(){},generateMipmap:function(){},stringForFormat:function(){return""},bitsPerPixelForFormat:function(a){return-1},addLoadedEventListener:function(a,c){this.addEventListener("load",a,c)},removeLoadedEventListener:function(a){this.removeEventTarget("load",a)},_generateColorTexture:function(){},_generateTextureCacheForColor:function(){if(this.channelCache)return this.channelCache; var a=[document.createElement("canvas"),document.createElement("canvas"),document.createElement("canvas"),document.createElement("canvas")],c=this._htmlElementObj,d=c.width,e=c.height;a[0].width=d;a[0].height=e;a[1].width=d;a[1].height=e;a[2].width=d;a[2].height=e;a[3].width=d;a[3].height=e;var f=a[3].getContext("2d");f.drawImage(c,0,0);for(var f=f.getImageData(0,0,d,e).data,g,h=0;4>h;h++){g=a[h].getContext("2d");for(var k=g.getImageData(0,0,d,e),m=k.data,n=0;n<f.length;n+=4)m[n]=0===h?f[n]:0,m[n+ 1]=1===h?f[n+1]:0,m[n+2]=2===h?f[n+2]:0,m[n+3]=f[n+3];g.putImageData(k,0,0)}c.onload=null;return this.channelCache=a},_grayElementObj:null,_backupElement:null,_isGray:!1,_switchToGray:function(a){this._textureLoaded&&this._isGray!==a&&((this._isGray=a)?(this._backupElement=this._htmlElementObj,this._grayElementObj||(this._grayElementObj=cc.Texture2D._generateGrayTexture(this._htmlElementObj)),this._htmlElementObj=this._grayElementObj):null!==this._backupElement&&(this._htmlElementObj=this._backupElement))}}; a._generateColorTexture=cc.sys._supportCanvasNewBlendModes?function(a,c,d,e,f){var g=!1;f?g=!0:f=document.createElement("canvas");var h=this._htmlElementObj;e||(e=cc.rect(0,0,h.width,h.height));f.width=e.width;f.height=e.height;var k=f.getContext("2d");k.globalCompositeOperation="source-over";k.fillStyle="rgb("+(a|0)+","+(c|0)+","+(d|0)+")";k.fillRect(0,0,e.width,e.height);k.globalCompositeOperation="multiply";k.drawImage(h,e.x,e.y,e.width,e.height,0,0,e.width,e.height);k.globalCompositeOperation= "destination-atop";k.drawImage(h,e.x,e.y,e.width,e.height,0,0,e.width,e.height);if(g)return f;a=new cc.Texture2D;a.initWithElement(f);a.handleLoadedTexture();return a}:function(a,c,d,e,f){var g=!1;f?g=!0:f=document.createElement("canvas");var h=this._htmlElementObj;e||(e=cc.rect(0,0,h.width,h.height));var k,m,h=e.x;k=e.y;m=e.width;e=e.height;if(m&&e){f.width=m;f.height=e;var n=f.getContext("2d"),p=cc.textureCache.getTextureColors(this);n.globalCompositeOperation="lighter";n.drawImage(p[3],h,k,m,e, 0,0,m,e);0<a&&(n.globalAlpha=a/255,n.drawImage(p[0],h,k,m,e,0,0,m,e));0<c&&(n.globalAlpha=c/255,n.drawImage(p[1],h,k,m,e,0,0,m,e));0<d&&(n.globalAlpha=d/255,n.drawImage(p[2],h,k,m,e,0,0,m,e));if(g)return f;a=new cc.Texture2D;a.initWithElement(f);a.handleLoadedTexture();return a}};cc.Texture2D=cc.Class.extend(a);cc.Texture2D._generateGrayTexture=function(a,c,d){if(null===a)return null;d=d||document.createElement("canvas");c=c||cc.rect(0,0,a.width,a.height);d.width=c.width;d.height=c.height;var e=d.getContext("2d"); e.drawImage(a,c.x,c.y,c.width,c.height,0,0,c.width,c.height);a=e.getImageData(0,0,c.width,c.height);c=a.data;for(var f=0,g=c.length;f<g;f+=4)c[f]=c[f+1]=c[f+2]=0.34*c[f]+0.5*c[f+1]+0.16*c[f+2];e.putImageData(a,0,0);return d}}else cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(cc.assert(cc.isFunction(cc._tmp.WebGLTexture2D),cc._LogInfos.MissingFile,"TexturesWebGL.js"),cc._tmp.WebGLTexture2D(),delete cc._tmp.WebGLTexture2D);cc.EventHelper.prototype.apply(cc.Texture2D.prototype);cc.assert(cc.isFunction(cc._tmp.PrototypeTexture2D), cc._LogInfos.MissingFile,"TexturesPropertyDefine.js");cc._tmp.PrototypeTexture2D();delete cc._tmp.PrototypeTexture2D});cc.textureCache={_textures:{},_textureColorsCache:{},_textureKeySeq:0|1E3*Math.random(),_loadedTexturesBefore:{},_initializingRenderer:function(){var a,b=this._loadedTexturesBefore,c=this._textures;for(a in b){var d=b[a];d.handleLoadedTexture();c[a]=d}this._loadedTexturesBefore={}},addPVRTCImage:function(a){cc.log(cc._LogInfos.textureCache_addPVRTCImage)},addETCImage:function(a){cc.log(cc._LogInfos.textureCache_addETCImage)},description:function(){return"\x3cTextureCache | Number of textures \x3d "+ this._textures.length+"\x3e"},textureForKey:function(a){cc.log(cc._LogInfos.textureCache_textureForKey);return this.getTextureForKey(a)},getTextureForKey:function(a){return this._textures[a]||this._textures[cc.loader._getAliase(a)]},getKeyByTexture:function(a){for(var b in this._textures)if(this._textures[b]===a)return b;return null},_generalTextureKey:function(a){return"_textureKey_"+a},getTextureColors:function(a){var b=a._htmlElementObj,c=this.getKeyByTexture(b);c||(c=b instanceof HTMLImageElement? b.src:this._generalTextureKey(a.__instanceId));this._textureColorsCache[c]||(this._textureColorsCache[c]=a._generateTextureCacheForColor());return this._textureColorsCache[c]},addPVRImage:function(a){cc.log(cc._LogInfos.textureCache_addPVRImage)},removeAllTextures:function(){var a=this._textures,b;for(b in a)a[b]&&a[b].releaseTexture();this._textures={}},removeTexture:function(a){if(a){var b=this._textures,c;for(c in b)b[c]===a&&(b[c].releaseTexture(),delete b[c])}},removeTextureForKey:function(a){null!= a&&this._textures[a]&&delete this._textures[a]},cacheImage:function(a,b){if(b instanceof cc.Texture2D)this._textures[a]=b;else{var c=new cc.Texture2D;c.initWithElement(b);c.handleLoadedTexture();this._textures[a]=c}},addUIImage:function(a,b){cc.assert(a,cc._LogInfos.textureCache_addUIImage_2);if(b&&this._textures[b])return this._textures[b];var c=new cc.Texture2D;c.initWithImage(a);null!=b?this._textures[b]=c:cc.log(cc._LogInfos.textureCache_addUIImage);return c},dumpCachedTextureInfo:function(){var a= 0,b=0,c=this._textures,d;for(d in c){var e=c[d];a++;e.getHtmlElementObj()instanceof HTMLImageElement?cc.log(cc._LogInfos.textureCache_dumpCachedTextureInfo,d,e.getHtmlElementObj().src,e.pixelsWidth,e.pixelsHeight):cc.log(cc._LogInfos.textureCache_dumpCachedTextureInfo_2,d,e.pixelsWidth,e.pixelsHeight);b+=e.pixelsWidth*e.pixelsHeight*4}c=this._textureColorsCache;for(d in c){var e=c[d],f;for(f in e){var g=e[f];a++;cc.log(cc._LogInfos.textureCache_dumpCachedTextureInfo_2,d,g.width,g.height);b+=g.width* g.height*4}}cc.log(cc._LogInfos.textureCache_dumpCachedTextureInfo_3,a,b/1024,(b/1048576).toFixed(2))},_clear:function(){this._textures={};this._textureColorsCache={};this._textureKeySeq=0|1E3*Math.random();this._loadedTexturesBefore={}}}; cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_CANVAS){var a=cc.textureCache;a.handleLoadedTexture=function(a){var c=this._textures,d=c[a];d||(d=c[a]=new cc.Texture2D,d.url=a);d.handleLoadedTexture()};a.addImage=function(a,c,d){cc.assert(a,cc._LogInfos.Texture2D_addImage);var e=this._textures,f=e[a]||e[cc.loader._getAliase(a)];if(f)return f.isLoaded()?c&&c.call(d,f):f.addEventListener("load",function(){c&&c.call(d,f)},d),f;f=e[a]=new cc.Texture2D; f.url=a;var g=cc.loader.getBasePath?cc.loader.getBasePath():cc.loader.resPath;cc.loader.loadImg(cc.path.join(g||"",a),function(f,g){if(f)return c&&c.call(d,f);cc.loader.cache[a]||(cc.loader.cache[a]=g);cc.textureCache.handleLoadedTexture(a);var m=e[a];c&&c.call(d,m)});return f};a.addImageAsync=a.addImage;a=null}else cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(cc.assert(cc.isFunction(cc._tmp.WebGLTextureCache),cc._LogInfos.MissingFile,"TexturesWebGL.js"),cc._tmp.WebGLTextureCache(),delete cc._tmp.WebGLTextureCache)});cc.TextureAtlas=cc.Class.extend({dirty:!1,texture:null,_indices:null,_buffersVBO:null,_capacity:0,_quads:null,_quadsArrayBuffer:null,_quadsWebBuffer:null,_quadsReader:null,ctor:function(a,b){this._buffersVBO=[];cc.isString(a)?this.initWithFile(a,b):a instanceof cc.Texture2D&&this.initWithTexture(a,b)},getTotalQuads:function(){return this._totalQuads},getCapacity:function(){return this._capacity},getTexture:function(){return this.texture},setTexture:function(a){this.texture=a},setDirty:function(a){this.dirty= a},isDirty:function(){return this.dirty},getQuads:function(){return this._quads},setQuads:function(a){this._quads=a},_copyQuadsToTextureAtlas:function(a,b){if(a)for(var c=0;c<a.length;c++)this._setQuadToArray(a[c],b+c)},_setQuadToArray:function(a,b){var c=this._quads;c[b]?(c[b].bl=a.bl,c[b].br=a.br,c[b].tl=a.tl,c[b].tr=a.tr):c[b]=new cc.V3F_C4B_T2F_Quad(a.tl,a.bl,a.tr,a.br,this._quadsArrayBuffer,b*cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT)},description:function(){return"\x3ccc.TextureAtlas | totalQuads \x3d"+ this._totalQuads+"\x3e"},_setupIndices:function(){if(0!==this._capacity)for(var a=this._indices,b=this._capacity,c=0;c<b;c++)cc.TEXTURE_ATLAS_USE_TRIANGLE_STRIP?(a[6*c+0]=4*c+0,a[6*c+1]=4*c+0,a[6*c+2]=4*c+2,a[6*c+3]=4*c+1,a[6*c+4]=4*c+3,a[6*c+5]=4*c+3):(a[6*c+0]=4*c+0,a[6*c+1]=4*c+1,a[6*c+2]=4*c+2,a[6*c+3]=4*c+3,a[6*c+4]=4*c+2,a[6*c+5]=4*c+1)},_setupVBO:function(){var a=cc._renderContext;this._buffersVBO[0]=a.createBuffer();this._buffersVBO[1]=a.createBuffer();this._quadsWebBuffer=a.createBuffer(); this._mapBuffers()},_mapBuffers:function(){var a=cc._renderContext;a.bindBuffer(a.ARRAY_BUFFER,this._quadsWebBuffer);a.bufferData(a.ARRAY_BUFFER,this._quadsArrayBuffer,a.DYNAMIC_DRAW);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._buffersVBO[1]);a.bufferData(a.ELEMENT_ARRAY_BUFFER,this._indices,a.STATIC_DRAW)},initWithFile:function(a,b){var c=cc.textureCache.addImage(a);if(c)return this.initWithTexture(c,b);cc.log(cc._LogInfos.TextureAtlas_initWithFile,a);return!1},initWithTexture:function(a,b){cc.assert(a, cc._LogInfos.TextureAtlas_initWithTexture);this._capacity=b|=0;this._totalQuads=0;this.texture=a;this._quads=[];this._indices=new Uint16Array(6*b);var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._quadsArrayBuffer=new ArrayBuffer(c*b);this._quadsReader=new Uint8Array(this._quadsArrayBuffer);if((!this._quads||!this._indices)&&0<b)return!1;for(var d=this._quads,e=0;e<b;e++)d[e]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,this._quadsArrayBuffer,e*c);this._setupIndices();this._setupVBO();return this.dirty= !0},updateQuad:function(a,b){cc.assert(a,cc._LogInfos.TextureAtlas_updateQuad);cc.assert(0<=b&&b<this._capacity,cc._LogInfos.TextureAtlas_updateQuad_2);this._totalQuads=Math.max(b+1,this._totalQuads);this._setQuadToArray(a,b);this.dirty=!0},insertQuad:function(a,b){cc.assert(b<this._capacity,cc._LogInfos.TextureAtlas_insertQuad_2);this._totalQuads++;if(this._totalQuads>this._capacity)cc.log(cc._LogInfos.TextureAtlas_insertQuad);else{var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,d=b*c,e=(this._totalQuads- 1-b)*c;this._quads[this._totalQuads-1]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,this._quadsArrayBuffer,(this._totalQuads-1)*c);this._quadsReader.set(this._quadsReader.subarray(d,d+e),d+c);this._setQuadToArray(a,b);this.dirty=!0}},insertQuads:function(a,b,c){c=c||a.length;cc.assert(b+c<=this._capacity,cc._LogInfos.TextureAtlas_insertQuads);var d=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._totalQuads+=c;if(this._totalQuads>this._capacity)cc.log(cc._LogInfos.TextureAtlas_insertQuad);else{var e=b* d,f=(this._totalQuads-1-b-c)*d,g=this._totalQuads-1-c,h;for(h=0;h<c;h++)this._quads[g+h]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,this._quadsArrayBuffer,(this._totalQuads-1)*d);this._quadsReader.set(this._quadsReader.subarray(e,e+f),e+d*c);for(h=0;h<c;h++)this._setQuadToArray(a[h],b+h);this.dirty=!0}},insertQuadFromIndex:function(a,b){if(a!==b){cc.assert(0<=b||b<this._totalQuads,cc._LogInfos.TextureAtlas_insertQuadFromIndex);cc.assert(0<=a||a<this._totalQuads,cc._LogInfos.TextureAtlas_insertQuadFromIndex_2); var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,d=this._quadsReader,e=d.subarray(a*c,c),f;a>b?(f=b*c,d.set(d.subarray(f,f+(a-b)*c),f+c),d.set(e,f)):(f=(a+1)*c,d.set(d.subarray(f,f+(b-a)*c),f-c),d.set(e,b*c));this.dirty=!0}},removeQuadAtIndex:function(a){cc.assert(a<this._totalQuads,cc._LogInfos.TextureAtlas_removeQuadAtIndex);var b=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._totalQuads--;this._quads.length=this._totalQuads;if(a!==this._totalQuads){var c=(a+1)*b;this._quadsReader.set(this._quadsReader.subarray(c, c+(this._totalQuads-a)*b),c-b)}this.dirty=!0},removeQuadsAtIndex:function(a,b){cc.assert(a+b<=this._totalQuads,cc._LogInfos.TextureAtlas_removeQuadsAtIndex);this._totalQuads-=b;if(a!==this._totalQuads){var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,d=(a+b)*c,e=a*c;this._quadsReader.set(this._quadsReader.subarray(d,d+(this._totalQuads-a)*c),e)}this.dirty=!0},removeAllQuads:function(){this._totalQuads=this._quads.length=0},_setDirty:function(a){this.dirty=a},resizeCapacity:function(a){if(a===this._capacity)return!0; var b=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,c=this._capacity;this._totalQuads=Math.min(this._totalQuads,a);var d=this._capacity=0|a,e=this._totalQuads;if(null===this._quads)for(this._quads=[],this._quadsArrayBuffer=new ArrayBuffer(b*d),this._quadsReader=new Uint8Array(this._quadsArrayBuffer),a=0;a<d;a++)this._quads=new cc.V3F_C4B_T2F_Quad(null,null,null,null,this._quadsArrayBuffer,a*b);else{var f,g,h=this._quads;if(d>c){f=[];g=new ArrayBuffer(b*d);for(a=0;a<e;a++)f[a]=new cc.V3F_C4B_T2F_Quad(h[a].tl, h[a].bl,h[a].tr,h[a].br,g,a*b);for(;a<d;a++)f[a]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,g,a*b)}else for(e=Math.max(e,d),f=[],g=new ArrayBuffer(b*d),a=0;a<e;a++)f[a]=new cc.V3F_C4B_T2F_Quad(h[a].tl,h[a].bl,h[a].tr,h[a].br,g,a*b);this._quadsReader=new Uint8Array(g);this._quads=f;this._quadsArrayBuffer=g}null===this._indices?this._indices=new Uint16Array(6*d):d>c?(b=new Uint16Array(6*d),b.set(this._indices,0),this._indices=b):this._indices=this._indices.subarray(0,6*d);this._setupIndices();this._mapBuffers(); return this.dirty=!0},increaseTotalQuadsWith:function(a){this._totalQuads+=a},moveQuadsFromIndex:function(a,b,c){if(void 0===c){if(c=b,b=this._totalQuads-a,cc.assert(c+(this._totalQuads-a)<=this._capacity,cc._LogInfos.TextureAtlas_moveQuadsFromIndex),0===b)return}else if(cc.assert(c+b<=this._totalQuads,cc._LogInfos.TextureAtlas_moveQuadsFromIndex_2),cc.assert(a<this._totalQuads,cc._LogInfos.TextureAtlas_moveQuadsFromIndex_3),a===c)return;var d=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,e=a*d,f=b*d,g=this._quadsReader, h=g.subarray(e,e+f),k=c*d;c<a?(b=c*d,g.set(g.subarray(b,b+(a-c)*d),b+f)):(b=(a+b)*d,g.set(g.subarray(b,b+(c-a)*d),e));g.set(h,k);this.dirty=!0},fillWithEmptyQuadsFromIndex:function(a,b){for(var c=b*cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,d=new Uint8Array(this._quadsArrayBuffer,a*cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,c),e=0;e<c;e++)d[e]=0},drawQuads:function(){this.drawNumberOfQuads(this._totalQuads,0)},_releaseBuffer:function(){var a=cc._renderContext;this._buffersVBO&&(this._buffersVBO[0]&&a.deleteBuffer(this._buffersVBO[0]), this._buffersVBO[1]&&a.deleteBuffer(this._buffersVBO[1]));this._quadsWebBuffer&&a.deleteBuffer(this._quadsWebBuffer)}});_p=cc.TextureAtlas.prototype;cc.defineGetterSetter(_p,"totalQuads",_p.getTotalQuads);cc.defineGetterSetter(_p,"capacity",_p.getCapacity);cc.defineGetterSetter(_p,"quads",_p.getQuads,_p.setQuads);cc.TextureAtlas.create=function(a,b){return new cc.TextureAtlas(a,b)};cc.TextureAtlas.createWithTexture=cc.TextureAtlas.create; cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(cc.assert(cc.isFunction(cc._tmp.WebGLTextureAtlas),cc._LogInfos.MissingFile,"TexturesWebGL.js"),cc._tmp.WebGLTextureAtlas(),delete cc._tmp.WebGLTextureAtlas)});cc.assert(cc.isFunction(cc._tmp.PrototypeTextureAtlas),cc._LogInfos.MissingFile,"TexturesPropertyDefine.js");cc._tmp.PrototypeTextureAtlas();delete cc._tmp.PrototypeTextureAtlas;cc.Scene=cc.Node.extend({_className:"Scene",ctor:function(){cc.Node.prototype.ctor.call(this);this._ignoreAnchorPointForPosition=!0;this.setAnchorPoint(0.5,0.5);this.setContentSize(cc.director.getWinSize())}});cc.Scene.create=function(){return new cc.Scene};cc.LoaderScene=cc.Scene.extend({_interval:null,_label:null,_className:"LoaderScene",cb:null,target:null,init:function(){var a=this,b=200,c=a._bgLayer=new cc.LayerColor(cc.color(32,32,32,255));a.addChild(c,0);var d=24,e=-b/2+100;cc._loaderImage&&(cc.loader.loadImg(cc._loaderImage,{isCrossOrigin:!1},function(c,d){b=d.height;a._initStage(d,cc.visibleRect.center)}),d=14,e=-b/2-10);d=a._label=new cc.LabelTTF("Loading... 0%","Arial",d);d.setPosition(cc.pAdd(cc.visibleRect.center,cc.p(0,e)));d.setColor(cc.color(180, 180,180));c.addChild(this._label,10);return!0},_initStage:function(a,b){var c=this._texture2d=new cc.Texture2D;c.initWithElement(a);c.handleLoadedTexture();c=this._logo=new cc.Sprite(c);c.setScale(cc.contentScaleFactor());c.x=b.x;c.y=b.y;this._bgLayer.addChild(c,10)},onEnter:function(){cc.Node.prototype.onEnter.call(this);this.schedule(this._startLoading,0.3)},onExit:function(){cc.Node.prototype.onExit.call(this);this._label.setString("Loading... 0%")},initWithResources:function(a,b,c){cc.isString(a)&& (a=[a]);this.resources=a||[];this.cb=b;this.target=c},_startLoading:function(){var a=this;a.unschedule(a._startLoading);cc.loader.load(a.resources,function(b,c,d){b=Math.min(d/c*100|0,100);a._label.setString("Loading... "+b+"%")},function(){a.cb&&a.cb.call(a.target)})},_updateTransform:function(){this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);this._bgLayer._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);this._label._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty); this._logo._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)}});cc.LoaderScene.preload=function(a,b,c){var d=cc;d.loaderScene||(d.loaderScene=new cc.LoaderScene,d.loaderScene.init(),cc.eventManager.addCustomListener(cc.Director.EVENT_PROJECTION_CHANGED,function(){d.loaderScene._updateTransform()}));d.loaderScene.initWithResources(a,b,c);cc.director.runScene(d.loaderScene);return d.loaderScene};cc.Layer=cc.Node.extend({_className:"Layer",ctor:function(){cc.Node.prototype.ctor.call(this);this._ignoreAnchorPointForPosition=!0;this.setAnchorPoint(0.5,0.5);this.setContentSize(cc.winSize);this._cascadeOpacityEnabled=this._cascadeColorEnabled=!1},bake:function(){this._renderCmd.bake()},unbake:function(){this._renderCmd.unbake()},isBaked:function(){return this._renderCmd._isBaked},visit:function(a){if(this._visible){var b=cc.renderer,c=this._renderCmd;c.visit(a&&a._renderCmd);if(c._isBaked)b.pushRenderCommand(c), c._bakeSprite.visit(this);else{var d=this._children,e=d.length,f;if(0<e){this._reorderChildDirty&&this.sortAllChildren();for(a=0;a<e;a++)if(f=d[a],0>f._localZOrder)f.visit(this);else break;for(b.pushRenderCommand(c);a<e;a++)d[a].visit(this)}else b.pushRenderCommand(c)}c._dirtyFlag=0}},addChild:function(a,b,c){cc.Node.prototype.addChild.call(this,a,b,c);this._renderCmd._bakeForAddChild(a)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.Layer.CanvasRenderCmd(this): new cc.Layer.WebGLRenderCmd(this)}});cc.Layer.create=function(){return new cc.Layer}; cc.LayerColor=cc.Layer.extend({_blendFunc:null,_className:"LayerColor",getBlendFunc:function(){return this._blendFunc},changeWidthAndHeight:function(a,b){this.width=a;this.height=b},changeWidth:function(a){this.width=a},changeHeight:function(a){this.height=a},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},ctor:function(a,b,c){cc.Layer.prototype.ctor.call(this);this._blendFunc=cc.BlendFunc._alphaNonPremultiplied();cc.LayerColor.prototype.init.call(this,a,b,c)},init:function(a, b,c){var d=cc.director.getWinSize();a=a||cc.color(0,0,0,255);b=void 0===b?d.width:b;c=void 0===c?d.height:c;d=this._realColor;d.r=a.r;d.g=a.g;d.b=a.b;this._realOpacity=a.a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty|cc.Node._dirtyFlags.opacityDirty);cc.LayerColor.prototype.setContentSize.call(this,b,c);return!0},visit:function(a){if(this._visible){var b=cc.renderer,c=this._renderCmd;c.visit(a&&a._renderCmd);if(c._isBaked)b.pushRenderCommand(c._bakeRenderCmd),c._bakeSprite._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty), c._bakeSprite.visit(this);else{var d=this._children,e=d.length;if(0<e){this._reorderChildDirty&&this.sortAllChildren();for(a=0;a<e;a++)if(child=d[a],0>child._localZOrder)child.visit(this);else break;for(b.pushRenderCommand(c);a<e;a++)d[a].visit(this)}else b.pushRenderCommand(c)}c._dirtyFlag=0}},setBlendFunc:function(a,b){var c=this._blendFunc;void 0===b?(c.src=a.src,c.dst=a.dst):(c.src=a,c.dst=b);this._renderCmd.updateBlendFunc(c)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS? new cc.LayerColor.CanvasRenderCmd(this):new cc.LayerColor.WebGLRenderCmd(this)}});cc.LayerColor.create=function(a,b,c){return new cc.LayerColor(a,b,c)};(function(){var a=cc.LayerColor.prototype;cc.defineGetterSetter(a,"width",a._getWidth,a._setWidth);cc.defineGetterSetter(a,"height",a._getHeight,a._setHeight)})(); cc.LayerGradient=cc.LayerColor.extend({_endColor:null,_startOpacity:255,_endOpacity:255,_alongVector:null,_compressedInterpolation:!1,_className:"LayerGradient",_colorStops:[],ctor:function(a,b,c,d){cc.LayerColor.prototype.ctor.call(this);this._endColor=cc.color(0,0,0,255);this._alongVector=cc.p(0,-1);this._endOpacity=this._startOpacity=255;d&&d instanceof Array?(this._colorStops=d,d.splice(0,0,{p:0,color:a||cc.color.BLACK}),d.push({p:1,color:b||cc.color.BLACK})):this._colorStops=[{p:0,color:a||cc.color.BLACK}, {p:1,color:b||cc.color.BLACK}];cc.LayerGradient.prototype.init.call(this,a,b,c,d)},init:function(a,b,c,d){a=a||cc.color(0,0,0,255);b=b||cc.color(0,0,0,255);c=c||cc.p(0,-1);d=this._endColor;this._startOpacity=a.a;d.r=b.r;d.g=b.g;d.b=b.b;this._endOpacity=b.a;this._alongVector=c;this._compressedInterpolation=!0;cc.LayerColor.prototype.init.call(this,cc.color(a.r,a.g,a.b,255));this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty|cc.Node._dirtyFlags.opacityDirty|cc.Node._dirtyFlags.gradientDirty); return!0},setContentSize:function(a,b){cc.LayerColor.prototype.setContentSize.call(this,a,b);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.gradientDirty)},_setWidth:function(a){cc.LayerColor.prototype._setWidth.call(this,a);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.gradientDirty)},_setHeight:function(a){cc.LayerColor.prototype._setHeight.call(this,a);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.gradientDirty)},getStartColor:function(){return cc.color(this._realColor)},setStartColor:function(a){this.color= a;var b=this._colorStops;b&&0<b.length&&(b=b[0].color,b.r=a.r,b.g=a.g,b.b=a.b)},setEndColor:function(a){var b=this._endColor;b.r=a.r;b.g=a.g;b.b=a.b;(b=this._colorStops)&&0<b.length&&(b=b[b.length-1].color,b.r=a.r,b.g=a.g,b.b=a.b);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty)},getEndColor:function(){return cc.color(this._endColor)},setStartOpacity:function(a){this._startOpacity=a;var b=this._colorStops;b&&0<b.length&&(b[0].color.a=a);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty)}, getStartOpacity:function(){return this._startOpacity},setEndOpacity:function(a){this._endOpacity=a;var b=this._colorStops;b&&0<b.length&&(b[b.length-1].color.a=a);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty)},getEndOpacity:function(){return this._endOpacity},setVector:function(a){this._alongVector.x=a.x;this._alongVector.y=a.y;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.gradientDirty)},getVector:function(){return cc.p(this._alongVector.x,this._alongVector.y)},isCompressedInterpolation:function(){return this._compressedInterpolation}, setCompressedInterpolation:function(a){this._compressedInterpolation=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.gradientDirty)},getColorStops:function(){return this._colorStops},setColorStops:function(a){this._colorStops=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty|cc.Node._dirtyFlags.opacityDirty|cc.Node._dirtyFlags.gradientDirty)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.LayerGradient.CanvasRenderCmd(this):new cc.LayerGradient.WebGLRenderCmd(this)}}); cc.LayerGradient.create=function(a,b,c,d){return new cc.LayerGradient(a,b,c,d)}; (function(){var a=cc.LayerGradient.prototype;cc.defineGetterSetter(a,"startColor",a.getStartColor,a.setStartColor);cc.defineGetterSetter(a,"endColor",a.getEndColor,a.setEndColor);cc.defineGetterSetter(a,"startOpacity",a.getStartOpacity,a.setStartOpacity);cc.defineGetterSetter(a,"endOpacity",a.getEndOpacity,a.setEndOpacity);cc.defineGetterSetter(a,"vector",a.getVector,a.setVector);cc.defineGetterSetter(a,"colorStops",a.getColorStops,a.setColorStops)})(); cc.LayerMultiplex=cc.Layer.extend({_enabledLayer:0,_layers:null,_className:"LayerMultiplex",ctor:function(a){cc.Layer.prototype.ctor.call(this);a instanceof Array?cc.LayerMultiplex.prototype.initWithLayers.call(this,a):cc.LayerMultiplex.prototype.initWithLayers.call(this,Array.prototype.slice.call(arguments))},initWithLayers:function(a){0<a.length&&null==a[a.length-1]&&cc.log(cc._LogInfos.LayerMultiplex_initWithLayers);this._layers=a;this._enabledLayer=0;this.addChild(this._layers[this._enabledLayer]); return!0},switchTo:function(a){a>=this._layers.length?cc.log(cc._LogInfos.LayerMultiplex_switchTo):(this.removeChild(this._layers[this._enabledLayer],!0),this._enabledLayer=a,this.addChild(this._layers[a]))},switchToAndReleaseMe:function(a){a>=this._layers.length?cc.log(cc._LogInfos.LayerMultiplex_switchToAndReleaseMe):(this.removeChild(this._layers[this._enabledLayer],!0),this._layers[this._enabledLayer]=null,this._enabledLayer=a,this.addChild(this._layers[a]))},addLayer:function(a){a?this._layers.push(a): cc.log(cc._LogInfos.LayerMultiplex_addLayer)}});cc.LayerMultiplex.create=function(){return new cc.LayerMultiplex(Array.prototype.slice.call(arguments))};(function(){cc.Layer.CanvasRenderCmd=function(a){this._rootCtor(a);this._isBaked=!1;this._bakeSprite=null;this._canUseDirtyRegion=!0;this._updateCache=2};var a=cc.Layer.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.Layer.CanvasRenderCmd;a._layerCmdCtor=cc.Layer.CanvasRenderCmd;a._setCacheDirty=function(a){a&&0===this._updateCache&&(this._updateCache=2);!1===this._cacheDirty&&(this._cacheDirty=!0,(a=this._cachedParent)&&a!==this&&a._setNodeDirtyForCache&& a._setNodeDirtyForCache())};a.updateStatus=function(){var a=cc.Node._dirtyFlags;this._dirtyFlag&a.orderDirty&&(this._cacheDirty=!0,0===this._updateCache&&(this._updateCache=2),this._dirtyFlag&=~a.orderDirty);this.originUpdateStatus()};a._syncStatus=function(a){var c=cc.Node._dirtyFlags,d=this._dirtyFlag;if(this._isBaked||d&c.orderDirty)this._cacheDirty=!0,0===this._updateCache&&(this._updateCache=2),this._dirtyFlag&=~c.orderDirty;this._originSyncStatus(a)};a.transform=function(a,c){this._worldTransform|| (this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0});var d=this._worldTransform,e=d.a,f=d.b,g=d.c,h=d.d;this.originTransform(a,c);d.a===e&&d.b===f&&d.c===g&&d.d===h||0!==this._updateCache||(this._updateCache=2)};a.bake=function(){if(!this._isBaked){this._needDraw=!0;this._isBaked=this._cacheDirty=cc.renderer.childrenOrderDirty=!0;0===this._updateCache&&(this._updateCache=2);for(var a=this._node._children,c=0,d=a.length;c<d;c++)a[c]._renderCmd._setCachedParent(this);this._bakeSprite||(this._bakeSprite= new cc.BakeSprite,this._bakeSprite.setAnchorPoint(0,0))}};a.unbake=function(){if(this._isBaked){cc.renderer.childrenOrderDirty=!0;this._isBaked=this._needDraw=!1;this._cacheDirty=!0;0===this._updateCache&&(this._updateCache=2);for(var a=this._node._children,c=0,d=a.length;c<d;c++)a[c]._renderCmd._setCachedParent(null)}};a.isBaked=function(){return this._isBaked};a.rendering=function(){if(this._cacheDirty){var a=this._node,c=a._children,d=this._bakeSprite;this.transform(this.getParentRenderCmd(),!0); var e=this._getBoundingBoxForBake();e.width=0|e.width+0.5;e.height=0|e.height+0.5;var f=d.getCacheContext(),g=f.getContext();d.setPosition(e.x,e.y);if(0<this._updateCache){d.resetCanvasSize(e.width,e.height);f.setOffset(0-e.x,g.canvas.height-e.height+e.y);a.sortAllChildren();cc.renderer._turnToCacheMode(this.__instanceId);a=0;for(e=c.length;a<e;a++)c[a].visit(this);cc.renderer._renderingToCacheCanvas(f,this.__instanceId);d.transform();this._updateCache--}this._cacheDirty=!1}};a._bakeForAddChild=function(a){a._parent=== this._node&&this._isBaked&&a._renderCmd._setCachedParent(this)};a._getBoundingBoxForBake=function(){var a=null,c=this._node;if(!c._children||0===c._children.length)return cc.rect(0,0,10,10);for(var d=c.getNodeToWorldTransform(),c=c._children,e=0,f=c.length;e<f;e++){var g=c[e];g&&g._visible&&(a?(g=g._getBoundingBoxToCurrentNode(d))&&(a=cc.rectUnion(a,g)):a=g._getBoundingBoxToCurrentNode(d))}return a}})(); (function(){cc.LayerColor.CanvasRenderCmd=function(a){this._layerCmdCtor(a);this._needDraw=!0;this._blendFuncStr="source-over";this._bakeRenderCmd=new cc.CustomRenderCmd(this,this._bakeRendering)};var a=cc.LayerColor.CanvasRenderCmd.prototype=Object.create(cc.Layer.CanvasRenderCmd.prototype);a.constructor=cc.LayerColor.CanvasRenderCmd;a.unbake=function(){cc.Layer.CanvasRenderCmd.prototype.unbake.call(this);this._needDraw=!0};a.rendering=function(a,c,d){a=a||cc._renderContext;var e=a.getContext(), f=this._node,g=this._displayedColor,h=this._displayedOpacity/255,k=f._contentSize.width,f=f._contentSize.height;0!==h&&(a.setCompositeOperation(this._blendFuncStr),a.setGlobalAlpha(h),a.setFillStyle("rgba("+(0|g.r)+","+(0|g.g)+","+(0|g.b)+", 1)"),a.setTransform(this._worldTransform,c,d),e.fillRect(0,0,k,-f),cc.g_NumberOfDraws++)};a.updateBlendFunc=function(a){this._blendFuncStr=cc.Node.CanvasRenderCmd._getCompositeOperationByBlendFunc(a)};a._updateSquareVertices=a._updateSquareVerticesWidth=a._updateSquareVerticesHeight= function(){};a._bakeRendering=function(){if(this._cacheDirty){var a=this._node,c=this._bakeSprite,d=a._children,e,f=d.length;this.transform(this.getParentRenderCmd(),!0);e=this._getBoundingBoxForBake();e.width=0|e.width+0.5;e.height=0|e.height+0.5;var g=c.getCacheContext(),h=g.getContext();c.setPosition(e.x,e.y);if(0<this._updateCache){h.fillStyle=g._currentFillStyle;c.resetCanvasSize(e.width,e.height);g.setOffset(0-e.x,h.canvas.height-e.height+e.y);cc.renderer._turnToCacheMode(this.__instanceId); if(0<f){a.sortAllChildren();for(e=0;e<f;e++)if(h=d[e],0>h._localZOrder)h.visit(a);else break;for(cc.renderer.pushRenderCommand(this);e<f;e++)d[e].visit(a)}else cc.renderer.pushRenderCommand(this);cc.renderer._renderingToCacheCanvas(g,this.__instanceId);c.transform();this._updateCache--}this._cacheDirty=!1}};a._getBoundingBoxForBake=function(){var a=this._node,c=cc.rect(0,0,a._contentSize.width,a._contentSize.height),d=a.getNodeToWorldTransform(),c=cc.rectApplyAffineTransform(c,a.getNodeToWorldTransform()); if(!a._children||0===a._children.length)return c;for(var a=a._children,e=0;e<a.length;e++){var f=a[e];f&&f._visible&&(f=f._getBoundingBoxToCurrentNode(d),c=cc.rectUnion(c,f))}return c}})(); (function(){cc.LayerGradient.CanvasRenderCmd=function(a){cc.LayerColor.CanvasRenderCmd.call(this,a);this._needDraw=!0;this._startPoint=cc.p(0,0);this._endPoint=cc.p(0,0);this._endStopStr=this._startStopStr=null};var a=cc.LayerGradient.CanvasRenderCmd.prototype=Object.create(cc.LayerColor.CanvasRenderCmd.prototype);a.constructor=cc.LayerGradient.CanvasRenderCmd;a.rendering=function(a,c,d){a=a||cc._renderContext;var e=a.getContext(),f=this._node,g=this._displayedOpacity/255;if(0!==g){var h=f._contentSize.width, k=f._contentSize.height;a.setCompositeOperation(this._blendFuncStr);a.setGlobalAlpha(g);g=e.createLinearGradient(this._startPoint.x,this._startPoint.y,this._endPoint.x,this._endPoint.y);if(f._colorStops)for(var m=0;m<f._colorStops.length;m++)g.addColorStop(f._colorStops[m].p,this._colorStopsStr[m]);else g.addColorStop(0,this._startStopStr),g.addColorStop(1,this._endStopStr);a.setFillStyle(g);a.setTransform(this._worldTransform,c,d);e.fillRect(0,0,h,-k);cc.g_NumberOfDraws++}};a.updateStatus=function(){var a= cc.Node._dirtyFlags;this._dirtyFlag&a.gradientDirty&&(this._dirtyFlag|=a.colorDirty,this._dirtyFlag&=~a.gradientDirty);this.originUpdateStatus()};a._syncStatus=function(a){var c=cc.Node._dirtyFlags;this._dirtyFlag&c.gradientDirty&&(this._dirtyFlag|=c.colorDirty,this._dirtyFlag&=~c.gradientDirty);this._originSyncStatus(a)};a._updateColor=function(){var a=this._node,c=a._contentSize,d=0.5*c.width,c=0.5*c.height,e=cc.pAngleSigned(cc.p(0,-1),a._alongVector),e=cc.pRotateByAngle(cc.p(0,-1),cc.p(0,0),e), f=Math.min(Math.abs(1/e.x),Math.abs(1/e.y));this._startPoint.x=d*-e.x*f+d;this._startPoint.y=c*e.y*f-c;this._endPoint.x=d*e.x*f+d;this._endPoint.y=c*-e.y*f-c;d=this._displayedColor;c=a._endColor;e=a._startOpacity/255;f=a._endOpacity/255;this._startStopStr="rgba("+Math.round(d.r)+","+Math.round(d.g)+","+Math.round(d.b)+","+e.toFixed(4)+")";this._endStopStr="rgba("+Math.round(c.r)+","+Math.round(c.g)+","+Math.round(c.b)+","+f.toFixed(4)+")";if(a._colorStops)for(this._endOpacity=this._startOpacity=0, this._colorStopsStr=[],d=0;d<a._colorStops.length;d++)c=a._colorStops[d].color,e=null==c.a?1:c.a/255,this._colorStopsStr.push("rgba("+Math.round(c.r)+","+Math.round(c.g)+","+Math.round(c.b)+","+e.toFixed(4)+")")}})();(function(){cc.Layer.WebGLRenderCmd=function(a){this._rootCtor(a);this._isBaked=!1};var a=cc.Layer.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.Layer.WebGLRenderCmd;a._layerCmdCtor=cc.Layer.WebGLRenderCmd;a.bake=function(){};a.unbake=function(){};a._bakeForAddChild=function(){}})(); (function(){cc.LayerColor.WebGLRenderCmd=function(a){this._layerCmdCtor(a);this._needDraw=!0;this._matrix=null;this.initData(4);this._color=new Uint32Array(1);this._vertexBuffer=null;this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_COLOR)};var a=cc.LayerColor.WebGLRenderCmd.prototype=Object.create(cc.Layer.WebGLRenderCmd.prototype);a.constructor=cc.LayerColor.WebGLRenderCmd;a.initData=function(a){this._data=new ArrayBuffer(16*a);this._positionView=new Float32Array(this._data);this._colorView= new Uint32Array(this._data);this._dataDirty=!0};a.transform=function(a,c){this.originTransform(a,c);var d=this._node,e=d._contentSize.width,f=d._contentSize.height,g=this._positionView;g[4]=e;g[9]=f;g[12]=e;g[13]=f;g[2].z=g[6]=g[10]=g[14]=d._vertexZ;this._dataDirty=!0};a._updateColor=function(){var a=this._displayedColor;this._color[0]=this._displayedOpacity<<24|a.b<<16|a.g<<8|a.r;for(var a=this._colorView,c=0;4>c;c++)a[4*c+3]=this._color[0];this._dataDirty=!0};a.rendering=function(a){a=a||cc._renderContext; var c=this._node;this._matrix||(this._matrix=new cc.math.Matrix4,this._matrix.identity());var d=this._worldTransform;this._matrix.mat[0]=d.a;this._matrix.mat[4]=d.c;this._matrix.mat[12]=d.tx;this._matrix.mat[1]=d.b;this._matrix.mat[5]=d.d;this._matrix.mat[13]=d.ty;this._dataDirty&&(this._vertexBuffer||(this._vertexBuffer=a.createBuffer()),a.bindBuffer(a.ARRAY_BUFFER,this._vertexBuffer),a.bufferData(a.ARRAY_BUFFER,this._data,a.DYNAMIC_DRAW),this._dataDirty=!1);this._shaderProgram.use();this._shaderProgram._setUniformForMVPMatrixWithMat4(this._matrix); cc.glBlendFunc(c._blendFunc.src,c._blendFunc.dst);a.bindBuffer(a.ARRAY_BUFFER,this._vertexBuffer);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,a.FLOAT,!1,16,0);a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,16,12);a.drawArrays(a.TRIANGLE_STRIP,0,4)};a.updateBlendFunc=function(a){}})(); (function(){cc.LayerGradient.WebGLRenderCmd=function(a){cc.LayerColor.WebGLRenderCmd.call(this,a);this._needDraw=!0;this._clipRect=new cc.Rect;this._clippingRectDirty=!1};var a=cc.LayerGradient.WebGLRenderCmd.prototype=Object.create(cc.LayerColor.WebGLRenderCmd.prototype);a.constructor=cc.LayerGradient.WebGLRenderCmd;a.updateStatus=function(){var a=cc.Node._dirtyFlags;this._dirtyFlag&a.gradientDirty&&(this._dirtyFlag|=a.colorDirty,this._updateVertex(),this._dirtyFlag&=~a.gradientDirty);this.originUpdateStatus()}; a._syncStatus=function(a){var c=cc.Node._dirtyFlags;this._dirtyFlag&c.gradientDirty&&(this._dirtyFlag|=c.colorDirty,this._updateVertex(),this._dirtyFlag&=~c.gradientDirty);this._originSyncStatus(a)};a.transform=function(a,c){this.originTransform(a,c);this._updateVertex()};a._updateVertex=function(){var a=this._node,c=a._colorStops;if(c&&!(2>c.length)){this._clippingRectDirty=!0;var d,e=c.length,f=2*e,g=a._contentSize;this._positionView.length/4<f&&this.initData(f);var h=Math.PI+cc.pAngleSigned(cc.p(0, -1),a._alongVector),f=cc.p(g.width/2,g.height/2);d=Math.round(cc.radiansToDegrees(h));var k=cc.affineTransformMake(1,0,0,1,f.x,f.y),k=cc.affineTransformRotate(k,h),m;90>d?(m=cc.p(-f.x,f.y),d=cc.p(f.x,f.y)):180>d?(m=cc.p(f.x,f.y),d=cc.p(f.x,-f.y)):270>d?(m=cc.p(f.x,-f.y),d=cc.p(-f.x,-f.y)):(m=cc.p(-f.x,-f.y),d=cc.p(-f.x,f.y));var n=Math.sin(h),h=Math.cos(h);m=Math.abs((m.x*h-m.y*n)/f.x);d=Math.abs((d.x*n+d.y*h)/f.y);k=cc.affineTransformScale(k,m,d);n=this._positionView;for(d=0;d<e;d++){m=c[d].p*g.height; var p=cc.pointApplyAffineTransform(-f.x,m-f.y,k),h=8*d;n[h]=p.x;n[h+1]=p.y;n[h+2]=a._vertexZ;m=cc.pointApplyAffineTransform(g.width-f.x,m-f.y,k);h+=4;n[h]=m.x;n[h+1]=m.y;n[h+2]=a._vertexZ}this._dataDirty=!0}};a._updateColor=function(){var a=this._node._colorStops;if(a&&!(2>a.length)){var c=a.length,d,e=this._colorView,f=this._displayedOpacity/255;for(i=0;i<c;i++)d=a[i].color,this._color[0]=d.a*f<<24|d.b<<16|d.g<<8|d.r,d=8*i,e[d+3]=this._color[0],d+=4,e[d+3]=this._color[0];this._dataDirty=!0}};a.rendering= function(a){a=a||cc._renderContext;var c=this._node;this._matrix||(this._matrix=new cc.math.Matrix4,this._matrix.identity());var d=this._getClippingRect();a.enable(a.SCISSOR_TEST);cc.view.setScissorInPoints(d.x,d.y,d.width,d.height);d=this._worldTransform;this._matrix.mat[0]=d.a;this._matrix.mat[4]=d.c;this._matrix.mat[12]=d.tx;this._matrix.mat[1]=d.b;this._matrix.mat[5]=d.d;this._matrix.mat[13]=d.ty;this._dataDirty&&(this._vertexBuffer||(this._vertexBuffer=gl.createBuffer()),gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer),gl.bufferData(gl.ARRAY_BUFFER,this._data,gl.DYNAMIC_DRAW),this._dataDirty=!1);this._shaderProgram.use();this._shaderProgram._setUniformForMVPMatrixWithMat4(this._matrix);cc.glBlendFunc(c._blendFunc.src,c._blendFunc.dst);gl.bindBuffer(gl.ARRAY_BUFFER,this._vertexBuffer);gl.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);gl.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);gl.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,gl.FLOAT,!1,16,0);gl.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR, 4,gl.UNSIGNED_BYTE,!0,16,12);gl.drawArrays(gl.TRIANGLE_STRIP,0,4);a.disable(a.SCISSOR_TEST)};a._getClippingRect=function(){if(this._clippingRectDirty){var a=this._node,c=cc.rect(0,0,a._contentSize.width,a._contentSize.height),a=a.getNodeToWorldTransform();this._clipRect=cc._rectApplyAffineTransformIn(c,a)}return this._clipRect}})();cc._tmp.PrototypeSprite=function(){var a=cc.Sprite.prototype;cc.defineGetterSetter(a,"opacityModifyRGB",a.isOpacityModifyRGB,a.setOpacityModifyRGB);cc.defineGetterSetter(a,"opacity",a.getOpacity,a.setOpacity);cc.defineGetterSetter(a,"color",a.getColor,a.setColor);cc.defineGetterSetter(a,"flippedX",a.isFlippedX,a.setFlippedX);cc.defineGetterSetter(a,"flippedY",a.isFlippedY,a.setFlippedY);cc.defineGetterSetter(a,"offsetX",a._getOffsetX);cc.defineGetterSetter(a,"offsetY",a._getOffsetY);cc.defineGetterSetter(a, "texture",a.getTexture,a.setTexture);cc.defineGetterSetter(a,"textureRectRotated",a.isTextureRectRotated);cc.defineGetterSetter(a,"batchNode",a.getBatchNode,a.setBatchNode);cc.defineGetterSetter(a,"quad",a.getQuad)};cc.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,_className:"Sprite",ctor:function(a,b,c){cc.Node.prototype.ctor.call(this);this.setAnchorPoint(0.5,0.5);this._loader=new cc.Sprite.LoadManager;this._shouldBeHidden= !1;this._offsetPosition=cc.p(0,0);this._unflippedOffsetPositionFromCenter=cc.p(0,0);this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};this._rect=cc.rect(0,0,0,0);this._softInit(a,b,c)},textureLoaded:function(){return this._textureLoaded},addLoadedEventListener:function(a,b){this.addEventListener("load",a,b)},isDirty:function(){return this.dirty},setDirty:function(a){this.dirty=a},isTextureRectRotated:function(){return this._rectRotated},getAtlasIndex:function(){return this.atlasIndex},setAtlasIndex:function(a){this.atlasIndex= a},getTextureRect:function(){return cc.rect(this._rect)},getTextureAtlas:function(){return this.textureAtlas},setTextureAtlas:function(a){this.textureAtlas=a},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(a){cc.assert(a,cc._LogInfos.Sprite_initWithSpriteFrame);return this.setSpriteFrame(a)},initWithSpriteFrameName:function(a){cc.assert(a, cc._LogInfos.Sprite_initWithSpriteFrameName);var b=cc.spriteFrameCache.getSpriteFrame(a);cc.assert(b,a+cc._LogInfos.Sprite_initWithSpriteFrameName1);return this.initWithSpriteFrame(b)},useBatchNode:function(a){},setVertexRect:function(a){var b=this._rect;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},setFlippedX:function(a){this._flippedX!==a&&(this._flippedX=a,this.setTextureRect(this._rect,this._rectRotated,this._contentSize), this.setNodeDirty(!0))},setFlippedY:function(a){this._flippedY!==a&&(this._flippedY=a,this.setTextureRect(this._rect,this._rectRotated,this._contentSize),this.setNodeDirty(!0))},isFlippedX:function(){return this._flippedX},isFlippedY:function(){return this._flippedY},setOpacityModifyRGB:function(a){this._opacityModifyRGB!==a&&(this._opacityModifyRGB=a,this._renderCmd._setColorDirty())},isOpacityModifyRGB:function(){return this._opacityModifyRGB},setDisplayFrameWithAnimationName:function(a,b){cc.assert(a, cc._LogInfos.Sprite_setDisplayFrameWithAnimationName_3);var c=cc.animationCache.getAnimation(a);c?(c=c.getFrames()[b])?this.setSpriteFrame(c.getSpriteFrame()):cc.log(cc._LogInfos.Sprite_setDisplayFrameWithAnimationName_2):cc.log(cc._LogInfos.Sprite_setDisplayFrameWithAnimationName)},getBatchNode:function(){return this._batchNode},getTexture:function(){return this._texture},_softInit:function(a,b,c){if(void 0===a)cc.Sprite.prototype.init.call(this);else if("string"===typeof a)"#"===a[0]?(b=a.substr(1, a.length-1),(b=cc.spriteFrameCache.getSpriteFrame(b))?this.initWithSpriteFrame(b):cc.log("%s does not exist",a)):cc.Sprite.prototype.init.call(this,a,b);else if("object"===typeof a)if(a instanceof cc.Texture2D)this.initWithTexture(a,b,c);else if(a instanceof cc.SpriteFrame)this.initWithSpriteFrame(a);else if(a instanceof HTMLImageElement||a instanceof HTMLCanvasElement)b=new cc.Texture2D,b.initWithElement(a),b.handleLoadedTexture(),this.initWithTexture(b)},getQuad:function(){return null},setBlendFunc:function(a, b){var c=this._blendFunc;void 0===b?(c.src=a.src,c.dst=a.dst):(c.src=a,c.dst=b);this._renderCmd.updateBlendFunc(c)},init:function(){if(0<arguments.length)return this.initWithFile(arguments[0],arguments[1]);cc.Node.prototype.init.call(this);this.dirty=this._recursiveDirty=!1;this._blendFunc.src=cc.BLEND_SRC;this._blendFunc.dst=cc.BLEND_DST;this.texture=null;this._flippedX=this._flippedY=!1;this.anchorY=this.anchorX=0.5;this._offsetPosition.x=0;this._offsetPosition.y=0;this._hasChildren=!1;this.setTextureRect(cc.rect(0, 0,0,0),!1,cc.size(0,0));return!0},initWithFile:function(a,b){cc.assert(a,cc._LogInfos.Sprite_initWithFile);var c=cc.textureCache.getTextureForKey(a);c||(c=cc.textureCache.addImage(a));if(!c.isLoaded())return this._loader.clear(),this._loader.once(c,function(){this.initWithFile(a,b);this.dispatchEvent("load")},this),!1;if(!b){var d=c.getContentSize();b=cc.rect(0,0,d.width,d.height)}return this.initWithTexture(c,b)},initWithTexture:function(a,b,c,d){cc.assert(0!==arguments.length,cc._LogInfos.CCSpriteBatchNode_initWithTexture); this._loader.clear();this._textureLoaded=a.isLoaded();if(!this._textureLoaded)return this._loader.once(a,function(){this.initWithTexture(a,b,c,d);this.dispatchEvent("load")},this),!1;c=c||!1;a=this._renderCmd._handleTextureForRotatedTexture(a,b,c,d);if(!cc.Node.prototype.init.call(this))return!1;this._batchNode=null;this.dirty=this._recursiveDirty=!1;this._opacityModifyRGB=!0;this._blendFunc.src=cc.BLEND_SRC;this._blendFunc.dst=cc.BLEND_DST;this._flippedX=this._flippedY=!1;this._offsetPosition.x= 0;this._offsetPosition.y=0;this._hasChildren=!1;this._rectRotated=c;b&&(this._rect.x=b.x,this._rect.y=b.y,this._rect.width=b.width,this._rect.height=b.height);b||(b=cc.rect(0,0,a.width,a.height));this._renderCmd._checkTextureBoundary(a,b,c);this.setTexture(a);this.setTextureRect(b,c);this.setBatchNode(null);return!0},setTextureRect:function(a,b,c,d){this._rectRotated=b||!1;this.setContentSize(c||a);this.setVertexRect(a);this._renderCmd._setTextureCoords(a,d);a=this._unflippedOffsetPositionFromCenter.x; b=this._unflippedOffsetPositionFromCenter.y;this._flippedX&&(a=-a);this._flippedY&&(b=-b);c=this._rect;this._offsetPosition.x=a+(this._contentSize.width-c.width)/2;this._offsetPosition.y=b+(this._contentSize.height-c.height)/2},addChild:function(a,b,c){cc.assert(a,cc._LogInfos.CCSpriteBatchNode_addChild_2);null==b&&(b=a._localZOrder);null==c&&(c=a.tag);this._renderCmd._setBatchNodeForAddChild(a)&&(cc.Node.prototype.addChild.call(this,a,b,c),this._hasChildren=!0)},setSpriteFrame:function(a){"string"=== typeof a&&(a=cc.spriteFrameCache.getSpriteFrame(a),cc.assert(a,cc._LogInfos.Sprite_setSpriteFrame));this._loader.clear();this.setNodeDirty(!0);var b=a.getTexture();this._textureLoaded=a.textureLoaded();this._loader.clear();if(!this._textureLoaded)return this._loader.once(b,function(){this.setSpriteFrame(a);this.dispatchEvent("load")},this),!1;var c=a.getOffset();this._unflippedOffsetPositionFromCenter.x=c.x;this._unflippedOffsetPositionFromCenter.y=c.y;b!==this._texture&&(this._renderCmd._setTexture(b), this.setColor(this._realColor));this.setTextureRect(a.getRect(),a.isRotated(),a.getOriginalSize())},setDisplayFrame:function(a){cc.log(cc._LogInfos.Sprite_setDisplayFrame);this.setSpriteFrame(a)},isFrameDisplayed:function(a){return this._renderCmd.isFrameDisplayed(a)},displayFrame:function(){return this.getSpriteFrame()},getSpriteFrame:function(){return new cc.SpriteFrame(this._texture,cc.rectPointsToPixels(this._rect),this._rectRotated,cc.pointPointsToPixels(this._unflippedOffsetPositionFromCenter), cc.sizePointsToPixels(this._contentSize))},setBatchNode:function(a){},setTexture:function(a){if(!a)return this._renderCmd._setTexture(null);var b="string"===typeof a;b&&(a=cc.textureCache.addImage(a));this._loader.clear();if(!a._textureLoaded)return this._loader.once(a,function(){this.setTexture(a);this.dispatchEvent("load")},this),!1;this._renderCmd._setTexture(a);b&&this._changeRectWithTexture(a);this.setColor(this._realColor);this._textureLoaded=!0},_changeRectWithTexture:function(a){a=a._contentSize; a=cc.rect(0,0,a.width,a.height);this.setTextureRect(a)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.Sprite.CanvasRenderCmd(this):new cc.Sprite.WebGLRenderCmd(this)}});cc.Sprite.create=function(a,b,c){return new cc.Sprite(a,b,c)};cc.Sprite.createWithTexture=cc.Sprite.create;cc.Sprite.createWithSpriteFrameName=cc.Sprite.create;cc.Sprite.createWithSpriteFrame=cc.Sprite.create;cc.Sprite.INDEX_NOT_INITIALIZED=-1;cc.EventHelper.prototype.apply(cc.Sprite.prototype); cc.assert(cc.isFunction(cc._tmp.PrototypeSprite),cc._LogInfos.MissingFile,"SpritesPropertyDefine.js");cc._tmp.PrototypeSprite();delete cc._tmp.PrototypeSprite; (function(){var a=cc.Sprite.LoadManager=function(){this.list=[]};a.prototype.add=function(a,c,d){a&&a.addEventListener&&(a.addEventListener("load",c,d),this.list.push({source:a,listener:c,target:d}))};a.prototype.once=function(a,c,d){if(a&&a.addEventListener){var e=function(f){a.removeEventListener("load",e,d);c.call(d,f)};a.addEventListener("load",e,d);this.list.push({source:a,listener:e,target:d})}};a.prototype.clear=function(){for(;0<this.list.length;){var a=this.list.pop();a.source.removeEventListener("load", a.listener,a.target)}}})();(function(){cc.Sprite.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._textureCoord={renderX:0,renderY:0,x:0,y:0,width:0,height:0,validRect:!1};this._blendFuncStr="source-over";this._colorized=!1;this._canUseDirtyRegion=!0;this._textureToRender=null};var a=cc.Sprite.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.Sprite.CanvasRenderCmd;a._spriteCmdCtor=cc.Sprite.CanvasRenderCmd;a.setDirtyRecursively=function(a){};a._setTexture=function(a){var c= this._node;c._texture!==a&&(c._textureLoaded=a?a._textureLoaded:!1,c._texture=a,a=a._contentSize,a=cc.rect(0,0,a.width,a.height),c.setTextureRect(a),this._updateColor())};a._setColorDirty=function(){this.setDirtyFlag(cc.Node._dirtyFlags.colorDirty|cc.Node._dirtyFlags.opacityDirty)};a.isFrameDisplayed=function(a){var c=this._node;return a.getTexture()!==c._texture?!1:cc.rectEqualToRect(a.getRect(),c._rect)};a.updateBlendFunc=function(a){this._blendFuncStr=cc.Node.CanvasRenderCmd._getCompositeOperationByBlendFunc(a)}; a._setBatchNodeForAddChild=function(a){return!0};a._handleTextureForRotatedTexture=function(a,c,d,e){d&&a.isLoaded()&&(a=a.getHtmlElementObj(),a=cc.Sprite.CanvasRenderCmd._cutRotateImageToCanvas(a,c,e),e=new cc.Texture2D,e.initWithElement(a),e.handleLoadedTexture(),a=e,c.x=c.y=0,this._node._rect=cc.rect(0,0,c.width,c.height));return a};a._checkTextureBoundary=function(a,c,d){a&&a.url&&(d=c.y+c.height,c.x+c.width>a.width&&cc.error(cc._LogInfos.RectWidth,a.url),d>a.height&&cc.error(cc._LogInfos.RectHeight, a.url))};a.rendering=function(a,c,d){var e=this._node,f=this._textureCoord,g=this._displayedOpacity/255,h=this._textureToRender||e._texture;if((!h||0!==f.width&&0!==f.height&&h._textureLoaded)&&0!==g){a=a||cc._renderContext;var k=a.getContext(),m=e._offsetPosition.x,n=e._rect.height,p=e._rect.width,r=-e._offsetPosition.y-n;a.setTransform(this._worldTransform,c,d);a.setCompositeOperation(this._blendFuncStr);a.setGlobalAlpha(g);(e._flippedX||e._flippedY)&&a.save();e._flippedX&&(m=-m-p,k.scale(-1,1)); e._flippedY&&(r=e._offsetPosition.y,k.scale(1,-1));var s,u,t;this._colorized?s=g=0:(g=f.renderX,s=f.renderY);u=f.width;t=f.height;h&&h._htmlElementObj?(c=h._htmlElementObj,""!==h._pattern?(a.setFillStyle(k.createPattern(c,h._pattern)),k.fillRect(m,r,p,n)):k.drawImage(c,g,s,u,t,m,r,p,n)):(h=e._contentSize,f.validRect&&(f=this._displayedColor,a.setFillStyle("rgba("+f.r+","+f.g+","+f.b+",1)"),k.fillRect(m,r,h.width*c,h.height*d)));(e._flippedX||e._flippedY)&&a.restore();cc.g_NumberOfDraws++}};a._updateColor= function(){var a=this._node._texture,c=this._textureCoord,d=this._displayedColor;a&&(255!==d.r||255!==d.g||255!==d.b?(this._textureToRender=a._generateColorTexture(d.r,d.g,d.b,c),this._colorized=!0):a&&(this._textureToRender=a,this._colorized=!1))};a._textureLoadedCallback=function(a){if(!this._textureLoaded){this._textureLoaded=!0;var c=this._rect,d=this._renderCmd;c?cc._rectEqualToZero(c)&&(c.width=a.width,c.height=a.height):c=cc.rect(0,0,a.width,a.height);this.texture=a;this.setTextureRect(c,this._rectRotated); a=d._displayedColor;255===a.r&&255===a.g&&255===a.b||d._updateColor();this.setBatchNode(this._batchNode);this.dispatchEvent("load")}};a._setTextureCoords=function(a,c){void 0===c&&(c=!0);var d=this._textureCoord,e=c?cc.contentScaleFactor():1;d.renderX=d.x=0|a.x*e;d.renderY=d.y=0|a.y*e;d.width=0|a.width*e;d.height=0|a.height*e;d.validRect=!(0===d.width||0===d.height||0>d.x||0>d.y)};cc.Sprite.CanvasRenderCmd._cutRotateImageToCanvas=function(a,c,d){if(!a)return null;if(!c)return a;d=null==d?!0:d;var e= document.createElement("canvas");e.width=c.width;e.height=c.height;var f=e.getContext("2d");f.translate(e.width/2,e.height/2);d?f.rotate(-1.5707963267948966):f.rotate(1.5707963267948966);f.drawImage(a,c.x,c.y,c.height,c.width,-c.height/2,-c.width/2,c.height,c.width);return e}})();(function(){cc.Sprite.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._vertices=[{x:0,y:0,u:0,v:0},{x:0,y:0,u:0,v:0},{x:0,y:0,u:0,v:0},{x:0,y:0,u:0,v:0}];this._color=new Uint32Array(1);this._recursiveDirty=this._dirty=!1;this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR)};var a=cc.Sprite.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.Sprite.WebGLRenderCmd;a._spriteCmdCtor=cc.Sprite.WebGLRenderCmd; a.updateBlendFunc=function(a){};a.setDirtyFlag=function(a){cc.Node.WebGLRenderCmd.prototype.setDirtyFlag.call(this,a);this._dirty=!0};a.setDirtyRecursively=function(a){this._dirty=this._recursiveDirty=a;for(var c=this._node._children,d,e=c?c.length:0,f=0;f<e;f++)d=c[f],d instanceof cc.Sprite&&d._renderCmd.setDirtyRecursively(a)};a._setBatchNodeForAddChild=function(a){var c=this._node;if(c._batchNode){if(!(a instanceof cc.Sprite))return cc.log(cc._LogInfos.Sprite_addChild),!1;a.texture._webTextureObj!== c.textureAtlas.texture._webTextureObj&&cc.log(cc._LogInfos.Sprite_addChild_2);c._batchNode.appendChild(a);c._reorderChildDirty||c._setReorderChildDirtyRecursively()}return!0};a._handleTextureForRotatedTexture=function(a){return a};a.isFrameDisplayed=function(a){var c=this._node;return cc.rectEqualToRect(a.getRect(),c._rect)&&a.getTexture().getName()===c._texture.getName()&&cc.pointEqualToPoint(a.getOffset(),c._unflippedOffsetPositionFromCenter)};a._textureLoadedCallback=function(a){if(!this._textureLoaded){this._textureLoaded= !0;var c=this._rect;c?cc._rectEqualToZero(c)&&(c.width=a.width,c.height=a.height):c=cc.rect(0,0,a.width,a.height);this.texture=a;this.setTextureRect(c,this._rectRotated);this.setBatchNode(this._batchNode);this.dispatchEvent("load");cc.renderer.childrenOrderDirty=!0}};a._setTextureCoords=function(a,c){void 0===c&&(c=!0);c&&(a=cc.rectPointsToPixels(a));var d=this._node,e=d._batchNode?d.textureAtlas.texture:d._texture,f=this._vertices;if(e){var g=e.pixelsWidth,h=e.pixelsHeight,k,m;d._rectRotated?(cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL? (e=(2*a.x+1)/(2*g),g=e+(2*a.height-2)/(2*g),k=(2*a.y+1)/(2*h),h=k+(2*a.width-2)/(2*h)):(e=a.x/g,g=(a.x+a.height)/g,k=a.y/h,h=(a.y+a.width)/h),d._flippedX&&(m=k,k=h,h=m),d._flippedY&&(m=e,e=g,g=m),f[0].u=g,f[0].v=k,f[1].u=e,f[1].v=k,f[2].u=g,f[2].v=h,f[3].u=e):(cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?(e=(2*a.x+1)/(2*g),g=e+(2*a.width-2)/(2*g),k=(2*a.y+1)/(2*h),h=k+(2*a.height-2)/(2*h)):(e=a.x/g,g=(a.x+a.width)/g,k=a.y/h,h=(a.y+a.height)/h),d._flippedX&&(m=e,e=g,g=m),d._flippedY&&(m=k,k=h,h=m),f[0].u=e, f[0].v=k,f[1].u=e,f[1].v=h,f[2].u=g,f[2].v=k,f[3].u=g);f[3].v=h}};a._setColorDirty=function(){};a._updateBlendFunc=function(){if(this._batchNode)cc.log(cc._LogInfos.Sprite__updateBlendFunc);else{var a=this._node,c=a._blendFunc;a._texture&&a._texture.hasPremultipliedAlpha()?(c.src===cc.SRC_ALPHA&&c.dst===cc.BLEND_DST&&(c.src=cc.ONE),a.opacityModifyRGB=!0):(c.src===cc.ONE&&c.dst===cc.BLEND_DST&&(c.src=cc.SRC_ALPHA),a.opacityModifyRGB=!1)}};a._setTexture=function(a){var c=this._node;c._texture!==a&& (c._textureLoaded=a?a._textureLoaded:!1,c._texture=a,a=a._contentSize,a=cc.rect(0,0,a.width,a.height),c.setTextureRect(a),this._updateBlendFunc(),c._textureLoaded&&(cc.renderer.childrenOrderDirty=!0))};a._checkTextureBoundary=function(a,c,d){a&&a.url&&(d?(d=c.x+c.height,c=c.y+c.width):(d=c.x+c.width,c=c.y+c.height),d>a.width&&cc.error(cc._LogInfos.RectWidth,a.url),c>a.height&&cc.error(cc._LogInfos.RectHeight,a.url))};a.transform=function(a,c){this.originTransform(a,c);var d=this._node,e=d._offsetPosition.x, f=e+d._rect.width,g=d._offsetPosition.y,h=g+d._rect.height,k=this._worldTransform,d=k.tx,m=k.ty,n=e*k.a,e=e*k.b,p=f*k.a,f=f*k.b,r=h*k.c,h=h*k.d,s=g*k.c,g=g*k.d,k=this._vertices;k[0].x=n+r+d;k[0].y=e+h+m;k[1].x=n+s+d;k[1].y=e+g+m;k[2].x=p+r+d;k[2].y=f+h+m;k[3].x=p+s+d;k[3].y=f+g+m};a.needDraw=function(){var a=this._node._texture;return this._needDraw&&a};a.uploadData=function(a,c,d){var e=this._node,f=e._texture;if(!(f&&f._textureLoaded&&e._rect.width&&e._rect.height&&this._displayedOpacity))return!1; var f=this._displayedOpacity,g=this._displayedColor.r,h=this._displayedColor.g,k=this._displayedColor.b;if(e._opacityModifyRGB)var m=f/255,g=g*m,h=h*m,k=k*m;this._color[0]=f<<24|k<<16|h<<8|g;e=e._vertexZ;f=this._vertices;g=f.length;k=d;for(d=0;d<g;++d)h=f[d],a[k]=h.x,a[k+1]=h.y,a[k+2]=e,c[k+3]=this._color[0],a[k+4]=h.u,a[k+5]=h.v,k+=6;return g}})();cc.SpriteBatchNode=cc.Node.extend({_blendFunc:null,_texture:null,_className:"SpriteBatchNode",ctor:function(a){cc.Node.prototype.ctor.call(this);this._blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST);var b;cc.isString(a)?(b=cc.textureCache.getTextureForKey(a))||(b=cc.textureCache.addImage(a)):a instanceof cc.Texture2D&&(b=a);b&&this.initWithTexture(b)},addSpriteWithoutQuad:function(a,b,c){this.addChild(a,b,c);return this},getTextureAtlas:function(){return null},setTextureAtlas:function(a){}, getDescendants:function(){return this._children},initWithFile:function(a,b){var c=cc.textureCache.getTextureForKey(a);c||(c=cc.textureCache.addImage(a));return this.initWithTexture(c,b)},init:function(a,b){var c=cc.textureCache.getTextureForKey(a);c||(c=cc.textureCache.addImage(a));return this.initWithTexture(c,b)},increaseAtlasCapacity:function(){},removeChildAtIndex:function(a,b){this.removeChild(this._children[a],b)},rebuildIndexInOrder:function(a,b){return b},highestAtlasIndexInChild:function(a){var b= a.children;return b&&0!==b.length?this.highestAtlasIndexInChild(b[b.length-1]):a.zIndex},lowestAtlasIndexInChild:function(a){var b=a.children;return b&&0!==b.length?this.lowestAtlasIndexInChild(b[b.length-1]):a.zIndex},atlasIndexForChild:function(a){return a.zIndex},reorderBatch:function(a){this._reorderChildDirty=a},setBlendFunc:function(a,b){this._blendFunc=void 0===b?a:{src:a,dst:b}},getBlendFunc:function(){return new cc.BlendFunc(this._blendFunc.src,this._blendFunc.dst)},updateQuadFromSprite:function(a, b){cc.assert(a,cc._LogInfos.CCSpriteBatchNode_updateQuadFromSprite_2);a instanceof cc.Sprite?(a.dirty=!0,a._renderCmd.transform(this._renderCmd,!0)):cc.log(cc._LogInfos.CCSpriteBatchNode_updateQuadFromSprite)},insertQuadFromSprite:function(a,b){this.addChild(a,b)},insertChild:function(a,b){this.addChild(a,b)},appendChild:function(a){this.sortAllChildren();this.addChild(a.lastLocalZOrder+1)},removeSpriteFromAtlas:function(a,b){this.removeChild(a,b)},initWithTexture:function(a){this.setTexture(a);return!0}, getTexture:function(){return this._texture},setTexture:function(a){this._texture=a;if(a._textureLoaded){var b,c=this._children,d=c.length;for(b=0;b<d;++b)c[b].setTexture(a)}else a.addEventListener("load",function(){var b,c=this._children,d=c.length;for(b=0;b<d;++b)c[b].setTexture(a)},this)},setShaderProgram:function(a){this._renderCmd.setShaderProgram(a);var b,c=this._children,d=c.length;for(b=0;b<d;++b)c[b].setShaderProgram(a)},addChild:function(a,b,c){cc.assert(void 0!==a,cc._LogInfos.CCSpriteBatchNode_addChild_3); this._isValidChild(a)&&(b=void 0===b?a.zIndex:b,c=void 0===c?a.tag:c,cc.Node.prototype.addChild.call(this,a,b,c),this._renderCmd._shaderProgram&&(a.shaderProgram=this._renderCmd._shaderProgram))},_isValidChild:function(a){return a instanceof cc.Sprite?a.texture!==this._texture?(cc.log(cc._LogInfos.Sprite_addChild_5),!1):!0:(cc.log(cc._LogInfos.Sprite_addChild_4),!1)}});_p=cc.SpriteBatchNode.prototype;cc.defineGetterSetter(_p,"texture",_p.getTexture,_p.setTexture); cc.defineGetterSetter(_p,"shaderProgram",_p.getShaderProgram,_p.setShaderProgram);cc.SpriteBatchNode.create=function(a){return new cc.SpriteBatchNode(a)};cc.SpriteBatchNode.createWithTexture=cc.SpriteBatchNode.create;cc.BakeSprite=cc.Sprite.extend({_cacheCanvas:null,_cacheContext:null,ctor:function(){cc.Sprite.prototype.ctor.call(this);var a=document.createElement("canvas");a.width=a.height=10;this._cacheCanvas=a;this._cacheContext=new cc.CanvasContextWrapper(a.getContext("2d"));var b=new cc.Texture2D;b.initWithElement(a);b.handleLoadedTexture();this.setTexture(b)},getCacheContext:function(){return this._cacheContext},getCacheCanvas:function(){return this._cacheCanvas},resetCanvasSize:function(a,b){var c=this._cacheCanvas, d=this._cacheContext,e=d._context.strokeStyle,f=d._context.fillStyle;void 0===b&&(b=a.height,a=a.width);c.width=a;c.height=b;e!==d._context.strokeStyle&&(d._context.strokeStyle=e);f!==d._context.fillStyle&&(d._context.fillStyle=f);this.getTexture().handleLoadedTexture();this.setTextureRect(cc.rect(0,0,a,b),!1,null,!1)}});cc.AnimationFrame=cc.Class.extend({_spriteFrame:null,_delayPerUnit:0,_userInfo:null,ctor:function(a,b,c){this._spriteFrame=a||null;this._delayPerUnit=b||0;this._userInfo=c||null},clone:function(){var a=new cc.AnimationFrame;a.initWithSpriteFrame(this._spriteFrame.clone(),this._delayPerUnit,this._userInfo);return a},copyWithZone:function(a){return cc.clone(this)},copy:function(a){a=new cc.AnimationFrame;a.initWithSpriteFrame(this._spriteFrame.clone(),this._delayPerUnit,this._userInfo);return a},initWithSpriteFrame:function(a, b,c){this._spriteFrame=a;this._delayPerUnit=b;this._userInfo=c;return!0},getSpriteFrame:function(){return this._spriteFrame},setSpriteFrame:function(a){this._spriteFrame=a},getDelayUnits:function(){return this._delayPerUnit},setDelayUnits:function(a){this._delayPerUnit=a},getUserInfo:function(){return this._userInfo},setUserInfo:function(a){this._userInfo=a}});cc.AnimationFrame.create=function(a,b,c){return new cc.AnimationFrame(a,b,c)}; cc.Animation=cc.Class.extend({_frames:null,_loops:0,_restoreOriginalFrame:!1,_duration:0,_delayPerUnit:0,_totalDelayUnits:0,ctor:function(a,b,c){this._frames=[];if(void 0===a)this.initWithSpriteFrames(null,0);else{var d=a[0];d&&(d instanceof cc.SpriteFrame?this.initWithSpriteFrames(a,b,c):d instanceof cc.AnimationFrame&&this.initWithAnimationFrames(a,b,c))}},getFrames:function(){return this._frames},setFrames:function(a){this._frames=a},addSpriteFrame:function(a){var b=new cc.AnimationFrame;b.initWithSpriteFrame(a, 1,null);this._frames.push(b);this._totalDelayUnits++},addSpriteFrameWithFile:function(a){a=cc.textureCache.addImage(a);var b=cc.rect(0,0,0,0);b.width=a.width;b.height=a.height;a=new cc.SpriteFrame(a,b);this.addSpriteFrame(a)},addSpriteFrameWithTexture:function(a,b){var c=new cc.SpriteFrame(a,b);this.addSpriteFrame(c)},initWithAnimationFrames:function(a,b,c){cc.arrayVerifyType(a,cc.AnimationFrame);this._delayPerUnit=b;this._loops=void 0===c?1:c;this._totalDelayUnits=0;b=this._frames;for(c=b.length= 0;c<a.length;c++){var d=a[c];b.push(d);this._totalDelayUnits+=d.getDelayUnits()}return!0},clone:function(){var a=new cc.Animation;a.initWithAnimationFrames(this._copyFrames(),this._delayPerUnit,this._loops);a.setRestoreOriginalFrame(this._restoreOriginalFrame);return a},copyWithZone:function(a){a=new cc.Animation;a.initWithAnimationFrames(this._copyFrames(),this._delayPerUnit,this._loops);a.setRestoreOriginalFrame(this._restoreOriginalFrame);return a},_copyFrames:function(){for(var a=[],b=0;b<this._frames.length;b++)a.push(this._frames[b].clone()); return a},copy:function(a){return this.copyWithZone(null)},getLoops:function(){return this._loops},setLoops:function(a){this._loops=a},setRestoreOriginalFrame:function(a){this._restoreOriginalFrame=a},getRestoreOriginalFrame:function(){return this._restoreOriginalFrame},getDuration:function(){return this._totalDelayUnits*this._delayPerUnit},getDelayPerUnit:function(){return this._delayPerUnit},setDelayPerUnit:function(a){this._delayPerUnit=a},getTotalDelayUnits:function(){return this._totalDelayUnits}, initWithSpriteFrames:function(a,b,c){cc.arrayVerifyType(a,cc.SpriteFrame);this._loops=void 0===c?1:c;this._delayPerUnit=b||0;this._totalDelayUnits=0;b=this._frames;b.length=0;if(a){for(c=0;c<a.length;c++){var d=a[c],e=new cc.AnimationFrame;e.initWithSpriteFrame(d,1,null);b.push(e)}this._totalDelayUnits+=a.length}return!0},retain:function(){},release:function(){}});cc.Animation.create=function(a,b,c){return new cc.Animation(a,b,c)};cc.Animation.createWithAnimationFrames=cc.Animation.create;cc.animationCache={_animations:{},addAnimation:function(a,b){this._animations[b]=a},removeAnimation:function(a){a&&this._animations[a]&&delete this._animations[a]},getAnimation:function(a){return this._animations[a]?this._animations[a]:null},_addAnimationsWithDictionary:function(a,b){var c=a.animations;if(c){var d=1,e=a.properties;if(e)for(var d=null!=e.format?parseInt(e.format):d,e=e.spritesheets,f=cc.spriteFrameCache,g=cc.path,h=0;h<e.length;h++)f.addSpriteFrames(g.changeBasename(b,e[h]));switch(d){case 1:this._parseVersion1(c); break;case 2:this._parseVersion2(c);break;default:cc.log(cc._LogInfos.animationCache__addAnimationsWithDictionary_2)}}else cc.log(cc._LogInfos.animationCache__addAnimationsWithDictionary)},addAnimations:function(a){cc.assert(a,cc._LogInfos.animationCache_addAnimations_2);var b=cc.loader.getRes(a);b?this._addAnimationsWithDictionary(b,a):cc.log(cc._LogInfos.animationCache_addAnimations)},_parseVersion1:function(a){var b=cc.spriteFrameCache,c;for(c in a){var d=a[c],e=d.frames,d=parseFloat(d.delay)|| 0,f=null;if(e){for(var f=[],g=0;g<e.length;g++){var h=b.getSpriteFrame(e[g]);if(h){var k=new cc.AnimationFrame;k.initWithSpriteFrame(h,1,null);f.push(k)}else cc.log(cc._LogInfos.animationCache__parseVersion1_2,c,e[g])}0===f.length?cc.log(cc._LogInfos.animationCache__parseVersion1_3,c):(f.length!==e.length&&cc.log(cc._LogInfos.animationCache__parseVersion1_4,c),f=new cc.Animation(f,d,1),cc.animationCache.addAnimation(f,c))}else cc.log(cc._LogInfos.animationCache__parseVersion1,c)}},_parseVersion2:function(a){var b= cc.spriteFrameCache,c;for(c in a){var d=a[c],e=d.loop,f=parseInt(d.loops),e=e?cc.REPEAT_FOREVER:isNaN(f)?1:f,f=d.restoreOriginalFrame&&!0==d.restoreOriginalFrame?!0:!1,g=d.frames;if(g){for(var h=[],k=0;k<g.length;k++){var m=g[k],n=m.spriteframe,p=b.getSpriteFrame(n);if(p){var n=parseFloat(m.delayUnits)||0,m=m.notification,r=new cc.AnimationFrame;r.initWithSpriteFrame(p,n,m);h.push(r)}else cc.log(cc._LogInfos.animationCache__parseVersion2_2,c,n)}d=parseFloat(d.delayPerUnit)||0;g=new cc.Animation;g.initWithAnimationFrames(h, d,e);g.setRestoreOriginalFrame(f);cc.animationCache.addAnimation(g,c)}else cc.log(cc._LogInfos.animationCache__parseVersion2,c)}},_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,ctor:function(a,b,c,d,e){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;void 0!==a&&void 0!==b&&(void 0===c||void 0===d||void 0===e? this.initWithTexture(a,b):this.initWithTexture(a,b,c,d,e))},textureLoaded:function(){return this._textureLoaded},addLoadedEventListener:function(a,b){this.addEventListener("load",a,b)},getRectInPixels:function(){var a=this._rectInPixels;return cc.rect(a.x,a.y,a.width,a.height)},setRectInPixels:function(a){this._rectInPixels||(this._rectInPixels=cc.rect(0,0,0,0));this._rectInPixels.x=a.x;this._rectInPixels.y=a.y;this._rectInPixels.width=a.width;this._rectInPixels.height=a.height;this._rect=cc.rectPixelsToPoints(a)}, isRotated:function(){return this._rotated},setRotated:function(a){this._rotated=a},getRect:function(){var a=this._rect;return cc.rect(a.x,a.y,a.width,a.height)},setRect:function(a){this._rect||(this._rect=cc.rect(0,0,0,0));this._rect.x=a.x;this._rect.y=a.y;this._rect.width=a.width;this._rect.height=a.height;this._rectInPixels=cc.rectPointsToPixels(this._rect)},getOffsetInPixels:function(){return cc.p(this._offsetInPixels)},setOffsetInPixels:function(a){this._offsetInPixels.x=a.x;this._offsetInPixels.y= a.y;cc._pointPixelsToPointsOut(this._offsetInPixels,this._offset)},getOriginalSizeInPixels:function(){return cc.size(this._originalSizeInPixels)},setOriginalSizeInPixels:function(a){this._originalSizeInPixels.width=a.width;this._originalSizeInPixels.height=a.height},getOriginalSize:function(){return cc.size(this._originalSize)},setOriginalSize:function(a){this._originalSize.width=a.width;this._originalSize.height=a.height},getTexture:function(){if(this._texture)return this._texture;if(""!==this._textureFilename){var a= cc.textureCache.addImage(this._textureFilename);a&&(this._textureLoaded=a.isLoaded());return a}return null},setTexture:function(a){if(this._texture!==a){var b=a.isLoaded();this._textureLoaded=b;this._texture=a;b||a.addEventListener("load",function(a){this._textureLoaded=!0;if(this._rotated&&cc._renderType===cc.game.RENDER_TYPE_CANVAS){var b=a.getHtmlElementObj(),b=cc.Sprite.CanvasRenderCmd._cutRotateImageToCanvas(b,this.getRect()),e=new cc.Texture2D;e.initWithElement(b);e.handleLoadedTexture();this.setTexture(e); b=this.getRect();this.setRect(cc.rect(0,0,b.width,b.height))}b=this._rect;0===b.width&&0===b.height&&(b=a.width,a=a.height,this._rect.width=b,this._rect.height=a,this._rectInPixels=cc.rectPointsToPixels(this._rect),this._originalSizeInPixels.width=this._rectInPixels.width,this._originalSizeInPixels.height=this._rectInPixels.height,this._originalSize.width=b,this._originalSize.height=a);this.dispatchEvent("load")},this)}},getOffset:function(){return cc.p(this._offset)},setOffset:function(a){this._offset.x= a.x;this._offset.y=a.y},clone:function(){var a=new cc.SpriteFrame;a.initWithTexture(this._textureFilename,this._rectInPixels,this._rotated,this._offsetInPixels,this._originalSizeInPixels);a.setTexture(this._texture);return a},copyWithZone:function(){var a=new cc.SpriteFrame;a.initWithTexture(this._textureFilename,this._rectInPixels,this._rotated,this._offsetInPixels,this._originalSizeInPixels);a.setTexture(this._texture);return a},copy:function(){return this.copyWithZone()},initWithTexture:function(a, b,c,d,e){2===arguments.length&&(b=cc.rectPointsToPixels(b));d=d||cc.p(0,0);e=e||b;c=c||!1;"string"===typeof a?(this._texture=null,this._textureFilename=a):a instanceof cc.Texture2D&&this.setTexture(a);a=this.getTexture();this._rectInPixels=b;this._rect=cc.rectPixelsToPoints(b);if(a&&a.url&&a.isLoaded()){var f,g;c?(f=b.x+b.height,g=b.y+b.width):(f=b.x+b.width,g=b.y+b.height);f>a.getPixelsWide()&&cc.error(cc._LogInfos.RectWidth,a.url);g>a.getPixelsHigh()&&cc.error(cc._LogInfos.RectHeight,a.url)}this._offsetInPixels.x= d.x;this._offsetInPixels.y=d.y;cc._pointPixelsToPointsOut(d,this._offset);this._originalSizeInPixels.width=e.width;this._originalSizeInPixels.height=e.height;cc._sizePixelsToPointsOut(e,this._originalSize);this._rotated=c;return!0}});cc.EventHelper.prototype.apply(cc.SpriteFrame.prototype);cc.SpriteFrame.create=function(a,b,c,d,e){return new cc.SpriteFrame(a,b,c,d,e)};cc.SpriteFrame.createWithTexture=cc.SpriteFrame.create; cc.SpriteFrame._frameWithTextureForCanvas=function(a,b,c,d,e){var f=new cc.SpriteFrame;f._texture=a;f._rectInPixels=b;f._rect=cc.rectPixelsToPoints(b);f._offsetInPixels.x=d.x;f._offsetInPixels.y=d.y;cc._pointPixelsToPointsOut(f._offsetInPixels,f._offset);f._originalSizeInPixels.width=e.width;f._originalSizeInPixels.height=e.height;cc._sizePixelsToPointsOut(f._originalSizeInPixels,f._originalSize);f._rotated=c;return f};cc.spriteFrameCache={_CCNS_REG1:/^\s*\{\s*([\-]?\d+[.]?\d*)\s*,\s*([\-]?\d+[.]?\d*)\s*\}\s*$/,_CCNS_REG2:/^\s*\{\s*\{\s*([\-]?\d+[.]?\d*)\s*,\s*([\-]?\d+[.]?\d*)\s*\}\s*,\s*\{\s*([\-]?\d+[.]?\d*)\s*,\s*([\-]?\d+[.]?\d*)\s*\}\s*\}\s*$/,_spriteFrames:{},_spriteFramesAliases:{},_frameConfigCache:{},_rectFromString:function(a){return(a=this._CCNS_REG2.exec(a))?cc.rect(parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3]),parseFloat(a[4])):cc.rect(0,0,0,0)},_pointFromString:function(a){return(a=this._CCNS_REG1.exec(a))? cc.p(parseFloat(a[1]),parseFloat(a[2])):cc.p(0,0)},_sizeFromString:function(a){return(a=this._CCNS_REG1.exec(a))?cc.size(parseFloat(a[1]),parseFloat(a[2])):cc.size(0,0)},_getFrameConfig:function(a){var b=cc.loader.getRes(a);cc.assert(b,cc._LogInfos.spriteFrameCache__getFrameConfig_2,a);cc.loader.release(a);if(b._inited)return this._frameConfigCache[a]=b;this._frameConfigCache[a]=this._parseFrameConfig(b);return this._frameConfigCache[a]},_getFrameConfigByJsonObject:function(a,b){cc.assert(b,cc._LogInfos.spriteFrameCache__getFrameConfig_2, a);this._frameConfigCache[a]=this._parseFrameConfig(b);return this._frameConfigCache[a]},_parseFrameConfig:function(a){var b=a.frames,c=a.metadata||a.meta;a={};var d={},e=0;c&&(e=c.format,e=1>=e.length?parseInt(e):e,d.image=c.textureFileName||c.textureFileName||c.image);for(var f in b){var g=b[f];if(g){c={};if(0==e){c.rect=cc.rect(g.x,g.y,g.width,g.height);c.rotated=!1;c.offset=cc.p(g.offsetX,g.offsetY);var h=g.originalWidth,g=g.originalHeight;h&&g||cc.log(cc._LogInfos.spriteFrameCache__getFrameConfig); h=Math.abs(h);g=Math.abs(g);c.size=cc.size(h,g)}else if(1==e||2==e)c.rect=this._rectFromString(g.frame),c.rotated=g.rotated||!1,c.offset=this._pointFromString(g.offset),c.size=this._sizeFromString(g.sourceSize);else if(3==e){var h=this._sizeFromString(g.spriteSize),k=this._rectFromString(g.textureRect);h&&(k=cc.rect(k.x,k.y,h.width,h.height));c.rect=k;c.rotated=g.textureRotated||!1;c.offset=this._pointFromString(g.spriteOffset);c.size=this._sizeFromString(g.spriteSourceSize);c.aliases=g.aliases}else h= g.frame,k=g.sourceSize,f=g.filename||f,c.rect=cc.rect(h.x,h.y,h.w,h.h),c.rotated=g.rotated||!1,c.offset=cc.p(0,0),c.size=cc.size(k.w,k.h);a[f]=c}}return{_inited:!0,frames:a,meta:d}},_addSpriteFramesByObject:function(a,b,c){cc.assert(a,cc._LogInfos.spriteFrameCache_addSpriteFrames_2);b&&b.frames&&(b=this._frameConfigCache[a]||this._getFrameConfigByJsonObject(a,b),this._createSpriteFrames(a,b,c))},_createSpriteFrames:function(a,b,c){var d=b.frames;b=b.meta;c?c instanceof cc.Texture2D||(cc.isString(c)? c=cc.textureCache.addImage(c):cc.assert(0,cc._LogInfos.spriteFrameCache_addSpriteFrames_3)):(c=cc.path.changeBasename(a,b.image||".png"),c=cc.textureCache.addImage(c));a=this._spriteFramesAliases;b=this._spriteFrames;for(var e in d){var f=d[e],g=b[e];if(!g){g=new cc.SpriteFrame(c,f.rect,f.rotated,f.offset,f.size);if(f=f.aliases)for(var h=0,k=f.length;h<k;h++){var m=f[h];a[m]&&cc.log(cc._LogInfos.spriteFrameCache_addSpriteFrames,m);a[m]=e}cc._renderType===cc.game.RENDER_TYPE_CANVAS&&g.isRotated()&& g.getTexture().isLoaded()&&(f=g.getTexture().getHtmlElementObj(),f=cc.Sprite.CanvasRenderCmd._cutRotateImageToCanvas(f,g.getRectInPixels()),h=new cc.Texture2D,h.initWithElement(f),h.handleLoadedTexture(),g.setTexture(h),g.setRotated(!1),f=g._rect,g.setRect(cc.rect(0,0,f.width,f.height)));b[e]=g}}},addSpriteFrames:function(a,b){cc.assert(a,cc._LogInfos.spriteFrameCache_addSpriteFrames_2);var c=this._frameConfigCache[a]||cc.loader.getRes(a);c&&c.frames&&(c=this._frameConfigCache[a]||this._getFrameConfig(a), this._createSpriteFrames(a,c,b))},_checkConflict:function(a){a=a.frames;for(var b in a)this._spriteFrames[b]&&cc.log(cc._LogInfos.spriteFrameCache__checkConflict,b)},addSpriteFrame:function(a,b){this._spriteFrames[b]=a},removeSpriteFrames:function(){this._spriteFrames={};this._spriteFramesAliases={}},removeSpriteFrameByName:function(a){a&&(this._spriteFramesAliases[a]&&delete this._spriteFramesAliases[a],this._spriteFrames[a]&&delete this._spriteFrames[a])},removeSpriteFramesFromFile:function(a){var b= this._spriteFrames,c=this._spriteFramesAliases;if(a=this._frameConfigCache[a]){a=a.frames;for(var d in a)if(b[d]){delete b[d];for(var e in c)c[e]===d&&delete c[e]}}},removeSpriteFramesFromTexture:function(a){var b=this._spriteFrames,c=this._spriteFramesAliases,d;for(d in b){var e=b[d];if(e&&e.getTexture()===a){delete b[d];for(var f in c)c[f]===d&&delete c[f]}}},getSpriteFrame:function(a){var b=this._spriteFrames[a];if(!b){var c=this._spriteFramesAliases[a];c&&((b=this._spriteFrames[c.toString()])|| delete this._spriteFramesAliases[a])}return b},_clear:function(){this._spriteFrames={};this._spriteFramesAliases={};this._frameConfigCache={}}};cc.configuration={ERROR:0,STRING:1,INT:2,DOUBLE:3,BOOLEAN:4,_maxTextureSize:0,_maxModelviewStackDepth:0,_supportsPVRTC:!1,_supportsNPOT:!1,_supportsBGRA8888:!1,_supportsDiscardFramebuffer:!1,_supportsShareableVAO:!1,_maxSamplesAllowed:0,_maxTextureUnits:0,_GlExtensions:"",_valueDict:{},_inited:!1,_init:function(){var a=this._valueDict;a["cocos2d.x.version"]=cc.ENGINE_VERSION;a["cocos2d.x.compiled_with_profiler"]=!1;a["cocos2d.x.compiled_with_gl_state_cache"]=cc.ENABLE_GL_STATE_CACHE;this._inited= !0},getMaxTextureSize:function(){return this._maxTextureSize},getMaxModelviewStackDepth:function(){return this._maxModelviewStackDepth},getMaxTextureUnits:function(){return this._maxTextureUnits},supportsNPOT:function(){return this._supportsNPOT},supportsPVRTC:function(){return this._supportsPVRTC},supportsETC:function(){return!1},supportsS3TC:function(){return!1},supportsATITC:function(){return!1},supportsBGRA8888:function(){return this._supportsBGRA8888},supportsDiscardFramebuffer:function(){return this._supportsDiscardFramebuffer}, supportsShareableVAO:function(){return this._supportsShareableVAO},checkForGLExtension:function(a){return-1<this._GlExtensions.indexOf(a)},getValue:function(a,b){this._inited||this._init();var c=this._valueDict;return c[a]?c[a]:b},setValue:function(a,b){this._valueDict[a]=b},dumpInfo:function(){0===cc.ENABLE_GL_STATE_CACHE&&(cc.log(""),cc.log(cc._LogInfos.configuration_dumpInfo),cc.log(""))},gatherGPUInfo:function(){if(cc._renderType!==cc.game.RENDER_TYPE_CANVAS){this._inited||this._init();var a= cc._renderContext,b=this._valueDict;b["gl.vendor"]=a.getParameter(a.VENDOR);b["gl.renderer"]=a.getParameter(a.RENDERER);b["gl.version"]=a.getParameter(a.VERSION);this._GlExtensions="";for(var c=a.getSupportedExtensions(),d=0;d<c.length;d++)this._GlExtensions+=c[d]+" ";this._maxTextureSize=a.getParameter(a.MAX_TEXTURE_SIZE);b["gl.max_texture_size"]=this._maxTextureSize;this._maxTextureUnits=a.getParameter(a.MAX_COMBINED_TEXTURE_IMAGE_UNITS);b["gl.max_texture_units"]=this._maxTextureUnits;this._supportsPVRTC= this.checkForGLExtension("GL_IMG_texture_compression_pvrtc");b["gl.supports_PVRTC"]=this._supportsPVRTC;this._supportsNPOT=!1;b["gl.supports_NPOT"]=this._supportsNPOT;this._supportsBGRA8888=this.checkForGLExtension("GL_IMG_texture_format_BGRA888");b["gl.supports_BGRA8888"]=this._supportsBGRA8888;this._supportsDiscardFramebuffer=this.checkForGLExtension("GL_EXT_discard_framebuffer");b["gl.supports_discard_framebuffer"]=this._supportsDiscardFramebuffer;this._supportsShareableVAO=this.checkForGLExtension("vertex_array_object"); b["gl.supports_vertex_array_object"]=this._supportsShareableVAO;cc.checkGLErrorDebug()}},loadConfigFile:function(a){this._inited||this._init();var b=cc.loader.getRes(a);if(!b)throw Error("Please load the resource first : "+a);cc.assert(b,cc._LogInfos.configuration_loadConfigFile_2,a);if(b=b.data)for(var c in b)this._valueDict[c]=b[c];else cc.log(cc._LogInfos.configuration_loadConfigFile,a)}};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,_contentScaleFactor:1,_deltaTime:0,_winSizeInPoints:null,_lastUpdate:null,_nextScene:null,_notificationNode:null,_openGLView:null,_scenesStack:null,_projectionDelegate:null,_runningScene:null,_totalFrames:0,_secondsPerFrame:0,_dirtyRegion:null,_scheduler:null,_actionManager:null,_eventProjectionChanged:null,_eventAfterUpdate:null, _eventAfterVisit:null,_eventAfterDraw:null,ctor:function(){var a=this;a._lastUpdate=Date.now();cc.eventManager.addCustomListener(cc.game.EVENT_SHOW,function(){a._lastUpdate=Date.now()})},init:function(){this._oldAnimationInterval=this._animationInterval=1/cc.defaultFPS;this._scenesStack=[];this._projection=cc.Director.PROJECTION_DEFAULT;this._projectionDelegate=null;this._totalFrames=0;this._lastUpdate=Date.now();this._purgeDirectorInNextLoop=this._paused=!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._eventAfterUpdate=new cc.EventCustom(cc.Director.EVENT_AFTER_UPDATE);this._eventAfterUpdate.setUserData(this);this._eventAfterVisit=new cc.EventCustom(cc.Director.EVENT_AFTER_VISIT);this._eventAfterVisit.setUserData(this);this._eventAfterDraw=new cc.EventCustom(cc.Director.EVENT_AFTER_DRAW);this._eventAfterDraw.setUserData(this);this._eventProjectionChanged=new cc.EventCustom(cc.Director.EVENT_PROJECTION_CHANGED); this._eventProjectionChanged.setUserData(this);return!0},calculateDeltaTime:function(){var a=Date.now();this._nextDeltaTimeZero?(this._deltaTime=0,this._nextDeltaTimeZero=!1):this._deltaTime=(a-this._lastUpdate)/1E3;0<cc.game.config[cc.game.CONFIG_KEY.debugMode]&&0.2<this._deltaTime&&(this._deltaTime=1/60);this._lastUpdate=a},convertToGL:function(a){var b=document.documentElement,c=cc.view,d=element.getBoundingClientRect();d.left+=window.pageXOffset-b.clientLeft;d.top+=window.pageYOffset-b.clientTop; b=c._devicePixelRatio*(a.x-d.left);a=c._devicePixelRatio*(d.top+d.height-a.y);return c._isRotated?{x:c._viewPortRect.width-a,y:b}:{x:b,y:a}},convertToUI:function(a){var b=document.documentElement,c=cc.view,d=element.getBoundingClientRect();d.left+=window.pageXOffset-b.clientLeft;d.top+=window.pageYOffset-b.clientTop;b={x:0,y:0};c._isRotated?(b.x=d.left+a.y/c._devicePixelRatio,b.y=d.top+d.height-(c._viewPortRect.width-a.x)/c._devicePixelRatio):(b.x=d.left+a.x/c._devicePixelRatio,b.y=d.top+d.height- a.y/c._devicePixelRatio);return b},drawScene:function(){var a=cc.renderer;this.calculateDeltaTime();this._paused||(this._actionManager.update(this._deltaTime),this._scheduler.update(this._deltaTime),cc.eventManager.dispatchEvent(this._eventAfterUpdate));this._nextScene&&this.setNextScene();this._runningScene&&(a.childrenOrderDirty?(cc.renderer.clearRenderCommands(),cc.renderer.assignedZ=0,this._runningScene._renderCmd._curLevel=0,this._runningScene.visit(),a.resetFlag()):a.transformDirty()&&a.transform()); a.clear();this._notificationNode&&this._notificationNode.visit();cc.eventManager.dispatchEvent(this._eventAfterVisit);cc.g_NumberOfDraws=0;a.rendering(cc._renderContext);this._totalFrames++;cc.eventManager.dispatchEvent(this._eventAfterDraw);cc.eventManager.frameUpdateListeners();this._calculateMPF()},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)},getVisibleSize:null,getVisibleOrigin:null,getZEye:null,pause:function(){this._paused||(this._oldAnimationInterval=this._animationInterval,this.setAnimationInterval(0.25),this._paused=!0)},popScene:function(){cc.assert(this._runningScene,cc._LogInfos.Director_popScene);this._scenesStack.pop();var a=this._scenesStack.length;0===a?this.end():(this._sendCleanupToScene= !0,this._nextScene=this._scenesStack[a-1])},purgeCachedData:function(){cc.animationCache._clear();cc.spriteFrameCache._clear();cc.textureCache._clear()},purgeDirector:function(){this.getScheduler().unscheduleAll();cc.eventManager&&cc.eventManager.setEnabled(!1);this._runningScene&&(this._runningScene._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),this._runningScene._performRecursive(cc.Node._stateCallbackType.onExit),this._runningScene._performRecursive(cc.Node._stateCallbackType.cleanup)); this._nextScene=this._runningScene=null;this._scenesStack.length=0;this.stopAnimation();this.purgeCachedData();cc.checkGLErrorDebug()},pushScene:function(a){cc.assert(a,cc._LogInfos.Director_pushScene);this._sendCleanupToScene=!1;this._scenesStack.push(a);this._nextScene=a},runScene:function(a){cc.assert(a,cc._LogInfos.Director_pushScene);if(this._runningScene){var b=this._scenesStack.length;0===b?(this._sendCleanupToScene=!0,this._scenesStack[b]=a):(this._sendCleanupToScene=!0,this._scenesStack[b- 1]=a);this._nextScene=a}else this.pushScene(a),this.startAnimation()},resume:function(){this._paused&&(this.setAnimationInterval(this._oldAnimationInterval),(this._lastUpdate=Date.now())||cc.log(cc._LogInfos.Director_resume),this._paused=!1,this._deltaTime=0)},setContentScaleFactor:function(a){a!==this._contentScaleFactor&&(this._contentScaleFactor=a)},setDepthTest:null,setClearColor:null,setDefaultValues:function(){},setNextDeltaTimeZero:function(a){this._nextDeltaTimeZero=a},setNextScene:function(){var a= !1,b=!1;cc.TransitionScene&&(a=this._runningScene?this._runningScene instanceof cc.TransitionScene:!1,b=this._nextScene?this._nextScene instanceof cc.TransitionScene:!1);if(!b){if(b=this._runningScene)b._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),b._performRecursive(cc.Node._stateCallbackType.onExit);this._sendCleanupToScene&&b&&b._performRecursive(cc.Node._stateCallbackType.cleanup)}this._runningScene=this._nextScene;cc.renderer.childrenOrderDirty=!0;this._nextScene=null; a||null===this._runningScene||(this._runningScene._performRecursive(cc.Node._stateCallbackType.onEnter),this._runningScene._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish))},setNotificationNode:function(a){cc.renderer.childrenOrderDirty=!0;this._notificationNode&&(this._notificationNode._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),this._notificationNode._performRecursive(cc.Node._stateCallbackType.onExit),this._notificationNode._performRecursive(cc.Node._stateCallbackType.cleanup)); if(this._notificationNode=a)this._notificationNode._performRecursive(cc.Node._stateCallbackType.onEnter),this._notificationNode._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish)},getDelegate:function(){return this._projectionDelegate},setDelegate:function(a){this._projectionDelegate=a},setOpenGLView:null,setProjection:null,setViewport:null,getOpenGLView:null,getProjection:null,setAlphaBlending:null,isSendCleanupToScene:function(){return this._sendCleanupToScene},getRunningScene:function(){return this._runningScene}, getAnimationInterval:function(){return this._animationInterval},isDisplayStats:function(){return cc.profiler?cc.profiler.isShowingStats():!1},setDisplayStats:function(a){cc.profiler&&(a?cc.profiler.showStats():cc.profiler.hideStats())},getSecondsPerFrame:function(){return this._secondsPerFrame},isNextDeltaTimeZero:function(){return this._nextDeltaTimeZero},isPaused:function(){return this._paused},getTotalFrames:function(){return this._totalFrames},popToRootScene:function(){this.popToSceneStackLevel(1)}, popToSceneStackLevel:function(a){cc.assert(this._runningScene,cc._LogInfos.Director_popToSceneStackLevel_2);var b=this._scenesStack,c=b.length;if(0===a)this.end();else if(!(a>=c)){for(;c>a;){var d=b.pop();d.running&&(d._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),d._performRecursive(cc.Node._stateCallbackType.onExit));d._performRecursive(cc.Node._stateCallbackType.cleanup);c--}this._nextScene=b[b.length-1];this._sendCleanupToScene=!0}},getScheduler:function(){return this._scheduler}, setScheduler:function(a){this._scheduler!==a&&(this._scheduler=a)},getActionManager:function(){return this._actionManager},setActionManager:function(a){this._actionManager!==a&&(this._actionManager=a)},getDeltaTime:function(){return this._deltaTime},_calculateMPF:function(){this._secondsPerFrame=(Date.now()-this._lastUpdate)/1E3}});cc.Director.EVENT_PROJECTION_CHANGED="director_projection_changed";cc.Director.EVENT_AFTER_UPDATE="director_after_update";cc.Director.EVENT_AFTER_VISIT="director_after_visit"; cc.Director.EVENT_AFTER_DRAW="director_after_draw";cc.DisplayLinkDirector=cc.Director.extend({invalid:!1,startAnimation:function(){this._nextDeltaTimeZero=!0;this.invalid=!1},mainLoop:function(){this._purgeDirectorInNextLoop?(this._purgeDirectorInNextLoop=!1,this.purgeDirector()):this.invalid||this.drawScene()},stopAnimation:function(){this.invalid=!0},setAnimationInterval:function(a){this._animationInterval=a;this.invalid||(this.stopAnimation(),this.startAnimation())}}); cc.Director.sharedDirector=null;cc.Director.firstUseDirector=!0;cc.Director._getInstance=function(){cc.Director.firstUseDirector&&(cc.Director.firstUseDirector=!1,cc.Director.sharedDirector=new cc.DisplayLinkDirector,cc.Director.sharedDirector.init());return cc.Director.sharedDirector};cc.defaultFPS=60;cc.Director.PROJECTION_2D=0;cc.Director.PROJECTION_3D=1;cc.Director.PROJECTION_CUSTOM=3;cc.Director.PROJECTION_DEFAULT=cc.Director.PROJECTION_2D;cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_CANVAS){var a=cc.Director.prototype;a.getProjection=function(a){return this._projection};a.setProjection=function(a){this._projection=a;cc.eventManager.dispatchEvent(this._eventProjectionChanged)};a.setDepthTest=function(){};a.setClearColor=function(a){cc.renderer._clearColor=a;cc.renderer._clearFillStyle="rgb("+a.r+","+a.g+","+a.b+")"};a.setOpenGLView=function(a){this._winSizeInPoints.width= cc._canvas.width;this._winSizeInPoints.height=cc._canvas.height;this._openGLView=a||cc.view;cc.eventManager&&cc.eventManager.setEnabled(!0)};a.getVisibleSize=function(){return this.getWinSize()};a.getVisibleOrigin=function(){return cc.p(0,0)}}else cc.Director._fpsImage=new Image,cc.Director._fpsImage.addEventListener("load",function(){cc.Director._fpsImageLoaded=!0}),cc._fpsImage&&(cc.Director._fpsImage.src=cc._fpsImage)});cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_WEBGL){cc.DirectorDelegate=cc.Class.extend({updateProjection:function(){}});var a=cc.Director.prototype,b=function(a){if(a&&a._renderCmd){a._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);var d=a._children;for(a=0;a<d.length;a++)b(d[a])}};cc.eventManager.addCustomListener(cc.Director.EVENT_PROJECTION_CHANGED,function(){for(var a=cc.director._scenesStack,d=0;d<a.length;d++)b(a[d])}); a.setProjection=function(a){var b=this._winSizeInPoints;this.setViewport();var e=this._openGLView,f=e._viewPortRect.x/e._scaleX,g=e._viewPortRect.y/e._scaleY;switch(a){case cc.Director.PROJECTION_2D:cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLLoadIdentity();e=cc.math.Matrix4.createOrthographicProjection(0,b.width,0,b.height,-1024,1024);cc.kmGLMultMatrix(e);cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLLoadIdentity();break;case cc.Director.PROJECTION_3D:var h=this.getZEye(),k=new cc.math.Matrix4, e=new cc.math.Matrix4;cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLLoadIdentity();k=cc.math.Matrix4.createPerspectiveProjection(60,b.width/b.height,0.1,2*h);cc.kmGLMultMatrix(k);h=new cc.math.Vec3(-f+b.width/2,-g+b.height/2,h);b=new cc.math.Vec3(-f+b.width/2,-g+b.height/2,0);f=new cc.math.Vec3(0,1,0);e.lookAt(h,b,f);cc.kmGLMultMatrix(e);cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLLoadIdentity();break;case cc.Director.PROJECTION_CUSTOM:this._projectionDelegate&&this._projectionDelegate.updateProjection(); break;default:cc.log(cc._LogInfos.Director_setProjection)}this._projection=a;cc.eventManager.dispatchEvent(this._eventProjectionChanged);cc.setProjectionMatrixDirty();cc.renderer.childrenOrderDirty=!0};a.setDepthTest=function(a){cc.renderer.setDepthTest(a)};a.setClearColor=function(a){cc.renderer._clearColor=a};a.setOpenGLView=function(a){this._winSizeInPoints.width=cc._canvas.width;this._winSizeInPoints.height=cc._canvas.height;this._openGLView=a||cc.view;a=cc.configuration;a.gatherGPUInfo();a.dumpInfo(); this.setGLDefaultValues();cc.eventManager&&cc.eventManager.setEnabled(!0)};a.getVisibleSize=function(){return this._openGLView.getVisibleSize()};a.getVisibleOrigin=function(){return this._openGLView.getVisibleOrigin()};a.getZEye=function(){return this._winSizeInPoints.height/1.1566};a.setViewport=function(){var a=this._openGLView;if(a){var b=this._winSizeInPoints;a.setViewPortInPoints(-a._viewPortRect.x/a._scaleX,-a._viewPortRect.y/a._scaleY,b.width,b.height)}};a.getOpenGLView=function(){return this._openGLView}; a.getProjection=function(){return this._projection};a.setAlphaBlending=function(a){a?cc.glBlendFunc(cc.BLEND_SRC,cc.BLEND_DST):cc.glBlendFunc(cc._renderContext.ONE,cc._renderContext.ZERO)};a.setGLDefaultValues=function(){this.setAlphaBlending(!0);this.setProjection(this._projection);cc._renderContext.clearColor(0,0,0,0)}}});(function(){var a=function(a,b,c,d,e,f,g){this.prev=a;this.next=b;this.callback=c;this.target=d;this.priority=e;this.paused=f;this.markedForDeletion=g},b=[];a.get=function(c,d,e,f,g,h,u){var t=b.pop();t?(t.prev=c,t.next=d,t.callback=e,t.target=f,t.priority=g,t.paused=h,t.markedForDeletion=u):t=new a(c,d,e,f,g,h,u);return t};a.put=function(a){a.prev=null;a.next=null;a.callback=null;a.target=null;a.priority=0;a.paused=!1;a.markedForDeletion=!1;20>b.length&&b.push(a)};var c=function(a,b,c,d){this.list= a;this.entry=b;this.target=c;this.callback=d},d=[];c.get=function(a,b,e,f){var g=d.pop();g?(g.list=a,g.entry=b,g.target=e,g.callback=f):g=new c(a,b,e,f);return g};c.put=function(a){a.list=null;a.entry=null;a.target=null;a.callback=null;20>d.length&&d.push(a)};var e=function(a,b,c,d,e,f){this.timers=a;this.target=b;this.timerIndex=c;this.currentTimer=d;this.currentTimerSalvaged=e;this.paused=f},f=[];e.get=function(a,b,c,d,g,h){var u=f.pop();u?(u.timers=a,u.target=b,u.timerIndex=c,u.currentTimer=d, u.currentTimerSalvaged=g,u.paused=h):u=new e(a,b,c,d,g,h);return u};e.put=function(a){a.timers=null;a.target=null;a.timerIndex=0;a.currentTimer=null;a.currentTimerSalvaged=!1;a.paused=!1;20>f.length&&f.push(a)};var g=function(){this._scheduler=null;this._elapsed=-1;this._useDelay=this._runForever=!1;this._interval=this._delay=this._repeat=this._timesExecuted=0;this._key=this._callback=this._target=null};cc.inject({initWithCallback:function(a,b,c,d,e,f,g){this._scheduler=a;this._target=c;this._callback= b;g&&(this._key=g);this._elapsed=-1;this._interval=d;this._delay=f;this._useDelay=0<this._delay;this._repeat=e;this._runForever=this._repeat===cc.REPEAT_FOREVER;return!0},getInterval:function(){return this._interval},setInterval:function(a){this._interval=a},update:function(a){var b=this._key;-1===this._elapsed?this._timesExecuted=this._elapsed=0:(this._elapsed+=a,this._runForever&&!this._useDelay?this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&& (this.trigger(),this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0,this._timesExecuted+=1),b!=this._key?this._elapsed=-1:this._callback&&!this._runForever&&this._timesExecuted>this._repeat&&this.cancel()))},getCallback:function(){return this._callback},getKey:function(){return this._key},trigger:function(){this._target&&this._callback&&this._callback.call(this._target,this._elapsed)},cancel:function(){this._scheduler.unschedule(this._callback, this._target)}},g.prototype);var h=[];g.get=function(){return h.pop()||new g};g.put=function(a){a._scheduler=null;a._elapsed=-1;a._runForever=!1;a._useDelay=!1;a._timesExecuted=0;a._repeat=0;a._delay=0;a._interval=0;a._target=null;a._callback=null;a._key=null;20>h.length&&h.push(a)};cc.Scheduler=cc.Class.extend({_timeScale:1,_updatesNegList:null,_updates0List:null,_updatesPosList:null,_hashForTimers:null,_arrayForTimers:null,_hashForUpdates:null,_currentTarget:null,_currentTargetSalvaged:!1,_updateHashLocked:!1, ctor:function(){this._timeScale=1;this._updatesNegList=[];this._updates0List=[];this._updatesPosList=[];this._hashForUpdates={};this._hashForTimers={};this._currentTarget=null;this._updateHashLocked=this._currentTargetSalvaged=!1;this._arrayForTimers=[]},_schedulePerFrame:function(a,b,c,d){var e=this._hashForUpdates[b.__instanceId];if(e&&e.entry)if(e.entry.priority!==c){if(this._updateHashLocked){cc.log("warning: you CANNOT change update priority in scheduled function");e.entry.markedForDeletion= !1;e.entry.paused=d;return}this.unscheduleUpdate(b)}else{e.entry.markedForDeletion=!1;e.entry.paused=d;return}0===c?this._appendIn(this._updates0List,a,b,d):0>c?this._priorityIn(this._updatesNegList,a,b,c,d):this._priorityIn(this._updatesPosList,a,b,c,d)},_removeHashElement:function(a){delete this._hashForTimers[a.target.__instanceId];for(var b=this._arrayForTimers,c=0,d=b.length;c<d;c++)if(b[c]===a){b.splice(c,1);break}e.put(a)},_removeUpdateFromHash:function(b){if(element=this._hashForUpdates[b.target.__instanceId]){b= element.list;for(var d=element.entry,e=0,f=b.length;e<f;e++)if(b[e]===d){b.splice(e,1);break}delete this._hashForUpdates[element.target.__instanceId];a.put(d);c.put(element)}},_priorityIn:function(b,d,e,f,g){d=a.get(null,null,d,e,f,g,!1);if(b){g=b.length-1;for(var h=0;h<=g&&!(f<b[h].priority);h++);b.splice(h,0,d)}else b=[],b.push(d);this._hashForUpdates[e.__instanceId]=c.get(b,d,e,null);return b},_appendIn:function(b,d,e,f){d=a.get(null,null,d,e,0,f,!1);b.push(d);this._hashForUpdates[e.__instanceId]= c.get(b,d,e,null,null)},setTimeScale:function(a){this._timeScale=a},getTimeScale:function(){return this._timeScale},update:function(a){this._updateHashLocked=!0;1!==this._timeScale&&(a*=this._timeScale);var b,c,d,e;b=0;c=this._updatesNegList;for(d=c.length;b<d;b++)e=c[b],e.paused||e.markedForDeletion||e.callback(a);b=0;c=this._updates0List;for(d=c.length;b<d;b++)e=c[b],e.paused||e.markedForDeletion||e.callback(a);b=0;c=this._updatesPosList;for(d=c.length;b<d;b++)e=c[b],e.paused||e.markedForDeletion|| e.callback(a);d=this._arrayForTimers;for(b=0;b<d.length;b++){this._currentTarget=c=d[b];this._currentTargetSalvaged=!1;if(!c.paused)for(c.timerIndex=0;c.timerIndex<c.timers.length;++c.timerIndex)c.currentTimer=c.timers[c.timerIndex],c.currentTimerSalvaged=!1,c.currentTimer.update(a),c.currentTimer=null;this._currentTargetSalvaged&&0===this._currentTarget.timers.length&&this._removeHashElement(this._currentTarget)}b=0;for(c=this._updatesNegList;b<c.length;)e=c[b],e.markedForDeletion?this._removeUpdateFromHash(e): b++;b=0;for(c=this._updates0List;b<c.length;)e=c[b],e.markedForDeletion?this._removeUpdateFromHash(e):b++;b=0;for(c=this._updatesPosList;b<c.length;)e=c[b],e.markedForDeletion?this._removeUpdateFromHash(e):b++;this._updateHashLocked=!1;this._currentTarget=null},scheduleCallbackForTarget:function(a,b,c,d,e,f){this.schedule(b,a,c,d,e,f,a.__instanceId+"")},schedule:function(a,b,c,d,f,h,u){if("function"!==typeof a){var t=a;a=b;b=t}if(4===arguments.length||5===arguments.length)u=f,h=d,d=cc.REPEAT_FOREVER, f=0;void 0===u&&(u=b.__instanceId+"");cc.assert(b,cc._LogInfos.Scheduler_scheduleCallbackForTarget_3);(t=this._hashForTimers[b.__instanceId])?cc.assert(t.paused===h,""):(t=e.get(null,b,0,null,null,h),this._arrayForTimers.push(t),this._hashForTimers[b.__instanceId]=t);var v,w;if(null==t.timers)t.timers=[];else for(w=0;w<t.timers.length;w++)if(v=t.timers[w],a===v._callback){cc.log(cc._LogInfos.Scheduler_scheduleCallbackForTarget,v.getInterval().toFixed(4),c.toFixed(4));v._interval=c;return}v=g.get(); v.initWithCallback(this,a,b,c,d,f,u);t.timers.push(v)},scheduleUpdate:function(a,b,c){this._schedulePerFrame(function(b){a.update(b)},a,b,c)},_getUnscheduleMark:function(a,b){switch(typeof a){case "number":case "string":return a===b._key;case "function":return a===b._callback}},unschedule:function(a,b){if(b&&a){var c=this._hashForTimers[b.__instanceId];if(c)for(var d=c.timers,e=0,f=d.length;e<f;e++){var h=d[e];if(this._getUnscheduleMark(a,h)){h!==c.currentTimer||c.currentTimerSalvaged||(c.currentTimerSalvaged= !0);d.splice(e,1);g.put(h);c.timerIndex>=e&&c.timerIndex--;0===d.length&&(this._currentTarget===c?this._currentTargetSalvaged=!0:this._removeHashElement(c));break}}}},unscheduleUpdate:function(a){a&&(a=this._hashForUpdates[a.__instanceId])&&(this._updateHashLocked?a.entry.markedForDeletion=!0:this._removeUpdateFromHash(a.entry))},unscheduleAllForTarget:function(a){if(a){var b=this._hashForTimers[a.__instanceId];if(b){var c=b.timers;-1<c.indexOf(b.currentTimer)&&!b.currentTimerSalvaged&&(b.currentTimerSalvaged= !0);for(var d=0,e=c.length;d<e;d++)g.put(c[d]);c.length=0;this._currentTarget===b?this._currentTargetSalvaged=!0:this._removeHashElement(b)}this.unscheduleUpdate(a)}},unscheduleAll:function(){this.unscheduleAllWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM)},unscheduleAllWithMinPriority:function(a){var b,c,d=this._arrayForTimers;for(b=d.length-1;0<=b;b--)c=d[b],this.unscheduleAllForTarget(c.target);d=0;if(0>a)for(b=0;b<this._updatesNegList.length;)d=this._updatesNegList.length,(c=this._updatesNegList[b])&& c.priority>=a&&this.unscheduleUpdate(c.target),d==this._updatesNegList.length&&b++;if(0>=a)for(b=0;b<this._updates0List.length;)d=this._updates0List.length,(c=this._updates0List[b])&&this.unscheduleUpdate(c.target),d==this._updates0List.length&&b++;for(b=0;b<this._updatesPosList.length;)d=this._updatesPosList.length,(c=this._updatesPosList[b])&&c.priority>=a&&this.unscheduleUpdate(c.target),d==this._updatesPosList.length&&b++},isScheduled:function(a,b){cc.assert(a,"Argument callback must not be empty"); cc.assert(b,"Argument target must be non-nullptr");var c=this._hashForTimers[b.__instanceId];if(!c)return!1;if(null!=c.timers)for(var c=c.timers,d=0;d<c.length;++d)if(a===c[d]._callback)return!0;return!1},pauseAllTargets:function(){return this.pauseAllTargetsWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM)},pauseAllTargetsWithMinPriority:function(a){var b=[],c,d=this._arrayForTimers,e,f;e=0;for(f=d.length;e<f;e++)if(c=d[e])c.paused=!0,b.push(c.target);if(0>a)for(e=0;e<this._updatesNegList.length;e++)(c= this._updatesNegList[e])&&c.priority>=a&&(c.paused=!0,b.push(c.target));if(0>=a)for(e=0;e<this._updates0List.length;e++)if(c=this._updates0List[e])c.paused=!0,b.push(c.target);for(e=0;e<this._updatesPosList.length;e++)(c=this._updatesPosList[e])&&c.priority>=a&&(c.paused=!0,b.push(c.target));return b},resumeTargets:function(a){if(a)for(var b=0;b<a.length;b++)this.resumeTarget(a[b])},pauseTarget:function(a){cc.assert(a,cc._LogInfos.Scheduler_pauseTarget);var b=this._hashForTimers[a.__instanceId];b&& (b.paused=!0);(a=this._hashForUpdates[a.__instanceId])&&(a.entry.paused=!0)},resumeTarget:function(a){cc.assert(a,cc._LogInfos.Scheduler_resumeTarget);var b=this._hashForTimers[a.__instanceId];b&&(b.paused=!1);(a=this._hashForUpdates[a.__instanceId])&&(a.entry.paused=!1)},isTargetPaused:function(a){cc.assert(a,cc._LogInfos.Scheduler_isTargetPaused);var b=this._hashForTimers[a.__instanceId];return b?b.paused:(a=this._hashForUpdates[a.__instanceId])?a.entry.paused:!1},scheduleUpdateForTarget:function(a, b,c){this.scheduleUpdate(a,b,c)},unscheduleCallbackForTarget:function(a,b){this.unschedule(b,a)},unscheduleUpdateForTarget:function(a){this.unscheduleUpdate(a)},unscheduleAllCallbacksForTarget:function(a){this.unschedule(a.__instanceId+"",a)},unscheduleAllCallbacks:function(){this.unscheduleAllWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM)},unscheduleAllCallbacksWithMinPriority:function(a){this.unscheduleAllWithMinPriority(a)}});cc.Scheduler.PRIORITY_SYSTEM=-2147483648;cc.Scheduler.PRIORITY_NON_SYSTEM= cc.Scheduler.PRIORITY_SYSTEM+1})();cc.PI2=2*Math.PI; cc.DrawingPrimitiveCanvas=cc.Class.extend({_cacheArray:[],_renderContext:null,ctor:function(a){this._renderContext=a},drawPoint:function(a,b){b||(b=1);var c=cc.view.getScaleX(),d=cc.view.getScaleY(),d=cc.p(a.x*c,a.y*d),e=this._renderContext.getContext();e.beginPath();e.arc(d.x,-d.y,b*c,0,2*Math.PI,!1);e.closePath();e.fill()},drawPoints:function(a,b,c){if(null!=a){c||(c=1);b=this._renderContext.getContext();var d=cc.view.getScaleX(),e=cc.view.getScaleY();b.beginPath();for(var f=0,g=a.length;f<g;f++)b.arc(a[f].x* d,-a[f].y*e,c*d,0,2*Math.PI,!1);b.closePath();b.fill()}},drawLine:function(a,b){var c=this._renderContext.getContext();cc.view.getScaleX();cc.view.getScaleY();c.beginPath();c.moveTo(a.x,-a.y);c.lineTo(b.x,-b.y);c.closePath();c.stroke()},drawRect:function(a,b){this.drawLine(cc.p(a.x,a.y),cc.p(b.x,a.y));this.drawLine(cc.p(b.x,a.y),cc.p(b.x,b.y));this.drawLine(cc.p(b.x,b.y),cc.p(a.x,b.y));this.drawLine(cc.p(a.x,b.y),cc.p(a.x,a.y))},drawSolidRect:function(a,b,c){a=[a,cc.p(b.x,a.y),b,cc.p(a.x,b.y)];this.drawSolidPoly(a, 4,c)},drawPoly:function(a,b,c,d){d=d||!1;if(null!=a){if(3>a.length)throw Error("Polygon's point must greater than 2");var e=a[0];b=this._renderContext.getContext();cc.view.getScaleX();cc.view.getScaleY();b.beginPath();b.moveTo(e.x,-e.y);for(var e=1,f=a.length;e<f;e++)b.lineTo(a[e].x,-a[e].y);c&&b.closePath();d?b.fill():b.stroke()}},drawSolidPoly:function(a,b,c){this.setDrawColor(c.r,c.g,c.b,c.a);this.drawPoly(a,b,!0,!0)},drawCircle:function(a,b,c,d,e){e=e||!1;d=this._renderContext.getContext();cc.view.getScaleX(); cc.view.getScaleY();d.beginPath();d.arc(0|a.x,0|-a.y,b,-c,-(c-2*Math.PI),!1);e&&d.lineTo(0|a.x,0|-a.y);d.stroke()},drawQuadBezier:function(a,b,c,d){for(var e=this._cacheArray,f=e.length=0,g=0;g<d;g++){var h=Math.pow(1-f,2)*a.x+2*(1-f)*f*b.x+f*f*c.x,k=Math.pow(1-f,2)*a.y+2*(1-f)*f*b.y+f*f*c.y;e.push(cc.p(h,k));f+=1/d}e.push(cc.p(c.x,c.y));this.drawPoly(e,d+1,!1,!1)},drawCubicBezier:function(a,b,c,d,e){for(var f=this._cacheArray,g=f.length=0,h=0;h<e;h++){var k=Math.pow(1-g,3)*a.x+3*Math.pow(1-g,2)* g*b.x+3*(1-g)*g*g*c.x+g*g*g*d.x,m=Math.pow(1-g,3)*a.y+3*Math.pow(1-g,2)*g*b.y+3*(1-g)*g*g*c.y+g*g*g*d.y;f.push(cc.p(k,m));g+=1/e}f.push(cc.p(d.x,d.y));this.drawPoly(f,e+1,!1,!1)},drawCatmullRom:function(a,b){this.drawCardinalSpline(a,0.5,b)},drawCardinalSpline:function(a,b,c){cc._renderContext.setStrokeStyle("rgba(255,255,255,1)");var d=this._cacheArray;d.length=0;for(var e,f,g=1/a.length,h=0;h<c+1;h++)f=h/c,1===f?(e=a.length-1,f=1):(e=0|f/g,f=(f-g*e)/g),e=cc.CardinalSplineAt(cc.getControlPointAt(a, e-1),cc.getControlPointAt(a,e-0),cc.getControlPointAt(a,e+1),cc.getControlPointAt(a,e+2),b,f),d.push(e);this.drawPoly(d,c+1,!1,!1)},drawImage:function(a,b,c,d,e){var f=arguments.length,g=this._renderContext.getContext();switch(f){case 2:g.drawImage(a,b.x,-(b.y+a.height));break;case 3:g.drawImage(a,b.x,-(b.y+c.height),c.width,c.height);break;case 5:g.drawImage(a,b.x,b.y,c.width,c.height,d.x,-(d.y+e.height),e.width,e.height);break;default:throw Error("Argument must be non-nil");}},drawStar:function(a, b,c){a=a||this._renderContext;var d=a.getContext();c="rgba("+(0|c.r)+","+(0|c.g)+","+(0|c.b);a.setFillStyle(c+",1)");var e=b/10;d.beginPath();d.moveTo(-b,b);d.lineTo(0,e);d.lineTo(b,b);d.lineTo(e,0);d.lineTo(b,-b);d.lineTo(0,-e);d.lineTo(-b,-b);d.lineTo(-e,0);d.lineTo(-b,b);d.closePath();d.fill();var f=d.createRadialGradient(0,0,e,0,0,b);f.addColorStop(0,c+", 1)");f.addColorStop(0.3,c+", 0.8)");f.addColorStop(1,c+", 0.0)");a.setFillStyle(f);d.beginPath();d.arc(0,0,b-e,0,cc.PI2,!1);d.closePath();d.fill()}, drawColorBall:function(a,b,c){a=a||this._renderContext;var d=a.getContext();b*=cc.view.getScaleX();c="rgba("+(0|c.r)+","+(0|c.g)+","+(0|c.b);var e=d.createRadialGradient(0,0,b/10,0,0,b);e.addColorStop(0,c+", 1)");e.addColorStop(0.3,c+", 0.8)");e.addColorStop(0.6,c+", 0.4)");e.addColorStop(1,c+", 0.0)");a.setFillStyle(e);d.beginPath();d.arc(0,0,b,0,cc.PI2,!1);d.closePath();d.fill()},fillText:function(a,b,c){this._renderContext.getContext().fillText(a,b,-c)},setDrawColor:function(a,b,c,d){this._renderContext.setFillStyle("rgba("+ a+","+b+","+c+","+d/255+")");this._renderContext.setStrokeStyle("rgba("+a+","+b+","+c+","+d/255+")")},setPointSize:function(a){},setLineWidth:function(a){this._renderContext.getContext().lineWidth=a*cc.view.getScaleX()}});cc.DrawingPrimitiveWebGL=cc.Class.extend({_renderContext:null,_initialized:!1,_shader:null,_colorLocation:"u_color",_colorArray:null,_pointSizeLocation:"u_pointSize",_pointSize:-1,ctor:function(a){null==a&&(a=cc._renderContext);if(!a instanceof WebGLRenderingContext)throw Error("Can't initialise DrawingPrimitiveWebGL. context need is WebGLRenderingContext");this._renderContext=a;this._colorArray=new Float32Array([1,1,1,1])},lazy_init:function(){this._initialized||(this._shader=cc.shaderCache.programForKey(cc.SHADER_POSITION_UCOLOR), this._shader._addUniformLocation(this._colorLocation),this._shader._addUniformLocation(this._pointSizeLocation),this._initialized=!0)},drawInit:function(){this._initialized=!1},drawPoint:function(a){this.lazy_init();var b=this._renderContext;this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();b.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);this._shader.setUniformLocationWith1f(this._pointSizeLocation, this._pointSize);var c=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,c);b.bufferData(b.ARRAY_BUFFER,new Float32Array([a.x,a.y]),b.STATIC_DRAW);b.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,b.FLOAT,!1,0,0);b.drawArrays(b.POINTS,0,1);b.deleteBuffer(c);cc.incrementGLDraws(1)},drawPoints:function(a,b){if(a&&0!==a.length){this.lazy_init();var c=this._renderContext;this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();c.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION); this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);this._shader.setUniformLocationWith1f(this._pointSizeLocation,this._pointSize);var d=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,d);c.bufferData(c.ARRAY_BUFFER,this._pointsToTypeArray(a),c.STATIC_DRAW);c.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,c.FLOAT,!1,0,0);c.drawArrays(c.POINTS,0,a.length);c.deleteBuffer(d);cc.incrementGLDraws(1)}},_pointsToTypeArray:function(a){for(var b=new Float32Array(2*a.length),c=0;c<a.length;c++)b[2* c]=a[c].x,b[2*c+1]=a[c].y;return b},drawLine:function(a,b){this.lazy_init();var c=this._renderContext;this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();c.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);var d=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,d);c.bufferData(c.ARRAY_BUFFER,this._pointsToTypeArray([a,b]),c.STATIC_DRAW);c.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,c.FLOAT, !1,0,0);c.drawArrays(c.LINES,0,2);c.deleteBuffer(d);cc.incrementGLDraws(1)},drawRect:function(a,b){this.drawLine(cc.p(a.x,a.y),cc.p(b.x,a.y));this.drawLine(cc.p(b.x,a.y),cc.p(b.x,b.y));this.drawLine(cc.p(b.x,b.y),cc.p(a.x,b.y));this.drawLine(cc.p(a.x,b.y),cc.p(a.x,a.y))},drawSolidRect:function(a,b,c){a=[a,cc.p(b.x,a.y),b,cc.p(a.x,b.y)];this.drawSolidPoly(a,4,c)},drawPoly:function(a,b,c){this.lazy_init();b=this._renderContext;this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4(); b.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);var d=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d);b.bufferData(b.ARRAY_BUFFER,this._pointsToTypeArray(a),b.STATIC_DRAW);b.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,b.FLOAT,!1,0,0);c?b.drawArrays(b.LINE_LOOP,0,a.length):b.drawArrays(b.LINE_STRIP,0,a.length);b.deleteBuffer(d);cc.incrementGLDraws(1)},drawSolidPoly:function(a,b,c){this.lazy_init();c&&this.setDrawColor(c.r, c.g,c.b,c.a);b=this._renderContext;this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();b.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);c=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,c);b.bufferData(b.ARRAY_BUFFER,this._pointsToTypeArray(a),b.STATIC_DRAW);b.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,b.FLOAT,!1,0,0);b.drawArrays(b.TRIANGLE_FAN,0,a.length);b.deleteBuffer(c);cc.incrementGLDraws(1)}, drawCircle:function(a,b,c,d,e){this.lazy_init();var f=1;e&&f++;var g=2*Math.PI/d;if(e=new Float32Array(2*(d+2))){for(var h=0;h<=d;h++){var k=h*g,m=b*Math.cos(k+c)+a.x,k=b*Math.sin(k+c)+a.y;e[2*h]=m;e[2*h+1]=k}e[2*(d+1)]=a.x;e[2*(d+1)+1]=a.y;a=this._renderContext;this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);b=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER, b);a.bufferData(a.ARRAY_BUFFER,e,a.STATIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,0,0);a.drawArrays(a.LINE_STRIP,0,d+f);a.deleteBuffer(b);cc.incrementGLDraws(1)}},drawQuadBezier:function(a,b,c,d){this.lazy_init();for(var e=new Float32Array(2*(d+1)),f=0,g=0;g<d;g++)e[2*g]=Math.pow(1-f,2)*a.x+2*(1-f)*f*b.x+f*f*c.x,e[2*g+1]=Math.pow(1-f,2)*a.y+2*(1-f)*f*b.y+f*f*c.y,f+=1/d;e[2*d]=c.x;e[2*d+1]=c.y;a=this._renderContext;this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4(); a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);b=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,b);a.bufferData(a.ARRAY_BUFFER,e,a.STATIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,0,0);a.drawArrays(a.LINE_STRIP,0,d+1);a.deleteBuffer(b);cc.incrementGLDraws(1)},drawCubicBezier:function(a,b,c,d,e){this.lazy_init();for(var f=new Float32Array(2*(e+1)),g=0,h=0;h<e;h++)f[2*h]=Math.pow(1-g,3)*a.x+3*Math.pow(1- g,2)*g*b.x+3*(1-g)*g*g*c.x+g*g*g*d.x,f[2*h+1]=Math.pow(1-g,3)*a.y+3*Math.pow(1-g,2)*g*b.y+3*(1-g)*g*g*c.y+g*g*g*d.y,g+=1/e;f[2*e]=d.x;f[2*e+1]=d.y;a=this._renderContext;this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);b=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,b);a.bufferData(a.ARRAY_BUFFER,f,a.STATIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION, 2,a.FLOAT,!1,0,0);a.drawArrays(a.LINE_STRIP,0,e+1);a.deleteBuffer(b);cc.incrementGLDraws(1)},drawCatmullRom:function(a,b){this.drawCardinalSpline(a,0.5,b)},drawCardinalSpline:function(a,b,c){this.lazy_init();for(var d=new Float32Array(2*(c+1)),e,f,g=1/a.length,h=0;h<c+1;h++)f=h/c,1===f?(e=a.length-1,f=1):(e=0|f/g,f=(f-g*e)/g),e=cc.cardinalSplineAt(cc.getControlPointAt(a,e-1),cc.getControlPointAt(a,e),cc.getControlPointAt(a,e+1),cc.getControlPointAt(a,e+2),b,f),d[2*h]=e.x,d[2*h+1]=e.y;a=this._renderContext; this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);b=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,b);a.bufferData(a.ARRAY_BUFFER,d,a.STATIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,0,0);a.drawArrays(a.LINE_STRIP,0,c+1);a.deleteBuffer(b);cc.incrementGLDraws(1)},setDrawColor:function(a,b,c,d){this._colorArray[0]= a/255;this._colorArray[1]=b/255;this._colorArray[2]=c/255;this._colorArray[3]=d/255},setPointSize:function(a){this._pointSize=a*cc.contentScaleFactor()},setLineWidth:function(a){this._renderContext.lineWidth&&this._renderContext.lineWidth(a)}});cc._tmp.PrototypeLabelTTF=function(){var a=cc.LabelTTF.prototype;cc.defineGetterSetter(a,"color",a.getColor,a.setColor);cc.defineGetterSetter(a,"opacity",a.getOpacity,a.setOpacity);cc.defineGetterSetter(a,"string",a.getString,a.setString);cc.defineGetterSetter(a,"textAlign",a.getHorizontalAlignment,a.setHorizontalAlignment);cc.defineGetterSetter(a,"verticalAlign",a.getVerticalAlignment,a.setVerticalAlignment);cc.defineGetterSetter(a,"fontSize",a.getFontSize,a.setFontSize);cc.defineGetterSetter(a, "fontName",a.getFontName,a.setFontName);cc.defineGetterSetter(a,"font",a._getFont,a._setFont);cc.defineGetterSetter(a,"boundingWidth",a._getBoundingWidth,a._setBoundingWidth);cc.defineGetterSetter(a,"boundingHeight",a._getBoundingHeight,a._setBoundingHeight);cc.defineGetterSetter(a,"fillStyle",a._getFillStyle,a.setFontFillColor);cc.defineGetterSetter(a,"strokeStyle",a._getStrokeStyle,a._setStrokeStyle);cc.defineGetterSetter(a,"lineWidth",a._getLineWidth,a._setLineWidth);cc.defineGetterSetter(a,"shadowOffsetX", a._getShadowOffsetX,a._setShadowOffsetX);cc.defineGetterSetter(a,"shadowOffsetY",a._getShadowOffsetY,a._setShadowOffsetY);cc.defineGetterSetter(a,"shadowOpacity",a._getShadowOpacity,a._setShadowOpacity);cc.defineGetterSetter(a,"shadowBlur",a._getShadowBlur,a._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,_onCacheCanvasMode:!0,_shadowEnabled:!1,_shadowOffset:null,_shadowOpacity:0,_shadowBlur:0,_shadowColor:null,_strokeEnabled:!1,_strokeColor:null,_strokeSize:0,_textFillColor:null,_strokeShadowOffsetX:0,_strokeShadowOffsetY:0,_needUpdateTexture:!1,_lineWidths:null,_className:"LabelTTF",_fontStyle:"normal",_fontWeight:"normal", _lineHeight:"normal",initWithString:function(a,b,c,d,e,f){a=a?a+"":"";c=c||16;d=d||cc.size(0,0);e=e||cc.TEXT_ALIGNMENT_LEFT;f=f||cc.VERTICAL_TEXT_ALIGNMENT_TOP;this._opacityModifyRGB=!1;this._dimensions=cc.size(d.width,d.height);this._fontName=b||"Arial";this._hAlignment=e;this._vAlignment=f;this._fontSize=c;this._renderCmd._setFontStyle(this._fontName,c,this._fontStyle,this._fontWeight);this.string=a;this._renderCmd._setColorsString();this._renderCmd._updateTexture();this._setUpdateTextureDirty(); this._scaleX=this._scaleY=1/cc.view.getDevicePixelRatio();return!0},_setUpdateTextureDirty:function(){this._needUpdateTexture=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.textDirty)},ctor:function(a,b,c,d,e,f){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._fontName="Arial";this._shadowEnabled=!1;this._shadowOffset=cc.p(0,0);this._shadowBlur=this._shadowOpacity= 0;this._strokeEnabled=!1;this._strokeColor=cc.color(255,255,255,255);this._strokeSize=0;this._textFillColor=cc.color(255,255,255,255);this._strokeShadowOffsetY=this._strokeShadowOffsetX=0;this._needUpdateTexture=!1;this._lineWidths=[];this._renderCmd._setColorsString();this._textureLoaded=!0;b&&b instanceof cc.FontDefinition?this.initWithStringAndTextDefinition(a,b):cc.LabelTTF.prototype.initWithString.call(this,a,b,c,d,e,f)},init:function(){return this.initWithString(" ",this._fontName,this._fontSize)}, description:function(){return"\x3ccc.LabelTTF | FontName \x3d"+this._fontName+" FontSize \x3d "+this._fontSize.toFixed(1)+"\x3e"},getLineHeight:function(){return!this._lineHeight||this._lineHeight.charAt?this._renderCmd._getFontClientHeight():this._lineHeight||this._renderCmd._getFontClientHeight()},setLineHeight:function(a){this._lineHeight=a},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},initWithStringAndTextDefinition:function(a,b){this._updateWithTextDefinition(b,!1);this.string=a;return!0},setTextDefinition:function(a){a&&this._updateWithTextDefinition(a,!0)},getTextDefinition:function(){return this._prepareTextDefinition(!1)},enableShadow:function(a,b,c,d){null!=a.r&&null!=a.g&&null!=a.b&&null!=a.a?this._enableShadow(a,b,c):this._enableShadowNoneColor(a, b,c,d)},_enableShadowNoneColor:function(a,b,c,d){c=c||0.5;!1===this._shadowEnabled&&(this._shadowEnabled=!0);var e=this._shadowOffset;if(e&&e.x!==a||e._y!==b)e.x=a,e.y=b;this._shadowOpacity!==c&&(this._shadowOpacity=c);this._renderCmd._setColorsString();this._shadowBlur!==d&&(this._shadowBlur=d);this._setUpdateTextureDirty()},_enableShadow:function(a,b,c){this._shadowColor||(this._shadowColor=cc.color(255,255,255,128));this._shadowColor.r=a.r;this._shadowColor.g=a.g;this._shadowColor.b=a.b;this._enableShadowNoneColor(b.width|| b.x||0,b.height||b.y||0,null!=a.a?a.a/255:0.5,c)},_getShadowOffsetX:function(){return this._shadowOffset.x},_setShadowOffsetX:function(a){!1===this._shadowEnabled&&(this._shadowEnabled=!0);this._shadowOffset.x!==a&&(this._shadowOffset.x=a,this._setUpdateTextureDirty())},_getShadowOffsetY:function(){return this._shadowOffset._y},_setShadowOffsetY:function(a){!1===this._shadowEnabled&&(this._shadowEnabled=!0);this._shadowOffset._y!==a&&(this._shadowOffset._y=a,this._setUpdateTextureDirty())},_getShadowOffset:function(){return cc.p(this._shadowOffset.x, this._shadowOffset.y)},_setShadowOffset:function(a){!1===this._shadowEnabled&&(this._shadowEnabled=!0);if(this._shadowOffset.x!==a.x||this._shadowOffset.y!==a.y)this._shadowOffset.x=a.x,this._shadowOffset.y=a.y,this._setUpdateTextureDirty()},_getShadowOpacity:function(){return this._shadowOpacity},_setShadowOpacity:function(a){!1===this._shadowEnabled&&(this._shadowEnabled=!0);this._shadowOpacity!==a&&(this._shadowOpacity=a,this._renderCmd._setColorsString(),this._setUpdateTextureDirty())},_getShadowBlur:function(){return this._shadowBlur}, _setShadowBlur:function(a){!1===this._shadowEnabled&&(this._shadowEnabled=!0);this._shadowBlur!==a&&(this._shadowBlur=a,this._setUpdateTextureDirty())},disableShadow:function(){this._shadowEnabled&&(this._shadowEnabled=!1,this._setUpdateTextureDirty())},enableStroke:function(a,b){!1===this._strokeEnabled&&(this._strokeEnabled=!0);var c=this._strokeColor;if(c.r!==a.r||c.g!==a.g||c.b!==a.b)c.r=a.r,c.g=a.g,c.b=a.b,this._renderCmd._setColorsString();this._strokeSize!==b&&(this._strokeSize=b||0);this._setUpdateTextureDirty()}, _getStrokeStyle:function(){return this._strokeColor},_setStrokeStyle:function(a){!1===this._strokeEnabled&&(this._strokeEnabled=!0);var b=this._strokeColor;if(b.r!==a.r||b.g!==a.g||b.b!==a.b)b.r=a.r,b.g=a.g,b.b=a.b,this._renderCmd._setColorsString(),this._setUpdateTextureDirty()},_getLineWidth:function(){return this._strokeSize},_setLineWidth:function(a){!1===this._strokeEnabled&&(this._strokeEnabled=!0);this._strokeSize!==a&&(this._strokeSize=a||0,this._setUpdateTextureDirty())},disableStroke:function(){this._strokeEnabled&& (this._strokeEnabled=!1,this._setUpdateTextureDirty())},setFontFillColor:function(a){var b=this._textFillColor;if(b.r!==a.r||b.g!==a.g||b.b!==a.b)b.r=a.r,b.g=a.g,b.b=a.b,this._renderCmd._setColorsString(),this._needUpdateTexture=!0},_getFillStyle:function(){return this._textFillColor},_updateWithTextDefinition:function(a,b){a.fontDimensions?(this._dimensions.width=a.boundingWidth,this._dimensions.height=a.boundingHeight):(this._dimensions.width=0,this._dimensions.height=0);this._hAlignment=a.textAlign; this._vAlignment=a.verticalAlign;this._fontName=a.fontName;this._fontSize=a.fontSize||12;this._lineHeight=a.lineHeight?a.lineHeight:this._fontSize;this._renderCmd._setFontStyle(a);a.shadowEnabled&&this.enableShadow(a.shadowOffsetX,a.shadowOffsetY,a.shadowOpacity,a.shadowBlur);a.strokeEnabled&&this.enableStroke(a.strokeStyle,a.lineWidth);this.setFontFillColor(a.fillStyle);b&&this._renderCmd._updateTexture();var c=cc.Node._dirtyFlags;this._renderCmd.setDirtyFlag(c.colorDirty|c.opacityDirty|c.textDirty)}, _prepareTextDefinition:function(a){var b=new cc.FontDefinition;a?(b.fontSize=this._fontSize,b.boundingWidth=cc.contentScaleFactor()*this._dimensions.width,b.boundingHeight=cc.contentScaleFactor()*this._dimensions.height):(b.fontSize=this._fontSize,b.boundingWidth=this._dimensions.width,b.boundingHeight=this._dimensions.height);b.fontName=this._fontName;b.textAlign=this._hAlignment;b.verticalAlign=this._vAlignment;if(this._strokeEnabled){b.strokeEnabled=!0;var c=this._strokeColor;b.strokeStyle=cc.color(c.r, c.g,c.b);b.lineWidth=this._strokeSize}else b.strokeEnabled=!1;this._shadowEnabled?(b.shadowEnabled=!0,b.shadowBlur=this._shadowBlur,b.shadowOpacity=this._shadowOpacity,b.shadowOffsetX=(a?cc.contentScaleFactor():1)*this._shadowOffset.x,b.shadowOffsetY=(a?cc.contentScaleFactor():1)*this._shadowOffset.y):b._shadowEnabled=!1;a=this._textFillColor;b.fillStyle=cc.color(a.r,a.g,a.b);return b},getScale:function(){this._scaleX!==this._scaleY&&cc.log(cc._LogInfos.Node_getScale);return this._scaleX*cc.view.getDevicePixelRatio()}, setScale:function(a,b){var c=cc.view.getDevicePixelRatio();this._scaleX=a/c;this._scaleY=(b||0===b?b:a)/c;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getScaleX:function(){return this._scaleX*cc.view.getDevicePixelRatio()},setScaleX:function(a){this._scaleX=a/cc.view.getDevicePixelRatio();this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getScaleY:function(){return this._scaleY*cc.view.getDevicePixelRatio()},setScaleY:function(a){this._scaleY=a/cc.view.getDevicePixelRatio(); this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},setString:function(a){a=String(a);this._originalText!==a&&(this._originalText=a+"",this._updateString(),this._setUpdateTextureDirty(),this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty))},_updateString:function(){this._string&&""!==this._string||this._string===this._originalText||(cc.renderer.childrenOrderDirty=!0);this._string=this._originalText},setHorizontalAlignment:function(a){a!==this._hAlignment&&(this._hAlignment= a,this._setUpdateTextureDirty())},setVerticalAlignment:function(a){a!==this._vAlignment&&(this._vAlignment=a,this._setUpdateTextureDirty())},setDimensions:function(a,b){var c;void 0===b?(c=a.width,b=a.height):c=a;if(c!==this._dimensions.width||b!==this._dimensions.height)this._dimensions.width=c,this._dimensions.height=b,this._updateString(),this._setUpdateTextureDirty()},_getBoundingWidth:function(){return this._dimensions.width},_setBoundingWidth:function(a){a!==this._dimensions.width&&(this._dimensions.width= a,this._updateString(),this._setUpdateTextureDirty())},_getBoundingHeight:function(){return this._dimensions.height},_setBoundingHeight:function(a){a!==this._dimensions.height&&(this._dimensions.height=a,this._updateString(),this._setUpdateTextureDirty())},setFontSize:function(a){this._fontSize!==a&&(this._fontSize=a,this._renderCmd._setFontStyle(this._fontName,this._fontSize,this._fontStyle,this._fontWeight),this._setUpdateTextureDirty())},setFontName:function(a){this._fontName&&this._fontName!== a&&(this._fontName=a,this._renderCmd._setFontStyle(this._fontName,this._fontSize,this._fontStyle,this._fontWeight),this._setUpdateTextureDirty())},_getFont:function(){return this._renderCmd._getFontStyle()},_setFont:function(a){if(a=cc.LabelTTF._fontStyleRE.exec(a))this._fontSize=parseInt(a[1]),this._fontName=a[2],this._renderCmd._setFontStyle(this._fontName,this._fontSize,this._fontStyle,this._fontWeight),this._setUpdateTextureDirty()},getContentSize:function(){this._needUpdateTexture&&this._renderCmd._updateTTF(); var a=cc.view.getDevicePixelRatio();return cc.size(this._contentSize.width/a,this._contentSize.height/a)},_getWidth:function(){this._needUpdateTexture&&this._renderCmd._updateTTF();return this._contentSize.width/cc.view.getDevicePixelRatio()},_getHeight:function(){this._needUpdateTexture&&this._renderCmd._updateTTF();return this._contentSize.height/cc.view.getDevicePixelRatio()},setTextureRect:function(a,b,c){this._rectRotated=b||!1;this.setContentSize(c||a);this.setVertexRect(a);this._renderCmd._setTextureCoords(a, !1);b=this._unflippedOffsetPositionFromCenter.x;c=this._unflippedOffsetPositionFromCenter.y;this._flippedX&&(b=-b);this._flippedY&&(c=-c);var d=this._rect;this._offsetPosition.x=b+(a.width-d.width)/2;this._offsetPosition.y=c+(a.height-d.height)/2},setDrawMode:function(a){this._onCacheCanvasMode=a},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new cc.LabelTTF.WebGLRenderCmd(this):this._onCacheCanvasMode?new cc.LabelTTF.CacheCanvasRenderCmd(this):new cc.LabelTTF.CanvasRenderCmd(this)}, _setFontStyle:function(a){this._fontStyle!==a&&(this._fontStyle=a,this._renderCmd._setFontStyle(this._fontName,this._fontSize,this._fontStyle,this._fontWeight),this._setUpdateTextureDirty())},_getFontStyle:function(){return this._fontStyle},_setFontWeight:function(a){this._fontWeight!==a&&(this._fontWeight=a,this._renderCmd._setFontStyle(this._fontName,this._fontSize,this._fontStyle,this._fontWeight),this._setUpdateTextureDirty())},_getFontWeight:function(){return this._fontWeight}}); cc.assert(cc.isFunction(cc._tmp.PrototypeLabelTTF),cc._LogInfos.MissingFile,"LabelTTFPropertyDefine.js");cc._tmp.PrototypeLabelTTF();delete cc._tmp.PrototypeLabelTTF;cc.LabelTTF._fontStyleRE=/^(\d+)px\s+['"]?([\w\s\d]+)['"]?$/;cc.LabelTTF.create=function(a,b,c,d,e,f){return new cc.LabelTTF(a,b,c,d,e,f)};cc.LabelTTF.createWithFontDefinition=cc.LabelTTF.create;cc.LabelTTF.__labelHeightDiv=document.createElement("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):window.addEventListener("load",function(){this.removeEventListener("load",arguments.callee,!1);document.body.appendChild(cc.LabelTTF.__labelHeightDiv)},!1); cc.LabelTTF.__getFontHeightByDiv=function(a,b){var c,d=cc.LabelTTF.__labelHeightDiv;if(a instanceof cc.FontDefinition){c=cc.LabelTTF.__fontHeightCache[a._getCanvasFontStr()];if(0<c)return c;d.innerHTML="ajghl~!";d.style.fontFamily=a.fontName;d.style.fontSize=a.fontSize+"px";d.style.fontStyle=a.fontStyle;d.style.fontWeight=a.fontWeight;c=d.clientHeight;cc.LabelTTF.__fontHeightCache[a._getCanvasFontStr()]=c}else{c=cc.LabelTTF.__fontHeightCache[a+"."+b];if(0<c)return c;d.innerHTML="ajghl~!";d.style.fontFamily= a;d.style.fontSize=b+"px";c=d.clientHeight;cc.LabelTTF.__fontHeightCache[a+"."+b]=c}d.innerHTML="";return c};cc.LabelTTF.__fontHeightCache={};cc.LabelTTF._textAlign=["left","center","right"];cc.LabelTTF._textBaseline=["top","middle","bottom"];cc.LabelTTF.wrapInspection=!0;cc.LabelTTF._wordRex=/([a-zA-Z0-9\u00c4\u00d6\u00dc\u00e4\u00f6\u00fc\u00df\u00e9\u00e8\u00e7\u00e0\u00f9\u00ea\u00e2\u00ee\u00f4\u00fb]+|\S)/;cc.LabelTTF._symbolRex=/^[!,.:;}\]%\?>\u3001\u2018\u201c\u300b\uff1f\u3002\uff0c\uff01]/;cc.LabelTTF._lastWordRex=/([a-zA-Z0-9\u00c4\u00d6\u00dc\u00e4\u00f6\u00fc\u00df\u00e9\u00e8\u00e7\u00e0\u00f9\u00ea\u00e2\u00ee\u00f4\u00fb]+|\S)$/; cc.LabelTTF._lastEnglish=/[a-zA-Z0-9\u00c4\u00d6\u00dc\u00e4\u00f6\u00fc\u00df\u00e9\u00e8\u00e7\u00e0\u00f9\u00ea\u00e2\u00ee\u00f4\u00fb]+$/;cc.LabelTTF._firsrEnglish=/^[a-zA-Z0-9\u00c4\u00d6\u00dc\u00e4\u00f6\u00fc\u00df\u00e9\u00e8\u00e7\u00e0\u00f9\u00ea\u00e2\u00ee\u00f4\u00fb]/; (function(){cc.LabelTTF.RenderCmd=function(){this._fontClientHeight=18;this._fontStyleStr="";this._shadowColorStr="rgba(128, 128, 128, 0.5)";this._strokeColorStr="";this._fillColorStr="rgba(255,255,255,1)";this._labelContext=this._labelCanvas=null;this._lineWidths=[];this._strings=[];this._isMultiLine=!1;this._status=[];this._renderingIndex=0;this._canUseDirtyRegion=!0};var a=cc.LabelTTF.RenderCmd.prototype;a.constructor=cc.LabelTTF.RenderCmd;a._labelCmdCtor=cc.LabelTTF.RenderCmd;a._setFontStyle= function(a,b,e,f){if(a instanceof cc.FontDefinition)this._fontStyleStr=a._getCanvasFontStr(),this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(a);else{var g=b*cc.view.getDevicePixelRatio();this._fontStyleStr=e+" "+f+" "+g+"px '"+a+"'";this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(a,b)}};a._getFontStyle=function(){return this._fontStyleStr};a._getFontClientHeight=function(){return this._fontClientHeight};a._updateColor=function(){this._setColorsString();this._updateTexture()};a._setColorsString= function(){var a=this._displayedColor,b=this._node,e=b._shadowColor||this._displayedColor,f=b._strokeColor,g=b._textFillColor,h=a.r/255,k=a.g/255,a=a.b/255;this._shadowColorStr="rgba("+(0|h*e.r)+","+(0|k*e.g)+","+(0|a*e.b)+","+b._shadowOpacity+")";this._fillColorStr="rgba("+(0|h*g.r)+","+(0|k*g.g)+","+(0|a*g.b)+", 1)";this._strokeColorStr="rgba("+(0|h*f.r)+","+(0|k*f.g)+","+(0|a*f.b)+", 1)"};var b=new cc.Rect;a.getLocalBB=function(){var a=this._node;b.x=b.y=0;var d=cc.view.getDevicePixelRatio();b.width= a._getWidth()*d;b.height=a._getHeight()*d;return b};a._updateTTF=function(){var a=this._node,b=cc.view.getDevicePixelRatio(),e=a._dimensions.width*b,f,g,h=this._lineWidths;h.length=0;this._isMultiLine=!1;this._measureConfig();var k={};if(0!==e)for(this._strings=a._string.split("\n"),f=0;f<this._strings.length;f++)this._checkWarp(this._strings,f,e);else for(this._strings=a._string.split("\n"),f=0,g=this._strings.length;f<g;f++)if(this._strings[f]){var m=this._measure(this._strings[f]);h.push(m);k[this._strings[f]]= m}else h.push(0);1<this._strings.length&&(this._isMultiLine=!0);g=f=0;a._strokeEnabled&&(f=g=2*a._strokeSize);a._shadowEnabled&&(m=a._shadowOffset,f+=2*Math.abs(m.x),g+=2*Math.abs(m.y));0===e?this._isMultiLine?b=cc.size(Math.ceil(Math.max.apply(Math,h)+f),Math.ceil(this._fontClientHeight*b*this._strings.length+g)):(m=k[a._string],!m&&a._string&&(m=this._measure(a._string)),b=cc.size(Math.ceil((m?m:0)+f),Math.ceil(this._fontClientHeight*b+g))):b=0===a._dimensions.height?this._isMultiLine?cc.size(Math.ceil(e+ f),Math.ceil(a.getLineHeight()*b*this._strings.length+g)):cc.size(Math.ceil(e+f),Math.ceil(a.getLineHeight()*b+g)):cc.size(Math.ceil(e+f),Math.ceil(a._dimensions.height*b+g));"normal"!==a._getFontStyle()&&(b.width=Math.ceil(b.width+0.3*a._fontSize));a.setContentSize(b);a._strokeShadowOffsetX=f;a._strokeShadowOffsetY=g;a=a._anchorPoint;this._anchorPointInPoints.x=0.5*f+(b.width-f)*a.x;this._anchorPointInPoints.y=0.5*g+(b.height-g)*a.y};a._saveStatus=function(){var a=this._node,b=cc.view.getDevicePixelRatio(), e=a._strokeShadowOffsetX,f=a._strokeShadowOffsetY,g=a._contentSize.height-f,h=a._vAlignment,k=a._hAlignment,m=0.5*e,f=g+0.5*f,n=0,p=0,r=[],e=a._contentSize.width-e,a=a.getLineHeight()*b,b=(a-this._fontClientHeight*b)/2,n=k===cc.TEXT_ALIGNMENT_RIGHT?n+e:k===cc.TEXT_ALIGNMENT_CENTER?n+e/2:n+0;if(this._isMultiLine)for(k=this._strings.length,h===cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM?p=a-2*b+g-a*k:h===cc.VERTICAL_TEXT_ALIGNMENT_CENTER&&(p=(a-2*b)/2+(g-a*k)/2),h=0;h<k;h++)r.push(-g+(a*h+b)+p);else h!==cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM&& (p=h===cc.VERTICAL_TEXT_ALIGNMENT_TOP?p-g:p-0.5*g),r.push(p);g={contextTransform:cc.p(m,f),xOffset:n,OffsetYArray:r};this._status.push(g)};a._drawTTFInCanvas=function(a){if(a){var b=this._status.pop();a.setTransform(1,0,0,1,b.contextTransform.x,b.contextTransform.y);this.drawLabels(a,b.xOffset,b.OffsetYArray)}};a._checkWarp=function(a,b,e){var f=a[b],g=this._measure(f);if(g>e&&1<f.length){for(var h=e/g*f.length|0,k=f.substr(h),m=g-this._measure(k),n,p=0,r=0;m>e&&100>r++;)h*=e/m,h|=0,k=f.substr(h), m=g-this._measure(k);for(r=0;m<e&&100>r++;)k&&(p=(n=cc.LabelTTF._wordRex.exec(k))?n[0].length:1,n=k),h+=p,k=f.substr(h),m=g-this._measure(k);h-=p;0===h&&(h=1,n=n.substr(1));e=f.substr(0,h);cc.LabelTTF.wrapInspection&&cc.LabelTTF._symbolRex.test(n||k)&&(g=cc.LabelTTF._lastWordRex.exec(e),h-=g?g[0].length:0,0===h&&(h=1),n=f.substr(h),e=f.substr(0,h));cc.LabelTTF._firsrEnglish.test(n)&&(g=cc.LabelTTF._lastEnglish.exec(e))&&e!==g[0]&&(h-=g[0].length,n=f.substr(h),e=f.substr(0,h));a[b]=n||k;a.splice(b, 0,e)}};a.updateStatus=function(){this._dirtyFlag&cc.Node._dirtyFlags.textDirty&&this._updateTexture();this.originUpdateStatus()};a._syncStatus=function(a){var b=cc.Node._dirtyFlags,e=this._dirtyFlag;e&b.textDirty&&this._updateTexture();this._originSyncStatus(a);(cc._renderType===cc.game.RENDER_TYPE_WEBGL||e&b.transformDirty)&&this.transform(a)};a.drawLabels=function(a,b,e){var f=this._node;if(f._shadowEnabled){var g=f._shadowOffset;a.shadowColor=this._shadowColorStr;a.shadowOffsetX=g.x;a.shadowOffsetY= -g.y;a.shadowBlur=f._shadowBlur}var g=f._hAlignment,h=f._vAlignment,k=f._strokeSize;a.font!==this._fontStyleStr&&(a.font=this._fontStyleStr);a.fillStyle=this._fillColorStr;if(f=f._strokeEnabled)a.lineWidth=2*k,a.strokeStyle=this._strokeColorStr;a.textBaseline=cc.LabelTTF._textBaseline[h];a.textAlign=cc.LabelTTF._textAlign[g];g=this._strings.length;for(h=0;h<g;h++)k=this._strings[h],f&&a.strokeText(k,b,e[h]),a.fillText(k,b,e[h]);cc.g_NumberOfDraws++}})(); (function(){cc.LabelTTF.CacheRenderCmd=function(){this._labelCmdCtor();var a=this._labelCanvas=document.createElement("canvas");a.width=1;a.height=1;this._labelContext=a.getContext("2d")};cc.LabelTTF.CacheRenderCmd.prototype=Object.create(cc.LabelTTF.RenderCmd.prototype);cc.inject(cc.LabelTTF.RenderCmd.prototype,cc.LabelTTF.CacheRenderCmd.prototype);var a=cc.LabelTTF.CacheRenderCmd.prototype;a.constructor=cc.LabelTTF.CacheRenderCmd;a._cacheCmdCtor=cc.LabelTTF.CacheRenderCmd;a._updateTexture=function(){this._dirtyFlag^= this._dirtyFlag&cc.Node._dirtyFlags.textDirty;var a=this._node;a._needUpdateTexture=!1;var c=a._contentSize;this._updateTTF();var d=c.width,e=c.height,f=this._labelContext,g=this._labelCanvas;if(!a._texture){var h=new cc.Texture2D;h.initWithElement(this._labelCanvas);a.setTexture(h)}if(0===a._string.length)return g.width=1,g.height=c.height||1,a._texture&&a._texture.handleLoadedTexture(),a.setTextureRect(cc.rect(0,0,1,c.height)),!0;f.font=this._fontStyleStr;c=g.width===d&&g.height===e;g.width=d;g.height= e;c&&f.clearRect(0,0,d,e);this._saveStatus();this._drawTTFInCanvas(f);a._texture&&a._texture.handleLoadedTexture();a.setTextureRect(cc.rect(0,0,d,e));return!0};a._measureConfig=function(){this._labelContext.font=this._fontStyleStr};a._measure=function(a){return a?this._labelContext.measureText(a).width:0}})(); (function(){cc.LabelTTF.CacheCanvasRenderCmd=function(a){this._spriteCmdCtor(a);this._cacheCmdCtor()};var a=cc.LabelTTF.CacheCanvasRenderCmd.prototype=Object.create(cc.Sprite.CanvasRenderCmd.prototype);cc.inject(cc.LabelTTF.CacheRenderCmd.prototype,a);a.constructor=cc.LabelTTF.CacheCanvasRenderCmd})(); (function(){cc.LabelTTF.CanvasRenderCmd=function(a){this._spriteCmdCtor(a);this._labelCmdCtor()};cc.LabelTTF.CanvasRenderCmd.prototype=Object.create(cc.Sprite.CanvasRenderCmd.prototype);cc.inject(cc.LabelTTF.RenderCmd.prototype,cc.LabelTTF.CanvasRenderCmd.prototype);var a=cc.LabelTTF.CanvasRenderCmd.prototype;a.constructor=cc.LabelTTF.CanvasRenderCmd;a._measureConfig=function(){};a._measure=function(a){if(a){var c=cc._renderContext.getContext();c.font=this._fontStyleStr;return c.measureText(a).width}return 0}; a._updateTexture=function(){this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.textDirty;var a=this._node,c=a._contentSize;this._updateTTF();var d=c.width,e=c.height;if(0===a._string.length)return a.setTextureRect(cc.rect(0,0,1,c.height)),!0;this._saveStatus();a.setTextureRect(cc.rect(0,0,d,e));return!0};a.rendering=function(a){var c=cc.view.getScaleX(),d=cc.view.getScaleY();a=a||cc._renderContext;var e=a.getContext();if(e){var f=this._node;a.computeRealOffsetY();if(!(0>=this._status.length)){var g= this._renderingIndex>=this._status.length?this._renderingIndex-this._status.length:this._renderingIndex,h=this._status[g];this._renderingIndex=g+1;var k=f._offsetPosition.x,g=-f._offsetPosition.y-f._rect.height,m=this._displayedOpacity/255;a.setTransform(this._worldTransform,c,d);a.setCompositeOperation(this._blendFuncStr);a.setGlobalAlpha(m);a.save();f._flippedX&&(k=-k-f._rect.width,e.scale(-1,1));f._flippedY&&(g=f._offsetPosition.y,e.scale(1,-1));c=h.xOffset+h.contextTransform.x+k*c;f=[];k=this._strings.length; for(m=0;m<k;m++)f.push(h.OffsetYArray[m]+h.contextTransform.y+g*d);this.drawLabels(e,c,f);a.restore()}}}})();(function(){cc.LabelTTF.WebGLRenderCmd=function(a){this._spriteCmdCtor(a);this._cacheCmdCtor()};var a=cc.LabelTTF.WebGLRenderCmd.prototype=Object.create(cc.Sprite.WebGLRenderCmd.prototype);cc.inject(cc.LabelTTF.CacheRenderCmd.prototype,a);a.constructor=cc.LabelTTF.WebGLRenderCmd;a._updateColor=function(){}})();cc.HashElement=cc.Class.extend({actions:null,target:null,actionIndex:0,currentAction:null,currentActionSalvaged:!1,paused:!1,ctor:function(){this.actions=[];this.target=null;this.actionIndex=0;this.currentAction=null;this.paused=this.currentActionSalvaged=!1}}); cc.ActionManager=cc.Class.extend({_hashTargets:null,_arrayTargets:null,_currentTarget:null,_currentTargetSalvaged:!1,_elementPool:[],_searchElementByTarget:function(a,b){for(var c=0;c<a.length;c++)if(b===a[c].target)return a[c];return null},ctor:function(){this._hashTargets={};this._arrayTargets=[];this._currentTarget=null;this._currentTargetSalvaged=!1},_getElement:function(a,b){var c=this._elementPool.pop();c||(c=new cc.HashElement);c.target=a;c.paused=!!b;return c},_putElement:function(a){a.actions.length= 0;a.actionIndex=0;a.currentAction=null;a.currentActionSalvaged=!1;a.paused=!1;this._elementPool.push(a)},addAction:function(a,b,c){if(!a)throw Error("cc.ActionManager.addAction(): action must be non-null");if(!b)throw Error("cc.ActionManager.addAction(): action must be non-null");var d=this._hashTargets[b.__instanceId];d?d.actions||(d.actions=[]):(d=this._getElement(b,c),this._hashTargets[b.__instanceId]=d,this._arrayTargets.push(d));d.actions.push(a);a.startWithTarget(b)},removeAllActions:function(){for(var a= this._arrayTargets,b=0;b<a.length;b++){var c=a[b];c&&this.removeAllActionsFromTarget(c.target,!0)}},removeAllActionsFromTarget:function(a,b){if(null!=a){var c=this._hashTargets[a.__instanceId];c&&(-1===c.actions.indexOf(c.currentAction)||c.currentActionSalvaged||(c.currentActionSalvaged=!0),c.actions.length=0,this._currentTarget!==c||b?this._deleteHashElement(c):this._currentTargetSalvaged=!0)}},removeAction:function(a){if(null!=a){var b=a.getOriginalTarget();if(b=this._hashTargets[b.__instanceId])for(var c= 0;c<b.actions.length;c++){if(b.actions[c]===a){b.actions.splice(c,1);break}}else cc.log(cc._LogInfos.ActionManager_removeAction)}},removeActionByTag:function(a,b){a===cc.ACTION_TAG_INVALID&&cc.log(cc._LogInfos.ActionManager_addAction);cc.assert(b,cc._LogInfos.ActionManager_addAction);var c=this._hashTargets[b.__instanceId];if(c)for(var d=c.actions.length,e=0;e<d;++e){var f=c.actions[e];if(f&&f.getTag()===a&&f.getOriginalTarget()===b){this._removeActionAtIndex(e,c);break}}},getActionByTag:function(a, b){a===cc.ACTION_TAG_INVALID&&cc.log(cc._LogInfos.ActionManager_getActionByTag);var c=this._hashTargets[b.__instanceId];if(c){if(null!=c.actions)for(var d=0;d<c.actions.length;++d){var e=c.actions[d];if(e&&e.getTag()===a)return e}cc.log(cc._LogInfos.ActionManager_getActionByTag_2,a)}return null},numberOfRunningActionsInTarget:function(a){return(a=this._hashTargets[a.__instanceId])?a.actions?a.actions.length:0:0},pauseTarget:function(a){(a=this._hashTargets[a.__instanceId])&&(a.paused=!0)},resumeTarget:function(a){(a= this._hashTargets[a.__instanceId])&&(a.paused=!1)},pauseAllRunningActions:function(){for(var a=[],b=this._arrayTargets,c=0;c<b.length;c++){var d=b[c];d&&!d.paused&&(d.paused=!0,a.push(d.target))}return a},resumeTargets:function(a){if(a)for(var b=0;b<a.length;b++)a[b]&&this.resumeTarget(a[b])},purgeSharedManager:function(){cc.director.getScheduler().unscheduleUpdate(this)},_removeActionAtIndex:function(a,b){b.actions[a]!==b.currentAction||b.currentActionSalvaged||(b.currentActionSalvaged=!0);b.actions.splice(a, 1);b.actionIndex>=a&&b.actionIndex--;0===b.actions.length&&(this._currentTarget===b?this._currentTargetSalvaged=!0:this._deleteHashElement(b))},_deleteHashElement:function(a){var b=!1;if(a&&this._hashTargets[a.target.__instanceId]){delete this._hashTargets[a.target.__instanceId];for(var b=this._arrayTargets,c=0,d=b.length;c<d;c++)if(b[c]===a){b.splice(c,1);break}this._putElement(a);b=!0}return b},update:function(a){for(var b=this._arrayTargets,c,d=0;d<b.length;d++){c=this._currentTarget=b[d];if(!c.paused)for(c.actionIndex= 0;c.actionIndex<(c.actions?c.actions.length:0);c.actionIndex++)if(c.currentAction=c.actions[c.actionIndex],c.currentAction){c.currentActionSalvaged=!1;c.currentAction.step(a*(c.currentAction._speedMethod?c.currentAction._speed:1));if(c.currentActionSalvaged)c.currentAction=null;else if(c.currentAction.isDone()){c.currentAction.stop();var e=c.currentAction;c.currentAction=null;this.removeAction(e)}c.currentAction=null}this._currentTargetSalvaged&&0===c.actions.length&&this._deleteHashElement(c)&&d--}}});cc.profiler=function(){var a=!1,b=!1,c=0,d=0,e=0,f=0,g=null,h=document.createElement("div"),k=document.createElement("div"),m=document.createElement("div"),n=document.createElement("div"),p=10,r=[0,10,20,30],s=[0,0,0,0],u=3,t=0,v=0;n.id="fps";n.style.position="absolute";n.style.padding="3px";n.style.textAlign="left";n.style.backgroundColor="rgb(0, 0, 34)";n.style.bottom=cc.DIRECTOR_STATS_POSITION.y+"0px";n.style.left=cc.DIRECTOR_STATS_POSITION.x+"px";n.style.width="45px";n.style.height="80px";for(var w= [m,k,h],x=0;3>x;++x){var B=w[x].style;B.color="rgb(0, 255, 255)";B.font="bold 12px Helvetica, Arial";B.lineHeight="20px";B.width="100%";n.appendChild(w[x])}var y=function(){e=cc.director.getSecondsPerFrame();c++;f+=cc.director.getDeltaTime();if(f>cc.DIRECTOR_FPS_INTERVAL){d=c/f;f=c=0;if(z.onFrameRateChange){var b=d,g=r.length-1,n=g,w=0;t++;for(v+=b;0<=n;n--)if(b>=r[n]){s[n]++;break}if(t>=p){w=v/p;for(n=g;0<n;n--)if(b=s[n]/p,0.6<=b&&w>=r[n]){n!=u&&(u=n,z.onFrameRateChange&&z.onFrameRateChange(w.toFixed(2))); break}v=t=_changeCount=0;for(n=g;0<n;n--)s[n]=0}}a&&(g=cc._renderType===cc.game.RENDER_TYPE_CANVAS?"\n canvas":"\n webgl",k.innerHTML=e.toFixed(3),h.innerHTML=d.toFixed(1).toString()+g,m.innerHTML=(0|cc.g_NumberOfDraws).toString())}},z={onFrameRateChange:null,getSecondsPerFrame:function(){return e},getFrameRate:function(){return d},setProfileDuration:function(a){!isNaN(a)&&0<a&&(p=a/cc.DIRECTOR_FPS_INTERVAL)},resumeProfiling:function(){cc.eventManager.addListener(g,1)},stopProfiling:function(){cc.eventManager.removeListener(g)}, isShowingStats:function(){return a},showStats:function(){b||this.init();null===n.parentElement&&cc.container.appendChild(n);a=!0},hideStats:function(){a=!1;n.parentElement===cc.container&&cc.container.removeChild(n)},init:function(){b||(g=cc.eventManager.addCustomListener(cc.Director.EVENT_AFTER_VISIT,y),b=!0)}};return z}();cc.math=cc.math||{};cc.math.EPSILON=0.015625;cc.math.square=function(a){return a*a};cc.math.almostEqual=function(a,b){return a+cc.math.EPSILON>b&&a-cc.math.EPSILON<b};(function(a){a.math.Vec2=function(a,b){void 0===b?(this.x=a.x,this.y=a.y):(this.x=a||0,this.y=b||0)};var b=a.math.Vec2.prototype;b.fill=function(a,b){this.x=a;this.y=b};b.length=function(){return Math.sqrt(a.math.square(this.x)+a.math.square(this.y))};b.lengthSq=function(){return a.math.square(this.x)+a.math.square(this.y)};b.normalize=function(){var a=1/this.length();this.x*=a;this.y*=a;return this};a.math.Vec2.add=function(a,b,e){a.x=b.x+e.x;a.y=b.y+e.y;return a};b.add=function(a){this.x+=a.x;this.y+= a.y;return this};b.dot=function(a){return this.x*a.x+this.y*a.y};a.math.Vec2.subtract=function(a,b,e){a.x=b.x-e.x;a.y=b.y-e.y;return a};b.subtract=function(a){this.x-=a.x;this.y-=a.y;return this};b.transform=function(a){var b=this.x,e=this.y;this.x=b*a.mat[0]+e*a.mat[3]+a.mat[6];this.y=b*a.mat[1]+e*a.mat[4]+a.mat[7];return this};a.math.Vec2.scale=function(a,b,e){a.x=b.x*e;a.y=b.y*e;return a};b.scale=function(a){this.x*=a;this.y*=a;return this};b.equals=function(b){return this.x<b.x+a.math.EPSILON&& this.x>b.x-a.math.EPSILON&&this.y<b.y+a.math.EPSILON&&this.y>b.y-a.math.EPSILON}})(cc);(function(a){a.math.Vec3=a.kmVec3=function(a,b,e){a&&void 0===b?(this.x=a.x,this.y=a.y,this.z=a.z):(this.x=a||0,this.y=b||0,this.z=e||0)};a.math.vec3=function(b,d,e){return new a.math.Vec3(b,d,e)};var b=a.math.Vec3.prototype;b.fill=function(a,b,e){a&&void 0===b?(this.x=a.x,this.y=a.y,this.z=a.z):(this.x=a,this.y=b,this.z=e);return this};b.length=function(){return Math.sqrt(a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z))};b.lengthSq=function(){return a.math.square(this.x)+a.math.square(this.y)+ a.math.square(this.z)};b.normalize=function(){var a=1/this.length();this.x*=a;this.y*=a;this.z*=a;return this};b.cross=function(a){var b=this.x,e=this.y,f=this.z;this.x=e*a.z-f*a.y;this.y=f*a.x-b*a.z;this.z=b*a.y-e*a.x;return this};b.dot=function(a){return this.x*a.x+this.y*a.y+this.z*a.z};b.add=function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this};b.subtract=function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this};b.transform=function(a){var b=this.x,e=this.y,f=this.z;a=a.mat;this.x=b* a[0]+e*a[4]+f*a[8]+a[12];this.y=b*a[1]+e*a[5]+f*a[9]+a[13];this.z=b*a[2]+e*a[6]+f*a[10]+a[14];return this};b.transformNormal=function(a){var b=this.x,e=this.y,f=this.z;a=a.mat;this.x=b*a[0]+e*a[4]+f*a[8];this.y=b*a[1]+e*a[5]+f*a[9];this.z=b*a[2]+e*a[6]+f*a[10];return this};b.transformCoord=function(b){var d=new a.math.Vec4(this.x,this.y,this.z,1);d.transform(b);this.x=d.x/d.w;this.y=d.y/d.w;this.z=d.z/d.w;return this};b.scale=function(a){this.x*=a;this.y*=a;this.z*=a;return this};b.equals=function(b){var d= a.math.EPSILON;return this.x<b.x+d&&this.x>b.x-d&&this.y<b.y+d&&this.y>b.y-d&&this.z<b.z+d&&this.z>b.z-d};b.inverseTransform=function(b){b=b.mat;var d=new a.math.Vec3(this.x-b[12],this.y-b[13],this.z-b[14]);this.x=d.x*b[0]+d.y*b[1]+d.z*b[2];this.y=d.x*b[4]+d.y*b[5]+d.z*b[6];this.z=d.x*b[8]+d.y*b[9]+d.z*b[10];return this};b.inverseTransformNormal=function(a){var b=this.x,e=this.y,f=this.z;a=a.mat;this.x=b*a[0]+e*a[1]+f*a[2];this.y=b*a[4]+e*a[5]+f*a[6];this.z=b*a[8]+e*a[9]+f*a[10];return this};b.assignFrom= function(a){if(!a)return this;this.x=a.x;this.y=a.y;this.z=a.z;return this};a.math.Vec3.zero=function(a){a.x=a.y=a.z=0;return a};b.toTypeArray=function(){var a=new Float32Array(3);a[0]=this.x;a[1]=this.y;a[2]=this.z;return a}})(cc);(function(a){a.math.Vec4=function(a,b,e,f){a&&void 0===b?(this.x=a.x,this.y=a.y,this.z=a.z,this.w=a.w):(this.x=a||0,this.y=b||0,this.z=e||0,this.w=f||0)};a.kmVec4=a.math.Vec4;var b=a.math.Vec4.prototype;b.fill=function(a,b,e,f){a&&void 0===b?(this.x=a.x,this.y=a.y,this.z=a.z,this.w=a.w):(this.x=a,this.y=b,this.z=e,this.w=f)};b.add=function(a){if(!a)return this;this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this};b.dot=function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w};b.length= function(){return Math.sqrt(a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z)+a.math.square(this.w))};b.lengthSq=function(){return a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z)+a.math.square(this.w)};b.lerp=function(a,b){return this};b.normalize=function(){var a=1/this.length();this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this};b.scale=function(a){this.normalize();this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this};b.subtract=function(a){this.x-=a.x;this.y-= a.y;this.z-=a.z;this.w-=a.w};b.transform=function(a){var b=this.x,e=this.y,f=this.z,g=this.w;a=a.mat;this.x=b*a[0]+e*a[4]+f*a[8]+g*a[12];this.y=b*a[1]+e*a[5]+f*a[9]+g*a[13];this.z=b*a[2]+e*a[6]+f*a[10]+g*a[14];this.w=b*a[3]+e*a[7]+f*a[11]+g*a[15];return this};a.math.Vec4.transformArray=function(b,d){for(var e=[],f=0;f<b.length;f++){var g=new a.math.Vec4(b[f]);g.transform(d);e.push(g)}return e};b.equals=function(b){var d=a.math.EPSILON;return this.x<b.x+d&&this.x>b.x-d&&this.y<b.y+d&&this.y>b.y-d&& this.z<b.z+d&&this.z>b.z-d&&this.w<b.w+d&&this.w>b.w-d};b.assignFrom=function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this};b.toTypeArray=function(){var a=new Float32Array(4);a[0]=this.x;a[1]=this.y;a[2]=this.z;a[3]=this.w;return a}})(cc);(function(a){function b(b,d,e){d=new a.math.Vec2(d);d.subtract(b);e.x=-d.y;e.y=d.x;e.normalize()}a.math.Ray2=function(b,d){this.start=b||new a.math.Vec2;this.dir=d||new a.math.Vec2};a.math.Ray2.prototype.fill=function(a,b,e,f){this.start.x=a;this.start.y=b;this.dir.x=e;this.dir.y=f};a.math.Ray2.prototype.intersectLineSegment=function(b,d,e){var f=this.start.x,g=this.start.y,h=this.start.x+this.dir.x,k=this.start.y+this.dir.y,m=b.x,n=b.y,p=d.x,r=d.y,s=(r-n)*(h-f)-(p-m)*(k-g);if(s>-a.math.EPSILON&& s<a.math.EPSILON)return!1;n=((p-m)*(g-n)-(r-n)*(f-m))/s;m=f+n*(h-f);n=g+n*(k-g);if(m<Math.min(b.x,d.x)-a.math.EPSILON||m>Math.max(b.x,d.x)+a.math.EPSILON||n<Math.min(b.y,d.y)-a.math.EPSILON||n>Math.max(b.y,d.y)+a.math.EPSILON||m<Math.min(f,h)-a.math.EPSILON||m>Math.max(f,h)+a.math.EPSILON||n<Math.min(g,k)-a.math.EPSILON||n>Math.max(g,k)+a.math.EPSILON)return!1;e.x=m;e.y=n;return!0};a.math.Ray2.prototype.intersectTriangle=function(c,d,e,f,g){var h=new a.math.Vec2,k=new a.math.Vec2,m=new a.math.Vec2, n=1E4,p=!1,r;this.intersectLineSegment(c,d,h)&&(p=!0,r=h.subtract(this.start).length(),r<n&&(k.x=h.x,k.y=h.y,n=r,b(c,d,m)));this.intersectLineSegment(d,e,h)&&(p=!0,r=h.subtract(this.start).length(),r<n&&(k.x=h.x,k.y=h.y,n=r,b(d,e,m)));this.intersectLineSegment(e,c,h)&&(p=!0,r=h.subtract(this.start).length(),r<n&&(k.x=h.x,k.y=h.y,b(e,c,m)));p&&(f.x=k.x,f.y=k.y,g&&(g.x=m.x,g.y=m.y));return p}})(cc);window.Uint16Array=window.Uint16Array||window.Array;window.Float32Array=window.Float32Array||window.Array; (function(a){a.math.Matrix3=function(a){this.mat=a&&a.mat?new Float32Array(a.mat):new Float32Array(9)};a.kmMat3=a.math.Matrix3;var b=a.math.Matrix3.prototype;b.fill=function(a){var b=this.mat;a=a.mat;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return this};b.adjugate=function(){var a=this.mat,b=a[0],c=a[1],g=a[2],h=a[3],k=a[4],m=a[5],n=a[6],p=a[7],r=a[8];a[0]=k*r-m*p;a[1]=g*p-c*r;a[2]=c*m-g*k;a[3]=m*n-h*r;a[4]=b*r-g*n;a[5]=g*h-b*m;a[6]=h*p-k*n;a[8]=b* k-c*h;return this};b.identity=function(){var a=this.mat;a[1]=a[2]=a[3]=a[5]=a[6]=a[7]=0;a[0]=a[4]=a[8]=1;return this};var c=new a.math.Matrix3;b.inverse=function(a){if(0===a)return this;c.assignFrom(this);a=1/a;this.adjugate();this.multiplyScalar(a);return this};b.isIdentity=function(){var a=this.mat;return 1===a[0]&&0===a[1]&&0===a[2]&&0===a[3]&&1===a[4]&&0===a[5]&&0===a[6]&&0===a[7]&&1===a[8]};b.transpose=function(){var a=this.mat,b=a[1],c=a[2],g=a[5],h=a[6],k=a[7];a[1]=a[3];a[2]=h;a[3]=b;a[5]= k;a[6]=c;a[7]=g;return this};b.determinant=function(){var a=this.mat,b=a[0]*a[4]*a[8]+a[1]*a[5]*a[6]+a[2]*a[3]*a[7];return b-=a[2]*a[4]*a[6]+a[0]*a[5]*a[7]+a[1]*a[3]*a[8]};b.multiply=function(a){var b=this.mat,c=a.mat;a=b[0];var g=b[1],h=b[2],k=b[3],m=b[4],n=b[5],p=b[6],r=b[7],s=b[8],u=c[0],t=c[1],v=c[2],w=c[3],x=c[4],B=c[5],y=c[6],z=c[7],c=c[8];b[0]=a*u+k*t+p*v;b[1]=g*u+m*t+r*v;b[2]=h*u+n*t+s*v;b[3]=h*u+n*t+s*v;b[4]=g*w+m*x+r*B;b[5]=h*w+n*x+s*B;b[6]=a*y+k*z+p*c;b[7]=g*y+m*z+r*c;b[8]=h*y+n*z+s*c; return this};b.multiplyScalar=function(a){var b=this.mat;b[0]*=a;b[1]*=a;b[2]*=a;b[3]*=a;b[4]*=a;b[5]*=a;b[6]*=a;b[7]*=a;b[8]*=a;return this};a.math.Matrix3.rotationAxisAngle=function(b,c){var f=Math.cos(c),g=Math.sin(c),h=new a.math.Matrix3,k=h.mat;k[0]=f+b.x*b.x*(1-f);k[1]=b.z*g+b.y*b.x*(1-f);k[2]=-b.y*g+b.z*b.x*(1-f);k[3]=-b.z*g+b.x*b.y*(1-f);k[4]=f+b.y*b.y*(1-f);k[5]=b.x*g+b.z*b.y*(1-f);k[6]=b.y*g+b.x*b.z*(1-f);k[7]=-b.x*g+b.y*b.z*(1-f);k[8]=f+b.z*b.z*(1-f);return h};b.assignFrom=function(b){if(this=== b)return a.log("cc.math.Matrix3.assign(): current matrix equals matIn"),this;var c=this.mat;b=b.mat;c[0]=b[0];c[1]=b[1];c[2]=b[2];c[3]=b[3];c[4]=b[4];c[5]=b[5];c[6]=b[6];c[7]=b[7];c[8]=b[8];return this};b.equals=function(b){if(this===b)return!0;var c=a.math.EPSILON,f=this.mat;b=b.mat;for(var g=0;9>g;++g)if(!(f[g]+c>b[g]&&f[g]-c<b[g]))return!1;return!0};a.math.Matrix3.createByRotationX=function(b){var c=new a.math.Matrix3,f=c.mat;f[0]=1;f[1]=0;f[2]=0;f[3]=0;f[4]=Math.cos(b);f[5]=Math.sin(b);f[6]=0; f[7]=-Math.sin(b);f[8]=Math.cos(b);return c};a.math.Matrix3.createByRotationY=function(b){var c=new a.math.Matrix3,f=c.mat;f[0]=Math.cos(b);f[1]=0;f[2]=-Math.sin(b);f[3]=0;f[4]=1;f[5]=0;f[6]=Math.sin(b);f[7]=0;f[8]=Math.cos(b);return c};a.math.Matrix3.createByRotationZ=function(b){var c=new a.math.Matrix3,f=c.mat;f[0]=Math.cos(b);f[1]=-Math.sin(b);f[2]=0;f[3]=Math.sin(b);f[4]=Math.cos(b);f[5]=0;f[6]=0;f[7]=0;f[8]=1;return c};a.math.Matrix3.createByRotation=function(b){var c=new a.math.Matrix3,f=c.mat; f[0]=Math.cos(b);f[1]=Math.sin(b);f[2]=0;f[3]=-Math.sin(b);f[4]=Math.cos(b);f[5]=0;f[6]=0;f[7]=0;f[8]=1;return c};a.math.Matrix3.createByScale=function(b,c){var f=new a.math.Matrix3;f.identity();f.mat[0]=b;f.mat[4]=c;return f};a.math.Matrix3.createByTranslation=function(b,c){var f=new a.math.Matrix3;f.identity();f.mat[6]=b;f.mat[7]=c;return f};a.math.Matrix3.createByQuaternion=function(b){if(!b)return null;var c=new a.math.Matrix3,f=c.mat;f[0]=1-2*(b.y*b.y+b.z*b.z);f[1]=2*(b.x*b.y-b.w*b.z);f[2]=2* (b.x*b.z+b.w*b.y);f[3]=2*(b.x*b.y+b.w*b.z);f[4]=1-2*(b.x*b.x+b.z*b.z);f[5]=2*(b.y*b.z-b.w*b.x);f[6]=2*(b.x*b.z-b.w*b.y);f[7]=2*(b.y*b.z+b.w*b.x);f[8]=1-2*(b.x*b.x+b.y*b.y);return c};b.rotationToAxisAngle=function(){return a.math.Quaternion.rotationMatrix(this).toAxisAndAngle()}})(cc);(function(a){a.math.Matrix4=function(a){this.mat=a&&a.mat?new Float32Array(a.mat):new Float32Array(16)};a.kmMat4=a.math.Matrix4;var b=a.math.Matrix4.prototype;b.fill=function(a){for(var b=this.mat,c=0;16>c;c++)b[c]=a[c];return this};a.kmMat4Identity=function(a){var b=a.mat;b[1]=b[2]=b[3]=b[4]=b[6]=b[7]=b[8]=b[9]=b[11]=b[12]=b[13]=b[14]=0;b[0]=b[5]=b[10]=b[15]=1;return a};b.identity=function(){var a=this.mat;a[1]=a[2]=a[3]=a[4]=a[6]=a[7]=a[8]=a[9]=a[11]=a[12]=a[13]=a[14]=0;a[0]=a[5]=a[10]=a[15]=1; return this};b.get=function(a,b){return this.mat[a+4*b]};b.set=function(a,b,c){this.mat[a+4*b]=c};b.swap=function(a,b,c,d){var k=this.mat,m=k[a+4*b];k[a+4*b]=k[c+4*d];k[c+4*d]=m};a.math.Matrix4._gaussj=function(a,b){var c,d=0,k=0,m,n,p,r,s=[0,0,0,0],u=[0,0,0,0],t=[0,0,0,0];for(c=0;4>c;c++){for(m=r=0;4>m;m++)if(1!==t[m])for(n=0;4>n;n++)0===t[n]&&(p=Math.abs(a.get(m,n)),p>=r&&(r=p,k=m,d=n));++t[d];if(k!==d){for(m=0;4>m;m++)a.swap(k,m,d,m);for(m=0;4>m;m++)b.swap(k,m,d,m)}u[c]=k;s[c]=d;if(0===a.get(d, d))return!1;n=1/a.get(d,d);a.set(d,d,1);for(m=0;4>m;m++)a.set(d,m,a.get(d,m)*n);for(m=0;4>m;m++)b.set(d,m,b.get(d,m)*n);for(n=0;4>n;n++)if(n!==d){p=a.get(n,d);a.set(n,d,0);for(m=0;4>m;m++)a.set(n,m,a.get(n,m)-a.get(d,m)*p);for(m=0;4>m;m++)b.set(n,m,a.get(n,m)-b.get(d,m)*p)}}for(m=3;0<=m;m--)if(u[m]!==s[m])for(n=0;4>n;n++)a.swap(n,u[m],n,s[m]);return!0};var c=(new a.math.Matrix4).identity();a.kmMat4Inverse=function(b,d){var g=new a.math.Matrix4(d),h=new a.math.Matrix4(c);if(!1===a.math.Matrix4._gaussj(g, h))return null;b.assignFrom(g);return b};b.inverse=function(){var b=new a.math.Matrix4(this),d=new a.math.Matrix4(c);return!1===a.math.Matrix4._gaussj(b,d)?null:b};b.isIdentity=function(){var a=this.mat;return 1===a[0]&&0===a[1]&&0===a[2]&&0===a[3]&&0===a[4]&&1===a[5]&&0===a[6]&&0===a[7]&&0===a[8]&&0===a[9]&&1===a[10]&&0===a[11]&&0===a[12]&&0===a[13]&&0===a[14]&&1===a[15]};b.transpose=function(){var a=this.mat,b=a[1],c=a[2],d=a[3],k=a[6],m=a[7],n=a[8],p=a[9],r=a[11],s=a[12],u=a[13],t=a[14];a[1]=a[4]; a[2]=n;a[3]=s;a[4]=b;a[6]=p;a[7]=u;a[8]=c;a[9]=k;a[11]=t;a[12]=d;a[13]=m;a[14]=r;return this};a.kmMat4Multiply=function(a,b,c){var d=a.mat,k=b.mat,m=c.mat;c=k[0];b=k[1];var n=k[2],p=k[3],r=k[4],s=k[5],u=k[6],t=k[7],v=k[8],w=k[9],x=k[10],B=k[11],y=k[12],z=k[13],C=k[14],k=k[15],A=m[0],D=m[1],F=m[2],M=m[3],E=m[4],N=m[5],Q=m[6],H=m[7],R=m[8],K=m[9],I=m[10],P=m[11],T=m[12],S=m[13],O=m[14],m=m[15];d[0]=A*c+D*r+F*v+M*y;d[1]=A*b+D*s+F*w+M*z;d[2]=A*n+D*u+F*x+M*C;d[3]=A*p+D*t+F*B+M*k;d[4]=E*c+N*r+Q*v+H*y;d[5]= E*b+N*s+Q*w+H*z;d[6]=E*n+N*u+Q*x+H*C;d[7]=E*p+N*t+Q*B+H*k;d[8]=R*c+K*r+I*v+P*y;d[9]=R*b+K*s+I*w+P*z;d[10]=R*n+K*u+I*x+P*C;d[11]=R*p+K*t+I*B+P*k;d[12]=T*c+S*r+O*v+m*y;d[13]=T*b+S*s+O*w+m*z;d[14]=T*n+S*u+O*x+m*C;d[15]=T*p+S*t+O*B+m*k;return a};b.multiply=function(a){var b=this.mat,c=a.mat;a=b[0];var d=b[1],k=b[2],m=b[3],n=b[4],p=b[5],r=b[6],s=b[7],u=b[8],t=b[9],v=b[10],w=b[11],x=b[12],B=b[13],y=b[14],z=b[15],C=c[0],A=c[1],D=c[2],F=c[3],M=c[4],E=c[5],N=c[6],Q=c[7],H=c[8],R=c[9],K=c[10],I=c[11],P=c[12], T=c[13],S=c[14],c=c[15];b[0]=C*a+A*n+D*u+F*x;b[1]=C*d+A*p+D*t+F*B;b[2]=C*k+A*r+D*v+F*y;b[3]=C*m+A*s+D*w+F*z;b[4]=M*a+E*n+N*u+Q*x;b[5]=M*d+E*p+N*t+Q*B;b[6]=M*k+E*r+N*v+Q*y;b[7]=M*m+E*s+N*w+Q*z;b[8]=H*a+R*n+K*u+I*x;b[9]=H*d+R*p+K*t+I*B;b[10]=H*k+R*r+K*v+I*y;b[11]=H*m+R*s+K*w+I*z;b[12]=P*a+T*n+S*u+c*x;b[13]=P*d+T*p+S*t+c*B;b[14]=P*k+T*r+S*v+c*y;b[15]=P*m+T*s+S*w+c*z;return this};a.getMat4MultiplyValue=function(a,b){var c=a.mat,d=b.mat,k=new Float32Array(16);k[0]=c[0]*d[0]+c[4]*d[1]+c[8]*d[2]+c[12]*d[3]; k[1]=c[1]*d[0]+c[5]*d[1]+c[9]*d[2]+c[13]*d[3];k[2]=c[2]*d[0]+c[6]*d[1]+c[10]*d[2]+c[14]*d[3];k[3]=c[3]*d[0]+c[7]*d[1]+c[11]*d[2]+c[15]*d[3];k[4]=c[0]*d[4]+c[4]*d[5]+c[8]*d[6]+c[12]*d[7];k[5]=c[1]*d[4]+c[5]*d[5]+c[9]*d[6]+c[13]*d[7];k[6]=c[2]*d[4]+c[6]*d[5]+c[10]*d[6]+c[14]*d[7];k[7]=c[3]*d[4]+c[7]*d[5]+c[11]*d[6]+c[15]*d[7];k[8]=c[0]*d[8]+c[4]*d[9]+c[8]*d[10]+c[12]*d[11];k[9]=c[1]*d[8]+c[5]*d[9]+c[9]*d[10]+c[13]*d[11];k[10]=c[2]*d[8]+c[6]*d[9]+c[10]*d[10]+c[14]*d[11];k[11]=c[3]*d[8]+c[7]*d[9]+c[11]* d[10]+c[15]*d[11];k[12]=c[0]*d[12]+c[4]*d[13]+c[8]*d[14]+c[12]*d[15];k[13]=c[1]*d[12]+c[5]*d[13]+c[9]*d[14]+c[13]*d[15];k[14]=c[2]*d[12]+c[6]*d[13]+c[10]*d[14]+c[14]*d[15];k[15]=c[3]*d[12]+c[7]*d[13]+c[11]*d[14]+c[15]*d[15];return k};a.kmMat4Assign=function(b,c){if(b===c)return a.log("cc.kmMat4Assign(): pOut equals pIn"),b;var d=b.mat,h=c.mat;d[0]=h[0];d[1]=h[1];d[2]=h[2];d[3]=h[3];d[4]=h[4];d[5]=h[5];d[6]=h[6];d[7]=h[7];d[8]=h[8];d[9]=h[9];d[10]=h[10];d[11]=h[11];d[12]=h[12];d[13]=h[13];d[14]=h[14]; d[15]=h[15];return b};b.assignFrom=function(b){if(this===b)return a.log("cc.mat.Matrix4.assignFrom(): mat4 equals current matrix"),this;var c=this.mat;b=b.mat;c[0]=b[0];c[1]=b[1];c[2]=b[2];c[3]=b[3];c[4]=b[4];c[5]=b[5];c[6]=b[6];c[7]=b[7];c[8]=b[8];c[9]=b[9];c[10]=b[10];c[11]=b[11];c[12]=b[12];c[13]=b[13];c[14]=b[14];c[15]=b[15];return this};b.equals=function(b){if(this===b)return a.log("cc.kmMat4AreEqual(): pMat1 and pMat2 are same object."),!0;var c=this.mat;b=b.mat;for(var d=a.math.EPSILON,h=0;16> h;h++)if(!(c[h]+d>b[h]&&c[h]-d<b[h]))return!1;return!0};a.math.Matrix4.createByRotationX=function(b,c){c=c||new a.math.Matrix4;var d=c.mat;d[0]=1;d[3]=d[2]=d[1]=0;d[4]=0;d[5]=Math.cos(b);d[6]=Math.sin(b);d[7]=0;d[8]=0;d[9]=-Math.sin(b);d[10]=Math.cos(b);d[11]=0;d[14]=d[13]=d[12]=0;d[15]=1;return c};a.math.Matrix4.createByRotationY=function(b,c){c=c||new a.math.Matrix4;var d=c.mat;d[0]=Math.cos(b);d[1]=0;d[2]=-Math.sin(b);d[3]=0;d[7]=d[6]=d[4]=0;d[5]=1;d[8]=Math.sin(b);d[9]=0;d[10]=Math.cos(b);d[11]= 0;d[14]=d[13]=d[12]=0;d[15]=1;return c};a.math.Matrix4.createByRotationZ=function(b,c){c=c||new a.math.Matrix4;var d=c.mat;d[0]=Math.cos(b);d[1]=Math.sin(b);d[3]=d[2]=0;d[4]=-Math.sin(b);d[5]=Math.cos(b);d[7]=d[6]=0;d[11]=d[9]=d[8]=0;d[10]=1;d[14]=d[13]=d[12]=0;d[15]=1;return c};a.math.Matrix4.createByPitchYawRoll=function(b,c,d,h){h=h||new a.math.Matrix4;var k=Math.cos(b);b=Math.sin(b);var m=Math.cos(c);c=Math.sin(c);var n=Math.cos(d);d=Math.sin(d);var p=b*c,r=k*c,s=h.mat;s[0]=m*n;s[4]=m*d;s[8]= -c;s[1]=p*n-k*d;s[5]=p*d+k*n;s[9]=b*m;s[2]=r*n+b*d;s[6]=r*d-b*n;s[10]=k*m;s[3]=s[7]=s[11]=0;s[15]=1;return h};a.math.Matrix4.createByQuaternion=function(b,c){c=c||new a.math.Matrix4;var d=c.mat;d[0]=1-2*(b.y*b.y+b.z*b.z);d[1]=2*(b.x*b.y+b.z*b.w);d[2]=2*(b.x*b.z-b.y*b.w);d[3]=0;d[4]=2*(b.x*b.y-b.z*b.w);d[5]=1-2*(b.x*b.x+b.z*b.z);d[6]=2*(b.z*b.y+b.x*b.w);d[7]=0;d[8]=2*(b.x*b.z+b.y*b.w);d[9]=2*(b.y*b.z-b.x*b.w);d[10]=1-2*(b.x*b.x+b.y*b.y);d[11]=0;d[14]=d[13]=d[12]=0;d[15]=1;return c};a.math.Matrix4.createByRotationTranslation= function(b,c,d){d=d||new a.math.Matrix4;var h=d.mat;b=b.mat;h[0]=b[0];h[1]=b[1];h[2]=b[2];h[3]=0;h[4]=b[3];h[5]=b[4];h[6]=b[5];h[7]=0;h[8]=b[6];h[9]=b[7];h[10]=b[8];h[11]=0;h[12]=c.x;h[13]=c.y;h[14]=c.z;h[15]=1;return d};a.math.Matrix4.createByScale=function(b,c,d,h){h=h||new a.math.Matrix4;var k=h.mat;k[0]=b;k[5]=c;k[10]=d;k[15]=1;k[1]=k[2]=k[3]=k[4]=k[6]=k[7]=k[8]=k[9]=k[11]=k[12]=k[13]=k[14]=0;return h};a.kmMat4Translation=function(a,b,c,d){a.mat[0]=a.mat[5]=a.mat[10]=a.mat[15]=1;a.mat[1]=a.mat[2]= a.mat[3]=a.mat[4]=a.mat[6]=a.mat[7]=a.mat[8]=a.mat[9]=a.mat[11]=0;a.mat[12]=b;a.mat[13]=c;a.mat[14]=d;return a};a.math.Matrix4.createByTranslation=function(b,c,d,h){h=h||new a.math.Matrix4;h.identity();h.mat[12]=b;h.mat[13]=c;h.mat[14]=d;return h};b.getUpVec3=function(){var b=this.mat;return(new a.math.Vec3(b[4],b[5],b[6])).normalize()};b.getRightVec3=function(){var b=this.mat;return(new a.math.Vec3(b[0],b[1],b[2])).normalize()};b.getForwardVec3=function(){var b=this.mat;return(new a.math.Vec3(b[8], b[9],b[10])).normalize()};a.kmMat4PerspectiveProjection=function(b,c,d,h,k){var m=a.degreesToRadians(c/2);c=k-h;var n=Math.sin(m);if(0===c||0===n||0===d)return null;m=Math.cos(m)/n;b.identity();b.mat[0]=m/d;b.mat[5]=m;b.mat[10]=-(k+h)/c;b.mat[11]=-1;b.mat[14]=-2*h*k/c;b.mat[15]=0;return b};a.math.Matrix4.createPerspectiveProjection=function(b,c,d,h){var k=a.degreesToRadians(b/2);b=h-d;var m=Math.sin(k);if(0===b||0===m||0===c)return null;var k=Math.cos(k)/m,m=new a.math.Matrix4,n=m.mat;m.identity(); n[0]=k/c;n[5]=k;n[10]=-(h+d)/b;n[11]=-1;n[14]=-2*d*h/b;n[15]=0;return m};a.kmMat4OrthographicProjection=function(a,b,c,d,k,m,n){a.identity();a.mat[0]=2/(c-b);a.mat[5]=2/(k-d);a.mat[10]=-2/(n-m);a.mat[12]=-((c+b)/(c-b));a.mat[13]=-((k+d)/(k-d));a.mat[14]=-((n+m)/(n-m));return a};a.math.Matrix4.createOrthographicProjection=function(b,c,d,h,k,m){var n=new a.math.Matrix4,p=n.mat;n.identity();p[0]=2/(c-b);p[5]=2/(h-d);p[10]=-2/(m-k);p[12]=-((c+b)/(c-b));p[13]=-((h+d)/(h-d));p[14]=-((m+k)/(m-k));return n}; a.kmMat4LookAt=function(b,c,d,h){d=new a.math.Vec3(d);var k=new a.math.Vec3(h);d.subtract(c);d.normalize();k.normalize();h=new a.math.Vec3(d);h.cross(k);h.normalize();k=new a.math.Vec3(h);k.cross(d);h.normalize();b.identity();b.mat[0]=h.x;b.mat[4]=h.y;b.mat[8]=h.z;b.mat[1]=k.x;b.mat[5]=k.y;b.mat[9]=k.z;b.mat[2]=-d.x;b.mat[6]=-d.y;b.mat[10]=-d.z;c=a.math.Matrix4.createByTranslation(-c.x,-c.y,-c.z);b.multiply(c);return b};var d=new a.math.Matrix4;b.lookAt=function(b,c,g){c=new a.math.Vec3(c);var h= new a.math.Vec3(g);g=this.mat;c.subtract(b);c.normalize();h.normalize();var k=new a.math.Vec3(c);k.cross(h);k.normalize();h=new a.math.Vec3(k);h.cross(c);k.normalize();this.identity();g[0]=k.x;g[4]=k.y;g[8]=k.z;g[1]=h.x;g[5]=h.y;g[9]=h.z;g[2]=-c.x;g[6]=-c.y;g[10]=-c.z;d=a.math.Matrix4.createByTranslation(-b.x,-b.y,-b.z,d);this.multiply(d);return this};a.kmMat4RotationAxisAngle=function(b,c,d){var h=Math.cos(d);d=Math.sin(d);c=new a.math.Vec3(c);c.normalize();b.mat[0]=h+c.x*c.x*(1-h);b.mat[1]=c.z* d+c.y*c.x*(1-h);b.mat[2]=-c.y*d+c.z*c.x*(1-h);b.mat[3]=0;b.mat[4]=-c.z*d+c.x*c.y*(1-h);b.mat[5]=h+c.y*c.y*(1-h);b.mat[6]=c.x*d+c.z*c.y*(1-h);b.mat[7]=0;b.mat[8]=c.y*d+c.x*c.z*(1-h);b.mat[9]=-c.x*d+c.y*c.z*(1-h);b.mat[10]=h+c.z*c.z*(1-h);b.mat[11]=0;b.mat[12]=0;b.mat[13]=0;b.mat[14]=0;b.mat[15]=1;return b};a.math.Matrix4.createByAxisAndAngle=function(b,c,d){d=d||new a.math.Matrix4;var h=this.mat,k=Math.cos(c);c=Math.sin(c);b=new a.math.Vec3(b);b.normalize();h[0]=k+b.x*b.x*(1-k);h[1]=b.z*c+b.y*b.x* (1-k);h[2]=-b.y*c+b.z*b.x*(1-k);h[3]=0;h[4]=-b.z*c+b.x*b.y*(1-k);h[5]=k+b.y*b.y*(1-k);h[6]=b.x*c+b.z*b.y*(1-k);h[7]=0;h[8]=b.y*c+b.x*b.z*(1-k);h[9]=-b.x*c+b.y*b.z*(1-k);h[10]=k+b.z*b.z*(1-k);h[11]=0;h[12]=h[13]=h[14]=0;h[15]=1;return d};b.extractRotation=function(){var b=new a.math.Matrix3,c=this.mat,d=b.mat;d[0]=c[0];d[1]=c[1];d[2]=c[2];d[3]=c[4];d[4]=c[5];d[5]=c[6];d[6]=c[8];d[7]=c[9];d[8]=c[10];return b};b.extractPlane=function(b){var c=new a.math.Plane,d=this.mat;switch(b){case a.math.Plane.RIGHT:c.a= d[3]-d[0];c.b=d[7]-d[4];c.c=d[11]-d[8];c.d=d[15]-d[12];break;case a.math.Plane.LEFT:c.a=d[3]+d[0];c.b=d[7]+d[4];c.c=d[11]+d[8];c.d=d[15]+d[12];break;case a.math.Plane.BOTTOM:c.a=d[3]+d[1];c.b=d[7]+d[5];c.c=d[11]+d[9];c.d=d[15]+d[13];break;case a.math.Plane.TOP:c.a=d[3]-d[1];c.b=d[7]-d[5];c.c=d[11]-d[9];c.d=d[15]-d[13];break;case a.math.Plane.FAR:c.a=d[3]-d[2];c.b=d[7]-d[6];c.c=d[11]-d[10];c.d=d[15]-d[14];break;case a.math.Plane.NEAR:c.a=d[3]+d[2];c.b=d[7]+d[6];c.c=d[11]+d[10];c.d=d[15]+d[14];break; default:a.log("cc.math.Matrix4.extractPlane: Invalid plane index")}b=Math.sqrt(c.a*c.a+c.b*c.b+c.c*c.c);c.a/=b;c.b/=b;c.c/=b;c.d/=b;return c};b.toAxisAndAngle=function(){var b=this.extractRotation();return a.math.Quaternion.rotationMatrix(b).toAxisAndAngle()}})(cc);(function(a){a.math.Plane=function(a,b,e,f){a&&void 0===b?(this.a=a.a,this.b=a.b,this.c=a.c,this.d=a.d):(this.a=a||0,this.b=b||0,this.c=e||0,this.d=f||0)};a.kmPlane=a.math.Plane;var b=a.math.Plane.prototype;a.math.Plane.LEFT=0;a.math.Plane.RIGHT=1;a.math.Plane.BOTTOM=2;a.math.Plane.TOP=3;a.math.Plane.NEAR=4;a.math.Plane.FAR=5;a.math.Plane.POINT_INFRONT_OF_PLANE=0;a.math.Plane.POINT_BEHIND_PLANE=1;a.math.Plane.POINT_ON_PLANE=2;b.dot=function(a){return this.a*a.x+this.b*a.y+this.c*a.z+this.d*a.w};b.dotCoord= function(a){return this.a*a.x+this.b*a.y+this.c*a.z+this.d};b.dotNormal=function(a){return this.a*a.x+this.b*a.y+this.c*a.z};a.math.Plane.fromPointNormal=function(b,d){return new a.math.Plane(d.x,d.y,d.z,-d.dot(b))};a.math.Plane.fromPoints=function(b,d,e){d=new a.math.Vec3(d);e=new a.math.Vec3(e);var f=new a.math.Plane;d.subtract(b);e.subtract(b);d.cross(e);d.normalize();f.a=d.x;f.b=d.y;f.c=d.z;f.d=d.scale(-1).dot(b);return f};b.normalize=function(){var b=new a.math.Vec3(this.a,this.b,this.c),d=1/ b.length();b.normalize();this.a=b.x;this.b=b.y;this.c=b.z;this.d*=d;return this};b.classifyPoint=function(b){b=this.a*b.x+this.b*b.y+this.c*b.z+this.d;return 0.001<b?a.math.Plane.POINT_INFRONT_OF_PLANE:-0.001>b?a.math.Plane.POINT_BEHIND_PLANE:a.math.Plane.POINT_ON_PLANE}})(cc);(function(a){a.math.Quaternion=function(a,b,e,f){a&&void 0===b?(this.x=a.x,this.y=a.y,this.z=a.z,this.w=a.w):(this.x=a||0,this.y=b||0,this.z=e||0,this.w=f||0)};a.kmQuaternion=a.math.Quaternion;var b=a.math.Quaternion.prototype;b.conjugate=function(a){this.x=-a.x;this.y=-a.y;this.z=-a.z;this.w=a.w;return this};b.dot=function(a){return this.w*a.w+this.x*a.x+this.y*a.y+this.z*a.z};b.exponential=function(){return this};b.identity=function(){this.z=this.y=this.x=0;this.w=1;return this};b.inverse=function(){var b= this.length();if(Math.abs(b)>a.math.EPSILON)return this.w=this.z=this.y=this.x=0,this;this.conjugate(this).scale(1/b);return this};b.isIdentity=function(){return 0===this.x&&0===this.y&&0===this.z&&1===this.w};b.length=function(){return Math.sqrt(this.lengthSq())};b.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w};b.multiply=function(a){var b=this.x,e=this.y,f=this.z,g=this.w;this.w=g*a.w-b*a.x-e*a.y-f*a.z;this.x=g*a.x+b*a.w+e*a.z-f*a.y;this.y=g*a.y+e*a.w+f*a.x- b*a.z;this.z=g*a.z+f*a.w+b*a.y-e*a.x;return this};b.normalize=function(){var b=this.length();if(Math.abs(b)<=a.math.EPSILON)throw Error("current quaternion is an invalid value");this.scale(1/b);return this};b.rotationAxis=function(a,b){var e=0.5*b,f=Math.sin(e);this.w=Math.cos(e);this.x=a.x*f;this.y=a.y*f;this.z=a.z*f;return this};a.math.Quaternion.rotationMatrix=function(b){if(!b)return null;var d,e,f;d=[];e=b.mat;b=0;d[0]=e[0];d[1]=e[3];d[2]=e[6];d[4]=e[1];d[5]=e[4];d[6]=e[7];d[8]=e[2];d[9]=e[5]; d[10]=e[8];d[15]=1;var g=d[0];b=g[0]+g[5]+g[10]+1;b>a.math.EPSILON?(b=2*Math.sqrt(b),d=(g[9]-g[6])/b,e=(g[2]-g[8])/b,f=(g[4]-g[1])/b,b*=0.25):g[0]>g[5]&&g[0]>g[10]?(b=2*Math.sqrt(1+g[0]-g[5]-g[10]),d=0.25*b,e=(g[4]+g[1])/b,f=(g[2]+g[8])/b,b=(g[9]-g[6])/b):g[5]>g[10]?(b=2*Math.sqrt(1+g[5]-g[0]-g[10]),d=(g[4]+g[1])/b,e=0.25*b,f=(g[9]+g[6])/b,b=(g[2]-g[8])/b):(b=2*Math.sqrt(1+g[10]-g[0]-g[5]),d=(g[2]+g[8])/b,e=(g[9]+g[6])/b,f=0.25*b,b=(g[4]-g[1])/b);return new a.math.Quaternion(d,e,f,b)};a.math.Quaternion.rotationYawPitchRoll= function(b,d,e){var f,g,h,k,m;f=a.degreesToRadians(d)/2;g=a.degreesToRadians(b)/2;h=a.degreesToRadians(e)/2;e=Math.cos(f);b=Math.cos(g);d=Math.cos(h);f=Math.sin(f);g=Math.sin(g);h=Math.sin(h);k=b*d;m=g*h;var n=new a.math.Quaternion;n.w=e*k+f*m;n.x=f*k-e*m;n.y=e*g*d+f*b*h;n.z=e*b*h-f*g*d;n.normalize();return n};b.slerp=function(b,d){if(this.x===b.x&&this.y===b.y&&this.z===b.z&&this.w===b.w)return this;var e=this.dot(b),f=Math.acos(e),g=Math.sqrt(1-a.math.square(e)),e=Math.sin(d*f)/g,f=Math.sin((1- d)*f)/g,g=new a.math.Quaternion(b);this.scale(f);g.scale(e);this.add(g);return this};b.toAxisAndAngle=function(){var b,d,e=new a.math.Vec3;b=Math.acos(this.w);d=Math.sqrt(a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z));d>-a.math.EPSILON&&d<a.math.EPSILON||d<2*Math.PI+a.math.EPSILON&&d>2*Math.PI-a.math.EPSILON?(b=0,e.x=0,e.y=0,e.z=1):(b*=2,e.x=this.x/d,e.y=this.y/d,e.z=this.z/d,e.normalize());return{axis:e,angle:b}};b.scale=function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this}; b.assignFrom=function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this};b.add=function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this};a.math.Quaternion.rotationBetweenVec3=function(b,d,e){var f=new a.math.Vec3(b),g=new a.math.Vec3(d);f.normalize();g.normalize();var h=f.dot(g);d=new a.math.Quaternion;if(1<=h)return d.identity(),d;-0.999999>h?Math.abs(e.lengthSq())<a.math.EPSILON?d.rotationAxis(e,Math.PI):(f=new a.math.Vec3(1,0,0),f.cross(b),Math.abs(f.lengthSq())<a.math.EPSILON&& (f.fill(0,1,0),f.cross(b)),f.normalize(),d.rotationAxis(f,Math.PI)):(b=Math.sqrt(2*(1+h)),e=1/b,f.cross(g),d.x=f.x*e,d.y=f.y*e,d.z=f.z*e,d.w=0.5*b,d.normalize());return d};b.multiplyVec3=function(b){var d=this.x,e=this.y,f=this.z,g=new a.math.Vec3(b),h=new a.math.Vec3(d,e,f),d=new a.math.Vec3(d,e,f);h.cross(b);d.cross(h);h.scale(2*q.w);d.scale(2);g.add(h);g.add(d);return g}})(cc);cc.math.AABB=function(a,b){this.min=a||new cc.math.Vec3;this.max=b||new cc.math.Vec3};cc.math.AABB.prototype.containsPoint=function(a){return a.x>=this.min.x&&a.x<=this.max.x&&a.y>=this.min.y&&a.y<=this.max.y&&a.z>=this.min.z&&a.z<=this.max.z};cc.math.AABB.containsPoint=function(a,b){return a.x>=b.min.x&&a.x<=b.max.x&&a.y>=b.min.y&&a.y<=b.max.y&&a.z>=b.min.z&&a.z<=b.max.z};cc.math.AABB.prototype.assignFrom=function(a){this.min.assignFrom(a.min);this.max.assignFrom(a.max)}; cc.math.AABB.assign=function(a,b){a.min.assignFrom(b.min);a.max.assignFrom(b.max);return a};(function(a){a.math.Matrix4Stack=function(a,b){this.top=a;this.stack=b||[];this.lastUpdated=0};a.km_mat4_stack=a.math.Matrix4Stack;var b=a.math.Matrix4Stack.prototype;b.initialize=function(){this.stack.length=0;this.top=null};a.km_mat4_stack_push=function(b,d){b.stack.push(b.top);b.top=new a.math.Matrix4(d)};a.km_mat4_stack_pop=function(a,b){a.top=a.stack.pop()};a.km_mat4_stack_release=function(a){a.stack=null;a.top=null};b.push=function(b){b=b||this.top;this.stack.push(this.top);this.top=new a.math.Matrix4(b)}; b.pop=function(){this.top=this.stack.pop()};b.release=function(){this._matrixPool=this.top=this.stack=null};b._getFromPool=function(b){var d=this._matrixPool;if(0===d.length)return new a.math.Matrix4(b);d=d.pop();d.assignFrom(b);return d};b._putInPool=function(a){this._matrixPool.push(a)}})(cc);(function(a){a.KM_GL_MODELVIEW=5888;a.KM_GL_PROJECTION=5889;a.KM_GL_TEXTURE=5890;a.modelview_matrix_stack=new a.math.Matrix4Stack;a.projection_matrix_stack=new a.math.Matrix4Stack;a.texture_matrix_stack=new a.math.Matrix4Stack;a.current_stack=null;a.lazyInitialize=function(){var b=new a.math.Matrix4;a.modelview_matrix_stack.initialize();a.projection_matrix_stack.initialize();a.texture_matrix_stack.initialize();a.current_stack=a.modelview_matrix_stack;a.initialized=!0;b.identity();a.modelview_matrix_stack.push(b); a.projection_matrix_stack.push(b);a.texture_matrix_stack.push(b)};a.lazyInitialize();a.kmGLFreeAll=function(){a.modelview_matrix_stack.release();a.modelview_matrix_stack=null;a.projection_matrix_stack.release();a.projection_matrix_stack=null;a.texture_matrix_stack.release();a.texture_matrix_stack=null;a.initialized=!1;a.current_stack=null};a.kmGLPushMatrix=function(){a.current_stack.push(a.current_stack.top)};a.kmGLPushMatrixWitMat4=function(b){a.current_stack.stack.push(a.current_stack.top);b.assignFrom(a.current_stack.top); a.current_stack.top=b};a.kmGLPopMatrix=function(){a.current_stack.top=a.current_stack.stack.pop()};a.kmGLMatrixMode=function(b){switch(b){case a.KM_GL_MODELVIEW:a.current_stack=a.modelview_matrix_stack;break;case a.KM_GL_PROJECTION:a.current_stack=a.projection_matrix_stack;break;case a.KM_GL_TEXTURE:a.current_stack=a.texture_matrix_stack;break;default:throw Error("Invalid matrix mode specified");}a.current_stack.lastUpdated=a.director.getTotalFrames()};a.kmGLLoadIdentity=function(){a.current_stack.top.identity()}; a.kmGLLoadMatrix=function(b){a.current_stack.top.assignFrom(b)};a.kmGLMultMatrix=function(b){a.current_stack.top.multiply(b)};var b=new a.math.Matrix4;a.kmGLTranslatef=function(c,e,f){c=a.math.Matrix4.createByTranslation(c,e,f,b);a.current_stack.top.multiply(c)};var c=new a.math.Vec3;a.kmGLRotatef=function(d,e,f,g){c.fill(e,f,g);d=a.math.Matrix4.createByAxisAndAngle(c,a.degreesToRadians(d),b);a.current_stack.top.multiply(d)};a.kmGLScalef=function(c,e,f){c=a.math.Matrix4.createByScale(c,e,f,b);a.current_stack.top.multiply(c)}; a.kmGLGetMatrix=function(b,c){switch(b){case a.KM_GL_MODELVIEW:c.assignFrom(a.modelview_matrix_stack.top);break;case a.KM_GL_PROJECTION:c.assignFrom(a.projection_matrix_stack.top);break;case a.KM_GL_TEXTURE:c.assignFrom(a.texture_matrix_stack.top);break;default:throw Error("Invalid matrix mode specified");}}})(cc);cc.SHADER_POSITION_UCOLOR_FRAG="precision lowp float;\nvarying 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 float u_pointSize;\nvarying lowp vec4 v_fragmentColor; \nvoid main(void) \n{\n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n gl_PointSize \x3d u_pointSize; \n v_fragmentColor \x3d u_color; \n}"; cc.SHADER_POSITION_COLOR_FRAG="precision lowp float; \nvarying 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 lowp vec4 v_fragmentColor;\nvoid main()\n{\n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n v_fragmentColor \x3d a_color; \n}";cc.SHADER_SPRITE_POSITION_COLOR_VERT="attribute vec4 a_position;\nattribute vec4 a_color;\nvarying lowp 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 mediump vec4 v_color;\nvarying mediump 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 mediump vec4 a_position; \nattribute mediump vec2 a_texcoord; \nattribute mediump vec4 a_color;\t\nvarying mediump vec4 v_color; \nvarying mediump 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 * CC_MVMatrix) * a_position; \n}"; cc.SHADER_POSITION_TEXTURE_FRAG="precision lowp float; \nvarying 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 mediump vec2 v_texCoord; \nvoid main() \n{ \n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n v_texCoord \x3d a_texCoord; \n}";cc.SHADER_POSITION_TEXTURE_UCOLOR_FRAG="precision lowp float; \nuniform 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 mediump vec2 v_texCoord; \nvoid main() \n{ \n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n v_texCoord \x3d a_texCoord; \n}";cc.SHADER_POSITION_TEXTURE_A8COLOR_FRAG="precision lowp float; \nvarying 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 lowp vec4 v_fragmentColor; \nvarying mediump vec2 v_texCoord; \nvoid main() \n{ \n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n v_fragmentColor \x3d a_color; \n v_texCoord \x3d a_texCoord; \n}";cc.SHADER_POSITION_TEXTURE_COLOR_FRAG="precision lowp float;\nvarying 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 lowp vec4 v_fragmentColor; \nvarying mediump vec2 v_texCoord; \nvoid main() \n{ \n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n v_fragmentColor \x3d a_color; \n v_texCoord \x3d a_texCoord; \n}";cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT="attribute vec4 a_position; \nattribute vec2 a_texCoord; \nattribute vec4 a_color; \nvarying lowp vec4 v_fragmentColor; \nvarying mediump 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_SPRITE_POSITION_TEXTURE_COLOR_GRAY_FRAG="precision lowp float;\nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n vec4 c \x3d texture2D(CC_Texture0, v_texCoord); \n gl_FragColor.xyz \x3d vec3(0.2126*c.r + 0.7152*c.g + 0.0722*c.b); \n gl_FragColor.w \x3d c.w ; \n}";cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG="precision lowp float; \nvarying 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 if ( texColor.a \x3c\x3d CC_alpha_value ) \n discard; \n gl_FragColor \x3d texColor * v_fragmentColor; \n}"; cc.SHADEREX_SWITCHMASK_FRAG="precision lowp float; \nvarying 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}";cc.shaderCache={TYPE_POSITION_TEXTURECOLOR:0,TYPE_POSITION_TEXTURECOLOR_ALPHATEST:1,TYPE_POSITION_COLOR:2,TYPE_POSITION_TEXTURE:3,TYPE_POSITION_TEXTURE_UCOLOR:4,TYPE_POSITION_TEXTURE_A8COLOR:5,TYPE_POSITION_UCOLOR:6,TYPE_POSITION_LENGTH_TEXTURECOLOR:7,TYPE_SPRITE_POSITION_TEXTURECOLOR:8,TYPE_SPRITE_POSITION_TEXTURECOLOR_ALPHATEST:9,TYPE_SPRITE_POSITION_COLOR:10,TYPE_SPRITE_POSITION_TEXTURECOLOR_GRAY:11,TYPE_MAX:11,_programs:{},_init:function(){return!0},_loadDefaultShader:function(a,b){switch(b){case cc.SHADER_POSITION_TEXTURECOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_COLOR_VERT, cc.SHADER_POSITION_TEXTURE_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_SPRITE_POSITION_TEXTURECOLOR:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_POSITION_TEXTURE_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR, cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_SPRITE_POSITION_TEXTURECOLOR_GRAY:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_GRAY_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_TEXTURECOLORALPHATEST:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_COLOR_VERT, cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION); a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_COLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_COLOR_VERT,cc.SHADER_POSITION_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);break;case cc.SHADER_SPRITE_POSITION_COLOR:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_COLOR_VERT, cc.SHADER_POSITION_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);break;case cc.SHADER_POSITION_TEXTURE:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_VERT,cc.SHADER_POSITION_TEXTURE_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_TEXTURE_UCOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_UCOLOR_VERT, cc.SHADER_POSITION_TEXTURE_UCOLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_TEXTUREA8COLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_A8COLOR_VERT,cc.SHADER_POSITION_TEXTURE_A8COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD, cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_UCOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_UCOLOR_VERT,cc.SHADER_POSITION_UCOLOR_FRAG);a.addAttribute("aVertex",cc.VERTEX_ATTRIB_POSITION);break;case cc.SHADER_POSITION_LENGTHTEXTURECOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_VERT,cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS); a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);break;default:cc.log("cocos2d: cc.shaderCache._loadDefaultShader, error shader type");return}a.link();a.updateUniforms()},loadDefaultShaders:function(){},reloadDefaultShaders:function(){var a=this.programForKey(cc.SHADER_POSITION_TEXTURECOLOR);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURECOLOR);a=this.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR);a.reset();this._loadDefaultShader(a,this.TYPE_SPRITE_POSITION_TEXTURECOLOR); a=this.programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURECOLOR_ALPHATEST);a=this.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST);a.reset();this._loadDefaultShader(a,this.TYPE_SPRITE_POSITION_TEXTURECOLOR_ALPHATEST);a=this.programForKey(cc.SHADER_POSITION_COLOR);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_COLOR);a=this.programForKey(cc.SHADER_POSITION_TEXTURE);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURE); a=this.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_GRAY_FRAG);a.reset();this._loadDefaultShader(a,this.TYPE_SPRITE_POSITION_TEXTURECOLOR_GRAY);a=this.programForKey(cc.SHADER_POSITION_TEXTURE_UCOLOR);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURE_UCOLOR);a=this.programForKey(cc.SHADER_POSITION_TEXTUREA8COLOR);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURE_A8COLOR);a=this.programForKey(cc.SHADER_POSITION_UCOLOR);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_UCOLOR)}, programForKey:function(a){if(!this._programs[a]){var b=new cc.GLProgram;this._loadDefaultShader(b,a);this._programs[a]=b}return this._programs[a]},getProgram:function(a){return this.programForKey(a)},addProgram:function(a,b){this._programs[b]=a}};cc.GLProgram=cc.Class.extend({_glContext:null,_programObj:null,_vertShader:null,_fragShader:null,_uniforms:null,_hashForUniforms:null,_usesTime:!1,_projectionUpdated:-1,_updateUniformLocation:function(a){if(!a)return!1;var b,c=this._hashForUniforms[a];if(c){b=!1;for(var d=arguments.length-1,e=0;e<d;++e)arguments[e+1]!==c[e]&&(c[e]=arguments[e+1],b=!0)}else c=[arguments[1],arguments[2],arguments[3],arguments[4]],this._hashForUniforms[a]=c,b=!0;return b},_description:function(){return"\x3cCCGLProgram \x3d "+ this.toString()+" | Program \x3d "+this._programObj.toString()+", VertexShader \x3d "+this._vertShader.toString()+", FragmentShader \x3d "+this._fragShader.toString()+"\x3e"},_compileShader:function(a,b,c){if(!c||!a)return!1;c=(cc.GLProgram._isHighpSupported()?"precision highp float;\n":"precision mediump float;\n")+"uniform mat4 CC_PMatrix; \nuniform mat4 CC_MVMatrix; \nuniform mat4 CC_MVPMatrix; \nuniform vec4 CC_Time; \nuniform vec4 CC_SinTime; \nuniform vec4 CC_CosTime; \nuniform vec4 CC_Random01; \nuniform sampler2D CC_Texture0; \n//CC INCLUDES END \n"+ c;this._glContext.shaderSource(a,c);this._glContext.compileShader(a);c=this._glContext.getShaderParameter(a,this._glContext.COMPILE_STATUS);c||(cc.log("cocos2d: ERROR: Failed to compile shader:\n"+this._glContext.getShaderSource(a)),b===this._glContext.VERTEX_SHADER?cc.log("cocos2d: \n"+this.vertexShaderLog()):cc.log("cocos2d: \n"+this.fragmentShaderLog()));return!0===c},ctor:function(a,b,c){this._uniforms={};this._hashForUniforms={};this._glContext=c||cc._renderContext;a&&b&&this.init(a,b)},destroyProgram:function(){this._hashForUniforms= this._uniforms=this._fragShader=this._vertShader=null;this._glContext.deleteProgram(this._programObj)},initWithVertexShaderByteArray:function(a,b){var c=this._glContext;this._programObj=c.createProgram();this._fragShader=this._vertShader=null;a&&(this._vertShader=c.createShader(c.VERTEX_SHADER),this._compileShader(this._vertShader,c.VERTEX_SHADER,a)||cc.log("cocos2d: ERROR: Failed to compile vertex shader"));b&&(this._fragShader=c.createShader(c.FRAGMENT_SHADER),this._compileShader(this._fragShader, c.FRAGMENT_SHADER,b)||cc.log("cocos2d: ERROR: Failed to compile fragment shader"));this._vertShader&&c.attachShader(this._programObj,this._vertShader);cc.checkGLErrorDebug();this._fragShader&&c.attachShader(this._programObj,this._fragShader);for(var d in this._hashForUniforms)delete this._hashForUniforms[d];cc.checkGLErrorDebug();return!0},initWithString:function(a,b){return this.initWithVertexShaderByteArray(a,b)},initWithVertexShaderFilename:function(a,b){var c=cc.loader.getRes(a);if(!c)throw Error("Please load the resource firset : "+ a);var d=cc.loader.getRes(b);if(!d)throw Error("Please load the resource firset : "+b);return this.initWithVertexShaderByteArray(c,d)},init:function(a,b){return this.initWithVertexShaderFilename(a,b)},addAttribute:function(a,b){this._glContext.bindAttribLocation(this._programObj,b,a)},link:function(){if(!this._programObj)return cc.log("cc.GLProgram.link(): Cannot link invalid program"),!1;this._glContext.linkProgram(this._programObj);this._vertShader&&this._glContext.deleteShader(this._vertShader); this._fragShader&&this._glContext.deleteShader(this._fragShader);this._fragShader=this._vertShader=null;return cc.game.config[cc.game.CONFIG_KEY.debugMode]&&!this._glContext.getProgramParameter(this._programObj,this._glContext.LINK_STATUS)?(cc.log("cocos2d: ERROR: Failed to link program: "+this._glContext.getProgramInfoLog(this._programObj)),cc.glDeleteProgram(this._programObj),this._programObj=null,!1):!0},use:function(){cc.glUseProgram(this._programObj)},updateUniforms:function(){this._uniforms[cc.UNIFORM_PMATRIX_S]= this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_PMATRIX_S);this._uniforms[cc.UNIFORM_MVMATRIX_S]=this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_MVMATRIX_S);this._uniforms[cc.UNIFORM_MVPMATRIX_S]=this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_MVPMATRIX_S);this._uniforms[cc.UNIFORM_TIME_S]=this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_TIME_S);this._uniforms[cc.UNIFORM_SINTIME_S]=this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_SINTIME_S); this._uniforms[cc.UNIFORM_COSTIME_S]=this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_COSTIME_S);this._usesTime=null!=this._uniforms[cc.UNIFORM_TIME_S]||null!=this._uniforms[cc.UNIFORM_SINTIME_S]||null!=this._uniforms[cc.UNIFORM_COSTIME_S];this._uniforms[cc.UNIFORM_RANDOM01_S]=this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_RANDOM01_S);this._uniforms[cc.UNIFORM_SAMPLER_S]=this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_SAMPLER_S);this.use();this.setUniformLocationWith1i(this._uniforms[cc.UNIFORM_SAMPLER_S], 0)},_addUniformLocation:function(a){var b=this._glContext.getUniformLocation(this._programObj,a);this._uniforms[a]=b},getUniformLocationForName:function(a){if(!a)throw Error("cc.GLProgram.getUniformLocationForName(): uniform name should be non-null");if(!this._programObj)throw Error("cc.GLProgram.getUniformLocationForName(): Invalid operation. Cannot get uniform location when program is not initialized");return this._uniforms[a]||this._glContext.getUniformLocation(this._programObj,a)},getUniformMVPMatrix:function(){return this._uniforms[cc.UNIFORM_MVPMATRIX_S]}, getUniformSampler:function(){return this._uniforms[cc.UNIFORM_SAMPLER_S]},setUniformLocationWith1i:function(a,b){var c=this._glContext;if("string"===typeof a){if(this._updateUniformLocation(a,b)){var d=this.getUniformLocationForName(a);c.uniform1i(d,b)}}else c.uniform1i(a,b)},setUniformLocationWith2i:function(a,b,c){var d=this._glContext;"string"===typeof a?this._updateUniformLocation(a,b,c)&&(a=this.getUniformLocationForName(a),d.uniform2i(a,b,c)):d.uniform2i(a,b,c)},setUniformLocationWith3i:function(a, b,c,d){var e=this._glContext;"string"===typeof a?this._updateUniformLocation(a,b,c,d)&&(a=this.getUniformLocationForName(a),e.uniform3i(a,b,c,d)):e.uniform3i(a,b,c,d)},setUniformLocationWith4i:function(a,b,c,d,e){var f=this._glContext;"string"===typeof a?this._updateUniformLocation(a,b,c,d,e)&&(a=this.getUniformLocationForName(a),f.uniform4i(a,b,c,d,e)):f.uniform4i(a,b,c,d,e)},setUniformLocationWith2iv:function(a,b){var c="string"===typeof a?this.getUniformLocationForName(a):a;this._glContext.uniform2iv(c, b)},setUniformLocationWith3iv:function(a,b){var c="string"===typeof a?this.getUniformLocationForName(a):a;this._glContext.uniform3iv(c,b)},setUniformLocationWith4iv:function(a,b){var c="string"===typeof a?this.getUniformLocationForName(a):a;this._glContext.uniform4iv(c,b)},setUniformLocationI32:function(a,b){this.setUniformLocationWith1i(a,b)},setUniformLocationWith1f:function(a,b){var c=this._glContext;if("string"===typeof a){if(this._updateUniformLocation(a,b)){var d=this.getUniformLocationForName(a); c.uniform1f(d,b)}}else c.uniform1f(a,b)},setUniformLocationWith2f:function(a,b,c){var d=this._glContext;"string"===typeof a?this._updateUniformLocation(a,b,c)&&(a=this.getUniformLocationForName(a),d.uniform2f(a,b,c)):d.uniform2f(a,b,c)},setUniformLocationWith3f:function(a,b,c,d){var e=this._glContext;"string"===typeof a?this._updateUniformLocation(a,b,c,d)&&(a=this.getUniformLocationForName(a),e.uniform3f(a,b,c,d)):e.uniform3f(a,b,c,d)},setUniformLocationWith4f:function(a,b,c,d,e){var f=this._glContext; "string"===typeof a?this._updateUniformLocation(a,b,c,d,e)&&(a=this.getUniformLocationForName(a),f.uniform4f(a,b,c,d,e)):f.uniform4f(a,b,c,d,e)},setUniformLocationWith2fv:function(a,b){var c="string"===typeof a?this.getUniformLocationForName(a):a;this._glContext.uniform2fv(c,b)},setUniformLocationWith3fv:function(a,b){var c="string"===typeof a?this.getUniformLocationForName(a):a;this._glContext.uniform3fv(c,b)},setUniformLocationWith4fv:function(a,b){var c="string"===typeof a?this.getUniformLocationForName(a): a;this._glContext.uniform4fv(c,b)},setUniformLocationWithMatrix3fv:function(a,b){var c="string"===typeof a?this.getUniformLocationForName(a):a;this._glContext.uniformMatrix3fv(c,!1,b)},setUniformLocationWithMatrix4fv:function(a,b){var c="string"===typeof a?this.getUniformLocationForName(a):a;this._glContext.uniformMatrix4fv(c,!1,b)},setUniformLocationF32:function(){if(!(2>arguments.length))switch(arguments.length){case 2:this.setUniformLocationWith1f(arguments[0],arguments[1]);break;case 3:this.setUniformLocationWith2f(arguments[0], arguments[1],arguments[2]);break;case 4:this.setUniformLocationWith3f(arguments[0],arguments[1],arguments[2],arguments[3]);break;case 5:this.setUniformLocationWith4f(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4])}},setUniformsForBuiltins:function(){var a=new cc.math.Matrix4,b=new cc.math.Matrix4,c=new cc.math.Matrix4;cc.kmGLGetMatrix(cc.KM_GL_PROJECTION,a);cc.kmGLGetMatrix(cc.KM_GL_MODELVIEW,b);cc.kmMat4Multiply(c,a,b);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S], a.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S],b.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S],c.mat,1);this._usesTime&&(a=cc.director,a=a.getTotalFrames()*a.getAnimationInterval(),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_TIME_S],a/10,a,2*a,4*a),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_SINTIME_S],a/8,a/4,a/2,Math.sin(a)),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_COSTIME_S],a/8,a/4, a/2,Math.cos(a)));-1!==this._uniforms[cc.UNIFORM_RANDOM01_S]&&this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_RANDOM01_S],Math.random(),Math.random(),Math.random(),Math.random())},_setUniformsForBuiltinsForRenderer:function(a){if(a&&a._renderCmd){var b=new cc.math.Matrix4,c=new cc.math.Matrix4;cc.kmGLGetMatrix(cc.KM_GL_PROJECTION,b);cc.kmMat4Multiply(c,b,a._renderCmd._stackMatrix);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],b.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S], a._renderCmd._stackMatrix.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S],c.mat,1);this._usesTime&&(a=cc.director,a=a.getTotalFrames()*a.getAnimationInterval(),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_TIME_S],a/10,a,2*a,4*a),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_SINTIME_S],a/8,a/4,a/2,Math.sin(a)),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_COSTIME_S],a/8,a/4,a/2,Math.cos(a)));-1!==this._uniforms[cc.UNIFORM_RANDOM01_S]&& this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_RANDOM01_S],Math.random(),Math.random(),Math.random(),Math.random())}},setUniformForModelViewProjectionMatrix:function(){this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S],!1,cc.getMat4MultiplyValue(cc.projection_matrix_stack.top,cc.modelview_matrix_stack.top))},setUniformForModelViewProjectionMatrixWithMat4:function(a){cc.kmMat4Multiply(a,cc.projection_matrix_stack.top,cc.modelview_matrix_stack.top);this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S], !1,a.mat)},setUniformForModelViewAndProjectionMatrixWithMat4:function(){this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S],!1,cc.modelview_matrix_stack.top.mat);this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],!1,cc.projection_matrix_stack.top.mat)},_setUniformForMVPMatrixWithMat4:function(a){if(!a)throw Error("modelView matrix is undefined.");this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S],!1,a.mat);this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S], !1,cc.projection_matrix_stack.top.mat)},_updateProjectionUniform:function(){var a=cc.projection_matrix_stack;a.lastUpdated!==this._projectionUpdated&&(this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],!1,a.top.mat),this._projectionUpdated=a.lastUpdated)},vertexShaderLog:function(){return this._glContext.getShaderInfoLog(this._vertShader)},getVertexShaderLog:function(){return this._glContext.getShaderInfoLog(this._vertShader)},getFragmentShaderLog:function(){return this._glContext.getShaderInfoLog(this._vertShader)}, fragmentShaderLog:function(){return this._glContext.getShaderInfoLog(this._fragShader)},programLog:function(){return this._glContext.getProgramInfoLog(this._programObj)},getProgramLog:function(){return this._glContext.getProgramInfoLog(this._programObj)},reset:function(){this._fragShader=this._vertShader=null;this._uniforms.length=0;this._glContext.deleteProgram(this._programObj);this._programObj=null;for(var a in this._hashForUniforms)this._hashForUniforms[a].length=0,delete this._hashForUniforms[a]}, getProgram:function(){return this._programObj},retain:function(){},release:function(){}});cc.GLProgram.create=function(a,b){return new cc.GLProgram(a,b)};cc.GLProgram._highpSupported=null;cc.GLProgram._isHighpSupported=function(){if(null==cc.GLProgram._highpSupported){var a=cc._renderContext,a=a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.HIGH_FLOAT);cc.GLProgram._highpSupported=0!==a.precision}return cc.GLProgram._highpSupported}; cc.setProgram=function(a,b){a.shaderProgram=b;var c=a.children;if(c)for(var d=0;d<c.length;d++)cc.setProgram(c[d],b)};cc._currentProjectionMatrix=-1;cc.ENABLE_GL_STATE_CACHE&&(cc.MAX_ACTIVETEXTURE=16,cc._currentShaderProgram=-1,cc._currentBoundTexture=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],cc._blendingSource=-1,cc._blendingDest=-1,cc._GLServerState=0,cc.TEXTURE_ATLAS_USE_VAO&&(cc._uVAO=0)); cc.glInvalidateStateCache=function(){cc.kmGLFreeAll();cc._currentProjectionMatrix=-1;if(cc.ENABLE_GL_STATE_CACHE){cc._currentShaderProgram=-1;for(var a=0;a<cc.MAX_ACTIVETEXTURE;a++)cc._currentBoundTexture[a]=-1;cc._blendingSource=-1;cc._blendingDest=-1;cc._GLServerState=0}};cc.glUseProgram=cc.ENABLE_GL_STATE_CACHE?function(a){a!==cc._currentShaderProgram&&(cc._currentShaderProgram=a,cc._renderContext.useProgram(a))}:function(a){cc._renderContext.useProgram(a)}; cc.glDeleteProgram=function(a){cc.ENABLE_GL_STATE_CACHE&&a===cc._currentShaderProgram&&(cc._currentShaderProgram=-1);gl.deleteProgram(a)};cc.setBlending=function(a,b){var c=cc._renderContext;a===c.ONE&&b===c.ZERO?c.disable(c.BLEND):(c.enable(c.BLEND),cc._renderContext.blendFunc(a,b))};cc.glBlendFunc=cc.ENABLE_GL_STATE_CACHE?function(a,b){if(a!==cc._blendingSource||b!==cc._blendingDest)cc._blendingSource=a,cc._blendingDest=b,cc.setBlending(a,b)}:cc.setBlending; cc.glBlendFuncForParticle=function(a,b){if(a!==cc._blendingSource||b!==cc._blendingDest){cc._blendingSource=a;cc._blendingDest=b;var c=cc._renderContext;a===c.ONE&&b===c.ZERO?c.disable(c.BLEND):(c.enable(c.BLEND),c.blendFuncSeparate(c.SRC_ALPHA,b,a,b))}};cc.glBlendResetToCache=function(){var a=cc._renderContext;a.blendEquation(a.FUNC_ADD);cc.ENABLE_GL_STATE_CACHE?cc.setBlending(cc._blendingSource,cc._blendingDest):cc.setBlending(a.BLEND_SRC,a.BLEND_DST)}; cc.setProjectionMatrixDirty=function(){cc._currentProjectionMatrix=-1};cc.glBindTexture2D=function(a){cc.glBindTexture2DN(0,a)}; cc.glBindTexture2DN=cc.ENABLE_GL_STATE_CACHE?function(a,b){if(cc._currentBoundTexture[a]!==b){cc._currentBoundTexture[a]=b;var c=cc._renderContext;c.activeTexture(c.TEXTURE0+a);b?c.bindTexture(c.TEXTURE_2D,b._webTextureObj):c.bindTexture(c.TEXTURE_2D,null)}}:function(a,b){var c=cc._renderContext;c.activeTexture(c.TEXTURE0+a);b?c.bindTexture(c.TEXTURE_2D,b._webTextureObj):c.bindTexture(c.TEXTURE_2D,null)};cc.glDeleteTexture=function(a){cc.glDeleteTextureN(0,a)}; cc.glDeleteTextureN=function(a,b){cc.ENABLE_GL_STATE_CACHE&&b===cc._currentBoundTexture[a]&&(cc._currentBoundTexture[a]=-1);cc._renderContext.deleteTexture(b._webTextureObj)};cc.glBindVAO=function(a){cc.TEXTURE_ATLAS_USE_VAO&&cc.ENABLE_GL_STATE_CACHE&&cc._uVAO!==a&&(cc._uVAO=a)};cc.glEnable=function(a){};cc.IMAGE_FORMAT_JPEG=0;cc.IMAGE_FORMAT_PNG=1;cc.IMAGE_FORMAT_RAWDATA=9;cc.NextPOT=function(a){a-=1;a|=a>>1;a|=a>>2;a|=a>>4;a|=a>>8;return(a|a>>16)+1}; cc.RenderTexture=cc.Node.extend({sprite:null,clearFlags:0,clearDepthVal:0,autoDraw:!1,_texture:null,_pixelFormat:0,clearStencilVal:0,_clearColor:null,_className:"RenderTexture",ctor:function(a,b,c,d){cc.Node.prototype.ctor.call(this);this._cascadeOpacityEnabled=this._cascadeColorEnabled=!0;this._pixelFormat=cc.Texture2D.PIXEL_FORMAT_RGBA8888;this._clearColor=new cc.Color(0,0,0,255);void 0!==a&&void 0!==b&&(c=c||cc.Texture2D.PIXEL_FORMAT_RGBA8888,this.initWithWidthAndHeight(a,b,c,d||0));this.setAnchorPoint(0, 0)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.RenderTexture.CanvasRenderCmd(this):new cc.RenderTexture.WebGLRenderCmd(this)},visit:function(a){if(this._visible){var b=cc.renderer,c=this._renderCmd;c.visit(a&&a._renderCmd);b.pushRenderCommand(c);this.sprite.visit(this);c._dirtyFlag=0}},cleanup:function(){cc.Node.prototype.onExit.call(this);this._renderCmd.cleanup()},getSprite:function(){return this.sprite},setSprite:function(a){this.sprite=a},setVirtualViewport:function(a, b,c){this._renderCmd.setVirtualViewport(a,b,c)},initWithWidthAndHeight:function(a,b,c,d){return this._renderCmd.initWithWidthAndHeight(a,b,c,d)},begin:function(){cc.renderer._turnToCacheMode(this.__instanceId);this._renderCmd.begin()},beginWithClear:function(a,b,c,d,e,f){var g=cc._renderContext;e=e||g.COLOR_BUFFER_BIT;f=f||g.COLOR_BUFFER_BIT|g.DEPTH_BUFFER_BIT;this._beginWithClear(a,b,c,d,e,f,g.COLOR_BUFFER_BIT|g.DEPTH_BUFFER_BIT|g.STENCIL_BUFFER_BIT)},_beginWithClear:function(a,b,c,d,e,f,g){this.begin(); this._renderCmd._beginWithClear(a,b,c,d,e,f,g)},end:function(){this._renderCmd.end()},clear:function(a,b,c,d){this.beginWithClear(a,b,c,d);this.end()},clearRect:function(a,b,c,d){this._renderCmd.clearRect(a,b,c,d)},clearDepth:function(a){this._renderCmd.clearDepth(a)},clearStencil:function(a){this._renderCmd.clearStencil(a)},getClearFlags:function(){return this.clearFlags},setClearFlags:function(a){this.clearFlags=a},getClearColor:function(){return this._clearColor},setClearColor:function(a){var b= this._clearColor;b.r=a.r;b.g=a.g;b.b=a.b;b.a=a.a;this._renderCmd.updateClearColor(a)},getClearDepth:function(){return this.clearDepthVal},setClearDepth:function(a){this.clearDepthVal=a},getClearStencil:function(){return this.clearStencilVal},setClearStencil:function(a){this.clearStencilVal=a},isAutoDraw:function(){return this.autoDraw},setAutoDraw:function(a){this.autoDraw=a},saveToFile:function(a,b){cc.log("saveToFile isn't supported on Cocos2d-Html5")},newCCImage:function(a){cc.log("saveToFile isn't supported on cocos2d-html5"); return null},listenToBackground:function(a){},listenToForeground:function(a){}});_p=cc.RenderTexture.prototype;cc.defineGetterSetter(_p,"clearColorVal",_p.getClearColor,_p.setClearColor);cc.RenderTexture.create=function(a,b,c,d){return new cc.RenderTexture(a,b,c,d)};(function(){cc.RenderTexture.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1;this._clearColorStr="rgba(255,255,255,1)";this._cacheCanvas=document.createElement("canvas");this._cacheContext=new cc.CanvasContextWrapper(this._cacheCanvas.getContext("2d"))};var a=cc.RenderTexture.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.RenderTexture.CanvasRenderCmd;a.cleanup=function(){this._cacheCanvas=this._cacheContext=null};a.clearStencil=function(a){}; a.setVirtualViewport=function(a,c,d){};a.updateClearColor=function(a){this._clearColorStr="rgba("+(0|a.r)+","+(0|a.g)+","+(0|a.b)+","+a.a/255+")"};a.initWithWidthAndHeight=function(a,c,d,e){d=this._node;e=this._cacheCanvas;var f=cc.contentScaleFactor();e.width=0|a*f;e.height=0|c*f;a=new cc.Texture2D;a.initWithElement(e);a.handleLoadedTexture();a=d.sprite=new cc.Sprite(a);a.setBlendFunc(cc.ONE,cc.ONE_MINUS_SRC_ALPHA);d.autoDraw=!1;d.addChild(a);return!0};a.begin=function(){};a._beginWithClear=function(a, c,d,e,f,g,h){a=a||0;c=c||0;d=d||0;e=isNaN(e)?255:e;f=this._cacheContext.getContext();g=this._cacheCanvas;f.setTransform(1,0,0,1,0,0);this._cacheContext.setFillStyle("rgba("+(0|a)+","+(0|c)+","+(0|d)+","+e/255+")");f.clearRect(0,0,g.width,g.height);f.fillRect(0,0,g.width,g.height)};a.end=function(){var a=this._node,c=cc.contentScaleFactor();cc.renderer._renderingToCacheCanvas(this._cacheContext,a.__instanceId,c,c);a=a.sprite._renderCmd;a._notifyRegionStatus&&a._notifyRegionStatus(cc.Node.CanvasRenderCmd.RegionStatus.Dirty)}; a.clearRect=function(a,c,d,e){this._cacheContext.clearRect(a,c,d,-e)};a.clearDepth=function(a){cc.log("clearDepth isn't supported on Cocos2d-Html5")}})();(function(){cc.RenderTexture.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._depthRenderBuffer=this._textureCopy=this._oldFBO=this._fBO=null;this._rtTextureRect=new cc.Rect;this._fullRect=new cc.Rect;this._fullViewport=new cc.Rect};var a=cc.RenderTexture.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.RenderTexture.WebGLRenderCmd;a.setVirtualViewport=function(a,c,d){this._rtTextureRect.x=a.x;this._rtTextureRect.y=a.y;this._fullRect=c; this._fullViewport=d};a.needDraw=function(){return this._needDraw&&this._node.autoDraw};a.rendering=function(a){var c=a||cc._renderContext;a=this._node;if(a.autoDraw){a.begin();var d=a.clearFlags;if(d){var e=[0,0,0,0],f=0,g=0;d&c.COLOR_BUFFER_BIT&&(e=c.getParameter(c.COLOR_CLEAR_VALUE),c.clearColor(a._clearColor.r/255,a._clearColor.g/255,a._clearColor.b/255,a._clearColor.a/255));d&c.DEPTH_BUFFER_BIT&&(f=c.getParameter(c.DEPTH_CLEAR_VALUE),c.clearDepth(a.clearDepthVal));d&c.STENCIL_BUFFER_BIT&&(g= c.getParameter(c.STENCIL_CLEAR_VALUE),c.clearStencil(a.clearStencilVal));c.clear(d);d&c.COLOR_BUFFER_BIT&&c.clearColor(e[0],e[1],e[2],e[3]);d&c.DEPTH_BUFFER_BIT&&c.clearDepth(f);d&c.STENCIL_BUFFER_BIT&&c.clearStencil(g)}a.sortAllChildren();c=a._children;for(d=0;d<c.length;d++)e=c[d],e!==a.sprite&&e.visit(a.sprite);a.end()}};a.clearStencil=function(a){var c=cc._renderContext,d=c.getParameter(c.STENCIL_CLEAR_VALUE);c.clearStencil(a);c.clear(c.STENCIL_BUFFER_BIT);c.clearStencil(d)};a.cleanup=function(){this._textureCopy= null;var a=cc._renderContext;a.deleteFramebuffer(this._fBO);this._depthRenderBuffer&&a.deleteRenderbuffer(this._depthRenderBuffer)};a.updateClearColor=function(a){};a.initWithWidthAndHeight=function(a,c,d,e){var f=this._node;d===cc.Texture2D.PIXEL_FORMAT_A8&&cc.log("cc.RenderTexture._initWithWidthAndHeightForWebGL() : only RGB and RGBA formats are valid for a render texture;");var g=cc._renderContext,h=cc.contentScaleFactor();this._fullRect=new cc.Rect(0,0,a,c);this._fullViewport=new cc.Rect(0,0, a,c);a=0|a*h;c=0|c*h;this._oldFBO=g.getParameter(g.FRAMEBUFFER_BINDING);var k;cc.configuration.supportsNPOT()?(h=a,k=c):(h=cc.NextPOT(a),k=cc.NextPOT(c));for(var m=new Uint8Array(h*k*4),n=0;n<h*k*4;n++)m[n]=0;this._pixelFormat=d;n=f._texture=new cc.Texture2D;if(!f._texture)return!1;n.initWithData(m,f._pixelFormat,h,k,cc.size(a,c));d=g.getParameter(g.RENDERBUFFER_BINDING);if(cc.configuration.checkForGLExtension("GL_QCOM")){this._textureCopy=new cc.Texture2D;if(!this._textureCopy)return!1;this._textureCopy.initWithData(m, f._pixelFormat,h,k,cc.size(a,c))}this._fBO=g.createFramebuffer();g.bindFramebuffer(g.FRAMEBUFFER,this._fBO);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,g.TEXTURE_2D,n._webTextureObj,0);0!==e&&(this._depthRenderBuffer=g.createRenderbuffer(),g.bindRenderbuffer(g.RENDERBUFFER,this._depthRenderBuffer),g.renderbufferStorage(g.RENDERBUFFER,e,h,k),e===g.DEPTH_STENCIL?g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,this._depthRenderBuffer):e===g.STENCIL_INDEX|| e===g.STENCIL_INDEX8?g.framebufferRenderbuffer(g.FRAMEBUFFER,g.STENCIL_ATTACHMENT,g.RENDERBUFFER,this._depthRenderBuffer):e===g.DEPTH_COMPONENT16&&g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,this._depthRenderBuffer));g.checkFramebufferStatus(g.FRAMEBUFFER)!==g.FRAMEBUFFER_COMPLETE&&cc.log("Could not attach texture to the framebuffer");n.setAliasTexParameters();a=f.sprite=new cc.Sprite(n);a.scaleY=-1;a.setBlendFunc(g.ONE,g.ONE_MINUS_SRC_ALPHA);g.bindRenderbuffer(g.RENDERBUFFER, d);g.bindFramebuffer(g.FRAMEBUFFER,this._oldFBO);f.autoDraw=!1;f.addChild(a);return!0};a.begin=function(){var a=this._node;cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLPushMatrix();cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLPushMatrix();var c=cc._renderContext,d=cc.director;d.setProjection(d.getProjection());var e=a._texture.getContentSizeInPixels(),f=cc.director.getWinSizeInPixels(),d=f.width/e.width,e=f.height/e.height,d=cc.math.Matrix4.createOrthographicProjection(-1/d,1/d,-1/e,1/e,-1,1);cc.kmGLMultMatrix(d); d=new cc.Rect(0,0,0,0);d.width=this._fullViewport.width;d.height=this._fullViewport.height;e=d.height/this._fullRect.height;d.x=d.width/this._fullRect.width*(this._fullRect.x-this._rtTextureRect.x);d.y=(this._fullRect.y-this._rtTextureRect.y)*e;c.viewport(d.x,d.y,d.width,d.height);this._oldFBO=c.getParameter(c.FRAMEBUFFER_BINDING);c.bindFramebuffer(c.FRAMEBUFFER,this._fBO);cc.configuration.checkForGLExtension("GL_QCOM")&&(c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,this._textureCopy._webTextureObj, 0),c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT),c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,a._texture._webTextureObj,0))};a._beginWithClear=function(a,c,d,e,f,g,h){a/=255;c/=255;d/=255;e/=255;var k=cc._renderContext,m=[0,0,0,0],n=0,p=0;h&k.COLOR_BUFFER_BIT&&(m=k.getParameter(k.COLOR_CLEAR_VALUE),k.clearColor(a,c,d,e));h&k.DEPTH_BUFFER_BIT&&(n=k.getParameter(k.DEPTH_CLEAR_VALUE),k.clearDepth(f));h&k.STENCIL_BUFFER_BIT&&(p=k.getParameter(k.STENCIL_CLEAR_VALUE),k.clearStencil(g)); k.clear(h);h&k.COLOR_BUFFER_BIT&&k.clearColor(m[0],m[1],m[2],m[3]);h&k.DEPTH_BUFFER_BIT&&k.clearDepth(n);h&k.STENCIL_BUFFER_BIT&&k.clearStencil(p)};a.end=function(){cc.renderer._renderingToBuffer(this._node.__instanceId);var a=cc._renderContext,c=cc.director;a.bindFramebuffer(a.FRAMEBUFFER,this._oldFBO);c.setViewport();cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLPopMatrix();cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLPopMatrix()};a.clearRect=function(a,c,d,e){};a.clearDepth=function(a){var c=this._node; c.begin();var d=cc._renderContext,e=d.getParameter(d.DEPTH_CLEAR_VALUE);d.clearDepth(a);d.clear(d.DEPTH_BUFFER_BIT);d.clearDepth(e);c.end()}})();cc.LabelBMFont=cc.SpriteBatchNode.extend({_opacityModifyRGB:!1,_string:"",_config:null,_fntFile:"",_initialString:"",_alignment:cc.TEXT_ALIGNMENT_CENTER,_width:-1,_lineBreakWithoutSpaces:!1,_imageOffset:null,_textureLoaded:!1,_className:"LabelBMFont",_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new cc.LabelBMFont.WebGLRenderCmd(this):new cc.LabelBMFont.CanvasRenderCmd(this)},_setString:function(a,b){b?this._initialString=a:this._string=a;var c=this._children;if(c)for(var d= 0;d<c.length;d++){var e=c[d];e&&e.setVisible(!1)}this._textureLoaded&&(this._string&&0<this._string.length&&this.createFontChars(),b&&this.updateLabel())},ctor:function(a,b,c,d,e){cc.SpriteBatchNode.prototype.ctor.call(this);this._imageOffset=cc.p(0,0);this._cascadeOpacityEnabled=this._cascadeColorEnabled=!0;this.initWithString(a,b,c,d,e)},textureLoaded:function(){return this._textureLoaded},addLoadedEventListener:function(a,b){this.addEventListener("load",a,b)},isOpacityModifyRGB:function(){return this._opacityModifyRGB}, setOpacityModifyRGB:function(a){this._opacityModifyRGB=a;if(a=this._children)for(var b=0;b<a.length;b++){var c=a[b];c&&(c.opacityModifyRGB=this._opacityModifyRGB)}},_changeTextureColor:function(){this._renderCmd._changeTextureColor()},init:function(){return this.initWithString(null,null,null,null,null)},initWithString:function(a,b,c,d,e){a=a||"";this._config&&cc.log("cc.LabelBMFont.initWithString(): re-init is no longer supported");var f;if(b){f=cc.loader.getRes(b);if(!f&&(f=cc.FntFrameCache[b]|| cc.FntFrameCache[cc.path.basename(b)],!f))return cc.log("cc.LabelBMFont.initWithString(): Impossible to create font. Please check file"),!1;this._config=f;this._fntFile=b;b=f.atlasName;(b=cc.spriteFrameCache.getSpriteFrame(b)||cc.spriteFrameCache.getSpriteFrame(cc.path.basename(b)))?(f=b.getTexture(),this._spriteFrame=b):f=cc.textureCache.addImage(f.atlasName);(this._textureLoaded=b=f.isLoaded())||f.addEventListener("load",function(a){this._textureLoaded=!0;this.initWithTexture(a,this._initialString.length); this.setString(this._initialString,!0);this.dispatchEvent("load")},this)}else f=new cc.Texture2D,b=new Image,f.initWithElement(b),this._textureLoaded=!1;return this.initWithTexture(f,a.length)?(this._alignment=d||cc.TEXT_ALIGNMENT_LEFT,this._imageOffset=e||cc.p(0,0),this._width=void 0===c?-1:c,this._realOpacity=255,this._realColor=cc.color(255,255,255,255),this._contentSize.width=0,this._contentSize.height=0,this.setAnchorPoint(0.5,0.5),this.setString(a,!0),!0):!1},createFontChars:function(){var a= this._string,b=a?a.length:0,c=this._renderCmd,d=c._texture||this._texture,e=0,f=cc.size(0,0),g=0,h=1,k,m=this._config,n=m.kerningDict,p=m.commonHeight,r=m.fontDefDictionary;for(k=0;k<b-1;k++)10===a.charCodeAt(k)&&h++;var s=p*h,h=-(p-p*h),u=-1,t;for(k=0;k<b;k++)if(p=a.charCodeAt(k),0!==p)if(10===p)e=0,h-=m.commonHeight;else{u=n[u<<16|p&65535]||0;t=r[p];t||(cc.log("cocos2d: LabelBMFont: character not found "+a[k]),t={rect:{x:0,y:0,width:0,height:0},xOffset:0,yOffset:0,xAdvance:0});var v=cc.rect(t.rect.x, t.rect.y,t.rect.width,t.rect.height),v=cc.rectPixelsToPoints(v);v.x+=this._imageOffset.x;v.y+=this._imageOffset.y;var w=!1;if(this._spriteFrame){var x=this._spriteFrame._rect;if(this._spriteFrame._rotated){var w=!0,B=v.x;v.x=v.y+x.x;v.y=B+x.y}else v.x+=x.x,v.y+=x.y}(x=this.getChildByTag(k))?c._updateCharTexture(x,v,p,w):(x=new cc.Sprite,x.initWithTexture(d,v,w),x._newTextureWhenChangeColor=!0,this.addChild(x,0,k));x.opacityModifyRGB=this._opacityModifyRGB;c._updateCharColorAndOpacity(x);v=cc.p(e+ t.xOffset+0.5*t.rect.width+u,h+(m.commonHeight-t.yOffset)-0.5*v.height*cc.contentScaleFactor());x.setPosition(cc.pointPixelsToPoints(v));e+=t.xAdvance+u;u=p;g<e&&(g=e)}f.width=t&&t.xAdvance<t.rect.width?g-t.xAdvance+t.rect.width:g;f.height=s;this.setContentSize(cc.sizePixelsToPoints(f))},updateString:function(a){var b=this._children;if(b)for(var c=0,d=b.length;c<d;c++){var e=b[c];e&&(e.visible=!1)}this._config&&this._string&&0<this._string.length&&this.createFontChars();a||this.updateLabel()},getString:function(){return this._initialString}, setString:function(a,b){a=String(a);void 0===b&&(b=!0);if(void 0===a||"string"!==typeof a)a+="";this._initialString=a;this._setString(a,b)},_setStringForSetter:function(a){this.setString(a,!1)},setCString:function(a){this.setString(a,!0)},_getCharsWidth:function(a,b){if(0>=b)return 0;var c=this.getChildByTag(a),d=this.getChildByTag(a+b);return this._getLetterPosXLeft(d)-this._getLetterPosXLeft(c)},_checkWarp:function(a,b,c,d){for(var e=a[b],f=0,g=0;g<b;g++)f+=a[g].length;var f=f+b-d,h=this._getCharsWidth(f, a[b].length-1);if(h>c&&1<e.length){d=c/h*e.length|0;for(var g=e.substr(d),k=h-this._getCharsWidth(f+d,g.length-1),m,n=0,p=0;k>c&&100>p++;)d*=c/k,d|=0,g=e.substr(d),k=h-this._getCharsWidth(f+d,g.length-1);for(p=0;k<c&&100>p++;)g&&(n=(m=cc.LabelTTF._wordRex.exec(g))?m[0].length:1,m=g),this._lineBreakWithoutSpaces&&(n=0),d+=n,g=e.substr(d),k=h-this._getCharsWidth(f+d,g.length-1);d-=n;0===d&&(d=1,m=m.substr(1));c=e.substr(0,d);cc.LabelTTF.wrapInspection&&cc.LabelTTF._symbolRex.test(m||g)&&(n=(f=cc.LabelTTF._lastWordRex.exec(c))? f[0].length:0,this._lineBreakWithoutSpaces&&(n=0),d-=n,m=e.substr(d),c=e.substr(0,d));cc.LabelTTF._firsrEnglish.test(m)&&(f=cc.LabelTTF._lastEnglish.exec(c))&&c!==f[0]&&(n=f[0].length,this._lineBreakWithoutSpaces&&(n=0),d-=n,m=e.substr(d),c=e.substr(0,d));a[b]=m||g;a.splice(b,0,c)}},updateLabel:function(){this.string=this._initialString;var a,b,c;if(0<this._width){var d=this.string.split("\n"),e="",f=0,g=0;for(a=0;a<d.length;a++)g=d.length,this._checkWarp(d,a,this._width*this._scaleX,f),g<d.length&& f++,0<a&&(e+="\n"),e+=d[a];e+=String.fromCharCode(0);this._setString(e,!1)}if(this._alignment!==cc.TEXT_ALIGNMENT_LEFT)for(d=a=0,e=this._string.length,f=[],g=0;g<e;g++)if(10===this._string[g].charCodeAt(0)||0===this._string[g].charCodeAt(0)){b=0;var h=f.length;if(0===h)d++;else if(c=a+h-1+d,!(0>c)){var k=this.getChildByTag(c);if(null!=k){b=k.getPositionX()+k._getWidth()/2;k=0;switch(this._alignment){case cc.TEXT_ALIGNMENT_CENTER:k=this.width/2-b/2;break;case cc.TEXT_ALIGNMENT_RIGHT:k=this.width-b}if(0!== k)for(b=0;b<h;b++)c=a+b+d,0>c||(c=this.getChildByTag(c))&&(c.x+=k);a+=h;d++;f.length=0}}}else f.push(this._string[a])},setAlignment:function(a){this._alignment=a;this.updateLabel()},_getAlignment:function(){return this._alignment},setBoundingWidth:function(a){this._width=a;this.updateLabel()},_getBoundingWidth:function(){return this._width},setLineBreakWithoutSpace:function(a){this._lineBreakWithoutSpaces=a;this.updateLabel()},setScale:function(a,b){cc.Node.prototype.setScale.call(this,a,b);this.updateLabel()}, setScaleX:function(a){cc.Node.prototype.setScaleX.call(this,a);this.updateLabel()},setScaleY:function(a){cc.Node.prototype.setScaleY.call(this,a);this.updateLabel()},setFntFile:function(a){if(null!=a&&a!==this._fntFile){var b=cc.loader.getRes(a);b?(this._fntFile=a,this._config=b,a=cc.textureCache.addImage(b.atlasName),(this._textureLoaded=b=a.isLoaded())?(this.setTexture(a),this._string&&0<this._string.length&&this.createFontChars()):a.addEventListener("load",function(a){this._textureLoaded=!0;this.setTexture(a); this._string&&0<this._string.length&&this.createFontChars();this._changeTextureColor();this.updateLabel();this.dispatchEvent("load")},this)):cc.log("cc.LabelBMFont.setFntFile() : Impossible to create font. Please check file")}},getFntFile:function(){return this._fntFile},setTexture:function(a){this._texture=a;this._renderCmd.setTexture(a)},setAnchorPoint:function(a,b){cc.Node.prototype.setAnchorPoint.call(this,a,b);this.updateLabel()},_setAnchorX:function(a){cc.Node.prototype._setAnchorX.call(this, a);this.updateLabel()},_setAnchorY:function(a){cc.Node.prototype._setAnchorY.call(this,a);this.updateLabel()},_atlasNameFromFntFile:function(a){},_kerningAmountForFirst:function(a,b){var c=0;if(this._configuration.kerningDictionary){var d=this._configuration.kerningDictionary[(a<<16|b&65535).toString()];d&&(c=d.amount)}return c},_getLetterPosXLeft:function(a){return a.getPositionX()*this._scaleX-a._getWidth()*this._scaleX*a._getAnchorX()},_getLetterPosXRight:function(a){return a.getPositionX()*this._scaleX+ a._getWidth()*this._scaleX*a._getAnchorX()},_isspace_unicode:function(a){a=a.charCodeAt(0);return 9<=a&&13>=a||32===a||133===a||160===a||5760===a||8192<=a&&8202>=a||8232===a||8233===a||8239===a||8287===a||12288===a},_utf8_trim_ws:function(a){var b=a.length;if(!(0>=b)&&(b-=1,this._isspace_unicode(a[b]))){for(var c=b-1;0<=c;--c)if(this._isspace_unicode(a[c]))b=c;else break;this._utf8_trim_from(a,b)}},_utf8_trim_from:function(a,b){var c=a.length;b>=c||0>b||a.splice(b,c)}}); (function(){var a=cc.LabelBMFont.prototype;cc.EventHelper.prototype.apply(a);cc.defineGetterSetter(a,"string",a.getString,a._setStringForSetter);cc.defineGetterSetter(a,"boundingWidth",a._getBoundingWidth,a.setBoundingWidth);cc.defineGetterSetter(a,"textAlign",a._getAlignment,a.setAlignment);cc.defineGetterSetter(a,"texture",a.getTexture,a.setTexture)})();cc.LabelBMFont.create=function(a,b,c,d,e){return new cc.LabelBMFont(a,b,c,d,e)};cc.FntFrameCache={}; var _fntLoader={FNT_HEAD:/fntframes [^\n]*(\n|$)/gi,FNT_FRAME_NAME:/fntframe [^\n]*(\n|$)/gi,INFO_EXP:/info [^\n]*(\n|$)/gi,COMMON_EXP:/common [^\n]*(\n|$)/gi,PAGE_EXP:/page [^\n]*(\n|$)/gi,CHAR_EXP:/char [^\n]*(\n|$)/gi,KERNING_EXP:/kerning [^\n]*(\n|$)/gi,ITEM_EXP:/\w+=[^ \r\n]+/gi,INT_EXP:/^[\-]?\d+$/,_parseStrToObj:function(a){a=a.match(this.ITEM_EXP);var b={};if(a)for(var c=0,d=a.length;c<d;c++){var e=a[c],f=e.indexOf("\x3d"),g=e.substring(0,f),e=e.substring(f+1);e.match(this.INT_EXP)?e=parseInt(e): '"'===e[0]&&(e=e.substring(1,e.length-1));b[g]=e}return b},_parseFntContent:function(a,b,c,d){var e=this._parseStrToObj(b.match(this.COMMON_EXP)[0]);a.commonHeight=e.lineHeight;if(cc._renderType===cc.game.RENDER_TYPE_WEBGL){var f=cc.configuration.getMaxTextureSize();(e.scaleW>f.width||e.scaleH>f.height)&&cc.log("cc.LabelBMFont._parseCommonArguments(): page can't be larger than supported")}1!==e.pages&&cc.log("cc.LabelBMFont._parseCommonArguments(): only supports 1 page");e=this._parseStrToObj(b.match(this.PAGE_EXP)[0]); 0!==e.id&&cc.log("cc.LabelBMFont._parseImageFileName() : file could not be found");a.atlasName=d?cc.path.join(cc.path.dirname(d.path)+e.file):cc.path.changeBasename(c,e.file);e=b.match(this.CHAR_EXP);f=a.fontDefDictionary={};c=0;for(d=e.length;c<d;c++){var g=this._parseStrToObj(e[c]);f[g.id]={rect:{x:g.x,y:g.y,width:g.width,height:g.height},xOffset:g.xoffset,yOffset:g.yoffset,xAdvance:g.xadvance}}e=a.kerningDict={};if(b=b.match(this.KERNING_EXP))for(c=0,d=b.length;c<d;c++)f=this._parseStrToObj(b[c]), e[f.first<<16|f.second&65535]=f.amount;return a},parseFnt:function(a,b){var c={},d=a.match(this.FNT_HEAD);if(d){var e=this._parseStrToObj(d[0]);if(e&&e.count){a=a.substr(d[0].length);for(var d=a.split("----"),f=0;f<e.count;++f){var g=d[f],h=g.match(this.FNT_FRAME_NAME);if(h){var k=this._parseStrToObj(h[0]);if(k&&k.name){var c={},m=cc.path.join(cc.path.dirname(b),k.name);cc.FntFrameCache[m]=this._parseFntContent(c,g.substr(h[0].length),b,{path:k.name})}}}}}else c=this._parseFntContent(c,a,b);return c}, load:function(a,b,c,d){var e=this;cc.loader.loadTxt(a,function(a,c){if(a)return d(a);d(null,e.parseFnt(c,b))})}};cc.loader.register(["fnt"],_fntLoader);(function(){cc.LabelBMFont.CanvasRenderCmd=function(a){this._rootCtor(a)};var a=cc.LabelBMFont.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.LabelBMFont.CanvasRenderCmd;a._updateCharTexture=function(a,c,d){32===d?a.setTextureRect(c,!1,cc.size(0,0)):(a.setTextureRect(c,!1),a.visible=!0)};a._updateCharColorAndOpacity=function(a){a._displayedColor=this._displayedColor;a._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty);a._displayedOpacity=this._displayedOpacity; a._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty)};a.setTexture=function(a){for(var c=this._node,d=c._children,e=this._displayedColor,f=0;f<d.length;f++){var g=d[f],h=g._renderCmd,k=h._displayedColor;if(c._texture===h._texture||k.r===e.r&&k.g===e.g&&k.b===e.b)g.texture=a}c._texture=a};a._changeTextureColor=function(){var a=this._node,c=a._texture,d=c.getContentSize(),e=a._texture,f=e.getHtmlElementObj(),g=this._displayedColor,h=cc.rect(0,0,f.width,f.height);c&&0<d.width&&f&&(c=e._generateColorTexture(g.r, g.g,g.b,h),a.setTexture(c))};a._updateChildrenDisplayedOpacity=function(a){cc.Node.prototype.updateDisplayedOpacity.call(a,this._displayedOpacity)};a._updateChildrenDisplayedColor=function(a){cc.Node.prototype.updateDisplayedColor.call(a,this._displayedColor)}})();(function(){cc.LabelBMFont.WebGLRenderCmd=function(a){this._rootCtor(a)};var a=cc.LabelBMFont.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.LabelBMFont.WebGLRenderCmd;a.setTexture=function(a){this._node.setOpacityModifyRGB(this._node._texture.hasPremultipliedAlpha())};a._updateCharTexture=function(a,c,d,e){a.setTextureRect(c,e);a.visible=!0};a._changeTextureColor=function(){};a._updateCharColorAndOpacity=function(){}})();cc.LabelAtlas=cc.LabelBMFont.extend({_className:"LabelAtlas",ctor:function(a,b,c,d,e){cc.SpriteBatchNode.prototype.ctor.call(this);this._imageOffset=cc.p(0,0);this._cascadeOpacityEnabled=this._cascadeColorEnabled=!0;b&&cc.LabelAtlas.prototype.initWithString.call(this,a,b,c,d,e)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new cc.LabelBMFont.WebGLRenderCmd(this):new cc.LabelBMFont.CanvasRenderCmd(this)},_createFntConfig:function(a,b,c,d){var e={};e.commonHeight=c; var f=e.fontDefDictionary={},g=a.pixelsWidth;a=a.pixelsHeight;d=d.charCodeAt(0);for(var h=0,k=c;k<=a;k+=c)for(var m=0;m<g;m+=b)f[d+h]={rect:{x:m,y:k-c,width:b,height:c},xOffset:0,yOffset:0,xAdvance:b},++h;e.kerningDict={};return e},initWithString:function(a,b,c,d,e){var f;this._string=this._initialString=a=a+""||"";if(void 0===c){e=cc.loader.getRes(b);if(1!==parseInt(e.version,10))return cc.log("cc.LabelAtlas.initWithString(): Unsupported version. Upgrade cocos2d version"),!1;f=cc.path.changeBasename(b, e.textureFilename);d=cc.contentScaleFactor();c=parseInt(e.itemWidth,10)/d;d=parseInt(e.itemHeight,10)/d;e=String.fromCharCode(parseInt(e.firstChar,10))}else f=b,c=c||0,d=d||0,e=e||" ";if(b){this._fntFile="dummy_fnt_file:"+f;b=f;var g=cc.spriteFrameCache.getSpriteFrame(b)||cc.spriteFrameCache.getSpriteFrame(cc.path.basename(b));g?(b=g.getTexture(),this._spriteFrame=g):b=cc.textureCache.addImage(f);c=this._createFntConfig(b,c,d,e);c.atlasName=f;this._config=c;(this._textureLoaded=f=b.isLoaded())||b.addEventListener("load", function(a){this._textureLoaded=!0;this.initWithTexture(a,this._initialString.length);this.setString(this._initialString,!0);this.dispatchEvent("load")},this)}else b=new cc.Texture2D,f=new Image,b.initWithElement(f),this._textureLoaded=!1;return this.initWithTexture(b,a.length)?(this._alignment=cc.TEXT_ALIGNMENT_LEFT,this._imageOffset=cc.p(0,0),this._width=-1,this._realOpacity=255,this._realColor=cc.color(255,255,255,255),this._contentSize.width=0,this._contentSize.height=0,this.setString(a,!0),!0): !1},setFntFile:function(){cc.warn("setFntFile doesn't support with LabelAtlas.")}});cc.LabelAtlas.create=function(a,b,c,d,e){return new cc.LabelAtlas(a,b,c,d,e)};(function(){cc.LabelAtlas.CanvasRenderCmd=function(a){cc.AtlasNode.CanvasRenderCmd.call(this,a);this._needDraw=!1};var a=cc.LabelAtlas.CanvasRenderCmd.prototype=Object.create(cc.AtlasNode.CanvasRenderCmd.prototype);a.constructor=cc.LabelAtlas.CanvasRenderCmd;a.setCascade=function(){var a=this._node;a._cascadeOpacityEnabled=!0;a._cascadeColorEnabled=!1};a.updateAtlasValues=function(){for(var a=this._node,c=a._string||"",d=c.length,e=this._textureToRender,f=a._itemWidth,g=a._itemHeight,h=0,k=-1;h<d;h++){var m= c.charCodeAt(h)-a._mapStartChar.charCodeAt(0),n=parseInt(m%a._itemsPerRow,10),m=parseInt(m/a._itemsPerRow,10);if(!(0>n||0>m||(n=cc.rect(n*f,m*g,f,g),m=e._contentSize,0>n.x||0>n.y||n.x+n.width>m.width||n.y+n.height>m.height))){k++;var m=c.charCodeAt(h),p=a.getChildByTag(h);p?32===m?(p.init(),p.setTextureRect(cc.rect(0,0,10,10),!1,cc.size(0,0))):(p.initWithTexture(e,n),p.visible=!0):(p=new cc.Sprite,32===m?(p.init(),p.setTextureRect(cc.rect(0,0,10,10),!1,cc.size(0,0))):p.initWithTexture(e,n),cc.Node.prototype.addChild.call(a, p,0,h));p.setPosition(k*f+f/2,g/2)}}this.updateContentSize(h,k+1)};a.updateContentSize=function(a,c){var d=this._node,e=d._contentSize;a!==c&&a*d._itemWidth===e.width&&d._itemHeight===e.height&&d.setContentSize(c*d._itemWidth,d._itemHeight)};a.setString=function(a){a=this._node;if(a._children){a=a._children;for(var c=a.length,d=0;d<c;d++){var e=a[d];e&&!e._lateChild&&(e.visible=!1)}}};a._addChild=function(){child._lateChild=!0}})();(function(){cc.LabelAtlas.WebGLRenderCmd=function(a){cc.AtlasNode.WebGLRenderCmd.call(this,a);this._needDraw=!0};var a=cc.LabelAtlas.WebGLRenderCmd.prototype=Object.create(cc.AtlasNode.WebGLRenderCmd.prototype);a.constructor=cc.LabelAtlas.WebGLRenderCmd;a._updateColor=function(){if(this._colorF32Array){var a=this._displayedColor,c=this._displayedOpacity/255;this._node._opacityModifyRGB?(this._colorF32Array[0]=a.r*c/255,this._colorF32Array[1]=a.g*c/255,this._colorF32Array[2]=a.b*c/255):(this._colorF32Array[0]= a.r/255,this._colorF32Array[1]=a.g/255,this._colorF32Array[2]=a.b/255);this._colorF32Array[3]=c}};a.setCascade=function(){var a=this._node;a._cascadeOpacityEnabled=!0;a._cascadeColorEnabled=!0};a.rendering=function(a){cc.AtlasNode.WebGLRenderCmd.prototype.rendering.call(this,a);if(cc.LABELATLAS_DEBUG_DRAW){var c=this._node;a=c.getContentSize();var c=c.getBoundingBoxToWorld(),d=c.x,e=c.y;a.width=c.width;a.height=c.height;a=[cc.p(d,e),cc.p(d+a.width,e),cc.p(a.width+d,a.height+e),cc.p(d,e+a.height)]; cc._drawingUtil.drawPoly(a,4,!0)}};a.updateAtlasValues=function(){var a=this._node,c=a._string,d=c.length,e=this._textureAtlas,f=e.texture,g=f.pixelsWidth,f=f.pixelsHeight,h=a._itemWidth,k=a._itemHeight;a._ignoreContentScaleFactor||(h=a._itemWidth*cc.contentScaleFactor(),k=a._itemHeight*cc.contentScaleFactor());d>e.getCapacity()&&cc.log("cc.LabelAtlas._updateAtlasValues(): Invalid String length");for(var m=e.quads,n=a._itemWidth,p=a._itemHeight,r=0,s=-1;r<d;r++){var u=c.charCodeAt(r)-a._mapStartChar.charCodeAt(0), t=u%a._itemsPerRow,v=0|u/a._itemsPerRow;if(!(0>t||0>v||t*n+n>g||v*p+p>f)){s++;var w;cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?(t=(2*t*h+1)/(2*g),u=t+(2*h-2)/(2*g),v=(2*v*k+1)/(2*f),w=v+(2*k-2)/(2*f)):(t=t*h/g,u=t+h/g,v=v*k/f,w=v+k/f);var x=m[r],B=x.tl,y=x.tr,z=x.bl,x=x.br;B.texCoords.u=t;B.texCoords.v=v;y.texCoords.u=u;y.texCoords.v=v;z.texCoords.u=t;z.texCoords.v=w;x.texCoords.u=u;x.texCoords.v=w;z.vertices.x=s*n;z.vertices.y=0;z.vertices.z=0;x.vertices.x=s*n+n;x.vertices.y=0;x.vertices.z=0;B.vertices.x= s*n;B.vertices.y=a._itemHeight;B.vertices.z=0;y.vertices.x=s*n+n;y.vertices.y=a._itemHeight;y.vertices.z=0}}this._updateColor();this.updateContentSize(r,s+1);0<d&&(e.dirty=!0,a=e.totalQuads,d>a&&e.increaseTotalQuadsWith(d-a))};a.updateContentSize=function(a,c){var d=this._node,e=d._contentSize;a!==c&&a*d._itemWidth===e.width&&d._itemHeight===e.height&&d.setContentSize(c*d._itemWidth,d._itemHeight)};a.setString=function(a){a=a.length;a>this._textureAtlas.totalQuads&&this._textureAtlas.resizeCapacity(a)}; a._addChild=function(){}})();cc.MotionStreak=cc.Node.extend({texture:null,fastMode:!1,startingPositionInitialized:!1,_blendFunc:null,_stroke:0,_fadeDelta:0,_minSeg:0,_maxPoints:0,_nuPoints:0,_previousNuPoints:0,_pointVertexes:null,_pointState:null,_vertices:null,_colorPointer:null,_texCoords:null,_verticesBuffer:null,_colorPointerBuffer:null,_texCoordsBuffer:null,_className:"MotionStreak",ctor:function(a,b,c,d,e){cc.Node.prototype.ctor.call(this);this._positionR=cc.p(0,0);this._blendFunc=new cc.BlendFunc(cc.SRC_ALPHA,cc.ONE_MINUS_SRC_ALPHA); this.startingPositionInitialized=this.fastMode=!1;this.texture=null;this._previousNuPoints=this._nuPoints=this._maxPoints=this._minSeg=this._fadeDelta=this._stroke=0;this._texCoordsBuffer=this._colorPointerBuffer=this._verticesBuffer=this._texCoords=this._colorPointer=this._vertices=this._pointState=this._pointVertexes=null;void 0!==e&&this.initWithFade(a,b,c,d,e)},getTexture:function(){return this.texture},setTexture:function(a){this.texture!==a&&(this.texture=a)},getBlendFunc:function(){return this._blendFunc}, setBlendFunc:function(a,b){void 0===b?this._blendFunc=a:(this._blendFunc.src=a,this._blendFunc.dst=b)},getOpacity:function(){cc.log("cc.MotionStreak.getOpacity has not been supported.");return 0},setOpacity:function(a){cc.log("cc.MotionStreak.setOpacity has not been supported.")},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},isFastMode:function(){return this.fastMode},setFastMode:function(a){this.fastMode=a},isStartingPositionInitialized:function(){return this.startingPositionInitialized}, setStartingPositionInitialized:function(a){this.startingPositionInitialized=a},getStroke:function(){return this._stroke},setStroke:function(a){this._stroke=a},initWithFade:function(a,b,c,d,e){if(!e)throw Error("cc.MotionStreak.initWithFade(): Invalid filename or texture");cc.isString(e)&&(e=cc.textureCache.addImage(e));cc.Node.prototype.setPosition.call(this,cc.p(0,0));this.anchorY=this.anchorX=0;this.ignoreAnchor=!0;this.startingPositionInitialized=!1;this.fastMode=!0;this._minSeg=-1===b?c/5:b;this._minSeg*= this._minSeg;this._stroke=c;this._fadeDelta=1/a;this._maxPoints=a=(0|60*a)+2;this._nuPoints=0;this._pointState=new Float32Array(a);this._pointVertexes=new Float32Array(2*a);this._vertices=new Float32Array(4*a);this._texCoords=new Float32Array(4*a);this._colorPointer=new Uint8Array(8*a);this._verticesBuffer=gl.createBuffer();this._texCoordsBuffer=gl.createBuffer();this._colorPointerBuffer=gl.createBuffer();this._blendFunc.src=gl.SRC_ALPHA;this._blendFunc.dst=gl.ONE_MINUS_SRC_ALPHA;this.texture=e;this.color= d;this.scheduleUpdate();gl.bindBuffer(gl.ARRAY_BUFFER,this._verticesBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._vertices,gl.DYNAMIC_DRAW);gl.bindBuffer(gl.ARRAY_BUFFER,this._texCoordsBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._texCoords,gl.DYNAMIC_DRAW);gl.bindBuffer(gl.ARRAY_BUFFER,this._colorPointerBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._colorPointer,gl.DYNAMIC_DRAW);return!0},tintWithColor:function(a){this.color=a;for(var b=this._colorPointer,c=0,d=2*this._nuPoints;c<d;c++)b[4*c]=a.r,b[4*c+ 1]=a.g,b[4*c+2]=a.b},reset:function(){this._nuPoints=0},setPosition:function(a,b){this.startingPositionInitialized=!0;void 0===b?(this._positionR.x=a.x,this._positionR.y=a.y):(this._positionR.x=a,this._positionR.y=b)},getPositionX:function(){return this._positionR.x},setPositionX:function(a){this._positionR.x=a;this.startingPositionInitialized||(this.startingPositionInitialized=!0)},getPositionY:function(){return this._positionR.y},setPositionY:function(a){this._positionR.y=a;this.startingPositionInitialized|| (this.startingPositionInitialized=!0)},update:function(a){if(this.startingPositionInitialized){this._renderCmd._updateDisplayColor();a*=this._fadeDelta;var b,c,d,e,f=0,g=this._nuPoints,h=this._pointState,k=this._pointVertexes,m=this._vertices,n=this._colorPointer;for(b=0;b<g;b++)h[b]-=a,0>=h[b]?f++:(c=b-f,0<f?(h[c]=h[b],k[2*c]=k[2*b],k[2*c+1]=k[2*b+1],e=2*b,d=2*c,m[2*d]=m[2*e],m[2*d+1]=m[2*e+1],m[2*(d+1)]=m[2*(e+1)],m[2*(d+1)+1]=m[2*(e+1)+1],e*=4,d*=4,n[d+0]=n[e+0],n[d+1]=n[e+1],n[d+2]=n[e+2],n[d+ 4]=n[e+4],n[d+5]=n[e+5],n[d+6]=n[e+6]):d=8*c,c=255*h[c],n[d+3]=c,n[d+7]=c);g-=f;b=!0;g>=this._maxPoints?b=!1:0<g&&(a=cc.pDistanceSQ(cc.p(k[2*(g-1)],k[2*(g-1)+1]),this._positionR)<this._minSeg,d=1===g?!1:cc.pDistanceSQ(cc.p(k[2*(g-2)],k[2*(g-2)+1]),this._positionR)<2*this._minSeg,a||d)&&(b=!1);b&&(k[2*g]=this._positionR.x,k[2*g+1]=this._positionR.y,h[g]=1,h=8*g,b=this.getDisplayedColor(),n[h]=b.r,n[h+1]=b.g,n[h+2]=b.b,n[h+4]=b.r,n[h+5]=b.g,n[h+6]=b.b,n[h+3]=255,n[h+7]=255,0<g&&this.fastMode&&(1<g? cc.vertexLineToPolygon(k,this._stroke,this._vertices,g,1):cc.vertexLineToPolygon(k,this._stroke,this._vertices,0,2)),g++);this.fastMode||cc.vertexLineToPolygon(k,this._stroke,this._vertices,0,g);if(g&&this._previousNuPoints!==g){k=1/g;n=this._texCoords;for(b=0;b<g;b++)n[4*b]=0,n[4*b+1]=k*b,n[2*(2*b+1)]=1,n[2*(2*b+1)+1]=k*b;this._previousNuPoints=g}this._nuPoints=g}},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new cc.MotionStreak.WebGLRenderCmd(this):null}}); cc.MotionStreak.create=function(a,b,c,d,e){return new cc.MotionStreak(a,b,c,d,e)};cc.MotionStreak.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._matrix=new cc.math.Matrix4;this._matrix.identity();this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLOR)};cc.MotionStreak.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);cc.MotionStreak.WebGLRenderCmd.prototype.constructor=cc.Sprite.WebGLRenderCmd; cc.MotionStreak.WebGLRenderCmd.prototype.rendering=function(a){var b=this._node;if(!(1>=b._nuPoints)&&b.texture&&b.texture.isLoaded()){a=a||cc._renderContext;var c=this._worldTransform;this._matrix.mat[0]=c.a;this._matrix.mat[4]=c.c;this._matrix.mat[12]=c.tx;this._matrix.mat[1]=c.b;this._matrix.mat[5]=c.d;this._matrix.mat[13]=c.ty;this._shaderProgram.use();this._shaderProgram._setUniformForMVPMatrixWithMat4(this._matrix);cc.glBlendFunc(b._blendFunc.src,b._blendFunc.dst);cc.glBindTexture2D(b.texture); a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);a.bindBuffer(a.ARRAY_BUFFER,b._verticesBuffer);a.bufferData(a.ARRAY_BUFFER,b._vertices,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,0,0);a.bindBuffer(a.ARRAY_BUFFER,b._texCoordsBuffer);a.bufferData(a.ARRAY_BUFFER,b._texCoords,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,0,0);a.bindBuffer(a.ARRAY_BUFFER, b._colorPointerBuffer);a.bufferData(a.ARRAY_BUFFER,b._colorPointer,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,0,0);a.drawArrays(a.TRIANGLE_STRIP,0,2*b._nuPoints);cc.g_NumberOfDraws++}};cc.NodeGrid=cc.Node.extend({grid:null,_target:null,_gridRect:null,ctor:function(a){cc.Node.prototype.ctor.call(this);void 0===a&&(a=cc.rect());this._gridRect=a},getGrid:function(){return this.grid},setGrid:function(a){this.grid=a},setGridRect:function(a){this._gridRect=a},getGridRect:function(){return this._gridRect},setTarget:function(a){this._target=a},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new cc.NodeGrid.WebGLRenderCmd(this):new cc.Node.CanvasRenderCmd(this)}}); _p=cc.NodeGrid.prototype;cc.defineGetterSetter(_p,"target",null,_p.setTarget);cc.NodeGrid.create=function(){return new cc.NodeGrid};(function(){cc.NodeGrid.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1;this._gridBeginCommand=new cc.CustomRenderCmd(this,this.onGridBeginDraw);this._gridEndCommand=new cc.CustomRenderCmd(this,this.onGridEndDraw)};var a=cc.NodeGrid.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.NodeGrid.WebGLRenderCmd;a.visit=function(a){var c=this._node;if(c._visible){if(a=a||this.getParentRenderCmd())this._curLevel=a._curLevel+1;var d=cc.current_stack;d.stack.push(d.top); this._syncStatus(a);d.top=this._stackMatrix;cc.renderer.pushRenderCommand(this._gridBeginCommand);c._target&&c._target.visit();if((a=c._children)&&0<a.length){var e=a.length;c.sortAllChildren();for(c=0;c<e;c++){var f=a[c];f&&f.visit()}}cc.renderer.pushRenderCommand(this._gridEndCommand);this._dirtyFlag=0;d.top=d.stack.pop()}};a.onGridBeginDraw=function(){var a=this._node.grid;a&&a._active&&a.beforeDraw()};a.onGridEndDraw=function(){var a=this._node.grid;a&&a._active&&a.afterDraw(this._node)}})();cc.DrawNode=cc.Node.extend({_buffer:null,_blendFunc:null,_lineWidth:1,_drawColor:null,getBlendFunc:function(){return this._blendFunc},setBlendFunc:function(a,b){void 0===b?(this._blendFunc.src=a.src,this._blendFunc.dst=a.dst):(this._blendFunc.src=a,this._blendFunc.dst=b)},setLineWidth:function(a){this._lineWidth=a},getLineWidth:function(){return this._lineWidth},setDrawColor:function(a){var b=this._drawColor;b.r=a.r;b.g=a.g;b.b=a.b;b.a=null==a.a?255:a.a},getDrawColor:function(){return cc.color(this._drawColor.r, this._drawColor.g,this._drawColor.b,this._drawColor.a)}});cc.DrawNode.create=function(){return new cc.DrawNode};cc.DrawNode.TYPE_DOT=0;cc.DrawNode.TYPE_SEGMENT=1;cc.DrawNode.TYPE_POLY=2; cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_CANVAS)cc._DrawNodeElement=function(a,b,c,d,e,f,g,h,k){this.type=a;this.verts=b||null;this.fillColor=c||null;this.lineWidth=d||0;this.lineColor=e||null;this.lineCap=f||"butt";this.isClosePolygon=g||!1;this.isFill=h||!1;this.isStroke=k||!1},cc.extend(cc.DrawNode.prototype,{_className:"DrawNodeCanvas",ctor:function(){cc.Node.prototype.ctor.call(this);var a=this._renderCmd;a._buffer=this._buffer= [];a._drawColor=this._drawColor=cc.color(255,255,255,255);a._blendFunc=this._blendFunc=new cc.BlendFunc(cc.SRC_ALPHA,cc.ONE_MINUS_SRC_ALPHA);this.init();this._localBB=new cc.Rect},setLocalBB:function(a,b,c,d){var e=this._localBB;void 0===b?(e.x=a.x,e.y=a.y,e.width=a.width,e.height=a.height):(e.x=a,e.y=b,e.width=c,e.height=d)},drawRect:function(a,b,c,d,e){d=null==d?this._lineWidth:d;e=e||this.getDrawColor();null==e.a&&(e.a=255);a=[a,cc.p(b.x,a.y),b,cc.p(a.x,b.y)];b=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY); b.verts=a;b.lineWidth=d;b.lineColor=e;b.isClosePolygon=!0;b.isStroke=!0;b.lineCap="butt";if(b.fillColor=c)null==c.a&&(c.a=255),b.isFill=!0;this._buffer.push(b)},drawCircle:function(a,b,c,d,e,f,g){f=f||this._lineWidth;g=g||this.getDrawColor();null==g.a&&(g.a=255);for(var h=2*Math.PI/d,k=[],m=0;m<=d;m++){var y=m*h,z=b*Math.cos(y+c)+a.x,y=b*Math.sin(y+c)+a.y;k.push(cc.p(z,y))}e&&k.push(cc.p(a.x,a.y));a=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);a.verts=k;a.lineWidth=f;a.lineColor=g;a.isClosePolygon= !0;a.isStroke=!0;this._buffer.push(a)},drawQuadBezier:function(a,b,c,d,e,f){e=e||this._lineWidth;f=f||this.getDrawColor();null==f.a&&(f.a=255);for(var g=[],h=0,k=0;k<d;k++){var m=Math.pow(1-h,2)*a.x+2*(1-h)*h*b.x+h*h*c.x,y=Math.pow(1-h,2)*a.y+2*(1-h)*h*b.y+h*h*c.y;g.push(cc.p(m,y));h+=1/d}g.push(cc.p(c.x,c.y));a=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);a.verts=g;a.lineWidth=e;a.lineColor=f;a.isStroke=!0;a.lineCap="round";this._buffer.push(a)},drawCubicBezier:function(a,b,c,d,e,f,g){f=f||this._lineWidth; g=g||this.getDrawColor();null==g.a&&(g.a=255);for(var h=[],k=0,m=0;m<e;m++){var y=Math.pow(1-k,3)*a.x+3*Math.pow(1-k,2)*k*b.x+3*(1-k)*k*k*c.x+k*k*k*d.x,z=Math.pow(1-k,3)*a.y+3*Math.pow(1-k,2)*k*b.y+3*(1-k)*k*k*c.y+k*k*k*d.y;h.push(cc.p(y,z));k+=1/e}h.push(cc.p(d.x,d.y));a=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);a.verts=h;a.lineWidth=f;a.lineColor=g;a.isStroke=!0;a.lineCap="round";this._buffer.push(a)},drawCatmullRom:function(a,b,c,d){this.drawCardinalSpline(a,0.5,b,c,d)},drawCardinalSpline:function(a, b,c,d,e){d=d||this._lineWidth;e=e||this.getDrawColor();null==e.a&&(e.a=255);for(var f=[],g,h,k=1/a.length,m=0;m<c+1;m++)h=m/c,1===h?(g=a.length-1,h=1):(g=0|h/k,h=(h-k*g)/k),g=cc.cardinalSplineAt(cc.getControlPointAt(a,g-1),cc.getControlPointAt(a,g-0),cc.getControlPointAt(a,g+1),cc.getControlPointAt(a,g+2),b,h),f.push(g);a=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);a.verts=f;a.lineWidth=d;a.lineColor=e;a.isStroke=!0;a.lineCap="round";this._buffer.push(a)},drawDot:function(a,b,c){c=c||this.getDrawColor(); null==c.a&&(c.a=255);var d=new cc._DrawNodeElement(cc.DrawNode.TYPE_DOT);d.verts=[a];d.lineWidth=b;d.fillColor=c;this._buffer.push(d)},drawDots:function(a,b,c){if(a&&0!=a.length){c=c||this.getDrawColor();null==c.a&&(c.a=255);for(var d=0,e=a.length;d<e;d++)this.drawDot(a[d],b,c)}},drawSegment:function(a,b,c,d){c=c||this._lineWidth;d=d||this.getDrawColor();null==d.a&&(d.a=255);var e=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);e.verts=[a,b];e.lineWidth=2*c;e.lineColor=d;e.isStroke=!0;e.lineCap="round"; this._buffer.push(e)},drawPoly_:function(a,b,c,d){c=null==c?this._lineWidth:c;d=d||this.getDrawColor();null==d.a&&(d.a=255);var e=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);e.verts=a;e.fillColor=b;e.lineWidth=c;e.lineColor=d;e.isClosePolygon=!0;e.isStroke=!0;e.lineCap="round";b&&(e.isFill=!0);this._buffer.push(e)},drawPoly:function(a,b,c,d){for(var e=[],f=0;f<a.length;f++)e.push(cc.p(a[f].x,a[f].y));return this.drawPoly_(e,b,c,d)},clear:function(){this._buffer.length=0},_createRenderCmd:function(){return new cc.DrawNode.CanvasRenderCmd(this)}}); else if(cc._renderType===cc.game.RENDER_TYPE_WEBGL){var a=null,b=[],c=cc.p(),d=cc.p(),e=new Uint32Array(1),f=cc.p(),g=cc.p(),h=cc.p(),k=cc.p(),m=[];cc.extend(cc.DrawNode.prototype,{_bufferCapacity:0,_vertexCount:0,_offset:0,_occupiedSize:0,_f32Buffer:null,_ui32Buffer:null,_dirty:!1,_className:"DrawNodeWebGL",manualRelease:!1,ctor:function(b,c){cc.Node.prototype.ctor.call(this);a||(a=new GlobalVertexBuffer(cc._renderContext,20*cc.DRAWNODE_TOTAL_VERTICES));this._renderCmd._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_LENGTHTEXTURECOLOR); this._blendFunc=new cc.BlendFunc(cc.SRC_ALPHA,cc.ONE_MINUS_SRC_ALPHA);this._drawColor=cc.color(255,255,255,255);this._bufferCapacity=b||64;this.manualRelease=c;this._dirty=!0},onEnter:function(){this._occupiedSize<this._bufferCapacity&&this._ensureCapacity(this._bufferCapacity)},onExit:function(){this.manualRelease||this.release()},release:function(){0<this._occupiedSize&&(this._vertexCount=0,a.freeBuffer(this._offset,20*this._occupiedSize),this._occupiedSize=0)},_ensureCapacity:function(b){var c= this._occupiedSize,d=this._offset;if(b>c||this._bufferCapacity>c){var e=Math.max(Math.min(c+c,200),b,this._bufferCapacity);0!==c&&(a.freeBuffer(d,20*c),this._occupiedSize=0);b=this._offset=a.requestBuffer(20*e);if(0<=b){this._occupiedSize=this._bufferCapacity=e;this._f32Buffer=new Float32Array(a.data,b,5*this._occupiedSize);this._ui32Buffer=new Uint32Array(a.data,b,5*this._occupiedSize);if(0!==c&&d!==b)for(c=(d+c)/4,b/=4,d/=4;d<c;b++,d++)a.dataArray[b]=a.dataArray[d];return!0}cc.warn("Failed to allocate buffer for DrawNode: buffer for "+ e+" vertices requested");return!1}return!0},drawRect:function(a,c,d,e,f){e=null==e?this._lineWidth:e;f=f||this._drawColor;b.length=0;b.push(a.x,a.y,c.x,a.y,c.x,c.y,a.x,c.y);null==d?this._drawSegments(b,e,f,!0):this.drawPoly(b,d,e,f);b.length=0},drawCircle:function(a,e,f,g,h,k,m){k=k||this._lineWidth;m=m||this._drawColor;var w=2*Math.PI/g,x;for(x=b.length=0;x<=g;x++){var B=x*w,y=e*Math.cos(B+f)+a.x,B=e*Math.sin(B+f)+a.y;b.push(y,B)}h&&b.push(a.x,a.y);k*=0.5;x=0;for(a=b.length-2;x<a;x+=2)c.x=b[x],c.y= b[x+1],d.x=b[x+2],d.y=b[x+3],this.drawSegment(c,d,k,m);b.length=0},drawQuadBezier:function(a,c,d,e,f,g){f=f||this._lineWidth;g=g||this._drawColor;for(var h=0,k=b.length=0;k<e;k++){var m=Math.pow(1-h,2)*a.x+2*(1-h)*h*c.x+h*h*d.x,B=Math.pow(1-h,2)*a.y+2*(1-h)*h*c.y+h*h*d.y;b.push(m,B);h+=1/e}b.push(d.x,d.y);this._drawSegments(b,f,g,!1);b.length=0},drawCubicBezier:function(a,c,d,e,f,g,h){g=g||this._lineWidth;h=h||this._drawColor;for(var k=0,m=b.length=0;m<f;m++){var B=Math.pow(1-k,3)*a.x+3*Math.pow(1- k,2)*k*c.x+3*(1-k)*k*k*d.x+k*k*k*e.x,y=Math.pow(1-k,3)*a.y+3*Math.pow(1-k,2)*k*c.y+3*(1-k)*k*k*d.y+k*k*k*e.y;b.push(B,y);k+=1/f}b.push(e.x,e.y);this._drawSegments(b,g,h,!1);b.length=0},drawCatmullRom:function(a,b,c,d){this.drawCardinalSpline(a,0.5,b,c,d)},drawCardinalSpline:function(a,e,f,g,h){g=g||this._lineWidth;h=h||this._drawColor;for(var k,m,w=1/a.length,x=b.length=0;x<f+1;x++)m=x/f,1===m?(k=a.length-1,m=1):(k=0|m/w,m=(m-w*k)/w),cc.cardinalSplineAt(cc.getControlPointAt(a,k-1),cc.getControlPointAt(a, k-0),cc.getControlPointAt(a,k+1),cc.getControlPointAt(a,k+2),e,m,c),b.push(c.x,c.y);g*=0.5;a=0;for(e=b.length-2;a<e;a+=2)c.x=b[a],c.y=b[a+1],d.x=b[a+2],d.y=b[a+3],this.drawSegment(c,d,g,h);b.length=0},drawDots:function(a,b,c){if(a&&0!==a.length){c=c||this._drawColor;for(var d=0,e=a.length;d<e;d++)this.drawDot(a[d],b,c)}},_render:function(){var b=cc._renderContext;0>this._offset||0>=this._vertexCount||(this._dirty?(a.updateSubData(this._offset,this._f32Buffer),this._dirty=!1):b.bindBuffer(b.ARRAY_BUFFER, a.vertexBuffer),b.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION),b.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR),b.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS),b.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,b.FLOAT,!1,20,0),b.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,b.UNSIGNED_BYTE,!0,20,8),b.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,b.FLOAT,!1,20,12),b.drawArrays(b.TRIANGLES,this._offset/20,this._vertexCount),cc.incrementGLDraws(1))},appendVertexData:function(a,b,c,d, f){var g=this._f32Buffer,h=5*this._vertexCount;g[h]=a;g[h+1]=b;e[0]=c.a<<24|c.b<<16|c.g<<8|c.r;this._ui32Buffer[h+2]=e[0];g[h+3]=d;g[h+4]=f;this._vertexCount++},drawDot:function(a,b,c){c=c||this._drawColor;null==c.a&&(c.a=255);var d=a.x-b,e=a.y-b,f=a.x+b;a=a.y+b;this._ensureCapacity(this._vertexCount+6)&&(this.appendVertexData(d,e,c,-1,-1),this.appendVertexData(d,a,c,-1,1),this.appendVertexData(f,a,c,1,1),this.appendVertexData(d,e,c,-1,-1),this.appendVertexData(f,a,c,1,1),this.appendVertexData(f, e,c,1,-1),this._dirty=!0)},drawSegment:function(a,b,c,d){d=d||this.getDrawColor();null==d.a&&(d.a=255);c=c||0.5*this._lineWidth;if(this._ensureCapacity(this._vertexCount+18)){f.x=a.y-b.y;f.y=b.x-a.x;cc.pNormalizeIn(f);g.x=-f.y;g.y=f.x;var e=c;h.x=f.x*e;h.y=f.y*e;k.x=g.x*c;k.y=g.y*c;c=b.x+h.x-k.x;var e=b.y+h.y-k.y,m=f.x-g.x,v=f.y-g.y,w=b.x-h.x,x=b.y-h.y,B=-f.x,y=-f.y,z=b.x+h.x,C=b.y+h.y,A=f.x,D=f.y,F=a.x-h.x,M=a.y-h.y,E=a.x+h.x,N=a.y+h.y,Q=f.x,H=f.y,R=a.x-h.x+k.x,K=a.y-h.y+k.y,I=g.x-f.x,P=g.y-f.y, T=a.x+h.x+k.x;a=a.y+h.y+k.y;var S=f.x+g.x,O=f.y+g.y;this.appendVertexData(b.x-h.x-k.x,b.y-h.y-k.y,d,-(f.x+g.x),-(f.y+g.y));this.appendVertexData(c,e,d,m,v);this.appendVertexData(w,x,d,B,y);this.appendVertexData(z,C,d,A,D);this.appendVertexData(c,e,d,m,v);this.appendVertexData(w,x,d,B,y);this.appendVertexData(z,C,d,A,D);this.appendVertexData(F,M,d,B,y);this.appendVertexData(w,x,d,B,y);this.appendVertexData(z,C,d,A,D);this.appendVertexData(F,M,d,B,y);this.appendVertexData(E,N,d,Q,H);this.appendVertexData(R, K,d,I,P);this.appendVertexData(F,M,d,B,y);this.appendVertexData(E,N,d,Q,H);this.appendVertexData(R,K,d,I,P);this.appendVertexData(T,a,d,S,O);this.appendVertexData(E,N,d,Q,H);this._dirty=!0}},drawPoly:function(a,c,d,e){if("object"===typeof a[0]){for(var g=b.length=0;g<a.length;g++)b.push(a[g].x,a[g].y);a=b}if(null==c)this._drawSegments(a,d,e,!0);else{null==c.a&&(c.a=255);null==e.a&&(e.a=255);d=null==d?this._lineWidth:d;d*=0.5;for(var k,v,w,x,B,y,z,C=a.length,g=m.length=0;g<C;g+=2)k=a[(g-2+C)%C],v= a[(g-1+C)%C],w=a[g],x=a[g+1],B=a[(g+2)%C],y=a[(g+3)%C],f.x=v-x,f.y=w-k,h.x=x-y,h.y=B-w,cc.pNormalizeIn(f),cc.pNormalizeIn(h),x=f.x*h.x+f.y*h.y+1,z=(f.x+h.x)/x,x=(f.y+h.y)/x,m.push(z,x,h.x,h.y);C/=2;z=0<d;if(this._ensureCapacity(this._vertexCount+3*(3*C-2))){for(var A=!1==z?0.5:0,g=0;g<C-2;g++)k=a[0]-m[0]*A,v=a[1]-m[1]*A,w=a[2*g+2]-m[4*(g+1)]*A,x=a[2*g+3]-m[4*(g+1)+1]*A,B=a[2*g+4]-m[4*(g+2)]*A,y=a[2*g+5]-m[4*(g+2)+1]*A,this.appendVertexData(k,v,c,0,0),this.appendVertexData(w,x,c,0,0),this.appendVertexData(B, y,c,0,0);var D,F,M,E;d=z?d:0.5;c=z?e:c;for(g=0;g<C;g++)e=(g+1)%C,k=a[2*g],v=a[2*g+1],w=a[2*e],x=a[2*e+1],f.x=m[4*g+2],f.y=m[4*g+3],h.x=z?-f.x:0,h.y=z?-f.y:0,D=m[4*g],F=m[4*g+1],M=m[4*e],E=m[4*e+1],e=k-D*d,B=v-F*d,y=w-M*d,A=x-E*d,k+=D*d,v+=F*d,w+=M*d,x+=E*d,this.appendVertexData(e,B,c,h.x,h.y),this.appendVertexData(y,A,c,h.x,h.y),this.appendVertexData(w,x,c,f.x,f.y),this.appendVertexData(e,B,c,h.x,h.y),this.appendVertexData(k,v,c,f.x,f.y),this.appendVertexData(w,x,c,f.x,f.y);m.length=0;b.length=0; this._dirty=!0}}},_drawSegments:function(a,b,c,d){b=null==b?this._lineWidth:b;if(!(0>=b)){c=c||this._drawColor;null==c.a&&(c.a=255);b*=0.5;var e,g,k,w,x,B,y,z=a.length;for(y=m.length=0;y<z;y+=2)e=a[(y-2+z)%z],g=a[(y-1+z)%z],k=a[y],w=a[y+1],x=a[(y+2)%z],B=a[(y+3)%z],f.x=g-w,f.y=k-e,h.x=w-B,h.y=x-k,cc.pNormalizeIn(f),cc.pNormalizeIn(h),k=f.x*h.x+f.y*h.y+1,w=(f.x+h.x)/k,k=(f.y+h.y)/k,m.push(w,k,h.x,h.y);z/=2;if(this._ensureCapacity(this._vertexCount+3*(3*z-2))){d=d?z:z-1;var C,A,D,F,M,E;for(y=0;y<d;y++)x= (y+1)%z,e=a[2*y],g=a[2*y+1],k=a[2*x],w=a[2*x+1],f.x=m[4*y+2],f.y=m[4*y+3],C=m[4*y],A=m[4*y+1],D=m[4*x],F=m[4*x+1],x=e-C*b,B=g-A*b,M=k-D*b,E=w-F*b,e+=C*b,g+=A*b,k+=D*b,w+=F*b,this.appendVertexData(x,B,c,-f.x,-f.y),this.appendVertexData(M,E,c,-f.x,-f.y),this.appendVertexData(k,w,c,f.x,f.y),this.appendVertexData(x,B,c,-f.x,-f.y),this.appendVertexData(e,g,c,f.x,f.y),this.appendVertexData(k,w,c,f.x,f.y);m.length=0;this._dirty=!0}}},clear:function(){this.release();this._dirty=!0},_createRenderCmd:function(){return new cc.DrawNode.WebGLRenderCmd(this)}})}});(function(){cc.DrawNode.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._blendFunc=this._drawColor=this._buffer=null};cc.DrawNode.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);cc.DrawNode.CanvasRenderCmd.prototype.constructor=cc.DrawNode.CanvasRenderCmd;cc.DrawNode.CanvasRenderCmd.prototype.getLocalBB=function(){return this._node._localBB};cc.extend(cc.DrawNode.CanvasRenderCmd.prototype,{rendering:function(a,b,c){a=a||cc._renderContext;a.getContext(); var d=this._node._displayedOpacity/255;if(0!==d){a.setTransform(this._worldTransform,b,c);a.setGlobalAlpha(d);this._blendFunc&&this._blendFunc.src===cc.SRC_ALPHA&&this._blendFunc.dst===cc.ONE&&a.setCompositeOperation("lighter");for(var d=this._buffer,e=0,f=d.length;e<f;e++){var g=d[e];switch(g.type){case cc.DrawNode.TYPE_DOT:this._drawDot(a,g,b,c);break;case cc.DrawNode.TYPE_SEGMENT:this._drawSegment(a,g,b,c);break;case cc.DrawNode.TYPE_POLY:this._drawPoly(a,g,b,c)}}}},_drawDot:function(a,b){var c= b.fillColor,d=b.verts[0],e=b.lineWidth,f=a.getContext();a.setFillStyle("rgba("+(0|c.r)+","+(0|c.g)+","+(0|c.b)+","+c.a/255+")");f.beginPath();f.arc(d.x,-d.y,e,0,2*Math.PI,!1);f.closePath();f.fill()},_drawSegment:function(a,b,c){var d=b.lineColor,e=b.verts[0],f=b.verts[1],g=b.lineWidth;b=b.lineCap;var h=a.getContext();a.setStrokeStyle("rgba("+(0|d.r)+","+(0|d.g)+","+(0|d.b)+","+d.a/255+")");h.lineWidth=g*c;h.beginPath();h.lineCap=b;h.moveTo(e.x,-e.y);h.lineTo(f.x,-f.y);h.stroke()},_drawPoly:function(a, b,c){var d=b.verts,e=b.lineCap;if(null!=d){var f=b.fillColor,g=b.lineWidth,h=b.lineColor,k=b.isClosePolygon,m=b.isFill;b=b.isStroke;var n=a.getContext(),p=d[0];n.lineCap=e;f&&a.setFillStyle("rgba("+(0|f.r)+","+(0|f.g)+","+(0|f.b)+","+f.a/255+")");g&&(n.lineWidth=g*c);h&&a.setStrokeStyle("rgba("+(0|h.r)+","+(0|h.g)+","+(0|h.b)+","+h.a/255+")");n.beginPath();n.moveTo(p.x,-p.y);a=1;for(c=d.length;a<c;a++)n.lineTo(d[a].x,-d[a].y);k&&n.closePath();m&&n.fill();b&&n.stroke()}}})})();(function(){cc.DrawNode.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._matrix=new cc.math.Matrix4;this._matrix.identity()};cc.DrawNode.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);cc.DrawNode.WebGLRenderCmd.prototype.constructor=cc.DrawNode.WebGLRenderCmd;cc.DrawNode.WebGLRenderCmd.prototype.rendering=function(a){a=this._node;if(0<a._vertexCount){var b=this._worldTransform;this._matrix.mat[0]=b.a;this._matrix.mat[4]=b.c;this._matrix.mat[12]=b.tx;this._matrix.mat[1]= b.b;this._matrix.mat[5]=b.d;this._matrix.mat[13]=b.ty;cc.glBlendFunc(a._blendFunc.src,a._blendFunc.dst);this._shaderProgram.use();this._shaderProgram._setUniformForMVPMatrixWithMat4(this._matrix);a._render()}}})();cc.stencilBits=-1; cc.ClippingNode=cc.Node.extend({inverted:!1,_alphaThreshold:0,_stencil:null,_className:"ClippingNode",_originStencilProgram:null,ctor:function(a){a=a||null;cc.Node.prototype.ctor.call(this);if(this._stencil=a)this._originStencilProgram=a.getShaderProgram();this.alphaThreshold=1;this.inverted=!1;this._renderCmd.initStencilBits()},onEnter:function(){cc.Node.prototype.onEnter.call(this);this._stencil&&this._stencil._performRecursive(cc.Node._stateCallbackType.onEnter)},onEnterTransitionDidFinish:function(){cc.Node.prototype.onEnterTransitionDidFinish.call(this);this._stencil&& this._stencil._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish)},onExitTransitionDidStart:function(){this._stencil._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart);cc.Node.prototype.onExitTransitionDidStart.call(this)},onExit:function(){this._stencil._performRecursive(cc.Node._stateCallbackType.onExit);cc.Node.prototype.onExit.call(this)},visit:function(a){this._visible&&this._renderCmd.clippingVisit(a&&a._renderCmd)},_visitChildren:function(){this._reorderChildDirty&& this.sortAllChildren();for(var a=this._children,b,c=0,d=a.length;c<d;c++)(b=a[c])&&b._visible&&b.visit(this);this._renderCmd._dirtyFlag=0},getAlphaThreshold:function(){return this._alphaThreshold},setAlphaThreshold:function(a){1===a&&a!==this._alphaThreshold&&this._renderCmd.resetProgramByStencil();this._alphaThreshold=a},isInverted:function(){return this.inverted},setInverted:function(a){this.inverted=a},getStencil:function(){return this._stencil},setStencil:function(a){this._stencil!==a&&(a&&(this._originStencilProgram= a.getShaderProgram()),this._renderCmd.setStencil(a))},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.ClippingNode.CanvasRenderCmd(this):new cc.ClippingNode.WebGLRenderCmd(this)}});_p=cc.ClippingNode.prototype;cc.defineGetterSetter(_p,"stencil",_p.getStencil,_p.setStencil);cc.defineGetterSetter(_p,"alphaThreshold",_p.getAlphaThreshold,_p.setAlphaThreshold);cc.ClippingNode.create=function(a){return new cc.ClippingNode(a)};(function(){cc.ClippingNode.CanvasRenderCmd=function(a){this._rootCtor(a);this._clipElemType=this._godhelpme=this._needDraw=!1;this._rendererSaveCmd=new cc.CustomRenderCmd(this,this._saveCmdCallback);this._rendererClipCmd=new cc.CustomRenderCmd(this,this._clipCmdCallback);this._rendererRestoreCmd=new cc.CustomRenderCmd(this,this._restoreCmdCallback)};var a=cc.ClippingNode.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.ClippingNode.CanvasRenderCmd;a.resetProgramByStencil= function(){};a.initStencilBits=function(){};a.setStencil=function(a){if(null!=a)if(this._node._stencil=a,a instanceof cc.DrawNode){if(a._buffer)for(var c=0;c<a._buffer.length;c++)a._buffer[c].isFill=!1,a._buffer[c].isStroke=!1;a._renderCmd.rendering=function(a,b,c){};a._renderCmd._canUseDirtyRegion=!0;this._rendererSaveCmd._canUseDirtyRegion=!0;this._rendererClipCmd._canUseDirtyRegion=!0;this._rendererRestoreCmd._canUseDirtyRegion=!0}else a._parent=this._node};a._saveCmdCallback=function(a,c,d){var e= a||cc._renderContext;a=e.getContext();this._clipElemType?(c=cc.ClippingNode.CanvasRenderCmd._getSharedCache(),d=a.canvas,c.width=d.width,c.height=d.height,c.getContext("2d").drawImage(d,0,0)):(e.save(),e.setTransform(this._worldTransform,c,d),this._node.inverted&&(a.beginPath(),a.rect(0,0,a.canvas.width,-a.canvas.height),a.clip()))};a._setStencilCompositionOperation=function(a){if(a){var c=this._node;a._renderCmd&&a._renderCmd._blendFuncStr&&(a._renderCmd._blendFuncStr=c.inverted?"destination-out": "destination-in");if(a._children){a=a._children;for(var c=0,d=a.length;c<d;c++)this._setStencilCompositionOperation(a[c])}}};a._clipCmdCallback=function(a){var c=this._node;a=(a||cc._renderContext).getContext();if(this._clipElemType)this._setStencilCompositionOperation(c._stencil);else{c=this._node._stencil;if(c instanceof cc.DrawNode){a.beginPath();var d=c._renderCmd._transform;a.transform(d.a,d.b,d.c,d.d,d.tx,-d.ty);for(d=0;d<c._buffer.length;d++){var e=c._buffer[d].verts,f=e[0];a.moveTo(f.x,-f.y); for(f=e.length-1;0<f;f--)a.lineTo(e[f].x,-e[f].y)}}a.clip()}};a._restoreCmdCallback=function(a){var c=cc.ClippingNode.CanvasRenderCmd._getSharedCache();a=a||cc._renderContext;var d=a.getContext();this._clipElemType?(d.save(),d.setTransform(1,0,0,1,0,0),d.globalCompositeOperation="destination-over",d.drawImage(c,0,0),d.restore(),this._dirtyFlag=0):a.restore()};a.transform=function(a,c){this.originTransform(a,c);var d=this._node;d._stencil&&d._stencil._renderCmd&&(d._stencil._renderCmd.transform(this, !0),d._stencil._dirtyFlag&=~cc.Node._dirtyFlags.transformDirty)};a._cangodhelpme=function(a){if(!0===a||!1===a)cc.ClippingNode.CanvasRenderCmd.prototype._godhelpme=a;return cc.ClippingNode.CanvasRenderCmd.prototype._godhelpme};a.clippingVisit=function(a){var c=this._node;a=a||this.getParentRenderCmd();this.visit(a);this._clipElemType=!(!this._cangodhelpme()&&c._stencil instanceof cc.DrawNode);if(c._stencil&&c._stencil.visible){cc.renderer.pushRenderCommand(this._rendererSaveCmd);this._clipElemType? c._visitChildren():c._stencil.visit(c);cc.renderer.pushRenderCommand(this._rendererClipCmd);if(this._clipElemType)c._stencil.visit(c);else{this._cangodhelpme(!0);a=c._children;var d,e=a.length;if(0<e)for(c.sortAllChildren(),d=0;d<e;d++)a[d].visit(c);this._cangodhelpme(!1)}cc.renderer.pushRenderCommand(this._rendererRestoreCmd);this._dirtyFlag=0}else this.inverted&&c._visitChildren()};cc.ClippingNode.CanvasRenderCmd._sharedCache=null;cc.ClippingNode.CanvasRenderCmd._getSharedCache=function(){return cc.ClippingNode.CanvasRenderCmd._sharedCache|| (cc.ClippingNode.CanvasRenderCmd._sharedCache=document.createElement("canvas"))}})();(function(){cc.ClippingNode.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1;this._beforeVisitCmd=new cc.CustomRenderCmd(this,this._onBeforeVisit);this._afterDrawStencilCmd=new cc.CustomRenderCmd(this,this._onAfterDrawStencil);this._afterVisitCmd=new cc.CustomRenderCmd(this,this._onAfterVisit);this._mask_layer_le=this._currentStencilEnabled=null};var a=cc.ClippingNode.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.ClippingNode.WebGLRenderCmd; cc.ClippingNode.WebGLRenderCmd._init_once=null;cc.ClippingNode.WebGLRenderCmd._visit_once=null;cc.ClippingNode.WebGLRenderCmd._layer=-1;a.initStencilBits=function(){cc.ClippingNode.WebGLRenderCmd._init_once=!0;cc.ClippingNode.WebGLRenderCmd._init_once&&(cc.stencilBits=cc._renderContext.getParameter(cc._renderContext.STENCIL_BITS),0>=cc.stencilBits&&cc.log("Stencil buffer is not enabled."),cc.ClippingNode.WebGLRenderCmd._init_once=!1)};a.transform=function(a,c){var d=this._node;this.originTransform(a, c);d._stencil&&(d._stencil._renderCmd.transform(this,!0),d._stencil._dirtyFlag&=~cc.Node._dirtyFlags.transformDirty)};a.clippingVisit=function(a){var c=this._node;a=a||this.getParentRenderCmd();this.visit(a);if(1>cc.stencilBits)c._visitChildren();else if(c._stencil&&c._stencil.visible)if(cc.ClippingNode.WebGLRenderCmd._layer+1===cc.stencilBits)cc.ClippingNode.WebGLRenderCmd._visit_once=!0,cc.ClippingNode.WebGLRenderCmd._visit_once&&(cc.log("Nesting more than "+cc.stencilBits+"stencils is not supported. Everything will be drawn without stencil for this node and its children."), cc.ClippingNode.WebGLRenderCmd._visit_once=!1),c._visitChildren();else{cc.renderer.pushRenderCommand(this._beforeVisitCmd);c._stencil.visit(c);cc.renderer.pushRenderCommand(this._afterDrawStencilCmd);if((a=c._children)&&0<a.length){var d=a.length;c.sortAllChildren();for(var e=0;e<d;e++)a[e].visit(c)}cc.renderer.pushRenderCommand(this._afterVisitCmd);this._dirtyFlag=0}else c.inverted&&c._visitChildren()};a.setStencil=function(a){var c=this._node;c._stencil&&(c._stencil._parent=null);c._stencil=a;c._stencil&& (c._stencil._parent=c)};a.resetProgramByStencil=function(){var a=this._node;a._stencil&&cc.setProgram(a._stencil,a._originStencilProgram)};a._onBeforeVisit=function(a){var c=a||cc._renderContext;a=this._node;cc.ClippingNode.WebGLRenderCmd._layer++;var d=1<<cc.ClippingNode.WebGLRenderCmd._layer;this._mask_layer_le=d|d-1;this._currentStencilEnabled=c.isEnabled(c.STENCIL_TEST);c.clear(c.DEPTH_BUFFER_BIT);c.enable(c.STENCIL_TEST);c.depthMask(!1);c.stencilFunc(c.NEVER,d,d);c.stencilOp(c.REPLACE,c.KEEP, c.KEEP);c.stencilMask(d);c.clear(c.STENCIL_BUFFER_BIT);1>a.alphaThreshold&&(c=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST),cc.glUseProgram(c.getProgram()),c.setUniformLocationWith1f(cc.UNIFORM_ALPHA_TEST_VALUE_S,a.alphaThreshold),c.setUniformLocationWithMatrix4fv(cc.UNIFORM_MVMATRIX_S,cc.renderer.mat4Identity.mat),cc.setProgram(a._stencil,c))};a._onAfterDrawStencil=function(a){a=a||cc._renderContext;a.depthMask(!0);a.stencilFunc(this._node.inverted?a.NOTEQUAL:a.EQUAL,this._mask_layer_le, this._mask_layer_le);a.stencilOp(a.KEEP,a.KEEP,a.KEEP)};a._onAfterVisit=function(a){a=a||cc._renderContext;cc.ClippingNode.WebGLRenderCmd._layer--;if(this._currentStencilEnabled){var c=1<<cc.ClippingNode.WebGLRenderCmd._layer,d=c|c-1;a.stencilMask(c);a.stencilFunc(a.EQUAL,d,d)}else a.disable(a.STENCIL_TEST)}})();cc.GridBase=cc.Class.extend({_active:!1,_reuseGrid:0,_gridSize:null,_gridRect:null,_texture:null,_step:null,_grabber:null,_isTextureFlipped:!1,_shaderProgram:null,_directorProjection:0,_dirty:!1,ctor:function(a,b,c,d){cc.sys._checkWebGLRenderMode();this._active=!1;this._reuseGrid=0;this._gridSize=null;this._gridRect=new cc.rect;this._texture=null;this._step=cc.p(0,0);this._grabber=null;this._isTextureFlipped=!1;this._shaderProgram=null;this._directorProjection=0;this._dirty=!1;void 0!==a&&this.initWithSize(a, b,c,d)},isActive:function(){return this._active},setActive:function(a){this._active=a;if(!a){a=cc.director;var b=a.getProjection();a.setProjection(b)}},getReuseGrid:function(){return this._reuseGrid},setReuseGrid:function(a){this._reuseGrid=a},getGridSize:function(){return cc.size(this._gridSize.width,this._gridSize.height)},setGridSize:function(a){this._gridSize.width=parseInt(a.width);this._gridSize.height=parseInt(a.height)},setGridRect:function(a){this._gridRect=a},getGridRect:function(){return this._gridRect}, getStep:function(){return cc.p(this._step.x,this._step.y)},setStep:function(a){this._step.x=a.x;this._step.y=a.y},isTextureFlipped:function(){return this._isTextureFlipped},setTextureFlipped:function(a){this._isTextureFlipped!==a&&(this._isTextureFlipped=a,this.calculateVertexPoints())},initWithSize:function(a,b,c,d){if(!b){var e=cc.director.getWinSizeInPixels(),f=cc.NextPOT(e.width),g=cc.NextPOT(e.height),h=new Uint8Array(f*g*4);if(!h)return cc.log("cocos2d: CCGrid: not enough memory."),!1;b=new cc.Texture2D; b.initWithData(h,cc.Texture2D.PIXEL_FORMAT_RGBA8888,f,g,e);if(!b)return cc.log("cocos2d: CCGrid: error creating texture"),!1}this._active=!1;this._reuseGrid=0;this._gridSize=a;this._texture=b;this._isTextureFlipped=c||!1;if(void 0===d||cc._rectEqualToZero(d))b=this._texture.getContentSize(),d=new cc.rect(0,0,b.width,b.height);this._gridRect=d;this._step.x=this._gridRect.width/a.width;this._step.y=this._gridRect.height/a.height;this._grabber=new cc.Grabber;if(!this._grabber)return!1;this._grabber.grab(this._texture); this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURE);this.calculateVertexPoints();return!0},beforeDraw:function(){this._directorProjection=cc.director.getProjection();var a=cc.director.getWinSizeInPixels();gl.viewport(0,0,a.width,a.height);this._grabber.beforeRender(this._texture)},afterDraw:function(a){this._grabber.afterRender(this._texture);cc.director.setViewport();cc.glBindTexture2D(this._texture);this.beforeBlit();this.blit(a);this.afterBlit()},beforeBlit:function(){}, afterBlit:function(){},blit:function(){cc.log("cc.GridBase.blit(): Shall be overridden in subclass.")},reuse:function(){cc.log("cc.GridBase.reuse(): Shall be overridden in subclass.")},calculateVertexPoints:function(){cc.log("cc.GridBase.calculateVertexPoints(): Shall be overridden in subclass.")},set2DProjection:function(){var a=cc.director.getWinSizeInPixels();cc._renderContext.viewport(0,0,a.width,a.height);cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLLoadIdentity();a=cc.math.Matrix4.createOrthographicProjection(0, a.width,0,a.height,-1,1);cc.kmGLMultMatrix(a);cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLLoadIdentity();cc.setProjectionMatrixDirty()}});cc.GridBase.create=function(a,b,c,d){return new cc.GridBase(a,b,c,d)}; cc.Grid3D=cc.GridBase.extend({_texCoordinates:null,_vertices:null,_originalVertices:null,_indices:null,_texCoordinateBuffer:null,_verticesBuffer:null,_indicesBuffer:null,_needDepthTestForBlit:!1,_oldDepthTestValue:!1,_oldDepthWriteValue:!1,ctor:function(a,b,c,d){cc.GridBase.prototype.ctor.call(this);this._indicesBuffer=this._verticesBuffer=this._texCoordinateBuffer=this._indices=this._originalVertices=this._vertices=this._texCoordinates=null;this._matrix=new cc.math.Matrix4;this._matrix.identity(); void 0!==a&&this.initWithSize(a,b,c,d)},vertex:function(a){return this.getVertex(a)},getVertex:function(a){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.Grid3D.vertex() : Numbers must be integers");a=0|3*(a.x*(this._gridSize.height+1)+a.y);var b=this._vertices;return new cc.Vertex3F(b[a],b[a+1],b[a+2])},originalVertex:function(a){return this.getOriginalVertex(a)},getOriginalVertex:function(a){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.Grid3D.originalVertex() : Numbers must be integers");a=0|3*(a.x*(this._gridSize.height+ 1)+a.y);var b=this._originalVertices;return new cc.Vertex3F(b[a],b[a+1],b[a+2])},setVertex:function(a,b){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.Grid3D.setVertex() : Numbers must be integers");var c=0|3*(a.x*(this._gridSize.height+1)+a.y),d=this._vertices;d[c]=b.x;d[c+1]=b.y;d[c+2]=b.z;this._dirty=!0},beforeBlit:function(){if(this._needDepthTestForBlit){var a=cc._renderContext;this._oldDepthTestValue=a.isEnabled(a.DEPTH_TEST);this._oldDepthWriteValue=a.getParameter(a.DEPTH_WRITEMASK);a.enable(a.DEPTH_TEST); a.depthMask(!0)}},afterBlit:function(){if(this._needDepthTestForBlit){var a=cc._renderContext;this._oldDepthTestValue?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST);a.depthMask(this._oldDepthWriteValue)}},blit:function(a){var b=this._gridSize.width*this._gridSize.height;a=a._renderCmd._worldTransform;this._matrix.mat[0]=a.a;this._matrix.mat[4]=a.c;this._matrix.mat[12]=a.tx;this._matrix.mat[1]=a.b;this._matrix.mat[5]=a.d;this._matrix.mat[13]=a.ty;this._shaderProgram.use();this._shaderProgram._setUniformForMVPMatrixWithMat4(this._matrix); a=cc._renderContext;var c=this._dirty;a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);a.bindBuffer(a.ARRAY_BUFFER,this._verticesBuffer);c&&a.bufferData(a.ARRAY_BUFFER,this._vertices,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,a.FLOAT,!1,0,0);a.bindBuffer(a.ARRAY_BUFFER,this._texCoordinateBuffer);c&&a.bufferData(a.ARRAY_BUFFER,this._texCoordinates,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT, !1,0,0);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._indicesBuffer);c&&a.bufferData(a.ELEMENT_ARRAY_BUFFER,this._indices,a.STATIC_DRAW);a.drawElements(a.TRIANGLES,6*b,a.UNSIGNED_SHORT,0);c&&(this._dirty=!1);cc.incrementGLDraws(1)},reuse:function(){if(0<this._reuseGrid){for(var a=this._originalVertices,b=this._vertices,c=0,d=this._vertices.length;c<d;c++)a[c]=b[c];--this._reuseGrid}},calculateVertexPoints:function(){var a=cc._renderContext,b=this._texture.pixelsWidth,c=this._texture.pixelsHeight,d=this._texture.getContentSizeInPixels().height, e=this._gridSize,f=(e.width+1)*(e.height+1);this._vertices=new Float32Array(3*f);this._texCoordinates=new Float32Array(2*f);this._indices=new Uint16Array(e.width*e.height*6);this._verticesBuffer&&a.deleteBuffer(this._verticesBuffer);this._verticesBuffer=a.createBuffer();this._texCoordinateBuffer&&a.deleteBuffer(this._texCoordinateBuffer);this._texCoordinateBuffer=a.createBuffer();this._indicesBuffer&&a.deleteBuffer(this._indicesBuffer);this._indicesBuffer=a.createBuffer();for(var g,h,k=this._indices, m=this._texCoordinates,n=this._isTextureFlipped,p=this._vertices,f=0;f<e.width;++f)for(g=0;g<e.height;++g){var r=g*e.width+f;h=f*this._step.x+this._gridRect.x;var s=h+this._step.x,u=g*this._step.y+this._gridRect.y,t=u+this._step.y,v=f*(e.height+1)+g,w=(f+1)*(e.height+1)+g,x=(f+1)*(e.height+1)+(g+1),B=f*(e.height+1)+(g+1);k[6*r]=v;k[6*r+1]=w;k[6*r+2]=B;k[6*r+3]=w;k[6*r+4]=x;k[6*r+5]=B;var r=[3*v,3*w,3*x,3*B],y=[{x:h,y:u,z:0},{x:s,y:u,z:0},{x:s,y:t,z:0},{x:h,y:t,z:0}],v=[2*v,2*w,2*x,2*B],s=[cc.p(h, u),cc.p(s,u),cc.p(s,t),cc.p(h,t)];for(h=0;4>h;++h)p[r[h]]=y[h].x,p[r[h]+1]=y[h].y,p[r[h]+2]=y[h].z,m[v[h]]=s[h].x/b,m[v[h]+1]=n?(d-s[h].y)/c:s[h].y/c}this._originalVertices=new Float32Array(this._vertices);a.bindBuffer(a.ARRAY_BUFFER,this._verticesBuffer);a.bufferData(a.ARRAY_BUFFER,this._vertices,a.DYNAMIC_DRAW);a.bindBuffer(a.ARRAY_BUFFER,this._texCoordinateBuffer);a.bufferData(a.ARRAY_BUFFER,this._texCoordinates,a.DYNAMIC_DRAW);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._indicesBuffer);a.bufferData(a.ELEMENT_ARRAY_BUFFER, this._indices,a.STATIC_DRAW);this._dirty=!0},setNeedDepthTestForBlit:function(a){this._needDepthTestForBlit=a},getNeedDepthTestForBlit:function(){return this._needDepthTestForBlit}});cc.Grid3D.create=function(a,b,c){return new cc.Grid3D(a,b,c)}; cc.TiledGrid3D=cc.GridBase.extend({_texCoordinates:null,_vertices:null,_originalVertices:null,_indices:null,_texCoordinateBuffer:null,_verticesBuffer:null,_indicesBuffer:null,ctor:function(a,b,c,d){cc.GridBase.prototype.ctor.call(this);this._indicesBuffer=this._verticesBuffer=this._texCoordinateBuffer=this._indices=this._originalVertices=this._vertices=this._texCoordinates=null;this._matrix=new cc.math.Matrix4;this._matrix.identity();void 0!==a&&this.initWithSize(a,b,c,d)},tile:function(a){return this.getTile(a)}, getTile:function(a){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.TiledGrid3D.tile() : Numbers must be integers");a=12*(this._gridSize.height*a.x+a.y);var b=this._vertices;return new cc.Quad3(new cc.Vertex3F(b[a],b[a+1],b[a+2]),new cc.Vertex3F(b[a+3],b[a+4],b[a+5]),new cc.Vertex3F(b[a+6],b[a+7],b[a+8]),new cc.Vertex3F(b[a+9],b[a+10],b[a+11]))},getOriginalTile:function(a){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.TiledGrid3D.originalTile() : Numbers must be integers");a=12*(this._gridSize.height*a.x+a.y); var b=this._originalVertices;return new cc.Quad3(new cc.Vertex3F(b[a],b[a+1],b[a+2]),new cc.Vertex3F(b[a+3],b[a+4],b[a+5]),new cc.Vertex3F(b[a+6],b[a+7],b[a+8]),new cc.Vertex3F(b[a+9],b[a+10],b[a+11]))},originalTile:function(a){return this.getOriginalTile(a)},setTile:function(a,b){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.TiledGrid3D.setTile() : Numbers must be integers");var c=12*(this._gridSize.height*a.x+a.y),d=this._vertices;d[c]=b.bl.x;d[c+1]=b.bl.y;d[c+2]=b.bl.z;d[c+3]=b.br.x;d[c+4]=b.br.y;d[c+ 5]=b.br.z;d[c+6]=b.tl.x;d[c+7]=b.tl.y;d[c+8]=b.tl.z;d[c+9]=b.tr.x;d[c+10]=b.tr.y;d[c+11]=b.tr.z;this._dirty=!0},blit:function(a){var b=this._gridSize.width*this._gridSize.height;a=a._renderCmd._worldTransform;this._matrix.mat[0]=a.a;this._matrix.mat[4]=a.c;this._matrix.mat[12]=a.tx;this._matrix.mat[1]=a.b;this._matrix.mat[5]=a.d;this._matrix.mat[13]=a.ty;this._shaderProgram.use();this._shaderProgram._setUniformForMVPMatrixWithMat4(this._matrix);a=cc._renderContext;var c=this._dirty;a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION); a.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);a.bindBuffer(a.ARRAY_BUFFER,this._verticesBuffer);c&&a.bufferData(a.ARRAY_BUFFER,this._vertices,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,a.FLOAT,!1,0,this._vertices);a.bindBuffer(a.ARRAY_BUFFER,this._texCoordinateBuffer);c&&a.bufferData(a.ARRAY_BUFFER,this._texCoordinates,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,0,this._texCoordinates);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._indicesBuffer); c&&a.bufferData(a.ELEMENT_ARRAY_BUFFER,this._indices,a.STATIC_DRAW);a.drawElements(a.TRIANGLES,6*b,a.UNSIGNED_SHORT,0);c&&(this._dirty=!1);cc.incrementGLDraws(1)},reuse:function(){if(0<this._reuseGrid){for(var a=this._vertices,b=this._originalVertices,c=0;c<a.length;c++)b[c]=a[c];--this._reuseGrid}},calculateVertexPoints:function(){var a=this._texture.pixelsWidth,b=this._texture.pixelsHeight,c=this._texture.getContentSizeInPixels().height,d=this._gridSize,e=d.width*d.height;this._vertices=new Float32Array(12* e);this._texCoordinates=new Float32Array(8*e);this._indices=new Uint16Array(6*e);var f=cc._renderContext;this._verticesBuffer&&f.deleteBuffer(this._verticesBuffer);this._verticesBuffer=f.createBuffer();this._texCoordinateBuffer&&f.deleteBuffer(this._texCoordinateBuffer);this._texCoordinateBuffer=f.createBuffer();this._indicesBuffer&&f.deleteBuffer(this._indicesBuffer);this._indicesBuffer=f.createBuffer();var g,h,k=0,m=this._step,n=this._vertices,p=this._texCoordinates,r=this._isTextureFlipped;for(g= 0;g<d.width;g++)for(h=0;h<d.height;h++){var s=g*m.x,u=s+m.x,t=h*m.y,v=t+m.y;n[12*k]=s;n[12*k+1]=t;n[12*k+2]=0;n[12*k+3]=u;n[12*k+4]=t;n[12*k+5]=0;n[12*k+6]=s;n[12*k+7]=v;n[12*k+8]=0;n[12*k+9]=u;n[12*k+10]=v;n[12*k+11]=0;var w=t,x=v;r&&(w=c-t,x=c-v);p[8*k]=s/a;p[8*k+1]=w/b;p[8*k+2]=u/a;p[8*k+3]=w/b;p[8*k+4]=s/a;p[8*k+5]=x/b;p[8*k+6]=u/a;p[8*k+7]=x/b;k++}a=this._indices;for(g=0;g<e;g++)a[6*g+0]=4*g+0,a[6*g+1]=4*g+1,a[6*g+2]=4*g+2,a[6*g+3]=4*g+1,a[6*g+4]=4*g+2,a[6*g+5]=4*g+3;this._originalVertices=new Float32Array(this._vertices); f.bindBuffer(f.ARRAY_BUFFER,this._verticesBuffer);f.bufferData(f.ARRAY_BUFFER,this._vertices,f.DYNAMIC_DRAW);f.bindBuffer(f.ARRAY_BUFFER,this._texCoordinateBuffer);f.bufferData(f.ARRAY_BUFFER,this._texCoordinates,f.DYNAMIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,this._indicesBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,this._indices,f.DYNAMIC_DRAW);this._dirty=!0}});cc.TiledGrid3D.create=function(a,b,c){return new cc.TiledGrid3D(a,b,c)};cc.Grabber=cc.Class.extend({_FBO:null,_oldFBO:null,_oldClearColor:null,_gl:null,ctor:function(){cc.sys._checkWebGLRenderMode();this._gl=cc._renderContext;this._oldClearColor=[0,0,0,0];this._oldFBO=null;this._FBO=this._gl.createFramebuffer()},grab:function(a){var b=this._gl;this._oldFBO=b.getParameter(b.FRAMEBUFFER_BINDING);b.bindFramebuffer(b.FRAMEBUFFER,this._FBO);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,a._webTextureObj,0);b.checkFramebufferStatus(b.FRAMEBUFFER)!==b.FRAMEBUFFER_COMPLETE&& cc.log("Frame Grabber: could not attach texture to frmaebuffer");b.bindFramebuffer(b.FRAMEBUFFER,this._oldFBO)},beforeRender:function(a){a=this._gl;this._oldFBO=a.getParameter(a.FRAMEBUFFER_BINDING);a.bindFramebuffer(a.FRAMEBUFFER,this._FBO);this._oldClearColor=a.getParameter(a.COLOR_CLEAR_VALUE);a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT)},afterRender:function(a){a=this._gl;a.bindFramebuffer(a.FRAMEBUFFER,this._oldFBO);a.colorMask(!0,!0,!0,!0)},destroy:function(){this._gl.deleteFramebuffer(this._FBO)}});cc.ACTION_TAG_INVALID=-1; cc.Action=cc.Class.extend({originalTarget:null,target:null,tag:cc.ACTION_TAG_INVALID,ctor:function(){this.target=this.originalTarget=null;this.tag=cc.ACTION_TAG_INVALID},copy:function(){cc.log("copy is deprecated. Please use clone instead.");return this.clone()},clone:function(){var a=new cc.Action;a.originalTarget=null;a.target=null;a.tag=this.tag;return a},isDone:function(){return!0},startWithTarget:function(a){this.target=this.originalTarget=a},stop:function(){this.target=null},step:function(a){cc.log("[Action step]. override me")}, update:function(a){cc.log("[Action update]. override me")},getTarget:function(){return this.target},setTarget:function(a){this.target=a},getOriginalTarget:function(){return this.originalTarget},setOriginalTarget:function(a){this.originalTarget=a},getTag:function(){return this.tag},setTag:function(a){this.tag=a},retain:function(){},release:function(){}});cc.action=function(){return new cc.Action};cc.Action.create=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._timesForRepeat||1)},setDuration:function(a){this._duration=a},reverse:function(){cc.log("cocos2d: FiniteTimeAction#reverse: Implement me");return null},clone:function(){return new cc.FiniteTimeAction}}); cc.Speed=cc.Action.extend({_speed:0,_innerAction:null,ctor:function(a,b){cc.Action.prototype.ctor.call(this);this._speed=0;this._innerAction=null;a&&this.initWithAction(a,b)},getSpeed:function(){return this._speed},setSpeed:function(a){this._speed=a},initWithAction:function(a,b){if(!a)throw Error("cc.Speed.initWithAction(): action must be non nil");this._innerAction=a;this._speed=b;return!0},clone:function(){var a=new cc.Speed;a.initWithAction(this._innerAction.clone(),this._speed);return a},startWithTarget:function(a){cc.Action.prototype.startWithTarget.call(this, a);this._innerAction.startWithTarget(a)},stop:function(){this._innerAction.stop();cc.Action.prototype.stop.call(this)},step:function(a){this._innerAction.step(a*this._speed)},isDone:function(){return this._innerAction.isDone()},reverse:function(){return new cc.Speed(this._innerAction.reverse(),this._speed)},setInnerAction:function(a){this._innerAction!==a&&(this._innerAction=a)},getInnerAction:function(){return this._innerAction}});cc.speed=function(a,b){return new cc.Speed(a,b)}; cc.Speed.create=cc.speed; cc.Follow=cc.Action.extend({_followedNode:null,_boundarySet:!1,_boundaryFullyCovered:!1,_halfScreenSize:null,_fullScreenSize:null,_worldRect:null,leftBoundary:0,rightBoundary:0,topBoundary:0,bottomBoundary:0,ctor:function(a,b){cc.Action.prototype.ctor.call(this);this._followedNode=null;this._boundaryFullyCovered=this._boundarySet=!1;this._fullScreenSize=this._halfScreenSize=null;this.bottomBoundary=this.topBoundary=this.rightBoundary=this.leftBoundary=0;this._worldRect=cc.rect(0,0,0,0);a&&(b?this.initWithTarget(a, b):this.initWithTarget(a))},clone:function(){var a=new cc.Follow,b=this._worldRect,b=new cc.Rect(b.x,b.y,b.width,b.height);a.initWithTarget(this._followedNode,b);return a},isBoundarySet:function(){return this._boundarySet},setBoudarySet:function(a){this._boundarySet=a},initWithTarget:function(a,b){if(!a)throw Error("cc.Follow.initWithAction(): followedNode must be non nil");b=b||cc.rect(0,0,0,0);this._followedNode=a;this._worldRect=b;this._boundarySet=!cc._rectEqualToZero(b);this._boundaryFullyCovered= !1;var c=cc.director.getWinSize();this._fullScreenSize=cc.p(c.width,c.height);this._halfScreenSize=cc.pMult(this._fullScreenSize,0.5);this._boundarySet&&(this.leftBoundary=-(b.x+b.width-this._fullScreenSize.x),this.rightBoundary=-b.x,this.topBoundary=-b.y,this.bottomBoundary=-(b.y+b.height-this._fullScreenSize.y),this.rightBoundary<this.leftBoundary&&(this.rightBoundary=this.leftBoundary=(this.leftBoundary+this.rightBoundary)/2),this.topBoundary<this.bottomBoundary&&(this.topBoundary=this.bottomBoundary= (this.topBoundary+this.bottomBoundary)/2),this.topBoundary===this.bottomBoundary&&this.leftBoundary===this.rightBoundary&&(this._boundaryFullyCovered=!0));return!0},step:function(a){a=this._followedNode.x;var b=this._followedNode.y;a=this._halfScreenSize.x-a;b=this._halfScreenSize.y-b;this.target._renderCmd._dirtyFlag=0;this._boundarySet?this._boundaryFullyCovered||this.target.setPosition(cc.clampf(a,this.leftBoundary,this.rightBoundary),cc.clampf(b,this.bottomBoundary,this.topBoundary)):this.target.setPosition(a, b)},isDone:function(){return!this._followedNode.running},stop:function(){this.target=null;cc.Action.prototype.stop.call(this)}});cc.follow=function(a,b){return new cc.Follow(a,b)};cc.Follow.create=cc.follow;cc.ActionInterval=cc.FiniteTimeAction.extend({_elapsed:0,_firstTick:!1,_easeList:null,_timesForRepeat:1,_repeatForever:!1,_repeatMethod:!1,_speed:1,_speedMethod:!1,ctor:function(a){this._timesForRepeat=this._speed=1;this._repeatForever=!1;this.MAX_VALUE=2;this._speedMethod=this._repeatMethod=!1;cc.FiniteTimeAction.prototype.ctor.call(this);void 0!==a&&this.initWithDuration(a)},getElapsed:function(){return this._elapsed},initWithDuration:function(a){this._duration=0===a?cc.FLT_EPSILON:a;this._elapsed= 0;return this._firstTick=!0},isDone:function(){return this._elapsed>=this._duration},_cloneDecoration:function(a){a._repeatForever=this._repeatForever;a._speed=this._speed;a._timesForRepeat=this._timesForRepeat;a._easeList=this._easeList;a._speedMethod=this._speedMethod;a._repeatMethod=this._repeatMethod},_reverseEaseList:function(a){if(this._easeList){a._easeList=[];for(var b=0;b<this._easeList.length;b++)a._easeList.push(this._easeList[b].reverse())}},clone:function(){var a=new cc.ActionInterval(this._duration); this._cloneDecoration(a);return a},easing:function(a){this._easeList?this._easeList.length=0:this._easeList=[];for(var b=0;b<arguments.length;b++)this._easeList.push(arguments[b]);return this},_computeEaseTime:function(a){var b=this._easeList;if(!b||0===b.length)return a;for(var c=0,d=b.length;c<d;c++)a=b[c].easing(a);return a},step:function(a){this._firstTick?(this._firstTick=!1,this._elapsed=0):this._elapsed+=a;a=this._elapsed/(1.192092896E-7<this._duration?this._duration:1.192092896E-7);a=1>a? a:1;this.update(0<a?a:0);this._repeatMethod&&1<this._timesForRepeat&&this.isDone()&&(this._repeatForever||this._timesForRepeat--,this.startWithTarget(this.target),this.step(this._elapsed-this._duration))},startWithTarget:function(a){cc.Action.prototype.startWithTarget.call(this,a);this._elapsed=0;this._firstTick=!0},reverse:function(){cc.log("cc.IntervalAction: reverse not implemented.");return null},setAmplitudeRate:function(a){cc.log("cc.ActionInterval.setAmplitudeRate(): it should be overridden in subclass.")}, getAmplitudeRate:function(){cc.log("cc.ActionInterval.getAmplitudeRate(): it should be overridden in subclass.");return 0},speed:function(a){if(0>=a)return cc.log("The speed parameter error"),this;this._speedMethod=!0;this._speed*=a;return this},getSpeed:function(){return this._speed},setSpeed:function(a){this._speed=a;return this},repeat:function(a){a=Math.round(a);if(isNaN(a)||1>a)return cc.log("The repeat parameter error"),this;this._repeatMethod=!0;this._timesForRepeat*=a;return this},repeatForever:function(){this._repeatMethod= !0;this._timesForRepeat=this.MAX_VALUE;this._repeatForever=!0;return this}});cc.actionInterval=function(a){return new cc.ActionInterval(a)};cc.ActionInterval.create=cc.actionInterval; cc.Sequence=cc.ActionInterval.extend({_actions:null,_split:null,_last:0,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._actions=[];var b=a instanceof Array?a:arguments,c=b.length-1;0<=c&&null==b[c]&&cc.log("parameters should not be ending with null in Javascript");if(0<=c){for(var d=b[0],e=1;e<c;e++)b[e]&&(d=cc.Sequence._actionOneTwo(d,b[e]));this.initWithTwoActions(d,b[c])}},initWithTwoActions:function(a,b){if(!a||!b)throw Error("cc.Sequence.initWithTwoActions(): arguments must all be non nil"); this.initWithDuration(a._duration+b._duration);this._actions[0]=a;this._actions[1]=b;return!0},clone:function(){var a=new cc.Sequence;this._cloneDecoration(a);a.initWithTwoActions(this._actions[0].clone(),this._actions[1].clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._split=this._actions[0]._duration/this._duration;this._last=-1},stop:function(){-1!==this._last&&this._actions[this._last].stop();cc.Action.prototype.stop.call(this)},update:function(a){var b= 0,c=this._split,d=this._actions,e=this._last;a=this._computeEaseTime(a);a<c?(a=0!==c?a/c:1,0===b&&1===e&&(d[1].update(0),d[1].stop())):(b=1,a=1===c?1:(a-c)/(1-c),-1===e&&(d[0].startWithTarget(this.target),d[0].update(1),d[0].stop()),e||(d[0].update(1),d[0].stop()));d=d[b];e===b&&d.isDone()||(e!==b&&d.startWithTarget(this.target),a*=d._timesForRepeat,d.update(1<a?a%1:a),this._last=b)},reverse:function(){var a=cc.Sequence._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());this._cloneDecoration(a); this._reverseEaseList(a);return a}});cc.sequence=function(a){var b=a instanceof Array?a:arguments;0<b.length&&null==b[b.length-1]&&cc.log("parameters should not be ending with null in Javascript");for(var c,d,e,f;b&&0<b.length;)for(d=Array.prototype.shift.call(b),f=d._timesForRepeat||1,d._repeatMethod=!1,d._timesForRepeat=1,e=0,c||(c=d,e=1),e;e<f;e++)c=cc.Sequence._actionOneTwo(c,d);return c};cc.Sequence.create=cc.sequence; cc.Sequence._actionOneTwo=function(a,b){var c=new cc.Sequence;c.initWithTwoActions(a,b);return c}; cc.Repeat=cc.ActionInterval.extend({_times:0,_total:0,_nextDt:0,_actionInstant:!1,_innerAction:null,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithAction(a,b)},initWithAction:function(a,b){return this.initWithDuration(a._duration*b)?(this._times=b,this._innerAction=a,a instanceof cc.ActionInstant&&(this._actionInstant=!0,this._times-=1),this._total=0,!0):!1},clone:function(){var a=new cc.Repeat;this._cloneDecoration(a);a.initWithAction(this._innerAction.clone(), this._times);return a},startWithTarget:function(a){this._total=0;this._nextDt=this._innerAction._duration/this._duration;cc.ActionInterval.prototype.startWithTarget.call(this,a);this._innerAction.startWithTarget(a)},stop:function(){this._innerAction.stop();cc.Action.prototype.stop.call(this)},update:function(a){a=this._computeEaseTime(a);var b=this._innerAction,c=this._duration,d=this._times,e=this._nextDt;if(a>=e){for(;a>e&&this._total<d;)b.update(1),this._total++,b.stop(),b.startWithTarget(this.target), this._nextDt=e+=b._duration/c;1<=a&&this._total<d&&this._total++;this._actionInstant||(this._total===d?(b.update(1),b.stop()):b.update(a-(e-b._duration/c)))}else b.update(a*d%1)},isDone:function(){return this._total===this._times},reverse:function(){var a=new cc.Repeat(this._innerAction.reverse(),this._times);this._cloneDecoration(a);this._reverseEaseList(a);return a},setInnerAction:function(a){this._innerAction!==a&&(this._innerAction=a)},getInnerAction:function(){return this._innerAction}}); cc.repeat=function(a,b){return new cc.Repeat(a,b)};cc.Repeat.create=cc.repeat; cc.RepeatForever=cc.ActionInterval.extend({_innerAction:null,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._innerAction=null;a&&this.initWithAction(a)},initWithAction:function(a){if(!a)throw Error("cc.RepeatForever.initWithAction(): action must be non null");this._innerAction=a;return!0},clone:function(){var a=new cc.RepeatForever;this._cloneDecoration(a);a.initWithAction(this._innerAction.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this, a);this._innerAction.startWithTarget(a)},step:function(a){var b=this._innerAction;b.step(a);b.isDone()&&(b.startWithTarget(this.target),b.step(b.getElapsed()-b._duration))},isDone:function(){return!1},reverse:function(){var a=new cc.RepeatForever(this._innerAction.reverse());this._cloneDecoration(a);this._reverseEaseList(a);return a},setInnerAction:function(a){this._innerAction!==a&&(this._innerAction=a)},getInnerAction:function(){return this._innerAction}});cc.repeatForever=function(a){return new cc.RepeatForever(a)}; cc.RepeatForever.create=cc.repeatForever; cc.Spawn=cc.ActionInterval.extend({_one:null,_two:null,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._two=this._one=null;var b,c,d;if(a instanceof Array)c=a;else for(c=Array(arguments.length),b=0;b<arguments.length;++b)c[b]=arguments[b];d=c.length-1;0<=d&&null==c[d]&&cc.log("parameters should not be ending with null in Javascript");if(0<=d){var e=c[0];for(b=1;b<d;b++)c[b]&&(e=cc.Spawn._actionOneTwo(e,c[b]));this.initWithTwoActions(e,c[d])}},initWithTwoActions:function(a,b){if(!a|| !b)throw Error("cc.Spawn.initWithTwoActions(): arguments must all be non null");var c=!1,d=a._duration,e=b._duration;this.initWithDuration(Math.max(d,e))&&(this._one=a,this._two=b,d>e?this._two=cc.Sequence._actionOneTwo(b,cc.delayTime(d-e)):d<e&&(this._one=cc.Sequence._actionOneTwo(a,cc.delayTime(e-d))),c=!0);return c},clone:function(){var a=new cc.Spawn;this._cloneDecoration(a);a.initWithTwoActions(this._one.clone(),this._two.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this, a);this._one.startWithTarget(a);this._two.startWithTarget(a)},stop:function(){this._one.stop();this._two.stop();cc.Action.prototype.stop.call(this)},update:function(a){a=this._computeEaseTime(a);this._one&&this._one.update(a);this._two&&this._two.update(a)},reverse:function(){var a=cc.Spawn._actionOneTwo(this._one.reverse(),this._two.reverse());this._cloneDecoration(a);this._reverseEaseList(a);return a}}); cc.spawn=function(a){var b=a instanceof Array?a:arguments;0<b.length&&null==b[b.length-1]&&cc.log("parameters should not be ending with null in Javascript");for(var c=b[0],d=1;d<b.length;d++)null!=b[d]&&(c=cc.Spawn._actionOneTwo(c,b[d]));return c};cc.Spawn.create=cc.spawn;cc.Spawn._actionOneTwo=function(a,b){var c=new cc.Spawn;c.initWithTwoActions(a,b);return c}; cc.RotateTo=cc.ActionInterval.extend({_dstAngleX:0,_startAngleX:0,_diffAngleX:0,_dstAngleY:0,_startAngleY:0,_diffAngleY:0,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._dstAngleX=b||0,this._dstAngleY=c||this._dstAngleX,!0):!1},clone:function(){var a=new cc.RotateTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._dstAngleX, this._dstAngleY);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var b=a.rotationX%360,c=this._dstAngleX-b;180<c&&(c-=360);-180>c&&(c+=360);this._startAngleX=b;this._diffAngleX=c;this._startAngleY=a.rotationY%360;a=this._dstAngleY-this._startAngleY;180<a&&(a-=360);-180>a&&(a+=360);this._diffAngleY=a},reverse:function(){cc.log("cc.RotateTo.reverse(): it should be overridden in subclass.")},update:function(a){a=this._computeEaseTime(a);this.target&&(this.target.rotationX= this._startAngleX+this._diffAngleX*a,this.target.rotationY=this._startAngleY+this._diffAngleY*a)}});cc.rotateTo=function(a,b,c){return new cc.RotateTo(a,b,c)};cc.RotateTo.create=cc.rotateTo; cc.RotateBy=cc.ActionInterval.extend({_angleX:0,_startAngleX:0,_angleY:0,_startAngleY:0,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._angleX=b||0,this._angleY=c||this._angleX,!0):!1},clone:function(){var a=new cc.RotateBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._angleX,this._angleY);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this, a);this._startAngleX=a.rotationX;this._startAngleY=a.rotationY},update:function(a){a=this._computeEaseTime(a);this.target&&(this.target.rotationX=this._startAngleX+this._angleX*a,this.target.rotationY=this._startAngleY+this._angleY*a)},reverse:function(){var a=new cc.RotateBy(this._duration,-this._angleX,-this._angleY);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.rotateBy=function(a,b,c){return new cc.RotateBy(a,b,c)};cc.RotateBy.create=cc.rotateBy; cc.MoveBy=cc.ActionInterval.extend({_positionDelta:null,_startPosition:null,_previousPosition:null,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);this._positionDelta=cc.p(0,0);this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(void 0!==b.x&&(c=b.y,b=b.x),this._positionDelta.x=b,this._positionDelta.y=c,!0):!1},clone:function(){var a= new cc.MoveBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._positionDelta);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var b=a.getPositionX();a=a.getPositionY();this._previousPosition.x=b;this._previousPosition.y=a;this._startPosition.x=b;this._startPosition.y=a},update:function(a){a=this._computeEaseTime(a);if(this.target){var b=this._positionDelta.x*a;a*=this._positionDelta.y;var c=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var d= this.target.getPositionX(),e=this.target.getPositionY(),f=this._previousPosition;c.x=c.x+d-f.x;c.y=c.y+e-f.y;b+=c.x;a+=c.y;f.x=b;f.y=a;this.target.setPosition(b,a)}else this.target.setPosition(c.x+b,c.y+a)}},reverse:function(){var a=new cc.MoveBy(this._duration,cc.p(-this._positionDelta.x,-this._positionDelta.y));this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.moveBy=function(a,b,c){return new cc.MoveBy(a,b,c)};cc.MoveBy.create=cc.moveBy; cc.MoveTo=cc.MoveBy.extend({_endPosition:null,ctor:function(a,b,c){cc.MoveBy.prototype.ctor.call(this);this._endPosition=cc.p(0,0);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.MoveBy.prototype.initWithDuration.call(this,a,b,c)?(void 0!==b.x&&(c=b.y,b=b.x),this._endPosition.x=b,this._endPosition.y=c,!0):!1},clone:function(){var a=new cc.MoveTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endPosition);return a},startWithTarget:function(a){cc.MoveBy.prototype.startWithTarget.call(this, a);this._positionDelta.x=this._endPosition.x-a.getPositionX();this._positionDelta.y=this._endPosition.y-a.getPositionY()}});cc.moveTo=function(a,b,c){return new cc.MoveTo(a,b,c)};cc.MoveTo.create=cc.moveTo; cc.SkewTo=cc.ActionInterval.extend({_skewX:0,_skewY:0,_startSkewX:0,_startSkewY:0,_endSkewX:0,_endSkewY:0,_deltaX:0,_deltaY:0,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);void 0!==c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){var d=!1;cc.ActionInterval.prototype.initWithDuration.call(this,a)&&(this._endSkewX=b,this._endSkewY=c,d=!0);return d},clone:function(){var a=new cc.SkewTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endSkewX,this._endSkewY); return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._startSkewX=a.skewX%180;this._deltaX=this._endSkewX-this._startSkewX;180<this._deltaX&&(this._deltaX-=360);-180>this._deltaX&&(this._deltaX+=360);this._startSkewY=a.skewY%360;this._deltaY=this._endSkewY-this._startSkewY;180<this._deltaY&&(this._deltaY-=360);-180>this._deltaY&&(this._deltaY+=360)},update:function(a){a=this._computeEaseTime(a);this.target.skewX=this._startSkewX+this._deltaX*a;this.target.skewY= this._startSkewY+this._deltaY*a}});cc.skewTo=function(a,b,c){return new cc.SkewTo(a,b,c)};cc.SkewTo.create=cc.skewTo; cc.SkewBy=cc.SkewTo.extend({ctor:function(a,b,c){cc.SkewTo.prototype.ctor.call(this);void 0!==c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){var d=!1;cc.SkewTo.prototype.initWithDuration.call(this,a,b,c)&&(this._skewX=b,this._skewY=c,d=!0);return d},clone:function(){var a=new cc.SkewBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._skewX,this._skewY);return a},startWithTarget:function(a){cc.SkewTo.prototype.startWithTarget.call(this,a);this._deltaX=this._skewX; this._deltaY=this._skewY;this._endSkewX=this._startSkewX+this._deltaX;this._endSkewY=this._startSkewY+this._deltaY},reverse:function(){var a=new cc.SkewBy(this._duration,-this._skewX,-this._skewY);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.skewBy=function(a,b,c){return new cc.SkewBy(a,b,c)};cc.SkewBy.create=cc.skewBy; cc.JumpBy=cc.ActionInterval.extend({_startPosition:null,_delta:null,_height:0,_jumps:0,_previousPosition:null,ctor:function(a,b,c,d,e){cc.ActionInterval.prototype.ctor.call(this);this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0);this._delta=cc.p(0,0);void 0!==d&&this.initWithDuration(a,b,c,d,e)},initWithDuration:function(a,b,c,d,e){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(void 0===e&&(e=d,d=c,c=b.y,b=b.x),this._delta.x=b,this._delta.y=c,this._height=d,this._jumps= e,!0):!1},clone:function(){var a=new cc.JumpBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._delta,this._height,this._jumps);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var b=a.getPositionX();a=a.getPositionY();this._previousPosition.x=b;this._previousPosition.y=a;this._startPosition.x=b;this._startPosition.y=a},update:function(a){a=this._computeEaseTime(a);if(this.target){var b=a*this._jumps%1,b=4*this._height*b*(1-b),b=b+this._delta.y* a;a*=this._delta.x;var c=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var d=this.target.getPositionX(),e=this.target.getPositionY(),f=this._previousPosition;c.x=c.x+d-f.x;c.y=c.y+e-f.y;a+=c.x;b+=c.y;f.x=a;f.y=b;this.target.setPosition(a,b)}else this.target.setPosition(c.x+a,c.y+b)}},reverse:function(){var a=new cc.JumpBy(this._duration,cc.p(-this._delta.x,-this._delta.y),this._height,this._jumps);this._cloneDecoration(a);this._reverseEaseList(a);return a}}); cc.jumpBy=function(a,b,c,d,e){return new cc.JumpBy(a,b,c,d,e)};cc.JumpBy.create=cc.jumpBy; cc.JumpTo=cc.JumpBy.extend({_endPosition:null,ctor:function(a,b,c,d,e){cc.JumpBy.prototype.ctor.call(this);this._endPosition=cc.p(0,0);void 0!==d&&this.initWithDuration(a,b,c,d,e)},initWithDuration:function(a,b,c,d,e){return cc.JumpBy.prototype.initWithDuration.call(this,a,b,c,d,e)?(void 0===e&&(c=b.y,b=b.x),this._endPosition.x=b,this._endPosition.y=c,!0):!1},startWithTarget:function(a){cc.JumpBy.prototype.startWithTarget.call(this,a);this._delta.x=this._endPosition.x-this._startPosition.x;this._delta.y= this._endPosition.y-this._startPosition.y},clone:function(){var a=new cc.JumpTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endPosition,this._height,this._jumps);return a}});cc.jumpTo=function(a,b,c,d,e){return new cc.JumpTo(a,b,c,d,e)};cc.JumpTo.create=cc.jumpTo;cc.bezierAt=function(a,b,c,d,e){return Math.pow(1-e,3)*a+3*e*Math.pow(1-e,2)*b+3*Math.pow(e,2)*(1-e)*c+Math.pow(e,3)*d}; cc.BezierBy=cc.ActionInterval.extend({_config:null,_startPosition:null,_previousPosition:null,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);this._config=[];this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0);b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._config=b,!0):!1},clone:function(){var a=new cc.BezierBy;this._cloneDecoration(a);for(var b=[],c=0;c<this._config.length;c++){var d= this._config[c];b.push(cc.p(d.x,d.y))}a.initWithDuration(this._duration,b);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var b=a.getPositionX();a=a.getPositionY();this._previousPosition.x=b;this._previousPosition.y=a;this._startPosition.x=b;this._startPosition.y=a},update:function(a){a=this._computeEaseTime(a);if(this.target){var b=this._config,c=b[0].y,d=b[1].y,e=b[2].y,b=cc.bezierAt(0,b[0].x,b[1].x,b[2].x,a);a=cc.bezierAt(0,c,d,e,a);c=this._startPosition; if(cc.ENABLE_STACKABLE_ACTIONS){var d=this.target.getPositionX(),e=this.target.getPositionY(),f=this._previousPosition;c.x=c.x+d-f.x;c.y=c.y+e-f.y;b+=c.x;a+=c.y;f.x=b;f.y=a;this.target.setPosition(b,a)}else this.target.setPosition(c.x+b,c.y+a)}},reverse:function(){var a=this._config,a=[cc.pAdd(a[1],cc.pNeg(a[2])),cc.pAdd(a[0],cc.pNeg(a[2])),cc.pNeg(a[2])],a=new cc.BezierBy(this._duration,a);this._cloneDecoration(a);this._reverseEaseList(a);return a}}); cc.bezierBy=function(a,b){return new cc.BezierBy(a,b)};cc.BezierBy.create=cc.bezierBy; cc.BezierTo=cc.BezierBy.extend({_toConfig:null,ctor:function(a,b){cc.BezierBy.prototype.ctor.call(this);this._toConfig=[];b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._toConfig=b,!0):!1},clone:function(){var a=new cc.BezierTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._toConfig);return a},startWithTarget:function(a){cc.BezierBy.prototype.startWithTarget.call(this,a);a=this._startPosition;var b= this._toConfig,c=this._config;c[0]=cc.pSub(b[0],a);c[1]=cc.pSub(b[1],a);c[2]=cc.pSub(b[2],a)}});cc.bezierTo=function(a,b){return new cc.BezierTo(a,b)};cc.BezierTo.create=cc.bezierTo; cc.ScaleTo=cc.ActionInterval.extend({_scaleX:1,_scaleY:1,_startScaleX:1,_startScaleY:1,_endScaleX:0,_endScaleY:0,_deltaX:0,_deltaY:0,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._endScaleX=b,this._endScaleY=null!=c?c:b,!0):!1},clone:function(){var a=new cc.ScaleTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endScaleX, this._endScaleY);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._startScaleX=a.scaleX;this._startScaleY=a.scaleY;this._deltaX=this._endScaleX-this._startScaleX;this._deltaY=this._endScaleY-this._startScaleY},update:function(a){a=this._computeEaseTime(a);this.target&&(this.target.scaleX=this._startScaleX+this._deltaX*a,this.target.scaleY=this._startScaleY+this._deltaY*a)}});cc.scaleTo=function(a,b,c){return new cc.ScaleTo(a,b,c)}; cc.ScaleTo.create=cc.scaleTo; cc.ScaleBy=cc.ScaleTo.extend({startWithTarget:function(a){cc.ScaleTo.prototype.startWithTarget.call(this,a);this._deltaX=this._startScaleX*this._endScaleX-this._startScaleX;this._deltaY=this._startScaleY*this._endScaleY-this._startScaleY},reverse:function(){var a=new cc.ScaleBy(this._duration,1/this._endScaleX,1/this._endScaleY);this._cloneDecoration(a);this._reverseEaseList(a);return a},clone:function(){var a=new cc.ScaleBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endScaleX, this._endScaleY);return a}});cc.scaleBy=function(a,b,c){return new cc.ScaleBy(a,b,c)};cc.ScaleBy.create=cc.scaleBy; cc.Blink=cc.ActionInterval.extend({_times:0,_originalState:!1,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._times=b,!0):!1},clone:function(){var a=new cc.Blink;this._cloneDecoration(a);a.initWithDuration(this._duration,this._times);return a},update:function(a){a=this._computeEaseTime(a);if(this.target&&!this.isDone()){var b=1/this._times;this.target.visible= a%b>b/2}},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._originalState=a.visible},stop:function(){this.target.visible=this._originalState;cc.ActionInterval.prototype.stop.call(this)},reverse:function(){var a=new cc.Blink(this._duration,this._times);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.blink=function(a,b){return new cc.Blink(a,b)};cc.Blink.create=cc.blink; cc.FadeTo=cc.ActionInterval.extend({_toOpacity:0,_fromOpacity:0,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._toOpacity=b,!0):!1},clone:function(){var a=new cc.FadeTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._toOpacity);return a},update:function(a){a=this._computeEaseTime(a);var b=void 0!==this._fromOpacity?this._fromOpacity: 255;this.target.opacity=b+(this._toOpacity-b)*a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._fromOpacity=a.opacity}});cc.fadeTo=function(a,b){return new cc.FadeTo(a,b)};cc.FadeTo.create=cc.fadeTo; cc.FadeIn=cc.FadeTo.extend({_reverseAction:null,ctor:function(a){cc.FadeTo.prototype.ctor.call(this);null==a&&(a=0);this.initWithDuration(a,255)},reverse:function(){var a=new cc.FadeOut;a.initWithDuration(this._duration,0);this._cloneDecoration(a);this._reverseEaseList(a);return a},clone:function(){var a=new cc.FadeIn;this._cloneDecoration(a);a.initWithDuration(this._duration,this._toOpacity);return a},startWithTarget:function(a){this._reverseAction&&(this._toOpacity=this._reverseAction._fromOpacity); cc.FadeTo.prototype.startWithTarget.call(this,a)}});cc.fadeIn=function(a){return new cc.FadeIn(a)};cc.FadeIn.create=cc.fadeIn; cc.FadeOut=cc.FadeTo.extend({ctor:function(a){cc.FadeTo.prototype.ctor.call(this);null==a&&(a=0);this.initWithDuration(a,0)},reverse:function(){var a=new cc.FadeIn;a._reverseAction=this;a.initWithDuration(this._duration,255);this._cloneDecoration(a);this._reverseEaseList(a);return a},clone:function(){var a=new cc.FadeOut;this._cloneDecoration(a);a.initWithDuration(this._duration,this._toOpacity);return a}});cc.fadeOut=function(a){return new cc.FadeOut(a)};cc.FadeOut.create=cc.fadeOut; cc.TintTo=cc.ActionInterval.extend({_to:null,_from:null,ctor:function(a,b,c,d){cc.ActionInterval.prototype.ctor.call(this);this._to=cc.color(0,0,0);this._from=cc.color(0,0,0);void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._to=cc.color(b,c,d),!0):!1},clone:function(){var a=new cc.TintTo;this._cloneDecoration(a);var b=this._to;a.initWithDuration(this._duration,b.r,b.g,b.b);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this, a);this._from=this.target.color},update:function(a){a=this._computeEaseTime(a);var b=this._from,c=this._to;b&&this.target.setColor(cc.color(b.r+(c.r-b.r)*a,b.g+(c.g-b.g)*a,b.b+(c.b-b.b)*a))}});cc.tintTo=function(a,b,c,d){return new cc.TintTo(a,b,c,d)};cc.TintTo.create=cc.tintTo; cc.TintBy=cc.ActionInterval.extend({_deltaR:0,_deltaG:0,_deltaB:0,_fromR:0,_fromG:0,_fromB:0,ctor:function(a,b,c,d){cc.ActionInterval.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._deltaR=b,this._deltaG=c,this._deltaB=d,!0):!1},clone:function(){var a=new cc.TintBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._deltaR,this._deltaG,this._deltaB);return a}, startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);a=a.color;this._fromR=a.r;this._fromG=a.g;this._fromB=a.b},update:function(a){a=this._computeEaseTime(a);this.target.color=cc.color(this._fromR+this._deltaR*a,this._fromG+this._deltaG*a,this._fromB+this._deltaB*a)},reverse:function(){var a=new cc.TintBy(this._duration,-this._deltaR,-this._deltaG,-this._deltaB);this._cloneDecoration(a);this._reverseEaseList(a);return a}}); cc.tintBy=function(a,b,c,d){return new cc.TintBy(a,b,c,d)};cc.TintBy.create=cc.tintBy;cc.DelayTime=cc.ActionInterval.extend({update:function(a){},reverse:function(){var a=new cc.DelayTime(this._duration);this._cloneDecoration(a);this._reverseEaseList(a);return a},clone:function(){var a=new cc.DelayTime;this._cloneDecoration(a);a.initWithDuration(this._duration);return a}});cc.delayTime=function(a){return new cc.DelayTime(a)};cc.DelayTime.create=cc.delayTime; cc.ReverseTime=cc.ActionInterval.extend({_other:null,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._other=null;a&&this.initWithAction(a)},initWithAction:function(a){if(!a)throw Error("cc.ReverseTime.initWithAction(): action must be non null");if(a===this._other)throw Error("cc.ReverseTime.initWithAction(): the action was already passed in.");return cc.ActionInterval.prototype.initWithDuration.call(this,a._duration)?(this._other=a,!0):!1},clone:function(){var a=new cc.ReverseTime; this._cloneDecoration(a);a.initWithAction(this._other.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._other.startWithTarget(a)},update:function(a){a=this._computeEaseTime(a);this._other&&this._other.update(1-a)},reverse:function(){return this._other.clone()},stop:function(){this._other.stop();cc.Action.prototype.stop.call(this)}});cc.reverseTime=function(a){return new cc.ReverseTime(a)};cc.ReverseTime.create=cc.reverseTime; cc.Animate=cc.ActionInterval.extend({_animation:null,_nextFrame:0,_origFrame:null,_executedLoops:0,_splitTimes:null,_currFrameIndex:0,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._splitTimes=[];a&&this.initWithAnimation(a)},getAnimation:function(){return this._animation},setAnimation:function(a){this._animation=a},getCurrentFrameIndex:function(){return this._currFrameIndex},initWithAnimation:function(a){if(!a)throw Error("cc.Animate.initWithAnimation(): animation must be non-NULL"); var b=a.getDuration();if(this.initWithDuration(b*a.getLoops())){this._nextFrame=0;this.setAnimation(a);this._origFrame=null;this._executedLoops=0;var c=this._splitTimes,d=c.length=0,e=b/a.getTotalDelayUnits();a=a.getFrames();cc.arrayVerifyType(a,cc.AnimationFrame);for(var f=0;f<a.length;f++){var g=d*e/b,d=d+a[f].getDelayUnits();c.push(g)}return!0}return!1},clone:function(){var a=new cc.Animate;this._cloneDecoration(a);a.initWithAnimation(this._animation.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this, a);this._animation.getRestoreOriginalFrame()&&(this._origFrame=a.getSpriteFrame());this._executedLoops=this._nextFrame=0},update:function(a){a=this._computeEaseTime(a);1>a&&(a*=this._animation.getLoops(),(0|a)>this._executedLoops&&(this._nextFrame=0,this._executedLoops++),a%=1);for(var b=this._animation.getFrames(),c=b.length,d=this._splitTimes,e=this._nextFrame;e<c;e++)if(d[e]<=a)_currFrameIndex=e,this.target.setSpriteFrame(b[_currFrameIndex].getSpriteFrame()),this._nextFrame=e+1;else break},reverse:function(){var a= this._animation,b=a.getFrames(),c=[];cc.arrayVerifyType(b,cc.AnimationFrame);if(0<b.length)for(var d=b.length-1;0<=d;d--){var e=b[d];if(!e)break;c.push(e.clone())}b=new cc.Animation(c,a.getDelayPerUnit(),a.getLoops());b.setRestoreOriginalFrame(a.getRestoreOriginalFrame());a=new cc.Animate(b);this._cloneDecoration(a);this._reverseEaseList(a);return a},stop:function(){this._animation.getRestoreOriginalFrame()&&this.target&&this.target.setSpriteFrame(this._origFrame);cc.Action.prototype.stop.call(this)}}); cc.animate=function(a){return new cc.Animate(a)};cc.Animate.create=cc.animate; cc.TargetedAction=cc.ActionInterval.extend({_action:null,_forcedTarget:null,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);b&&this.initWithTarget(a,b)},initWithTarget:function(a,b){return this.initWithDuration(b._duration)?(this._forcedTarget=a,this._action=b,!0):!1},clone:function(){var a=new cc.TargetedAction;this._cloneDecoration(a);a.initWithTarget(this._forcedTarget,this._action.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a); this._action.startWithTarget(this._forcedTarget)},stop:function(){this._action.stop()},update:function(a){a=this._computeEaseTime(a);this._action.update(a)},getForcedTarget:function(){return this._forcedTarget},setForcedTarget:function(a){this._forcedTarget!==a&&(this._forcedTarget=a)}});cc.targetedAction=function(a,b){return new cc.TargetedAction(a,b)};cc.TargetedAction.create=cc.targetedAction;cc.ActionInstant=cc.FiniteTimeAction.extend({isDone:function(){return!0},step:function(a){this.update(1)},update:function(a){},reverse:function(){return this.clone()},clone:function(){return new cc.ActionInstant}});cc.Show=cc.ActionInstant.extend({update:function(a){this.target.visible=!0},reverse:function(){return new cc.Hide},clone:function(){return new cc.Show}});cc.show=function(){return new cc.Show};cc.Show.create=cc.show; cc.Hide=cc.ActionInstant.extend({update:function(a){this.target.visible=!1},reverse:function(){return new cc.Show},clone:function(){return new cc.Hide}});cc.hide=function(){return new cc.Hide};cc.Hide.create=cc.hide;cc.ToggleVisibility=cc.ActionInstant.extend({update:function(a){this.target.visible=!this.target.visible},reverse:function(){return new cc.ToggleVisibility},clone:function(){return new cc.ToggleVisibility}});cc.toggleVisibility=function(){return new cc.ToggleVisibility}; cc.ToggleVisibility.create=cc.toggleVisibility;cc.RemoveSelf=cc.ActionInstant.extend({_isNeedCleanUp:!0,ctor:function(a){cc.FiniteTimeAction.prototype.ctor.call(this);void 0!==a&&this.init(a)},update:function(a){this.target.removeFromParent(this._isNeedCleanUp)},init:function(a){this._isNeedCleanUp=a;return!0},reverse:function(){return new cc.RemoveSelf(this._isNeedCleanUp)},clone:function(){return new cc.RemoveSelf(this._isNeedCleanUp)}});cc.removeSelf=function(a){return new cc.RemoveSelf(a)}; cc.RemoveSelf.create=cc.removeSelf;cc.FlipX=cc.ActionInstant.extend({_flippedX:!1,ctor:function(a){cc.FiniteTimeAction.prototype.ctor.call(this);this._flippedX=!1;void 0!==a&&this.initWithFlipX(a)},initWithFlipX:function(a){this._flippedX=a;return!0},update:function(a){this.target.flippedX=this._flippedX},reverse:function(){return new cc.FlipX(!this._flippedX)},clone:function(){var a=new cc.FlipX;a.initWithFlipX(this._flippedX);return a}});cc.flipX=function(a){return new cc.FlipX(a)}; cc.FlipX.create=cc.flipX;cc.FlipY=cc.ActionInstant.extend({_flippedY:!1,ctor:function(a){cc.FiniteTimeAction.prototype.ctor.call(this);this._flippedY=!1;void 0!==a&&this.initWithFlipY(a)},initWithFlipY:function(a){this._flippedY=a;return!0},update:function(a){this.target.flippedY=this._flippedY},reverse:function(){return new cc.FlipY(!this._flippedY)},clone:function(){var a=new cc.FlipY;a.initWithFlipY(this._flippedY);return a}});cc.flipY=function(a){return new cc.FlipY(a)};cc.FlipY.create=cc.flipY; cc.Place=cc.ActionInstant.extend({_x:0,_y:0,ctor:function(a,b){cc.FiniteTimeAction.prototype.ctor.call(this);this._y=this._x=0;void 0!==a&&(void 0!==a.x&&(b=a.y,a=a.x),this.initWithPosition(a,b))},initWithPosition:function(a,b){this._x=a;this._y=b;return!0},update:function(a){this.target.setPosition(this._x,this._y)},clone:function(){var a=new cc.Place;a.initWithPosition(this._x,this._y);return a}});cc.place=function(a,b){return new cc.Place(a,b)};cc.Place.create=cc.place; cc.CallFunc=cc.ActionInstant.extend({_selectorTarget:null,_function:null,_data:null,ctor:function(a,b,c){cc.FiniteTimeAction.prototype.ctor.call(this);this.initWithFunction(a,b,c)},initWithFunction:function(a,b,c){a&&(this._function=a);b&&(this._selectorTarget=b);void 0!==c&&(this._data=c);return!0},execute:function(){this._function&&this._function.call(this._selectorTarget,this.target,this._data)},update:function(a){this.execute()},getTargetCallback:function(){return this._selectorTarget},setTargetCallback:function(a){a!== this._selectorTarget&&(this._selectorTarget&&(this._selectorTarget=null),this._selectorTarget=a)},clone:function(){var a=new cc.CallFunc;a.initWithFunction(this._function,this._selectorTarget,this._data);return a}});cc.callFunc=function(a,b,c){return new cc.CallFunc(a,b,c)};cc.CallFunc.create=cc.callFunc;cc.ActionEase=cc.ActionInterval.extend({_inner:null,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);a&&this.initWithAction(a)},initWithAction:function(a){if(!a)throw Error("cc.ActionEase.initWithAction(): action must be non nil");return this.initWithDuration(a.getDuration())?(this._inner=a,!0):!1},clone:function(){var a=new cc.ActionEase;a.initWithAction(this._inner.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._inner.startWithTarget(this.target)}, stop:function(){this._inner.stop();cc.ActionInterval.prototype.stop.call(this)},update:function(a){this._inner.update(a)},reverse:function(){return new cc.ActionEase(this._inner.reverse())},getInnerAction:function(){return this._inner}});cc.actionEase=function(a){return new cc.ActionEase(a)};cc.ActionEase.create=cc.actionEase; cc.EaseRateAction=cc.ActionEase.extend({_rate:0,ctor:function(a,b){cc.ActionEase.prototype.ctor.call(this);void 0!==b&&this.initWithAction(a,b)},setRate:function(a){this._rate=a},getRate:function(){return this._rate},initWithAction:function(a,b){return cc.ActionEase.prototype.initWithAction.call(this,a)?(this._rate=b,!0):!1},clone:function(){var a=new cc.EaseRateAction;a.initWithAction(this._inner.clone(),this._rate);return a},reverse:function(){return new cc.EaseRateAction(this._inner.reverse(), 1/this._rate)}});cc.easeRateAction=function(a,b){return new cc.EaseRateAction(a,b)};cc.EaseRateAction.create=cc.easeRateAction;cc.EaseIn=cc.EaseRateAction.extend({update:function(a){this._inner.update(Math.pow(a,this._rate))},reverse:function(){return new cc.EaseIn(this._inner.reverse(),1/this._rate)},clone:function(){var a=new cc.EaseIn;a.initWithAction(this._inner.clone(),this._rate);return a}});cc.EaseIn.create=function(a,b){return new cc.EaseIn(a,b)}; cc.easeIn=function(a){return{_rate:a,easing:function(a){return Math.pow(a,this._rate)},reverse:function(){return cc.easeIn(1/this._rate)}}};cc.EaseOut=cc.EaseRateAction.extend({update:function(a){this._inner.update(Math.pow(a,1/this._rate))},reverse:function(){return new cc.EaseOut(this._inner.reverse(),1/this._rate)},clone:function(){var a=new cc.EaseOut;a.initWithAction(this._inner.clone(),this._rate);return a}});cc.EaseOut.create=function(a,b){return new cc.EaseOut(a,b)}; cc.easeOut=function(a){return{_rate:a,easing:function(a){return Math.pow(a,1/this._rate)},reverse:function(){return cc.easeOut(1/this._rate)}}};cc.EaseInOut=cc.EaseRateAction.extend({update:function(a){a*=2;1>a?this._inner.update(0.5*Math.pow(a,this._rate)):this._inner.update(1-0.5*Math.pow(2-a,this._rate))},clone:function(){var a=new cc.EaseInOut;a.initWithAction(this._inner.clone(),this._rate);return a},reverse:function(){return new cc.EaseInOut(this._inner.reverse(),this._rate)}}); cc.EaseInOut.create=function(a,b){return new cc.EaseInOut(a,b)};cc.easeInOut=function(a){return{_rate:a,easing:function(a){a*=2;return 1>a?0.5*Math.pow(a,this._rate):1-0.5*Math.pow(2-a,this._rate)},reverse:function(){return cc.easeInOut(this._rate)}}}; cc.EaseExponentialIn=cc.ActionEase.extend({update:function(a){this._inner.update(0===a?0:Math.pow(2,10*(a-1)))},reverse:function(){return new cc.EaseExponentialOut(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialIn;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialIn.create=function(a){return new cc.EaseExponentialIn(a)};cc._easeExponentialInObj={easing:function(a){return 0===a?0:Math.pow(2,10*(a-1))},reverse:function(){return cc._easeExponentialOutObj}}; cc.easeExponentialIn=function(){return cc._easeExponentialInObj};cc.EaseExponentialOut=cc.ActionEase.extend({update:function(a){this._inner.update(1===a?1:-Math.pow(2,-10*a)+1)},reverse:function(){return new cc.EaseExponentialIn(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialOut;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialOut.create=function(a){return new cc.EaseExponentialOut(a)}; cc._easeExponentialOutObj={easing:function(a){return 1===a?1:-Math.pow(2,-10*a)+1},reverse:function(){return cc._easeExponentialInObj}};cc.easeExponentialOut=function(){return cc._easeExponentialOutObj}; cc.EaseExponentialInOut=cc.ActionEase.extend({update:function(a){1!==a&&0!==a&&(a*=2,a=1>a?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*(a-1))+2));this._inner.update(a)},reverse:function(){return new cc.EaseExponentialInOut(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialInOut;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialInOut.create=function(a){return new cc.EaseExponentialInOut(a)}; cc._easeExponentialInOutObj={easing:function(a){return 1!==a&&0!==a?(a*=2,1>a?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*(a-1))+2)):a},reverse:function(){return cc._easeExponentialInOutObj}};cc.easeExponentialInOut=function(){return cc._easeExponentialInOutObj}; cc.EaseSineIn=cc.ActionEase.extend({update:function(a){a=0===a||1===a?a:-1*Math.cos(a*Math.PI/2)+1;this._inner.update(a)},reverse:function(){return new cc.EaseSineOut(this._inner.reverse())},clone:function(){var a=new cc.EaseSineIn;a.initWithAction(this._inner.clone());return a}});cc.EaseSineIn.create=function(a){return new cc.EaseSineIn(a)};cc._easeSineInObj={easing:function(a){return 0===a||1===a?a:-1*Math.cos(a*Math.PI/2)+1},reverse:function(){return cc._easeSineOutObj}};cc.easeSineIn=function(){return cc._easeSineInObj}; cc.EaseSineOut=cc.ActionEase.extend({update:function(a){a=0===a||1===a?a:Math.sin(a*Math.PI/2);this._inner.update(a)},reverse:function(){return new cc.EaseSineIn(this._inner.reverse())},clone:function(){var a=new cc.EaseSineOut;a.initWithAction(this._inner.clone());return a}});cc.EaseSineOut.create=function(a){return new cc.EaseSineOut(a)};cc._easeSineOutObj={easing:function(a){return 0===a||1===a?a:Math.sin(a*Math.PI/2)},reverse:function(){return cc._easeSineInObj}};cc.easeSineOut=function(){return cc._easeSineOutObj}; cc.EaseSineInOut=cc.ActionEase.extend({update:function(a){a=0===a||1===a?a:-0.5*(Math.cos(Math.PI*a)-1);this._inner.update(a)},clone:function(){var a=new cc.EaseSineInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseSineInOut(this._inner.reverse())}});cc.EaseSineInOut.create=function(a){return new cc.EaseSineInOut(a)};cc._easeSineInOutObj={easing:function(a){return 0===a||1===a?a:-0.5*(Math.cos(Math.PI*a)-1)},reverse:function(){return cc._easeSineInOutObj}}; cc.easeSineInOut=function(){return cc._easeSineInOutObj}; cc.EaseElastic=cc.ActionEase.extend({_period:0.3,ctor:function(a,b){cc.ActionEase.prototype.ctor.call(this);a&&this.initWithAction(a,b)},getPeriod:function(){return this._period},setPeriod:function(a){this._period=a},initWithAction:function(a,b){cc.ActionEase.prototype.initWithAction.call(this,a);this._period=null==b?0.3:b;return!0},reverse:function(){cc.log("cc.EaseElastic.reverse(): it should be overridden in subclass.");return null},clone:function(){var a=new cc.EaseElastic;a.initWithAction(this._inner.clone(), this._period);return a}});cc.EaseElastic.create=function(a,b){return new cc.EaseElastic(a,b)};cc.EaseElasticIn=cc.EaseElastic.extend({update:function(a){var b=0;0===a||1===a?b=a:(b=this._period/4,a-=1,b=-Math.pow(2,10*a)*Math.sin((a-b)*Math.PI*2/this._period));this._inner.update(b)},reverse:function(){return new cc.EaseElasticOut(this._inner.reverse(),this._period)},clone:function(){var a=new cc.EaseElasticIn;a.initWithAction(this._inner.clone(),this._period);return a}}); cc.EaseElasticIn.create=function(a,b){return new cc.EaseElasticIn(a,b)};cc._easeElasticInObj={easing:function(a){if(0===a||1===a)return a;a-=1;return-Math.pow(2,10*a)*Math.sin((a-0.075)*Math.PI*2/0.3)},reverse:function(){return cc._easeElasticOutObj}};cc.easeElasticIn=function(a){return a&&0.3!==a?{_period:a,easing:function(a){if(0===a||1===a)return a;a-=1;return-Math.pow(2,10*a)*Math.sin((a-this._period/4)*Math.PI*2/this._period)},reverse:function(){return cc.easeElasticOut(this._period)}}:cc._easeElasticInObj}; cc.EaseElasticOut=cc.EaseElastic.extend({update:function(a){var b=0;0===a||1===a?b=a:(b=this._period/4,b=Math.pow(2,-10*a)*Math.sin((a-b)*Math.PI*2/this._period)+1);this._inner.update(b)},reverse:function(){return new cc.EaseElasticIn(this._inner.reverse(),this._period)},clone:function(){var a=new cc.EaseElasticOut;a.initWithAction(this._inner.clone(),this._period);return a}});cc.EaseElasticOut.create=function(a,b){return new cc.EaseElasticOut(a,b)}; cc._easeElasticOutObj={easing:function(a){return 0===a||1===a?a:Math.pow(2,-10*a)*Math.sin((a-0.075)*Math.PI*2/0.3)+1},reverse:function(){return cc._easeElasticInObj}};cc.easeElasticOut=function(a){return a&&0.3!==a?{_period:a,easing:function(a){return 0===a||1===a?a:Math.pow(2,-10*a)*Math.sin((a-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(a){var b=0,b=this._period;if(0===a||1===a)b=a;else{b||(b=this._period=0.3*1.5);var c=b/4;a=2*a-1;b=0>a?-0.5*Math.pow(2,10*a)*Math.sin((a-c)*Math.PI*2/b):Math.pow(2,-10*a)*Math.sin((a-c)*Math.PI*2/b)*0.5+1}this._inner.update(b)},reverse:function(){return new cc.EaseElasticInOut(this._inner.reverse(),this._period)},clone:function(){var a=new cc.EaseElasticInOut;a.initWithAction(this._inner.clone(),this._period);return a}}); cc.EaseElasticInOut.create=function(a,b){return new cc.EaseElasticInOut(a,b)};cc.easeElasticInOut=function(a){return{_period:a||0.3,easing:function(a){var c=0,c=this._period;if(0===a||1===a)c=a;else{c||(c=this._period=0.3*1.5);var d=c/4;a=2*a-1;c=0>a?-0.5*Math.pow(2,10*a)*Math.sin((a-d)*Math.PI*2/c):Math.pow(2,-10*a)*Math.sin((a-d)*Math.PI*2/c)*0.5+1}return c},reverse:function(){return cc.easeElasticInOut(this._period)}}}; cc.EaseBounce=cc.ActionEase.extend({bounceTime:function(a){if(a<1/2.75)return 7.5625*a*a;if(a<2/2.75)return a-=1.5/2.75,7.5625*a*a+0.75;if(a<2.5/2.75)return a-=2.25/2.75,7.5625*a*a+0.9375;a-=2.625/2.75;return 7.5625*a*a+0.984375},clone:function(){var a=new cc.EaseBounce;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseBounce(this._inner.reverse())}});cc.EaseBounce.create=function(a){return new cc.EaseBounce(a)}; cc.EaseBounceIn=cc.EaseBounce.extend({update:function(a){a=1-this.bounceTime(1-a);this._inner.update(a)},reverse:function(){return new cc.EaseBounceOut(this._inner.reverse())},clone:function(){var a=new cc.EaseBounceIn;a.initWithAction(this._inner.clone());return a}});cc.EaseBounceIn.create=function(a){return new cc.EaseBounceIn(a)}; cc._bounceTime=function(a){if(a<1/2.75)return 7.5625*a*a;if(a<2/2.75)return a-=1.5/2.75,7.5625*a*a+0.75;if(a<2.5/2.75)return a-=2.25/2.75,7.5625*a*a+0.9375;a-=2.625/2.75;return 7.5625*a*a+0.984375};cc._easeBounceInObj={easing:function(a){return 1-cc._bounceTime(1-a)},reverse:function(){return cc._easeBounceOutObj}};cc.easeBounceIn=function(){return cc._easeBounceInObj}; cc.EaseBounceOut=cc.EaseBounce.extend({update:function(a){a=this.bounceTime(a);this._inner.update(a)},reverse:function(){return new cc.EaseBounceIn(this._inner.reverse())},clone:function(){var a=new cc.EaseBounceOut;a.initWithAction(this._inner.clone());return a}});cc.EaseBounceOut.create=function(a){return new cc.EaseBounceOut(a)};cc._easeBounceOutObj={easing:function(a){return cc._bounceTime(a)},reverse:function(){return cc._easeBounceInObj}};cc.easeBounceOut=function(){return cc._easeBounceOutObj}; cc.EaseBounceInOut=cc.EaseBounce.extend({update:function(a){var b=0,b=0.5>a?0.5*(1-this.bounceTime(1-2*a)):0.5*this.bounceTime(2*a-1)+0.5;this._inner.update(b)},clone:function(){var a=new cc.EaseBounceInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseBounceInOut(this._inner.reverse())}});cc.EaseBounceInOut.create=function(a){return new cc.EaseBounceInOut(a)}; cc._easeBounceInOutObj={easing:function(a){return a=0.5>a?0.5*(1-cc._bounceTime(1-2*a)):0.5*cc._bounceTime(2*a-1)+0.5},reverse:function(){return cc._easeBounceInOutObj}};cc.easeBounceInOut=function(){return cc._easeBounceInOutObj};cc.EaseBackIn=cc.ActionEase.extend({update:function(a){this._inner.update(0===a||1===a?a:a*a*(2.70158*a-1.70158))},reverse:function(){return new cc.EaseBackOut(this._inner.reverse())},clone:function(){var a=new cc.EaseBackIn;a.initWithAction(this._inner.clone());return a}}); cc.EaseBackIn.create=function(a){return new cc.EaseBackIn(a)};cc._easeBackInObj={easing:function(a){return 0===a||1===a?a:a*a*(2.70158*a-1.70158)},reverse:function(){return cc._easeBackOutObj}};cc.easeBackIn=function(){return cc._easeBackInObj}; cc.EaseBackOut=cc.ActionEase.extend({update:function(a){a-=1;this._inner.update(a*a*(2.70158*a+1.70158)+1)},reverse:function(){return new cc.EaseBackIn(this._inner.reverse())},clone:function(){var a=new cc.EaseBackOut;a.initWithAction(this._inner.clone());return a}});cc.EaseBackOut.create=function(a){return new cc.EaseBackOut(a)};cc._easeBackOutObj={easing:function(a){a-=1;return a*a*(2.70158*a+1.70158)+1},reverse:function(){return cc._easeBackInObj}};cc.easeBackOut=function(){return cc._easeBackOutObj}; cc.EaseBackInOut=cc.ActionEase.extend({update:function(a){a*=2;1>a?this._inner.update(a*a*(3.5949095*a-2.5949095)/2):(a-=2,this._inner.update(a*a*(3.5949095*a+2.5949095)/2+1))},clone:function(){var a=new cc.EaseBackInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseBackInOut(this._inner.reverse())}});cc.EaseBackInOut.create=function(a){return new cc.EaseBackInOut(a)}; cc._easeBackInOutObj={easing:function(a){a*=2;if(1>a)return a*a*(3.5949095*a-2.5949095)/2;a-=2;return a*a*(3.5949095*a+2.5949095)/2+1},reverse:function(){return cc._easeBackInOutObj}};cc.easeBackInOut=function(){return cc._easeBackInOutObj}; cc.EaseBezierAction=cc.ActionEase.extend({_p0:null,_p1:null,_p2:null,_p3:null,ctor:function(a){cc.ActionEase.prototype.ctor.call(this,a)},_updateTime:function(a,b,c,d,e){return Math.pow(1-e,3)*a+3*e*Math.pow(1-e,2)*b+3*Math.pow(e,2)*(1-e)*c+Math.pow(e,3)*d},update:function(a){a=this._updateTime(this._p0,this._p1,this._p2,this._p3,a);this._inner.update(a)},clone:function(){var a=new cc.EaseBezierAction;a.initWithAction(this._inner.clone());a.setBezierParamer(this._p0,this._p1,this._p2,this._p3);return a}, reverse:function(){var a=new cc.EaseBezierAction(this._inner.reverse());a.setBezierParamer(this._p3,this._p2,this._p1,this._p0);return a},setBezierParamer:function(a,b,c,d){this._p0=a||0;this._p1=b||0;this._p2=c||0;this._p3=d||0}});cc.EaseBezierAction.create=function(a){return new cc.EaseBezierAction(a)};cc.easeBezierAction=function(a,b,c,d){return{easing:function(e){return cc.EaseBezierAction.prototype._updateTime(a,b,c,d,e)},reverse:function(){return cc.easeBezierAction(d,c,b,a)}}}; cc.EaseQuadraticActionIn=cc.ActionEase.extend({_updateTime:function(a){return Math.pow(a,2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuadraticActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuadraticActionIn(this._inner.reverse())}});cc.EaseQuadraticActionIn.create=function(a){return new cc.EaseQuadraticActionIn(a)};cc._easeQuadraticActionIn={easing:cc.EaseQuadraticActionIn.prototype._updateTime,reverse:function(){return cc._easeQuadraticActionIn}}; cc.easeQuadraticActionIn=function(){return cc._easeQuadraticActionIn};cc.EaseQuadraticActionOut=cc.ActionEase.extend({_updateTime:function(a){return-a*(a-2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuadraticActionOut;a.initWithAction();return a},reverse:function(){return new cc.EaseQuadraticActionOut(this._inner.reverse())}});cc.EaseQuadraticActionOut.create=function(a){return new cc.EaseQuadraticActionOut(a)}; cc._easeQuadraticActionOut={easing:cc.EaseQuadraticActionOut.prototype._updateTime,reverse:function(){return cc._easeQuadraticActionOut}};cc.easeQuadraticActionOut=function(){return cc._easeQuadraticActionOut}; cc.EaseQuadraticActionInOut=cc.ActionEase.extend({_updateTime:function(a){var b=a;a*=2;1>a?b=a*a*0.5:(--a,b=-0.5*(a*(a-2)-1));return b},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuadraticActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuadraticActionInOut(this._inner.reverse())}});cc.EaseQuadraticActionInOut.create=function(a){return new cc.EaseQuadraticActionInOut(a)}; cc._easeQuadraticActionInOut={easing:cc.EaseQuadraticActionInOut.prototype._updateTime,reverse:function(){return cc._easeQuadraticActionInOut}};cc.easeQuadraticActionInOut=function(){return cc._easeQuadraticActionInOut};cc.EaseQuarticActionIn=cc.ActionEase.extend({_updateTime:function(a){return a*a*a*a},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuarticActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuarticActionIn(this._inner.reverse())}}); cc.EaseQuarticActionIn.create=function(a){return new cc.EaseQuarticActionIn(a)};cc._easeQuarticActionIn={easing:cc.EaseQuarticActionIn.prototype._updateTime,reverse:function(){return cc._easeQuarticActionIn}};cc.easeQuarticActionIn=function(){return cc._easeQuarticActionIn}; cc.EaseQuarticActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return-(a*a*a*a-1)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuarticActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuarticActionOut(this._inner.reverse())}});cc.EaseQuarticActionOut.create=function(a){return new cc.EaseQuarticActionOut(a)};cc._easeQuarticActionOut={easing:cc.EaseQuarticActionOut.prototype._updateTime,reverse:function(){return cc._easeQuarticActionOut}}; cc.easeQuarticActionOut=function(){return cc._easeQuarticActionOut};cc.EaseQuarticActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return 0.5*a*a*a*a;a-=2;return-0.5*(a*a*a*a-2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuarticActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuarticActionInOut(this._inner.reverse())}});cc.EaseQuarticActionInOut.create=function(a){return new cc.EaseQuarticActionInOut(a)}; cc._easeQuarticActionInOut={easing:cc.EaseQuarticActionInOut.prototype._updateTime,reverse:function(){return cc._easeQuarticActionInOut}};cc.easeQuarticActionInOut=function(){return cc._easeQuarticActionInOut};cc.EaseQuinticActionIn=cc.ActionEase.extend({_updateTime:function(a){return a*a*a*a*a},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuinticActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuinticActionIn(this._inner.reverse())}}); cc.EaseQuinticActionIn.create=function(a){return new cc.EaseQuinticActionIn(a)};cc._easeQuinticActionIn={easing:cc.EaseQuinticActionIn.prototype._updateTime,reverse:function(){return cc._easeQuinticActionIn}};cc.easeQuinticActionIn=function(){return cc._easeQuinticActionIn}; cc.EaseQuinticActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return a*a*a*a*a+1},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuinticActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuinticActionOut(this._inner.reverse())}});cc.EaseQuinticActionOut.create=function(a){return new cc.EaseQuinticActionOut(a)};cc._easeQuinticActionOut={easing:cc.EaseQuinticActionOut.prototype._updateTime,reverse:function(){return cc._easeQuinticActionOut}}; cc.easeQuinticActionOut=function(){return cc._easeQuinticActionOut};cc.EaseQuinticActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return 0.5*a*a*a*a*a;a-=2;return 0.5*(a*a*a*a*a+2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuinticActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuinticActionInOut(this._inner.reverse())}});cc.EaseQuinticActionInOut.create=function(a){return new cc.EaseQuinticActionInOut(a)}; cc._easeQuinticActionInOut={easing:cc.EaseQuinticActionInOut.prototype._updateTime,reverse:function(){return cc._easeQuinticActionInOut}};cc.easeQuinticActionInOut=function(){return cc._easeQuinticActionInOut};cc.EaseCircleActionIn=cc.ActionEase.extend({_updateTime:function(a){return-1*(Math.sqrt(1-a*a)-1)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCircleActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCircleActionIn(this._inner.reverse())}}); cc.EaseCircleActionIn.create=function(a){return new cc.EaseCircleActionIn(a)};cc._easeCircleActionIn={easing:cc.EaseCircleActionIn.prototype._updateTime,reverse:function(){return cc._easeCircleActionIn}};cc.easeCircleActionIn=function(){return cc._easeCircleActionIn}; cc.EaseCircleActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return Math.sqrt(1-a*a)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCircleActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCircleActionOut(this._inner.reverse())}});cc.EaseCircleActionOut.create=function(a){return new cc.EaseCircleActionOut(a)};cc._easeCircleActionOut={easing:cc.EaseCircleActionOut.prototype._updateTime,reverse:function(){return cc._easeCircleActionOut}}; cc.easeCircleActionOut=function(){return cc._easeCircleActionOut};cc.EaseCircleActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return-0.5*(Math.sqrt(1-a*a)-1);a-=2;return 0.5*(Math.sqrt(1-a*a)+1)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCircleActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCircleActionInOut(this._inner.reverse())}});cc.EaseCircleActionInOut.create=function(a){return new cc.EaseCircleActionInOut(a)}; cc._easeCircleActionInOut={easing:cc.EaseCircleActionInOut.prototype._updateTime,reverse:function(){return cc._easeCircleActionInOut}};cc.easeCircleActionInOut=function(){return cc._easeCircleActionInOut};cc.EaseCubicActionIn=cc.ActionEase.extend({_updateTime:function(a){return a*a*a},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCubicActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCubicActionIn(this._inner.reverse())}}); cc.EaseCubicActionIn.create=function(a){return new cc.EaseCubicActionIn(a)};cc._easeCubicActionIn={easing:cc.EaseCubicActionIn.prototype._updateTime,reverse:function(){return cc._easeCubicActionIn}};cc.easeCubicActionIn=function(){return cc._easeCubicActionIn}; cc.EaseCubicActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return a*a*a+1},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCubicActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCubicActionOut(this._inner.reverse())}});cc.EaseCubicActionOut.create=function(a){return new cc.EaseCubicActionOut(a)};cc._easeCubicActionOut={easing:cc.EaseCubicActionOut.prototype._updateTime,reverse:function(){return cc._easeCubicActionOut}}; cc.easeCubicActionOut=function(){return cc._easeCubicActionOut};cc.EaseCubicActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return 0.5*a*a*a;a-=2;return 0.5*(a*a*a+2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCubicActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCubicActionInOut(this._inner.reverse())}});cc.EaseCubicActionInOut.create=function(a){return new cc.EaseCubicActionInOut(a)}; cc._easeCubicActionInOut={easing:cc.EaseCubicActionInOut.prototype._updateTime,reverse:function(){return cc._easeCubicActionInOut}};cc.easeCubicActionInOut=function(){return cc._easeCubicActionInOut};cc.cardinalSplineAt=function(a,b,c,d,e,f,g){var h=f*f,k=h*f,m=(1-e)/2;e=m*(-k+2*h-f);var n=m*(-k+h)+(2*k-3*h+1);f=m*(k-2*h+f)+(-2*k+3*h);k=m*(k-h);h=a.x*e+b.x*n+c.x*f+d.x*k;a=a.y*e+b.y*n+c.y*f+d.y*k;if(void 0!==g)g.x=h,g.y=a;else return cc.p(h,a)};cc.reverseControlPoints=function(a){for(var b=[],c=a.length-1;0<=c;c--)b.push(cc.p(a[c].x,a[c].y));return b};cc.cloneControlPoints=function(a){for(var b=[],c=0;c<a.length;c++)b.push(cc.p(a[c].x,a[c].y));return b};cc.copyControlPoints=cc.cloneControlPoints; cc.getControlPointAt=function(a,b){var c=Math.min(a.length-1,Math.max(b,0));return a[c]};cc.reverseControlPointsInline=function(a){for(var b=a.length,c=0|b/2,d=0;d<c;++d){var e=a[d];a[d]=a[b-d-1];a[b-d-1]=e}}; cc.CardinalSplineTo=cc.ActionInterval.extend({_points:null,_deltaT:0,_tension:0,_previousPosition:null,_accumulatedDiff:null,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);this._points=[];void 0!==c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){if(!b||0===b.length)throw Error("Invalid configuration. It must at least have one control point");return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this.setPoints(b),this._tension=c,!0):!1},clone:function(){var a= new cc.CardinalSplineTo;a.initWithDuration(this._duration,cc.copyControlPoints(this._points),this._tension);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);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(a){a=this._computeEaseTime(a);var b,c=this._points;if(1===a)b=c.length-1,a=1;else{var d=this._deltaT;b=0|a/d;a=(a-d*b)/d}b=cc.cardinalSplineAt(cc.getControlPointAt(c, b-1),cc.getControlPointAt(c,b-0),cc.getControlPointAt(c,b+1),cc.getControlPointAt(c,b+2),this._tension,a);cc.ENABLE_STACKABLE_ACTIONS&&(c=this.target.getPositionX()-this._previousPosition.x,a=this.target.getPositionY()-this._previousPosition.y,0!==c||0!==a)&&(d=this._accumulatedDiff,c=d.x+c,a=d.y+a,d.x=c,d.y=a,b.x+=c,b.y+=a);this.updatePosition(b)},reverse:function(){var a=cc.reverseControlPoints(this._points);return cc.cardinalSplineTo(this._duration,a,this._tension)},updatePosition:function(a){this.target.setPosition(a); this._previousPosition=a},getPoints:function(){return this._points},setPoints:function(a){this._points=a}});cc.cardinalSplineTo=function(a,b,c){return new cc.CardinalSplineTo(a,b,c)};cc.CardinalSplineTo.create=cc.cardinalSplineTo; cc.CardinalSplineBy=cc.CardinalSplineTo.extend({_startPosition:null,ctor:function(a,b,c){cc.CardinalSplineTo.prototype.ctor.call(this);this._startPosition=cc.p(0,0);void 0!==c&&this.initWithDuration(a,b,c)},startWithTarget:function(a){cc.CardinalSplineTo.prototype.startWithTarget.call(this,a);this._startPosition.x=a.getPositionX();this._startPosition.y=a.getPositionY()},reverse:function(){for(var a=this._points.slice(),b,c=a[0],d=1;d<a.length;++d)b=a[d],a[d]=cc.pSub(b,c),c=b;a=cc.reverseControlPoints(a); c=a[a.length-1];a.pop();c.x=-c.x;c.y=-c.y;a.unshift(c);for(d=1;d<a.length;++d)b=a[d],b.x=-b.x,b.y=-b.y,b.x+=c.x,b.y+=c.y,c=a[d]=b;return cc.cardinalSplineBy(this._duration,a,this._tension)},updatePosition:function(a){var b=this._startPosition,c=a.x+b.x;a=a.y+b.y;this._previousPosition.x=c;this._previousPosition.y=a;this.target.setPosition(c,a)},clone:function(){var a=new cc.CardinalSplineBy;a.initWithDuration(this._duration,cc.copyControlPoints(this._points),this._tension);return a}}); cc.cardinalSplineBy=function(a,b,c){return new cc.CardinalSplineBy(a,b,c)};cc.CardinalSplineBy.create=cc.cardinalSplineBy;cc.CatmullRomTo=cc.CardinalSplineTo.extend({ctor:function(a,b){b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.CardinalSplineTo.prototype.initWithDuration.call(this,a,b,0.5)},clone:function(){var a=new cc.CatmullRomTo;a.initWithDuration(this._duration,cc.copyControlPoints(this._points));return a}}); cc.catmullRomTo=function(a,b){return new cc.CatmullRomTo(a,b)};cc.CatmullRomTo.create=cc.catmullRomTo;cc.CatmullRomBy=cc.CardinalSplineBy.extend({ctor:function(a,b){cc.CardinalSplineBy.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.CardinalSplineTo.prototype.initWithDuration.call(this,a,b,0.5)},clone:function(){var a=new cc.CatmullRomBy;a.initWithDuration(this._duration,cc.copyControlPoints(this._points));return a}}); cc.catmullRomBy=function(a,b){return new cc.CatmullRomBy(a,b)};cc.CatmullRomBy.create=cc.catmullRomBy;cc.ActionTweenDelegate=cc.Class.extend({updateTweenAction:function(a,b){}}); cc.ActionTween=cc.ActionInterval.extend({key:"",from:0,to:0,delta:0,ctor:function(a,b,c,d){cc.ActionInterval.prototype.ctor.call(this);this.key="";void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this.key=b,this.to=d,this.from=c,!0):!1},startWithTarget:function(a){if(!a||!a.updateTweenAction)throw Error("cc.ActionTween.startWithTarget(): target must be non-null, and target must implement updateTweenAction function");cc.ActionInterval.prototype.startWithTarget.call(this, a);this.delta=this.to-this.from},update:function(a){this.target.updateTweenAction(this.to-this.delta*(1-a),this.key)},reverse:function(){return new cc.ActionTween(this.duration,this.key,this.to,this.from)},clone:function(){var a=new cc.ActionTween;a.initWithDuration(this._duration,this.key,this.from,this.to);return a}});cc.actionTween=function(a,b,c,d){return new cc.ActionTween(a,b,c,d)};cc.ActionTween.create=cc.actionTween;cc.GridAction=cc.ActionInterval.extend({_gridSize:null,_gridNodeTarget:null,ctor:function(a,b){cc.sys._checkWebGLRenderMode();cc.ActionInterval.prototype.ctor.call(this);this._gridSize=cc.size(0,0);b&&this.initWithDuration(a,b)},_cacheTargetAsGridNode:function(a){this._gridNodeTarget=a},clone:function(){var a=new cc.GridAction,b=this._gridSize;a.initWithDuration(this._duration,cc.size(b.width,b.height));return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a); cc.renderer.childrenOrderDirty=!0;this._cacheTargetAsGridNode(a);var b=this.getGrid();(a=this._gridNodeTarget.getGrid())&&0<a.getReuseGrid()?(b=a.getGridSize(),a.isActive()&&b.width===this._gridSize.width&&b.height===this._gridSize.height&&a.reuse()):(a&&a.isActive()&&a.setActive(!1),this._gridNodeTarget.setGrid(b),this._gridNodeTarget.getGrid().setActive(!0))},reverse:function(){return new cc.ReverseTime(this)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this, a)?(this._gridSize.width=b.width,this._gridSize.height=b.height,!0):!1},getGrid:function(){cc.log("cc.GridAction.getGrid(): it should be overridden in subclass.")}});cc.gridAction=function(a,b){return new cc.GridAction(a,b)};cc.GridAction.create=cc.gridAction; cc.Grid3DAction=cc.GridAction.extend({getGrid:function(){return new cc.Grid3D(this._gridSize,void 0,void 0,this._gridNodeTarget.getGridRect())},getGridRect:function(){return this._gridNodeTarget.getGridRect()},vertex:function(a){return this.getVertex(a)},getVertex:function(a){return this.target.grid.getVertex(a)},originalVertex:function(a){return this.getOriginalVertex(a)},getOriginalVertex:function(a){return this.target.grid.originalVertex(a)},setVertex:function(a,b){this.target.grid.setVertex(a, b)}});cc.grid3DAction=function(a,b){return new cc.Grid3DAction(a,b)};cc.Grid3DAction.create=cc.grid3DAction;cc.TiledGrid3DAction=cc.GridAction.extend({tile:function(a){return this.getTile(a)},getTile:function(a){return this.target.grid.tile(a)},originalTile:function(a){return this.getOriginalTile(a)},getOriginalTile:function(a){return this.target.grid.originalTile(a)},setTile:function(a,b){this.target.grid.setTile(a,b)},getGrid:function(){return new cc.TiledGrid3D(this._gridSize,void 0,void 0,this._gridNodeTarget.getGridRect())}}); cc.tiledGrid3DAction=function(a,b){return new cc.TiledGrid3DAction(a,b)};cc.TiledGrid3DAction.create=cc.tiledGrid3DAction;cc.StopGrid=cc.ActionInstant.extend({startWithTarget:function(a){cc.ActionInstant.prototype.startWithTarget.call(this,a);cc.renderer.childrenOrderDirty=!0;(a=this.target.grid)&&a.isActive()&&a.setActive(!1)}});cc.stopGrid=function(){return new cc.StopGrid};cc.StopGrid.create=cc.stopGrid; cc.ReuseGrid=cc.ActionInstant.extend({_times:null,ctor:function(a){cc.ActionInstant.prototype.ctor.call(this);void 0!==a&&this.initWithTimes(a)},initWithTimes:function(a){this._times=a;return!0},startWithTarget:function(a){cc.ActionInstant.prototype.startWithTarget.call(this,a);cc.renderer.childrenOrderDirty=!0;this.target.grid&&this.target.grid.isActive()&&this.target.grid.setReuseGrid(this.target.grid.getReuseGrid()+this._times)}});cc.reuseGrid=function(a){return new cc.ReuseGrid(a)}; cc.ReuseGrid.create=cc.reuseGrid;cc.Waves3D=cc.Grid3DAction.extend({_waves:0,_amplitude:0,_amplitudeRate:0,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},getAmplitude:function(){return this._amplitude},setAmplitude:function(a){this._amplitude=a},getAmplitudeRate:function(){return this._amplitudeRate},setAmplitudeRate:function(a){this._amplitudeRate=a},initWithDuration:function(a,b,c,d){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,b)?(this._waves=c,this._amplitude= d,this._amplitudeRate=1,!0):!1},update:function(a){for(var b=this._gridSize,c=this._amplitude,d=cc.p(0,0),e=this._amplitudeRate,f=this._waves,g=0;g<b.width+1;++g)for(var h=0;h<b.height+1;++h){d.x=g;d.y=h;var k=this.originalVertex(d);k.z+=Math.sin(Math.PI*a*f*2+0.01*(k.y+k.x))*c*e;this.setVertex(d,k)}}});cc.waves3D=function(a,b,c,d){return new cc.Waves3D(a,b,c,d)};cc.Waves3D.create=cc.waves3D; cc.FlipX3D=cc.Grid3DAction.extend({ctor:function(a){void 0!==a?cc.GridAction.prototype.ctor.call(this,a,cc.size(1,1)):cc.GridAction.prototype.ctor.call(this)},initWithDuration:function(a){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,cc.size(1,1))},initWithSize:function(a,b){return 1!==a.width||1!==a.height?(cc.log("Grid size must be (1,1)"),!1):cc.Grid3DAction.prototype.initWithDuration.call(this,b,a)},update:function(a){var b=Math.PI*a;a=Math.sin(b);var c=Math.cos(b/2),b=new cc.Vertex3F, d=cc.p(0,0);d.x=d.y=1;var e=this.originalVertex(d);d.x=d.y=0;var d=this.originalVertex(d),f=e.x,g=d.x,h,k;f>g?(e=cc.p(0,0),d=cc.p(0,1),h=cc.p(1,0),k=cc.p(1,1)):(h=cc.p(0,0),k=cc.p(0,1),e=cc.p(1,0),d=cc.p(1,1),f=g);b.x=f-f*c;b.z=Math.abs(parseFloat(f*a/4));a=this.originalVertex(e);a.x=b.x;a.z+=b.z;this.setVertex(e,a);a=this.originalVertex(d);a.x=b.x;a.z+=b.z;this.setVertex(d,a);a=this.originalVertex(h);a.x-=b.x;a.z-=b.z;this.setVertex(h,a);a=this.originalVertex(k);a.x-=b.x;a.z-=b.z;this.setVertex(k, a)}});cc.flipX3D=function(a){return new cc.FlipX3D(a)};cc.FlipX3D.create=cc.flipX3D; cc.FlipY3D=cc.FlipX3D.extend({ctor:function(a){void 0!==a?cc.GridAction.prototype.ctor.call(this,a,cc.size(1,1)):cc.GridAction.prototype.ctor.call(this)},update:function(a){var b=Math.PI*a;a=Math.sin(b);var c=Math.cos(b/2),b=new cc.Vertex3F,d=cc.p(0,0);d.x=d.y=1;var e=this.originalVertex(d);d.x=d.y=0;var d=this.originalVertex(d),f=e.y,g=d.y,h,k;f>g?(e=cc.p(0,0),d=cc.p(0,1),h=cc.p(1,0),k=cc.p(1,1)):(d=cc.p(0,0),e=cc.p(0,1),k=cc.p(1,0),h=cc.p(1,1),f=g);b.y=f-f*c;b.z=Math.abs(parseFloat(f*a)/4);a=this.originalVertex(e); a.y=b.y;a.z+=b.z;this.setVertex(e,a);a=this.originalVertex(d);a.y-=b.y;a.z-=b.z;this.setVertex(d,a);a=this.originalVertex(h);a.y=b.y;a.z+=b.z;this.setVertex(h,a);a=this.originalVertex(k);a.y-=b.y;a.z-=b.z;this.setVertex(k,a)}});cc.flipY3D=function(a){return new cc.FlipY3D(a)};cc.FlipY3D.create=cc.flipY3D; cc.Lens3D=cc.Grid3DAction.extend({_position:null,_radius:0,_lensEffect:0,_concave:!1,_dirty:!1,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);this._position=cc.p(0,0);void 0!==d&&this.initWithDuration(a,b,c,d)},getLensEffect:function(){return this._lensEffect},setLensEffect:function(a){this._lensEffect=a},setConcave:function(a){this._concave=a},getPosition:function(){return this._position},setPosition:function(a){cc.pointEqualToPoint(a,this._position)||(this._position.x=a.x,this._position.y= a.y,this._dirty=!0)},initWithDuration:function(a,b,c,d){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,b)?(this.setPosition(c),this._radius=d,this._lensEffect=0.7,this._dirty=!0):!1},update:function(a){if(this._dirty){a=this._gridSize.width;for(var b=this._gridSize.height,c=this._radius,d=this._lensEffect,e=cc.p(0,0),f=cc.p(0,0),g,h,k,m=0;m<a+1;++m)for(var n=0;n<b+1;++n)e.x=m,e.y=n,g=this.originalVertex(e),f.x=this._position.x-g.x,f.y=this._position.y-g.y,h=cc.pLength(f),h<c&&(h=c- h,h/=c,0===h&&(h=0.001),h=Math.log(h)*d,k=Math.exp(h)*c,h=cc.pLength(f),0<h&&(f.x/=h,f.y/=h,f.x*=k,f.y*=k,g.z+=cc.pLength(f)*d)),this.setVertex(e,g);this._dirty=!1}}});cc.lens3D=function(a,b,c,d){return new cc.Lens3D(a,b,c,d)};cc.Lens3D.create=cc.lens3D; cc.Ripple3D=cc.Grid3DAction.extend({_position:null,_radius:0,_waves:0,_amplitude:0,_amplitudeRate:0,ctor:function(a,b,c,d,e,f){cc.GridAction.prototype.ctor.call(this);this._position=cc.p(0,0);void 0!==f&&this.initWithDuration(a,b,c,d,e,f)},getPosition:function(){return this._position},setPosition:function(a){this._position.x=a.x;this._position.y=a.y},getAmplitude:function(){return this._amplitude},setAmplitude:function(a){this._amplitude=a},getAmplitudeRate:function(){return this._amplitudeRate}, setAmplitudeRate:function(a){this._amplitudeRate=a},initWithDuration:function(a,b,c,d,e,f){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,b)?(this.setPosition(c),this._radius=d,this._waves=e,this._amplitude=f,this._amplitudeRate=1,!0):!1},update:function(a){for(var b=this._gridSize.width,c=this._gridSize.height,d=cc.p(0,0),e=this._radius,f=this._waves,g=this._amplitude,h=this._amplitudeRate,k,m,n=cc.p(0,0),p=0;p<b+1;++p)for(var r=0;r<c+1;++r){d.x=p;d.y=r;k=this.originalVertex(d);n.x= this._position.x-k.x;n.y=this._position.y-k.y;m=cc.pLength(n);if(m<e){m=e-m;var s=Math.pow(m/e,2);k.z+=Math.sin(a*Math.PI*f*2+0.1*m)*g*h*s}this.setVertex(d,k)}}});cc.ripple3D=function(a,b,c,d,e,f){return new cc.Ripple3D(a,b,c,d,e,f)};cc.Ripple3D.create=cc.ripple3D; cc.Shaky3D=cc.Grid3DAction.extend({_randRange:0,_shakeZ:!1,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,b)?(this._randRange=c,this._shakeZ=d,!0):!1},update:function(a){a=this._gridSize.width;for(var b=this._gridSize.height,c=this._randRange,d=this._shakeZ,e=cc.p(0,0),f,g=0;g<a+1;++g)for(var h=0;h<b+1;++h)e.x=g,e.y=h,f=this.originalVertex(e), f.x+=cc.rand()%(2*c)-c,f.y+=cc.rand()%(2*c)-c,d&&(f.z+=cc.rand()%(2*c)-c),this.setVertex(e,f)}});cc.shaky3D=function(a,b,c,d){return new cc.Shaky3D(a,b,c,d)};cc.Shaky3D.create=cc.shaky3D; cc.Liquid=cc.Grid3DAction.extend({_waves:0,_amplitude:0,_amplitudeRate:0,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},getAmplitude:function(){return this._amplitude},setAmplitude:function(a){this._amplitude=a},getAmplitudeRate:function(){return this._amplitudeRate},setAmplitudeRate:function(a){this._amplitudeRate=a},initWithDuration:function(a,b,c,d){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,b)?(this._waves=c,this._amplitude= d,this._amplitudeRate=1,!0):!1},update:function(a){for(var b=this._gridSize.width,c=this._gridSize.height,d=cc.p(0,0),e=this._waves,f=this._amplitude,g=this._amplitudeRate,h,k=1;k<b;++k)for(var m=1;m<c;++m)d.x=k,d.y=m,h=this.originalVertex(d),h.x+=Math.sin(a*Math.PI*e*2+0.01*h.x)*f*g,h.y+=Math.sin(a*Math.PI*e*2+0.01*h.y)*f*g,this.setVertex(d,h)}});cc.liquid=function(a,b,c,d){return new cc.Liquid(a,b,c,d)};cc.Liquid.create=cc.liquid; cc.Waves=cc.Grid3DAction.extend({_waves:0,_amplitude:0,_amplitudeRate:0,_vertical:!1,_horizontal:!1,ctor:function(a,b,c,d,e,f){cc.GridAction.prototype.ctor.call(this);void 0!==f&&this.initWithDuration(a,b,c,d,e,f)},getAmplitude:function(){return this._amplitude},setAmplitude:function(a){this._amplitude=a},getAmplitudeRate:function(){return this._amplitudeRate},setAmplitudeRate:function(a){this._amplitudeRate=a},initWithDuration:function(a,b,c,d,e,f){return cc.Grid3DAction.prototype.initWithDuration.call(this, a,b)?(this._waves=c,this._amplitude=d,this._amplitudeRate=1,this._horizontal=e,this._vertical=f,!0):!1},update:function(a){for(var b=this._gridSize.width,c=this._gridSize.height,d=cc.p(0,0),e=this._vertical,f=this._horizontal,g=this._waves,h=this._amplitude,k=this._amplitudeRate,m,n=0;n<b+1;++n)for(var p=0;p<c+1;++p)d.x=n,d.y=p,m=this.originalVertex(d),e&&(m.x+=Math.sin(a*Math.PI*g*2+0.01*m.y)*h*k),f&&(m.y+=Math.sin(a*Math.PI*g*2+0.01*m.x)*h*k),this.setVertex(d,m)}}); cc.waves=function(a,b,c,d,e,f){return new cc.Waves(a,b,c,d,e,f)};cc.Waves.create=cc.waves; cc.Twirl=cc.Grid3DAction.extend({_position:null,_twirls:0,_amplitude:0,_amplitudeRate:0,ctor:function(a,b,c,d,e){cc.GridAction.prototype.ctor.call(this);this._position=cc.p(0,0);void 0!==e&&this.initWithDuration(a,b,c,d,e)},getPosition:function(){return this._position},setPosition:function(a){this._position.x=a.x;this._position.y=a.y},getAmplitude:function(){return this._amplitude},setAmplitude:function(a){this._amplitude=a},getAmplitudeRate:function(){return this._amplitudeRate},setAmplitudeRate:function(a){this._amplitudeRate= a},initWithDuration:function(a,b,c,d,e){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,b)?(this.setPosition(c),this._twirls=d,this._amplitude=e,this._amplitudeRate=1,!0):!1},update:function(a){for(var b=this._position,c=this._gridSize.width,d=this._gridSize.height,e=cc.p(0,0),f=0.1*this._amplitude*this._amplitudeRate,g=this._twirls,h,k,m,n=cc.p(0,0),p=0;p<c+1;++p)for(var r=0;r<d+1;++r)e.x=p,e.y=r,h=this.originalVertex(e),n.x=p-c/2,n.y=r-d/2,k=cc.pLength(n)*Math.cos(Math.PI/2+a*Math.PI* g*2)*f,m=Math.sin(k)*(h.y-b.y)+Math.cos(k)*(h.x-b.x),k=Math.cos(k)*(h.y-b.y)-Math.sin(k)*(h.x-b.x),h.x=b.x+m,h.y=b.y+k,this.setVertex(e,h)}});cc.twirl=function(a,b,c,d,e){return new cc.Twirl(a,b,c,d,e)};cc.Twirl.create=cc.twirl;cc.ShakyTiles3D=cc.TiledGrid3DAction.extend({_randRange:0,_shakeZ:!1,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,b)?(this._randRange=c,this._shakeZ=d,!0):!1},update:function(a){a=this._gridSize;for(var b=this._randRange,c=cc.p(0,0),d=0;d<a.width;++d)for(var e=0;e<a.height;++e){c.x=d;c.y=e;var f=this.originalTile(c);f.bl.x+=cc.rand()%(2* b)-b;f.br.x+=cc.rand()%(2*b)-b;f.tl.x+=cc.rand()%(2*b)-b;f.tr.x+=cc.rand()%(2*b)-b;f.bl.y+=cc.rand()%(2*b)-b;f.br.y+=cc.rand()%(2*b)-b;f.tl.y+=cc.rand()%(2*b)-b;f.tr.y+=cc.rand()%(2*b)-b;this._shakeZ&&(f.bl.z+=cc.rand()%(2*b)-b,f.br.z+=cc.rand()%(2*b)-b,f.tl.z+=cc.rand()%(2*b)-b,f.tr.z+=cc.rand()%(2*b)-b);this.setTile(c,f)}}});cc.shakyTiles3D=function(a,b,c,d){return new cc.ShakyTiles3D(a,b,c,d)};cc.ShakyTiles3D.create=cc.shakyTiles3D; cc.ShatteredTiles3D=cc.TiledGrid3DAction.extend({_randRange:0,_once:!1,_shatterZ:!1,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,b)?(this._once=!1,this._randRange=c,this._shatterZ=d,!0):!1},update:function(a){if(!1===this._once){a=this._gridSize;for(var b=this._randRange,c,d=cc.p(0,0),e=0;e<a.width;++e)for(var f=0;f<a.height;++f)d.x=e, d.y=f,c=this.originalTile(d),c.bl.x+=cc.rand()%(2*b)-b,c.br.x+=cc.rand()%(2*b)-b,c.tl.x+=cc.rand()%(2*b)-b,c.tr.x+=cc.rand()%(2*b)-b,c.bl.y+=cc.rand()%(2*b)-b,c.br.y+=cc.rand()%(2*b)-b,c.tl.y+=cc.rand()%(2*b)-b,c.tr.y+=cc.rand()%(2*b)-b,this._shatterZ&&(c.bl.z+=cc.rand()%(2*b)-b,c.br.z+=cc.rand()%(2*b)-b,c.tl.z+=cc.rand()%(2*b)-b,c.tr.z+=cc.rand()%(2*b)-b),this.setTile(d,c);this._once=!0}}});cc.shatteredTiles3D=function(a,b,c,d){return new cc.ShatteredTiles3D(a,b,c,d)}; cc.ShatteredTiles3D.create=cc.shatteredTiles3D;cc.Tile=function(a,b,c){this.position=a||cc.p(0,0);this.startPosition=b||cc.p(0,0);this.delta=c||cc.p(0,0)}; cc.ShuffleTiles=cc.TiledGrid3DAction.extend({_seed:0,_tilesCount:0,_tilesOrder:null,_tiles:null,ctor:function(a,b,c){cc.GridAction.prototype.ctor.call(this);this._tilesOrder=[];this._tiles=[];void 0!==c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,b)?(this._seed=c,this._tilesOrder.length=0,this._tiles.length=0,!0):!1},shuffle:function(a,b){for(var c=b-1;0<=c;c--){var d=0|cc.rand()%(c+1),e=a[c];a[c]=a[d];a[d]=e}}, getDelta:function(a){var b=this._gridSize,c=a.width*b.height+a.height;return cc.size(this._tilesOrder[c]/b.height-a.width,this._tilesOrder[c]%b.height-a.height)},placeTile:function(a,b){var c=this.originalTile(a),d=this.target.grid.getStep(),e=b.position;c.bl.x+=e.x*d.x;c.bl.y+=e.y*d.y;c.br.x+=e.x*d.x;c.br.y+=e.y*d.y;c.tl.x+=e.x*d.x;c.tl.y+=e.y*d.y;c.tr.x+=e.x*d.x;c.tr.y+=e.y*d.y;this.setTile(a,c)},startWithTarget:function(a){cc.TiledGrid3DAction.prototype.startWithTarget.call(this,a);a=this._gridSize; this._tilesCount=a.width*a.height;for(var b=this._tilesOrder,c=b.length=0;c<this._tilesCount;++c)b[c]=c;this.shuffle(b,this._tilesCount);for(var b=this._tiles,c=b.length=0,d=cc.size(0,0),e=0;e<a.width;++e)for(var f=0;f<a.height;++f)b[c]=new cc.Tile,b[c].position=cc.p(e,f),b[c].startPosition=cc.p(e,f),d.width=e,d.height=f,b[c].delta=this.getDelta(d),++c},update:function(a){for(var b=0,c=this._gridSize,d=this._tiles,e,f=cc.p(0,0),g=0;g<c.width;++g)for(var h=0;h<c.height;++h)f.x=g,f.y=h,e=d[b],e.position.x= e.delta.width*a,e.position.y=e.delta.height*a,this.placeTile(f,e),++b}});cc.shuffleTiles=function(a,b,c){return new cc.ShuffleTiles(a,b,c)};cc.ShuffleTiles.create=cc.shuffleTiles; cc.FadeOutTRTiles=cc.TiledGrid3DAction.extend({testFunc:function(a,b){var c=this._gridSize.width*b,d=this._gridSize.height*b;return c===this._gridSize.width&&d===this._gridSize.height?0:0===c+d?1:Math.pow((a.x+a.y)/(c+d),6)},turnOnTile:function(a){this.setTile(a,this.originalTile(a))},turnOffTile:function(a){this.setTile(a,new cc.Quad3)},transformTile:function(a,b){var c=this.originalTile(a),d=this.target.grid.getStep();c.bl.x+=d.x/2*(1-b);c.bl.y+=d.y/2*(1-b);c.br.x-=d.x/2*(1-b);c.br.y+=d.y/2*(1- b);c.tl.x+=d.x/2*(1-b);c.tl.y-=d.y/2*(1-b);c.tr.x-=d.x/2*(1-b);c.tr.y-=d.y/2*(1-b);this.setTile(a,c)},update:function(a){for(var b=this._gridSize,c=cc.p(0,0),d,e=0;e<b.width;++e)for(var f=0;f<b.height;++f)c.x=e,c.y=f,d=this.testFunc(c,a),0===d?this.turnOffTile(c):1>d?this.transformTile(c,d):this.turnOnTile(c)}});cc.fadeOutTRTiles=function(a,b){return new cc.FadeOutTRTiles(a,b)};cc.FadeOutTRTiles.create=cc.fadeOutTRTiles; cc.FadeOutBLTiles=cc.FadeOutTRTiles.extend({testFunc:function(a,b){var c=this._gridSize.width*(1-b),d=this._gridSize.height*(1-b);return 0===c+d?0:0===a.x+a.y?1:Math.pow((c+d)/(a.x+a.y),6)}});cc.fadeOutBLTiles=function(a,b){return new cc.FadeOutBLTiles(a,b)};cc.FadeOutBLTiles.create=cc.fadeOutBLTiles; cc.FadeOutUpTiles=cc.FadeOutTRTiles.extend({testFunc:function(a,b){var c=this._gridSize.height*b;return c===this._gridSize.height?0:0===c?1:Math.pow(a.y/c,6)},transformTile:function(a,b){var c=this.originalTile(a),d=this.target.grid.getStep();c.bl.y+=d.y/2*(1-b);c.br.y+=d.y/2*(1-b);c.tl.y-=d.y/2*(1-b);c.tr.y-=d.y/2*(1-b);this.setTile(a,c)}});cc.fadeOutUpTiles=function(a,b){return new cc.FadeOutUpTiles(a,b)};cc.FadeOutUpTiles.create=cc.fadeOutUpTiles; cc.FadeOutDownTiles=cc.FadeOutUpTiles.extend({testFunc:function(a,b){var c=this._gridSize.height*(1-b);return 0===c?0:0===a.y?1:Math.pow(c/a.y,6)}});cc.fadeOutDownTiles=function(a,b){return new cc.FadeOutDownTiles(a,b)};cc.FadeOutDownTiles.create=cc.fadeOutDownTiles; cc.TurnOffTiles=cc.TiledGrid3DAction.extend({_seed:null,_tilesCount:0,_tilesOrder:null,ctor:function(a,b,c){cc.GridAction.prototype.ctor.call(this);this._tilesOrder=[];void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,b)?(this._seed=c||0,this._tilesOrder.length=0,!0):!1},shuffle:function(a,b){for(var c=b-1;0<=c;c--){var d=0|cc.rand()%(c+1),e=a[c];a[c]=a[d];a[d]=e}},turnOnTile:function(a){this.setTile(a,this.originalTile(a))}, turnOffTile:function(a){this.setTile(a,new cc.Quad3)},startWithTarget:function(a){cc.TiledGrid3DAction.prototype.startWithTarget.call(this,a);this._tilesCount=this._gridSize.width*this._gridSize.height;a=this._tilesOrder;for(var b=a.length=0;b<this._tilesCount;++b)a[b]=b;this.shuffle(a,this._tilesCount)},update:function(a){a=0|a*this._tilesCount;for(var b=this._gridSize,c,d=cc.p(0,0),e=this._tilesOrder,f=0;f<this._tilesCount;f++)c=e[f],d.x=0|c/b.height,d.y=c%(0|b.height),f<a?this.turnOffTile(d):this.turnOnTile(d)}}); cc.turnOffTiles=function(a,b,c){return new cc.TurnOffTiles(a,b,c)};cc.TurnOffTiles.create=cc.turnOffTiles; cc.WavesTiles3D=cc.TiledGrid3DAction.extend({_waves:0,_amplitude:0,_amplitudeRate:0,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},getAmplitude:function(){return this._amplitude},setAmplitude:function(a){this._amplitude=a},getAmplitudeRate:function(){return this._amplitudeRate},setAmplitudeRate:function(a){this._amplitudeRate=a},initWithDuration:function(a,b,c,d){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,b)?(this._waves= c,this._amplitude=d,this._amplitudeRate=1,!0):!1},update:function(a){for(var b=this._gridSize,c=this._waves,d=this._amplitude,e=this._amplitudeRate,f=cc.p(0,0),g,h=0;h<b.width;h++)for(var k=0;k<b.height;k++)f.x=h,f.y=k,g=this.originalTile(f),g.bl.z=Math.sin(a*Math.PI*c*2+0.01*(g.bl.y+g.bl.x))*d*e,g.br.z=g.bl.z,g.tl.z=g.bl.z,g.tr.z=g.bl.z,this.setTile(f,g)}});cc.wavesTiles3D=function(a,b,c,d){return new cc.WavesTiles3D(a,b,c,d)};cc.WavesTiles3D.create=cc.wavesTiles3D; cc.JumpTiles3D=cc.TiledGrid3DAction.extend({_jumps:0,_amplitude:0,_amplitudeRate:0,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},getAmplitude:function(){return this._amplitude},setAmplitude:function(a){this._amplitude=a},getAmplitudeRate:function(){return this._amplitudeRate},setAmplitudeRate:function(a){this._amplitudeRate=a},initWithDuration:function(a,b,c,d){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,b)?(this._jumps= c,this._amplitude=d,this._amplitudeRate=1,!0):!1},update:function(a){var b=Math.sin(Math.PI*a*this._jumps*2)*this._amplitude*this._amplitudeRate;a=Math.sin(Math.PI*(a*this._jumps*2+1))*this._amplitude*this._amplitudeRate;for(var c=this._gridSize,d=this.target.grid,e,f=cc.p(0,0),g=0;g<c.width;g++)for(var h=0;h<c.height;h++)f.x=g,f.y=h,e=d.originalTile(f),0===(g+h)%2?(e.bl.z+=b,e.br.z+=b,e.tl.z+=b,e.tr.z+=b):(e.bl.z+=a,e.br.z+=a,e.tl.z+=a,e.tr.z+=a),d.setTile(f,e)}}); cc.jumpTiles3D=function(a,b,c,d){return new cc.JumpTiles3D(a,b,c,d)};cc.JumpTiles3D.create=cc.jumpTiles3D; cc.SplitRows=cc.TiledGrid3DAction.extend({_rows:0,_winSize:null,ctor:function(a,b){cc.GridAction.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){this._rows=b;return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,cc.size(1,b))},update:function(a){for(var b=this._gridSize,c=this._winSize.width,d,e,f=cc.p(0,0),g=0;g<b.height;++g)f.y=g,d=this.originalTile(f),e=1,0===g%2&&(e=-1),d.bl.x+=e*c*a,d.br.x+=e*c*a,d.tl.x+=e*c*a,d.tr.x+=e*c*a,this.setTile(f, d)},startWithTarget:function(a){cc.TiledGrid3DAction.prototype.startWithTarget.call(this,a);this._winSize=cc.director.getWinSizeInPixels()}});cc.splitRows=function(a,b){return new cc.SplitRows(a,b)};cc.SplitRows.create=cc.splitRows; cc.SplitCols=cc.TiledGrid3DAction.extend({_cols:0,_winSize:null,ctor:function(a,b){cc.GridAction.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){this._cols=b;return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,cc.size(b,1))},update:function(a){for(var b=this._gridSize.width,c=this._winSize.height,d,e,f=cc.p(0,0),g=0;g<b;++g)f.x=g,d=this.originalTile(f),e=1,0===g%2&&(e=-1),d.bl.y+=e*c*a,d.br.y+=e*c*a,d.tl.y+=e*c*a,d.tr.y+=e*c*a,this.setTile(f, d);cc.renderer.childrenOrderDirty=!0},startWithTarget:function(a){cc.TiledGrid3DAction.prototype.startWithTarget.call(this,a);this._winSize=cc.director.getWinSizeInPixels()}});cc.splitCols=function(a,b){return new cc.SplitCols(a,b)};cc.SplitCols.create=cc.splitCols;cc.PageTurn3D=cc.Grid3DAction.extend({getGrid:function(){var a=new cc.Grid3D(this._gridSize,void 0,void 0,this._gridNodeTarget.getGridRect());a.setNeedDepthTestForBlit(!0);return a},clone:function(){var a=new cc.PageTurn3D;a.initWithDuration(this._duration,this._gridSize);return a},update:function(a){var b=Math.max(0,a-0.25),b=-100-b*b*500,c=Math.sqrt(a),d=0.5<c?Math.PI/2*c:Math.PI/2*(1-c);a=(2-a)*Math.PI;for(var c=Math.sin(d),d=Math.cos(d),e=this._gridSize,f=cc.p(0,0),g=0;g<=e.width;++g)for(var h= 0;h<=e.height;++h){f.x=g;f.y=h;var k=this.getOriginalVertex(f);k.x-=this.getGridRect().x;var m=Math.sqrt(k.x*k.x+(k.y-b)*(k.y-b)),n=m*c,p=Math.asin(k.x/m)/c,r=Math.cos(p);k.x=p<=Math.PI?n*Math.sin(p):0;k.y=m+b-n*(1-r)*c;k.z=n*(1-r)*d;k.x=k.z*Math.sin(a)+k.x*Math.cos(a);k.z=k.z*Math.cos(a)-k.x*Math.cos(a);k.z/=7;0.5>k.z&&(k.z=0.5);k.x+=this.getGridRect().x;this.setVertex(f,k)}}});cc.pageTurn3D=function(a,b){return new cc.PageTurn3D(a,b)};cc.PageTurn3D.create=cc.pageTurn3D;cc.ProgressTimer=cc.Node.extend({_type:null,_percentage:0,_sprite:null,_midPoint:null,_barChangeRate:null,_reverseDirection:!1,_className:"ProgressTimer",ctor:function(a){cc.Node.prototype.ctor.call(this);this._type=cc.ProgressTimer.TYPE_RADIAL;this._percentage=0;this._midPoint=cc.p(0,0);this._barChangeRate=cc.p(0,0);this._reverseDirection=!1;this._sprite=null;a&&this.initWithSprite(a)},onEnter:function(){this._super();cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(this._renderCmd.initCmd(),this._renderCmd._updateProgress())}, cleanup:function(){cc._renderType===cc.game.RENDER_TYPE_WEBGL&&this._renderCmd.releaseData();this._super()},getMidpoint:function(){return cc.p(this._midPoint.x,this._midPoint.y)},setMidpoint:function(a){this._midPoint=cc.pClamp(a,cc.p(0,0),cc.p(1,1))},getBarChangeRate:function(){return cc.p(this._barChangeRate.x,this._barChangeRate.y)},setBarChangeRate:function(a){this._barChangeRate=cc.pClamp(a,cc.p(0,0),cc.p(1,1))},getType:function(){return this._type},getPercentage:function(){return this._percentage}, getSprite:function(){return this._sprite},setPercentage:function(a){this._percentage!==a&&(this._percentage=cc.clampf(a,0,100),this._renderCmd._updateProgress())},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},isReverseDirection:function(){return this._reverseDirection},setColor:function(a){this._sprite.color=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty)},setOpacity:function(a){this._sprite.opacity=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty)}, getColor:function(){return this._sprite.color},getOpacity:function(){return this._sprite.opacity},setReverseProgress:function(a){this._reverseDirection!==a&&(this._reverseDirection=a,this._renderCmd.resetVertexData())},setSprite:function(a){this._sprite!==a&&((this._sprite=a)?(this.setContentSize(a.width,a.height),a.ignoreAnchorPointForPosition(!0)):this.setContentSize(0,0),this._renderCmd.resetVertexData())},setType:function(a){a!==this._type&&(this._type=a,this._renderCmd.resetVertexData())},setReverseDirection:function(a){this._reverseDirection!== a&&(this._reverseDirection=a,this._renderCmd.resetVertexData())},initWithSprite:function(a){this.percentage=0;this.setAnchorPoint(0.5,0.5);this._type=cc.ProgressTimer.TYPE_RADIAL;this._reverseDirection=!1;this.midPoint=cc.p(0.5,0.5);this.barChangeRate=cc.p(1,1);this.setSprite(a);this._renderCmd.resetVertexData();return!0},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.ProgressTimer.CanvasRenderCmd(this):new cc.ProgressTimer.WebGLRenderCmd(this)}});_p=cc.ProgressTimer.prototype; cc.defineGetterSetter(_p,"midPoint",_p.getMidpoint,_p.setMidpoint);cc.defineGetterSetter(_p,"barChangeRate",_p.getBarChangeRate,_p.setBarChangeRate);cc.defineGetterSetter(_p,"type",_p.getType,_p.setType);cc.defineGetterSetter(_p,"percentage",_p.getPercentage,_p.setPercentage);cc.defineGetterSetter(_p,"sprite",_p.getSprite,_p.setSprite);cc.defineGetterSetter(_p,"reverseDir",_p.isReverseDirection,_p.setReverseDirection);cc.ProgressTimer.create=function(a){return new cc.ProgressTimer(a)}; cc.ProgressTimer.TEXTURE_COORDS_COUNT=4;cc.ProgressTimer.TEXTURE_COORDS=75;cc.ProgressTimer.TYPE_RADIAL=0;cc.ProgressTimer.TYPE_BAR=1;cc.ProgressTo=cc.ActionInterval.extend({_to:0,_from:0,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);this._from=this._to=0;void 0!==b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._to=b,!0):!1},clone:function(){var a=new cc.ProgressTo;a.initWithDuration(this._duration,this._to);return a},reverse:function(){cc.log("cc.ProgressTo.reverse(): reverse hasn't been supported.");return null},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this, a);this._from=a.percentage},update:function(a){this.target instanceof cc.ProgressTimer&&(this.target.percentage=this._from+(this._to-this._from)*a)}});cc.progressTo=function(a,b){return new cc.ProgressTo(a,b)};cc.ProgressTo.create=cc.progressTo; cc.ProgressFromTo=cc.ActionInterval.extend({_to:0,_from:0,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);this._from=this._to=0;void 0!==c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._to=c,this._from=b,!0):!1},clone:function(){var a=new cc.ProgressFromTo;a.initWithDuration(this._duration,this._from,this._to);return a},reverse:function(){return cc.progressFromTo(this._duration,this._to,this._from)}, startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a)},update:function(a){this.target instanceof cc.ProgressTimer&&(this.target.percentage=this._from+(this._to-this._from)*a)}});cc.progressFromTo=function(a,b,c){return new cc.ProgressFromTo(a,b,c)};cc.ProgressFromTo.create=cc.progressFromTo;(function(){cc.ProgressTimer.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._PI180=Math.PI/180;this._barRect=cc.rect(0,0,0,0);this._origin=cc.p(0,0);this._radius=0;this._endAngle=this._startAngle=270;this._counterClockWise=!1;this._canUseDirtyRegion=!0};var a=cc.ProgressTimer.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.ProgressTimer.CanvasRenderCmd;a.rendering=function(a,c,d){a=a||cc._renderContext;var e=a.getContext(),f=this._node, g=f._sprite,h=g._renderCmd._textureCoord,k=g._renderCmd._displayedOpacity/255;if(0!==h.width&&0!==h.height&&g._texture&&h.validRect&&0!==k){a.setTransform(this._worldTransform,c,d);a.setCompositeOperation(g._blendFuncStr);a.setGlobalAlpha(k);var m=g._rect,n=g._offsetPosition;c=n.x;d=-n.y-m.height;k=m.width;m=m.height;a.save();g._flippedX&&(c=-c-k,e.scale(-1,1));g._flippedY&&(d=n.y,e.scale(1,-1));f._type===cc.ProgressTimer.TYPE_BAR?(f=this._barRect,e.beginPath(),e.rect(f.x,f.y,f.width,f.height),e.clip(), e.closePath()):f._type===cc.ProgressTimer.TYPE_RADIAL&&(f=this._origin.x,n=this._origin.y,e.beginPath(),e.arc(f,n,this._radius,this._PI180*this._startAngle,this._PI180*this._endAngle,this._counterClockWise),e.lineTo(f,n),e.clip(),e.closePath());f=(g._renderCmd._textureToRender||g._texture).getHtmlElementObj();g._renderCmd._colorized?e.drawImage(f,0,0,h.width,h.height,c,d,k,m):e.drawImage(f,h.renderX,h.renderY,h.width,h.height,c,d,k,m);a.restore();cc.g_NumberOfDraws++}};a.releaseData=function(){}; a.resetVertexData=function(){};a._updateProgress=function(){this.setDirtyFlag(cc.Node._dirtyFlags.contentDirty);var a=this._node,c=a._sprite,d=c.width,e=c.height,f=a._midPoint;if(a._type===cc.ProgressTimer.TYPE_RADIAL){this._radius=Math.round(Math.sqrt(d*d+e*e));var g,h=!1,k=this._origin;k.x=d*f.x;k.y=-e*f.y;a._reverseDirection?(g=270,f=270-3.6*a._percentage):(f=-90,g=-90+3.6*a._percentage);c._flippedX&&(k.x-=2*d*a._midPoint.x,f=-f-180,g=-g-180,h=!h);c._flippedY&&(k.y+=2*e*a._midPoint.y,h=!h,f=-f, g=-g);this._startAngle=f;this._endAngle=g;this._counterClockWise=h}else h=a._barChangeRate,k=a._percentage/100,a=this._barRect,h=cc.size(d*(1-h.x),e*(1-h.y)),k=cc.size((d-h.width)*k,(e-h.height)*k),h=cc.size(h.width+k.width,h.height+k.height),g=cc.p(d*f.x,e*f.y),k=g.x-h.width/2,0.5<f.x&&h.width/2>=d-g.x&&(k=d-h.width),d=g.y-h.height/2,0.5<f.y&&h.height/2>=e-g.y&&(d=e-h.height),a.x=0,e=1,c._flippedX&&(a.x-=h.width,e=-1),0<k&&(a.x+=k*e),a.y=0,e=1,c._flippedY&&(a.y+=h.height,e=-1),0<d&&(a.y-=d*e),a.width= h.width,a.height=-h.height};a._syncStatus=function(a){var c=this._node;if(c._sprite){var d=cc.Node._dirtyFlags,e=this._dirtyFlag,f=a?a._node:null;f&&f._cascadeColorEnabled&&a._dirtyFlag&d.colorDirty&&(e|=d.colorDirty);f&&f._cascadeOpacityEnabled&&a._dirtyFlag&d.opacityDirty&&(e|=d.opacityDirty);a&&a._dirtyFlag&d.transformDirty&&(e|=d.transformDirty);this._dirtyFlag=e;var c=c._sprite._renderCmd,g=c._dirtyFlag,f=g&d.colorDirty,g=g&d.opacityDirty;f&&(c._syncDisplayColor(),c._dirtyFlag&=~d.colorDirty, this._dirtyFlag&=~d.colorDirty);g&&(c._syncDisplayOpacity(),c._dirtyFlag&=~d.opacityDirty,this._dirtyFlag&=~d.opacityDirty);(f||g)&&c._updateColor();e&d.transformDirty&&this.transform(a);e&d.orderDirty&&(this._dirtyFlag&=~d.orderDirty)}};a.updateStatus=function(){var a=this._node;if(a._sprite){var c=cc.Node._dirtyFlags,d=this._dirtyFlag,a=a._sprite._renderCmd,e=a._dirtyFlag,f=e&c.colorDirty,e=e&c.opacityDirty;f&&(a._updateDisplayColor(),a._dirtyFlag^=a._dirtyFlag&c.colorDirty,this._dirtyFlag^=this._dirtyFlag& c.colorDirty);e&&(a._updateDisplayOpacity(),a._dirtyFlag^=a._dirtyFlag&c.opacityDirty,this._dirtyFlag^=this._dirtyFlag&c.opacityDirty);(f||e)&&a._updateColor();d&c.transformDirty&&this.transform(this.getParentRenderCmd(),!0);d&c.contentDirty&&this._notifyRegionStatus&&this._notifyRegionStatus(cc.Node.CanvasRenderCmd.RegionStatus.Dirty);this._dirtyFlag=0}}})();(function(){cc.ProgressTimer.WebGLRenderCmd=function(a){this._rootCtor(a);this._progressDirty=this._needDraw=!0;this._bl=cc.p();this._tr=cc.p();this.initCmd()};var a=cc.ProgressTimer.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.ProgressTimer.WebGLRenderCmd;a.transform=function(a,c){this.originTransform(a,c);var d=this._node._sprite;d._renderCmd.transform(this,c);var e=d._offsetPosition.x,f=e+d._rect.width,g=d._offsetPosition.y,d=g+d._rect.height,h=this._worldTransform; this._bl.x=e*h.a+g*h.c+h.tx;this._bl.y=e*h.b+g*h.d+h.ty;this._tr.x=f*h.a+d*h.c+h.tx;this._tr.y=f*h.b+d*h.d+h.ty;this._updateProgressData()};a.rendering=function(a){var c=this._node;a=a||cc._renderContext;if(0!==this._vertexDataCount&&c._sprite){this._shaderProgram.use();this._shaderProgram._updateProjectionUniform();var d=c._sprite._blendFunc;cc.glBlendFunc(d.src,d.dst);cc.glBindTexture2D(c._sprite.texture);a.bindBuffer(a.ARRAY_BUFFER,this._vertexWebGLBuffer);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION); a.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);this._vertexDataDirty&&(a.bufferSubData(a.ARRAY_BUFFER,0,this._float32View),this._vertexDataDirty=!1);d=cc.V3F_C4B_T2F.BYTES_PER_ELEMENT;a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,a.FLOAT,!1,d,0);a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,d,12);a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,d,16);c._type===cc.ProgressTimer.TYPE_RADIAL?a.drawArrays(a.TRIANGLE_FAN, 0,this._vertexDataCount):c._type===cc.ProgressTimer.TYPE_BAR&&(c._reverseDirection?(a.drawArrays(a.TRIANGLE_STRIP,0,this._vertexDataCount/2),a.drawArrays(a.TRIANGLE_STRIP,4,this._vertexDataCount/2),cc.g_NumberOfDraws++):a.drawArrays(a.TRIANGLE_STRIP,0,this._vertexDataCount));cc.g_NumberOfDraws++}};a._syncStatus=function(a){var c=this._node;if(c._sprite){var d=cc.Node._dirtyFlags,e=this._dirtyFlag,f=a?a._node:null;f&&f._cascadeColorEnabled&&a._dirtyFlag&d.colorDirty&&(e|=d.colorDirty);f&&f._cascadeOpacityEnabled&& a._dirtyFlag&d.opacityDirty&&(e|=d.opacityDirty);a&&a._dirtyFlag&d.transformDirty&&(e|=d.transformDirty);this._dirtyFlag=e;var c=c._sprite._renderCmd,g=c._dirtyFlag,f=(e|g)&d.colorDirty,g=(e|g)&d.opacityDirty;f&&(c._syncDisplayColor(),c._dirtyFlag&=~d.colorDirty,this._dirtyFlag&=~d.colorDirty);g&&(c._syncDisplayOpacity(),c._dirtyFlag&=~d.opacityDirty,this._dirtyFlag&=~d.opacityDirty);(f||g)&&this._updateColor();e&d.transformDirty&&this.transform(a);e&d.textureDirty&&(this._updateProgressData(),this._dirtyFlag&= ~d.textureDirty);c._dirtyFlag=0}};a.updateStatus=function(){var a=this._node;if(a._sprite){var c=cc.Node._dirtyFlags,d=this._dirtyFlag,a=a._sprite._renderCmd,e=a._dirtyFlag,f=(d|e)&c.colorDirty,e=(d|e)&c.opacityDirty;f&&(a._updateDisplayColor(),a._dirtyFlag^=a._dirtyFlag&c.colorDirty,this._dirtyFlag^=this._dirtyFlag&c.colorDirty);e&&(a._updateDisplayOpacity(),a._dirtyFlag^=a._dirtyFlag&c.opacityDirty,this._dirtyFlag^=this._dirtyFlag&c.opacityDirty);(f||e)&&this._updateColor();d&c.transformDirty&& this.transform(this.getParentRenderCmd(),!0);d&c.orderDirty&&(this._dirtyFlag^=this._dirtyFlag&c.orderDirty);d&c.textureDirty&&(this._updateProgressData(),this._dirtyFlag^=this._dirtyFlag&c.textureDirty)}};a.releaseData=function(){if(this._vertexData){var a=this._vertexWebGLBuffer;setTimeout(function(){cc._renderContext.deleteBuffer(a)},0.1);this._vertexArrayBuffer=this._float32View=this._vertexData=this._vertexWebGLBuffer=null;this._vertexDataCount=0}};a.initCmd=function(){if(!this._vertexData){this._vertexWebGLBuffer= cc._renderContext.createBuffer();var a=cc.V3F_C4B_T2F.BYTES_PER_ELEMENT;this._vertexArrayBuffer=new ArrayBuffer(8*a);this._float32View=new Float32Array(this._vertexArrayBuffer);this._vertexData=[];for(var c=0;8>c;c++)this._vertexData[c]=new cc.V3F_C4B_T2F(null,null,null,this._vertexArrayBuffer,c*a);gl.bindBuffer(gl.ARRAY_BUFFER,this._vertexWebGLBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._float32View,gl.DYNAMIC_DRAW);this._vertexDataCount=0;this._vertexDataDirty=!0;this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR)}}; a.resetVertexData=function(){this._vertexDataCount=0};a._updateProgressData=function(){var a=this._node._type;a===cc.ProgressTimer.TYPE_RADIAL?this._updateRadial():a===cc.ProgressTimer.TYPE_BAR&&this._updateBar();this._vertexDataDirty=!0};a._updateProgress=function(){this.setDirtyFlag(cc.Node._dirtyFlags.textureDirty)};a._updateBar=function(){var a=this._node;if(a._sprite){var c=a._percentage/100,d=a._barChangeRate,d=cc.pMult(cc.p(1-d.x+c*d.x,1-d.y+c*d.y),0.5),c=cc.pSub(a._midPoint,d),a=cc.pAdd(a._midPoint, d);0>c.x&&(a.x+=-c.x,c.x=0);1<a.x&&(c.x-=a.x-1,a.x=1);0>c.y&&(a.y+=-c.y,c.y=0);1<a.y&&(c.y-=a.y-1,a.y=1);this._reverseDirection?(d=this._vertexData,this._vertexDataCount||(this._vertexDataCount=8,this._textureCoordFromAlphaPoint(d[0].texCoords,0,1),this._vertexFromAlphaPoint(d[0].vertices,0,1),this._textureCoordFromAlphaPoint(d[1].texCoords,0,0),this._vertexFromAlphaPoint(d[1].vertices,0,0),this._textureCoordFromAlphaPoint(d[6].texCoords,1,1),this._vertexFromAlphaPoint(d[6].vertices,1,1),this._textureCoordFromAlphaPoint(d[7].texCoords, 1,0),this._vertexFromAlphaPoint(d[7].vertices,1,0)),this._textureCoordFromAlphaPoint(d[2].texCoords,c.x,a.y),this._vertexFromAlphaPoint(d[2].vertices,c.x,a.y),this._textureCoordFromAlphaPoint(d[3].texCoords,c.x,c.y),this._vertexFromAlphaPoint(d[3].vertices,c.x,c.y),this._textureCoordFromAlphaPoint(d[4].texCoords,a.x,a.y),this._vertexFromAlphaPoint(d[4].vertices,a.x,a.y),this._textureCoordFromAlphaPoint(d[5].texCoords,a.x,c.y),this._vertexFromAlphaPoint(d[5].vertices,a.x,c.y)):(this._vertexDataCount|| (this._vertexDataCount=4),d=this._vertexData,this._textureCoordFromAlphaPoint(d[0].texCoords,c.x,a.y),this._vertexFromAlphaPoint(d[0].vertices,c.x,a.y),this._textureCoordFromAlphaPoint(d[1].texCoords,c.x,c.y),this._vertexFromAlphaPoint(d[1].vertices,c.x,c.y),this._textureCoordFromAlphaPoint(d[2].texCoords,a.x,a.y),this._vertexFromAlphaPoint(d[2].vertices,a.x,a.y),this._textureCoordFromAlphaPoint(d[3].texCoords,a.x,c.y),this._vertexFromAlphaPoint(d[3].vertices,a.x,c.y));this._updateColor()}};a._updateRadial= function(){var a=this._node;if(a._sprite){var c,d=a._midPoint;c=a._percentage/100;var e=2*cc.PI*(a._reverseDirection?c:1-c),a=cc.p(d.x,1),f=cc.pRotateByAngle(a,d,e),e=0;if(0===c)f=a,e=0;else if(1===c)f=a,e=4;else{var g=cc.FLT_MAX,h=cc.ProgressTimer.TEXTURE_COORDS_COUNT;for(c=0;c<=h;++c){var k=(c+(h-1))%h,m=this._boundaryTexCoord(c%h),k=this._boundaryTexCoord(k);0===c?k=cc.pLerp(m,k,1-d.x):4===c&&(m=cc.pLerp(m,k,1-d.x));var n=cc.p(0,0);cc.pLineIntersect(m,k,d,f,n)&&(0!==c&&4!==c||0<=n.x&&1>=n.x)&& 0<=n.y&&n.y<g&&(g=n.y,e=c)}f=cc.pAdd(d,cc.pMult(cc.pSub(f,d),g))}c=!0;this._vertexDataCount!==e+3&&(c=!1,this._vertexDataCount=e+3);this._updateColor();g=this._vertexData;if(!c)for(this._textureCoordFromAlphaPoint(g[0].texCoords,d.x,d.y),this._vertexFromAlphaPoint(g[0].vertices,d.x,d.y),this._textureCoordFromAlphaPoint(g[1].texCoords,a.x,a.y),this._vertexFromAlphaPoint(g[1].vertices,a.x,a.y),c=0;c<e;c++)d=this._boundaryTexCoord(c),this._textureCoordFromAlphaPoint(g[c+2].texCoords,d.x,d.y),this._vertexFromAlphaPoint(g[c+ 2].vertices,d.x,d.y);this._textureCoordFromAlphaPoint(g[this._vertexDataCount-1].texCoords,f.x,f.y);this._vertexFromAlphaPoint(g[this._vertexDataCount-1].vertices,f.x,f.y)}};a._boundaryTexCoord=function(a){if(a<cc.ProgressTimer.TEXTURE_COORDS_COUNT){var c=cc.ProgressTimer.TEXTURE_COORDS;return this._node._reverseDirection?cc.p(c>>7-(a<<1)&1,c>>7-((a<<1)+1)&1):cc.p(c>>(a<<1)+1&1,c>>(a<<1)&1)}return cc.p(0,0)};a._textureCoordFromAlphaPoint=function(a,c,d){var e=this._node._sprite;if(e){var f=e._renderCmd._vertices, g=f[1],f=f[2],g=cc.p(g.u,g.v),f=cc.p(f.u,f.v);e.textureRectRotated&&(e=c,c=d,d=e);a.u=g.x*(1-c)+f.x*c;a.v=g.y*(1-d)+f.y*d}else a.u=0,a.v=0};a._vertexFromAlphaPoint=function(a,c,d){a.x=this._bl.x*(1-c)+this._tr.x*c;a.y=this._bl.y*(1-d)+this._tr.y*d;a.z=this._node._vertexZ};a._updateColor=function(){var a=this._node._sprite;if(this._vertexDataCount&&a){var c=this._displayedColor,d=a._renderCmd._displayedColor,e=d.r,f=d.g,d=d.b,g=a._renderCmd._displayedOpacity/255;a._opacityModifyRGB&&(e*=g,f*=g,d*= g);c.r=e;c.g=f;c.b=d;c.a=a._renderCmd._displayedOpacity;a=this._vertexData;e=0;for(f=this._vertexDataCount;e<f;++e)a[e].colors=c;this._vertexDataDirty=!0}}})();cc.SCENE_FADE=4208917214;cc.TRANSITION_ORIENTATION_LEFT_OVER=0;cc.TRANSITION_ORIENTATION_RIGHT_OVER=1;cc.TRANSITION_ORIENTATION_UP_OVER=0;cc.TRANSITION_ORIENTATION_DOWN_OVER=1; cc.TransitionScene=cc.Scene.extend({_inScene:null,_outScene:null,_duration:null,_isInSceneOnTop:!1,_isSendCleanupToScene:!1,_className:"TransitionScene",ctor:function(a,b){cc.Scene.prototype.ctor.call(this);void 0!==a&&void 0!==b&&this.initWithDuration(a,b)},_setNewScene:function(a){this.unschedule(this._setNewScene);a=cc.director;this._isSendCleanupToScene=a.isSendCleanupToScene();a.runScene(this._inScene);cc.eventManager.setEnabled(!0);this._outScene.visible=!0},_sceneOrder:function(){this._isInSceneOnTop= !0},visit:function(){this._isInSceneOnTop?(this._outScene.visit(),this._inScene.visit()):(this._inScene.visit(),this._outScene.visit());cc.Node.prototype.visit.call(this)},onEnter:function(){cc.Node.prototype.onEnter.call(this);cc.eventManager.setEnabled(!1);this._outScene._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart);this._inScene._performRecursive(cc.Node._stateCallbackType.onEnter)},onExit:function(){cc.Node.prototype.onExit.call(this);cc.eventManager.setEnabled(!0);this._outScene._performRecursive(cc.Node._stateCallbackType.onExit); this._inScene._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish)},cleanup:function(){cc.Node.prototype.cleanup.call(this);this._isSendCleanupToScene&&this._outScene._performRecursive(cc.Node._stateCallbackType.cleanup)},initWithDuration:function(a,b){if(!b)throw Error("cc.TransitionScene.initWithDuration(): Argument scene must be non-nil");if(this.init()){this._duration=a;this.attr({x:0,y:0,anchorX:0,anchorY:0});this._inScene=b;this._outScene=cc.director.getRunningScene();this._outScene|| (this._outScene=new cc.Scene,this._outScene.init());if(this._inScene===this._outScene)throw Error("cc.TransitionScene.initWithDuration(): Incoming scene must be different from the outgoing scene");this._sceneOrder();return!0}return!1},finish:function(){this._inScene.attr({visible:!0,x:0,y:0,scale:1,rotation:0});this._outScene.attr({visible:!1,x:0,y:0,scale:1,rotation:0});this.schedule(this._setNewScene,0)},hideOutShowIn:function(){this._inScene.visible=!0;this._outScene.visible=!1}}); cc.TransitionScene.create=function(a,b){return new cc.TransitionScene(a,b)};cc.TransitionSceneOriented=cc.TransitionScene.extend({_orientation:0,ctor:function(a,b,c){cc.TransitionScene.prototype.ctor.call(this);void 0!=c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){cc.TransitionScene.prototype.initWithDuration.call(this,a,b)&&(this._orientation=c);return!0}});cc.TransitionSceneOriented.create=function(a,b,c){return new cc.TransitionSceneOriented(a,b,c)}; cc.TransitionRotoZoom=cc.TransitionScene.extend({ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._inScene.attr({scale:0.001,anchorX:0.5,anchorY:0.5});this._outScene.attr({scale:1,anchorX:0.5,anchorY:0.5});var a=cc.sequence(cc.spawn(cc.scaleBy(this._duration/2,0.001),cc.rotateBy(this._duration/2,720)),cc.delayTime(this._duration/2));this._outScene.runAction(a);this._inScene.runAction(cc.sequence(a.reverse(), cc.callFunc(this.finish,this)))}});cc.TransitionRotoZoom.create=function(a,b){return new cc.TransitionRotoZoom(a,b)}; cc.TransitionJumpZoom=cc.TransitionScene.extend({ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a=cc.director.getWinSize();this._inScene.attr({scale:0.5,x:a.width,y:0,anchorX:0.5,anchorY:0.5});this._outScene.anchorX=0.5;this._outScene.anchorY=0.5;var b=cc.jumpBy(this._duration/4,cc.p(-a.width,0),a.width/4,2),c=cc.scaleTo(this._duration/4,1),a=cc.scaleTo(this._duration/4,0.5),a=cc.sequence(a, b),b=cc.sequence(b,c),c=cc.delayTime(this._duration/2);this._outScene.runAction(a);this._inScene.runAction(cc.sequence(c,b,cc.callFunc(this.finish,this)))}});cc.TransitionJumpZoom.create=function(a,b){return new cc.TransitionJumpZoom(a,b)}; cc.TransitionMoveInL=cc.TransitionScene.extend({ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this.initScenes();var a=this.action();this._inScene.runAction(cc.sequence(this.easeActionWithAction(a),cc.callFunc(this.finish,this)))},initScenes:function(){this._inScene.setPosition(-cc.director.getWinSize().width,0)},action:function(){return cc.moveTo(this._duration,cc.p(0,0))},easeActionWithAction:function(a){return new cc.EaseOut(a, 2)}});cc.TransitionMoveInL.create=function(a,b){return new cc.TransitionMoveInL(a,b)};cc.TransitionMoveInR=cc.TransitionMoveInL.extend({ctor:function(a,b){cc.TransitionMoveInL.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},initScenes:function(){this._inScene.setPosition(cc.director.getWinSize().width,0)}});cc.TransitionMoveInR.create=function(a,b){return new cc.TransitionMoveInR(a,b)}; cc.TransitionMoveInT=cc.TransitionMoveInL.extend({ctor:function(a,b){cc.TransitionMoveInL.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},initScenes:function(){this._inScene.setPosition(0,cc.director.getWinSize().height)}});cc.TransitionMoveInT.create=function(a,b){return new cc.TransitionMoveInT(a,b)}; cc.TransitionMoveInB=cc.TransitionMoveInL.extend({ctor:function(a,b){cc.TransitionMoveInL.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},initScenes:function(){this._inScene.setPosition(0,-cc.director.getWinSize().height)}});cc.TransitionMoveInB.create=function(a,b){return new cc.TransitionMoveInB(a,b)};cc.ADJUST_FACTOR=0.5; cc.TransitionSlideInL=cc.TransitionScene.extend({ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_sceneOrder:function(){this._isInSceneOnTop=!1},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this.initScenes();var a=this.action(),b=this.action(),a=cc.sequence(this.easeActionWithAction(a),cc.callFunc(this.finish,this)),b=this.easeActionWithAction(b);this._inScene.runAction(a);this._outScene.runAction(b)},initScenes:function(){this._inScene.setPosition(-cc.director.getWinSize().width+ cc.ADJUST_FACTOR,0)},action:function(){return cc.moveBy(this._duration,cc.p(cc.director.getWinSize().width-cc.ADJUST_FACTOR,0))},easeActionWithAction:function(a){return new cc.EaseInOut(a,2)}});cc.TransitionSlideInL.create=function(a,b){return new cc.TransitionSlideInL(a,b)}; cc.TransitionSlideInR=cc.TransitionSlideInL.extend({ctor:function(a,b){cc.TransitionSlideInL.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_sceneOrder:function(){this._isInSceneOnTop=!0},initScenes:function(){this._inScene.setPosition(cc.director.getWinSize().width-cc.ADJUST_FACTOR,0)},action:function(){return cc.moveBy(this._duration,cc.p(-(cc.director.getWinSize().width-cc.ADJUST_FACTOR),0))}});cc.TransitionSlideInR.create=function(a,b){return new cc.TransitionSlideInR(a,b)}; cc.TransitionSlideInB=cc.TransitionSlideInL.extend({ctor:function(a,b){cc.TransitionSlideInL.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_sceneOrder:function(){this._isInSceneOnTop=!1},initScenes:function(){this._inScene.setPosition(0,-(cc.director.getWinSize().height-cc.ADJUST_FACTOR))},action:function(){return cc.moveBy(this._duration,cc.p(0,cc.director.getWinSize().height-cc.ADJUST_FACTOR))}});cc.TransitionSlideInB.create=function(a,b){return new cc.TransitionSlideInB(a,b)}; cc.TransitionSlideInT=cc.TransitionSlideInL.extend({ctor:function(a,b){cc.TransitionSlideInL.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_sceneOrder:function(){this._isInSceneOnTop=!0},initScenes:function(){this._inScene.setPosition(0,cc.director.getWinSize().height-cc.ADJUST_FACTOR)},action:function(){return cc.moveBy(this._duration,cc.p(0,-(cc.director.getWinSize().height-cc.ADJUST_FACTOR)))}});cc.TransitionSlideInT.create=function(a,b){return new cc.TransitionSlideInT(a,b)}; cc.TransitionShrinkGrow=cc.TransitionScene.extend({ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._inScene.attr({scale:0.001,anchorX:2/3,anchorY:0.5});this._outScene.attr({scale:1,anchorX:1/3,anchorY:0.5});var a=cc.scaleTo(this._duration,0.01),b=cc.scaleTo(this._duration,1);this._inScene.runAction(cc.sequence(this.easeActionWithAction(b),cc.callFunc(this.finish,this)));this._outScene.runAction(this.easeActionWithAction(a))}, easeActionWithAction:function(a){return new cc.EaseOut(a,2)}});cc.TransitionShrinkGrow.create=function(a,b){return new cc.TransitionShrinkGrow(a,b)}; cc.TransitionFade=cc.TransitionScene.extend({_color:null,ctor:function(a,b,c){cc.TransitionScene.prototype.ctor.call(this);this._color=cc.color();b&&this.initWithDuration(a,b,c)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a=new cc.LayerColor(this._color);this._inScene.visible=!1;this.addChild(a,2,cc.SCENE_FADE);var a=this.getChildByTag(cc.SCENE_FADE),b=cc.sequence(cc.fadeIn(this._duration/2),cc.callFunc(this.hideOutShowIn,this),cc.fadeOut(this._duration/2),cc.callFunc(this.finish, this));a.runAction(b)},onExit:function(){cc.TransitionScene.prototype.onExit.call(this);this.removeChildByTag(cc.SCENE_FADE,!1)},initWithDuration:function(a,b,c){c=c||cc.color.BLACK;cc.TransitionScene.prototype.initWithDuration.call(this,a,b)&&(this._color.r=c.r,this._color.g=c.g,this._color.b=c.b,this._color.a=0);return!0}});cc.TransitionFade.create=function(a,b,c){return new cc.TransitionFade(a,b,c)}; cc.TransitionCrossFade=cc.TransitionScene.extend({ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a=cc.color(0,0,0,0),b=cc.director.getWinSize(),a=new cc.LayerColor(a),c=new cc.RenderTexture(b.width,b.height);c.sprite.anchorX=0.5;c.sprite.anchorY=0.5;c.attr({x:b.width/2,y:b.height/2,anchorX:0.5,anchorY:0.5});c.begin();this._inScene.visit();c.end();var d=new cc.RenderTexture(b.width, b.height);d.setPosition(b.width/2,b.height/2);d.sprite.anchorX=d.anchorX=0.5;d.sprite.anchorY=d.anchorY=0.5;d.begin();this._outScene.visit();d.end();c.sprite.setBlendFunc(cc.ONE,cc.ONE);d.sprite.setBlendFunc(cc.SRC_ALPHA,cc.ONE_MINUS_SRC_ALPHA);a.addChild(c);a.addChild(d);c.sprite.opacity=255;d.sprite.opacity=255;b=cc.sequence(cc.fadeTo(this._duration,0),cc.callFunc(this.hideOutShowIn,this),cc.callFunc(this.finish,this));d.sprite.runAction(b);this.addChild(a,2,cc.SCENE_FADE)},onExit:function(){this.removeChildByTag(cc.SCENE_FADE, !1);cc.TransitionScene.prototype.onExit.call(this)}});cc.TransitionCrossFade.create=function(a,b){return new cc.TransitionCrossFade(a,b)}; cc.TransitionTurnOffTiles=cc.TransitionScene.extend({_gridProxy:null,ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);this._gridProxy=new cc.NodeGrid;b&&this.initWithDuration(a,b)},_sceneOrder:function(){this._isInSceneOnTop=!1},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._gridProxy.setTarget(this._outScene);this._gridProxy._performRecursive(cc.Node._stateCallbackType.onEnter);var a=cc.director.getWinSize(),a=cc.turnOffTiles(this._duration,cc.size(0|a.width/ a.height*12,12)),a=this.easeActionWithAction(a);this._gridProxy.runAction(cc.sequence(a,cc.callFunc(this.finish,this),cc.stopGrid()))},visit:function(){this._inScene.visit();this._gridProxy.visit()},easeActionWithAction:function(a){return a}});cc.TransitionTurnOffTiles.create=function(a,b){return new cc.TransitionTurnOffTiles(a,b)}; cc.TransitionSplitCols=cc.TransitionScene.extend({_gridProxy:null,_switchTargetToInscene:function(){this._gridProxy.setTarget(this._inScene)},ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);this._gridProxy=new cc.NodeGrid;b&&this.initWithDuration(a,b)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._gridProxy.setTarget(this._outScene);this._gridProxy._performRecursive(cc.Node._stateCallbackType.onEnter);var a=this.action(),a=cc.sequence(a,cc.callFunc(this._switchTargetToInscene, this),a.reverse());this._gridProxy.runAction(cc.sequence(this.easeActionWithAction(a),cc.callFunc(this.finish,this),cc.stopGrid()))},onExit:function(){this._gridProxy.setTarget(null);this._gridProxy._performRecursive(cc.Node._stateCallbackType.onExit);cc.TransitionScene.prototype.onExit.call(this)},visit:function(){this._gridProxy.visit()},easeActionWithAction:function(a){return new cc.EaseInOut(a,3)},action:function(){return cc.splitCols(this._duration/2,3)}}); cc.TransitionSplitCols.create=function(a,b){return new cc.TransitionSplitCols(a,b)};cc.TransitionSplitRows=cc.TransitionSplitCols.extend({ctor:function(a,b){cc.TransitionSplitCols.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},action:function(){return cc.splitRows(this._duration/2,3)}});cc.TransitionSplitRows.create=function(a,b){return new cc.TransitionSplitRows(a,b)}; cc.TransitionFadeTR=cc.TransitionScene.extend({_gridProxy:null,ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);this._gridProxy=new cc.NodeGrid;b&&this.initWithDuration(a,b)},_sceneOrder:function(){this._isInSceneOnTop=!1},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._gridProxy.setTarget(this._outScene);this._gridProxy._performRecursive(cc.Node._stateCallbackType.onEnter);var a=cc.director.getWinSize(),a=this.actionWithSize(cc.size(0|a.width/a.height*12,12)); this._gridProxy.runAction(cc.sequence(this.easeActionWithAction(a),cc.callFunc(this.finish,this),cc.stopGrid()))},visit:function(){this._inScene.visit();this._gridProxy.visit()},easeActionWithAction:function(a){return a},actionWithSize:function(a){return cc.fadeOutTRTiles(this._duration,a)}});cc.TransitionFadeTR.create=function(a,b){return new cc.TransitionFadeTR(a,b)}; cc.TransitionFadeBL=cc.TransitionFadeTR.extend({ctor:function(a,b){cc.TransitionFadeTR.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},actionWithSize:function(a){return cc.fadeOutBLTiles(this._duration,a)}});cc.TransitionFadeBL.create=function(a,b){return new cc.TransitionFadeBL(a,b)}; cc.TransitionFadeUp=cc.TransitionFadeTR.extend({ctor:function(a,b){cc.TransitionFadeTR.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},actionWithSize:function(a){return new cc.FadeOutUpTiles(this._duration,a)}});cc.TransitionFadeUp.create=function(a,b){return new cc.TransitionFadeUp(a,b)}; cc.TransitionFadeDown=cc.TransitionFadeTR.extend({ctor:function(a,b){cc.TransitionFadeTR.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},actionWithSize:function(a){return cc.fadeOutDownTiles(this._duration,a)}});cc.TransitionFadeDown.create=function(a,b){return new cc.TransitionFadeDown(a,b)};cc.SCENE_RADIAL=49153; cc.TransitionProgress=cc.TransitionScene.extend({_to:0,_from:0,_sceneToBeModified:null,_className:"TransitionProgress",ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_setAttrs:function(a,b,c){a.attr({x:b,y:c,anchorX:0.5,anchorY:0.5})},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._setupTransition();var a=cc.director.getWinSize(),b=new cc.RenderTexture(a.width,a.height);b.sprite.anchorX=0.5;b.sprite.anchorY=0.5;this._setAttrs(b, a.width/2,a.height/2);b.clear(0,0,0,1);b.begin();this._sceneToBeModified.visit();b.end();this._sceneToBeModified===this._outScene&&this.hideOutShowIn();a=this._progressTimerNodeWithRenderTexture(b);b=cc.sequence(cc.progressFromTo(this._duration,this._from,this._to),cc.callFunc(this.finish,this));a.runAction(b);this.addChild(a,2,cc.SCENE_RADIAL)},onExit:function(){this.removeChildByTag(cc.SCENE_RADIAL,!0);cc.TransitionScene.prototype.onExit.call(this)},_setupTransition:function(){this._sceneToBeModified= this._outScene;this._from=100;this._to=0},_progressTimerNodeWithRenderTexture:function(a){cc.log("cc.TransitionProgress._progressTimerNodeWithRenderTexture(): should be overridden in subclass");return null},_sceneOrder:function(){this._isInSceneOnTop=!1}});cc.TransitionProgress.create=function(a,b){return new cc.TransitionProgress(a,b)}; cc.TransitionProgressRadialCCW=cc.TransitionProgress.extend({ctor:function(a,b){cc.TransitionProgress.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_progressTimerNodeWithRenderTexture:function(a){var b=cc.director.getWinSize();a=new cc.ProgressTimer(a.sprite);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(a.sprite.flippedY=!0);a.type=cc.ProgressTimer.TYPE_RADIAL;a.reverseDir=!1;a.percentage=100;this._setAttrs(a,b.width/2,b.height/2);return a}}); cc.TransitionProgressRadialCCW.create=function(a,b){return new cc.TransitionProgressRadialCCW(a,b)}; cc.TransitionProgressRadialCW=cc.TransitionProgress.extend({ctor:function(a,b){cc.TransitionProgress.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_progressTimerNodeWithRenderTexture:function(a){var b=cc.director.getWinSize();a=new cc.ProgressTimer(a.sprite);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(a.sprite.flippedY=!0);a.type=cc.ProgressTimer.TYPE_RADIAL;a.reverseDir=!0;a.percentage=100;this._setAttrs(a,b.width/2,b.height/2);return a}}); cc.TransitionProgressRadialCW.create=function(a,b){var c=new cc.TransitionProgressRadialCW;return null!==c&&c.initWithDuration(a,b)?c:new cc.TransitionProgressRadialCW(a,b)}; cc.TransitionProgressHorizontal=cc.TransitionProgress.extend({ctor:function(a,b){cc.TransitionProgress.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_progressTimerNodeWithRenderTexture:function(a){var b=cc.director.getWinSize();a=new cc.ProgressTimer(a.sprite);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(a.sprite.flippedY=!0);a.type=cc.ProgressTimer.TYPE_BAR;a.midPoint=cc.p(1,0);a.barChangeRate=cc.p(1,0);a.percentage=100;this._setAttrs(a,b.width/2,b.height/2);return a}}); cc.TransitionProgressHorizontal.create=function(a,b){return new cc.TransitionProgressHorizontal(a,b)}; cc.TransitionProgressVertical=cc.TransitionProgress.extend({ctor:function(a,b){cc.TransitionProgress.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_progressTimerNodeWithRenderTexture:function(a){var b=cc.director.getWinSize();a=new cc.ProgressTimer(a.sprite);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(a.sprite.flippedY=!0);a.type=cc.ProgressTimer.TYPE_BAR;a.midPoint=cc.p(0,0);a.barChangeRate=cc.p(0,1);a.percentage=100;this._setAttrs(a,b.width/2,b.height/2);return a}}); cc.TransitionProgressVertical.create=function(a,b){return new cc.TransitionProgressVertical(a,b)}; cc.TransitionProgressInOut=cc.TransitionProgress.extend({ctor:function(a,b){cc.TransitionProgress.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_progressTimerNodeWithRenderTexture:function(a){var b=cc.director.getWinSize();a=new cc.ProgressTimer(a.sprite);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(a.sprite.flippedY=!0);a.type=cc.ProgressTimer.TYPE_BAR;a.midPoint=cc.p(0.5,0.5);a.barChangeRate=cc.p(1,1);a.percentage=0;this._setAttrs(a,b.width/2,b.height/2);return a},_sceneOrder:function(){this._isInSceneOnTop= !1},_setupTransition:function(){this._sceneToBeModified=this._inScene;this._from=0;this._to=100}});cc.TransitionProgressInOut.create=function(a,b){return new cc.TransitionProgressInOut(a,b)}; cc.TransitionProgressOutIn=cc.TransitionProgress.extend({ctor:function(a,b){cc.TransitionProgress.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_progressTimerNodeWithRenderTexture:function(a){var b=cc.director.getWinSize();a=new cc.ProgressTimer(a.sprite);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(a.sprite.flippedY=!0);a.type=cc.ProgressTimer.TYPE_BAR;a.midPoint=cc.p(0.5,0.5);a.barChangeRate=cc.p(1,1);a.percentage=100;this._setAttrs(a,b.width/2,b.height/2);return a}}); cc.TransitionProgressOutIn.create=function(a,b){return new cc.TransitionProgressOutIn(a,b)};cc.TransitionPageTurn=cc.TransitionScene.extend({ctor:function(a,b,c){cc.TransitionScene.prototype.ctor.call(this);this._gridProxy=new cc.NodeGrid;this.initWithDuration(a,b,c)},_back:!0,_gridProxy:null,_className:"TransitionPageTurn",initWithDuration:function(a,b,c){this._back=c;cc.TransitionScene.prototype.initWithDuration.call(this,a,b);return!0},actionWithSize:function(a){return this._back?cc.reverseTime(cc.pageTurn3D(this._duration,a)):cc.pageTurn3D(this._duration,a)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this); var a=cc.director.getWinSize(),b;a.width>a.height?(a=16,b=12):(a=12,b=16);a=this.actionWithSize(cc.size(a,b));b=this._gridProxy;this._back?(b.setTarget(this._inScene),b._performRecursive(cc.Node._stateCallbackType.onEnter),this._inScene.visible=!1,b.runAction(cc.sequence(a,cc.callFunc(this.finish,this),cc.stopGrid())),this._inScene.runAction(cc.show())):(b.setTarget(this._outScene),b._performRecursive(cc.Node._stateCallbackType.onEnter),b.runAction(cc.sequence(a,cc.callFunc(this.finish,this),cc.stopGrid())))}, visit:function(){this._back?this._outScene.visit():this._inScene.visit();this._gridProxy.visit()},_sceneOrder:function(){this._isInSceneOnTop=this._back}});cc.TransitionPageTurn.create=function(a,b,c){return new cc.TransitionPageTurn(a,b,c)};cc.Codec={name:"Jacob__Codec"};cc.unzip=function(){return cc.Codec.GZip.gunzip.apply(cc.Codec.GZip,arguments)};cc.unzipBase64=function(){var a=cc.Codec.Base64.decode.apply(cc.Codec.Base64,arguments);return cc.Codec.GZip.gunzip.apply(cc.Codec.GZip,[a])};cc.unzipBase64AsArray=function(a,b){b=b||1;var c=this.unzipBase64(a),d=[],e,f,g;e=0;for(g=c.length/b;e<g;e++)for(d[e]=0,f=b-1;0<=f;--f)d[e]+=c.charCodeAt(e*b+f)<<8*f;return d}; cc.unzipAsArray=function(a,b){b=b||1;var c=this.unzip(a),d=[],e,f,g;e=0;for(g=c.length/b;e<g;e++)for(d[e]=0,f=b-1;0<=f;--f)d[e]+=c.charCodeAt(e*b+f)<<8*f;return d};cc.StringToArray=function(a){a=a.split(",");var b=[],c;for(c=0;c<a.length;c++)b.push(parseInt(a[c]));return b};cc.Codec.Base64={name:"Jacob__Codec__Base64"};cc.Codec.Base64._keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d"; cc.Codec.Base64.decode=function(a){var b=[],c,d,e,f,g,h=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");h<a.length;)c=this._keyStr.indexOf(a.charAt(h++)),d=this._keyStr.indexOf(a.charAt(h++)),f=this._keyStr.indexOf(a.charAt(h++)),g=this._keyStr.indexOf(a.charAt(h++)),c=c<<2|d>>4,d=(d&15)<<4|f>>2,e=(f&3)<<6|g,b.push(String.fromCharCode(c)),64!==f&&b.push(String.fromCharCode(d)),64!==g&&b.push(String.fromCharCode(e));return b=b.join("")}; cc.Codec.Base64.decodeAsArray=function(a,b){var c=this.decode(a),d=[],e,f,g;e=0;for(g=c.length/b;e<g;e++)for(d[e]=0,f=b-1;0<=f;--f)d[e]+=c.charCodeAt(e*b+f)<<8*f;return d};cc.uint8ArrayToUint32Array=function(a){if(0!==a.length%4)return null;for(var b=a.length/4,c=window.Uint32Array?new Uint32Array(b):[],d=0;d<b;d++){var e=4*d;c[d]=a[e]+256*a[e+1]+65536*a[e+2]+16777216*a[e+3]}return c};cc.PNGReader=cc.Class.extend({ctor:function(a){var b,c,d,e;this.data=a;this.pos=8;this.palette=[];this.imgData=[];this.transparency={};this.animation=null;this.text={};for(d=null;;){b=this.readUInt32();e=a=void 0;e=[];for(a=0;4>a;++a)e.push(String.fromCharCode(this.data[this.pos++]));a=e.join("");switch(a){case "IHDR":this.width=this.readUInt32();this.height=this.readUInt32();this.bits=this.data[this.pos++];this.colorType=this.data[this.pos++];this.compressionMethod=this.data[this.pos++];this.filterMethod= this.data[this.pos++];this.interlaceMethod=this.data[this.pos++];break;case "acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||Infinity,frames:[]};break;case "PLTE":this.palette=this.read(b);break;case "fcTL":d&&this.animation.frames.push(d);this.pos+=4;d={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()};a=this.readUInt16();b=this.readUInt16()||100;d.delay=1E3*a/b;d.disposeOp=this.data[this.pos++];d.blendOp=this.data[this.pos++]; d.data=[];break;case "IDAT":case "fdAT":"fdAT"===a&&(this.pos+=4,b-=4);a=(null!=d?d.data:void 0)||this.imgData;for(e=0;0<=b?e<b:e>b;0<=b?++e:--e)a.push(this.data[this.pos++]);break;case "tRNS":this.transparency={};switch(this.colorType){case 3:this.transparency.indexed=this.read(b);b=255-this.transparency.indexed.length;if(0<b)for(a=0;0<=b?a<b:a>b;0<=b?++a:--a)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(b)[0];break;case 2:this.transparency.rgb=this.read(b)}break; case "tEXt":e=this.read(b);b=e.indexOf(0);a=String.fromCharCode.apply(String,e.slice(0,b));this.text[a]=String.fromCharCode.apply(String,e.slice(b+1));break;case "IEND":d&&this.animation.frames.push(d);a:{switch(this.colorType){case 0:case 3:case 4:d=1;break a;case 2:case 6:d=3;break a}d=void 0}this.colors=d;this.hasAlphaChannel=4===(c=this.colorType)||6===c;c=this.colors+(this.hasAlphaChannel?1:0);this.pixelBitlength=this.bits*c;a:{switch(this.colors){case 1:c="DeviceGray";break a;case 3:c="DeviceRGB"; break a}c=void 0}this.colorSpace=c;Uint8Array!=Array&&(this.imgData=new Uint8Array(this.imgData));return;default:this.pos+=b}this.pos+=4;if(this.pos>this.data.length)throw Error("Incomplete or corrupt PNG file");}},read:function(a){var b,c;c=[];for(b=0;0<=a?b<a:b>a;0<=a?++b:--b)c.push(this.data[this.pos++]);return c},readUInt32:function(){var a,b,c,d;a=this.data[this.pos++]<<24;b=this.data[this.pos++]<<16;c=this.data[this.pos++]<<8;d=this.data[this.pos++];return a|b|c|d},readUInt16:function(){var a, b;a=this.data[this.pos++]<<8;b=this.data[this.pos++];return a|b},decodePixels:function(a){var b,c,d,e,f,g,h,k,m,n,p,r,s,u,t;null==a&&(a=this.imgData);if(0===a.length)return new Uint8Array(0);a=(new Zlib.Inflate(a,{index:0,verify:!1})).decompress();k=this.pixelBitlength/8;r=k*this.width;m=new Uint8Array(r*this.height);g=a.length;for(c=n=p=0;n<g;){switch(a[n++]){case 0:for(b=0;b<r;b+=1)m[c++]=a[n++];break;case 1:for(e=s=0;s<r;e=s+=1)b=a[n++],f=e<k?0:m[c-k],m[c++]=(b+f)%256;break;case 2:for(e=f=0;f< r;e=f+=1)b=a[n++],d=(e-e%k)/k,s=p&&m[(p-1)*r+d*k+e%k],m[c++]=(s+b)%256;break;case 3:for(e=t=0;t<r;e=t+=1)b=a[n++],d=(e-e%k)/k,f=e<k?0:m[c-k],s=p&&m[(p-1)*r+d*k+e%k],m[c++]=(b+Math.floor((f+s)/2))%256;break;case 4:for(e=t=0;t<r;e=t+=1)b=a[n++],d=(e-e%k)/k,f=e<k?0:m[c-k],0===p?s=u=0:(s=m[(p-1)*r+d*k+e%k],u=d&&m[(p-1)*r+(d-1)*k+e%k]),h=f+s-u,e=Math.abs(h-f),d=Math.abs(h-s),h=Math.abs(h-u),f=e<=d&&e<=h?f:d<=h?s:u,m[c++]=(b+f)%256;break;default:throw Error("Invalid filter algorithm: "+a[n-1]);}p++}return m}, copyToImageData:function(a,b){var c,d,e,f,g,h,k,m;d=this.colors;m=null;c=this.hasAlphaChannel;this.palette.length&&(m=null!=(e=this._decodedPalette)?e:this._decodedPalette=this.decodePalette(),d=4,c=!0);e=a.data||a;k=e.length;g=m||b;f=h=0;if(1===d)for(;f<k;)d=m?4*b[f/4]:h,h=g[d++],e[f++]=h,e[f++]=h,e[f++]=h,e[f++]=c?g[d++]:255,h=d;else for(;f<k;)d=m?4*b[f/4]:h,e[f++]=g[d++],e[f++]=g[d++],e[f++]=g[d++],e[f++]=c?g[d++]:255,h=d},decodePalette:function(){var a,b,c,d,e,f,g,h,k;c=this.palette;f=this.transparency.indexed|| [];e=new Uint8Array((f.length||0)+c.length);b=g=a=d=0;for(h=c.length;g<h;b=g+=3)e[d++]=c[b],e[d++]=c[b+1],e[d++]=c[b+2],e[d++]=null!=(k=f[a++])?k:255;return e},render:function(a){var b;a.width=this.width;a.height=this.height;a=a.getContext("2d");b=a.createImageData(this.width,this.height);this.copyToImageData(b,this.decodePixels());return a.putImageData(b,0,0)}});cc.tiffReader={_littleEndian:!1,_tiffData:null,_fileDirectories:[],getUint8:function(a){return this._tiffData[a]},getUint16:function(a){return this._littleEndian?this._tiffData[a+1]<<8|this._tiffData[a]:this._tiffData[a]<<8|this._tiffData[a+1]},getUint32:function(a){var b=this._tiffData;return this._littleEndian?b[a+3]<<24|b[a+2]<<16|b[a+1]<<8|b[a]:b[a]<<24|b[a+1]<<16|b[a+2]<<8|b[a+3]},checkLittleEndian:function(){var a=this.getUint16(0);if(18761===a)this.littleEndian=!0;else if(19789===a)this.littleEndian= !1;else throw console.log(a),TypeError("Invalid byte order value.");return this.littleEndian},hasTowel:function(){if(42!==this.getUint16(2))throw RangeError("You forgot your towel!");return!0},getFieldTypeName:function(a){var b=this.fieldTypeNames;return a in b?b[a]:null},getFieldTagName:function(a){var b=this.fieldTagNames;if(a in b)return b[a];console.log("Unknown Field Tag:",a);return"Tag"+a},getFieldTypeLength:function(a){return-1!==["BYTE","ASCII","SBYTE","UNDEFINED"].indexOf(a)?1:-1!==["SHORT", "SSHORT"].indexOf(a)?2:-1!==["LONG","SLONG","FLOAT"].indexOf(a)?4:-1!==["RATIONAL","SRATIONAL","DOUBLE"].indexOf(a)?8:null},getFieldValues:function(a,b,c,d){a=[];var e=this.getFieldTypeLength(b);if(4>=e*c)!1===this.littleEndian?a.push(d>>>8*(4-e)):a.push(d);else for(var f=0;f<c;f++){var g=e*f;8<=e?-1!==["RATIONAL","SRATIONAL"].indexOf(b)?(a.push(this.getUint32(d+g)),a.push(this.getUint32(d+g+4))):cc.log("Can't handle this field type or size"):a.push(this.getBytes(e,d+g))}"ASCII"===b&&a.forEach(function(a, b,c){c[b]=String.fromCharCode(a)});return a},getBytes:function(a,b){if(0>=a)cc.log("No bytes requested");else{if(1>=a)return this.getUint8(b);if(2>=a)return this.getUint16(b);if(3>=a)return this.getUint32(b)>>>8;if(4>=a)return this.getUint32(b);cc.log("Too many bytes requested")}},getBits:function(a,b,c){c=c||0;b+=Math.floor(c/8);var d=c+a;a=32-a;var e,f;0>=d?console.log("No bits requested"):8>=d?(e=24+c,f=this.getUint8(b)):16>=d?(e=16+c,f=this.getUint16(b)):32>=d?(e=c,f=this.getUint32(b)):console.log("Too many bits requested"); return{bits:f<<e>>>a,byteOffset:b+Math.floor(d/8),bitOffset:d%8}},parseFileDirectory:function(a){var b=this.getUint16(a),c=[];a+=2;for(var d=0;d<b;a+=12,d++){var e=this.getUint16(a),f=this.getUint16(a+2),g=this.getUint32(a+4),h=this.getUint32(a+8),e=this.getFieldTagName(e),f=this.getFieldTypeName(f),g=this.getFieldValues(e,f,g,h);c[e]={type:f,values:g}}this._fileDirectories.push(c);b=this.getUint32(a);0!==b&&this.parseFileDirectory(b)},clampColorSample:function(a,b){var c=Math.pow(2,8-b);return Math.floor(a* c+(c-1))},parseTIFF:function(a,b){b=b||document.createElement("canvas");this._tiffData=a;this.canvas=b;this.checkLittleEndian();if(this.hasTowel()){var c=this.getUint32(4);this._fileDirectories.length=0;this.parseFileDirectory(c);var d=this._fileDirectories[0],c=d.ImageWidth.values[0],e=d.ImageLength.values[0];this.canvas.width=c;this.canvas.height=e;var f=[],g=d.Compression?d.Compression.values[0]:1,h=d.SamplesPerPixel.values[0],k=[],m=0,n=!1;d.BitsPerSample.values.forEach(function(a,b,c){k[b]={bitsPerSample:a, hasBytesPerSample:!1,bytesPerSample:void 0};0===a%8&&(k[b].hasBytesPerSample=!0,k[b].bytesPerSample=a/8);m+=a},this);if(0===m%8)var n=!0,p=m/8;var r=d.StripOffsets.values,s=r.length;if(d.StripByteCounts)var u=d.StripByteCounts.values;else if(cc.log("Missing StripByteCounts!"),1===s)u=[Math.ceil(c*e*m/8)];else throw Error("Cannot recover from missing StripByteCounts");for(var t=0;t<s;t++){var v=r[t];f[t]=[];for(var w=u[t],x=0,B=0,y=1,z=!0,C=[],A=0,D=0,F=0;x<w;x+=y)switch(g){case 1:y=0;for(C=[];y<h;y++)if(k[y].hasBytesPerSample)C.push(this.getBytes(k[y].bytesPerSample, v+x+k[y].bytesPerSample*y));else{var M=this.getBits(k[y].bitsPerSample,v+x,B);C.push(M.bits);x=M.byteOffset-v;B=M.bitOffset;throw RangeError("Cannot handle sub-byte bits per sample");}f[t].push(C);if(n)y=p;else throw y=0,RangeError("Cannot handle sub-byte bits per pixel");break;case 32773:if(z){var z=!1,E=1,N=1,y=this.getInt8(v+x);0<=y&&127>=y?E=y+1:-127<=y&&-1>=y?N=-y+1:z=!0}else{for(var Q=this.getUint8(v+x),y=0;y<N;y++){if(k[D].hasBytesPerSample)F=F<<8*A|Q,A++,A===k[D].bytesPerSample&&(C.push(F), F=A=0,D++);else throw RangeError("Cannot handle sub-byte bits per sample");D===h&&(f[t].push(C),C=[],D=0)}E--;0===E&&(z=!0)}y=1}}if(b.getContext){p=this.canvas.getContext("2d");p.fillStyle="rgba(255, 255, 255, 0)";t=d.RowsPerStrip?d.RowsPerStrip.values[0]:e;v=f.length;e%=t;e=0===e?t:e;x=t;g=0;C=d.PhotometricInterpretation.values[0];E=[];N=0;d.ExtraSamples&&(E=d.ExtraSamples.values,N=E.length);if(d.ColorMap)var M=d.ColorMap.values,H=Math.pow(2,k[0].bitsPerSample);for(t=0;t<v;t++){t+1===v&&(x=e);d= f[t].length;g*=t;for(n=h=0;h<x,n<d;h++)for(r=0;r<c;r++,n++){u=f[t][n];z=B=w=0;s=1;if(0<N)for(w=0;w<N;w++)if(1===E[w]||2===E[w]){s=u[3+w]/256;break}switch(C){case 0:if(k[0].hasBytesPerSample)var R=Math.pow(16,2*k[0].bytesPerSample);u.forEach(function(a,b,c){c[b]=R-a});case 1:w=B=z=this.clampColorSample(u[0],k[0].bitsPerSample);break;case 2:w=this.clampColorSample(u[0],k[0].bitsPerSample);B=this.clampColorSample(u[1],k[1].bitsPerSample);z=this.clampColorSample(u[2],k[2].bitsPerSample);break;case 3:if(void 0=== M)throw Error("Palette image missing color map");u=u[0];w=this.clampColorSample(M[u],16);B=this.clampColorSample(M[H+u],16);z=this.clampColorSample(M[2*H+u],16);break;default:throw RangeError("Unknown Photometric Interpretation:",C);}p.fillStyle="rgba("+w+", "+B+", "+z+", "+s+")";p.fillRect(r,g+h,1,1)}g=x}}return this.canvas}},fieldTagNames:{315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder", 289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution", 326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint", 344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile", 700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop"},fieldTypeNames:{1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE"}};cc.Particle=function(a,b,c,d,e,f,g,h,k,m,n,p){this.pos=a?a:cc.p(0,0);this.startPos=b?b:cc.p(0,0);this.color=c?c:{r:0,g:0,b:0,a:255};this.deltaColor=d?d:{r:0,g:0,b:0,a:255};this.size=e||0;this.deltaSize=f||0;this.rotation=g||0;this.deltaRotation=h||0;this.timeToLive=k||0;this.atlasIndex=m||0;this.modeA=n?n:new cc.Particle.ModeA;this.modeB=p?p:new cc.Particle.ModeB;this.isChangeColor=!1;this.drawPos=cc.p(0,0)}; cc.Particle.ModeA=function(a,b,c){this.dir=a?a:cc.p(0,0);this.radialAccel=b||0;this.tangentialAccel=c||0};cc.Particle.ModeB=function(a,b,c,d){this.angle=a||0;this.degreesPerSecond=b||0;this.radius=c||0;this.deltaRadius=d||0};cc.Particle.TemporaryPoints=[cc.p(),cc.p(),cc.p(),cc.p()]; cc.ParticleSystem=cc.Node.extend({_className:"ParticleSystem",_plistFile:"",_elapsed:0,_dontTint:!1,modeA:null,modeB:null,_pointZeroForParticle:cc.p(0,0),_particles:null,_emitCounter:0,_particleIdx:0,_batchNode:null,atlasIndex:0,_transformSystemDirty:!1,_allocatedParticles:0,_isActive:!1,particleCount:0,duration:0,_sourcePosition:null,_posVar:null,life:0,lifeVar:0,angle:0,angleVar:0,startSize:0,startSizeVar:0,endSize:0,endSizeVar:0,_startColor:null,_startColorVar:null,_endColor:null,_endColorVar:null, startSpin:0,startSpinVar:0,endSpin:0,endSpinVar:0,emissionRate:0,_totalParticles:0,_texture:null,_blendFunc:null,_opacityModifyRGB:!1,positionType:null,autoRemoveOnFinish:!1,emitterMode:0,_textureLoaded:null,ctor:function(a){cc.Node.prototype.ctor.call(this);this.emitterMode=cc.ParticleSystem.MODE_GRAVITY;this.modeA=new cc.ParticleSystem.ModeA;this.modeB=new cc.ParticleSystem.ModeB;this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};this._particles=[];this._sourcePosition=cc.p(0,0);this._posVar=cc.p(0, 0);this._startColor=cc.color(255,255,255,255);this._startColorVar=cc.color(255,255,255,255);this._endColor=cc.color(255,255,255,255);this._endColorVar=cc.color(255,255,255,255);this._plistFile="";this._elapsed=0;this._dontTint=!1;this._pointZeroForParticle=cc.p(0,0);this._particleIdx=this._emitCounter=0;this._batchNode=null;this.atlasIndex=0;this._transformSystemDirty=!1;this._allocatedParticles=0;this._isActive=!1;this._totalParticles=this.emissionRate=this.endSpinVar=this.endSpin=this.startSpinVar= this.startSpin=this.endSizeVar=this.endSize=this.startSizeVar=this.startSize=this.angleVar=this.angle=this.lifeVar=this.life=this.duration=this.particleCount=0;this._texture=null;this._opacityModifyRGB=!1;this.positionType=cc.ParticleSystem.TYPE_FREE;this.autoRemoveOnFinish=!1;this._textureLoaded=!0;!a||cc.isNumber(a)?(a=a||100,this.setDrawMode(cc.ParticleSystem.TEXTURE_MODE),this.initWithTotalParticles(a)):cc.isString(a)?this.initWithFile(a):cc.isObject(a)&&this.initWithDictionary(a,"")},_createRenderCmd:function(){return cc._renderType=== cc.game.RENDER_TYPE_CANVAS?new cc.ParticleSystem.CanvasRenderCmd(this):new cc.ParticleSystem.WebGLRenderCmd(this)},ignoreColor:function(a){this._dontTint=a},initTexCoordsWithRect:function(a){this._renderCmd.initTexCoordsWithRect(a)},getBatchNode:function(){return this._batchNode},setBatchNode:function(a){this._renderCmd.setBatchNode(a)},getAtlasIndex:function(){return this.atlasIndex},setAtlasIndex:function(a){this.atlasIndex=a},getDrawMode:function(){return this._renderCmd.getDrawMode()},setDrawMode:function(a){this._renderCmd.setDrawMode(a)}, getShapeType:function(){return this._renderCmd.getShapeType()},setShapeType:function(a){this._renderCmd.setShapeType(a)},isActive:function(){return this._isActive},getParticleCount:function(){return this.particleCount},setParticleCount:function(a){this.particleCount=a},getDuration:function(){return this.duration},setDuration:function(a){this.duration=a},getSourcePosition:function(){return{x:this._sourcePosition.x,y:this._sourcePosition.y}},setSourcePosition:function(a){this._sourcePosition.x=a.x; this._sourcePosition.y=a.y},getPosVar:function(){return{x:this._posVar.x,y:this._posVar.y}},setPosVar:function(a){this._posVar.x=a.x;this._posVar.y=a.y},getLife:function(){return this.life},setLife:function(a){this.life=a},getLifeVar:function(){return this.lifeVar},setLifeVar:function(a){this.lifeVar=a},getAngle:function(){return this.angle},setAngle:function(a){this.angle=a},getAngleVar:function(){return this.angleVar},setAngleVar:function(a){this.angleVar=a},getGravity:function(){this.emitterMode!== cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getGravity() : Particle Mode should be Gravity");var a=this.modeA.gravity;return cc.p(a.x,a.y)},setGravity:function(a){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setGravity() : Particle Mode should be Gravity");this.modeA.gravity=a},getSpeed:function(){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getSpeed() : Particle Mode should be Gravity");return this.modeA.speed}, setSpeed:function(a){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setSpeed() : Particle Mode should be Gravity");this.modeA.speed=a},getSpeedVar:function(){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getSpeedVar() : Particle Mode should be Gravity");return this.modeA.speedVar},setSpeedVar:function(a){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setSpeedVar() : Particle Mode should be Gravity"); this.modeA.speedVar=a},getTangentialAccel:function(){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getTangentialAccel() : Particle Mode should be Gravity");return this.modeA.tangentialAccel},setTangentialAccel:function(a){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setTangentialAccel() : Particle Mode should be Gravity");this.modeA.tangentialAccel=a},getTangentialAccelVar:function(){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&& cc.log("cc.ParticleBatchNode.getTangentialAccelVar() : Particle Mode should be Gravity");return this.modeA.tangentialAccelVar},setTangentialAccelVar:function(a){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setTangentialAccelVar() : Particle Mode should be Gravity");this.modeA.tangentialAccelVar=a},getRadialAccel:function(){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getRadialAccel() : Particle Mode should be Gravity");return this.modeA.radialAccel}, setRadialAccel:function(a){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setRadialAccel() : Particle Mode should be Gravity");this.modeA.radialAccel=a},getRadialAccelVar:function(){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getRadialAccelVar() : Particle Mode should be Gravity");return this.modeA.radialAccelVar},setRadialAccelVar:function(a){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setRadialAccelVar() : Particle Mode should be Gravity"); this.modeA.radialAccelVar=a},getRotationIsDir:function(){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getRotationIsDir() : Particle Mode should be Gravity");return this.modeA.rotationIsDir},setRotationIsDir:function(a){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setRotationIsDir() : Particle Mode should be Gravity");this.modeA.rotationIsDir=a},getStartRadius:function(){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getStartRadius() : Particle Mode should be Radius"); return this.modeB.startRadius},setStartRadius:function(a){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setStartRadius() : Particle Mode should be Radius");this.modeB.startRadius=a},getStartRadiusVar:function(){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getStartRadiusVar() : Particle Mode should be Radius");return this.modeB.startRadiusVar},setStartRadiusVar:function(a){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setStartRadiusVar() : Particle Mode should be Radius"); this.modeB.startRadiusVar=a},getEndRadius:function(){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getEndRadius() : Particle Mode should be Radius");return this.modeB.endRadius},setEndRadius:function(a){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setEndRadius() : Particle Mode should be Radius");this.modeB.endRadius=a},getEndRadiusVar:function(){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getEndRadiusVar() : Particle Mode should be Radius"); return this.modeB.endRadiusVar},setEndRadiusVar:function(a){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setEndRadiusVar() : Particle Mode should be Radius");this.modeB.endRadiusVar=a},getRotatePerSecond:function(){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getRotatePerSecond() : Particle Mode should be Radius");return this.modeB.rotatePerSecond},setRotatePerSecond:function(a){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setRotatePerSecond() : Particle Mode should be Radius"); this.modeB.rotatePerSecond=a},getRotatePerSecondVar:function(){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getRotatePerSecondVar() : Particle Mode should be Radius");return this.modeB.rotatePerSecondVar},setRotatePerSecondVar:function(a){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setRotatePerSecondVar() : Particle Mode should be Radius");this.modeB.rotatePerSecondVar=a},setScale:function(a,b){this._transformSystemDirty=!0;cc.Node.prototype.setScale.call(this, a,b)},setRotation:function(a){this._transformSystemDirty=!0;cc.Node.prototype.setRotation.call(this,a)},setScaleX:function(a){this._transformSystemDirty=!0;cc.Node.prototype.setScaleX.call(this,a)},setScaleY:function(a){this._transformSystemDirty=!0;cc.Node.prototype.setScaleY.call(this,a)},getStartSize:function(){return this.startSize},setStartSize:function(a){this.startSize=a},getStartSizeVar:function(){return this.startSizeVar},setStartSizeVar:function(a){this.startSizeVar=a},getEndSize:function(){return this.endSize}, setEndSize:function(a){this.endSize=a},getEndSizeVar:function(){return this.endSizeVar},setEndSizeVar:function(a){this.endSizeVar=a},getStartColor:function(){return cc.color(this._startColor.r,this._startColor.g,this._startColor.b,this._startColor.a)},setStartColor:function(a){this._startColor.r=a.r;this._startColor.g=a.g;this._startColor.b=a.b;this._startColor.a=a.a},getStartColorVar:function(){return cc.color(this._startColorVar.r,this._startColorVar.g,this._startColorVar.b,this._startColorVar.a)}, setStartColorVar:function(a){this._startColorVar.r=a.r;this._startColorVar.g=a.g;this._startColorVar.b=a.b;this._startColorVar.a=a.a},getEndColor:function(){return cc.color(this._endColor.r,this._endColor.g,this._endColor.b,this._endColor.a)},setEndColor:function(a){this._endColor.r=a.r;this._endColor.g=a.g;this._endColor.b=a.b;this._endColor.a=a.a},getEndColorVar:function(){return cc.color(this._endColorVar.r,this._endColorVar.g,this._endColorVar.b,this._endColorVar.a)},setEndColorVar:function(a){this._endColorVar.r= a.r;this._endColorVar.g=a.g;this._endColorVar.b=a.b;this._endColorVar.a=a.a},getStartSpin:function(){return this.startSpin},setStartSpin:function(a){this.startSpin=a},getStartSpinVar:function(){return this.startSpinVar},setStartSpinVar:function(a){this.startSpinVar=a},getEndSpin:function(){return this.endSpin},setEndSpin:function(a){this.endSpin=a},getEndSpinVar:function(){return this.endSpinVar},setEndSpinVar:function(a){this.endSpinVar=a},getEmissionRate:function(){return this.emissionRate},setEmissionRate:function(a){this.emissionRate= a},getTotalParticles:function(){return this._totalParticles},setTotalParticles:function(a){this._renderCmd.setTotalParticles(a)},getTexture:function(){return this._texture},setTexture:function(a){a&&(a.isLoaded()?this.setTextureWithRect(a,cc.rect(0,0,a.width,a.height)):(this._textureLoaded=!1,a.addEventListener("load",function(a){this._textureLoaded=!0;this.setTextureWithRect(a,cc.rect(0,0,a.width,a.height))},this)))},getBlendFunc:function(){return this._blendFunc},setBlendFunc:function(a,b){if(void 0=== b)this._blendFunc!==a&&(this._blendFunc=a,this._updateBlendFunc());else if(this._blendFunc.src!==a||this._blendFunc.dst!==b)this._blendFunc={src:a,dst:b},this._updateBlendFunc()},isOpacityModifyRGB:function(){return this._opacityModifyRGB},setOpacityModifyRGB:function(a){this._opacityModifyRGB=a},isBlendAdditive:function(){return this._blendFunc.src===cc.SRC_ALPHA&&this._blendFunc.dst===cc.ONE||this._blendFunc.src===cc.ONE&&this._blendFunc.dst===cc.ONE},setBlendAdditive:function(a){var b=this._blendFunc; a?(b.src=cc.SRC_ALPHA,b.dst=cc.ONE):this._renderCmd._setBlendAdditive()},getPositionType:function(){return this.positionType},setPositionType:function(a){this.positionType=a},isAutoRemoveOnFinish:function(){return this.autoRemoveOnFinish},setAutoRemoveOnFinish:function(a){this.autoRemoveOnFinish=a},getEmitterMode:function(){return this.emitterMode},setEmitterMode:function(a){this.emitterMode=a},init:function(){return this.initWithTotalParticles(150)},initWithFile:function(a){this._plistFile=a;a=cc.loader.getRes(a); return a?this.initWithDictionary(a,""):(cc.log("cc.ParticleSystem.initWithFile(): Particles: file not found"),!1)},getBoundingBoxToWorld:function(){return cc.rect(0,0,cc._canvas.width,cc._canvas.height)},initWithDictionary:function(a,b){var c=!1,d=null,d=this._valueForKey,e=parseInt(d("maxParticles",a));if(this.initWithTotalParticles(e)){this.angle=parseFloat(d("angle",a));this.angleVar=parseFloat(d("angleVariance",a));this.duration=parseFloat(d("duration",a));this._blendFunc.src=parseInt(d("blendFuncSource", a));this._blendFunc.dst=parseInt(d("blendFuncDestination",a));c=this._startColor;c.r=255*parseFloat(d("startColorRed",a));c.g=255*parseFloat(d("startColorGreen",a));c.b=255*parseFloat(d("startColorBlue",a));c.a=255*parseFloat(d("startColorAlpha",a));c=this._startColorVar;c.r=255*parseFloat(d("startColorVarianceRed",a));c.g=255*parseFloat(d("startColorVarianceGreen",a));c.b=255*parseFloat(d("startColorVarianceBlue",a));c.a=255*parseFloat(d("startColorVarianceAlpha",a));c=this._endColor;c.r=255*parseFloat(d("finishColorRed", a));c.g=255*parseFloat(d("finishColorGreen",a));c.b=255*parseFloat(d("finishColorBlue",a));c.a=255*parseFloat(d("finishColorAlpha",a));c=this._endColorVar;c.r=255*parseFloat(d("finishColorVarianceRed",a));c.g=255*parseFloat(d("finishColorVarianceGreen",a));c.b=255*parseFloat(d("finishColorVarianceBlue",a));c.a=255*parseFloat(d("finishColorVarianceAlpha",a));this.startSize=parseFloat(d("startParticleSize",a));this.startSizeVar=parseFloat(d("startParticleSizeVariance",a));this.endSize=parseFloat(d("finishParticleSize", a));this.endSizeVar=parseFloat(d("finishParticleSizeVariance",a));this.setPosition(parseFloat(d("sourcePositionx",a)),parseFloat(d("sourcePositiony",a)));this._posVar.x=parseFloat(d("sourcePositionVariancex",a));this._posVar.y=parseFloat(d("sourcePositionVariancey",a));this.startSpin=parseFloat(d("rotationStart",a));this.startSpinVar=parseFloat(d("rotationStartVariance",a));this.endSpin=parseFloat(d("rotationEnd",a));this.endSpinVar=parseFloat(d("rotationEndVariance",a));this.emitterMode=parseInt(d("emitterType", a));if(this.emitterMode===cc.ParticleSystem.MODE_GRAVITY)c=this.modeA,c.gravity.x=parseFloat(d("gravityx",a)),c.gravity.y=parseFloat(d("gravityy",a)),c.speed=parseFloat(d("speed",a)),c.speedVar=parseFloat(d("speedVariance",a)),e=d("radialAcceleration",a),c.radialAccel=e?parseFloat(e):0,e=d("radialAccelVariance",a),c.radialAccelVar=e?parseFloat(e):0,e=d("tangentialAcceleration",a),c.tangentialAccel=e?parseFloat(e):0,e=d("tangentialAccelVariance",a),c.tangentialAccelVar=e?parseFloat(e):0,e=d("rotationIsDir", a),null!==e?(e=e.toString().toLowerCase(),c.rotationIsDir="true"===e||"1"===e):c.rotationIsDir=!1;else if(this.emitterMode===cc.ParticleSystem.MODE_RADIUS)c=this.modeB,c.startRadius=parseFloat(d("maxRadius",a)),c.startRadiusVar=parseFloat(d("maxRadiusVariance",a)),c.endRadius=parseFloat(d("minRadius",a)),c.endRadiusVar=0,c.rotatePerSecond=parseFloat(d("rotatePerSecond",a)),c.rotatePerSecondVar=parseFloat(d("rotatePerSecondVariance",a));else return cc.log("cc.ParticleSystem.initWithDictionary(): Invalid emitterType in config file"), !1;this.life=parseFloat(d("particleLifespan",a));this.lifeVar=parseFloat(d("particleLifespanVariance",a));this.emissionRate=this._totalParticles/this.life;if(!this._batchNode)if(this._opacityModifyRGB=!1,c=d("textureFileName",a),c=cc.path.changeBasename(this._plistFile,c),e=cc.textureCache.getTextureForKey(c))this.setTexture(e);else if((d=d("textureImageData",a))&&0!==d.length){d=cc.unzipBase64AsArray(d,1);if(!d)return cc.log("cc.ParticleSystem: error decoding or ungzipping textureImageData"),!1; e=cc.getImageFormatByData(d);if(e!==cc.FMT_TIFF&&e!==cc.FMT_PNG)return cc.log("cc.ParticleSystem: unknown image format with Data"),!1;var f=document.createElement("canvas");e===cc.FMT_PNG?(new cc.PNGReader(d)).render(f):cc.tiffReader.parseTIFF(d,f);cc.textureCache.cacheImage(c,f);(d=cc.textureCache.getTextureForKey(c))||cc.log("cc.ParticleSystem.initWithDictionary() : error loading the texture");this.setTexture(d)}else{e=cc.textureCache.addImage(c);if(!e)return!1;this.setTexture(e)}c=!0}return c}, initWithTotalParticles:function(a){this._totalParticles=a;var b,c=this._particles;for(b=c.length=0;b<a;b++)c[b]=new cc.Particle;if(!c)return cc.log("Particle system: not enough memory"),!1;this._allocatedParticles=a;if(this._batchNode)for(b=0;b<this._totalParticles;b++)c[b].atlasIndex=b;this._isActive=!0;this._blendFunc.src=cc.BLEND_SRC;this._blendFunc.dst=cc.BLEND_DST;this.positionType=cc.ParticleSystem.TYPE_FREE;this.emitterMode=cc.ParticleSystem.MODE_GRAVITY;this._transformSystemDirty=this.autoRemoveOnFinish= !1;this.scheduleUpdateWithPriority(1);this._renderCmd._initWithTotalParticles(a);return!0},destroyParticleSystem:function(){this.unscheduleUpdate()},addParticle:function(){if(this.isFull())return!1;var a=this._renderCmd.addParticle();this.initParticle(a);++this.particleCount;return!0},initParticle:function(a){var b=cc.randomMinus1To1;a.timeToLive=this.life+this.lifeVar*b();a.timeToLive=Math.max(0,a.timeToLive);a.pos.x=this._sourcePosition.x+this._posVar.x*b();a.pos.y=this._sourcePosition.y+this._posVar.y* b();var c,d;c=this._startColor;var e=this._startColorVar,f=this._endColor;d=this._endColorVar;c={r:cc.clampf(c.r+e.r*b(),0,255),g:cc.clampf(c.g+e.g*b(),0,255),b:cc.clampf(c.b+e.b*b(),0,255),a:cc.clampf(c.a+e.a*b(),0,255)};d={r:cc.clampf(f.r+d.r*b(),0,255),g:cc.clampf(f.g+d.g*b(),0,255),b:cc.clampf(f.b+d.b*b(),0,255),a:cc.clampf(f.a+d.a*b(),0,255)};a.color=c;e=a.deltaColor;f=a.timeToLive;e.r=(d.r-c.r)/f;e.g=(d.g-c.g)/f;e.b=(d.b-c.b)/f;e.a=(d.a-c.a)/f;c=this.startSize+this.startSizeVar*b();c=Math.max(0, c);a.size=c;this.endSize===cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE?a.deltaSize=0:(d=this.endSize+this.endSizeVar*b(),d=Math.max(0,d),a.deltaSize=(d-c)/f);c=this.startSpin+this.startSpinVar*b();d=this.endSpin+this.endSpinVar*b();a.rotation=c;a.deltaRotation=(d-c)/f;this.positionType===cc.ParticleSystem.TYPE_FREE?a.startPos=this.convertToWorldSpace(this._pointZeroForParticle):this.positionType===cc.ParticleSystem.TYPE_RELATIVE&&(a.startPos.x=this._position.x,a.startPos.y=this._position.y);c= cc.degreesToRadians(this.angle+this.angleVar*b());if(this.emitterMode===cc.ParticleSystem.MODE_GRAVITY)f=this.modeA,d=a.modeA,e=f.speed+f.speedVar*b(),d.dir.x=Math.cos(c),d.dir.y=Math.sin(c),cc.pMultIn(d.dir,e),d.radialAccel=f.radialAccel+f.radialAccelVar*b(),d.tangentialAccel=f.tangentialAccel+f.tangentialAccelVar*b(),f.rotationIsDir&&(a.rotation=-cc.radiansToDegrees(cc.pToAngle(d.dir)));else{d=this.modeB;a=a.modeB;var e=d.startRadius+d.startRadiusVar*b(),g=d.endRadius+d.endRadiusVar*b();a.radius= e;a.deltaRadius=d.endRadius===cc.ParticleSystem.START_RADIUS_EQUAL_TO_END_RADIUS?0:(g-e)/f;a.angle=c;a.degreesPerSecond=cc.degreesToRadians(d.rotatePerSecond+d.rotatePerSecondVar*b())}},stopSystem:function(){this._isActive=!1;this._elapsed=this.duration;this._emitCounter=0},resetSystem:function(){this._isActive=!0;this._elapsed=0;var a=this._particles;for(this._particleIdx=0;this._particleIdx<this.particleCount;++this._particleIdx)a[this._particleIdx].timeToLive=0},isFull:function(){return this.particleCount>= this._totalParticles},updateQuadWithParticle:function(a,b){this._renderCmd.updateQuadWithParticle(a,b)},postStep:function(){this._renderCmd.postStep()},update:function(a){if(this._isActive&&this.emissionRate){var b=1/this.emissionRate;this.particleCount<this._totalParticles&&(this._emitCounter+=a);for(;this.particleCount<this._totalParticles&&this._emitCounter>b;)this.addParticle(),this._emitCounter-=b;this._elapsed+=a;-1!==this.duration&&this.duration<this._elapsed&&this.stopSystem()}this._particleIdx= 0;b=cc.Particle.TemporaryPoints[0];this.positionType===cc.ParticleSystem.TYPE_FREE?cc.pIn(b,this.convertToWorldSpace(this._pointZeroForParticle)):this.positionType===cc.ParticleSystem.TYPE_RELATIVE&&(b.x=this._position.x,b.y=this._position.y);if(this._visible){for(var c=cc.Particle.TemporaryPoints[1],d=cc.Particle.TemporaryPoints[2],e=cc.Particle.TemporaryPoints[3],f=this._particles;this._particleIdx<this.particleCount;){cc.pZeroIn(c);cc.pZeroIn(d);cc.pZeroIn(e);var g=f[this._particleIdx];g.timeToLive-= a;if(0<g.timeToLive){if(this.emitterMode===cc.ParticleSystem.MODE_GRAVITY){var h=e,k=c,m=d;g.pos.x||g.pos.y?(cc.pIn(k,g.pos),cc.pNormalizeIn(k)):cc.pZeroIn(k);cc.pIn(m,k);cc.pMultIn(k,g.modeA.radialAccel);var n=m.x;m.x=-m.y;m.y=n;cc.pMultIn(m,g.modeA.tangentialAccel);cc.pIn(h,k);cc.pAddIn(h,m);cc.pAddIn(h,this.modeA.gravity);cc.pMultIn(h,a);cc.pAddIn(g.modeA.dir,h);cc.pIn(h,g.modeA.dir);cc.pMultIn(h,a);cc.pAddIn(g.pos,h)}else h=g.modeB,h.angle+=h.degreesPerSecond*a,h.radius+=h.deltaRadius*a,g.pos.x= -Math.cos(h.angle)*h.radius,g.pos.y=-Math.sin(h.angle)*h.radius;this._renderCmd._updateDeltaColor(g,a);g.size+=g.deltaSize*a;g.size=Math.max(0,g.size);g.rotation+=g.deltaRotation*a;h=c;this.positionType===cc.ParticleSystem.TYPE_FREE||this.positionType===cc.ParticleSystem.TYPE_RELATIVE?(k=d,cc.pIn(k,b),cc.pSubIn(k,g.startPos),cc.pIn(h,g.pos),cc.pSubIn(h,k)):cc.pIn(h,g.pos);this._batchNode&&(h.x+=this._position.x,h.y+=this._position.y);this._renderCmd.updateParticlePosition(g,h);++this._particleIdx}else if(g= g.atlasIndex,this._particleIdx!==this.particleCount-1&&(h=f[this._particleIdx],f[this._particleIdx]=f[this.particleCount-1],f[this.particleCount-1]=h),this._batchNode&&(this._batchNode.disableParticle(this.atlasIndex+g),f[this.particleCount-1].atlasIndex=g),--this.particleCount,0===this.particleCount&&this.autoRemoveOnFinish){this.unscheduleUpdate();this._parent.removeChild(this,!0);return}}this._transformSystemDirty=!1}this._batchNode||this.postStep()},updateWithNoTime:function(){this.update(0)}, _valueForKey:function(a,b){if(b){var c=b[a];return null!=c?c:""}return""},_updateBlendFunc:function(){if(this._batchNode)cc.log("Can't change blending functions when the particle is being batched");else{var a=this._texture;if(a&&a instanceof cc.Texture2D){this._opacityModifyRGB=!1;var b=this._blendFunc;b.src===cc.BLEND_SRC&&b.dst===cc.BLEND_DST&&(a.hasPremultipliedAlpha()?this._opacityModifyRGB=!0:(b.src=cc.SRC_ALPHA,b.dst=cc.ONE_MINUS_SRC_ALPHA))}}},clone:function(){var a=new cc.ParticleSystem;if(a.initWithTotalParticles(this.getTotalParticles())){a.setAngle(this.getAngle()); a.setAngleVar(this.getAngleVar());a.setDuration(this.getDuration());var b=this.getBlendFunc();a.setBlendFunc(b.src,b.dst);a.setStartColor(this.getStartColor());a.setStartColorVar(this.getStartColorVar());a.setEndColor(this.getEndColor());a.setEndColorVar(this.getEndColorVar());a.setStartSize(this.getStartSize());a.setStartSizeVar(this.getStartSizeVar());a.setEndSize(this.getEndSize());a.setEndSizeVar(this.getEndSizeVar());a.setPosition(cc.p(this.x,this.y));a.setPosVar(cc.p(this.getPosVar().x,this.getPosVar().y)); a.setPositionType(this.getPositionType());a.setStartSpin(this.getStartSpin()||0);a.setStartSpinVar(this.getStartSpinVar()||0);a.setEndSpin(this.getEndSpin()||0);a.setEndSpinVar(this.getEndSpinVar()||0);a.setEmitterMode(this.getEmitterMode());this.getEmitterMode()===cc.ParticleSystem.MODE_GRAVITY?(b=this.getGravity(),a.setGravity(cc.p(b.x,b.y)),a.setSpeed(this.getSpeed()),a.setSpeedVar(this.getSpeedVar()),a.setRadialAccel(this.getRadialAccel()),a.setRadialAccelVar(this.getRadialAccelVar()),a.setTangentialAccel(this.getTangentialAccel()), a.setTangentialAccelVar(this.getTangentialAccelVar())):this.getEmitterMode()===cc.ParticleSystem.MODE_RADIUS&&(a.setStartRadius(this.getStartRadius()),a.setStartRadiusVar(this.getStartRadiusVar()),a.setEndRadius(this.getEndRadius()),a.setEndRadiusVar(this.getEndRadiusVar()),a.setRotatePerSecond(this.getRotatePerSecond()),a.setRotatePerSecondVar(this.getRotatePerSecondVar()));a.setLife(this.getLife());a.setLifeVar(this.getLifeVar());a.setEmissionRate(this.getEmissionRate());if(!this.getBatchNode()&& (a.setOpacityModifyRGB(this.isOpacityModifyRGB()),b=this.getTexture())){var c=b.getContentSize();a.setTextureWithRect(b,cc.rect(0,0,c.width,c.height))}}return a},setDisplayFrame:function(a){if(a){var b=a.getOffsetInPixels();0===b.x&&0===b.y||cc.log("cc.ParticleSystem.setDisplayFrame(): QuadParticle only supports SpriteFrames with no offsets");a=a.getTexture();this._texture!==a&&this.setTexture(a)}},setTextureWithRect:function(a,b){this._texture!==a&&(this._texture=a,this._updateBlendFunc());this.initTexCoordsWithRect(b)}, listenBackToForeground:function(a){}});_p=cc.ParticleSystem.prototype;cc.defineGetterSetter(_p,"opacityModifyRGB",_p.isOpacityModifyRGB,_p.setOpacityModifyRGB);cc.defineGetterSetter(_p,"batchNode",_p.getBatchNode,_p.setBatchNode);cc.defineGetterSetter(_p,"drawMode",_p.getDrawMode,_p.setDrawMode);cc.defineGetterSetter(_p,"shapeType",_p.getShapeType,_p.setShapeType);cc.defineGetterSetter(_p,"active",_p.isActive);cc.defineGetterSetter(_p,"sourcePos",_p.getSourcePosition,_p.setSourcePosition); cc.defineGetterSetter(_p,"posVar",_p.getPosVar,_p.setPosVar);cc.defineGetterSetter(_p,"gravity",_p.getGravity,_p.setGravity);cc.defineGetterSetter(_p,"speed",_p.getSpeed,_p.setSpeed);cc.defineGetterSetter(_p,"speedVar",_p.getSpeedVar,_p.setSpeedVar);cc.defineGetterSetter(_p,"tangentialAccel",_p.getTangentialAccel,_p.setTangentialAccel);cc.defineGetterSetter(_p,"tangentialAccelVar",_p.getTangentialAccelVar,_p.setTangentialAccelVar);cc.defineGetterSetter(_p,"radialAccel",_p.getRadialAccel,_p.setRadialAccel); cc.defineGetterSetter(_p,"radialAccelVar",_p.getRadialAccelVar,_p.setRadialAccelVar);cc.defineGetterSetter(_p,"rotationIsDir",_p.getRotationIsDir,_p.setRotationIsDir);cc.defineGetterSetter(_p,"startRadius",_p.getStartRadius,_p.setStartRadius);cc.defineGetterSetter(_p,"startRadiusVar",_p.getStartRadiusVar,_p.setStartRadiusVar);cc.defineGetterSetter(_p,"endRadius",_p.getEndRadius,_p.setEndRadius);cc.defineGetterSetter(_p,"endRadiusVar",_p.getEndRadiusVar,_p.setEndRadiusVar); cc.defineGetterSetter(_p,"rotatePerS",_p.getRotatePerSecond,_p.setRotatePerSecond);cc.defineGetterSetter(_p,"rotatePerSVar",_p.getRotatePerSecondVar,_p.setRotatePerSecondVar);cc.defineGetterSetter(_p,"startColor",_p.getStartColor,_p.setStartColor);cc.defineGetterSetter(_p,"startColorVar",_p.getStartColorVar,_p.setStartColorVar);cc.defineGetterSetter(_p,"endColor",_p.getEndColor,_p.setEndColor);cc.defineGetterSetter(_p,"endColorVar",_p.getEndColorVar,_p.setEndColorVar); cc.defineGetterSetter(_p,"totalParticles",_p.getTotalParticles,_p.setTotalParticles);cc.defineGetterSetter(_p,"texture",_p.getTexture,_p.setTexture);cc.ParticleSystem.create=function(a){return new cc.ParticleSystem(a)};cc.ParticleSystem.createWithTotalParticles=cc.ParticleSystem.create; cc.ParticleSystem.ModeA=function(a,b,c,d,e,f,g,h){this.gravity=a?a:cc.p(0,0);this.speed=b||0;this.speedVar=c||0;this.tangentialAccel=d||0;this.tangentialAccelVar=e||0;this.radialAccel=f||0;this.radialAccelVar=g||0;this.rotationIsDir=h||!1};cc.ParticleSystem.ModeB=function(a,b,c,d,e,f){this.startRadius=a||0;this.startRadiusVar=b||0;this.endRadius=c||0;this.endRadiusVar=d||0;this.rotatePerSecond=e||0;this.rotatePerSecondVar=f||0};cc.ParticleSystem.SHAPE_MODE=0;cc.ParticleSystem.TEXTURE_MODE=1; cc.ParticleSystem.STAR_SHAPE=0;cc.ParticleSystem.BALL_SHAPE=1;cc.ParticleSystem.DURATION_INFINITY=-1;cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE=-1;cc.ParticleSystem.START_RADIUS_EQUAL_TO_END_RADIUS=-1;cc.ParticleSystem.MODE_GRAVITY=0;cc.ParticleSystem.MODE_RADIUS=1;cc.ParticleSystem.TYPE_FREE=0;cc.ParticleSystem.TYPE_RELATIVE=1;cc.ParticleSystem.TYPE_GROUPED=2;(function(){cc.ParticleSystem.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._drawMode=cc.ParticleSystem.TEXTURE_MODE;this._shapeType=cc.ParticleSystem.BALL_SHAPE;this._pointRect=cc.rect(0,0,0,0);this._tintCache=null};var a=cc.ParticleSystem.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.ParticleSystem.CanvasRenderCmd;a.getDrawMode=function(){return this._drawMode};a.setDrawMode=function(a){this._drawMode=a};a.getShapeType=function(){return this._shapeType}; a.setShapeType=function(a){this._shapeType=a};a.setBatchNode=function(a){this._batchNode!==a&&(this._node._batchNode=a)};a.updateQuadWithParticle=function(a,c){};a.updateParticlePosition=function(a,c){cc.pIn(a.drawPos,c)};a.rendering=function(a,c,d){a=a||cc._renderContext;var e=a.getContext(),f=this._node,g=this._pointRect;a.setTransform(this._worldTransform,c,d);a.save();f.isBlendAdditive()?e.globalCompositeOperation="lighter":e.globalCompositeOperation="source-over";var h,k;d=this._node.particleCount; var m=this._node._particles;if(f.drawMode!==cc.ParticleSystem.SHAPE_MODE&&f._texture){if(!f._texture._textureLoaded){a.restore();return}var n=f._texture.getHtmlElementObj();if(!n.width||!n.height){a.restore();return}h=n;for(c=0;c<d;c++)if(h=m[c],k=h.color.a/255,0!==k){e.globalAlpha=k;e.save();e.translate(0|h.drawPos.x,-(0|h.drawPos.y));var p=4*Math.floor(h.size/4);k=g.width;var r=g.height;e.scale(Math.max(1/k*p,1E-6),Math.max(1/r*p,1E-6));h.rotation&&e.rotate(cc.degreesToRadians(h.rotation));h=h.isChangeColor? this._changeTextureColor(f._texture,h.color,this._pointRect):n;e.drawImage(h,-(0|k/2),-(0|r/2));e.restore()}}else for(n=cc._drawingUtil,c=0;c<d;c++)h=m[c],g=0|0.5*h.size,k=h.color.a/255,0!==k&&(e.globalAlpha=k,e.save(),e.translate(0|h.drawPos.x,-(0|h.drawPos.y)),f.shapeType===cc.ParticleSystem.STAR_SHAPE?(h.rotation&&e.rotate(cc.degreesToRadians(h.rotation)),n.drawStar(a,g,h.color)):n.drawColorBall(a,g,h.color),e.restore());a.restore();cc.g_NumberOfDraws++};a._changeTextureColor=function(a,c,d){this._tintCache|| (this._tintCache=document.createElement("canvas"));var e=this._tintCache,f=a.getContentSize();e.width=f.width;e.height=f.height;return a._generateColorTexture(c.r,c.g,c.b,d,e)};a.initTexCoordsWithRect=function(a){this._pointRect=a};a.setTotalParticles=function(a){this._node._totalParticles=200>a?a:200};a.addParticle=function(){var a=this._node,c=a._particles;a.particleCount<c.length?a=c[a.particleCount]:(a=new cc.Particle,c.push(a));return a};a._setupVBO=function(){};a._allocMemory=function(){return!0}; a.postStep=function(){};a._setBlendAdditive=function(){var a=this._node._blendFunc;a.src=cc.BLEND_SRC;a.dst=cc.BLEND_DST};a._initWithTotalParticles=function(a){};a._updateDeltaColor=function(a,c){this._node._dontTint||(a.color.r+=a.deltaColor.r*c,a.color.g+=a.deltaColor.g*c,a.color.b+=a.deltaColor.b*c,a.color.a+=a.deltaColor.a*c,a.isChangeColor=!0)}})();(function(){cc.ParticleSystem.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._matrix=null;this._buffersVBO=[0,0];this._quads=[];this._indices=[];this._quadsArrayBuffer=null};var a=cc.ParticleSystem.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.ParticleSystem.WebGLRenderCmd;a.getDrawMode=function(){};a.setDrawMode=function(a){};a.getShapeType=function(){};a.setShapeType=function(a){};a.setBatchNode=function(a){var c=this._node;if(c._batchNode!== a){var d=c._batchNode;if(c._batchNode=a)for(var e=c._particles,f=0;f<c._totalParticles;f++)e[f].atlasIndex=f;a?d||(c._batchNode.textureAtlas._copyQuadsToTextureAtlas(this._quads,c.atlasIndex),cc._renderContext.deleteBuffer(this._buffersVBO[1])):(this._allocMemory(),this.initIndices(c._totalParticles),c.setTexture(d.getTexture()),this._setupVBO())}};a.initIndices=function(a){for(var c=this._indices,d=0;d<a;++d){var e=6*d,f=4*d;c[e+0]=f+0;c[e+1]=f+1;c[e+2]=f+2;c[e+5]=f+1;c[e+4]=f+2;c[e+3]=f+3}};a.isDifferentTexture= function(a,c){return a===c};a.updateParticlePosition=function(a,c){this.updateQuadWithParticle(a,c)};a.updateQuadWithParticle=function(a,c){var d=null,e=this._node;e._batchNode?(d=e._batchNode.textureAtlas.quads[e.atlasIndex+a.atlasIndex],e._batchNode.textureAtlas.dirty=!0):d=this._quads[e._particleIdx];var f,g,h;e._opacityModifyRGB?(e=0|a.color.r*a.color.a/255,f=0|a.color.g*a.color.a/255,g=0|a.color.b*a.color.a/255):(e=0|a.color.r,f=0|a.color.g,g=0|a.color.b);h=0|a.color.a;var k=d.bl.colors,m=d.br.colors, n=d.tl.colors,p=d.tr.colors;k.r=m.r=n.r=p.r=e;k.g=m.g=n.g=p.g=f;k.b=m.b=n.b=p.b=g;k.a=m.a=n.a=p.a=h;e=a.size/2;a.rotation?(f=-e,g=-e,h=c.x,k=c.y,n=-cc.degreesToRadians(a.rotation),m=Math.cos(n),n=Math.sin(n),d.bl.vertices.x=f*m-g*n+h,d.bl.vertices.y=f*n+g*m+k,d.br.vertices.x=e*m-g*n+h,d.br.vertices.y=e*n+g*m+k,d.tl.vertices.x=f*m-e*n+h,d.tl.vertices.y=f*n+e*m+k,d.tr.vertices.x=e*m-e*n+h,d.tr.vertices.y=e*n+e*m+k):(d.bl.vertices.x=c.x-e,d.bl.vertices.y=c.y-e,d.br.vertices.x=c.x+e,d.br.vertices.y=c.y- e,d.tl.vertices.x=c.x-e,d.tl.vertices.y=c.y+e,d.tr.vertices.x=c.x+e,d.tr.vertices.y=c.y+e)};a.rendering=function(a){var c=this._node;if(c._texture){a=a||cc._renderContext;this._matrix||(this._matrix=new cc.math.Matrix4,this._matrix.identity());var d=this._worldTransform;this._matrix.mat[0]=d.a;this._matrix.mat[4]=d.c;this._matrix.mat[12]=d.tx;this._matrix.mat[1]=d.b;this._matrix.mat[5]=d.d;this._matrix.mat[13]=d.ty;this._shaderProgram.use();this._shaderProgram._setUniformForMVPMatrixWithMat4(this._matrix); cc.glBindTexture2D(c._texture);cc.glBlendFuncForParticle(c._blendFunc.src,c._blendFunc.dst);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);a.bindBuffer(a.ARRAY_BUFFER,this._buffersVBO[0]);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,a.FLOAT,!1,24,0);a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,24,12);a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1, 24,16);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._buffersVBO[1]);a.drawElements(a.TRIANGLES,6*c._particleIdx,a.UNSIGNED_SHORT,0)}};a.initTexCoordsWithRect=function(a){var c=this._node,d=c.texture,e=cc.contentScaleFactor(),f=cc.rect(a.x*e,a.y*e,a.width*e,a.height*e),e=a.width,g=a.height;d&&(e=d.pixelsWidth,g=d.pixelsHeight);cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?(d=(2*f.x+1)/(2*e),a=(2*f.y+1)/(2*g),e=d+(2*f.width-2)/(2*e),f=a+(2*f.height-2)/(2*g)):(d=f.x/e,a=f.y/g,e=d+f.width/e,f=a+f.height/g);g=f;f=a; a=g;var h=0,k=0;c._batchNode?(g=c._batchNode.textureAtlas.quads,h=c.atlasIndex,k=c.atlasIndex+c._totalParticles):(g=this._quads,h=0,k=c._totalParticles);for(c=h;c<k;c++)g[c]||(g[c]=cc.V3F_C4B_T2F_QuadZero()),h=g[c],h.bl.texCoords.u=d,h.bl.texCoords.v=a,h.br.texCoords.u=e,h.br.texCoords.v=a,h.tl.texCoords.u=d,h.tl.texCoords.v=f,h.tr.texCoords.u=e,h.tr.texCoords.v=f};a.setTotalParticles=function(a){var c=this._node;if(a>c._allocatedParticles){var d=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._indices= new Uint16Array(6*a);var e=new ArrayBuffer(a*d),f=c._particles;f.length=0;for(var g=this._quads,h=g.length=0;h<a;h++)f[h]=new cc.Particle,g[h]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,e,h*d);c._allocatedParticles=a;c._totalParticles=a;if(c._batchNode)for(d=0;d<a;d++)f[d].atlasIndex=d;this._quadsArrayBuffer=e;this.initIndices(a);this._setupVBO();c._texture&&this.initTexCoordsWithRect(cc.rect(0,0,c._texture.width,c._texture.height))}else c._totalParticles=a;c.resetSystem()};a.addParticle=function(){var a= this._node;return a._particles[a.particleCount]};a._setupVBO=function(){var a=cc._renderContext;this._buffersVBO[0]=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,this._buffersVBO[0]);a.bufferData(a.ARRAY_BUFFER,this._quadsArrayBuffer,a.DYNAMIC_DRAW);this._buffersVBO[1]=a.createBuffer();a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._buffersVBO[1]);a.bufferData(a.ELEMENT_ARRAY_BUFFER,this._indices,a.STATIC_DRAW)};a._allocMemory=function(){var a=this._node;if(a._batchNode)return cc.log("cc.ParticleSystem._allocMemory(): Memory should not be allocated when not using batchNode"), !1;var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,a=a._totalParticles,d=this._quads;d.length=0;this._indices=new Uint16Array(6*a);for(var e=new ArrayBuffer(c*a),f=0;f<a;f++)d[f]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,e,f*c);if(!d||!this._indices)return cc.log("cocos2d: Particle system: not enough memory"),!1;this._quadsArrayBuffer=e;return!0};a.postStep=function(){var a=cc._renderContext;a.bindBuffer(a.ARRAY_BUFFER,this._buffersVBO[0]);a.bufferSubData(a.ARRAY_BUFFER,0,this._quadsArrayBuffer)};a._setBlendAdditive= function(){var a=this._node._blendFunc;this._texture&&!this._texture.hasPremultipliedAlpha()?(a.src=cc.SRC_ALPHA,a.dst=cc.ONE_MINUS_SRC_ALPHA):(a.src=cc.BLEND_SRC,a.dst=cc.BLEND_DST)};a._initWithTotalParticles=function(a){if(!this._allocMemory())return!1;this.initIndices(a);this._setupVBO();this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLOR)};a._updateDeltaColor=function(a,c){a.color.r+=a.deltaColor.r*c;a.color.g+=a.deltaColor.g*c;a.color.b+=a.deltaColor.b*c;a.color.a+= a.deltaColor.a*c;a.isChangeColor=!0}})();cc.ParticleFire=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?300:150)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY),this.setGravity(cc.p(0,0)),this.setRadialAccel(0),this.setRadialAccelVar(0),this.setSpeed(60),this.setSpeedVar(20),this.setAngle(90),this.setAngleVar(10), a=cc.director.getWinSize(),this.setPosition(a.width/2,60),this.setPosVar(cc.p(40,20)),this.setLife(3),this.setLifeVar(0.25),this.setStartSize(54),this.setStartSizeVar(10),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.color(194,64,31,255)),this.setStartColorVar(cc.color(0,0,0,0)),this.setEndColor(cc.color(0,0,0,255)),this.setEndColorVar(cc.color(0,0,0,0)),this.setBlendAdditive(!0),!0):!1}}); cc.ParticleFire.create=function(){return new cc.ParticleFire}; cc.ParticleFireworks=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?1500:150)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY),this.setGravity(cc.p(0,-90)),this.setRadialAccel(0),this.setRadialAccelVar(0),this.setSpeed(180),this.setSpeedVar(50),a=cc.director.getWinSize(), this.setPosition(a.width/2,a.height/2),this.setAngle(90),this.setAngleVar(20),this.setLife(3.5),this.setLifeVar(1),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.color(128,128,128,255)),this.setStartColorVar(cc.color(128,128,128,255)),this.setEndColor(cc.color(26,26,26,51)),this.setEndColorVar(cc.color(26,26,26,51)),this.setStartSize(8),this.setStartSizeVar(2),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setBlendAdditive(!1),!0):!1}}); cc.ParticleFireworks.create=function(){return new cc.ParticleFireworks}; cc.ParticleSun=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?350:150)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setBlendAdditive(!0),this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY),this.setGravity(cc.p(0,0)),this.setRadialAccel(0),this.setRadialAccelVar(0),this.setSpeed(20),this.setSpeedVar(5), this.setAngle(90),this.setAngleVar(360),a=cc.director.getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.p(0,0)),this.setLife(1),this.setLifeVar(0.5),this.setStartSize(30),this.setStartSizeVar(10),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.color(194,64,31,255)),this.setStartColorVar(cc.color(0,0,0,0)),this.setEndColor(cc.color(0,0,0,255)),this.setEndColorVar(cc.color(0,0,0,0)), !0):!1}});cc.ParticleSun.create=function(){return new cc.ParticleSun}; cc.ParticleGalaxy=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?200:100)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY),this.setGravity(cc.p(0,0)),this.setSpeed(60),this.setSpeedVar(10),this.setRadialAccel(-80),this.setRadialAccelVar(0),this.setTangentialAccel(80), this.setTangentialAccelVar(0),this.setAngle(90),this.setAngleVar(360),a=cc.director.getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.p(0,0)),this.setLife(4),this.setLifeVar(1),this.setStartSize(37),this.setStartSizeVar(10),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.color(31,64,194,255)),this.setStartColorVar(cc.color(0,0,0,0)),this.setEndColor(cc.color(0,0,0,255)),this.setEndColorVar(cc.color(0, 0,0,0)),this.setBlendAdditive(!0),!0):!1}});cc.ParticleGalaxy.create=function(){return new cc.ParticleGalaxy}; cc.ParticleFlower=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?250:100)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY),this.setGravity(cc.p(0,0)),this.setSpeed(80),this.setSpeedVar(10),this.setRadialAccel(-60),this.setRadialAccelVar(0),this.setTangentialAccel(15), this.setTangentialAccelVar(0),this.setAngle(90),this.setAngleVar(360),a=cc.director.getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.p(0,0)),this.setLife(4),this.setLifeVar(1),this.setStartSize(30),this.setStartSizeVar(10),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.color(128,128,128,255)),this.setStartColorVar(cc.color(128,128,128,128)),this.setEndColor(cc.color(0,0,0,255)), this.setEndColorVar(cc.color(0,0,0,0)),this.setBlendAdditive(!0),!0):!1}});cc.ParticleFlower.create=function(){return new cc.ParticleFlower}; cc.ParticleMeteor=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?150:100)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY),this.setGravity(cc.p(-200,200)),this.setSpeed(15),this.setSpeedVar(5),this.setRadialAccel(0),this.setRadialAccelVar(0),this.setTangentialAccel(0), this.setTangentialAccelVar(0),this.setAngle(90),this.setAngleVar(360),a=cc.director.getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.p(0,0)),this.setLife(2),this.setLifeVar(1),this.setStartSize(60),this.setStartSizeVar(10),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.color(51,102,179)),this.setStartColorVar(cc.color(0,0,51,26)),this.setEndColor(cc.color(0,0,0,255)),this.setEndColorVar(cc.color(0, 0,0,0)),this.setBlendAdditive(!0),!0):!1}});cc.ParticleMeteor.create=function(){return new cc.ParticleMeteor}; cc.ParticleSpiral=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?500:100)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY),this.setGravity(cc.p(0,0)),this.setSpeed(150),this.setSpeedVar(0),this.setRadialAccel(-380),this.setRadialAccelVar(0),this.setTangentialAccel(45), this.setTangentialAccelVar(0),this.setAngle(90),this.setAngleVar(0),a=cc.director.getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.p(0,0)),this.setLife(12),this.setLifeVar(0),this.setStartSize(20),this.setStartSizeVar(0),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.color(128,128,128,255)),this.setStartColorVar(cc.color(128,128,128,0)),this.setEndColor(cc.color(128,128,128,255)), this.setEndColorVar(cc.color(128,128,128,0)),this.setBlendAdditive(!1),!0):!1}});cc.ParticleSpiral.create=function(){return new cc.ParticleSpiral}; cc.ParticleExplosion=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?700:300)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(0.1),this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY),this.setGravity(cc.p(0,0)),this.setSpeed(70),this.setSpeedVar(40),this.setRadialAccel(0),this.setRadialAccelVar(0),this.setTangentialAccel(0),this.setTangentialAccelVar(0), this.setAngle(90),this.setAngleVar(360),a=cc.director.getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.p(0,0)),this.setLife(5),this.setLifeVar(2),this.setStartSize(15),this.setStartSizeVar(10),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getDuration()),this.setStartColor(cc.color(179,26,51,255)),this.setStartColorVar(cc.color(128,128,128,0)),this.setEndColor(cc.color(128,128,128,0)),this.setEndColorVar(cc.color(128, 128,128,0)),this.setBlendAdditive(!1),!0):!1}});cc.ParticleExplosion.create=function(){return new cc.ParticleExplosion}; cc.ParticleSmoke=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?200:100)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY),this.setGravity(cc.p(0,0)),this.setRadialAccel(0),this.setRadialAccelVar(0),this.setSpeed(25),this.setSpeedVar(10),this.setAngle(90), this.setAngleVar(5),a=cc.director.getWinSize(),this.setPosition(a.width/2,0),this.setPosVar(cc.p(20,0)),this.setLife(4),this.setLifeVar(1),this.setStartSize(60),this.setStartSizeVar(10),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.color(204,204,204,255)),this.setStartColorVar(cc.color(5,5,5,0)),this.setEndColor(cc.color(0,0,0,255)),this.setEndColorVar(cc.color(0,0,0,0)),this.setBlendAdditive(!1), !0):!1}});cc.ParticleSmoke.create=function(){return new cc.ParticleSmoke}; cc.ParticleSnow=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?700:250)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY),this.setGravity(cc.p(0,-1)),this.setSpeed(5),this.setSpeedVar(1),this.setRadialAccel(0),this.setRadialAccelVar(1),this.setTangentialAccel(0), this.setTangentialAccelVar(1),a=cc.director.getWinSize(),this.setPosition(a.width/2,a.height+10),this.setPosVar(cc.p(a.width/2,0)),this.setAngle(-90),this.setAngleVar(5),this.setLife(45),this.setLifeVar(15),this.setStartSize(10),this.setStartSizeVar(5),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(10),this.setStartColor(cc.color(255,255,255,255)),this.setStartColorVar(cc.color(0,0,0,0)),this.setEndColor(cc.color(255,255,255,0)),this.setEndColorVar(cc.color(0, 0,0,0)),this.setBlendAdditive(!1),!0):!1}});cc.ParticleSnow.create=function(){return new cc.ParticleSnow}; cc.ParticleRain=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?1E3:300)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY),this.setGravity(cc.p(10,-10)),this.setRadialAccel(0),this.setRadialAccelVar(1),this.setTangentialAccel(0),this.setTangentialAccelVar(1), this.setSpeed(130),this.setSpeedVar(30),this.setAngle(-90),this.setAngleVar(5),a=cc.director.getWinSize(),this.setPosition(a.width/2,a.height),this.setPosVar(cc.p(a.width/2,0)),this.setLife(4.5),this.setLifeVar(0),this.setStartSize(4),this.setStartSizeVar(2),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(20),this.setStartColor(cc.color(179,204,255,255)),this.setStartColorVar(cc.color(0,0,0,0)),this.setEndColor(cc.color(179,204,255,128)),this.setEndColorVar(cc.color(0, 0,0,0)),this.setBlendAdditive(!1),!0):!1}});cc.ParticleRain.create=function(){return new cc.ParticleRain};cc.PARTICLE_DEFAULT_CAPACITY=500; cc.ParticleBatchNode=cc.Node.extend({textureAtlas:null,_blendFunc:null,_className:"ParticleBatchNode",ctor:function(a,b){cc.Node.prototype.ctor.call(this);this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};cc.isString(a)?this.init(a,b):a instanceof cc.Texture2D&&this.initWithTexture(a,b)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.ParticleBatchNode.CanvasRenderCmd(this):new cc.ParticleBatchNode.WebGLRenderCmd(this)},initWithTexture:function(a,b){this.textureAtlas= new cc.TextureAtlas;this.textureAtlas.initWithTexture(a,b);this._children.length=0;this._renderCmd._initWithTexture();return!0},initWithFile:function(a,b){var c=cc.textureCache.addImage(a);return this.initWithTexture(c,b)},init:function(a,b){var c=cc.textureCache.addImage(a);return this.initWithTexture(c,b)},visit:function(a){if(this._visible){var b=this._renderCmd;b.visit(a&&a._renderCmd);cc.renderer.pushRenderCommand(b);b._dirtyFlag=0}},addChild:function(a,b,c){if(!a)throw Error("cc.ParticleBatchNode.addChild() : child should be non-null"); if(!(a instanceof cc.ParticleSystem))throw Error("cc.ParticleBatchNode.addChild() : only supports cc.ParticleSystem as children");b=null==b?a.zIndex:b;c=null==c?a.tag:c;if(a.getTexture()!==this.textureAtlas.texture)throw Error("cc.ParticleSystem.addChild() : the child is not using the same texture id");var d=a.getBlendFunc();if(0===this._children.length)this.setBlendFunc(d);else if(d.src!==this._blendFunc.src||d.dst!==this._blendFunc.dst){cc.log("cc.ParticleSystem.addChild() : Can't add a ParticleSystem that uses a different blending function"); return}b=this._addChildHelper(a,b,c);c=0;0!==b?(b=this._children[b-1],c=b.getAtlasIndex()+b.getTotalParticles()):c=0;this.insertChild(a,c);a.setBatchNode(this)},insertChild:function(a,b){var c=a.getTotalParticles(),d=this.textureAtlas,e=d.totalQuads;a.setAtlasIndex(b);e+c>d.getCapacity()&&(this._increaseAtlasCapacityTo(e+c),d.fillWithEmptyQuadsFromIndex(d.getCapacity()-c,c));a.getAtlasIndex()+c!==e&&d.moveQuadsFromIndex(b,b+c);d.increaseTotalQuadsWith(c);this._updateAllAtlasIndexes()},removeChild:function(a, b){if(null!=a){if(!(a instanceof cc.ParticleSystem))throw Error("cc.ParticleBatchNode.removeChild(): only supports cc.ParticleSystem as children");if(-1===this._children.indexOf(a))cc.log("cc.ParticleBatchNode.removeChild(): doesn't contain the sprite. Can't remove it");else{cc.Node.prototype.removeChild.call(this,a,b);var c=this.textureAtlas;c.removeQuadsAtIndex(a.getAtlasIndex(),a.getTotalParticles());c.fillWithEmptyQuadsFromIndex(c.totalQuads,a.getTotalParticles());a.setBatchNode(null);this._updateAllAtlasIndexes()}}}, reorderChild:function(a,b){if(!a)throw Error("cc.ParticleBatchNode.reorderChild(): child should be non-null");if(!(a instanceof cc.ParticleSystem))throw Error("cc.ParticleBatchNode.reorderChild(): only supports cc.QuadParticleSystems as children");if(-1===this._children.indexOf(a))cc.log("cc.ParticleBatchNode.reorderChild(): Child doesn't belong to batch");else if(b!==a.zIndex){if(1<this._children.length){var c=this._getCurrentIndex(a,b);if(c.oldIndex!==c.newIndex){this._children.splice(c.oldIndex, 1);this._children.splice(c.newIndex,0,a);c=a.getAtlasIndex();this._updateAllAtlasIndexes();for(var d=0,e=this._children,f=0;f<e.length;f++)if(e[f]===a){d=a.getAtlasIndex();break}this.textureAtlas.moveQuadsFromIndex(c,a.getTotalParticles(),d);a.updateWithNoTime()}}a._setLocalZOrder(b)}},removeChildAtIndex:function(a,b){this.removeChild(this._children[i],b)},removeAllChildren:function(a){for(var b=this._children,c=0;c<b.length;c++)b[c].setBatchNode(null);cc.Node.prototype.removeAllChildren.call(this, a);this.textureAtlas.removeAllQuads()},disableParticle:function(a){a=this.textureAtlas.quads[a];a.br.vertices.x=a.br.vertices.y=a.tr.vertices.x=a.tr.vertices.y=a.tl.vertices.x=a.tl.vertices.y=a.bl.vertices.x=a.bl.vertices.y=0;this.textureAtlas._setDirty(!0)},getTexture:function(){return this.textureAtlas.texture},setTexture:function(a){this.textureAtlas.texture=a;var b=this._blendFunc;a&&!a.hasPremultipliedAlpha()&&b.src===cc.BLEND_SRC&&b.dst===cc.BLEND_DST&&(b.src=cc.SRC_ALPHA,b.dst=cc.ONE_MINUS_SRC_ALPHA)}, setBlendFunc:function(a,b){void 0===b?(this._blendFunc.src=a.src,this._blendFunc.dst=a.dst):(this._blendFunc.src=a,this._blendFunc.src=b)},getBlendFunc:function(){return new cc.BlendFunc(this._blendFunc.src,this._blendFunc.dst)},_updateAllAtlasIndexes:function(){for(var a=0,b=this._children,c=0;c<b.length;c++){var d=b[c];d.setAtlasIndex(a);a+=d.getTotalParticles()}},_increaseAtlasCapacityTo:function(a){cc.log("cocos2d: cc.ParticleBatchNode: resizing TextureAtlas capacity from ["+this.textureAtlas.getCapacity()+ "] to ["+a+"].");this.textureAtlas.resizeCapacity(a)||cc.log("cc.ParticleBatchNode._increaseAtlasCapacityTo() : WARNING: Not enough memory to resize the atlas")},_searchNewPositionInChildrenForZ:function(a){for(var b=this._children,c=b.length,d=0;d<c;d++)if(b[d].zIndex>a)return d;return c},_getCurrentIndex:function(a,b){for(var c=!1,d=!1,e=0,f=0,g=0,h=this._children,k=h.length,m=0;m<k;m++){var n=h[m];if(n.zIndex>b&&!d&&(e=m,d=!0,c&&d))break;if(a===n&&(f=m,c=!0,d||(g=-1),c&&d))break}d||(e=k);return{newIndex:e+ g,oldIndex:f}},_addChildHelper:function(a,b,c){if(!a)throw Error("cc.ParticleBatchNode._addChildHelper(): child should be non-null");if(a.parent)return cc.log("cc.ParticleBatchNode._addChildHelper(): child already added. It can't be added again"),null;this._children||(this._children=[]);var d=this._searchNewPositionInChildrenForZ(b);this._children.splice(d,0,a);a.tag=c;a._setLocalZOrder(b);a.parent=this;this._running&&(a._performRecursive(cc.Node._stateCallbackType.onEnter),a._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish)); return d},_updateBlendFunc:function(){this.textureAtlas.texture.hasPremultipliedAlpha()||(this._blendFunc.src=cc.SRC_ALPHA,this._blendFunc.dst=cc.ONE_MINUS_SRC_ALPHA)},getTextureAtlas:function(){return this.textureAtlas},setTextureAtlas:function(a){this.textureAtlas=a}});_p=cc.ParticleBatchNode.prototype;cc.defineGetterSetter(_p,"texture",_p.getTexture,_p.setTexture);cc.ParticleBatchNode.create=function(a,b){return new cc.ParticleBatchNode(a,b)};(function(){cc.ParticleBatchNode.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1};var a=cc.ParticleBatchNode.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.ParticleBatchNode.CanvasRenderCmd;a._initWithTexture=function(){}})();(function(){cc.ParticleBatchNode.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._matrix=new cc.math.Matrix4;this._matrix.identity()};var a=cc.ParticleBatchNode.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.ParticleBatchNode.WebGLRenderCmd;a.rendering=function(a){a=this._node;if(0!==a.textureAtlas.totalQuads){var c=this._worldTransform;this._matrix.mat[0]=c.a;this._matrix.mat[4]=c.c;this._matrix.mat[12]=c.tx;this._matrix.mat[1]=c.b;this._matrix.mat[5]= c.d;this._matrix.mat[13]=c.ty;this._shaderProgram.use();this._shaderProgram._setUniformForMVPMatrixWithMat4(this._matrix);cc.glBlendFuncForParticle(a._blendFunc.src,a._blendFunc.dst);a.textureAtlas.drawQuads()}};a._initWithTexture=function(){this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLOR)}})();cc.IMEKeyboardNotificationInfo=function(a,b,c){this.begin=a||cc.rect(0,0,0,0);this.end=b||cc.rect(0,0,0,0);this.duration=c||0}; cc.IMEDelegate=cc.Class.extend({ctor:function(){cc.imeDispatcher.addDelegate(this)},removeDelegate:function(){cc.imeDispatcher.removeDelegate(this)},attachWithIME:function(){return cc.imeDispatcher.attachDelegateWithIME(this)},detachWithIME:function(){return cc.imeDispatcher.detachDelegateWithIME(this)},canAttachWithIME:function(){return!1},didAttachWithIME:function(){},canDetachWithIME:function(){return!1},didDetachWithIME:function(){},insertText:function(a,b){},deleteBackward:function(){},getContentText:function(){return""}, keyboardWillShow:function(a){},keyboardDidShow:function(a){},keyboardWillHide:function(a){},keyboardDidHide:function(a){}}); cc.IMEDispatcher=cc.Class.extend({_domInputControl:null,impl:null,_currentInputString:"",_lastClickPosition:null,ctor:function(){this.impl=new cc.IMEDispatcher.Impl;this._lastClickPosition=cc.p(0,0)},init:function(){if(!cc.sys.isMobile){this._domInputControl=cc.$("#imeDispatcherInput");this._domInputControl||(this._domInputControl=cc.$new("input"),this._domInputControl.setAttribute("type","text"),this._domInputControl.setAttribute("id","imeDispatcherInput"),this._domInputControl.resize(0,0),this._domInputControl.translates(0, 0),this._domInputControl.style.opacity="0",this._domInputControl.style.fontSize="1px",this._domInputControl.setAttribute("tabindex",2),this._domInputControl.style.position="absolute",this._domInputControl.style.top=0,this._domInputControl.style.left=0,document.body.appendChild(this._domInputControl));var a=this;this._domInputControl.addEventListener("input",function(){a._processDomInputString(a._domInputControl.value)},!1);this._domInputControl.addEventListener("keydown",function(b){b.keyCode===cc.KEY.tab? (b.stopPropagation(),b.preventDefault()):b.keyCode===cc.KEY.enter&&(a.dispatchInsertText("\n",1),b.stopPropagation(),b.preventDefault())},!1);/msie/i.test(navigator.userAgent)&&this._domInputControl.addEventListener("keyup",function(b){b.keyCode===cc.KEY.backspace&&a._processDomInputString(a._domInputControl.value)},!1);window.addEventListener("mousedown",function(b){var c=b.pageY||0;a._lastClickPosition.x=b.pageX||0;a._lastClickPosition.y=c},!1)}},_processDomInputString:function(a){var b,c;b=this._currentInputString.length< a.length?this._currentInputString.length:a.length;for(c=0;c<b&&a[c]===this._currentInputString[c];c++);var d=this._currentInputString.length-c,e=a.length-c;for(b=0;b<d;b++)this.dispatchDeleteBackward();for(b=0;b<e;b++)this.dispatchInsertText(a[c+b],1);this._currentInputString=a},dispatchInsertText:function(a,b){!this.impl||!a||0>=b||this.impl._delegateWithIme&&this.impl._delegateWithIme.insertText(a,b)},dispatchDeleteBackward:function(){this.impl&&this.impl._delegateWithIme&&this.impl._delegateWithIme.deleteBackward()}, getContentText:function(){if(this.impl&&this.impl._delegateWithIme){var a=this.impl._delegateWithIme.getContentText();return a?a:""}return""},dispatchKeyboardWillShow:function(a){if(this.impl)for(var b=0;b<this.impl._delegateList.length;b++){var c=this.impl._delegateList[b];c&&c.keyboardWillShow(a)}},dispatchKeyboardDidShow:function(a){if(this.impl)for(var b=0;b<this.impl._delegateList.length;b++){var c=this.impl._delegateList[b];c&&c.keyboardDidShow(a)}},dispatchKeyboardWillHide:function(a){if(this.impl)for(var b= 0;b<this.impl._delegateList.length;b++){var c=this.impl._delegateList[b];c&&c.keyboardWillHide(a)}},dispatchKeyboardDidHide:function(a){if(this.impl)for(var b=0;b<this.impl._delegateList.length;b++){var c=this.impl._delegateList[b];c&&c.keyboardDidHide(a)}},addDelegate:function(a){a&&this.impl&&(-1<this.impl._delegateList.indexOf(a)||this.impl._delegateList.splice(0,0,a))},attachDelegateWithIME:function(a){if(!this.impl||!a||-1===this.impl._delegateList.indexOf(a))return!1;if(this.impl._delegateWithIme){if(!this.impl._delegateWithIme.canDetachWithIME()|| !a.canAttachWithIME())return!1;var b=this.impl._delegateWithIme;this.impl._delegateWithIme=null;b.didDetachWithIME();this._focusDomInput(a);return!0}if(!a.canAttachWithIME())return!1;this._focusDomInput(a);return!0},_focusDomInput:function(a){if(cc.sys.isMobile){this.impl._delegateWithIme=a;a.didAttachWithIME();this._currentInputString=a.string||"";a=a.getTipMessage?a.getTipMessage():"please enter your word:";var b=window.Window;a=b&&b.prototype.prompt&&b.prototype.prompt!=prompt?b.prototype.prompt.call(window, a,this._currentInputString):prompt(a,this._currentInputString);null!=a&&this._processDomInputString(a);this.dispatchInsertText("\n",1)}else this.impl._delegateWithIme=a,this._currentInputString=a.string||"",a.didAttachWithIME(),this._domInputControl.focus(),this._domInputControl.value=this._currentInputString,this._domInputControlTranslate()},_domInputControlTranslate:function(){/msie/i.test(navigator.userAgent)?(this._domInputControl.style.left=this._lastClickPosition.x+"px",this._domInputControl.style.top= this._lastClickPosition.y+"px"):this._domInputControl.translates(this._lastClickPosition.x,this._lastClickPosition.y)},detachDelegateWithIME:function(a){if(!this.impl||!a||this.impl._delegateWithIme!==a||!a.canDetachWithIME())return!1;this.impl._delegateWithIme=null;a.didDetachWithIME();cc._canvas.focus();return!0},removeDelegate:function(a){this.impl&&a&&-1!==this.impl._delegateList.indexOf(a)&&(this.impl._delegateWithIme&&a===this.impl._delegateWithIme&&(this.impl._delegateWithIme=null),cc.arrayRemoveObject(this.impl._delegateList, a))},processKeycode:function(a){32>a?a===cc.KEY.backspace?this.dispatchDeleteBackward():a===cc.KEY.enter&&this.dispatchInsertText("\n",1):255>a&&this.dispatchInsertText(String.fromCharCode(a),1)}});cc.IMEDispatcher.Impl=cc.Class.extend({_delegateWithIme:null,_delegateList:null,ctor:function(){this._delegateList=[]},findDelegate:function(a){for(var b=0;b<this._delegateList.length;b++)if(this._delegateList[b]===a)return b;return null}});cc.imeDispatcher=new cc.IMEDispatcher; document.body?cc.imeDispatcher.init():window.addEventListener("load",function(){cc.imeDispatcher.init()},!1);cc.TextFieldDelegate=cc.Class.extend({onTextFieldAttachWithIME:function(a){return!1},onTextFieldDetachWithIME:function(a){return!1},onTextFieldInsertText:function(a,b,c){return!1},onTextFieldDeleteBackward:function(a,b,c){return!1},onDraw:function(a){return!1}}); cc.TextFieldTTF=cc.LabelTTF.extend({delegate:null,colorSpaceHolder:null,_colorText:null,_lens:null,_inputText:"",_placeHolder:"",_charCount:0,_className:"TextFieldTTF",ctor:function(a,b,c,d,e){this.colorSpaceHolder=cc.color(127,127,127);this._colorText=cc.color(255,255,255,255);cc.LabelTTF.prototype.ctor.call(this);void 0!==e?(this.initWithPlaceHolder("",b,c,d,e),a&&this.setPlaceHolder(a)):void 0===d&&void 0!==c&&(this.initWithString("",b,c),a&&this.setPlaceHolder(a))},onEnter:function(){cc.LabelTTF.prototype.onEnter.call(this); cc.imeDispatcher.addDelegate(this)},onExit:function(){cc.LabelTTF.prototype.onExit.call(this);cc.imeDispatcher.removeDelegate(this)},getDelegate:function(){return this.delegate},setDelegate:function(a){this.delegate=a},getCharCount:function(){return this._charCount},getColorSpaceHolder:function(){return cc.color(this.colorSpaceHolder)},setColorSpaceHolder:function(a){this.colorSpaceHolder.r=a.r;this.colorSpaceHolder.g=a.g;this.colorSpaceHolder.b=a.b;this.colorSpaceHolder.a=cc.isUndefined(a.a)?255: a.a;this._inputText.length||this.setColor(this.colorSpaceHolder)},setTextColor:function(a){this._colorText.r=a.r;this._colorText.g=a.g;this._colorText.b=a.b;this._colorText.a=cc.isUndefined(a.a)?255:a.a;this._inputText.length&&this.setColor(this._colorText)},initWithPlaceHolder:function(a,b,c,d,e){switch(arguments.length){case 5:return a&&this.setPlaceHolder(a),this.initWithString(this._placeHolder,d,e,b,c);case 3:return a&&this.setPlaceHolder(a),this.initWithString(this._placeHolder,arguments[1], arguments[2]);default:throw Error("Argument must be non-nil ");}},setString:function(a){this._inputText=(a=String(a))||"";this._inputText.length?(cc.LabelTTF.prototype.setString.call(this,this._inputText),this.setColor(this._colorText)):(cc.LabelTTF.prototype.setString.call(this,this._placeHolder),this.setColor(this.colorSpaceHolder));cc._renderType===cc.game.RENDER_TYPE_CANVAS&&this._renderCmd._updateTexture();this._charCount=this._inputText.length},getString:function(){return this._inputText},setPlaceHolder:function(a){this._placeHolder= a||"";this._inputText.length||(cc.LabelTTF.prototype.setString.call(this,this._placeHolder),this.setColor(this.colorSpaceHolder))},getPlaceHolder:function(){return this._placeHolder},draw:function(a){a=a||cc._renderContext;this.delegate&&this.delegate.onDraw(this)||cc.LabelTTF.prototype.draw.call(this,a)},attachWithIME:function(){return cc.imeDispatcher.attachDelegateWithIME(this)},detachWithIME:function(){return cc.imeDispatcher.detachDelegateWithIME(this)},canAttachWithIME:function(){return this.delegate? !this.delegate.onTextFieldAttachWithIME(this):!0},didAttachWithIME:function(){},canDetachWithIME:function(){return this.delegate?!this.delegate.onTextFieldDetachWithIME(this):!0},didDetachWithIME:function(){},deleteBackward:function(){var a=this._inputText.length;0===a||this.delegate&&this.delegate.onTextFieldDeleteBackward(this,this._inputText[a-1],1)||(1>=a?(this._inputText="",this._charCount=0,cc.LabelTTF.prototype.setString.call(this,this._placeHolder),this.setColor(this.colorSpaceHolder)):this.string= this._inputText.substring(0,a-1))},removeDelegate:function(){cc.imeDispatcher.removeDelegate(this)},_tipMessage:"please enter your word:",setTipMessage:function(a){null!=a&&(this._tipMessage=a)},getTipMessage:function(){return this._tipMessage},insertText:function(a,b){var c=a,d=c.indexOf("\n");-1<d&&(c=c.substring(0,d));if(0<c.length){if(this.delegate&&this.delegate.onTextFieldInsertText(this,c,c.length))return;c=this._inputText+c;this._charCount=c.length;this.string=c}-1!==d&&(this.delegate&&this.delegate.onTextFieldInsertText(this, "\n",1)||this.detachWithIME())},getContentText:function(){return this._inputText},keyboardWillShow:function(a){},keyboardDidShow:function(a){},keyboardWillHide:function(a){},keyboardDidHide:function(a){}});_p=cc.TextFieldTTF.prototype;cc.defineGetterSetter(_p,"charCount",_p.getCharCount);cc.defineGetterSetter(_p,"placeHolder",_p.getPlaceHolder,_p.setPlaceHolder);cc.TextFieldTTF.create=function(a,b,c,d,e){return new cc.TextFieldTTF(a,b,c,d,e)};cc._globalFontSize=cc.ITEM_SIZE;cc._globalFontName="Arial";cc._globalFontNameRelease=!1; cc.MenuItem=cc.Node.extend({_enabled:!1,_target:null,_callback:null,_isSelected:!1,_className:"MenuItem",ctor:function(a,b){var c=cc.Node.prototype;c.ctor.call(this);this._callback=this._target=null;this._enabled=this._isSelected=!1;c.setAnchorPoint.call(this,0.5,0.5);this._target=b||null;if(this._callback=a||null)this._enabled=!0},isSelected:function(){return this._isSelected},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},setTarget:function(a,b){this._target=b;this._callback= a},isEnabled:function(){return this._enabled},setEnabled:function(a){this._enabled=a},initWithCallback:function(a,b){this.anchorY=this.anchorX=0.5;this._target=b;this._callback=a;this._enabled=!0;this._isSelected=!1;return!0},rect:function(){var a=this._position,b=this._contentSize,c=this._anchorPoint;return cc.rect(a.x-b.width*c.x,a.y-b.height*c.y,b.width,b.height)},selected:function(){this._isSelected=!0},unselected:function(){this._isSelected=!1},setCallback:function(a,b){this._target=b;this._callback= a},activate:function(){if(this._enabled){var a=this._target,b=this._callback;if(b)if(a&&cc.isString(b))a[b](this);else a&&cc.isFunction(b)?b.call(a,this):b(this)}}});_p=cc.MenuItem.prototype;cc.defineGetterSetter(_p,"enabled",_p.isEnabled,_p.setEnabled);cc.MenuItem.create=function(a,b){return new cc.MenuItem(a,b)}; cc.MenuItemLabel=cc.MenuItem.extend({_disabledColor:null,_label:null,_originalScale:0,_colorBackup:null,ctor:function(a,b,c){cc.MenuItem.prototype.ctor.call(this,b,c);this._colorBackup=this._label=this._disabledColor=null;a&&(this._originalScale=1,this._colorBackup=cc.color.WHITE,this._disabledColor=cc.color(126,126,126),this.setLabel(a),a.textureLoaded&&!a.textureLoaded()&&a.addEventListener("load",function(a){this.width=a.width;this.height=a.height;this.parent instanceof cc.Menu&&this.parent.updateAlign()}, this),this.setCascadeColorEnabled(!0),this.setCascadeOpacityEnabled(!0))},getDisabledColor:function(){return this._disabledColor},setDisabledColor:function(a){this._disabledColor=a},getLabel:function(){return this._label},setLabel:function(a){a&&(this.addChild(a),a.anchorX=0,a.anchorY=0,this.width=a.width,this.height=a.height,a.setCascadeColorEnabled(!0));this._label&&this.removeChild(this._label,!0);this._label=a},setEnabled:function(a){this._enabled!==a&&(a?this.setColor(this._colorBackup):(this._colorBackup= this.color,this.setColor(this._disabledColor)));cc.MenuItem.prototype.setEnabled.call(this,a)},initWithLabel:function(a,b,c){this.initWithCallback(b,c);this._originalScale=1;this._colorBackup=cc.color.WHITE;this._disabledColor=cc.color(126,126,126);this.setLabel(a);this.setCascadeColorEnabled(!0);this.setCascadeOpacityEnabled(!0);return!0},setString:function(a){this._label.string=a;this.width=this._label.width;this.height=this._label.height},getString:function(){return this._label.string},activate:function(){this._enabled&& (this.stopAllActions(),this.scale=this._originalScale,cc.MenuItem.prototype.activate.call(this))},selected:function(){if(this._enabled){cc.MenuItem.prototype.selected.call(this);var a=this.getActionByTag(cc.ZOOM_ACTION_TAG);a?this.stopAction(a):this._originalScale=this.scale;a=cc.scaleTo(0.1,1.2*this._originalScale);a.setTag(cc.ZOOM_ACTION_TAG);this.runAction(a)}},unselected:function(){if(this._enabled){cc.MenuItem.prototype.unselected.call(this);this.stopActionByTag(cc.ZOOM_ACTION_TAG);var a=cc.scaleTo(0.1, this._originalScale);a.setTag(cc.ZOOM_ACTION_TAG);this.runAction(a)}}});_p=cc.MenuItemLabel.prototype;cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);cc.defineGetterSetter(_p,"disabledColor",_p.getDisabledColor,_p.setDisabledColor);cc.defineGetterSetter(_p,"label",_p.getLabel,_p.setLabel);cc.MenuItemLabel.create=function(a,b,c){return new cc.MenuItemLabel(a,b,c)}; cc.MenuItemAtlasFont=cc.MenuItemLabel.extend({ctor:function(a,b,c,d,e,f,g){var h;a&&0<a.length&&(h=new cc.LabelAtlas(a,b,c,d,e));cc.MenuItemLabel.prototype.ctor.call(this,h,f,g)},initWithString:function(a,b,c,d,e,f,g){if(!a||0===a.length)throw Error("cc.MenuItemAtlasFont.initWithString(): value should be non-null and its length should be greater than 0");var h=new cc.LabelAtlas;h.initWithString(a,b,c,d,e);this.initWithLabel(h,f,g);return!0}}); cc.MenuItemAtlasFont.create=function(a,b,c,d,e,f,g){return new cc.MenuItemAtlasFont(a,b,c,d,e,f,g)}; cc.MenuItemFont=cc.MenuItemLabel.extend({_fontSize:null,_fontName:null,ctor:function(a,b,c){var d;a&&0<a.length?(this._fontName=cc._globalFontName,this._fontSize=cc._globalFontSize,d=new cc.LabelTTF(a,this._fontName,this._fontSize)):(this._fontSize=0,this._fontName="");cc.MenuItemLabel.prototype.ctor.call(this,d,b,c)},initWithString:function(a,b,c){if(!a||0===a.length)throw Error("Value should be non-null and its length should be greater than 0");this._fontName=cc._globalFontName;this._fontSize=cc._globalFontSize; a=new cc.LabelTTF(a,this._fontName,this._fontSize);this.initWithLabel(a,b,c);return!0},setFontSize:function(a){this._fontSize=a;this._recreateLabel()},getFontSize:function(){return this._fontSize},setFontName:function(a){this._fontName=a;this._recreateLabel()},getFontName:function(){return this._fontName},_recreateLabel:function(){var a=new cc.LabelTTF(this._label.string,this._fontName,this._fontSize);this.setLabel(a)}});cc.MenuItemFont.setFontSize=function(a){cc._globalFontSize=a}; cc.MenuItemFont.fontSize=function(){return cc._globalFontSize};cc.MenuItemFont.setFontName=function(a){cc._globalFontNameRelease&&(cc._globalFontName="");cc._globalFontName=a;cc._globalFontNameRelease=!0};_p=cc.MenuItemFont.prototype;cc.defineGetterSetter(_p,"fontSize",_p.getFontSize,_p.setFontSize);cc.defineGetterSetter(_p,"fontName",_p.getFontName,_p.setFontName);cc.MenuItemFont.fontName=function(){return cc._globalFontName}; cc.MenuItemFont.create=function(a,b,c){return new cc.MenuItemFont(a,b,c)}; cc.MenuItemSprite=cc.MenuItem.extend({_normalImage:null,_selectedImage:null,_disabledImage:null,ctor:function(a,b,c,d,e){cc.MenuItem.prototype.ctor.call(this);this._disabledImage=this._selectedImage=this._normalImage=null;this._loader=new cc.Sprite.LoadManager;if(void 0!==a){b=b||null;var f,g,h;void 0!==e?(f=c,h=d,g=e):void 0!==d&&cc.isFunction(d)?(f=c,h=d):void 0!==d&&cc.isFunction(c)?(g=d,h=c,f=null):void 0===c&&(f=null);this._loader.clear();if(a.textureLoaded&&!a.textureLoaded())return this._loader.once(a, function(){this.initWithNormalSprite(a,b,f,h,g)},this),!1;this.initWithNormalSprite(a,b,f,h,g);return!0}},getNormalImage:function(){return this._normalImage},setNormalImage:function(a){this._normalImage!==a&&(a&&(this.addChild(a,0,cc.NORMAL_TAG),a.anchorX=0,a.anchorY=0),this._normalImage&&this.removeChild(this._normalImage,!0),this._normalImage=a)&&(this.width=this._normalImage.width,this.height=this._normalImage.height,this._updateImagesVisibility(),a.textureLoaded&&!a.textureLoaded()&&a.addEventListener("load", function(a){this.width=a.width;this.height=a.height;this.parent instanceof cc.Menu&&this.parent.updateAlign()},this))},getSelectedImage:function(){return this._selectedImage},setSelectedImage:function(a){this._selectedImage!==a&&(a&&(this.addChild(a,0,cc.SELECTED_TAG),a.anchorX=0,a.anchorY=0),this._selectedImage&&this.removeChild(this._selectedImage,!0),this._selectedImage=a,this._updateImagesVisibility())},getDisabledImage:function(){return this._disabledImage},setDisabledImage:function(a){this._disabledImage!== a&&(a&&(this.addChild(a,0,cc.DISABLE_TAG),a.anchorX=0,a.anchorY=0),this._disabledImage&&this.removeChild(this._disabledImage,!0),this._disabledImage=a,this._updateImagesVisibility())},initWithNormalSprite:function(a,b,c,d,e){this._loader.clear();if(a.textureLoaded&&!a.textureLoaded())return this._loader.once(a,function(){this.initWithNormalSprite(a,b,c,d,e)},this),!1;this.initWithCallback(d,e);this.setNormalImage(a);this.setSelectedImage(b);this.setDisabledImage(c);var f=this._normalImage;f&&(this.width= f.width,this.height=f.height);this.setCascadeColorEnabled(!0);this.setCascadeOpacityEnabled(!0);return!0},selected:function(){cc.MenuItem.prototype.selected.call(this);this._normalImage&&(this._disabledImage&&(this._disabledImage.visible=!1),this._selectedImage?(this._normalImage.visible=!1,this._selectedImage.visible=!0):this._normalImage.visible=!0)},unselected:function(){cc.MenuItem.prototype.unselected.call(this);this._normalImage&&(this._normalImage.visible=!0,this._selectedImage&&(this._selectedImage.visible= !1),this._disabledImage&&(this._disabledImage.visible=!1))},setEnabled:function(a){this._enabled!==a&&(cc.MenuItem.prototype.setEnabled.call(this,a),this._updateImagesVisibility())},_updateImagesVisibility:function(){var a=this._normalImage,b=this._selectedImage,c=this._disabledImage;this._enabled?(a&&(a.visible=!0),b&&(b.visible=!1),c&&(c.visible=!1)):c?(a&&(a.visible=!1),b&&(b.visible=!1),c&&(c.visible=!0)):(a&&(a.visible=!0),b&&(b.visible=!1))}});_p=cc.MenuItemSprite.prototype; cc.defineGetterSetter(_p,"normalImage",_p.getNormalImage,_p.setNormalImage);cc.defineGetterSetter(_p,"selectedImage",_p.getSelectedImage,_p.setSelectedImage);cc.defineGetterSetter(_p,"disabledImage",_p.getDisabledImage,_p.setDisabledImage);cc.MenuItemSprite.create=function(a,b,c,d,e){return new cc.MenuItemSprite(a,b,c,d,e||void 0)}; cc.MenuItemImage=cc.MenuItemSprite.extend({ctor:function(a,b,c,d,e){var f=null,g=null,h=null,k=null,m=null;void 0===a||null===a?cc.MenuItemSprite.prototype.ctor.call(this):(f=new cc.Sprite(a),b&&(g=new cc.Sprite(b)),void 0===d?k=c:void 0===e?(k=c,m=d):e&&(h=new cc.Sprite(c),k=d,m=e),cc.MenuItemSprite.prototype.ctor.call(this,f,g,h,k,m))},setNormalSpriteFrame:function(a){this.setNormalImage(new cc.Sprite(a))},setSelectedSpriteFrame:function(a){this.setSelectedImage(new cc.Sprite(a))},setDisabledSpriteFrame:function(a){this.setDisabledImage(new cc.Sprite(a))}, initWithNormalImage:function(a,b,c,d,e){var f=null,g=null,h=null;a&&(f=new cc.Sprite(a));b&&(g=new cc.Sprite(b));c&&(h=new cc.Sprite(c));return this.initWithNormalSprite(f,g,h,d,e)}});cc.MenuItemImage.create=function(a,b,c,d,e){return new cc.MenuItemImage(a,b,c,d,e)}; cc.MenuItemToggle=cc.MenuItem.extend({subItems:null,_selectedIndex:0,_opacity:null,_color:null,ctor:function(){cc.MenuItem.prototype.ctor.call(this);this._selectedIndex=0;this.subItems=[];this._opacity=0;this._color=cc.color.WHITE;0<arguments.length&&this.initWithItems(Array.prototype.slice.apply(arguments))},getOpacity:function(){return this._opacity},setOpacity:function(a){this._opacity=a;if(this.subItems&&0<this.subItems.length)for(var b=0;b<this.subItems.length;b++)this.subItems[b].opacity=a; this._color.a=a},getColor:function(){var a=this._color;return cc.color(a.r,a.g,a.b,a.a)},setColor:function(a){var b=this._color;b.r=a.r;b.g=a.g;b.b=a.b;if(this.subItems&&0<this.subItems.length)for(b=0;b<this.subItems.length;b++)this.subItems[b].setColor(a);void 0===a.a||a.a_undefined||this.setOpacity(a.a)},getSelectedIndex:function(){return this._selectedIndex},setSelectedIndex:function(a){if(a!==this._selectedIndex){this._selectedIndex=a;(a=this.getChildByTag(cc.CURRENT_ITEM))&&a.removeFromParent(!1); a=this.subItems[this._selectedIndex];this.addChild(a,0,cc.CURRENT_ITEM);var b=a.width,c=a.height;this.width=b;this.height=c;a.setPosition(b/2,c/2)}},getSubItems:function(){return this.subItems},setSubItems:function(a){this.subItems=a},initWithItems:function(a){var b=a.length;cc.isFunction(a[a.length-2])?(this.initWithCallback(a[a.length-2],a[a.length-1]),b-=2):cc.isFunction(a[a.length-1])?(this.initWithCallback(a[a.length-1],null),b-=1):this.initWithCallback(null,null);for(var c=this.subItems,d=c.length= 0;d<b;d++)a[d]&&c.push(a[d]);this._selectedIndex=cc.UINT_MAX;this.setSelectedIndex(0);this.setCascadeColorEnabled(!0);this.setCascadeOpacityEnabled(!0);return!0},addSubItem:function(a){this.subItems.push(a)},activate:function(){this._enabled&&this.setSelectedIndex((this._selectedIndex+1)%this.subItems.length);cc.MenuItem.prototype.activate.call(this)},selected:function(){cc.MenuItem.prototype.selected.call(this);this.subItems[this._selectedIndex].selected()},unselected:function(){cc.MenuItem.prototype.unselected.call(this); this.subItems[this._selectedIndex].unselected()},setEnabled:function(a){if(this._enabled!==a){cc.MenuItem.prototype.setEnabled.call(this,a);var b=this.subItems;if(b&&0<b.length)for(var c=0;c<b.length;c++)b[c].enabled=a}},selectedItem:function(){return this.subItems[this._selectedIndex]},getSelectedItem:function(){return this.subItems[this._selectedIndex]},onEnter:function(){cc.Node.prototype.onEnter.call(this);this.setSelectedIndex(this._selectedIndex)}});_p=cc.MenuItemToggle.prototype; cc.defineGetterSetter(_p,"selectedIndex",_p.getSelectedIndex,_p.setSelectedIndex);cc.MenuItemToggle.create=function(){0<arguments.length&&null==arguments[arguments.length-1]&&cc.log("parameters should not be ending with null in Javascript");var a=new cc.MenuItemToggle;a.initWithItems(Array.prototype.slice.apply(arguments));return a};cc.MENU_STATE_WAITING=0;cc.MENU_STATE_TRACKING_TOUCH=1;cc.MENU_HANDLER_PRIORITY=-128;cc.DEFAULT_PADDING=5; cc.Menu=cc.Layer.extend({enabled:!1,_selectedItem:null,_state:-1,_touchListener:null,_className:"Menu",ctor:function(a){cc.Layer.prototype.ctor.call(this);this._color=cc.color.WHITE;this.enabled=!1;this._opacity=255;this._selectedItem=null;this._state=-1;this._touchListener=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,swallowTouches:!0,onTouchBegan:this._onTouchBegan,onTouchMoved:this._onTouchMoved,onTouchEnded:this._onTouchEnded,onTouchCancelled:this._onTouchCancelled});var b= arguments.length,c;if(a instanceof Array)c=a;else if(0===b)c=[];else if(0<b){c=[];for(var d=0;d<b;d++)arguments[d]&&c.push(arguments[d])}this.initWithArray(c)},onEnter:function(){var a=this._touchListener;a._isRegistered()||cc.eventManager.addListener(a,this);cc.Node.prototype.onEnter.call(this)},isEnabled:function(){return this.enabled},setEnabled:function(a){this.enabled=a},initWithItems:function(a){var b=[];if(a)for(var c=0;c<a.length;c++)a[c]&&b.push(a[c]);return this.initWithArray(b)},initWithArray:function(a){if(cc.Layer.prototype.init.call(this)){this.enabled= !0;var b=cc.winSize;this.setPosition(b.width/2,b.height/2);this.setContentSize(b);this.setAnchorPoint(0.5,0.5);this.ignoreAnchorPointForPosition(!0);if(a)for(b=0;b<a.length;b++)this.addChild(a[b],b);this._selectedItem=null;this._state=cc.MENU_STATE_WAITING;return this.cascadeOpacity=this.cascadeColor=!0}return!1},addChild:function(a,b,c){if(!(a instanceof cc.MenuItem))throw Error("cc.Menu.addChild() : Menu only supports MenuItem objects as children");cc.Layer.prototype.addChild.call(this,a,b,c)}, updateAlign:function(){switch(this._align){case "vertically":this.alignItemsVertically();break;case "horizontally":this.alignItemsHorizontally()}},alignItemsVertically:function(){this.alignItemsVerticallyWithPadding(cc.DEFAULT_PADDING)},alignItemsVerticallyWithPadding:function(a){this._align="vertically";var b=-a,c=this._children,d,e,f,g;if(c&&0<c.length){e=0;for(d=c.length;e<d;e++)b+=c[e].height*c[e].scaleY+a;var h=b/2;e=0;for(d=c.length;e<d;e++)g=c[e],f=g.height,b=g.scaleY,g.setPosition(0,h-f*b/ 2),h-=f*b+a}},alignItemsHorizontally:function(){this.alignItemsHorizontallyWithPadding(cc.DEFAULT_PADDING)},alignItemsHorizontallyWithPadding:function(a){this._align="horizontally";var b=-a,c=this._children,d,e,f,g;if(c&&0<c.length){d=0;for(e=c.length;d<e;d++)b+=c[d].width*c[d].scaleX+a;var h=-b/2;d=0;for(e=c.length;d<e;d++)g=c[d],b=g.scaleX,f=c[d].width,g.setPosition(h+f*b/2,0),h+=f*b+a}},alignItemsInColumns:function(){0<arguments.length&&null==arguments[arguments.length-1]&&cc.log("parameters should not be ending with null in Javascript"); var a,b=[];for(a=0;a<arguments.length;a++)b.push(arguments[a]);var c=-5,d=0,e=0,f=0,g,h,k,m=this._children;if(m&&0<m.length)for(a=0,k=m.length;a<k;a++)d>=b.length||!(g=b[d])||(h=m[a].height,e=e>=h||isNaN(h)?e:h,++f,f>=g&&(c+=e+5,e=f=0,++d));var n=cc.director.getWinSize(),p=g=e=d=0,r=0,c=c/2;if(m&&0<m.length)for(a=0,k=m.length;a<k;a++){var s=m[a];0===g&&(g=b[d],r=p=n.width/(1+g));h=s._getHeight();e=e>=h||isNaN(h)?e:h;s.setPosition(r-n.width/2,c-h/2);r+=p;++f;f>=g&&(c-=e+5,e=g=f=0,++d)}},alignItemsInRows:function(){0< arguments.length&&null==arguments[arguments.length-1]&&cc.log("parameters should not be ending with null in Javascript");var a,b=[];for(a=0;a<arguments.length;a++)b.push(arguments[a]);var c=[],d=[],e=-10,f=-5,g=0,h=0,k=0,m,n,p,r,s=this._children;if(s&&0<s.length)for(a=0,p=s.length;a<p;a++)(n=s[a],g>=b.length||!(m=b[g]))||(r=n.width,h=h>=r||isNaN(r)?h:r,f+=n.height+5,++k,k>=m&&(c.push(h),d.push(f),e+=h+10,h=k=0,f=-5,++g));f=cc.director.getWinSize();m=h=g=0;var e=-e/2,u=0;if(s&&0<s.length)for(a=0,p= s.length;a<p;a++)n=s[a],0===m&&(m=b[g],u=d[g]),r=n._getWidth(),h=h>=r||isNaN(r)?h:r,n.setPosition(e+c[g]/2,u-f.height/2),u-=n.height+10,++k,k>=m&&(e+=h+5,h=m=k=0,++g)},removeChild:function(a,b){null!=a&&(a instanceof cc.MenuItem?(this._selectedItem===a&&(this._selectedItem=null),cc.Node.prototype.removeChild.call(this,a,b)):cc.log("cc.Menu.removeChild():Menu only supports MenuItem objects as children"))},_onTouchBegan:function(a,b){var c=b.getCurrentTarget();if(c._state!==cc.MENU_STATE_WAITING||!c._visible|| !c.enabled)return!1;for(var d=c.parent;null!=d;d=d.parent)if(!d.isVisible())return!1;c._selectedItem=c._itemForTouch(a);return c._selectedItem?(c._state=cc.MENU_STATE_TRACKING_TOUCH,c._selectedItem.selected(),c._selectedItem.setNodeDirty(),!0):!1},_onTouchEnded:function(a,b){var c=b.getCurrentTarget();c._state!==cc.MENU_STATE_TRACKING_TOUCH?cc.log("cc.Menu.onTouchEnded(): invalid state"):(c._selectedItem&&(c._selectedItem.unselected(),c._selectedItem.setNodeDirty(),c._selectedItem.activate()),c._state= cc.MENU_STATE_WAITING)},_onTouchCancelled:function(a,b){var c=b.getCurrentTarget();c._state!==cc.MENU_STATE_TRACKING_TOUCH?cc.log("cc.Menu.onTouchCancelled(): invalid state"):(c._selectedItem&&(c._selectedItem.unselected(),c._selectedItem.setNodeDirty()),c._state=cc.MENU_STATE_WAITING)},_onTouchMoved:function(a,b){var c=b.getCurrentTarget();if(c._state!==cc.MENU_STATE_TRACKING_TOUCH)cc.log("cc.Menu.onTouchMoved(): invalid state");else{var d=c._itemForTouch(a);d!==c._selectedItem&&(c._selectedItem&& (c._selectedItem.unselected(),c._selectedItem.setNodeDirty()),c._selectedItem=d,c._selectedItem&&(c._selectedItem.selected(),c._selectedItem.setNodeDirty()))}},onExit:function(){this._state===cc.MENU_STATE_TRACKING_TOUCH&&(this._selectedItem&&(this._selectedItem.unselected(),this._selectedItem=null),this._state=cc.MENU_STATE_WAITING);cc.Node.prototype.onExit.call(this)},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},_itemForTouch:function(a){a=a.getLocation();var b=this._children, c;if(b&&0<b.length)for(var d=b.length-1;0<=d;d--)if(c=b[d],c.isVisible()&&c.isEnabled()){var e=c.convertToNodeSpace(a),f=c.rect();f.x=0;f.y=0;if(cc.rectContainsPoint(f,e))return c}return null}});_p=cc.Menu.prototype;cc.Menu.create=function(a){var b=arguments.length;0<b&&null==arguments[b-1]&&cc.log("parameters should not be ending with null in Javascript");return 0===b?new cc.Menu:1===b?new cc.Menu(a):new cc.Menu(Array.prototype.slice.call(arguments,0))};cc.Codec.GZip=function(a){this.data=a;this.debug=!1;this.gpflags=void 0;this.files=0;this.unzipped=[];this.buf32k=Array(32768);this.bIdx=0;this.modeZIP=!1;this.bytepos=0;this.bb=1;this.bits=0;this.nameBuf=[];this.fileout=void 0;this.literalTree=Array(cc.Codec.GZip.LITERALS);this.distanceTree=Array(32);this.treepos=0;this.Places=null;this.len=0;this.fpos=Array(17);this.fpos[0]=0;this.fmax=this.flens=void 0};cc.Codec.GZip.gunzip=function(a){return(new cc.Codec.GZip(a)).gunzip()[0][0]}; cc.Codec.GZip.HufNode=function(){this.b1=this.b0=0;this.jump=null;this.jumppos=-1};cc.Codec.GZip.LITERALS=288;cc.Codec.GZip.NAMEMAX=256; cc.Codec.GZip.bitReverse=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161, 97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255]; cc.Codec.GZip.cplens=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];cc.Codec.GZip.cplext=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99];cc.Codec.GZip.cpdist=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];cc.Codec.GZip.cpdext=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];cc.Codec.GZip.border=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; cc.Codec.GZip.prototype.gunzip=function(){this.outputArr=[];this.nextFile();return this.unzipped};cc.Codec.GZip.prototype.readByte=function(){this.bits+=8;return this.bytepos<this.data.length?this.data.charCodeAt(this.bytepos++):-1};cc.Codec.GZip.prototype.byteAlign=function(){this.bb=1};cc.Codec.GZip.prototype.readBit=function(){var a;this.bits++;a=this.bb&1;this.bb>>=1;0===this.bb&&(this.bb=this.readByte(),a=this.bb&1,this.bb=this.bb>>1|128);return a}; cc.Codec.GZip.prototype.readBits=function(a){for(var b=0,c=a;c--;)b=b<<1|this.readBit();a&&(b=cc.Codec.GZip.bitReverse[b]>>8-a);return b};cc.Codec.GZip.prototype.flushBuffer=function(){this.bIdx=0};cc.Codec.GZip.prototype.addBuffer=function(a){this.buf32k[this.bIdx++]=a;this.outputArr.push(String.fromCharCode(a));32768===this.bIdx&&(this.bIdx=0)}; cc.Codec.GZip.prototype.IsPat=function(){for(;;){if(this.fpos[this.len]>=this.fmax)return-1;if(this.flens[this.fpos[this.len]]===this.len)return this.fpos[this.len]++;this.fpos[this.len]++}}; cc.Codec.GZip.prototype.Rec=function(){var a=this.Places[this.treepos],b;if(17===this.len)return-1;this.treepos++;this.len++;b=this.IsPat();if(0<=b)a.b0=b;else if(a.b0=32768,this.Rec())return-1;b=this.IsPat();if(0<=b)a.b1=b,a.jump=null;else if(a.b1=32768,a.jump=this.Places[this.treepos],a.jumppos=this.treepos,this.Rec())return-1;this.len--;return 0}; cc.Codec.GZip.prototype.CreateTree=function(a,b,c,d){this.Places=a;this.treepos=0;this.flens=c;this.fmax=b;for(a=0;17>a;a++)this.fpos[a]=0;this.len=0;return this.Rec()?-1:0};cc.Codec.GZip.prototype.DecodeValue=function(a){for(var b,c,d=0,e=a[d];;)if(b=this.readBit()){if(!(e.b1&32768))return e.b1;e=e.jump;b=a.length;for(c=0;c<b;c++)if(a[c]===e){d=c;break}}else{if(!(e.b0&32768))return e.b0;d++;e=a[d]}return-1}; cc.Codec.GZip.prototype.DeflateLoop=function(){var a,b,c,d,e;do if(a=this.readBit(),c=this.readBits(2),0===c)for(this.byteAlign(),c=this.readByte(),c|=this.readByte()<<8,b=this.readByte(),b|=this.readByte()<<8,(c^~b)&65535&&document.write("BlockLen checksum mismatch\n");c--;)b=this.readByte(),this.addBuffer(b);else if(1===c)for(;;)if(c=cc.Codec.GZip.bitReverse[this.readBits(7)]>>1,23<c?(c=c<<1|this.readBit(),199<c?(c-=128,c=c<<1|this.readBit()):(c-=48,143<c&&(c+=136))):c+=256,256>c)this.addBuffer(c); else if(256===c)break;else{var f;c-=257;e=this.readBits(cc.Codec.GZip.cplext[c])+cc.Codec.GZip.cplens[c];c=cc.Codec.GZip.bitReverse[this.readBits(5)]>>3;8<cc.Codec.GZip.cpdext[c]?(f=this.readBits(8),f|=this.readBits(cc.Codec.GZip.cpdext[c]-8)<<8):f=this.readBits(cc.Codec.GZip.cpdext[c]);f+=cc.Codec.GZip.cpdist[c];for(c=0;c<e;c++)b=this.buf32k[this.bIdx-f&32767],this.addBuffer(b)}else if(2===c){var g=Array(320);b=257+this.readBits(5);f=1+this.readBits(5);d=4+this.readBits(4);for(c=0;19>c;c++)g[c]= 0;for(c=0;c<d;c++)g[cc.Codec.GZip.border[c]]=this.readBits(3);e=this.distanceTree.length;for(d=0;d<e;d++)this.distanceTree[d]=new cc.Codec.GZip.HufNode;if(this.CreateTree(this.distanceTree,19,g,0))return this.flushBuffer(),1;e=b+f;d=0;for(var h=-1;d<e;)if(h++,c=this.DecodeValue(this.distanceTree),16>c)g[d++]=c;else if(16===c){var k;c=3+this.readBits(2);if(d+c>e)return this.flushBuffer(),1;for(k=d?g[d-1]:0;c--;)g[d++]=k}else{c=17===c?3+this.readBits(3):11+this.readBits(7);if(d+c>e)return this.flushBuffer(), 1;for(;c--;)g[d++]=0}e=this.literalTree.length;for(d=0;d<e;d++)this.literalTree[d]=new cc.Codec.GZip.HufNode;if(this.CreateTree(this.literalTree,b,g,0))return this.flushBuffer(),1;e=this.literalTree.length;for(d=0;d<e;d++)this.distanceTree[d]=new cc.Codec.GZip.HufNode;c=[];for(d=b;d<g.length;d++)c[d-b]=g[d];if(this.CreateTree(this.distanceTree,f,c,0))return this.flushBuffer(),1;for(;;)if(c=this.DecodeValue(this.literalTree),256<=c){c-=256;if(0===c)break;c--;e=this.readBits(cc.Codec.GZip.cplext[c])+ cc.Codec.GZip.cplens[c];c=this.DecodeValue(this.distanceTree);8<cc.Codec.GZip.cpdext[c]?(f=this.readBits(8),f|=this.readBits(cc.Codec.GZip.cpdext[c]-8)<<8):f=this.readBits(cc.Codec.GZip.cpdext[c]);for(f+=cc.Codec.GZip.cpdist[c];e--;)b=this.buf32k[this.bIdx-f&32767],this.addBuffer(b)}else this.addBuffer(c)}while(!a);this.flushBuffer();this.byteAlign();return 0};cc.Codec.GZip.prototype.unzipFile=function(a){var b;this.gunzip();for(b=0;b<this.unzipped.length;b++)if(this.unzipped[b][1]===a)return this.unzipped[b][0]}; cc.Codec.GZip.prototype.nextFile=function(){this.outputArr=[];this.modeZIP=!1;var a=[];a[0]=this.readByte();a[1]=this.readByte();120===a[0]&&218===a[1]&&(this.DeflateLoop(),this.unzipped[this.files]=[this.outputArr.join(""),"geonext.gxt"],this.files++);31===a[0]&&139===a[1]&&(this.skipdir(),this.unzipped[this.files]=[this.outputArr.join(""),"file"],this.files++);if(80===a[0]&&75===a[1]&&(this.modeZIP=!0,a[2]=this.readByte(),a[3]=this.readByte(),3===a[2]&&4===a[3])){a[0]=this.readByte();a[1]=this.readByte(); this.gpflags=this.readByte();this.gpflags|=this.readByte()<<8;a=this.readByte();a|=this.readByte()<<8;this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();var b=this.readByte(),b=b|this.readByte()<<8,c=this.readByte(),c=c|this.readByte()<<8,d=0;for(this.nameBuf=[];b--;){var e=this.readByte();"/"===e|":"===e?d=0:d<cc.Codec.GZip.NAMEMAX-1&&(this.nameBuf[d++]=String.fromCharCode(e))}this.fileout|| (this.fileout=this.nameBuf);for(var d=0;d<c;)this.readByte(),d++;8===a&&(this.DeflateLoop(),this.unzipped[this.files]=[this.outputArr.join(""),this.nameBuf.join("")],this.files++);this.skipdir()}}; cc.Codec.GZip.prototype.skipdir=function(){var a=[],b;this.gpflags&8&&(a[0]=this.readByte(),a[1]=this.readByte(),a[2]=this.readByte(),a[3]=this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte());this.modeZIP&&this.nextFile();a[0]=this.readByte();if(8!==a[0])return 0;this.gpflags=this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();if(this.gpflags&4)for(a[0]= this.readByte(),a[2]=this.readByte(),this.len=a[0]+256*a[1],a=0;a<this.len;a++)this.readByte();if(this.gpflags&8)for(a=0,this.nameBuf=[];b=this.readByte();){if("7"===b||":"===b)a=0;a<cc.Codec.GZip.NAMEMAX-1&&(this.nameBuf[a++]=b)}if(this.gpflags&16)for(;this.readByte(););this.gpflags&2&&(this.readByte(),this.readByte());this.DeflateLoop();this.readByte();this.readByte();this.readByte();this.readByte();this.modeZIP&&this.nextFile()};/* zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */ (function(){function a(a){throw a;}function b(a,b){var c=a.split("."),d=y;c[0]in d||!d.execScript||d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)c.length||b===x?d=d[e]?d[e]:d[e]={}:d[e]=b}function c(a){if("string"===typeof a){a=a.split("");var b,c;b=0;for(c=a.length;b<c;b++)a[b]=(a[b].charCodeAt(0)&255)>>>0}b=1;c=0;for(var d=a.length,e,f=0;0<d;){e=1024<d?1024:d;d-=e;do b+=a[f++],c+=b;while(--e);b%=65521;c%=65521}return(c<<16|b)>>>0}function d(b,c){this.index="number"===typeof c?c:0; this.i=0;this.buffer=b instanceof(z?Uint8Array:Array)?b:new (z?Uint8Array:Array)(32768);2*this.buffer.length<=this.index&&a(Error("invalid index"));this.buffer.length<=this.index&&this.f()}function e(a){this.buffer=new (z?Uint16Array:Array)(2*a);this.length=0}function f(a){var b=a.length,c=0,d=Number.POSITIVE_INFINITY,e,f,g,h,k,m,n,p,s;for(p=0;p<b;++p)a[p]>c&&(c=a[p]),a[p]<d&&(d=a[p]);e=1<<c;f=new (z?Uint32Array:Array)(e);g=1;h=0;for(k=2;g<=c;){for(p=0;p<b;++p)if(a[p]===g){m=0;n=h;for(s=0;s<g;++s)m= m<<1|n&1,n>>=1;for(s=m;s<e;s+=k)f[s]=g<<16|p;++h}++g;h<<=1;k<<=1}return[f,c,d]}function g(a,b){this.h=N;this.w=0;this.input=a;this.b=0;b&&(b.lazy&&(this.w=b.lazy),"number"===typeof b.compressionType&&(this.h=b.compressionType),b.outputBuffer&&(this.a=z&&b.outputBuffer instanceof Array?new Uint8Array(b.outputBuffer):b.outputBuffer),"number"===typeof b.outputIndex&&(this.b=b.outputIndex));this.a||(this.a=new (z?Uint8Array:Array)(32768))}function h(a,b){this.length=a;this.G=b}function k(){var b=H;switch(B){case 3=== b:return[257,b-3,0];case 4===b:return[258,b-4,0];case 5===b:return[259,b-5,0];case 6===b:return[260,b-6,0];case 7===b:return[261,b-7,0];case 8===b:return[262,b-8,0];case 9===b:return[263,b-9,0];case 10===b:return[264,b-10,0];case 12>=b:return[265,b-11,1];case 14>=b:return[266,b-13,1];case 16>=b:return[267,b-15,1];case 18>=b:return[268,b-17,1];case 22>=b:return[269,b-19,2];case 26>=b:return[270,b-23,2];case 30>=b:return[271,b-27,2];case 34>=b:return[272,b-31,2];case 42>=b:return[273,b-35,3];case 50>= b:return[274,b-43,3];case 58>=b:return[275,b-51,3];case 66>=b:return[276,b-59,3];case 82>=b:return[277,b-67,4];case 98>=b:return[278,b-83,4];case 114>=b:return[279,b-99,4];case 130>=b:return[280,b-115,4];case 162>=b:return[281,b-131,5];case 194>=b:return[282,b-163,5];case 226>=b:return[283,b-195,5];case 257>=b:return[284,b-227,5];case 258===b:return[285,b-258,0];default:a("invalid length: "+b)}}function m(b,c){function d(b,c){var e=b.G,f=[],g=0,h;h=R[b.length];f[g++]=h&65535;f[g++]=h>>16&255;f[g++]= h>>24;var k;switch(B){case 1===e:k=[0,e-1,0];break;case 2===e:k=[1,e-2,0];break;case 3===e:k=[2,e-3,0];break;case 4===e:k=[3,e-4,0];break;case 6>=e:k=[4,e-5,1];break;case 8>=e:k=[5,e-7,1];break;case 12>=e:k=[6,e-9,2];break;case 16>=e:k=[7,e-13,2];break;case 24>=e:k=[8,e-17,3];break;case 32>=e:k=[9,e-25,3];break;case 48>=e:k=[10,e-33,4];break;case 64>=e:k=[11,e-49,4];break;case 96>=e:k=[12,e-65,5];break;case 128>=e:k=[13,e-97,5];break;case 192>=e:k=[14,e-129,6];break;case 256>=e:k=[15,e-193,6];break; case 384>=e:k=[16,e-257,7];break;case 512>=e:k=[17,e-385,7];break;case 768>=e:k=[18,e-513,8];break;case 1024>=e:k=[19,e-769,8];break;case 1536>=e:k=[20,e-1025,9];break;case 2048>=e:k=[21,e-1537,9];break;case 3072>=e:k=[22,e-2049,10];break;case 4096>=e:k=[23,e-3073,10];break;case 6144>=e:k=[24,e-4097,11];break;case 8192>=e:k=[25,e-6145,11];break;case 12288>=e:k=[26,e-8193,12];break;case 16384>=e:k=[27,e-12289,12];break;case 24576>=e:k=[28,e-16385,13];break;case 32768>=e:k=[29,e-24577,13];break;default:a("invalid distance")}h= k;f[g++]=h[0];f[g++]=h[1];f[g++]=h[2];e=0;for(g=f.length;e<g;++e)s[r++]=f[e];u[f[0]]++;v[f[3]]++;t=b.length+c-1;p=null}var e,f,g,k,m,n={},p,s=z?new Uint16Array(2*c.length):[],r=0,t=0,u=new (z?Uint32Array:Array)(286),v=new (z?Uint32Array:Array)(30),w=b.w,y;if(!z){for(g=0;285>=g;)u[g++]=0;for(g=0;29>=g;)v[g++]=0}u[256]=1;e=0;for(f=c.length;e<f;++e){g=m=0;for(k=3;g<k&&e+g!==f;++g)m=m<<8|c[e+g];n[m]===x&&(n[m]=[]);g=n[m];if(!(0<t--)){for(;0<g.length&&32768<e-g[0];)g.shift();if(e+3>=f){p&&d(p,-1);g=0; for(k=f-e;g<k;++g)y=c[e+g],s[r++]=y,++u[y];break}if(0<g.length){m=k=x;var A=0,C=x,G=x,D=C=x,U=c.length,G=0,D=g.length;a:for(;G<D;G++){k=g[D-G-1];C=3;if(3<A){for(C=A;3<C;C--)if(c[k+C-1]!==c[e+C-1])continue a;C=A}for(;258>C&&e+C<U&&c[k+C]===c[e+C];)++C;C>A&&(m=k,A=C);if(258===C)break}k=new h(A,e-m);p?p.length<k.length?(y=c[e-1],s[r++]=y,++u[y],d(k,0)):d(p,-1):k.length<w?p=k:d(k,0)}else p?d(p,-1):(y=c[e],s[r++]=y,++u[y])}g.push(e)}s[r++]=256;u[256]++;b.L=u;b.K=v;return z?s.subarray(0,r):s}function n(a, b){function c(a){var b=s[a][r[a]];b===n?(c(a+1),c(a+1)):--p[b];++r[a]}var d=a.length,f=new e(572),g=new (z?Uint8Array:Array)(d),h,k,m;if(!z)for(k=0;k<d;k++)g[k]=0;for(k=0;k<d;++k)0<a[k]&&f.push(k,a[k]);d=Array(f.length/2);h=new (z?Uint32Array:Array)(f.length/2);if(1===d.length)return g[f.pop().index]=1,g;k=0;for(m=f.length/2;k<m;++k)d[k]=f.pop(),h[k]=d[k].value;var n=h.length;k=new (z?Uint16Array:Array)(b);var f=new (z?Uint8Array:Array)(b),p=new (z?Uint8Array:Array)(n);m=Array(b);var s=Array(b),r= Array(b),t=(1<<b)-n,u=1<<b-1,v,w,x;k[b-1]=n;for(v=0;v<b;++v)t<u?f[v]=0:(f[v]=1,t-=u),t<<=1,k[b-2-v]=(k[b-1-v]/2|0)+n;k[0]=f[0];m[0]=Array(k[0]);s[0]=Array(k[0]);for(v=1;v<b;++v)k[v]>2*k[v-1]+f[v]&&(k[v]=2*k[v-1]+f[v]),m[v]=Array(k[v]),s[v]=Array(k[v]);for(t=0;t<n;++t)p[t]=b;for(u=0;u<k[b-1];++u)m[b-1][u]=h[u],s[b-1][u]=u;for(t=0;t<b;++t)r[t]=0;1===f[b-1]&&(--p[0],++r[b-1]);for(v=b-2;0<=v;--v){w=t=0;x=r[v+1];for(u=0;u<k[v];u++)w=m[v+1][x]+m[v+1][x+1],w>h[t]?(m[v][u]=w,s[v][u]=n,x+=2):(m[v][u]=h[t], s[v][u]=t,++t);r[v]=0;1===f[v]&&c(v)}h=p;k=0;for(m=d.length;k<m;++k)g[d[k].index]=h[k];return g}function p(b){var c=new (z?Uint16Array:Array)(b.length),d=[],e=[],f=0,g,h,k;g=0;for(h=b.length;g<h;g++)d[b[g]]=(d[b[g]]|0)+1;g=1;for(h=16;g<=h;g++)e[g]=f,f+=d[g]|0,f>1<<g&&a("overcommitted"),f<<=1;65536>f&&a("undercommitted");g=0;for(h=b.length;g<h;g++)for(f=e[b[g]],e[b[g]]+=1,d=c[g]=0,k=b[g];d<k;d++)c[g]=c[g]<<1|f&1,f>>>=1;return c}function r(a,b){this.input=a;this.a=new (z?Uint8Array:Array)(32768);this.h= K.j;var c={},d;!b&&(b={})||"number"!==typeof b.compressionType||(this.h=b.compressionType);for(d in b)c[d]=b[d];c.outputBuffer=this.a;this.z=new g(this.input,c)}function s(b,c){this.k=[];this.l=32768;this.e=this.g=this.c=this.q=0;this.input=z?new Uint8Array(b):b;this.s=!1;this.m=P;this.B=!1;if(c||!(c={}))c.index&&(this.c=c.index),c.bufferSize&&(this.l=c.bufferSize),c.bufferType&&(this.m=c.bufferType),c.resize&&(this.B=c.resize);switch(this.m){case I:this.b=32768;this.a=new (z?Uint8Array:Array)(32768+ this.l+258);break;case P:this.b=0;this.a=new (z?Uint8Array:Array)(this.l);this.f=this.J;this.t=this.H;this.o=this.I;break;default:a(Error("invalid inflate mode"))}}function u(b,c){for(var d=b.g,e=b.e,f=b.input,g=b.c,h;e<c;)h=f[g++],h===x&&a(Error("input buffer is broken")),d|=h<<e,e+=8;b.g=d>>>c;b.e=e-c;b.c=g;return d&(1<<c)-1}function t(b,c){for(var d=b.g,e=b.e,f=b.input,g=b.c,h=c[0],k=c[1],m;e<k;)m=f[g++],m===x&&a(Error("input buffer is broken")),d|=m<<e,e+=8;f=h[d&(1<<k)-1];h=f>>>16;b.g=d>>h;b.e= e-h;b.c=g;return f&65535}function v(a){function b(a,c,d){var e,f,g,h;for(h=0;h<a;)switch(e=t(this,c),e){case 16:for(g=3+u(this,2);g--;)d[h++]=f;break;case 17:for(g=3+u(this,3);g--;)d[h++]=0;f=0;break;case 18:for(g=11+u(this,7);g--;)d[h++]=0;f=0;break;default:f=d[h++]=e}return d}var c=u(a,5)+257,d=u(a,5)+1,e=u(a,4)+4,g=new (z?Uint8Array:Array)(T.length),h;for(h=0;h<e;++h)g[T[h]]=u(a,3);e=f(g);g=new (z?Uint8Array:Array)(c);h=new (z?Uint8Array:Array)(d);a.o(f(b.call(a,c,e,g)),f(b.call(a,d,e,h)))}function w(b, c){var d,e;this.input=b;this.c=0;if(c||!(c={}))c.index&&(this.c=c.index),c.verify&&(this.M=c.verify);d=b[this.c++];e=b[this.c++];switch(d&15){case la:this.method=la;break;default:a(Error("unsupported compression method"))}0!==((d<<8)+e)%31&&a(Error("invalid fcheck flag:"+((d<<8)+e)%31));e&32&&a(Error("fdict flag is not supported"));this.A=new s(b,{index:this.c,bufferSize:c.bufferSize,bufferType:c.bufferType,resize:c.resize})}var x=void 0,B=!0,y=this,z="undefined"!==typeof Uint8Array&&"undefined"!== typeof Uint16Array&&"undefined"!==typeof Uint32Array;d.prototype.f=function(){var a=this.buffer,b,c=a.length,d=new (z?Uint8Array:Array)(c<<1);if(z)d.set(a);else for(b=0;b<c;++b)d[b]=a[b];return this.buffer=d};d.prototype.d=function(a,b,c){var d=this.buffer,e=this.index,f=this.i,g=d[e];c&&1<b&&(a=8<b?(E[a&255]<<24|E[a>>>8&255]<<16|E[a>>>16&255]<<8|E[a>>>24&255])>>32-b:E[a]>>8-b);if(8>b+f)g=g<<b|a,f+=b;else for(c=0;c<b;++c)g=g<<1|a>>b-c-1&1,8===++f&&(f=0,d[e++]=E[g],g=0,e===d.length&&(d=this.f())); d[e]=g;this.buffer=d;this.i=f;this.index=e};d.prototype.finish=function(){var a=this.buffer,b=this.index,c;0<this.i&&(a[b]<<=8-this.i,a[b]=E[a[b]],b++);z?c=a.subarray(0,b):(a.length=b,c=a);return c};var C=new (z?Uint8Array:Array)(256),A;for(A=0;256>A;++A){for(var D=A,F=D,M=7,D=D>>>1;D;D>>>=1)F<<=1,F|=D&1,--M;C[A]=(F<<M&255)>>>0}var E=C,C=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049, 498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275, 3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277, 2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143, 2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112, 2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746, 711928724,3020668471,3272380065,1510334235,755167117];z&&new Uint32Array(C);e.prototype.getParent=function(a){return 2*((a-2)/4|0)};e.prototype.push=function(a,b){var c,d,e=this.buffer,f;c=this.length;e[this.length++]=b;for(e[this.length++]=a;0<c;)if(d=this.getParent(c),e[c]>e[d])f=e[c],e[c]=e[d],e[d]=f,f=e[c+1],e[c+1]=e[d+1],e[d+1]=f,c=d;else break;return this.length};e.prototype.pop=function(){var a,b,c=this.buffer,d,e,f;b=c[0];a=c[1];this.length-=2;c[0]=c[this.length];c[1]=c[this.length+1];for(f= 0;;){e=2*f+2;if(e>=this.length)break;e+2<this.length&&c[e+2]>c[e]&&(e+=2);if(c[e]>c[f])d=c[f],c[f]=c[e],c[e]=d,d=c[f+1],c[f+1]=c[e+1],c[e+1]=d;else break;f=e}return{index:a,value:b,length:this.length}};var N=2,C={NONE:0,r:1,j:N,N:3},Q=[];for(A=0;288>A;A++)switch(B){case 143>=A:Q.push([A+48,8]);break;case 255>=A:Q.push([A-144+400,9]);break;case 279>=A:Q.push([A-256+0,7]);break;case 287>=A:Q.push([A-280+192,8]);break;default:a("invalid literal: "+A)}g.prototype.n=function(){var b,c,e,f,g=this.input; switch(this.h){case 0:e=0;for(f=g.length;e<f;){c=z?g.subarray(e,e+65535):g.slice(e,e+65535);e+=c.length;var h=e===f,k=x,s=k=x,s=k=x,r=this.a,t=this.b;if(z){for(r=new Uint8Array(this.a.buffer);r.length<=t+c.length+5;)r=new Uint8Array(r.length<<1);r.set(this.a)}k=h?1:0;r[t++]=k|0;k=c.length;s=~k+65536&65535;r[t++]=k&255;r[t++]=k>>>8&255;r[t++]=s&255;r[t++]=s>>>8&255;if(z)r.set(c,t),t+=c.length,r=r.subarray(0,t);else{k=0;for(s=c.length;k<s;++k)r[t++]=c[k];r.length=t}this.b=t;this.a=r}break;case 1:e= new d(new Uint8Array(this.a.buffer),this.b);e.d(1,1,B);e.d(1,2,B);g=m(this,g);c=0;for(h=g.length;c<h;c++)if(f=g[c],d.prototype.d.apply(e,Q[f]),256<f)e.d(g[++c],g[++c],B),e.d(g[++c],5),e.d(g[++c],g[++c],B);else if(256===f)break;this.a=e.finish();this.b=this.a.length;break;case N:f=new d(new Uint8Array(this.a),this.b);var u,v,w,y=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],A,C,k=Array(19),G,r=N;f.d(1,1,B);f.d(r,2,B);g=m(this,g);s=n(this.L,15);A=p(s);r=n(this.K,7);t=p(r);for(u=286;257<u&&0===s[u- 1];u--);for(v=30;1<v&&0===r[v-1];v--);var D=u,U=v;b=new (z?Uint32Array:Array)(D+U);var F=new (z?Uint32Array:Array)(316),E,W;C=new (z?Uint8Array:Array)(19);for(G=w=0;G<D;G++)b[w++]=s[G];for(G=0;G<U;G++)b[w++]=r[G];if(!z)for(G=0,U=C.length;G<U;++G)C[G]=0;G=E=0;for(U=b.length;G<U;G+=w){for(w=1;G+w<U&&b[G+w]===b[G];++w);D=w;if(0===b[G])if(3>D)for(;0<D--;)F[E++]=0,C[0]++;else for(;0<D;)W=138>D?D:138,W>D-3&&W<D&&(W=D-3),10>=W?(F[E++]=17,F[E++]=W-3,C[17]++):(F[E++]=18,F[E++]=W-11,C[18]++),D-=W;else if(F[E++]= b[G],C[b[G]]++,D--,3>D)for(;0<D--;)F[E++]=b[G],C[b[G]]++;else for(;0<D;)W=6>D?D:6,W>D-3&&W<D&&(W=D-3),F[E++]=16,F[E++]=W-3,C[16]++,D-=W}b=z?F.subarray(0,E):F.slice(0,E);C=n(C,7);for(G=0;19>G;G++)k[G]=C[y[G]];for(w=19;4<w&&0===k[w-1];w--);y=p(C);f.d(u-257,5,B);f.d(v-1,5,B);f.d(w-4,4,B);for(G=0;G<w;G++)f.d(k[G],3,B);G=0;for(k=b.length;G<k;G++)if(c=b[G],f.d(y[c],C[c],B),16<=c){G++;switch(c){case 16:h=2;break;case 17:h=3;break;case 18:h=7;break;default:a("invalid code: "+c)}f.d(b[G],h,B)}h=[A,s];t=[t, r];c=h[0];h=h[1];r=t[0];A=t[1];t=0;for(k=g.length;t<k;++t)if(e=g[t],f.d(c[e],h[e],B),256<e)f.d(g[++t],g[++t],B),s=g[++t],f.d(r[s],A[s],B),f.d(g[++t],g[++t],B);else if(256===e)break;this.a=f.finish();this.b=this.a.length;break;default:a("invalid compression type")}return this.a};A=[];var H;for(H=3;258>=H;H++)D=k(),A[H]=D[2]<<24|D[1]<<16|D[0];var R=z?new Uint32Array(A):A,K=C;r.prototype.n=function(){var b,d,e,f,g=0;f=this.a;b=la;switch(b){case la:d=Math.LOG2E*Math.log(32768)-8;break;default:a(Error("invalid compression method"))}d= d<<4|b;f[g++]=d;switch(b){case la:switch(this.h){case K.NONE:e=0;break;case K.r:e=1;break;case K.j:e=2;break;default:a(Error("unsupported compression type"))}break;default:a(Error("invalid compression method"))}b=e<<6|0;f[g++]=b|31-(256*d+b)%31;b=c(this.input);this.z.b=g;f=this.z.n();g=f.length;z&&(f=new Uint8Array(f.buffer),f.length<=g+4&&(this.a=new Uint8Array(f.length+4),this.a.set(f),f=this.a),f=f.subarray(0,g+4));f[g++]=b>>24&255;f[g++]=b>>16&255;f[g++]=b>>8&255;f[g++]=b&255;return f};b("Zlib.Deflate", r);b("Zlib.Deflate.compress",function(a,b){return(new r(a,b)).n()});b("Zlib.Deflate.CompressionType",K);b("Zlib.Deflate.CompressionType.NONE",K.NONE);b("Zlib.Deflate.CompressionType.FIXED",K.r);b("Zlib.Deflate.CompressionType.DYNAMIC",K.j);var I=0,P=1,C={D:I,C:P};s.prototype.p=function(){for(;!this.s;){var b=u(this,3);b&1&&(this.s=B);b>>>=1;switch(b){case 0:var b=this.input,c=this.c,d=this.a,e=this.b,f=x,g=x,h=x,k=d.length,f=x;this.e=this.g=0;f=b[c++];f===x&&a(Error("invalid uncompressed block header: LEN (first byte)")); g=f;f=b[c++];f===x&&a(Error("invalid uncompressed block header: LEN (second byte)"));g|=f<<8;f=b[c++];f===x&&a(Error("invalid uncompressed block header: NLEN (first byte)"));h=f;f=b[c++];f===x&&a(Error("invalid uncompressed block header: NLEN (second byte)"));h|=f<<8;g===~h&&a(Error("invalid uncompressed block header: length verify"));c+g>b.length&&a(Error("input buffer is broken"));switch(this.m){case I:for(;e+g>d.length;){f=k-e;g-=f;if(z)d.set(b.subarray(c,c+f),e),e+=f,c+=f;else for(;f--;)d[e++]= b[c++];this.b=e;d=this.f();e=this.b}break;case P:for(;e+g>d.length;)d=this.f({v:2});break;default:a(Error("invalid inflate mode"))}if(z)d.set(b.subarray(c,c+g),e),e+=g,c+=g;else for(;g--;)d[e++]=b[c++];this.c=c;this.b=e;this.a=d;break;case 1:this.o(W,ga);break;case 2:v(this);break;default:a(Error("unknown BTYPE: "+b))}}return this.t()};A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var T=z?new Uint16Array(A):A;A=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227, 258,258,258];var S=z?new Uint16Array(A):A;A=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0];var O=z?new Uint8Array(A):A;A=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];var G=z?new Uint16Array(A):A;A=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];var U=z?new Uint8Array(A):A;A=new (z?Uint8Array:Array)(288);D=0;for(F=A.length;D<F;++D)A[D]=143>=D?8:255>=D?9:279>=D?7:8;var W=f(A);A=new (z?Uint8Array: Array)(30);D=0;for(F=A.length;D<F;++D)A[D]=5;var ga=f(A);s.prototype.o=function(a,b){var c=this.a,d=this.b;this.u=a;for(var e=c.length-258,f,g,h;256!==(f=t(this,a));)if(256>f)d>=e&&(this.b=d,c=this.f(),d=this.b),c[d++]=f;else for(f-=257,h=S[f],0<O[f]&&(h+=u(this,O[f])),f=t(this,b),g=G[f],0<U[f]&&(g+=u(this,U[f])),d>=e&&(this.b=d,c=this.f(),d=this.b);h--;)c[d]=c[d++-g];for(;8<=this.e;)this.e-=8,this.c--;this.b=d};s.prototype.I=function(a,b){var c=this.a,d=this.b;this.u=a;for(var e=c.length,f,g,h;256!== (f=t(this,a));)if(256>f)d>=e&&(c=this.f(),e=c.length),c[d++]=f;else for(f-=257,h=S[f],0<O[f]&&(h+=u(this,O[f])),f=t(this,b),g=G[f],0<U[f]&&(g+=u(this,U[f])),d+h>e&&(c=this.f(),e=c.length);h--;)c[d]=c[d++-g];for(;8<=this.e;)this.e-=8,this.c--;this.b=d};s.prototype.f=function(){var a=new (z?Uint8Array:Array)(this.b-32768),b=this.b-32768,c,d,e=this.a;if(z)a.set(e.subarray(32768,a.length));else for(c=0,d=a.length;c<d;++c)a[c]=e[c+32768];this.k.push(a);this.q+=a.length;if(z)e.set(e.subarray(b,b+32768)); else for(c=0;32768>c;++c)e[c]=e[b+c];this.b=32768;return e};s.prototype.J=function(a){var b,c=this.input.length/this.c+1|0,d,e,f,g=this.input,h=this.a;a&&("number"===typeof a.v&&(c=a.v),"number"===typeof a.F&&(c+=a.F));2>c?(d=(g.length-this.c)/this.u[2],f=d/2*258|0,e=f<h.length?h.length+f:h.length<<1):e=h.length*c;z?(b=new Uint8Array(e),b.set(h)):b=h;return this.a=b};s.prototype.t=function(){var a=0,b=this.a,c=this.k,d,e=new (z?Uint8Array:Array)(this.q+(this.b-32768)),f,g,h,k;if(0===c.length)return z? this.a.subarray(32768,this.b):this.a.slice(32768,this.b);f=0;for(g=c.length;f<g;++f)for(d=c[f],h=0,k=d.length;h<k;++h)e[a++]=d[h];f=32768;for(g=this.b;f<g;++f)e[a++]=b[f];this.k=[];return this.buffer=e};s.prototype.H=function(){var a,b=this.b;z?this.B?(a=new Uint8Array(b),a.set(this.a.subarray(0,b))):a=this.a.subarray(0,b):(this.a.length>b&&(this.a.length=b),a=this.a);return this.buffer=a};w.prototype.p=function(){var b=this.input,d,e;d=this.A.p();this.c=this.A.c;this.M&&(e=(b[this.c++]<<24|b[this.c++]<< 16|b[this.c++]<<8|b[this.c++])>>>0,e!==c(d)&&a(Error("invalid adler-32 checksum")));return d};b("Zlib.Inflate",w);b("Zlib.Inflate.BufferType",C);C.ADAPTIVE=C.C;C.BLOCK=C.D;b("Zlib.Inflate.prototype.decompress",w.prototype.p);C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];z&&new Uint16Array(C);C=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258];z&&new Uint16Array(C);C=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0];z&&new Uint8Array(C); C=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];z&&new Uint16Array(C);C=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];z&&new Uint8Array(C);C=new (z?Uint8Array:Array)(288);A=0;for(D=C.length;A<D;++A)C[A]=143>=A?8:255>=A?9:279>=A?7:8;f(C);C=new (z?Uint8Array:Array)(30);A=0;for(D=C.length;A<D;++A)C[A]=5;f(C);var la=8}).call(this);_p=window;_p=_p.Zlib=_p.Zlib;_p.Deflate=_p.Deflate;_p.Deflate.compress=_p.Deflate.compress; _p.Inflate=_p.Inflate;_p.Inflate.BufferType=_p.Inflate.BufferType;_p.Inflate.prototype.decompress=_p.Inflate.prototype.decompress;cc.TGA_OK=0;cc.TGA_ERROR_FILE_OPEN=1;cc.TGA_ERROR_READING_FILE=2;cc.TGA_ERROR_INDEXED_COLOR=3;cc.TGA_ERROR_MEMORY=4;cc.TGA_ERROR_COMPRESSED_FILE=5;cc.ImageTGA=function(a,b,c,d,e,f,g){this.status=a||0;this.type=b||0;this.pixelDepth=c||0;this.width=d||0;this.height=e||0;this.imageData=f||[];this.flipped=g||0}; cc.tgaLoadHeader=function(a,b,c){var d=2;if(d+1>b)return!1;a=new cc.BinaryStreamReader(a);a.setOffset(d);c.type=a.readByte();d+=10;if(d+4+1>b)return!1;a.setOffset(d);c.width=a.readUnsignedShort();c.height=a.readUnsignedInteger();c.pixelDepth=a.readByte();if(d+5+1>b)return!1;b=a.readByte();c.flipped=0;b&32&&(c.flipped=1);return!0}; cc.tgaLoadImageData=function(a,b,c){var d,e;d=0|c.pixelDepth/2;e=c.height*c.width*d;if(18+e>b)return!1;c.imageData=cc.__getSubArray(a,18,18+e);if(3<=d)for(a=0;a<e;a+=d)b=c.imageData[a],c.imageData[a]=c.imageData[a+2],c.imageData[a+2]=b;return!0}; cc.tgaRGBtogreyscale=function(a){var b,c;if(8!==a.pixelDepth){var d=a.pixelDepth/8,e=new Uint8Array(a.height*a.width);if(null!==e){for(c=b=0;c<a.width*a.height;b+=d,c++)e[c]=0.3*a.imageData[b]+0.59*a.imageData[b+1]+0.11*a.imageData[b+2];a.pixelDepth=8;a.type=3;a.imageData=e}}};cc.tgaDestroy=function(a){a&&(a.imageData=null)}; cc.tgaLoadRLEImageData=function(a,b,c){var d,e,f,g=0,h=0,k=0,m=[],n=0,p=18;d=c.pixelDepth/8;e=c.height*c.width;for(f=0;f<e;f++){if(0!==n)n--,h=0!==k;else{if(p+1>b)break;n=a[p];p+=1;(k=n&128)&&(n-=128);h=0}if(!h){if(p+d>b)break;m=cc.__getSubArray(a,p,p+d);p+=d;3<=d&&(h=m[0],m[0]=m[2],m[2]=h)}for(h=0;h<d;h++)c.imageData[g+h]=m[h];g+=d}return!0}; cc.tgaFlipImage=function(a){for(var b=a.pixelDepth/8*a.width,c=0;c<a.height/2;c++){var d=cc.__getSubArray(a.imageData,c*b,c*b+b);cc.__setDataToArray(cc.__getSubArray(a.imageData,(a.height-(c+1))*b,b),a.imageData,c*b);cc.__setDataToArray(d,a.imageData,(a.height-(c+1))*b)}a.flipped=0};cc.__getSubArray=function(a,b,c){return a instanceof Array?a.slice(b,c):a.subarray(b,c)};cc.__setDataToArray=function(a,b,c){for(var d=0;d<a.length;d++)b[c+d]=a[d]}; cc.BinaryStreamReader=cc.Class.extend({_binaryData:null,_offset:0,ctor:function(a){this._binaryData=a},setBinaryData:function(a){this._binaryData=a;this._offset=0},getBinaryData:function(){return this._binaryData},_checkSize:function(a){if(!(this._offset+Math.ceil(a/8)<this._data.length))throw Error("Index out of bound");},_decodeFloat:function(a,b){var c=a+b+1,d=c>>3;this._checkSize(c);var c=Math.pow(2,b-1)-1,e=this._readBits(a+b,1,d),f=this._readBits(a,b,d),g=0,h=2,k=0;do for(var m=this._readByte(++k, d),n=a%8||8,p=1<<n;p>>=1;)m&p&&(g+=1/h),h*=2;while(a-=n);this._offset+=d;return f===(c<<1)+1?g?NaN:e?-Infinity:Infinity:(1+-2*e)*(f||g?f?Math.pow(2,f-c)*(1+g):Math.pow(2,-c+1)*g:0)},_readByte:function(a,b){return this._data[this._offset+b-a-1]},_decodeInt:function(a,b){var c=this._readBits(0,a,a/8),d=Math.pow(2,a);this._offset+=a/8;return b&&c>=d/2?c-d:c},_shl:function(a,b){for(++b;--b;a=1073741824===((a%=2147483648)&1073741824)?2*a:2*(a-1073741824)+2147483648);return a},_readBits:function(a,b,c){var d= (a+b)%8,e=a%8,f=c-(a>>3)-1;a=c+(-(a+b)>>3);var g=f-a;b=this._readByte(f,c)>>e&(1<<(g?8-e:b))-1;for(g&&d&&(b+=(this._readByte(a++,c)&(1<<d)-1)<<(g--<<3)-e);g;)b+=this._shl(this._readByte(a++,c),(g--<<3)-e);return b},readInteger:function(){return this._decodeInt(32,!0)},readUnsignedInteger:function(){return this._decodeInt(32,!1)},readSingle:function(){return this._decodeFloat(23,8)},readShort:function(){return this._decodeInt(16,!0)},readUnsignedShort:function(){return this._decodeInt(16,!1)},readByte:function(){var a= this._data[this._offset];this._offset+=1;return a},readData:function(a,b){return this._binaryData instanceof Array?this._binaryData.slice(a,b):this._binaryData.subarray(a,b)},setOffset:function(a){this._offset=a},getOffset:function(){return this._offset}});cc.TMX_ORIENTATION_ORTHO=0;cc.TMX_ORIENTATION_HEX=1;cc.TMX_ORIENTATION_ISO=2; cc.TMXTiledMap=cc.Node.extend({properties:null,mapOrientation:null,objectGroups:null,_mapSize:null,_tileSize:null,_tileProperties:null,_className:"TMXTiledMap",ctor:function(a,b){cc.Node.prototype.ctor.call(this);this._mapSize=cc.size(0,0);this._tileSize=cc.size(0,0);void 0!==b?this.initWithXML(a,b):void 0!==a&&this.initWithTMXFile(a)},getMapSize:function(){return cc.size(this._mapSize.width,this._mapSize.height)},setMapSize:function(a){this._mapSize.width=a.width;this._mapSize.height=a.height},_getMapWidth:function(){return this._mapSize.width}, _setMapWidth:function(a){this._mapSize.width=a},_getMapHeight:function(){return this._mapSize.height},_setMapHeight:function(a){this._mapSize.height=a},getTileSize:function(){return cc.size(this._tileSize.width,this._tileSize.height)},setTileSize:function(a){this._tileSize.width=a.width;this._tileSize.height=a.height},_getTileWidth:function(){return this._tileSize.width},_setTileWidth:function(a){this._tileSize.width=a},_getTileHeight:function(){return this._tileSize.height},_setTileHeight:function(a){this._tileSize.height= a},getMapOrientation:function(){return this.mapOrientation},setMapOrientation:function(a){this.mapOrientation=a},getObjectGroups:function(){return this.objectGroups},setObjectGroups:function(a){this.objectGroups=a},getProperties:function(){return this.properties},setProperties:function(a){this.properties=a},initWithTMXFile:function(a){if(!a||0===a.length)throw Error("cc.TMXTiledMap.initWithTMXFile(): tmxFile should be non-null or non-empty string.");this.height=this.width=0;a=new cc.TMXMapInfo(a); if(!a)return!1;var b=a.getTilesets();b&&0!==b.length||cc.log("cc.TMXTiledMap.initWithTMXFile(): Map not found. Please check the filename.");this._buildWithMapInfo(a);return!0},initWithXML:function(a,b){this.height=this.width=0;var c=new cc.TMXMapInfo(a,b),d=c.getTilesets();d&&0!==d.length||cc.log("cc.TMXTiledMap.initWithXML(): Map not found. Please check the filename.");this._buildWithMapInfo(c);return!0},_buildWithMapInfo:function(a){this._mapSize=a.getMapSize();this._tileSize=a.getTileSize();this.mapOrientation= a.orientation;this.objectGroups=a.getObjectGroups();this.properties=a.properties;this._tileProperties=a.getTileProperties();var b=0,c=a.getLayers();if(c)for(var d=null,e=0,f=c.length;e<f;e++)(d=c[e])&&d.visible&&(d=this._parseLayer(d,a),this.addChild(d,b,b),this.width=Math.max(this.width,d.width),this.height=Math.max(this.height,d.height),b++)},allLayers:function(){for(var a=[],b=this._children,c=0,d=b.length;c<d;c++){var e=b[c];e&&e instanceof cc.TMXLayer&&a.push(e)}return a},getLayer:function(a){if(!a|| 0===a.length)throw Error("cc.TMXTiledMap.getLayer(): layerName should be non-null or non-empty string.");for(var b=this._children,c=0;c<b.length;c++){var d=b[c];if(d&&d.layerName===a)return d}return null},getObjectGroup:function(a){if(!a||0===a.length)throw Error("cc.TMXTiledMap.getObjectGroup(): groupName should be non-null or non-empty string.");if(this.objectGroups)for(var b=0;b<this.objectGroups.length;b++){var c=this.objectGroups[b];if(c&&c.groupName===a)return c}return null},getProperty:function(a){return this.properties[a.toString()]}, propertiesForGID:function(a){cc.log("propertiesForGID is deprecated. Please use getPropertiesForGID instead.");return this.getPropertiesForGID[a]},getPropertiesForGID:function(a){return this._tileProperties[a]},_parseLayer:function(a,b){var c=this._tilesetForLayer(a,b),c=new cc.TMXLayer(c,a,b);a.ownTiles=!1;return c},_tilesetForLayer:function(a,b){var c=a._layerSize,d=b.getTilesets();if(d)for(var e=d.length-1;0<=e;e--){var f=d[e];if(f)for(var g=0;g<c.height;g++)for(var h=0;h<c.width;h++){var k=a._tiles[h+ c.width*g];if(0!==k&&(k&cc.TMX_TILE_FLIPPED_MASK)>>>0>=f.firstGid)return f}}cc.log("cocos2d: Warning: TMX Layer "+a.name+" has no tiles");return null}});_p=cc.TMXTiledMap.prototype;cc.defineGetterSetter(_p,"mapWidth",_p._getMapWidth,_p._setMapWidth);cc.defineGetterSetter(_p,"mapHeight",_p._getMapHeight,_p._setMapHeight);cc.defineGetterSetter(_p,"tileWidth",_p._getTileWidth,_p._setTileWidth);cc.defineGetterSetter(_p,"tileHeight",_p._getTileHeight,_p._setTileHeight); cc.TMXTiledMap.create=function(a,b){return new cc.TMXTiledMap(a,b)};cc.TMX_PROPERTY_NONE=0;cc.TMX_PROPERTY_MAP=1;cc.TMX_PROPERTY_LAYER=2;cc.TMX_PROPERTY_OBJECTGROUP=3;cc.TMX_PROPERTY_OBJECT=4;cc.TMX_PROPERTY_TILE=5;cc.TMX_TILE_HORIZONTAL_FLAG=2147483648;cc.TMX_TILE_VERTICAL_FLAG=1073741824;cc.TMX_TILE_DIAGONAL_FLAG=536870912;cc.TMX_TILE_FLIPPED_ALL=(cc.TMX_TILE_HORIZONTAL_FLAG|cc.TMX_TILE_VERTICAL_FLAG|cc.TMX_TILE_DIAGONAL_FLAG)>>>0;cc.TMX_TILE_FLIPPED_MASK=~cc.TMX_TILE_FLIPPED_ALL>>>0; cc.TMXLayerInfo=cc.Class.extend({properties:null,name:"",_layerSize:null,_tiles:null,visible:null,_opacity:null,ownTiles:!0,_minGID:1E5,_maxGID:0,offset:null,ctor:function(){this.properties=[];this.name="";this._tiles=this._layerSize=null;this.visible=!0;this._opacity=0;this.ownTiles=!0;this._minGID=1E5;this._maxGID=0;this.offset=cc.p(0,0)},getProperties:function(){return this.properties},setProperties:function(a){this.properties=a}}); cc.TMXTilesetInfo=cc.Class.extend({name:"",firstGid:0,_tileSize:null,spacing:0,margin:0,sourceImage:"",imageSize:null,ctor:function(){this._tileSize=cc.size(0,0);this.imageSize=cc.size(0,0)},rectForGID:function(a,b){var c=b||cc.rect(0,0,0,0);c.width=this._tileSize.width;c.height=this._tileSize.height;a&=cc.TMX_TILE_FLIPPED_MASK;a-=parseInt(this.firstGid,10);var d=parseInt((this.imageSize.width-2*this.margin+this.spacing)/(this._tileSize.width+this.spacing),10);c.x=parseInt(a%d*(this._tileSize.width+ this.spacing)+this.margin,10);c.y=parseInt(parseInt(a/d,10)*(this._tileSize.height+this.spacing)+this.margin,10);return c}}); cc.TMXMapInfo=cc.SAXParser.extend({properties:null,orientation:null,parentElement:null,parentGID:null,layerAttrs:0,storingCharacters:!1,tmxFileName:null,currentString:null,_objectGroups:null,_mapSize:null,_tileSize:null,_layers:null,_tilesets:null,_tileProperties:null,_resources:"",_currentFirstGID:0,ctor:function(a,b){cc.SAXParser.prototype.ctor.apply(this);this._mapSize=cc.size(0,0);this._tileSize=cc.size(0,0);this._layers=[];this._tilesets=[];this._objectGroups=[];this.properties=[];this._tileProperties= {};this._currentFirstGID=0;void 0!==b?this.initWithXML(a,b):void 0!==a&&this.initWithTMXFile(a)},getOrientation:function(){return this.orientation},setOrientation:function(a){this.orientation=a},getMapSize:function(){return cc.size(this._mapSize.width,this._mapSize.height)},setMapSize:function(a){this._mapSize.width=a.width;this._mapSize.height=a.height},_getMapWidth:function(){return this._mapSize.width},_setMapWidth:function(a){this._mapSize.width=a},_getMapHeight:function(){return this._mapSize.height}, _setMapHeight:function(a){this._mapSize.height=a},getTileSize:function(){return cc.size(this._tileSize.width,this._tileSize.height)},setTileSize:function(a){this._tileSize.width=a.width;this._tileSize.height=a.height},_getTileWidth:function(){return this._tileSize.width},_setTileWidth:function(a){this._tileSize.width=a},_getTileHeight:function(){return this._tileSize.height},_setTileHeight:function(a){this._tileSize.height=a},getLayers:function(){return this._layers},setLayers:function(a){this._layers.push(a)}, getTilesets:function(){return this._tilesets},setTilesets:function(a){this._tilesets.push(a)},getObjectGroups:function(){return this._objectGroups},setObjectGroups:function(a){this._objectGroups.push(a)},getParentElement:function(){return this.parentElement},setParentElement:function(a){this.parentElement=a},getParentGID:function(){return this.parentGID},setParentGID:function(a){this.parentGID=a},getLayerAttribs:function(){return this.layerAttrs},setLayerAttribs:function(a){this.layerAttrs=a},getStoringCharacters:function(){return this.storingCharacters}, setStoringCharacters:function(a){this.storingCharacters=a},getProperties:function(){return this.properties},setProperties:function(a){this.properties=a},initWithTMXFile:function(a){this._internalInit(a,null);return this.parseXMLFile(a)},initWithXML:function(a,b){this._internalInit(null,b);return this.parseXMLString(a)},parseXMLFile:function(a,b){var c=(b=b||!1)?a:cc.loader.getRes(a);if(!c)throw Error("Please load the resource first : "+a);var d,e,c=this._parseXML(c).documentElement;d=c.getAttribute("version"); e=c.getAttribute("orientation");if("map"===c.nodeName&&("1.0"!==d&&null!==d&&cc.log("cocos2d: TMXFormat: Unsupported TMX version:"+d),"orthogonal"===e?this.orientation=cc.TMX_ORIENTATION_ORTHO:"isometric"===e?this.orientation=cc.TMX_ORIENTATION_ISO:"hexagonal"===e?this.orientation=cc.TMX_ORIENTATION_HEX:null!==e&&cc.log("cocos2d: TMXFomat: Unsupported orientation:"+e),d=cc.size(0,0),d.width=parseFloat(c.getAttribute("width")),d.height=parseFloat(c.getAttribute("height")),this.setMapSize(d),d=cc.size(0, 0),d.width=parseFloat(c.getAttribute("tilewidth")),d.height=parseFloat(c.getAttribute("tileheight")),this.setTileSize(d),e=c.querySelectorAll("map \x3e properties \x3e property"))){var f={};for(d=0;d<e.length;d++)f[e[d].getAttribute("name")]=e[d].getAttribute("value");this.properties=f}f=c.getElementsByTagName("tileset");"map"!==c.nodeName&&(f=[],f.push(c));for(d=0;d<f.length;d++){e=f[d];var g=e.getAttribute("source");if(g)e=b?cc.path.join(this._resources,g):cc.path.changeBasename(a,g),this.parseXMLFile(e); else{g=new cc.TMXTilesetInfo;g.name=e.getAttribute("name")||"";g.firstGid=parseInt(e.getAttribute("firstgid"))||0;g.spacing=parseInt(e.getAttribute("spacing"))||0;g.margin=parseInt(e.getAttribute("margin"))||0;var h=cc.size(0,0);h.width=parseFloat(e.getAttribute("tilewidth"));h.height=parseFloat(e.getAttribute("tileheight"));g._tileSize=h;var h=e.getElementsByTagName("image")[0].getAttribute("source"),k=-1;this.tmxFileName&&(k=this.tmxFileName.lastIndexOf("/"));-1!==k?(k=this.tmxFileName.substr(0, k+1),g.sourceImage=k+h):g.sourceImage=this._resources+(this._resources?"/":"")+h;this.setTilesets(g);if(h=e.getElementsByTagName("tile"))for(k=0;k<h.length;k++){e=h[k];this.parentGID=parseInt(g.firstGid)+parseInt(e.getAttribute("id")||0);var m=e.querySelectorAll("properties \x3e property");if(m){var n={};for(e=0;e<m.length;e++){var p=m[e].getAttribute("name");n[p]=m[e].getAttribute("value")}this._tileProperties[this.parentGID]=n}}}}if(f=c.getElementsByTagName("layer"))for(d=0;d<f.length;d++){k=f[d]; m=k.getElementsByTagName("data")[0];g=new cc.TMXLayerInfo;g.name=k.getAttribute("name");e=cc.size(0,0);e.width=parseFloat(k.getAttribute("width"));e.height=parseFloat(k.getAttribute("height"));g._layerSize=e;e=k.getAttribute("visible");g.visible="0"!=e;e=k.getAttribute("opacity")||1;g._opacity=e?parseInt(255*parseFloat(e)):255;g.offset=cc.p(parseFloat(k.getAttribute("x"))||0,parseFloat(k.getAttribute("y"))||0);n="";for(e=0;e<m.childNodes.length;e++)n+=m.childNodes[e].nodeValue;n=n.trim();e=m.getAttribute("compression"); p=m.getAttribute("encoding");if(e&&"gzip"!==e&&"zlib"!==e)return cc.log("cc.TMXMapInfo.parseXMLFile(): unsupported compression method"),null;switch(e){case "gzip":h=cc.unzipBase64AsArray(n,4);break;case "zlib":h=new Zlib.Inflate(cc.Codec.Base64.decodeAsArray(n,1));h=cc.uint8ArrayToUint32Array(h.decompress());break;case null:case "":if("base64"===p)h=cc.Codec.Base64.decodeAsArray(n,4);else if("csv"===p)for(h=[],e=n.split(","),m=0;m<e.length;m++)h.push(parseInt(e[m]));else for(e=m.getElementsByTagName("tile"), h=[],m=0;m<e.length;m++)h.push(parseInt(e[m].getAttribute("gid")));break;default:this.layerAttrs===cc.TMXLayerInfo.ATTRIB_NONE&&cc.log("cc.TMXMapInfo.parseXMLFile(): Only base64 and/or gzip/zlib maps are supported")}h&&(g._tiles=new Uint32Array(h));if(k=k.querySelectorAll("properties \x3e property")){m={};for(e=0;e<k.length;e++)m[k[e].getAttribute("name")]=k[e].getAttribute("value");g.properties=m}this.setLayers(g)}if(h=c.getElementsByTagName("objectgroup"))for(d=0;d<h.length;d++){g=h[d];f=new cc.TMXObjectGroup; f.groupName=g.getAttribute("name");f.setPositionOffset(cc.p(parseFloat(g.getAttribute("x"))*this.getTileSize().width||0,parseFloat(g.getAttribute("y"))*this.getTileSize().height||0));if(k=g.querySelectorAll("objectgroup \x3e properties \x3e property"))for(e=0;e<k.length;e++)m={},m[k[e].getAttribute("name")]=k[e].getAttribute("value"),f.properties=m;g=g.querySelectorAll("object");k=cc.director.getContentScaleFactor();if(g)for(e=0;e<g.length;e++){n=g[e];m={};m.name=n.getAttribute("name")||"";m.type= n.getAttribute("type")||"";m.width=parseInt(n.getAttribute("width"))||0;m.height=parseInt(n.getAttribute("height"))||0;m.x=(((n.getAttribute("x")||0)|0)+f.getPositionOffset().x)/k;p=((n.getAttribute("y")||0)|0)+f.getPositionOffset().y/k;m.y=(parseInt(this.getMapSize().height*this.getTileSize().height)-p-m.height)/cc.director.getContentScaleFactor();m.rotation=parseInt(n.getAttribute("rotation"))||0;if(p=n.querySelectorAll("properties \x3e property"))for(var r=0;r<p.length;r++)m[p[r].getAttribute("name")]= p[r].getAttribute("value");(p=n.querySelectorAll("polygon"))&&0<p.length&&(p=p[0].getAttribute("points"))&&(m.points=this._parsePointsString(p));(n=n.querySelectorAll("polyline"))&&0<n.length&&(n=n[0].getAttribute("points"))&&(m.polylinePoints=this._parsePointsString(n));f.setObjects(m)}this.setObjectGroups(f)}return c},_parsePointsString:function(a){if(!a)return null;var b=[];a=a.split(" ");for(var c=0;c<a.length;c++){var d=a[c].split(",");b.push({x:d[0],y:d[1]})}return b},parseXMLString:function(a){return this.parseXMLFile(a, !0)},getTileProperties:function(){return this._tileProperties},setTileProperties:function(a){this._tileProperties.push(a)},getCurrentString:function(){return this.currentString},setCurrentString:function(a){this.currentString=a},getTMXFileName:function(){return this.tmxFileName},setTMXFileName:function(a){this.tmxFileName=a},_internalInit:function(a,b){this._tilesets.length=0;this._layers.length=0;this.tmxFileName=a;b&&(this._resources=b);this._objectGroups.length=0;this.properties.length=0;this._tileProperties.length= 0;this.currentString="";this.storingCharacters=!1;this.layerAttrs=cc.TMXLayerInfo.ATTRIB_NONE;this.parentElement=cc.TMX_PROPERTY_NONE;this._currentFirstGID=0}});_p=cc.TMXMapInfo.prototype;cc.defineGetterSetter(_p,"mapWidth",_p._getMapWidth,_p._setMapWidth);cc.defineGetterSetter(_p,"mapHeight",_p._getMapHeight,_p._setMapHeight);cc.defineGetterSetter(_p,"tileWidth",_p._getTileWidth,_p._setTileWidth);cc.defineGetterSetter(_p,"tileHeight",_p._getTileHeight,_p._setTileHeight); cc.TMXMapInfo.create=function(a,b){return new cc.TMXMapInfo(a,b)};cc.loader.register(["tmx","tsx"],cc._txtLoader);cc.TMXLayerInfo.ATTRIB_NONE=1;cc.TMXLayerInfo.ATTRIB_BASE64=2;cc.TMXLayerInfo.ATTRIB_GZIP=4;cc.TMXLayerInfo.ATTRIB_ZLIB=8;cc.TMXObjectGroup=cc.Class.extend({properties:null,groupName:"",_positionOffset:null,_objects:null,ctor:function(){this.groupName="";this._positionOffset=cc.p(0,0);this.properties=[];this._objects=[]},getPositionOffset:function(){return cc.p(this._positionOffset)},setPositionOffset:function(a){this._positionOffset.x=a.x;this._positionOffset.y=a.y},getProperties:function(){return this.properties},setProperties:function(a){this.properties.push(a)},getGroupName:function(){return this.groupName.toString()}, setGroupName:function(a){this.groupName=a},propertyNamed:function(a){return this.properties[a]},objectNamed:function(a){return this.getObject(a)},getObject:function(a){if(this._objects&&0<this._objects.length)for(var b=this._objects,c=0,d=b.length;c<d;c++){var e=b[c].name;if(e&&e===a)return b[c]}return null},getObjects:function(){return this._objects},setObjects:function(a){this._objects.push(a)}});cc.TMXLayer=cc.SpriteBatchNode.extend({tiles:null,tileset:null,layerOrientation:null,properties:null,layerName:"",_textures:null,_texGrids:null,_spriteTiles:null,_layerSize:null,_mapTileSize:null,_opacity:255,_minGID:null,_maxGID:null,_vertexZvalue:null,_useAutomaticVertexZ:null,_reusedTile:null,_atlasIndexArray:null,_contentScaleFactor:null,_className:"TMXLayer",ctor:function(a,b,c){cc.SpriteBatchNode.prototype.ctor.call(this);this._descendants=[];this._layerSize=cc.size(0,0);this._mapTileSize=cc.size(0, 0);this._spriteTiles={};void 0!==c&&this.initWithTilesetInfo(a,b,c)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.TMXLayer.CanvasRenderCmd(this):new cc.TMXLayer.WebGLRenderCmd(this)},_fillTextureGrids:function(a,b){var c=this._textures[b];if(c.isLoaded()){a.imageSize.width&&a.imageSize.height||(a.imageSize.width=c.width,a.imageSize.height=c.height);for(var d=a._tileSize.width,e=a._tileSize.height,f=c._contentSize.width,c=c._contentSize.height,g=a.spacing,h= a.margin,k=a.firstGid,g=a.firstGid+Math.floor((c-2*h+g)/(e+g))*Math.floor((f-2*h+g)/(d+g)),h=this._texGrids,m=null,n=h[k]?!0:!1;k<g;++k){n&&!h[k]&&(n=!1);if(!n&&h[k])break;m={texId:b,x:0,y:0,width:d,height:e,t:0,l:0,r:0,b:0};a.rectForGID(k,m);m.t=m.y/c;m.l=m.x/f;m.r=(m.x+m.width)/f;m.b=(m.y+m.height)/c;h[k]=m}}else c.addEventListener("load",function(){this._fillTextureGrids(a,b)},this)},initWithTilesetInfo:function(a,b,c){var d=b._layerSize;parseInt(d.width*d.height);this.layerName=b.name;this.tiles= b._tiles;this.properties=b.properties;this._layerSize=d;this._minGID=b._minGID;this._maxGID=b._maxGID;this._opacity=b._opacity;this.tileset=a;this.layerOrientation=c.orientation;this._mapTileSize=c.getTileSize();if(c=c._tilesets){this._textures=[];this._texGrids=[];for(var e=c.length,f,g,d=0;d<e;++d)f=c[d],g=cc.textureCache.addImage(f.sourceImage),this._textures.push(g),this._fillTextureGrids(f,d),f===a&&(this._texture=g)}a=this._calculateLayerOffset(b.offset);this.setPosition(cc.pointPixelsToPoints(a)); this._parseInternalProperties();this.setContentSize(cc.sizePixelsToPoints(cc.size(this._layerSize.width*this._mapTileSize.width,this._layerSize.height*this._mapTileSize.height)));this._useAutomaticVertexZ=!1;this._vertexZvalue=0;return!0},getLayerSize:function(){return cc.size(this._layerSize.width,this._layerSize.height)},setLayerSize:function(a){this._layerSize.width=a.width;this._layerSize.height=a.height},_getLayerWidth:function(){return this._layerSize.width},_setLayerWidth:function(a){this._layerSize.width= a},_getLayerHeight:function(){return this._layerSize.height},_setLayerHeight:function(a){this._layerSize.height=a},getMapTileSize:function(){return cc.size(this._mapTileSize.width,this._mapTileSize.height)},setMapTileSize:function(a){this._mapTileSize.width=a.width;this._mapTileSize.height=a.height},_getTileWidth:function(){return this._mapTileSize.width},_setTileWidth:function(a){this._mapTileSize.width=a},_getTileHeight:function(){return this._mapTileSize.height},_setTileHeight:function(a){this._mapTileSize.height= a},getTiles:function(){return this.tiles},setTiles:function(a){this.tiles=a},getTileset:function(){return this.tileset},setTileset:function(a){this.tileset=a},getLayerOrientation:function(){return this.layerOrientation},setLayerOrientation:function(a){this.layerOrientation=a},getProperties:function(){return this.properties},setProperties:function(a){this.properties=a},getProperty:function(a){return this.properties[a]},getLayerName:function(){return this.layerName},setLayerName:function(a){this.layerName= a},releaseMap:function(){this._spriteTiles={}},getTileAt:function(a,b){if(void 0===a)throw Error("cc.TMXLayer.getTileAt(): pos should be non-null");var c=a;void 0===b&&(c=a.x,b=a.y);if(c>=this._layerSize.width||b>=this._layerSize.height||0>c||0>b)throw Error("cc.TMXLayer.getTileAt(): invalid position");if(!this.tiles)return cc.log("cc.TMXLayer.getTileAt(): TMXLayer: the tiles map has been released"),null;var d=null,e=this.getTileGIDAt(c,b);if(0===e)return d;var f=0|c+b*this._layerSize.width,d=this._spriteTiles[f]; d||(d=this._texGrids[e],e=this._textures[d.texId],d=cc.rectPixelsToPoints(d),d=new cc.Sprite(e,d),d.setPosition(this.getPositionAt(c,b)),c=this._vertexZForPos(c,b),d.setVertexZ(c),d.setAnchorPoint(0,0),d.setOpacity(this._opacity),this.addChild(d,c,f));return d},getTileGIDAt:function(a,b){if(void 0===a)throw Error("cc.TMXLayer.getTileGIDAt(): pos should be non-null");var c=a;void 0===b&&(c=a.x,b=a.y);if(c>=this._layerSize.width||b>=this._layerSize.height||0>c||0>b)throw Error("cc.TMXLayer.getTileGIDAt(): invalid position"); return this.tiles?(this.tiles[0|c+b*this._layerSize.width]&cc.TMX_TILE_FLIPPED_MASK)>>>0:(cc.log("cc.TMXLayer.getTileGIDAt(): TMXLayer: the tiles map has been released"),null)},setTileGID:function(a,b,c,d){if(void 0===b)throw Error("cc.TMXLayer.setTileGID(): pos should be non-null");void 0!==d?b=cc.p(b,c):d=c;if(b.x>=this._layerSize.width||b.y>=this._layerSize.height||0>b.x||0>b.y)throw Error("cc.TMXLayer.setTileGID(): invalid position");if(this.tiles)if(0!==a&&a<this.tileset.firstGid)cc.log("cc.TMXLayer.setTileGID(): invalid gid:"+ a);else{d=d||0;c=this.getTileFlagsAt(b);var e=this.getTileGIDAt(b);if(e!==a||c!==d)if(c=(a|d)>>>0,0===a)this.removeTileAt(b);else if(0===e)this._updateTileForGID(c,b);else{var e=b.x+b.y*this._layerSize.width,f=this.getChildByTag(e);if(f){a=this._texGrids[a];var g=this._textures[a.texId];a=cc.rectPixelsToPoints(a);f.setTexture(g);f.setTextureRect(a,!1);null!=d&&this._setupTileSprite(f,b,c);this.tiles[e]=c}else this._updateTileForGID(c,b)}}else cc.log("cc.TMXLayer.setTileGID(): TMXLayer: the tiles map has been released")}, addChild:function(a,b,c){cc.Node.prototype.addChild.call(this,a,b,c);void 0!==c&&(this._spriteTiles[c]=a,a._vertexZ=this._vertexZ+cc.renderer.assignedZStep*c/this.tiles.length)},removeChild:function(a,b){this._spriteTiles[a.tag]&&(this._spriteTiles[a.tag]=null);cc.Node.prototype.removeChild.call(this,a,b)},getTileFlagsAt:function(a,b){if(!a)throw Error("cc.TMXLayer.getTileFlagsAt(): pos should be non-null");void 0!==b&&(a=cc.p(a,b));if(a.x>=this._layerSize.width||a.y>=this._layerSize.height||0>a.x|| 0>a.y)throw Error("cc.TMXLayer.getTileFlagsAt(): invalid position");return this.tiles?(this.tiles[0|a.x+a.y*this._layerSize.width]&cc.TMX_TILE_FLIPPED_ALL)>>>0:(cc.log("cc.TMXLayer.getTileFlagsAt(): TMXLayer: the tiles map has been released"),null)},removeTileAt:function(a,b){if(!a)throw Error("cc.TMXLayer.removeTileAt(): pos should be non-null");void 0!==b&&(a=cc.p(a,b));if(a.x>=this._layerSize.width||a.y>=this._layerSize.height||0>a.x||0>a.y)throw Error("cc.TMXLayer.removeTileAt(): invalid position"); if(!this.tiles)cc.log("cc.TMXLayer.removeTileAt(): TMXLayer: the tiles map has been released");else if(0!==this.getTileGIDAt(a)){var c=0|a.x+a.y*this._layerSize.width;this.tiles[c]=0;(c=this._spriteTiles[c])&&this.removeChild(c,!0)}},getPositionAt:function(a,b){void 0!==b&&(a=cc.p(a,b));var c=cc.p(0,0);switch(this.layerOrientation){case cc.TMX_ORIENTATION_ORTHO:c=this._positionForOrthoAt(a);break;case cc.TMX_ORIENTATION_ISO:c=this._positionForIsoAt(a);break;case cc.TMX_ORIENTATION_HEX:c=this._positionForHexAt(a)}return cc.pointPixelsToPoints(c)}, _positionForIsoAt:function(a){return cc.p(this._mapTileSize.width/2*(this._layerSize.width+a.x-a.y-1),this._mapTileSize.height/2*(2*this._layerSize.height-a.x-a.y-2))},_positionForOrthoAt:function(a){return cc.p(a.x*this._mapTileSize.width,(this._layerSize.height-a.y-1)*this._mapTileSize.height)},_positionForHexAt:function(a){return cc.p(a.x*this._mapTileSize.width*3/4,(this._layerSize.height-a.y-1)*this._mapTileSize.height+(1===a.x%2?-this._mapTileSize.height/2:0))},_calculateLayerOffset:function(a){var b= cc.p(0,0);switch(this.layerOrientation){case cc.TMX_ORIENTATION_ORTHO:b=cc.p(a.x*this._mapTileSize.width,-a.y*this._mapTileSize.height);break;case cc.TMX_ORIENTATION_ISO:b=cc.p(this._mapTileSize.width/2*(a.x-a.y),this._mapTileSize.height/2*(-a.x-a.y));break;case cc.TMX_ORIENTATION_HEX:0===a.x&&0===a.y||cc.log("offset for hexagonal map not implemented yet")}return b},_updateTileForGID:function(a,b){if(this._texGrids[a]){var c=0|b.x+b.y*this._layerSize.width;c<this.tiles.length&&(this.tiles[c]=a)}}, _parseInternalProperties:function(){var a=this.getProperty("cc_vertexz");if(a)if("automatic"===a){this._useAutomaticVertexZ=!0;var a=this.getProperty("cc_alpha_func"),b=0;a&&(b=parseFloat(a));cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(this.shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST),this.shaderProgram.use(),this.shaderProgram.setUniformLocationWith1f(cc.UNIFORM_ALPHA_TEST_VALUE_S,b))}else this._vertexZvalue=parseInt(a,10)},_setupTileSprite:function(a, b,c){var d=this.getPositionAt(b);a.setPosition(d);a.setVertexZ(this._vertexZForPos(b));a.setAnchorPoint(0,0);a.setOpacity(this._opacity);a.setFlippedX(!1);a.setFlippedY(!1);a.setRotation(0);(c&cc.TMX_TILE_DIAGONAL_FLAG)>>>0?(a.setAnchorPoint(0.5,0.5),a.setPosition(d.x+a.width/2,d.y+a.height/2),b=(c&(cc.TMX_TILE_HORIZONTAL_FLAG|cc.TMX_TILE_VERTICAL_FLAG)>>>0)>>>0,b===cc.TMX_TILE_HORIZONTAL_FLAG?a.setRotation(90):b===cc.TMX_TILE_VERTICAL_FLAG?a.setRotation(270):(b===(cc.TMX_TILE_VERTICAL_FLAG|cc.TMX_TILE_HORIZONTAL_FLAG)>>> 0?a.setRotation(90):a.setRotation(270),a.setFlippedX(!0))):((c&cc.TMX_TILE_HORIZONTAL_FLAG)>>>0&&a.setFlippedX(!0),(c&cc.TMX_TILE_VERTICAL_FLAG)>>>0&&a.setFlippedY(!0))},_vertexZForPos:function(a,b){void 0===b&&(b=a.y,a=a.x);var c=0,d=0;if(this._useAutomaticVertexZ)switch(this.layerOrientation){case cc.TMX_ORIENTATION_ISO:d=this._layerSize.width+this._layerSize.height;c=-(d-(a+b));break;case cc.TMX_ORIENTATION_ORTHO:c=-(this._layerSize.height-b);break;case cc.TMX_ORIENTATION_HEX:cc.log("TMX Hexa zOrder not supported"); break;default:cc.log("TMX invalid value")}else c=this._vertexZvalue;return c}});_p=cc.TMXLayer.prototype;cc.defineGetterSetter(_p,"layerWidth",_p._getLayerWidth,_p._setLayerWidth);cc.defineGetterSetter(_p,"layerHeight",_p._getLayerHeight,_p._setLayerHeight);cc.defineGetterSetter(_p,"tileWidth",_p._getTileWidth,_p._setTileWidth);cc.defineGetterSetter(_p,"tileHeight",_p._getTileHeight,_p._setTileHeight);cc.TMXLayer.create=function(a,b,c){return new cc.TMXLayer(a,b,c)};(function(){cc.TMXLayer.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0};var a=cc.TMXLayer.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.TMXLayer.CanvasRenderCmd;a.visit=function(a){var c=this._node,d=cc.renderer;if(a=a||this.getParentRenderCmd())this._curLevel=a._curLevel+1;if(c._visible){isNaN(c._customZ)&&(c._vertexZ=d.assignedZ,d.assignedZ+=d.assignedZStep);this._syncStatus(a);a=c._children;var e=c._spriteTiles,f,g=a.length;if(0<g){c.sortAllChildren(); for(f=0;f<g;f++)if(c=a[f],0>c._localZOrder)c._renderCmd.visit(this);else break;for(d.pushRenderCommand(this);f<g;f++)c=a[f],0===c._localZOrder&&e[c.tag]?(isNaN(c._customZ)&&(c._vertexZ=d.assignedZ,d.assignedZ+=d.assignedZStep),c._renderCmd.updateStatus()):c._renderCmd.visit(this)}else d.pushRenderCommand(this);this._dirtyFlag=0}};a.rendering=function(a,c,d){var e=this._node,f=e._rotationX||e._rotationY,g=e.layerOrientation,h=e._opacity/255;if(e.tiles&&!(0>=h)){var k=e._mapTileSize.width,m=e._mapTileSize.height, n=e.tileset._tileSize.width/cc.director._contentScaleFactor,p=e.tileset._tileSize.height/cc.director._contentScaleFactor,r=n-k,s=p-m,u=cc.winSize.width,t=cc.winSize.height,v=e._layerSize.height,w=e._layerSize.width,x=e._texGrids,B=e._spriteTiles,y=this._worldTransform,z=-e._contentSize.width*e._anchorPoint.x,C=-e._contentSize.height*e._anchorPoint.y,A=y.a,D=y.d,F=z*A+C*y.c+y.tx,z=z*y.b+C*D+y.ty,C=a||cc._renderContext,M=C.getContext(),E=0,N=0,Q=w,H=v;f||g!==cc.TMX_ORIENTATION_ORTHO||(E=Math.floor(-(F- r*A)/(k*A)),N=Math.floor((z-s*D+m*v*D-t)/(m*D)),Q=Math.ceil((u-F+r*A)/(k*A)),H=v-Math.floor(-(z+s*D)/(m*D)),0>E&&(E=0),0>N&&(N=0),Q>w&&(Q=w),H>v&&(H=v));var R,K,r=N*w,I,P,T,S=cc.TMX_TILE_FLIPPED_MASK,O,G,U,W,ga=n*A,la=p*D,ba,ta,pa=!1,qa=!1,s=r+E;for(R in B)if(R<s&&B[R])I=B[R]._renderCmd,0===B[R]._localZOrder&&I.rendering&&I.rendering(a,c,d);else if(R>=s)break;C.setTransform(y,c,d);for(C.setGlobalAlpha(h);N<H;++N){for(K=E;K<Q;++K)if(s=r+K,B[s])I=B[s]._renderCmd,0===B[s]._localZOrder&&I.rendering&& (I.rendering(a,c,d),C.setTransform(y,c,d),C.setGlobalAlpha(h));else if(I=e.tiles[s],(P=x[(I&S)>>>0])&&(T=e._textures[P.texId])&&T._htmlElementObj){switch(g){case cc.TMX_ORIENTATION_ORTHO:G=K*k;U=-(v-N-1)*m;break;case cc.TMX_ORIENTATION_ISO:G=k/2*(w+K-N-1);U=-m/2*(2*v-K-N-2);break;case cc.TMX_ORIENTATION_HEX:G=K*k*3/4,U=-(v-N-1)*m+(1===K%2?-m/2:0)}W=G+n;O=U-p;if(!f&&g===cc.TMX_ORIENTATION_ISO){ba=-z+U*D;if(ba<-t-la){K+=Math.floor(2*(-t-ba)/la)-1;continue}ba=F+W*A;if(ba<-ga){K+=Math.floor(2*-ba/ga)- 1;continue}ta=F+G*A;ba=-z+O*D;if(ta>u||0<ba){K=Q;continue}}I>cc.TMX_TILE_DIAGONAL_FLAG&&(pa=(I&cc.TMX_TILE_HORIZONTAL_FLAG)>>>0,qa=(I&cc.TMX_TILE_VERTICAL_FLAG)>>>0);pa&&(G=-W,M.scale(-1,1));qa&&(O=-U,M.scale(1,-1));M.drawImage(T._htmlElementObj,P.x,P.y,P.width,P.height,G,O,n,p);pa&&M.scale(-1,1);qa&&M.scale(1,-1);cc.g_NumberOfDraws++}r+=w}for(R in B)R>s&&B[R]&&(I=B[R]._renderCmd,0===B[R]._localZOrder&&I.rendering&&I.rendering(a,c,d))}}})();(function(){cc.TMXLayer.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._vertices=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}];this._color=new Uint32Array(1);this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST);a=90*Math.PI/180;this._sin90=Math.sin(a);this._cos90=Math.cos(a);a*=3;this._sin270=Math.sin(a);this._cos270=Math.cos(a)};var a=cc.TMXLayer.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.TMXLayer.WebGLRenderCmd; a.uploadData=function(a,c,d){var e=this._node,f=e._rotationX||e._rotationY,g=e.layerOrientation,h=e.tiles;if(!h)return 0;var k=e._mapTileSize.width,m=e._mapTileSize.height,n=e.tileset._tileSize.width/cc.director._contentScaleFactor,p=e.tileset._tileSize.height/cc.director._contentScaleFactor,r=n-k,s=p-m,u=cc.winSize.width,t=cc.winSize.height,v=e._layerSize.height,w=e._layerSize.width,x=e._texGrids,B=e._spriteTiles,y=this._worldTransform,z=y.a,C=y.b,A=y.c,D=y.d,F=y.tx,y=y.ty,M=-e._contentSize.width* e._anchorPoint.x,E=-e._contentSize.height*e._anchorPoint.y,N=M*z+E*A+F,M=M*C+E*D+y,E=e._opacity,Q=this._displayedColor.r,H=this._displayedColor.g,R=this._displayedColor.b;if(e._opacityModifyRGB)var K=E/255,Q=Q*K,H=H*K,R=R*K;this._color[0]=E<<24|R<<16|H<<8|Q;var I=E=0,Q=w,H=v;f||g!==cc.TMX_ORIENTATION_ORTHO||(E=Math.floor(-(N-r*z)/(k*z)),I=Math.floor((M-s*D+m*v*D-t)/(m*D)),Q=Math.ceil((u-N+r*z)/(k*z)),H=v-Math.floor(-(M+s*D)/(m*D)),0>E&&(E=0),0>I&&(I=0),Q>w&&(Q=w),H>v&&(H=v));for(var P,r=d,s=I*w,T, S,O,R=cc.TMX_TILE_FLIPPED_MASK,G,U,W,ga,K=n*z,la=p*D,ba,ta,pa=z,qa=C,ka=A,xa=D,wa=F,ya=y,za=!1,na=!1,ua=!1,fa=this._vertices;I<H;++I){for(P=E;P<Q;++P)if(r+24>a.length&&(cc.renderer._increaseBatchingSize((r-d)/6),cc.renderer._batchRendering(),r=d=0),T=s+P,!B[T]&&(S=e.tiles[T],O=x[(S&R)>>>0])){switch(g){case cc.TMX_ORIENTATION_ORTHO:U=P*k;W=(v-I-1)*m;T=e._vertexZ+cc.renderer.assignedZStep*T/h.length;break;case cc.TMX_ORIENTATION_ISO:U=k/2*(w+P-I-1);W=m/2*(2*v-P-I-2);T=e._vertexZ+cc.renderer.assignedZStep* (e.height-W)/e.height;break;case cc.TMX_ORIENTATION_HEX:U=P*k*3/4,W=(v-I-1)*m+(1===P%2?-m/2:0),T=e._vertexZ+cc.renderer.assignedZStep*(e.height-W)/e.height}ga=U+n;G=W+p;if(!f&&g===cc.TMX_ORIENTATION_ISO){ba=M+W*D;if(ba>t+la){P+=Math.floor(2*(ba-t)/la)-1;continue}ba=N+ga*z;if(ba<-K){P+=Math.floor(2*-ba/K)-1;continue}ta=N+U*z;ba=M+G*D;if(ta>u||0>ba){P=Q;continue}}S>cc.TMX_TILE_DIAGONAL_FLAG&&(za=!0,na=(S&cc.TMX_TILE_HORIZONTAL_FLAG)>>>0,ua=(S&cc.TMX_TILE_VERTICAL_FLAG)>>>0);fa[0].x=U*pa+G*ka+wa;fa[0].y= U*qa+G*xa+ya;fa[1].x=U*pa+W*ka+wa;fa[1].y=U*qa+W*xa+ya;fa[2].x=ga*pa+G*ka+wa;fa[2].y=ga*qa+G*xa+ya;fa[3].x=ga*pa+W*ka+wa;fa[3].y=ga*qa+W*xa+ya;for(S=0;4>S;++S){a[r]=fa[S].x;a[r+1]=fa[S].y;a[r+2]=T;c[r+3]=this._color[0];switch(S){case 0:a[r+4]=na?O.r:O.l;a[r+5]=ua?O.b:O.t;break;case 1:a[r+4]=na?O.r:O.l;a[r+5]=ua?O.t:O.b;break;case 2:a[r+4]=na?O.l:O.r;a[r+5]=ua?O.b:O.t;break;case 3:a[r+4]=na?O.l:O.r,a[r+5]=ua?O.t:O.b}r+=6}za&&(pa=z,qa=C,ka=A,xa=D,wa=F,ya=y,za=ua=na=!1)}s+=w}return(r-d)/6}})();cc.PointObject=cc.Class.extend({_ratio:null,_offset:null,_child:null,ctor:function(a,b){this.initWithCCPoint(a,b)},getRatio:function(){return this._ratio},setRatio:function(a){this._ratio=a},getOffset:function(){return this._offset},setOffset:function(a){this._offset=a},getChild:function(){return this._child},setChild:function(a){this._child=a},initWithCCPoint:function(a,b){this._ratio=a;this._offset=b;this._child=null;return!0}});cc.PointObject.create=function(a,b){return new cc.PointObject(a,b)}; cc.ParallaxNode=cc.Node.extend({parallaxArray:null,_lastPosition:null,_className:"ParallaxNode",getParallaxArray:function(){return this.parallaxArray},setParallaxArray:function(a){this.parallaxArray=a},ctor:function(){cc.Node.prototype.ctor.call(this);this.parallaxArray=[];this._lastPosition=cc.p(-100,-100)},addChild:function(a,b,c,d){if(3===arguments.length)cc.log("ParallaxNode: use addChild(child, z, ratio, offset) instead");else{if(!a)throw Error("cc.ParallaxNode.addChild(): child should be non-null"); var e=new cc.PointObject(c,d);e.setChild(a);this.parallaxArray.push(e);a.setPosition(this._position.x*c.x+d.x,this._position.y*c.y+d.y);cc.Node.prototype.addChild.call(this,a,b,a.tag)}},removeChild:function(a,b){for(var c=this.parallaxArray,d=0;d<c.length;d++)if(c[d].getChild()===a){c.splice(d,1);break}cc.Node.prototype.removeChild.call(this,a,b)},removeAllChildren:function(a){this.parallaxArray.length=0;cc.Node.prototype.removeAllChildren.call(this,a)},_updateParallaxPosition:function(){var a=this._absolutePosition(); if(!cc.pointEqualToPoint(a,this._lastPosition)){for(var b=this.parallaxArray,c=0,d=b.length;c<d;c++){var e=b[c];e.getChild().setPosition(-a.x+a.x*e.getRatio().x+e.getOffset().x,-a.y+a.y*e.getRatio().y+e.getOffset().y)}this._lastPosition=a}},_absolutePosition:function(){for(var a=this._position,b=this;null!==b.parent;)b=b.parent,a=cc.pAdd(a,b.getPosition());return a},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.ParallaxNode.CanvasRenderCmd(this):new cc.ParallaxNode.WebGLRenderCmd(this)}}); cc.ParallaxNode.create=function(){return new cc.ParallaxNode};(function(){cc.ParallaxNode.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1};var a=cc.ParallaxNode.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.ParallaxNode.CanvasRenderCmd;a.updateStatus=function(){this._node._updateParallaxPosition();this.originUpdateStatus()};a._syncStatus=function(a){this._node._updateParallaxPosition();this._originSyncStatus(a)}})(); cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_WEBGL){cc.ParallaxNode.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1};var a=cc.ParallaxNode.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.ParallaxNode.WebGLRenderCmd;a.updateStatus=function(){this._node._updateParallaxPosition();this.originUpdateStatus()};a._syncStatus=function(a){this._node._updateParallaxPosition();this._originSyncStatus(a)}}});(function(){var a=cc.sys,b={ONLY_ONE:!1,WEB_AUDIO:!!(window.AudioContext||window.webkitAudioContext||window.mozAudioContext),DELAY_CREATE_CTX:!1,ONE_SOURCE:!1};a.browserType===a.BROWSER_TYPE_FIREFOX&&(b.DELAY_CREATE_CTX=!0,b.USE_LOADER_EVENT="canplay");a.os===a.OS_IOS&&(b.USE_LOADER_EVENT="loadedmetadata");a.os===a.OS_ANDROID&&a.browserType===a.BROWSER_TYPE_UC&&(b.ONE_SOURCE=!0);window.__audioSupport=b})(); cc.Audio=cc.Class.extend({interruptPlay:!1,src:null,_element:null,_AUDIO_TYPE:"AUDIO",ctor:function(a){this.src=a},setBuffer:function(a){this._AUDIO_TYPE="WEBAUDIO";this._element=new cc.Audio.WebAudio(a)},setElement:function(a){this._AUDIO_TYPE="AUDIO";this._element=a;a.addEventListener("ended",function(){a.loop||(a.paused=!0)})},play:function(a,b){this._element?(this._element.loop=b,this._element.play(),"AUDIO"===this._AUDIO_TYPE&&this._element.paused&&(this.stop(),cc.Audio.touchPlayList.push({loop:b, offset:a,audio:this._element})),!1===cc.Audio.bindTouch&&this._element.paused&&(cc.Audio.bindTouch=!0,cc.game.canvas.addEventListener("touchstart",cc.Audio.touchStart))):this.interruptPlay=!1},getPlaying:function(){return this._element?!this._element.paused:!0},stop:function(){if(this._element){this._element.pause();try{this._element.currentTime=0}catch(a){}}else this.interruptPlay=!0},pause:function(){this._element?this._element.pause():this.interruptPlay=!0},resume:function(){this._element?this._element.play(): this.interruptPlay=!1},setVolume:function(a){this._element&&(this._element.volume=a)},getVolume:function(){if(this._element)return this._element.volume},cloneNode:function(){var a=new cc.Audio(this.src);if("AUDIO"===this._AUDIO_TYPE){for(var b=document.createElement("audio"),c=b.getElementsByTagName("source"),d=0;d<c.length;d++)b.appendChild(c[d]);b.src=this.src;a.setElement(b)}else a.setBuffer(this._element.buffer);return a}});cc.Audio.touchPlayList=[];cc.Audio.bindTouch=!1; cc.Audio.touchStart=function(){for(var a=cc.Audio.touchPlayList,b=null;b=a.pop();)b.audio.loop=!!b.loop,b.audio.play(b.offset)};cc.Audio.WebAudio=function(a){this.buffer=a;this.context=cc.Audio._context;a=this.context.createGain();a.gain.value=1;a.connect(this.context.destination);this._volume=a;this._loop=!1;this._startTime=-1;this._currentSource=null;this.playedLength=0;this._currextTimer=null}; cc.Audio.WebAudio.prototype={constructor:cc.Audio.WebAudio,get paused(){return this._currentSource&&this._currentSource.loop?!1:-1===this._startTime?!0:this.context.currentTime-this._startTime>this.buffer.duration},set paused(a){},get loop(){return this._loop},set loop(a){return this._loop=a},get volume(){return this._volume.gain.value},set volume(a){return this._volume.gain.value=a},get currentTime(){return this.playedLength},set currentTime(a){return this.playedLength=a},play:function(a){this._currentSource&& !this.paused&&(this._currentSource.stop(0),this.playedLength=0);var b=this.context.createBufferSource();b.buffer=this.buffer;b.connect(this._volume);b.loop=this._loop;this._startTime=this.context.currentTime;a=a||this.playedLength;var c=this.buffer.duration;this._loop?b.start?b.start(0):b.notoGrainOn?b.noteGrainOn(0):b.noteOn(0):b.start?b.start(0,a,c-a):b.notoGrainOn?b.noteGrainOn(0,a,c-a):b.noteOn(0,a,c-a);this._currentSource=b;if(0===this.context.currentTime){var d=this;clearTimeout(this._currextTimer); this._currextTimer=setTimeout(function(){0===d.context.currentTime&&cc.Audio.touchPlayList.push({offset:a,audio:d})},10)}},pause:function(){this.playedLength=this.context.currentTime-this._startTime;this.playedLength%=this.buffer.duration;var a=this._currentSource;this._currentSource=null;this._startTime=-1;a&&a.stop(0)}}; (function(a){var b=a.WEB_AUDIO,c=a.ONLY_ONE,d=[];(function(){var a=document.createElement("audio");if(a.canPlayType){var b=a.canPlayType('audio/ogg; codecs\x3d"vorbis"');b&&""!==b&&d.push(".ogg");(b=a.canPlayType("audio/mpeg"))&&""!==b&&d.push(".mp3");(b=a.canPlayType('audio/wav; codecs\x3d"1"'))&&""!==b&&d.push(".wav");(b=a.canPlayType("audio/mp4"))&&""!==b&&d.push(".mp4");(a=a.canPlayType("audio/x-m4a"))&&""!==a&&d.push(".m4a")}})();try{if(b){var e=new (window.AudioContext||window.webkitAudioContext|| window.mozAudioContext);cc.Audio._context=e;a.DELAY_CREATE_CTX&&setTimeout(function(){e=new (window.AudioContext||window.webkitAudioContext||window.mozAudioContext);cc.Audio._context=e},0)}}catch(f){b=!1,cc.log("browser don't support web audio")}var g={cache:{},useWebAudio:!0,loadBuffer:function(a,c){if(b){var d=cc.loader.getXMLHttpRequest();d.open("GET",a,!0);d.responseType="arraybuffer";d.onload=function(){0<=d._timeoutId&&clearTimeout(d._timeoutId);e.decodeAudioData(d.response,function(a){c(null, a)},function(){c("decode error - "+a)})};d.onerror=function(){c("request error - "+a)};void 0===d.ontimeout&&(d._timeoutId=setTimeout(function(){d.ontimeout()},d.timeout));d.ontimeout=function(){c("request timeout - "+a)};d.send()}},load:function(a,b,c,e){if(0===d.length)return e("can not support audio!");var f=cc.loader.getRes(b);if(f)return e(null,f);cc.loader.audioPath&&(a=cc.path.join(cc.loader.audioPath,a));f=cc.path.extname(a);c=[f];for(var g=0;g<d.length;g++)f!==d[g]&&c.push(d[g]);f=new cc.Audio(a); cc.loader.cache[b]=f;this.loadAudioFromExtList(a,c,f,e);return f},loadAudioFromExtList:function(c,e,f,g){if(0===e.length){var p="can not found the resource of audio! Last match url is : ",p=p+c.replace(/\.(.*)?$/,"(");d.forEach(function(a){p+=a+"|"});p=p.replace(/\|$/,")");return g({status:520,errorMessage:p},null)}if(b&&this.useWebAudio)this.loadBuffer(c,function(a,b){a&&cc.log(a);b&&f.setBuffer(b);g(null,f)});else{for(var r=a.ONE_SOURCE?1:e.length,s=document.createElement("audio"),u=0;u<r;u++){var t= document.createElement("source");t.src=cc.path.changeExtname(c,e[u]);s.appendChild(t)}f.setElement(s);var v=setTimeout(function(){0===s.readyState?x():w()},8E3),w=function(){s.removeEventListener("canplaythrough",w,!1);s.removeEventListener("error",x,!1);s.removeEventListener("emptied",w,!1);a.USE_LOADER_EVENT&&s.removeEventListener(a.USE_LOADER_EVENT,w,!1);clearTimeout(v);g(null,f)},x=function(){cc.log("load audio failure - "+c);w()};s.addEventListener("canplaythrough",w,!1);s.addEventListener("error", x,!1);a.USE_LOADER_EVENT&&s.addEventListener(a.USE_LOADER_EVENT,w,!1)}}};cc.loader.register(["mp3","ogg","wav","mp4","m4a"],g);cc.audioEngine={_currMusic:null,_musicVolume:1,features:a,willPlayMusic:function(){return!1},playMusic:function(a,b){var c=this._currMusic;c&&c.getPlaying()&&c.stop();var d=this._musicVolume,e=cc.loader.getRes(a);e||(cc.loader.load(a,function(){e.getPlaying()||e.interruptPlay||(e.setVolume(d),e.play(0,b||!1))}),e=cc.loader.getRes(a));e.setVolume(d);e.play(0,b||!1);this._currMusic= e},getDurationOfCurrentMusic:function(){return this._currMusic&&this._currMusic._element&&this._currMusic._element.buffer&&this._currMusic._element.buffer.duration?this._currMusic._element.buffer.duration:0},stopMusic:function(a){var b=this._currMusic;if(b){for(var c=cc.Audio.touchPlayList,d=c.length-1;0<=d;--d)this[d]&&this[d].audio===b._element&&c.splice(d,1);b.stop();this._currMusic=null;a&&cc.loader.release(b.src)}},pauseMusic:function(){var a=this._currMusic;a&&a.pause()},resumeMusic:function(){var a= this._currMusic;a&&a.resume()},rewindMusic:function(){var a=this._currMusic;a&&(a.stop(),a.play())},getMusicVolume:function(){return this._musicVolume},setMusicVolume:function(a){a-=0;isNaN(a)&&(a=1);1<a&&(a=1);0>a&&(a=0);this._musicVolume=a;var b=this._currMusic;b&&b.setVolume(a)},isMusicPlaying:function(){var a=this._currMusic;return a?a.getPlaying():!1},_audioPool:{},_maxAudioInstance:10,_effectVolume:1,playEffect:function(a,d){if(c&&this._currMusic&&this._currMusic.getPlaying())return cc.log("Browser is only allowed to play one audio"), null;var e=this._audioPool[a];e||(e=this._audioPool[a]=[]);for(var f=0;f<e.length&&e[f].getPlaying();f++);!b&&f>this._maxAudioInstance&&(f=e.shift(),f.stop(),e.push(f),f=e.length-1);var p;if(e[f])return p=e[f],p.setVolume(this._effectVolume),p.play(0,d||!1),p;(p=cc.loader.getRes(a))&&b&&"AUDIO"===p._AUDIO_TYPE&&(cc.loader.release(a),p=null);if(p)if(b&&"AUDIO"===p._AUDIO_TYPE)g.loadBuffer(a,function(a,b){p.setBuffer(b);p.setVolume(cc.audioEngine._effectVolume);p.getPlaying()||p.play(0,d||!1)});else return p= p.cloneNode(),p.setVolume(this._effectVolume),p.play(0,d||!1),e.push(p),p;f=g.useWebAudio;g.useWebAudio=!0;cc.loader.load(a,function(b){b=cc.loader.getRes(a);b=b.cloneNode();b.setVolume(cc.audioEngine._effectVolume);b.play(0,d||!1);e.push(b)});g.useWebAudio=f;return p},setEffectsVolume:function(a){a-=0;isNaN(a)&&(a=1);1<a&&(a=1);0>a&&(a=0);this._effectVolume=a;var b=this._audioPool,c;for(c in b){var d=b[c];if(Array.isArray(d))for(var e=0;e<d.length;e++)d[e].setVolume(a)}},getEffectsVolume:function(){return this._effectVolume}, pauseEffect:function(a){a&&a.pause()},pauseAllEffects:function(){var a=this._audioPool,b;for(b in a)for(var c=a[b],d=0;d<a[b].length;d++)c[d].getPlaying()&&c[d].pause()},resumeEffect:function(a){a&&a.resume()},resumeAllEffects:function(){var a=this._audioPool,b;for(b in a)for(var c=a[b],d=0;d<a[b].length;d++)c[d].resume()},stopEffect:function(a){a&&a.stop()},stopAllEffects:function(){var a=this._audioPool,b;for(b in a){for(var c=a[b],d=0;d<c.length;d++)c[d].stop();c.length=0}a.length=0},unloadEffect:function(a){if(a){cc.loader.release(a); var b=this._audioPool[a];if(b){for(var c=0;c<b.length;c++)b[c].stop();b.length=0}delete this._audioPool[a]}},end:function(){this.stopMusic();this.stopAllEffects()},_pauseCache:[],_pausePlaying:function(){var a=this._currMusic;a&&a.getPlaying()&&(a.pause(),this._pauseCache.push(a));var a=this._audioPool,b;for(b in a)for(var c=a[b],d=0;d<a[b].length;d++)c[d].getPlaying()&&(c[d].pause(),this._pauseCache.push(c[d]))},_resumePlaying:function(){for(var a=this._pauseCache,b=0;b<a.length;b++)a[b].resume(); a.length=0}}})(window.__audioSupport);cc.CONTROL_EVENT_TOTAL_NUMBER=9;cc.CONTROL_EVENT_TOUCH_DOWN=1;cc.CONTROL_EVENT_TOUCH_DRAG_INSIDE=2;cc.CONTROL_EVENT_TOUCH_DRAG_OUTSIDE=4;cc.CONTROL_EVENT_TOUCH_DRAG_ENTER=8;cc.CONTROL_EVENT_TOUCH_DRAG_EXIT=16;cc.CONTROL_EVENT_TOUCH_UP_INSIDE=32;cc.CONTROL_EVENT_TOUCH_UP_OUTSIDE=64;cc.CONTROL_EVENT_TOUCH_CANCEL=128;cc.CONTROL_EVENT_VALUECHANGED=256;cc.CONTROL_STATE_NORMAL=1;cc.CONTROL_STATE_HIGHLIGHTED=2;cc.CONTROL_STATE_DISABLED=4;cc.CONTROL_STATE_SELECTED=8;cc.CONTROL_STATE_INITIAL=8; cc.Control=cc.Layer.extend({_isOpacityModifyRGB:!1,_hasVisibleParents:!1,_touchListener:null,_className:"Control",isOpacityModifyRGB:function(){return this._isOpacityModifyRGB},setOpacityModifyRGB:function(a){this._isOpacityModifyRGB=a;for(var b=this.getChildren(),c=0,d=b.length;c<d;c++){var e=b[c];e&&e.setOpacityModifyRGB(a)}},_state:cc.CONTROL_STATE_NORMAL,getState:function(){return this._state},_enabled:!1,_selected:!1,_highlighted:!1,_dispatchTable:null,setEnabled:function(a){this._state=(this._enabled= a)?cc.CONTROL_STATE_NORMAL:cc.CONTROL_STATE_DISABLED;this.needsLayout()},isEnabled:function(){return this._enabled},setSelected:function(a){this._selected=a;this.needsLayout()},isSelected:function(){return this._selected},setHighlighted:function(a){this._highlighted=a;this.needsLayout()},isHighlighted:function(){return this._highlighted},hasVisibleParents:function(){for(var a=this.getParent();null!=a;a=a.getParent())if(!a.isVisible())return!1;return!0},ctor:function(){cc.Layer.prototype.ctor.call(this); this._dispatchTable={};this._color=cc.color.WHITE},init:function(){this._state=cc.CONTROL_STATE_NORMAL;this._enabled=!0;this._highlighted=this._selected=!1;var a=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,swallowTouches:!0});this.onTouchBegan&&(a.onTouchBegan=this.onTouchBegan.bind(this));this.onTouchMoved&&(a.onTouchMoved=this.onTouchMoved.bind(this));this.onTouchEnded&&(a.onTouchEnded=this.onTouchEnded.bind(this));this.onTouchCancelled&&(a.onTouchCancelled=this.onTouchCancelled.bind(this)); this._touchListener=a;return!0},onEnter:function(){var a=this._touchListener;a._isRegistered()||cc.eventManager.addListener(a,this);cc.Node.prototype.onEnter.call(this)},sendActionsForControlEvents:function(a){for(var b=0,c=cc.CONTROL_EVENT_TOTAL_NUMBER;b<c;b++)if(a&1<<b)for(var d=this._dispatchListforControlEvent(1<<b),e=0,f=d.length;e<f;e++)d[e].invoke(this)},addTargetWithActionForControlEvents:function(a,b,c){for(var d=0,e=cc.CONTROL_EVENT_TOTAL_NUMBER;d<e;d++)c&1<<d&&this._addTargetWithActionForControlEvent(a, b,1<<d)},removeTargetWithActionForControlEvents:function(a,b,c){for(var d=0,e=cc.CONTROL_EVENT_TOTAL_NUMBER;d<e;d++)c&1<<d&&this._removeTargetWithActionForControlEvent(a,b,1<<d)},getTouchLocation:function(a){a=a.getLocation();return this.convertToNodeSpace(a)},isTouchInside:function(a){a=a.getLocation();a=this.getParent().convertToNodeSpace(a);return cc.rectContainsPoint(this.getBoundingBox(),a)},_invocationWithTargetAndActionForControlEvent:function(a,b,c){return null},_dispatchListforControlEvent:function(a){a= a.toString();this._dispatchTable[a]||(this._dispatchTable[a]=[]);return this._dispatchTable[a]},_addTargetWithActionForControlEvent:function(a,b,c){a=new cc.Invocation(a,b,c);this._dispatchListforControlEvent(c).push(a)},_removeTargetWithActionForControlEvent:function(a,b,c){c=this._dispatchListforControlEvent(c);if(a||b)for(var d=0;d<c.length;){var e=c[d],f=!0;a&&(f=a===e.getTarget());b&&(f=f&&b===e.getAction());f?cc.arrayRemoveObject(c,e):d++}else c.length=0},needsLayout:function(){}});_p=cc.Control.prototype; cc.defineGetterSetter(_p,"state",_p.getState);cc.defineGetterSetter(_p,"enabled",_p.isEnabled,_p.setEnabled);cc.defineGetterSetter(_p,"selected",_p.isSelected,_p.setSelected);cc.defineGetterSetter(_p,"highlighted",_p.isHighlighted,_p.setHighlighted);_p=null;cc.Control.create=function(){var a=new cc.Control;return a&&a.init()?a:null};cc.CONTROL_ZOOM_ACTION_TAG=3435855873; cc.ControlButton=cc.Control.extend({_doesAdjustBackgroundImage:!1,zoomOnTouchDown:!1,_preferredSize:null,_labelAnchorPoint:null,_currentTitle:null,_currentTitleColor:null,_titleLabel:null,_backgroundSprite:null,_opacity:0,_isPushed:!1,_titleDispatchTable:null,_titleColorDispatchTable:null,_titleLabelDispatchTable:null,_backgroundSpriteDispatchTable:null,_parentInited:!1,_marginV:0,_marginH:0,_className:"ControlButton",ctor:function(a,b,c){cc.Control.prototype.ctor.call(this);this._preferredSize=cc.size(0, 0);this._labelAnchorPoint=cc.p(0,0);this._currentTitle="";this._currentTitleColor=cc.color.WHITE;this._titleDispatchTable={};this._titleColorDispatchTable={};this._titleLabelDispatchTable={};this._backgroundSpriteDispatchTable={};void 0!=c?this.initWithTitleAndFontNameAndFontSize(a,b,c):void 0!=b?this.initWithLabelAndBackgroundSprite(a,b):void 0!=a?this.initWithBackgroundSprite(a):this.init()},init:function(){return this.initWithLabelAndBackgroundSprite(new cc.LabelTTF("","Arial",12),new cc.Scale9Sprite)}, needsLayout:function(){if(this._parentInited){this._titleLabel&&this._titleLabel.setVisible(!1);this._backgroundSprite&&this._backgroundSprite.setVisible(!1);this.setLabelAnchorPoint(this._labelAnchorPoint);var a=this._state;this._currentTitle=this.getTitleForState(a);this._currentTitleColor=this.getTitleColorForState(a);var b=this._titleLabel=this.getTitleLabelForState(a);b&&b.setString&&b.setString(this._currentTitle);b&&b.setColor(this._currentTitleColor);var c=this.getContentSize();b&&b.setPosition(c.width/ 2,c.height/2);(a=this._backgroundSprite=this.getBackgroundSpriteForState(a))&&a.setPosition(c.width/2,c.height/2);c=cc.size(0,0);if(b){var d=b.getBoundingBox();c.width=d.width;c.height=d.height}this._doesAdjustBackgroundImage?a&&a.setContentSize(c.width+2*this._marginH,c.height+2*this._marginV):a&&(d=a.getPreferredSize(),d=cc.size(d.width,d.height),0>=d.width&&(d.width=c.width),0>=d.height&&(d.height=c.height),a.setContentSize(d));c=b?b.getBoundingBox():cc.rect(0,0,0,0);d=a?a.getBoundingBox():cc.rect(0, 0,0,0);c=cc.rectUnion(c,d);this.setContentSize(c.width,c.height);c=this.getContentSize();b&&(b.setPosition(c.width/2,c.height/2),b.setVisible(!0));a&&(a.setPosition(c.width/2,c.height/2),a.setVisible(!0))}},initWithLabelAndBackgroundSprite:function(a,b){if(!a)throw Error("cc.ControlButton.initWithLabelAndBackgroundSprite(): label should be non-null");if(!b)throw Error("cc.ControlButton.initWithLabelAndBackgroundSprite(): backgroundSprite should be non-null");if(cc.Control.prototype.init.call(this, !0)){this._parentInited=!0;this._titleDispatchTable={};this._titleColorDispatchTable={};this._titleLabelDispatchTable={};this._backgroundSpriteDispatchTable={};this._isPushed=!1;this.zoomOnTouchDown=!0;this._currentTitle=null;this.setAdjustBackgroundImage(!0);this.setPreferredSize(cc.size(0,0));this.zoomOnTouchDown=!0;this.ignoreAnchorPointForPosition(!1);this.setAnchorPoint(0.5,0.5);this._titleLabel=a;this._backgroundSprite=b;this.setOpacity(255);this.setOpacityModifyRGB(!0);var c=a.getString(); this.setTitleForState(c,cc.CONTROL_STATE_NORMAL);this.setTitleColorForState(a.getColor(),cc.CONTROL_STATE_NORMAL);this.setTitleLabelForState(a,cc.CONTROL_STATE_NORMAL);this.setBackgroundSpriteForState(b,cc.CONTROL_STATE_NORMAL);this._state=cc.CONTROL_STATE_NORMAL;this._marginH=24;this._marginV=12;this._labelAnchorPoint=cc.p(0.5,0.5);this.setPreferredSize(cc.size(0,0));this.needsLayout();return!0}return!1},initWithTitleAndFontNameAndFontSize:function(a,b,c){a=new cc.LabelTTF(a,b,c);return this.initWithLabelAndBackgroundSprite(a, new cc.Scale9Sprite)},initWithBackgroundSprite:function(a){var b=new cc.LabelTTF("","Arial",30);return this.initWithLabelAndBackgroundSprite(b,a)},doesAdjustBackgroundImage:function(){return this._doesAdjustBackgroundImage},setAdjustBackgroundImage:function(a){this._doesAdjustBackgroundImage=a;this.needsLayout()},getZoomOnTouchDown:function(){return this.zoomOnTouchDown},setZoomOnTouchDown:function(a){return this.zoomOnTouchDown=a},getPreferredSize:function(){return this._preferredSize},setPreferredSize:function(a){if(0=== a.width&&0===a.height)this._doesAdjustBackgroundImage=!0;else{this._doesAdjustBackgroundImage=!1;var b=this._backgroundSpriteDispatchTable,c;for(c in b)b[c].setPreferredSize(a)}this._preferredSize=a;this.needsLayout()},getLabelAnchorPoint:function(){return this._labelAnchorPoint},setLabelAnchorPoint:function(a){this._labelAnchorPoint=a;this._titleLabel&&this._titleLabel.setAnchorPoint(a)},_getCurrentTitle:function(){return this._currentTitle},_getCurrentTitleColor:function(){return this._currentTitleColor}, getOpacity:function(){return this._opacity},setOpacity:function(a){cc.Control.prototype.setOpacity.call(this,a);var b=this._backgroundSpriteDispatchTable,c;for(c in b)b[c].setOpacity(a)},setColor:function(a){cc.Control.prototype.setColor.call(this,a);var b=this._backgroundSpriteDispatchTable,c;for(c in b)b[c].setColor(a)},getColor:function(){var a=this._realColor;return cc.color(a.r,a.g,a.b,a.a)},isPushed:function(){return this._isPushed},_getVerticalMargin:function(){return this._marginV},_getHorizontalOrigin:function(){return this._marginH}, setMargins:function(a,b){this._marginV=b;this._marginH=a;this.needsLayout()},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);this.needsLayout()},setSelected:function(a){cc.Control.prototype.setSelected.call(this,a);this.needsLayout()},setHighlighted:function(a){this._state=a?cc.CONTROL_STATE_HIGHLIGHTED:cc.CONTROL_STATE_NORMAL;cc.Control.prototype.setHighlighted.call(this,a);(a=this.getActionByTag(cc.CONTROL_ZOOM_ACTION_TAG))&&this.stopAction(a);this.zoomOnTouchDown&&(a=this.isHighlighted()&& this.isEnabled()&&!this.isSelected()?1.1:1,a=cc.scaleTo(0.05,a),a.setTag(cc.CONTROL_ZOOM_ACTION_TAG),this.runAction(a))},onTouchBegan:function(a,b){if(!(this.isTouchInside(a)&&this.isEnabled()&&this.isVisible()&&this.hasVisibleParents()))return!1;this._isPushed=!0;this.setHighlighted(!0);this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DOWN);return!0},onTouchMoved:function(a,b){if(this._enabled&&this._isPushed&&!this._selected){var c=this.isTouchInside(a);c&&!this._highlighted?(this.setHighlighted(!0), this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_ENTER)):c&&this._highlighted?this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_INSIDE):!c&&this._highlighted?(this.setHighlighted(!1),this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_EXIT)):c||this._highlighted||this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_OUTSIDE)}else this._highlighted&&this.setHighlighted(!1)},onTouchEnded:function(a,b){this._isPushed=!1;this.setHighlighted(!1);this.isTouchInside(a)? this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_UP_INSIDE):this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_UP_OUTSIDE)},onTouchCancelled:function(a,b){this._isPushed=!1;this.setHighlighted(!1);this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_CANCEL)},getTitleForState:function(a){var b=this._titleDispatchTable;return b?b[a]?b[a]:b[cc.CONTROL_STATE_NORMAL]:""},setTitleForState:function(a,b){this._titleDispatchTable[b]=a||"";this.getState()===b&&this.needsLayout()},getTitleColorForState:function(a){return(a= this._titleColorDispatchTable[a])?a:(a=this._titleColorDispatchTable[cc.CONTROL_STATE_NORMAL])?a:cc.color.WHITE},setTitleColorForState:function(a,b){this._titleColorDispatchTable[b]=a;this.getState()===b&&this.needsLayout()},getTitleLabelForState:function(a){var b=this._titleLabelDispatchTable;return b[a]?b[a]:b[cc.CONTROL_STATE_NORMAL]},setTitleLabelForState:function(a,b){var c=this._titleLabelDispatchTable;if(c[b]){var d=c[b];d&&this.removeChild(d,!0)}c[b]=a;a.setVisible(!1);a.setAnchorPoint(0.5, 0.5);this.addChild(a,1);this.getState()===b&&this.needsLayout()},setTitleTTFForState:function(a,b){var c=this.getTitleForState(b);c||(c="");this.setTitleLabelForState(new cc.LabelTTF(c,a,12),b)},getTitleTTFForState:function(a){a=this.getTitleLabelForState(a);return null!=a&&a instanceof cc.LabelTTF?a.getFontName():""},setTitleTTFSizeForState:function(a,b){var c=this.getTitleLabelForState(b);null!=c&&c instanceof cc.LabelTTF&&c.setFontSize(a)},getTitleTTFSizeForState:function(a){a=this.getTitleLabelForState(a); return null!=a&&a instanceof cc.LabelTTF?a.getFontSize():0},setTitleBMFontForState:function(a,b){var c=this.getTitleForState(b);c||(c="");this.setTitleLabelForState(new cc.LabelBMFont(c,a),b)},getTitleBMFontForState:function(a){a=this.getTitleLabelForState(a);return null!=a&&a instanceof cc.LabelBMFont?a.getFntFile():""},getBackgroundSpriteForState:function(a){var b=this._backgroundSpriteDispatchTable;return b[a]?b[a]:b[cc.CONTROL_STATE_NORMAL]},setBackgroundSpriteForState:function(a,b){var c=this._backgroundSpriteDispatchTable; if(c[b]){var d=c[b];d&&this.removeChild(d,!0)}c[b]=a;a.setVisible(!1);a.setAnchorPoint(0.5,0.5);this.addChild(a);c=this._preferredSize;0===c.width&&0===c.height||a.setPreferredSize(c);this._state===b&&this.needsLayout()},setBackgroundSpriteFrameForState:function(a,b){var c=cc.Scale9Sprite.createWithSpriteFrame(a);this.setBackgroundSpriteForState(c,b)}});_p=cc.ControlButton.prototype;cc.defineGetterSetter(_p,"adjustBackground",_p.getAdjustBackgroundImage,_p.setAdjustBackgroundImage); cc.defineGetterSetter(_p,"preferredSize",_p.getPreferredSize,_p.setPreferredSize);cc.defineGetterSetter(_p,"labelAnchor",_p.getLabelAnchorPoint,_p.setLabelAnchorPoint);_p=null;cc.ControlButton.create=function(a,b,c){return new cc.ControlButton(a,b,c)};cc.RGBA=function(a,b,c,d){this.r=a;this.g=b;this.b=c;this.a=d};cc.HSV=function(a,b,c){this.h=a;this.s=b;this.v=c};cc.ControlUtils={};cc.ControlUtils.addSpriteToTargetWithPosAndAnchor=function(a,b,c,d){a=new cc.Sprite("#"+a);if(!a)return null;a.setPosition(c);a.setAnchorPoint(d);b.addChild(a);return a}; cc.ControlUtils.HSVfromRGB=function(a){var b=new cc.HSV,c,d;c=a.r<a.g?a.r:a.g;c=c<a.b?c:a.b;d=a.r>a.g?a.r:a.g;d=d>a.b?d:a.b;b.v=d;c=d-c;if(0<d)b.s=c/d;else return b.s=0,b.h=-1,b;b.h=a.r>=d?(a.g-a.b)/c:a.g>=d?2+(a.b-a.r)/c:4+(a.r-a.g)/c;b.h*=60;0>b.h&&(b.h+=360);return b}; cc.ControlUtils.RGBfromHSV=function(a){var b,c,d,e,f=new cc.RGBA;f.a=1;if(0>=a.s){if(!a.h)return f.r=a.v,f.g=a.v,f.b=a.v,f;f.r=0;f.g=0;f.b=0;return f}b=a.h;360<=b&&(b=0);b/=60;e=0|b;d=b-e;b=a.v*(1-a.s);c=a.v*(1-a.s*d);d=a.v*(1-a.s*(1-d));switch(e){case 0:f.r=a.v;f.g=d;f.b=b;break;case 1:f.r=c;f.g=a.v;f.b=b;break;case 2:f.r=b;f.g=a.v;f.b=d;break;case 3:f.r=b;f.g=c;f.b=a.v;break;case 4:f.r=d;f.g=b;f.b=a.v;break;default:f.r=a.v,f.g=b,f.b=c}return f}; cc.ControlUtils.CCRectUnion=function(a,b){return cc.rectUnion(a,b)};cc.Invocation=cc.Class.extend({_action:null,_target:null,_controlEvent:null,ctor:function(a,b,c){this._target=a;this._action=b;this._controlEvent=c},getAction:function(){return this._action},getTarget:function(){return this._target},getControlEvent:function(){return this._controlEvent},invoke:function(a){if(this._target&&this._action)if(cc.isString(this._action))this._target[this._action](a,this._controlEvent);else this._action.call(this._target,a,this._controlEvent)}});cc.Spacer=cc.Layer.extend({});cc.Spacer.verticalSpacer=function(a){var b=new cc.Spacer;b.init();b.setContentSize(0,a);return b};cc.Spacer.horizontalSpacer=function(a){var b=new cc.Spacer;b.init();b.setContentSize(a,0);return b}; cc.MenuPassive=cc.Layer.extend({_color:null,_opacity:0,_className:"MenuPassive",ctor:function(){},getColor:function(){var a=this._color;return cc.color(a.r,a.g,a.b,a.a)},setColor:function(a){var b=this._color;b.r=a.r;b.g=a.g;b.b=a.b;if(this._children&&0<this._children.length)for(b=0;b<this._children.length;b++)this._children[b]&&this._children[b].setColor(a);void 0===a.a||a.a_undefined||this.setOpacity(a.a)},getOpacity:function(){return this._opacity},setOpacity:function(a){this._opacity=a;if(this._children&& 0<this._children.length)for(var b=0;b<this._children.length;b++)this._children[b]&&this._children[b].setOpacity(a);this._color.a=a},initWithItems:function(a,b){if(this.init()){var c=cc.director.getWinSize();this.ignoreAnchorPointForPosition(!0);this.setAnchorPoint(0.5,0.5);this.setContentSize(c);this.setPosition(c.width/2,c.height/2);c=0;if(a){this.addChild(a,c);for(var d=0;d<b.length;d++)b[d]&&(c++,this.addChild(b[d],c))}return!0}return!1},alignItemsVertically:function(){this.alignItemsVerticallyWithPadding(cc.DEFAULT_PADDING)}, alignItemsVerticallyWithPadding:function(a){var b=-a,c;if(this._children&&0<this._children.length)for(c=0;c<this._children.length;c++)this._children[c]&&(b+=this._children[c].getContentSize().height*this._children[c].getScaleY()+a);var d=0,e=b/2;if(this._children&&0<this._children.length)for(c=0;c<this._children.length;c++)this._children[c]&&(d=Math.max(d,this._children[c].getContentSize().width),this._children[c].setPosition(0,e-this._children[c].getContentSize().height*this._children[c].getScaleY()/ 2),e-=this._children[c].getContentSize().height*this._children[c].getScaleY()+a);this.setContentSize(d,b)},alignItemsHorizontally:function(){this.alignItemsHorizontallyWithPadding(cc.DEFAULT_PADDING)},alignItemsHorizontallyWithPadding:function(a){var b=-a,c;if(this._children&&0<this._children.length)for(c=0;c<this._children.length;c++)this._children[c]&&(b+=this._children[c].getContentSize().width*this._children[c].getScaleX()+a);var d=0,e=-b/2;if(this._children&&0<this._children.length)for(c=0;c< this._children.length;c++)this._children[c]&&(d=Math.max(d,this._children[c].getContentSize().height),this._children[c].setPosition(e+this._children[c].getContentSize().width*this._children[c].getScaleX()/2,0),e+=this._children[c].getContentSize().width*this._children[c].getScaleX()+a);this.setContentSize(b,d)},alignItemsInColumns:function(a){var b=[],c;for(c=1;c<arguments.length;c++)b.push(arguments[c]);var d=-5,e=0,f=0,g=0,h,k;if(this._children&&0<this._children.length)for(c=0;c<this._children.length;c++)this._children[c]&& (e>=b.length?cc.log("cc.MenuPassive.alignItemsInColumns(): invalid row index"):(h=b[e])?(k=this._children[c].getContentSize().height,f=0|(f>=k||null==k?f:k),++g,g>=h&&(d+=f+5,f=g=0,++e)):cc.log("cc.MenuPassive.alignItemsInColumns(): can not have zero columns on a row"));var m=cc.director.getWinSize(),n=h=f=e=0,p=0,d=d/2;if(this._children&&0<this._children.length)for(c=0;c<this._children.length;c++)this._children[c]&&(0===h&&(h=b[e],p=n=m.width/(1+h)),k=this._children[c].getContentSize().height,f= 0|(f>=k||null==k?f:k),this._children[c].setPosition(p-m.width/2,d-this._children[c].getContentSize().height/2),p+=n,++g,g>=h&&(d-=f+5,f=h=g=0,++e))},alignItemsInRows:function(a){var b=[],c;for(c=1;c<arguments.length;c++)b.push(arguments[c]);var d=[],e=[],f=-10,g=-5,h=0,k=0,m=0,n,p;if(this._children&&0<this._children.length)for(c=0;c<this._children.length;c++)this._children[c]&&(h>=b.length?cc.log("cc.MenuPassive.alignItemsInRows(): invalid row index"):(n=b[h])?(p=this._children[c].getContentSize().width, k=0|(k>=p||null==p?k:p),g+=0|this._children[c].getContentSize().height+5,++m,m>=n&&(d.push(k),e.push(g),f+=k+10,k=m=0,g=-5,++h)):cc.log("cc.MenuPassive.alignItemsInColumns(): can't have zero rows on a column"));g=cc.director.getWinSize();k=h=0;n=null;var f=-f/2,r=0;if(this._children&&0<this._children.length)for(c=0;c<this._children.length;c++)this._children[c]&&(null==n&&(n=b[h],r=e[h]),p=this._children[c].getContentSize().width,k=0|(k>=p||null==p?k:p),this._children[c].setPosition(f+d[h]/2,r-g.height/ 2),r-=this._children[c].getContentSize().height+10,++m,m>=n&&(f+=k+5,k=n=m=0,++h))},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1}});cc.MenuPassive.create=function(a){a||(a=null);for(var b=[],c=1;c<arguments.length;c++)b.push(arguments[c]);return(c=new cc.MenuPassive)&&c.initWithItems(a,b)?c:null};cc.MenuPassive.createWithItem=function(a){return cc.MenuPassive.create(a,null)};cc.ControlSaturationBrightnessPicker=cc.Control.extend({_saturation:0,_brightness:0,_background:null,_overlay:null,_shadow:null,_slider:null,_startPos:null,_boxPos:0,_boxSize:0,_className:"ControlSaturationBrightnessPicker",ctor:function(a,b){cc.Control.prototype.ctor.call(this);b&&this.initWithTargetAndPos(a,b)},getSaturation:function(){return this._saturation},getBrightness:function(){return this._brightness},getBackground:function(){return this._background},getOverlay:function(){return this._brightness}, getShadow:function(){return this._shadow},getSlider:function(){return this._slider},getStartPos:function(){return this._startPos},initWithTargetAndPos:function(a,b){return cc.Control.prototype.init.call(this)?(this._background=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPickerBackground.png",a,b,cc.p(0,0)),this._overlay=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPickerOverlay.png",a,b,cc.p(0,0)),this._shadow=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPickerShadow.png", a,b,cc.p(0,0)),this._slider=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPicker.png",a,b,cc.p(0.5,0.5)),this._startPos=b,this._boxPos=35,this._boxSize=this._background.getContentSize().width/2,!0):!1},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);this._slider&&this._slider.setOpacity(a?255:128)},updateWithHSV:function(a){var b=new cc.HSV;b.s=1;b.h=a.h;b.v=1;a=cc.ControlUtils.RGBfromHSV(b);this._background.setColor(cc.color(0|255*a.r,0|255*a.g,0|255*a.b))},updateDraggerWithHSV:function(a){a= cc.p(this._startPos.x+this._boxPos+this._boxSize*(1-a.s),this._startPos.y+this._boxPos+this._boxSize*a.v);this._updateSliderPosition(a)},_updateSliderPosition:function(a){var b=this._startPos.x+0.5*this._background.getBoundingBox().width,c=this._startPos.y+0.5*this._background.getBoundingBox().height,d=a.x-b,e=a.y-c,f=Math.sqrt(d*d+e*e),d=Math.atan2(e,d),e=0.5*this._background.getBoundingBox().width;f>e&&(a.x=b+e*Math.cos(d),a.y=c+e*Math.sin(d));this._slider.setPosition(a);a.x<this._startPos.x+this._boxPos? a.x=this._startPos.x+this._boxPos:a.x>this._startPos.x+this._boxPos+this._boxSize-1&&(a.x=this._startPos.x+this._boxPos+this._boxSize-1);a.y<this._startPos.y+this._boxPos?a.y=this._startPos.y+this._boxPos:a.y>this._startPos.y+this._boxPos+this._boxSize&&(a.y=this._startPos.y+this._boxPos+this._boxSize);this._saturation=1-Math.abs((this._startPos.x+this._boxPos-a.x)/this._boxSize);this._brightness=Math.abs((this._startPos.y+this._boxPos-a.y)/this._boxSize)},_checkSliderPosition:function(a){var b=this._startPos.x+ 0.5*this._background.getBoundingBox().width,c=this._startPos.y+0.5*this._background.getBoundingBox().height,b=a.x-b,c=a.y-c;return Math.sqrt(b*b+c*c)<=0.5*this._background.getBoundingBox().width?(this._updateSliderPosition(a),this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED),!0):!1},onTouchBegan:function(a,b){if(!this.isEnabled()||!this.isVisible())return!1;var c=this.getTouchLocation(a);return this._checkSliderPosition(c)},onTouchMoved:function(a,b){var c=this.getTouchLocation(a);this._checkSliderPosition(c)}}); _p=cc.ControlSaturationBrightnessPicker.prototype;cc.defineGetterSetter(_p,"saturation",_p.getSaturation);cc.defineGetterSetter(_p,"brightness",_p.getBrightness);cc.defineGetterSetter(_p,"background",_p.getBackground);cc.defineGetterSetter(_p,"overlay",_p.getOverlay);cc.defineGetterSetter(_p,"shadow",_p.getShadow);cc.defineGetterSetter(_p,"slider",_p.getSlider);cc.defineGetterSetter(_p,"startPos",_p.getStartPos);_p=null; cc.ControlSaturationBrightnessPicker.create=function(a,b){return new cc.ControlSaturationBrightnessPicker(a,b)};cc.ControlHuePicker=cc.Control.extend({_hue:0,_huePercentage:0,_background:null,_slider:null,_startPos:null,_className:"ControlHuePicker",ctor:function(a,b){cc.Control.prototype.ctor.call(this);b&&this.initWithTargetAndPos(a,b)},getHue:function(){return this._hue},setHue:function(a){this._hue=a;this.setHuePercentage(this._hue/360)},getHuePercentage:function(){return this._huePercentage},setHuePercentage:function(a){this._huePercentage=a;this._hue=360*this._huePercentage;var b=this._background.getBoundingBox(), c=this._startPos.x+0.5*b.width;a=this._startPos.y+0.5*b.height;var b=0.5*b.width-15,d=cc.degreesToRadians(360*this._huePercentage-180),c=c+b*Math.cos(d);a+=b*Math.sin(d);this._slider.setPosition(c,a)},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);this._slider&&this._slider.setOpacity(a?255:128)},getBackground:function(){return this._background},getSlider:function(){return this._slider},getStartPos:function(){return this._startPos},initWithTargetAndPos:function(a,b){return cc.Control.prototype.init.call(this)? (this._background=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("huePickerBackground.png",a,b,cc.p(0,0)),this._slider=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPicker.png",a,b,cc.p(0.5,0.5)),this._slider.setPosition(b.x,b.y+0.5*this._background.getBoundingBox().height),this._startPos=b,this._huePercentage=this._hue=0,!0):!1},_updateSliderPosition:function(a){var b=this._background.getBoundingBox();a=Math.atan2(a.y-(this._startPos.y+0.5*b.height),a.x-(this._startPos.x+0.5*b.width)); a=cc.radiansToDegrees(a)+180;this.setHue(a);this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},_checkSliderPosition:function(a){var b=Math.sqrt(Math.pow(a.x+10,2)+Math.pow(a.y,2));return 80>b&&59<b?(this._updateSliderPosition(a),!0):!1},onTouchBegan:function(a,b){if(!this.isEnabled()||!this.isVisible())return!1;var c=this.getTouchLocation(a);return this._checkSliderPosition(c)},onTouchMoved:function(a,b){var c=this.getTouchLocation(a);this._checkSliderPosition(c)}});_p=cc.ControlHuePicker.prototype; cc.defineGetterSetter(_p,"hue",_p.getHue,_p.setHue);cc.defineGetterSetter(_p,"huePercent",_p.getHuePercentage,_p.setHuePercentage);cc.defineGetterSetter(_p,"background",_p.getBackground);cc.defineGetterSetter(_p,"slider",_p.getSlider);cc.defineGetterSetter(_p,"startPos",_p.getStartPos);_p=null;cc.ControlHuePicker.create=function(a,b){return new cc.ControlHuePicker(a,b)};cc.ControlColourPicker=cc.Control.extend({_hsv:null,_colourPicker:null,_huePicker:null,_background:null,_className:"ControlColourPicker",ctor:function(){cc.Control.prototype.ctor.call(this);this.init()},hueSliderValueChanged:function(a,b){this._hsv.h=a.getHue();var c=cc.ControlUtils.RGBfromHSV(this._hsv);cc.Control.prototype.setColor.call(this,cc.color(0|255*c.r,0|255*c.g,0|255*c.b));this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED);this._updateControlPicker()},colourSliderValueChanged:function(a, b){this._hsv.s=a.getSaturation();this._hsv.v=a.getBrightness();var c=cc.ControlUtils.RGBfromHSV(this._hsv);cc.Control.prototype.setColor.call(this,cc.color(0|255*c.r,0|255*c.g,0|255*c.b));this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},setColor:function(a){cc.Control.prototype.setColor.call(this,a);var b=new cc.RGBA;b.r=a.r/255;b.g=a.g/255;b.b=a.b/255;b.a=1;this._hsv=cc.ControlUtils.HSVfromRGB(b);this._updateHueAndControlPicker()},getBackground:function(){return this._background}, init:function(){if(cc.Control.prototype.init.call(this)){cc.spriteFrameCache.addSpriteFrames(res.CCControlColourPickerSpriteSheet_plist);var a=new cc.SpriteBatchNode(res.CCControlColourPickerSpriteSheet_png);this.addChild(a);this._hsv=new cc.HSV(0,0,0);this._background=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("menuColourPanelBackground.png",a,cc.p(0,0),cc.p(0.5,0.5));var b=cc.pSub(this._background.getPosition(),cc.p(this._background.getContentSize().width/2,this._background.getContentSize().height/ 2));this._huePicker=new cc.ControlHuePicker(a,cc.p(b.x+8,b.y+8));this._colourPicker=new cc.ControlSaturationBrightnessPicker(a,cc.p(b.x+28,b.y+28));this._huePicker.addTargetWithActionForControlEvents(this,this.hueSliderValueChanged,cc.CONTROL_EVENT_VALUECHANGED);this._colourPicker.addTargetWithActionForControlEvents(this,this.colourSliderValueChanged,cc.CONTROL_EVENT_VALUECHANGED);this._updateHueAndControlPicker();this.addChild(this._huePicker);this.addChild(this._colourPicker);this.setContentSize(this._background.getContentSize()); return!0}return!1},_updateControlPicker:function(){this._huePicker.setHue(this._hsv.h);this._colourPicker.updateWithHSV(this._hsv)},_updateHueAndControlPicker:function(){this._huePicker.setHue(this._hsv.h);this._colourPicker.updateWithHSV(this._hsv);this._colourPicker.updateDraggerWithHSV(this._hsv)},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);null!==this._huePicker&&this._huePicker.setEnabled(a);this._colourPicker&&this._colourPicker.setEnabled(a)},onTouchBegan:function(){return!1}}); _p=cc.ControlColourPicker.prototype;cc.defineGetterSetter(_p,"background",_p.getBackground);_p=null;cc.ControlColourPicker.create=function(){return new cc.ControlColourPicker};var res=res||{};res.CCControlColourPickerSpriteSheet_plist=res.CCControlColourPickerSpriteSheet_plist||"res/extensions/CCControlColourPickerSpriteSheet.plist";res.CCControlColourPickerSpriteSheet_png=res.CCControlColourPickerSpriteSheet_png||"res/extensions/CCControlColourPickerSpriteSheet.png";cc.SLIDER_MARGIN_H=24;cc.SLIDER_MARGIN_V=8; cc.ControlSlider=cc.Control.extend({_value:0,_minimumValue:0,_maximumValue:0,_minimumAllowedValue:0,_maximumAllowedValue:0,_thumbSprite:null,_progressSprite:null,_backgroundSprite:null,_className:"ControlSlider",ctor:function(a,b,c){cc.Control.prototype.ctor.call(this);void 0!=c&&(a=new cc.Sprite(a),b=new cc.Sprite(b),c=new cc.Sprite(c),this.initWithSprites(a,b,c))},getValue:function(){return this._value},setValue:function(a){a=Math.max(a,this._minimumValue);this._value=a=Math.min(a,this._maximumValue); this.needsLayout();this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},getMinimumValue:function(){return this._minimumValue},setMinimumValue:function(a){this._minimumAllowedValue=this._minimumValue=a;this._minimumValue>=this._maximumValue&&(this._maximumValue=this._minimumValue+1);this.setValue(this._value)},getMaximumValue:function(){return this._maximumValue},setMaximumValue:function(a){this._maximumAllowedValue=this._maximumValue=a;this._maximumValue<=this._minimumValue&&(this._minimumValue= this._maximumValue-1);this.setValue(this._value)},isTouchInside:function(a){a=a.getLocation();a=this.getParent().convertToNodeSpace(a);var b=this.getBoundingBox();b.width+=this._thumbSprite.getContentSize().width;b.x-=this._thumbSprite.getContentSize().width/2;return cc.rectContainsPoint(b,a)},locationFromTouch:function(a){a=a.getLocation();a=this.convertToNodeSpace(a);0>a.x?a.x=0:a.x>this._backgroundSprite.getContentSize().width&&(a.x=this._backgroundSprite.getContentSize().width);return a},getMinimumAllowedValue:function(){return this._minimumAllowedValue}, setMinimumAllowedValue:function(a){this._minimumAllowedValue=a},getMaximumAllowedValue:function(){return this._maximumAllowedValue},setMaximumAllowedValue:function(a){this._maximumAllowedValue=a},getThumbSprite:function(){return this._thumbSprite},getProgressSprite:function(){return this._progressSprite},getBackgroundSprite:function(){return this._backgroundSprite},initWithSprites:function(a,b,c){return cc.Control.prototype.init.call(this)?(this.ignoreAnchorPointForPosition(!1),this._backgroundSprite= a,this._progressSprite=b,this._thumbSprite=c,a=cc.ControlUtils.CCRectUnion(a.getBoundingBox(),c.getBoundingBox()),this.setContentSize(a.width,a.height),this._backgroundSprite.setAnchorPoint(0.5,0.5),this._backgroundSprite.setPosition(a.width/2,a.height/2),this.addChild(this._backgroundSprite),this._progressSprite.setAnchorPoint(0,0.5),this._progressSprite.setPosition(0,a.height/2),this.addChild(this._progressSprite),this._thumbSprite.setPosition(0,a.height/2),this.addChild(this._thumbSprite),this._minimumValue= 0,this._maximumValue=1,this.setValue(this._minimumValue),!0):!1},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);this._thumbSprite&&this._thumbSprite.setOpacity(a?255:128)},sliderBegan:function(a){this.setSelected(!0);this._thumbSprite.setColor(cc.color.GRAY);this.setValue(this.valueForLocation(a))},sliderMoved:function(a){this.setValue(this.valueForLocation(a))},sliderEnded:function(a){this.isSelected()&&this.setValue(this.valueForLocation(this._thumbSprite.getPosition()));this._thumbSprite.setColor(cc.color.WHITE); this.setSelected(!1)},getTouchLocationInControl:function(a){a=a.getLocation();a=this.convertToNodeSpace(a);0>a.x?a.x=0:a.x>this._backgroundSprite.getContentSize().width+cc.SLIDER_MARGIN_H&&(a.x=this._backgroundSprite.getContentSize().width+cc.SLIDER_MARGIN_H);return a},onTouchBegan:function(a,b){if(!this.isTouchInside(a)||!this.isEnabled()||!this.isVisible())return!1;var c=this.locationFromTouch(a);this.sliderBegan(c);return!0},onTouchMoved:function(a,b){var c=this.locationFromTouch(a);this.sliderMoved(c)}, onTouchEnded:function(a,b){this.sliderEnded(cc.p(0,0))},needsLayout:function(){this._thumbSprite.setPositionX((this._value-this._minimumValue)/(this._maximumValue-this._minimumValue)*this._backgroundSprite.getContentSize().width);var a=this._progressSprite.getTextureRect(),a=cc.rect(a.x,a.y,this._thumbSprite.getPositionX(),a.height);this._progressSprite.setTextureRect(a,this._progressSprite.isTextureRectRotated());this._thumbSprite._renderCmd.transform(this._renderCmd)},valueForLocation:function(a){a= a.x/this._backgroundSprite.getContentSize().width;return Math.max(Math.min(this._minimumValue+a*(this._maximumValue-this._minimumValue),this._maximumAllowedValue),this._minimumAllowedValue)}});_p=cc.ControlSlider.prototype;cc.defineGetterSetter(_p,"value",_p.getValue,_p.setValue);cc.defineGetterSetter(_p,"minValue",_p.getMinimumValue,_p.setMinimumValue);cc.defineGetterSetter(_p,"maxValue",_p.getMaximumValue,_p.setMaximumValue);cc.defineGetterSetter(_p,"minAllowedValue",_p.getMinimumAllowedValue,_p.setMinimumAllowedValue); cc.defineGetterSetter(_p,"maxAllowedValue",_p.getMaximumAllowedValue,_p.setMaximumAllowedValue);cc.defineGetterSetter(_p,"thumbSprite",_p.getThumbSprite);cc.defineGetterSetter(_p,"progressSprite",_p.getProgressSprite);cc.defineGetterSetter(_p,"backgroundSprite",_p.getBackgroundSprite);_p=null;cc.ControlSlider.create=function(a,b,c){return new cc.ControlSlider(a,b,c)};cc.ControlSwitch=cc.Control.extend({_switchSprite:null,_initialTouchXPosition:0,_moved:!1,_on:!1,_className:"ControlSwitch",ctor:function(a,b,c,d,e,f){cc.Control.prototype.ctor.call(this);f&&this.initWithMaskSprite(a,b,c,d,e,f)},initWithMaskSprite:function(a,b,c,d,e,f){if(!a)throw Error("cc.ControlSwitch.initWithMaskSprite(): maskSprite should be non-null.");if(!b)throw Error("cc.ControlSwitch.initWithMaskSprite(): onSprite should be non-null.");if(!c)throw Error("cc.ControlSwitch.initWithMaskSprite(): offSprite should be non-null."); if(!d)throw Error("cc.ControlSwitch.initWithMaskSprite(): thumbSprite should be non-null.");return this.init()?(this._on=!0,this._switchSprite=new cc.ControlSwitchSprite,this._switchSprite.initWithMaskSprite(a,b,c,d,e,f),this._switchSprite.setPosition(this._switchSprite.getContentSize().width/2,this._switchSprite.getContentSize().height/2),this.addChild(this._switchSprite),this.ignoreAnchorPointForPosition(!1),this.setAnchorPoint(0.5,0.5),this.setContentSize(this._switchSprite.getContentSize()),!0): !1},setOn:function(a,b){b=b||!1;var c=(this._on=a)?this._switchSprite.getOnPosition():this._switchSprite.getOffPosition();b?this._switchSprite.runAction(new cc.ActionTween(0.2,"sliderXPosition",this._switchSprite.getSliderXPosition(),c)):this._switchSprite.setSliderXPosition(c);this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},isOn:function(){return this._on},hasMoved:function(){return this._moved},setEnabled:function(a){this._enabled=a;this._switchSprite.setOpacity(a?255:128)},locationFromTouch:function(a){a= a.getLocation();return a=this.convertToNodeSpace(a)},onTouchBegan:function(a,b){if(!this.isTouchInside(a)||!this.isEnabled()||!this.isVisible())return!1;this._moved=!1;this._initialTouchXPosition=this.locationFromTouch(a).x-this._switchSprite.getSliderXPosition();this._switchSprite.getThumbSprite().setColor(cc.color.GRAY);this._switchSprite.needsLayout();return!0},onTouchMoved:function(a,b){var c=this.locationFromTouch(a),c=cc.p(c.x-this._initialTouchXPosition,0);this._moved=!0;this._switchSprite.setSliderXPosition(c.x)}, onTouchEnded:function(a,b){var c=this.locationFromTouch(a);this._switchSprite.getThumbSprite().setColor(cc.color.WHITE);this.hasMoved()?this.setOn(!(c.x<this._switchSprite.getContentSize().width/2),!0):this.setOn(!this._on,!0)},onTouchCancelled:function(a,b){var c=this.locationFromTouch(a);this._switchSprite.getThumbSprite().setColor(cc.color.WHITE);this.hasMoved()?this.setOn(!(c.x<this._switchSprite.getContentSize().width/2),!0):this.setOn(!this._on,!0)}}); cc.ControlSwitch.create=function(a,b,c,d,e,f){return new cc.ControlSwitch(a,b,c,d,e,f)}; cc.ControlSwitchSprite=cc.Sprite.extend({_sliderXPosition:0,_onPosition:0,_offPosition:0,_textureLocation:0,_maskLocation:0,_maskSize:null,_onSprite:null,_offSprite:null,_thumbSprite:null,_onLabel:null,_offLabel:null,_clipper:null,_stencil:null,_backRT:null,ctor:function(){cc.Sprite.prototype.ctor.call(this);this._maskLocation=this._offPosition=this._onPosition=this._sliderXPosition=0;this._maskSize=cc.size(0,0);this._offLabel=this._onLabel=this._thumbSprite=this._offSprite=this._onSprite=null},initWithMaskSprite:function(a, b,c,d,e,f){return cc.Sprite.prototype.init.call(this)?(this.setSpriteFrame(a.displayFrame()),this._onPosition=0,this._offPosition=-b.getContentSize().width+d.getContentSize().width/2,this._sliderXPosition=this._onPosition,this.setOnSprite(b),this.setOffSprite(c),this.setThumbSprite(d),this.setOnLabel(e),this.setOffLabel(f),this._stencil=a,a=this._maskSize=this._stencil.getContentSize(),this._stencil.setPosition(0,0),this._clipper=new cc.ClippingNode,this._clipper.setAnchorPoint(0.5,0.5),this._clipper.setPosition(a.width/ 2,a.height/2),this._clipper.setStencil(this._stencil),this.addChild(this._clipper),this._clipper.addChild(b),this._clipper.addChild(c),this._clipper.addChild(e),this._clipper.addChild(f),this.addChild(this._thumbSprite),this.needsLayout(),!0):!1},needsLayout:function(){var a=this._maskSize;this._onSprite.setPosition(this._onSprite.getContentSize().width/2+this._sliderXPosition-a.width/2,this._onSprite.getContentSize().height/2-a.height/2);this._offSprite.setPosition(this._onSprite.getContentSize().width+ this._offSprite.getContentSize().width/2+this._sliderXPosition-a.width/2,this._offSprite.getContentSize().height/2-a.height/2);this._onLabel&&this._onLabel.setPosition(this._onSprite.getPositionX()-this._thumbSprite.getContentSize().width/6,this._onSprite.getContentSize().height/2-a.height/2);this._offLabel&&this._offLabel.setPosition(this._offSprite.getPositionX()+this._thumbSprite.getContentSize().width/6,this._offSprite.getContentSize().height/2-a.height/2);this._thumbSprite.setPosition(this._onSprite.getContentSize().width+ this._sliderXPosition,this._maskSize.height/2)},setSliderXPosition:function(a){a<=this._offPosition?a=this._offPosition:a>=this._onPosition&&(a=this._onPosition);this._sliderXPosition=a;this.needsLayout()},getSliderXPosition:function(){return this._sliderXPosition},_getOnSideWidth:function(){return this._onSprite.getContentSize().width},_getOffSideWidth:function(){return this._offSprite.getContentSize().height},updateTweenAction:function(a,b){"sliderXPosition"===b&&this.setSliderXPosition(a)},setOnPosition:function(a){this._onPosition= a},getOnPosition:function(){return this._onPosition},setOffPosition:function(a){this._offPosition=a},getOffPosition:function(){return this._offPosition},setMaskTexture:function(a){this._stencil.setTexture(a)},getMaskTexture:function(){return this._stencil.getTexture()},setTextureLocation:function(a){this._textureLocation=a},getTextureLocation:function(){return this._textureLocation},setMaskLocation:function(a){this._maskLocation=a},getMaskLocation:function(){return this._maskLocation},setOnSprite:function(a){this._onSprite= a},getOnSprite:function(){return this._onSprite},setOffSprite:function(a){this._offSprite=a},getOffSprite:function(){return this._offSprite},setThumbSprite:function(a){this._thumbSprite=a},getThumbSprite:function(){return this._thumbSprite},setOnLabel:function(a){this._onLabel=a},getOnLabel:function(){return this._onLabel},setOffLabel:function(a){this._offLabel=a},getOffLabel:function(){return this._offLabel}});_p=cc.ControlSwitchSprite.prototype; cc.defineGetterSetter(_p,"sliderX",_p.getSliderXPosition,_p.setSliderXPosition);cc.defineGetterSetter(_p,"onPos",_p.getOnPosition,_p.setOnPosition);cc.defineGetterSetter(_p,"offPos",_p.getOffPosition,_p.setOffPosition);cc.defineGetterSetter(_p,"maskTexture",_p.getMaskTexture,_p.setMaskTexture);cc.defineGetterSetter(_p,"maskPos",_p.getMaskLocation,_p.setMaskLocation);cc.defineGetterSetter(_p,"onSprite",_p.getOnSprite,_p.setOnSprite);cc.defineGetterSetter(_p,"offSprite",_p.getOffSprite,_p.setOffSprite); cc.defineGetterSetter(_p,"thumbSprite",_p.getThumbSprite,_p.setThumbSprite);cc.defineGetterSetter(_p,"onLabel",_p.getOnLabel,_p.setOnLabel);cc.defineGetterSetter(_p,"offLabel",_p.getOffLabel,_p.setOffLabel);cc.defineGetterSetter(_p,"onSideWidth",_p._getOnSideWidth);cc.defineGetterSetter(_p,"offSideWidth",_p._getOffSideWidth);_p=null;cc.CONTROL_STEPPER_PARTMINUS=0;cc.CONTROL_STEPPER_PARTPLUS=1;cc.CONTROL_STEPPER_PARTNONE=2;cc.CONTROL_STEPPER_LABELCOLOR_ENABLED=cc.color(55,55,55);cc.CONTROL_STEPPER_LABELCOLOR_DISABLED=cc.color(147,147,147);cc.CONTROL_STEPPER_LABELFONT="CourierNewPSMT";cc.AUTOREPEAT_DELTATIME=0.15;cc.AUTOREPEAT_INCREASETIME_INCREMENT=12; cc.ControlStepper=cc.Control.extend({_minusSprite:null,_plusSprite:null,_minusLabel:null,_plusLabel:null,_value:0,_continuous:!1,_autorepeat:!1,_wraps:!1,_minimumValue:0,_maximumValue:0,_stepValue:0,_touchInsideFlag:!1,_touchedPart:cc.CONTROL_STEPPER_PARTNONE,_autorepeatCount:0,_className:"ControlStepper",ctor:function(a,b){cc.Control.prototype.ctor.call(this);this._plusLabel=this._minusLabel=this._plusSprite=this._minusSprite=null;this._value=0;this._wraps=this._autorepeat=this._continuous=!1;this._stepValue= this._maximumValue=this._minimumValue=0;this._touchInsideFlag=!1;this._touchedPart=cc.CONTROL_STEPPER_PARTNONE;this._autorepeatCount=0;b&&this.initWithMinusSpriteAndPlusSprite(a,b)},initWithMinusSpriteAndPlusSprite:function(a,b){if(!a)throw Error("cc.ControlStepper.initWithMinusSpriteAndPlusSprite(): Minus sprite should be non-null.");if(!b)throw Error("cc.ControlStepper.initWithMinusSpriteAndPlusSprite(): Plus sprite should be non-null.");if(this.init()){this._continuous=this._autorepeat=!0;this._minimumValue= 0;this._maximumValue=100;this._value=0;this._stepValue=1;this._wraps=!1;this.ignoreAnchorPointForPosition(!1);this.setMinusSprite(a);this._minusSprite.setPosition(a.getContentSize().width/2,a.getContentSize().height/2);this.addChild(this._minusSprite);this.setMinusLabel(new cc.LabelTTF("-",cc.CONTROL_STEPPER_LABELFONT,40,cc.size(40,40),cc.TEXT_ALIGNMENT_CENTER,cc.VERTICAL_TEXT_ALIGNMENT_CENTER));this._minusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_DISABLED);this._minusLabel.setPosition(this._minusSprite.getContentSize().width/ 2,this._minusSprite.getContentSize().height/2);this._minusSprite.addChild(this._minusLabel);this.setPlusSprite(b);this._plusSprite.setPosition(a.getContentSize().width+b.getContentSize().width/2,a.getContentSize().height/2);this.addChild(this._plusSprite);this.setPlusLabel(new cc.LabelTTF("+",cc.CONTROL_STEPPER_LABELFONT,40,cc.size(40,40),cc.TEXT_ALIGNMENT_CENTER,cc.VERTICAL_TEXT_ALIGNMENT_CENTER));this._plusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_ENABLED);this._plusLabel.setPosition(this._plusSprite.getContentSize().width/ 2,this._plusSprite.getContentSize().height/2);this._plusSprite.addChild(this._plusLabel);var c=cc.ControlUtils.CCRectUnion(this._minusSprite.getBoundingBox(),this._plusSprite.getBoundingBox());this.setContentSize(this._minusSprite.getContentSize().width+this._plusSprite.getContentSize().height,c.height);return!0}return!1},setWraps:function(a){if(this._wraps=a)this._minusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_ENABLED),this._plusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_ENABLED);this.setValue(this._value)}, getWraps:function(){return this._wraps},setMinimumValue:function(a){if(a>=this._maximumValue)throw Error("cc.ControlStepper.setMinimumValue(): minimumValue should be numerically less than maximumValue.");this._minimumValue=a;this.setValue(this._value)},getMinimumValue:function(){return this._minimumValue},setMaximumValue:function(a){if(a<=this._minimumValue)throw Error("cc.ControlStepper.setMaximumValue(): maximumValue should be numerically less than maximumValue.");this._maximumValue=a;this.setValue(this._value)}, getMaximumValue:function(){return this._maximumValue},setValue:function(a){this.setValueWithSendingEvent(a,!0)},getValue:function(){return this._value},setStepValue:function(a){if(0>=a)throw Error("cc.ControlStepper.setMaximumValue(): stepValue should be numerically greater than 0.");this._stepValue=a},getStepValue:function(){return this._stepValue},isContinuous:function(){return this._continuous},setValueWithSendingEvent:function(a,b){a<this._minimumValue?a=this._wraps?this._maximumValue:this._minimumValue: a>this._maximumValue&&(a=this._wraps?this._minimumValue:this._maximumValue);this._value=a;this._wraps||(this._minusLabel.setColor(a===this._minimumValue?cc.CONTROL_STEPPER_LABELCOLOR_DISABLED:cc.CONTROL_STEPPER_LABELCOLOR_ENABLED),this._plusLabel.setColor(a===this._maximumValue?cc.CONTROL_STEPPER_LABELCOLOR_DISABLED:cc.CONTROL_STEPPER_LABELCOLOR_ENABLED));b&&this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},startAutorepeat:function(){this._autorepeatCount=-1;this.schedule(this.update, cc.AUTOREPEAT_DELTATIME,cc.REPEAT_FOREVER,3*cc.AUTOREPEAT_DELTATIME)},stopAutorepeat:function(){this.unschedule(this.update)},update:function(a){this._autorepeatCount++;this._autorepeatCount<cc.AUTOREPEAT_INCREASETIME_INCREMENT&&0!==this._autorepeatCount%3||(this._touchedPart===cc.CONTROL_STEPPER_PARTMINUS?this.setValueWithSendingEvent(this._value-this._stepValue,this._continuous):this._touchedPart===cc.CONTROL_STEPPER_PARTPLUS&&this.setValueWithSendingEvent(this._value+this._stepValue,this._continuous))}, updateLayoutUsingTouchLocation:function(a){a.x<this._minusSprite.getContentSize().width&&this._value>this._minimumValue?(this._touchedPart=cc.CONTROL_STEPPER_PARTMINUS,this._minusSprite.setColor(cc.color.GRAY),this._plusSprite.setColor(cc.color.WHITE)):a.x>=this._minusSprite.getContentSize().width&&this._value<this._maximumValue?(this._touchedPart=cc.CONTROL_STEPPER_PARTPLUS,this._minusSprite.setColor(cc.color.WHITE),this._plusSprite.setColor(cc.color.GRAY)):(this._touchedPart=cc.CONTROL_STEPPER_PARTNONE, this._minusSprite.setColor(cc.color.WHITE),this._plusSprite.setColor(cc.color.WHITE))},onTouchBegan:function(a,b){if(!this.isTouchInside(a)||!this.isEnabled()||!this.isVisible())return!1;var c=this.getTouchLocation(a);this.updateLayoutUsingTouchLocation(c);this._touchInsideFlag=!0;this._autorepeat&&this.startAutorepeat();return!0},onTouchMoved:function(a,b){if(this.isTouchInside(a)){var c=this.getTouchLocation(a);this.updateLayoutUsingTouchLocation(c);this._touchInsideFlag||(this._touchInsideFlag= !0,this._autorepeat&&this.startAutorepeat())}else this._touchInsideFlag=!1,this._touchedPart=cc.CONTROL_STEPPER_PARTNONE,this._minusSprite.setColor(cc.color.WHITE),this._plusSprite.setColor(cc.color.WHITE),this._autorepeat&&this.stopAutorepeat()},onTouchEnded:function(a,b){this._minusSprite.setColor(cc.color.WHITE);this._plusSprite.setColor(cc.color.WHITE);this._autorepeat&&this.stopAutorepeat();if(this.isTouchInside(a)){var c=this.getTouchLocation(a);this.setValue(this._value+(c.x<this._minusSprite.getContentSize().width? 0-this._stepValue:this._stepValue))}},setMinusSprite:function(a){this._minusSprite=a},getMinusSprite:function(){return this._minusSprite},setPlusSprite:function(a){this._plusSprite=a},getPlusSprite:function(){return this._plusSprite},setMinusLabel:function(a){this._minusLabel=a},getMinusLabel:function(){return this._minusLabel},setPlusLabel:function(a){this._plusLabel=a},getPlusLabel:function(){return this._plusLabel}});_p=cc.ControlStepper.prototype;cc.defineGetterSetter(_p,"wraps",_p.getWraps,_p.setWraps); cc.defineGetterSetter(_p,"value",_p.getValue,_p.setValue);cc.defineGetterSetter(_p,"minValue",_p.getMinimumValue,_p.setMinimumValue);cc.defineGetterSetter(_p,"maxValue",_p.getMaximumValue,_p.setMaximumValue);cc.defineGetterSetter(_p,"stepValue",_p.getStepValue,_p.setStepValue);cc.defineGetterSetter(_p,"continuous",_p.isContinuous);cc.defineGetterSetter(_p,"minusSprite",_p.getMinusSprite,_p.setMinusSprite);cc.defineGetterSetter(_p,"plusSprite",_p.getPlusSprite,_p.setPlusSprite); cc.defineGetterSetter(_p,"minusLabel",_p.getMinusLabel,_p.setMinusLabel);cc.defineGetterSetter(_p,"plusLabel",_p.getPlusLabel,_p.setPlusLabel);_p=null;cc.ControlStepper.create=function(a,b){return new cc.ControlStepper(a,b)};cc.ControlPotentiometer=cc.Control.extend({_thumbSprite:null,_progressTimer:null,_previousLocation:null,_value:0,_minimumValue:0,_maximumValue:1,_className:"ControlPotentiometer",ctor:function(a,b,c){cc.Control.prototype.ctor.call(this);void 0!=c&&(a=new cc.Sprite(a),c=new cc.Sprite(c),b=new cc.ProgressTimer(new cc.Sprite(b)),this.initWithTrackSprite_ProgressTimer_ThumbSprite(a,b,c))},initWithTrackSprite_ProgressTimer_ThumbSprite:function(a,b,c){return this.init()?(this.setProgressTimer(b),this.setThumbSprite(c), this._thumbSprite.setPosition(b.getPosition()),this.addChild(c,2),this.addChild(b,1),this.addChild(a),this.setContentSize(a.getContentSize()),this._minimumValue=0,this._maximumValue=1,this.setValue(this._minimumValue),!0):!1},setEnabled:function(a){this.setEnabled(a);null!==this._thumbSprite&&this._thumbSprite.setOpacity(a?255:128)},setValue:function(a){a<this._minimumValue&&(a=this._minimumValue);a>this._maximumValue&&(a=this._maximumValue);this._value=a;a=(a-this._minimumValue)/(this._maximumValue- this._minimumValue);this._progressTimer.setPercentage(100*a);this._thumbSprite.setRotation(360*a);this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},getValue:function(){return this._value},setMinimumValue:function(a){this._minimumValue=a;this._minimumValue>=this._maximumValue&&(this._maximumValue=this._minimumValue+1);this.setValue(this._maximumValue)},getMinimumValue:function(){return this._minimumValue},setMaximumValue:function(a){this._maximumValue=a;this._maximumValue<=this._minimumValue&& (this._minimumValue=this._maximumValue-1);this.setValue(this._minimumValue)},getMaximumValue:function(){return this._maximumValue},isTouchInside:function(a){a=this.getTouchLocation(a);return this.distanceBetweenPointAndPoint(this._progressTimer.getPosition(),a)<Math.min(this.getContentSize().width/2,this.getContentSize().height/2)},onTouchBegan:function(a,b){if(!this.isTouchInside(a)||!this.isEnabled()||!this.isVisible())return!1;this._previousLocation=this.getTouchLocation(a);this.potentiometerBegan(this._previousLocation); return!0},onTouchMoved:function(a,b){var c=this.getTouchLocation(a);this.potentiometerMoved(c)},onTouchEnded:function(a,b){this.potentiometerEnded(cc.p(0,0))},distanceBetweenPointAndPoint:function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)},angleInDegreesBetweenLineFromPoint_toPoint_toLineFromPoint_toPoint:function(a,b,c,d){var e=d.x-c.x;c=d.y-c.y;a=Math.atan2(b.x-a.x,b.y-a.y);e=Math.atan2(e,c);return 180*(a-e)/Math.PI},potentiometerBegan:function(a){this.setSelected(!0);this.getThumbSprite().setColor(cc.color.GRAY)}, potentiometerMoved:function(a){var b=this.angleInDegreesBetweenLineFromPoint_toPoint_toLineFromPoint_toPoint(this._progressTimer.getPosition(),a,this._progressTimer.getPosition(),this._previousLocation);180<b?b-=360:-180>b&&(b+=360);this.setValue(this._value+b/360*(this._maximumValue-this._minimumValue));this._previousLocation=a},potentiometerEnded:function(a){this.getThumbSprite().setColor(cc.color.WHITE);this.setSelected(!1)},setThumbSprite:function(a){this._thumbSprite=a},getThumbSprite:function(){return this._thumbSprite}, setProgressTimer:function(a){this._progressTimer=a},getProgressTimer:function(){return this._progressTimer},setPreviousLocation:function(a){this._previousLocation=a},getPreviousLocation:function(){return this._previousLocation}});_p=cc.ControlPotentiometer.prototype;cc.defineGetterSetter(_p,"value",_p.getValue,_p.setValue);cc.defineGetterSetter(_p,"minValue",_p.getMinimumValue,_p.setMinimumValue);cc.defineGetterSetter(_p,"maxValue",_p.getMaximumValue,_p.setMaximumValue); cc.defineGetterSetter(_p,"progressTimer",_p.getProgressTimer,_p.setProgressTimer);cc.defineGetterSetter(_p,"thumbSprite",_p.getThumbSprite,_p.setThumbSprite);cc.defineGetterSetter(_p,"prevLocation",_p.getPreviousLocation,_p.setPreviousLocation);_p=null;cc.ControlPotentiometer.create=function(a,b,c){return new cc.ControlPotentiometer(a,b,c)};cc.SCROLLVIEW_DIRECTION_NONE=-1;cc.SCROLLVIEW_DIRECTION_HORIZONTAL=0;cc.SCROLLVIEW_DIRECTION_VERTICAL=1;cc.SCROLLVIEW_DIRECTION_BOTH=2;var SCROLL_DEACCEL_RATE=0.95,SCROLL_DEACCEL_DIST=1,BOUNCE_DURATION=0.15,INSET_RATIO=0.2,MOVE_INCH=0.04375,BOUNCE_BACK_FACTOR=0.35;cc.convertDistanceFromPointToInch=function(a){var b=cc.view,b=(b.getScaleX()+b.getScaleY())/2;return a*b/160};cc.ScrollViewDelegate=cc.Class.extend({scrollViewDidScroll:function(a){},scrollViewDidZoom:function(a){}}); cc.ScrollView=cc.Layer.extend({_zoomScale:0,_minZoomScale:0,_maxZoomScale:0,_delegate:null,_direction:cc.SCROLLVIEW_DIRECTION_BOTH,_dragging:!1,_contentOffset:null,_container:null,_touchMoved:!1,_maxInset:null,_minInset:null,_bounceable:!1,_clippingToBounds:!1,_scrollDistance:null,_touchPoint:null,_touchLength:0,_touches:null,_viewSize:null,_minScale:0,_maxScale:0,_parentScissorRect:null,_scissorRestored:!1,_tmpViewRect:null,_touchListener:null,_className:"ScrollView",ctor:function(a,b){cc.Layer.prototype.ctor.call(this); this._contentOffset=cc.p(0,0);this._maxInset=cc.p(0,0);this._minInset=cc.p(0,0);this._scrollDistance=cc.p(0,0);this._touchPoint=cc.p(0,0);this._touches=[];this._viewSize=cc.size(0,0);this._parentScissorRect=new cc.Rect(0,0,0,0);this._tmpViewRect=new cc.Rect(0,0,0,0);void 0!=b?this.initWithViewSize(a,b):this.initWithViewSize(cc.size(200,200),null)},init:function(){return this.initWithViewSize(cc.size(200,200),null)},initWithViewSize:function(a,b){var c=cc.p(0,0);return cc.Layer.prototype.init.call(this)? (b||this._container||(b=new cc.Layer),b&&this.setContainer(b),this.setViewSize(a),this.setTouchEnabled(!0),this._touches.length=0,this._delegate=null,this._clippingToBounds=this._bounceable=!0,this._direction=cc.SCROLLVIEW_DIRECTION_BOTH,this._container.setPosition(c),this._touchLength=0,this._minScale=this._maxScale=1,!0):!1},visit:function(a){if(this._visible){var b=cc.renderer,c=this._renderCmd;c.visit(a&&a._renderCmd);this._clippingToBounds&&b.pushRenderCommand(c.startCmd);var d=this._children, e=d.length;if(0<e)for(this._reorderChildDirty&&this.sortAllChildren(),a=0;a<e;a++)d[a].visit(this);this._clippingToBounds&&b.pushRenderCommand(c.endCmd);c._dirtyFlag=0}},setContentOffset:function(a,b){if(b)this.setContentOffsetInDuration(a,BOUNCE_DURATION);else{if(!this._bounceable){var c=this.minContainerOffset(),d=this.maxContainerOffset();a.x=Math.max(c.x,Math.min(d.x,a.x));a.y=Math.max(c.y,Math.min(d.y,a.y))}this._container.setPosition(a);c=this._delegate;null!=c&&c.scrollViewDidScroll&&c.scrollViewDidScroll(this)}}, getContentOffset:function(){var a=this._container.getPosition();return cc.p(a.x,a.y)},setContentOffsetInDuration:function(a,b){var c=cc.moveTo(b,a),d=cc.callFunc(this._stoppedAnimatedScroll,this);this._container.runAction(cc.sequence(c,d));this.schedule(this._performedAnimatedScroll)},setZoomScale:function(a,b){if(b)this.setZoomScaleInDuration(a,BOUNCE_DURATION);else{var c=this._container;if(c.getScale()!==a){var d,e;0===this._touchLength?(e=this._viewSize,e=cc.p(0.5*e.width,0.5*e.height),e=this.convertToWorldSpace(e)): e=this._touchPoint;d=c.convertToNodeSpace(e);c.setScale(Math.max(this._minScale,Math.min(this._maxScale,a)));d=c.convertToWorldSpace(d);e=cc.pSub(e,d);this._delegate&&this._delegate.scrollViewDidZoom&&this._delegate.scrollViewDidZoom(this);this.setContentOffset(cc.pAdd(c.getPosition(),e))}}},getZoomScale:function(){return this._container.getScale()},setZoomScaleInDuration:function(a,b){if(0<b){var c=this._container.getScale();c!==a&&(c=cc.actionTween(b,"zoomScale",c,a),this.runAction(c))}else this.setZoomScale(a)}, minContainerOffset:function(){var a=this._container,b=a.getContentSize(),c=this._viewSize;return cc.p(c.width-b.width*a.getScaleX(),c.height-b.height*a.getScaleY())},maxContainerOffset:function(){return cc.p(0,0)},isNodeVisible:function(a){var b=this.getContentOffset(),c=this.getViewSize(),d=this.getZoomScale(),b=cc.rect(-b.x/d,-b.y/d,c.width/d,c.height/d);return cc.rectIntersectsRect(b,a.getBoundingBox())},pause:function(a){this._container.pause();a=this._container.getChildren();for(var b=0;b<a.length;b++)a[b].pause(); this._super()},resume:function(a){a=this._container.getChildren();for(var b=0,c=a.length;b<c;b++)a[b].resume();this._container.resume();this._super()},isDragging:function(){return this._dragging},isTouchMoved:function(){return this._touchMoved},isBounceable:function(){return this._bounceable},setBounceable:function(a){this._bounceable=a},getViewSize:function(){return this._viewSize},setViewSize:function(a){this._viewSize=a;cc.Node.prototype.setContentSize.call(this,a)},getContainer:function(){return this._container}, setContainer:function(a){a&&(this.removeAllChildren(!0),this._container=a,a.ignoreAnchorPointForPosition(!1),a.setAnchorPoint(0,0),this.addChild(a),this.setViewSize(this._viewSize))},getDirection:function(){return this._direction},setDirection:function(a){this._direction=a},getDelegate:function(){return this._delegate},setDelegate:function(a){this._delegate=a},onTouchBegan:function(a,b){for(var c=this;null!=c;c=c.parent)if(!c.isVisible())return!1;var c=this._getViewRect(),d=this._container,e=d.convertToWorldSpace(d.convertTouchToNodeSpace(a)), f=this._touches;if(2<f.length||this._touchMoved||!cc.rectContainsPoint(c,e))return!1;f.push(a);1===f.length?(this._touchPoint=this.convertTouchToNodeSpace(a),this._touchMoved=!1,this._dragging=!0,this._scrollDistance.x=0,this._touchLength=this._scrollDistance.y=0):2===f.length&&(this._touchPoint=cc.pMidpoint(this.convertTouchToNodeSpace(f[0]),this.convertTouchToNodeSpace(f[1])),this._touchLength=cc.pDistance(d.convertTouchToNodeSpace(f[0]),d.convertTouchToNodeSpace(f[1])),this._dragging=!1);return!0}, onTouchMoved:function(a,b){if(this.isVisible())if(this.setNodeDirty(),1===this._touches.length&&this._dragging){this._touchMoved=!0;this._getViewRect();var c=this.convertTouchToNodeSpace(a),d=cc.pSub(c,this._touchPoint),e=0,f=this._direction,g;if(f===cc.SCROLLVIEW_DIRECTION_VERTICAL)e=d.y,g=this._container.getPositionY(),this.minContainerOffset().y<=g&&g<=this.maxContainerOffset().y||(d.y*=BOUNCE_BACK_FACTOR);else if(f===cc.SCROLLVIEW_DIRECTION_HORIZONTAL)e=d.x,g=this._container.getPositionX(),this.minContainerOffset().x<= g&&g<=this.maxContainerOffset().x||(d.x*=BOUNCE_BACK_FACTOR);else{e=Math.sqrt(d.x*d.x+d.y*d.y);g=this._container.getPositionY();var h=this.minContainerOffset(),k=this.maxContainerOffset();h.y<=g&&g<=k.y||(d.y*=BOUNCE_BACK_FACTOR);g=this._container.getPositionX();h.x<=g&&g<=k.x||(d.x*=BOUNCE_BACK_FACTOR)}if(this._touchMoved||!(Math.abs(cc.convertDistanceFromPointToInch(e))<MOVE_INCH))if(this._touchMoved||(d.x=0,d.y=0),this._touchPoint=c,this._touchMoved=!0,this._dragging){switch(f){case cc.SCROLLVIEW_DIRECTION_VERTICAL:d.x= 0;break;case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:d.y=0}e=this._container.getPosition();c=e.x+d.x;e=e.y+d.y;this._scrollDistance=d;this.setContentOffset(cc.p(c,e))}}else 2!==this._touches.length||this._dragging||(d=cc.pDistance(this._container.convertTouchToNodeSpace(this._touches[0]),this._container.convertTouchToNodeSpace(this._touches[1])),this.setZoomScale(this.getZoomScale()*d/this._touchLength))},onTouchEnded:function(a,b){this.isVisible()&&(1===this._touches.length&&this._touchMoved&&this.schedule(this._deaccelerateScrolling), this._touches.length=0,this._touchMoved=this._dragging=!1)},onTouchCancelled:function(a,b){this.isVisible()&&(this._touches.length=0,this._touchMoved=this._dragging=!1)},setContentSize:function(a,b){null!==this.getContainer()&&(void 0===b?this.getContainer().setContentSize(a):this.getContainer().setContentSize(a,b),this.updateInset())},_setWidth:function(a){var b=this.getContainer();null!==b&&(b._setWidth(a),this.updateInset())},_setHeight:function(a){var b=this.getContainer();null!==b&&(b._setHeight(a), this.updateInset())},getContentSize:function(){return this._container.getContentSize()},updateInset:function(){if(null!==this.getContainer()){var a=this._viewSize,b=this.maxContainerOffset();this._maxInset.x=b.x+a.width*INSET_RATIO;this._maxInset.y=b.y+a.height*INSET_RATIO;b=this.minContainerOffset();this._minInset.x=b.x-a.width*INSET_RATIO;this._minInset.y=b.y-a.height*INSET_RATIO}},isClippingToBounds:function(){return this._clippingToBounds},setClippingToBounds:function(a){this._clippingToBounds= a},addChild:function(a,b,c){if(!a)throw Error("child must not nil!");b=b||a.getLocalZOrder();c=c||a.getTag();this._container!==a?this._container.addChild(a,b,c):cc.Layer.prototype.addChild.call(this,a,b,c)},isTouchEnabled:function(){return null!==this._touchListener},setTouchEnabled:function(a){this._touchListener&&cc.eventManager.removeListener(this._touchListener);this._touchListener=null;a?(a=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE}),this.onTouchBegan&&(a.onTouchBegan= this.onTouchBegan.bind(this)),this.onTouchMoved&&(a.onTouchMoved=this.onTouchMoved.bind(this)),this.onTouchEnded&&(a.onTouchEnded=this.onTouchEnded.bind(this)),this.onTouchCancelled&&(a.onTouchCancelled=this.onTouchCancelled.bind(this)),this._touchListener=a,cc.eventManager.addListener(a,this)):(this._touchMoved=this._dragging=!1,this._touches.length=0)},_initWithViewSize:function(a){return null},_relocateContainer:function(a){var b=this.minContainerOffset(),c=this.maxContainerOffset(),d=this._direction, e=this._container.getPosition(),f=e.x,g=e.y;if(d===cc.SCROLLVIEW_DIRECTION_BOTH||d===cc.SCROLLVIEW_DIRECTION_HORIZONTAL)f=Math.max(f,b.x),f=Math.min(f,c.x);if(d===cc.SCROLLVIEW_DIRECTION_BOTH||d===cc.SCROLLVIEW_DIRECTION_VERTICAL)g=Math.min(g,c.y),g=Math.max(g,b.y);g===e.y&&f===e.x||this.setContentOffset(cc.p(f,g),a)},_deaccelerateScrolling:function(a){if(this._dragging)this.unschedule(this._deaccelerateScrolling);else{var b,c;b=this._container.getPosition();a=this._scrollDistance;this._container.setPosition(b.x+ a.x,b.y+a.y);this._bounceable?(b=this._maxInset,c=this._minInset):(b=this.maxContainerOffset(),c=this.minContainerOffset());var d=this._container.getPositionX(),e=this._container.getPositionY();a.x*=SCROLL_DEACCEL_RATE;a.y*=SCROLL_DEACCEL_RATE;this.setContentOffset(cc.p(d,e));if(Math.abs(a.x)<=SCROLL_DEACCEL_DIST&&Math.abs(a.y)<=SCROLL_DEACCEL_DIST||e>b.y||e<c.y||d>b.x||d<c.x||d===b.x||d===c.x||e===b.y||e===c.y)this.unschedule(this._deaccelerateScrolling),this._relocateContainer(!0)}},_performedAnimatedScroll:function(a){this._dragging? this.unschedule(this._performedAnimatedScroll):this._delegate&&this._delegate.scrollViewDidScroll&&this._delegate.scrollViewDidScroll(this)},_stoppedAnimatedScroll:function(a){this.unschedule(this._performedAnimatedScroll);this._delegate&&this._delegate.scrollViewDidScroll&&this._delegate.scrollViewDidScroll(this)},_handleZoom:function(){},_getViewRect:function(){for(var a=this.convertToWorldSpace(cc.p(0,0)),b=this._viewSize,c=this.getScaleX(),d=this.getScaleY(),e=this._parent;null!=e;e=e.getParent())c*= e.getScaleX(),d*=e.getScaleY();0>c&&(a.x+=b.width*c,c=-c);0>d&&(a.y+=b.height*d,d=-d);e=this._tmpViewRect;e.x=a.x;e.y=a.y;e.width=b.width*c;e.height=b.height*d;return e},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.ScrollView.CanvasRenderCmd(this):new cc.ScrollView.WebGLRenderCmd(this)}});_p=cc.ScrollView.prototype;cc.defineGetterSetter(_p,"minOffset",_p.minContainerOffset);cc.defineGetterSetter(_p,"maxOffset",_p.maxContainerOffset); cc.defineGetterSetter(_p,"bounceable",_p.isBounceable,_p.setBounceable);cc.defineGetterSetter(_p,"viewSize",_p.getViewSize,_p.setViewSize);cc.defineGetterSetter(_p,"container",_p.getContainer,_p.setContainer);cc.defineGetterSetter(_p,"direction",_p.getDirection,_p.setDirection);cc.defineGetterSetter(_p,"delegate",_p.getDelegate,_p.setDelegate);cc.defineGetterSetter(_p,"clippingToBounds",_p.isClippingToBounds,_p.setClippingToBounds);_p=null; cc.ScrollView.create=function(a,b){return new cc.ScrollView(a,b)};(function(){cc.ScrollView.CanvasRenderCmd=function(a){this._layerCmdCtor(a);this._needDraw=!1;this.startCmd=new cc.CustomRenderCmd(this,this._startCmd);this.startCmd._canUseDirtyRegion=!0;this.endCmd=new cc.CustomRenderCmd(this,this._endCmd);this.endCmd._canUseDirtyRegion=!0};var a=cc.ScrollView.CanvasRenderCmd.prototype=Object.create(cc.Layer.CanvasRenderCmd.prototype);a.constructor=cc.ScrollView.CanvasRenderCmd;a._startCmd=function(a,c,d){var e=this._node,f=a||cc._renderContext;a=f.getContext(); f.save();e._clippingToBounds&&(this._scissorRestored=!1,f.setTransform(this._worldTransform,c,d),d=e.getScaleX(),c=e.getScaleY(),d*=e._viewSize.width,e=e._viewSize.height*c,a.beginPath(),a.rect(0,0,d,-e),a.closePath(),a.clip())};a._endCmd=function(a){a=a||cc._renderContext;a.restore()}})();(function(){cc.ScrollView.WebGLRenderCmd=function(a){this._layerCmdCtor(a);this._needDraw=!1;this.startCmd=new cc.CustomRenderCmd(this,this._startCmd);this.endCmd=new cc.CustomRenderCmd(this,this._endCmd)};var a=cc.ScrollView.WebGLRenderCmd.prototype=Object.create(cc.Layer.WebGLRenderCmd.prototype);a.constructor=cc.ScrollView.WebGLRenderCmd;a._startCmd=function(){var a=this._node,c=cc.view,d=a._getViewRect();if(c.isScissorEnabled()){if(a._scissorRestored=!0,a._parentScissorRect=c.getScissorRect(), cc.rectIntersection(d,a._parentScissorRect)){var e=a._parentScissorRect,a=Math.max(d.x,e.x),f=Math.max(d.y,e.y),g=Math.min(d.x+d.width,e.x+e.width),d=Math.min(d.y+d.height,e.y+e.height);c.setScissorInPoints(a,f,g-a,d-f)}}else a=cc._renderContext,a.enable(a.SCISSOR_TEST),c.setScissorInPoints(d.x,d.y,d.width,d.height)};a._endCmd=function(){var a=this._node;a._scissorRestored?(a=a._parentScissorRect,cc.view.setScissorInPoints(a.x,a.y,a.width,a.height)):(a=cc._renderContext,a.disable(a.SCISSOR_TEST))}})();cc.SortableObject=cc.Class.extend({setObjectID:function(a){},getObjectID:function(){return 0}});cc.SortedObject=cc.SortableObject.extend({_objectID:0,ctor:function(){this._objectID=0},setObjectID:function(a){this._objectID=a},getObjectID:function(){return this._objectID}});var _compareObject=function(a,b){return a.getObjectID()-b.getObjectID()}; cc.ArrayForObjectSorting=cc.Class.extend({_saveObjectArr:null,ctor:function(){this._saveObjectArr=[]},insertSortedObject:function(a){if(!a)throw Error("cc.ArrayForObjectSorting.insertSortedObject(): addObject should be non-null.");var b=this.indexOfSortedObject(a);this.insertObject(a,b)},removeSortedObject:function(a){if(0!==this.count()){var b=this.indexOfSortedObject(a);b<this.count()&&b!==cc.INVALID_INDEX&&this.objectAtIndex(b).getObjectID()===a.getObjectID()&&this.removeObjectAtIndex(b)}},setObjectID_ofSortedObject:function(a, b){var c=this.indexOfSortedObject(b);if(c<this.count()&&c!==cc.INVALID_INDEX){var d=this.objectAtIndex(c);d.getObjectID()===b.getObjectID()&&(this.removeObjectAtIndex(c),d.setObjectID(a),this.insertSortedObject(d))}},objectWithObjectID:function(a){if(0===this.count())return null;var b=new cc.SortedObject;b.setObjectID(a);var c=this.indexOfSortedObject(b);c<this.count()&&c!==cc.INVALID_INDEX&&(b=this.objectAtIndex(c),b.getObjectID()!==a&&(b=null));return b},getObjectWithObjectID:function(a){return null}, indexOfSortedObject:function(a){var b=0;if(a){var c=0;a=a.getObjectID();for(var d=this._saveObjectArr,e=0;e<d.length;e++){var f=d[e].getObjectID();if(a===f||a>=c&&a<f)break;c=f;b++}}else b=cc.INVALID_INDEX;return b},count:function(){return this._saveObjectArr.length},lastObject:function(){var a=this._saveObjectArr;return 0===a.length?null:a[a.length-1]},objectAtIndex:function(a){return this._saveObjectArr[a]},addObject:function(a){this._saveObjectArr.push(a);this._saveObjectArr.sort(_compareObject)}, removeObjectAtIndex:function(a){this._saveObjectArr.splice(a,1);this._saveObjectArr.sort(_compareObject)},insertObject:function(a,b){this._saveObjectArr.splice(b,0,a);this._saveObjectArr.sort(_compareObject)}});cc.TABLEVIEW_FILL_TOPDOWN=0;cc.TABLEVIEW_FILL_BOTTOMUP=1;cc.TableViewCell=cc.Node.extend({_idx:0,_className:"TableViewCell",getIdx:function(){return this._idx},setIdx:function(a){this._idx=a},reset:function(){this._idx=cc.INVALID_INDEX},setObjectID:function(a){this._idx=a},getObjectID:function(){return this._idx}});_p=cc.TableViewCell.prototype;cc.defineGetterSetter(_p,"objectId",_p.getObjectID,_p.setObjectID);_p=null; cc.TableViewDelegate=cc.ScrollViewDelegate.extend({tableCellTouched:function(a,b){},tableCellHighlight:function(a,b){},tableCellUnhighlight:function(a,b){},tableCellWillRecycle:function(a,b){}});cc.TableViewDataSource=cc.Class.extend({tableCellSizeForIndex:function(a,b){return this.cellSizeForTable(a)},cellSizeForTable:function(a){return cc.size(0,0)},tableCellAtIndex:function(a,b){return null},numberOfCellsInTableView:function(a){return 0}}); cc.TableView=cc.ScrollView.extend({_vOrdering:null,_indices:null,_cellsFreed:null,_dataSource:null,_tableViewDelegate:null,_oldDirection:null,_cellsPositions:null,_touchedCell:null,ctor:function(a,b,c){cc.ScrollView.prototype.ctor.call(this);this._oldDirection=cc.SCROLLVIEW_DIRECTION_NONE;this._cellsPositions=[];this.initWithViewSize(b,c);this.setDataSource(a);this._updateCellPositions();this._updateContentSize()},__indexFromOffset:function(a){var b=0,c=this._dataSource.numberOfCellsInTableView(this)- 1;switch(this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:a=a.x;break;default:a=a.y}for(var d=this._cellsPositions;c>=b;){var e=0|b+(c-b)/2,f=d[e],g=d[e+1];if(a>=f&&a<=g)return e;a<f?c=e-1:b=e+1}return 0>=b?0:-1},_indexFromOffset:function(a){var b={x:a.x,y:a.y};a=this._dataSource.numberOfCellsInTableView(this)-1;this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN&&(b.y=this.getContainer().getContentSize().height-b.y);b=this.__indexFromOffset(b);-1!==b&&(b=Math.max(0,b),b>a&&(b=cc.INVALID_INDEX)); return b},__offsetFromIndex:function(a){switch(this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:a=cc.p(this._cellsPositions[a],0);break;default:a=cc.p(0,this._cellsPositions[a])}return a},_offsetFromIndex:function(a){var b=this.__offsetFromIndex(a);a=this._dataSource.tableCellSizeForIndex(this,a);this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN&&(b.y=this.getContainer().getContentSize().height-b.y-a.height);return b},_updateCellPositions:function(){var a=this._dataSource.numberOfCellsInTableView(this), b=this._cellsPositions;if(0<a){for(var c=0,d,e=this._dataSource,f=0;f<a;f++)switch(b[f]=c,d=e.tableCellSizeForIndex(this,f),this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:c+=d.width;break;default:c+=d.height}this._cellsPositions[a]=c}},_updateContentSize:function(){var a=cc.size(0,0),b=this._dataSource.numberOfCellsInTableView(this);if(0<b)switch(a=this._cellsPositions[b],this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:a=cc.size(a,this._viewSize.height);break;default:a= cc.size(this._viewSize.width,a)}this.setContentSize(a);this._oldDirection!==this._direction&&(this._direction===cc.SCROLLVIEW_DIRECTION_HORIZONTAL?this.setContentOffset(cc.p(0,0)):this.setContentOffset(cc.p(0,this.minContainerOffset().y)),this._oldDirection=this._direction)},_moveCellOutOfSight:function(a){this._tableViewDelegate&&this._tableViewDelegate.tableCellWillRecycle&&this._tableViewDelegate.tableCellWillRecycle(this,a);this._cellsFreed.addObject(a);this._cellsUsed.removeSortedObject(a);cc.arrayRemoveObject(this._indices, a.getIdx());a.reset();a.getParent()===this.getContainer()&&this.getContainer().removeChild(a,!0)},_setIndexForCell:function(a,b){b.setAnchorPoint(0,0);b.setPosition(this._offsetFromIndex(a));b.setIdx(a)},_addCellIfNecessary:function(a){a.getParent()!==this.getContainer()&&this.getContainer().addChild(a);this._cellsUsed.insertSortedObject(a);var b=this._indices;a=a.getIdx();-1===b.indexOf(a)&&(b.push(a),b.sort(function(a,b){return a-b}))},getDataSource:function(){return this._dataSource},setDataSource:function(a){this._dataSource= a},getDelegate:function(){return this._tableViewDelegate},setDelegate:function(a){this._tableViewDelegate=a},setVerticalFillOrder:function(a){this._vOrdering!==a&&(this._vOrdering=a,0<this._cellsUsed.count()&&this.reloadData())},getVerticalFillOrder:function(){return this._vOrdering},initWithViewSize:function(a,b){return cc.ScrollView.prototype.initWithViewSize.call(this,a,b)?(this._cellsUsed=new cc.ArrayForObjectSorting,this._cellsFreed=new cc.ArrayForObjectSorting,this._indices=[],this._tableViewDelegate= null,this._vOrdering=cc.TABLEVIEW_FILL_BOTTOMUP,this.setDirection(cc.SCROLLVIEW_DIRECTION_VERTICAL),cc.ScrollView.prototype.setDelegate.call(this,this),!0):!1},updateCellAtIndex:function(a){if(!(a===cc.INVALID_INDEX||a>this._dataSource.numberOfCellsInTableView(this)-1)){var b=this.cellAtIndex(a);b&&this._moveCellOutOfSight(b);b=this._dataSource.tableCellAtIndex(this,a);this._setIndexForCell(a,b);this._addCellIfNecessary(b)}},insertCellAtIndex:function(a){if(!(a===cc.INVALID_INDEX||a>this._dataSource.numberOfCellsInTableView(this)- 1)){var b,c=this._cellsUsed;if(b=c.objectWithObjectID(a))for(var d=b=c.indexOfSortedObject(b);d<c.count();d++)b=c.objectAtIndex(d),this._setIndexForCell(b.getIdx()+1,b);b=this._dataSource.tableCellAtIndex(this,a);this._setIndexForCell(a,b);this._addCellIfNecessary(b);this._updateCellPositions();this._updateContentSize()}},removeCellAtIndex:function(a){if(!(a===cc.INVALID_INDEX||a>this._dataSource.numberOfCellsInTableView(this)-1)){var b=this.cellAtIndex(a);if(b){var c=this._cellsUsed,d=c.indexOfSortedObject(b); this._moveCellOutOfSight(b);cc.arrayRemoveObject(this._indices,a);this._updateCellPositions();for(a=c.count()-1;a>d;a--)b=c.objectAtIndex(a),this._setIndexForCell(b.getIdx()-1,b)}}},reloadData:function(){this._oldDirection=cc.SCROLLVIEW_DIRECTION_NONE;for(var a=this._cellsUsed,b=this._cellsFreed,c=this.getContainer(),d=0,e=a.count();d<e;d++){var f=a.objectAtIndex(d);this._tableViewDelegate&&this._tableViewDelegate.tableCellWillRecycle&&this._tableViewDelegate.tableCellWillRecycle(this,f);b.addObject(f); f.reset();f.getParent()===c&&c.removeChild(f,!0)}this._indices=[];this._cellsUsed=new cc.ArrayForObjectSorting;this._updateCellPositions();this._updateContentSize();0<this._dataSource.numberOfCellsInTableView(this)&&this.scrollViewDidScroll(this);this.setNodeDirty()},dequeueCell:function(){if(0===this._cellsFreed.count())return null;var a=this._cellsFreed.objectAtIndex(0);this._cellsFreed.removeObjectAtIndex(0);return a},cellAtIndex:function(a){return-1===this._indices.indexOf(a)?null:this._cellsUsed.objectWithObjectID(a)}, scrollViewDidScroll:function(a){var b=this._dataSource.numberOfCellsInTableView(this);if(0!==b){null!==this._tableViewDelegate&&this._tableViewDelegate.scrollViewDidScroll&&this._tableViewDelegate.scrollViewDidScroll(this);var c=0,d=this._viewSize,c=this.getContainer(),e=this.getContentOffset();e.x*=-1;e.y*=-1;var f=Math.max(b-1,0);this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN&&(e.y+=d.height/c.getScaleY());a=this._indexFromOffset(e);a===cc.INVALID_INDEX&&(a=b-1);e.y=this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN? e.y-d.height/c.getScaleY():e.y+d.height/c.getScaleY();e.x+=d.width/c.getScaleX();d=this._indexFromOffset(e);d===cc.INVALID_INDEX&&(d=b-1);e=this._cellsUsed;if(0<e.count())for(b=e.objectAtIndex(0),c=b.getIdx();c<a;)if(this._moveCellOutOfSight(b),0<e.count())b=e.objectAtIndex(0),c=b.getIdx();else break;if(0<e.count())for(b=e.lastObject(),c=b.getIdx();c<=f&&c>d;)if(this._moveCellOutOfSight(b),0<e.count())b=e.lastObject(),c=b.getIdx();else break;for(f=this._indices;a<=d;a++)-1===f.indexOf(a)&&this.updateCellAtIndex(a)}}, scrollViewDidZoom:function(a){},onTouchEnded:function(a,b){if(this.isVisible()){if(this._touchedCell){var c=this.getBoundingBox(),d=cc.p(c.x,c.y),d=this._parent.convertToWorldSpace(d);c.x=d.x;c.y=d.y;d=this._tableViewDelegate;cc.rectContainsPoint(c,a.getLocation())&&null!==d&&(d.tableCellUnhighlight&&d.tableCellUnhighlight(this,this._touchedCell),d.tableCellTouched&&d.tableCellTouched(this,this._touchedCell));this._touchedCell=null}cc.ScrollView.prototype.onTouchEnded.call(this,a,b)}},onTouchBegan:function(a, b){for(var c=this;null!=c;c=c.parent)if(!c.isVisible())return!1;c=cc.ScrollView.prototype.onTouchBegan.call(this,a,b);if(1===this._touches.length){var d;d=this.getContainer().convertTouchToNodeSpace(a);d=this._indexFromOffset(d);(this._touchedCell=d===cc.INVALID_INDEX?null:this.cellAtIndex(d))&&null!==this._tableViewDelegate&&this._tableViewDelegate.tableCellHighlight&&this._tableViewDelegate.tableCellHighlight(this,this._touchedCell)}else this._touchedCell&&(null!==this._tableViewDelegate&&this._tableViewDelegate.tableCellUnhighlight&& this._tableViewDelegate.tableCellUnhighlight(this,this._touchedCell),this._touchedCell=null);return c},onTouchMoved:function(a,b){cc.ScrollView.prototype.onTouchMoved.call(this,a,b);this._touchedCell&&this.isTouchMoved()&&(null!==this._tableViewDelegate&&this._tableViewDelegate.tableCellUnhighlight&&this._tableViewDelegate.tableCellUnhighlight(this,this._touchedCell),this._touchedCell=null)},onTouchCancelled:function(a,b){cc.ScrollView.prototype.onTouchCancelled.call(this,a,b);this._touchedCell&& (null!==this._tableViewDelegate&&this._tableViewDelegate.tableCellUnhighlight&&this._tableViewDelegate.tableCellUnhighlight(this,this._touchedCell),this._touchedCell=null)}});_p=cc.TableView.prototype;cc.defineGetterSetter(_p,"dataSource",_p.getDataSource,_p.setDataSource);cc.defineGetterSetter(_p,"delegate",_p.getDelegate,_p.setDelegate);cc.defineGetterSetter(_p,"verticalFillOrder",_p.getVerticalFillOrder,_p.setVerticalFillOrder);_p=null; cc.TableView.create=function(a,b,c){return new cc.TableView(a,b,c)};var PROPERTY_POSITION="position",PROPERTY_CONTENTSIZE="contentSize",PROPERTY_SKEW="skew",PROPERTY_ANCHORPOINT="anchorPoint",PROPERTY_SCALE="scale",PROPERTY_ROTATION="rotation",PROPERTY_TAG="tag",PROPERTY_IGNOREANCHORPOINTFORPOSITION="ignoreAnchorPointForPosition",PROPERTY_VISIBLE="visible",ASSERT_FAIL_UNEXPECTED_PROPERTY=function(a){cc.log("Unexpected property: '"+a+"'!")},ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE=function(a){cc.log("Unexpected property type: '"+a+"'!")}; function BlockData(a,b){this.selMenuHander=a;this.target=b}function BlockCCControlData(a,b,c){this.selCCControlHandler=a;this.target=b;this.controlEvents=c} cc.NodeLoader=cc.Class.extend({_customProperties:null,_pt:null,_size:null,_arr2:null,ctor:function(){this._customProperties=new cc._Dictionary;this._pt=cc.p();this._size=cc.size();this._arr2=Array(2);this._blockControlData={selCCControlHandler:null,target:null,controlEvents:null}},loadCCNode:function(a,b){return this._createCCNode(a,b)},parseProperties:function(a,b,c){for(var d=c.readInt(!1),e=c.readInt(!1),e=d+e,f=0;f<e;f++){var g=f>=d,h=c.readInt(!1),k=c.readCachedString(),m=!1,n=c._data[c._currentByte++]; if(n===CCB_PLATFORM_ALL||n===CCB_PLATFORM_IOS||n===CCB_PLATFORM_MAC)m=!0;g&&(a.ccbFileNode?(a=a.ccbFileNode,m=-1!==a.userObject.indexOf(k)):a===c._animationManager.getRootNode()&&(g=a.userObject,g||(g=[],a.userObject=g),g.push(k)));switch(h){case CCB_PROPTYPE_POSITION:h=this.parsePropTypePosition(a,b,c,k);if(m)this.onHandlePropTypePosition(a,b,k,h,c);break;case CCB_PROPTYPE_POINT:h=this.parsePropTypePoint(a,b,c);if(m)this.onHandlePropTypePoint(a,b,k,h,c);break;case CCB_PROPTYPE_POINTLOCK:h=this.parsePropTypePointLock(a, b,c);if(m)this.onHandlePropTypePointLock(a,b,k,h,c);break;case CCB_PROPTYPE_SIZE:h=this.parsePropTypeSize(a,b,c);if(m)this.onHandlePropTypeSize(a,b,k,h,c);break;case CCB_PROPTYPE_SCALELOCK:h=this.parsePropTypeScaleLock(a,b,c,k);if(m)this.onHandlePropTypeScaleLock(a,b,k,h,c);break;case CCB_PROPTYPE_FLOATXY:h=this.parsePropTypeFloatXY(a,b,c);if(m)this.onHandlePropTypeFloatXY(a,b,k,h,c);break;case CCB_PROPTYPE_FLOAT:h=this.parsePropTypeFloat(a,b,c);if(m)this.onHandlePropTypeFloat(a,b,k,h,c);break;case CCB_PROPTYPE_DEGREES:h= this.parsePropTypeDegrees(a,b,c,k);if(m)this.onHandlePropTypeDegrees(a,b,k,h,c);break;case CCB_PROPTYPE_FLOATSCALE:h=this.parsePropTypeFloatScale(a,b,c);if(m)this.onHandlePropTypeFloatScale(a,b,k,h,c);break;case CCB_PROPTYPE_INTEGER:h=this.parsePropTypeInteger(a,b,c);if(m)this.onHandlePropTypeInteger(a,b,k,h,c);break;case CCB_PROPTYPE_INTEGERLABELED:h=this.parsePropTypeIntegerLabeled(a,b,c);if(m)this.onHandlePropTypeIntegerLabeled(a,b,k,h,c);break;case CCB_PROPTYPE_FLOATVAR:h=this.parsePropTypeFloatVar(a, b,c);if(m)this.onHandlePropTypeFloatVar(a,b,k,h,c);break;case CCB_PROPTYPE_CHECK:h=this.parsePropTypeCheck(a,b,c,k);if(m)this.onHandlePropTypeCheck(a,b,k,h,c);break;case CCB_PROPTYPE_SPRITEFRAME:h=this.parsePropTypeSpriteFrame(a,b,c,k);if(m)this.onHandlePropTypeSpriteFrame(a,b,k,h,c);break;case CCB_PROPTYPE_ANIMATION:h=this.parsePropTypeAnimation(a,b,c);if(m)this.onHandlePropTypeAnimation(a,b,k,h,c);break;case CCB_PROPTYPE_TEXTURE:h=this.parsePropTypeTexture(a,b,c);if(m)this.onHandlePropTypeTexture(a, b,k,h,c);break;case CCB_PROPTYPE_BYTE:h=this.parsePropTypeByte(a,b,c,k);if(m)this.onHandlePropTypeByte(a,b,k,h,c);break;case CCB_PROPTYPE_COLOR3:h=this.parsePropTypeColor3(a,b,c,k);if(m)this.onHandlePropTypeColor3(a,b,k,h,c);break;case CCB_PROPTYPE_COLOR4VAR:h=this.parsePropTypeColor4FVar(a,b,c);if(m)this.onHandlePropTypeColor4FVar(a,b,k,h,c);break;case CCB_PROPTYPE_FLIP:h=this.parsePropTypeFlip(a,b,c);if(m)this.onHandlePropTypeFlip(a,b,k,h,c);break;case CCB_PROPTYPE_BLENDMODE:h=this.parsePropTypeBlendFunc(a, b,c);if(m)this.onHandlePropTypeBlendFunc(a,b,k,h,c);break;case CCB_PROPTYPE_FNTFILE:h=c.getCCBRootPath()+this.parsePropTypeFntFile(a,b,c);if(m)this.onHandlePropTypeFntFile(a,b,k,h,c);break;case CCB_PROPTYPE_FONTTTF:h=this.parsePropTypeFontTTF(a,b,c);if(m)this.onHandlePropTypeFontTTF(a,b,k,h,c);break;case CCB_PROPTYPE_STRING:h=this.parsePropTypeString(a,b,c);if(m)this.onHandlePropTypeString(a,b,k,h,c);break;case CCB_PROPTYPE_TEXT:h=this.parsePropTypeText(a,b,c);if(m)this.onHandlePropTypeText(a,b,k, h,c);break;case CCB_PROPTYPE_BLOCK:h=this.parsePropTypeBlock(a,b,c);if(m)this.onHandlePropTypeBlock(a,b,k,h,c);break;case CCB_PROPTYPE_BLOCKCCCONTROL:h=this.parsePropTypeBlockCCControl(a,b,c);if(m&&null!=h)this.onHandlePropTypeBlockCCControl(a,b,k,h,c);break;case CCB_PROPTYPE_CCBFILE:h=this.parsePropTypeCCBFile(a,b,c);if(m)this.onHandlePropTypeCCBFile(a,b,k,h,c);break;default:ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(h)}}},getCustomProperties:function(){return this._customProperties},_createCCNode:function(a, b){return new cc.Node},parsePropTypePosition:function(a,b,c,d){var e=c.readFloat(),f=c.readFloat(),g=c.readInt(!1);cc.getAbsolutePosition(e,f,g,b?b._contentSize:c._animationManager._rootContainerSize,d,this._pt);a.setPosition(this._pt);-1<c._animatedProps.indexOf(d)&&c._animationManager.setBaseValue([e,f,g],a,d);return this._pt},parsePropTypePoint:function(a,b,c){this._pt.x=c.readFloat();this._pt.y=c.readFloat();return this._pt},parsePropTypePointLock:function(a,b,c){this._pt.x=c.readFloat();this._pt.y= c.readFloat();return this._pt},parsePropTypeSize:function(a,b,c){a=c.readFloat();var d=c.readFloat(),e=c.readInt(!1);b=b?b._contentSize:c._animationManager._rootContainerSize;switch(e){case CCB_SIZETYPE_ABSOLUTE:break;case CCB_SIZETYPE_RELATIVE_CONTAINER:a=b.width-a;d=b.height-d;break;case CCB_SIZETYPE_PERCENT:a=b.width*a/100;d=b.height*d/100;break;case CCB_SIZETYPE_HORIZONTAL_PERCENT:a=b.width*a/100;break;case CCB_SIZETYPE_VERTICAL_PERCENT:d=b.height*d/100;break;case CCB_SIZETYPE_MULTIPLY_RESOLUTION:b= cc.BuilderReader.getResolutionScale();a*=b;d*=b;break;default:cc.log("Unknown CCB type.")}this._size.width=a;this._size.height=d;return this._size},parsePropTypeScaleLock:function(a,b,c,d){b=c.readFloat();var e=c.readFloat(),f=c.readInt(!1);-1<c._animatedProps.indexOf(d)&&c._animationManager.setBaseValue([b,e,f],a,d);f===CCB_SCALETYPE_MULTIPLY_RESOLUTION&&(a=cc.BuilderReader.getResolutionScale(),b*=a,e*=a);this._pt.x=b;this._pt.y=e;return this._pt},parsePropTypeFloat:function(a,b,c){return c.readFloat()}, parsePropTypeDegrees:function(a,b,c,d){b=c.readFloat();-1<c._animatedProps.indexOf(d)&&c._animationManager.setBaseValue(b,a,d);return b},parsePropTypeFloatScale:function(a,b,c){a=c.readFloat();c.readInt(!1)===CCB_SCALETYPE_MULTIPLY_RESOLUTION&&(a*=cc.BuilderReader.getResolutionScale());return a},parsePropTypeInteger:function(a,b,c){return c.readInt(!0)},parsePropTypeIntegerLabeled:function(a,b,c){return c.readInt(!0)},parsePropTypeFloatVar:function(a,b,c){this._arr2[0]=c.readFloat();this._arr2[1]= c.readFloat();return this._arr2},parsePropTypeCheck:function(a,b,c,d){b=!!c._data[c._currentByte++];-1<c._animatedProps.indexOf(d)&&c._animationManager.setBaseValue(b,a,d);return b},parsePropTypeSpriteFrame:function(a,b,c,d){b=c.readCachedString();var e=c.readCachedString(),f;e&&(0===b.length?(e=c._ccbRootPath+e,b=cc.textureCache.addImage(e),e=b.getContentSize(),e=cc.rect(0,0,e.width,e.height),f=new cc.SpriteFrame(b,e)):(f=cc.spriteFrameCache,b=c._ccbRootPath+b,-1===c._loadedSpriteSheets.indexOf(b)&& (f.addSpriteFrames(b),c._loadedSpriteSheets.push(b)),f=f.getSpriteFrame(e)),-1<c._animatedProps.indexOf(d)&&c._animationManager.setBaseValue(f,a,d));return f},parsePropTypeAnimation:function(a,b,c){a=c._ccbRootPath+c.readCachedString();c=c.readCachedString();b=null;c=cc.BuilderReader.lastPathComponent(c);a=cc.BuilderReader.lastPathComponent(a);c&&(b=cc.animationCache,b.addAnimations(a),b=b.getAnimation(c));return b},parsePropTypeTexture:function(a,b,c){return(a=c._ccbRootPath+c.readCachedString())? cc.textureCache.addImage(a):null},parsePropTypeByte:function(a,b,c,d){b=c._data[c._currentByte++];-1<c._animatedProps.indexOf(d)&&c._animationManager.setBaseValue(b,a,d);return b},parsePropTypeColor3:function(a,b,c,d){b=c._data[c._currentByte++];var e=c._data[c._currentByte++],f=c._data[c._currentByte++];b=cc.color(b,e,f);-1<c._animatedProps.indexOf(d)&&c._animationManager.setBaseValue(b,a,d);return b},parsePropTypeColor4FVar:function(a,b,c){a=0|255*c.readFloat();b=0|255*c.readFloat();var d=0|255* c.readFloat(),e=c.readFloat(),e=1>=e?0|255*e:e,f=0|255*c.readFloat(),g=0|255*c.readFloat(),h=0|255*c.readFloat();c=c.readFloat();this._arr2[0]={r:a,g:b,b:d,a:e};this._arr2[1]={r:f,g:g,b:h,a:1>=c?0|255*c:c};return this._arr2},parsePropTypeFlip:function(a,b,c){this._arr2[0]=!!c._data[c._currentByte++];this._arr2[1]=!!c._data[c._currentByte++];return this._arr2},parsePropTypeBlendFunc:function(a,b,c){a=c.readInt(!1);c=c.readInt(!1);return new cc.BlendFunc(a,c)},parsePropTypeFntFile:function(a,b,c){return c.readCachedString()}, parsePropTypeString:function(a,b,c){return c.readCachedString()},parsePropTypeText:function(a,b,c){return c.readCachedString()},parsePropTypeFontTTF:function(a,b,c){return c.readCachedString()},parsePropTypeBlock:function(a,b,c){b=c.readCachedString();var d=c.readInt(!1);if(d!==CCB_TARGETTYPE_NONE){var e=null;if(c._jsControlled)d===CCB_TARGETTYPE_DOCUMENTROOT?(c.addDocumentCallbackNode(a),c.addDocumentCallbackName(b),c.addDocumentCallbackControlEvents(0)):(c.addOwnerCallbackNode(a),c.addOwnerCallbackName(b), c.addOwnerCallbackControlEvents(0));else if(d===CCB_TARGETTYPE_DOCUMENTROOT?e=c._animationManager._rootNode:d===CCB_TARGETTYPE_OWNER&&(e=c._owner),null!==e)if(0<b.length)if(a=0,e.onResolveCCBCCMenuItemSelector&&(a=e.onResolveCCBCCMenuItemSelector(e,b)),0===a&&(c=c._ccbSelectorResolver)&&(a=c.onResolveCCBCCMenuItemSelector(e,b)),0===a)cc.log("Skipping selector '"+b+"' since no CCBSelectorResolver is present.");else return new BlockData(a,e);else cc.log("Unexpected empty selector.");else cc.log("Unexpected NULL target for selector.")}return null}, parsePropTypeBlockCCControl:function(a,b,c){b=c.readCachedString();var d=c.readInt(!1),e=c.readInt(!1);if(d!==CCB_TARGETTYPE_NONE)if(c._jsControlled)d===CCB_TARGETTYPE_DOCUMENTROOT?(c.addDocumentCallbackNode(a),c.addDocumentCallbackName(b),c.addDocumentCallbackControlEvents(e)):(c.addOwnerCallbackNode(a),c.addOwnerCallbackName(b),c.addOwnerCallbackControlEvents(e));else if(a=null,d===CCB_TARGETTYPE_DOCUMENTROOT?a=c._animationManager._rootNode:d===CCB_TARGETTYPE_OWNER&&(a=c._owner),null!==a)if(0<b.length)if(d= 0,a.onResolveCCBCCControlSelector&&(d=a.onResolveCCBCCControlSelector(a,b)),0===d&&(c=c._ccbSelectorResolver,null!=c&&(d=c.onResolveCCBCCControlSelector(a,b))),0===d)cc.log("Skipping selector '"+b+"' since no CCBSelectorResolver is present.");else return this._blockControlData.selCCControlHandler=d,this._blockControlData.target=a,this._blockControlData.controlEvents=e,this._blockControlData;else cc.log("Unexpected empty selector.");else cc.log("Unexpected NULL target for selector.");return null}, parsePropTypeCCBFile:function(a,b,c){var d=c._ccbRootPath+c.readCachedString(),d=cc.BuilderReader.deletePathExtension(d)+".ccbi";a=new cc.BuilderReader(c);var e=cc.loader.getRes(d);e||(e=cc.loader.getUrl(d),e=hlddz.convertToDownloadURL(e),e=cc.loader.loadBinarySync(e),cc.loader.cache[d]=e);a.initWithData(e,c._owner);a._animationManager.setRootContainerSize(b._contentSize);a.setAnimationManagers(c._animationManagers);a._animationManager.setOwner(c._owner);b=a.readFileWithCleanUp(!1);c.setAnimationManagers(a._animationManagers); b&&-1!==a._animationManager._autoPlaySequenceId&&a._animationManager.runAnimations(a._animationManager._autoPlaySequenceId,0);return b},parsePropTypeFloatXY:function(a,b,c){this._pt.x=c.readFloat();this._pt.y=c.readFloat();return this._pt},onHandlePropTypePosition:function(a,b,c,d,e){c===PROPERTY_POSITION?a.setPosition(d):ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypePoint:function(a,b,c,d,e){c===PROPERTY_ANCHORPOINT?a.setAnchorPoint(d):ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypePointLock:function(a, b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeSize:function(a,b,c,d,e){c===PROPERTY_CONTENTSIZE?a.setContentSize(d):ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeScaleLock:function(a,b,c,d,e){c===PROPERTY_SCALE?a.setScale(d.x,d.y):ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeFloatXY:function(a,b,c,d,e){c===PROPERTY_SKEW?(a._skewX=d.x,a._skewY=d.y):(b=c+"X",e=c+"Y",a[b]&&a[e]||ASSERT_FAIL_UNEXPECTED_PROPERTY(c),a[b](d.x),a[e](d.y))},onHandlePropTypeFloat:function(a,b,c, d,e){this._customProperties.setObject(d,c)},onHandlePropTypeDegrees:function(a,b,c,d,e){c===PROPERTY_ROTATION?a.setRotation(d):ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeFloatScale:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeInteger:function(a,b,c,d,e){c===PROPERTY_TAG?a.tag=d:ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeIntegerLabeled:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeFloatVar:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)}, onHandlePropTypeCheck:function(a,b,c,d,e){c===PROPERTY_VISIBLE?a._visible=d:c===PROPERTY_IGNOREANCHORPOINTFORPOSITION?a._ignoreAnchorPointForPosition=d:ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeSpriteFrame:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeAnimation:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeTexture:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeByte:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)}, onHandlePropTypeColor3:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeColor4FVar:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeFlip:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeFntFile:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeString:function(a,b,c,d,e){this._customProperties.setObject(d,c)},onHandlePropTypeText:function(a, b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeFontTTF:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeBlock:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeBlockCCControl:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeCCBFile:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)}});cc.NodeLoader.loader=function(){return new cc.NodeLoader};cc.NodeLoaderListener=cc.Class.extend({onNodeLoaded:function(a,b){}});cc.BuilderSelectorResolver=cc.Class.extend({onResolveCCBCCMenuItemSelector:function(a,b){},onResolveCCBCCCallFuncSelector:function(a,b){},onResolveCCBCCControlSelector:function(a,b){}});cc.BuilderScriptOwnerProtocol=cc.Class.extend({createNew:function(){}});cc.BuilderMemberVariableAssigner=cc.Class.extend({onAssignCCBMemberVariable:function(a,b,c){return!1},onAssignCCBCustomProperty:function(a,b,c){return!1}});var PROPERTY_CCBFILE="ccbFile";cc.BuilderFileLoader=cc.NodeLoader.extend({_createCCNode:function(a,b){var c=new cc.Node;c.ccbFileNode=null;return c},onHandlePropTypeCCBFile:function(a,b,c,d,e){c===PROPERTY_CCBFILE?a.ccbFileNode=d:cc.NodeLoader.prototype.onHandlePropTypeCCBFile.call(this,a,b,c,d,e)}});cc.BuilderFileLoader.loader=function(){return new cc.BuilderFileLoader};var PROPERTY_ENABLED="enabled",PROPERTY_SELECTED="selected",PROPERTY_CCCONTROL="ccControl"; cc.ControlLoader=cc.NodeLoader.extend({_createCCNode:function(a,b){},onHandlePropTypeBlockCCControl:function(a,b,c,d,e){c===PROPERTY_CCCONTROL?a.addTargetWithActionForControlEvents(d.target,d.selCCControlHandler,d.controlEvents):cc.NodeLoader.prototype.onHandlePropTypeBlockCCControl.call(this,a,b,c,d,e)},onHandlePropTypeCheck:function(a,b,c,d,e){c===PROPERTY_ENABLED?a.setEnabled(d):c===PROPERTY_SELECTED?a.setSelected(d):cc.NodeLoader.prototype.onHandlePropTypeCheck.call(this,a,b,c,d,e)}}); var PROPERTY_ZOOMONTOUCHDOWN="zoomOnTouchDown",PROPERTY_TITLE_NORMAL="title|1",PROPERTY_TITLE_HIGHLIGHTED="title|2",PROPERTY_TITLE_DISABLED="title|3",PROPERTY_TITLECOLOR_NORMAL="titleColor|1",PROPERTY_TITLECOLOR_HIGHLIGHTED="titleColor|2",PROPERTY_TITLECOLOR_DISABLED="titleColor|3",PROPERTY_TITLETTF_NORMAL="titleTTF|1",PROPERTY_TITLETTF_HIGHLIGHTED="titleTTF|2",PROPERTY_TITLETTF_DISABLED="titleTTF|3",PROPERTY_TITLETTFSIZE_NORMAL="titleTTFSize|1",PROPERTY_TITLETTFSIZE_HIGHLIGHTED="titleTTFSize|2", PROPERTY_TITLETTFSIZE_DISABLED="titleTTFSize|4",PROPERTY_LABELANCHORPOINT="labelAnchorPoint",PROPERTY_PREFEREDSIZE="preferedSize",PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL="backgroundSpriteFrame|1",PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED="backgroundSpriteFrame|2",PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED="backgroundSpriteFrame|3"; cc.ControlButtonLoader=cc.ControlLoader.extend({_createCCNode:function(a,b){return new cc.ControlButton},onHandlePropTypeCheck:function(a,b,c,d,e){c===PROPERTY_ZOOMONTOUCHDOWN?a.zoomOnTouchDown=d:cc.ControlLoader.prototype.onHandlePropTypeCheck.call(this,a,b,c,d,e)},onHandlePropTypeString:function(a,b,c,d,e){c===PROPERTY_TITLE_NORMAL?a.setTitleForState(d,cc.CONTROL_STATE_NORMAL):c===PROPERTY_TITLE_HIGHLIGHTED?a.setTitleForState(d,cc.CONTROL_STATE_HIGHLIGHTED):c===PROPERTY_TITLE_DISABLED?a.setTitleForState(d, cc.CONTROL_STATE_DISABLED):cc.ControlLoader.prototype.onHandlePropTypeString.call(this,a,b,c,d,e)},onHandlePropTypeFontTTF:function(a,b,c,d,e){c===PROPERTY_TITLETTF_NORMAL?a.setTitleTTFForState(d,cc.CONTROL_STATE_NORMAL):c===PROPERTY_TITLETTF_HIGHLIGHTED?a.setTitleTTFForState(d,cc.CONTROL_STATE_HIGHLIGHTED):c===PROPERTY_TITLETTF_DISABLED?a.setTitleTTFForState(d,cc.CONTROL_STATE_DISABLED):cc.ControlLoader.prototype.onHandlePropTypeFontTTF.call(this,a,b,c,d,e)},onHandlePropTypeFloatScale:function(a, b,c,d,e){c===PROPERTY_TITLETTFSIZE_NORMAL?a.setTitleTTFSizeForState(d,cc.CONTROL_STATE_NORMAL):c===PROPERTY_TITLETTFSIZE_HIGHLIGHTED?a.setTitleTTFSizeForState(d,cc.CONTROL_STATE_HIGHLIGHTED):c===PROPERTY_TITLETTFSIZE_DISABLED?a.setTitleTTFSizeForState(d,cc.CONTROL_STATE_DISABLED):cc.ControlLoader.prototype.onHandlePropTypeFloatScale.call(this,a,b,c,d,e)},onHandlePropTypePoint:function(a,b,c,d,e){c===PROPERTY_LABELANCHORPOINT?a.setLabelAnchorPoint(d):cc.ControlLoader.prototype.onHandlePropTypePoint.call(this, a,b,c,d,e)},onHandlePropTypeSize:function(a,b,c,d,e){c===PROPERTY_PREFEREDSIZE?a.setPreferredSize(d):cc.ControlLoader.prototype.onHandlePropTypeSize.call(this,a,b,c,d,e)},onHandlePropTypeSpriteFrame:function(a,b,c,d,e){c===PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL?null!=d&&a.setBackgroundSpriteFrameForState(d,cc.CONTROL_STATE_NORMAL):c===PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED?null!=d&&a.setBackgroundSpriteFrameForState(d,cc.CONTROL_STATE_HIGHLIGHTED):c===PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED?null!= d&&a.setBackgroundSpriteFrameForState(d,cc.CONTROL_STATE_DISABLED):cc.ControlLoader.prototype.onHandlePropTypeSpriteFrame.call(this,a,b,c,d,e)},onHandlePropTypeColor3:function(a,b,c,d,e){c===PROPERTY_TITLECOLOR_NORMAL?a.setTitleColorForState(d,cc.CONTROL_STATE_NORMAL):c===PROPERTY_TITLECOLOR_HIGHLIGHTED?a.setTitleColorForState(d,cc.CONTROL_STATE_HIGHLIGHTED):c===PROPERTY_TITLECOLOR_DISABLED?a.setTitleColorForState(d,cc.CONTROL_STATE_DISABLED):cc.ControlLoader.prototype.onHandlePropTypeColor3.call(this, a,b,c,d,e)}});cc.ControlButtonLoader.loader=function(){return new cc.ControlButtonLoader};var PROPERTY_CONTAINER="container",PROPERTY_DIRECTION="direction",PROPERTY_CLIPSTOBOUNDS="clipsToBounds",PROPERTY_BOUNCES="bounces",PROPERTY_SCALE="scale"; cc.ScrollViewLoader=cc.NodeLoader.extend({_createCCNode:function(a,b){return new cc.ScrollView},onHandlePropTypeSize:function(a,b,c,d,e){c===PROPERTY_CONTENTSIZE?a.setViewSize(d):cc.NodeLoader.prototype.onHandlePropTypeSize.call(this,a,b,c,d,e)},onHandlePropTypeCCBFile:function(a,b,c,d,e){c===PROPERTY_CONTAINER?(a.setContainer(d),a.updateInset()):cc.NodeLoader.prototype.onHandlePropTypeCCBFile.call(this,a,b,c,d,e)},onHandlePropTypeCheck:function(a,b,c,d,e){c===PROPERTY_CLIPSTOBOUNDS?a.setClippingToBounds(d): c===PROPERTY_BOUNCES?a.setBounceable(d):cc.NodeLoader.prototype.onHandlePropTypeCheck.call(this,a,b,c,d,e)},onHandlePropTypeFloat:function(a,b,c,d,e){c===PROPERTY_SCALE?a.setScale(d):cc.NodeLoader.prototype.onHandlePropTypeFloat.call(this,a,b,c,d,e)},onHandlePropTypeIntegerLabeled:function(a,b,c,d,e){c===PROPERTY_DIRECTION?a.setDirection(d):cc.NodeLoader.prototype.onHandlePropTypeIntegerLabeled.call(this,a,b,c,d,e)}});cc.ScrollViewLoader.loader=function(){return new cc.ScrollViewLoader}; var PROPERTY_CONTENTSIZE="contentSize",PROPERTY_SPRITEFRAME="spriteFrame",PROPERTY_COLOR="color",PROPERTY_OPACITY="opacity",PROPERTY_BLENDFUNC="blendFunc",PROPERTY_INSETLEFT="insetLeft",PROPERTY_INSETTOP="insetTop",PROPERTY_INSETRIGHT="insetRight",PROPERTY_INSETBOTTOM="insetBottom"; cc.Scale9SpriteLoader=cc.NodeLoader.extend({_createCCNode:function(a,b){var c=new cc.Scale9Sprite;c.setAnchorPoint(0,0);return c},onHandlePropTypeColor3:function(a,b,c,d,e){c===PROPERTY_COLOR?255===d.r&&255===d.g&&255===d.b||a.setColor(d):cc.NodeLoader.prototype.onHandlePropTypeColor3.call(this,a,b,c,d,e)},onHandlePropTypeByte:function(a,b,c,d,e){c===PROPERTY_OPACITY?a.setOpacity(d):cc.NodeLoader.prototype.onHandlePropTypeByte.call(this,a,b,c,d,e)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){c!== PROPERTY_BLENDFUNC&&cc.NodeLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,b,c,d,e)},onHandlePropTypeSpriteFrame:function(a,b,c,d,e){c===PROPERTY_SPRITEFRAME?a.setSpriteFrame(d):cc.NodeLoader.prototype.onHandlePropTypeSpriteFrame.call(this,a,b,c,d,e)},onHandlePropTypeSize:function(a,b,c,d,e){c!==PROPERTY_CONTENTSIZE&&(c===PROPERTY_PREFEREDSIZE?a.setPreferredSize(d):cc.NodeLoader.prototype.onHandlePropTypeSize.call(this,a,b,c,d,e))},onHandlePropTypeFloat:function(a,b,c,d,e){c===PROPERTY_INSETLEFT? a.setInsetLeft(d):c===PROPERTY_INSETTOP?a.setInsetTop(d):c===PROPERTY_INSETRIGHT?a.setInsetRight(d):c===PROPERTY_INSETBOTTOM?a.setInsetBottom(d):cc.NodeLoader.prototype.onHandlePropTypeFloat.call(this,a,b,c,d,e)}});cc.Scale9SpriteLoader.loader=function(){return new cc.Scale9SpriteLoader};var PROPERTY_FLIP="flip",PROPERTY_DISPLAYFRAME="displayFrame",PROPERTY_COLOR="color",PROPERTY_OPACITY="opacity",PROPERTY_BLENDFUNC="blendFunc"; cc.SpriteLoader=cc.NodeLoader.extend({_createCCNode:function(a,b){return new cc.Sprite},onHandlePropTypeColor3:function(a,b,c,d,e){c===PROPERTY_COLOR?255===d.r&&255===d.g&&255===d.b||a.setColor(d):cc.NodeLoader.prototype.onHandlePropTypeColor3.call(this,a,b,c,d,e)},onHandlePropTypeByte:function(a,b,c,d,e){c===PROPERTY_OPACITY?a.setOpacity(d):cc.NodeLoader.prototype.onHandlePropTypeByte.call(this,a,b,c,d,e)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){c===PROPERTY_BLENDFUNC?a.setBlendFunc(d):cc.NodeLoader.prototype.onHandlePropTypeBlendFunc.call(this, a,b,c,d,e)},onHandlePropTypeSpriteFrame:function(a,b,c,d,e){c===PROPERTY_DISPLAYFRAME?d?a.setSpriteFrame(d):cc.log("ERROR: SpriteFrame is null"):cc.NodeLoader.prototype.onHandlePropTypeSpriteFrame.call(this,a,b,c,d,e)},onHandlePropTypeFlip:function(a,b,c,d,e){c===PROPERTY_FLIP?(a.setFlippedX(d[0]),a.setFlippedY(d[1])):cc.NodeLoader.prototype.onHandlePropTypeFlip.call(this,a,b,c,d,e)}});cc.SpriteLoader.loader=function(){return new cc.SpriteLoader}; var PROPERTY_TOUCH_ENABLED="touchEnabled",PROPERTY_IS_TOUCH_ENABLED="isTouchEnabled",PROPERTY_ACCELEROMETER_ENABLED="accelerometerEnabled",PROPERTY_IS_ACCELEROMETER_ENABLED="isAccelerometerEnabled",PROPERTY_IS_MOUSE_ENABLED="isMouseEnabled",PROPERTY_MOUSE_ENABLED="mouseEnabled",PROPERTY_KEYBOARD_ENABLED="keyboardEnabled",PROPERTY_IS_KEYBOARD_ENABLED="isKeyboardEnabled"; cc.LayerLoader=cc.NodeLoader.extend({_createCCNode:function(a,b){var c=new cc.Layer;c.setContentSize(0,0);return c},onHandlePropTypeCheck:function(a,b,c,d,e){c!==PROPERTY_TOUCH_ENABLED&&c!==PROPERTY_IS_TOUCH_ENABLED&&c!==PROPERTY_ACCELEROMETER_ENABLED&&c!==PROPERTY_IS_ACCELEROMETER_ENABLED&&c!==PROPERTY_MOUSE_ENABLED&&c!==PROPERTY_IS_MOUSE_ENABLED&&(c===PROPERTY_KEYBOARD_ENABLED||c===PROPERTY_IS_KEYBOARD_ENABLED?a.setKeyboardEnabled&&!cc.sys.isNative?a.setKeyboardEnabled(d):cc.log("The property '"+ PROPERTY_IS_KEYBOARD_ENABLED+"' is not supported!"):cc.NodeLoader.prototype.onHandlePropTypeCheck.call(this,a,b,c,d,e))}});cc.LayerLoader.loader=function(){return new cc.LayerLoader}; cc.LayerColorLoader=cc.LayerLoader.extend({_createCCNode:function(a,b){return new cc.LayerColor},onHandlePropTypeColor3:function(a,b,c,d,e){c===PROPERTY_COLOR?a.setColor(d):cc.LayerLoader.prototype.onHandlePropTypeColor3.call(this,a,b,c,d,e)},onHandlePropTypeByte:function(a,b,c,d,e){c===PROPERTY_OPACITY?a.setOpacity(d):cc.LayerLoader.prototype.onHandlePropTypeByte.call(this,a,b,c,d,e)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){c===PROPERTY_BLENDFUNC?a.setBlendFunc(d):cc.LayerLoader.prototype.onHandlePropTypeBlendFunc.call(this, a,b,c,d,e)}});cc.LayerColorLoader.loader=function(){return new cc.LayerColorLoader};var PROPERTY_STARTCOLOR="startColor",PROPERTY_ENDCOLOR="endColor",PROPERTY_STARTOPACITY="startOpacity",PROPERTY_ENDOPACITY="endOpacity",PROPERTY_VECTOR="vector"; cc.LayerGradientLoader=cc.LayerLoader.extend({_createCCNode:function(a,b){return new cc.LayerGradient},onHandlePropTypeColor3:function(a,b,c,d,e){c===PROPERTY_STARTCOLOR?a.setStartColor(d):c===PROPERTY_ENDCOLOR?a.setEndColor(d):cc.LayerLoader.prototype.onHandlePropTypeColor3.call(this,a,b,c,d,e)},onHandlePropTypeByte:function(a,b,c,d,e){c===PROPERTY_STARTOPACITY?a.setStartOpacity(d):c===PROPERTY_ENDOPACITY?a.setEndOpacity(d):cc.LayerLoader.prototype.onHandlePropTypeByte.call(this,a,b,c,d,e)},onHandlePropTypePoint:function(a, b,c,d,e){c===PROPERTY_VECTOR?a.setVector(d):cc.LayerLoader.prototype.onHandlePropTypePoint.call(this,a,b,c,d,e)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){c===PROPERTY_BLENDFUNC?a.setBlendFunc(d):cc.LayerLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,b,c,d,e)}});cc.LayerGradientLoader.loader=function(){return new cc.LayerGradientLoader};cc.MenuLoader=cc.LayerLoader.extend({_createCCNode:function(a,b){var c=new cc.Menu;c.setContentSize(0,0);return c}});cc.MenuLoader.loader=function(){return new cc.MenuLoader}; var PROPERTY_BLOCK="block",PROPERTY_ISENABLED="isEnabled";cc.MenuItemLoader=cc.NodeLoader.extend({_createCCNode:function(a,b){return null},onHandlePropTypeBlock:function(a,b,c,d,e){c===PROPERTY_BLOCK?null!=d&&a.setTarget(d.selMenuHander,d.target):cc.NodeLoader.prototype.onHandlePropTypeBlock.call(this,a,b,c,d,e)},onHandlePropTypeCheck:function(a,b,c,d,e){c===PROPERTY_ISENABLED?a.setEnabled(d):cc.NodeLoader.prototype.onHandlePropTypeCheck.call(this,a,b,c,d,e)}}); var PROPERTY_NORMALDISPLAYFRAME="normalSpriteFrame",PROPERTY_SELECTEDDISPLAYFRAME="selectedSpriteFrame",PROPERTY_DISABLEDDISPLAYFRAME="disabledSpriteFrame"; cc.MenuItemImageLoader=cc.MenuItemLoader.extend({_createCCNode:function(a,b){return new cc.MenuItemImage},onHandlePropTypeSpriteFrame:function(a,b,c,d,e){c===PROPERTY_NORMALDISPLAYFRAME?null!=d&&a.setNormalSpriteFrame(d):c===PROPERTY_SELECTEDDISPLAYFRAME?null!=d&&a.setSelectedSpriteFrame(d):c===PROPERTY_DISABLEDDISPLAYFRAME?null!=d&&a.setDisabledSpriteFrame(d):cc.MenuItemLoader.prototype.onHandlePropTypeSpriteFrame.call(this,a,b,c,d,e)}});cc.MenuItemImageLoader.loader=function(){return new cc.MenuItemImageLoader}; var PROPERTY_FONTNAME="fontName",PROPERTY_FONTSIZE="fontSize",PROPERTY_HORIZONTALALIGNMENT="horizontalAlignment",PROPERTY_VERTICALALIGNMENT="verticalAlignment",PROPERTY_STRING="string",PROPERTY_DIMENSIONS="dimensions"; cc.LabelTTFLoader=cc.NodeLoader.extend({_createCCNode:function(a,b){return new cc.LabelTTF},onHandlePropTypeColor3:function(a,b,c,d,e){c===PROPERTY_COLOR?255===d.r&&255===d.g&&255===d.b||a.setColor(d):cc.NodeLoader.prototype.onHandlePropTypeColor3.call(this,a,b,c,d,e)},onHandlePropTypeByte:function(a,b,c,d,e){c===PROPERTY_OPACITY?a.setOpacity(d):cc.NodeLoader.prototype.onHandlePropTypeByte.call(this,a,b,c,d,e)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){c===PROPERTY_BLENDFUNC?a.setBlendFunc(d): cc.NodeLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,b,c,d,e)},onHandlePropTypeFontTTF:function(a,b,c,d,e){c===PROPERTY_FONTNAME?a.setFontName(d):cc.NodeLoader.prototype.onHandlePropTypeFontTTF.call(this,a,b,c,d,e)},onHandlePropTypeText:function(a,b,c,d,e){c===PROPERTY_STRING?a.setString(d):cc.NodeLoader.prototype.onHandlePropTypeText.call(this,a,b,c,d,e)},onHandlePropTypeFloatScale:function(a,b,c,d,e){c===PROPERTY_FONTSIZE?a.setFontSize(d):cc.NodeLoader.prototype.onHandlePropTypeFloatScale.call(this, a,b,c,d,e)},onHandlePropTypeIntegerLabeled:function(a,b,c,d,e){c===PROPERTY_HORIZONTALALIGNMENT?a.setHorizontalAlignment(d):c===PROPERTY_VERTICALALIGNMENT?a.setVerticalAlignment(d):cc.NodeLoader.prototype.onHandlePropTypeIntegerLabeled.call(this,a,b,c,d,e)},onHandlePropTypeSize:function(a,b,c,d,e){c===PROPERTY_DIMENSIONS?a.setDimensions(d):cc.NodeLoader.prototype.onHandlePropTypeSize.call(this,a,b,c,d,e)}});cc.LabelTTFLoader.loader=function(){return new cc.LabelTTFLoader};var PROPERTY_FNTFILE="fntFile"; cc.LabelBMFontLoader=cc.NodeLoader.extend({_createCCNode:function(a,b){return new cc.LabelBMFont},onHandlePropTypeColor3:function(a,b,c,d,e){c===PROPERTY_COLOR?255===d.r&&255===d.g&&255===d.b||a.setColor(d):cc.NodeLoader.prototype.onHandlePropTypeColor3.call(this,a,b,c,d,e)},onHandlePropTypeByte:function(a,b,c,d,e){c===PROPERTY_OPACITY?a.setOpacity(d):cc.NodeLoader.prototype.onHandlePropTypeByte.call(this,a,b,c,d,e)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){c===PROPERTY_BLENDFUNC?a.setBlendFunc(d): cc.NodeLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,b,c,d,e)},onHandlePropTypeFntFile:function(a,b,c,d,e){c===PROPERTY_FNTFILE?a.setFntFile(d):cc.NodeLoader.prototype.onHandlePropTypeFntFile.call(this,a,b,c,d,e)},onHandlePropTypeText:function(a,b,c,d,e){c===PROPERTY_STRING?a.setString(d):cc.NodeLoader.prototype.onHandlePropTypeText.call(this,a,b,c,d,e)}});cc.LabelBMFontLoader.loader=function(){return new cc.LabelBMFontLoader}; var PROPERTY_EMITERMODE="emitterMode",PROPERTY_POSVAR="posVar",PROPERTY_EMISSIONRATE="emissionRate",PROPERTY_DURATION="duration",PROPERTY_TOTALPARTICLES="totalParticles",PROPERTY_LIFE="life",PROPERTY_STARTSIZE="startSize",PROPERTY_ENDSIZE="endSize",PROPERTY_STARTSPIN="startSpin",PROPERTY_ENDSPIN="endSpin",PROPERTY_ANGLE="angle",PROPERTY_GRAVITY="gravity",PROPERTY_SPEED="speed",PROPERTY_TANGENTIALACCEL="tangentialAccel",PROPERTY_RADIALACCEL="radialAccel",PROPERTY_TEXTURE="texture",PROPERTY_STARTRADIUS= "startRadius",PROPERTY_ENDRADIUS="endRadius",PROPERTY_ROTATEPERSECOND="rotatePerSecond"; cc.ParticleSystemLoader=cc.NodeLoader.extend({_createCCNode:function(a,b){return new cc.ParticleSystem},onHandlePropTypeIntegerLabeled:function(a,b,c,d,e){c===PROPERTY_EMITERMODE?a.setEmitterMode(d):cc.NodeLoader.prototype.onHandlePropTypeIntegerLabeled.call(this,a,b,c,d,e)},onHandlePropTypePoint:function(a,b,c,d,e){c===PROPERTY_POSVAR?a.setPosVar(d):c===PROPERTY_GRAVITY?a.setGravity(d):cc.NodeLoader.prototype.onHandlePropTypePoint.call(this,a,b,c,d,e)},onHandlePropTypeFloat:function(a,b,c,d,e){c=== PROPERTY_EMISSIONRATE?a.setEmissionRate(d):c===PROPERTY_DURATION?a.setDuration(d):cc.NodeLoader.prototype.onHandlePropTypeFloat.call(this,a,b,c,d,e)},onHandlePropTypeInteger:function(a,b,c,d,e){c===PROPERTY_TOTALPARTICLES?a.setTotalParticles(d):cc.NodeLoader.prototype.onHandlePropTypeInteger.call(this,a,b,c,d,e)},onHandlePropTypeFloatVar:function(a,b,c,d,e){c===PROPERTY_LIFE?(a.setLife(d[0]),a.setLifeVar(d[1])):c===PROPERTY_STARTSIZE?(a.setStartSize(d[0]),a.setStartSizeVar(d[1])):c===PROPERTY_ENDSIZE? (a.setEndSize(d[0]),a.setEndSizeVar(d[1])):c===PROPERTY_STARTSPIN?(a.setStartSpin(d[0]),a.setStartSpinVar(d[1])):c===PROPERTY_ENDSPIN?(a.setEndSpin(d[0]),a.setEndSpinVar(d[1])):c===PROPERTY_ANGLE?(a.setAngle(d[0]),a.setAngleVar(d[1])):c===PROPERTY_SPEED?(a.setSpeed(d[0]),a.setSpeedVar(d[1])):c===PROPERTY_TANGENTIALACCEL?(a.setTangentialAccel(d[0]),a.setTangentialAccelVar(d[1])):c===PROPERTY_RADIALACCEL?(a.setRadialAccel(d[0]),a.setRadialAccelVar(d[1])):c===PROPERTY_STARTRADIUS?(a.setStartRadius(d[0]), a.setStartRadiusVar(d[1])):c===PROPERTY_ENDRADIUS?(a.setEndRadius(d[0]),a.setEndRadiusVar(d[1])):c===PROPERTY_ROTATEPERSECOND?(a.setRotatePerSecond(d[0]),a.setRotatePerSecondVar(d[1])):cc.NodeLoader.prototype.onHandlePropTypeFloatVar.call(this,a,b,c,d,e)},onHandlePropTypeColor4FVar:function(a,b,c,d,e){c===PROPERTY_STARTCOLOR?(a.setStartColor(d[0]),a.setStartColorVar(d[1])):c===PROPERTY_ENDCOLOR?(a.setEndColor(d[0]),a.setEndColorVar(d[1])):cc.NodeLoader.prototype.onHandlePropTypeColor4FVar.call(this, a,b,c,d,e)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){c===PROPERTY_BLENDFUNC?a.setBlendFunc(d):cc.NodeLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,b,c,d,e)},onHandlePropTypeTexture:function(a,b,c,d,e){c===PROPERTY_TEXTURE?a.setTexture(d):cc.NodeLoader.prototype.onHandlePropTypeTexture.call(this,a,b,c,d,e)}});cc.ParticleSystemLoader.loader=function(){return new cc.ParticleSystemLoader};cc.NodeLoaderLibrary=cc.Class.extend({_ccNodeLoaders:null,ctor:function(){this._ccNodeLoaders={}},registerDefaultCCNodeLoaders:function(){this.registerCCNodeLoader("CCNode",cc.NodeLoader.loader());this.registerCCNodeLoader("CCLayer",cc.LayerLoader.loader());this.registerCCNodeLoader("CCLayerColor",cc.LayerColorLoader.loader());this.registerCCNodeLoader("CCLayerGradient",cc.LayerGradientLoader.loader());this.registerCCNodeLoader("CCSprite",cc.SpriteLoader.loader());this.registerCCNodeLoader("CCLabelBMFont", cc.LabelBMFontLoader.loader());this.registerCCNodeLoader("CCLabelTTF",cc.LabelTTFLoader.loader());this.registerCCNodeLoader("CCScale9Sprite",cc.Scale9SpriteLoader.loader());this.registerCCNodeLoader("CCScrollView",cc.ScrollViewLoader.loader());this.registerCCNodeLoader("CCBFile",cc.BuilderFileLoader.loader());this.registerCCNodeLoader("CCMenu",cc.MenuLoader.loader());this.registerCCNodeLoader("CCMenuItemImage",cc.MenuItemImageLoader.loader());this.registerCCNodeLoader("CCControlButton",cc.ControlButtonLoader.loader()); this.registerCCNodeLoader("CCParticleSystemQuad",cc.ParticleSystemLoader.loader())},registerCCNodeLoader:function(a,b){this._ccNodeLoaders[a]=b},unregisterCCNodeLoader:function(a){this._ccNodeLoaders[a]&&delete this._ccNodeLoaders[a]},getCCNodeLoader:function(a){return this._ccNodeLoaders[a]?this._ccNodeLoaders[a]:null},purge:function(a){if(a)for(var b in this._ccNodeLoaders)delete this._ccNodeLoaders[b];this._ccNodeLoaders={}}});cc.NodeLoaderLibrary.sSharedCCNodeLoaderLibrary=null; cc.NodeLoaderLibrary.library=function(){return new cc.NodeLoaderLibrary};cc.NodeLoaderLibrary.sharedCCNodeLoaderLibrary=function(){null==cc.NodeLoaderLibrary.sSharedCCNodeLoaderLibrary&&(cc.NodeLoaderLibrary.sSharedCCNodeLoaderLibrary=new cc.NodeLoaderLibrary,cc.NodeLoaderLibrary.sSharedCCNodeLoaderLibrary.registerDefaultCCNodeLoaders());return cc.NodeLoaderLibrary.sSharedCCNodeLoaderLibrary}; cc.NodeLoaderLibrary.purgeSharedCCNodeLoaderLibrary=function(){cc.NodeLoaderLibrary.sSharedCCNodeLoaderLibrary=null};cc.NodeLoaderLibrary.newDefaultCCNodeLoaderLibrary=function(){var a=cc.NodeLoaderLibrary.library();a.registerDefaultCCNodeLoaders();return a};var CCB_VERSION=5,CCB_PROPTYPE_POSITION=0,CCB_PROPTYPE_SIZE=1,CCB_PROPTYPE_POINT=2,CCB_PROPTYPE_POINTLOCK=3,CCB_PROPTYPE_SCALELOCK=4,CCB_PROPTYPE_DEGREES=5,CCB_PROPTYPE_INTEGER=6,CCB_PROPTYPE_FLOAT=7,CCB_PROPTYPE_FLOATVAR=8,CCB_PROPTYPE_CHECK=9,CCB_PROPTYPE_SPRITEFRAME=10,CCB_PROPTYPE_TEXTURE=11,CCB_PROPTYPE_BYTE=12,CCB_PROPTYPE_COLOR3=13,CCB_PROPTYPE_COLOR4VAR=14,CCB_PROPTYPE_FLIP=15,CCB_PROPTYPE_BLENDMODE=16,CCB_PROPTYPE_FNTFILE=17,CCB_PROPTYPE_TEXT=18,CCB_PROPTYPE_FONTTTF=19,CCB_PROPTYPE_INTEGERLABELED= 20,CCB_PROPTYPE_BLOCK=21,CCB_PROPTYPE_ANIMATION=22,CCB_PROPTYPE_CCBFILE=23,CCB_PROPTYPE_STRING=24,CCB_PROPTYPE_BLOCKCCCONTROL=25,CCB_PROPTYPE_FLOATSCALE=26,CCB_PROPTYPE_FLOATXY=27,CCB_FLOAT0=0,CCB_FLOAT1=1,CCB_FLOAT_MINUS1=2,CCB_FLOAT05=3,CCB_FLOAT_INTEGER=4,CCB_FLOAT_FULL=5,CCB_PLATFORM_ALL=0,CCB_PLATFORM_IOS=1,CCB_PLATFORM_MAC=2,CCB_TARGETTYPE_NONE=0,CCB_TARGETTYPE_DOCUMENTROOT=1,CCB_TARGETTYPE_OWNER=2,CCB_KEYFRAME_EASING_INSTANT=0,CCB_KEYFRAME_EASING_LINEAR=1,CCB_KEYFRAME_EASING_CUBIC_IN=2,CCB_KEYFRAME_EASING_CUBIC_OUT= 3,CCB_KEYFRAME_EASING_CUBIC_INOUT=4,CCB_KEYFRAME_EASING_ELASTIC_IN=5,CCB_KEYFRAME_EASING_ELASTIC_OUT=6,CCB_KEYFRAME_EASING_ELASTIC_INOUT=7,CCB_KEYFRAME_EASING_BOUNCE_IN=8,CCB_KEYFRAME_EASING_BOUNCE_OUT=9,CCB_KEYFRAME_EASING_BOUNCE_INOUT=10,CCB_KEYFRAME_EASING_BACK_IN=11,CCB_KEYFRAME_EASING_BACK_OUT=12,CCB_KEYFRAME_EASING_BACK_INOUT=13,CCB_POSITIONTYPE_RELATIVE_BOTTOM_LEFT=0,CCB_POSITIONTYPE_RELATIVE_TOP_LEFT=1,CCB_POSITIONTYPE_RELATIVE_TOP_RIGHT=2,CCB_POSITIONTYPE_RELATIVE_BOTTOM_RIGHT=3,CCB_POSITIONTYPE_PERCENT= 4,CCB_POSITIONTYPE_MULTIPLY_RESOLUTION=5,CCB_SIZETYPE_ABSOLUTE=0,CCB_SIZETYPE_PERCENT=1,CCB_SIZETYPE_RELATIVE_CONTAINER=2,CCB_SIZETYPE_HORIZONTAL_PERCENT=3,CCB_SIZETYPE_VERTICAL_PERCENT=4,CCB_SIZETYPE_MULTIPLY_RESOLUTION=5,CCB_SCALETYPE_ABSOLUTE=0,CCB_SCALETYPE_MULTIPLY_RESOLUTION=1; cc.BuilderReader=cc.Class.extend({_jsControlled:!1,_data:null,_ccbRootPath:"",_bytes:0,_currentByte:0,_currentBit:0,_stringCache:null,_loadedSpriteSheets:null,_owner:null,_animationManager:null,_animationManagers:null,_animatedProps:null,_ccNodeLoaderLibrary:null,_ccNodeLoaderListener:null,_ccbMemberVariableAssigner:null,_ccbSelectorResolver:null,_ownerOutletNames:null,_ownerOutletNodes:null,_nodesWithAnimationManagers:null,_animationManagerForNodes:null,_ownerCallbackNames:null,_ownerCallbackNodes:null, _ownerCallbackEvents:null,_readNodeGraphFromData:!1,ctor:function(a,b,c,d){this._stringCache=[];this._loadedSpriteSheets=[];this._currentByte=this._currentBit=-1;0!==arguments.length&&(a instanceof cc.BuilderReader?(this._loadedSpriteSheets=a._loadedSpriteSheets,this._ccNodeLoaderLibrary=a._ccNodeLoaderLibrary,this._ccbMemberVariableAssigner=a._ccbMemberVariableAssigner,this._ccbSelectorResolver=a._ccbSelectorResolver,this._ccNodeLoaderListener=a._ccNodeLoaderListener,this._ownerCallbackNames=a._ownerCallbackNames, this._ownerCallbackNodes=a._ownerCallbackNodes,this._ownerCallbackEvents=a._ownerCallbackEvents,this._ownerOutletNames=a._ownerOutletNames,this._ownerOutletNodes=a._ownerOutletNodes,this._ccbRootPath=a._ccbRootPath):(this._ccNodeLoaderLibrary=a,this._ccbMemberVariableAssigner=b,this._ccbSelectorResolver=c,this._ccNodeLoaderListener=d))},getCCBRootPath:function(){return this._ccbRootPath},setCCBRootPath:function(a){this._ccbRootPath=a},initWithData:function(a,b){this._animationManager=new cc.BuilderAnimationManager; this._data=a;this._bytes=a.length;this._currentByte=this._currentBit=0;this._owner=b;this._animationManager.setRootContainerSize(cc.director.getWinSize());return!0},_loadBinarySync:function(a){var b=this.getXMLHttpRequest(),c="load "+a+" failed!";b.open("GET",a,!1);var d=null;if(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)){b.setRequestHeader("Accept-Charset","x-user-defined");b.send(null);if(200!==b.status)return cc.log(c),null;if(b=cc._convertResponseBodyToText(b.responseBody))d= this._stringConvertToArray(b),this._fileDataCache[a]=d}else{b.overrideMimeType&&b.overrideMimeType("text/plain; charset\x3dx-user-defined");b.send(null);if(200!==b.status)return cc.log(c),null;d=this._stringConvertToArray(b.responseText);this._fileDataCache[a]=d}return d},readNodeGraphFromFile:function(a,b,c,d){null==c?c=cc.director.getWinSize():c instanceof cc.BuilderAnimationManager&&(d=c,c=cc.director.getWinSize());var e=cc.loader.getRes(a);e||(e=cc.loader.getUrl(a),e=cc.loader.loadBinarySync(e), cc.loader.cache[a]=e);return this.readNodeGraphFromData(e,b,c,d)},readNodeGraphFromData:function(a,b,c){this.initWithData(a,b);a=this._animationManager;a.setRootContainerSize(c);a.setOwner(b);this._ownerOutletNames=[];this._ownerOutletNodes=[];this._ownerCallbackNames=[];this._ownerCallbackNodes=[];this._ownerCallbackEvents=[];this._animationManagers=new cc._Dictionary;(b=this.readFileWithCleanUp(!0))&&-1!==a.getAutoPlaySequenceId()&&a.runAnimations(a.getAutoPlaySequenceId(),0);if(this._jsControlled){c= [];a=[];for(var d=this._animationManagers,e=d.allKeys(),f=0;f<e.length;f++)c.push(e[f]),a.push(d.objectForKey(e[f]));this._nodesWithAnimationManagers=c;this._animationManagerForNodes=a}return b},createSceneWithNodeGraphFromFile:function(a,b,c,d){a=this.readNodeGraphFromFile(a,b,c,d);b=new cc.Scene;b.addChild(a);return b},getCCBMemberVariableAssigner:function(){return this._ccbMemberVariableAssigner},getCCBSelectorResolver:function(){return this._ccbSelectorResolver},getAnimationManager:function(){return this._animationManager}, setAnimationManager:function(a){this._animationManager=a},getAnimatedProperties:function(){return this._animatedProps},getLoadedSpriteSheet:function(){return this._loadedSpriteSheets},getOwner:function(){return this._owner},readInt:function(a){for(var b=0,c=this._data[this._currentByte],d=!!(c&1<<this._currentBit++);!d;)if(b++,d=!!(c&1<<this._currentBit++),8<=this._currentBit&&(this._currentBit=0,this._currentByte++,c=this._data[this._currentByte],this._currentByte>this._data.length))throw Error("out of the data bound"); for(var e=0,f=b-1;0<=f;f--){d=!!(c&1<<this._currentBit++);if(8<=this._currentBit&&(this._currentBit=0,this._currentByte++,c=this._data[this._currentByte],this._currentByte>this._data.length))throw Error("out of the data bound");d&&(e|=1<<f)}e|=1<<b;this._currentBit&&(this._currentBit=0,this._currentByte++);return a?e%2?0|e/2:0|-e/2:e-1},readByte:function(){var a=this._data[this._currentByte];this._currentByte++;return a},readBool:function(){return!!this._data[this._currentByte++]},readFloat:function(){switch(this._data[this._currentByte++]){case CCB_FLOAT0:return 0; case CCB_FLOAT1:return 1;case CCB_FLOAT_MINUS1:return-1;case CCB_FLOAT05:return 0.5;case CCB_FLOAT_INTEGER:return this.readInt(!0);default:return this._decodeFloat(23,8)}},_decodeFloat:function(a,b){var c=a+b+1>>3;if(this._currentByte+c>=this._data.length)throw Error("Index out of bound");var d=Math.pow(2,b-1)-1,e=this._readBitsOnly(a+b,1,c),f=this._readBitsOnly(a,b,c),g=0,h=2,k=0;do for(var m=this._data[this._currentByte+c-++k-1],n=a%8||8,p=1<<n;p>>=1;)m&p&&(g+=1/h),h*=2;while(a-=n);this._currentByte+= c;return f===(d<<1)+1?g?NaN:e?-Infinity:Infinity:(1+-2*e)*(f||g?f?Math.pow(2,f-d)*(1+g):Math.pow(2,-d+1)*g:0)},_readBitsOnly:function(a,b,c){var d=(a+b)%8,e=a%8,f=c-(a>>3)-1;a=c+(-(a+b)>>3);var g=f-a;b=this._data[this._currentByte+c-f-1]>>e&(1<<(g?8-e:b))-1;g&&d&&(b+=(this._data[this._currentByte+c-a-1]&(1<<d)-1)<<(g--<<3)-e,a++);for(;g;)b+=this._shl(this._data[this._currentByte+c-a-1],(g--<<3)-e),a++;return b},_shl:function(a,b){for(++b;--b;a=1073741824===((a%=2147483648)&1073741824)?2*a:2*(a-1073741824)+ 2147483648);return a},readCachedString:function(){return this._stringCache[this.readInt(!1)]},isJSControlled:function(){return this._jsControlled},getOwnerCallbackNames:function(){return this._ownerCallbackNames},getOwnerCallbackNodes:function(){return this._ownerCallbackNodes},getOwnerCallbackControlEvents:function(){return this._ownerCallbackEvents},getOwnerOutletNames:function(){return this._ownerOutletNames},getOwnerOutletNodes:function(){return this._ownerOutletNodes},getNodesWithAnimationManagers:function(){return this._nodesWithAnimationManagers}, getAnimationManagersForNodes:function(){return this._animationManagerForNodes},getAnimationManagers:function(){return this._animationManagers},setAnimationManagers:function(a){this._animationManagers=a},addOwnerCallbackName:function(a){this._ownerCallbackNames.push(a)},addOwnerCallbackNode:function(a){this._ownerCallbackNodes.push(a)},addOwnerCallbackControlEvents:function(a){this._ownerCallbackEvents.push(a)},addDocumentCallbackName:function(a){this._animationManager.addDocumentCallbackName(a)}, addDocumentCallbackNode:function(a){this._animationManager.addDocumentCallbackNode(a)},addDocumentCallbackControlEvents:function(a){this._animationManager.addDocumentCallbackControlEvents(a)},readFileWithCleanUp:function(a){if(!this._readHeader()||!this._readStringCache()||!this._readSequences())return null;var b=this._readNodeGraph();this._animationManagers.setObject(this._animationManager,b);a&&this._cleanUpNodeGraph(b);return b},addOwnerOutletName:function(a){this._ownerOutletNames.push(a)},addOwnerOutletNode:function(a){null!= a&&this._ownerOutletNodes.push(a)},_cleanUpNodeGraph:function(a){a.userObject=null;a=a.getChildren();for(var b=0,c=a.length;b<c;b++)this._cleanUpNodeGraph(a[b])},_readCallbackKeyframesForSeq:function(a){var b=this.readInt(!1);if(!b)return!0;for(var c=new cc.BuilderSequenceProperty,d=this._jsControlled,e=this._animationManager,f=c.getKeyframes(),g=0;g<b;g++){var h=this.readFloat(),k=this.readCachedString(),m=this.readInt(!1),n=[k,m],p=new cc.BuilderKeyframe;p.setTime(h);p.setValue(n);d&&e.getKeyframeCallbacks().push(m+ ":"+k);f.push(p)}a.setCallbackChannel(c);return!0},_readSoundKeyframesForSeq:function(a){var b=this.readInt(!1);if(!b)return!0;for(var c=new cc.BuilderSequenceProperty,d=c.getKeyframes(),e=0;e<b;e++){var f=this.readFloat(),g=this.readCachedString(),h=this.readFloat(),k=this.readFloat(),m=this.readFloat(),g=[g,h,k,m],h=new cc.BuilderKeyframe;h.setTime(f);h.setValue(g);d.push(h)}a.setSoundChannel(c);return!0},_readSequences:function(){for(var a=this._animationManager.getSequences(),b=this.readInt(!1), c=0;c<b;c++){var d=new cc.BuilderSequence;d.setDuration(this.readFloat());d.setName(this.readCachedString());d.setSequenceId(this.readInt(!1));d.setChainedSequenceId(this.readInt(!0));if(!this._readCallbackKeyframesForSeq(d)||!this._readSoundKeyframesForSeq(d))return!1;a.push(d)}this._animationManager.setAutoPlaySequenceId(this.readInt(!0));return!0},readKeyframe:function(a){var b=new cc.BuilderKeyframe;b.setTime(this.readFloat());var c=this.readInt(!1),d=0,e=null;if(c===CCB_KEYFRAME_EASING_CUBIC_IN|| c===CCB_KEYFRAME_EASING_CUBIC_OUT||c===CCB_KEYFRAME_EASING_CUBIC_INOUT||c===CCB_KEYFRAME_EASING_ELASTIC_IN||c===CCB_KEYFRAME_EASING_ELASTIC_OUT||c===CCB_KEYFRAME_EASING_ELASTIC_INOUT)d=this.readFloat();b.setEasingType(c);b.setEasingOpt(d);a===CCB_PROPTYPE_CHECK?e=!!this._data[this._currentByte++]:a===CCB_PROPTYPE_BYTE?e=this._data[this._currentByte++]:a===CCB_PROPTYPE_COLOR3?e=cc.color(this._data[this._currentByte++],this._data[this._currentByte++],this._data[this._currentByte++]):a===CCB_PROPTYPE_FLOATXY? e=[this.readFloat(),this.readFloat()]:a===CCB_PROPTYPE_DEGREES?e=this.readFloat():a===CCB_PROPTYPE_SCALELOCK||a===CCB_PROPTYPE_POSITION||a===CCB_PROPTYPE_FLOATXY?e=[this.readFloat(),this.readFloat()]:a===CCB_PROPTYPE_SPRITEFRAME&&(a=this.readCachedString(),c=this.readCachedString(),""===a?(c=this._ccbRootPath+c,a=cc.textureCache.addImage(c),c=a.getContentSize(),c=cc.rect(0,0,c.width,c.height),e=new cc.SpriteFrame(a,c)):(a=this._ccbRootPath+a,d=cc.spriteFrameCache,-1===this._loadedSpriteSheets.indexOf(a)&& (d.addSpriteFrames(a),this._loadedSpriteSheets.push(a)),e=d.getSpriteFrame(c)));b.setValue(e);return b},_readHeader:function(){if(!this._data)return!1;var a=this._readStringFromBytes(this._currentByte,4,!0);this._currentByte+=4;if("ccbi"!==a)return!1;a=this.readInt(!1);if(a!==CCB_VERSION)return cc.log("WARNING! Incompatible ccbi file version (file: "+a+" reader: "+CCB_VERSION+")"),!1;this._jsControlled=!!this._data[this._currentByte++];this._animationManager._jsControlled=this._jsControlled;return!0}, _readStringFromBytes:function(a,b,c){var d="",e=this._data;if(c)for(c=b-1;0<=c;c--)d+=String.fromCharCode(e[a+c]);else for(c=0;c<b;c++)d+=String.fromCharCode(e[a+c]);return d},_readStringCache:function(){for(var a=this.readInt(!1),b=0;b<a;b++)this._readStringCacheEntry();return!0},_readStringCacheEntry:function(){for(var a=this._data[this._currentByte++],b=this._data[this._currentByte++],a=a<<8|b,b="",c=this._data,d=this._currentByte,e=0;e<a;e++)var f=c[d+e].toString("16").toUpperCase(),f=1<f.length? f:"0"+f,b=b+("%"+f);b=decodeURIComponent(b);this._currentByte+=a;this._stringCache.push(b)},_readNodeGraph:function(a){var b=this.readCachedString(),c,d=this._jsControlled,e=this._animationManager;d&&(c=this.readCachedString());var f=this.readInt(!1),g;f!==CCB_TARGETTYPE_NONE&&(g=this.readCachedString());(b=this._ccNodeLoaderLibrary.getCCNodeLoader(b))||(b=this._ccNodeLoaderLibrary.getCCNodeLoader("CCNode"));var h=b.loadCCNode(a,this);e.getRootNode()||e.setRootNode(h);d&&h===e.getRootNode()&&e.setDocumentControllerName(c); var k=new cc._Dictionary,m=this._animatedProps=[],n=this.readInt(!1);for(c=0;c<n;++c){for(var p=this.readInt(!1),r=new cc._Dictionary,s=this.readInt(!1),u=0;u<s;++u){var t=new cc.BuilderSequenceProperty;t.setName(this.readCachedString());t.setType(this.readInt(!1));m.push(t.getName());for(var v=this.readInt(!1),w=t.getKeyframes(),x=0;x<v;++x){var B=this.readKeyframe(t.getType());w.push(B)}r.setObject(t,t.getName())}k.setObject(r,p)}0<k.count()&&e.addNode(h,k);b.parseProperties(h,a,this);if(a=!!h.ccbFileNode)c= h.ccbFileNode,c.setPosition(h.getPosition()),c.setRotation(h.getRotation()),c.setScaleX(h.getScaleX()),c.setScaleY(h.getScaleY()),c.setTag(h.getTag()),c.setVisible(!0),e.moveAnimationsFromNode(h,c),h.ccbFileNode=null,h=c;m=k=null;if(f!==CCB_TARGETTYPE_NONE)if(d)f===CCB_TARGETTYPE_DOCUMENTROOT?(e.addDocumentOutletName(g),e.addDocumentOutletNode(h)):(this._ownerOutletNames.push(g),this._ownerOutletNodes.push(h));else if(f===CCB_TARGETTYPE_DOCUMENTROOT?k=e.getRootNode():f===CCB_TARGETTYPE_OWNER&&(k= this._owner),!k&&(c=!1,k.onAssignCCBMemberVariable&&(c=k.onAssignCCBMemberVariable(k,g,h)),m=this._ccbMemberVariableAssigner,!c&&null!=m&&m.onAssignCCBMemberVariable))m.onAssignCCBMemberVariable(k,g,h);if(0<b.getCustomProperties().length&&(g=!1,!d&&(k=h,null!=k&&null!=k.onAssignCCBCustomProperty)))for(d=b.getCustomProperties(),e=d.allKeys(),c=0;c<e.length;c++)if(f=d.objectForKey(e[c]),g=k.onAssignCCBCustomProperty(k,e[c],f),m=this._ccbMemberVariableAssigner,!g&&null!=m&&null!=m.onAssignCCBCustomProperty)m.onAssignCCBCustomProperty(k, e[c],f);this._animatedProps=null;d=this.readInt(!1);for(c=0;c<d;c++)g=this._readNodeGraph(h),h.addChild(g);if(!a)if(null!=h&&h.onNodeLoaded)h.onNodeLoaded(h,b);else if(null!=this._ccNodeLoaderListener)this._ccNodeLoaderListener.onNodeLoaded(h,b);return h},_readUTF8:function(){}});cc.BuilderReader._ccbResolutionScale=1;cc.BuilderReader.setResolutionScale=function(a){cc.BuilderReader._ccbResolutionScale=a};cc.BuilderReader.getResolutionScale=function(){return cc.BuilderReader._ccbResolutionScale}; cc.BuilderReader.loadAsScene=function(a,b,c,d){d=d||cc.BuilderReader.getResourcePath();a=cc.BuilderReader.load(a,b,c,d);b=new cc.Scene;b.addChild(a);return b};cc.BuilderReader._controllerClassCache={};cc.BuilderReader.registerController=function(a,b){cc.BuilderReader._controllerClassCache[a]=cc.Class.extend(b)}; cc.BuilderReader.load=function(a,b,c,d){d=d||cc.BuilderReader.getResourcePath();var e=new cc.BuilderReader(cc.NodeLoaderLibrary.newDefaultCCNodeLoaderLibrary());e.setCCBRootPath(d);if(5>a.length||a.toLowerCase().lastIndexOf(".ccbi")!==a.length-5)a+=".ccbi";a=e.readNodeGraphFromFile(a,b,c);var f,g,h;if(b){d=e.getOwnerCallbackNames();var k=e.getOwnerCallbackNodes(),m=e.getOwnerCallbackControlEvents();for(c=0;c<d.length;c++)f=d[c],g=k[c],h=m[c],g instanceof cc.ControlButton?g.addTargetWithActionForControlEvents(b, b[f],h):g.setCallback(b[f],b);d=e.getOwnerOutletNames();k=e.getOwnerOutletNodes();for(c=0;c<d.length;c++)f=d[c],g=k[c],b[f]=g}d=e.getNodesWithAnimationManagers();e=e.getAnimationManagersForNodes();if(!d||!e)return a;k=cc.BuilderReader._controllerClassCache;for(c=0;c<d.length;c++){var n=d[c],p=e[c];n.animationManager=p;if(f=p.getDocumentControllerName()){m=k[f];if(!m)throw Error("Can not find controller : "+f);m=new m;m.controllerName=f;n.controller=m;m.rootNode=n;for(var r=p.getDocumentCallbackNames(), s=p.getDocumentCallbackNodes(),u=p.getDocumentCallbackControlEvents(),n=0;n<r.length;n++)f=r[n],g=s[n],h=u[n],g instanceof cc.ControlButton?g.addTargetWithActionForControlEvents(m,m[f],h):g.setCallback(m[f],m);h=p.getDocumentOutletNames();r=p.getDocumentOutletNodes();for(n=0;n<h.length;n++)f=h[n],g=r[n],m[f]=g;if(m.onDidLoadFromCCB&&cc.isFunction(m.onDidLoadFromCCB))m.onDidLoadFromCCB();f=p.getKeyframeCallbacks();for(n=0;n<f.length;n++)h=f[n].split(":"),g=h[0],h=h[1],1==g?p.setCallFunc(cc.callFunc(m[h], m),f[n]):2==g&&b&&p.setCallFunc(cc.callFunc(b[h],b),f[n])}}p.runAnimations(p.getAutoPlaySequenceId(),0);return a};cc.BuilderReader._resourcePath="";cc.BuilderReader.setResourcePath=function(a){cc.BuilderReader._resourcePath=a};cc.BuilderReader.getResourcePath=function(){return cc.BuilderReader._resourcePath};cc.BuilderReader.lastPathComponent=function(a){var b=a.lastIndexOf("/");return-1!==b?a.substring(b+1,a.length-b):a}; cc.BuilderReader.deletePathExtension=function(a){var b=a.lastIndexOf(".");return-1!==b?a.substring(0,b):a};cc.BuilderReader.toLowerCase=function(a){return a.toLowerCase()};cc.BuilderReader.endsWith=function(a,b){return a.length>=b.length?0===a.lastIndexOf(b):!1};cc.BuilderReader.concat=function(a,b){return a+b};cc.loader.register(["ccbi"],cc._binaryLoader);cc.INT_VALUE=0;cc.FLOAT_VALUE=1;cc.POINTER_VALUE=2;cc.BOOL_VALUE=3;cc.UNSIGNEDCHAR_VALUE=4;cc.BuilderValue=cc.Class.extend({_value:null,_type:0,getIntValue:function(){},getFloatValue:function(){},getBoolValue:function(){},getByteValue:function(){},getPointer:function(){},getValue:function(){return this._value}});cc.BuilderValue.create=function(a){return new cc.BuilderValue};cc.BuilderKeyframe=cc.Class.extend({_value:null,_time:0,_easingType:0,_easingOpt:0,getValue:function(){return this._value},setValue:function(a){this._value=a},getTime:function(){return this._time},setTime:function(a){this._time=a},getEasingType:function(){return this._easingType},setEasingType:function(a){this._easingType=a},getEasingOpt:function(){return this._easingOpt},setEasingOpt:function(a){this._easingOpt=a}});cc.BuilderSequence=cc.Class.extend({_duration:0,_name:"",_sequenceId:0,_chainedSequenceId:0,_callbackChannel:null,_soundChannel:null,ctor:function(){this._name=""},getDuration:function(){return this._duration},setDuration:function(a){this._duration=a},getName:function(){return this._name},setName:function(a){this._name=a},getSequenceId:function(){return this._sequenceId},setSequenceId:function(a){this._sequenceId=a},getChainedSequenceId:function(){return this._chainedSequenceId},setChainedSequenceId:function(a){this._chainedSequenceId= a},getCallbackChannel:function(){return this._callbackChannel},setCallbackChannel:function(a){this._callbackChannel=a},getSoundChannel:function(){return this._soundChannel},setSoundChannel:function(a){this._soundChannel=a}}); cc.BuilderSequenceProperty=cc.Class.extend({_name:null,_type:0,_keyFrames:null,ctor:function(){this.init()},init:function(){this._keyFrames=[];this._name=""},getName:function(){return this._name},setName:function(a){this._name=a},getType:function(){return this._type},setType:function(a){this._type=a},getKeyframes:function(){return this._keyFrames}});cc.getAbsolutePosition=function(a,b,c,d,e,f){e=f||cc.p(0,0);c===CCB_POSITIONTYPE_RELATIVE_BOTTOM_LEFT?(e.x=a,e.y=b):c===CCB_POSITIONTYPE_RELATIVE_TOP_LEFT?(e.x=a,e.y=d.height-b):c===CCB_POSITIONTYPE_RELATIVE_TOP_RIGHT?(e.x=d.width-a,e.y=d.height-b):c===CCB_POSITIONTYPE_RELATIVE_BOTTOM_RIGHT?(e.x=d.width-a,e.y=b):c===CCB_POSITIONTYPE_PERCENT?(e.x=d.width*a/100,e.y=d.height*b/100):c===CCB_POSITIONTYPE_MULTIPLY_RESOLUTION&&(c=cc.BuilderReader.getResolutionScale(),e.x=a*c,e.y=b*c);return e}; cc.setRelativeScale=function(a,b,c,d,e){if(!a)throw Error("cc.setRelativeScale(): node should be non-null");d===CCB_POSITIONTYPE_MULTIPLY_RESOLUTION&&(d=cc.BuilderReader.getResolutionScale(),b*=d,c*=d);a.setScale(b,c)};(function(){var a=cc.p();cc.BuilderAnimationManagerDelegate=cc.Class.extend({completedAnimationSequenceNamed:function(a){}});cc.BuilderAnimationManager=cc.Class.extend({_sequences:null,_nodeSequences:null,_baseValues:null,_autoPlaySequenceId:0,_rootNode:null,_owner:null,_rootContainerSize:null,_delegate:null,_runningSequence:null,_documentOutletNames:null,_documentOutletNodes:null,_documentCallbackNames:null,_documentCallbackNodes:null,_documentCallbackControlEvents:null,_documentControllerName:"", _lastCompletedSequenceName:"",_keyframeCallbacks:null,_keyframeCallFuncs:null,_animationCompleteCallbackFunc:null,_target:null,_jsControlled:!1,ctor:function(){this._rootContainerSize=cc.size(0,0);this.init()},init:function(){this._sequences=[];this._nodeSequences=new cc._Dictionary;this._baseValues=new cc._Dictionary;this._documentOutletNames=[];this._documentOutletNodes=[];this._documentCallbackNames=[];this._documentCallbackNodes=[];this._documentCallbackControlEvents=[];this._keyframeCallbacks= [];this._keyframeCallFuncs={};return!0},getSequences:function(){return this._sequences},setSequences:function(a){this._sequences=a},getAutoPlaySequenceId:function(){return this._autoPlaySequenceId},setAutoPlaySequenceId:function(a){this._autoPlaySequenceId=a},getRootNode:function(){return this._rootNode},setRootNode:function(a){this._rootNode=a},getOwner:function(){return this._owner},setOwner:function(a){this._owner=a},addDocumentCallbackNode:function(a){this._documentCallbackNodes.push(a)},addDocumentCallbackName:function(a){this._documentCallbackNames.push(a)}, addDocumentCallbackControlEvents:function(a){this._documentCallbackControlEvents.push(a)},addDocumentOutletNode:function(a){this._documentOutletNodes.push(a)},addDocumentOutletName:function(a){this._documentOutletNames.push(a)},setDocumentControllerName:function(a){this._documentControllerName=a},getDocumentControllerName:function(){return this._documentControllerName},getDocumentCallbackNames:function(){return this._documentCallbackNames},getDocumentCallbackNodes:function(){return this._documentCallbackNodes}, getDocumentCallbackControlEvents:function(){return this._documentCallbackControlEvents},getDocumentOutletNames:function(){return this._documentOutletNames},getDocumentOutletNodes:function(){return this._documentOutletNodes},getLastCompletedSequenceName:function(){return this._lastCompletedSequenceName},getKeyframeCallbacks:function(){return this._keyframeCallbacks},getRootContainerSize:function(){return this._rootContainerSize},setRootContainerSize:function(a){this._rootContainerSize=cc.size(a.width, a.height)},getDelegate:function(){return this._delegate},setDelegate:function(a){this._delegate=a},getRunningSequenceName:function(){return this._runningSequence?this._runningSequence.getName():null},getContainerSize:function(a){return a?a.getContentSize():this._rootContainerSize},addNode:function(a,c){this._nodeSequences.setObject(c,a)},setBaseValue:function(a,c,d){var e=this._baseValues.objectForKey(c);e||(e=new cc._Dictionary,this._baseValues.setObject(e,c));e.setObject(a,d)},moveAnimationsFromNode:function(a, c){var d=this._baseValues,e=d.objectForKey(a);null!==e&&(d.setObject(e,c),d.removeObjectForKey(a));d=this._nodeSequences;e=d.objectForKey(a);null!=e&&(d.setObject(e,c),d.removeObjectForKey(a))},getActionForCallbackChannel:function(a){var c=0,d=[];a=a.getKeyframes();for(var e=a.length,f=0;f<e;++f){var g=a[f],h=g.getTime()-c,c=g.getTime();0<h&&d.push(cc.delayTime(h));h=g.getValue();g=h[0];h=h[1];if(this._jsControlled)g=this._keyframeCallFuncs[h+":"+g],null!=g&&d.push(g);else{var k;h===CCB_TARGETTYPE_DOCUMENTROOT? k=this._rootNode:h===CCB_TARGETTYPE_OWNER&&(k=this._owner);null!=k&&(0<g.length?(h=0,null!=k.onResolveCCBCCCallFuncSelector&&(h=k.onResolveCCBCCCallFuncSelector(k,g)),0===h?cc.log("Skipping selector '"+g+"' since no CCBSelectorResolver is present."):d.push(cc.callFunc(h,k))):cc.log("Unexpected empty selector."))}}return 1>d.length?null:cc.sequence(d)},getActionForSoundChannel:function(a){var c=0,d=[];a=a.getKeyframes();for(var e=a.length,f=0;f<e;++f){var g=a[f],h=g.getTime()-c,c=g.getTime();0<h&& d.push(cc.delayTime(h));var k=g.getValue(),g=cc.BuilderReader.getResourcePath()+k[0],h=parseFloat(k[1]),m=parseFloat(k[2]),k=parseFloat(k[3]);d.push(cc.BuilderSoundEffect.create(g,h,m,k))}return 1>d.length?null:cc.sequence(d)},runAnimationsForSequenceNamed:function(a){this.runAnimationsForSequenceIdTweenDuration(this._getSequenceId(a),0)},runAnimationsForSequenceNamedTweenDuration:function(a,c){this.runAnimationsForSequenceIdTweenDuration(this._getSequenceId(a),c)},runAnimationsForSequenceIdTweenDuration:function(a, c){if(-1===a)throw Error("cc.BuilderAnimationManager.runAnimationsForSequenceIdTweenDuration(): Sequence id should not be -1");c=c||0;this._rootNode.stopAllActions();for(var d=this._nodeSequences.allKeys(),e=0,f=d.length;e<f;e++){var g=d[e];g.stopAllActions();var h=this._nodeSequences.objectForKey(g).objectForKey(a),k,m=[];if(h){var n=h.allKeys();for(k=0;k<n.length;k++){var p=n[k],r=h.objectForKey(p);m.push(p);this._setFirstFrame(g,r,c);this._runAction(g,r,c)}}if(h=this._baseValues.objectForKey(g))for(n= h.allKeys(),k=0;k<n.length;k++)p=n[k],-1===m.indexOf(p)&&(r=h.objectForKey(p),null!=r&&this._setAnimatedProperty(p,g,r,c))}d=this._getSequence(a);e=cc.sequence(cc.delayTime(d.getDuration()+c),cc.callFunc(this._sequenceCompleted,this));this._rootNode.runAction(e);d.getCallbackChannel()&&(e=this.getActionForCallbackChannel(d.getCallbackChannel()))&&this._rootNode.runAction(e);d.getSoundChannel()&&(e=this.getActionForSoundChannel(d.getSoundChannel()))&&this._rootNode.runAction(e);this._runningSequence= this._getSequence(a)},runAnimations:function(a,c){c=c||0;var d;d=cc.isString(a)?this._getSequenceId(a):a;this.runAnimationsForSequenceIdTweenDuration(d,c)},setAnimationCompletedCallback:function(a,c){this._target=a;this._animationCompleteCallbackFunc=c},setCompletedAnimationCallback:function(a,c){this.setAnimationCompletedCallback(a,c)},setCallFunc:function(a,c){this._keyframeCallFuncs[c]=a},debug:function(){},_getBaseValue:function(a,c){var d=this._baseValues.objectForKey(a);return d?d.objectForKey(c): null},_getSequenceId:function(a){for(var c=null,d=this._sequences,e=0,f=d.length;e<f;e++)if((c=d[e])&&c.getName()===a)return c.getSequenceId();return-1},_getSequence:function(a){for(var c=null,d=this._sequences,e=0,f=d.length;e<f;e++)if((c=d[e])&&c.getSequenceId()===a)return c;return null},_getAction:function(a,c,d,e){a=c.getTime()-(a?a.getTime():0);var f,g;if("rotation"===d)return cc.BuilderRotateTo.create(a,c.getValue());if("rotationX"===d)return cc.BuilderRotateXTo.create(a,c.getValue());if("rotationY"=== d)return cc.BuilderRotateYTo.create(a,c.getValue());if("opacity"===d)return cc.fadeTo(a,c.getValue());if("color"===d)return d=c.getValue(),cc.tintTo(a,d.r,d.g,d.b);if("visible"===d)return c.getValue()?cc.sequence(cc.delayTime(a),cc.show()):cc.sequence(cc.delayTime(a),cc.hide());if("displayFrame"===d)return cc.sequence(cc.delayTime(a),cc.BuilderSetSpriteFrame.create(c.getValue()));if("position"===d)return f=this._getBaseValue(e,d),f=f[2],g=c.getValue(),c=g[0],g=g[1],e=this.getContainerSize(e.getParent()), d=cc.getAbsolutePosition(c,g,f,e,d),cc.moveTo(a,d);if("scale"===d)return f=this._getBaseValue(e,d),f=f[2],g=c.getValue(),c=g[0],g=g[1],f===CCB_SCALETYPE_MULTIPLY_RESOLUTION&&(d=cc.BuilderReader.getResolutionScale(),c*=d,g*=d),cc.scaleTo(a,c,g);if("skew"===d)return g=c.getValue(),c=g[0],g=g[1],cc.skewTo(a,c,g);cc.log("BuilderReader: Failed to create animation for property: "+d);return null},_setAnimatedProperty:function(b,c,d,e){if(0<e){var f=new cc.BuilderKeyframe;f.setValue(d);f.setTime(e);f.setEasingType(CCB_KEYFRAME_EASING_LINEAR); b=this._getAction(null,f,b,c);c.runAction(b)}else{if("position"===b)e=this._getBaseValue(c,b),e=e[2],f=d[0],d=d[1],cc.getAbsolutePosition(f,d,e,this.getContainerSize(c.getParent()),b,a),c._position.x=a.x,c._position.y=a.y;else if("scale"===b)e=this._getBaseValue(c,b),e=e[2],f=d[0],d=d[1],cc.setRelativeScale(c,f,d,e,b);else if("skew"===b)f=d[0],d=d[1],c._skewX=f,c._skewY=d;else if("rotation"===b)c.setRotation(d);else if("rotationX"===b)c._rotationX=d;else if("rotationY"===b)c._rotationY=d;else if("opacity"=== b)c._realOpacity=d;else if("displayFrame"===b)c.setSpriteFrame(d);else if("color"===b)255===d.r&&255===d.g&&255===d.b||c.setColor(d);else if("visible"===b)c.setVisible(d||!1);else{cc.log("unsupported property name is "+b);return}c.setNodeDirty()}},_setFirstFrame:function(a,c,d){var e=c.getKeyframes();0===e.length?((e=this._getBaseValue(a,c.getName()))||cc.log("cc.BuilderAnimationManager._setFirstFrame(): No baseValue found for property"),this._setAnimatedProperty(c.getName(),a,e,d)):(e=e[0],this._setAnimatedProperty(c.getName(), a,e.getValue(),d))},_getEaseAction:function(a,c,d){if(c===CCB_KEYFRAME_EASING_LINEAR||c===CCB_KEYFRAME_EASING_INSTANT)return a;if(c===CCB_KEYFRAME_EASING_CUBIC_IN)return a.easing(cc.easeIn(d));if(c===CCB_KEYFRAME_EASING_CUBIC_OUT)return a.easing(cc.easeOut(d));if(c===CCB_KEYFRAME_EASING_CUBIC_INOUT)return a.easing(cc.easeInOut(d));if(c===CCB_KEYFRAME_EASING_BACK_IN)return a.easing(cc.easeBackIn());if(c===CCB_KEYFRAME_EASING_BACK_OUT)return a.easing(cc.easeBackOut());if(c===CCB_KEYFRAME_EASING_BACK_INOUT)return a.easing(cc.easeBackInOut()); if(c===CCB_KEYFRAME_EASING_BOUNCE_IN)return a.easing(cc.easeBounceIn());if(c===CCB_KEYFRAME_EASING_BOUNCE_OUT)return a.easing(cc.easeBounceOut());if(c===CCB_KEYFRAME_EASING_BOUNCE_INOUT)return a.easing(cc.easeBounceInOut());if(c===CCB_KEYFRAME_EASING_ELASTIC_IN)return a.easing(cc.easeElasticIn(d));if(c===CCB_KEYFRAME_EASING_ELASTIC_OUT)return a.easing(cc.easeElasticOut(d));if(c===CCB_KEYFRAME_EASING_ELASTIC_INOUT)return a.easing(cc.easeElasticInOut(d));cc.log("BuilderReader: Unknown easing type "+ c);return a},_runAction:function(a,c,d){var e=c.getKeyframes(),f=e.length;if(1<f){var g=[];d=e[0].getTime()+d;0<d&&g.push(cc.delayTime(d));for(d=0;d<f-1;++d){var h=e[d],k=this._getAction(h,e[d+1],c.getName(),a);k&&(k=this._getEaseAction(k,h.getEasingType(),h.getEasingOpt()),g.push(k))}a.runAction(cc.sequence(g))}},_sequenceCompleted:function(){var a=this._runningSequence,c=a.getName();this._lastCompletedSequenceName!=a.getName()&&(this._lastCompletedSequenceName=a.getName());a=a.getChainedSequenceId(); this._runningSequence=null;-1!==a&&this.runAnimations(a,0);this._delegate&&this._delegate.completedAnimationSequenceNamed(c);this._target&&this._animationCompleteCallbackFunc&&this._animationCompleteCallbackFunc.call(this._target)}});cc.BuilderSetSpriteFrame=cc.ActionInstant.extend({_spriteFrame:null,initWithSpriteFrame:function(a){this._spriteFrame=a;return!0},update:function(a){this.target.setSpriteFrame(this._spriteFrame)}});cc.BuilderSetSpriteFrame.create=function(a){var c=new cc.BuilderSetSpriteFrame; return c&&c.initWithSpriteFrame(a)?c:null};cc.BuilderRotateTo=cc.ActionInterval.extend({_startAngle:0,_dstAngle:0,_diffAngle:0,initWithDuration:function(a,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._dstAngle=c,!0):!1},update:function(a){this.target.setRotation(this._startAngle+this._diffAngle*a)},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._startAngle=this.target.getRotation();this._diffAngle=this._dstAngle-this._startAngle}}); cc.BuilderRotateTo.create=function(a,c){var d=new cc.BuilderRotateTo;return d&&d.initWithDuration(a,c)?d:null};cc.BuilderRotateXTo=cc.ActionInterval.extend({});cc.BuilderRotateXTo.create=function(a,c){throw Error("rotationX has not been implemented in cocos2d-html5");};cc.BuilderRotateYTo=cc.ActionInterval.extend({});cc.BuilderRotateYTo.create=function(a,c){throw Error("rotationY has not been implemented in cocos2d-html5");};cc.BuilderSoundEffect=cc.ActionInstant.extend({init:function(a){this._file= a;return!0},update:function(a){cc.audioEngine.playEffect(this._file)}});cc.BuilderSoundEffect.create=function(a,c,d,e){return(c=new cc.BuilderSoundEffect)&&c.init(a)?c:null}})();cc.KEYBOARD_RETURNTYPE_DEFAULT=0;cc.KEYBOARD_RETURNTYPE_DONE=1;cc.KEYBOARD_RETURNTYPE_SEND=2;cc.KEYBOARD_RETURNTYPE_SEARCH=3;cc.KEYBOARD_RETURNTYPE_GO=4;cc.EDITBOX_INPUT_MODE_ANY=0;cc.EDITBOX_INPUT_MODE_EMAILADDR=1;cc.EDITBOX_INPUT_MODE_NUMERIC=2;cc.EDITBOX_INPUT_MODE_PHONENUMBER=3;cc.EDITBOX_INPUT_MODE_URL=4;cc.EDITBOX_INPUT_MODE_DECIMAL=5;cc.EDITBOX_INPUT_MODE_SINGLELINE=6;cc.EDITBOX_INPUT_FLAG_PASSWORD=0;cc.EDITBOX_INPUT_FLAG_SENSITIVE=1;cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD=2; cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_SENTENCE=3;cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS=4;cc.EditBoxDelegate=cc.Class.extend({editBoxEditingDidBegan:function(a){},editBoxEditingDidEnded:function(a){},editBoxTextChanged:function(a,b){},editBoxEditingReturn:function(a){}}); cc.EditBox=cc.Node.extend({_backgroundSprite:null,_delegate:null,_editBoxInputMode:cc.EDITBOX_INPUT_MODE_ANY,_editBoxInputFlag:cc.EDITBOX_INPUT_FLAG_SENSITIVE,_keyboardReturnType:cc.KEYBOARD_RETURNTYPE_DEFAULT,_maxLength:50,_text:"",_textColor:null,_placeholderText:"",_placeholderFontName:"",_placeholderFontSize:14,_placeholderColor:null,_className:"EditBox",_touchEnabled:!0,ctor:function(a,b){cc.Node.prototype.ctor.call(this);this.setAnchorPoint(cc.p(0.5,0.5));this._textColor=cc.color.WHITE;this._placeholderColor= cc.color.GRAY;cc.Node.prototype.setContentSize.call(this,a);this._renderCmd._createLabels();this.createDomElementIfNeeded();this.initWithSizeAndBackgroundSprite(a,b);cc.eventManager.addListener({event:cc.EventListener.TOUCH_ONE_BY_ONE,swallowTouches:!0,onTouchBegan:this._onTouchBegan.bind(this),onTouchEnded:this._onTouchEnded.bind(this)},this);this._touchEnabled=!0;this.setInputFlag(this._editBoxInputFlag)},setTouchEnabled:function(a){this._touchEnabled=a},_createRenderCmd:function(){return cc._renderType=== cc.game.RENDER_TYPE_CANVAS?new cc.EditBox.CanvasRenderCmd(this):new cc.EditBox.WebGLRenderCmd(this)},setContentSize:function(a,b){void 0!==a.width&&void 0!==a.height&&(b=a.height,a=a.width);cc.Node.prototype.setContentSize.call(this,a,b);this._updateEditBoxSize(a,b)},setVisible:function(a){cc.Node.prototype.setVisible.call(this,a);this._renderCmd.updateVisibility()},createDomElementIfNeeded:function(){this._renderCmd._edTxt||this._renderCmd.createNativeControl()},setTabIndex:function(a){this._renderCmd._edTxt&& (this._renderCmd._edTxt.tabIndex=a)},getTabIndex:function(){if(this._renderCmd._edTxt)return this._renderCmd._edTxt.tabIndex;cc.warn("The dom control is not created!");return-1},setFocus:function(){this._renderCmd._edTxt&&this._renderCmd._edTxt.focus()},isFocused:function(){if(this._renderCmd._edTxt)return document.activeElement===this._renderCmd._edTxt;cc.warn("The dom control is not created!");return!1},stayOnTop:function(a){this._alwaysOnTop!==a&&(this._alwaysOnTop=a,this._renderCmd.stayOnTop(this._alwaysOnTop))}, cleanup:function(){this._super();this._renderCmd._removeDomInputControl()},_onTouchBegan:function(a){if(!this._touchEnabled)return!1;a=a.getLocation();var b=cc.rect(0,0,this._contentSize.width,this._contentSize.height);if(cc.rectContainsPoint(b,this.convertToNodeSpace(a)))return!0;this._renderCmd.hidden();return!1},_onTouchEnded:function(){this._renderCmd.show()},_updateBackgroundSpriteSize:function(a,b){this._backgroundSprite&&this._backgroundSprite.setContentSize(a,b)},_updateEditBoxSize:function(a, b){var c="number"===typeof a.width?a.width:a,d="number"===typeof a.height?a.height:b;this._updateBackgroundSpriteSize(c,d);this._renderCmd.updateSize(c,d)},setLineHeight:function(a){this._renderCmd.setLineHeight(a)},setFont:function(a,b){this._renderCmd.setFont(a,b)},_setFont:function(a){this._renderCmd._setFont(a)},getBackgroundSprite:function(){return this._backgroundSprite},setFontName:function(a){this._renderCmd.setFontName(a)},setFontSize:function(a){this._renderCmd.setFontSize(a)},setString:function(a){a.length>= this._maxLength&&(a=a.slice(0,this._maxLength));this._text=a;this._renderCmd.setString(a)},setFontColor:function(a){this._textColor=a;this._renderCmd.setFontColor(a)},setMaxLength:function(a){isNaN(a)||(0>a&&(a=65535),this._maxLength=a,this._renderCmd.setMaxLength(a))},getMaxLength:function(){return this._maxLength},setPlaceHolder:function(a){null!==a&&(this._renderCmd.setPlaceHolder(a),this._placeholderText=a)},setPlaceholderFont:function(a,b){this._placeholderFontName=a;this._placeholderFontSize= b;this._renderCmd._updateDOMPlaceholderFontStyle()},_setPlaceholderFont:function(a){if(a=cc.LabelTTF._fontStyleRE.exec(a))this._placeholderFontName=a[2],this._placeholderFontSize=parseInt(a[1]),this._renderCmd._updateDOMPlaceholderFontStyle()},setPlaceholderFontName:function(a){this._placeholderFontName=a;this._renderCmd._updateDOMPlaceholderFontStyle()},setPlaceholderFontSize:function(a){this._placeholderFontSize=a;this._renderCmd._updateDOMPlaceholderFontStyle()},setPlaceholderFontColor:function(a){this._placeholderColor= a;this._renderCmd.setPlaceholderFontColor(a)},setInputFlag:function(a){this._editBoxInputFlag=a;this._renderCmd.setInputFlag(a)},getString:function(){return this._text},initWithSizeAndBackgroundSprite:function(a,b){this._backgroundSprite&&this._backgroundSprite.removeFromParent();this._backgroundSprite=b;this.setContentSize(a);this._backgroundSprite&&!this._backgroundSprite.parent&&(this._backgroundSprite.setAnchorPoint(cc.p(0,0)),this.addChild(this._backgroundSprite),this._updateBackgroundSpriteSize(a.width, a.height));this.y=this.x=0;return!0},setDelegate:function(a){this._delegate=a},getPlaceHolder:function(){return this._placeholderText},setInputMode:function(a){if(this._editBoxInputMode!==a){var b=this.getString();this._editBoxInputMode=a;this._renderCmd.setInputMode(a);this._renderCmd.transform();this.setString(b);this._renderCmd._updateLabelPosition(this.getContentSize())}},setReturnType:function(a){this._keyboardReturnType=a},initWithBackgroundColor:function(a,b){this._edWidth=a.width;this.dom.style.width= this._edWidth.toString()+"px";this._edHeight=a.height;this.dom.style.height=this._edHeight.toString()+"px";this.dom.style.backgroundColor=cc.colorToHex(b)}});_p=cc.EditBox.prototype;cc.defineGetterSetter(_p,"font",null,_p._setFont);cc.defineGetterSetter(_p,"fontName",null,_p.setFontName);cc.defineGetterSetter(_p,"fontSize",null,_p.setFontSize);cc.defineGetterSetter(_p,"fontColor",null,_p.setFontColor);cc.defineGetterSetter(_p,"string",_p.getString,_p.setString); cc.defineGetterSetter(_p,"maxLength",_p.getMaxLength,_p.setMaxLength);cc.defineGetterSetter(_p,"placeholder",_p.getPlaceHolder,_p.setPlaceHolder);cc.defineGetterSetter(_p,"placeholderFont",null,_p._setPlaceholderFont);cc.defineGetterSetter(_p,"placeholderFontName",null,_p.setPlaceholderFontName);cc.defineGetterSetter(_p,"placeholderFontSize",null,_p.setPlaceholderFontSize);cc.defineGetterSetter(_p,"placeholderFontColor",null,_p.setPlaceholderFontColor);cc.defineGetterSetter(_p,"inputFlag",null,_p.setInputFlag); cc.defineGetterSetter(_p,"delegate",null,_p.setDelegate);cc.defineGetterSetter(_p,"inputMode",null,_p.setInputMode);cc.defineGetterSetter(_p,"returnType",null,_p.setReturnType);_p=null;cc.EditBox.create=function(a,b,c,d){return new cc.EditBox(a,b,c,d)};(function(a){a._polyfill={zoomInvalid:!1};cc.sys.OS_ANDROID!==cc.sys.os||cc.sys.browserType!==cc.sys.BROWSER_TYPE_SOUGOU&&cc.sys.browserType!==cc.sys.BROWSER_TYPE_360||(a._polyfill.zoomInvalid=!0)})(cc.EditBox); (function(a){function b(a){var b=a.convertToWorldSpace(cc.p(0,0)),c=cc.visibleRect.height,d=0.5;cc.visibleRect.width>c&&(d=0.7);setTimeout(function(){if(window.scrollY<e&&b.y<c*d){var a=c*d-b.y-window.scrollY;35>a&&(a=35);320<a&&(a=320);window.scrollTo(0,a)}},f)}function c(a){return a.replace(/(?:^|\s)\S/g,function(a){return a.toUpperCase()})}function d(a,b){var c=Object.getOwnPropertyDescriptor(a,b);return c?c:(c=Object.getPrototypeOf(a))?d(c,b):null}var e=40,f=400,g=function(){}.prototype=Object.create(Object.prototype); g.updateMatrix=function(){if(this._edTxt){var b=this._node,c=cc.view._scaleX,d=cc.view._scaleY,e=cc.view._devicePixelRatio,f=this._worldTransform,c=c/e,d=d/e,g=cc.game.container,e=f.a*c,h=f.b,k=f.c,w=f.d*d,x=g&&g.style.paddingLeft&&parseInt(g.style.paddingLeft),g=g&&g.style.paddingBottom&&parseInt(g.style.paddingBottom),c=f.tx*c+x,d=f.ty*d+g;a.zoomInvalid&&(this.updateSize(b._contentSize.width*e,b._contentSize.height*w),w=e=1);b="matrix("+e+","+-h+","+-k+","+w+","+c+","+-d+")";this._edTxt.style.transform= b;this._edTxt.style["-webkit-transform"]=b;this._edTxt.style["transform-origin"]="0px 100% 0px";this._edTxt.style["-webkit-transform-origin"]="0px 100% 0px"}};g.updateVisibility=function(){if(this._edTxt){var a=this._edTxt;if(this._node.visible)a.style.visibility="visible",cc.game.container.appendChild(a);else{a.style.visibility="hidden";var b=!1;(b="contains"in cc.game.container?cc.game.container.contains(a):cc.game.container.compareDocumentPosition(a)%16)&&cc.game.container.removeChild(a)}}};g.stayOnTop= function(a){a?(this._removeLabels(),this._edTxt.style.display=""):(this._createLabels(),this._edTxt.style.display="none",this._updateLabelString())};g._createDomInput=function(){this._removeDomInputControl();var a=this,c=this._edTxt=document.createElement("input");c.type="text";c.style.fontSize=this._edFontSize+"px";c.style.color="#000000";c.style.border=0;c.style.background="transparent";c.style.width="100%";c.style.height="100%";c.style.active=0;c.style.outline="medium";c.style.padding="0";c.style.textTransform= "uppercase";c.style.display="none";c.style.position="absolute";c.style.bottom="0px";c.style.left="2px";c.style.className="cocosEditBox";this.setMaxLength(a._editBox._maxLength);c.addEventListener("input",function(){var b=a._editBox;this.value.length>this.maxLength&&(this.value=this.value.slice(0,this.maxLength));b._delegate&&b._delegate.editBoxTextChanged&&b._text.toLowerCase()!==this.value.toLowerCase()&&(b._text=this.value,a._updateEditBoxContentStyle(),b._delegate.editBoxTextChanged(b,b._text))}); c.addEventListener("keypress",function(b){var c=a._editBox;b.keyCode===cc.KEY.enter&&(b.stopPropagation(),b.preventDefault(),""===this.value&&(this.style.fontSize=c._placeholderFontSize+"px",this.style.color=cc.colorToHex(c._placeholderColor)),c._text=this.value,a._updateEditBoxContentStyle(),a.hidden(),c._delegate&&c._delegate.editBoxEditingReturn&&c._delegate.editBoxEditingReturn(c),cc._canvas.focus())});c.addEventListener("focus",function(){var c=a._editBox;this.style.fontSize=a._edFontSize+"px"; this.style.color=cc.colorToHex(c._textColor);a._hiddenLabels();cc.view.isAutoFullScreenEnabled()?(a.__fullscreen=!0,cc.view.enableAutoFullScreen(!1),cc.screen.exitFullScreen()):a.__fullscreen=!1;this.__autoResize=cc.view.__resizeWithBrowserSize;cc.view.resizeWithBrowserSize(!1);b(c);c._delegate&&c._delegate.editBoxEditingDidBegan&&c._delegate.editBoxEditingDidBegan(c)});c.addEventListener("blur",function(){var b=a._editBox;b._text=this.value;a._updateEditBoxContentStyle();a.__fullscreen&&cc.view.enableAutoFullScreen(!0); this.__autoResize&&cc.view.resizeWithBrowserSize(!0);window.scrollY=0;b._delegate&&b._delegate.editBoxEditingDidEnded&&b._delegate.editBoxEditingDidEnded(b);""===this.value&&(this.style.fontSize=b._placeholderFontSize+"px",this.style.color=cc.colorToHex(b._placeholderColor));a.hidden()});return c};g._createDomTextArea=function(){this._removeDomInputControl();var a=this,b=this._edTxt=document.createElement("textarea");b.type="text";b.style.fontSize=this._edFontSize+"px";b.style.color="#000000";b.style.border= 0;b.style.background="transparent";b.style.width="100%";b.style.height="100%";b.style.active=0;b.style.outline="medium";b.style.padding="0";b.style.resize="none";b.style.textTransform="uppercase";b.style.overflow_y="scroll";b.style.display="none";b.style.position="absolute";b.style.bottom="0px";b.style.left="2px";b.style.className="cocosEditBox";this.setMaxLength(a._editBox._maxLength);b.addEventListener("input",function(){this.value.length>this.maxLength&&(this.value=this.value.slice(0,this.maxLength)); var b=a._editBox;b._delegate&&b._delegate.editBoxTextChanged&&b._text.toLowerCase()!==this.value.toLowerCase()&&(b._text=this.value,a._updateEditBoxContentStyle(),b._delegate.editBoxTextChanged(b,b._text))});b.addEventListener("focus",function(){var b=a._editBox;a._hiddenLabels();this.style.fontSize=a._edFontSize+"px";this.style.color=cc.colorToHex(b._textColor);cc.view.isAutoFullScreenEnabled()?(a.__fullscreen=!0,cc.view.enableAutoFullScreen(!1),cc.screen.exitFullScreen()):a.__fullscreen=!1;this.__autoResize= cc.view.__resizeWithBrowserSize;cc.view.resizeWithBrowserSize(!0);b._delegate&&b._delegate.editBoxEditingDidBegan&&b._delegate.editBoxEditingDidBegan(b)});b.addEventListener("keypress",function(b){var c=a._editBox;b.keyCode===cc.KEY.enter&&(b.stopPropagation(),c._delegate&&c._delegate.editBoxEditingReturn&&c._delegate.editBoxEditingReturn(c))});b.addEventListener("blur",function(){var b=a._editBox;b._text=this.value;a._updateEditBoxContentStyle();window.scrollY=0;a.__fullscreen&&cc.view.enableAutoFullScreen(!0); this.__autoResize&&cc.view.resizeWithBrowserSize(!0);b._delegate&&b._delegate.editBoxEditingDidEnded&&b._delegate.editBoxEditingDidEnded(b);""===this.value&&(this.style.fontSize=b._placeholderFontSize+"px",this.style.color=cc.colorToHex(b._placeholderColor));a.hidden()});return b};g._createLabels=function(){var a=this._editBox.getContentSize();this._textLabel||(this._textLabel=new cc.LabelTTF,this._textLabel.setVisible(!1),this._textLabel.setAnchorPoint(cc.p(0,1)),this._editBox.addChild(this._textLabel, 100));this._placeholderLabel||(this._placeholderLabel=new cc.LabelTTF,this._placeholderLabel.setAnchorPoint(cc.p(0,1)),this._placeholderLabel.setColor(cc.color.GRAY),this._editBox.addChild(this._placeholderLabel,100));this._updateLabelPosition(a)};g._removeLabels=function(){this._textLabel&&(this._editBox.removeChild(this._textLabel),this._textLabel=null)};g._updateLabelPosition=function(a){if(this._textLabel&&this._placeholderLabel){var b=cc.size(a.width-2,a.height);this._textLabel.setContentSize(b); this._textLabel.setDimensions(b);this._placeholderLabel.setLineHeight(a.height);b=this._placeholderLabel.getContentSize();this._editBox._editBoxInputMode===cc.EDITBOX_INPUT_MODE_ANY?(this._textLabel.setPosition(2,a.height),this._placeholderLabel.setPosition(2,a.height),this._placeholderLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_TOP),this._textLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_TOP)):(this._textLabel.setPosition(2,a.height),this._placeholderLabel.setPosition(2,(a.height+ b.height)/2),this._placeholderLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER),this._textLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER))}};g.setLineHeight=function(a){this._textLabel&&this._textLabel.setLineHeight(a)};g._hiddenLabels=function(){this._textLabel&&this._textLabel.setVisible(!1);this._placeholderLabel&&this._placeholderLabel.setVisible(!1)};g._updateEditBoxContentStyle=function(){var a=this._editBox._editBoxInputFlag;if(a===cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS)this._editBox._text= this._editBox._text.toUpperCase();else if(a===cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD)this._editBox._text=c(this._editBox._text);else if(a===cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_SENTENCE){var a=this._editBox,b;b=this._editBox._text;b=b.charAt(0).toUpperCase()+b.slice(1);a._text=b}};g._updateLabelString=function(){this._updateInputType();this._textLabel&&(this._textLabel.setVisible(!0),this._textLabel.setString(this._editBox._text));if("password"===this._edTxt.type){for(var a="",b=this._editBox._text.length, c=0;c<b;++c)a+="\u25cf";this._textLabel&&this._textLabel.setString(a)}else this._updateEditBoxContentStyle(),this._textLabel&&this._textLabel.setString(this._editBox._text)};g._showLabels=function(){this._hiddenLabels();""===this._edTxt.value?this._placeholderLabel&&(this._placeholderLabel.setVisible(!0),this._placeholderLabel.setString(this._editBox._placeholderText)):this._updateLabelString()};g.show=function(){this._editBox._alwaysOnTop||"none"!==this._edTxt.style.display||(this._edTxt.style.display= "",this._edTxt.focus());this._hiddenLabels()};g.hidden=function(){this._editBox._alwaysOnTop||(this._edTxt.style.display="none");this._showLabels()};g._setFont=function(a){a=cc.LabelTTF._fontStyleRE.exec(a);var b=a[2],c=parseInt(a[1]);a&&this.setFont(b,c)};g.setFont=function(a,b){this._edFontName=a||this._edFontName;this._edFontSize=b||this._edFontSize;this._updateDOMFontStyle()};g.setFontName=function(a){this._edFontName=a||this._edFontName;this._updateDOMFontStyle()};g.setFontSize=function(a){this._edFontSize= a||this._edFontSize;this._updateDOMFontStyle()};g.setFontColor=function(a){this._edTxt&&(this._edTxt.value!==this._editBox._placeholderText&&(this._edTxt.style.color=cc.colorToHex(a)),this._textLabel&&this._textLabel.setColor(a))};g.setPlaceHolder=function(a){this._placeholderLabel.setString(a)};g.setMaxLength=function(a){this._edTxt&&(this._edTxt.maxLength=a)};g._updateDOMPlaceholderFontStyle=function(){this._placeholderLabel.setFontName(this._editBox._placeholderFontName);this._placeholderLabel.setFontSize(this._editBox._placeholderFontSize)}; g.setPlaceholderFontColor=function(a){this._placeholderLabel.setColor(a)};g._updateInputType=function(){this._editBox._keyboardReturnType===cc.KEYBOARD_RETURNTYPE_SEARCH&&(this._edTxt.type="search");var a=this._editBox._editBoxInputMode;a===cc.EDITBOX_INPUT_MODE_EMAILADDR?this._edTxt.type="email":a===cc.EDITBOX_INPUT_MODE_DECIMAL||a===cc.EDITBOX_INPUT_MODE_NUMERIC?this._edTxt.type="number":a===cc.EDITBOX_INPUT_MODE_PHONENUMBER?(this._edTxt.type="number",this._edTxt.pattern="[0-9]*"):this._edTxt.type= a===cc.EDITBOX_INPUT_MODE_URL?"url":"text";this._editBox._editBoxInputFlag===cc.EDITBOX_INPUT_FLAG_PASSWORD&&(this._edTxt.type="password")};g.setInputFlag=function(a){this._edTxt&&(this._updateInputType(),this._edTxt.style.textTransform="none",a===cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS?this._edTxt.style.textTransform="uppercase":a===cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD&&(this._edTxt.style.textTransform="capitalize"),this._updateLabelString())};g.setInputMode=function(a){this._removeDomInputControl(); a===cc.EDITBOX_INPUT_MODE_ANY?this._createDomTextArea():this._createDomInput();this._addDomInputControl();this._updateInputType();a=this._node.getContentSize();this.updateSize(a.width,a.height)};g.setString=function(a){this._edTxt&&null!==a&&(this._edTxt.value=a,""===a?(this._placeholderLabel&&(this._placeholderLabel.setString(this._editBox._placeholderText),this._placeholderLabel.setColor(this._editBox._placeholderColor),this._placeholderLabel.setVisible(!0)),this._textLabel&&this._textLabel.setVisible(!1)): (this._edTxt.style.color=cc.colorToHex(this._editBox._textColor),this._textLabel&&this._textLabel.setColor(this._editBox._textColor),this._placeholderLabel&&this._placeholderLabel.setVisible(!1),this._updateLabelString()))};g._updateDOMFontStyle=function(){this._edTxt&&(""!==this._edTxt.value&&(this._edTxt.style.fontFamily=this._edFontName,this._edTxt.style.fontSize=this._edFontSize+"px"),this._textLabel&&(this._textLabel.setFontSize(this._edFontSize),this._textLabel.setFontName(this._edFontName)))}; g.updateSize=function(a,b){var c=this._edTxt;c&&(c.style.width=a+"px",c.style.height=b+"px",this._updateLabelPosition(cc.size(a,b)))};g.createNativeControl=function(){this._createDomTextArea();this._addDomInputControl()};g._addDomInputControl=function(){cc.game.container.appendChild(this._edTxt)};g._removeDomInputControl=function(){var a=this._edTxt;if(a){var b=!1;(b="contains"in cc.game.container?cc.game.container.contains(a):cc.game.container.compareDocumentPosition(a)%16)&&cc.game.container.removeChild(a)}this._edTxt= null};g.initializeRenderCmd=function(a){this._editBox=a;this._edFontSize=14;this._edFontName="Arial";this._placeholderLabel=this._textLabel=null};cc.EditBox.CanvasRenderCmd=function(a){this._rootCtor(a);this.initializeRenderCmd(a)};var h=cc.EditBox.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype),k=function(a){a=a||{};for(var b=1,c=arguments.length;b<c;b++){var e=arguments[b];if(e)if("object"!==typeof e)cc.error("cc.js.mixin: arguments must be type object:",e);else for(var f in e){var g= f,h=a,k=d(e,g);Object.defineProperty(h,g,k)}}return a};k(h,g);h.constructor=cc.EditBox.CanvasRenderCmd;h.transform=function(a,b){this.originTransform(a,b);this.updateMatrix()};cc.EditBox.WebGLRenderCmd=function(a){this._rootCtor(a);this.initializeRenderCmd(a)};h=cc.EditBox.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);k(h,g);h.constructor=cc.EditBox.WebGLRenderCmd;h.transform=function(a,b){this.originTransform(a,b);this.updateMatrix()}})(cc.EditBox._polyfill);cc.ProtectedNode=cc.Node.extend({_protectedChildren:null,_reorderProtectedChildDirty:!1,_insertProtectedChild:function(a,b){this._reorderProtectedChildDirty=!0;this._protectedChildren.push(a);a._setLocalZOrder(b)},ctor:function(){cc.Node.prototype.ctor.call(this);this._protectedChildren=[]},visit:function(a){if(this._visible){var b=cc.renderer,c=this._renderCmd,d=this._children,e=d.length,f,g=this._protectedChildren,h=g.length,k;c.visit(a&&a._renderCmd);var m=this.grid;m&&m._active&&m.beforeDraw(); this._reorderChildDirty&&this.sortAllChildren();this._reorderProtectedChildDirty&&this.sortAllProtectedChildren();for(a=0;a<e;a++)if(f=d[a],0>f._localZOrder)f.visit(this);else break;for(f=0;f<h;f++)if((k=g[f])&&0>k._localZOrder)c._changeProtectedChild(k),k.visit(this);else break;for(b.pushRenderCommand(c);a<e;a++)d[a].visit(this);for(;f<h;f++)if(k=g[f])c._changeProtectedChild(k),k.visit(this);m&&m._active&&m.afterDraw(this);c._dirtyFlag=0}},addProtectedChild:function(a,b,c){cc.assert(null!=a,"child must be non-nil"); cc.assert(!a.parent,"child already added. It can't be added again");b=b||a.getLocalZOrder();c&&a.setTag(c);this._insertProtectedChild(a,b);a.setParent(this);a.setOrderOfArrival(cc.s_globalOrderOfArrival);this._running&&(a._performRecursive(cc.Node._stateCallbackType.onEnter),this._isTransitionFinished&&a._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish));this._cascadeColorEnabled&&this._renderCmd.setCascadeColorEnabledDirty();this._cascadeOpacityEnabled&&this._renderCmd.setCascadeOpacityEnabledDirty()}, getProtectedChildByTag:function(a){cc.assert(a!==cc.NODE_TAG_INVALID,"Invalid tag");for(var b=this._protectedChildren,c=0,d=b.length;c<d;c++)if(b.getTag()===a)return b[c];return null},removeProtectedChild:function(a,b){null==b&&(b=!0);var c=this._protectedChildren;if(0!==c.length){var d=c.indexOf(a);-1<d&&(this._running&&(a._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),a._performRecursive(cc.Node._stateCallbackType.onExit)),b&&a._performRecursive(cc.Node._stateCallbackType.cleanup), a.setParent(null),c.splice(d,1))}},removeProtectedChildByTag:function(a,b){cc.assert(a!==cc.NODE_TAG_INVALID,"Invalid tag");null==b&&(b=!0);var c=this.getProtectedChildByTag(a);null==c?cc.log("cocos2d: removeChildByTag(tag \x3d %d): child not found!",a):this.removeProtectedChild(c,b)},removeAllProtectedChildren:function(){this.removeAllProtectedChildrenWithCleanup(!0)},removeAllProtectedChildrenWithCleanup:function(a){null==a&&(a=!0);for(var b=this._protectedChildren,c=0,d=b.length;c<d;c++){var e= b[c];this._running&&(e._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),e._performRecursive(cc.Node._stateCallbackType.onExit));a&&e._performRecursive(cc.Node._stateCallbackType.cleanup);e.setParent(null)}b.length=0},reorderProtectedChild:function(a,b){cc.assert(null!=a,"Child must be non-nil");this._reorderProtectedChildDirty=!0;a.setOrderOfArrival(cc.s_globalOrderOfArrival++);a._setLocalZOrder(b)},sortAllProtectedChildren:function(){if(this._reorderProtectedChildDirty){var a= this._protectedChildren,b,c,d=a.length,e;for(b=1;b<d;b++){e=a[b];for(c=b-1;0<=c;){if(e._localZOrder<a[c]._localZOrder)a[c+1]=a[c];else if(e._localZOrder===a[c]._localZOrder&&e.arrivalOrder<a[c].arrivalOrder)a[c+1]=a[c];else break;c--}a[c+1]=e}this._reorderProtectedChildDirty=!1}},_changePosition:function(){},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.ProtectedNode.CanvasRenderCmd(this):new cc.ProtectedNode.WebGLRenderCmd(this)}}); cc.ProtectedNode.create=function(){return new cc.ProtectedNode};(function(){cc.ProtectedNode.RenderCmd={_updateDisplayColor:function(a){var c=this._node,d=this._displayedColor,e=c._realColor,f,g;if(this._cascadeColorEnabledDirty&&!c._cascadeColorEnabled){d.r=e.r;d.g=e.g;d.b=e.b;d=new cc.Color(255,255,255,255);f=c._children;e=0;for(a=f.length;e<a;e++)(g=f[e])&&g._renderCmd&&g._renderCmd._updateDisplayColor(d);this._cascadeColorEnabledDirty=!1}else{void 0===a&&(a=(a=c._parent)&&a._cascadeColorEnabled?a.getDisplayedColor():cc.color.WHITE);d.r=0|e.r*a.r/255;d.g=0| e.g*a.g/255;d.b=0|e.b*a.b/255;if(c._cascadeColorEnabled)for(f=c._children,e=0,a=f.length;e<a;e++)(g=f[e])&&g._renderCmd&&(g._renderCmd._updateDisplayColor(d),g._renderCmd._updateColor());f=c._protectedChildren;e=0;for(a=f.length;e<a;e++)(g=f[e])&&g._renderCmd&&(g._renderCmd._updateDisplayColor(d),g._renderCmd._updateColor())}this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.colorDirty},_updateDisplayOpacity:function(a){var c=this._node,d,e,f;if(this._cascadeOpacityEnabledDirty&&!c._cascadeOpacityEnabled){this._displayedOpacity= c._realOpacity;e=c._children;a=0;for(d=e.length;a<d;a++)(f=e[a])&&f._renderCmd&&f._renderCmd._updateDisplayOpacity(255);this._cascadeOpacityEnabledDirty=!1}else{void 0===a&&(d=c._parent,a=255,d&&d._cascadeOpacityEnabled&&(a=d.getDisplayedOpacity()));this._displayedOpacity=c._realOpacity*a/255;if(c._cascadeOpacityEnabled)for(e=c._children,a=0,d=e.length;a<d;a++)(f=e[a])&&f._renderCmd&&(f._renderCmd._updateDisplayOpacity(this._displayedOpacity),f._renderCmd._updateColor());e=c._protectedChildren;a= 0;for(d=e.length;a<d;a++)(f=e[a])&&f._renderCmd&&(f._renderCmd._updateDisplayOpacity(this._displayedOpacity),f._renderCmd._updateColor())}this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.opacityDirty},_changeProtectedChild:function(a){a=a._renderCmd;var c=a._dirtyFlag,d=cc.Node._dirtyFlags;this._dirtyFlag&d.colorDirty&&(c|=d.colorDirty);this._dirtyFlag&d.opacityDirty&&(c|=d.opacityDirty);var e=c&d.colorDirty,c=c&d.opacityDirty;e&&a._updateDisplayColor(this._displayedColor);c&&a._updateDisplayOpacity(this._displayedOpacity); (e||c)&&a._updateColor()}};cc.ProtectedNode.CanvasRenderCmd=function(a){this._rootCtor(a);this._cachedParent=null;this._cacheDirty=!1};var a=cc.ProtectedNode.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);cc.inject(cc.ProtectedNode.RenderCmd,a);a.constructor=cc.ProtectedNode.CanvasRenderCmd;a._pNodeCmdCtor=cc.ProtectedNode.CanvasRenderCmd;a.transform=function(a,c){var d=this._node;d._changePosition&&d._changePosition();this.originTransform(a,c);var e,f=d._protectedChildren; if(c&&f&&0!==f.length)for(d=0,e=f.length;d<e;d++)f[d]._renderCmd.transform(this,c)};a.pNodeTransform=a.transform})();(function(){if(cc.Node.WebGLRenderCmd){cc.ProtectedNode.WebGLRenderCmd=function(a){this._rootCtor(a)};var a=cc.ProtectedNode.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);cc.inject(cc.ProtectedNode.RenderCmd,a);a.constructor=cc.ProtectedNode.WebGLRenderCmd;a._pNodeCmdCtor=cc.ProtectedNode.WebGLRenderCmd;a.transform=function(a,c){this.originTransform(a,c);var d,e,f=this._node._protectedChildren;if(c&&f&&0!==f.length)for(d=0,e=f.length;d<e;d++)f[d]._renderCmd.transform(this, c)};a.pNodeTransform=a.transform}})();var ccui=ccui||{};ccui.Class=ccui.Class||cc.Class;ccui.Class.extend=ccui.Class.extend||cc.Class.extend;ccui.Node=ccui.Node||cc.Node;ccui.Node.extend=ccui.Node.extend||cc.Node.extend;ccui.ProtectedNode=ccui.ProtectedNode||cc.ProtectedNode;ccui.ProtectedNode.extend=ccui.ProtectedNode.extend||cc.ProtectedNode.extend;ccui.cocosGUIVersion="CocosGUI v1.0.0.0";ccui._FocusNavigationController=cc.Class.extend({_keyboardListener:null,_firstFocusedWidget:null,_enableFocusNavigation:!1,_keyboardEventPriority:1,enableFocusNavigation:function(a){this._enableFocusNavigation!==a&&((this._enableFocusNavigation=a)?this._addKeyboardEventListener():this._removeKeyboardEventListener())},_setFirstFocsuedWidget:function(a){this._firstFocusedWidget=a},_onKeyPressed:function(a,b){this._enableFocusNavigation&&this._firstFocusedWidget&&(a===cc.KEY.dpadDown&&(this._firstFocusedWidget= this._firstFocusedWidget.findNextFocusedWidget(ccui.Widget.DOWN,this._firstFocusedWidget)),a===cc.KEY.dpadUp&&(this._firstFocusedWidget=this._firstFocusedWidget.findNextFocusedWidget(ccui.Widget.UP,this._firstFocusedWidget)),a===cc.KEY.dpadLeft&&(this._firstFocusedWidget=this._firstFocusedWidget.findNextFocusedWidget(ccui.Widget.LEFT,this._firstFocusedWidget)),a===cc.KEY.dpadRight&&(this._firstFocusedWidget=this._firstFocusedWidget.findNextFocusedWidget(ccui.Widget.RIGHT,this._firstFocusedWidget)))}, _addKeyboardEventListener:function(){this._keyboardListener||(this._keyboardListener=cc.EventListener.create({event:cc.EventListener.KEYBOARD,onKeyReleased:this._onKeyPressed.bind(this)}),cc.eventManager.addListener(this._keyboardListener,this._keyboardEventPriority))},_removeKeyboardEventListener:function(){this._keyboardListener&&(cc.eventManager.removeEventListener(this._keyboardListener),this._keyboardListener=null)}});ccui.__LAYOUT_COMPONENT_NAME="__ui_layout"; ccui.Widget=ccui.ProtectedNode.extend({_enabled:!0,_bright:!0,_touchEnabled:!1,_brightStyle:null,_touchBeganPosition:null,_touchMovePosition:null,_touchEndPosition:null,_touchEventListener:null,_touchEventSelector:null,_name:"default",_widgetType:null,_actionTag:0,_customSize:null,_layoutParameterDictionary:null,_layoutParameterType:0,_focused:!1,_focusEnabled:!0,_ignoreSize:!1,_affectByClipping:!1,_sizeType:null,_sizePercent:null,_positionType:null,_positionPercent:null,_hit:!1,_nodes:null,_touchListener:null, _className:"Widget",_flippedX:!1,_flippedY:!1,_opacity:255,_highlight:!1,_touchEventCallback:null,_clickEventListener:null,_propagateTouchEvents:!0,_unifySize:!1,_callbackName:null,_callbackType:null,_usingLayoutComponent:!1,_inViewRect:!0,ctor:function(){cc.ProtectedNode.prototype.ctor.call(this);this._brightStyle=ccui.Widget.BRIGHT_STYLE_NONE;this._touchBeganPosition=cc.p(0,0);this._touchMovePosition=cc.p(0,0);this._touchEndPosition=cc.p(0,0);this._widgetType=ccui.Widget.TYPE_WIDGET;this._customSize= cc.size(0,0);this._layoutParameterDictionary={};this._sizeType=ccui.Widget.SIZE_ABSOLUTE;this._sizePercent=cc.p(0,0);this._positionType=ccui.Widget.POSITION_ABSOLUTE;this._positionPercent=cc.p(0,0);this._nodes=[];this._layoutParameterType=ccui.LayoutParameter.NONE;ccui.Widget.prototype.init.call(this)},init:function(){this._layoutParameterDictionary={};this._initRenderer();this.setBright(!0);this.onFocusChanged=this.onFocusChange;this.onNextFocusedWidget=null;this.setAnchorPoint(cc.p(0.5,0.5));this.ignoreContentAdaptWithSize(!0); return!0},onEnter:function(){var a=this._touchListener;a&&!a._isRegistered()&&this._touchEnabled&&cc.eventManager.addListener(a,this);this._usingLayoutComponent||this.updateSizeAndPosition();this._sizeDirty&&this._onSizeChanged();cc.ProtectedNode.prototype.onEnter.call(this)},onExit:function(){this.unscheduleUpdate();cc.ProtectedNode.prototype.onExit.call(this)},_getOrCreateLayoutComponent:function(){var a=this.getComponent(ccui.__LAYOUT_COMPONENT_NAME);null==a&&(a=new ccui.LayoutComponent,this.addComponent(a)); return a},getWidgetParent:function(){var a=this.getParent();return a instanceof ccui.Widget?a:null},_updateContentSizeWithTextureSize:function(a){this._unifySize?this.setContentSize(a):this.setContentSize(this._ignoreSize?a:this._customSize)},_isAncestorsEnabled:function(){var a=this._getAncensterWidget(this);return null==a?!0:a&&!a.isEnabled()?!1:a._isAncestorsEnabled()},setPropagateTouchEvents:function(a){this._propagateTouchEvents=a},isPropagateTouchEvents:function(){return this._propagateTouchEvents}, setSwallowTouches:function(a){this._touchListener&&this._touchListener.setSwallowTouches(a)},isSwallowTouches:function(){return this._touchListener?this._touchListener.isSwallowTouches():!1},_getAncensterWidget:function(a){if(null==a)return null;a=a.getParent();return null==a?null:a instanceof ccui.Widget?a:this._getAncensterWidget(a.getParent())},_isAncestorsVisible:function(a){return null==a?!0:(a=a.getParent())&&!a.isVisible()?!1:this._isAncestorsVisible(a)},setEnabled:function(a){this._enabled= a;this.setBright(a)},_initRenderer:function(){},setContentSize:function(a,b){cc.Node.prototype.setContentSize.call(this,a,b);var c=this._contentSize.width,d=this._contentSize.height;this._customSize.width=c;this._customSize.height=d;!this._unifySize&&this._ignoreSize&&(this._contentSize=this.getVirtualRendererSize());if(!this._usingLayoutComponent&&this._running){var e=this.getWidgetParent(),e=e?e.getContentSize():this._parent.getContentSize();this._sizePercent.x=0<e.width?c/e.width:0;this._sizePercent.y= 0<e.height?d/e.height:0}this._running?this._onSizeChanged():this._sizeDirty=!0},_setWidth:function(a){a!==this._contentSize.width&&(cc.Node.prototype._setWidth.call(this,a),this._customSize.width=a,!this._unifySize&&this._ignoreSize&&(this._contentSize=this.getVirtualRendererSize()),!this._usingLayoutComponent&&this._running&&(a=(a=this.getWidgetParent())?a.width:this._parent.width,this._sizePercent.x=0<a?this._customSize.width/a:0),this._running?this._onSizeChanged():this._sizeDirty=!0)},_setHeight:function(a){a!== this._contentSize.height&&(cc.Node.prototype._setHeight.call(this,a),this._customSize.height=a,!this._unifySize&&this._ignoreSize&&(this._contentSize=this.getVirtualRendererSize()),!this._usingLayoutComponent&&this._running&&(a=(a=this.getWidgetParent())?a.height:this._parent.height,this._sizePercent.y=0<a?this._customSize.height/a:0),this._running?this._onSizeChanged():this._sizeDirty=!0)},setSizePercent:function(a){if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();b.setUsingPercentContentSize(!0); b.setPercentContentSize(a);b.refreshLayout()}else{this._sizePercent.x=a.x;this._sizePercent.y=a.y;var b=this._customSize.width,c=this._customSize.height;this._running&&((c=this.getWidgetParent())?(b=c.width*a.x,c=c.height*a.y):(b=this._parent.width*a.x,c=this._parent.height*a.y));this._ignoreSize?this.setContentSize(this.getVirtualRendererSize()):this.setContentSize(b,c);this._customSize.width=b;this._customSize.height=c}},_setWidthPercent:function(a){this._sizePercent.x=a;var b=this._customSize.width; this._running&&(b=this.getWidgetParent(),b=(b?b.width:this._parent.width)*a);this._ignoreSize?this._setWidth(this.getVirtualRendererSize().width):this._setWidth(b);this._customSize.width=b},_setHeightPercent:function(a){this._sizePercent.y=a;var b=this._customSize.height;this._running&&(b=this.getWidgetParent(),b=(b?b.height:this._parent.height)*a);this._ignoreSize?this._setHeight(this.getVirtualRendererSize().height):this._setHeight(b);this._customSize.height=b},updateSizeAndPosition:function(a){a|| (a=(a=this.getWidgetParent())?a.getLayoutSize():this._parent.getContentSize());switch(this._sizeType){case ccui.Widget.SIZE_ABSOLUTE:this._ignoreSize?this.setContentSize(this.getVirtualRendererSize()):this.setContentSize(this._customSize);this._sizePercent.x=0<a.width?this._customSize.width/a.width:0;this._sizePercent.y=0<a.height?this._customSize.height/a.height:0;break;case ccui.Widget.SIZE_PERCENT:var b=cc.size(a.width*this._sizePercent.x,a.height*this._sizePercent.y);this._ignoreSize?this.setContentSize(this.getVirtualRendererSize()): this.setContentSize(b);this._customSize.width=b.width;this._customSize.height=b.height}this._onSizeChanged();b=this.getPosition();switch(this._positionType){case ccui.Widget.POSITION_ABSOLUTE:0>=a.width||0>=a.height?this._positionPercent.x=this._positionPercent.y=0:(this._positionPercent.x=b.x/a.width,this._positionPercent.y=b.y/a.height);break;case ccui.Widget.POSITION_PERCENT:b=cc.p(a.width*this._positionPercent.x,a.height*this._positionPercent.y)}if(this._parent instanceof ccui.ImageView&&(a=this._parent._imageRenderer)&& !a._textureLoaded)return;this.setPosition(b)},setSizeType:function(a){this._sizeType=a;this._usingLayoutComponent&&this._getOrCreateLayoutComponent().setUsingPercentContentSize(this._sizeType===ccui.SIZE_PERCENT)},getSizeType:function(){return this._sizeType},ignoreContentAdaptWithSize:function(a){this._unifySize?this.setContentSize(this._customSize):this._ignoreSize!==a&&(this._ignoreSize=a,this.setContentSize(a?this.getVirtualRendererSize():this._customSize))},isIgnoreContentAdaptWithSize:function(){return this._ignoreSize}, getCustomSize:function(){return cc.size(this._customSize)},getLayoutSize:function(){return cc.size(this._contentSize)},getSizePercent:function(){this._usingLayoutComponent&&(this._sizePercent=this._getOrCreateLayoutComponent().getPercentContentSize());return this._sizePercent},_getWidthPercent:function(){return this._sizePercent.x},_getHeightPercent:function(){return this._sizePercent.y},getWorldPosition:function(){return this.convertToWorldSpace(cc.p(this._anchorPoint.x*this._contentSize.width,this._anchorPoint.y* this._contentSize.height))},getVirtualRenderer:function(){return this},getVirtualRendererSize:function(){return cc.size(this._contentSize)},_onSizeChanged:function(){if(!this._usingLayoutComponent){for(var a=this.getChildren(),b=0,c=a.length;b<c;b++){var d=a[b];d instanceof ccui.Widget&&d.updateSizeAndPosition()}this._sizeDirty=!1}},setTouchEnabled:function(a){this._touchEnabled!==a&&((this._touchEnabled=a)?(this._touchListener||(this._touchListener=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE, swallowTouches:!0,onTouchBegan:this.onTouchBegan.bind(this),onTouchMoved:this.onTouchMoved.bind(this),onTouchEnded:this.onTouchEnded.bind(this)})),cc.eventManager.addListener(this._touchListener,this)):cc.eventManager.removeListener(this._touchListener))},isTouchEnabled:function(){return this._touchEnabled},isHighlighted:function(){return this._highlight},setHighlighted:function(a){a!==this._highlight&&(this._highlight=a,this._bright?this._highlight?this.setBrightStyle(ccui.Widget.BRIGHT_STYLE_HIGH_LIGHT): this.setBrightStyle(ccui.Widget.BRIGHT_STYLE_NORMAL):this._onPressStateChangedToDisabled())},isFocused:function(){return this._focused},setFocused:function(a){if(this._focused=a)ccui.Widget._focusedWidget=this,ccui.Widget._focusNavigationController&&ccui.Widget._focusNavigationController._setFirstFocsuedWidget(this)},isFocusEnabled:function(){return this._focusEnabled},setFocusEnabled:function(a){this._focusEnabled=a},findNextFocusedWidget:function(a,b){if(null===this.onNextFocusedWidget||null==this.onNextFocusedWidget(a)){var c= b instanceof ccui.Layout;if(this.isFocused()||c){var d=this.getParent();return null!==d&&d instanceof ccui.Layout?d.findNextFocusedWidget(a,b):c?b.findNextFocusedWidget(a,b):b}return b}c=this.onNextFocusedWidget(a);this.dispatchFocusEvent(this,c);return c},requestFocus:function(){this!==ccui.Widget._focusedWidget&&this.dispatchFocusEvent(ccui.Widget._focusedWidget,this)},getCurrentFocusedWidget:function(){return ccui.Widget._focusedWidget},onFocusChanged:null,onNextFocusedWidget:null,interceptTouchEvent:function(a, b,c){var d=this.getWidgetParent();d&&d.interceptTouchEvent(a,b,c)},onFocusChange:function(a,b){a&&a.setFocused(!1);b&&b.setFocused(!0)},dispatchFocusEvent:function(a,b){a&&!a.isFocused()&&(a=ccui.Widget._focusedWidget);if(b!==a){if(b&&b.onFocusChanged)b.onFocusChanged(a,b);if(a&&b.onFocusChanged)a.onFocusChanged(a,b);cc.eventManager.dispatchEvent(new cc.EventFocus(a,b))}},setBright:function(a){(this._bright=a)?(this._brightStyle=ccui.Widget.BRIGHT_STYLE_NONE,this.setBrightStyle(ccui.Widget.BRIGHT_STYLE_NORMAL)): this._onPressStateChangedToDisabled()},setBrightStyle:function(a){if(this._brightStyle!==a)switch(this._brightStyle=a=a||ccui.Widget.BRIGHT_STYLE_NORMAL,this._brightStyle){case ccui.Widget.BRIGHT_STYLE_NORMAL:this._onPressStateChangedToNormal();break;case ccui.Widget.BRIGHT_STYLE_HIGH_LIGHT:this._onPressStateChangedToPressed()}},_onPressStateChangedToNormal:function(){},_onPressStateChangedToPressed:function(){},_onPressStateChangedToDisabled:function(){},_updateChildrenDisplayedRGBA:function(){this.setColor(this.getColor()); this.setOpacity(this.getOpacity())},didNotSelectSelf:function(){},onTouchBegan:function(a,b){this._hit=!1;if(this.isVisible()&&this.isEnabled()&&this._isAncestorsEnabled()&&this._isAncestorsVisible(this)){var c=a.getLocation();this._touchBeganPosition.x=c.x;this._touchBeganPosition.y=c.y;this.hitTest(this._touchBeganPosition)&&this.isClippingParentContainsPoint(this._touchBeganPosition)&&(this._hit=!0)}if(!this._hit)return!1;this.setHighlighted(!0);this._propagateTouchEvents&&this.propagateTouchEvent(ccui.Widget.TOUCH_BEGAN, this,a);this._pushDownEvent();return!0},propagateTouchEvent:function(a,b,c){var d=this.getWidgetParent();d&&d.interceptTouchEvent(a,b,c)},onTouchMoved:function(a,b){var c=a.getLocation();this._touchMovePosition.x=c.x;this._touchMovePosition.y=c.y;this.setHighlighted(this.hitTest(c));this._propagateTouchEvents&&this.propagateTouchEvent(ccui.Widget.TOUCH_MOVED,this,a);this._moveEvent()},onTouchEnded:function(a,b){var c=a.getLocation();this._touchEndPosition.x=c.x;this._touchEndPosition.y=c.y;this._propagateTouchEvents&& this.propagateTouchEvent(ccui.Widget.TOUCH_ENDED,this,a);c=this._highlight;this.setHighlighted(!1);c?this._releaseUpEvent():this._cancelUpEvent()},onTouchCancelled:function(a){this.setHighlighted(!1);this._cancelUpEvent()},onTouchLongClicked:function(a){this.longClickEvent()},_pushDownEvent:function(){this._touchEventCallback&&this._touchEventCallback(this,ccui.Widget.TOUCH_BEGAN);this._touchEventListener&&this._touchEventSelector&&this._touchEventSelector.call(this._touchEventListener,this,ccui.Widget.TOUCH_BEGAN)}, _moveEvent:function(){this._touchEventCallback&&this._touchEventCallback(this,ccui.Widget.TOUCH_MOVED);this._touchEventListener&&this._touchEventSelector&&this._touchEventSelector.call(this._touchEventListener,this,ccui.Widget.TOUCH_MOVED)},_releaseUpEvent:function(){this._touchEventCallback&&this._touchEventCallback(this,ccui.Widget.TOUCH_ENDED);this._touchEventListener&&this._touchEventSelector&&this._touchEventSelector.call(this._touchEventListener,this,ccui.Widget.TOUCH_ENDED);this._clickEventListener&& this._clickEventListener(this)},_cancelUpEvent:function(){this._touchEventCallback&&this._touchEventCallback(this,ccui.Widget.TOUCH_CANCELED);this._touchEventListener&&this._touchEventSelector&&this._touchEventSelector.call(this._touchEventListener,this,ccui.Widget.TOUCH_CANCELED)},longClickEvent:function(){},addTouchEventListener:function(a,b){void 0===b?this._touchEventCallback=a:(this._touchEventSelector=a,this._touchEventListener=b)},addClickEventListener:function(a){this._clickEventListener= a},hitTest:function(a){var b=cc.rect(0,0,this._contentSize.width,this._contentSize.height);return cc.rectContainsPoint(b,this.convertToNodeSpace(a))},isClippingParentContainsPoint:function(a){this._affectByClipping=!1;for(var b=this.getParent(),c=null;b;){if(b instanceof ccui.Layout&&b.isClippingEnabled()){this._affectByClipping=!0;c=b;break}b=b.getParent()}return this._affectByClipping?c?c.hitTest(a)?c.isClippingParentContainsPoint(a):!1:!0:!0},checkChildInfo:function(a,b,c){var d=this.getWidgetParent(); d&&d.checkChildInfo(a,b,c)},setPosition:function(a,b){if(!this._usingLayoutComponent&&this._running){var c=this.getWidgetParent();c&&(c=c.getContentSize(),0>=c.width||0>=c.height?(this._positionPercent.x=0,this._positionPercent.y=0):void 0===b?(this._positionPercent.x=a.x/c.width,this._positionPercent.y=a.y/c.height):(this._positionPercent.x=a/c.width,this._positionPercent.y=b/c.height))}cc.Node.prototype.setPosition.call(this,a,b)},setPositionX:function(a){if(this._running){var b=this.getWidgetParent(); b&&(b=b.width,this._positionPercent.x=0>=b?0:a/b)}cc.Node.prototype.setPositionX.call(this,a)},setPositionY:function(a){if(this._running){var b=this.getWidgetParent();b&&(b=b.height,this._positionPercent.y=0>=b?0:a/b)}cc.Node.prototype.setPositionY.call(this,a)},setPositionPercent:function(a){if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();b.setPositionPercentX(a.x);b.setPositionPercentY(a.y);b.refreshLayout()}else this._setXPercent(a.x),this._setYPercent(a.y),this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)}, _setXPercent:function(a){if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();b.setPositionPercentX(a.x);b.refreshLayout()}else this._positionPercent.x=a,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},_setYPercent:function(a){if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();b.setPositionPercentY(a.x);b.refreshLayout()}else this._positionPercent.y=a,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getPositionPercent:function(){if(this._usingLayoutComponent){var a= this._getOrCreateLayoutComponent();this._positionPercent.x=a.getPositionPercentX();this._positionPercent.y=a.getPositionPercentY()}return cc.p(this._positionPercent)},_getXPercent:function(){if(this._usingLayoutComponent){var a=this._getOrCreateLayoutComponent();this._positionPercent.x=a.getPositionPercentX();this._positionPercent.y=a.getPositionPercentY()}return this._positionPercent.x},_getYPercent:function(){if(this._usingLayoutComponent){var a=this._getOrCreateLayoutComponent();this._positionPercent.x= a.getPositionPercentX();this._positionPercent.y=a.getPositionPercentY()}return this._positionPercent.y},setPositionType:function(a){this._positionType=a;if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();a===ccui.POSITION_ABSOLUTE?(b.setPositionPercentXEnabled(!1),b.setPositionPercentYEnabled(!1)):(b.setPositionPercentXEnabled(!0),b.setPositionPercentYEnabled(!0))}this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getPositionType:function(){return this._positionType}, setFlippedX:function(a){var b=this.getScaleX();this._flippedX=a;this.setScaleX(b)},isFlippedX:function(){return this._flippedX},setFlippedY:function(a){var b=this.getScaleY();this._flippedY=a;this.setScaleY(b)},isFlippedY:function(){return this._flippedY},_adaptRenderers:function(){},isBright:function(){return this._bright},isEnabled:function(){return this._enabled},getLeftBoundary:function(){return this.getPositionX()-this._getAnchorX()*this._contentSize.width},getBottomBoundary:function(){return this.getPositionY()- this._getAnchorY()*this._contentSize.height},getRightBoundary:function(){return this.getLeftBoundary()+this._contentSize.width},getTopBoundary:function(){return this.getBottomBoundary()+this._contentSize.height},getTouchBeganPosition:function(){return cc.p(this._touchBeganPosition)},getTouchMovePosition:function(){return cc.p(this._touchMovePosition)},getTouchEndPosition:function(){return cc.p(this._touchEndPosition)},getWidgetType:function(){return this._widgetType},setLayoutParameter:function(a){a&& (this._layoutParameterDictionary[a.getLayoutType()]=a,this._layoutParameterType=a.getLayoutType())},getLayoutParameter:function(a){a=a||this._layoutParameterType;return this._layoutParameterDictionary[a]},getDescription:function(){return"Widget"},clone:function(){var a=this._createCloneInstance();a._copyProperties(this);a._copyClonedWidgetChildren(this);return a},_createCloneInstance:function(){return new ccui.Widget},_copyClonedWidgetChildren:function(a){a=a.getChildren();for(var b=0;b<a.length;b++){var c= a[b];c instanceof ccui.Widget&&this.addChild(c.clone())}},_copySpecialProperties:function(a){},_copyProperties:function(a){this.setEnabled(a.isEnabled());this.setVisible(a.isVisible());this.setBright(a.isBright());this.setTouchEnabled(a.isTouchEnabled());this.setLocalZOrder(a.getLocalZOrder());this.setTag(a.getTag());this.setName(a.getName());this.setActionTag(a.getActionTag());this._ignoreSize=a._ignoreSize;this.setContentSize(a._contentSize);this._customSize.width=a._customSize.width;this._customSize.height= a._customSize.height;this._copySpecialProperties(a);this._sizeType=a.getSizeType();this._sizePercent.x=a._sizePercent.x;this._sizePercent.y=a._sizePercent.y;this._positionType=a._positionType;this._positionPercent.x=a._positionPercent.x;this._positionPercent.y=a._positionPercent.y;this.setPosition(a.getPosition());this.setAnchorPoint(a.getAnchorPoint());this.setScaleX(a.getScaleX());this.setScaleY(a.getScaleY());this.setRotation(a.getRotation());this.setRotationX(a.getRotationX());this.setRotationY(a.getRotationY()); this.setFlippedX(a.isFlippedX());this.setFlippedY(a.isFlippedY());this.setColor(a.getColor());this.setOpacity(a.getOpacity());this._touchEventCallback=a._touchEventCallback;this._touchEventListener=a._touchEventListener;this._touchEventSelector=a._touchEventSelector;this._clickEventListener=a._clickEventListener;this._focused=a._focused;this._focusEnabled=a._focusEnabled;this._propagateTouchEvents=a._propagateTouchEvents;for(var b in a._layoutParameterDictionary){var c=a._layoutParameterDictionary[b]; c&&this.setLayoutParameter(c.clone())}},setActionTag:function(a){this._actionTag=a},getActionTag:function(){return this._actionTag},getLeftInParent:function(){cc.log("getLeftInParent is deprecated. Please use getLeftBoundary instead.");return this.getLeftBoundary()},getBottomInParent:function(){cc.log("getBottomInParent is deprecated. Please use getBottomBoundary instead.");return this.getBottomBoundary()},getRightInParent:function(){cc.log("getRightInParent is deprecated. Please use getRightBoundary instead."); return this.getRightBoundary()},getTopInParent:function(){cc.log("getTopInParent is deprecated. Please use getTopBoundary instead.");return this.getTopBoundary()},getTouchEndPos:function(){cc.log("getTouchEndPos is deprecated. Please use getTouchEndPosition instead.");return this.getTouchEndPosition()},getTouchMovePos:function(){cc.log("getTouchMovePos is deprecated. Please use getTouchMovePosition instead.");return this.getTouchMovePosition()},clippingParentAreaContainPoint:function(a){cc.log("clippingParentAreaContainPoint is deprecated. Please use isClippingParentContainsPoint instead."); this.isClippingParentContainsPoint(a)},getTouchStartPos:function(){cc.log("getTouchStartPos is deprecated. Please use getTouchBeganPosition instead.");return this.getTouchBeganPosition()},setSize:function(a){this.setContentSize(a)},getSize:function(){return this.getContentSize()},addNode:function(a,b,c){a instanceof ccui.Widget?cc.log("Please use addChild to add a Widget."):(cc.Node.prototype.addChild.call(this,a,b,c),this._nodes.push(a))},getNodeByTag:function(a){for(var b=this._nodes,c=0;c<b.length;c++){var d= b[c];if(d&&d.getTag()===a)return d}return null},getNodes:function(){return this._nodes},removeNode:function(a,b){cc.Node.prototype.removeChild.call(this,a,b);cc.arrayRemoveObject(this._nodes,a)},_getNormalGLProgram:function(){return cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR)},_getGrayGLProgram:function(){return cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR_GRAY)},removeNodeByTag:function(a,b){var c=this.getChildByTag(a);c?this.removeChild(c,b):cc.log("cocos2d: removeNodeByTag(tag \x3d %d): child not found!", a)},removeAllNodes:function(){for(var a=0;a<this._nodes.length;a++)cc.Node.prototype.removeChild.call(this,this._nodes[a]);this._nodes.length=0},_findLayout:function(){cc.renderer.childrenOrderDirty=!0;for(var a=this._parent;a;)if(a._doLayout){a._doLayoutDirty=!0;break}else a=a._parent},isUnifySizeEnabled:function(){return this._unifySize},setUnifySizeEnabled:function(a){this._unifySize=a},_ccEventCallback:null,addCCSEventListener:function(a){this._ccEventCallback=a},setScaleX:function(a){this._flippedX&& (a*=-1);cc.Node.prototype.setScaleX.call(this,a)},setScaleY:function(a){this._flippedY&&(a*=-1);cc.Node.prototype.setScaleY.call(this,a)},setScale:function(a,b){void 0===b&&(b=a);this.setScaleX(a);this.setScaleY(b)},getScaleX:function(){var a=cc.Node.prototype.getScaleX.call(this);this._flippedX&&(a*=-1);return a},getScaleY:function(){var a=cc.Node.prototype.getScaleY.call(this);this._flippedY&&(a*=-1);return a},getScale:function(){this.getScaleX()!==this.getScaleY()&&cc.log("Widget#scale. ScaleX !\x3d ScaleY. Don't know which one to return"); return this.getScaleX()},setCallbackName:function(a){this._callbackName=a},getCallbackName:function(){return this._callbackName},setCallbackType:function(a){this._callbackType=a},getCallbackType:function(){return this._callbackType},setLayoutComponentEnabled:function(a){this._usingLayoutComponent=a},isLayoutComponentEnabled:function(){return this._usingLayoutComponent},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new ccui.Widget.WebGLRenderCmd(this):new ccui.Widget.CanvasRenderCmd(this)}}); _p=ccui.Widget.prototype;cc.defineGetterSetter(_p,"xPercent",_p._getXPercent,_p._setXPercent);cc.defineGetterSetter(_p,"yPercent",_p._getYPercent,_p._setYPercent);cc.defineGetterSetter(_p,"widthPercent",_p._getWidthPercent,_p._setWidthPercent);cc.defineGetterSetter(_p,"heightPercent",_p._getHeightPercent,_p._setHeightPercent);cc.defineGetterSetter(_p,"widgetParent",_p.getWidgetParent);cc.defineGetterSetter(_p,"enabled",_p.isEnabled,_p.setEnabled);cc.defineGetterSetter(_p,"focused",_p.isFocused,_p.setFocused); cc.defineGetterSetter(_p,"sizeType",_p.getSizeType,_p.setSizeType);cc.defineGetterSetter(_p,"widgetType",_p.getWidgetType);cc.defineGetterSetter(_p,"touchEnabled",_p.isTouchEnabled,_p.setTouchEnabled);cc.defineGetterSetter(_p,"updateEnabled",_p.isUpdateEnabled,_p.setUpdateEnabled);cc.defineGetterSetter(_p,"bright",_p.isBright,_p.setBright);cc.defineGetterSetter(_p,"name",_p.getName,_p.setName);cc.defineGetterSetter(_p,"actionTag",_p.getActionTag,_p.setActionTag); cc.defineGetterSetter(_p,"opacity",_p.getOpacity,_p.setOpacity);_p=null;ccui.Widget.create=function(){return new ccui.Widget};ccui.Widget._focusedWidget=null;ccui.Widget._focusNavigationController=null; ccui.Widget.enableDpadNavigation=function(a){a?(null==ccui.Widget._focusNavigationController&&(ccui.Widget._focusNavigationController=new ccui._FocusNavigationController,ccui.Widget._focusedWidget&&ccui.Widget._focusNavigationController._setFirstFocsuedWidget(ccui.Widget._focusedWidget)),ccui.Widget._focusNavigationController.enableFocusNavigation(!0)):ccui.Widget._focusNavigationController&&(ccui.Widget._focusNavigationController.enableFocusNavigation(!1),ccui.Widget._focusNavigationController=null)}; ccui.Widget.getCurrentFocusedWidget=function(){return ccui.Widget._focusedWidget};ccui.Widget.BRIGHT_STYLE_NONE=-1;ccui.Widget.BRIGHT_STYLE_NORMAL=0;ccui.Widget.BRIGHT_STYLE_HIGH_LIGHT=1;ccui.Widget.TYPE_WIDGET=0;ccui.Widget.TYPE_CONTAINER=1;ccui.Widget.LEFT=0;ccui.Widget.RIGHT=1;ccui.Widget.UP=2;ccui.Widget.DOWN=3;ccui.Widget.LOCAL_TEXTURE=0;ccui.Widget.PLIST_TEXTURE=1;ccui.Widget.TOUCH_BEGAN=0;ccui.Widget.TOUCH_MOVED=1;ccui.Widget.TOUCH_ENDED=2;ccui.Widget.TOUCH_CANCELED=3; ccui.Widget.SIZE_ABSOLUTE=0;ccui.Widget.SIZE_PERCENT=1;ccui.Widget.POSITION_ABSOLUTE=0;ccui.Widget.POSITION_PERCENT=1;cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_CANVAS){ccui.Widget.CanvasRenderCmd=function(a){this._pNodeCmdCtor(a);this._needDraw=!1};var a=ccui.Widget.CanvasRenderCmd.prototype=Object.create(cc.ProtectedNode.CanvasRenderCmd.prototype);a.constructor=ccui.Widget.CanvasRenderCmd;a.visit=function(a){var c=this._node,d=cc.renderer;if(a=a||this.getParentRenderCmd())this._curLevel=a._curLevel+1;isNaN(c._customZ)&&(c._vertexZ=d.assignedZ,d.assignedZ+= d.assignedZStep);c._adaptRenderers();this._syncStatus(a)};a.transform=function(a,c){this._transform||(this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0},this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0});var d=this._node;if(d._visible&&d._running){d._adaptRenderers();if(!this._usingLayoutComponent){var e=d.getWidgetParent();e&&(e=e.getContentSize(),0!==e.width&&0!==e.height&&(d._position.x=e.width*d._positionPercent.x,d._position.y=e.height*d._positionPercent.y))}this.pNodeTransform(a,c)}}}else ccui.Widget.WebGLRenderCmd= function(a){this._pNodeCmdCtor(a);this._needDraw=!1},a=ccui.Widget.WebGLRenderCmd.prototype=Object.create(cc.ProtectedNode.WebGLRenderCmd.prototype),a.constructor=ccui.Widget.WebGLRenderCmd,a.visit=function(a){var c=this._node,d=cc.renderer;if(a=a||this.getParentRenderCmd())this._curLevel=a._curLevel+1;isNaN(c._customZ)&&(c._vertexZ=d.assignedZ,d.assignedZ+=d.assignedZStep);c._adaptRenderers();this._syncStatus(a)},a.transform=function(a,c){this._transform||(this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0}, this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0});var d=this._node;if(d._visible&&d._running){d._adaptRenderers();if(!this._usingLayoutComponent){var e=d.getWidgetParent();e&&(e=e.getContentSize(),0!==e.width&&0!==e.height&&(d._position.x=e.width*d._positionPercent.x,d._position.y=e.height*d._positionPercent.y))}this.pNodeTransform(a,c)}};a.widgetTransform=a.transform});(function(){var a={_pool:{},_lengths:[],put:function(a){var b=a.length;this._pool[b]?this._pool[b].push(a):(this._pool[b]=[a],this._lengths.push(b),this._lengths.sort())},get:function(a){for(var b,c=0;c<this._lengths.length;c++)if(this._lengths[c]>=a){b=this._lengths[c];break}if(b)return this._pool[b].pop()}},b=cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL,c,d={_rebuildQuads_base:function(b,d,e,f){var g=b._vertices,r=b._renderCmd._worldTransform,s,u,t;if(f)u=s=0,t=e.width,e=e.height;else{s=d._originalSize; var v=d._rect,w=d._offset;t=e.width/s.width;f=e.height/s.height;var x=w.x-(s.width-v.width)/2;u=w.y+(s.height-v.height)/2;var B=w.y-(s.height-v.height)/2;s=(w.x+(s.width-v.width)/2)*t;u*=f;t=e.width+x*t;e=e.height+B*f}8>g.length&&(a.put(g),g=a.get(8)||new Float32Array(8),b._vertices=g);c?(g[0]=s*r.a+u*r.c+r.tx,g[1]=s*r.b+u*r.d+r.ty,g[2]=t*r.a+u*r.c+r.tx,g[3]=t*r.b+u*r.d+r.ty,g[4]=s*r.a+e*r.c+r.tx,g[5]=s*r.b+e*r.d+r.ty,g[6]=t*r.a+e*r.c+r.tx,g[7]=t*r.b+e*r.d+r.ty):(g[0]=s,g[1]=u,g[2]=t,g[3]=u,g[4]= s,g[5]=e,g[6]=t,g[7]=e);b._uvsDirty&&this._calculateUVs(b,d);b._vertCount=4},_calculateUVs:function(c,d){var e=c._uvs,f=d._texture._pixelsWide,g=d._texture._pixelsHigh,r=d._rect;8>e.length&&(a.put(e),e=a.get(8)||new Float32Array(8),c._uvs=e);var s,u,t=b?0.5:0;d._rotated?(s=(r.x+t)/f,u=(r.y+r.width-t)/g,f=(r.x+r.height-t)/f,g=(r.y+t)/g,e[0]=s,e[1]=g,e[2]=s,e[3]=u,e[4]=f,e[5]=g,e[6]=f,e[7]=u):(s=(r.x+t)/f,u=(r.y+r.height-t)/g,f=(r.x+r.width-t)/f,g=(r.y+t)/g,e[0]=s,e[1]=u,e[2]=f,e[3]=u,e[4]=s,e[5]=g, e[6]=f,e[7]=g)}},e={x:Array(4),y:Array(4),_rebuildQuads_base:function(b,d,e,f,g,r,s){var u=b._vertices,t=b._renderCmd._worldTransform,v=e.width-f-g,w=e.height-r-s,x=e.width/(f+g),B=e.height/(r+s),y=this.x,z=this.y;y[0]=0;y[1]=f*(1<x?1:x);y[2]=y[1]+(0>v?0:v);y[3]=e.width;z[0]=0;z[1]=s*(1<B?1:B);z[2]=z[1]+(0>w?0:w);z[3]=e.height;32>u.length&&(a.put(u),u=a.get(32)||new Float32Array(32),b._vertices=u);e=0;if(c)for(v=0;4>v;v++)for(w=0;4>w;w++)u[e]=y[w]*t.a+z[v]*t.c+t.tx,u[e+1]=y[w]*t.b+z[v]*t.d+t.ty,e+= 2;else for(v=0;4>v;v++)for(w=0;4>w;w++)u[e]=y[w],u[e+1]=z[v],e+=2;b._uvsDirty&&this._calculateUVs(b,d,f,g,r,s)},_calculateUVs:function(c,d,e,f,g,r){var s=c._uvs,u=d._rect,t=d._texture._pixelsWide,v=d._texture._pixelsHigh,w,x=d._rect;f=u.width-e-f;w=u.height-g-r;32>s.length&&(a.put(s),s=a.get(32)||new Float32Array(32),c._uvs=s);c=this.x;var u=this.y,B=b?0.5:0,y=0;if(d._rotated)for(c[0]=(x.x+B)/t,c[1]=(r+x.x)/t,c[2]=(r+w+x.x)/t,c[3]=(x.x+x.height-B)/t,u[3]=(x.y+B)/v,u[2]=(e+x.y)/v,u[1]=(e+f+x.y)/v, u[0]=(x.y+x.width-B)/v,d=0;4>d;d++)for(e=0;4>e;e++)s[y]=c[d],s[y+1]=u[3-e],y+=2;else for(c[0]=(x.x+B)/t,c[1]=(e+x.x)/t,c[2]=(e+f+x.x)/t,c[3]=(x.x+x.width-B)/t,u[3]=(x.y+B)/v,u[2]=(g+x.y)/v,u[1]=(g+w+x.y)/v,u[0]=(x.y+x.height-B)/v,d=0;4>d;d++)for(e=0;4>e;e++)s[y]=c[e],s[y+1]=u[d],y+=2}};ccui.Scale9Sprite=cc.Scale9Sprite=cc.Node.extend({_spriteFrame:null,_scale9Image:null,_insetLeft:0,_insetRight:0,_insetTop:0,_insetBottom:0,_blendFunc:null,_renderingType:1,_brightState:0,_opacityModifyRGB:!1,_rawVerts:null, _rawUvs:null,_vertices:null,_uvs:null,_vertCount:0,_quadsDirty:!0,_uvsDirty:!0,_isTriangle:!1,_isTrimmedContentSize:!1,_flippedX:!1,_flippedY:!1,_className:"Scale9Sprite",ctor:function(b,d,e){cc.Node.prototype.ctor.call(this);this._loader=new cc.Sprite.LoadManager;this._renderCmd.setState(this._brightState);this._blendFunc=cc.BlendFunc._alphaPremultiplied();this.setAnchorPoint(cc.p(0.5,0.5));this._rawUvs=this._rawVerts=null;this._vertices=a.get(8)||new Float32Array(8);this._uvs=a.get(8)||new Float32Array(8); if(void 0!==b)if(b instanceof cc.SpriteFrame)this.initWithSpriteFrame(b,d);else{var f=cc.spriteFrameCache.getSpriteFrame(b);f?this.initWithSpriteFrame(f,d):this.initWithFile(b,d,e)}void 0===c&&(c=cc._renderType===cc.game.RENDER_TYPE_WEBGL)},getCapInsets:function(){return cc.rect(this._capInsetsInternal)},_asyncSetCapInsets:function(){this.removeEventListener("load",this._asyncSetCapInsets,this);this.setCapInsets(this._cacheCapInsets);this._cacheCapInsets=null},setCapInsets:function(a){if(!this.loaded())return this._cacheCapInsets= a,this.removeEventListener("load",this._asyncSetCapInsets,this),this.addEventListener("load",this._asyncSetCapInsets,this),!1;this._capInsetsInternal=a;this._updateCapInsets(this._spriteFrame._rect,this._capInsetsInternal)},_updateCapInsets:function(a,b){b&&a&&!cc._rectEqualToZero(b)?this._capInsetsInternal=b:(a=a||{x:0,y:0,width:this._contentSize.width,height:this._contentSize.height},this._capInsetsInternal=cc.rect(a.width/3,a.height/3,a.width/3,a.height/3));cc._rectEqualToZero(a)||(this._insetLeft= this._capInsetsInternal.x,this._insetTop=this._capInsetsInternal.y,this._insetRight=a.width-this._insetLeft-this._capInsetsInternal.width,this._insetBottom=a.height-this._insetTop-this._capInsetsInternal.height)},initWithFile:function(a,b,c){a instanceof cc.Rect?(c=a=b,b=cc.rect(0,0,0,0)):(b=b||cc.rect(0,0,0,0),c=c||cc.rect(0,0,0,0));if(!a)throw Error("ccui.Scale9Sprite.initWithFile(): file should be non-null");var d=cc.textureCache.getTextureForKey(a);d||(d=cc.textureCache.addImage(a));var e=d.isLoaded(); this._loader.clear();if(!e)return this._loader.once(d,function(){this.initWithFile(a,b,c);this.dispatchEvent("load")},this),!1;cc._rectEqualToZero(b)&&(e=d.getContentSize(),b=cc.rect(0,0,e.width,e.height));this.setTexture(d,b);this._updateCapInsets(b,c);return!0},updateWithBatchNode:function(a,b,c,d){if(!a)return!1;var e=a.getTexture();this._loader.clear();if(!e.isLoaded())return this._loader.once(e,function(){this.updateWithBatchNode(a,b,c,d);this.dispatchEvent("load")},this),!1;this.setTexture(e, b);this._updateCapInsets(b,d);return!0},initWithSpriteFrame:function(a,b){this.setSpriteFrame(a);b=b||cc.rect(0,0,0,0);this._updateCapInsets(a._rect,b)},initWithSpriteFrameName:function(a,b){if(!a)throw Error("ccui.Scale9Sprite.initWithSpriteFrameName(): spriteFrameName should be non-null");b=b||cc.rect(0,0,0,0);var c=cc.spriteFrameCache.getSpriteFrame(a);if(null==c)return cc.log("ccui.Scale9Sprite.initWithSpriteFrameName(): can't find the sprite frame by spriteFrameName"),!1;this.setSpriteFrame(c); b=b||cc.rect(0,0,0,0);this._updateCapInsets(c._rect,b)},loaded:function(){return null===this._spriteFrame?!1:this._spriteFrame.textureLoaded()},setTexture:function(a,b){var c=new cc.SpriteFrame(a,b);this.setSpriteFrame(c)},_updateBlendFunc:function(){var a=this._blendFunc;this._spriteFrame&&this._spriteFrame._texture.hasPremultipliedAlpha()?(a.src===cc.SRC_ALPHA&&a.dst===cc.BLEND_DST&&(a.src=cc.ONE),this._opacityModifyRGB=!0):(a.src===cc.ONE&&a.dst===cc.BLEND_DST&&(a.src=cc.SRC_ALPHA),this._opacityModifyRGB= !1)},setOpacityModifyRGB:function(a){this._opacityModifyRGB!==a&&(this._opacityModifyRGB=a,this._renderCmd._setColorDirty())},isOpacityModifyRGB:function(){return this._opacityModifyRGB},setSpriteFrame:function(a){if(a){this._spriteFrame=a;this._uvsDirty=this._quadsDirty=!0;var b=this,c=function(){cc.sizeEqualToSize(b._contentSize,cc.size(0,0))&&b.setContentSize(b._spriteFrame._rect);b._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty);cc.renderer.childrenOrderDirty=!0};a.textureLoaded()?c(): (this._loader.clear(),this._loader.once(a,function(){c();this.dispatchEvent("load")},this))}},setBlendFunc:function(a,b){void 0===b?(this._blendFunc.src=a.src||cc.BLEND_SRC,this._blendFunc.dst=a.dst||cc.BLEND_DST):(this._blendFunc.src=a||cc.BLEND_SRC,this._blendFunc.dst=b||cc.BLEND_DST);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getBlendFunc:function(){return new cc.BlendFunc(this._blendFunc.src,this._blendFunc.dst)},setPreferredSize:function(a){a&&!cc.sizeEqualToSize(this._contentSize, a)&&this.setContentSize(a)},getPreferredSize:function(){return this.getContentSize()},setContentSize:function(a,b){void 0===b&&(b=a.height,a=a.width);if(a!==this._contentSize.width||b!==this._contentSize.height)cc.Node.prototype.setContentSize.call(this,a,b),this._quadsDirty=!0},getContentSize:function(){return this._renderingType===ccui.Scale9Sprite.RenderingType.SIMPLE?this._spriteFrame?this._spriteFrame._originalSize:cc.size(this._contentSize):cc.size(this._contentSize)},_setWidth:function(a){cc.Node.prototype._setWidth.call(this, a);this._quadsDirty=!0},_setHeight:function(a){cc.Node.prototype._setHeight.call(this,a);this._quadsDirty=!0},setState:function(a){this._brightState=a;this._renderCmd.setState(a);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getState:function(){return this._brightState},setRenderingType:function(a){this._renderingType!==a&&(this._renderingType=a,this._uvsDirty=this._quadsDirty=!0,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty))},getRenderingType:function(){return this._renderingType}, setInsetLeft:function(a){this._insetLeft=a;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getInsetLeft:function(){return this._insetLeft},setInsetTop:function(a){this._insetTop=a;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getInsetTop:function(){return this._insetTop},setInsetRight:function(a){this._insetRight=a;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)}, getInsetRight:function(){return this._insetRight},setInsetBottom:function(a){this._insetBottom=a;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getInsetBottom:function(){return this._insetBottom},_rebuildQuads:function(){if(this._spriteFrame&&this._spriteFrame._textureLoaded){this._updateBlendFunc();this._isTriangle=!1;switch(this._renderingType){case g.SIMPLE:d._rebuildQuads_base(this,this._spriteFrame,this._contentSize,this._isTrimmedContentSize); break;case g.SLICED:e._rebuildQuads_base(this,this._spriteFrame,this._contentSize,this._insetLeft,this._insetRight,this._insetTop,this._insetBottom);break;default:this._uvsDirty=this._quadsDirty=!1;cc.error("Can not generate quad");return}this._uvsDirty=this._quadsDirty=!1}},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new ccui.Scale9Sprite.CanvasRenderCmd(this):new ccui.Scale9Sprite.WebGLRenderCmd(this)}});var f=ccui.Scale9Sprite.prototype;cc.EventHelper.prototype.apply(f); cc.defineGetterSetter(f,"preferredSize",f.getPreferredSize,f.setPreferredSize);cc.defineGetterSetter(f,"capInsets",f.getCapInsets,f.setCapInsets);cc.defineGetterSetter(f,"insetLeft",f.getInsetLeft,f.setInsetLeft);cc.defineGetterSetter(f,"insetTop",f.getInsetTop,f.setInsetTop);cc.defineGetterSetter(f,"insetRight",f.getInsetRight,f.setInsetRight);cc.defineGetterSetter(f,"insetBottom",f.getInsetBottom,f.setInsetBottom);f=null;ccui.Scale9Sprite.create=function(a,b,c){return new ccui.Scale9Sprite(a,b, c)};ccui.Scale9Sprite.createWithSpriteFrame=function(a,b){return new ccui.Scale9Sprite(a,b)};ccui.Scale9Sprite.createWithSpriteFrameName=function(a,b){return new ccui.Scale9Sprite(a,b)};ccui.Scale9Sprite.POSITIONS_CENTRE=0;ccui.Scale9Sprite.POSITIONS_TOP=1;ccui.Scale9Sprite.POSITIONS_LEFT=2;ccui.Scale9Sprite.POSITIONS_RIGHT=3;ccui.Scale9Sprite.POSITIONS_BOTTOM=4;ccui.Scale9Sprite.POSITIONS_TOPRIGHT=5;ccui.Scale9Sprite.POSITIONS_TOPLEFT=6;ccui.Scale9Sprite.POSITIONS_BOTTOMRIGHT=7;ccui.Scale9Sprite.state= {NORMAL:0,GRAY:1};var g=ccui.Scale9Sprite.RenderingType={SIMPLE:0,SLICED:1}})();(function(){ccui.Scale9Sprite.CanvasRenderCmd=function(a){cc.Node.CanvasRenderCmd.call(this,a);this._needDraw=!0;this._state=ccui.Scale9Sprite.state.NORMAL;this._originalTexture=this._textureToRender=null};var a=ccui.Scale9Sprite.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=ccui.Scale9Sprite.CanvasRenderCmd;a.transform=function(a,c){this.originTransform(a,c);this._node._rebuildQuads()};a.needDraw=function(){return this._needDraw&&this._node.loaded()};a._updateDisplayColor= function(a){cc.Node.RenderCmd.prototype._updateDisplayColor.call(this,a);this._originalTexture=this._textureToRender=null};a.setState=function(a){this._state!==a&&(this._state=a,this._originalTexture=this._textureToRender=null)};a._setColorDirty=function(){this.setDirtyFlag(cc.Node._dirtyFlags.colorDirty|cc.Node._dirtyFlags.opacityDirty)};a.rendering=function(a,c,d){var e=this._node,f=this._displayedOpacity,g=f/255,h=null;e._spriteFrame&&(h=e._spriteFrame._texture);if(e.loaded()&&0!==f){if(null=== this._textureToRender||this._originalTexture!==h)this._textureToRender=this._originalTexture=h,cc.Scale9Sprite.state.GRAY===this._state&&(this._textureToRender=this._textureToRender._switchToGray()),f=e.getDisplayedColor(),!h||255===f.r&&255===f.g&&255===f.b||(this._textureToRender=this._textureToRender._generateColorTexture(f.r,f.g,f.b));h=a||cc._renderContext;a=h.getContext();h.setTransform(this._worldTransform,c,d);h.setCompositeOperation(cc.Node.CanvasRenderCmd._getCompositeOperationByBlendFunc(e._blendFunc)); h.setGlobalAlpha(g);if(this._textureToRender){e._quadsDirty&&e._rebuildQuads();var k,m,n,p,r,s,u;c=this._textureToRender._pixelsWide;d=this._textureToRender._pixelsHigh;var g=this._textureToRender._htmlElementObj,f=e._vertices,t=e._uvs,v=0,w=0;if(e._renderingType===cc.Scale9Sprite.RenderingType.SLICED){for(h=0;3>h;++h)for(v=0;3>v;++v)w=8*h+2*v,p=f[w],r=f[w+1],s=f[w+10]-p,u=f[w+11]-r,r=-r-u,e=t[w]*c,k=t[w+11]*d,m=(t[w+10]-t[w])*c,n=(t[w+1]-t[w+11])*d,0<m&&0<n&&0<s&&0<u&&a.drawImage(g,e,k,m,n,p,r,s, u);cc.g_NumberOfDraws+=9}else{for(var x=Math.floor(e._vertCount/4),w=v=0;v<x;v++)p=f[w],r=f[w+1],s=f[w+6]-p,u=f[w+7]-r,r=-r-u,e=t[w]*c,k=t[w+7]*d,m=(t[w+6]-t[w])*c,n=(t[w+1]-t[w+7])*d,""!==this._textureToRender._pattern?(h.setFillStyle(a.createPattern(g,this._textureToRender._pattern)),a.fillRect(p,r,s,u)):0<m&&0<n&&0<s&&0<u&&a.drawImage(g,e,k,m,n,p,r,s,u),w+=8;cc.g_NumberOfDraws+=x}}}}})();(function(){if(cc.Node.WebGLRenderCmd){ccui.Scale9Sprite.WebGLRenderCmd=function(a){cc.Node.WebGLRenderCmd.call(this,a);this._needDraw=!0;this._color=new Uint32Array(1);this._dirty=!1;this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR)};var a=ccui.Scale9Sprite,b=ccui.Scale9Sprite.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);b.constructor=ccui.Scale9Sprite.WebGLRenderCmd;b.needDraw=function(){return this._needDraw&&this._node.loaded()}; b._uploadSliced=function(a,b,e,f,g,h,k){for(var m,n=0;3>n;++n)for(var p=0;3>p;++p)m=8*n+2*p,g[k]=a[m],g[k+1]=a[m+1],g[k+2]=f,h[k+3]=e[0],g[k+4]=b[m],g[k+5]=b[m+1],k+=6,g[k]=a[m+2],g[k+1]=a[m+3],g[k+2]=f,h[k+3]=e[0],g[k+4]=b[m+2],g[k+5]=b[m+3],k+=6,g[k]=a[m+8],g[k+1]=a[m+9],g[k+2]=f,h[k+3]=e[0],g[k+4]=b[m+8],g[k+5]=b[m+9],k+=6,g[k]=a[m+10],g[k+1]=a[m+11],g[k+2]=f,h[k+3]=e[0],g[k+4]=b[m+10],g[k+5]=b[m+11],k+=6;return 36};b.transform=function(a,b){this.originTransform(a,b);this._node._rebuildQuads()}; b._setColorDirty=function(){};b.uploadData=function(b,d,e){var f=this._node;if(0===this._displayedOpacity)return 0;f._quadsDirty&&f._rebuildQuads();var g=this._displayedOpacity,h=this._displayedColor.r,k=this._displayedColor.g,m=this._displayedColor.b;if(f._opacityModifyRGB)var n=g/255,h=h*n,k=k*n,m=m*n;this._color[0]=g<<24|m<<16|k<<8|h;g=f._vertexZ;h=f._vertices;k=f._uvs;n=a.RenderingType;m=0;switch(f._renderingType){case n.SIMPLE:m=this._node._vertCount;for(n=f=0;f<m;f++,n+=2)b[e]=h[n],b[e+1]=h[n+ 1],b[e+2]=g,d[e+3]=this._color[0],b[e+4]=k[n],b[e+5]=k[n+1],e+=6;break;case n.SLICED:m=this._uploadSliced(h,k,this._color,g,b,d,e)}return m};b.setState=function(b){b===a.state.NORMAL?this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR):b===a.state.GRAY&&(this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR_GRAY))}}})();ccui.Layout=ccui.Widget.extend({_clippingEnabled:!1,_backGroundScale9Enabled:null,_backGroundImage:null,_backGroundImageFileName:null,_backGroundImageCapInsets:null,_colorType:null,_bgImageTexType:ccui.Widget.LOCAL_TEXTURE,_colorRender:null,_gradientRender:null,_color:null,_startColor:null,_endColor:null,_alongVector:null,_opacity:255,_backGroundImageTextureSize:null,_layoutType:null,_doLayoutDirty:!0,_clippingRectDirty:!0,_clippingType:null,_clippingStencil:null,_scissorRectDirty:!1,_clippingRect:null, _clippingParent:null,_className:"Layout",_backGroundImageColor:null,_finalPositionX:0,_finalPositionY:0,_backGroundImageOpacity:0,_loopFocus:!1,__passFocusToChild:!0,_isFocusPassing:!1,_isInterceptTouch:!1,ctor:function(){this._layoutType=ccui.Layout.ABSOLUTE;this._widgetType=ccui.Widget.TYPE_CONTAINER;this._clippingType=ccui.Layout.CLIPPING_SCISSOR;this._colorType=ccui.Layout.BG_COLOR_NONE;ccui.Widget.prototype.ctor.call(this);this.ignoreContentAdaptWithSize(!1);this.setContentSize(cc.size(0,0)); this.setAnchorPoint(0,0);this.onPassFocusToChild=this._findNearestChildWidgetIndex.bind(this);this._backGroundImageCapInsets=cc.rect(0,0,0,0);this._color=cc.color(255,255,255,255);this._startColor=cc.color(255,255,255,255);this._endColor=cc.color(255,255,255,255);this._alongVector=cc.p(0,-1);this._backGroundImageTextureSize=cc.size(0,0);this._clippingRect=cc.rect(0,0,0,0);this._backGroundImageColor=cc.color(255,255,255,255)},onEnter:function(){ccui.Widget.prototype.onEnter.call(this);this._clippingStencil&& this._clippingStencil._performRecursive(cc.Node._stateCallbackType.onEnter);this._clippingRectDirty=this._doLayoutDirty=!0},onExit:function(){ccui.Widget.prototype.onExit.call(this);this._clippingStencil&&this._clippingStencil._performRecursive(cc.Node._stateCallbackType.onExit)},visit:function(a){if(this._visible){this._adaptRenderers();this._doLayout();var b=this._renderCmd,c=a&&a._renderCmd;b.visit(c);a=this._clippingEnabled&&this._clippingType===ccui.Layout.CLIPPING_STENCIL;var d=this._clippingEnabled&& this._clippingType===ccui.Layout.CLIPPING_SCISSOR;a?b.stencilClippingVisit(c):d&&b.scissorClippingVisit(c);var e=this._children,f=e.length,g,h=this._protectedChildren,k=h.length,m;this._reorderChildDirty&&this.sortAllChildren();this._reorderProtectedChildDirty&&this.sortAllProtectedChildren();for(c=0;c<f;c++)if(g=e[c],0>g._localZOrder)g.visit(this);else break;for(g=0;g<k;g++)if(m=h[g],0>m._localZOrder)b._changeProtectedChild(m),m.visit(this);else break;for(;c<f;c++)e[c].visit(this);for(;g<k;g++)m= h[g],b._changeProtectedChild(m),m.visit(this);a?b.postStencilVisit():d&&b.postScissorVisit();b._dirtyFlag=0}},setLoopFocus:function(a){this._loopFocus=a},isLoopFocus:function(){return this._loopFocus},setPassFocusToChild:function(a){this.__passFocusToChild=a},isPassFocusToChild:function(){return this.__passFocusToChild},findNextFocusedWidget:function(a,b){if(this._isFocusPassing||this.isFocused()){var c=this.getParent();this._isFocusPassing=!1;if(this.__passFocusToChild){var d=this._passFocusToChild(a, b);return d instanceof ccui.Layout&&c?(c._isFocusPassing=!0,c.findNextFocusedWidget(a,this)):d}if(null==c||!(c instanceof ccui.Layout))return this;c._isFocusPassing=!0;return c.findNextFocusedWidget(a,this)}if(b.isFocused()||b instanceof ccui.Layout)if(this._layoutType===ccui.Layout.LINEAR_HORIZONTAL)switch(a){case ccui.Widget.LEFT:return this._getPreviousFocusedWidget(a,b);case ccui.Widget.RIGHT:return this._getNextFocusedWidget(a,b);case ccui.Widget.DOWN:case ccui.Widget.UP:return this._isLastWidgetInContainer(this, a)?this._isWidgetAncestorSupportLoopFocus(b,a)?ccui.Widget.prototype.findNextFocusedWidget.call(this,a,this):b:ccui.Widget.prototype.findNextFocusedWidget.call(this,a,this);default:return cc.assert(0,"Invalid Focus Direction"),b}else if(this._layoutType===ccui.Layout.LINEAR_VERTICAL)switch(a){case ccui.Widget.LEFT:case ccui.Widget.RIGHT:return this._isLastWidgetInContainer(this,a)?this._isWidgetAncestorSupportLoopFocus(b,a)?ccui.Widget.prototype.findNextFocusedWidget.call(this,a,this):b:ccui.Widget.prototype.findNextFocusedWidget.call(this, a,this);case ccui.Widget.DOWN:return this._getNextFocusedWidget(a,b);case ccui.Widget.UP:return this._getPreviousFocusedWidget(a,b);default:return cc.assert(0,"Invalid Focus Direction"),b}else return cc.assert(0,"Un Supported Layout type, please use VBox and HBox instead!!!"),b;else return b},onPassFocusToChild:null,addChild:function(a,b,c){a instanceof ccui.Widget&&this._supplyTheLayoutParameterLackToChild(a);ccui.Widget.prototype.addChild.call(this,a,b,c);this._doLayoutDirty=!0},removeChild:function(a, b){ccui.Widget.prototype.removeChild.call(this,a,b);this._doLayoutDirty=!0},removeAllChildren:function(a){ccui.Widget.prototype.removeAllChildren.call(this,a);this._doLayoutDirty=!0},removeAllChildrenWithCleanup:function(a){ccui.Widget.prototype.removeAllChildrenWithCleanup.call(this,a);this._doLayoutDirty=!0},isClippingEnabled:function(){return this._clippingEnabled},setClippingEnabled:function(a){if(a!==this._clippingEnabled)switch(this._clippingEnabled=a,this._clippingType){case ccui.Layout.CLIPPING_SCISSOR:case ccui.Layout.CLIPPING_STENCIL:a? (this._clippingStencil=new cc.DrawNode,this._renderCmd.rebindStencilRendering(this._clippingStencil),this._running&&this._clippingStencil._performRecursive(cc.Node._stateCallbackType.onEnter),this._setStencilClippingSize(this._contentSize)):(this._running&&this._clippingStencil&&this._clippingStencil._performRecursive(cc.Node._stateCallbackType.onExit),this._clippingStencil=null)}},setClippingType:function(a){if(a!==this._clippingType){var b=this.isClippingEnabled();this.setClippingEnabled(!1);this._clippingType= a;this.setClippingEnabled(b)}},getClippingType:function(){return this._clippingType},_setStencilClippingSize:function(a){if(this._clippingEnabled){var b=[];b[0]=cc.p(0,0);b[1]=cc.p(a.width,0);b[2]=cc.p(a.width,a.height);b[3]=cc.p(0,a.height);var c=cc.color.GREEN;this._clippingStencil.clear();this._clippingStencil.setLocalBB&&this._clippingStencil.setLocalBB(0,0,a.width,a.height);this._clippingStencil.drawPoly(b,4,c,0,c)}},_getClippingRect:function(){if(this._clippingRectDirty){var a=this.convertToWorldSpace(cc.p(0, 0)),b=this.getNodeToWorldTransform(),c=this._contentSize.width*b.a,b=this._contentSize.height*b.d,d;for(d=this;d;)if((d=d.getParent())&&d instanceof ccui.Layout&&d.isClippingEnabled()){this._clippingParent=d;break}this._clippingParent?(d=this._clippingParent._getClippingRect(),this._clippingRect.x=Math.max(a.x,d.x),this._clippingRect.y=Math.max(a.y,d.y),c=Math.min(a.x+c,d.x+d.width),a=Math.min(a.y+b,d.y+d.height),this._clippingRect.width=Math.max(0,c-this._clippingRect.x),this._clippingRect.height= Math.max(0,a-this._clippingRect.y)):(this._clippingRect.x=a.x,this._clippingRect.y=a.y,this._clippingRect.width=c,this._clippingRect.height=b);this._clippingRectDirty=!1}return this._clippingRect},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);var a=this._contentSize;this._setStencilClippingSize(a);this._clippingRectDirty=this._doLayoutDirty=!0;this._backGroundImage&&(this._backGroundImage.setPosition(0.5*a.width,0.5*a.height),this._backGroundScale9Enabled&&this._backGroundImage instanceof ccui.Scale9Sprite&&this._backGroundImage.setPreferredSize(a));this._colorRender&&this._colorRender.setContentSize(a);this._gradientRender&&this._gradientRender.setContentSize(a)},setBackGroundImageScale9Enabled:function(a){this._backGroundScale9Enabled!==a&&(this.removeProtectedChild(this._backGroundImage),this._backGroundImage=null,this._backGroundScale9Enabled=a,this._addBackGroundImage(),this.setBackGroundImage(this._backGroundImageFileName,this._bgImageTexType),this.setBackGroundImageCapInsets(this._backGroundImageCapInsets))}, isBackGroundImageScale9Enabled:function(){return this._backGroundScale9Enabled},setBackGroundImage:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;null===this._backGroundImage&&(this._addBackGroundImage(),this.setBackGroundImageScale9Enabled(this._backGroundScale9Enabled));this._backGroundImageFileName=a;this._bgImageTexType=b;var c=this._backGroundImage;switch(this._bgImageTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._backGroundScale9Enabled&& c.setPreferredSize(this._contentSize);this._backGroundImageTextureSize=c.getContentSize();c.setPosition(0.5*this._contentSize.width,0.5*this._contentSize.height);this._updateBackGroundImageColor()}},setBackGroundImageCapInsets:function(a){if(a){var b=this._backGroundImageCapInsets;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._backGroundScale9Enabled&&this._backGroundImage.setCapInsets(a)}},getBackGroundImageCapInsets:function(){return cc.rect(this._backGroundImageCapInsets)},_supplyTheLayoutParameterLackToChild:function(a){if(a)switch(this._layoutType){case ccui.Layout.LINEAR_HORIZONTAL:case ccui.Layout.LINEAR_VERTICAL:var b= a.getLayoutParameter(ccui.LayoutParameter.LINEAR);b||a.setLayoutParameter(new ccui.LinearLayoutParameter);break;case ccui.Layout.RELATIVE:(b=a.getLayoutParameter(ccui.LayoutParameter.RELATIVE))||a.setLayoutParameter(new ccui.RelativeLayoutParameter)}},_addBackGroundImage:function(){var a=this._contentSize;this._backGroundScale9Enabled?(this._backGroundImage=new ccui.Scale9Sprite,this._backGroundImage.setPreferredSize(a)):this._backGroundImage=new cc.Sprite;this.addProtectedChild(this._backGroundImage, ccui.Layout.BACKGROUND_IMAGE_ZORDER,-1);this._backGroundImage.setPosition(0.5*a.width,0.5*a.height)},removeBackGroundImage:function(){this._backGroundImage&&(this.removeProtectedChild(this._backGroundImage),this._backGroundImage=null,this._backGroundImageFileName="",this._backGroundImageTextureSize.width=0,this._backGroundImageTextureSize.height=0)},setBackGroundColorType:function(a){if(this._colorType!==a){switch(this._colorType){case ccui.Layout.BG_COLOR_NONE:this._colorRender&&(this.removeProtectedChild(this._colorRender), this._colorRender=null);this._gradientRender&&(this.removeProtectedChild(this._gradientRender),this._gradientRender=null);break;case ccui.Layout.BG_COLOR_SOLID:this._colorRender&&(this.removeProtectedChild(this._colorRender),this._colorRender=null);break;case ccui.Layout.BG_COLOR_GRADIENT:this._gradientRender&&(this.removeProtectedChild(this._gradientRender),this._gradientRender=null)}this._colorType=a;switch(this._colorType){case ccui.Layout.BG_COLOR_SOLID:this._colorRender=new cc.LayerColor;this._colorRender.setContentSize(this._contentSize); this._colorRender.setOpacity(this._opacity);this._colorRender.setColor(this._color);this.addProtectedChild(this._colorRender,ccui.Layout.BACKGROUND_RENDERER_ZORDER,-1);break;case ccui.Layout.BG_COLOR_GRADIENT:this._gradientRender=new cc.LayerGradient(cc.color(255,0,0,255),cc.color(0,255,0,255)),this._gradientRender.setContentSize(this._contentSize),this._gradientRender.setOpacity(this._opacity),this._gradientRender.setStartColor(this._startColor),this._gradientRender.setEndColor(this._endColor),this._gradientRender.setVector(this._alongVector), this.addProtectedChild(this._gradientRender,ccui.Layout.BACKGROUND_RENDERER_ZORDER,-1)}}},getBackGroundColorType:function(){return this._colorType},setBackGroundColor:function(a,b){b?(this._startColor.r=a.r,this._startColor.g=a.g,this._startColor.b=a.b,this._gradientRender&&this._gradientRender.setStartColor(a),this._endColor.r=b.r,this._endColor.g=b.g,this._endColor.b=b.b,this._gradientRender&&this._gradientRender.setEndColor(b)):(this._color.r=a.r,this._color.g=a.g,this._color.b=a.b,this._colorRender&& this._colorRender.setColor(a))},getBackGroundColor:function(){var a=this._color;return cc.color(a.r,a.g,a.b,a.a)},getBackGroundStartColor:function(){var a=this._startColor;return cc.color(a.r,a.g,a.b,a.a)},getBackGroundEndColor:function(){var a=this._endColor;return cc.color(a.r,a.g,a.b,a.a)},setBackGroundColorOpacity:function(a){this._opacity=a;switch(this._colorType){case ccui.Layout.BG_COLOR_SOLID:this._colorRender.setOpacity(a);break;case ccui.Layout.BG_COLOR_GRADIENT:this._gradientRender.setOpacity(a)}}, getBackGroundColorOpacity:function(){return this._opacity},setBackGroundColorVector:function(a){this._alongVector.x=a.x;this._alongVector.y=a.y;this._gradientRender&&this._gradientRender.setVector(a)},getBackGroundColorVector:function(){return this._alongVector},setBackGroundImageColor:function(a){this._backGroundImageColor.r=a.r;this._backGroundImageColor.g=a.g;this._backGroundImageColor.b=a.b;this._updateBackGroundImageColor()},setBackGroundImageOpacity:function(a){this._backGroundImageColor.a= a;this.getBackGroundImageColor()},getBackGroundImageColor:function(){var a=this._backGroundImageColor;return cc.color(a.r,a.g,a.b,a.a)},getBackGroundImageOpacity:function(){return this._backGroundImageColor.a},_updateBackGroundImageColor:function(){this._backGroundImage&&this._backGroundImage.setColor(this._backGroundImageColor)},getBackGroundImageTextureSize:function(){return this._backGroundImageTextureSize},setLayoutType:function(a){this._layoutType=a;a=this._children;for(var b=null,c=0;c<a.length;c++)b= a[c],b instanceof ccui.Widget&&this._supplyTheLayoutParameterLackToChild(b);this._doLayoutDirty=!0},getLayoutType:function(){return this._layoutType},requestDoLayout:function(){this._doLayoutDirty=!0},_doLayout:function(){if(this._doLayoutDirty){this.sortAllChildren();var a=ccui.getLayoutManager(this._layoutType);a&&a._doLayout(this);this._doLayoutDirty=!1}},_getLayoutContentSize:function(){return this.getContentSize()},_getLayoutElements:function(){return this.getChildren()},_updateBackGroundImageOpacity:function(){this._backGroundImage&& this._backGroundImage.setOpacity(this._backGroundImageOpacity)},_updateBackGroundImageRGBA:function(){this._backGroundImage&&(this._backGroundImage.setColor(this._backGroundImageColor),this._backGroundImage.setOpacity(this._backGroundImageOpacity))},_getLayoutAccumulatedSize:function(){for(var a=this.getChildren(),b=cc.size(0,0),c=0,d,e=0,f=a.length;e<f;e++)if(d=a[e],null!==d&&d instanceof ccui.Layout)d=d._getLayoutAccumulatedSize(),b.width+=d.width,b.height+=d.height;else if(d instanceof ccui.Widget){c++; var g=d.getLayoutParameter().getMargin();d=d.getContentSize();b.width+=d.width+0.5*(g.right+g.left);b.height+=d.height+0.5*(g.top+g.bottom)}a=this.getLayoutType();a===ccui.Layout.LINEAR_HORIZONTAL&&(b.height-=b.height/c*(c-1));a===ccui.Layout.LINEAR_VERTICAL&&(b.width-=b.width/c*(c-1));return b},_findNearestChildWidgetIndex:function(a,b){if(null==b||b===this)return this._findFirstFocusEnabledWidgetIndex();var c=0,d=this.getChildren(),e=d.length,f,g=cc.FLT_MAX,h=0;if(a===ccui.Widget.LEFT||a===ccui.Widget.RIGHT|| a===ccui.Widget.DOWN||a===ccui.Widget.UP){for(f=this._getWorldCenterPoint(b);c<e;){var k=d[c];k&&k instanceof ccui.Widget&&k.isFocusEnabled()&&(k=k instanceof ccui.Layout?k._calculateNearestDistance(b):cc.pLength(cc.pSub(this._getWorldCenterPoint(k),f)),k<g&&(h=c,g=k));c++}return h}cc.log("invalid focus direction!");return 0},_findFarthestChildWidgetIndex:function(a,b){if(null==b||b===this)return this._findFirstFocusEnabledWidgetIndex();var c=0,d=this.getChildren(),e=d.length,f=-cc.FLT_MAX,g=0;if(a=== ccui.Widget.LEFT||a===ccui.Widget.RIGHT||a===ccui.Widget.DOWN||a===ccui.Widget.UP){for(var h=this._getWorldCenterPoint(b);c<e;){var k=d[c];k&&k instanceof ccui.Widget&&k.isFocusEnabled()&&(k=k instanceof ccui.Layout?k._calculateFarthestDistance(b):cc.pLength(cc.pSub(this._getWorldCenterPoint(k),h)),k>f&&(g=c,f=k));c++}return g}cc.log("invalid focus direction!!!");return 0},_calculateNearestDistance:function(a){for(var b=cc.FLT_MAX,c=this._getWorldCenterPoint(a),d=this._children,e=0,f=d.length;e<f;e++){var g= d[e];if(g instanceof ccui.Layout)g=g._calculateNearestDistance(a);else if(g instanceof ccui.Widget&&g.isFocusEnabled())g=cc.pLength(cc.pSub(this._getWorldCenterPoint(g),c));else continue;g<b&&(b=g)}return b},_calculateFarthestDistance:function(a){for(var b=-cc.FLT_MAX,c=this._getWorldCenterPoint(a),d=this._children,e=0,f=d.length;e<f;e++){var g=d[e];if(g instanceof ccui.Layout)g=g._calculateFarthestDistance(a);else if(g instanceof ccui.Widget&&g.isFocusEnabled())g=this._getWorldCenterPoint(g),g=cc.pLength(cc.pSub(g, c));else continue;g>b&&(b=g)}return b},_findProperSearchingFunctor:function(a,b){if(void 0!==b){var c=this._getWorldCenterPoint(b),d=this._getWorldCenterPoint(this._findFirstNonLayoutWidget());a===ccui.Widget.LEFT?this.onPassFocusToChild=c.x>d.x?this._findNearestChildWidgetIndex:this._findFarthestChildWidgetIndex:a===ccui.Widget.RIGHT?this.onPassFocusToChild=c.x>d.x?this._findFarthestChildWidgetIndex:this._findNearestChildWidgetIndex:a===ccui.Widget.DOWN?this.onPassFocusToChild=c.y>d.y?this._findNearestChildWidgetIndex: this._findFarthestChildWidgetIndex:a===ccui.Widget.UP?this.onPassFocusToChild=c.y<d.y?this._findNearestChildWidgetIndex:this._findFarthestChildWidgetIndex:cc.log("invalid direction!")}},_findFirstNonLayoutWidget:function(){for(var a=this._children,b=0,c=a.length;b<c;b++){var d=a[b];if(d instanceof ccui.Layout){if(d=d._findFirstNonLayoutWidget())return d}else if(d instanceof ccui.Widget)return d}return null},_findFirstFocusEnabledWidgetIndex:function(){for(var a=0,b=this.getChildren(),c=b.length;a< c;){var d=b[a];if(d&&d instanceof ccui.Widget&&d.isFocusEnabled())return a;a++}return 0},_findFocusEnabledChildWidgetByIndex:function(a){var b=this._getChildWidgetByIndex(a);return b?b.isFocusEnabled()?b:this._findFocusEnabledChildWidgetByIndex(a+1):null},_getWorldCenterPoint:function(a){var b=a instanceof ccui.Layout?a._getLayoutAccumulatedSize():a.getContentSize();return a.convertToWorldSpace(cc.p(b.width/2,b.height/2))},_getNextFocusedWidget:function(a,b){var c=null,c=this._children,d=c.indexOf(b), d=d+1;if(d<c.length){if(c=this._getChildWidgetByIndex(d)){if(c.isFocusEnabled()){if(c instanceof ccui.Layout)return c._isFocusPassing=!0,c.findNextFocusedWidget(a,c);this.dispatchFocusEvent(b,c);return c}return this._getNextFocusedWidget(a,c)}return b}if(this._loopFocus){if(this._checkFocusEnabledChild()){c=this._getChildWidgetByIndex(0);if(c.isFocusEnabled()){if(c instanceof ccui.Layout)return c._isFocusPassing=!0,c.findNextFocusedWidget(a,c);this.dispatchFocusEvent(b,c);return c}return this._getNextFocusedWidget(a, c)}return b instanceof ccui.Layout?b:ccui.Widget._focusedWidget}return this._isLastWidgetInContainer(b,a)?this._isWidgetAncestorSupportLoopFocus(this,a)?ccui.Widget.prototype.findNextFocusedWidget.call(this,a,this):b instanceof ccui.Layout?b:ccui.Widget._focusedWidget:ccui.Widget.prototype.findNextFocusedWidget.call(this,a,this)},_getPreviousFocusedWidget:function(a,b){var c=null,c=this._children,d=c.indexOf(b),d=d-1;if(0<=d){c=this._getChildWidgetByIndex(d);if(c.isFocusEnabled()){if(c instanceof ccui.Layout)return c._isFocusPassing=!0,c.findNextFocusedWidget(a,c);this.dispatchFocusEvent(b,c);return c}return this._getPreviousFocusedWidget(a,c)}if(this._loopFocus){if(this._checkFocusEnabledChild()){d=c.length-1;c=this._getChildWidgetByIndex(d);if(c.isFocusEnabled()){if(c instanceof ccui.Layout)return c._isFocusPassing=!0,c.findNextFocusedWidget(a,c);this.dispatchFocusEvent(b,c);return c}return this._getPreviousFocusedWidget(a,c)}return b instanceof ccui.Layout?b:ccui.Widget._focusedWidget}return this._isLastWidgetInContainer(b, a)?this._isWidgetAncestorSupportLoopFocus(this,a)?ccui.Widget.prototype.findNextFocusedWidget.call(this,a,this):b instanceof ccui.Layout?b:ccui.Widget._focusedWidget:ccui.Widget.prototype.findNextFocusedWidget.call(this,a,this)},_getChildWidgetByIndex:function(a){for(var b=this._children,c=b.length,d=0,e=a;a<c;){var f=b[a];if(f&&f instanceof ccui.Widget)return f;d++;a++}for(a=0;a<e;){if((c=b[a])&&c instanceof ccui.Widget)return c;d++;a++}return null},_isLastWidgetInContainer:function(a,b){var c=a.getParent(); if(null==c||!(c instanceof ccui.Layout))return!0;var d=c.getChildren(),e=d.indexOf(a);if(c.getLayoutType()===ccui.Layout.LINEAR_HORIZONTAL){if(b===ccui.Widget.LEFT)return 0===e?this._isLastWidgetInContainer(c,b):!1;if(b===ccui.Widget.RIGHT)return e===d.length-1?this._isLastWidgetInContainer(c,b):!1;if(b===ccui.Widget.DOWN||b===ccui.Widget.UP)return this._isLastWidgetInContainer(c,b)}else if(c.getLayoutType()===ccui.Layout.LINEAR_VERTICAL){if(b===ccui.Widget.UP)return 0===e?this._isLastWidgetInContainer(c, b):!1;if(b===ccui.Widget.DOWN)return e===d.length-1?this._isLastWidgetInContainer(c,b):!1;if(b===ccui.Widget.LEFT||b===ccui.Widget.RIGHT)return this._isLastWidgetInContainer(c,b)}else return cc.log("invalid layout Type"),!1},_isWidgetAncestorSupportLoopFocus:function(a,b){var c=a.getParent();if(null==c||!(c instanceof ccui.Layout))return!1;if(c.isLoopFocus()){var d=c.getLayoutType();if(d===ccui.Layout.LINEAR_HORIZONTAL)return b===ccui.Widget.LEFT||b===ccui.Widget.RIGHT?!0:this._isWidgetAncestorSupportLoopFocus(c, b);if(d===ccui.Layout.LINEAR_VERTICAL)return b===ccui.Widget.DOWN||b===ccui.Widget.UP?!0:this._isWidgetAncestorSupportLoopFocus(c,b);cc.assert(0,"invalid layout type");return!1}return this._isWidgetAncestorSupportLoopFocus(c,b)},_passFocusToChild:function(a,b){if(this._checkFocusEnabledChild()){var c=ccui.Widget.getCurrentFocusedWidget();this._findProperSearchingFunctor(a,c);c=this.onPassFocusToChild(a,c);c=this._getChildWidgetByIndex(c);if(c instanceof ccui.Layout)return c._isFocusPassing=!0,c.findNextFocusedWidget(a, c);this.dispatchFocusEvent(b,c);return c}return this},_checkFocusEnabledChild:function(){for(var a=this._children,b=0,c=a.length;b<c;b++){var d=a[b];if(d&&d instanceof ccui.Widget&&d.isFocusEnabled())return!0}return!1},getDescription:function(){return"Layout"},_createCloneInstance:function(){return new ccui.Layout},_copyClonedWidgetChildren:function(a){ccui.Widget.prototype._copyClonedWidgetChildren.call(this,a)},_copySpecialProperties:function(a){a instanceof ccui.Layout&&(this.setBackGroundImageScale9Enabled(a._backGroundScale9Enabled), this.setBackGroundImage(a._backGroundImageFileName,a._bgImageTexType),this.setBackGroundImageCapInsets(a._backGroundImageCapInsets),this.setBackGroundColorType(a._colorType),this.setBackGroundColor(a._color),this.setBackGroundColor(a._startColor,a._endColor),this.setBackGroundColorOpacity(a._opacity),this.setBackGroundColorVector(a._alongVector),this.setLayoutType(a._layoutType),this.setClippingEnabled(a._clippingEnabled),this.setClippingType(a._clippingType),this._loopFocus=a._loopFocus,this.__passFocusToChild= a.__passFocusToChild,this._isInterceptTouch=a._isInterceptTouch)},forceDoLayout:function(){this.requestDoLayout();this._doLayout()},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new ccui.Layout.WebGLRenderCmd(this):new ccui.Layout.CanvasRenderCmd(this)}});_p=ccui.Layout.prototype;cc.defineGetterSetter(_p,"clippingEnabled",_p.isClippingEnabled,_p.setClippingEnabled);cc.defineGetterSetter(_p,"clippingType",null,_p.setClippingType); cc.defineGetterSetter(_p,"layoutType",_p.getLayoutType,_p.setLayoutType);_p=null;ccui.Layout.create=function(){return new ccui.Layout};ccui.Layout.BG_COLOR_NONE=0;ccui.Layout.BG_COLOR_SOLID=1;ccui.Layout.BG_COLOR_GRADIENT=2;ccui.Layout.ABSOLUTE=0;ccui.Layout.LINEAR_VERTICAL=1;ccui.Layout.LINEAR_HORIZONTAL=2;ccui.Layout.RELATIVE=3;ccui.Layout.CLIPPING_STENCIL=0;ccui.Layout.CLIPPING_SCISSOR=1;ccui.Layout.BACKGROUND_IMAGE_ZORDER=-1;ccui.Layout.BACKGROUND_RENDERER_ZORDER=-2;(function(){ccui.Layout.CanvasRenderCmd=function(a){this._pNodeCmdCtor(a);this._needDraw=!1;this._rendererRestoreCmd=this._rendererClipCmd=this._rendererSaveCmd=null};var a=ccui.Layout.CanvasRenderCmd.prototype=Object.create(ccui.ProtectedNode.CanvasRenderCmd.prototype);a.constructor=ccui.Layout.CanvasRenderCmd;a._layoutCmdCtor=ccui.Layout.CanvasRenderCmd;a._onRenderSaveCmd=function(a,c,d){var e=a||cc._renderContext;a=e.getContext();e.save();e.save();e.setTransform(this._worldTransform,c,d);c=this._node._clippingStencil._renderCmd._buffer; d=0;for(e=c.length;d<e;d++){var f=c[d].verts,g=f[0];a.beginPath();a.moveTo(g.x,-g.y);for(var g=1,h=f.length;g<h;g++)a.lineTo(f[g].x,-f[g].y);a.closePath()}};a._onRenderClipCmd=function(a){a=a||cc._renderContext;var c=a.getContext();a.restore();c.clip()};a._onRenderRestoreCmd=function(a){a=a||cc._renderContext;a.getContext();a.restore()};a.rebindStencilRendering=function(a){a._renderCmd.rendering=this.__stencilDraw;a._renderCmd._canUseDirtyRegion=!0};a.__stencilDraw=function(a,c,d){};a.stencilClippingVisit= a.scissorClippingVisit=function(a){a=this._node;a._clippingStencil&&a._clippingStencil.isVisible()&&(this._rendererSaveCmd||(this._rendererSaveCmd=new cc.CustomRenderCmd(this,this._onRenderSaveCmd),this._rendererClipCmd=new cc.CustomRenderCmd(this,this._onRenderClipCmd),this._rendererRestoreCmd=new cc.CustomRenderCmd(this,this._onRenderRestoreCmd)),cc.renderer.pushRenderCommand(this._rendererSaveCmd),a._clippingStencil.visit(this),cc.renderer.pushRenderCommand(this._rendererClipCmd))};a.postStencilVisit= a.postScissorVisit=function(){cc.renderer.pushRenderCommand(this._rendererRestoreCmd)};ccui.Layout.CanvasRenderCmd._getSharedCache=function(){return cc.ClippingNode._sharedCache||(cc.ClippingNode._sharedCache=document.createElement("canvas"))}})();(function(){if(ccui.ProtectedNode.WebGLRenderCmd){ccui.Layout.WebGLRenderCmd=function(a){this._pNodeCmdCtor(a);this._needDraw=!1;this._currentStencilEnabled=0;this._scissorOldState=!1;this._clippingOldRect=null;this._mask_layer_le=0;this._afterVisitCmdScissor=this._beforeVisitCmdScissor=this._afterVisitCmdStencil=this._afterDrawStencilCmd=this._beforeVisitCmdStencil=null};var a=ccui.Layout.WebGLRenderCmd.prototype=Object.create(ccui.ProtectedNode.WebGLRenderCmd.prototype);a.constructor=ccui.Layout.WebGLRenderCmd; a._layoutCmdCtor=ccui.Layout.CanvasRenderCmd;a._syncStatus=function(a){this._originSyncStatus(a);a&&a._dirtyFlag&cc.Node._dirtyFlags.transformDirty&&(this._node._clippingRectDirty=!0)};a._onBeforeVisitStencil=function(a){a=a||cc._renderContext;ccui.Layout.WebGLRenderCmd._layer++;var c=1<<ccui.Layout.WebGLRenderCmd._layer;this._mask_layer_le=c|c-1;this._currentStencilEnabled=a.isEnabled(a.STENCIL_TEST);a.clear(a.DEPTH_BUFFER_BIT);a.enable(a.STENCIL_TEST);a.depthMask(!1);a.stencilFunc(a.NEVER,c,c); a.stencilOp(a.REPLACE,a.KEEP,a.KEEP);a.stencilMask(c);a.clear(a.STENCIL_BUFFER_BIT)};a._onAfterDrawStencil=function(a){a=a||cc._renderContext;a.depthMask(!0);a.stencilFunc(a.EQUAL,this._mask_layer_le,this._mask_layer_le);a.stencilOp(a.KEEP,a.KEEP,a.KEEP)};a._onAfterVisitStencil=function(a){a=a||cc._renderContext;ccui.Layout.WebGLRenderCmd._layer--;if(this._currentStencilEnabled){var c=1<<ccui.Layout.WebGLRenderCmd._layer,d=c|c-1;a.stencilMask(c);a.stencilFunc(a.EQUAL,d,d)}else a.disable(a.STENCIL_TEST)}; a._onBeforeVisitScissor=function(a){this._node._clippingRectDirty=!0;var c=this._node._getClippingRect();a=a||cc._renderContext;(this._scissorOldState=a.isEnabled(a.SCISSOR_TEST))?(this._clippingOldRect=cc.view.getScissorRect(),cc.rectEqualToRect(this._clippingOldRect,c)||cc.view.setScissorInPoints(c.x,c.y,c.width,c.height)):(a.enable(a.SCISSOR_TEST),cc.view.setScissorInPoints(c.x,c.y,c.width,c.height))};a._onAfterVisitScissor=function(a){a=a||cc._renderContext;this._scissorOldState?cc.rectEqualToRect(this._clippingOldRect, this._node._clippingRect)||cc.view.setScissorInPoints(this._clippingOldRect.x,this._clippingOldRect.y,this._clippingOldRect.width,this._clippingOldRect.height):a.disable(a.SCISSOR_TEST)};a.rebindStencilRendering=function(a){};a.transform=function(a,c){var d=this._node;this.pNodeTransform(a,c);d._clippingStencil&&d._clippingStencil._renderCmd.transform(this,c)};a.stencilClippingVisit=function(a){a=this._node;if(a._clippingStencil&&a._clippingStencil.isVisible())if(ccui.Layout.WebGLRenderCmd._layer+ 1===cc.stencilBits)ccui.Layout.WebGLRenderCmd._visit_once=!0,ccui.Layout.WebGLRenderCmd._visit_once&&(cc.log("Nesting more than "+cc.stencilBits+"stencils is not supported. Everything will be drawn without stencil for this node and its childs."),ccui.Layout.WebGLRenderCmd._visit_once=!1);else{this._beforeVisitCmdStencil||(this._beforeVisitCmdStencil=new cc.CustomRenderCmd(this,this._onBeforeVisitStencil),this._afterDrawStencilCmd=new cc.CustomRenderCmd(this,this._onAfterDrawStencil),this._afterVisitCmdStencil= new cc.CustomRenderCmd(this,this._onAfterVisitStencil));cc.renderer.pushRenderCommand(this._beforeVisitCmdStencil);var c=cc.current_stack;c.stack.push(c.top);c.top=this._stackMatrix;a._clippingStencil.visit(this);cc.renderer.pushRenderCommand(this._afterDrawStencilCmd)}};a.postStencilVisit=function(){renderer.pushRenderCommand(cmd._afterVisitCmdStencil);cc.current_stack.top=cc.current_stack.stack.pop()};a.scissorClippingVisit=function(a){this._beforeVisitCmdScissor||(this._beforeVisitCmdScissor=new cc.CustomRenderCmd(this, this._onBeforeVisitScissor),this._afterVisitCmdScissor=new cc.CustomRenderCmd(this,this._onAfterVisitScissor));cc.renderer.pushRenderCommand(this._beforeVisitCmdScissor)};a.postScissorVisit=function(){cc.renderer.pushRenderCommand(this._afterVisitCmdScissor)};ccui.Layout.WebGLRenderCmd._layer=-1;ccui.Layout.WebGLRenderCmd._visit_once=null}})();ccui.Margin=ccui.Class.extend({left:0,top:0,right:0,bottom:0,ctor:function(a,b,c,d){void 0!==a&&void 0===b&&(this.left=a.left,this.top=a.top,this.right=a.right,this.bottom=a.bottom);void 0!==d&&(this.left=a,this.top=b,this.right=c,this.bottom=d)},setMargin:function(a,b,c,d){this.left=a;this.top=b;this.right=c;this.bottom=d},equals:function(a){return this.left===a.left&&this.top===a.top&&this.right===a.right&&this.bottom===a.bottom}});ccui.MarginZero=function(){return new ccui.Margin(0,0,0,0)}; ccui.LayoutParameter=ccui.Class.extend({_margin:null,_layoutParameterType:null,ctor:function(){this._margin=new ccui.Margin;this._layoutParameterType=ccui.LayoutParameter.NONE},setMargin:function(a,b,c,d){cc.isObject(a)?(this._margin.left=a.left,this._margin.top=a.top,this._margin.right=a.right,this._margin.bottom=a.bottom):(this._margin.left=a,this._margin.top=b,this._margin.right=c,this._margin.bottom=d)},getMargin:function(){return this._margin},getLayoutType:function(){return this._layoutParameterType}, clone:function(){var a=this._createCloneInstance();a._copyProperties(this);return a},_createCloneInstance:function(){return new ccui.LayoutParameter},_copyProperties:function(a){this._margin.bottom=a._margin.bottom;this._margin.left=a._margin.left;this._margin.right=a._margin.right;this._margin.top=a._margin.top}});ccui.LayoutParameter.create=function(){return new ccui.LayoutParameter};ccui.LayoutParameter.NONE=0;ccui.LayoutParameter.LINEAR=1;ccui.LayoutParameter.RELATIVE=2; ccui.LinearLayoutParameter=ccui.LayoutParameter.extend({_linearGravity:null,ctor:function(){ccui.LayoutParameter.prototype.ctor.call(this);this._linearGravity=ccui.LinearLayoutParameter.NONE;this._layoutParameterType=ccui.LayoutParameter.LINEAR},setGravity:function(a){this._linearGravity=a},getGravity:function(){return this._linearGravity},_createCloneInstance:function(){return new ccui.LinearLayoutParameter},_copyProperties:function(a){ccui.LayoutParameter.prototype._copyProperties.call(this,a); a instanceof ccui.LinearLayoutParameter&&this.setGravity(a._linearGravity)}});ccui.LinearLayoutParameter.create=function(){return new ccui.LinearLayoutParameter};ccui.LinearLayoutParameter.NONE=0;ccui.LinearLayoutParameter.LEFT=1;ccui.LinearLayoutParameter.TOP=2;ccui.LinearLayoutParameter.RIGHT=3;ccui.LinearLayoutParameter.BOTTOM=4;ccui.LinearLayoutParameter.CENTER_VERTICAL=5;ccui.LinearLayoutParameter.CENTER_HORIZONTAL=6; ccui.RelativeLayoutParameter=ccui.LayoutParameter.extend({_relativeAlign:null,_relativeWidgetName:"",_relativeLayoutName:"",_put:!1,ctor:function(){ccui.LayoutParameter.prototype.ctor.call(this);this._relativeAlign=ccui.RelativeLayoutParameter.NONE;this._relativeLayoutName=this._relativeWidgetName="";this._put=!1;this._layoutParameterType=ccui.LayoutParameter.RELATIVE},setAlign:function(a){this._relativeAlign=a},getAlign:function(){return this._relativeAlign},setRelativeToWidgetName:function(a){this._relativeWidgetName= a},getRelativeToWidgetName:function(){return this._relativeWidgetName},setRelativeName:function(a){this._relativeLayoutName=a},getRelativeName:function(){return this._relativeLayoutName},_createCloneInstance:function(){return new ccui.RelativeLayoutParameter},_copyProperties:function(a){ccui.LayoutParameter.prototype._copyProperties.call(this,a);a instanceof ccui.RelativeLayoutParameter&&(this.setAlign(a._relativeAlign),this.setRelativeToWidgetName(a._relativeWidgetName),this.setRelativeName(a._relativeLayoutName))}}); ccui.RelativeLayoutParameter.create=function(){return new ccui.RelativeLayoutParameter};ccui.RelativeLayoutParameter.NONE=0;ccui.RelativeLayoutParameter.PARENT_TOP_LEFT=1;ccui.RelativeLayoutParameter.PARENT_TOP_CENTER_HORIZONTAL=2;ccui.RelativeLayoutParameter.PARENT_TOP_RIGHT=3;ccui.RelativeLayoutParameter.PARENT_LEFT_CENTER_VERTICAL=4;ccui.RelativeLayoutParameter.CENTER_IN_PARENT=5;ccui.RelativeLayoutParameter.PARENT_RIGHT_CENTER_VERTICAL=6;ccui.RelativeLayoutParameter.PARENT_LEFT_BOTTOM=7; ccui.RelativeLayoutParameter.PARENT_BOTTOM_CENTER_HORIZONTAL=8;ccui.RelativeLayoutParameter.PARENT_RIGHT_BOTTOM=9;ccui.RelativeLayoutParameter.LOCATION_ABOVE_LEFTALIGN=10;ccui.RelativeLayoutParameter.LOCATION_ABOVE_CENTER=11;ccui.RelativeLayoutParameter.LOCATION_ABOVE_RIGHTALIGN=12;ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_TOPALIGN=13;ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_CENTER=14;ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_BOTTOMALIGN=15; ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_TOPALIGN=16;ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_CENTER=17;ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_BOTTOMALIGN=18;ccui.RelativeLayoutParameter.LOCATION_BELOW_LEFTALIGN=19;ccui.RelativeLayoutParameter.LOCATION_BELOW_CENTER=20;ccui.RelativeLayoutParameter.LOCATION_BELOW_RIGHTALIGN=21;ccui.LINEAR_GRAVITY_NONE=0;ccui.LINEAR_GRAVITY_LEFT=1;ccui.LINEAR_GRAVITY_TOP=2;ccui.LINEAR_GRAVITY_RIGHT=3;ccui.LINEAR_GRAVITY_BOTTOM=4; ccui.LINEAR_GRAVITY_CENTER_VERTICAL=5;ccui.LINEAR_GRAVITY_CENTER_HORIZONTAL=6;ccui.RELATIVE_ALIGN_NONE=0;ccui.RELATIVE_ALIGN_PARENT_TOP_LEFT=1;ccui.RELATIVE_ALIGN_PARENT_TOP_CENTER_HORIZONTAL=2;ccui.RELATIVE_ALIGN_PARENT_TOP_RIGHT=3;ccui.RELATIVE_ALIGN_PARENT_LEFT_CENTER_VERTICAL=4;ccui.RELATIVE_ALIGN_PARENT_CENTER=5;ccui.RELATIVE_ALIGN_PARENT_RIGHT_CENTER_VERTICAL=6;ccui.RELATIVE_ALIGN_PARENT_LEFT_BOTTOM=7;ccui.RELATIVE_ALIGN_PARENT_BOTTOM_CENTER_HORIZONTAL=8; ccui.RELATIVE_ALIGN_PARENT_RIGHT_BOTTOM=9;ccui.RELATIVE_ALIGN_LOCATION_ABOVE_LEFT=10;ccui.RELATIVE_ALIGN_LOCATION_ABOVE_CENTER=11;ccui.RELATIVE_ALIGN_LOCATION_ABOVE_RIGHT=12;ccui.RELATIVE_ALIGN_LOCATION_LEFT_TOP=13;ccui.RELATIVE_ALIGN_LOCATION_LEFT_CENTER=14;ccui.RELATIVE_ALIGN_LOCATION_LEFT_BOTTOM=15;ccui.RELATIVE_ALIGN_LOCATION_RIGHT_TOP=16;ccui.RELATIVE_ALIGN_LOCATION_RIGHT_CENTER=17;ccui.RELATIVE_ALIGN_LOCATION_RIGHT_BOTTOM=18;ccui.RELATIVE_ALIGN_LOCATION_BELOW_TOP=19; ccui.RELATIVE_ALIGN_LOCATION_BELOW_CENTER=20;ccui.RELATIVE_ALIGN_LOCATION_BELOW_BOTTOM=21;ccui.getLayoutManager=function(a){switch(a){case ccui.Layout.LINEAR_VERTICAL:return ccui.linearVerticalLayoutManager;case ccui.Layout.LINEAR_HORIZONTAL:return ccui.linearHorizontalLayoutManager;case ccui.Layout.RELATIVE:return ccui.relativeLayoutManager}return null}; ccui.linearVerticalLayoutManager={_doLayout:function(a){var b=a._getLayoutContentSize();a=a._getLayoutElements();for(var c=b.height,d=0,e=a.length;d<e;d++){var f=a[d];if(f){var g=f.getLayoutParameter();if(g){var h=g.getGravity(),k=f.getAnchorPoint(),m=f.getContentSize(),n=k.x*m.width,c=c-(1-k.y)*m.height;switch(h){case ccui.LinearLayoutParameter.RIGHT:n=b.width-(1-k.x)*m.width;break;case ccui.LinearLayoutParameter.CENTER_HORIZONTAL:n=b.width/2-m.width*(0.5-k.x)}g=g.getMargin();n+=g.left;c-=g.top; f.setPosition(n,c);c=f.getPositionY()-k.y*m.height-g.bottom}}}}}; ccui.linearHorizontalLayoutManager={_doLayout:function(a){var b=a._getLayoutContentSize();a=a._getLayoutElements();for(var c=0,d=0,e=a.length;d<e;d++){var f=a[d];if(f){var g=f.getLayoutParameter();if(g){var h=g.getGravity(),k=f.getAnchorPoint(),m=f.getContentSize(),c=c+k.x*m.width,n=b.height-(1-k.y)*m.height;switch(h){case ccui.LinearLayoutParameter.BOTTOM:n=k.y*m.height;break;case ccui.LinearLayoutParameter.CENTER_VERTICAL:n=b.height/2-m.height*(0.5-k.y)}g=g.getMargin();c+=g.left;n-=g.top;f.setPosition(c, n);c=f.getRightBoundary()+g.right}}}}}; ccui.relativeLayoutManager={_unlayoutChildCount:0,_widgetChildren:[],_widget:null,_finalPositionX:0,_finalPositionY:0,_relativeWidgetLP:null,_doLayout:function(a){for(var b=this._widgetChildren=this._getAllWidgets(a);0<this._unlayoutChildCount;){for(var c=0,d=b.length;c<d;c++){this._widget=b[c];var e=this._widget.getLayoutParameter();e&&!e._put&&this._calculateFinalPositionWithRelativeWidget(a)&&(this._calculateFinalPositionWithRelativeAlign(),this._widget.setPosition(this._finalPositionX,this._finalPositionY), e._put=!0)}this._unlayoutChildCount--}this._widgetChildren.length=0},_getAllWidgets:function(a){a=a._getLayoutElements();for(var b=this._widgetChildren,c=b.length=0,d=a.length;c<d;c++){var e=a[c];e&&e instanceof ccui.Widget&&(e.getLayoutParameter()._put=!1,this._unlayoutChildCount++,b.push(e))}return b},_getRelativeWidget:function(a){var b=null;if((a=a.getLayoutParameter().getRelativeToWidgetName())&&0!==a.length)for(var c=this._widgetChildren,d=0,e=c.length;d<e;d++){var f=c[d];if(f){var g=f.getLayoutParameter(); if(g&&g.getRelativeName()===a){b=f;this._relativeWidgetLP=g;break}}}return b},_calculateFinalPositionWithRelativeWidget:function(a){var b=this._widget,c=b.getAnchorPoint(),d=b.getContentSize();this._finalPositionY=this._finalPositionX=0;var e=this._getRelativeWidget(b),b=b.getLayoutParameter().getAlign();a=a._getLayoutContentSize();switch(b){case ccui.RelativeLayoutParameter.NONE:case ccui.RelativeLayoutParameter.PARENT_TOP_LEFT:this._finalPositionX=c.x*d.width;this._finalPositionY=a.height-(1-c.y)* d.height;break;case ccui.RelativeLayoutParameter.PARENT_TOP_CENTER_HORIZONTAL:this._finalPositionX=0.5*a.width-d.width*(0.5-c.x);this._finalPositionY=a.height-(1-c.y)*d.height;break;case ccui.RelativeLayoutParameter.PARENT_TOP_RIGHT:this._finalPositionX=a.width-(1-c.x)*d.width;this._finalPositionY=a.height-(1-c.y)*d.height;break;case ccui.RelativeLayoutParameter.PARENT_LEFT_CENTER_VERTICAL:this._finalPositionX=c.x*d.width;this._finalPositionY=0.5*a.height-d.height*(0.5-c.y);break;case ccui.RelativeLayoutParameter.CENTER_IN_PARENT:this._finalPositionX= 0.5*a.width-d.width*(0.5-c.x);this._finalPositionY=0.5*a.height-d.height*(0.5-c.y);break;case ccui.RelativeLayoutParameter.PARENT_RIGHT_CENTER_VERTICAL:this._finalPositionX=a.width-(1-c.x)*d.width;this._finalPositionY=0.5*a.height-d.height*(0.5-c.y);break;case ccui.RelativeLayoutParameter.PARENT_LEFT_BOTTOM:this._finalPositionX=c.x*d.width;this._finalPositionY=c.y*d.height;break;case ccui.RelativeLayoutParameter.PARENT_BOTTOM_CENTER_HORIZONTAL:this._finalPositionX=0.5*a.width-d.width*(0.5-c.x);this._finalPositionY= c.y*d.height;break;case ccui.RelativeLayoutParameter.PARENT_RIGHT_BOTTOM:this._finalPositionX=a.width-(1-c.x)*d.width;this._finalPositionY=c.y*d.height;break;case ccui.RelativeLayoutParameter.LOCATION_ABOVE_LEFTALIGN:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1;this._finalPositionY=e.getTopBoundary()+c.y*d.height;this._finalPositionX=e.getLeftBoundary()+c.x*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_ABOVE_CENTER:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1; a=e.getContentSize();this._finalPositionY=e.getTopBoundary()+c.y*d.height;this._finalPositionX=e.getLeftBoundary()+0.5*a.width+c.x*d.width-0.5*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_ABOVE_RIGHTALIGN:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1;this._finalPositionY=e.getTopBoundary()+c.y*d.height;this._finalPositionX=e.getRightBoundary()-(1-c.x)*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_TOPALIGN:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1; this._finalPositionY=e.getTopBoundary()-(1-c.y)*d.height;this._finalPositionX=e.getLeftBoundary()-(1-c.x)*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_CENTER:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1;a=e.getContentSize();this._finalPositionX=e.getLeftBoundary()-(1-c.x)*d.width;this._finalPositionY=e.getBottomBoundary()+0.5*a.height+c.y*d.height-0.5*d.height}break;case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_BOTTOMALIGN:if(e){if(this._relativeWidgetLP&& !this._relativeWidgetLP._put)return!1;this._finalPositionY=e.getBottomBoundary()+c.y*d.height;this._finalPositionX=e.getLeftBoundary()-(1-c.x)*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_TOPALIGN:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1;this._finalPositionY=e.getTopBoundary()-(1-c.y)*d.height;this._finalPositionX=e.getRightBoundary()+c.x*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_CENTER:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1; a=e.getContentSize();this._finalPositionX=e.getRightBoundary()+c.x*d.width;this._finalPositionY=e.getBottomBoundary()+0.5*a.height+c.y*d.height-0.5*d.height}break;case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_BOTTOMALIGN:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1;this._finalPositionY=e.getBottomBoundary()+c.y*d.height;this._finalPositionX=e.getRightBoundary()+c.x*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_BELOW_LEFTALIGN:if(e){if(this._relativeWidgetLP&& !this._relativeWidgetLP._put)return!1;this._finalPositionY=e.getBottomBoundary()-(1-c.y)*d.height;this._finalPositionX=e.getLeftBoundary()+c.x*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_BELOW_CENTER:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1;a=e.getContentSize();this._finalPositionY=e.getBottomBoundary()-(1-c.y)*d.height;this._finalPositionX=e.getLeftBoundary()+0.5*a.width+c.x*d.width-0.5*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_BELOW_RIGHTALIGN:if(e){if(this._relativeWidgetLP&& !this._relativeWidgetLP._put)return!1;this._finalPositionY=e.getBottomBoundary()-(1-c.y)*d.height;this._finalPositionX=e.getRightBoundary()-(1-c.x)*d.width}}return!0},_calculateFinalPositionWithRelativeAlign:function(){var a=this._widget.getLayoutParameter(),b=a.getMargin();switch(a.getAlign()){case ccui.RelativeLayoutParameter.NONE:case ccui.RelativeLayoutParameter.PARENT_TOP_LEFT:this._finalPositionX+=b.left;this._finalPositionY-=b.top;break;case ccui.RelativeLayoutParameter.PARENT_TOP_CENTER_HORIZONTAL:this._finalPositionY-= b.top;break;case ccui.RelativeLayoutParameter.PARENT_TOP_RIGHT:this._finalPositionX-=b.right;this._finalPositionY-=b.top;break;case ccui.RelativeLayoutParameter.PARENT_LEFT_CENTER_VERTICAL:this._finalPositionX+=b.left;break;case ccui.RelativeLayoutParameter.PARENT_RIGHT_CENTER_VERTICAL:this._finalPositionX-=b.right;break;case ccui.RelativeLayoutParameter.PARENT_LEFT_BOTTOM:this._finalPositionX+=b.left;this._finalPositionY+=b.bottom;break;case ccui.RelativeLayoutParameter.PARENT_BOTTOM_CENTER_HORIZONTAL:this._finalPositionY+= b.bottom;break;case ccui.RelativeLayoutParameter.PARENT_RIGHT_BOTTOM:this._finalPositionX-=b.right;this._finalPositionY+=b.bottom;break;case ccui.RelativeLayoutParameter.LOCATION_ABOVE_LEFTALIGN:this._finalPositionY+=b.bottom;this._finalPositionX+=b.left;break;case ccui.RelativeLayoutParameter.LOCATION_ABOVE_RIGHTALIGN:this._finalPositionY+=b.bottom;this._finalPositionX-=b.right;break;case ccui.RelativeLayoutParameter.LOCATION_ABOVE_CENTER:this._finalPositionY+=b.bottom;break;case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_TOPALIGN:this._finalPositionX-= b.right;this._finalPositionY-=b.top;break;case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_BOTTOMALIGN:this._finalPositionX-=b.right;this._finalPositionY+=b.bottom;break;case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_CENTER:this._finalPositionX-=b.right;break;case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_TOPALIGN:this._finalPositionX+=b.left;this._finalPositionY-=b.top;break;case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_BOTTOMALIGN:this._finalPositionX+=b.left;this._finalPositionY+= b.bottom;break;case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_CENTER:this._finalPositionX+=b.left;break;case ccui.RelativeLayoutParameter.LOCATION_BELOW_LEFTALIGN:this._finalPositionY-=b.top;this._finalPositionX+=b.left;break;case ccui.RelativeLayoutParameter.LOCATION_BELOW_RIGHTALIGN:this._finalPositionY-=b.top;this._finalPositionX-=b.right;break;case ccui.RelativeLayoutParameter.LOCATION_BELOW_CENTER:this._finalPositionY-=b.top}}};ccui.HBox=ccui.Layout.extend({ctor:function(a){ccui.Layout.prototype.ctor.call(this);this.setLayoutType(ccui.Layout.LINEAR_HORIZONTAL);a&&this.setContentSize(a)}});ccui.HBox.create=function(a){return new ccui.HBox(a)};ccui.RelativeBox=ccui.Layout.extend({ctor:function(a){ccui.Layout.prototype.ctor.call(this);this.setLayoutType(ccui.Layout.RELATIVE);a&&this.setContentSize(a)}});ccui.RelativeBox.create=function(a){return new ccui.RelativeBox(a)};ccui.VBox=ccui.Layout.extend({ctor:function(a){ccui.Layout.prototype.ctor.call(this);this.setLayoutType(ccui.Layout.LINEAR_VERTICAL);a&&this.setContentSize(a)},initWithSize:function(a){return this.init()?!0:!1}});ccui.VBox.create=function(a){return new ccui.VBox(a)};ccui.helper={seekWidgetByTag:function(a,b){if(!a)return null;if(a.getTag()===b)return a;for(var c=a.getChildren(),d=c.length,e=0;e<d;e++){var f=ccui.helper.seekWidgetByTag(c[e],b);if(null!==f)return f}return null},seekWidgetByName:function(a,b){if(!a)return null;if(a.getName()===b)return a;for(var c=a.getChildren(),d=c.length,e=0;e<d;e++){var f=ccui.helper.seekWidgetByName(c[e],b);if(null!==f)return f}return null},seekWidgetByRelativeName:function(a,b){if(!a)return null;for(var c=a.getChildren(), d=c.length,e=0;e<d;e++){var f=c[e],g=f.getLayoutParameter(ccui.LayoutParameter.RELATIVE);if(g&&g.getRelativeName()===b)return f}return null},seekActionWidgetByActionTag:function(a,b){if(!a)return null;if(a.getActionTag()===b)return a;for(var c=a.getChildren(),d=0;d<c.length;d++){var e=ccui.helper.seekActionWidgetByActionTag(c[d],b);if(null!==e)return e}return null},_activeLayout:!0,doLayout:function(a){if(this._activeLayout){a=a.getChildren();for(var b,c=0,d=a.length;c<d;c++){b=a[c];var e=b.getComponent(ccui.LayoutComponent.NAME); b=b.getParent();null!=e&&null!==b&&e.refreshLayout&&e.refreshLayout()}}},changeLayoutSystemActiveState:function(a){this._activeLayout=a},restrictCapInsetRect:function(a,b){var c=a.x,d=a.y,e=a.width,f=a.height;b.width<e&&(e=c=0);b.height<f&&(f=d=0);return cc.rect(c,d,e,f)},_createSpriteFromBase64:function(a,b){var c=cc.textureCache.getTextureForKey(b);c||(c=new Image,c.src=a,cc.textureCache.cacheImage(b,c),c=cc.textureCache.getTextureForKey(b));return new cc.Sprite(c)}};ccui.Button=ccui.Widget.extend({_buttonScale9Renderer:null,_buttonNormalSpriteFrame:null,_buttonClickedSpriteFrame:null,_buttonDisableSpriteFrame:null,_titleRenderer:null,_normalFileName:"",_clickedFileName:"",_disabledFileName:"",_prevIgnoreSize:!0,_scale9Enabled:!1,_capInsetsNormal:null,_normalTexType:ccui.Widget.LOCAL_TEXTURE,_pressedTexType:ccui.Widget.LOCAL_TEXTURE,_disabledTexType:ccui.Widget.LOCAL_TEXTURE,_normalTextureSize:null,pressedActionEnabled:!1,_titleColor:null,_zoomScale:0.1,_normalTextureLoaded:!1, _pressedTextureLoaded:!1,_disabledTextureLoaded:!1,_className:"Button",_normalTextureAdaptDirty:!0,_fontName:"Thonburi",_fontSize:12,_type:0,ctor:function(a,b,c,d){this._capInsetsNormal=cc.rect(0,0,0,0);this._normalTextureSize=cc.size(0,0);ccui.Widget.prototype.ctor.call(this);this.setTouchEnabled(!0);this._normalLoader=new cc.Sprite.LoadManager;this._clickedLoader=new cc.Sprite.LoadManager;this._disabledLoader=new cc.Sprite.LoadManager;a&&this.loadTextures(a,b,c,d)},_createTitleRendererIfNeeded:function(){this._titleRenderer|| (this._titleRenderer=new cc.LabelTTF(""),this._titleRenderer.setAnchorPoint(0.5,0.5),this._titleColor=cc.color.WHITE,this._titleRenderer.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER),this.addProtectedChild(this._titleRenderer,ccui.Button.TITLE_RENDERER_ZORDER,-1))},_initRenderer:function(){this._buttonScale9Renderer=new ccui.Scale9Sprite;this._buttonScale9Renderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SIMPLE);this.addProtectedChild(this._buttonScale9Renderer,ccui.Button.DISABLED_RENDERER_ZORDER, -1)},setScale9Enabled:function(a){this._scale9Enabled!==a&&(this._brightStyle=ccui.Widget.BRIGHT_STYLE_NONE,(this._scale9Enabled=a)?this._buttonScale9Renderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SLICED):this._buttonScale9Renderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SIMPLE),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1),this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsets(this._capInsetsNormal),this.setBright(this._bright), this._normalTextureAdaptDirty=!0)},isScale9Enabled:function(){return this._scale9Enabled},ignoreContentAdaptWithSize:function(a){if(this._unifySize)this._updateContentSize();else if(!this._scale9Enabled||this._scale9Enabled&&!a)ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,a),this._prevIgnoreSize=a},getVirtualRendererSize:function(){return this._unifySize?this._getNormalSize():!this._normalTextureLoaded&&this._titleRenderer&&0<this._titleRenderer.getString().length?this._titleRenderer.getContentSize(): cc.size(this._normalTextureSize)},loadTextures:function(a,b,c,d){this.loadTextureNormal(a,d);this.loadTexturePressed(b,d);this.loadTextureDisabled(c,d)},_createSpriteFrameWithFile:function(a){var b=cc.textureCache.getTextureForKey(a);b||(b=cc.textureCache.addImage(a));if(!b._textureLoaded)return b;a=b.getContentSize();a=cc.rect(0,0,a.width,a.height);return new cc.SpriteFrame(b,a)},_createSpriteFrameWithName:function(a){a=cc.spriteFrameCache.getSpriteFrame(a);return null==a?(cc.log("ccui.Scale9Sprite.initWithSpriteFrameName(): can't find the sprite frame by spriteFrameName"), null):a},loadTextureNormal:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._normalFileName=a;this._normalTexType=b;var c;switch(this._normalTexType){case ccui.Widget.LOCAL_TEXTURE:c=this._createSpriteFrameWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:"#"===a[0]&&(a=a.substr(1,a.length-1)),c=this._createSpriteFrameWithName(a)}c&&(c._textureLoaded?(this._normalTextureLoaded=c._textureLoaded,this._buttonNormalSpriteFrame=c,this._buttonScale9Renderer.setSpriteFrame(c),this._scale9Enabled&& this._buttonScale9Renderer.setCapInsets(this._capInsetsNormal),!this._ignoreSize&&cc.sizeEqualToSize(this._customSize,cc.size(0,0))&&(this._customSize=this._buttonScale9Renderer.getContentSize()),this._normalTextureSize=this._buttonScale9Renderer.getContentSize(),this._updateChildrenDisplayedRGBA(),this._unifySize?this._scale9Enabled&&(this._buttonScale9Renderer.setCapInsets(this._capInsetsNormal),this._updateContentSizeWithTextureSize(this._getNormalSize())):this._updateContentSizeWithTextureSize(this._normalTextureSize), this._normalTextureAdaptDirty=!0,this._findLayout()):(this._normalLoader.clear(),this._normalLoader.once(c,function(){this.loadTextureNormal(this._normalFileName,this._normalTexType)},this)))}},loadTexturePressed:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._clickedFileName=a;this._pressedTexType=b;var c;switch(this._pressedTexType){case ccui.Widget.LOCAL_TEXTURE:c=this._createSpriteFrameWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:"#"===a[0]&&(a=a.substr(1,a.length-1)),c=this._createSpriteFrameWithName(a)}c&& (c._textureLoaded?(this._buttonClickedSpriteFrame=c,this._updateChildrenDisplayedRGBA(),this._pressedTextureLoaded=!0):(this._clickedLoader.clear(),this._clickedLoader.once(c,function(){this.loadTexturePressed(this._clickedFileName,this._pressedTexType)},this)))}},loadTextureDisabled:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._disabledFileName=a;this._disabledTexType=b;var c;switch(this._disabledTexType){case ccui.Widget.LOCAL_TEXTURE:c=this._createSpriteFrameWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:"#"=== a[0]&&(a=a.substr(1,a.length-1)),c=this._createSpriteFrameWithName(a)}c&&(c._textureLoaded?(this._buttonDisableSpriteFrame=c,this._updateChildrenDisplayedRGBA(),this._disabledTextureLoaded=!0,this._findLayout()):(this._disabledLoader.clear(),this._disabledLoader.once(c,function(){this.loadTextureDisabled(this._disabledFileName,this._disabledTexType)},this)))}},setCapInsets:function(a){this.setCapInsetsNormalRenderer(a)},setCapInsetsNormalRenderer:function(a){if(a&&this._scale9Enabled){var b=a.x,c= a.y,d=a.width;a=a.height;this._normalTextureSize.width<d&&(d=b=0);this._normalTextureSize.height<a&&(a=c=0);var e=this._capInsetsNormal;e.x=b;e.y=c;e.width=d;e.height=a;this._capInsetsNormal=e;this._buttonScale9Renderer.setCapInsets(e)}},getCapInsetsNormalRenderer:function(){return cc.rect(this._capInsetsNormal)},setCapInsetsPressedRenderer:function(a){this.setCapInsetsNormalRenderer(a)},getCapInsetsPressedRenderer:function(){return cc.rect(this._capInsetsNormal)},setCapInsetsDisabledRenderer:function(a){this.setCapInsetsNormalRenderer(a)}, getCapInsetsDisabledRenderer:function(){return cc.rect(this._capInsetsNormal)},_onPressStateChangedToNormal:function(){this._buttonScale9Renderer.setSpriteFrame(this._buttonNormalSpriteFrame);this._buttonScale9Renderer.setState(ccui.Scale9Sprite.state.NORMAL);if(this._pressedTextureLoaded){if(this.pressedActionEnabled&&(this._buttonScale9Renderer.stopAllActions(),this._buttonScale9Renderer.setScale(1),this._titleRenderer))if(this._titleRenderer.stopAllActions(),this._unifySize){var a=cc.scaleTo(ccui.Button.ZOOM_ACTION_TIME_STEP, 1,1);this._titleRenderer.runAction(a)}else this._titleRenderer.setScaleX(1),this._titleRenderer.setScaleY(1)}else this._buttonScale9Renderer.stopAllActions(),this._buttonScale9Renderer.setScale(1),this._scale9Enabled&&this._buttonScale9Renderer.setColor(cc.color.WHITE),this._titleRenderer&&(this._titleRenderer.stopAllActions(),this._titleRenderer.setScaleX(1),this._titleRenderer.setScaleY(1))},_onPressStateChangedToPressed:function(){this._buttonScale9Renderer.setState(ccui.Scale9Sprite.state.NORMAL); if(this._pressedTextureLoaded){if(this._buttonScale9Renderer.setSpriteFrame(this._buttonClickedSpriteFrame),this.pressedActionEnabled){this._buttonScale9Renderer.stopAllActions();var a=cc.scaleTo(ccui.Button.ZOOM_ACTION_TIME_STEP,1+this._zoomScale,1+this._zoomScale);this._buttonScale9Renderer.runAction(a);this._titleRenderer&&(this._titleRenderer.stopAllActions(),this._titleRenderer.runAction(cc.scaleTo(ccui.Button.ZOOM_ACTION_TIME_STEP,1+this._zoomScale,1+this._zoomScale)))}}else this._buttonScale9Renderer.setSpriteFrame(this._buttonClickedSpriteFrame), this._buttonScale9Renderer.stopAllActions(),this._buttonScale9Renderer.setScale(1+this._zoomScale,1+this._zoomScale),this._titleRenderer&&(this._titleRenderer.stopAllActions(),this._titleRenderer.setScaleX(1+this._zoomScale),this._titleRenderer.setScaleY(1+this._zoomScale))},_onPressStateChangedToDisabled:function(){this._disabledTextureLoaded?this._buttonScale9Renderer.setSpriteFrame(this._buttonDisableSpriteFrame):this._normalTextureLoaded&&this._buttonScale9Renderer.setState(ccui.Scale9Sprite.state.GRAY); this._buttonScale9Renderer.setScale(1)},_updateContentSize:function(){if(this._unifySize){if(this._scale9Enabled)ccui.ProtectedNode.setContentSize(this._customSize);else{var a=this._getNormalSize();ccui.ProtectedNode.setContentSize(a)}this._onSizeChanged()}else this._ignoreSize&&this.setContentSize(this.getVirtualRendererSize())},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._titleRenderer&&this._updateTitleLocation();this._normalTextureAdaptDirty=!0},getVirtualRenderer:function(){return this._buttonScale9Renderer}, _normalTextureScaleChangedWithSize:function(){this._buttonScale9Renderer.setContentSize(this._contentSize);this._buttonScale9Renderer.setPosition(this._contentSize.width/2,this._contentSize.height/2)},_adaptRenderers:function(){this._normalTextureAdaptDirty&&(this._normalTextureScaleChangedWithSize(),this._normalTextureAdaptDirty=!1)},_updateTitleLocation:function(){this._titleRenderer.setPosition(0.5*this._contentSize.width,0.5*this._contentSize.height)},setPressedActionEnabled:function(a){this.pressedActionEnabled= a},setTitleText:function(a){a!==this.getTitleText()&&(this._createTitleRendererIfNeeded(),this._titleRenderer.setString(a),this._ignoreSize?(a=this.getVirtualRendererSize(),this.setContentSize(a)):this._titleRenderer._renderCmd._updateTTF())},getTitleText:function(){return this._titleRenderer?this._titleRenderer.getString():""},setTitleColor:function(a){this._createTitleRendererIfNeeded();this._titleRenderer.setFontFillColor(a)},getTitleColor:function(){return this._titleRenderer?this._titleRenderer._getFillStyle(): cc.color.WHITE},setTitleFontSize:function(a){this._createTitleRendererIfNeeded();this._titleRenderer.setFontSize(a);this._fontSize=a},getTitleFontSize:function(){return this._titleRenderer?this._titleRenderer.getFontSize():this._fontSize},setZoomScale:function(a){this._zoomScale=a},getZoomScale:function(){return this._zoomScale},getNormalTextureSize:function(){return this._normalTextureSize},setTitleFontName:function(a){this._createTitleRendererIfNeeded();this._titleRenderer.setFontName(a);this._fontName= a},getTitleRenderer:function(){return this._titleRenderer},getTitleFontName:function(){return this._titleRenderer?this._titleRenderer.getFontName():this._fontName},_setTitleFont:function(a){this._titleRenderer.font=a},_getTitleFont:function(){return this._titleRenderer.font},getDescription:function(){return"Button"},_createCloneInstance:function(){return new ccui.Button},_copySpecialProperties:function(a){this._prevIgnoreSize=a._prevIgnoreSize;this._capInsetsNormal=a._capInsetsNormal;this.setScale9Enabled(a._scale9Enabled); this.loadTextureNormal(a._normalFileName,a._normalTexType);this.loadTexturePressed(a._clickedFileName,a._pressedTexType);this.loadTextureDisabled(a._disabledFileName,a._disabledTexType);a._titleRenderer&&a._titleRenderer._string&&(this.setTitleText(a.getTitleText()),this.setTitleFontName(a.getTitleFontName()),this.setTitleFontSize(a.getTitleFontSize()),this.setTitleColor(a.getTitleColor()));this.setPressedActionEnabled(a.pressedActionEnabled);this.setZoomScale(a._zoomScale)},_getNormalSize:function(){var a; null!==this._titleRenderer&&(a=this._titleRenderer.getContentSize());var b=this._buttonScale9Renderer.getContentSize();return cc.size(a.width>b.width?a.width:b.width,a.height>b.height?a.height:b.height)}});_p=ccui.Button.prototype;cc.defineGetterSetter(_p,"titleText",_p.getTitleText,_p.setTitleText);cc.defineGetterSetter(_p,"titleFont",_p._getTitleFont,_p._setTitleFont);cc.defineGetterSetter(_p,"titleFontSize",_p.getTitleFontSize,_p.setTitleFontSize); cc.defineGetterSetter(_p,"titleFontName",_p.getTitleFontName,_p.setTitleFontName);cc.defineGetterSetter(_p,"titleColor",_p.getTitleColor,_p.setTitleColor);_p=null;ccui.Button.create=function(a,b,c,d){return new ccui.Button(a,b,c,d)};ccui.Button.NORMAL_RENDERER_ZORDER=-2;ccui.Button.PRESSED_RENDERER_ZORDER=-2;ccui.Button.DISABLED_RENDERER_ZORDER=-2;ccui.Button.TITLE_RENDERER_ZORDER=-1;ccui.Button.ZOOM_ACTION_TIME_STEP=0.05;ccui.Button.SYSTEM=0;ccui.Button.TTF=1;ccui.CheckBox=ccui.Widget.extend({_backGroundBoxRenderer:null,_backGroundSelectedBoxRenderer:null,_frontCrossRenderer:null,_backGroundBoxDisabledRenderer:null,_frontCrossDisabledRenderer:null,_isSelected:!0,_checkBoxEventListener:null,_checkBoxEventSelector:null,_backGroundTexType:ccui.Widget.LOCAL_TEXTURE,_backGroundSelectedTexType:ccui.Widget.LOCAL_TEXTURE,_frontCrossTexType:ccui.Widget.LOCAL_TEXTURE,_backGroundDisabledTexType:ccui.Widget.LOCAL_TEXTURE,_frontCrossDisabledTexType:ccui.Widget.LOCAL_TEXTURE, _backGroundFileName:"",_backGroundSelectedFileName:"",_frontCrossFileName:"",_backGroundDisabledFileName:"",_frontCrossDisabledFileName:"",_className:"CheckBox",_zoomScale:0.1,_backgroundTextureScaleX:0.1,_backgroundTextureScaleY:0.1,_backGroundBoxRendererAdaptDirty:!0,_backGroundSelectedBoxRendererAdaptDirty:!0,_frontCrossRendererAdaptDirty:!0,_backGroundBoxDisabledRendererAdaptDirty:!0,_frontCrossDisabledRendererAdaptDirty:!0,ctor:function(a,b,c,d,e,f){ccui.Widget.prototype.ctor.call(this);this.setTouchEnabled(!0); for(var g=0,h=0;h<arguments.length;h++){var k=typeof arguments[h];"string"===k?isNaN(arguments[h]-0)?g++:(f=arguments[h],arguments[h]=void 0):"number"===k&&g++}switch(g){case 2:f=c,c=b,b=void 0}f=void 0===f?0:f;this._isSelected=!0;this.setSelected(!1);this.loadTextures(a,b,c,d,e,f)},_initRenderer:function(){this._backGroundBoxRenderer=new cc.Sprite;this._backGroundSelectedBoxRenderer=new cc.Sprite;this._frontCrossRenderer=new cc.Sprite;this._backGroundBoxDisabledRenderer=new cc.Sprite;this._frontCrossDisabledRenderer= new cc.Sprite;this.addProtectedChild(this._backGroundBoxRenderer,ccui.CheckBox.BOX_RENDERER_ZORDER,-1);this.addProtectedChild(this._backGroundSelectedBoxRenderer,ccui.CheckBox.BOX_SELECTED_RENDERER_ZORDER,-1);this.addProtectedChild(this._frontCrossRenderer,ccui.CheckBox.FRONT_CROSS_RENDERER_ZORDER,-1);this.addProtectedChild(this._backGroundBoxDisabledRenderer,ccui.CheckBox.BOX_DISABLED_RENDERER_ZORDER,-1);this.addProtectedChild(this._frontCrossDisabledRenderer,ccui.CheckBox.FRONT_CROSS_DISABLED_RENDERER_ZORDER, -1)},loadTextures:function(a,b,c,d,e,f){a&&this.loadTextureBackGround(a,f);b&&this.loadTextureBackGroundSelected(b,f);c&&this.loadTextureFrontCross(c,f);d&&this.loadTextureBackGroundDisabled(d,f);e&&this.loadTextureFrontCrossDisabled(e,f)},loadTextureBackGround:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._backGroundFileName=a;this._backGroundTexType=b;var c=this._backGroundBoxRenderer;c._textureLoaded?this._backGroundBoxRenderer.setContentSize(this._customSize):c.addEventListener("load", function(){this._updateContentSizeWithTextureSize(this._backGroundBoxRenderer.getContentSize());this.loadTextureBackGround(this._backGroundFileName,this._backGroundTexType)},this);switch(this._backGroundTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();this._updateContentSizeWithTextureSize(this._backGroundBoxRenderer.getContentSize());this._backGroundBoxRendererAdaptDirty=!0;this._findLayout()}}, loadTextureBackGroundSelected:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._backGroundSelectedFileName=a;this._backGroundSelectedTexType=b;var c=this._backGroundSelectedBoxRenderer;c._textureLoaded||c.addEventListener("load",function(){this.loadTextureBackGroundSelected(this._backGroundSelectedFileName,this._backGroundSelectedTexType)},this);switch(this._backGroundSelectedTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA(); this._backGroundSelectedBoxRendererAdaptDirty=!0;this._findLayout()}},loadTextureFrontCross:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._frontCrossFileName=a;this._frontCrossTexType=b;var c=this._frontCrossRenderer;c._textureLoaded||c.addEventListener("load",function(){this.loadTextureFrontCross(this._frontCrossFileName,this._frontCrossTexType)},this);switch(this._frontCrossTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA(); this._frontCrossRendererAdaptDirty=!0;this._findLayout()}},loadTextureBackGroundDisabled:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._backGroundDisabledFileName=a;this._backGroundDisabledTexType=b;var c=this._backGroundBoxDisabledRenderer;c._textureLoaded||c.addEventListener("load",function(){this.loadTextureBackGroundDisabled(this._backGroundDisabledFileName,this._backGroundDisabledTexType)},this);switch(this._backGroundDisabledTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a); break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();this._backGroundBoxDisabledRendererAdaptDirty=!0;this._findLayout()}},loadTextureFrontCrossDisabled:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._frontCrossDisabledFileName=a;this._frontCrossDisabledTexType=b;var c=this._frontCrossDisabledRenderer;c._textureLoaded||c.addEventListener("load",function(){this.loadTextureFrontCrossDisabled(this._frontCrossDisabledFileName,this._frontCrossDisabledTexType)}, this);switch(this._frontCrossDisabledTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();this._frontCrossDisabledRendererAdaptDirty=!0;this._findLayout()}},_onPressStateChangedToNormal:function(){this._backGroundBoxRenderer.setVisible(!0);this._backGroundSelectedBoxRenderer.setVisible(!1);this._backGroundBoxDisabledRenderer.setVisible(!1);this._frontCrossDisabledRenderer.setVisible(!1);this._backGroundBoxRenderer.setScale(this._backgroundTextureScaleX, this._backgroundTextureScaleY);this._frontCrossRenderer.setScale(this._backgroundTextureScaleX,this._backgroundTextureScaleY);this._isSelected&&(this._frontCrossRenderer.setVisible(!0),this._frontCrossRendererAdaptDirty=!0)},_onPressStateChangedToPressed:function(){this._backGroundSelectedFileName?(this._backGroundBoxRenderer.setVisible(!1),this._backGroundSelectedBoxRenderer.setVisible(!0),this._backGroundBoxDisabledRenderer.setVisible(!1),this._frontCrossDisabledRenderer.setVisible(!1)):(this._backGroundBoxRenderer.setScale(this._backgroundTextureScaleX+ this._zoomScale,this._backgroundTextureScaleY+this._zoomScale),this._frontCrossRenderer.setScale(this._backgroundTextureScaleX+this._zoomScale,this._backgroundTextureScaleY+this._zoomScale))},_onPressStateChangedToDisabled:function(){this._backGroundDisabledFileName&&this._frontCrossDisabledFileName&&(this._backGroundBoxRenderer.setVisible(!1),this._backGroundBoxDisabledRenderer.setVisible(!0));this._backGroundSelectedBoxRenderer.setVisible(!1);this._frontCrossRenderer.setVisible(!1);this._backGroundBoxRenderer.setScale(this._backgroundTextureScaleX, this._backgroundTextureScaleY);this._frontCrossRenderer.setScale(this._backgroundTextureScaleX,this._backgroundTextureScaleY);this._isSelected&&(this._frontCrossDisabledRenderer.setVisible(!0),this._frontCrossDisabledRendererAdaptDirty=!0)},setZoomScale:function(a){this._zoomScale=a},getZoomScale:function(){return this._zoomScale},setSelectedState:function(a){this.setSelected(a)},setSelected:function(a){a!==this._isSelected&&(this._isSelected=a,this._frontCrossRenderer.setVisible(this._isSelected))}, getSelectedState:function(){return this.isSelected()},isSelected:function(){return this._isSelected},_selectedEvent:function(){this._checkBoxEventSelector&&(this._checkBoxEventListener?this._checkBoxEventSelector.call(this._checkBoxEventListener,this,ccui.CheckBox.EVENT_SELECTED):this._checkBoxEventSelector(this,ccui.CheckBox.EVENT_SELECTED))},_unSelectedEvent:function(){this._checkBoxEventSelector&&(this._checkBoxEventListener?this._checkBoxEventSelector.call(this._checkBoxEventListener,this,ccui.CheckBox.EVENT_UNSELECTED): this._checkBoxEventSelector(this,ccui.CheckBox.EVENT_UNSELECTED))},_releaseUpEvent:function(){ccui.Widget.prototype._releaseUpEvent.call(this);this._isSelected?(this.setSelected(!1),this._unSelectedEvent()):(this.setSelected(!0),this._selectedEvent())},addEventListenerCheckBox:function(a,b){this.addEventListener(a,b)},addEventListener:function(a,b){this._checkBoxEventSelector=a;this._checkBoxEventListener=b},getVirtualRendererSize:function(){return this._backGroundBoxRenderer.getContentSize()},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this); this._frontCrossDisabledRendererAdaptDirty=this._backGroundBoxDisabledRendererAdaptDirty=this._frontCrossRendererAdaptDirty=this._backGroundSelectedBoxRendererAdaptDirty=this._backGroundBoxRendererAdaptDirty=!0},getVirtualRenderer:function(){return this._backGroundBoxRenderer},_backGroundTextureScaleChangedWithSize:function(){var a=this._backGroundBoxRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1),this._backgroundTextureScaleX=this._backgroundTextureScaleY=1;else{var c=a.getContentSize(); if(0>=c.width||0>=c.height){a.setScale(1);this._backgroundTextureScaleX=this._backgroundTextureScaleY=1;return}var d=b.width/c.width,c=b.height/c.height;this._backgroundTextureScaleX=d;this._backgroundTextureScaleY=c;a.setScaleX(d);a.setScaleY(c)}a.setPosition(0.5*b.width,0.5*b.height)},_backGroundSelectedTextureScaleChangedWithSize:function(){var a=this._backGroundSelectedBoxRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1); return}var d=b.height/c.height;a.setScaleX(b.width/c.width);a.setScaleY(d)}a.setPosition(0.5*b.width,0.5*b.height)},_frontCrossTextureScaleChangedWithSize:function(){var a=this._frontCrossRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1);return}var d=b.height/c.height;a.setScaleX(b.width/c.width);a.setScaleY(d)}a.setPosition(0.5*b.width,0.5*b.height)},_backGroundDisabledTextureScaleChangedWithSize:function(){var a= this._backGroundBoxDisabledRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1);return}var d=b.height/c.height;a.setScaleX(b.width/c.width);a.setScaleY(d)}a.setPosition(0.5*b.width,0.5*b.height)},_frontCrossDisabledTextureScaleChangedWithSize:function(){var a=this._frontCrossDisabledRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1); return}var d=b.height/c.height;a.setScaleX(b.width/c.width);a.setScaleY(d)}a.setPosition(0.5*b.width,0.5*b.height)},getDescription:function(){return"CheckBox"},_createCloneInstance:function(){return new ccui.CheckBox},_copySpecialProperties:function(a){a instanceof ccui.CheckBox&&(this.loadTextureBackGround(a._backGroundFileName,a._backGroundTexType),this.loadTextureBackGroundSelected(a._backGroundSelectedFileName,a._backGroundSelectedTexType),this.loadTextureFrontCross(a._frontCrossFileName,a._frontCrossTexType), this.loadTextureBackGroundDisabled(a._backGroundDisabledFileName,a._backGroundDisabledTexType),this.loadTextureFrontCrossDisabled(a._frontCrossDisabledFileName,a._frontCrossDisabledTexType),this.setSelected(a._isSelected),this._checkBoxEventListener=a._checkBoxEventListener,this._checkBoxEventSelector=a._checkBoxEventSelector,this._ccEventCallback=a._ccEventCallback,this._zoomScale=a._zoomScale,this._backgroundTextureScaleX=a._backgroundTextureScaleX,this._backgroundTextureScaleY=a._backgroundTextureScaleY)}, _adaptRenderers:function(){this._backGroundBoxRendererAdaptDirty&&(this._backGroundTextureScaleChangedWithSize(),this._backGroundBoxRendererAdaptDirty=!1);this._backGroundSelectedBoxRendererAdaptDirty&&(this._backGroundSelectedTextureScaleChangedWithSize(),this._backGroundSelectedBoxRendererAdaptDirty=!1);this._frontCrossRendererAdaptDirty&&(this._frontCrossTextureScaleChangedWithSize(),this._frontCrossRendererAdaptDirty=!1);this._backGroundBoxDisabledRendererAdaptDirty&&(this._backGroundDisabledTextureScaleChangedWithSize(), this._backGroundBoxDisabledRendererAdaptDirty=!1);this._frontCrossDisabledRendererAdaptDirty&&(this._frontCrossDisabledTextureScaleChangedWithSize(),this._frontCrossDisabledRendererAdaptDirty=!1)}});_p=ccui.CheckBox.prototype;cc.defineGetterSetter(_p,"selected",_p.isSelected,_p.setSelected);_p=null;ccui.CheckBox.create=function(a,b,c,d,e,f){return new ccui.CheckBox(a,b,c,d,e,f)};ccui.CheckBox.EVENT_SELECTED=0;ccui.CheckBox.EVENT_UNSELECTED=1;ccui.CheckBox.BOX_RENDERER_ZORDER=-1; ccui.CheckBox.BOX_SELECTED_RENDERER_ZORDER=-1;ccui.CheckBox.BOX_DISABLED_RENDERER_ZORDER=-1;ccui.CheckBox.FRONT_CROSS_RENDERER_ZORDER=-1;ccui.CheckBox.FRONT_CROSS_DISABLED_RENDERER_ZORDER=-1;ccui.ImageView=ccui.Widget.extend({_scale9Enabled:!1,_prevIgnoreSize:!0,_capInsets:null,_imageRenderer:null,_textureFile:"",_imageTexType:ccui.Widget.LOCAL_TEXTURE,_imageTextureSize:null,_className:"ImageView",_imageRendererAdaptDirty:!0,ctor:function(a,b){this._capInsets=cc.rect(0,0,0,0);this._imageTextureSize=cc.size(this._capInsets.width,this._capInsets.height);ccui.Widget.prototype.ctor.call(this);a?this.loadTexture(a,void 0===b?0:b):this._imageTexType=ccui.Widget.LOCAL_TEXTURE},_initRenderer:function(){this._imageRenderer= new ccui.Scale9Sprite;this._imageRenderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SIMPLE);this.addProtectedChild(this._imageRenderer,ccui.ImageView.RENDERER_ZORDER,-1)},loadTexture:function(a,b){if(a&&(this._textureFile!=a||this._imageTexType!=b)){var c=this;b=b||ccui.Widget.LOCAL_TEXTURE;this._textureFile=a;this._imageTexType=b;var d=c._imageRenderer;d._textureLoaded||d.addEventListener("load",function(){!c._ignoreSize&&cc.sizeEqualToSize(c._customSize,cc.size(0,0))&&(c._customSize=c._imageRenderer.getContentSize()); c._imageTextureSize=d.getContentSize();c._updateChildrenDisplayedRGBA();c._updateContentSizeWithTextureSize(c._imageTextureSize)});switch(c._imageTexType){case ccui.Widget.LOCAL_TEXTURE:c._scale9Enabled?(d.initWithFile(a),d.setCapInsets(c._capInsets)):d.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c._scale9Enabled?(d.initWithSpriteFrameName(a),d.setCapInsets(c._capInsets)):d.initWithSpriteFrameName(a)}!this._ignoreSize&&cc.sizeEqualToSize(this._customSize,cc.size(0,0))&&(this._customSize= this._imageRenderer.getContentSize());c._imageTextureSize=d.getContentSize();this._updateChildrenDisplayedRGBA();c._updateContentSizeWithTextureSize(c._imageTextureSize);c._imageRendererAdaptDirty=!0;c._findLayout()}},setTextureRect:function(){cc.warn("ImageView.setTextureRect is deprecated!")},setScale9Enabled:function(a){this._scale9Enabled!==a&&((this._scale9Enabled=a)?this._imageRenderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SLICED):this._imageRenderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SIMPLE), this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1),this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsets(this._capInsets),this._imageRendererAdaptDirty=!0)},isScale9Enabled:function(){return this._scale9Enabled},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled||this._scale9Enabled&&!a)ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,a),this._prevIgnoreSize=a},setCapInsets:function(a){if(a){var b=this._capInsets; b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._imageRenderer.setCapInsets(a)}},getCapInsets:function(){return cc.rect(this._capInsets)},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._imageRendererAdaptDirty=!0},_adaptRenderers:function(){this._imageRendererAdaptDirty&&(this._imageTextureScaleChangedWithSize(),this._imageRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return cc.size(this._imageTextureSize)},getVirtualRenderer:function(){return this._imageRenderer}, _imageTextureScaleChangedWithSize:function(){this._imageRenderer.setContentSize(this._contentSize);this._imageRenderer.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getDescription:function(){return"ImageView"},_createCloneInstance:function(){return new ccui.ImageView},_copySpecialProperties:function(a){a instanceof ccui.ImageView&&(this._prevIgnoreSize=a._prevIgnoreSize,this._capInsets=a._capInsets,this.loadTexture(a._textureFile,a._imageTexType),this.setScale9Enabled(a._scale9Enabled))}, setContentSize:function(a,b){b&&(a=cc.size(a,b));ccui.Widget.prototype.setContentSize.call(this,a);this._imageRenderer.setContentSize(a)}});ccui.ImageView.create=function(a,b){return new ccui.ImageView(a,b)};ccui.ImageView.RENDERER_ZORDER=-1;ccui.LoadingBar=ccui.Widget.extend({_direction:null,_percent:100,_totalLength:0,_barRenderer:null,_renderBarTexType:ccui.Widget.LOCAL_TEXTURE,_barRendererTextureSize:null,_scale9Enabled:!1,_prevIgnoreSize:!0,_capInsets:null,_textureFile:"",_isTextureLoaded:!1,_className:"LoadingBar",_barRendererAdaptDirty:!0,ctor:function(a,b){this._direction=ccui.LoadingBar.TYPE_LEFT;this._barRendererTextureSize=cc.size(0,0);this._capInsets=cc.rect(0,0,0,0);ccui.Widget.prototype.ctor.call(this);void 0!==a&&this.loadTexture(a); void 0!==b&&this.setPercent(b)},_initRenderer:function(){this._barRenderer=new cc.Sprite;this.addProtectedChild(this._barRenderer,ccui.LoadingBar.RENDERER_ZORDER,-1);this._barRenderer.setAnchorPoint(0,0.5)},setDirection:function(a){if(this._direction!==a)switch(this._direction=a,this._direction){case ccui.LoadingBar.TYPE_LEFT:this._barRenderer.setAnchorPoint(0,0.5);this._barRenderer.setPosition(0,0.5*this._contentSize.height);this._scale9Enabled||this._barRenderer.setFlippedX(!1);break;case ccui.LoadingBar.TYPE_RIGHT:this._barRenderer.setAnchorPoint(1, 0.5),this._barRenderer.setPosition(this._totalLength,0.5*this._contentSize.height),this._scale9Enabled||this._barRenderer.setFlippedX(!0)}},getDirection:function(){return this._direction},loadTexture:function(a,b){if(a){this._renderBarTexType=b=b||ccui.Widget.LOCAL_TEXTURE;this._textureFile=a;var c=this._barRenderer,d=this;c._textureLoaded||c.addEventListener("load",function(){d.loadTexture(d._textureFile,d._renderBarTexType);d._setPercent(d._percent)});switch(this._renderBarTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a); break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}var e=c.getContentSize();this._barRendererTextureSize.width=e.width;this._barRendererTextureSize.height=e.height;switch(this._direction){case ccui.LoadingBar.TYPE_LEFT:c.setAnchorPoint(0,0.5);this._scale9Enabled||c.setFlippedX(!1);break;case ccui.LoadingBar.TYPE_RIGHT:c.setAnchorPoint(1,0.5),this._scale9Enabled||c.setFlippedX(!0)}this._scale9Enabled&&c.setCapInsets(this._capInsets);this._updateChildrenDisplayedRGBA();this._barRendererScaleChangedWithSize(); this._updateContentSizeWithTextureSize(this._barRendererTextureSize);this._barRendererAdaptDirty=!0;this._findLayout()}},setScale9Enabled:function(a){this._scale9Enabled!==a&&(this._scale9Enabled=a,this.removeProtectedChild(this._barRenderer),this._barRenderer=this._scale9Enabled?new ccui.Scale9Sprite:new cc.Sprite,this.loadTexture(this._textureFile,this._renderBarTexType),this.addProtectedChild(this._barRenderer,ccui.LoadingBar.RENDERER_ZORDER,-1),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1), this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsets(this._capInsets),this.setPercent(this._percent),this._barRendererAdaptDirty=!0)},isScale9Enabled:function(){return this._scale9Enabled},setCapInsets:function(a){if(a){var b=this._capInsets;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._barRenderer.setCapInsets(a)}},getCapInsets:function(){return cc.rect(this._capInsets)},setPercent:function(a){100<a&&(a=100);0>a&&(a=0);a!== this._percent&&(this._percent=a,this._setPercent(a))},_setPercent:function(){var a,b,c,d;0>=this._totalLength||(a=this._percent/100,this._scale9Enabled?this._setScale9Scale():(c=this._barRenderer,d=this._barRendererTextureSize,b=c.getTextureRect(),b.width=d.width*a,c.setTextureRect(cc.rect(b.x,b.y,d.width*a,d.height),c._rectRotated)))},setContentSize:function(a,b){ccui.Widget.prototype.setContentSize.call(this,a,b);this._totalLength=void 0===b?a.width:a},getPercent:function(){return this._percent}, _onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._barRendererAdaptDirty=!0},_adaptRenderers:function(){this._barRendererAdaptDirty&&(this._barRendererScaleChangedWithSize(),this._barRendererAdaptDirty=!1)},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled||this._scale9Enabled&&!a)ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,a),this._prevIgnoreSize=a},getVirtualRendererSize:function(){return cc.size(this._barRendererTextureSize)},getVirtualRenderer:function(){return this._barRenderer}, _barRendererScaleChangedWithSize:function(){var a=this._barRenderer,b=this._contentSize;if(this._unifySize)this._totalLength=this._contentSize.width,this.setPercent(this._percent);else if(this._ignoreSize)this._scale9Enabled||(this._totalLength=this._barRendererTextureSize.width,a.setScale(1));else if(this._totalLength=b.width,this._scale9Enabled)this._setScale9Scale(),a.setScale(1);else{var c=this._barRendererTextureSize;if(0>=c.width||0>=c.height){a.setScale(1);return}var d=b.height/c.height;a.setScaleX(b.width/ c.width);a.setScaleY(d)}switch(this._direction){case ccui.LoadingBar.TYPE_LEFT:a.setPosition(0,0.5*b.height);break;case ccui.LoadingBar.TYPE_RIGHT:a.setPosition(this._totalLength,0.5*b.height)}},_setScale9Scale:function(){this._barRenderer.setPreferredSize(cc.size(this._percent/100*this._totalLength,this._contentSize.height))},getDescription:function(){return"LoadingBar"},_createCloneInstance:function(){return new ccui.LoadingBar},_copySpecialProperties:function(a){a instanceof ccui.LoadingBar&&(this._prevIgnoreSize= a._prevIgnoreSize,this.setScale9Enabled(a._scale9Enabled),this.loadTexture(a._textureFile,a._renderBarTexType),this.setCapInsets(a._capInsets),this.setPercent(a._percent),this.setDirection(a._direction))}});_p=ccui.LoadingBar.prototype;cc.defineGetterSetter(_p,"direction",_p.getDirection,_p.setDirection);cc.defineGetterSetter(_p,"percent",_p.getPercent,_p.setPercent);_p=null;ccui.LoadingBar.create=function(a,b){return new ccui.LoadingBar(a,b)};ccui.LoadingBar.TYPE_LEFT=0; ccui.LoadingBar.TYPE_RIGHT=1;ccui.LoadingBar.RENDERER_ZORDER=-1;ccui.Slider=ccui.Widget.extend({_barRenderer:null,_progressBarRenderer:null,_barTextureSize:null,_progressBarTextureSize:null,_slidBallNormalRenderer:null,_slidBallPressedRenderer:null,_slidBallDisabledRenderer:null,_slidBallRenderer:null,_barLength:0,_percent:0,_scale9Enabled:!1,_prevIgnoreSize:!0,_textureFile:"",_progressBarTextureFile:"",_slidBallNormalTextureFile:"",_slidBallPressedTextureFile:"",_slidBallDisabledTextureFile:"",_capInsetsBarRenderer:null,_capInsetsProgressBarRenderer:null,_sliderEventListener:null, _sliderEventSelector:null,_barTexType:ccui.Widget.LOCAL_TEXTURE,_progressBarTexType:ccui.Widget.LOCAL_TEXTURE,_ballNTexType:ccui.Widget.LOCAL_TEXTURE,_ballPTexType:ccui.Widget.LOCAL_TEXTURE,_ballDTexType:ccui.Widget.LOCAL_TEXTURE,_isTextureLoaded:!1,_className:"Slider",_barRendererAdaptDirty:!0,_progressBarRendererDirty:!0,_unifySize:!1,_zoomScale:0.1,_sliderBallNormalTextureScaleX:1,_sliderBallNormalTextureScaleY:1,ctor:function(a,b,c){this._barTextureSize=cc.size(0,0);this._progressBarTextureSize= cc.size(0,0);this._capInsetsBarRenderer=cc.rect(0,0,0,0);this._capInsetsProgressBarRenderer=cc.rect(0,0,0,0);ccui.Widget.prototype.ctor.call(this);c=c||0;this.setTouchEnabled(!0);a&&this.loadBarTexture(a,c);b&&this.loadSlidBallTextures(b,c)},_initRenderer:function(){this._barRenderer=new cc.Sprite;this._progressBarRenderer=new cc.Sprite;this._progressBarRenderer.setAnchorPoint(0,0.5);this.addProtectedChild(this._barRenderer,ccui.Slider.BASEBAR_RENDERER_ZORDER,-1);this.addProtectedChild(this._progressBarRenderer, ccui.Slider.PROGRESSBAR_RENDERER_ZORDER,-1);this._slidBallNormalRenderer=new cc.Sprite;this._slidBallPressedRenderer=new cc.Sprite;this._slidBallPressedRenderer.setVisible(!1);this._slidBallDisabledRenderer=new cc.Sprite;this._slidBallDisabledRenderer.setVisible(!1);this._slidBallRenderer=new cc.Node;this._slidBallRenderer.addChild(this._slidBallNormalRenderer);this._slidBallRenderer.addChild(this._slidBallPressedRenderer);this._slidBallRenderer.addChild(this._slidBallDisabledRenderer);this._slidBallRenderer.setCascadeColorEnabled(!0); this._slidBallRenderer.setCascadeOpacityEnabled(!0);this.addProtectedChild(this._slidBallRenderer,ccui.Slider.BALL_RENDERER_ZORDER,-1)},loadBarTexture:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._textureFile=a;this._barTexType=b;var c=this._barRenderer,d=this;c._textureLoaded||c.addEventListener("load",function(){d.loadBarTexture(d._textureFile,d._barTexType)});switch(this._barTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA(); this._progressBarRendererDirty=this._barRendererAdaptDirty=!0;this._updateContentSizeWithTextureSize(this._barRenderer.getContentSize());this._findLayout();this._barTextureSize=this._barRenderer.getContentSize()}},loadProgressBarTexture:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._progressBarTextureFile=a;this._progressBarTexType=b;var c=this._progressBarRenderer,d=this;c._textureLoaded||c.addEventListener("load",function(){d.loadProgressBarTexture(d._progressBarTextureFile,d._progressBarTexType)}); switch(this._progressBarTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();this._progressBarRenderer.setAnchorPoint(cc.p(0,0.5));c=this._progressBarRenderer.getContentSize();this._progressBarTextureSize={width:c.width,height:c.height};this._progressBarRendererDirty=!0;this._findLayout()}},setScale9Enabled:function(a){this._scale9Enabled!==a&&(this._scale9Enabled=a,this.removeProtectedChild(this._barRenderer, !0),this.removeProtectedChild(this._progressBarRenderer,!0),this._progressBarRenderer=this._barRenderer=null,this._scale9Enabled?(this._barRenderer=new ccui.Scale9Sprite,this._progressBarRenderer=new ccui.Scale9Sprite):(this._barRenderer=new cc.Sprite,this._progressBarRenderer=new cc.Sprite),this.loadBarTexture(this._textureFile,this._barTexType),this.loadProgressBarTexture(this._progressBarTextureFile,this._progressBarTexType),this.addProtectedChild(this._barRenderer,ccui.Slider.BASEBAR_RENDERER_ZORDER, -1),this.addProtectedChild(this._progressBarRenderer,ccui.Slider.PROGRESSBAR_RENDERER_ZORDER,-1),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1),this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsetsBarRenderer(this._capInsetsBarRenderer),this.setCapInsetProgressBarRenderer(this._capInsetsProgressBarRenderer),this._progressBarRendererDirty=this._barRendererAdaptDirty=!0)},isScale9Enabled:function(){return this._scale9Enabled},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled|| this._scale9Enabled&&!a)ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,a),this._prevIgnoreSize=a},setCapInsets:function(a){this.setCapInsetsBarRenderer(a);this.setCapInsetProgressBarRenderer(a)},setCapInsetsBarRenderer:function(a){if(a){var b=this._capInsetsBarRenderer;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._barRenderer.setCapInsets(a)}},getCapInsetsBarRenderer:function(){return cc.rect(this._capInsetsBarRenderer)},setCapInsetProgressBarRenderer:function(a){if(a){var b= this._capInsetsProgressBarRenderer;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._progressBarRenderer.setCapInsets(a)}},getCapInsetsProgressBarRenderer:function(){return cc.rect(this._capInsetsProgressBarRenderer)},loadSlidBallTextures:function(a,b,c,d){this.loadSlidBallTextureNormal(a,d);this.loadSlidBallTexturePressed(b,d);this.loadSlidBallTextureDisabled(c,d)},loadSlidBallTextureNormal:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._slidBallNormalTextureFile= a;this._ballNTexType=b;var c=this;this._slidBallNormalRenderer._textureLoaded||this._slidBallNormalRenderer.addEventListener("load",function(){c.loadSlidBallTextureNormal(c._slidBallNormalTextureFile,c._ballNTexType)});switch(this._ballNTexType){case ccui.Widget.LOCAL_TEXTURE:this._slidBallNormalRenderer.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:this._slidBallNormalRenderer.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();this._findLayout()}},loadSlidBallTexturePressed:function(a, b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._slidBallPressedTextureFile=a;this._ballPTexType=b;var c=this;this._slidBallPressedRenderer._textureLoaded||this._slidBallPressedRenderer.addEventListener("load",function(){c.loadSlidBallTexturePressed(c._slidBallPressedTextureFile,c._ballPTexType)});switch(this._ballPTexType){case ccui.Widget.LOCAL_TEXTURE:this._slidBallPressedRenderer.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:this._slidBallPressedRenderer.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA(); this._findLayout()}},loadSlidBallTextureDisabled:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._slidBallDisabledTextureFile=a;this._ballDTexType=b;var c=this;this._slidBallDisabledRenderer._textureLoaded||this._slidBallDisabledRenderer.addEventListener("load",function(){c.loadSlidBallTextureDisabled(c._slidBallDisabledTextureFile,c._ballDTexType)});switch(this._ballDTexType){case ccui.Widget.LOCAL_TEXTURE:this._slidBallDisabledRenderer.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:this._slidBallDisabledRenderer.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA(); this._findLayout()}},setPercent:function(a){100<a&&(a=100);0>a&&(a=0);this._percent=a;a=a/100*this._barLength;this._slidBallRenderer.setPosition(a,this._contentSize.height/2);if(this._scale9Enabled)this._progressBarRenderer.setPreferredSize(cc.size(a,this._contentSize.height));else{var b=this._progressBarRenderer,c=b.getTextureRect();b.setTextureRect(cc.rect(c.x,c.y,a/b._scaleX,c.height),b.isTextureRectRotated())}},hitTest:function(a){a=this._slidBallNormalRenderer.convertToNodeSpace(a);var b=this._slidBallNormalRenderer.getContentSize(), b=cc.rect(0,0,b.width,b.height);return a.x>=b.x&&a.x<=b.x+b.width&&a.y>=b.y&&a.y<=b.y+b.height},onTouchBegan:function(a,b){var c=ccui.Widget.prototype.onTouchBegan.call(this,a,b);if(this._hit){var d=this.convertToNodeSpace(this._touchBeganPosition);this.setPercent(this._getPercentWithBallPos(d.x));this._percentChangedEvent()}return c},onTouchMoved:function(a,b){var c=a.getLocation(),c=this.convertToNodeSpace(c);this.setPercent(this._getPercentWithBallPos(c.x));this._percentChangedEvent()},onTouchEnded:function(a, b){ccui.Widget.prototype.onTouchEnded.call(this,a,b)},onTouchCancelled:function(a,b){ccui.Widget.prototype.onTouchCancelled.call(this,a,b)},_getPercentWithBallPos:function(a){return a/this._barLength*100},addEventListenerSlider:function(a,b){this.addEventListener(a,b)},addEventListener:function(a,b){this._sliderEventSelector=a;this._sliderEventListener=b},_percentChangedEvent:function(){this._sliderEventSelector&&(this._sliderEventListener?this._sliderEventSelector.call(this._sliderEventListener, this,ccui.Slider.EVENT_PERCENT_CHANGED):this._sliderEventSelector(this,ccui.Slider.EVENT_PERCENT_CHANGED));this._ccEventCallback&&this._ccEventCallback(this,ccui.Slider.EVENT_PERCENT_CHANGED)},getPercent:function(){return this._percent},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._progressBarRendererDirty=this._barRendererAdaptDirty=!0},_adaptRenderers:function(){this._barRendererAdaptDirty&&(this._barRendererScaleChangedWithSize(),this._barRendererAdaptDirty=!1); this._progressBarRendererDirty&&(this._progressBarRendererScaleChangedWithSize(),this._progressBarRendererDirty=!1)},getVirtualRendererSize:function(){return this._barRenderer.getContentSize()},getVirtualRenderer:function(){return this._barRenderer},_barRendererScaleChangedWithSize:function(){if(this._unifySize)this._barLength=this._contentSize.width,this._barRenderer.setPreferredSize(this._contentSize);else if(this._ignoreSize)this._barRenderer.setScale(1),this._barLength=this._contentSize.width; else if(this._barLength=this._contentSize.width,this._scale9Enabled)this._barRenderer.setPreferredSize(this._contentSize),this._barRenderer.setScale(1);else{var a=this._barTextureSize;if(0>=a.width||0>=a.height)this._barRenderer.setScale(1);else{var b=this._contentSize.height/a.height;this._barRenderer.setScaleX(this._contentSize.width/a.width);this._barRenderer.setScaleY(b)}}this._barRenderer.setPosition(this._contentSize.width/2,this._contentSize.height/2);this.setPercent(this._percent)},_progressBarRendererScaleChangedWithSize:function(){if(this._unifySize)this._progressBarRenderer.setPreferredSize(this._contentSize); else if(this._ignoreSize){if(!this._scale9Enabled){var a=this._progressBarTextureSize,b=this._contentSize.width/a.width,a=this._contentSize.height/a.height;this._progressBarRenderer.setScaleX(b);this._progressBarRenderer.setScaleY(a)}}else if(this._scale9Enabled)this._progressBarRenderer.setPreferredSize(this._contentSize),this._progressBarRenderer.setScale(1);else{a=this._progressBarTextureSize;if(0>=a.width||0>=a.height){this._progressBarRenderer.setScale(1);return}b=this._contentSize.width/a.width; a=this._contentSize.height/a.height;this._progressBarRenderer.setScaleX(b);this._progressBarRenderer.setScaleY(a)}this._progressBarRenderer.setPosition(0,this._contentSize.height/2);this.setPercent(this._percent)},_onPressStateChangedToNormal:function(){this._slidBallNormalRenderer.setVisible(!0);this._slidBallPressedRenderer.setVisible(!1);this._slidBallDisabledRenderer.setVisible(!1);this._slidBallNormalRenderer.setScale(this._sliderBallNormalTextureScaleX,this._sliderBallNormalTextureScaleY);cc._renderType=== cc.game.RENDER_TYPE_WEBGL&&(this._slidBallNormalRenderer._renderCmd._shaderProgram=this._getNormalGLProgram())},_onPressStateChangedToPressed:function(){this._slidBallPressedTextureFile?(this._slidBallNormalRenderer.setVisible(!1),this._slidBallPressedRenderer.setVisible(!0),this._slidBallDisabledRenderer.setVisible(!1)):this._slidBallNormalRenderer.setScale(this._sliderBallNormalTextureScaleX+this._zoomScale,this._sliderBallNormalTextureScaleY+this._zoomScale);cc._renderType===cc.game.RENDER_TYPE_WEBGL&& (this._slidBallNormalRenderer._renderCmd._shaderProgram=this._getNormalGLProgram())},_onPressStateChangedToDisabled:function(){this._slidBallDisabledTextureFile?(this._slidBallNormalRenderer.setVisible(!1),this._slidBallDisabledRenderer.setVisible(!0)):(this._slidBallNormalRenderer.setVisible(!0),cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(this._slidBallNormalRenderer._renderCmd._shaderProgram=this._getGrayGLProgram()));this._slidBallNormalRenderer.setScale(this._sliderBallNormalTextureScaleX,this._sliderBallNormalTextureScaleY); this._slidBallPressedRenderer.setVisible(!1)},setZoomScale:function(a){this._zoomScale=a},getZoomScale:function(){return this._zoomScale},getSlidBallNormalRenderer:function(){return this._slidBallNormalRenderer},getSlidBallPressedRenderer:function(){return this._slidBallPressedRenderer},getSlidBallDisabledRenderer:function(){return this._slidBallDisabledRenderer},getSlidBallRenderer:function(){return this._slidBallRenderer},getDescription:function(){return"Slider"},_createCloneInstance:function(){return new ccui.Slider}, _copySpecialProperties:function(a){this._prevIgnoreSize=a._prevIgnoreSize;this.setScale9Enabled(a._scale9Enabled);this.loadBarTexture(a._textureFile,a._barTexType);this.loadProgressBarTexture(a._progressBarTextureFile,a._progressBarTexType);this.loadSlidBallTextureNormal(a._slidBallNormalTextureFile,a._ballNTexType);this.loadSlidBallTexturePressed(a._slidBallPressedTextureFile,a._ballPTexType);this.loadSlidBallTextureDisabled(a._slidBallDisabledTextureFile,a._ballDTexType);this.setPercent(a.getPercent()); this._sliderEventListener=a._sliderEventListener;this._sliderEventSelector=a._sliderEventSelector;this._zoomScale=a._zoomScale;this._ccEventCallback=a._ccEventCallback}});_p=ccui.Slider.prototype;cc.defineGetterSetter(_p,"percent",_p.getPercent,_p.setPercent);_p=null;ccui.Slider.create=function(a,b,c){return new ccui.Slider(a,b,c)};ccui.Slider.EVENT_PERCENT_CHANGED=0;ccui.Slider.BASEBAR_RENDERER_ZORDER=-3;ccui.Slider.PROGRESSBAR_RENDERER_ZORDER=-2;ccui.Slider.BALL_RENDERER_ZORDER=-1;ccui.Text=ccui.Widget.extend({_touchScaleChangeEnabled:!1,_normalScaleValueX:1,_normalScaleValueY:1,_fontName:"Arial",_fontSize:16,_onSelectedScaleOffset:0.5,_labelRenderer:null,_textAreaSize:null,_textVerticalAlignment:0,_textHorizontalAlignment:0,_className:"Text",_type:null,_labelRendererAdaptDirty:!0,ctor:function(a,b,c){this._type=ccui.Text.Type.SYSTEM;this._textAreaSize=cc.size(0,0);ccui.Widget.prototype.ctor.call(this);void 0!==c?(this.setFontName(b),this.setFontSize(c),this.setString(a)): this.setFontName(this._fontName)},_initRenderer:function(){this._labelRenderer=new cc.LabelTTF;this.addProtectedChild(this._labelRenderer,ccui.Text.RENDERER_ZORDER,-1)},setText:function(a){cc.log("Please use the setString");this.setString(a)},setString:function(a){a!==this._labelRenderer.getString()&&(this._labelRenderer.setString(a),this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize()),this._labelRendererAdaptDirty=!0)},_setString:function(a){a!==this._labelRenderer.getString()&& (this._labelRenderer.setString(a),this._labelRendererAdaptDirty=!0)},getStringValue:function(){cc.log("Please use the getString");return this._labelRenderer.getString()},getString:function(){return this._labelRenderer.getString()},getStringLength:function(){return this._labelRenderer.getStringLength()},setFontSize:function(a){this._labelRenderer.setFontSize(a);this._fontSize=a;this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize());this._labelRendererAdaptDirty=!0},_setFontSize:function(a){this._labelRenderer.setFontSize(a); this._fontSize=a;this._labelRendererAdaptDirty=!0},getFontSize:function(){return this._fontSize},setFontName:function(a){this._fontName=a;this._labelRenderer.setFontName(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize());this._labelRendererAdaptDirty=!0},_setFontName:function(a){this._fontName=a;this._labelRenderer.setFontName(a);this._labelRendererAdaptDirty=!0},_updateUITextContentSize:function(){this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())}, getFontName:function(){return this._fontName},_setFont:function(a){var b=cc.LabelTTF._fontStyleRE.exec(a);b&&(this._fontSize=parseInt(b[1]),this._fontName=b[2],this._labelRenderer._setFont(a),this._labelScaleChangedWithSize())},_getFont:function(){return this._labelRenderer._getFont()},getType:function(){return this._type},setTextAreaSize:function(a){this._labelRenderer.setDimensions(a);this._ignoreSize||(this._customSize=a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize()); this._labelRendererAdaptDirty=!0},_setTextAreaSize:function(a){this._labelRenderer.setDimensions(a);this._ignoreSize||(this._customSize=a);this._labelRendererAdaptDirty=!0},getTextAreaSize:function(){return this._labelRenderer.getDimensions()},setTextHorizontalAlignment:function(a){this._labelRenderer.setHorizontalAlignment(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize());this._labelRendererAdaptDirty=!0},_setTextHorizontalAlignment:function(a){this._labelRenderer.setHorizontalAlignment(a); this._labelRendererAdaptDirty=!0},getTextHorizontalAlignment:function(){return this._labelRenderer.getHorizontalAlignment()},setTextVerticalAlignment:function(a){this._labelRenderer.setVerticalAlignment(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize());this._labelRendererAdaptDirty=!0},_setTextVerticalAlignment:function(a){this._labelRenderer.setVerticalAlignment(a);this._labelRendererAdaptDirty=!0},getTextVerticalAlignment:function(){return this._labelRenderer.getVerticalAlignment()}, setTouchScaleChangeEnabled:function(a){this._touchScaleChangeEnabled=a},isTouchScaleChangeEnabled:function(){return this._touchScaleChangeEnabled},_onPressStateChangedToNormal:function(){this._touchScaleChangeEnabled&&(this._labelRenderer.setScaleX(this._normalScaleValueX),this._labelRenderer.setScaleY(this._normalScaleValueY))},_onPressStateChangedToPressed:function(){this._touchScaleChangeEnabled&&(this._labelRenderer.setScaleX(this._normalScaleValueX+this._onSelectedScaleOffset),this._labelRenderer.setScaleY(this._normalScaleValueY+ this._onSelectedScaleOffset))},_onPressStateChangedToDisabled:function(){},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._labelRendererAdaptDirty=!0},_adaptRenderers:function(){this._labelRendererAdaptDirty&&(this._labelScaleChangedWithSize(),this._labelRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return this._labelRenderer.getContentSize()},getVirtualRenderer:function(){return this._labelRenderer},getAutoRenderSize:function(){var a=this._labelRenderer.getContentSize(); this._ignoreSize||(this._labelRenderer.setDimensions(0,0),a=this._labelRenderer.getContentSize(),this._labelRenderer.setDimensions(this._contentSize.width,this._contentSize.height));return a},_labelScaleChangedWithSize:function(){var a=this._contentSize;if(this._ignoreSize)this._labelRenderer.setDimensions(0,0),this._labelRenderer.setScale(1),this._normalScaleValueX=this._normalScaleValueY=1;else{this._labelRenderer.setDimensions(cc.size(a.width,a.height));var b=this._labelRenderer.getContentSize(); if(0>=b.width||0>=b.height){this._labelRenderer.setScale(1);return}var c=a.width/b.width,b=a.height/b.height;this._labelRenderer.setScaleX(c);this._labelRenderer.setScaleY(b);this._normalScaleValueX=c;this._normalScaleValueY=b}this._labelRenderer.setPosition(a.width/2,a.height/2)},getDescription:function(){return"Label"},enableShadow:function(a,b,c){this._labelRenderer.enableShadow(a,b,c)},enableOutline:function(a,b){this._labelRenderer.enableStroke(a,b)},enableGlow:function(a){this._type===ccui.Text.Type.TTF&& this._labelRenderer.enableGlow(a)},disableEffect:function(){this._labelRenderer.disableEffect&&this._labelRenderer.disableEffect()},_createCloneInstance:function(){return new ccui.Text},_copySpecialProperties:function(a){a instanceof ccui.Text&&(this.setFontName(a._fontName),this.setFontSize(a.getFontSize()),this.setString(a.getString()),this.setTouchScaleChangeEnabled(a.touchScaleEnabled),this.setTextAreaSize(a._textAreaSize),this.setTextHorizontalAlignment(a._labelRenderer.getHorizontalAlignment()), this.setTextVerticalAlignment(a._labelRenderer.getVerticalAlignment()),this.setContentSize(a.getContentSize()),this.setTextColor(a.getTextColor()))},_setBoundingWidth:function(a){this._textAreaSize.width=a;this._labelRenderer._setBoundingWidth(a);this._labelScaleChangedWithSize()},_setBoundingHeight:function(a){this._textAreaSize.height=a;this._labelRenderer._setBoundingHeight(a);this._labelScaleChangedWithSize()},_getBoundingWidth:function(){return this._textAreaSize.width},_getBoundingHeight:function(){return this._textAreaSize.height}, _changePosition:function(){this._adaptRenderers()},setColor:function(a){cc.ProtectedNode.prototype.setColor.call(this,a);this._labelRenderer.setColor(a)},setTextColor:function(a){this._labelRenderer.setFontFillColor(a)},getTextColor:function(){return this._labelRenderer._getFillStyle()}});_p=ccui.Text.prototype;cc.defineGetterSetter(_p,"boundingWidth",_p._getBoundingWidth,_p._setBoundingWidth);cc.defineGetterSetter(_p,"boundingHeight",_p._getBoundingHeight,_p._setBoundingHeight); cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);cc.defineGetterSetter(_p,"stringLength",_p.getStringLength);cc.defineGetterSetter(_p,"font",_p._getFont,_p._setFont);cc.defineGetterSetter(_p,"fontSize",_p.getFontSize,_p.setFontSize);cc.defineGetterSetter(_p,"fontName",_p.getFontName,_p.setFontName);cc.defineGetterSetter(_p,"textAlign",_p.getTextHorizontalAlignment,_p.setTextHorizontalAlignment);cc.defineGetterSetter(_p,"verticalAlign",_p.getTextVerticalAlignment,_p.setTextVerticalAlignment); _p=null;ccui.Label=ccui.Text.create=function(a,b,c){return new ccui.Text(a,b,c)};ccui.Text.RENDERER_ZORDER=-1;ccui.Text.Type={SYSTEM:0,TTF:1};ccui.TextAtlas=ccui.Widget.extend({_labelAtlasRenderer:null,_stringValue:"",_charMapFileName:"",_itemWidth:0,_itemHeight:0,_startCharMap:"",_className:"TextAtlas",_labelAtlasRendererAdaptDirty:null,ctor:function(a,b,c,d,e){ccui.Widget.prototype.ctor.call(this);void 0!==e&&this.setProperty(a,b,c,d,e)},_initRenderer:function(){this._labelAtlasRenderer=new cc.LabelAtlas;this._labelAtlasRenderer.setAnchorPoint(cc.p(0.5,0.5));this.addProtectedChild(this._labelAtlasRenderer,ccui.TextAtlas.RENDERER_ZORDER, -1);this._labelAtlasRenderer.addEventListener("load",function(){this._updateContentSizeWithTextureSize(this._labelAtlasRenderer.getContentSize());this._findLayout()},this)},setProperty:function(a,b,c,d,e){this._stringValue=a;this._charMapFileName=b;this._itemWidth=c;this._itemHeight=d;this._startCharMap=e;this._labelAtlasRenderer.initWithString(a,this._charMapFileName,this._itemWidth,this._itemHeight,this._startCharMap[0]);this._updateContentSizeWithTextureSize(this._labelAtlasRenderer.getContentSize()); this._labelAtlasRendererAdaptDirty=!0},setString:function(a){a!==this._labelAtlasRenderer.getString()&&(this._stringValue=a,this._labelAtlasRenderer.setString(a),this._updateContentSizeWithTextureSize(this._labelAtlasRenderer.getContentSize()),this._labelAtlasRendererAdaptDirty=!0)},setStringValue:function(a){cc.log("Please use the setString");this.setString(a)},getStringValue:function(){cc.log("Please use the getString");return this.getString()},getString:function(){return this._labelAtlasRenderer.getString()}, getStringLength:function(){return this._labelAtlasRenderer.getStringLength()},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._labelAtlasRendererAdaptDirty=!0},_adaptRenderers:function(){this._labelAtlasRendererAdaptDirty&&(this._labelAtlasScaleChangedWithSize(),this._labelAtlasRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return this._labelAtlasRenderer.getContentSize()},getVirtualRenderer:function(){return this._labelAtlasRenderer},_labelAtlasScaleChangedWithSize:function(){var a= this._labelAtlasRenderer;if(this._ignoreSize)a.setScale(1);else{var b=a.getContentSize();if(0>=b.width||0>=b.height){a.setScale(1);return}a.setScaleX(this._contentSize.width/b.width);a.setScaleY(this._contentSize.height/b.height)}a.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getDescription:function(){return"LabelAtlas"},_copySpecialProperties:function(a){a&&this.setProperty(a._stringValue,a._charMapFileName,a._itemWidth,a._itemHeight,a._startCharMap)},_createCloneInstance:function(){return new ccui.TextAtlas}}); _p=ccui.TextAtlas.prototype;cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);_p=null;ccui.TextAtlas.create=function(a,b,c,d,e){return new ccui.TextAtlas(a,b,c,d,e)};ccui.TextAtlas.RENDERER_ZORDER=-1;ccui.LabelBMFont=ccui.TextBMFont=ccui.Widget.extend({_labelBMFontRenderer:null,_fntFileHasInit:!1,_fntFileName:"",_stringValue:"",_className:"TextBMFont",_labelBMFontRendererAdaptDirty:!0,ctor:function(a,b){ccui.Widget.prototype.ctor.call(this);this._loader=new cc.Sprite.LoadManager;void 0!==b&&(this.setFntFile(b),this.setString(a))},_initRenderer:function(){this._labelBMFontRenderer=new cc.LabelBMFont;this.addProtectedChild(this._labelBMFontRenderer,ccui.TextBMFont.RENDERER_ZORDER,-1)},setFntFile:function(a){if(a){this._fntFileName= a;this._fntFileHasInit=!0;this._labelBMFontRenderer.initWithString(this._stringValue,a);this._updateContentSizeWithTextureSize(this._labelBMFontRenderer.getContentSize());this._labelBMFontRendererAdaptDirty=!0;var b=this;a=b._labelBMFontRenderer;a._textureLoaded||a.addEventListener("load",function(){b.setFntFile(b._fntFileName)})}},setText:function(a){cc.log("Please use the setString");this.setString(a)},setString:function(a){this._loader.clear();this._labelBMFontRenderer._textureLoaded?a!==this._labelBMFontRenderer.getString()&& (this._stringValue=a,this._labelBMFontRenderer.setString(a),this._fntFileHasInit&&(this._updateContentSizeWithTextureSize(this._labelBMFontRenderer.getContentSize()),this._labelBMFontRendererAdaptDirty=!0)):this._loader.add(this._labelBMFontRenderer,function(){this.setString(a)},this)},getString:function(){return this._stringValue},getStringLength:function(){return this._labelBMFontRenderer.getStringLength()},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._labelBMFontRendererAdaptDirty= !0},_adaptRenderers:function(){this._labelBMFontRendererAdaptDirty&&(this._labelBMFontScaleChangedWithSize(),this._labelBMFontRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return this._labelBMFontRenderer.getContentSize()},getVirtualRenderer:function(){return this._labelBMFontRenderer},_labelBMFontScaleChangedWithSize:function(){var a=this._labelBMFontRenderer;if(this._ignoreSize)a.setScale(1);else{var b=a.getContentSize();if(0>=b.width||0>=b.height){a.setScale(1);return}a.setScaleX(this._contentSize.width/ b.width);a.setScaleY(this._contentSize.height/b.height)}a.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getDescription:function(){return"TextBMFont"},_createCloneInstance:function(){return new ccui.TextBMFont},_copySpecialProperties:function(a){this.setFntFile(a._fntFileName);this.setString(a._stringValue)}});_p=ccui.TextBMFont.prototype;cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);_p=null;ccui.TextBMFont.create=function(a,b){return new ccui.TextBMFont(a,b)}; ccui.TextBMFont.RENDERER_ZORDER=-1;ccui._TextFieldRenderer=cc.TextFieldTTF.extend({_maxLengthEnabled:!1,_maxLength:0,_passwordEnabled:!1,_passwordStyleText:"",_attachWithIME:!1,_detachWithIME:!1,_insertText:!1,_deleteBackward:!1,_className:"_TextFieldRenderer",ctor:function(){cc.TextFieldTTF.prototype.ctor.call(this);this._maxLengthEnabled=!1;this._maxLength=0;this._passwordEnabled=!1;this._passwordStyleText="*";this._deleteBackward=this._insertText=this._detachWithIME=this._attachWithIME=!1},onEnter:function(){cc.TextFieldTTF.prototype.onEnter.call(this); cc.TextFieldTTF.prototype.setDelegate.call(this,this)},onTextFieldAttachWithIME:function(a){this.setAttachWithIME(!0);return!1},onTextFieldInsertText:function(a,b,c){if(1===c&&"\n"===b)return!1;this.setInsertText(!0);return this._maxLengthEnabled&&cc.TextFieldTTF.prototype.getCharCount.call(this)>=this._maxLength},onTextFieldDeleteBackward:function(a,b,c){this.setDeleteBackward(!0);return!1},onTextFieldDetachWithIME:function(a){this.setDetachWithIME(!0);return!1},insertText:function(a,b){"\n"!==a&& this._maxLengthEnabled&&this.getString().length>=this._maxLength?this._passwordEnabled&&this.setPasswordText(this.getString()):(cc.TextFieldTTF.prototype.insertText.call(this,a,b),this._passwordEnabled&&0<cc.TextFieldTTF.prototype.getCharCount.call(this)&&this.setPasswordText(this.getString()))},deleteBackward:function(){cc.TextFieldTTF.prototype.deleteBackward.call(this);0<cc.TextFieldTTF.prototype.getCharCount.call(this)&&this._passwordEnabled&&this.setPasswordText(this._inputText)},openIME:function(){cc.TextFieldTTF.prototype.attachWithIME.call(this)}, closeIME:function(){cc.TextFieldTTF.prototype.detachWithIME.call(this)},setMaxLengthEnabled:function(a){this._maxLengthEnabled=a},isMaxLengthEnabled:function(){return this._maxLengthEnabled},setMaxLength:function(a){this._maxLength=a},getMaxLength:function(){return this._maxLength},getCharCount:function(){return cc.TextFieldTTF.prototype.getCharCount.call(this)},setPasswordEnabled:function(a){this._passwordEnabled=a},isPasswordEnabled:function(){return this._passwordEnabled},setPasswordStyleText:function(a){if(!(1< a.length)){var b=a.charCodeAt(0);33>b||126<b||(this._passwordStyleText=a)}},setPasswordText:function(a){var b="",c=a.length;a=c;this._maxLengthEnabled&&c>this._maxLength&&(a=this._maxLength);for(c=0;c<a;++c)b+=this._passwordStyleText;cc.LabelTTF.prototype.setString.call(this,b)},setAttachWithIME:function(a){this._attachWithIME=a},getAttachWithIME:function(){return this._attachWithIME},setDetachWithIME:function(a){this._detachWithIME=a},getDetachWithIME:function(){return this._detachWithIME},setInsertText:function(a){this._insertText= a},getInsertText:function(){return this._insertText},setDeleteBackward:function(a){this._deleteBackward=a},getDeleteBackward:function(){return this._deleteBackward},onDraw:function(a){return!1}});ccui._TextFieldRenderer.create=function(a,b,c){var d=new ccui._TextFieldRenderer;return d&&d.initWithString("",b,c)?(a&&d.setPlaceHolder(a),d):null}; ccui.TextField=ccui.Widget.extend({_textFieldRenderer:null,_touchWidth:0,_touchHeight:0,_useTouchArea:!1,_textFieldEventListener:null,_textFieldEventSelector:null,_passwordStyleText:"",_textFieldRendererAdaptDirty:!0,_fontName:"",_fontSize:12,_ccEventCallback:null,ctor:function(a,b,c){ccui.Widget.prototype.ctor.call(this);this.setTouchEnabled(!0);b&&this.setFontName(b);c&&this.setFontSize(c);a&&this.setPlaceHolder(a)},onEnter:function(){ccui.Widget.prototype.onEnter.call(this);this.scheduleUpdate()}, _initRenderer:function(){this._textFieldRenderer=ccui._TextFieldRenderer.create("input words here","Thonburi",20);this.addProtectedChild(this._textFieldRenderer,ccui.TextField.RENDERER_ZORDER,-1)},setTouchSize:function(a){this._touchWidth=a.width;this._touchHeight=a.height},setTouchAreaEnabled:function(a){this._useTouchArea=a},hitTest:function(a){if(this._useTouchArea){a=this.convertToNodeSpace(a);var b=cc.rect(-this._touchWidth*this._anchorPoint.x,-this._touchHeight*this._anchorPoint.y,this._touchWidth, this._touchHeight);return a.x>=b.x&&a.x<=b.x+b.width&&a.y>=b.y&&a.y<=b.y+b.height}return ccui.Widget.prototype.hitTest.call(this,a)},getTouchSize:function(){return cc.size(this._touchWidth,this._touchHeight)},setText:function(a){cc.log("Please use the setString");this.setString(a)},setString:function(a){null!=a&&(a=String(a),this.isMaxLengthEnabled()&&(a=a.substr(0,this.getMaxLength())),this.isPasswordEnabled()?(this._textFieldRenderer.setPasswordText(a),this._textFieldRenderer.setString(""),this._textFieldRenderer.insertText(a, a.length)):this._textFieldRenderer.setString(a),this._textFieldRendererAdaptDirty=!0,this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize()))},setPlaceHolder:function(a){this._textFieldRenderer.setPlaceHolder(a);this._textFieldRendererAdaptDirty=!0;this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize())},getPlaceHolder:function(){return this._textFieldRenderer.getPlaceHolder()},getPlaceHolderColor:function(){return this._textFieldRenderer.getPlaceHolderColor()}, setPlaceHolderColor:function(a){this._textFieldRenderer.setColorSpaceHolder(a)},setTextColor:function(a){this._textFieldRenderer.setTextColor(a)},setFontSize:function(a){this._textFieldRenderer.setFontSize(a);this._fontSize=a;this._textFieldRendererAdaptDirty=!0;this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize())},getFontSize:function(){return this._fontSize},setFontName:function(a){this._textFieldRenderer.setFontName(a);this._fontName=a;this._textFieldRendererAdaptDirty= !0;this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize())},getFontName:function(){return this._fontName},didNotSelectSelf:function(){this._textFieldRenderer.detachWithIME()},getStringValue:function(){cc.log("Please use the getString");return this.getString()},getString:function(){return this._textFieldRenderer.getString()},getStringLength:function(){return this._textFieldRenderer.getStringLength()},onTouchBegan:function(a,b){var c=this,d=ccui.Widget.prototype.onTouchBegan.call(c, a,b);c._hit?setTimeout(function(){c._textFieldRenderer.attachWithIME()},0):setTimeout(function(){c._textFieldRenderer.detachWithIME()},0);return d},setMaxLengthEnabled:function(a){this._textFieldRenderer.setMaxLengthEnabled(a)},isMaxLengthEnabled:function(){return this._textFieldRenderer.isMaxLengthEnabled()},setMaxLength:function(a){this._textFieldRenderer.setMaxLength(a);this.setString(this.getString())},getMaxLength:function(){return this._textFieldRenderer.getMaxLength()},setPasswordEnabled:function(a){this._textFieldRenderer.setPasswordEnabled(a)}, isPasswordEnabled:function(){return this._textFieldRenderer.isPasswordEnabled()},setPasswordStyleText:function(a){this._textFieldRenderer.setPasswordStyleText(a);this._passwordStyleText=a;this.setString(this.getString())},getPasswordStyleText:function(){return this._passwordStyleText},update:function(a){this.getDetachWithIME()&&(this._detachWithIMEEvent(),this.setDetachWithIME(!1));this.getAttachWithIME()&&(this._attachWithIMEEvent(),this.setAttachWithIME(!1));this.getInsertText()&&(this._textFieldRendererAdaptDirty= !0,this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize()),this._insertTextEvent(),this.setInsertText(!1));this.getDeleteBackward()&&(this._textFieldRendererAdaptDirty=!0,this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize()),this._deleteBackwardEvent(),this.setDeleteBackward(!1))},getAttachWithIME:function(){return this._textFieldRenderer.getAttachWithIME()},setAttachWithIME:function(a){this._textFieldRenderer.setAttachWithIME(a)},getDetachWithIME:function(){return this._textFieldRenderer.getDetachWithIME()}, setDetachWithIME:function(a){this._textFieldRenderer.setDetachWithIME(a)},getInsertText:function(){return this._textFieldRenderer.getInsertText()},setInsertText:function(a){this._textFieldRenderer.setInsertText(a)},getDeleteBackward:function(){return this._textFieldRenderer.getDeleteBackward()},setDeleteBackward:function(a){this._textFieldRenderer.setDeleteBackward(a)},_attachWithIMEEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener, this,ccui.TextField.EVENT_ATTACH_WITH_IME):this._textFieldEventSelector(this,ccui.TextField.EVENT_ATTACH_WITH_IME));this._ccEventCallback&&this._ccEventCallback(this,ccui.TextField.EVENT_ATTACH_WITH_IME)},_detachWithIMEEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener,this,ccui.TextField.EVENT_DETACH_WITH_IME):this._textFieldEventSelector(this,ccui.TextField.EVENT_DETACH_WITH_IME));this._ccEventCallback&&this._ccEventCallback(this, ccui.TextField.EVENT_DETACH_WITH_IME)},_insertTextEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener,this,ccui.TextField.EVENT_INSERT_TEXT):this._textFieldEventSelector(this,ccui.TextField.EVENT_INSERT_TEXT));this._ccEventCallback&&this._ccEventCallback(this,ccui.TextField.EVENT_INSERT_TEXT)},_deleteBackwardEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener, this,ccui.TextField.EVENT_DELETE_BACKWARD):this._textFieldEventSelector(this,ccui.TextField.EVENT_DELETE_BACKWARD));this._ccEventCallback&&this._ccEventCallback(this,ccui.TextField.EVENT_DELETE_BACKWARD)},addEventListenerTextField:function(a,b){this.addEventListener(a,b)},addEventListener:function(a,b){this._textFieldEventSelector=a;this._textFieldEventListener=b},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._textFieldRendererAdaptDirty=!0},_adaptRenderers:function(){this._textFieldRendererAdaptDirty&& (this._textfieldRendererScaleChangedWithSize(),this._textFieldRendererAdaptDirty=!1)},_textfieldRendererScaleChangedWithSize:function(){this._ignoreSize||this._textFieldRenderer.setDimensions(this._contentSize);this._textFieldRenderer.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getAutoRenderSize:function(){var a=this._textFieldRenderer.getContentSize();this._ignoreSize||(this._textFieldRenderer.setDimensions(0,0),a=this._textFieldRenderer.getContentSize(),this._textFieldRenderer.setDimensions(this._contentSize.width, this._contentSize.height));return a},getVirtualRendererSize:function(){return this._textFieldRenderer.getContentSize()},getVirtualRenderer:function(){return this._textFieldRenderer},getDescription:function(){return"TextField"},attachWithIME:function(){this._textFieldRenderer.attachWithIME()},_createCloneInstance:function(){return new ccui.TextField},_copySpecialProperties:function(a){this.setString(a._textFieldRenderer.getString());this.setPlaceHolder(a.getString());this.setFontSize(a._textFieldRenderer.getFontSize()); this.setFontName(a._textFieldRenderer.getFontName());this.setMaxLengthEnabled(a.isMaxLengthEnabled());this.setMaxLength(a.getMaxLength());this.setPasswordEnabled(a.isPasswordEnabled());this.setPasswordStyleText(a._passwordStyleText);this.setAttachWithIME(a.getAttachWithIME());this.setDetachWithIME(a.getDetachWithIME());this.setInsertText(a.getInsertText());this.setDeleteBackward(a.getDeleteBackward());this._ccEventCallback=a._ccEventCallback;this._textFieldEventListener=a._textFieldEventListener; this._textFieldEventSelector=a._textFieldEventSelector},setTextAreaSize:function(a){this.setContentSize(a)},setTextHorizontalAlignment:function(a){this._textFieldRenderer.setHorizontalAlignment(a)},setTextVerticalAlignment:function(a){this._textFieldRenderer.setVerticalAlignment(a)},_setFont:function(a){this._textFieldRenderer._setFont(a);this._textFieldRendererAdaptDirty=!0},_getFont:function(){return this._textFieldRenderer._getFont()},_changePosition:function(){this._adaptRenderers()}}); ccui.TextField.create=function(a,b,c){return new ccui.TextField(a,b,c)};_p=ccui.TextField.prototype;cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);cc.defineGetterSetter(_p,"placeHolder",_p.getPlaceHolder,_p.setPlaceHolder);cc.defineGetterSetter(_p,"font",_p._getFont,_p._setFont);cc.defineGetterSetter(_p,"fontSize",_p.getFontSize,_p.setFontSize);cc.defineGetterSetter(_p,"fontName",_p.getFontName,_p.setFontName);cc.defineGetterSetter(_p,"maxLengthEnabled",_p.isMaxLengthEnabled,_p.setMaxLengthEnabled); cc.defineGetterSetter(_p,"maxLength",_p.getMaxLength,_p.setMaxLength);cc.defineGetterSetter(_p,"passwordEnabled",_p.isPasswordEnabled,_p.setPasswordEnabled);_p=null;ccui.TextField.EVENT_ATTACH_WITH_IME=0;ccui.TextField.EVENT_DETACH_WITH_IME=1;ccui.TextField.EVENT_INSERT_TEXT=2;ccui.TextField.EVENT_DELETE_BACKWARD=3;ccui.TextField.RENDERER_ZORDER=-1;ccui.VideoPlayer=ccui.Widget.extend({_played:!1,_playing:!1,_stopped:!0,ctor:function(a){ccui.Widget.prototype.ctor.call(this);this._EventList={};a&&this.setURL(a)},_createRenderCmd:function(){return new ccui.VideoPlayer.RenderCmd(this)},visit:function(){var a=this._renderCmd,b=cc.container,c=cc.eventManager;if(this._visible)b.appendChild(a._video),null===this._listener&&(this._listener=cc.eventManager.addCustomListener(cc.game.EVENT_RESIZE,function(){a.resize()}));else{var d=!1;(d="contains"in b? b.contains(a._video):b.compareDocumentPosition(a._video)%16)&&b.removeChild(a._video);c.removeListener(a._listener);a._listener=null}a.updateStatus();a.resize()},setURL:function(a){this._renderCmd.updateURL(a)},getURL:function(){return this._renderCmd._url},play:function(){var a=this,b=this._renderCmd._video;if(b){this._played=!0;b.pause();if(!1!==this._stopped||!1!==this._playing||!0!==this._played)b.currentTime=0;ccui.VideoPlayer._polyfill.autoplayAfterOperation?setTimeout(function(){b.play();a._playing= !0;a._stopped=!1},20):(b.play(),this._playing=!0,this._stopped=!1)}},pause:function(){var a=this._renderCmd._video;a&&!0===this._playing&&!1===this._stopped&&(a.pause(),this._playing=!1)},resume:function(){!1===this._stopped&&!1===this._playing&&!0===this._played&&this.play()},stop:function(){var a=this,b=this._renderCmd._video;b&&(b.pause(),b.currentTime=0,this._playing=!1,this._stopped=!0);setTimeout(function(){a._dispatchEvent(ccui.VideoPlayer.EventType.STOPPED)},0)},seekTo:function(a){var b=this._renderCmd._video; b&&(b.currentTime=a,ccui.VideoPlayer._polyfill.autoplayAfterOperation&&this.isPlaying()&&setTimeout(function(){b.play()},20))},isPlaying:function(){ccui.VideoPlayer._polyfill.autoplayAfterOperation&&this._playing&&setTimeout(function(){video.play()},20);return this._playing},setKeepAspectRatioEnabled:function(a){cc.log("On the web is always keep the aspect ratio")},isKeepAspectRatioEnabled:function(){return!1},setFullScreenEnabled:function(a){var b=this._renderCmd._video;b&&(a?cc.screen.requestFullScreen(b): cc.screen.exitFullScreen(b))},isFullScreenEnabled:function(){cc.log("Can't know status")},setEventListener:function(a,b){this._EventList[a]=b},removeEventListener:function(a){this._EventList[a]=null},_dispatchEvent:function(a){(a=this._EventList[a])&&a.call(this,this,this._renderCmd._video.src)},onPlayEvent:function(){var a=this._EventList[ccui.VideoPlayer.EventType.PLAYING];if(a)for(var b=0;b<a.length;b++)a[b].call(this,this,this._renderCmd._video.src)},setContentSize:function(a,b){ccui.Widget.prototype.setContentSize.call(this, a,b);void 0===b&&(b=a.height,a=a.width);this._renderCmd.changeSize(a,b)},cleanup:function(){this._renderCmd.removeDom();this.stopAllActions();this.unscheduleAllCallbacks()},onEnter:function(){ccui.Widget.prototype.onEnter.call(this);var a=ccui.VideoPlayer.elements;-1===a.indexOf(this)&&a.push(this)},onExit:function(){ccui.Widget.prototype.onExit.call(this);var a=ccui.VideoPlayer.elements,b=a.indexOf(this);-1!==b&&a.splice(b,1)}});ccui.VideoPlayer.elements=[];ccui.VideoPlayer.pauseElements=[]; cc.eventManager.addCustomListener(cc.game.EVENT_HIDE,function(){for(var a=ccui.VideoPlayer.elements,b,c=0;c<a.length;c++)b=a[c],a[c]._playing&&(b.pause(),ccui.VideoPlayer.pauseElements.push(b))});cc.eventManager.addCustomListener(cc.game.EVENT_SHOW,function(){for(var a=ccui.VideoPlayer.pauseElements,b=a.pop();b;)b.play(),b=a.pop()});ccui.VideoPlayer.EventType={PLAYING:"play",PAUSED:"pause",STOPPED:"stop",COMPLETED:"complete"}; (function(a){a._polyfill={devicePixelRatio:!1,event:"canplay",canPlayType:[]};var b=document.createElement("video");b.canPlayType("video/ogg")&&(a._polyfill.canPlayType.push(".ogg"),a._polyfill.canPlayType.push(".ogv"));b.canPlayType("video/mp4")&&a._polyfill.canPlayType.push(".mp4");b.canPlayType("video/webm")&&a._polyfill.canPlayType.push(".webm");cc.sys.OS_IOS===cc.sys.os&&(a._polyfill.devicePixelRatio=!0,a._polyfill.event="progress");cc.sys.browserType===cc.sys.BROWSER_TYPE_FIREFOX&&(a._polyfill.autoplayAfterOperation= !0);a=document.createElement("style");a.innerHTML=".cocosVideo:-moz-full-screen{transform:matrix(1,0,0,1,0,0) !important;}.cocosVideo:full-screen{transform:matrix(1,0,0,1,0,0) !important;}.cocosVideo:-webkit-full-screen{transform:matrix(1,0,0,1,0,0) !important;}";document.head.appendChild(a)})(ccui.VideoPlayer); (function(a){var b=null,b=cc._renderType===cc.game.RENDER_TYPE_WEBGL?cc.Node.WebGLRenderCmd:cc.Node.CanvasRenderCmd;ccui.VideoPlayer.RenderCmd=function(a){this._rootCtor(a);this._listener=null;this._url="";this.initStyle()};b=ccui.VideoPlayer.RenderCmd.prototype=Object.create(b.prototype);b.constructor=ccui.VideoPlayer.RenderCmd;b.transform=function(a,b){this.originTransform(a,b);this.updateMatrix(this._worldTransform,cc.view._scaleX,cc.view._scaleY)};b.updateStatus=function(){a.devicePixelRatio= cc.view.isRetinaEnabled();var b=cc.Node._dirtyFlags,d=this._dirtyFlag;d&b.transformDirty&&(this.transform(this.getParentRenderCmd(),!0),this.updateMatrix(this._worldTransform,cc.view._scaleX,cc.view._scaleY),this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.transformDirty);d&b.orderDirty&&(this._dirtyFlag^=this._dirtyFlag&b.orderDirty)};b.resize=function(a){a=a||cc.view;var b=this._node,e=cc.eventManager;b._parent&&b._visible?this.updateMatrix(this._worldTransform,a._scaleX,a._scaleY):(e.removeListener(this._listener), this._listener=null)};b.updateMatrix=function(b,d,e){var f=this._node;if(a.devicePixelRatio){var g=cc.view.getDevicePixelRatio();d/=g;e/=g}if(!1!==this._loaded){var h=cc.game.container.style,g=parseInt(h.paddingLeft),h=parseInt(h.paddingBottom),k=f._contentSize.width,m=f._contentSize.height;b="matrix("+b.a*d+","+b.b+","+b.c+","+b.d*e+","+(g+b.tx*d-k/2+k*f._scaleX/2*d)+","+-(h+b.ty*e-m/2+m*f._scaleY/2*e)+")";this._video.style.transform=b;this._video.style["-webkit-transform"]=b}};b.updateURL=function(b){var d, e,f,g=this._node;if(this._url!=b){this._url=b;cc.loader.resPath&&!/^http/.test(b)&&(b=cc.path.join(cc.loader.resPath,b));d=!1;f=cc.container;(d="contains"in f?f.contains(this._video):f.compareDocumentPosition(this._video)%16)&&f.removeChild(this._video);e=this._video=document.createElement("video");this.bindEvent();var h=this,k=function(){!0!=h._loaded&&(h._loaded=!0,h.changeSize(),h.setDirtyFlag(cc.Node._dirtyFlags.transformDirty),e.removeEventListener(a.event,k),e.currentTime=0,e.style.visibility= "visible",e.play(),g._played||(e.pause(),e.currentTime=0))};e.addEventListener(a.event,k);e.preload="metadata";e.style.visibility="hidden";this._loaded=!1;g._played=!1;g._playing=!1;g._stopped=!0;this.initStyle();this._node.visit();d=document.createElement("source");d.src=b;e.appendChild(d);f=cc.path.extname(b);for(var m=0;m<a.canPlayType.length;m++)f!==a.canPlayType[m]&&(d=document.createElement("source"),d.src=b.replace(f,a.canPlayType[m]),e.appendChild(d))}};b.bindEvent=function(){var a=this,b= this._node,e=this._video;e.addEventListener("ended",function(){b._renderCmd.updateMatrix(a._worldTransform,cc.view._scaleX,cc.view._scaleY);b._playing=!1;b._dispatchEvent(ccui.VideoPlayer.EventType.COMPLETED)});e.addEventListener("play",function(){b._dispatchEvent(ccui.VideoPlayer.EventType.PLAYING)});e.addEventListener("pause",function(){b._dispatchEvent(ccui.VideoPlayer.EventType.PAUSED)})};b.initStyle=function(){if(this._video){var a=this._video;a.style.position="absolute";a.style.bottom="0px"; a.style.left="0px";a.className="cocosVideo"}};b.changeSize=function(a,b){var e=this._node._contentSize;a=a||e.width;b=b||e.height;if(e=this._video)0!==a&&(e.width=a),0!==b&&(e.height=b)};b.removeDom=function(){var a=this._video;if(a){var b=!1;(b="contains"in cc.container?cc.container.contains(a):cc.container.compareDocumentPosition(a)%16)&&cc.container.removeChild(a)}}})(ccui.VideoPlayer._polyfill);ccui.RichElement=ccui.Class.extend({_type:0,_tag:0,_color:null,_opacity:0,ctor:function(a,b,c){this._type=0;this._tag=a||0;this._color=cc.color(255,255,255,255);b&&(this._color.r=b.r,this._color.g=b.g,this._color.b=b.b);this._opacity=c||0;this._color.a=void 0===c?b.a:c}}); ccui.RichElementText=ccui.RichElement.extend({_text:"",_fontName:"",_fontSize:0,_fontDefinition:null,ctor:function(a,b,c,d,e,f){var g=b;b&&b instanceof cc.FontDefinition&&(g=b.fillStyle,e=b.fontName,f=b.fontSize,this._fontDefinition=b);ccui.RichElement.prototype.ctor.call(this,a,g,c);this._type=ccui.RichElement.TEXT;this._text=d;this._fontName=e;this._fontSize=f}});ccui.RichElementText.create=function(a,b,c,d,e,f){return new ccui.RichElementText(a,b,c,d,e,f)}; ccui.RichElementImage=ccui.RichElement.extend({_filePath:"",_textureRect:null,_textureType:0,ctor:function(a,b,c,d){ccui.RichElement.prototype.ctor.call(this,a,b,c);this._type=ccui.RichElement.IMAGE;this._filePath=d||"";this._textureRect=cc.rect(0,0,0,0);this._textureType=0}});ccui.RichElementImage.create=function(a,b,c,d){return new ccui.RichElementImage(a,b,c,d)}; ccui.RichElementCustomNode=ccui.RichElement.extend({_customNode:null,ctor:function(a,b,c,d){ccui.RichElement.prototype.ctor.call(this,a,b,c);this._type=ccui.RichElement.CUSTOM;this._customNode=d||null}});ccui.RichElementCustomNode.create=function(a,b,c,d){return new ccui.RichElementCustomNode(a,b,c,d)}; ccui.RichText=ccui.Widget.extend({_formatTextDirty:!1,_richElements:null,_elementRenders:null,_leftSpaceWidth:0,_verticalSpace:0,_elementRenderersContainer:null,_lineBreakOnSpace:!1,_textHorizontalAlignment:null,_textVerticalAlignment:null,ctor:function(){ccui.Widget.prototype.ctor.call(this);this._formatTextDirty=!1;this._richElements=[];this._elementRenders=[];this._verticalSpace=this._leftSpaceWidth=0;this._textHorizontalAlignment=cc.TEXT_ALIGNMENT_LEFT;this._textVerticalAlignment=cc.VERTICAL_TEXT_ALIGNMENT_TOP}, _initRenderer:function(){this._elementRenderersContainer=new cc.Node;this._elementRenderersContainer.setAnchorPoint(0.5,0.5);this.addProtectedChild(this._elementRenderersContainer,0,-1)},insertElement:function(a,b){this._richElements.splice(b,0,a);this._formatTextDirty=!0},pushBackElement:function(a){this._richElements.push(a);this._formatTextDirty=!0},removeElement:function(a){cc.isNumber(a)?this._richElements.splice(a,1):cc.arrayRemoveObject(this._richElements,a);this._formatTextDirty=!0},formatText:function(){if(this._formatTextDirty){this._elementRenderersContainer.removeAllChildren(); this._elementRenders.length=0;var a,b,c=this._richElements;if(this._ignoreSize)for(this._addNewLine(),a=0;a<c.length;a++){b=c[a];var d=null;switch(b._type){case ccui.RichElement.TEXT:d=b._fontDefinition?new cc.LabelTTF(b._text,b._fontDefinition):new cc.LabelTTF(b._text,b._fontName,b._fontSize);break;case ccui.RichElement.IMAGE:d=new cc.Sprite(b._filePath);break;case ccui.RichElement.CUSTOM:d=b._customNode}d.setColor(b._color);d.setOpacity(b._color.a);this._pushToContainer(d)}else for(this._addNewLine(), a=0;a<c.length;a++)switch(b=c[a],b._type){case ccui.RichElement.TEXT:b._fontDefinition?this._handleTextRenderer(b._text,b._fontDefinition,b._fontDefinition.fontSize,b._fontDefinition.fillStyle):this._handleTextRenderer(b._text,b._fontName,b._fontSize,b._color);break;case ccui.RichElement.IMAGE:this._handleImageRenderer(b._filePath,b._color,b._color.a);break;case ccui.RichElement.CUSTOM:this._handleCustomRenderer(b._customNode)}this.formatRenderers();this._formatTextDirty=!1}},_handleTextRenderer:function(a, b,c,d){if(""!==a)if("\n"===a)this._addNewLine();else{var e=b instanceof cc.FontDefinition?new cc.LabelTTF(a,b):new cc.LabelTTF(a,b,c),f=e.getContentSize().width;this._leftSpaceWidth-=f;if(0>this._leftSpaceWidth){var e=a.length*(1- -this._leftSpaceWidth/f),f=a.substr(0,e),g=a.substr(e,a.length-1),h=0<e;this._lineBreakOnSpace&&(g=f.lastIndexOf(" "),e=-1===g?e:g+1,g=a.substr(e,a.length-1),h=0<e&&" "!==g);h&&(a=null,b instanceof cc.FontDefinition?(a=new cc.LabelTTF(f.substr(0,e),b),a.setOpacity(b.fillStyle.a)): (a=new cc.LabelTTF(f.substr(0,e),b,c),a.setColor(d),a.setOpacity(d.a)),this._pushToContainer(a));this._addNewLine();this._handleTextRenderer(g,b,c,d)}else b instanceof cc.FontDefinition?e.setOpacity(b.fillStyle.a):(e.setColor(d),e.setOpacity(d.a)),this._pushToContainer(e)}},_handleImageRenderer:function(a,b,c){a=new cc.Sprite(a);this._handleCustomRenderer(a)},_handleCustomRenderer:function(a){var b=a.getContentSize();this._leftSpaceWidth-=b.width;0>this._leftSpaceWidth?(this._addNewLine(),this._pushToContainer(a), this._leftSpaceWidth-=b.width):this._pushToContainer(a)},_addNewLine:function(){this._leftSpaceWidth=this._customSize.width;this._elementRenders.push([])},formatRenderers:function(){var a=0,b=this._elementRenderersContainer,c=this._elementRenders,d,e,f,g,h,k;if(this._ignoreSize){d=0;f=c[0];for(e=g=0;e<f.length;e++)h=f[e],h.setAnchorPoint(cc.p(0,0)),h.setPosition(g,0),b.addChild(h,1,e),k=h.getLineHeight?h.getLineHeight():a,h=h.getContentSize(),d+=h.width,a=Math.max(Math.min(a,k),h.height),g+=h.width; if(this._textHorizontalAlignment!==cc.TEXT_ALIGNMENT_LEFT)for(k=0,this._textHorizontalAlignment===cc.TEXT_ALIGNMENT_RIGHT?k=this._contentSize.width-g:this._textHorizontalAlignment===cc.TEXT_ALIGNMENT_CENTER&&(k=(this._contentSize.width-g)/2),e=0;e<f.length;e++)f[e].x+=k;b.setContentSize(d,a)}else{var m=[];for(d=0;d<c.length;d++){f=c[d];for(e=g=0;e<f.length;e++)h=f[e],k=h.getLineHeight?h.getLineHeight():h.getContentSize().height,g=Math.max(Math.min(h.getContentSize().height,k),g);m[d]=g;a+=m[d]}var n= this._customSize.height;for(d=0;d<c.length;d++){f=c[d];g=0;n-=m[d]+this._verticalSpace;for(e=0;e<f.length;e++)h=f[e],h.setAnchorPoint(cc.p(0,0)),h.setPosition(cc.p(g,n)),b.addChild(h,1),g+=h.getContentSize().width;if(this._textHorizontalAlignment!==cc.TEXT_ALIGNMENT_LEFT||this._textVerticalAlignment!==cc.VERTICAL_TEXT_ALIGNMENT_TOP)for(k=0,this._textHorizontalAlignment===cc.TEXT_ALIGNMENT_RIGHT?k=this._contentSize.width-g:this._textHorizontalAlignment===cc.TEXT_ALIGNMENT_CENTER&&(k=(this._contentSize.width- g)/2),g=0,this._textVerticalAlignment===cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM?g=this._customSize.height-a:this._textVerticalAlignment===cc.VERTICAL_TEXT_ALIGNMENT_CENTER&&(g=(this._customSize.height-a)/2),e=0;e<f.length;e++)h=f[e],h.x+=k,h.y-=g}b.setContentSize(this._contentSize)}a=c.length;for(d=0;d<a;d++)c[d].length=0;this._elementRenders.length=0;this.setContentSize(this._ignoreSize?this.getVirtualRendererSize():this._customSize);this._updateContentSizeWithTextureSize(this._contentSize);b.setPosition(0.5* this._contentSize.width,0.5*this._contentSize.height)},_pushToContainer:function(a){0>=this._elementRenders.length||this._elementRenders[this._elementRenders.length-1].push(a)},_adaptRenderers:function(){this.formatText()},setVerticalSpace:function(a){this._verticalSpace=a},setAnchorPoint:function(a){ccui.Widget.prototype.setAnchorPoint.call(this,a);this._elementRenderersContainer.setAnchorPoint(a)},_setAnchorX:function(a){ccui.Widget.prototype._setAnchorX.call(this,a);this._elementRenderersContainer._setAnchorX(a)}, _setAnchorY:function(a){ccui.Widget.prototype._setAnchorY.call(this,a);this._elementRenderersContainer._setAnchorY(a)},getVirtualRendererSize:function(){return this._elementRenderersContainer.getContentSize()},ignoreContentAdaptWithSize:function(a){this._ignoreSize!==a&&(this._formatTextDirty=!0,ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,a))},getContentSize:function(){this.formatText();return cc.Node.prototype.getContentSize.call(this)},_getWidth:function(){this.formatText();return cc.Node.prototype._getWidth.call(this)}, _getHeight:function(){this.formatText();return cc.Node.prototype._getHeight.call(this)},setContentSize:function(a,b){ccui.Widget.prototype.setContentSize.call(this,void 0===b?a.width:a,void 0===b?a.height:b);this._formatTextDirty=!0},getDescription:function(){return"RichText"},setCascadeOpacityEnabled:function(a){ccui.Widget.prototype.setCascadeOpacityEnabled.call(this,a);this._elementRenderersContainer.setCascadeOpacityEnabled(a)},setLineBreakOnSpace:function(a){this._lineBreakOnSpace=a;this._formatTextDirty= !0;this.formatText()},setTextHorizontalAlignment:function(a){a!==this._textHorizontalAlignment&&(this._textHorizontalAlignment=a,this.formatText())},setTextVerticalAlignment:function(a){a!==this._textVerticalAlignment&&(this._textVerticalAlignment=a,this.formatText())}});ccui.RichText.create=function(){return new ccui.RichText};ccui.RichElement.TEXT=0;ccui.RichElement.IMAGE=1;ccui.RichElement.CUSTOM=2;ccui.WebView=ccui.Widget.extend({ctor:function(a){ccui.Widget.prototype.ctor.call(this);this._EventList={};a&&this.loadURL(a)},visit:function(){var a=this._renderCmd,b=a._div,c=cc.container,d=cc.eventManager;if(this._visible)c.appendChild(b),null===this._listener&&(this._listener=d.addCustomListener(cc.game.EVENT_RESIZE,function(){a.resize()}));else{var e=!1;(e="contains"in c?c.contains(b):c.compareDocumentPosition(b)%16)&&c.removeChild(b);b=d._listenersMap[cc.game.EVENT_RESIZE].getFixedPriorityListeners(); d._removeListenerInVector(b,a._listener);a._listener=null}a.updateStatus();a.resize(cc.view)},setJavascriptInterfaceScheme:function(a){},loadData:function(a,b,c,d){},loadHTMLString:function(a,b){},loadURL:function(a){this._renderCmd.updateURL(a);this._dispatchEvent(ccui.WebView.EventType.LOADING)},stopLoading:function(){cc.log("Web does not support loading")},reload:function(){var a=this._renderCmd._iframe;a&&(a=a.contentWindow)&&a.location&&a.location.reload()},canGoBack:function(){cc.log("Web does not support query history"); return!0},canGoForward:function(){cc.log("Web does not support query history");return!0},goBack:function(){try{if(ccui.WebView._polyfill.closeHistory)return cc.log("The current browser does not support the GoBack");var a=this._renderCmd._iframe;if(a){var b=a.contentWindow;if(b&&b.location)try{b.history.back.call(b)}catch(c){b.history.back()}}}catch(d){cc.log(d)}},goForward:function(){try{if(ccui.WebView._polyfill.closeHistory)return cc.log("The current browser does not support the GoForward");var a= this._renderCmd._iframe;if(a){var b=a.contentWindow;if(b&&b.location)try{b.history.forward.call(b)}catch(c){b.history.forward()}}}catch(d){cc.log(d)}},evaluateJS:function(a){var b=this._renderCmd._iframe;if(b){b=b.contentWindow;try{b.eval(a),this._dispatchEvent(ccui.WebView.EventType.JS_EVALUATED)}catch(c){console.error(c)}}},setScalesPageToFit:function(){cc.log("Web does not support zoom")},setEventListener:function(a,b){this._EventList[a]=b},removeEventListener:function(a){this._EventList[a]=null}, _dispatchEvent:function(a){(a=this._EventList[a])&&a.call(this,this,this._renderCmd._iframe.src)},_createRenderCmd:function(){return new ccui.WebView.RenderCmd(this)},setContentSize:function(a,b){ccui.Widget.prototype.setContentSize.call(this,a,b);void 0===b&&(b=a.height,a=a.width);this._renderCmd.changeSize(a,b)},cleanup:function(){this._renderCmd.removeDom();this.stopAllActions();this.unscheduleAllCallbacks()}});ccui.WebView.EventType={LOADING:"loading",LOADED:"load",ERROR:"error",JS_EVALUATED:"js"}; (function(){var a=ccui.WebView._polyfill={devicePixelRatio:!1,enableDiv:!1};cc.sys.os===cc.sys.OS_IOS&&(a.enableDiv=!0);cc.sys.isMobile?cc.sys.browserType===cc.sys.BROWSER_TYPE_FIREFOX&&(a.enableBG=!0):cc.sys.browserType===cc.sys.BROWSER_TYPE_IE&&(a.closeHistory=!0)})(); (function(a){var b=null,b=cc._renderType===cc.game.RENDER_TYPE_WEBGL?cc.Node.WebGLRenderCmd:cc.Node.CanvasRenderCmd;ccui.WebView.RenderCmd=function(b){this._rootCtor(b);this._iframe=this._div=null;a.enableDiv?(this._div=document.createElement("div"),this._div.style["-webkit-overflow"]="auto",this._div.style["-webkit-overflow-scrolling"]="touch",this._iframe=document.createElement("iframe"),this._iframe.style.width="100%",this._iframe.style.height="100%",this._div.appendChild(this._iframe)):this._div= this._iframe=document.createElement("iframe");a.enableBG&&(this._div.style.background="#FFF");this._iframe.addEventListener("load",function(){b._dispatchEvent(ccui.WebView.EventType.LOADED)});this._iframe.addEventListener("error",function(){b._dispatchEvent(ccui.WebView.EventType.ERROR)});this._div.style.background="#FFF";this._div.style.height="200px";this._div.style.width="300px";this._div.style.overflow="scroll";this._div.style.border="none";this._listener=null;this.initStyle()};b=ccui.WebView.RenderCmd.prototype= Object.create(b.prototype);b.constructor=ccui.WebView.RenderCmd;b.transform=function(a,b){this.originTransform(a,b);this.updateMatrix(this._worldTransform,cc.view._scaleX,cc.view._scaleY)};b.updateStatus=function(){a.devicePixelRatio=cc.view.isRetinaEnabled();var b=cc.Node._dirtyFlags,d=this._dirtyFlag;d&b.transformDirty&&(this.transform(this.getParentRenderCmd(),!0),this.updateMatrix(this._worldTransform,cc.view._scaleX,cc.view._scaleY),this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.transformDirty); d&b.orderDirty&&(this._dirtyFlag^=this._dirtyFlag&b.orderDirty)};b.resize=function(a){a=a||cc.view;var b=this._node,e=cc.eventManager;b._parent&&b._visible?this.updateMatrix(this._worldTransform,a._scaleX,a._scaleY):(a=e._listenersMap[cc.game.EVENT_RESIZE].getFixedPriorityListeners(),e._removeListenerInVector(a,this._listener),this._listener=null)};b.updateMatrix=function(b,d,e){var f=this._node;if(a.devicePixelRatio){var g=cc.view.getDevicePixelRatio();d/=g;e/=g}if(!1!==this._loaded){var h=cc.game.container.style, g=parseInt(h.paddingLeft),h=parseInt(h.paddingBottom),k=f._contentSize.width,m=f._contentSize.height;b="matrix("+b.a*d+","+b.b+","+b.c+","+b.d*e+","+(g+b.tx*d-k/2+k*f._scaleX/2*d)+","+-(h+b.ty*e-m/2+m*f._scaleY/2*e)+")";this._div.style.transform=b;this._div.style["-webkit-transform"]=b}};b.initStyle=function(){if(this._div){var a=this._div;a.style.position="absolute";a.style.bottom="0px";a.style.left="0px"}};b.updateURL=function(a){var b=this._iframe;b.src=a;var e=this,f=function(){e._loaded=!0;b.removeEventListener("load", f)};b.addEventListener("load",f)};b.changeSize=function(a,b){var e=this._div;e&&(e.style.width=a+"px",e.style.height=b+"px")};b.removeDom=function(){var a=this._div;if(a){var b=!1;(b="contains"in cc.container?cc.container.contains(a):cc.container.compareDocumentPosition(a)%16)&&cc.container.removeChild(a)}}})(ccui.WebView._polyfill);ccui.ScrollViewBar=ccui.ProtectedNode.extend({_parentScroll:null,_direction:null,_upperHalfCircle:null,_lowerHalfCircle:null,_body:null,_opacity:255,_marginFromBoundary:0,_marginForLength:0,_touching:!1,_autoHideEnabled:!0,autoHideTime:0,_autoHideRemainingTime:0,_className:"ScrollViewBar",ctor:function(a,b){cc.ProtectedNode.prototype.ctor.call(this);this._direction=b;this._parentScroll=a;this._marginForLength=this._marginFromBoundary=ccui.ScrollViewBar.DEFAULT_MARGIN;this.opacity=255*ccui.ScrollViewBar.DEFAULT_SCROLLBAR_OPACITY; this.autoHideTime=ccui.ScrollViewBar.DEFAULT_AUTO_HIDE_TIME;this._autoHideEnabled=!0;ccui.ScrollViewBar.prototype.init.call(this);this.setCascadeColorEnabled(!0);this.setCascadeOpacityEnabled(!0)},init:function(){this._upperHalfCircle=ccui.helper._createSpriteFromBase64(ccui.ScrollViewBar.HALF_CIRCLE_IMAGE,ccui.ScrollViewBar.HALF_CIRCLE_IMAGE_KEY);this._upperHalfCircle.setAnchorPoint(cc.p(0.5,0));this._lowerHalfCircle=ccui.helper._createSpriteFromBase64(ccui.ScrollViewBar.HALF_CIRCLE_IMAGE,ccui.ScrollViewBar.HALF_CIRCLE_IMAGE_KEY); this._lowerHalfCircle.setAnchorPoint(cc.p(0.5,0));this._lowerHalfCircle.setScaleY(-1);this.addProtectedChild(this._upperHalfCircle);this.addProtectedChild(this._lowerHalfCircle);this._body=ccui.helper._createSpriteFromBase64(ccui.ScrollViewBar.BODY_IMAGE_1_PIXEL_HEIGHT,ccui.ScrollViewBar.BODY_IMAGE_1_PIXEL_HEIGHT_KEY);this._body.setAnchorPoint(cc.p(0.5,0));this.addProtectedChild(this._body);this.setColor(ccui.ScrollViewBar.DEFAULT_COLOR);this.onScrolled(cc.p(0,0));cc.ProtectedNode.prototype.setOpacity.call(this, 0);this._autoHideRemainingTime=0;this._direction===ccui.ScrollView.DIR_HORIZONTAL&&this.setRotation(90)},setPositionFromCorner:function(a){this._direction===ccui.ScrollView.DIR_VERTICAL?(this._marginForLength=a.y,this._marginFromBoundary=a.x):(this._marginForLength=a.x,this._marginFromBoundary=a.y)},onEnter:function(){cc.ProtectedNode.prototype.onEnter.call(this);this.scheduleUpdate()},getPositionFromCorner:function(){return this._direction===ccui.ScrollView.DIR_VERTICAL?cc.p(this._marginFromBoundary, this._marginForLength):cc.p(this._marginForLength,this._marginFromBoundary)},setWidth:function(a){a/=this._body.width;this._body.setScaleX(a);this._upperHalfCircle.setScale(a);this._lowerHalfCircle.setScale(-a)},getWidth:function(){return this._body.getBoundingBox().width},setAutoHideEnabled:function(a){this._autoHideEnabled=a;!this._autoHideEnabled&&!this._touching&&0>=this._autoHideRemainingTime?cc.ProtectedNode.prototype.setOpacity.call(this,this.opacity):cc.ProtectedNode.prototype.setOpacity.call(this, 0)},isAutoHideEnabled:function(){return this._autoHideEnabled},setOpacity:function(a){this._opacity=a},getOpacity:function(){return this._opacity},_updateLength:function(a){var b=a/this._body.getTextureRect().height;this._body.setScaleY(b);this._upperHalfCircle.setPositionY(this._body.getPositionY()+a)},_processAutoHide:function(a){!this._autoHideEnabled||0>=this._autoHideRemainingTime||this._touching||(this._autoHideRemainingTime-=a,this._autoHideRemainingTime<=this.autoHideTime&&(this._autoHideRemainingTime= Math.max(0,this._autoHideRemainingTime),cc.ProtectedNode.prototype.setOpacity.call(this,this._autoHideRemainingTime/this.autoHideTime*this._opacity)))},update:function(a){this._processAutoHide(a)},onTouchBegan:function(){this._autoHideEnabled&&(this._touching=!0)},onTouchEnded:function(){this._autoHideEnabled&&(this._touching=!1,0>=this._autoHideRemainingTime||(this._autoHideRemainingTime=this.autoHideTime))},onScrolled:function(a){this._autoHideEnabled&&(this._autoHideRemainingTime=this.autoHideTime, cc.ProtectedNode.prototype.setOpacity.call(this,this.opacity));var b=this._parentScroll.getInnerContainer(),c=0,d=0,e=0,f=0;this._direction===ccui.ScrollView.DIR_VERTICAL?(c=b.height,d=this._parentScroll.height,e=a.y,f=-b.getPositionY()):this._direction===ccui.ScrollView.DIR_HORIZONTAL&&(c=b.width,d=this._parentScroll.width,e=a.x,f=-b.getPositionX());a=this._calculateLength(c,d,e);c=this._calculatePosition(c,d,f,e,a);this._updateLength(a);this.setPosition(c)},_calculateLength:function(a,b,c){0!== c&&(a+=20*(0<c?c:-c));c=b/a;return Math.abs(b-2*this._marginForLength)*c},_calculatePosition:function(a,b,c,d,e){a-=b;0!==d&&(a+=Math.abs(d));d=0;0!==a&&(d=Math.max(c/a,0),d=Math.min(d,1));b=(b-e-2*this._marginForLength)*d+this._marginForLength;return this._direction===ccui.ScrollView.DIR_VERTICAL?cc.p(this._parentScroll.width-this._marginFromBoundary,b):cc.p(b,this._marginFromBoundary)}});_p=ccui.ScrollViewBar.prototype;cc.defineGetterSetter(_p,"opacity",_p.getOpacity,_p.setOpacity); cc.defineGetterSetter(_p,"autoHideEnabled",_p.isAutoHideEnabled,_p.setAutoHideEnabled);ccui.ScrollViewBar.DEFAULT_COLOR=cc.color(52,65,87);ccui.ScrollViewBar.DEFAULT_MARGIN=20;ccui.ScrollViewBar.DEFAULT_AUTO_HIDE_TIME=0.2;ccui.ScrollViewBar.DEFAULT_SCROLLBAR_OPACITY=0.4;ccui.ScrollViewBar.HALF_CIRCLE_IMAGE_KEY="/__half_circle_image";ccui.ScrollViewBar.HALF_CIRCLE_IMAGE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAGCAMAAADAMI+zAAAAJ1BMVEX///////////////////////////////////////////////////9Ruv0SAAAADHRSTlMABgcbbW7Hz9Dz+PmlcJP5AAAAMElEQVR4AUXHwQ2AQAhFwYcLH1H6r1djzDK3ASxUpTBeK/uTCyz7dx54b44m4p5cD1MwAooEJyk3AAAAAElFTkSuQmCC"; ccui.ScrollViewBar.BODY_IMAGE_1_PIXEL_HEIGHT_KEY="/__body_image_height";ccui.ScrollViewBar.BODY_IMAGE_1_PIXEL_HEIGHT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAABCAMAAADdNb8LAAAAA1BMVEX///+nxBvIAAAACklEQVR4AWNABgAADQABYc2cpAAAAABJRU5ErkJggg\x3d\x3d";ccui.ScrollView=ccui.Layout.extend({_innerContainer:null,_direction:null,_topBoundary:0,_bottomBoundary:0,_leftBoundary:0,_rightBoundary:0,_touchMoveDisplacements:null,_touchMoveTimeDeltas:null,_touchMovePreviousTimestamp:0,_touchTotalTimeThreshold:0.5,_autoScrolling:!1,_autoScrollTargetDelta:null,_autoScrollAttenuate:!0,_autoScrollStartPosition:null,_autoScrollTotalTime:0,_autoScrollAccumulatedTime:0,_autoScrollCurrentlyOutOfBoundary:!1,_autoScrollBraking:!1,_autoScrollBrakingStartPosition:null, _bePressed:!1,_childFocusCancelOffset:0,bounceEnabled:!1,_outOfBoundaryAmount:null,_outOfBoundaryAmountDirty:!0,inertiaScrollEnabled:!1,_scrollBarEnabled:!0,_verticalScrollBar:null,_horizontalScrollBar:null,_scrollViewEventListener:null,_scrollViewEventSelector:null,_className:"ScrollView",ctor:function(){ccui.Layout.prototype.ctor.call(this);this.setClippingEnabled(!0);this._innerContainer.setTouchEnabled(!1);this._direction=ccui.ScrollView.DIR_NONE;this._childFocusCancelOffset=5;this.inertiaScrollEnabled= !0;this._outOfBoundaryAmount=cc.p(0,0);this._autoScrollTargetDelta=cc.p(0,0);this._autoScrollStartPosition=cc.p(0,0);this._autoScrollBrakingStartPosition=cc.p(0,0);this._touchMoveDisplacements=[];this._touchMoveTimeDeltas=[];this._touchMovePreviousTimestamp=0;this._scrollBarEnabled=!0;this._initScrollBar();this.setTouchEnabled(!0)},onEnter:function(){ccui.Layout.prototype.onEnter.call(this);this.scheduleUpdate()},onExit:function(){cc.renderer._removeCache(this.__instanceId);ccui.Layout.prototype.onExit.call(this)}, visit:function(a){if(this._visible){this._adaptRenderers();this._doLayout();var b=cc.renderer,c=this._renderCmd,d=a&&a._renderCmd;c.visit(d);b.pushRenderCommand(c);c instanceof ccui.ScrollView.WebGLRenderCmd&&b._turnToCacheMode(this.__instanceId);a=this._clippingEnabled&&this._clippingType===ccui.Layout.CLIPPING_STENCIL;var e=this._clippingEnabled&&this._clippingType===ccui.Layout.CLIPPING_SCISSOR;a?c.stencilClippingVisit(d):e&&c.scissorClippingVisit(d);var f,g=this._children,h=g.length,k,d=this._protectedChildren, m=d.length;this._reorderChildDirty&&this.sortAllChildren();this._reorderProtectedChildDirty&&this.sortAllProtectedChildren();for(f=0;f<h;f++)(k=g[f])&&k._visible&&k.visit(this);for(f=0;f<m;f++)(g=d[f])&&g._visible&&(c._changeProtectedChild(g),g.visit(this));a?c.postStencilVisit():e&&c.postScissorVisit();c instanceof ccui.ScrollView.WebGLRenderCmd&&b._turnToNormalMode();this.updateChildren();c._dirtyFlag=0}},findNextFocusedWidget:function(a,b){return this.getLayoutType()===ccui.Layout.LINEAR_VERTICAL|| this.getLayoutType()===ccui.Layout.LINEAR_HORIZONTAL?this._innerContainer.findNextFocusedWidget(a,b):ccui.Widget.prototype.findNextFocusedWidget.call(this,a,b)},_initRenderer:function(){ccui.Layout.prototype._initRenderer.call(this);this._innerContainer=new ccui.Layout;this._innerContainer.setColor(cc.color(255,255,255));this._innerContainer.setOpacity(255);this._innerContainer.setCascadeColorEnabled(!0);this._innerContainer.setCascadeOpacityEnabled(!0);this.addProtectedChild(this._innerContainer, 1,1)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new ccui.ScrollView.WebGLRenderCmd(this):new ccui.ScrollView.CanvasRenderCmd(this)},_onSizeChanged:function(){ccui.Layout.prototype._onSizeChanged.call(this);var a=this._contentSize;this._topBoundary=a.height;this._rightBoundary=a.width;var b=this._innerContainer.getContentSize();this._innerContainer.setContentSize(cc.size(Math.max(b.width,a.width),Math.max(b.height,a.height)));this._innerContainer.setPosition(0,a.height- this._innerContainer.getContentSize().height);if(this._verticalScrollBar)this._verticalScrollBar.onScrolled(this._getHowMuchOutOfBoundary());if(this._horizontalScrollBar)this._horizontalScrollBar.onScrolled(this._getHowMuchOutOfBoundary())},setInnerContainerSize:function(a){var b=this._innerContainer,c=this._contentSize,d=c.width,e=c.height;a.width<c.width?cc.log("Inner width \x3c\x3d ScrollView width, it will be force sized!"):d=a.width;a.height<c.height?cc.log("Inner height \x3c\x3d ScrollView height, it will be force sized!"): e=a.height;b.setContentSize(cc.size(d,e));a=this._innerContainer.getPosition();b=this._innerContainer.getAnchorPoint();0!=this._innerContainer.getLeftBoundary()&&(a.x=b.x*d);this._innerContainer.getTopBoundary()!=this._contentSize.height&&(a.y=this._contentSize.height-(1-b.y)*e);this.setInnerContainerPosition(a);this._updateScrollBar(cc.p(0,0))},_setInnerWidth:function(a){var b=this._contentSize.width,c=b,d=this._innerContainer,e=d.width;a<b?cc.log("Inner width \x3c\x3d scrollview width, it will be force sized!"): c=a;d.width=c;switch(this._direction){case ccui.ScrollView.DIR_HORIZONTAL:case ccui.ScrollView.DIR_BOTH:d.getRightBoundary()<=b&&this._scrollChildren(e-d.width,0)}a=d.anchorX;0<d.getLeftBoundary()&&(d.x=a*c);d.getRightBoundary()<b&&(d.x=b-(1-a)*c)},_setInnerHeight:function(a){var b=this._contentSize.height,c=b,d=this._innerContainer,e=d.height;a<b?cc.log("Inner height \x3c\x3d scrollview height, it will be force sized!"):c=a;d.height=c;switch(this._direction){case ccui.ScrollView.DIR_VERTICAL:case ccui.ScrollView.DIR_BOTH:this._scrollChildren(0, e-c)}a=d.anchorY;0<d.getLeftBoundary()&&(d.y=a*c);d.getRightBoundary()<b&&(d.y=b-(1-a)*c)},setInnerContainerPosition:function(a){if(a.x!==this._innerContainer.getPositionX()||a.y!==this._innerContainer.getPositionY()){this._innerContainer.setPosition(a);this._outOfBoundaryAmountDirty=!0;if(this.bounceEnabled)for(a=ccui.ScrollView.MOVEDIR_TOP;a<ccui.ScrollView.MOVEDIR_RIGHT;++a)this._isOutOfBoundary(a)&&this._processScrollEvent(a,!0);this._dispatchEvent(ccui.ScrollView.EVENT_CONTAINER_MOVED)}},getInnerContainerPosition:function(){return this._innerContainer.getPosition()}, getInnerContainerSize:function(){return this._innerContainer.getContentSize()},_getInnerWidth:function(){return this._innerContainer.width},_getInnerHeight:function(){return this._innerContainer.height},_isInContainer:function(a){if(!this._clippingEnabled)return!0;var b=a._position,c=a._contentSize;a=a._anchorPoint;var d=this._customSize,e=this._innerContainer._position,f=0,g=0;return(f=b.y-a.y*c.height)>=d.height-e.y||f+c.height<=-e.y||(g=b.x-a.x*c.width)>=d.width-e.x||g+c.width<=-e.x?!1:!0},updateChildren:function(){var a, b,c,d=this._innerContainer._children;b=0;for(c=d.length;b<c;b++)a=d[b],!0===a._inViewRect&&!1===this._isInContainer(a)?a._inViewRect=!1:!1===a._inViewRect&&!0===this._isInContainer(a)&&(a._inViewRect=!0)},addChild:function(a,b,c){if(!a)return!1;!1===this._isInContainer(a)&&(a._inViewRect=!1);b=b||a.getLocalZOrder();c=c||a.getTag();return this._innerContainer.addChild(a,b,c)},removeAllChildren:function(){this.removeAllChildrenWithCleanup(!0)},removeAllChildrenWithCleanup:function(a){this._innerContainer.removeAllChildrenWithCleanup(a)}, removeChild:function(a,b){return this._innerContainer.removeChild(a,b)},getChildren:function(){return this._innerContainer.getChildren()},getChildrenCount:function(){return this._innerContainer.getChildrenCount()},getChildByTag:function(a){return this._innerContainer.getChildByTag(a)},getChildByName:function(a){return this._innerContainer.getChildByName(a)},_flattenVectorByDirection:function(a){var b=cc.p(0,0);b.x=this._direction===ccui.ScrollView.DIR_VERTICAL?0:a.x;b.y=this._direction===ccui.ScrollView.DIR_HORIZONTAL? 0:a.y;return b},_getHowMuchOutOfBoundary:function(a){void 0===a&&(a=cc.p(0,0));if(0===a.x&&0===a.y&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var b=cc.p(0,0);this._innerContainer.getLeftBoundary()+a.x>this._leftBoundary?b.x=this._leftBoundary-(this._innerContainer.getLeftBoundary()+a.x):this._innerContainer.getRightBoundary()+a.x<this._rightBoundary&&(b.x=this._rightBoundary-(this._innerContainer.getRightBoundary()+a.x));this._innerContainer.getTopBoundary()+a.y<this._topBoundary? b.y=this._topBoundary-(this._innerContainer.getTopBoundary()+a.y):this._innerContainer.getBottomBoundary()+a.y>this._bottomBoundary&&(b.y=this._bottomBoundary-(this._innerContainer.getBottomBoundary()+a.y));0===a.x&&0===a.y&&(this._outOfBoundaryAmount=b,this._outOfBoundaryAmountDirty=!1);return b},_isOutOfBoundary:function(a){var b=this._getHowMuchOutOfBoundary();if(void 0!==a)switch(a){case ccui.ScrollView.MOVEDIR_TOP:return 0<b.y;case ccui.ScrollView.MOVEDIR_BOTTOM:return 0>b.y;case ccui.ScrollView.MOVEDIR_LEFT:return 0> b.x;case ccui.ScrollView.MOVEDIR_RIGHT:return 0<b.x}else return!this._fltEqualZero(b);return!1},_moveInnerContainer:function(a,b){var c=this._flattenVectorByDirection(a);this.setInnerContainerPosition(cc.pAdd(this.getInnerContainerPosition(),c));c=this._getHowMuchOutOfBoundary();this._updateScrollBar(c);this.bounceEnabled&&b&&this._startBounceBackIfNeeded()},_updateScrollBar:function(a){if(this._verticalScrollBar)this._verticalScrollBar.onScrolled(a);if(this._horizontalScrollBar)this._horizontalScrollBar.onScrolled(a)}, _calculateTouchMoveVelocity:function(){for(var a=0,b=0;b<this._touchMoveTimeDeltas.length;++b)a+=this._touchMoveTimeDeltas[b];if(0==a||a>=this._touchTotalTimeThreshold)return cc.p(0,0);for(var c=cc.p(0,0),b=0;b<this._touchMoveDisplacements.length;++b)c.x+=this._touchMoveDisplacements[b].x,c.y+=this._touchMoveDisplacements[b].y;return cc.pMult(c,1/a)},setTouchTotalTimeThreshold:function(a){this._touchTotalTimeThreshold=a},getTouchTotalTimeThreshold:function(){return this._touchTotalTimeThreshold}, _startInertiaScroll:function(a){var b=cc.pMult(a,0.7);this._startAttenuatingAutoScroll(b,a)},_startBounceBackIfNeeded:function(){if(!this.bounceEnabled)return!1;var a=this._getHowMuchOutOfBoundary();if(this._fltEqualZero(a))return!1;this._startAutoScroll(a,1,!0);return!0},_startAutoScrollToDestination:function(a,b,c){this._startAutoScroll(cc.pSub(a,this._innerContainer.getPosition()),b,c)},_calculateAutoScrollTimeByInitialSpeed:function(a){return Math.sqrt(Math.sqrt(a/5))},_startAttenuatingAutoScroll:function(a, b){var c=this._calculateAutoScrollTimeByInitialSpeed(cc.pLength(b));this._startAutoScroll(a,c,!0)},_startAutoScroll:function(a,b,c){a=this._flattenVectorByDirection(a);this._autoScrolling=!0;this._autoScrollTargetDelta=a;this._autoScrollAttenuate=c;this._autoScrollStartPosition=this._innerContainer.getPosition();this._autoScrollTotalTime=b;this._autoScrollAccumulatedTime=0;this._autoScrollBraking=!1;this._autoScrollBrakingStartPosition=cc.p(0,0);b=this._getHowMuchOutOfBoundary();!this._fltEqualZero(b)&& (this._autoScrollCurrentlyOutOfBoundary=!0,c=this._getHowMuchOutOfBoundary(a),0<b.x*c.x||0<b.y*c.y)&&(this._autoScrollBraking=!0)},stopAutoScroll:function(){this._autoScrolling=!1;this._autoScrollAttenuate=!0;this._autoScrollAccumulatedTime=this._autoScrollTotalTime=0},_isNecessaryAutoScrollBrake:function(){if(this._autoScrollBraking)return!0;if(this._isOutOfBoundary()){if(!this._autoScrollCurrentlyOutOfBoundary)return this._autoScrollBraking=this._autoScrollCurrentlyOutOfBoundary=!0,this._autoScrollBrakingStartPosition= this.getInnerContainerPosition(),!0}else this._autoScrollCurrentlyOutOfBoundary=!1;return!1},_getAutoScrollStopEpsilon:function(){return 1E-4},_fltEqualZero:function(a){return 1E-4>=Math.abs(a.x)&&1E-4>=Math.abs(a.y)},_processAutoScrolling:function(a){var b=this._isNecessaryAutoScrollBrake()?0.05:1;this._autoScrollAccumulatedTime+=1/b*a;var c=Math.min(1,this._autoScrollAccumulatedTime/this._autoScrollTotalTime);this._autoScrollAttenuate&&(c-=1,c=c*c*c*c*c+1);a=cc.pAdd(this._autoScrollStartPosition, cc.pMult(this._autoScrollTargetDelta,c));c=Math.abs(c-1)<=this._getAutoScrollStopEpsilon();this.bounceEnabled?a=cc.pAdd(this._autoScrollBrakingStartPosition,cc.pMult(cc.pSub(a,this._autoScrollBrakingStartPosition),b)):(b=cc.pSub(a,this.getInnerContainerPosition()),b=this._getHowMuchOutOfBoundary(b),this._fltEqualZero(b)||(a.x+=b.x,a.y+=b.y,c=!0));c&&(this._autoScrolling=!1,this._dispatchEvent(ccui.ScrollView.EVENT_AUTOSCROLL_ENDED));this._moveInnerContainer(cc.pSub(a,this.getInnerContainerPosition()), c)},_jumpToDestination:function(a,b){void 0===a.x&&(a=cc.p(a,b));this._autoScrolling=!1;this._moveInnerContainer(cc.pSub(a,this.getInnerContainerPosition()),!0)},_scrollChildren:function(a){if(this.bounceEnabled){var b=this._getHowMuchOutOfBoundary();a.x*=0==b.x?1:0.5;a.y*=0==b.y?1:0.5}this.bounceEnabled||(b=this._getHowMuchOutOfBoundary(a),a.x+=b.x,a.y+=b.y);var c=b=!1,d=!1,e=!1;0<a.y?this._innerContainer.getBottomBoundary()+a.y>=this._bottomBoundary&&(e=!0):0>a.y&&this._innerContainer.getTopBoundary()+ a.y<=this._topBoundary&&(d=!0);0>a.x?this._innerContainer.getRightBoundary()+a.x<=this._rightBoundary&&(c=!0):0<a.x&&this._innerContainer.getLeftBoundary()+a.x>=this._leftBoundary&&(b=!0);this._moveInnerContainer(a,!1);0==a.x&&0==a.y||this._processScrollingEvent();e&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_BOTTOM,!1);d&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_TOP,!1);b&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_LEFT,!1);c&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_RIGHT, !1)},scrollToBottom:function(a,b){this._startAutoScrollToDestination(cc.p(this._innerContainer.getPositionX(),0),a,b)},scrollToTop:function(a,b){this._startAutoScrollToDestination(cc.p(this._innerContainer.getPositionX(),this._contentSize.height-this._innerContainer.getContentSize().height),a,b)},scrollToLeft:function(a,b){this._startAutoScrollToDestination(cc.p(0,this._innerContainer.getPositionY()),a,b)},scrollToRight:function(a,b){this._startAutoScrollToDestination(cc.p(this._contentSize.width- this._innerContainer.getContentSize().width,this._innerContainer.getPositionY()),a,b)},scrollToTopLeft:function(a,b){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll direction is not both!"):this._startAutoScrollToDestination(cc.p(0,this._contentSize.height-this._innerContainer.getContentSize().height),a,b)},scrollToTopRight:function(a,b){if(this._direction!==ccui.ScrollView.DIR_BOTH)cc.log("Scroll direction is not both!");else{var c=this._innerContainer.getContentSize();this._startAutoScrollToDestination(cc.p(this._contentSize.width- c.width,this._contentSize.height-c.height),a,b)}},scrollToBottomLeft:function(a,b){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll direction is not both!"):this._startAutoScrollToDestination(cc.p(0,0),a,b)},scrollToBottomRight:function(a,b){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll direction is not both!"):this._startAutoScrollToDestination(cc.p(this._contentSize.width-this._innerContainer.getContentSize().width,0),a,b)},scrollToPercentVertical:function(a,b,c){var d=this._contentSize.height- this._innerContainer.getContentSize().height,e=-d;this._startAutoScrollToDestination(cc.p(this._innerContainer.getPositionX(),d+a*e/100),b,c)},scrollToPercentHorizontal:function(a,b,c){var d=this._innerContainer.getContentSize().width-this._contentSize.width;this._startAutoScrollToDestination(cc.p(-(a*d/100),this._innerContainer.getPositionY()),b,c)},scrollToPercentBothDirection:function(a,b,c){if(this._direction===ccui.ScrollView.DIR_BOTH){var d=this._contentSize.height-this._innerContainer.getContentSize().height, e=-d,f=this._innerContainer.getContentSize().width-this._contentSize.width;this._startAutoScrollToDestination(cc.p(-(a.x*f/100),d+a.y*e/100),b,c)}},jumpToBottom:function(){this._jumpToDestination(this._innerContainer.getPositionX(),0)},jumpToTop:function(){this._jumpToDestination(this._innerContainer.getPositionX(),this._contentSize.height-this._innerContainer.getContentSize().height)},jumpToLeft:function(){this._jumpToDestination(0,this._innerContainer.getPositionY())},jumpToRight:function(){this._jumpToDestination(this._contentSize.width- this._innerContainer.getContentSize().width,this._innerContainer.getPositionY())},jumpToTopLeft:function(){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll _direction is not both!"):this._jumpToDestination(0,this._contentSize.height-this._innerContainer.getContentSize().height)},jumpToTopRight:function(){if(this._direction!==ccui.ScrollView.DIR_BOTH)cc.log("Scroll _direction is not both!");else{var a=this._innerContainer.getContentSize();this._jumpToDestination(this._contentSize.width-a.width, this._contentSize.height-a.height)}},jumpToBottomLeft:function(){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll _direction is not both!"):this._jumpToDestination(0,0)},jumpToBottomRight:function(){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll _direction is not both!"):this._jumpToDestination(this._contentSize.width-this._innerContainer.getContentSize().width,0)},jumpToPercentVertical:function(a){var b=this._contentSize.height-this._innerContainer.getContentSize().height,c=-b; this._jumpToDestination(this._innerContainer.getPositionX(),b+a*c/100)},jumpToPercentHorizontal:function(a){var b=this._innerContainer.getContentSize().width-this._contentSize.width;this._jumpToDestination(-(a*b/100),this._innerContainer.getPositionY())},jumpToPercentBothDirection:function(a){if(this._direction===ccui.ScrollView.DIR_BOTH){var b=this._innerContainer.getContentSize(),c=this._contentSize.height-b.height;this._jumpToDestination(-(a.x*(b.width-this._contentSize.width)/100),c+a.y*-c/100)}}, _gatherTouchMove:function(a){for(;5<=this._touchMoveDisplacements.length;)this._touchMoveDisplacements.splice(0,1),this._touchMoveTimeDeltas.splice(0,1);this._touchMoveDisplacements.push(a);a=(new Date).getTime();this._touchMoveTimeDeltas.push((a-this._touchMovePreviousTimestamp)/1E3);this._touchMovePreviousTimestamp=a},_handlePressLogic:function(a){this._bePressed=!0;this._autoScrolling=!1;this._touchMovePreviousTimestamp=(new Date).getTime();this._touchMoveDisplacements.length=0;this._touchMoveTimeDeltas.length= 0;if(this._verticalScrollBar)this._verticalScrollBar.onTouchBegan();if(this._horizontalScrollBar)this._horizontalScrollBar.onTouchBegan()},_handleMoveLogic:function(a){var b=this.convertToNodeSpace(a.getLocation());a=this.convertToNodeSpace(a.getPreviousLocation());b=cc.pSub(b,a);this._scrollChildren(b);this._gatherTouchMove(b)},_handleReleaseLogic:function(a){var b=this.convertToNodeSpace(a.getLocation());a=this.convertToNodeSpace(a.getPreviousLocation());b=cc.pSub(b,a);this._gatherTouchMove(b); this._bePressed=!1;!this._startBounceBackIfNeeded()&&this.inertiaScrollEnabled&&(b=this._calculateTouchMoveVelocity(),0===b.x&&0===b.y||this._startInertiaScroll(b));if(this._verticalScrollBar)this._verticalScrollBar.onTouchEnded();if(this._horizontalScrollBar)this._horizontalScrollBar.onTouchEnded()},onTouchBegan:function(a,b){var c=ccui.Layout.prototype.onTouchBegan.call(this,a,b);this._isInterceptTouch||this._hit&&this._handlePressLogic(a);return c},onTouchMoved:function(a,b){ccui.Layout.prototype.onTouchMoved.call(this, a,b);this._isInterceptTouch||this._handleMoveLogic(a)},onTouchEnded:function(a,b){ccui.Layout.prototype.onTouchEnded.call(this,a,b);this._isInterceptTouch||this._handleReleaseLogic(a);this._isInterceptTouch=!1},onTouchCancelled:function(a,b){ccui.Layout.prototype.onTouchCancelled.call(this,a,b);this._isInterceptTouch||this._handleReleaseLogic(a);this._isInterceptTouch=!1},update:function(a){this._autoScrolling&&this._processAutoScrolling(a)},interceptTouchEvent:function(a,b,c){if(!this._touchEnabled)ccui.Layout.prototype.interceptTouchEvent.call(this, a,b,c);else if(this._direction!==ccui.ScrollView.DIR_NONE){var d=c.getLocation();switch(a){case ccui.Widget.TOUCH_BEGAN:this._isInterceptTouch=!0;this._touchBeganPosition.x=d.x;this._touchBeganPosition.y=d.y;this._handlePressLogic(c);break;case ccui.Widget.TOUCH_MOVED:a=cc.pLength(cc.pSub(b.getTouchBeganPosition(),d));this._touchMovePosition.x=d.x;this._touchMovePosition.y=d.y;a>this._childFocusCancelOffset&&(b.setHighlighted(!1),this._handleMoveLogic(c));break;case ccui.Widget.TOUCH_CANCELED:case ccui.Widget.TOUCH_ENDED:this._touchEndPosition.x= d.x,this._touchEndPosition.y=d.y,this._handleReleaseLogic(c),b.isSwallowTouches()&&(this._isInterceptTouch=!1)}}},_processScrollEvent:function(a,b){var c=0;switch(a){case ccui.ScrollView.MOVEDIR_TOP:c=b?ccui.ScrollView.EVENT_BOUNCE_TOP:ccui.ScrollView.EVENT_SCROLL_TO_TOP;break;case ccui.ScrollView.MOVEDIR_BOTTOM:c=b?ccui.ScrollView.EVENT_BOUNCE_BOTTOM:ccui.ScrollView.EVENT_SCROLL_TO_BOTTOM;break;case ccui.ScrollView.MOVEDIR_LEFT:c=b?ccui.ScrollView.EVENT_BOUNCE_LEFT:ccui.ScrollView.EVENT_SCROLL_TO_LEFT; break;case ccui.ScrollView.MOVEDIR_RIGHT:c=b?ccui.ScrollView.EVENT_BOUNCE_RIGHT:ccui.ScrollView.EVENT_SCROLL_TO_RIGHT}this._dispatchEvent(c)},_processScrollingEvent:function(){this._dispatchEvent(ccui.ScrollView.EVENT_SCROLLING)},_dispatchEvent:function(a){this._scrollViewEventSelector&&(this._scrollViewEventListener?this._scrollViewEventSelector.call(this._scrollViewEventListener,this,a):this._scrollViewEventSelector(this,a));this._ccEventCallback&&this._ccEventCallback(this,a)},addEventListenerScrollView:function(a, b){this._scrollViewEventSelector=a;this._scrollViewEventListener=b},addEventListener:function(a){this._ccEventCallback=a},setDirection:function(a){this._direction=a;this._scrollBarEnabled&&(this._removeScrollBar(),this._initScrollBar())},getDirection:function(){return this._direction},setBounceEnabled:function(a){this.bounceEnabled=a},isBounceEnabled:function(){return this.bounceEnabled},setInertiaScrollEnabled:function(a){this.inertiaScrollEnabled=a},isInertiaScrollEnabled:function(){return this.inertiaScrollEnabled}, setScrollBarEnabled:function(a){this._scrollBarEnabled!==a&&(this._scrollBarEnabled&&this._removeScrollBar(),(this._scrollBarEnabled=a)&&this._initScrollBar())},isScrollBarEnabled:function(){return this._scrollBarEnabled},setScrollBarPositionFromCorner:function(a){this._direction!==ccui.ScrollView.DIR_HORIZONTAL&&this.setScrollBarPositionFromCornerForVertical(a);this._direction!==ccui.ScrollView.DIR_VERTICAL&&this.setScrollBarPositionFromCornerForHorizontal(a)},setScrollBarPositionFromCornerForVertical:function(a){cc.assert(this._scrollBarEnabled, "Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_HORIZONTAL,"Scroll view doesn't have a vertical scroll bar!");this._verticalScrollBar.setPositionFromCorner(a)},getScrollBarPositionFromCornerForVertical:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_HORIZONTAL,"Scroll view doesn't have a vertical scroll bar!");return this._verticalScrollBar.getPositionFromCorner()},setScrollBarPositionFromCornerForHorizontal:function(a){cc.assert(this._scrollBarEnabled, "Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_VERTICAL,"Scroll view doesn't have a horizontal scroll bar!");this._horizontalScrollBar.setPositionFromCorner(a)},getScrollBarPositionFromCornerForHorizontal:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_VERTICAL,"Scroll view doesn't have a horizontal scroll bar!");return this._horizontalScrollBar.getPositionFromCorner()},setScrollBarWidth:function(a){cc.assert(this._scrollBarEnabled, "Scroll bar should be enabled!");this._verticalScrollBar&&this._verticalScrollBar.setWidth(a);this._horizontalScrollBar&&this._horizontalScrollBar.setWidth(a)},getScrollBarWidth:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.getWidth():this._horizontalScrollBar?this._horizontalScrollBar.getWidth():0},setScrollBarColor:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&& this._verticalScrollBar.setColor(a);this._horizontalScrollBar&&this._horizontalScrollBar.setColor(a)},getScrollBarColor:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&this._verticalScrollBar.getColor();this._horizontalScrollBar&&this._horizontalScrollBar.getColor();return cc.color.WHITE},setScrollBarOpacity:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&(this._verticalScrollBar.opacity=a); this._horizontalScrollBar&&(this._horizontalScrollBar.opacity=a)},getScrollBarOpacity:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.opacity:this._horizontalScrollBar?this._horizontalScrollBar.opacity:-1},setScrollBarAutoHideEnabled:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&(this._verticalScrollBar.autoHideEnabled=a);this._horizontalScrollBar&&(this._horizontalScrollBar.autoHideEnabled= a)},isScrollBarAutoHideEnabled:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.autoHideEnabled:this._horizontalScrollBar?this._horizontalScrollBar.autoHideEnabled:!1},setScrollBarAutoHideTime:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&(this._verticalScrollBar.autoHideTime=a);this._horizontalScrollBar&&(this._horizontalScrollBar.autoHideTime=a)},getScrollBarAutoHideTime:function(){cc.assert(this._scrollBarEnabled, "Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.autoHideTime:this._horizontalScrollBar?this._horizontalScrollBar.autoHideTime:0},getInnerContainer:function(){return this._innerContainer},setLayoutType:function(a){this._innerContainer.setLayoutType(a)},getLayoutType:function(){return this._innerContainer.getLayoutType()},_doLayout:function(){this._doLayoutDirty&&(this._doLayoutDirty=!1)},getDescription:function(){return"ScrollView"},_createCloneInstance:function(){return new ccui.ScrollView}, _copyClonedWidgetChildren:function(a){ccui.Layout.prototype._copyClonedWidgetChildren.call(this,a)},_copySpecialProperties:function(a){a instanceof ccui.ScrollView&&(ccui.Layout.prototype._copySpecialProperties.call(this,a),this.setInnerContainerSize(a.getInnerContainerSize()),this.setInnerContainerPosition(a.getInnerContainerPosition()),this.setDirection(a._direction),this._topBoundary=a._topBoundary,this._bottomBoundary=a._bottomBoundary,this._leftBoundary=a._leftBoundary,this._rightBoundary=a._rightBoundary, this._bePressed=a._bePressed,this._childFocusCancelOffset=a._childFocusCancelOffset,this._touchMoveDisplacements=a._touchMoveDisplacements,this._touchMoveTimeDeltas=a._touchMoveTimeDeltas,this._touchMovePreviousTimestamp=a._touchMovePreviousTimestamp,this._autoScrolling=a._autoScrolling,this._autoScrollAttenuate=a._autoScrollAttenuate,this._autoScrollStartPosition=a._autoScrollStartPosition,this._autoScrollTargetDelta=a._autoScrollTargetDelta,this._autoScrollTotalTime=a._autoScrollTotalTime,this._autoScrollAccumulatedTime= a._autoScrollAccumulatedTime,this._autoScrollCurrentlyOutOfBoundary=a._autoScrollCurrentlyOutOfBoundary,this._autoScrollBraking=a._autoScrollBraking,this._autoScrollBrakingStartPosition=a._autoScrollBrakingStartPosition,this.setBounceEnabled(a.bounceEnabled),this.setInertiaScrollEnabled(a.inertiaScrollEnabled),this._scrollViewEventListener=a._scrollViewEventListener,this._scrollViewEventSelector=a._scrollViewEventSelector,this._ccEventCallback=a._ccEventCallback,this.setScrollBarEnabled(a.isScrollBarEnabled()), this.isScrollBarEnabled()&&(this._direction!==ccui.ScrollView.DIR_HORIZONTAL&&this.setScrollBarPositionFromCornerForVertical(a.getScrollBarPositionFromCornerForVertical()),this._direction!==ccui.ScrollView.DIR_VERTICAL&&this.setScrollBarPositionFromCornerForHorizontal(a.getScrollBarPositionFromCornerForHorizontal()),this.setScrollBarWidth(a.getScrollBarWidth()),this.setScrollBarColor(a.getScrollBarColor()),this.setScrollBarAutoHideEnabled(a.isScrollBarAutoHideEnabled()),this.setScrollBarAutoHideTime(a.getScrollBarAutoHideTime())))}, _initScrollBar:function(){this._direction===ccui.ScrollView.DIR_HORIZONTAL||this._verticalScrollBar||(this._verticalScrollBar=new ccui.ScrollViewBar(this,ccui.ScrollView.DIR_VERTICAL),this.addProtectedChild(this._verticalScrollBar,2));this._direction===ccui.ScrollView.DIR_VERTICAL||this._horizontalScrollBar||(this._horizontalScrollBar=new ccui.ScrollViewBar(this,ccui.ScrollView.DIR_HORIZONTAL),this.addProtectedChild(this._horizontalScrollBar,2))},_removeScrollBar:function(){this._verticalScrollBar&& (this.removeProtectedChild(this._verticalScrollBar),this._verticalScrollBar=null);this._horizontalScrollBar&&(this.removeProtectedChild(this._horizontalScrollBar),this._horizontalScrollBar=null)},getNodeByTag:function(a){return this._innerContainer.getNodeByTag(a)},getNodes:function(){return this._innerContainer.getNodes()},removeNode:function(a){this._innerContainer.removeNode(a)},removeNodeByTag:function(a){this._innerContainer.removeNodeByTag(a)},removeAllNodes:function(){this._innerContainer.removeAllNodes()}, addNode:function(a,b,c){this._innerContainer.addNode(a,b,c)}});_p=ccui.ScrollView.prototype;cc.defineGetterSetter(_p,"innerWidth",_p._getInnerWidth,_p._setInnerWidth);cc.defineGetterSetter(_p,"innerHeight",_p._getInnerHeight,_p._setInnerHeight);cc.defineGetterSetter(_p,"direction",_p.getDirection,_p.setDirection);cc.defineGetterSetter(_p,"touchTotalTimeThreshold",_p.getTouchTotalTimeThreshold,_p.setTouchTotalTimeThreshold);_p=null;ccui.ScrollView.create=function(){return new ccui.ScrollView}; ccui.ScrollView.DIR_NONE=0;ccui.ScrollView.DIR_VERTICAL=1;ccui.ScrollView.DIR_HORIZONTAL=2;ccui.ScrollView.DIR_BOTH=3;ccui.ScrollView.EVENT_SCROLL_TO_TOP=0;ccui.ScrollView.EVENT_SCROLL_TO_BOTTOM=1;ccui.ScrollView.EVENT_SCROLL_TO_LEFT=2;ccui.ScrollView.EVENT_SCROLL_TO_RIGHT=3;ccui.ScrollView.EVENT_SCROLLING=4;ccui.ScrollView.EVENT_BOUNCE_TOP=5;ccui.ScrollView.EVENT_BOUNCE_BOTTOM=6;ccui.ScrollView.EVENT_BOUNCE_LEFT=7;ccui.ScrollView.EVENT_BOUNCE_RIGHT=8;ccui.ScrollView.EVENT_CONTAINER_MOVED=9; ccui.ScrollView.EVENT_AUTOSCROLL_ENDED=10;ccui.ScrollView.MOVEDIR_TOP=0;ccui.ScrollView.MOVEDIR_BOTTOM=1;ccui.ScrollView.MOVEDIR_LEFT=2;ccui.ScrollView.MOVEDIR_RIGHT=3;ccui.ListView=ccui.ScrollView.extend({_model:null,_items:null,_gravity:null,_itemsMargin:0,_curSelectedIndex:0,_refreshViewDirty:!0,_listViewEventListener:null,_listViewEventSelector:null,_ccListViewEventCallback:null,_magneticAllowedOutOfBoundary:!0,_magneticType:0,_className:"ListView",ctor:function(){this._items=[];ccui.ScrollView.prototype.ctor.call(this);this._gravity=ccui.ListView.GRAVITY_CENTER_VERTICAL;this.setTouchEnabled(!0);this.setDirection(ccui.ScrollView.DIR_VERTICAL)},setItemModel:function(a){a? this._model=a:cc.log("Can't set a null to item model!")},_handleReleaseLogic:function(a){ccui.ScrollView.prototype._handleReleaseLogic.call(this,a);this._autoScrolling||this._startMagneticScroll()},_onItemListChanged:function(){this._outOfBoundaryAmountDirty=!0},_updateInnerContainerSize:function(){var a,b=this._items,c;switch(this.direction){case ccui.ScrollView.DIR_VERTICAL:c=b.length;var d=(c-1)*this._itemsMargin;for(a=0;a<c;a++)d+=b[a].getContentSize().height;this.setInnerContainerSize(cc.size(this._contentSize.width, d));break;case ccui.ScrollView.DIR_HORIZONTAL:c=b.length;d=(c-1)*this._itemsMargin;for(a=0;a<c;a++)d+=b[a].getContentSize().width;this.setInnerContainerSize(cc.size(d,this._contentSize.height))}},_remedyLayoutParameter:function(a){cc.assert(null!=a,"ListView Item can't be nil!");var b=a.getLayoutParameter(ccui.LayoutParameter.LINEAR),c=!0;b||(b=new ccui.LinearLayoutParameter,c=!1);var d=this.getIndex(a);switch(this.direction){case ccui.ScrollView.DIR_VERTICAL:this._remedyVerticalLayoutParameter(b, d);break;case ccui.ScrollView.DIR_HORIZONTAL:this._remedyHorizontalLayoutParameter(b,d)}c||a.setLayoutParameter(b)},_remedyVerticalLayoutParameter:function(a,b){cc.assert(null!=a,"Layout parameter can't be nil!");switch(this._gravity){case ccui.ListView.GRAVITY_LEFT:a.setGravity(ccui.LinearLayoutParameter.LEFT);break;case ccui.ListView.GRAVITY_RIGHT:a.setGravity(ccui.LinearLayoutParameter.RIGHT);break;case ccui.ListView.GRAVITY_CENTER_HORIZONTAL:a.setGravity(ccui.LinearLayoutParameter.CENTER_HORIZONTAL)}0=== b?a.setMargin(ccui.MarginZero()):a.setMargin(new ccui.Margin(0,this._itemsMargin,0,0))},_remedyHorizontalLayoutParameter:function(a,b){cc.assert(null!=a,"Layout parameter can't be nil!");switch(this._gravity){case ccui.ListView.GRAVITY_TOP:a.setGravity(ccui.LinearLayoutParameter.TOP);break;case ccui.ListView.GRAVITY_BOTTOM:a.setGravity(ccui.LinearLayoutParameter.BOTTOM);break;case ccui.ListView.GRAVITY_CENTER_VERTICAL:a.setGravity(ccui.LinearLayoutParameter.CENTER_VERTICAL)}0===b?a.setMargin(ccui.MarginZero()): a.setMargin(new ccui.Margin(this._itemsMargin,0,0,0))},pushBackDefaultItem:function(){if(null!=this._model){var a=this._model.clone();this._remedyLayoutParameter(a);this.addChild(a);this._refreshViewDirty=!0}},insertDefaultItem:function(a){if(null!=this._model){var b=this._model.clone();this._items.splice(a,0,b);ccui.ScrollView.prototype.addChild.call(this,b);this._remedyLayoutParameter(b);this._refreshViewDirty=!0}},pushBackCustomItem:function(a){this._remedyLayoutParameter(a);this.addChild(a);this._refreshViewDirty= !0},addChild:function(a,b,c){a&&(b=b||a.getLocalZOrder(),c=c||a.getName(),ccui.ScrollView.prototype.addChild.call(this,a,b,c),a instanceof ccui.Widget&&(this._items.push(a),this._onItemListChanged()))},removeChild:function(a,b){if(a){var c=this._items.indexOf(a);-1<c&&this._items.splice(c,1);this._onItemListChanged();ccui.ScrollView.prototype.removeChild.call(this,a,b)}},removeAllChildren:function(){this.removeAllChildrenWithCleanup(!0)},removeAllChildrenWithCleanup:function(a){ccui.ScrollView.prototype.removeAllChildrenWithCleanup.call(this, a);this._items=[];this._onItemListChanged()},insertCustomItem:function(a,b){this._items.splice(b,0,a);this._onItemListChanged();ccui.ScrollView.prototype.addChild.call(this,a);this._remedyLayoutParameter(a);this._refreshViewDirty=!0},removeItem:function(a){a=this.getItem(a);null!=a&&(this.removeChild(a,!0),this._refreshViewDirty=!0)},removeLastItem:function(){this.removeItem(this._items.length-1)},removeAllItems:function(){this.removeAllChildren()},getItem:function(a){return 0>a||a>=this._items.length? null:this._items[a]},getItems:function(){return this._items},getIndex:function(a){return null==a?-1:this._items.indexOf(a)},setGravity:function(a){this._gravity!==a&&(this._gravity=a,this._refreshViewDirty=!0)},setMagneticType:function(a){this._magneticType=a;this._onItemListChanged();this._startMagneticScroll()},getMagneticType:function(){return this._magneticType},setMagneticAllowedOutOfBoundary:function(a){this._magneticAllowedOutOfBoundary=a},getMagneticAllowedOutOfBoundary:function(){return this._magneticAllowedOutOfBoundary}, setItemsMargin:function(a){this._itemsMargin!==a&&(this._itemsMargin=a,this._refreshViewDirty=!0)},getItemsMargin:function(){return this._itemsMargin},setDirection:function(a){switch(a){case ccui.ScrollView.DIR_VERTICAL:this.setLayoutType(ccui.Layout.LINEAR_VERTICAL);break;case ccui.ScrollView.DIR_HORIZONTAL:this.setLayoutType(ccui.Layout.LINEAR_HORIZONTAL);break;case ccui.ScrollView.DIR_BOTH:return;default:return}ccui.ScrollView.prototype.setDirection.call(this,a)},_getHowMuchOutOfBoundary:function(a){void 0=== a&&(a=cc.p(0,0));if(this._magneticAllowedOutOfBoundary&&0!==this._items.length){if(this._magneticType===ccui.ListView.MAGNETIC_NONE||this._magneticType===ccui.ListView.MAGNETIC_BOTH_END)return ccui.ScrollView.prototype._getHowMuchOutOfBoundary.call(this,a);if(0===a.x&&0===a.y&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount}else return ccui.ScrollView.prototype._getHowMuchOutOfBoundary.call(this,a);var b=this._leftBoundary,c=this._rightBoundary,d=this._topBoundary,e=this._bottomBoundary, f=this._items.length-1,g=this.getContentSize(),h=cc.p(0,0),k=cc.p(0,0);switch(this._magneticType){case ccui.ListView.MAGNETIC_CENTER:h.x=(g.width-this._items[0].width)/2;h.y=(g.height-this._items[0].height)/2;k.x=(g.width-this._items[f].width)/2;k.y=(g.height-this._items[f].height)/2;break;case ccui.ListView.MAGNETIC_LEFT:case ccui.ListView.MAGNETIC_TOP:k.x=g.width-this._items[f].width;k.y=g.height-this._items[f].height;break;case ccui.ListView.MAGNETIC_RIGHT:case ccui.ListView.MAGNETIC_BOTTOM:h.x= g.width-this._items[0].width,h.y=g.height-this._items[0].height}b+=h.x;c-=k.x;d-=h.y;e+=k.y;f=cc.p(0,0);this._innerContainer.getLeftBoundary()+a.x>b?f.x=b-(this._innerContainer.getLeftBoundary()+a.x):this._innerContainer.getRightBoundary()+a.x<c&&(f.x=c-(this._innerContainer.getRightBoundary()+a.x));this._innerContainer.getTopBoundary()+a.y<d?f.y=d-(this._innerContainer.getTopBoundary()+a.y):this._innerContainer.getBottomBoundary()+a.y>e&&(f.y=e-(this._innerContainer.getBottomBoundary()+a.y));0=== a.x&&0===a.y&&(this._outOfBoundaryAmount=f,this._outOfBoundaryAmountDirty=!1);return f},_calculateItemPositionWithAnchor:function(a,b){var c=cc.p(a.getLeftBoundary(),a.getBottomBoundary()),d=a.getContentSize();return cc.p(c.x+d.width*b.x,c.y+d.height*b.y)},_findClosestItem:function(a,b,c,d,e,f,g){cc.assert(0<=d&&f<b.length&&d<=f,"");if(d===f)return b[d];if(1===f-d)return e<=g?b[d]:b[f];var h=Math.floor((d+f)/2),k=this._calculateItemPositionWithAnchor(b[h],c),k=cc.pLength(cc.pSub(a,k));return e<=g? this._findClosestItem(a,b,c,d,e,h,k):this._findClosestItem(a,b,c,h,k,f,g)},getClosestItemToPosition:function(a,b){if(0===this._items.length)return null;var c=this._calculateItemPositionWithAnchor(this._items[0],b),c=cc.pLength(cc.pSub(a,c)),d=this._items.length-1,e=this._calculateItemPositionWithAnchor(this._items[d],b),e=cc.pLength(cc.pSub(a,e));return this._findClosestItem(a,this._items,b,0,c,d,e)},getClosestItemToPositionInCurrentView:function(a,b){var c=this.getContentSize(),d=cc.pMult(this._innerContainer.getPosition(), -1);d.x+=c.width*a.x;d.y+=c.height*a.y;return this.getClosestItemToPosition(d,b)},getCenterItemInCurrentView:function(){return this.getClosestItemToPositionInCurrentView(cc.p(0.5,0.5),cc.p(0.5,0.5))},getLeftmostItemInCurrentView:function(){return this._direction===ccui.ScrollView.DIR_HORIZONTAL?this.getClosestItemToPositionInCurrentView(cc.p(0,0.5),cc.p(0.5,0.5)):null},getRightmostItemInCurrentView:function(){return this._direction===ccui.ScrollView.DIR_HORIZONTAL?this.getClosestItemToPositionInCurrentView(cc.p(1, 0.5),cc.p(0.5,0.5)):null},getTopmostItemInCurrentView:function(){return this._direction===ccui.ScrollView.DIR_VERTICAL?this.getClosestItemToPositionInCurrentView(cc.p(0.5,1),cc.p(0.5,0.5)):null},getBottommostItemInCurrentView:function(){return this._direction===ccui.ScrollView.DIR_VERTICAL?this.getClosestItemToPositionInCurrentView(cc.p(0.5,0),cc.p(0.5,0.5)):null},_calculateItemDestination:function(a,b,c){var d=this.getContentSize(),e=cc.p(0,0);e.x+=d.width*a.x;e.y+=d.height*a.y;a=this._calculateItemPositionWithAnchor(b, c);return cc.pMult(cc.pSub(a,e),-1)},jumpToBottom:function(){this.doLayout();ccui.ScrollView.prototype.jumpToBottom.call(this)},jumpToTop:function(){this.doLayout();ccui.ScrollView.prototype.jumpToTop.call(this)},jumpToLeft:function(){this.doLayout();ccui.ScrollView.prototype.jumpToLeft.call(this)},jumpToRight:function(){this.doLayout();ccui.ScrollView.prototype.jumpToRight.call(this)},jumpToTopLeft:function(){this.doLayout();ccui.ScrollView.prototype.jumpToTopLeft.call(this)},jumpToTopRight:function(){this.doLayout(); ccui.ScrollView.prototype.jumpToTopRight.call(this)},jumpToBottomLeft:function(){this.doLayout();ccui.ScrollView.prototype.jumpToBottomLeft.call(this)},jumpToBottomRight:function(){this.doLayout();ccui.ScrollView.prototype.jumpToBottomRight.call(this)},jumpToPercentVertical:function(a){this.doLayout();ccui.ScrollView.prototype.jumpToPercentVertical.call(this,a)},jumpToPercentHorizontal:function(a){this.doLayout();ccui.ScrollView.prototype.jumpToPercentHorizontal.call(this,a)},jumpToPercentBothDirection:function(a){this.doLayout(); ccui.ScrollView.prototype.jumpToPercentBothDirection.call(this,a)},jumpToItem:function(a,b,c){if(a=this.getItem(a))this.doLayout(),b=this._calculateItemDestination(b,a,c),this.bounceEnabled||(c=cc.pSub(b,this._innerContainer.getPosition()),c=this._getHowMuchOutOfBoundary(c),b.x+=c.x,b.y+=c.y),this._jumpToDestination(b)},scrollToItem:function(a,b,c,d){void 0===d&&(d=1);if(a=this.getItem(a))b=this._calculateItemDestination(b,a,c),this._startAutoScrollToDestination(b,d,!0)},requestRefreshView:function(){this._refreshViewDirty= !0},refreshView:function(){this.forceDoLayout()},doLayout:function(){this._doLayout()},requestDoLayout:function(){this._refreshViewDirty=!0},_doLayout:function(){if(this._refreshViewDirty){for(var a=this._items,b=0;b<a.length;b++){var c=a[b];c.setLocalZOrder(b);this._remedyLayoutParameter(c)}this._updateInnerContainerSize();this._innerContainer.forceDoLayout();this._refreshViewDirty=!1}},addEventListenerListView:function(a,b){this._listViewEventListener=b;this._listViewEventSelector=a},addEventListener:function(a){this._ccListViewEventCallback= a},_selectedItemEvent:function(a){a=a===ccui.Widget.TOUCH_BEGAN?ccui.ListView.ON_SELECTED_ITEM_START:ccui.ListView.ON_SELECTED_ITEM_END;this._listViewEventSelector&&(this._listViewEventListener?this._listViewEventSelector.call(this._listViewEventListener,this,a):this._listViewEventSelector(this,a));this._ccListViewEventCallback&&this._ccListViewEventCallback(this,a)},interceptTouchEvent:function(a,b,c){ccui.ScrollView.prototype.interceptTouchEvent.call(this,a,b,c);if(this._touchEnabled&&a!==ccui.Widget.TOUCH_MOVED){for(c= b;c;){if(c&&c.getParent()===this._innerContainer){this._curSelectedIndex=this.getIndex(c);break}c=c.getParent()}b.isHighlighted()&&this._selectedItemEvent(a)}},getCurSelectedIndex:function(){return this._curSelectedIndex},_onSizeChanged:function(){ccui.ScrollView.prototype._onSizeChanged.call(this);this._refreshViewDirty=!0},getDescription:function(){return"ListView"},_createCloneInstance:function(){return new ccui.ListView},_copyClonedWidgetChildren:function(a){a=a.getItems();for(var b=0;b<a.length;b++)this.pushBackCustomItem(a[b].clone())}, _copySpecialProperties:function(a){a instanceof ccui.ListView&&(ccui.ScrollView.prototype._copySpecialProperties.call(this,a),this.setItemModel(a._model),this.setItemsMargin(a._itemsMargin),this.setGravity(a._gravity),this._listViewEventListener=a._listViewEventListener,this._listViewEventSelector=a._listViewEventSelector)},_startAttenuatingAutoScroll:function(a,b){var c=a;if(0!==this._items.length&&this._magneticType!==ccui.ListView.MAGNETIC_NONE){var c=this._flattenVectorByDirection(c),d=this._getHowMuchOutOfBoundary(c); if(0===d.x&&0===d.y){d=this._magneticType;d===ccui.ListView.MAGNETIC_BOTH_END&&(this._direction===ccui.ScrollView.DIR_HORIZONTAL?d=0<c.x?ccui.ListView.MAGNETIC_LEFT:ccui.ListView.MAGNETIC_RIGHT:this._direction===ccui.ScrollView.DIR_VERTICAL&&(d=0<c.y?ccui.ListView.MAGNETIC_BOTTOM:ccui.ListView.MAGNETIC_TOP));var e=this._getAnchorPointByMagneticType(d),d=cc.pMult(this._innerContainer.getPosition(),-1);d.x+=this.width*e.x;d.y+=this.height*e.y;c=this.getClosestItemToPosition(cc.pSub(d,c),e);c=this._calculateItemPositionWithAnchor(c, e);c=cc.pSub(d,c)}}ccui.ScrollView.prototype._startAttenuatingAutoScroll.call(this,c,b)},_getAnchorPointByMagneticType:function(a){switch(a){case ccui.ListView.MAGNETIC_BOTH_END:return cc.p(0,1);case ccui.ListView.MAGNETIC_CENTER:return cc.p(0.5,0.5);case ccui.ListView.MAGNETIC_LEFT:return cc.p(0,0.5);case ccui.ListView.MAGNETIC_RIGHT:return cc.p(1,0.5);case ccui.ListView.MAGNETIC_TOP:return cc.p(0.5,1);case ccui.ListView.MAGNETIC_BOTTOM:return cc.p(0.5,0)}return cc.p(0,0)},_startMagneticScroll:function(){if(0!== this._items.length&&this._magneticType!==ccui.ListView.MAGNETIC_NONE){var a=this._getAnchorPointByMagneticType(this._magneticType),b=cc.pMult(this._innerContainer.getPosition(),-1);b.x+=this.width*a.x;b.y+=this.height*a.y;b=this.getClosestItemToPosition(b,a);this.scrollToItem(this.getIndex(b),a,a)}}});ccui.ListView.create=function(){return new ccui.ListView};ccui.ListView.EVENT_SELECTED_ITEM=0;ccui.ListView.ON_SELECTED_ITEM_START=0;ccui.ListView.ON_SELECTED_ITEM_END=1;ccui.ListView.GRAVITY_LEFT=0; ccui.ListView.GRAVITY_RIGHT=1;ccui.ListView.GRAVITY_CENTER_HORIZONTAL=2;ccui.ListView.GRAVITY_TOP=3;ccui.ListView.GRAVITY_BOTTOM=4;ccui.ListView.GRAVITY_CENTER_VERTICAL=5;ccui.ListView.MAGNETIC_NONE=0;ccui.ListView.MAGNETIC_CENTER=1;ccui.ListView.MAGNETIC_BOTH_END=2;ccui.ListView.MAGNETIC_LEFT=3;ccui.ListView.MAGNETIC_RIGHT=4;ccui.ListView.MAGNETIC_TOP=5;ccui.ListView.MAGNETIC_BOTTOM=6;ccui.PageView=ccui.ListView.extend({_curPageIdx:0,_childFocusCancelOffset:0,_pageViewEventListener:null,_pageViewEventSelector:null,_className:"PageView",_indicator:null,_indicatorPositionAsAnchorPoint:null,ctor:function(){ccui.ListView.prototype.ctor.call(this);this._childFocusCancelOffset=5;this._indicatorPositionAsAnchorPoint=cc.p(0.5,0.1);this._pageViewEventSelector=this._pageViewEventListener=null;this.setDirection(ccui.ScrollView.DIR_HORIZONTAL);this.setMagneticType(ccui.ListView.MAGNETIC_CENTER); this.setScrollBarEnabled(!1)},addWidgetToPage:function(a,b,c){this.insertCustomItem(a,b)},addPage:function(a){this.pushBackCustomItem(a)},insertPage:function(a,b){this.insertCustomItem(a,b)},removePage:function(a){this.removeItem(this.getIndex(a))},removePageAtIndex:function(a){this.removeItem(a)},removeAllPages:function(){this.removeAllItems()},scrollToItem:function(a){ccui.ListView.prototype.scrollToItem.call(this,a,cc.p(0.5,0.5),cc.p(0.5,0.5))},scrollToPage:function(a){this.scrollToItem(a)},_doLayout:function(){if(this._refreshViewDirty){ccui.ListView.prototype._doLayout.call(this); if(this._indicator){var a=this.getIndex(this.getCenterItemInCurrentView());this._indicator.indicate(a)}this._refreshViewDirty=!1}},setDirection:function(a){ccui.ListView.prototype.setDirection.call(this,a);a===ccui.ScrollView.DIR_HORIZONTAL?this._indicatorPositionAsAnchorPoint=cc.p(0.5,0.1):a===ccui.ScrollView.DIR_VERTICAL&&(this._indicatorPositionAsAnchorPoint=cc.p(0.1,0.5));this._indicator&&(this._indicator.setDirection(a),this._refreshIndicatorPosition())},setCustomScrollThreshold:function(a){}, getCustomScrollThreshold:function(){return 0},setUsingCustomScrollThreshold:function(a){},isUsingCustomScrollThreshold:function(){return!1},_moveInnerContainer:function(a,b){ccui.ListView.prototype._moveInnerContainer.call(this,a,b);this._curPageIdx=this.getIndex(this.getCenterItemInCurrentView());this._indicator&&this._indicator.indicate(this._curPageIdx)},_onItemListChanged:function(){ccui.ListView.prototype._onItemListChanged.call(this);this._indicator&&this._indicator.reset(this._items.length)}, _onSizeChanged:function(){ccui.ListView.prototype._onSizeChanged.call(this);this._refreshIndicatorPosition()},_remedyLayoutParameter:function(a){a.setContentSize(this.getContentSize());ccui.ListView.prototype._remedyLayoutParameter.call(this,a)},_refreshIndicatorPosition:function(){if(this._indicator){var a=this.getContentSize();this._indicator.setPosition(cc.p(a.width*this._indicatorPositionAsAnchorPoint.x,a.height*this._indicatorPositionAsAnchorPoint.y))}},_handleReleaseLogic:function(a){ccui.ScrollView.prototype._handleReleaseLogic.call(this, a);if(!(0>=this._items.length))if(a=this._flattenVectorByDirection(this._calculateTouchMoveVelocity()),500>cc.pLength(a))this._startMagneticScroll();else{var b=this.getItem(this._curPageIdx),b=this._calculateItemDestination(cc.p(0.5,0.5),b,cc.p(0.5,0.5)),b=cc.pSub(b,this.getInnerContainerPosition()),b=this._flattenVectorByDirection(b);0<a.x*b.x||0<a.y*b.y?this._startMagneticScroll():(0>a.x||0<a.y?++this._curPageIdx:--this._curPageIdx,this._curPageIdx=Math.min(this._curPageIdx,this._items.length), this._curPageIdx=Math.max(this._curPageIdx,0),this.scrollToItem(this._curPageIdx))}},_getAutoScrollStopEpsilon:function(){return 0.001},_pageTurningEvent:function(){this._pageViewEventSelector&&(this._pageViewEventListener?this._pageViewEventSelector.call(this._pageViewEventListener,this,ccui.PageView.EVENT_TURNING):this._pageViewEventSelector(this,ccui.PageView.EVENT_TURNING));this._ccEventCallback&&this._ccEventCallback(this,ccui.PageView.EVENT_TURNING)},addEventListenerPageView:function(a,b){this._pageViewEventSelector= a;this._pageViewEventListener=b},addEventListener:function(a){this._ccEventCallback=function(b,c){c==ccui.ScrollView.EVENT_AUTOSCROLL_ENDED&&a(this,c)}},setCurrentPageIndex:function(a){this.jumpToItem(a,cc.p(0.5,0.5),cc.p(0.5,0.5))},setCurPageIndex:function(a){this.setCurrentPageIndex(a)},getCurrentPageIndex:function(){return this._curPageIdx},getCurPageIndex:function(){var a=this.getCenterItemInCurrentView();return this.getIndex(a)},getPages:function(){return this.getItems()},getPage:function(a){return this.getItem(a)}, getDescription:function(){return"PageView"},_createCloneInstance:function(){return new ccui.PageView},_copyClonedWidgetChildren:function(a){a=a.getPages();for(var b=0;b<a.length;b++)this.addPage(a[b].clone())},_copySpecialProperties:function(a){ccui.ListView.prototype._copySpecialProperties.call(this,a);this._ccEventCallback=a._ccEventCallback;this._pageViewEventListener=a._pageViewEventListener;this._pageViewEventSelector=a._pageViewEventSelector;this._customScrollThreshold=a._customScrollThreshold}, setIndicatorEnabled:function(a){a!=(null!==this._indicator)&&(a?(this._indicator=new ccui.PageViewIndicator,this._indicator.setDirection(this.getDirection()),this.addProtectedChild(this._indicator,1E4),this.setIndicatorSelectedIndexColor(cc.color(100,100,255)),this._refreshIndicatorPosition()):(this.removeProtectedChild(this._indicator),this._indicator=null))},getIndicatorEnabled:function(){return null!==this._indicator},setIndicatorPositionAsAnchorPoint:function(a){this._indicatorPositionAsAnchorPoint= a;this._refreshIndicatorPosition()},getIndicatorPositionAsAnchorPoint:function(){return this._indicatorPositionAsAnchorPoint},setIndicatorPosition:function(a){if(this._indicator){var b=this.getContentSize();this._indicatorPositionAsAnchorPoint.x=a.x/b.width;this._indicatorPositionAsAnchorPoint.y=a.y/b.height;this._indicator.setPosition(a)}},getIndicatorPosition:function(){cc.assert(null!==this._indicator,"");return this._indicator.getPosition()},setIndicatorSpaceBetweenIndexNodes:function(a){this._indicator&& this._indicator.setSpaceBetweenIndexNodes(a)},getIndicatorSpaceBetweenIndexNodes:function(){cc.assert(null!==this._indicator,"");return this._indicator.getSpaceBetweenIndexNodes()},setIndicatorSelectedIndexColor:function(a){this._indicator&&this._indicator.setSelectedIndexColor(a)},getIndicatorSelectedIndexColor:function(){cc.assert(null!==this._indicator,"");return this._indicator.getSelectedIndexColor()},setIndicatorIndexNodesColor:function(a){this._indicator&&this._indicator.setIndexNodesColor(a)}, getIndicatorIndexNodesColor:function(){cc.assert(null!==this._indicator,"");return this._indicator.getIndexNodesColor()},setIndicatorIndexNodesScale:function(a){this._indicator&&(this._indicator.setIndexNodesScale(a),this._indicator.indicate(this._curPageIdx))},getIndicatorIndexNodesScale:function(){cc.assert(null!==this._indicator,"");return this._indicator.getIndexNodesScale()},setIndicatorIndexNodesTexture:function(a,b){this._indicator&&(this._indicator.setIndexNodesTexture(a,b),this._indicator.indicate(this._curPageIdx))}}); ccui.PageView.create=function(){return new ccui.PageView};ccui.PageView.EVENT_TURNING=0;ccui.PageView.TOUCH_DIR_LEFT=0;ccui.PageView.TOUCH_DIR_RIGHT=1;ccui.PageView.DIRECTION_LEFT=0;ccui.PageView.DIRECTION_RIGHT=1;ccui.PageViewIndicator=ccui.ProtectedNode.extend({_direction:null,_indexNodes:null,_currentIndexNode:null,_spaceBetweenIndexNodes:0,_indexNodesScale:1,_indexNodesColor:null,_useDefaultTexture:!0,_indexNodesTextureFile:"",_indexNodesTexType:ccui.Widget.LOCAL_TEXTURE,_className:"PageViewIndicator",ctor:function(){cc.ProtectedNode.prototype.ctor.call(this);this._direction=ccui.ScrollView.DIR_HORIZONTAL;this._indexNodes=[];this._spaceBetweenIndexNodes=ccui.PageViewIndicator.SPACE_BETWEEN_INDEX_NODES_DEFAULT; this._indexNodesColor=cc.color.WHITE;this._currentIndexNode=ccui.helper._createSpriteFromBase64(ccui.PageViewIndicator.CIRCLE_IMAGE,ccui.PageViewIndicator.CIRCLE_IMAGE_KEY);this._currentIndexNode.setVisible(!1);this.addProtectedChild(this._currentIndexNode,1)},setDirection:function(a){this._direction=a;this._rearrange()},reset:function(a){for(;this._indexNodes.length<a;)this._increaseNumberOfPages();for(;this._indexNodes.length>a;)this._decreaseNumberOfPages();this._rearrange();this._currentIndexNode.setVisible(0< this._indexNodes.length)},indicate:function(a){0>a||a>=this._indexNodes.length||this._currentIndexNode.setPosition(this._indexNodes[a].getPosition())},_rearrange:function(){if(0!==this._indexNodes.length)for(var a=this._direction===ccui.ScrollView.DIR_HORIZONTAL,b=this._indexNodes[0].getContentSize(),c=a?b.width:b.height,d=this._indexNodes.length,d=-((c*d+this._spaceBetweenIndexNodes*(d-1))/2)+c/2,e=0;e<this._indexNodes.length;++e){var f;f=a?cc.p(d,b.height/2):cc.p(b.width/2,-d);this._indexNodes[e].setPosition(f); d+=c+this._spaceBetweenIndexNodes}},setSpaceBetweenIndexNodes:function(a){this._spaceBetweenIndexNodes!==a&&(this._spaceBetweenIndexNodes=a,this._rearrange())},getSpaceBetweenIndexNodes:function(){return this._spaceBetweenIndexNodes},setSelectedIndexColor:function(a){this._currentIndexNode.setColor(a)},getSelectedIndexColor:function(){return this._currentIndexNode.getColor()},setIndexNodesColor:function(a){this._indexNodesColor=a;for(var b=0;b<this._indexNodes.length;++b)this._indexNodes[b].setColor(a)}, getIndexNodesColor:function(){var a=this._indexNodesColor;return cc.color(a.r,a.g,a.b,a.a)},setIndexNodesScale:function(a){if(this._indexNodesScale!==a){this._indexNodesScale=a;this._currentIndexNode.setScale(a);for(a=0;a<this._indexNodes.length;++a)this._indexNodes[a].setScale(this,_indexNodesScale);this._rearrange()}},getIndexNodesScale:function(){return this._indexNodesScale},setIndexNodesTexture:function(a,b){void 0===b&&(b=ccui.Widget.LOCAL_TEXTURE);this._useDefaultTexture=!1;this._indexNodesTextureFile= a;this._indexNodesTexType=b;switch(b){case ccui.Widget.LOCAL_TEXTURE:this._currentIndexNode.setTexture(a);for(var c=0;c<this._indexNodes.length;++c)this._indexNodes[c].setTexture(a);break;case ccui.Widget.PLIST_TEXTURE:for(this._currentIndexNode.setSpriteFrame(a),c=0;c<this._indexNodes.length;++c)this._indexNodes[c].setSpriteFrame(a)}this._rearrange()},_increaseNumberOfPages:function(){var a;if(this._useDefaultTexture)a=ccui.helper._createSpriteFromBase64(ccui.PageViewIndicator.CIRCLE_IMAGE,ccui.PageViewIndicator.CIRCLE_IMAGE_KEY); else switch(a=new cc.Sprite,this._indexNodesTexType){case ccui.Widget.LOCAL_TEXTURE:a.initWithFile(this._indexNodesTextureFile);break;case ccui.Widget.PLIST_TEXTURE:a.initWithSpriteFrameName(this._indexNodesTextureFile)}a.setColor(this._indexNodesColor);a.setScale(this._indexNodesScale);this.addProtectedChild(a);this._indexNodes.push(a)},_decreaseNumberOfPages:function(){0!==this._indexNodes.length&&(this.removeProtectedChild(this._indexNodes[0]),this._indexNodes.splice(0,1))},clear:function(){for(var a= 0;a<this._indexNodes.length;++a)this.removeProtectedChild(this._indexNodes[a]);this._indexNodes.length=0;this._currentIndexNode.setVisible(!1)}});_p=ccui.PageViewIndicator.prototype;cc.defineGetterSetter(_p,"spaceBetweenIndexNodes",_p.getSpaceBetweenIndexNodes,_p.setSpaceBetweenIndexNodes);ccui.PageViewIndicator.SPACE_BETWEEN_INDEX_NODES_DEFAULT=23;ccui.PageViewIndicator.CIRCLE_IMAGE_KEY="/__circle_image";ccui.PageViewIndicator.CIRCLE_IMAGE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAA8ElEQVRIx62VyRGCQBBF+6gWRCEmYDIQkhiBCgHhSclC8YqWzOV5oVzKAYZp3r1/9fpbxAIBMTsKrjx5cqVgR0wgLhCRUWOjJiPqD56xoaGPhpRZV/iSEy6crHmw5oIrF9b/lVeMofrJgjlnxlIy/wik+JB+mme8BExbBhm+5CJC2LE2LtSEQoyGWDioBA5CoRIohJtK4CYDxzNEM4GAugR1E9VjVC+SZpXvhCJCrjomESLvc17pDGX7bWmlh6UtpjPVCWy9zaJ0TD7qfm3pwERMz2trRVZk3K3BD/L34AY+dEDCniMVBkPFkT2J/b2/AIV+dRpFLOYoAAAAAElFTkSuQmCC";(function(){if(ccui.ProtectedNode.CanvasRenderCmd){ccui.ScrollView.CanvasRenderCmd=function(a){this._layoutCmdCtor(a);this._dirty=!1};var a=ccui.ScrollView.CanvasRenderCmd.prototype=Object.create(ccui.Layout.CanvasRenderCmd.prototype);a.constructor=ccui.ScrollView.CanvasRenderCmd;a.rendering=function(a){var c=cc.renderer._cacheToCanvasCmds[this._node.__instanceId],d,e=cc.view.getScaleX(),f=cc.view.getScaleY(),g=a||cc._renderContext;g.computeRealOffsetY();this._node.updateChildren();a=0;for(d=c.length;a< d;a++){var h=c[a]._node;h instanceof ccui.ScrollView||h&&h._parent&&!1===h._parent._inViewRect||c[a].rendering(g,e,f)}}}})();(function(){if(ccui.ProtectedNode.WebGLRenderCmd){ccui.ScrollView.WebGLRenderCmd=function(a){this._layoutCmdCtor(a);this._needDraw=!0;this._dirty=!1};var a=ccui.ScrollView.WebGLRenderCmd.prototype=Object.create(ccui.Layout.WebGLRenderCmd.prototype);a.constructor=ccui.ScrollView.WebGLRenderCmd;a.rendering=function(a){var c=cc.renderer._cacheToBufferCmds[this._node.__instanceId],d,e,f,g=a||cc._renderContext;if(c)for(this._node.updateChildren(),g.bindBuffer(gl.ARRAY_BUFFER,null),a=0,d=c.length;a<d;a++)f= c[a],e=f._node,e&&e._parent&&!1===e._parent._inViewRect||(f.uploadData?cc.renderer._uploadBufferData(f):(0<f._batchingSize&&cc.renderer._batchRendering(),f.rendering(g)),cc.renderer._batchRendering())}}})();cc.Component=cc.Class.extend({_owner:null,_name:"",_enabled:!0,ctor:function(){this._owner=null;this._name="";this._enabled=!0},init:function(){return!0},onEnter:function(){},onExit:function(){},update:function(a){},serialize:function(a){},isEnabled:function(){return this._enabled},setEnabled:function(a){this._enabled=a},getName:function(){return this._name},setName:function(a){this._name=a},setOwner:function(a){this._owner=a},getOwner:function(){return this._owner}});cc.Component.create=function(){return new cc.Component};cc.ComponentContainer=cc.Class.extend({_components:null,_owner:null,ctor:function(a){this._components=null;this._owner=a},getComponent:function(a){if(!a)throw Error("cc.ComponentContainer.getComponent(): name should be non-null");a=a.trim();this._components||(this._components={});return this._components[a]},add:function(a){if(!a)throw Error("cc.ComponentContainer.add(): component should be non-null");if(a.getOwner())return cc.log("cc.ComponentContainer.add(): Component already added. It can't be added again"), !1;null==this._components&&(this._components={},this._owner.scheduleUpdate());if(this._components[a.getName()])return cc.log("cc.ComponentContainer.add(): Component already added. It can't be added again"),!1;a.setOwner(this._owner);this._components[a.getName()]=a;a.onEnter();return!0},remove:function(a){if(!a)throw Error("cc.ComponentContainer.remove(): name should be non-null");if(!this._components)return!1;if(a instanceof cc.Component)return this._removeByComponent(a);a=a.trim();return this._removeByComponent(this._components[a])}, _removeByComponent:function(a){if(!a)return!1;a.onExit();a.setOwner(null);delete this._components[a.getName()];return!0},removeAll:function(){if(this._components){var a=this._components,b;for(b in a){var c=a[b];c.onExit();c.setOwner(null);delete a[b]}this._owner.unscheduleUpdate();this._components=null}},_alloc:function(){this._components={}},visit:function(a){if(this._components){var b=this._components,c;for(c in b)b[c].update(a)}},isEmpty:function(){return this._components?0===this._components.length: !0}});ccui.LayoutComponent_ReferencePoint={BOTTOM_LEFT:0,TOP_LEFT:1,BOTTOM_RIGHT:2,TOP_RIGHT:3};ccui.LayoutComponent_PositionType={Position:0,RelativePosition:1,PreRelativePosition:2,PreRelativePositionEnable:3};ccui.LayoutComponent_SizeType={Size:0,PreSize:1,PreSizeEnable:2}; ccui.LayoutComponent=cc.Component.extend({_horizontalEdge:0,_verticalEdge:0,_leftMargin:0,_rightMargin:0,_bottomMargin:0,_topMargin:0,_usingPositionPercentX:!1,_positionPercentX:0,_usingPositionPercentY:!1,_positionPercentY:0,_usingStretchWidth:!1,_usingStretchHeight:!1,_percentWidth:0,_usingPercentWidth:!1,_percentHeight:0,_usingPercentHeight:!1,_actived:!0,_isPercentOnly:!1,ctor:function(){this._name=ccui.LayoutComponent.NAME},init:function(){return cc.Component.prototype.init.call(this)?!0:!1}, getPercentContentSize:function(){return cc.p(this._percentWidth,this._percentHeight)},setPercentContentSize:function(a){this.setPercentWidth(a.x);this.setPercentHeight(a.y)},setUsingPercentContentSize:function(a){this._usingPercentWidth=this._usingPercentHeight=a},SetActiveEnable:function(a){this._actived=a},getUsingPercentContentSize:function(){return this._usingPercentWidth&&this._usingPercentHeight},getAnchorPosition:function(){return this._owner.getAnchorPoint()},setAnchorPosition:function(a, b){var c=this._owner.getBoundingBox();this._owner.setAnchorPoint(a,b);var d=this._owner.getBoundingBox(),e=c.x-d.x,c=c.y-d.y,d=this._owner.getPosition();d.x+=e;d.y+=c;this.setPosition(d)},getPosition:function(){return this._owner.getPosition()},setPosition:function(a,b){var c=this._getOwnerParent(),d;null!=c?(void 0===b?(d=a.x,b=a.y):d=a,c=c.getContentSize(),0!==c.width?this._positionPercentX=d/c.width:(this._positionPercentX=0,this._usingPositionPercentX&&(d=0)),0!==c.height?this._positionPercentY= b/c.height:(this._positionPercentY=0,this._usingPositionPercentY&&(b=0)),this._owner.setPosition(d,b),this._refreshHorizontalMargin(),this._refreshVerticalMargin()):this._owner.setPosition(a,b)},isPositionPercentXEnabled:function(){return this._usingPositionPercentX},setPositionPercentXEnabled:function(a){if(this._usingPositionPercentX=a)this._horizontalEdge=ccui.LayoutComponent.horizontalEdge.NONE},getPositionPercentX:function(){return this._positionPercentX},setPositionPercentX:function(a){this._positionPercentX= a;a=this._getOwnerParent();null!==a&&(this._owner.setPositionX(a.width*this._positionPercentX),this._refreshHorizontalMargin())},isPositionPercentYEnabled:function(){return this._usingPositionPercentY},setPositionPercentYEnabled:function(a){if(this._usingPositionPercentY=a)this._verticalEdge=ccui.LayoutComponent.verticalEdge.NONE},getPositionPercentY:function(){return this._positionPercentY},setPositionPercentY:function(a){this._positionPercentY=a;a=this._getOwnerParent();null!==a&&(this._owner.setPositionY(a.height* this._positionPercentY),this._refreshVerticalMargin())},getHorizontalEdge:function(){return this._horizontalEdge},setHorizontalEdge:function(a){this._horizontalEdge=a;this._horizontalEdge!==ccui.LayoutComponent.horizontalEdge.NONE&&(this._usingPositionPercentX=!1);var b=this._getOwnerParent();null!==b&&(a=this._owner.getPosition(),b=b.getContentSize(),0!==b.width?this._positionPercentX=a.x/b.width:(this._positionPercentX=0,a.x=0,this._usingPositionPercentX&&this._owner.setPosition(a)),this._refreshHorizontalMargin())}, getVerticalEdge:function(){return this._verticalEdge},setVerticalEdge:function(a){this._verticalEdge=a;this._verticalEdge!==ccui.LayoutComponent.verticalEdge.NONE&&(this._usingPositionPercentY=!1);var b=this._getOwnerParent();null!==b&&(a=this._owner.getPosition(),b=b.getContentSize(),0!==b.height?this._positionPercentY=a.y/b.height:(this._positionPercentY=0,a.y=0,this._usingPositionPercentY&&this._owner.setPosition(a)),this._refreshVerticalMargin())},getLeftMargin:function(){return this._leftMargin}, setLeftMargin:function(a){this._leftMargin=a},getRightMargin:function(){return this._rightMargin},setRightMargin:function(a){this._rightMargin=a},getTopMargin:function(){return this._topMargin},setTopMargin:function(a){this._topMargin=a},getBottomMargin:function(){return this._bottomMargin},setBottomMargin:function(a){this._bottomMargin=a},getSize:function(){return this.getOwner().getContentSize()},setSize:function(a){var b=this._getOwnerParent();null!==b?(b=b.getContentSize(),0!==b.width?this._percentWidth= a.width/b.width:(this._percentWidth=0,this._usingPercentWidth&&(a.width=0)),0!==b.height?this._percentHeight=a.height/b.height:(this._percentHeight=0,this._usingPercentHeight&&(a.height=0)),this._owner.setContentSize(a),this._refreshHorizontalMargin(),this._refreshVerticalMargin()):this._owner.setContentSize(a)},isPercentWidthEnabled:function(){return this._usingPercentWidth},setPercentWidthEnabled:function(a){if(this._usingPercentWidth=a)this._usingStretchWidth=!1},getSizeWidth:function(){return this._owner.width}, setSizeWidth:function(a){var b=this._owner.getContentSize();b.width=a;a=this._getOwnerParent();null!==a?(a=a.getContentSize(),0!==a.width?this._percentWidth=b.width/a.width:(this._percentWidth=0,this._usingPercentWidth&&(b.width=0)),this._owner.setContentSize(b),this._refreshHorizontalMargin()):this._owner.setContentSize(b)},getPercentWidth:function(){return this._percentWidth},setPercentWidth:function(a){this._percentWidth=a;a=this._getOwnerParent();if(null!==a){var b=this._owner.getContentSize(); b.width=a.width*this._percentWidth;this._owner.setContentSize(b);this._refreshHorizontalMargin()}},isPercentHeightEnabled:function(){return this._usingPercentHeight},setPercentHeightEnabled:function(a){if(this._usingPercentHeight=a)this._usingStretchHeight=!1},getSizeHeight:function(){return this._owner.height},setSizeHeight:function(a){var b=this._owner.getContentSize();b.height=a;a=this._getOwnerParent();null!==a?(a=a.getContentSize(),0!==a.height?this._percentHeight=b.height/a.height:(this._percentHeight= 0,this._usingPercentHeight&&(b.height=0)),this._owner.setContentSize(b),this._refreshVerticalMargin()):this._owner.setContentSize(b)},getPercentHeight:function(){return this._percentHeight},setPercentHeight:function(a){this._percentHeight=a;a=this._getOwnerParent();if(null!==a){var b=this._owner.getContentSize();b.height=a.height*this._percentHeight;this._owner.setContentSize(b);this._refreshVerticalMargin()}},isStretchWidthEnabled:function(){return this._usingStretchWidth},setStretchWidthEnabled:function(a){if(this._usingStretchWidth= a)this._usingPercentWidth=!1},isStretchHeightEnabled:function(){return this._usingStretchHeight},setStretchHeightEnabled:function(a){if(this._usingStretchHeight=a)this._usingPercentHeight=!1},setPercentOnlyEnabled:function(a){this._isPercentOnly=a},setActiveEnabled:function(a){this._actived=a},refreshLayout:function(){if(this._actived){var a=this._getOwnerParent();if(null!==a){var a=a.getContentSize(),b=this._owner,c=b.getAnchorPoint(),d=b.getContentSize(),e=b.getPosition();switch(this._horizontalEdge){case ccui.LayoutComponent.horizontalEdge.NONE:this._usingStretchWidth&& !this._isPercentOnly?(d.width=a.width*this._percentWidth,e.x=this._leftMargin+c.x*d.width):(this._usingPositionPercentX&&(e.x=a.width*this._positionPercentX),this._usingPercentWidth&&(d.width=a.width*this._percentWidth));break;case ccui.LayoutComponent.horizontalEdge.LEFT:if(this._isPercentOnly)break;if(this._usingPercentWidth||this._usingStretchWidth)d.width=a.width*this._percentWidth;e.x=this._leftMargin+c.x*d.width;break;case ccui.LayoutComponent.horizontalEdge.RIGHT:if(this._isPercentOnly)break; if(this._usingPercentWidth||this._usingStretchWidth)d.width=a.width*this._percentWidth;e.x=a.width-(this._rightMargin+(1-c.x)*d.width);break;case ccui.LayoutComponent.horizontalEdge.CENTER:if(this._isPercentOnly)break;this._usingStretchWidth?(d.width=a.width-this._leftMargin-this._rightMargin,0>d.width&&(d.width=0),e.x=this._leftMargin+c.x*d.width):(this._usingPercentWidth&&(d.width=a.width*this._percentWidth),e.x=a.width*this._positionPercentX)}switch(this._verticalEdge){case ccui.LayoutComponent.verticalEdge.NONE:this._usingStretchHeight&& !this._isPercentOnly?(d.height=a.height*this._percentHeight,e.y=this._bottomMargin+c.y*d.height):(this._usingPositionPercentY&&(e.y=a.height*this._positionPercentY),this._usingPercentHeight&&(d.height=a.height*this._percentHeight));break;case ccui.LayoutComponent.verticalEdge.BOTTOM:if(this._isPercentOnly)break;if(this._usingPercentHeight||this._usingStretchHeight)d.height=a.height*this._percentHeight;e.y=this._bottomMargin+c.y*d.height;break;case ccui.LayoutComponent.verticalEdge.TOP:if(this._isPercentOnly)break; if(this._usingPercentHeight||this._usingStretchHeight)d.height=a.height*this._percentHeight;e.y=a.height-(this._topMargin+(1-c.y)*d.height);break;case ccui.LayoutComponent.verticalEdge.CENTER:if(this._isPercentOnly)break;this._usingStretchHeight?(d.height=a.height-this._topMargin-this._bottomMargin,0>d.height&&(d.height=0),e.y=this._bottomMargin+c.y*d.height):(this._usingPercentHeight&&(d.height=a.height*this._percentHeight),e.y=a.height*this._positionPercentY)}b.setPosition(e);b.setContentSize(d); if(b instanceof ccui.PageView)for(b.forceDoLayout(),a=b.getPages(),b=0;b<a.length;b++)ccui.helper.doLayout(a[b]);else ccui.helper.doLayout(b)}}},_getOwnerParent:function(){return this._owner?this._owner.getParent():null},_refreshHorizontalMargin:function(){var a=this._getOwnerParent();if(null!==a){var b=this._owner.getPosition(),c=this._owner.getAnchorPoint(),d=this._owner.getContentSize(),a=a.getContentSize();this._leftMargin=b.x-c.x*d.width;this._rightMargin=a.width-(b.x+(1-c.x)*d.width)}},_refreshVerticalMargin:function(){var a= this._getOwnerParent();if(null!==a){var b=this._owner.getPosition(),c=this._owner.getAnchorPoint(),d=this._owner.getContentSize(),a=a.getContentSize();this._bottomMargin=b.y-c.y*d.height;this._topMargin=a.height-(b.y+(1-c.y)*d.height)}}});ccui.LayoutComponent.horizontalEdge={NONE:0,LEFT:1,RIGHT:2,CENTER:3};ccui.LayoutComponent.verticalEdge={NONE:0,BOTTOM:1,TOP:2,CENTER:3};ccui.LayoutComponent.NAME="__ui_layout"; ccui.LayoutComponent.bindLayoutComponent=function(a){var b=a.getComponent(ccui.LayoutComponent.NAME);if(void 0!==b)return b;b=new ccui.LayoutComponent;b.init();a.addComponent(b);a instanceof ccui.Widget||a.addEventListener&&a.addEventListener("load",function(){b.refreshLayout()},this);return b};var ccs=ccs||{};ccs.Class=ccs.Class||cc.Class;ccs.Class.extend=ccs.Class.extend||cc.Class.extend;ccs.Node=ccs.Node||cc.Node;ccs.Node.extend=ccs.Node.extend||cc.Node.extend;ccs.Sprite=ccs.Sprite||cc.Sprite;ccs.Sprite.extend=ccs.Sprite.extend||cc.Sprite.extend;ccs.Component=ccs.Component||cc.Component;ccs.Component.extend=ccs.Component.extend||cc.Component.extend;ccs.cocostudioVersion="v1.3.0.0";ccs.VERSION_COMBINED=0.3;ccs.VERSION_CHANGE_ROTATION_RANGE=1;ccs.VERSION_COLOR_READING=1.1;ccs.MAX_VERTEXZ_VALUE=5E6;ccs.ARMATURE_MAX_CHILD=50;ccs.ARMATURE_MAX_ZORDER=100;ccs.ARMATURE_MAX_COUNT=ccs.MAX_VERTEXZ_VALUE/ccs.ARMATURE_MAX_CHILD/ccs.ARMATURE_MAX_ZORDER;ccs.AUTO_ADD_SPRITE_FRAME_NAME_PREFIX=!1;ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT=!1;ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX=!1;ccs.armatureVersion=function(){return"v1.1.0.0"};ccs.CONST_VERSION="version";ccs.CONST_VERSION_2_0=2;ccs.CONST_VERSION_COMBINED=0.3;ccs.CONST_ARMATURES="armatures";ccs.CONST_ARMATURE="armature";ccs.CONST_BONE="b";ccs.CONST_DISPLAY="d";ccs.CONST_ANIMATIONS="animations";ccs.CONST_ANIMATION="animation";ccs.CONST_MOVEMENT="mov";ccs.CONST_FRAME="f";ccs.CONST_TEXTURE_ATLAS="TextureAtlas";ccs.CONST_SUB_TEXTURE="SubTexture";ccs.CONST_SKELETON="skeleton";ccs.CONST_A_NAME="name";ccs.CONST_A_DURATION="dr";ccs.CONST_A_FRAME_INDEX="fi"; ccs.CONST_A_DURATION_TO="to";ccs.CONST_A_DURATION_TWEEN="drTW";ccs.CONST_A_LOOP="lp";ccs.CONST_A_MOVEMENT_SCALE="sc";ccs.CONST_A_MOVEMENT_DELAY="dl";ccs.CONST_A_DISPLAY_INDEX="dI";ccs.CONST_A_PLIST="plist";ccs.CONST_A_PARENT="parent";ccs.CONST_A_SKEW_X="kX";ccs.CONST_A_SKEW_Y="kY";ccs.CONST_A_SCALE_X="cX";ccs.CONST_A_SCALE_Y="cY";ccs.CONST_A_Z="z";ccs.CONST_A_EVENT="evt";ccs.CONST_A_SOUND="sd";ccs.CONST_A_SOUND_EFFECT="sdE";ccs.CONST_A_TWEEN_EASING="twE";ccs.CONST_A_EASING_PARAM="twEP"; ccs.CONST_A_TWEEN_ROTATE="twR";ccs.CONST_A_IS_ARMATURE="isArmature";ccs.CONST_A_DISPLAY_TYPE="displayType";ccs.CONST_A_MOVEMENT="mov";ccs.CONST_A_X="x";ccs.CONST_A_Y="y";ccs.CONST_A_COCOS2DX_X="cocos2d_x";ccs.CONST_A_COCOS2DX_Y="cocos2d_y";ccs.CONST_A_WIDTH="width";ccs.CONST_A_HEIGHT="height";ccs.CONST_A_PIVOT_X="pX";ccs.CONST_A_PIVOT_Y="pY";ccs.CONST_A_COCOS2D_PIVOT_X="cocos2d_pX";ccs.CONST_A_COCOS2D_PIVOT_Y="cocos2d_pY";ccs.CONST_A_BLEND_TYPE="bd";ccs.CONST_A_BLEND_SRC="bd_src"; ccs.CONST_A_BLEND_DST="bd_dst";ccs.CONST_A_ALPHA="a";ccs.CONST_A_RED="r";ccs.CONST_A_GREEN="g";ccs.CONST_A_BLUE="b";ccs.CONST_A_ALPHA_OFFSET="aM";ccs.CONST_A_RED_OFFSET="rM";ccs.CONST_A_GREEN_OFFSET="gM";ccs.CONST_A_BLUE_OFFSET="bM";ccs.CONST_A_COLOR_TRANSFORM="colorTransform";ccs.CONST_A_TWEEN_FRAME="tweenFrame";ccs.CONST_CONTOUR="con";ccs.CONST_CONTOUR_VERTEX="con_vt";ccs.CONST_FL_NAN="NaN";ccs.CONST_FRAME_DATA="frame_data";ccs.CONST_MOVEMENT_BONE_DATA="mov_bone_data";ccs.CONST_MOVEMENT_DATA="mov_data"; ccs.CONST_ANIMATION_DATA="animation_data";ccs.CONST_DISPLAY_DATA="display_data";ccs.CONST_SKIN_DATA="skin_data";ccs.CONST_BONE_DATA="bone_data";ccs.CONST_ARMATURE_DATA="armature_data";ccs.CONST_CONTOUR_DATA="contour_data";ccs.CONST_TEXTURE_DATA="texture_data";ccs.CONST_VERTEX_POINT="vertex";ccs.CONST_COLOR_INFO="color";ccs.CONST_CONFIG_FILE_PATH="config_file_path";ccs.CONST_CONTENT_SCALE="content_scale"; ccs.DataInfo=function(){this.asyncStruct=null;this.configFileQueue=[];this.contentScale=1;this.baseFilePath=this.filename="";this.cocoStudioVersion=this.flashToolVersion=0}; ccs.dataReaderHelper={ConfigType:{DragonBone_XML:0,CocoStudio_JSON:1,CocoStudio_Binary:2},_configFileList:[],_flashToolVersion:ccs.CONST_VERSION_2_0,_positionReadScale:1,_asyncRefCount:0,_asyncRefTotalCount:0,_dataQueue:null,setPositionReadScale:function(a){this._positionReadScale=a},getPositionReadScale:function(){return this._positionReadScale},addDataFromFile:function(a){if(-1===this._configFileList.indexOf(a)){this._configFileList.push(a);var b=this._initBaseFilePath(a),c=cc.path.extname(a).toLowerCase(), d=new ccs.DataInfo;d.filename=a;d.basefilePath=b;".xml"===c?ccs.dataReaderHelper.addDataFromXML(a,d):".json"===c||".exportjson"===c?ccs.dataReaderHelper.addDataFromJson(a,d):".csb"===c&&ccs.dataReaderHelper.addDataFromBinaryCache(a,d)}},addDataFromFileAsync:function(a,b,c,d,e){if(-1!==this._configFileList.indexOf(c))e&&d&&(0===this._asyncRefTotalCount&&0===this._asyncRefCount?this._asyncCallBack(d,e,1):this._asyncCallBack(d,e,(this._asyncRefTotalCount-this._asyncRefCount)/this._asyncRefTotalCount)); else{this._asyncRefTotalCount++;this._asyncRefCount++;var f=this;cc.director.getScheduler().schedule(function(){f.addDataFromFile(c);f._asyncRefCount--;f._asyncCallBack(d,e,(f._asyncRefTotalCount-f._asyncRefCount)/f._asyncRefTotalCount)},this,0.1,!1,0,!1,"armatrueDataHelper")}},removeConfigFile:function(a){for(var b=this._configFileList,c=b.length,d=b[c],e=0;e<c;e++)b[e]===a&&(d=e);d!==b[c]&&cc.arrayRemoveObject(b,a)},addDataFromCache:function(a,b){if(a){b.flashToolVersion=parseFloat(a.getAttribute(ccs.CONST_VERSION)); var c=a.querySelectorAll(ccs.CONST_SKELETON+" \x3e "+ccs.CONST_ARMATURES+" \x3e "+ccs.CONST_ARMATURE+""),d=ccs.armatureDataManager,e;for(e=0;e<c.length;e++){var f=this.decodeArmature(c[e],b);d.addArmatureData(f.name,f,b.filename)}c=a.querySelectorAll(ccs.CONST_SKELETON+" \x3e "+ccs.CONST_ANIMATIONS+" \x3e "+ccs.CONST_ANIMATION+"");for(e=0;e<c.length;e++)f=this.decodeAnimation(c[e],b),d.addAnimationData(f.name,f,b.filename);c=a.querySelectorAll(ccs.CONST_SKELETON+" \x3e "+ccs.CONST_TEXTURE_ATLAS+ " \x3e "+ccs.CONST_SUB_TEXTURE+"");for(e=0;e<c.length;e++)f=this.decodeTexture(c[e],b),d.addTextureData(f.name,f,b.filename)}else cc.log("XML error or XML is empty.")},decodeArmature:function(a,b){var c=new ccs.ArmatureData;c.init();c.name=a.getAttribute(ccs.CONST_A_NAME);for(var d=a.querySelectorAll(ccs.CONST_ARMATURE+" \x3e "+ccs.CONST_BONE),e=0;e<d.length;e++){var f=d[e],g=f.getAttribute(ccs.CONST_A_PARENT),h=null;if(g)for(var k=0;k<d.length&&(h=d[k],g!=d[k].getAttribute(ccs.CONST_A_NAME));k++); f=this.decodeBone(f,h,b);c.addBoneData(f)}return c},decodeArmatureFromJSON:function(a,b){var c=new ccs.ArmatureData;c.init();var d=a[ccs.CONST_A_NAME];d&&(c.name=d);b.cocoStudioVersion=c.dataVersion=a[ccs.CONST_VERSION]||0.1;for(var d=a[ccs.CONST_BONE_DATA],e=0;e<d.length;e++){var f=this.decodeBoneFromJson(d[e],b);c.addBoneData(f)}return c},decodeBone:function(a,b,c){b=new ccs.BoneData;b.init();b.name=a.getAttribute(ccs.CONST_A_NAME);b.parentName=a.getAttribute(ccs.CONST_A_PARENT)||"";b.zOrder=parseInt(a.getAttribute(ccs.CONST_A_Z))|| 0;a=a.querySelectorAll(ccs.CONST_BONE+" \x3e "+ccs.CONST_DISPLAY);for(var d=0;d<a.length;d++){var e=this.decodeBoneDisplay(a[d],c);b.addDisplayData(e)}return b},decodeBoneFromJson:function(a,b){var c=new ccs.BoneData;c.init();this.decodeNodeFromJson(c,a,b);c.name=a[ccs.CONST_A_NAME]||"";c.parentName=a[ccs.CONST_A_PARENT]||"";for(var d=a[ccs.CONST_DISPLAY_DATA]||[],e=0;e<d.length;e++){var f=this.decodeBoneDisplayFromJson(d[e],b);c.addDisplayData(f)}return c},decodeBoneDisplay:function(a,b){var c=null; 1===(parseFloat(a.getAttribute(ccs.CONST_A_IS_ARMATURE))||0)?(c=new ccs.ArmatureDisplayData,c.displayType=ccs.DISPLAY_TYPE_ARMATURE):(c=new ccs.SpriteDisplayData,c.displayType=ccs.DISPLAY_TYPE_SPRITE);var d=a.getAttribute(ccs.CONST_A_NAME)||"";d&&(c.displayName=d);return c},decodeBoneDisplayFromJson:function(a,b){var c=a[ccs.CONST_A_DISPLAY_TYPE]||ccs.DISPLAY_TYPE_SPRITE,d=null;switch(c){case ccs.DISPLAY_TYPE_SPRITE:var d=new ccs.SpriteDisplayData,e=a[ccs.CONST_A_NAME];null!=e&&(d.displayName=e); if(e=(a[ccs.CONST_SKIN_DATA]||[])[0]){var f=d.skinData;f.x=e[ccs.CONST_A_X]*this._positionReadScale;f.y=e[ccs.CONST_A_Y]*this._positionReadScale;f.scaleX=null==e[ccs.CONST_A_SCALE_X]?1:e[ccs.CONST_A_SCALE_X];f.scaleY=null==e[ccs.CONST_A_SCALE_Y]?1:e[ccs.CONST_A_SCALE_Y];f.skewX=null==e[ccs.CONST_A_SKEW_X]?1:e[ccs.CONST_A_SKEW_X];f.skewY=null==e[ccs.CONST_A_SKEW_Y]?1:e[ccs.CONST_A_SKEW_Y];f.x*=b.contentScale;f.y*=b.contentScale}break;case ccs.DISPLAY_TYPE_ARMATURE:d=new ccs.ArmatureDisplayData;e=a[ccs.CONST_A_NAME]; null!=e&&(d.displayName=a[ccs.CONST_A_NAME]);break;case ccs.DISPLAY_TYPE_PARTICLE:d=new ccs.ParticleDisplayData;e=a[ccs.CONST_A_PLIST];null!=e&&(d.displayName=b.asyncStruct?b.asyncStruct.basefilePath+e:b.basefilePath+e);break;default:d=new ccs.SpriteDisplayData}d.displayType=c;return d},decodeAnimation:function(a,b){var c=new ccs.AnimationData,d=a.getAttribute(ccs.CONST_A_NAME),e=ccs.armatureDataManager.getArmatureData(d);c.name=d;for(var d=a.querySelectorAll(ccs.CONST_ANIMATION+" \x3e "+ccs.CONST_MOVEMENT), f=null,g=0;g<d.length;g++)f=d[g],f=this.decodeMovement(f,e,b),c.addMovement(f);return c},decodeAnimationFromJson:function(a,b){var c=new ccs.AnimationData;a[ccs.CONST_A_NAME]&&(c.name=a[ccs.CONST_A_NAME]);for(var d=a[ccs.CONST_MOVEMENT_DATA]||[],e=0;e<d.length;e++){var f=this.decodeMovementFromJson(d[e],b);c.addMovement(f)}return c},decodeMovement:function(a,b,c){var d=new ccs.MovementData;d.name=a.getAttribute(ccs.CONST_A_NAME);var e;e=0;e=a.getAttribute(ccs.CONST_A_DURATION);d.duration=null==e? 0:parseFloat(e);e=a.getAttribute(ccs.CONST_A_DURATION_TO);d.durationTo=null==e?0:parseFloat(e);e=a.getAttribute(ccs.CONST_A_DURATION_TWEEN);d.durationTween=null==e?0:parseFloat(e);e=a.getAttribute(ccs.CONST_A_LOOP);d.loop=e?Boolean(parseFloat(e)):!0;if(e=a.getAttribute(ccs.CONST_A_TWEEN_EASING))e!=ccs.CONST_FL_NAN?(e=null==e?0:parseFloat(e),d.tweenEasing=2===e?ccs.TweenType.SINE_EASEINOUT:e):d.tweenEasing=ccs.TweenType.LINEAR;a=a.querySelectorAll(ccs.CONST_MOVEMENT+" \x3e "+ccs.CONST_BONE);var f= null;for(e=0;e<a.length;e++){var f=a[e],g=f.getAttribute(ccs.CONST_A_NAME);if(!d.getMovementBoneData(g)){var g=b.getBoneData(g),h=g.parentName,k=null;if(""!==h)for(var m=0;m<a.length&&(k=a[m],h!==k.getAttribute(ccs.CONST_A_NAME));m++);f=this.decodeMovementBone(f,k,g,c);d.addMovementBoneData(f)}}return d},decodeMovementFromJson:function(a,b){var c=new ccs.MovementData;c.loop=null==a[ccs.CONST_A_LOOP]?!1:a[ccs.CONST_A_LOOP];c.durationTween=a[ccs.CONST_A_DURATION_TWEEN]||0;c.durationTo=a[ccs.CONST_A_DURATION_TO]|| 0;c.duration=a[ccs.CONST_A_DURATION]||0;c.scale=null==a[ccs.CONST_A_DURATION]?1:null==a[ccs.CONST_A_MOVEMENT_SCALE]?1:a[ccs.CONST_A_MOVEMENT_SCALE];c.tweenEasing=null==a[ccs.CONST_A_TWEEN_EASING]?ccs.TweenType.LINEAR:a[ccs.CONST_A_TWEEN_EASING];var d=a[ccs.CONST_A_NAME];d&&(c.name=d);for(var d=a[ccs.CONST_MOVEMENT_BONE_DATA]||[],e=0;e<d.length;e++){var f=this.decodeMovementBoneFromJson(d[e],b);c.addMovementBoneData(f)}return c},decodeMovementBone:function(a,b,c,d){var e=new ccs.MovementBoneData;e.init(); var f;a&&(f=parseFloat(a.getAttribute(ccs.CONST_A_MOVEMENT_SCALE))||0,e.scale=f,f=parseFloat(a.getAttribute(ccs.CONST_A_MOVEMENT_DELAY))||0,0<f&&(f-=1),e.delay=f);var g=0,h=f=0,k=null,m=[];if(null!=b){for(var n=b.querySelectorAll(ccs.CONST_BONE+" \x3e "+ccs.CONST_FRAME),g=0;g<n.length;g++)m.push(n[g]);g=m.length}e.name=a.getAttribute(ccs.CONST_A_NAME);a=a.querySelectorAll(ccs.CONST_BONE+" \x3e "+ccs.CONST_FRAME);for(var p=n=0,r=0;r<a.length;r++){var s=a[r];if(b)for(;n<g&&(k?p<f||p>=f+h:1);)k=m[n], f+=h,h=parseFloat(k.getAttribute(ccs.CONST_A_DURATION)),n++;s=this.decodeFrame(s,k,c,d);e.addFrameData(s);s.frameID=p;p+=s.duration;e.duration=p}b=e.frameList;c=Math.PI;for(g=b.length-1;0<=g;g--)if(0<g){d=b[g].skewX-b[g-1].skewX;f=b[g].skewY-b[g-1].skewY;if(d<-c||d>c)b[g-1].skewX=0>d?b[g-1].skewX-2*c:b[g-1].skewX+2*c;if(f<-c||f>c)b[g-1].skewY=0>f?b[g-1].skewY-2*c:b[g-1].skewY+2*c}b=new ccs.FrameData;b.copy(e.frameList[e.frameList.length-1]);b.frameID=e.duration;e.addFrameData(b);return e},decodeMovementBoneFromJson:function(a, b){var c=new ccs.MovementBoneData;c.init();c.delay=a[ccs.CONST_A_MOVEMENT_DELAY]||0;var d=a[ccs.CONST_A_NAME];d&&(c.name=d);for(var e=(a[ccs.CONST_FRAME_DATA]||[]).length,d=0;d<e;d++){var f=this.decodeFrameFromJson(a[ccs.CONST_FRAME_DATA][d],b);c.addFrameData(f);b.cocoStudioVersion<ccs.CONST_VERSION_COMBINED&&(f.frameID=c.duration,c.duration+=f.duration)}if(b.cocoStudioVersion<ccs.VERSION_CHANGE_ROTATION_RANGE)for(e=c.frameList,f=Math.PI,d=e.length-1;0<=d;d--)if(0<d){var g=e[d].skewX-e[d-1].skewX, h=e[d].skewY-e[d-1].skewY;if(g<-f||g>f)e[d-1].skewX=0>g?e[d-1].skewX-2*f:e[d-1].skewX+2*f;if(h<-f||h>f)e[d-1].skewY=0>h?e[d-1].skewY-2*f:e[d-1].skewY+2*f}b.cocoStudioVersion<ccs.CONST_VERSION_COMBINED&&0<c.frameList.length&&(f=new ccs.FrameData,f.copy(c.frameList[c.frameList.length-1]),c.addFrameData(f),f.frameID=c.duration);return c},decodeFrame:function(a,b,c,d){var e=0,e=e=e=e=e=e=e=e=e=e=e=0;c=new ccs.FrameData;c.strMovement=a.getAttribute(ccs.CONST_A_MOVEMENT)||"";c.movement=c.strMovement;c.strEvent= a.getAttribute(ccs.CONST_A_EVENT)||"";c.event=c.strEvent;c.strSound=a.getAttribute(ccs.CONST_A_SOUND)||"";c.sound=c.strSound;c.strSoundEffect=a.getAttribute(ccs.CONST_A_SOUND_EFFECT)||"";c.soundEffect=c.strSoundEffect;e=a.getAttribute(ccs.CONST_A_TWEEN_FRAME);c.isTween=!(void 0!==e&&("false"===e||"0"===e));if(d.flashToolVersion>=ccs.CONST_VERSION_2_0){if(e=a.getAttribute(ccs.CONST_A_COCOS2DX_X))c.x=parseFloat(e),c.x*=this._positionReadScale;e=a.getAttribute(ccs.CONST_A_COCOS2DX_Y)}else{if(e=a.getAttribute(ccs.CONST_A_X))c.x= parseFloat(e),c.x*=this._positionReadScale;e=a.getAttribute(ccs.CONST_A_Y)}e&&(c.y=-parseFloat(e),c.y*=this._positionReadScale);e=a.getAttribute(ccs.CONST_A_SCALE_X);null!=e&&(c.scaleX=parseFloat(e));e=a.getAttribute(ccs.CONST_A_SCALE_Y);null!=e&&(c.scaleY=parseFloat(e));e=a.getAttribute(ccs.CONST_A_SKEW_X);null!=e&&(c.skewX=cc.degreesToRadians(parseFloat(e)));e=a.getAttribute(ccs.CONST_A_SKEW_Y);null!=e&&(c.skewY=cc.degreesToRadians(-parseFloat(e)));e=a.getAttribute(ccs.CONST_A_DURATION);null!=e&& (c.duration=parseFloat(e));e=a.getAttribute(ccs.CONST_A_DISPLAY_INDEX);null!=e&&(c.displayIndex=parseFloat(e));e=a.getAttribute(ccs.CONST_A_Z);null!=e&&(c.zOrder=parseInt(e));e=a.getAttribute(ccs.CONST_A_TWEEN_ROTATE);null!=e&&(c.tweenRotate=parseFloat(e));e=a.getAttribute(ccs.CONST_A_BLEND_TYPE);if(null!=e){var f=c.blendFunc;switch(e){case ccs.BLEND_TYPE_NORMAL:f.src=cc.BLEND_SRC;f.dst=cc.BLEND_DST;break;case ccs.BLEND_TYPE_ADD:f.src=cc.SRC_ALPHA;f.dst=cc.ONE;break;case ccs.BLEND_TYPE_MULTIPLY:f.src= cc.DST_COLOR;f.dst=cc.ONE_MINUS_SRC_ALPHA;break;case ccs.BLEND_TYPE_SCREEN:f.src=cc.ONE;f.dst=cc.ONE_MINUS_DST_COLOR;break;default:c.blendFunc.src=cc.BLEND_SRC,c.blendFunc.dst=cc.BLEND_DST}}var g=a.querySelectorAll(ccs.CONST_FRAME+" \x3e "+ccs.CONST_A_COLOR_TRANSFORM);if(g&&0<g.length){var g=g[0],h,k,m,n,p,e=parseFloat(g.getAttribute(ccs.CONST_A_ALPHA))||0,f=parseFloat(g.getAttribute(ccs.CONST_A_RED))||0;h=parseFloat(g.getAttribute(ccs.CONST_A_GREEN))||0;k=parseFloat(g.getAttribute(ccs.CONST_A_BLUE))|| 0;m=parseFloat(g.getAttribute(ccs.CONST_A_ALPHA_OFFSET))||0;n=parseFloat(g.getAttribute(ccs.CONST_A_RED_OFFSET))||0;p=parseFloat(g.getAttribute(ccs.CONST_A_GREEN_OFFSET))||0;g=parseFloat(g.getAttribute(ccs.CONST_A_BLUE_OFFSET))||0;c.a=2.55*m+e;c.r=2.55*n+f;c.g=2.55*p+h;c.b=2.55*g+k;c.isUseColorInfo=!0}e=a.getAttribute(ccs.CONST_A_TWEEN_EASING);null!=e&&(e!=ccs.CONST_FL_NAN?(e=a.getAttribute(ccs.CONST_A_TWEEN_EASING))&&(c.tweenEasing=2===e?ccs.TweenType.SINE_EASEINOUT:e):c.tweenEasing=ccs.TweenType.LINEAR); b&&(a=new ccs.BaseData,d.flashToolVersion>=ccs.CONST_VERSION_2_0?(a.x=parseFloat(b.getAttribute(ccs.CONST_A_COCOS2DX_X)),a.y=parseFloat(b.getAttribute(ccs.CONST_A_COCOS2DX_Y))):(a.x=parseFloat(b.getAttribute(ccs.CONST_A_X)),a.y=parseFloat(b.getAttribute(ccs.CONST_A_Y))),a.skewX=parseFloat(b.getAttribute(ccs.CONST_A_SKEW_X)),a.skewY=parseFloat(b.getAttribute(ccs.CONST_A_SKEW_Y)),a.y=-a.y,a.skewX=cc.degreesToRadians(a.skewX),a.skewY=cc.degreesToRadians(-a.skewY),ccs.TransformHelp.transformFromParent(c, a));return c},decodeFrameFromJson:function(a,b){var c=new ccs.FrameData;this.decodeNodeFromJson(c,a,b);c.tweenEasing=a[ccs.CONST_A_TWEEN_EASING]||ccs.TweenType.LINEAR;c.displayIndex=a[ccs.CONST_A_DISPLAY_INDEX];var d=null==a[ccs.CONST_A_BLEND_DST]?cc.BLEND_DST:a[ccs.CONST_A_BLEND_DST];c.blendFunc.src=null==a[ccs.CONST_A_BLEND_SRC]?cc.BLEND_SRC:a[ccs.CONST_A_BLEND_SRC];c.blendFunc.dst=d;c.isTween=null==a[ccs.CONST_A_TWEEN_FRAME]?!0:a[ccs.CONST_A_TWEEN_FRAME];d=a[ccs.CONST_A_EVENT];null!=d&&(c.strEvent= d,c.event=d);b.cocoStudioVersion<ccs.CONST_VERSION_COMBINED?c.duration=null==a[ccs.CONST_A_DURATION]?1:a[ccs.CONST_A_DURATION]:c.frameID=a[ccs.CONST_A_FRAME_INDEX];for(var d=a[ccs.CONST_A_EASING_PARAM]||[],e=0;e<d.length;e++)c.easingParams[e]=d[e];return c},decodeTexture:function(a,b){var c=new ccs.TextureData;c.init();a.getAttribute(ccs.CONST_A_NAME)&&(c.name=a.getAttribute(ccs.CONST_A_NAME));var d,e;b.flashToolVersion>=ccs.CONST_VERSION_2_0?(d=parseFloat(a.getAttribute(ccs.CONST_A_COCOS2D_PIVOT_X))|| 0,e=parseFloat(a.getAttribute(ccs.CONST_A_COCOS2D_PIVOT_Y))||0):(d=parseFloat(a.getAttribute(ccs.CONST_A_PIVOT_X))||0,e=parseFloat(a.getAttribute(ccs.CONST_A_PIVOT_Y))||0);var f=parseFloat(a.getAttribute(ccs.CONST_A_WIDTH))||0,g=parseFloat(a.getAttribute(ccs.CONST_A_HEIGHT))||0;c.pivotX=d/f;c.pivotY=(g-e)/g;d=a.querySelectorAll(ccs.CONST_SUB_TEXTURE+" \x3e "+ccs.CONST_CONTOUR);for(e=0;e<d.length;e++)c.addContourData(this.decodeContour(d[e],b));return c},decodeTextureFromJson:function(a){var b=new ccs.TextureData; b.init();var c=a[ccs.CONST_A_NAME];null!=c&&(b.name=c);b.width=a[ccs.CONST_A_WIDTH]||0;b.height=a[ccs.CONST_A_HEIGHT]||0;b.pivotX=a[ccs.CONST_A_PIVOT_X]||0;b.pivotY=a[ccs.CONST_A_PIVOT_Y]||0;a=a[ccs.CONST_CONTOUR_DATA]||[];for(c=0;c<a.length;c++)b.contourDataList.push(this.decodeContourFromJson(a[c]));return b},decodeContour:function(a,b){var c=new ccs.ContourData;c.init();for(var d=a.querySelectorAll(ccs.CONST_CONTOUR+" \x3e "+ccs.CONST_CONTOUR_VERTEX),e,f=0;f<d.length;f++){e=d[f];var g=cc.p(0,0); g.x=parseFloat(e.getAttribute(ccs.CONST_A_X))||0;g.y=parseFloat(e.getAttribute(ccs.CONST_A_Y))||0;g.y=-g.y;c.vertexList.push(g)}return c},decodeContourFromJson:function(a){var b=new ccs.ContourData;b.init();a=a[ccs.CONST_VERTEX_POINT]||[];for(var c=a.length,d=0;d<c;d++){var e=a[d],f=cc.p(0,0);f.x=e[ccs.CONST_A_X]||0;f.y=e[ccs.CONST_A_Y]||0;b.vertexList.push(f)}return b},addDataFromJsonCache:function(a,b){b.contentScale=null==a[ccs.CONST_CONTENT_SCALE]?1:a[ccs.CONST_CONTENT_SCALE];var c=a[ccs.CONST_ARMATURE_DATA]|| [],d,e;for(d=0;d<c.length;d++)e=this.decodeArmatureFromJSON(c[d],b),ccs.armatureDataManager.addArmatureData(e.name,e,b.filename);c=a[ccs.CONST_ANIMATION_DATA]||[];for(d=0;d<c.length;d++)e=this.decodeAnimationFromJson(c[d],b),ccs.armatureDataManager.addAnimationData(e.name,e,b.filename);c=a[ccs.CONST_TEXTURE_DATA]||[];for(d=0;d<c.length;d++)e=this.decodeTextureFromJson(c[d],b),ccs.armatureDataManager.addTextureData(e.name,e,b.filename);if(null==b.asyncStruct?ccs.armatureDataManager.isAutoLoadSpriteFile(): b.asyncStruct.autoLoadSpriteFile){var c=a[ccs.CONST_CONFIG_FILE_PATH]||[],f;for(d=0;d<c.length;d++)e=c[d],f=e.lastIndexOf("."),e=e.substring(0,f),f=b.basefilePath+e+".plist",e=b.basefilePath+e+".png",ccs.armatureDataManager.addSpriteFrameFromFile(f,e,b.filename)}},decodeNodeFromJson:function(a,b,c){a.x=b[ccs.CONST_A_X]*this._positionReadScale;a.y=b[ccs.CONST_A_Y]*this._positionReadScale;a.x*=c.contentScale;a.y*=c.contentScale;a.zOrder=b[ccs.CONST_A_Z];a.skewX=b[ccs.CONST_A_SKEW_X]||0;a.skewY=b[ccs.CONST_A_SKEW_Y]|| 0;a.scaleX=null==b[ccs.CONST_A_SCALE_X]?1:b[ccs.CONST_A_SCALE_X];a.scaleY=null==b[ccs.CONST_A_SCALE_Y]?1:b[ccs.CONST_A_SCALE_Y];if(b=c.cocoStudioVersion<ccs.VERSION_COLOR_READING?b[0]:b[ccs.CONST_COLOR_INFO]||null)a.a=null==b[ccs.CONST_A_ALPHA]?255:b[ccs.CONST_A_ALPHA],a.r=null==b[ccs.CONST_A_RED]?255:b[ccs.CONST_A_RED],a.g=null==b[ccs.CONST_A_GREEN]?255:b[ccs.CONST_A_GREEN],a.b=null==b[ccs.CONST_A_BLUE]?255:b[ccs.CONST_A_BLUE],a.isUseColorInfo=!0},clear:function(){this._configFileList=[];this._asyncRefTotalCount= this._asyncRefCount=0},_asyncCallBack:function(a,b,c){a&&cc.isFunction(a)&&a.call(b,c);if(b&&a&&"string"===typeof a)b[a](c)},_initBaseFilePath:function(a){var b=a.lastIndexOf("/");return a=-1<b?a.substr(0,b+1):""},addDataFromXML:function(a,b){var c=cc.loader.getRes(a);if(!c)throw Error("Please load the resource first : "+a);(c=cc.saxParser.parse(c).documentElement)&&this.addDataFromCache(c,b)},addDataFromJson:function(a,b){var c=cc.loader.getRes(a);this.addDataFromJsonCache(c,b)}};ccs.spriteFrameCacheHelper={_textureAtlasDic:{},_imagePaths:[],addSpriteFrameFromFile:function(a,b){cc.spriteFrameCache.addSpriteFrames(a,b)},getTextureAtlasWithTexture:function(a){return null},clear:function(){this._textureAtlasDic={};this._imagePaths=[]}};ccs.TransformHelp=ccs.TransformHelp||ccs.Class.extend({});ccs.TransformHelp.helpMatrix1=cc.affineTransformMake(1,0,0,1,0,0);ccs.TransformHelp.helpMatrix2=cc.affineTransformMake(1,0,0,1,0,0);ccs.TransformHelp.helpPoint1=cc.p(0,0);ccs.TransformHelp.helpPoint2=cc.p(0,0);ccs.TransformHelp.helpParentNode={}; ccs.TransformHelp.transformFromParent=function(a,b){this.nodeToMatrix(a,this.helpMatrix1);this.nodeToMatrix(b,this.helpMatrix2);this.helpMatrix2=cc.affineTransformInvert(this.helpMatrix2);this.helpMatrix1=cc.affineTransformConcat(this.helpMatrix1,this.helpMatrix2);this.matrixToNode(this.helpMatrix1,a)}; ccs.TransformHelp.transformToParent=function(a,b){this.nodeToMatrix(a,this.helpMatrix1);this.nodeToMatrix(b,this.helpMatrix2);this.helpMatrix1=cc.affineTransformConcat(this.helpMatrix1,this.helpMatrix2);this.matrixToNode(this.helpMatrix1,a)}; ccs.TransformHelp.transformFromParentWithoutScale=function(a,b){for(var c in b)this.helpParentNode[c]=b[c];this.helpParentNode.scaleX=1;this.helpParentNode.scaleY=1;this.nodeToMatrix(a,this.helpMatrix1);this.nodeToMatrix(this.helpParentNode,this.helpMatrix2);this.helpMatrix2=cc.affineTransformInvert(this.helpMatrix2);this.helpMatrix1=cc.affineTransformConcat(this.helpMatrix1,this.helpMatrix2);this.matrixToNode(this.helpMatrix1,a)}; ccs.TransformHelp.transformToParentWithoutScale=function(a,b){for(var c in b)this.helpParentNode[c]=b[c];this.helpParentNode.scaleX=1;this.helpParentNode.scaleY=1;this.nodeToMatrix(a,this.helpMatrix1);this.nodeToMatrix(this.helpParentNode,this.helpMatrix2);this.helpMatrix1=cc.affineTransformConcat(this.helpMatrix1,this.helpMatrix2);this.matrixToNode(this.helpMatrix1,a)}; ccs.TransformHelp.nodeToMatrix=function(a,b){if(a.skewX===-a.skewY){var c=Math.sin(a.skewX),d=Math.cos(a.skewX);b.a=a.scaleX*d;b.b=a.scaleX*-c;b.c=a.scaleY*c;b.d=a.scaleY*d}else b.a=a.scaleX*Math.cos(a.skewY),b.b=a.scaleX*Math.sin(a.skewY),b.c=a.scaleY*Math.sin(a.skewX),b.d=a.scaleY*Math.cos(a.skewX);b.tx=a.x;b.ty=a.y}; ccs.TransformHelp.matrixToNode=function(a,b){this.helpPoint1.x=0;this.helpPoint1.y=1;this.helpPoint1=cc.pointApplyAffineTransform(this.helpPoint1,a);this.helpPoint1.x-=a.tx;this.helpPoint1.y-=a.ty;this.helpPoint2.x=1;this.helpPoint2.y=0;this.helpPoint2=cc.pointApplyAffineTransform(this.helpPoint2,a);this.helpPoint2.x-=a.tx;this.helpPoint2.y-=a.ty;b.skewX=-(Math.atan2(this.helpPoint1.y,this.helpPoint1.x)-1.5707964);b.skewY=Math.atan2(this.helpPoint2.y,this.helpPoint2.x);b.scaleX=Math.sqrt(a.a*a.a+ a.b*a.b);b.scaleY=Math.sqrt(a.c*a.c+a.d*a.d);b.x=a.tx;b.y=a.ty};ccs.TransformHelp.nodeConcat=function(a,b){a.x+=b.x;a.y+=b.y;a.skewX+=b.skewX;a.skewY+=b.skewY;a.scaleX+=b.scaleX;a.scaleY+=b.scaleY};ccs.TransformHelp.nodeSub=function(a,b){a.x-=b.x;a.y-=b.y;a.skewX-=b.skewX;a.skewY-=b.skewY;a.scaleX-=b.scaleX;a.scaleY-=b.scaleY};ccs.TweenType={CUSTOM_EASING:-1,LINEAR:0,SINE_EASEIN:1,SINE_EASEOUT:2,SINE_EASEINOUT:3,QUAD_EASEIN:4,QUAD_EASEOUT:5,QUAD_EASEINOUT:6,CUBIC_EASEIN:7,CUBIC_EASEOUT:8,CUBIC_EASEINOUT:9,QUART_EASEIN:10,QUART_EASEOUT:11,QUART_EASEINOUT:12,QUINT_EASEIN:13,QUINT_EASEOUT:14,QUINT_EASEINOUT:15,EXPO_EASEIN:16,EXPO_EASEOUT:17,EXPO_EASEINOUT:18,CIRC_EASEIN:19,CIRC_EASEOUT:20,CIRC_EASEINOUT:21,ELASTIC_EASEIN:22,ELASTIC_EASEOUT:23,ELASTIC_EASEINOUT:24,BACK_EASEIN:25,BACK_EASEOUT:26,BACK_EASEINOUT:27,BOUNCE_EASEIN:28, BOUNCE_EASEOUT:29,BOUNCE_EASEINOUT:30,TWEEN_EASING_MAX:1E4};ccs.TweenFunction=ccs.TweenFunction||ccs.Class.extend({});ccs.DOUBLE_PI=ccs.M_PI_X_2=2*Math.PI;ccs.HALF_PI=ccs.M_PI_2=Math.PI/2;ccs.M_PI=Math.PI; ccs.TweenFunction.tweenTo=function(a,b,c){var d=0;switch(b){case ccs.TweenType.CUSTOM_EASING:d=this.customEase(a,c);break;case ccs.TweenType.LINEAR:d=this.linear(a);break;case ccs.TweenType.SINE_EASEIN:d=this.sineEaseIn(a);break;case ccs.TweenType.SINE_EASEOUT:d=this.sineEaseOut(a);break;case ccs.TweenType.SINE_EASEINOUT:d=this.sineEaseInOut(a);break;case ccs.TweenType.QUAD_EASEIN:d=this.quadEaseIn(a);break;case ccs.TweenType.QUAD_EASEOUT:d=this.quadEaseOut(a);break;case ccs.TweenType.QUAD_EASEINOUT:d= this.quadEaseInOut(a);break;case ccs.TweenType.CUBIC_EASEIN:d=this.cubicEaseIn(a);break;case ccs.TweenType.CUBIC_EASEOUT:d=this.cubicEaseOut(a);break;case ccs.TweenType.CUBIC_EASEINOUT:d=this.cubicEaseInOut(a);break;case ccs.TweenType.QUART_EASEIN:d=this.quartEaseIn(a);break;case ccs.TweenType.QUART_EASEOUT:d=this.quartEaseOut(a);break;case ccs.TweenType.QUART_EASEINOUT:d=this.quartEaseInOut(a);break;case ccs.TweenType.QUINT_EASEIN:d=this.quintEaseIn(a);break;case ccs.TweenType.QUINT_EASEOUT:d=this.quintEaseOut(a); break;case ccs.TweenType.QUINT_EASEINOUT:d=this.quintEaseInOut(a);break;case ccs.TweenType.EXPO_EASEIN:d=this.expoEaseIn(a);break;case ccs.TweenType.EXPO_EASEOUT:d=this.expoEaseOut(a);break;case ccs.TweenType.EXPO_EASEINOUT:d=this.expoEaseInOut(a);break;case ccs.TweenType.CIRC_EASEIN:d=this.circEaseIn(a);break;case ccs.TweenType.CIRC_EASEOUT:d=this.circEaseOut(a);break;case ccs.TweenType.CIRC_EASEINOUT:d=this.circEaseInOut(a);break;case ccs.TweenType.ELASTIC_EASEIN:b=0.3;null!=c&&0<c.length&&(b=c[0]); d=this.elasticEaseIn(a,b);break;case ccs.TweenType.ELASTIC_EASEOUT:b=0.3;null!=c&&0<c.length&&(b=c[0]);d=this.elasticEaseOut(a,b);break;case ccs.TweenType.ELASTIC_EASEINOUT:b=0.3;null!=c&&0<c.length&&(b=c[0]);d=this.elasticEaseInOut(a,b);break;case ccs.TweenType.BACK_EASEIN:d=this.backEaseIn(a);break;case ccs.TweenType.BACK_EASEOUT:d=this.backEaseOut(a);break;case ccs.TweenType.BACK_EASEINOUT:d=this.backEaseInOut(a);break;case ccs.TweenType.BOUNCE_EASEIN:d=this.bounceEaseIn(a);break;case ccs.TweenType.BOUNCE_EASEOUT:d= this.bounceEaseOut(a);break;case ccs.TweenType.BOUNCE_EASEINOUT:d=this.bounceEaseInOut(a);break;default:d=this.sineEaseInOut(a)}return d};ccs.TweenFunction.linear=function(a){return a};ccs.TweenFunction.sineEaseIn=function(a){return-1*Math.cos(a*ccs.HALF_PI)+1};ccs.TweenFunction.sineEaseOut=function(a){return Math.sin(a*ccs.HALF_PI)};ccs.TweenFunction.sineEaseInOut=function(a){return-0.5*(Math.cos(ccs.M_PI*a)-1)};ccs.TweenFunction.quadEaseIn=function(a){return a*a}; ccs.TweenFunction.quadEaseOut=function(a){return-1*a*(a-2)};ccs.TweenFunction.quadEaseInOut=function(a){a*=2;if(1>a)return 0.5*a*a;--a;return-0.5*(a*(a-2)-1)};ccs.TweenFunction.cubicEaseIn=function(a){return a*a*a};ccs.TweenFunction.cubicEaseOut=function(a){a-=1;return a*a*a+1};ccs.TweenFunction.cubicEaseInOut=function(a){a*=2;if(1>a)return 0.5*a*a*a;a-=2;return 0.5*(a*a*a+2)};ccs.TweenFunction.quartEaseIn=function(a){return a*a*a*a}; ccs.TweenFunction.quartEaseOut=function(a){a-=1;return-(a*a*a*a-1)};ccs.TweenFunction.quartEaseInOut=function(a){a*=2;if(1>a)return 0.5*a*a*a*a;a-=2;return-0.5*(a*a*a*a-2)};ccs.TweenFunction.quintEaseIn=function(a){return a*a*a*a*a};ccs.TweenFunction.quintEaseOut=function(a){a-=1;return a*a*a*a*a+1};ccs.TweenFunction.quintEaseInOut=function(a){a*=2;if(1>a)return 0.5*a*a*a*a*a;a-=2;return 0.5*(a*a*a*a*a+2)};ccs.TweenFunction.expoEaseIn=function(a){return 0===a?0:Math.pow(2,10*(a-1))-0.001}; ccs.TweenFunction.expoEaseOut=function(a){return 1===a?1:-Math.pow(2,-10*a)+1};ccs.TweenFunction.expoEaseInOut=function(a){a/=0.5;return a=1>a?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*(a-1))+2)};ccs.TweenFunction.circEaseIn=function(a){return-1*(Math.sqrt(1-a*a)-1)};ccs.TweenFunction.circEaseOut=function(a){a-=1;return Math.sqrt(1-a*a)};ccs.TweenFunction.circEaseInOut=function(a){a*=2;if(1>a)return-0.5*(Math.sqrt(1-a*a)-1);a-=2;return 0.5*(Math.sqrt(1-a*a)+1)}; ccs.TweenFunction.elasticEaseIn=function(a,b){var c=0.3;0<b.length&&(c=b[0]);var d=0;0===a||1===a?d=a:(d=c/4,a-=1,d=-Math.pow(2,10*a)*Math.sin((a-d)*ccs.DOUBLE_PI/c));return d};ccs.TweenFunction.elasticEaseOut=function(a,b){var c=0.3;0<b.length&&(c=b[0]);var d=0;0===a||1===a?d=a:(d=c/4,d=Math.pow(2,-10*a)*Math.sin((a-d)*ccs.DOUBLE_PI/c)+1);return d}; ccs.TweenFunction.elasticEaseInOut=function(a,b){var c=0.3;0<b.length&&(c=b[0]);var d=0;0===a||1===a?d=a:(c||(c=0.3*1.5),d=c/4,a=2*a-1,d=0>a?-0.5*Math.pow(2,10*a)*Math.sin((a-d)*ccs.DOUBLE_PI/c):Math.pow(2,-10*a)*Math.sin((a-d)*ccs.DOUBLE_PI/c)*0.5+1);return d};ccs.TweenFunction.backEaseIn=function(a){return a*a*(2.70158*a-1.70158)};ccs.TweenFunction.backEaseOut=function(a){a-=1;return a*a*(2.70158*a+1.70158)+1}; ccs.TweenFunction.backEaseInOut=function(a){a*=2;if(1>a)return a*a*(3.5949095*a-2.5949095)/2;a-=2;return a*a*(3.5949095*a+2.5949095)/2+1};ccs.bounceTime=function(a){if(a<1/2.75)return 7.5625*a*a;if(a<2/2.75)return a-=1.5/2.75,7.5625*a*a+0.75;if(a<2.5/2.75)return a-=2.25/2.75,7.5625*a*a+0.9375;a-=2.625/2.75;return 7.5625*a*a+0.984375};ccs.TweenFunction.bounceEaseIn=function(a){return 1-ccs.bounceTime(1-a)};ccs.TweenFunction.bounceEaseOut=function(a){return ccs.bounceTime(a)}; ccs.TweenFunction.bounceEaseInOut=function(a){var b=0;return b=0.5>a?0.5*(1-ccs.bounceTime(1-2*a)):0.5*ccs.bounceTime(2*a-1)+0.5};ccs.TweenFunction.customEase=function(a,b){if(0<b.length){var c=1-a;return b[1]*c*c*c+3*b[3]*a*c*c+3*b[5]*a*a*c+b[7]*a*a*a}return a};ccs.TweenFunction.easeIn=function(a,b){return Math.pow(a,b)};ccs.TweenFunction.easeOut=function(a,b){return Math.pow(a,1/b)};ccs.TweenFunction.easeInOut=function(a,b){a*=2;return 1>a?0.5*Math.pow(a,b):1-0.5*Math.pow(2-a,b)}; ccs.TweenFunction.quadraticIn=function(a){return Math.pow(a,2)};ccs.TweenFunction.quadraticOut=function(a){return-a*(a-2)};ccs.TweenFunction.bezieratFunction=function(a,b,c,d,e){return Math.pow(1-e,3)*a+3*e*Math.pow(1-e,2)*b+3*Math.pow(e,2)*(1-e)*c+Math.pow(e,3)*d};var ENABLE_PHYSICS_DETECT=!1;ccs.fmodf=function(a,b){for(;a>b;)a-=b;return a};var CC_SAFE_RELEASE=function(a){a&&a.release&&a.release()};ccs.isSpriteContainPoint=function(a,b,c){b=a.convertToNodeSpace(b);c&&(c.x=b.x,c.y=b.y);a=a.getContentSize();return cc.rectContainsPoint(cc.rect(0,0,a.width,a.height),b)};ccs.SPRITE_CONTAIN_POINT=ccs.isSpriteContainPoint;ccs.SPRITE_CONTAIN_POINT_WITH_RETURN=ccs.isSpriteContainPoint; ccs.extBezierTo=function(a,b,c,d,e){var f=cc.p(0,0);d&&!e&&(f.x=Math.pow(1-a,2)*b.x+2*a*(1-a)*c.x+Math.pow(a,2)*d.x,f.y=Math.pow(1-a,2)*b.y+2*a*(1-a)*c.y+Math.pow(a,2)*d.y);e&&(f.x=b.x*Math.pow(1-a,3)+3*a*c.x*Math.pow(1-a,2)+3*d.x*Math.pow(a,2)*(1-a)+e.x*Math.pow(a,3),f.y=b.y*Math.pow(1-a,3)+3*a*c.y*Math.pow(1-a,2)+3*d.y*Math.pow(a,2)*(1-a)+e.y*Math.pow(a,3));return f};ccs.extCircleTo=function(a,b,c,d,e){var f=cc.p(0,0);f.x=b.x+c*Math.cos(d+e*a);f.y=b.y+c*Math.sin(d+e*a);return f};ccs.RelativeData=function(){this.plistFiles=[];this.armatures=[];this.animations=[];this.textures=[]}; ccs.armatureDataManager={_animationDatas:{},_armatureDatas:{},_textureDatas:{},_autoLoadSpriteFile:!1,_relativeDatas:{},s_sharedArmatureDataManager:null,removeArmatureFileInfo:function(a){var b=this.getRelativeData(a);if(b){var c,d;for(c=0;c<b.armatures.length;c++)d=b.armatures[c],this.removeArmatureData(d);for(c=0;c<b.animations.length;c++)d=b.animations[c],this.removeAnimationData(d);for(c=0;c<b.textures.length;c++)d=b.textures[c],this.removeTextureData(d);for(c=0;c<b.plistFiles.length;c++)d=b.plistFiles[c], cc.spriteFrameCache.removeSpriteFramesFromFile(d);delete this._relativeDatas[a];ccs.dataReaderHelper.removeConfigFile(a)}},addArmatureData:function(a,b,c){(c=this.getRelativeData(c))&&c.armatures.push(a);this._armatureDatas[a]=b},getArmatureData:function(a){var b=null;this._armatureDatas&&(b=this._armatureDatas[a]);return b},removeArmatureData:function(a){this._armatureDatas[a]&&delete this._armatureDatas[a]},addAnimationData:function(a,b,c){(c=this.getRelativeData(c))&&c.animations.push(a);this._animationDatas[a]= b},getAnimationData:function(a){var b=null;this._animationDatas[a]&&(b=this._animationDatas[a]);return b},removeAnimationData:function(a){this._animationDatas[a]&&delete this._animationDatas[a]},addTextureData:function(a,b,c){(c=this.getRelativeData(c))&&c.textures.push(a);this._textureDatas[a]=b},getTextureData:function(a){var b=null;this._textureDatas&&(b=this._textureDatas[a]);return b},removeTextureData:function(a){this._textureDatas[a]&&delete this._textureDatas[a]},addArmatureFileInfo:function(){var a, b,c;switch(arguments.length){case 1:c=arguments[0];this.addRelativeData(c);this._autoLoadSpriteFile=!0;ccs.dataReaderHelper.addDataFromFile(c);break;case 3:a=arguments[0],b=arguments[1],c=arguments[2],this.addRelativeData(c),this._autoLoadSpriteFile=!1,ccs.dataReaderHelper.addDataFromFile(c),this.addSpriteFrameFromFile(b,a)}},addArmatureFileInfoAsync:function(){var a,b,c,d,e;switch(arguments.length){case 3:c=arguments[0];d=arguments[2];e=arguments[1];this.addRelativeData(c);this._autoLoadSpriteFile= !0;ccs.dataReaderHelper.addDataFromFileAsync("","",c,e,d);break;case 5:a=arguments[0],b=arguments[1],c=arguments[2],d=arguments[4],e=arguments[3],this.addRelativeData(c),this._autoLoadSpriteFile=!1,ccs.dataReaderHelper.addDataFromFileAsync(a,b,c,e,d),this.addSpriteFrameFromFile(b,a)}},addSpriteFrameFromFile:function(a,b,c){(c=this.getRelativeData(c))&&c.plistFiles.push(a);ccs.spriteFrameCacheHelper.addSpriteFrameFromFile(a,b)},isAutoLoadSpriteFile:function(){return this._autoLoadSpriteFile},getArmatureDatas:function(){return this._armatureDatas}, getAnimationDatas:function(){return this._animationDatas},getTextureDatas:function(){return this._textureDatas},addRelativeData:function(a){this._relativeDatas[a]||(this._relativeDatas[a]=new ccs.RelativeData)},getRelativeData:function(a){return this._relativeDatas[a]},clear:function(){for(var a in this._relativeDatas)this.removeArmatureFileInfo(a);this._animationDatas={};this._armatureDatas={};this._textureDatas={};this._relativeDatas={};ccs.spriteFrameCacheHelper.clear();ccs.dataReaderHelper.clear()}};ccs.BLEND_TYPE_NORMAL=0;ccs.BLEND_TYPE_LAYER=1;ccs.BLEND_TYPE_DARKEN=2;ccs.BLEND_TYPE_MULTIPLY=3;ccs.BLEND_TYPE_LIGHTEN=4;ccs.BLEND_TYPE_SCREEN=5;ccs.BLEND_TYPE_OVERLAY=6;ccs.BLEND_TYPE_HIGHLIGHT=7;ccs.BLEND_TYPE_ADD=8;ccs.BLEND_TYPE_SUBTRACT=9;ccs.BLEND_TYPE_DIFFERENCE=10;ccs.BLEND_TYPE_INVERT=11;ccs.BLEND_TYPE_ALPHA=12;ccs.BLEND_TYPE_ERASE=13;ccs.DISPLAY_TYPE_SPRITE=0;ccs.DISPLAY_TYPE_ARMATURE=1;ccs.DISPLAY_TYPE_PARTICLE=2;ccs.DISPLAY_TYPE_MAX=3; ccs.BaseData=ccs.Class.extend({x:0,y:0,zOrder:0,skewX:0,skewY:0,scaleX:1,scaleY:1,tweenRotate:0,isUseColorInfo:!1,r:255,g:255,b:255,a:255,ctor:function(){this.skewY=this.skewX=this.zOrder=this.y=this.x=0;this.scaleY=this.scaleX=1;this.tweenRotate=0;this.isUseColorInfo=!1;this.a=this.b=this.g=this.r=255},copy:function(a){this.x=a.x;this.y=a.y;this.zOrder=a.zOrder;this.scaleX=a.scaleX;this.scaleY=a.scaleY;this.skewX=a.skewX;this.skewY=a.skewY;this.tweenRotate=a.tweenRotate;this.isUseColorInfo=a.isUseColorInfo; this.r=a.r;this.g=a.g;this.b=a.b;this.a=a.a},setColor:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.a=a.a},getColor:function(){return cc.color(this.r,this.g,this.b,this.a)},subtract:function(a,b,c){this.x=b.x-a.x;this.y=b.y-a.y;this.scaleX=b.scaleX-a.scaleX;this.scaleY=b.scaleY-a.scaleY;this.skewX=b.skewX-a.skewX;this.skewY=b.skewY-a.skewY;this.isUseColorInfo||a.isUseColorInfo||b.isUseColorInfo?(this.a=b.a-a.a,this.r=b.r-a.r,this.g=b.g-a.g,this.b=b.b-a.b,this.isUseColorInfo=!0):(this.a=this.r= this.g=this.b=0,this.isUseColorInfo=!1);c&&(this.skewX>ccs.M_PI&&(this.skewX-=ccs.DOUBLE_PI),this.skewX<-ccs.M_PI&&(this.skewX+=ccs.DOUBLE_PI),this.skewY>ccs.M_PI&&(this.skewY-=ccs.DOUBLE_PI),this.skewY<-ccs.M_PI&&(this.skewY+=ccs.DOUBLE_PI));b.tweenRotate&&(this.skewX+=b.tweenRotate*ccs.PI*2,this.skewY-=b.tweenRotate*ccs.PI*2)}}); ccs.DisplayData=ccs.Class.extend({displayType:ccs.DISPLAY_TYPE_MAX,displayName:"",ctor:function(){this.displayType=ccs.DISPLAY_TYPE_MAX},changeDisplayToTexture:function(a){var b=a.lastIndexOf(".");-1!==b&&(a=a.substring(0,b));return a},copy:function(a){this.displayName=a.displayName;this.displayType=a.displayType}}); ccs.SpriteDisplayData=ccs.DisplayData.extend({skinData:null,ctor:function(){this.skinData=new ccs.BaseData;this.displayType=ccs.DISPLAY_TYPE_SPRITE},copy:function(a){ccs.DisplayData.prototype.copy.call(this,a);this.skinData=a.skinData}});ccs.ArmatureDisplayData=ccs.DisplayData.extend({ctor:function(){this.displayName="";this.displayType=ccs.DISPLAY_TYPE_ARMATURE}});ccs.ParticleDisplayData=ccs.DisplayData.extend({ctor:function(){this.displayType=ccs.DISPLAY_TYPE_PARTICLE}}); ccs.BoneData=ccs.BaseData.extend({displayDataList:null,name:"",parentName:"",boneDataTransform:null,ctor:function(){this.displayDataList=[];this.parentName=this.name="";this.boneDataTransform=null},init:function(){this.displayDataList.length=0;return!0},addDisplayData:function(a){this.displayDataList.push(a)},getDisplayData:function(a){return this.displayDataList[a]}}); ccs.ArmatureData=ccs.Class.extend({boneDataDic:null,name:"",dataVersion:0.1,ctor:function(){this.boneDataDic={};this.name="";this.dataVersion=0.1},init:function(){return!0},addBoneData:function(a){this.boneDataDic[a.name]=a},getBoneDataDic:function(){return this.boneDataDic},getBoneData:function(a){return this.boneDataDic[a]}}); ccs.FrameData=ccs.BaseData.extend({duration:0,tweenEasing:0,easingParamNumber:0,easingParams:null,displayIndex:-1,movement:"",event:"",sound:"",soundEffect:"",blendFunc:null,frameID:0,isTween:!0,ctor:function(){ccs.BaseData.prototype.ctor.call(this);this.duration=1;this.tweenEasing=ccs.TweenType.LINEAR;this.easingParamNumber=0;this.easingParams=[];this.displayIndex=0;this.soundEffect=this.sound=this.event=this.movement="";this.blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST);this.frameID=0;this.isTween= !0},copy:function(a){ccs.BaseData.prototype.copy.call(this,a);this.duration=a.duration;this.displayIndex=a.displayIndex;this.tweenEasing=a.tweenEasing;this.easingParamNumber=a.easingParamNumber;if(0!==this.easingParamNumber)for(var b=this.easingParams.length=0;b<this.easingParamNumber;b++)this.easingParams[b]=a.easingParams[b];this.blendFunc=a.blendFunc;this.isTween=a.isTween}}); ccs.MovementBoneData=ccs.Class.extend({delay:0,scale:1,duration:0,frameList:null,name:"",ctor:function(){this.delay=0;this.scale=1;this.duration=0;this.frameList=[];this.name=""},init:function(){return!0},addFrameData:function(a){this.frameList.push(a)},getFrameData:function(a){return this.frameList[a]}});ccs.MovementData=function(){this.name="";this.duration=0;this.scale=1;this.durationTween=this.durationTo=0;this.loop=!0;this.tweenEasing=ccs.TweenType.LINEAR;this.movBoneDataDic={}}; ccs.MovementData.prototype.addMovementBoneData=function(a){this.movBoneDataDic[a.name]=a};ccs.MovementData.prototype.getMovementBoneData=function(a){return this.movBoneDataDic[a]};ccs.AnimationData=function(){this.movementDataDic={};this.movementNames=[];this.name=""};ccs.AnimationData.prototype.addMovement=function(a){this.movementDataDic[a.name]=a;this.movementNames.push(a.name)};ccs.AnimationData.prototype.getMovement=function(a){return this.movementDataDic[a]}; ccs.AnimationData.prototype.getMovementCount=function(){return Object.keys(this.movementDataDic).length};ccs.ContourVertex2=function(a,b){this.x=a||0;this.y=b||0};ccs.ContourData=function(){this.vertexList=[]};ccs.ContourData.prototype.init=function(){this.vertexList.length=0;return!0};ccs.ContourData.prototype.addVertex=function(a){this.vertexList.push(a)};ccs.TextureData=function(){this.width=this.height=0;this.pivotY=this.pivotX=0.5;this.name="";this.contourDataList=[]}; ccs.TextureData.prototype.init=function(){this.contourDataList.length=0};ccs.TextureData.prototype.addContourData=function(a){this.contourDataList.push(a)};ccs.TextureData.prototype.getContourData=function(a){return this.contourDataList[a]};ccs.DecorativeDisplay=ccs.Class.extend({_display:null,_colliderDetector:null,_displayData:null,ctor:function(){this._displayData=this._colliderDetector=this._display=null},init:function(){return!0},setDisplay:function(a){a._parent&&(a._parent.removeChild(a),delete a._parent);this._display=a},getDisplay:function(){return this._display},setColliderDetector:function(a){this._colliderDetector=a},getColliderDetector:function(){return this._colliderDetector},setDisplayData:function(a){this._displayData= a},getDisplayData:function(){return this._displayData},release:function(){this._colliderDetector=this._displayData=this._display=null}});ccs.DecorativeDisplay.create=function(){return new ccs.DecorativeDisplay};ccs.displayFactory={addDisplay:function(a,b,c){switch(c.displayType){case ccs.DISPLAY_TYPE_SPRITE:this.addSpriteDisplay(a,b,c);break;case ccs.DISPLAY_TYPE_PARTICLE:this.addParticleDisplay(a,b,c);break;case ccs.DISPLAY_TYPE_ARMATURE:this.addArmatureDisplay(a,b,c)}},createDisplay:function(a,b){switch(b.getDisplayData().displayType){case ccs.DISPLAY_TYPE_SPRITE:this.createSpriteDisplay(a,b);break;case ccs.DISPLAY_TYPE_PARTICLE:this.createParticleDisplay(a,b);break;case ccs.DISPLAY_TYPE_ARMATURE:this.createArmatureDisplay(a, b)}},_helpTransform:{a:1,b:0,c:0,d:1,tx:0,ty:0},updateDisplay:function(a,b,c){var d=a.getDisplayRenderNode();if(d){switch(a.getDisplayRenderNodeType()){case ccs.DISPLAY_TYPE_SPRITE:c&&(d._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty),d.updateArmatureTransform());break;case ccs.DISPLAY_TYPE_PARTICLE:this.updateParticleDisplay(a,d,b);break;case ccs.DISPLAY_TYPE_ARMATURE:this.updateArmatureDisplay(a,d,b);break;default:b=a.getNodeToArmatureTransform(),d.setAdditionalTransform(b)}if((ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT|| ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX)&&c&&(d=a.getDisplayManager().getCurrentDecorativeDisplay(),c=d.getColliderDetector())){b=d.getDisplay();var e=b.getNodeToParentTransform(),d=this._helpTransform;d.a=e.a;d.b=e.b;d.c=e.c;d.d=e.d;d.tx=e.tx;d.ty=e.ty;b=cc.pointApplyAffineTransform(b.getAnchorPointInPoints(),d);d.tx=b.x;d.ty=b.y;a=cc.affineTransformConcat(d,a.getArmature().getNodeToParentTransform());c.updateTransform(a)}}},addSpriteDisplay:function(a,b,c){var d=new ccs.SpriteDisplayData;d.copy(c); b.setDisplayData(d);this.createSpriteDisplay(a,b)},createSpriteDisplay:function(a,b){var c=null,d=b.getDisplayData(),c=d.displayName,e=c.lastIndexOf(".");-1!==e&&(c=c.substring(0,e));c=""===c?new ccs.Skin:new ccs.Skin("#"+c+".png");b.setDisplay(c);c.setBone(a);this.initSpriteDisplay(a,b,d.displayName,c);(e=a.getArmature())&&(e.getArmatureData().dataVersion>=ccs.CONST_VERSION_COMBINED?c.setSkinData(d.skinData):c.setSkinData(a.boneData))},initSpriteDisplay:function(a,b,c,d){var e=c.lastIndexOf("."); -1!==e&&(c=c.substring(0,e));(c=ccs.armatureDataManager.getTextureData(c))&&d.setAnchorPoint(cc.p(c.pivotX,c.pivotY));(ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT||ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX)&&c&&0<c.contourDataList.length&&(a=new ccs.ColliderDetector(a),a.addContourDataList(c.contourDataList),b.setColliderDetector(a))},addArmatureDisplay:function(a,b,c){var d=new ccs.ArmatureDisplayData;d.copy(c);b.setDisplayData(d);this.createArmatureDisplay(a,b)},createArmatureDisplay:function(a,b){var c= b.getDisplayData(),c=new ccs.Armature(c.displayName,a);b.setDisplay(c)},updateArmatureDisplay:function(a,b,c){b&&(b.sortAllChildren(),b.update(c))},addParticleDisplay:function(a,b,c){var d=new ccs.ParticleDisplayData;d.copy(c);b.setDisplayData(d);this.createParticleDisplay(a,b)},createParticleDisplay:function(a,b){var c=b.getDisplayData(),c=new cc.ParticleSystem(c.displayName);c.removeFromParent();c.cleanup();a.getArmature()&&c.setParent(a.getArmature());b.setDisplay(c)},updateParticleDisplay:function(a, b,c){var d=new ccs.BaseData;ccs.TransformHelp.matrixToNode(a.nodeToArmatureTransform(),d);b.setPosition(d.x,d.y);b.setScaleX(d.scaleX);b.setScaleY(d.scaleY);b.update(c)}};ccs.DisplayManager=ccs.Class.extend({_decoDisplayList:null,_currentDecoDisplay:null,_displayRenderNode:null,_displayIndex:null,_forceChangeDisplay:!1,_bone:null,_visible:!0,_displayType:null,ctor:function(a){this._decoDisplayList=[];this._displayIndex=this._displayRenderNode=this._currentDecoDisplay=null;this._forceChangeDisplay=!1;this._bone=null;this._visible=!0;this._displayType=ccs.DISPLAY_TYPE_MAX;a&&ccs.DisplayManager.prototype.init.call(this,a)},init:function(a){this._bone=a;this.initDisplayList(a.getBoneData()); return!0},addDisplay:function(a,b){var c,d=this._decoDisplayList;0<=b&&b<d.length?c=d[b]:(c=new ccs.DecorativeDisplay,d.push(c));if(a instanceof ccs.DisplayData)ccs.displayFactory.addDisplay(this._bone,c,a);else{var e=null;if(a instanceof ccs.Skin){a.setBone(this._bone);e=new ccs.SpriteDisplayData;ccs.displayFactory.initSpriteDisplay(this._bone,c,a.getDisplayName(),a);var f=c.getDisplayData();if(f instanceof ccs.SpriteDisplayData)a.setSkinData(f.skinData),e.skinData=f.skinData;else{for(var f=!1,g= d.length-2;0<=g;g--){var h=d[g].getDisplayData();if(h instanceof ccs.SpriteDisplayData){f=!0;a.setSkinData(h.skinData);e.skinData=h.skinData;break}}f||a.setSkinData(new ccs.BaseData)}}else a instanceof cc.ParticleSystem?(e=new ccs.ParticleDisplayData,a.removeFromParent(),a._performRecursive(cc.Node._stateCallbackType.cleanup),(d=this._bone.getArmature())&&a.setParent(d)):a instanceof ccs.Armature?(e=new ccs.ArmatureDisplayData,e.displayName=a.getName(),a.setParentBone(this._bone)):e=new ccs.DisplayData; c.setDisplay(a);c.setDisplayData(e)}b===this._displayIndex&&(this._displayIndex=-1,this.changeDisplayWithIndex(b,!1))},_addDisplayOther:function(a,b){var c=null;if(b instanceof ccs.Skin){b.setBone(this._bone);c=new ccs.SpriteDisplayData;c.displayName=b.getDisplayName();ccs.displayFactory.initSpriteDisplay(this._bone,a,b.getDisplayName(),b);var d=a.getDisplayData();if(d instanceof ccs.SpriteDisplayData)b.setSkinData(d.skinData);else{for(var d=!1,e=this._decoDisplayList.length-2;0<=e;e--){var f=this._decoDisplayList[e].getDisplayData(); if(f){d=!0;b.setSkinData(f.skinData);c.skinData=f.skinData;break}}d||b.setSkinData(new ccs.BaseData);b.setSkinData(new ccs.BaseData)}}else b instanceof cc.ParticleSystem?(c=new ccs.ParticleDisplayData,c.displayName=b._plistFile):b instanceof ccs.Armature?(c=new ccs.ArmatureDisplayData,c.displayName=b.getName(),b.setParentBone(this._bone)):c=new ccs.DisplayData;a.setDisplay(b);a.setDisplayData(c)},removeDisplay:function(a){this._decoDisplayList.splice(a,1);a===this._displayIndex&&(this.setCurrentDecorativeDisplay(null), this._displayIndex=-1)},getDecorativeDisplayList:function(){return this._decoDisplayList},changeDisplayWithIndex:function(a,b){a>=this._decoDisplayList.length?cc.log("the index value is out of range"):(this._forceChangeDisplay=b,this._displayIndex!==a&&(this._displayIndex=a,0>a?this._displayRenderNode&&(this._displayRenderNode.removeFromParent(!0),this.setCurrentDecorativeDisplay(null)):this.setCurrentDecorativeDisplay(this._decoDisplayList[a])))},changeDisplayWithName:function(a,b){for(var c=this._decoDisplayList, d=0;d<c.length;d++)if(c[d].getDisplayData().displayName===a){this.changeDisplayWithIndex(d,b);break}},setCurrentDecorativeDisplay:function(a){var b=this._currentDecoDisplay;(ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT||ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX)&&b&&b.getColliderDetector()&&b.getColliderDetector().setActive(!1);b=this._currentDecoDisplay=a;(ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT||ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX)&&b&&b.getColliderDetector()&&b.getColliderDetector().setActive(!0);a=b?b.getDisplay(): null;var b=this._displayRenderNode,c=this._bone;b&&(b instanceof ccs.Armature&&c.setChildArmature(null),b.removeFromParent(!0));(this._displayRenderNode=a)?(a instanceof ccs.Armature?(this._bone.setChildArmature(a),a.setParentBone(this._bone)):a instanceof cc.ParticleSystem&&(a instanceof ccs.Armature?(c.setChildArmature(a),a.setParentBone(c)):a instanceof cc.ParticleSystem&&a.resetSystem()),a.setColor(c.getDisplayedColor()),a.setOpacity(c.getDisplayedOpacity()),this._displayRenderNode.setVisible(this._visible), this._displayType=this._currentDecoDisplay.getDisplayData().displayType):this._displayType=ccs.DISPLAY_TYPE_MAX;cc.renderer.childrenOrderDirty=!0},getDisplayRenderNode:function(){return this._displayRenderNode},getDisplayRenderNodeType:function(){return this._displayType},getCurrentDisplayIndex:function(){return this._displayIndex},getCurrentDecorativeDisplay:function(){return this._currentDecoDisplay},getDecorativeDisplayByIndex:function(a){return this._decoDisplayList[a]},initDisplayList:function(a){this._decoDisplayList.length= 0;if(a){a=a.displayDataList;for(var b=this._decoDisplayList,c=this._bone,d=0;d<a.length;d++){var e=a[d],f=new ccs.DecorativeDisplay;f.setDisplayData(e);ccs.displayFactory.createDisplay(c,f);b.push(f)}}},containPoint:function(a,b){if(!this._visible||0>this._displayIndex)return!1;void 0!==b&&(a=cc.p(a,b));if(this._currentDecoDisplay.getDisplayData().displayType===ccs.DISPLAY_TYPE_SPRITE){var c=this._currentDecoDisplay.getDisplay(),c=c.getChildByTag(0);return ccs.SPRITE_CONTAIN_POINT_WITH_RETURN(c,a)}return!1}, setVisible:function(a){this._displayRenderNode&&(this._visible=a,this._displayRenderNode.setVisible(a))},isVisible:function(){return this._visible},getContentSize:function(){return this._displayRenderNode?this._displayRenderNode.getContentSize():cc.size(0,0)},getBoundingBox:function(){return this._displayRenderNode?this._displayRenderNode.getBoundingBox():cc.rect(0,0,0,0)},getAnchorPoint:function(){return this._displayRenderNode?this._displayRenderNode.getAnchorPoint():cc.p(0,0)},getAnchorPointInPoints:function(){return this._displayRenderNode? this._displayRenderNode.getAnchorPointInPoints():cc.p(0,0)},getForceChangeDisplay:function(){return this._forceChangeDisplay},release:function(){this._decoDisplayList=null;this._displayRenderNode&&(this._displayRenderNode.removeFromParent(!0),this._displayRenderNode=null)}});ccs.DisplayManager.create=function(a){return new ccs.DisplayManager(a)};ccs.Skin=ccs.Sprite.extend({_skinData:null,bone:null,_skinTransform:null,_displayName:"",_armature:null,_className:"Skin",ctor:function(a,b){cc.Sprite.prototype.ctor.call(this);this.bone=this._skinData=null;this._displayName="";this._skinTransform=cc.affineTransformIdentity();this._armature=null;null==a||""===a?ccs.Skin.prototype.init.call(this):"#"===a[0]?ccs.Skin.prototype.initWithSpriteFrameName.call(this,a.substr(1)):ccs.Skin.prototype.initWithFile.call(this,a,b)},initWithSpriteFrameName:function(a){if(""=== a)return!1;var b=cc.spriteFrameCache.getSpriteFrame(a),c=!0;b?this.initWithSpriteFrame(b):(cc.log("Can't find CCSpriteFrame with %s. Please check your .plist file",a),c=!1);this._displayName=a;return c},initWithFile:function(a,b){var c=b?cc.Sprite.prototype.initWithFile.call(this,a,b):cc.Sprite.prototype.initWithFile.call(this,a);this._displayName=a;return c},setSkinData:function(a){this._skinData=a;this.setScaleX(a.scaleX);this.setScaleY(a.scaleY);this.setRotationX(cc.radiansToDegrees(a.skewX)); this.setRotationY(cc.radiansToDegrees(-a.skewY));this.setPosition(a.x,a.y);this._renderCmd.transform()},getSkinData:function(){return this._skinData},updateArmatureTransform:function(){this._renderCmd.transform()},getNodeToWorldTransform:function(){return this._renderCmd.getNodeToWorldTransform()},getNodeToWorldTransformAR:function(){return this._renderCmd.getNodeToWorldTransformAR()},setBone:function(a){this.bone=a;if(a=this.bone.getArmature())this._armature=a},getBone:function(){return this.bone}, getDisplayName:function(){return this._displayName},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new ccs.Skin.CanvasRenderCmd(this):new ccs.Skin.WebGLRenderCmd(this)}});_p=ccs.Skin.prototype;cc.defineGetterSetter(_p,"skinData",_p.getSkinData,_p.setSkinData);cc.defineGetterSetter(_p,"displayName",_p.getDisplayName);_p=null;ccs.Skin.create=function(a,b){return new ccs.Skin(a,b)};ccs.Skin.createWithSpriteFrameName=function(a){return new ccs.Skin("#"+a)};(function(){ccs.Skin.RenderCmd={_realWorldTM:null,transform:function(a,c){this._transform||(this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0},this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0});var d=this._node,e=a?a._worldTransform:null,f=this._transform,g=this._worldTransform;if(this._dirtyFlag&cc.Node._dirtyFlags.transformDirty||e)this.originTransform(),cc.affineTransformConcatIn(this._transform,d.bone.getNodeToArmatureTransform()),this._dirtyFlag&=~cc.Node._dirtyFlags.transformDirty;if(e){if(g.a=f.a* e.a+f.b*e.c,g.b=f.a*e.b+f.b*e.d,g.c=f.c*e.a+f.d*e.c,g.d=f.c*e.b+f.d*e.d,g.tx=f.tx*e.a+f.ty*e.c+e.tx,g.ty=f.tx*e.b+f.ty*e.d+e.ty,e=this._vertices){var h=d._offsetPosition.x,k=h+d._rect.width,m=d._offsetPosition.y,d=m+d._rect.height;e[0].x=h*g.a+d*g.c+g.tx;e[0].y=h*g.b+d*g.d+g.ty;e[1].x=h*g.a+m*g.c+g.tx;e[1].y=h*g.b+m*g.d+g.ty;e[2].x=k*g.a+d*g.c+g.tx;e[2].y=k*g.b+d*g.d+g.ty;e[3].x=k*g.a+m*g.c+g.tx;e[3].y=k*g.b+m*g.d+g.ty}}else g.a=f.a,g.b=f.b,g.c=f.c,g.d=f.d,g.tx=f.tx,g.ty=f.ty;if(g=this._realWorldTM)g.a= f.a,g.b=f.b,g.c=f.c,g.d=f.d,g.tx=f.tx,g.ty=f.ty,cc.affineTransformConcatIn(g,this._node.bone.getArmature()._renderCmd._worldTransform)},getNodeToWorldTransform:function(){return cc.affineTransformConcat(this._transform,this._node.bone.getArmature().getNodeToWorldTransform())},getNodeToWorldTransformAR:function(){var a=this._transform,c=this._node;this._anchorPointInPoints=cc.pointApplyAffineTransform(this._anchorPointInPoints,a);a.tx=this._anchorPointInPoints.x;a.ty=this._anchorPointInPoints.y;return cc.affineTransformConcat(a, c.bone.getArmature().getNodeToWorldTransform())}};ccs.Skin.CanvasRenderCmd=function(a){this._spriteCmdCtor(a);this._realWorldTM={a:1,b:0,c:0,d:1,tx:0,ty:0}};var a=ccs.Skin.CanvasRenderCmd.prototype=Object.create(cc.Sprite.CanvasRenderCmd.prototype);cc.inject(ccs.Skin.RenderCmd,a);a.constructor=ccs.Skin.CanvasRenderCmd;a._updateCurrentRegions=function(){var a=this._currentRegion;this._currentRegion=this._oldRegion;this._oldRegion=a;cc.Node.CanvasRenderCmd.RegionStatus.DirtyDouble!==this._regionFlag|| this._currentRegion.isEmpty()||this._oldRegion.union(this._currentRegion);this._currentRegion.updateRegion(this.getLocalBB(),this._realWorldTM)};ccs.Skin.WebGLRenderCmd=function(a){this._spriteCmdCtor(a)};a=ccs.Skin.WebGLRenderCmd.prototype=Object.create(cc.Sprite.WebGLRenderCmd.prototype);cc.inject(ccs.Skin.RenderCmd,a);a.constructor=ccs.Skin.WebGLRenderCmd})();ccs.ANIMATION_TYPE_SINGLE_FRAME=-4;ccs.ANIMATION_TYPE_NO_LOOP=-3;ccs.ANIMATION_TYPE_TO_LOOP_FRONT=-2;ccs.ANIMATION_TYPE_TO_LOOP_BACK=-1;ccs.ANIMATION_TYPE_LOOP_FRONT=0;ccs.ANIMATION_TYPE_LOOP_BACK=1;ccs.ANIMATION_TYPE_MAX=2; ccs.ProcessBase=ccs.Class.extend({_processScale:1,_isComplete:!0,_isPause:!0,_isPlaying:!1,_currentPercent:0,_rawDuration:0,_loopType:0,_tweenEasing:0,animationInternal:null,_currentFrame:0,_durationTween:0,_nextFrameIndex:0,_curFrameIndex:null,_isLoopBack:!1,ctor:function(){this._processScale=1;this._isPause=this._isComplete=!0;this._isPlaying=!1;this._rawDuration=this._durationTween=this._currentPercent=this._currentFrame=0;this._loopType=ccs.ANIMATION_TYPE_LOOP_BACK;this._tweenEasing=ccs.TweenType.LINEAR; this.animationInternal=1/60;this._durationTween=this._curFrameIndex=0;this._isLoopBack=!1},pause:function(){this._isPause=!0;this._isPlaying=!1},resume:function(){this._isPause=!1;this._isPlaying=!0},stop:function(){this._isComplete=!0;this._isPlaying=!1},play:function(a,b,c,d){this._isPause=this._isComplete=!1;this._isPlaying=!0;this._currentFrame=0;this._nextFrameIndex=a;this._tweenEasing=d},update:function(a){if(!(this._isComplete||this._isPause||0>=this._rawDuration||1<a)){var b=void 0===this._nextFrameIndex? 0:this._nextFrameIndex,c=this._currentFrame;0>=b?(this._currentPercent=1,c=0):(c+=a/this.animationInternal*this._processScale,this._currentPercent=c/b,c=ccs.fmodf(c,b));this._currentFrame=c;this.updateHandler()}},gotoFrame:function(a){var b=this._loopType;b===ccs.ANIMATION_TYPE_NO_LOOP?b=ccs.ANIMATION_TYPE_MAX:b===ccs.ANIMATION_TYPE_TO_LOOP_FRONT&&(b=ccs.ANIMATION_TYPE_LOOP_FRONT);this._loopType=b;this._curFrameIndex=a;this._nextFrameIndex=this._durationTween},getCurrentFrameIndex:function(){return this._curFrameIndex= (this._rawDuration-1)*this._currentPercent},updateHandler:function(){},isPause:function(){return this._isPause},isComplete:function(){return this._isComplete},getCurrentPercent:function(){return this._currentPercent},getRawDuration:function(){return this._rawDuration},getLoop:function(){return this._loopType},getTweenEasing:function(){return this._tweenEasing},getAnimationInternal:function(){return this.animationInternal},setAnimationInternal:function(a){this.animationInternal=a},getProcessScale:function(){return this._processScale}, setProcessScale:function(a){this._processScale=a},isPlaying:function(){return this._isPlaying}});_p=ccs.ProcessBase.prototype;cc.defineGetterSetter(_p,"currentFrameIndex",_p.getCurrentFrameIndex);cc.defineGetterSetter(_p,"paused",_p.isPause);cc.defineGetterSetter(_p,"completed",_p.isComplete);cc.defineGetterSetter(_p,"currentPercent",_p.getCurrentPercent);cc.defineGetterSetter(_p,"rawDuration",_p.getRawDuration);cc.defineGetterSetter(_p,"loop",_p.getLoop);cc.defineGetterSetter(_p,"tweenEasing",_p.getTweenEasing); cc.defineGetterSetter(_p,"playing",_p.isPlaying);_p=null;ccs.MovementEventType={start:0,complete:1,loopComplete:2};ccs.AnimationEvent=ccs.Class.extend({_arguments:null,_callFunc:null,_selectorTarget:null,ctor:function(a,b,c){this._data=c;this._callFunc=a;this._selectorTarget=b},call:function(){this._callFunc&&this._callFunc.apply(this._selectorTarget,this._arguments)},setArguments:function(a){this._arguments=a}});ccs.MovementEvent=function(){this.armature=null;this.movementType=ccs.MovementEventType.start;this.movementID=""}; ccs.FrameEvent=function(){this.bone=null;this.frameEventName="";this.currentFrameIndex=this.originFrameIndex=0}; ccs.ArmatureAnimation=ccs.ProcessBase.extend({_animationData:null,_movementData:null,_armature:null,_movementID:"",_toIndex:0,_tweenList:null,_speedScale:1,_ignoreFrameEvent:!1,_frameEventQueue:null,_movementEventQueue:null,_movementList:null,_onMovementList:!1,_movementListLoop:!1,_movementIndex:0,_movementListDurationTo:-1,_movementEventCallFunc:null,_frameEventCallFunc:null,_movementEventTarget:null,_frameEventTarget:null,_movementEventListener:null,_frameEventListener:null,ctor:function(a){ccs.ProcessBase.prototype.ctor.call(this); this._tweenList=[];this._movementList=[];this._frameEventQueue=[];this._movementEventQueue=[];this._armature=null;a&&ccs.ArmatureAnimation.prototype.init.call(this,a)},init:function(a){this._armature=a;this._tweenList.length=0;return!0},pause:function(){for(var a=this._tweenList,b=0;b<a.length;b++)a[b].pause();ccs.ProcessBase.prototype.pause.call(this)},resume:function(){for(var a=this._tweenList,b=0;b<a.length;b++)a[b].resume();ccs.ProcessBase.prototype.resume.call(this)},stop:function(){for(var a= this._tweenList,b=0;b<a.length;b++)a[b].stop();a.length=0;ccs.ProcessBase.prototype.stop.call(this)},setAnimationScale:function(a){this.setSpeedScale(a)},getAnimationScale:function(){return this.getSpeedScale()},setSpeedScale:function(a){if(a!==this._speedScale){this._speedScale=a;this._processScale=this._movementData?this._speedScale*this._movementData.scale:this._speedScale;a=this._armature.getBoneDic();for(var b in a){var c=a[b];c.getTween().setProcessScale(this._processScale);c.getChildArmature()&& c.getChildArmature().getAnimation().setSpeedScale(this._processScale)}}},getSpeedScale:function(){return this._speedScale},play:function(a,b,c){cc.assert(this._animationData,"this.animationData can not be null");this._movementData=this._animationData.getMovement(a);cc.assert(this._movementData,"this._movementData can not be null");b=void 0===b?-1:b;c=void 0===c?-1:c;this._rawDuration=this._movementData.duration;this._movementID=a;this._processScale=this._speedScale*this._movementData.scale;b=-1=== b?this._movementData.durationTo:b;a=0===this._movementData.durationTween?this._rawDuration:this._movementData.durationTween;var d=this._movementData.tweenEasing;c=0>c?this._movementData.loop:c;this._onMovementList=!1;ccs.ProcessBase.prototype.play.call(this,b,a,c,d);0===this._rawDuration?this._loopType=ccs.ANIMATION_TYPE_SINGLE_FRAME:(this._loopType=c?ccs.ANIMATION_TYPE_TO_LOOP_FRONT:ccs.ANIMATION_TYPE_NO_LOOP,this._durationTween=a);this._tweenList.length=0;var e,f=this._armature.getBoneDic(),g;for(g in f){var h= f[g];e=this._movementData.movBoneDataDic[h.getName()];var k=h.getTween();e&&0<e.frameList.length?(this._tweenList.push(k),e.duration=this._movementData.duration,k.play(e,b,a,c,d),k.setProcessScale(this._processScale),h.getChildArmature()&&(h.getChildArmature().getAnimation().setSpeedScale(this._processScale),h.getChildArmature().getAnimation().isPlaying()||h.getChildArmature().getAnimation().playWithIndex(0))):h.isIgnoreMovementBoneData()||(h.getDisplayManager().changeDisplayWithIndex(-1,!1),k.stop())}this._armature.update(0)}, playByIndex:function(a,b,c,d,e){cc.log("playByIndex is deprecated. Use playWithIndex instead.");this.playWithIndex(a,b,d)},playWithIndex:function(a,b,c){var d=this._animationData.movementNames;cc.assert(-1<a&&a<d.length);this.play(d[a],b,c)},playWithNames:function(a,b,c){this._movementListLoop=void 0===c?!0:c;this._movementListDurationTo=void 0===b?-1:b;this._onMovementList=!0;this._movementIndex=0;a instanceof Array?this._movementList=a:this._movementList.length=0;this.updateMovementList()},playWithIndexes:function(a, b,c){this._movementList.length=0;this._movementListLoop=void 0===c?!0:c;this._movementListDurationTo=void 0===b?-1:b;this._onMovementList=!0;this._movementIndex=0;b=this._animationData.movementNames;for(c=0;c<a.length;c++)this._movementList.push(b[a[c]]);this.updateMovementList()},gotoAndPlay:function(a){if(!this._movementData||0>a||a>=this._movementData.duration)cc.log("Please ensure you have played a movement, and the frameIndex is in the range.");else{var b=this._ignoreFrameEvent;this._isPlaying= this._ignoreFrameEvent=!0;this._isComplete=this._isPause=!1;ccs.ProcessBase.prototype.gotoFrame.call(this,a);this._currentPercent=this._curFrameIndex/(this._movementData.duration-1);this._currentFrame=this._nextFrameIndex*this._currentPercent;for(var c=this._tweenList,d=0;d<c.length;d++)c[d].gotoAndPlay(a);this._armature.update(0);this._ignoreFrameEvent=b}},gotoAndPause:function(a){this.gotoAndPlay(a);this.pause()},getMovementCount:function(){return this._animationData.getMovementCount()},update:function(a){ccs.ProcessBase.prototype.update.call(this, a);for(var b=this._tweenList,c=0;c<b.length;c++)b[c].update(a);for(b=this._frameEventQueue;0<b.length;)a=b.shift(),this._ignoreFrameEvent=!0,this._frameEventCallFunc&&this._frameEventCallFunc.call(this._frameEventTarget,a.bone,a.frameEventName,a.originFrameIndex,a.currentFrameIndex),this._frameEventListener&&this._frameEventListener(a.bone,a.frameEventName,a.originFrameIndex,a.currentFrameIndex),this._ignoreFrameEvent=!1;for(b=this._movementEventQueue;0<b.length;)a=b.shift(),this._movementEventCallFunc&& this._movementEventCallFunc.call(this._movementEventTarget,a.armature,a.movementType,a.movementID),this._movementEventListener&&this._movementEventListener(a.armature,a.movementType,a.movementID)},updateHandler:function(){var a=this._currentPercent;if(1<=a){switch(this._loopType){case ccs.ANIMATION_TYPE_NO_LOOP:this._loopType=ccs.ANIMATION_TYPE_MAX;this._currentFrame=(a-1)*this._nextFrameIndex;a=this._currentFrame/this._durationTween;if(1>a){this._nextFrameIndex=this._durationTween;this.movementEvent(this._armature, ccs.MovementEventType.start,this._movementID);break}break;case ccs.ANIMATION_TYPE_MAX:case ccs.ANIMATION_TYPE_SINGLE_FRAME:a=1;this._isComplete=!0;this._isPlaying=!1;this.movementEvent(this._armature,ccs.MovementEventType.complete,this._movementID);this.updateMovementList();break;case ccs.ANIMATION_TYPE_TO_LOOP_FRONT:this._loopType=ccs.ANIMATION_TYPE_LOOP_FRONT;a=ccs.fmodf(a,1);this._currentFrame=0===this._nextFrameIndex?0:ccs.fmodf(this._currentFrame,this._nextFrameIndex);this._nextFrameIndex=0< this._durationTween?this._durationTween:1;this.movementEvent(this,ccs.MovementEventType.start,this._movementID);break;default:this._currentFrame=ccs.fmodf(this._currentFrame,this._nextFrameIndex),this._toIndex=0,this.movementEvent(this._armature,ccs.MovementEventType.loopComplete,this._movementID)}this._currentPercent=a}},getCurrentMovementID:function(){return this._isComplete?"":this._movementID},setMovementEventCallFunc:function(a,b){1===arguments.length?this._movementEventListener=a:2===arguments.length&& (this._movementEventTarget=b,this._movementEventCallFunc=a)},setFrameEventCallFunc:function(a,b){1===arguments.length?this._frameEventListener=a:2===arguments.length&&(this._frameEventTarget=b,this._frameEventCallFunc=a)},setUserObject:function(a){this._userObject=a},frameEvent:function(a,b,c,d){if(this._frameEventTarget&&this._frameEventCallFunc||this._frameEventListener){var e=new ccs.FrameEvent;e.bone=a;e.frameEventName=b;e.originFrameIndex=c;e.currentFrameIndex=d;this._frameEventQueue.push(e)}}, movementEvent:function(a,b,c){if(this._movementEventTarget&&this._movementEventCallFunc||this._movementEventListener){var d=new ccs.MovementEvent;d.armature=a;d.movementType=b;d.movementID=c;this._movementEventQueue.push(d)}},updateMovementList:function(){if(this._onMovementList){var a,b=this._movementList;this._movementListLoop?(a=b[this._movementIndex],this.play(a,a.durationTo,0),this._movementIndex++,this._movementIndex>=b.length&&(this._movementIndex=0)):this._movementIndex<b.length?(a=b[this._movementIndex], this.play(a,a.durationTo,0),this._movementIndex++):this._onMovementList=!1;this._onMovementList=!0}},setAnimationData:function(a){this._animationData!==a&&(this._animationData=a)},getAnimationData:function(){return this._animationData},getUserObject:function(){return this._userObject},isIgnoreFrameEvent:function(){return this._ignoreFrameEvent}});_p=ccs.ArmatureAnimation.prototype;cc.defineGetterSetter(_p,"speedScale",_p.getSpeedScale,_p.setSpeedScale); cc.defineGetterSetter(_p,"animationScale",_p.getAnimationScale,_p.setAnimationScale);_p=null;ccs.ArmatureAnimation.create=function(a){return new ccs.ArmatureAnimation(a)};ccs.Tween=ccs.ProcessBase.extend({_tweenData:null,_to:null,_from:null,_between:null,_movementBoneData:null,_bone:null,_frameTweenEasing:0,_betweenDuration:0,_totalDuration:0,_toIndex:0,_fromIndex:0,_animation:null,_passLastFrame:!1,ctor:function(a){ccs.ProcessBase.prototype.ctor.call(this);this._frameTweenEasing=ccs.TweenType.LINEAR;ccs.Tween.prototype.init.call(this,a)},init:function(a){this._from=new ccs.FrameData;this._between=new ccs.FrameData;this._bone=a;this._tweenData=this._bone.getTweenData(); this._tweenData.displayIndex=-1;this._animation=null!==this._bone&&null!==this._bone.getArmature()?this._bone.getArmature().getAnimation():null;return!0},play:function(a,b,c,d,e){ccs.ProcessBase.prototype.play.call(this,b,c,d,e);this._loopType=d?ccs.ANIMATION_TYPE_TO_LOOP_FRONT:ccs.ANIMATION_TYPE_NO_LOOP;this._fromIndex=this._toIndex=this._betweenDuration=this._totalDuration=0;e=a!==this._movementBoneData;this.setMovementBoneData(a);this._rawDuration=this._movementBoneData.duration;a=this._movementBoneData.getFrameData(0); this._tweenData.displayIndex=a.displayIndex;this._bone.getArmature().getArmatureData().dataVersion>=ccs.CONST_VERSION_COMBINED&&(ccs.TransformHelp.nodeSub(this._tweenData,this._bone.getBoneData()),this._tweenData.scaleX+=1,this._tweenData.scaleY+=1);0===this._rawDuration?(this._loopType=ccs.ANIMATION_TYPE_SINGLE_FRAME,0===b?this.setBetween(a,a):this.setBetween(this._tweenData,a),this._frameTweenEasing=ccs.TweenType.LINEAR):1<this._movementBoneData.frameList.length&&(this._durationTween=c*this._movementBoneData.scale, d&&0!==this._movementBoneData.delay?this.setBetween(this._tweenData,this.tweenNodeTo(this.updateFrameData(1-this._movementBoneData.delay),this._between)):e&&0!==b?this.setBetween(this._tweenData,a):this.setBetween(a,a));this.tweenNodeTo(0)},gotoAndPlay:function(a){ccs.ProcessBase.prototype.gotoFrame.call(this,a);this._fromIndex=this._toIndex=this._betweenDuration=this._totalDuration=0;this._isPlaying=!0;this._isComplete=this._isPause=!1;this._currentPercent=this._curFrameIndex/(this._rawDuration- 1);this._currentFrame=this._nextFrameIndex*this._currentPercent},gotoAndPause:function(a){this.gotoAndPlay(a);this.pause()},updateHandler:function(){var a=null==this._currentPercent?1:this._currentPercent,b=this._loopType;if(1<=a)switch(b){case ccs.ANIMATION_TYPE_SINGLE_FRAME:a=1;this._isComplete=!0;this._isPlaying=!1;break;case ccs.ANIMATION_TYPE_NO_LOOP:b=ccs.ANIMATION_TYPE_MAX;a=0>=this._durationTween?1:(a-1)*this._nextFrameIndex/this._durationTween;1<=a?(a=1,this._isComplete=!0,this._isPlaying= !1):(this._nextFrameIndex=this._durationTween,this._currentFrame=a*this._nextFrameIndex,this._fromIndex=this._toIndex=this._betweenDuration=this._totalDuration=0);break;case ccs.ANIMATION_TYPE_TO_LOOP_FRONT:b=ccs.ANIMATION_TYPE_LOOP_FRONT;this._nextFrameIndex=0<this._durationTween?this._durationTween:1;0!==this._movementBoneData.delay?(this._currentFrame=(1-this._movementBoneData.delay)*this._nextFrameIndex,a=this._currentFrame/this._nextFrameIndex):this._currentFrame=a=0;this._fromIndex=this._toIndex= this._betweenDuration=this._totalDuration=0;break;case ccs.ANIMATION_TYPE_MAX:a=1;this._isComplete=!0;this._isPlaying=!1;break;default:this._currentFrame=ccs.fmodf(this._currentFrame,this._nextFrameIndex)}1>a&&b<ccs.ANIMATION_TYPE_TO_LOOP_BACK&&(a=Math.sin(a*cc.PI/2));this._currentPercent=a;this._loopType=b;b>ccs.ANIMATION_TYPE_TO_LOOP_BACK&&(a=this.updateFrameData(a));this._frameTweenEasing!==ccs.TweenType.TWEEN_EASING_MAX&&this.tweenNodeTo(a)},setBetween:function(a,b,c){void 0===c&&(c=!0);0>a.displayIndex&& 0<=b.displayIndex?(this._from.copy(b),this._between.subtract(b,b,c)):0>b.displayIndex&&0<=a.displayIndex?(this._from.copy(a),this._between.subtract(b,b,c)):(this._from.copy(a),this._between.subtract(a,b,c));a.isTween||(this._tweenData.copy(a),this._tweenData.isTween=!0);this.arriveKeyFrame(a)},arriveKeyFrame:function(a){if(a){var b=this._bone,c=b.getDisplayManager(),d=a.displayIndex;c.getForceChangeDisplay()||c.changeDisplayWithIndex(d,!1);this._tweenData.zOrder=a.zOrder;b.updateZOrder();this._bone.setBlendFunc(a.blendFunc); (b=b.getChildArmature())&&""!==a.movement&&b.getAnimation().play(a.movement)}},tweenNodeTo:function(a,b){b||(b=this._tweenData);var c=this._from,d=this._between;c.isTween||(a=0);b.x=c.x+a*d.x;b.y=c.y+a*d.y;b.scaleX=c.scaleX+a*d.scaleX;b.scaleY=c.scaleY+a*d.scaleY;b.skewX=c.skewX+a*d.skewX;b.skewY=c.skewY+a*d.skewY;this._bone.setTransformDirty(!0);b&&d.isUseColorInfo&&this.tweenColorTo(a,b);return b},tweenColorTo:function(a,b){var c=this._from,d=this._between;b.a=c.a+a*d.a;b.r=c.r+a*d.r;b.g=c.g+a* d.g;b.b=c.b+a*d.b;this._bone.updateColor()},updateFrameData:function(a){1<a&&0!==this._movementBoneData.delay&&(a=ccs.fmodf(a,1));a*=this._rawDuration-1;var b,c,d=this._totalDuration,e=this._betweenDuration,f=this._toIndex;if(a<d||a>=d+e){var e=this._movementBoneData.frameList,g=e.length;if(a<e[0].frameID)return b=c=e[0],this.setBetween(b,c),this._currentPercent;if(a>=e[g-1].frameID){if(this._passLastFrame)return b=c=e[g-1],this.setBetween(b,c),this._currentPercent;this._passLastFrame=!0}else this._passLastFrame= !1;do if(this._fromIndex=f,b=e[this._fromIndex],d=b.frameID,f=this._fromIndex+1,f>=g&&(f=0),c=e[f],b.strEvent&&!this._animation.isIgnoreFrameEvent()&&this._animation.frameEvent(this._bone,b.strEvent,b.frameID,a),a===b.frameID||this._passLastFrame&&this._fromIndex===g-1)break;while(a<b.frameID||a>=c.frameID);e=c.frameID-b.frameID;this._frameTweenEasing=b.tweenEasing;this.setBetween(b,c,!1);this._totalDuration=d;this._betweenDuration=e;this._toIndex=f}a=0===e?0:(a-this._totalDuration)/this._betweenDuration; b=this._frameTweenEasing!==ccs.TweenType.LINEAR?this._frameTweenEasing:this._tweenEasing;b===ccs.TweenType.TWEEN_EASING_MAX||b===ccs.TweenType.LINEAR||this._passLastFrame||(a=ccs.TweenFunction.tweenTo(a,b,this._from.easingParams));return a},setAnimation:function(a){this._animation=a},getAnimation:function(){return this._animation},setMovementBoneData:function(a){this._movementBoneData=a}});_p=ccs.Tween.prototype;cc.defineGetterSetter(_p,"animation",_p.getAnimation,_p.setAnimation);_p=null; ccs.Tween.create=function(a){return new ccs.Tween(a)};ccs.PT_RATIO=32;ccs.ColliderFilter=ccs.Class.extend({_collisionType:0,_group:0,_categoryBits:0,_groupIndex:0,_maskBits:0,ctor:function(a,b){this._collisionType=a||0;this._group=b||0},updateShape:function(a){if(a instanceof cp.Shape)a.collision_type=this._collisionType,a.group=this._group;else if(a instanceof Box2D.b2FilterData){var b=new Box2D.b2FilterData;b.categoryBits=this._categoryBits;b.groupIndex=this._groupIndex;b.maskBits=this._maskBits;a.SetFilterData(b)}}}); ccs.ColliderBody=ccs.Class.extend({shape:null,coutourData:null,colliderFilter:null,_calculatedVertexList:null,ctor:function(a){this.shape=null;this.coutourData=a;this.colliderFilter=new ccs.ColliderFilter;ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX&&(this._calculatedVertexList=[])},getContourData:function(){return this.coutourData},setColliderFilter:function(a){this.colliderFilter=a},getCalculatedVertexList:function(){return this._calculatedVertexList},setB2Fixture:function(a){this._fixture=a},getB2Fixture:function(){return this._fixture}, setShape:function(a){this.shape=a},getShape:function(){return this.shape},setContourData:function(a){this.coutourData=a},getColliderFilter:function(){return this.colliderFilter}}); ccs.ColliderDetector=ccs.Class.extend({_colliderBodyList:null,_bone:null,_body:null,_active:!1,_filter:null,helpPoint:cc.p(0,0),ctor:function(a){this._colliderBodyList=[];this._body=this._bone=null;this._active=!1;this._filter=null;ccs.ColliderDetector.prototype.init.call(this,a)},init:function(a){this._colliderBodyList.length=0;a&&(this._bone=a);this._filter=new ccs.ColliderFilter;return!0},addContourData:function(a){var b=new ccs.ColliderBody(a);this._colliderBodyList.push(b);if(ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX){b= b.getCalculatedVertexList();a=a.vertexList;for(var c=0;c<a.length;c++){var d=new ccs.ContourVertex2(0,0);b.push(d)}}},addContourDataList:function(a){for(var b=0;b<a.length;b++)this.addContourData(a[b])},removeContourData:function(a){var b=[],c,d=this._colliderBodyList;for(c=0;c<d.length;c++){var e=d[c];e&&e.getContourData()===a&&b.push(e)}for(c=0;c<b.length;c++)cc.arrayRemoveObject(d,b[c])},removeAll:function(){this._colliderBodyList.length=0},setActive:function(a){if(this._active!==a){this._active= a;a=this._body;var b;if(a)if(b=null,this._active)for(var c=0;c<this._colliderBodyList.length;c++)b=this._colliderBodyList[c],b=b.getShape(),a.space.addShape(b);else for(c=0;c<this._colliderBodyList.length;c++)b=this._colliderBodyList[c],b=b.getShape(),a.space.removeShape(b)}},getActive:function(){return this._active},getColliderBodyList:function(){return this._colliderBodyList},setColliderFilter:function(a){this._filter=a;for(var b=this._colliderBodyList,c=0;c<b.length;c++){var d=b[c];d.setColliderFilter(a); d.getShape()&&d.getColliderFilter().updateShape(d.getShape())}},getColliderFilter:function(){return this._filter},updateTransform:function(a){if(this._active)for(var b=null,c=this._body,d=this.helpPoint,e=0;e<this._colliderBodyList.length;e++){var b=this._colliderBodyList[e],f=b.getContourData(),g=null;c&&(g=b.getShape());for(var f=f.vertexList,h=b.getCalculatedVertexList(),b=0;b<f.length;b++){d.x=f[b].x;d.y=f[b].y;d=cc.pointApplyAffineTransform(d,a);if(ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX){var k= cc.p(0,0);k.x=d.x;k.y=d.y;h[b]=k}g&&(g.verts[2*b]=d.x,g.verts[2*b+1]=d.y)}if(g)for(b=0;b<f.length;b++)h=cp.v.normalize(cp.v.perp(cp.v.sub(g.verts[(b+1)%g.verts.length],g.verts[b]))),g.planes&&(g.planes[b].n=h,g.planes[b].d=cp.v.dot(h,g.verts[b]))}},setBody:function(a){this._body=a;for(var b=this._colliderBodyList,c=0;c<b.length;c++){a=b[c];for(var d=[],e=a.getContourData().vertexList,f=0;f<e.length;f++){var g=e[f];d.push(g.x);d.push(g.y)}d=new cp.PolyShape(this._body,d,cp.vzero);d.sensor=!0;d.data= this._bone;this._active&&this._body.space.addShape(d);a.setShape(d);a.getColliderFilter().updateShape(d)}},getBody:function(){return this._body}});_p=ccs.ColliderDetector.prototype;cc.defineGetterSetter(_p,"colliderFilter",_p.getColliderFilter,_p.setColliderFilter);cc.defineGetterSetter(_p,"active",_p.getActive,_p.setActive);cc.defineGetterSetter(_p,"body",_p.getBody,_p.setBody);_p=null;ccs.ColliderDetector.create=function(a){return new ccs.ColliderDetector(a)};ccs.Armature=ccs.Node.extend({animation:null,armatureData:null,batchNode:null,_parentBone:null,_boneDic:null,_topBoneList:null,_armatureIndexDic:null,_offsetPoint:null,version:0,_armatureTransformDirty:!0,_body:null,_blendFunc:null,_className:"Armature",ctor:function(a,b){cc.Node.prototype.ctor.call(this);this._name="";this._topBoneList=[];this._armatureIndexDic={};this._offsetPoint=cc.p(0,0);this._armatureTransformDirty=!0;this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};a&&ccs.Armature.prototype.init.call(this, a,b);this._texture={}},init:function(a,b){b&&(this._parentBone=b);this.removeAllChildren();this.animation=new ccs.ArmatureAnimation;this.animation.init(this);this._boneDic={};this._topBoneList.length=0;var c=ccs.armatureDataManager,d;if(""!==a){d=c.getAnimationData(a);cc.assert(d,"AnimationData not exist!");this.animation.setAnimationData(d);c=c.getArmatureData(a);cc.assert(c,"ArmatureData not exist!");this.armatureData=c;var c=c.getBoneDataDic(),e;for(e in c){var c=this.createBone(String(e)),f=d.getMovement(d.movementNames[0]); f&&(f=f.getMovementBoneData(c.getName()))&&!(0>=f.frameList.length)&&(f=f.getFrameData(0))&&(c.getTweenData().copy(f),c.changeDisplayWithIndex(f.displayIndex,!1))}this.update(0);this.updateOffsetPoint()}else a="new_armature",this.armatureData=new ccs.ArmatureData,this.armatureData.name=a,d=new ccs.AnimationData,d.name=a,c.addArmatureData(a,this.armatureData),c.addAnimationData(a,d),this.animation.setAnimationData(d);this._renderCmd.initShaderCache();this.setCascadeOpacityEnabled(!0);this.setCascadeColorEnabled(!0); return!0},visit:function(a){this._visible&&(this._renderCmd.visit(a&&a._renderCmd),this._renderCmd._dirtyFlag=0)},addChild:function(a,b,c){a instanceof ccui.Widget?cc.log("Armature doesn't support to add Widget as its child, it will be fix soon."):cc.Node.prototype.addChild.call(this,a,b,c)},createBone:function(a){var b=this.getBone(a);if(b)return b;var b=this.armatureData.getBoneData(a),c=b.parentName,d=null;c?(this.createBone(c),d=new ccs.Bone(a),this.addBone(d,c)):(d=new ccs.Bone(a),this.addBone(d, ""));d.setBoneData(b);d.getDisplayManager().changeDisplayWithIndex(-1,!1);return d},addBone:function(a,b){cc.assert(a,"Argument must be non-nil");var c=this._boneDic;a.getName()&&cc.assert(!c[a.getName()],"bone already added. It can't be added again");if(b){var d=c[b];d?d.addChildBone(a):this._topBoneList.push(a)}else this._topBoneList.push(a);a.setArmature(this);c[a.getName()]=a;this.addChild(a)},removeBone:function(a,b){cc.assert(a,"bone must be added to the bone dictionary!");a.setArmature(null); a.removeFromParent(b);cc.arrayRemoveObject(this._topBoneList,a);delete this._boneDic[a.getName()];this.removeChild(a,!0)},getBone:function(a){return this._boneDic[a]},changeBoneParent:function(a,b){cc.assert(a,"bone must be added to the bone dictionary!");var c=a.getParentBone();c&&(cc.arrayRemoveObject(c.getChildren(),a),a.setParentBone(null));b&&((c=this._boneDic[b])?(c.addChildBone(a),cc.arrayRemoveObject(this._topBoneList,a)):this._topBoneList.push(a))},getBoneDic:function(){return this._boneDic}, updateOffsetPoint:function(){var a=this.getBoundingBox();this.setContentSize(a);var b=this._offsetPoint;b.x=-a.x;b.y=-a.y;0!==a.width&&0!==a.height&&this.setAnchorPoint(b.x/a.width,b.y/a.height)},getOffsetPoints:function(){return{x:this._offsetPoint.x,y:this._offsetPoint.y}},setAnimation:function(a){this.animation=a},getAnimation:function(){return this.animation},getArmatureTransformDirty:function(){return this._armatureTransformDirty},update:function(a){this.animation.update(a);for(var b=this._topBoneList, c=0;c<b.length;c++)b[c].update(a);this._armatureTransformDirty=!1},onEnter:function(){cc.Node.prototype.onEnter.call(this);this.scheduleUpdate()},onExit:function(){cc.Node.prototype.onExit.call(this);this.unscheduleUpdate()},getBoundingBox:function(){for(var a,b,c,d=0,e=!0,f=cc.rect(0,0,0,0),g=this._children,h=g.length,k=0;k<h;k++)if(a=g[k])if(d=a.getDisplayManager().getBoundingBox(),0!==d.x||0!==d.y||0!==d.width||0!==d.height)e?(a=d.x,b=d.y,c=d.x+d.width,d=d.y+d.height,e=!1):(a=d.x<f.x?d.x:f.x,b= d.y<f.y?d.y:f.y,c=d.x+d.width>f.x+f.width?d.x+d.width:f.x+f.width,d=d.y+d.height>f.y+f.height?d.y+d.height:f.y+f.height),f.x=a,f.y=b,f.width=c-a,f.height=d-b;return cc.rectApplyAffineTransform(f,this.getNodeToParentTransform())},getBoneAtPoint:function(a,b){for(var c=this._children,d=c.length-1;0<=d;d--){var e=c[d];if(e instanceof ccs.Bone&&e.getDisplayManager().containPoint(a,b))return e}return null},setParentBone:function(a){this._parentBone=a;a=this._boneDic;for(var b in a)a[b].setArmature(this)}, getParentBone:function(){return this._parentBone},drawContour:function(){cc._drawingUtil.setDrawColor(255,255,255,255);cc._drawingUtil.setLineWidth(1);var a=this._boneDic,b;for(b in a){var c=a[b].getColliderDetector();if(c)for(var c=c.getColliderBodyList(),d=0;d<c.length;d++){var e=c[d].getCalculatedVertexList();cc._drawingUtil.drawPoly(e,e.length,!0)}}},setBody:function(a){if(this._body!==a){this._body=a;this._body.data=this;var b,c;a=this._children;for(var d=0;d<a.length;d++)if(b=a[d],b instanceof ccs.Bone){b=b.getDisplayManager().getDecorativeDisplayList();for(var e=0;e<b.length;e++)c=b[e],(c=c.getColliderDetector())&&c.setBody(this._body)}}},getShapeList:function(){return this._body?this._body.shapeList:null},getBody:function(){return this._body},setBlendFunc:function(a,b){void 0===b?(this._blendFunc.src=a.src,this._blendFunc.dst=a.dst):(this._blendFunc.src=a,this._blendFunc.dst=b)},getBlendFunc:function(){return new cc.BlendFunc(this._blendFunc.src,this._blendFunc.dst)},setColliderFilter:function(a){var b= this._boneDic,c;for(c in b)b[c].setColliderFilter(a)},getArmatureData:function(){return this.armatureData},setArmatureData:function(a){this.armatureData=a},getBatchNode:function(){return this.batchNode},setBatchNode:function(a){this.batchNode=a},getVersion:function(){return this.version},setVersion:function(a){this.version=a},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new ccs.Armature.CanvasRenderCmd(this):new ccs.Armature.WebGLRenderCmd(this)}});_p=ccs.Armature.prototype; cc.defineGetterSetter(_p,"parentBone",_p.getParentBone,_p.setParentBone);cc.defineGetterSetter(_p,"body",_p.getBody,_p.setBody);cc.defineGetterSetter(_p,"colliderFilter",null,_p.setColliderFilter);_p=null;ccs.Armature.create=function(a,b){return new ccs.Armature(a,b)};(function(){ccs.Armature.RenderCmd={_updateAnchorPointInPoint:function(){var a=this._node,b=a._contentSize,c=a._anchorPoint,a=a._offsetPoint;this._anchorPointInPoints.x=b.width*c.x-a.x;this._anchorPointInPoints.y=b.height*c.y-a.y;this._realAnchorPointInPoints.x=b.width*c.x;this._realAnchorPointInPoints.y=b.height*c.y;this.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getAnchorPointInPoints:function(){return cc.p(this._realAnchorPointInPoints)}}})(); (function(){ccs.Armature.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._realAnchorPointInPoints=new cc.Point(0,0);this._canUseDirtyRegion=!0;this._startRenderCmd=new cc.CustomRenderCmd(this,this._startCmdCallback);this._RestoreRenderCmd=new cc.CustomRenderCmd(this,this._RestoreCmdCallback);this._startRenderCmd._canUseDirtyRegion=!0;this._RestoreRenderCmd._canUseDirtyRegion=!0;this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0};this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0}};var a= ccs.Armature.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);cc.inject(ccs.Armature.RenderCmd,a);a.constructor=ccs.Armature.CanvasRenderCmd;a._startCmdCallback=function(a,c,d){var e=this._node._parent;this.transform(e?e._renderCmd:null);a=a||cc._renderContext;a.save();a._switchToArmatureMode(!0,this._worldTransform,c,d)};a.transform=function(a,c){this.originTransform(a,c);for(var d=this._node._children,e=0,f=d.length;e<f;e++){var g=d[e],h=g._renderCmd;if(g&&g.getDisplayRenderNode){var k= g.getDisplayRenderNodeType(),m=g.getDisplayRenderNode();if(m&&m._renderCmd){m=m._renderCmd;m.transform(null);k!==ccs.DISPLAY_TYPE_ARMATURE&&k!==ccs.DISPLAY_TYPE_SPRITE&&cc.affineTransformConcatIn(m._worldTransform,g._worldTransform);var k=cc.Node._dirtyFlags,n=m._dirtyFlag,p=h._dirtyFlag,r=p&k.colorDirty,p=p&k.opacityDirty;r&&h._updateDisplayColor(this._displayedColor);p&&h._updateDisplayOpacity(this._displayedOpacity);(r||p)&&h._updateColor();h=g._renderCmd._displayedColor;g=g._renderCmd._displayedOpacity; r=n&k.colorDirty;p=n&k.opacityDirty;r&&m._updateDisplayColor(h);p&&m._updateDisplayOpacity(g);(r||p)&&m._updateColor()}}}};a._RestoreCmdCallback=function(a){this._cacheDirty=!1;a._switchToArmatureMode(!1);a.restore()};a.initShaderCache=function(){};a.setShaderProgram=function(){};a.updateChildPosition=function(a,c){a.visit()};a.rendering=function(a,c,d){for(var e=this._node._children,f=0,g=e.length;f<g;f++){var h=e[f];if(h&&h.getDisplayRenderNode){var k=h.getDisplayRenderNode();if(null!==k)switch(h._renderCmd._syncStatus(this), h.getDisplayRenderNodeType()){case ccs.DISPLAY_TYPE_SPRITE:k.visit(h);break;case ccs.DISPLAY_TYPE_ARMATURE:k._renderCmd.rendering(a,c,d);break;default:k.visit(h)}}else h instanceof cc.Node&&this._visitNormalChild(h)}};a._visitNormalChild=function(a){if(a){var c=a._renderCmd;if(a._visible){c._curLevel=this._curLevel+1;var d,e=a._children,f;c._syncStatus(this);c.transform(null);var g=e.length;if(0<g){a.sortAllChildren();for(d=0;d<g;d++)if(f=e[d],0>f._localZOrder)f.visit(a);else break;for(cc.renderer.pushRenderCommand(c);d< g;d++)e[d].visit(a)}else cc.renderer.pushRenderCommand(c);this._dirtyFlag=0}}};a.visit=function(a){var c=this._node;c._visible&&(this._syncStatus(a),c.sortAllChildren(),cc.renderer.pushRenderCommand(this._startRenderCmd),this.rendering(),cc.renderer.pushRenderCommand(this._RestoreRenderCmd),this._cacheDirty=!1)}})();(function(){ccs.Armature.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._parentCmd=null;this._realAnchorPointInPoints=new cc.Point(0,0);this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0};this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0}};var a=ccs.Armature.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);cc.inject(ccs.Armature.RenderCmd,a);a.constructor=ccs.Armature.WebGLRenderCmd;a.uploadData=function(a,c,d){a=this._node;d=this._parentCmd||this;for(var e=a._children, f=cc.BlendFunc.ALPHA_PREMULTIPLIED,g=cc.BlendFunc.ALPHA_NON_PREMULTIPLIED,h=0,k=e.length;h<k;h++){var m=e[h],n=m._renderCmd;if(m&&m.getDisplayRenderNode){var p=m.getDisplayRenderNode();if(null!==p)switch(c=p._renderCmd,m.getDisplayRenderNodeType()){case ccs.DISPLAY_TYPE_SPRITE:p instanceof ccs.Skin&&(p.setShaderProgram(this._shaderProgram),this._updateColorAndOpacity(c,m),c.transform(d),n=m.getBlendFunc(),n.src!==f.src||n.dst!==f.dst?p.setBlendFunc(m.getBlendFunc()):(m=p.getTexture(),a._blendFunc.src=== f.src&&a._blendFunc.dst===f.dst&&m&&!m.hasPremultipliedAlpha()?p.setBlendFunc(g):p.setBlendFunc(a._blendFunc)),cc.renderer._uploadBufferData(c));break;case ccs.DISPLAY_TYPE_ARMATURE:p.setShaderProgram(this._shaderProgram),this._updateColorAndOpacity(c,m),c._parentCmd=this;default:n._syncStatus(d),c._syncStatus(n),c.uploadData?cc.renderer._uploadBufferData(c):c.rendering&&(cc.renderer._batchRendering(),c.rendering(cc._renderContext))}}else m instanceof cc.Node&&(m.setShaderProgram(this._shaderProgram), n._syncStatus(d),n.uploadData?cc.renderer._uploadBufferData(n):n.rendering&&(cc.renderer._batchRendering(),n.rendering(cc._renderContext)))}this._parentCmd=null;return 0};a.initShaderCache=function(){this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR)};a.setShaderProgram=function(a){this._shaderProgram=a};a._updateColorAndOpacity=function(a,c){var d=c._renderCmd._displayedColor,e=c._renderCmd._displayedOpacity,f=cc.Node._dirtyFlags,g=a._dirtyFlag,h=g&f.colorDirty, f=g&f.opacityDirty;h&&a._updateDisplayColor(d);f&&a._updateDisplayOpacity(e);(h||f)&&a._updateColor()};a.visit=function(a){var c=this._node;if(c._visible){if(a=a||this.getParentRenderCmd())this._curLevel=a._curLevel+1;this._syncStatus(a);c.sortAllChildren();a=cc.renderer;var d=c._children,e,f=d.length;isNaN(c._customZ)&&(c._vertexZ=a.assignedZ,a.assignedZ+=a.assignedZStep);for(e=0;e<f;e++)if(c=d[e],0>c._localZOrder)isNaN(c._customZ)&&(c._vertexZ=a.assignedZ,a.assignedZ+=a.assignedZStep);else break; for(a.pushRenderCommand(this);e<f;e++)c=d[e],isNaN(c._customZ)&&(c._vertexZ=a.assignedZ,a.assignedZ+=a.assignedZStep);this._dirtyFlag=0}}})();ccs.Bone=ccs.Node.extend({_boneData:null,_armature:null,_childArmature:null,_displayManager:null,ignoreMovementBoneData:!1,_tween:null,_tweenData:null,_parentBone:null,_boneTransformDirty:!1,_worldTransform:null,_blendFunc:null,blendDirty:!1,_worldInfo:null,_armatureParentBone:null,_dataVersion:0,_className:"Bone",ctor:function(a){cc.Node.prototype.ctor.call(this);this._displayManager=this._tween=this._boneData=this._childArmature=this._armature=this._parentBone=this._tweenData=null;this.ignoreMovementBoneData= !1;this._worldTransform=cc.affineTransformMake(1,0,0,1,0,0);this._boneTransformDirty=!0;this._blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST);this.blendDirty=!1;this._armatureParentBone=this._worldInfo=null;this._dataVersion=0;ccs.Bone.prototype.init.call(this,a)},init:function(a){a&&(this._name=a);this._tweenData=new ccs.FrameData;this._tween=new ccs.Tween(this);this._displayManager=new ccs.DisplayManager(this);this._worldInfo=new ccs.BaseData;this._boneData=new ccs.BaseData;return!0},setBoneData:function(a){cc.assert(a, "_boneData must not be null");this._boneData!==a&&(this._boneData=a);this.setName(this._boneData.name);this._localZOrder=this._boneData.zOrder;this._displayManager.initDisplayList(a)},getBoneData:function(){return this._boneData},setArmature:function(a){(this._armature=a)?(this._tween.setAnimation(this._armature.getAnimation()),this._dataVersion=this._armature.getArmatureData().dataVersion,this._armatureParentBone=this._armature.getParentBone()):this._armatureParentBone=null},getArmature:function(){return this._armature}, update:function(a){this._parentBone&&(this._boneTransformDirty=this._boneTransformDirty||this._parentBone.isTransformDirty());this._armatureParentBone&&!this._boneTransformDirty&&(this._boneTransformDirty=this._armatureParentBone.isTransformDirty());if(this._boneTransformDirty){var b=this._tweenData;this._dataVersion>=ccs.CONST_VERSION_COMBINED&&(ccs.TransformHelp.nodeConcat(b,this._boneData),b.scaleX-=1,b.scaleY-=1);var c=this._worldInfo;c.copy(b);c.x=b.x+this._position.x;c.y=b.y+this._position.y; c.scaleX=b.scaleX*this._scaleX;c.scaleY=b.scaleY*this._scaleY;c.skewX=b.skewX+this._skewX+cc.degreesToRadians(this._rotationX);c.skewY=b.skewY+this._skewY-cc.degreesToRadians(this._rotationY);this._parentBone?this._applyParentTransform(this._parentBone):this._armatureParentBone&&this._applyParentTransform(this._armatureParentBone);ccs.TransformHelp.nodeToMatrix(c,this._worldTransform);this._armatureParentBone&&cc.affineTransformConcatIn(this._worldTransform,this._armature.getNodeToParentTransform())}ccs.displayFactory.updateDisplay(this, a,this._boneTransformDirty||this._armature.getArmatureTransformDirty());for(b=0;b<this._children.length;b++)this._children[b].update(a);this._boneTransformDirty=!1},_applyParentTransform:function(a){var b=this._worldInfo,c=a._worldTransform;a=a._worldInfo;var d=b.x,e=b.y;b.x=d*c.a+e*c.c+a.x;b.y=d*c.b+e*c.d+a.y;b.scaleX*=a.scaleX;b.scaleY*=a.scaleY;b.skewX+=a.skewX;b.skewY+=a.skewY},setBlendFunc:function(a,b){var c=this._blendFunc,d,e;void 0===b?(d=a.src,e=a.dst):(d=a,e=b);if(c.src!==d||c.dst!==e)c.src= d,c.dst=e,this.blendDirty=!0},updateColor:function(){var a=this._displayManager.getDisplayRenderNode();if(null!==a){var b=this._renderCmd;a.setColor(cc.color(b._displayedColor.r*this._tweenData.r/255,b._displayedColor.g*this._tweenData.g/255,b._displayedColor.b*this._tweenData.b/255));a.setOpacity(b._displayedOpacity*this._tweenData.a/255)}},updateZOrder:function(){this._armature.getArmatureData().dataVersion>=ccs.CONST_VERSION_COMBINED?this.setLocalZOrder(this._tweenData.zOrder+this._boneData.zOrder): this.setLocalZOrder(this._tweenData.zOrder)},addChildBone:function(a){cc.assert(a,"Argument must be non-nil");cc.assert(!a.parentBone,"child already added. It can't be added again");0>this._children.indexOf(a)&&(this._children.push(a),a.setParentBone(this))},removeChildBone:function(a,b){if(0<this._children.length&&-1!==this._children.getIndex(a)){if(b)for(var c=a._children,d=0;d<c.length;d++)a.removeChildBone(c[d],b);a.setParentBone(null);a.getDisplayManager().setCurrentDecorativeDisplay(null);cc.arrayRemoveObject(this._children, a)}},removeFromParent:function(a){this._parentBone&&this._parentBone.removeChildBone(this,a)},setParentBone:function(a){this._parentBone=a},getParentBone:function(){return this._parentBone},setChildArmature:function(a){this._childArmature!==a&&(null==a&&this._childArmature&&this._childArmature.setParentBone(null),this._childArmature=a)},getChildArmature:function(){return this._childArmature},getTween:function(){return this._tween},setLocalZOrder:function(a){this._localZOrder!==a&&cc.Node.prototype.setLocalZOrder.call(this, a)},getNodeToArmatureTransform:function(){return this._worldTransform},getNodeToWorldTransform:function(){return cc.affineTransformConcat(this._worldTransform,this._armature.getNodeToWorldTransform())},getDisplayRenderNode:function(){return this._displayManager.getDisplayRenderNode()},getDisplayRenderNodeType:function(){return this._displayManager.getDisplayRenderNodeType()},addDisplay:function(a,b){return this._displayManager.addDisplay(a,b||0)},removeDisplay:function(a){this._displayManager.removeDisplay(a)}, changeDisplayByIndex:function(a,b){cc.log("changeDisplayByIndex is deprecated. Use changeDisplayWithIndex instead.");this.changeDisplayWithIndex(a,b)},changeDisplayByName:function(a,b){cc.log("changeDisplayByName is deprecated. Use changeDisplayWithName instead.");this.changeDisplayWithName(a,b)},changeDisplayWithIndex:function(a,b){this._displayManager.changeDisplayWithIndex(a,b)},changeDisplayWithName:function(a,b){this._displayManager.changeDisplayWithName(a,b)},getColliderDetector:function(){var a= this._displayManager.getCurrentDecorativeDisplay();return a&&(a=a.getColliderDetector())?a:null},setColliderFilter:function(a){for(var b=this._displayManager.getDecorativeDisplayList(),c=0;c<b.length;c++){var d=b[c].getColliderDetector();d&&d.setColliderFilter(a)}},getColliderFilter:function(){var a=this.displayManager.getCurrentDecorativeDisplay();return a&&(a=a.getColliderDetector())?a.getColliderFilter():null},setTransformDirty:function(a){this._boneTransformDirty=a},isTransformDirty:function(){return this._boneTransformDirty}, getDisplayManager:function(){return this._displayManager},setIgnoreMovementBoneData:function(a){this._ignoreMovementBoneData=a},isIgnoreMovementBoneData:function(){return this._ignoreMovementBoneData},getBlendFunc:function(){return new cc.BlendFunc(this._blendFunc.src,this._blendFunc.dst)},setBlendDirty:function(a){this._blendDirty=a},isBlendDirty:function(){return this._blendDirty},getTweenData:function(){return this._tweenData},getWorldInfo:function(){return this._worldInfo},getChildrenBone:function(){return this._children}, nodeToArmatureTransform:function(){return this.getNodeToArmatureTransform()},nodeToWorldTransform:function(){return this.getNodeToWorldTransform()},getColliderBodyList:function(){var a=this.getColliderDetector();return a?a.getColliderBodyList():null},getIgnoreMovementBoneData:function(){return this.isIgnoreMovementBoneData()},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new ccs.Bone.CanvasRenderCmd(this):new ccs.Bone.WebGLRenderCmd(this)}});_p=ccs.Bone.prototype; cc.defineGetterSetter(_p,"boneData",_p.getBoneData,_p.setBoneData);cc.defineGetterSetter(_p,"armature",_p.getArmature,_p.setArmature);cc.defineGetterSetter(_p,"childArmature",_p.getChildArmature,_p.setChildArmature);cc.defineGetterSetter(_p,"childrenBone",_p.getChildrenBone);cc.defineGetterSetter(_p,"tween",_p.getTween);cc.defineGetterSetter(_p,"tweenData",_p.getTweenData);cc.defineGetterSetter(_p,"colliderFilter",_p.getColliderFilter,_p.setColliderFilter);_p=null;ccs.Bone.create=function(a){return new ccs.Bone(a)}; ccs.Bone.RenderCmd={_updateColor:function(){var a=this._node,b=a._displayManager.getDisplayRenderNode();if(null!==b){var c=b._renderCmd;b.setColor(this._displayedColor);b.setOpacity(this._displayedOpacity);c._syncDisplayColor(a._tweenData);c._syncDisplayOpacity(a._tweenData.a);c._updateColor()}},transform:function(a,b){this._transform||(this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0},this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0});var c=this._node,d=this._transform,e=this._worldTransform,f=a?a._worldTransform: null;f&&(this.originTransform(),cc.affineTransformConcatIn(d,c._worldTransform));f?(e.a=d.a*f.a+d.b*f.c,e.b=d.a*f.b+d.b*f.d,e.c=d.c*f.a+d.d*f.c,e.d=d.c*f.b+d.d*f.d,e.tx=d.tx*f.a+d.ty*f.c+f.tx,e.ty=d.tx*f.b+d.ty*f.d+f.ty):(e.a=d.a,e.b=d.b,e.c=d.c,e.d=d.d,e.tx=d.tx,e.ty=d.ty)}};(function(){ccs.Bone.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1};var a=ccs.Bone.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);cc.inject(ccs.Bone.RenderCmd,a);a.constructor=ccs.Bone.CanvasRenderCmd})(); (function(){if(cc.Node.WebGLRenderCmd){ccs.Bone.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1};var a=ccs.Bone.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);cc.inject(ccs.Bone.RenderCmd,a);a.constructor=ccs.Bone.WebGLRenderCmd}})();ccs.FRAME_TYPE_MOVE=0;ccs.FRAME_TYPE_SCALE=1;ccs.FRAME_TYPE_ROTATE=2;ccs.FRAME_TYPE_TINT=3;ccs.FRAME_TYPE_FADE=4;ccs.FRAME_TYPE_MAX=5; ccs.FrameEaseType={CUSTOM:-1,LINEAR:0,SINE_EASEIN:1,SINE_EASEOUT:2,SINE_EASEINOUT:3,QUAD_EASEIN:4,QUAD_EASEOUT:5,QUAD_EASEINOUT:6,CUBIC_EASEIN:7,CUBIC_EASEOUT:8,CUBIC_EASEINOUT:9,QUART_EASEIN:10,QUART_EASEOUT:11,QUART_EASEINOUT:12,QUINT_EASEIN:13,QUINT_EASEOUT:14,QUINT_EASEINOUT:15,EXPO_EASEIN:16,EXPO_EASEOUT:17,EXPO_EASEINOUT:18,CIRC_EASEIN:19,CIRC_EASEOUT:20,CIRC_EASEINOUT:21,ELASTIC_EASEIN:22,ELASTIC_EASEOUT:23,ELASTIC_EASEINOUT:24,BACK_EASEIN:25,BACK_EASEOUT:26,BACK_EASEINOUT:27,BOUNCE_EASEIN:28, BOUNCE_EASEOUT:29,BOUNCE_EASEINOUT:30,TWEEN_EASING_MAX:1E3}; ccs.ActionFrame=ccs.Class.extend({frameType:0,easingType:0,frameIndex:0,_Parameter:null,time:0,ctor:function(){this.frameType=0;this.easingType=ccs.FrameEaseType.LINEAR;this.time=this.frameIndex=0},getAction:function(a,b){cc.log("Need a definition of \x3cgetAction\x3e for ActionFrame");return null},_getEasingAction:function(a){if(null===a)return console.error("Action cannot be null!"),null;var b;switch(this.easingType){case ccs.FrameEaseType.LINEAR:b=a;break;case ccs.FrameEaseType.SINE_EASEIN:b=a.easing(cc.easeSineIn()); break;case ccs.FrameEaseType.SINE_EASEOUT:b=a.easing(cc.easeSineOut());break;case ccs.FrameEaseType.SINE_EASEINOUT:b=a.easing(cc.easeSineInOut());break;case ccs.FrameEaseType.QUAD_EASEIN:b=a.easing(cc.easeQuadraticActionIn());break;case ccs.FrameEaseType.QUAD_EASEOUT:b=a.easing(cc.easeQuadraticActionOut());break;case ccs.FrameEaseType.QUAD_EASEINOUT:b=a.easing(cc.easeQuadraticActionInOut());break;case ccs.FrameEaseType.CUBIC_EASEIN:b=a.easing(cc.easeCubicActionIn());break;case ccs.FrameEaseType.CUBIC_EASEOUT:b= a.easing(cc.easeCubicActionOut());break;case ccs.FrameEaseType.CUBIC_EASEINOUT:b=a.easing(cc.easeCubicActionInOut());break;case ccs.FrameEaseType.QUART_EASEIN:b=a.easing(cc.easeQuarticActionIn());break;case ccs.FrameEaseType.QUART_EASEOUT:b=a.easing(cc.easeQuarticActionOut());break;case ccs.FrameEaseType.QUART_EASEINOUT:b=a.easing(cc.easeQuarticActionInOut());break;case ccs.FrameEaseType.QUINT_EASEIN:b=a.easing(cc.easeQuinticActionIn());break;case ccs.FrameEaseType.QUINT_EASEOUT:b=a.easing(cc.easeQuinticActionOut()); break;case ccs.FrameEaseType.QUINT_EASEINOUT:b=a.easing(cc.easeQuinticActionInOut());break;case ccs.FrameEaseType.EXPO_EASEIN:b=a.easing(cc.easeExponentialIn());break;case ccs.FrameEaseType.EXPO_EASEOUT:b=a.easing(cc.easeExponentialOut());break;case ccs.FrameEaseType.EXPO_EASEINOUT:b=a.easing(cc.easeExponentialInOut());break;case ccs.FrameEaseType.CIRC_EASEIN:b=a.easing(cc.easeCircleActionIn());break;case ccs.FrameEaseType.CIRC_EASEOUT:b=a.easing(cc.easeCircleActionOut());break;case ccs.FrameEaseType.CIRC_EASEINOUT:b= a.easing(cc.easeCircleActionInOut());break;case ccs.FrameEaseType.ELASTIC_EASEIN:b=a.easing(cc.easeElasticIn());break;case ccs.FrameEaseType.ELASTIC_EASEOUT:b=a.easing(cc.easeElasticOut());break;case ccs.FrameEaseType.ELASTIC_EASEINOUT:b=a.easing(cc.easeElasticInOut());break;case ccs.FrameEaseType.BACK_EASEIN:b=a.easing(cc.easeBackIn());break;case ccs.FrameEaseType.BACK_EASEOUT:b=a.easing(cc.easeBackOut());break;case ccs.FrameEaseType.BACK_EASEINOUT:b=a.easing(cc.easeBackInOut());break;case ccs.FrameEaseType.BOUNCE_EASEIN:b= a.easing(cc.easeBounceIn());break;case ccs.FrameEaseType.BOUNCE_EASEOUT:b=a.easing(cc.easeBounceOut());break;case ccs.FrameEaseType.BOUNCE_EASEINOUT:b=a.easing(cc.easeBounceInOut())}return b},setEasingParameter:function(a){this._Parameter=[];for(var b=0;b<a.length;b++)this._Parameter.push(a[b])},setEasingType:function(a){this.easingType=a}}); ccs.ActionMoveFrame=ccs.ActionFrame.extend({_position:null,ctor:function(){ccs.ActionFrame.prototype.ctor.call(this);this._position=cc.p(0,0);this.frameType=ccs.FRAME_TYPE_MOVE},setPosition:function(a,b){void 0===b?(this._position.x=a.x,this._position.y=a.y):(this._position.x=a,this._position.y=b)},getPosition:function(){return this._position},getAction:function(a){return this._getEasingAction(cc.moveTo(a,this._position))}}); ccs.ActionScaleFrame=ccs.ActionFrame.extend({_scaleX:1,_scaleY:1,ctor:function(){ccs.ActionFrame.prototype.ctor.call(this);this._scaleY=this._scaleX=1;this.frameType=ccs.FRAME_TYPE_SCALE},setScaleX:function(a){this._scaleX=a},getScaleX:function(){return this._scaleX},setScaleY:function(a){this._scaleY=a},getScaleY:function(){return this._scaleY},getAction:function(a){return this._getEasingAction(cc.scaleTo(a,this._scaleX,this._scaleY))}}); ccs.ActionRotationFrame=ccs.ActionFrame.extend({_rotation:0,ctor:function(){ccs.ActionFrame.prototype.ctor.call(this);this._rotation=0;this.frameType=ccs.FRAME_TYPE_ROTATE},setRotation:function(a){this._rotation=a},getRotation:function(){return this._rotation},getAction:function(a,b){return void 0===b?this._getEasingAction(cc.rotateTo(a,this._rotation)):b instanceof cc.ActionRotationFrame?this._getEasingAction(cc.rotateBy(a,this._rotation-b._rotation)):this.getAction(a)}}); ccs.ActionFadeFrame=ccs.ActionFrame.extend({_opacity:255,ctor:function(){ccs.ActionFrame.prototype.ctor.call(this);this._opacity=255;this.frameType=ccs.FRAME_TYPE_FADE},setOpacity:function(a){this._opacity=a},getOpacity:function(){return this._opacity},getAction:function(a){return this._getEasingAction(cc.fadeTo(a,this._opacity))}}); ccs.ActionTintFrame=ccs.ActionFrame.extend({_color:null,ctor:function(){ccs.ActionFrame.prototype.ctor.call(this);this._color=cc.color(255,255,255,255);this.frameType=ccs.FRAME_TYPE_TINT},setColor:function(a){var b=this._color;b.r=a.r;b.g=a.g;b.b=a.b},getColor:function(){var a=this._color;return cc.color(a.r,a.g,a.b,a.a)},getAction:function(a){return this._getEasingAction(cc.tintTo(a,this._color.r,this._color.g,this._color.b))}});ccs.actionManager={_actionDic:{},initWithDictionary:function(a,b,c){var d=a.lastIndexOf("/");a=a.substr(d+1,a.length);b=b.actionlist;for(var d=[],e=0;e<b.length;e++){var f=new ccs.ActionObject;f.initWithDictionary(b[e],c);d.push(f)}this._actionDic[a]=d},getActionByName:function(a,b){var c=a.lastIndexOf("/"),c=a.substr(c+1,a.length),c=this._actionDic[c];if(!c)return null;for(var d=0;d<c.length;d++){var e=c[d];if(b===e.getName())return e}return null},playActionByName:function(a,b,c){(a=this.getActionByName(a, b))&&a.play(c)},stopActionByName:function(a,b){var c=this.getActionByName(a,b);c&&c.stop()},releaseActions:function(){this._actionDic={}},clear:function(){this._actionDic={}}};ccs.ActionNode=ccs.Class.extend({_currentFrameIndex:0,_destFrameIndex:0,_unitTime:0,_actionTag:0,_object:null,_actionSpawn:null,_action:null,_frameArray:null,_frameArrayNum:0,ctor:function(){this._destFrameIndex=this._currentFrameIndex=0;this._unitTime=0.1;this._actionTag=0;this._action=this._actionSpawn=this._object=null;this._frameArray=[];this._frameArrayNum=ccs.FRAME_TYPE_MAX;for(var a=0;a<this._frameArrayNum;a++)this._frameArray.push([])},initWithDictionary:function(a,b){this.setActionTag(a.ActionTag); for(var c=a.actionframelist,d=ccui.helper.seekActionWidgetByActionTag(b,a.ActionTag),e=d instanceof ccui.Widget&&!(d instanceof ccui.Layout),f=0;f<c.length;f++){var g=c[f],h=g.frameid,k=g.tweenType;null==k&&(k=0);for(var m=g.tweenParameter,n=[],p=0;p<m;p++)n.push(g.tweenParameter[p]);if(void 0!==g.positionx){var p=g.positionx,r=g.positiony;e&&d.parent&&(m=d.parent.getAnchorPointInPoints(),p+=m.x,r+=m.y);m=new ccs.ActionMoveFrame;m.frameIndex=h;m.setEasingType(k);m.setEasingParameter(n);m.setPosition(p, r);p=this._frameArray[ccs.FRAME_TYPE_MOVE];p.push(m)}void 0!==g.scalex&&(p=g.scalex,r=g.scaley,m=new ccs.ActionScaleFrame,m.frameIndex=h,m.setEasingType(k),m.setEasingParameter(n),m.setScaleX(p),m.setScaleY(r),p=this._frameArray[ccs.FRAME_TYPE_SCALE],p.push(m));void 0!==g.rotation&&(p=g.rotation,m=new ccs.ActionRotationFrame,m.frameIndex=h,m.setEasingType(k),m.setEasingParameter(n),m.setRotation(p),p=this._frameArray[ccs.FRAME_TYPE_ROTATE],p.push(m));void 0!==g.opacity&&(p=g.opacity,m=new ccs.ActionFadeFrame, m.frameIndex=h,m.setEasingType(k),m.setEasingParameter(n),m.setOpacity(p),p=this._frameArray[ccs.FRAME_TYPE_FADE],p.push(m));void 0!==g.colorr&&(p=g.colorr,r=g.colorg,g=g.colorb,m=new ccs.ActionTintFrame,m.frameIndex=h,m.setEasingType(k),m.setEasingParameter(n),m.setColor(cc.color(p,r,g)),p=this._frameArray[ccs.FRAME_TYPE_TINT],p.push(m))}this._initActionNodeFromRoot(b)},_initActionNodeFromRoot:function(a){a instanceof ccui.Widget&&(a=ccui.helper.seekActionWidgetByActionTag(a,this.getActionTag()))&& this.setObject(a)},setUnitTime:function(a){this._unitTime=a;this._refreshActionProperty()},getUnitTime:function(){return this._unitTime},setActionTag:function(a){this._actionTag=a},getActionTag:function(){return this._actionTag},setObject:function(a){this._object=a},getObject:function(){return this._object},getActionNode:function(){return this._object instanceof cc.Node?this._object:null},insertFrame:function(a,b){null!=b&&this._frameArray[b.frameType].splice(a,0,b)},addFrame:function(a){a&&this._frameArray[a.frameType].push(a)}, deleteFrame:function(a){void 0!==a&&cc.arrayRemoveObject(this._frameArray[a.frameType],a)},clearAllFrame:function(){for(var a=0;a<this._frameArrayNum;a++)this._frameArray[a].length=0},_refreshActionProperty:function(){if(!this._object)return null;for(var a=[],b=0;b<this._frameArrayNum;b++){var c=this._frameArray[b];if(!(0>=c.length)){for(var d=[],e=0;e<c.length;e++){var f=c[e],g=null;0!==e?(g=(f.frameIndex-c[e-1].frameIndex)*this.getUnitTime(),g=f.getAction(g)):g=f.getAction(0);g&&d.push(g)}d&&(c= cc.sequence(d),null!==c&&a.push(c))}}this._action=null;return this._actionSpawn=cc.spawn(a)},playAction:function(a){this._object&&this._actionSpawn&&(this._action=a?cc.sequence(this._actionSpawn,a):cc.sequence(this._actionSpawn),this._runAction())},_runAction:function(){var a=this.getActionNode();null!==a&&null!==this._action&&a.runAction(this._action)},stopAction:function(){var a=this.getActionNode();null!==a&&null!==this._action&&(this._action.isDone()||a.stopAction(this._action))},getFirstFrameIndex:function(){for(var a= 99999,b=!1,c=this._frameArray,d=0,e=this._frameArrayNum;d<e;d++){var f=c[d];0>=f.length||(b=!0,f=f[0].frameIndex,a=a>f?f:a)}b||(a=0);return a},getLastFrameIndex:function(){for(var a=-1,b=!1,c=this._frameArray,d=0,e=this._frameArrayNum;d<e;d++){var f=c[d];0>=f.length||(b=!0,f=f[f.length-1].frameIndex,a=a<f?f:a)}b||(a=0);return a},updateActionToTimeLine:function(a){for(var b=!1,c=this.getUnitTime(),d=0;d<this._frameArrayNum;d++){var e=this._frameArray[d];if(e)for(var f=0;f<e.length;f++){var g=e[f]; if(g.frameIndex*c===a){this._easingToFrame(1,1,g);b=!0;break}else if(g.frameIndex*c>a){0===f?(this._easingToFrame(1,1,g),b=!1):(b=e[f-1],e=(g.frameIndex-b.frameIndex)*c,f=a-b.frameIndex*c,this._easingToFrame(e,1,b),this._easingToFrame(e,f/e,g),b=!0);break}}}return b},_easingToFrame:function(a,b,c){a=c.getAction(a);c=this.getActionNode();null!=a&&null!=c&&(a.startWithTarget(c),a.update(b))},isActionDoneOnce:function(){return this._action?this._action.isDone():!0}});ccs.ActionObject=ccs.Class.extend({_actionNodeList:null,_name:"",_loop:!1,_pause:!1,_playing:!1,_unitTime:0,_currentTime:0,_scheduler:null,_callback:null,_fTotalTime:0,ctor:function(){this._actionNodeList=[];this._name="";this._playing=this._pause=this._loop=!1;this._unitTime=0.1;this._fTotalTime=this._currentTime=0;this._scheduler=cc.director.getScheduler()},setName:function(a){this._name=a},getName:function(){return this._name},setLoop:function(a){this._loop=a},getLoop:function(){return this._loop}, setUnitTime:function(a){this._unitTime=a;a=this._actionNodeList.length;for(var b=0;b<a;b++)this._actionNodeList[b].setUnitTime(this._unitTime)},getUnitTime:function(){return this._unitTime},getCurrentTime:function(){return this._currentTime},setCurrentTime:function(a){this._currentTime=a},getTotalTime:function(){return this._fTotalTime},isPlaying:function(){return this._playing},initWithDictionary:function(a,b){this.setName(a.name);this.setLoop(a.loop);this.setUnitTime(a.unittime);for(var c=a.actionnodelist, d=0,e=0;e<c.length;e++){var f=new ccs.ActionNode;f.initWithDictionary(c[e],b);f.setUnitTime(this.getUnitTime());this._actionNodeList.push(f);f=f.getLastFrameIndex()-f.getFirstFrameIndex();f>d&&(d=f)}this._fTotalTime=d*this._unitTime},addActionNode:function(a){a&&(this._actionNodeList.push(a),a.setUnitTime(this._unitTime))},removeActionNode:function(a){null!=a&&cc.arrayRemoveObject(this._actionNodeList,a)},play:function(a){this.stop();this.updateToFrameByTime(0);for(var b=this._actionNodeList,c=b.length, d=0;d<c;d++)b[d].playAction(a);this._loop&&this._scheduler.schedule(this.simulationActionUpdate,this,0,cc.REPEAT_FOREVER,0,!1,this.__instanceId+"");void 0!==a&&(this._callback=a)},pause:function(){this._pause=!0;this._playing=!1},stop:function(){for(var a=this._actionNodeList,b=0;b<a.length;b++)a[b].stopAction();this._scheduler.unschedule(this.simulationActionUpdate,this);this._playing=this._pause=!1},updateToFrameByTime:function(a){this._currentTime=a;for(var b=0;b<this._actionNodeList.length;b++)this._actionNodeList[b].updateActionToTimeLine(a)}, simulationActionUpdate:function(a){a=!0;for(var b=this._actionNodeList,c=0,d=b.length;c<d;c++)if(!b[c].isActionDoneOnce()){a=!1;break}a&&(null!==this._callback&&this._callback.execute(),this._loop?this.play():(this._playing=!1,this._scheduler.unschedule(this.simulationActionUpdate,this)))}});ccs.ComAttribute=ccs.Component.extend({_jsonDict:null,_filePath:"",ctor:function(){cc.Component.prototype.ctor.call(this);this._jsonDict={};this._filePath="";this._name="CCComAttribute";ccs.ComAttribute.prototype.init.call(this)},init:function(){this._jsonDict={};return!0},setInt:function(a,b){a?this._jsonDict[a]=b:cc.log("Argument must be non-nil")},setDouble:function(a,b){a?this._jsonDict[a]=b:cc.log("Argument must be non-nil")},setFloat:function(a,b){a?this._jsonDict[a]=b:cc.log("Argument must be non-nil")}, setBool:function(a,b){a?this._jsonDict[a]=b:cc.log("Argument must be non-nil")},setString:function(a,b){a?this._jsonDict[a]=b:cc.log("Argument must be non-nil")},setObject:function(a,b){a?this._jsonDict[a]=b:cc.log("Argument must be non-nil")},getInt:function(a){return parseInt(this._jsonDict[a]||0)},getDouble:function(a){return parseFloat(this._jsonDict[a]||0)},getFloat:function(a){return parseFloat(this._jsonDict[a]||0)},getBool:function(a){return Boolean(this._jsonDict[a]||!1)},getString:function(a){return this._jsonDict[a]|| ""},getObject:function(a){return this._jsonDict[a]},parse:function(a){this._jsonDict=cc.loader.getRes(a)}});ccs.ComAttribute.create=function(){return new ccs.ComAttribute};ccs.ComAudio=ccs.Component.extend({_filePath:"",_loop:!1,ctor:function(){cc.Component.prototype.ctor.call(this);this._name="Audio";ccs.ComAudio.prototype.init.call(this)},init:function(){return!0},onExit:function(){this.stopBackgroundMusic(!0);this.stopAllEffects()},end:function(){cc.audioEngine.end()},preloadBackgroundMusic:function(a){cc.loader.load(a)},playBackgroundMusic:function(a,b){a?cc.audioEngine.playMusic(a,b):cc.audioEngine.playMusic(this._filePath,this._loop)},stopBackgroundMusic:function(a){cc.audioEngine.stopMusic(a)}, pauseBackgroundMusic:function(){cc.audioEngine.pauseMusic()},resumeBackgroundMusic:function(){cc.audioEngine.resumeMusic()},rewindBackgroundMusic:function(){cc.audioEngine.rewindMusic()},willPlayBackgroundMusic:function(){return cc.audioEngine.willPlayMusic()},isBackgroundMusicPlaying:function(){return cc.audioEngine.isMusicPlaying()},getBackgroundMusicVolume:function(){return cc.audioEngine.getMusicVolume()},setBackgroundMusicVolume:function(a){cc.audioEngine.setMusicVolume(a)},getEffectsVolume:function(){return cc.audioEngine.getEffectsVolume()}, setEffectsVolume:function(a){cc.audioEngine.setEffectsVolume(a)},playEffect:function(a,b){return a?cc.audioEngine.playEffect(a,b):cc.audioEngine.playEffect(this._filePath,this._loop)},pauseEffect:function(a){cc.audioEngine.pauseEffect(a)},pauseAllEffects:function(){cc.audioEngine.pauseAllEffects()},resumeEffect:function(a){cc.audioEngine.resumeEffect(a)},resumeAllEffects:function(){cc.audioEngine.resumeAllEffects()},stopEffect:function(a){cc.audioEngine.stopEffect(a)},stopAllEffects:function(){cc.audioEngine.stopAllEffects()}, preloadEffect:function(a){cc.loader.getRes(a);this.setFile(a);this.setLoop(!1)},unloadEffect:function(a){cc.audioEngine.unloadEffect(a)},setFile:function(a){this._filePath=a},setLoop:function(a){this._loop=a},getFile:function(){return this._filePath},isLoop:function(){return this._loop}});ccs.ComAudio.create=function(){return new ccs.ComAudio};ccs.ComController=ccs.Component.extend({ctor:function(){cc.Component.prototype.ctor.call(this);this._name="ComController";ccs.ComController.prototype.init.call(this)},onEnter:function(){null!==this._owner&&this._owner.scheduleUpdate()},isEnabled:function(){return this._enabled},setEnabled:function(a){this._enabled=a}});ccs.ComController.create=function(){return new ccs.ComController};ccs.ComRender=ccs.Component.extend({_render:null,ctor:function(a,b){cc.Component.prototype.ctor.call(this);this._render=a;this._name=b;this.isRenderer=!0;ccs.ComRender.prototype.init.call(this)},onEnter:function(){this._owner&&this._owner.addChild(this._render)},onExit:function(){this._owner&&(this._owner.removeChild(this._render,!0),this._render=null)},getNode:function(){return this._render},setNode:function(a){this._render=a}});ccs.ComRender.create=function(a,b){return new ccs.ComRender(a,b)};ccs.objectFactory={_typeMap:{},createObject:function(a){var b=null;(a=this._typeMap[a])&&(b=cc.isFunction(a._fun)?new a._fun:a._fun);return b},registerType:function(a){this._typeMap[a._className]=a},createGUI:function(a){var b=null;"Panel"===a?a="Layout":"TextArea"===a?a="Label":"TextButton"===a&&(a="Button");(a=this._typeMap[a])&&a._fun&&(b=a._fun);return b},removeAll:function(){this._typeMap={}}}; ccs.TInfo=ccs.Class.extend({_className:"",_fun:null,ctor:function(a,b){b?(this._className=a,this._fun=b):(this._className=a._className,this._fun=a._fun);ccs.objectFactory.registerType(this)}});ccs.sendEvent=function(a){a=ccs.triggerManager.get(a);if(null!=a)for(var b=0;b<a.length;b++){var c=a[b];null!=c&&c.detect()&&c.done()}};ccs.registerTriggerClass=function(a,b){new ccs.TInfo(a,b)};ccs.triggerManager={_eventTriggers:{},_triggerObjs:{},_movementDispatches:[],parse:function(a){for(var b=0;b<a.length;++b){var c=a[b],d=new ccs.TriggerObj;d.serialize(c);for(var c=d.getEvents(),e=0;e<c.length;e++)this.add(c[e],d);this._triggerObjs[d.getId()]=d}},get:function(a){return this._eventTriggers[a]},getTriggerObj:function(a){return this._triggerObjs[a]},add:function(a,b){var c=this._eventTriggers[a];c||(c=[]);-1===c.indexOf(b)&&(c.push(b),this._eventTriggers[a]=c)},removeAll:function(){for(var a in this._eventTriggers)for(var b= this._eventTriggers[a],c=0;c<b.length;c++)b[c].removeAll();this._eventTriggers={}},remove:function(a,b){if(b)return this._removeObj(a,b);var c=!1,d=this._eventTriggers[a];if(d){for(c=0;c<d.length;c++){var e=d[c];e&&e.removeAll()}delete this._eventTriggers[a];c=!0}return c},_removeObj:function(a,b){var c=!1;do{var d=this._eventTriggers[a];if(d){for(c=0;c<d.length;c++){var e=d[c];if(e&&e==b){e.removeAll();d.splice(c,1);break}}c=!0}}while(0);return c},removeTriggerObj:function(a){a=this.getTriggerObj(a); if(!a)return!1;for(var b=a.getEvents(),c=0;c<b.length;c++)this.remove(b[c],a);return!0},isEmpty:function(){return!this._eventTriggers||0>=this._eventTriggers.length},addArmatureMovementCallBack:function(a,b,c){if(null!=a&&null!=c&&null!=b){for(var d,e=!1,f=0;f<this._movementDispatches.length;f++)(d=this._movementDispatches[f])&&d[0]===a&&(d.addAnimationEventCallBack(b,c),e=!0);e||(d=new ccs.ArmatureMovementDispatcher,a.getAnimation().setMovementEventCallFunc(d.animationEvent,d),d.addAnimationEventCallBack(b, c),this._movementDispatches.push([a,d]))}},removeArmatureMovementCallBack:function(a,b,c){if(null!=a&&null!=b&&null!=c)for(var d,e=0;e<this._movementDispatches.length;e++)(d=this._movementDispatches[e])&&d[0]===a&&d.removeAnimationEventCallBack(c,b)},removeArmatureAllMovementCallBack:function(a){if(null!=a)for(var b,c=0;c<this._movementDispatches.length;c++)if((b=this._movementDispatches[c])&&b[0]===a){this._movementDispatches.splice(c,1);break}},removeAllArmatureMovementCallBack:function(){this._movementDispatches.length= 0},version:function(){return"1.2.0.0"}}; ccs.ArmatureMovementDispatcher=ccs.Class.extend({_mapEventAnimation:null,ctor:function(){this._mapEventAnimation=[]},animationEvent:function(a,b,c){for(var d,e,f=0;f<this._mapEventAnimation.length;f++)d=this._mapEventAnimation[f],e=d[0],(d=d[1])&&d.call(e,a,b,c)},addAnimationEventCallBack:function(a,b){this._mapEventAnimation.push([b,a])},removeAnimationEventCallBack:function(a,b){for(var c,d=0;d<this._mapEventAnimation.length;d++)c=this._mapEventAnimation[d],c[0]===b&&this._mapEventAnimation.splice(d, 1)}});ccs.BaseTriggerCondition=ccs.Class.extend({ctor:function(){},init:function(){return!0},detect:function(){return!0},serialize:function(a){},removeAll:function(){}});ccs.BaseTriggerAction=ccs.Class.extend({ctor:function(){},init:function(){return!0},done:function(){},serialize:function(a){},removeAll:function(){}}); ccs.TriggerObj=ccs.Class.extend({_cons:null,_acts:null,_id:0,_enable:!0,_vInt:null,ctor:function(){this._id=0;this._enable=!0;ccs.TriggerObj.prototype.init.call(this)},init:function(){this._cons=[];this._acts=[];this._vInt=[];return!0},detect:function(){if(!this._enable||0===this._cons.length)return!0;for(var a=!0,b=null,c=0;c<this._cons.length;c++)(b=this._cons[c])&&b.detect&&(a=a&&b.detect());return a},done:function(){if(this._enable&&0!==this._acts.length)for(var a,b=0;b<this._acts.length;b++)(a= this._acts[b])&&a.done&&a.done()},removeAll:function(){for(var a=null,b=0;b<this._cons.length;b++)(a=this._cons[b])&&a.removeAll();this._cons=[];for(b=0;b<this._acts.length;b++)(a=this._acts[b])&&a.removeAll();this._acts=[]},serialize:function(a){this._id=a.id||0;for(var b=a.conditions||[],c=0;c<b.length;c++){var d=b[c],e=d.classname,f=ccs.objectFactory.createObject(e);f?(f.serialize(d),f.init(),this._cons.push(f)):cc.log("class named classname("+e+") can not implement!")}b=a.actions||[];for(c=0;c< b.length;c++)d=b[c],e=d.classname,(f=ccs.objectFactory.createObject(e))?(f.serialize(d),f.init(),this._acts.push(f)):cc.log("class named classname("+e+") can not implement!");a=a.events||[];for(c=0;c<a.length;c++)d=a[c],d=d.id,0>d||this._vInt.push(d)},getId:function(){return this._id},setEnable:function(a){this._enable=a},getEvents:function(){return this._vInt}});ccs.TriggerObj.create=function(){return new ccs.TriggerObj};ccs.ActionTimelineData=ccs.Class.extend({_actionTag:0,ctor:function(a){this._init(a)},_init:function(a){this._actionTag=a;return!0},setActionTag:function(a){this._actionTag=a},getActionTag:function(){return this._actionTag}});ccs.AnimationInfo=function(a,b,c){this.name=a;this.startIndex=b;this.endIndex=c}; ccs.ComExtensionData=ccs.Component.extend({_customProperty:null,_timelineData:null,_name:"ComExtensionData",ctor:function(){this._customProperty="";this._timelineData=new ccs.ActionTimelineData(0);return!0},setActionTag:function(a){this._timelineData.setActionTag(a)},getActionTag:function(){return this._timelineData.getActionTag()},setCustomProperty:function(a){this._customProperty=a},getCustomProperty:function(){return this._customProperty}});ccs.ComExtensionData.create=function(){return new ccs.ComExtensionData}; ccs.ActionTimelineData.create=function(a){return new ccs.ActionTimelineData(a)}; ccs.ActionTimeline=cc.Action.extend({_timelineMap:null,_timelineList:null,_duration:0,_time:null,_timeSpeed:1,_frameInternal:1/60,_playing:!1,_currentFrame:0,_startFrame:0,_endFrame:0,_loop:null,_frameEventListener:null,_animationInfos:null,_lastFrameListener:null,ctor:function(){cc.Action.prototype.ctor.call(this);this._timelineMap={};this._timelineList=[];this._animationInfos={};this.init()},_gotoFrame:function(a){for(var b=this._timelineList.length,c=0;c<b;c++)this._timelineList[c]._gotoFrame(a)}, _stepToFrame:function(a){for(var b=this._timelineList.length,c=0;c<b;c++)this._timelineList[c]._stepToFrame(a)},_emitFrameEvent:function(a){this._frameEventListener&&this._frameEventListener(a)},init:function(){return!0},gotoFrameAndPlay:function(a,b,c,d){var e=0,f=arguments.length,g=[],h;for(e;e<f;e++)"boolean"===typeof arguments[e]?h=arguments[e]:g.push(arguments[e]);a=g[0];b=void 0!==g[1]?g[1]:this._duration;c=g[2]||a;this._startFrame=a;this._endFrame=b;this._currentFrame=c;this._loop=null!=h? h:!0;this._time=this._currentFrame*this._frameInternal;this.resume();this._gotoFrame(this._currentFrame)},gotoFrameAndPause:function(a){this._startFrame=this._currentFrame=a;this._time=this._currentFrame*this._frameInternal;this.pause();this._gotoFrame(this._currentFrame)},pause:function(){this._playing=!1},resume:function(){this._playing=!0},isPlaying:function(){return this._playing},setTimeSpeed:function(a){this._timeSpeed=a},getTimeSpeed:function(){return this._timeSpeed},setDuration:function(a){this._duration= a},getDuration:function(){return this._duration},getStartFrame:function(){return this._startFrame},getEndFrame:function(){return this._endFrame},setCurrentFrame:function(a){a>=this._startFrame&&a<=this._endFrame?(this._currentFrame=a,this._time=this._currentFrame*this._frameInternal):cc.log("frame index is not between start frame and end frame")},getCurrentFrame:function(){return this._currentFrame},addTimeline:function(a){var b=a.getActionTag();this._timelineMap[b]||(this._timelineMap[b]=[]);-1=== this._timelineMap[b].indexOf(a)&&(this._timelineList.push(a),this._timelineMap[b].push(a),a.setActionTimeline(this))},removeTimeline:function(a){var b=a.getActionTag();this._timelineMap[b]&&this._timelineMap[b].some(function(b){if(b===a)return!0})&&(cc.arrayRemoveObject(this._timelineMap[b],a),cc.arrayRemoveObject(this._timelineList,a),a.setActionTimeline(null))},getTimelines:function(){return this._timelineList},setFrameEventCallFunc:function(a){this._frameEventListener=a},clearFrameEventCallFunc:function(){this._frameEventListener= null},clone:function(){var a=new ccs.ActionTimeline;a.setDuration(this._duration);a.setTimeSpeed(this._timeSpeed);for(var b in this._timelineMap){var c=this._timelineMap[b],d;for(d in c){var e=c[d].clone();a.addTimeline(e)}}return a},reverse:function(){return null},step:function(a){this._playing&&0!==this._timelineMap.length&&0!==this._duration&&(this._time+=a*this._timeSpeed,a=this._time-this._endFrame*this._frameInternal,a<this._frameInternal?(this._currentFrame=Math.floor(this._time/this._frameInternal), this._stepToFrame(this._currentFrame),0<=a&&this._lastFrameListener&&this._lastFrameListener()):(this._playing=this._loop)?this.gotoFrameAndPlay(this._startFrame,this._endFrame,this._loop):(this._time=this._endFrame*this._frameInternal,this._currentFrame!=this._endFrame&&(this._currentFrame=this._endFrame,this._stepToFrame(this._currentFrame),this._lastFrameListener&&this._lastFrameListener())))},_foreachNodeDescendant:function(a,b){b(a);for(var c=a.getChildren(),d=0;d<c.length;d++)this._foreachNodeDescendant(c[d], b)},startWithTarget:function(a){cc.Action.prototype.startWithTarget.call(this,a);var b=this;this._foreachNodeDescendant(a,function(a){var d=a.getComponent("ComExtensionData");if(d&&(d=d.getActionTag(),b._timelineMap[d]))for(var d=b._timelineMap[d],e=0;e<d.length;e++)d[e].setNode(a)})},isDone:function(){return!1},play:function(a,b){var c=this._animationInfos[a];if(!c)return cc.log("Can't find animation info for %s",a);this.gotoFrameAndPlay(c.startIndex,c.endIndex,b)},addAnimationInfo:function(a){this._animationInfos[a.name]= a},removeAnimationInfo:function(a){delete this._animationInfos[a]},isAnimationInfoExists:function(a){return this._animationInfos[a]},getAnimationInfo:function(a){return this._animationInfos[a]},setLastFrameCallFunc:function(a){this._lastFrameListener=a},clearLastFrameCallFunc:function(){this._lastFrameListener=null}});ccs.ActionTimeline.create=function(){return new ccs.ActionTimeline};ccs.Frame=ccs.Class.extend({_frameIndex:null,_tween:null,_timeline:null,_node:null,_tweenType:null,_easingParam:null,_enterWhenPassed:null,ctor:function(){this._frameIndex=0;this._tween=!0;this._node=this._timeline=null;this._enterWhenPassed=!1;this._easingParam=[]},_emitEvent:function(){this._timeline&&this._timeline.getActionTimeline()._emitFrameEvent(this)},_cloneProperty:function(a){this._frameIndex=a.getFrameIndex();this._tween=a.isTween();this._tweenType=a.getTweenType();this.setEasingParams(a.getEasingParams())}, setFrameIndex:function(a){this._frameIndex=a},getFrameIndex:function(){return this._frameIndex},setTimeline:function(a){this._timeline=a},getTimeline:function(a){return this._timeline},setNode:function(a){this._node=a},getNode:function(){return this._node},setTween:function(a){this._tween=a},isTween:function(){return this._tween},onEnter:function(a){},apply:function(a){this._tween&&(this._tweenType!==ccs.FrameEaseType.TWEEN_EASING_MAX&&this._tweenType!==ccs.FrameEaseType.LINEAR&&(a=this.tweenPercent(a)), this._onApply(a))},_onApply:function(a){},clone:function(){},tweenPercent:function(a){var b=ccs.Frame.tweenToMap[this._tweenType];return b?b(a,this._easingParam):a},setEasingParams:function(a){if(a)for(var b=this._easingParam.length=0;b<a.length;b++)this._easingParam[b]=a[b]},getEasingParams:function(){return this._easingParam},setTweenType:function(a){this._tweenType=a},getTweenType:function(){return this._tweenType},isEnterWhenPassed:function(){return this._enterWhenPassed}}); ccs.Frame.tweenToMap={"-1":function(a,b){if(b){var c=1-a;return b[1]*c*c*c+3*b[3]*a*c*c+3*b[5]*a*a*c+b[7]*a*a*a}return a},1:cc._easeSineInObj.easing,2:cc._easeSineOutObj.easing,3:cc._easeSineInOutObj.easing,4:cc._easeQuadraticActionIn.easing,5:cc._easeQuadraticActionOut.easing,6:cc._easeQuadraticActionInOut.easing,7:cc._easeCubicActionIn.easing,8:cc._easeCubicActionOut.easing,9:cc._easeCubicActionInOut.easing,10:cc._easeCubicActionIn.easing,11:cc._easeCubicActionOut.easing,12:cc._easeCubicActionInOut.easing, 13:cc._easeQuinticActionIn.easing,14:cc._easeQuinticActionOut.easing,15:cc._easeQuinticActionInOut.easing,16:cc._easeExponentialInObj.easing,17:cc._easeExponentialOutObj.easing,18:cc._easeExponentialInOutObj.easing,19:cc._easeCircleActionIn.easing,20:cc._easeCircleActionOut.easing,21:cc._easeCircleActionInOut.easing,22:function(a,b){var c=0.3;null!=b&&(c=b[0]);return cc.easeElasticIn(c).easing(a)},23:function(a,b){var c=0.3;null!=b&&(c=b[0]);return cc.easeElasticOut(c).easing(a)},24:function(a,b){var c= 0.3;null!=b&&(c=b[0]);return cc.easeElasticInOut(c).easing(a)},25:cc._easeBackInObj.easing,26:cc._easeBackOutObj.easing,27:cc._easeBackInOutObj.easing,28:cc._easeBounceInObj.easing,29:cc._easeBounceOutObj.easing,30:cc._easeBounceInOutObj.easing}; ccs.VisibleFrame=ccs.Frame.extend({_visible:!0,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._visible=!0},onEnter:function(a){this._node&&this._node.setVisible(this._visible)},clone:function(){var a=new ccs.VisibleFrame;a.setVisible(this._visible);a._cloneProperty(this);return a},setVisible:function(a){this._visible=a},isVisible:function(){return this._visible}});ccs.VisibleFrame.create=function(){return new ccs.VisibleFrame}; ccs.TextureFrame=ccs.Frame.extend({_sprite:null,_textureName:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._textureName=""},setNode:function(a){ccs.Frame.prototype.setNode.call(this,a);this._sprite=a},onEnter:function(a){if(this._sprite){a=this._sprite.getBlendFunc();var b=cc.spriteFrameCache._spriteFrames[this._textureName];null!=b?this._sprite.setSpriteFrame(b):this._sprite.setTexture(this._textureName);this._sprite.getBlendFunc()!==a&&this._sprite.setBlendFunc(a)}},clone:function(){var a= new ccs.TextureFrame;a.setTextureName(this._textureName);a._cloneProperty(this);return a},setTextureName:function(a){this._textureName=a},getTextureName:function(){return this._textureName}});ccs.TextureFrame.create=function(){return new ccs.TextureFrame}; ccs.RotationFrame=ccs.Frame.extend({_rotation:null,_betwennRotation:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._rotation=0},onEnter:function(a){this._node&&(this._node.setRotation(this._rotation),this._tween&&(this._betwennRotation=a._rotation-this._rotation))},_onApply:function(a){0!==this._betwennRotation&&this._node.setRotation(this._rotation+a*this._betwennRotation)},clone:function(){var a=new ccs.RotationFrame;a.setRotation(this._rotation);a._cloneProperty(this);return a}, setRotation:function(a){this._rotation=a},getRotation:function(){return this._rotation}});ccs.RotationFrame.create=function(){return new ccs.RotationFrame}; ccs.SkewFrame=ccs.Frame.extend({_skewX:null,_skewY:null,_betweenSkewX:null,_betweenSkewY:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._skewY=this._skewX=0},onEnter:function(a){this._node&&(this._node.setSkewX(this._skewX),this._node.setSkewY(this._skewY),this._tween&&(this._betweenSkewX=a._skewX-this._skewX,this._betweenSkewY=a._skewY-this._skewY))},_onApply:function(a){if(0!==this._betweenSkewX||0!==this._betweenSkewY){var b=this._skewY+a*this._betweenSkewY;this._node.setSkewX(this._skewX+ a*this._betweenSkewX);this._node.setSkewY(b)}},clone:function(){var a=new ccs.SkewFrame;a.setSkewX(this._skewX);a.setSkewY(this._skewY);a._cloneProperty(this);return a},setSkewX:function(a){this._skewX=a},getSkewX:function(){return this._skewX},setSkewY:function(a){this._skewY=a},getSkewY:function(){return this._skewY}});ccs.SkewFrame.create=function(){return new ccs.SkewFrame}; ccs.RotationSkewFrame=ccs.SkewFrame.extend({onEnter:function(a){this._node&&(this._node.setRotationX(this._skewX),this._node.setRotationY(this._skewY),this._tween&&(this._betweenSkewX=a._skewX-this._skewX,this._betweenSkewY=a._skewY-this._skewY))},_onApply:function(a){if(this._node&&(0!==this._betweenSkewX||0!==this._betweenSkewY)){var b=this._skewY+a*this._betweenSkewY;this._node.setRotationX(this._skewX+a*this._betweenSkewX);this._node.setRotationY(b)}},clone:function(){var a=new ccs.RotationSkewFrame; a.setSkewX(this._skewX);a.setSkewY(this._skewY);a._cloneProperty(this);return a}});ccs.RotationSkewFrame.create=function(){return new ccs.RotationSkewFrame}; ccs.PositionFrame=ccs.Frame.extend({_position:null,_betweenX:null,_betweenY:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._position=cc.p(0,0)},onEnter:function(a){this._node&&(this._node.setPosition(this._position),this._tween&&(this._betweenX=a._position.x-this._position.x,this._betweenY=a._position.y-this._position.y))},_onApply:function(a){if(this._node&&(0!==this._betweenX||0!==this._betweenY)){var b=cc.p(0,0);b.x=this._position.x+this._betweenX*a;b.y=this._position.y+this._betweenY* a;this._node.setPosition(b)}},clone:function(){var a=new ccs.PositionFrame;a.setPosition(this._position);a._cloneProperty(this);return a},setPosition:function(a){this._position=a},getPosition:function(){return this._position},setX:function(a){this._position.x=a},getX:function(){return this._position.x},setY:function(a){this._position.y=a},getY:function(){return this._position.y}});ccs.PositionFrame.create=function(){return new ccs.PositionFrame}; ccs.ScaleFrame=ccs.Frame.extend({_scaleX:null,_scaleY:null,_betweenScaleX:null,_betweenScaleY:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._scaleY=this._scaleX=1},onEnter:function(a){this._node&&(this._node.setScaleX(this._scaleX),this._node.setScaleY(this._scaleY),this._tween&&(this._betweenScaleX=a._scaleX-this._scaleX,this._betweenScaleY=a._scaleY-this._scaleY))},_onApply:function(a){if(this._node&&(0!==this._betweenScaleX||0!==this._betweenScaleY)){var b=this._scaleY+this._betweenScaleY* a;this._node.setScaleX(this._scaleX+this._betweenScaleX*a);this._node.setScaleY(b)}},clone:function(){var a=new ccs.ScaleFrame;a.setScaleX(this._scaleX);a.setScaleY(this._scaleY);a._cloneProperty(this);return a},setScale:function(a){this._scaleY=this._scaleX=a},setScaleX:function(a){this._scaleX=a},getScaleX:function(){return this._scaleX},setScaleY:function(a){this._scaleY=a},getScaleY:function(){return this._scaleY}});ccs.ScaleFrame.create=function(){return new ccs.ScaleFrame}; ccs.AnchorPointFrame=ccs.Frame.extend({_anchorPoint:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._anchorPoint=cc.p(0,0)},onEnter:function(a){this._node&&this._node.setAnchorPoint(this._anchorPoint)},clone:function(){var a=new ccs.AnchorPointFrame;a.setAnchorPoint(this._anchorPoint);a._cloneProperty(this);return a},setAnchorPoint:function(a){this._anchorPoint=a},getAnchorPoint:function(){return this._anchorPoint}});ccs.AnchorPointFrame.create=function(){return new ccs.AnchorPointFrame}; ccs.InnerActionType={LoopAction:0,NoLoopAction:1,SingleFrame:2}; ccs.InnerActionFrame=ccs.Frame.extend({_innerActionType:null,_startFrameIndex:null,_endFrameIndex:0,_singleFrameIndex:0,_enterWithName:null,_animationName:"",ctor:function(){ccs.Frame.prototype.ctor.call(this);this._enterWithName=!1;this._innerActionType=ccs.InnerActionType.LoopAction;this._startFrameIndex=0},onEnter:function(a){if(this._node&&(a=this._node.getActionByTag(this._node.getTag())))if(ccs.InnerActionType.SingleFrame===this._innerActionType)a.gotoFrameAndPause(this._singleFrameIndex);else{var b= this._startFrameIndex,c=this._endFrameIndex;this._enterWithName&&("-- ALL --"===this._animationName?(b=0,c=a.getDuration()):a.isAnimationInfoExists(this._animationName)?(c=a.getAnimationInfo(this._animationName),b=c.startIndex,c=c.endIndex):cc.log("Animation %s not exists!",this._animationName));var d=this._timeline.getActionTimeline().getDuration()-this._frameIndex-c+b;0>d&&(c+=d);ccs.InnerActionType.NoLoopAction===this._innerActionType?a.gotoFrameAndPlay(b,c,!1):ccs.InnerActionType.LoopAction=== this._innerActionType&&a.gotoFrameAndPlay(b,c,!0)}},setAnimationName:function(a){this._animationName=a},setSingleFrameIndex:function(a){this._singleFrameIndex=a},getSingleFrameIndex:function(){return this._startFrameIndex},setEnterWithName:function(a){this._enterWithName=a},getEnterWithName:function(){return this._enterWithName},clone:function(){var a=new ccs.InnerActionFrame;a.setInnerActionType(this._innerActionType);a.setStartFrameIndex(this._startFrameIndex);a.setEnterWithName(this._enterWithName); a.setAnimationName(this._animationName);a.setSingleFrameIndex(this._singleFrameIndex);a._cloneProperty(this);return a},setInnerActionType:function(a){this._innerActionType=a},getInnerActionType:function(){return this._innerActionType},setStartFrameIndex:function(a){this._startFrameIndex=a},getStartFrameIndex:function(){return this._startFrameIndex}});ccs.InnerActionFrame.create=function(){return new ccs.InnerActionFrame}; ccs.ColorFrame=ccs.Frame.extend({_alpha:null,_color:null,_betweenAlpha:null,_betweenRed:null,_betweenGreen:null,_betweenBlue:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._color=cc.color(255,255,255)},onEnter:function(a){this._node&&(this._node.setColor(this._color),this._tween&&(a=a._color,this._betweenRed=a.r-this._color.r,this._betweenGreen=a.g-this._color.g,this._betweenBlue=a.b-this._color.b))},_onApply:function(a){if(this._node&&this._tween&&(0!==this._betweenAlpha||0!==this._betweenRed|| 0!==this._betweenGreen||0!==this._betweenBlue)){var b=cc.color(255,255,255);b.r=this._color.r+this._betweenRed*a;b.g=this._color.g+this._betweenGreen*a;b.b=this._color.b+this._betweenBlue*a;this._node.setColor(b);null!==this._alpha&&this._node.setOpacity(this._alpha+this._betweenAlpha*a)}},clone:function(){var a=new ccs.ColorFrame;a.setColor(this._color);a._cloneProperty(this);return a},setColor:function(a){this._color=a},getColor:function(){return this._color}});ccs.ColorFrame.create=function(){return new ccs.ColorFrame}; ccs.AlphaFrame=ccs.Frame.extend({_alpha:null,_betweenAlpha:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._alpha=255},onEnter:function(a){this._node&&(this._node.setOpacity(this._alpha),this._tween&&(this._betweenAlpha=a._alpha-this._alpha))},_onApply:function(a){this._node&&this._node.setOpacity(this._alpha+this._betweenAlpha*a)},setAlpha:function(a){this._alpha=a},getAlpha:function(){return this._alpha},clone:function(){var a=new ccs.AlphaFrame;a.setAlpha(this._alpha);a._cloneProperty(this); return a}});ccs.EventFrame=ccs.Frame.extend({_event:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._event="";this._enterWhenPassed=!0},onEnter:function(a){this._emitEvent()},clone:function(){var a=new ccs.EventFrame;a.setEvent(this._event);a._cloneProperty(this);return a},setEvent:function(a){this._event=a},getEvent:function(){return this._event}});ccs.EventFrame.create=function(){return new ccs.EventFrame}; ccs.ZOrderFrame=ccs.Frame.extend({_zorder:0,onEnter:function(a){this._node&&this._node.setLocalZOrder(this._zorder)},clone:function(){var a=new ccs.ZOrderFrame;a.setZOrder(this._zorder);a._cloneProperty(this);return a},setZOrder:function(a){this._zorder=a},getZOrder:function(){return this._zorder}});ccs.ZOrderFrame.create=function(){return new ccs.ZOrderFrame}; ccs.BlendFuncFrame=ccs.Frame.extend({ctor:function(){this._super();this._blendFunc=null},onEnter:function(a,b){this._node&&this._blendFunc&&this._node.setBlendFunc(this._blendFunc)},clone:function(){var a=new ccs.BlendFuncFrame;a.setBlendFunc(this._blendFunc);a._cloneProperty(this);return a},setBlendFunc:function(a){a&&a.src&&a.dst&&(this._blendFunc=a)},getBlendFunc:function(){return this._blendFunc}});ccs.BlendFuncFrame.create=function(){return new ccs.BlendFuncFrame};ccs.Timeline=ccs.Class.extend({_frames:null,_currentKeyFrame:null,_currentKeyFrameIndex:null,_fromIndex:null,_toIndex:null,_betweenDuration:null,_actionTag:null,_ActionTimeline:null,_node:null,ctor:function(){this._frames=[];this._currentKeyFrame=null;this._actionTag=this._betweenDuration=this._toIndex=this._fromIndex=this._currentKeyFrameIndex=0;this._node=this._ActionTimeline=null},_gotoFrame:function(a){0!==this._frames.length&&(this._binarySearchKeyFrame(a),this._apply(a))},_stepToFrame:function(a){0!== this._frames.length&&(this._updateCurrentKeyFrame(a),this._apply(a))},getFrames:function(){return this._frames},addFrame:function(a){this._frames.push(a);a.setTimeline(this)},insertFrame:function(a,b){this._frames.splice(b,0,a);a.setTimeline(this)},removeFrame:function(a){cc.arrayRemoveObject(this._frames,a);a.setTimeline(null)},setActionTag:function(a){this._actionTag=a},getActionTag:function(){return this._actionTag},setNode:function(a){for(var b=0;b<this._frames.length;b++)this._frames[b].setNode(a)}, getNode:function(){return this._node},setActionTimeline:function(a){this._ActionTimeline=a},getActionTimeline:function(){return this._ActionTimeline},clone:function(){var a=new ccs.Timeline;a._actionTag=this._actionTag;for(var b=0;b<this._frames.length;b++){var c=this._frames[b].clone();a.addFrame(c)}return a},_apply:function(a){this._currentKeyFrame&&this._currentKeyFrame.apply(0>=this._betweenDuration?0:(a-this._currentKeyFrameIndex)/this._betweenDuration)},_binarySearchKeyFrame:function(a){var b= null,c=null,d=this._frames.length,e=!1;do if(a<this._frames[0].getFrameIndex())this._currentKeyFrameIndex>=this._frames[0].getFrameIndex()&&(e=!0),this._toIndex=this._fromIndex=0,b=c=this._frames[0],this._currentKeyFrameIndex=0,this._betweenDuration=this._frames[0].getFrameIndex();else if(a>=this._frames[d-1].getFrameIndex())this._fromIndex=d-1,this._toIndex=0,b=c=this._frames[d-1],this._currentKeyFrameIndex=this._frames[d-1].getFrameIndex(),this._betweenDuration=0;else{for(var f=-1,b=0,c=d-1,g=0;b<= c;){g=Math.ceil((b+c)/2);if(a>=this._frames[g].getFrameIndex()&&a<this._frames[g+1].getFrameIndex()){f=g;break}this._frames[g].getFrameIndex()>a?c=g-1:b=g+1}this._fromIndex=f;this._toIndex=1<d?f+1|0:f|0;b=this._frames[f];c=this._frames[f+1];0===f&&this._currentKeyFrameIndex<b.getFrameIndex()&&(e=!0);this._currentKeyFrameIndex=b.getFrameIndex();this._betweenDuration=c.getFrameIndex()-b.getFrameIndex()}while(0);if(e||this._currentKeyFrame!=b)this._currentKeyFrame=b,this._currentKeyFrame.onEnter(c)}, _updateCurrentKeyFrame:function(a){if(a<this._currentKeyFrameIndex||a>=this._currentKeyFrameIndex+this._betweenDuration){var b=null,c=null;do{var d=this._frames.length;if(a<this._frames[0].getFrameIndex())b=c=this._frames[0],this._currentKeyFrameIndex=0,this._betweenDuration=this._frames[0].getFrameIndex();else{if(a>=this._frames[d-1].getFrameIndex()&&(a=this._frames[d-1].getFrameIndex(),this._currentKeyFrameIndex>=a))return;do{this._fromIndex=this._toIndex;b=this._frames[this._fromIndex];this._currentKeyFrameIndex= b.getFrameIndex();this._toIndex=this._fromIndex+1;this._toIndex>=d&&(this._toIndex=0);c=this._frames[this._toIndex];if(a===b.getFrameIndex())break;if(a>b.getFrameIndex()&&a<c.getFrameIndex())break;if(b.isEnterWhenPassed())b.onEnter(c)}while(1);this._betweenDuration=c.getFrameIndex()-b.getFrameIndex()}}while(0);this._currentKeyFrame=b;this._currentKeyFrame.onEnter(c)}}});ccs.Timeline.create=function(){return new ccs.Timeline};ccs.SkinNode=function(){var a=cc.Node.extend({});a.create=function(){};return a}();ccs.BoneNode=function(){var a=cc.Node,b=ccs.SkinNode,c=cc.BlendFunc,d={p:cc.p,size:cc.size,rect:cc.rect},e={log:cc.log,assert:cc.assert},f=a.extend({_customCommand:null,_blendFunc:null,_rackColor:null,_rackLength:null,_rackWidth:null,_childBones:null,_boneSkins:null,_rootSkeleton:null,_squareVertices:null,_squareColors:null,_noMVPVertices:null,ctor:function(b){a.prototype.ctor.call(this);null===this._squareVertices&&(this._squareVertices=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}]);this._rackColor= cc.color.WHITE;this._blendFunc=c.ALPHA_NON_PREMULTIPLIED;this._childBones=[];this._boneSkins=[];this._rackLength=void 0===b?50:b;this._rackWidth=20;this._updateVertices()},visit:function(a){this._visit&&this._visit(a&&a._renderCmd)},addSkin:function(b,c,d){var f=this._boneSkins;e.assert(null!=b,"Argument must be non-nil");if(d)for(d=0;d<f.length;d++)f[d].setVisible(!1);a.prototype.addChild.call(this,b);this._boneSkins.push(b);b.setVisible(c)},getChildBones:function(){return this._childBones},getSkins:function(){return this._boneSkins}, displaySkin:function(a,b){var c=this._boneSkins,d,e;if("string"===typeof a)for(e=0;e<c.length;e++)d=c[e],a==d.getName()?d.setVisible(!0):b&&d.setVisible(!1);else for(e=0;e<c.length;e++)d=c[e],d==a?d.setVisible(!0):b&&d.setVisible(!1)},getVisibleSkins:function(){for(var a=[],b=this._boneSkins,c,d=0;d<b.length;d++)c=b[d],c.isVisible()&&a.push(c);return a},getRootSkeletonNode:function(){return this._rootSkeleton},getAllSubBones:function(){for(var a=[],b=[],c=this._childBones,d=0;d<c.length;d++)b.push(c[d]); for(;0<b.length;)for(c=b.pop(),a.push(c),c=c.getChildBones(),d=0;d<c;d++)b.push(c[d]);return a},getAllSubSkins:function(){for(var a=this.getAllSubBones(),b=[],c=0;c<a.length;c++)for(var d=a[c].getSkins(),e=0;e<d.length;e++)b.push(d[c]);return b},addChild:function(b,c,d){a.prototype.addChild.call(this,b,c,d);this._addToChildrenListHelper(b)},removeChild:function(b,c){-1!==this._children.indexOf(b)&&(a.prototype.removeChild.call(this,b,c),this._removeFromChildrenListHelper(b))},setBlendFunc:function(a){var b= this._blendFunc;if(a&&b.src!==a.src&&b.dst!==a.dst){this._blendFunc=a;for(var b=this._boneSkins,c,d=0;d<b.length;d++)c=b[d],c.setBlendFunc(a)}},getBlendFunc:function(){return this._blendFunc},setDebugDrawLength:function(a){this._rackLength=a;this._updateVertices()},getDebugDrawLength:function(){return this._rackLength},setDebugDrawWidth:function(a){this._rackWidth=a;this._updateVertices()},getDebugDrawWidth:function(){return this._rackWidth},setDebugDrawEnabled:function(a){var b=this._renderCmd;b._debug!== a&&(b._debug=a,cc.renderer.childrenOrderDirty=!0,this._visible&&null!=this._rootSkeleton&&(this._rootSkeleton._subBonesDirty=!0,this._rootSkeleton._subBonesOrderDirty=!0))},isDebugDrawEnabled:function(){return this._renderCmd._debug},setDebugDrawColor:function(a){this._rackColor=a},getDebugDrawColor:function(){return this._rackColor},getVisibleSkinsRect:function(){var a,b,c,e=0;a=b=c=e;var f=!0,g=d.rect(0,0,0,0);this._renderCmd._debug&&null!=this._rootSkeleton&&this._rootSkeleton._renderCmd._debug&& (c=this._rackWidth,e=this._rackLength,f=!1);for(var h=this._boneSkins,t,v=0;v<h.length;v++){t=h[v];var w=t.getBoundingBox();!t.isVisible()||0===w.x&&0===w.y&&0===w.width&&0===w.height||(f?(a=cc.rectGetMinX(w),b=cc.rectGetMinY(w),c=cc.rectGetMaxX(w),e=cc.rectGetMaxY(w),f=!1):(a=Math.min(cc.rectGetMinX(w),a),b=Math.min(cc.rectGetMinY(w),b),c=Math.max(cc.rectGetMaxX(w),c),e=Math.max(cc.rectGetMaxY(w),e)),g.setRect(a,b,c-a,e-b))}return g},getBoundingBox:function(){var a=this.getVisibleSkinsRect();return cc.rectApplyAffineTransform(a, this.getNodeToParentAffineTransform())},batchBoneDrawToSkeleton:function(a){},setLocalZOrder:function(b){a.prototype.setLocalZOrder.call(this,b);null!=this._rootSkeleton&&(this._rootSkeleton._subBonesOrderDirty=!0)},setName:function(b){var c=this._rootSkeleton,d=this.getName();a.prototype.setName.call(this,b);if(null!=c){var d=c._subBonesMap[d],e=c._subBonesMap[b];d&&!e&&(delete c._subBonesMap[d],c._subBonesMap[b]=d)}},setContentSize:function(b){a.prototype.setContentSize.call(this,b);this._updateVertices()}, setAnchorPoint:function(b){a.prototype.setAnchorPoint.call(this,b);this._updateVertices()},setVisible:function(b){this._visible!=b&&(a.prototype.setVisible.call(this,b),null!=this._rootSkeleton&&(this._rootSkeleton._subBonesDirty=!0,this._rootSkeleton._subBonesOrderDirty=!0))},_addToChildrenListHelper:function(a){a instanceof f?this._addToBoneList(a):this._addToSkinList(a)},_removeFromChildrenListHelper:function(a){a instanceof f?this._removeFromBoneList(a):a instanceof b&&this._removeFromSkinList(skin)}, _removeFromBoneList:function(a){if(null!=this._rootSkeleton&&a instanceof ccs.SkeletonNode&&a._rootSkeleton===this._rootSkeleton){a._rootSkeleton=null;var b=a.getAllSubBones();b.push(a);for(var c,d=0;d<b.length;d++)c=b[d],c._rootSkeleton=null,delete this._rootSkeleton._subBonesMap[c.getName()],this._rootSkeleton._subBonesDirty=!0,this._rootSkeleton._subBonesOrderDirty=!0}else this._rootSkeleton._subBonesDirty=!0,this._rootSkeleton._subBonesOrderDirty=!0;cc.arrayRemoveObject(this._childBones,a)},_setRootSkeleton:function(a){this._rootSkeleton= a;a=this.getAllSubBones();for(var b=0;b<a.length;b++)this._addToBoneList(a[b])},_addToBoneList:function(a){-1===this._childBones.indexOf(a)&&this._childBones.push(a);if(null!=this._rootSkeleton&&!(a instanceof b||a._rootSkeleton)){var c=a.getAllSubBones();c.push(a);for(var d=0;d<c.length;d++){a=c[d];a._setRootSkeleton(this._rootSkeleton);var e=a.getName();this._rootSkeleton._subBonesMap[e]?cc.log("already has a bone named %s in skeleton %s",e,this._rootSkeleton.getName()):this._rootSkeleton._subBonesMap[a.getName()]= a;this._rootSkeleton._subBonesDirty=!0;this._rootSkeleton._subBonesOrderDirty=!0}}},_visitSkins:function(){var a=this._renderCmd;if(this._visible){var b=a.getParentRenderCmd();b&&(a._curLevel=b._curLevel+1);var c=this._boneSkins,d;a._syncStatus(b);var e=c.length;if(0<e){this.sortAllChildren();for(b=0;b<e;b++)if(d=c[b],0>d._localZOrder)d.visit(this);else break;for(;b<e;b++)c[b].visit(this)}a._dirtyFlag=0}},_addToSkinList:function(a){this._boneSkins.push(a);if(a.getBlendFunc){var b=a.getBlendFunc(); this._blendFunc.src!==b.src&&this._blendFunc.dst!==b.dst&&a.setBlendFunc(this._blendFunc)}},_removeFromSkinList:function(a){cc.arrayRemoveObject(this._boneSkins,a)},sortAllChildren:function(){this._sortArray(this._childBones);this._sortArray(this._boneSkins);a.prototype.sortAllChildren.call(this)},_sortArray:function(a){if(a){var b=a.length,c,d,e;for(c=1;c<b;c++){e=a[c];for(d=c-1;0<=d;){if(e._localZOrder<a[d]._localZOrder)a[d+1]=a[d];else if(e._localZOrder===a[d]._localZOrder&&e.arrivalOrder<a[d].arrivalOrder)a[d+ 1]=a[d];else break;d--}a[d+1]=e}}},_updateVertices:function(){var a=this._squareVertices,b=this._renderCmd._anchorPointInPoints;if(this._rackLength!=a[2].x-b.x||a[3].y!=this._rackWidth/2-b.y){a[1].x=a[1].y=a[3].y=0;a[0].x=a[2].x=0.1*this._rackLength;a[2].y=0.5*this._rackWidth;a[0].y=-a[2].y;a[3].x=this._rackLength;for(var c=0;c<a.length;c++)a[c].x+=b.x,a[c].y+=b.y;this._renderCmd.updateDebugPoint(a)}},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new g(this):new h(this)}}); f.create=function(a,b){return new ccui.BoneNode(a,b)};var g=function(){var b=function(a){this._rootCtor(a);this._debug=!1;this._color=cc.color.WHITE;this._drawNode=new cc.DrawNode},c=b.prototype=Object.create(a.CanvasRenderCmd.prototype);c.constructor=b;c.updateDebugPoint=function(a){this._drawNode.clear();this._drawNode.drawPoly(a,this._color,0,this._color)};c.transform=function(a,b){var c=this._node._rootSkeleton;this.originTransform(a,b);c&&c._renderCmd._debug&&this._drawNode._renderCmd.transform(this)}; return b}(),h=function(){var b=function(a){this._rootCtor(a);this._debug=!1;this._color=cc.color.WHITE;this._drawNode=new cc.DrawNode},c=b.prototype=Object.create(a.WebGLRenderCmd.prototype);c.constructor=b;c.updateDebugPoint=function(a){this._drawNode.clear();this._drawNode.drawPoly(a,this._color,0,this._color)};c.transform=function(a,b){var c=this._node._rootSkeleton;this.originTransform(a,b);c&&c._renderCmd._debug&&this._drawNode._renderCmd.transform(this)};return b}();return f}();ccs.SkeletonNode=function(){var a=ccs.BoneNode,b=a.extend({_subBonesMap:null,_squareVertices:null,_squareColors:null,_noMVPVertices:null,_skinGroupMap:null,_sortedAllBonesDirty:!1,_sortedAllBones:null,_batchedBoneVetices:null,_batchedBoneColors:null,_batchedVeticesCount:null,_batchBoneCommand:null,_subOrderedAllBones:null,ctor:function(){this._squareVertices=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}];this._rootSkeleton=this;a.prototype.ctor.call(this);this._subBonesMap= {};this._subOrderedAllBones=[];this._skinGroupMap={};this._rackLength=this._rackWidth=20;this._updateVertices()},getBoneNode:function(a){return(a=this._subBonesMap[a])?a:null},getAllSubBonesMap:function(){return this._subBonesMap},changeSkins:function(a){if("object"===typeof a){var b,e;for(e in a){b=a[e];var f=this.getBoneNode(e);null!==f&&f.displaySkin(b,!0)}}else(a=this._suitMap[a])&&this.changeSkins(a,!0)},addSkinGroup:function(a,b){this._skinGroupMap[a]=b},getBoundingBox:function(){var a,b,e, f=0;a=b=e=f;var g=this.getVisibleSkinsRect(),h=!0;if(0!==g.x||0!==g.y||0!==g.width||0!==g.height)a=cc.rectGetMinX(g),b=cc.rectGetMinY(g),e=cc.rectGetMaxX(g),f=cc.rectGetMaxY(g),h=!1;for(var k=this.getAllSubBones(),m,n=0;n<k.length;n++)if(m=k[n],m=cc.rectApplyAffineTransform(m.getVisibleSkinsRect(),m.getNodeToParentTransform(m.getRootSkeletonNode())),0!==m.x||0!==m.y||0!==m.width||0!==m.height)h?(a=cc.rectGetMinX(m),b=cc.rectGetMinY(m),e=cc.rectGetMaxX(m),f=cc.rectGetMaxY(m),h=!1):(a=Math.min(cc.rectGetMinX(m), a),b=Math.min(cc.rectGetMinY(m),b),e=Math.max(cc.rectGetMaxX(m),e),f=Math.max(cc.rectGetMaxY(m),f));g.x=a;g.y=b;g.width=e-a;g.height=f-b;return cc.rectApplyAffineTransform(g,this.getNodeToParentTransform())},_visit:function(a){if(this._visible){var b=this._renderCmd;a=a||b.getParentRenderCmd();b._syncStatus(a);var e;if(0!==this._children.length)for(a=0;a<this._children.length;a++)e=this._children[a],e.visit(this);this._checkSubBonesDirty();e=this._subOrderedAllBones;var f;for(a=0;a<e.length;a++)f= e[a],f._visitSkins();if(b._debug)for(a=0;a<e.length;a++)f=e[a]._renderCmd,cc.renderer.pushRenderCommand(f._drawNode._renderCmd);b._dirtyFlag=0}},_checkSubBonesDirty:function(){this._subBonesDirty&&(this._updateOrderedAllbones(),this._subBonesDirty=!1);this._subBonesOrderDirty&&(this._sortOrderedAllBones(),this._subBonesOrderDirty=!1)},_updateOrderedAllbones:function(){this._subOrderedAllBones.length=0;for(var a=[],b=this._childBones,e,f=0;f<b.length;f++)e=b[f],e.isVisible()&&a.push(e);for(;0<a.length;)for(f= a.pop(),b=f._renderCmd,b._syncStatus(b.getParentRenderCmd()),this._subOrderedAllBones.push(f),b=f.getChildBones(),f=0;f<b.length;f++)e=b[f],e.isVisible()&&a.push(e)},_sortOrderedAllBones:function(){this._sortArray(this._subOrderedAllBones)},_updateVertices:function(){var a=this._squareVertices,b=this._renderCmd._anchorPointInPoints;if(this._rackLength!=a[6].x-b.x||this._rackWidth!=a[3].y-b.y){var e=0.5*this._rackLength,f=0.5*this._rackWidth,g=0.25*e,h=0.25*f;a[5].y=a[2].y=a[1].y=a[6].y=a[0].x=a[4].x= a[7].x=a[3].x=0;a[5].x=-e;a[0].y=-f;a[6].x=e;a[3].y=f;a[1].x=g;a[7].y=h;a[2].x=-g;a[4].y=-h;for(e=0;e<a.length;e++)a[e].x+=b.x,a[e].y+=b.y}},_updateAllDrawBones:function(){this._subDrawBones={};for(var a in this._subBonesMap){var b=this._subBonesMap[a];b.isVisible()&&b.isDebugDrawEnabled()&&this._subDrawBones.push(b)}this._sortArray(this._sortedAllBones);this._subDrawBones=!1}});b.create=function(){return new b};return b}();ccs._load=function(){var a=function(a,d,h){var k=cc.loader.getRes(a);if(!k)return cc.log("%s does not exist",a);var m=a.match(c),m=(m&&m[1]?m[1]:null).toLocaleLowerCase();if("json"!==m&&"exportjson"!==m)return cc.log("%s load error, must be json file",a);var n;d?n=b[d]:k.widgetTree?n=b.ccui:k.nodeTree?n=b.timeline:k.Content&&k.Content.Content?n=b.timeline:k.gameobjects&&(n=b.scene);if(!n)return cc.log("Can't find the parser : %s",a),new cc.Node;d=k.version||k.Version;if(!d&&k.armature_data)return cc.warn("%s is armature. please use:", a),cc.warn(" ccs.armatureDataManager.addArmatureFileInfoAsync(%s);",a),cc.warn(" var armature \x3d new ccs.Armature('name');"),new cc.Node;n=e(n,d);return n?n.parse(a,k,h)||null:(cc.log("Can't find the parser : %s",a),new cc.Node)},b={ccui:{},timeline:{},action:{},scene:{}};a.registerParser=function(a,c,d){if(!a||!c||!d)return cc.log("register parser error");b[a]||(b[a]={});b[a][c]=d};a.getParser=function(a,c){return a&&c?b[a]?b[a][c]:void 0:a?b[a]:b};var c=/\.([^\.]+)$/,d=/([^\.](\.\*)?)*$/, e=function(a,b){return a[b]?a[b]:"*"===b?null:e(a,b.replace(d,"*"))};return a}(); ccs._parser=cc.Class.extend({ctor:function(){this.parsers={}},_dirnameReg:/\S*\//,_dirname:function(a){return(a=a.match(this._dirnameReg))&&a[0]?a[0]:""},getClass:function(a){return a.classname},getNodeJson:function(a){return a.widgetTree},parse:function(a,b,c){c=c||this._dirname(a);this.pretreatment(b,c);var d=this.parseNode(this.getNodeJson(b),c,a);d&&this.deferred(b,c,d,a);return d},pretreatment:function(a,b,c){},deferred:function(a,b,c,d){},parseNode:function(a,b){var c=this.parsers[this.getClass(a)], d=null;c?d=c.call(this,a,b):cc.log("Can't find the parser : %s",this.getClass(a));return d},registerParser:function(a,b){this.parsers[a]=b}});ccs.load=function(a,b){var c={node:null,action:null};c.node=ccs._load(a,null,b);c.action=ccs._load(a,"action",b);c.action&&-1===c.action.tag&&c.node&&(c.action.tag=c.node.tag);return c};ccs.load.validate={};ccs.load.preload=!0; ccs.loadWithVisibleSize=function(a,b){var c=ccs.load(a,b),d=cc.director.getVisibleSize();c.node&&d&&(c.node.setContentSize(d.width,d.height),ccui.helper.doLayout(c.node));return c};ccs.actionTimelineCache={createAction:function(a){return ccs._load(a,"action")}};ccs.csLoader={createNode:function(a){return ccs._load(a)}}; cc.loader.register(["json"],{load:function(a,b,c,d){cc.loader.loadJson(a,function(a,c){var g=cc.path;if(c&&c.Content&&c.Content.Content.UsedResources){for(var h=c.Content.Content.UsedResources,k=g.dirname(b),m=[],n,p=0;p<h.length;p++)if(ccs.load.preload||!/\.(png|jpg$)/.test(h[p]))n=g.join(k,h[p]),n=g._normalize(n),ccs.load.validate[n]||(ccs.load.validate[n]=!0,m.push(n));cc.loader.load(m,function(){d(a,c)})}else d(a,c)})}});(function(a,b){var c=new (b.extend({getNodeJson:function(a){return a},parseNode:function(a,b){var c=this.parsers[this.getClass(a)],d=null;c?d=c.call(this,a,b):cc.log("Can't find the parser : %s",this.getClass(a));return d},deferred:function(a,b,c,d){ccs.triggerManager.parse(a.Triggers||[]);ccs.sceneReader&&(ccs.sceneReader._node=c)},setPropertyFromJsonDict:function(a,b){var c=cc.isUndefined(b.x)?0:b.x,d=cc.isUndefined(b.y)?0:b.y;a.setPosition(c,d);c=Boolean(cc.isUndefined(b.visible)?1:b.visible); a.setVisible(c);c=cc.isUndefined(b.objecttag)?-1:b.objecttag;a.setTag(c);c=cc.isUndefined(b.zorder)?0:b.zorder;a.setLocalZOrder(c);c=cc.isUndefined(b.scalex)?1:b.scalex;d=cc.isUndefined(b.scaley)?1:b.scaley;a.setScaleX(c);a.setScaleY(d);c=cc.isUndefined(b.rotation)?0:b.rotation;a.setRotation(c);a.setName(b.name||"")}}));c.parseChild=function(a,b,c){for(var d=0;d<b.length;d++){var e,f=b[d];f&&(e=this.parseNode(f,c));e&&a.addChild(e)}};var d={CCSprite:function(a,b,c){var d=new cc.Sprite;f(b.fileData, c,function(a,b){if(0===b)d.setTexture(a);else if(1===b){var c=cc.spriteFrameCache.getSpriteFrame(a);d.setSpriteFrame(c)}});b=new ccs.ComRender(d,"CCSprite");a.addComponent(b);return b},CCTMXTiledMap:function(a,b,c){var d=null;f(b.fileData,c,function(a,b){0===b&&(d=new cc.TMXTiledMap(a))});b=new ccs.ComRender(d,"CCTMXTiledMap");a.addComponent(b);return b},CCParticleSystemQuad:function(a,b,c){var d=null;f(b.fileData,c,function(a,b){0===b?d=new cc.ParticleSystem(a):cc.log("unknown resourcetype on CCParticleSystemQuad!"); d.setPosition(0,0)});b=new ccs.ComRender(d,"CCParticleSystemQuad");a.addComponent(b);return b},CCArmature:function(a,b,c){var d=null;f(b.fileData,c,function(a,b){if(0===b){var c=cc.loader.getRes(a);c||cc.log("Please load the resource [%s] first!",a);c=c.armature_data[0].name;ccs.armatureDataManager.addArmatureFileInfo(a);d=new ccs.Armature(c)}});if(d)return c=new ccs.ComRender(d,"CCArmature"),a.addComponent(c),(a=b.selectedactionname)&&d.getAnimation()&&d.getAnimation().play(a),c},CCComAudio:function(a, b,c){var d=null;f(b.fileData,c,function(c,e){if(0===e){d=new ccs.ComAudio;d.preloadEffect(c);var f=b.name;f&&d.setName(f);a.addComponent(d)}})},CCComAttribute:function(a,b,c){var d=null;f(b.fileData,c,function(b,c){0===c?(d=new ccs.ComAttribute,""!==b&&d.parse(b),a.addComponent(d)):cc.log("unknown resourcetype on CCComAttribute!")});return d},CCBackgroundAudio:function(a,b,c){var d=null;f(b.fileData,c,function(c,e){if(0===e){d=new ccs.ComAudio;d.preloadBackgroundMusic(c);d.setFile(c);var f=Boolean(b.loop|| 0);d.setLoop(f);var k=b.name;k&&d.setName(k);a.addComponent(d);d.playBackgroundMusic(c,f)}})},GUIComponent:function(a,b,c){var d=null;f(b.fileData,c,function(a,b){d=ccs._load(a,"ccui")});b=new ccs.ComRender(d,"GUIComponent");a.addComponent(b);return b},CCScene:function(){}},e={},f=function(a,b,c){if(null!=a){var d=a.path,f=a.resourceType;a=a.plist;d&&(a&&(cc.loader.getRes(b+a)?(e[b+a]=!0,cc.spriteFrameCache.addSpriteFrames(b+a)):e[b+a]||cc.log("%s need to be preloaded",b+a)),0!==f?c(d,f):c(b+d,f))}}; c.parseComponents=function(a,b,c){a&&b&&b.forEach(function(b){var e=d[b.classname],f=null;e?f=e(a,b,c):cc.log("Can't find the component parser : %s",b.classname);b=b.name;f&&b&&f.setName(b)})};c.registerParser("CCNode",function(a,b){var c=new cc.Node;this.setPropertyFromJsonDict(c,a);this.parseChild.call(this,c,a.gameobjects,b);this.parseComponents(c,a.components,b);var d=a.CanvasSize;d&&c.setContentSize(cc.size(d._width,d._height));return c});a.registerParser("scene","*",c)})(ccs._load,ccs._parser);(function(a,b){var c=Array(50),d=new (b.extend({addSpriteFrame:function(a,b){if(a)for(var c=0;c<a.length;c++)cc.spriteFrameCache.addSpriteFrames(b+a[c])},pretreatment:function(a,b){this.addSpriteFrame(a.textures,b)},parseRecursive:function(a,b){var d=1,e=null,f,p,r,s,u;for(c[0]=a;0<d;)if(d--,p=c[d],c[d]=null,p)if(r=p.classname,f=this.parsers[r]){if(r=new f.object)if(e||(e=r),s=p.options,this.generalAttributes(r,s),f.handle(r,s,b),this.colorAttributes(r,s),f=p.parent,p.parent=null,f instanceof ccui.PageView? f.addPage(r):f instanceof ccui.ListView?f.pushBackCustomItem(r):f&&(f instanceof ccui.Layout||(r.getPositionType()===ccui.Widget.POSITION_PERCENT&&(s=r._positionPercent,u=f._anchorPoint,r._positionPercent.x=s.x+u.x,r._positionPercent.y=s.y+u.y),s=f._renderCmd._anchorPointInPoints,r._position.x+=s.x,r._position.y+=s.y,r.setNodeDirty()),f.addChild(r)),(p=p.children)&&0<p.length)for(f=p.length-1;0<=f;f--)c[d]=p[f],c[d].parent=r,d++}else cc.log("Can't find the parser : %s",r);return e},parse:function(a, b,c){c=c||this._dirname(a);this.pretreatment(b,c);var d=this.parseRecursive(b.widgetTree,c);d&&this.deferred(b,c,d,a);return d},deferred:function(a,b,c,d){c&&(ccs.actionManager.initWithDictionary(d,a.animation,c),c.setContentSize(a.designWidth,a.designHeight))}}));d.generalAttributes=function(a,b){a._ignoreSize=b.ignoreSize||!0;a._sizeType=b.sizeType||0;a._positionType=b.positionType||0;a._sizePercent.x=b.sizePercentX||0;a._sizePercent.y=b.sizePercentY||0;a._positionPercent.x=b.positionPercentX|| 0;a._positionPercent.y=b.positionPercentY||0;var c=0,d=0;b.adaptScreen?(d=cc.director.getWinSize(),c=d.width,d=d.height):(c=b.width||0,d=b.height||0);var e=b.anchorPointX,f=b.anchorPointY;a._anchorPoint.x=isNaN(e)?0.5:e;a._anchorPoint.y=isNaN(f)?0.5:f;a.setContentSize(c,d);a.setTag(b.tag);a.setActionTag(b.actiontag);a.setTouchEnabled(b.touchAble);a._name=b.name||"default";a._position.x=b.x||0;a._position.y=b.y||0;a._scaleX=b.scaleX||1;a._scaleY=b.scaleY||1;a._rotationX=a._rotationY=b.rotation||0; a._visible=b.visible||!1;a._localZOrder=b.ZOrder||0;if(null!=b.layoutParameter){c=b.layoutParameter;d=null;switch(isNaN(c.type)?2:c.type){case 1:d=new ccui.LinearLayoutParameter;d._linearGravity=c.gravity||0;break;case 2:d=new ccui.RelativeLayoutParameter,d._relativeLayoutName=c.relativeName,d._relativeWidgetName=c.relativeToName,d._relativeAlign=c.align||0}null!=d&&(e=d._margin,e.left=c.marginLeft||0,e.top=c.marginTop||0,e.right=c.marginRight||0,e.bottom=c.marginDown||0,a.setLayoutParameter(d))}}; d.colorAttributes=function(a,b){var c=null!==b.opacity?b.opacity:255;null!=c&&a.setOpacity(c);var c=b.colorR,d=b.colorG,e=b.colorB;a.setColor(cc.color(null==c?255:c,null==d?255:d,null==e?255:e));a.setFlippedX(b.flipX);a.setFlippedY(b.flipY)};var e=function(a,b,c,d){c&&(0===b?d(a+c,b):d(c,b))};d.LayoutAttributes=function(a,b,c){var d=0,f=0;b.adaptScreen?(f=cc.director.getWinSize(),d=f.width,f=f.height):(d=b.width||0,f=b.height||0);a.setSize(cc.size(d,f));a.setClippingEnabled(b.clipAble);d=b.backGroundScale9Enable; a.setBackGroundImageScale9Enabled(d);var f=b.bgColorR||0,p=b.bgColorG||0,r=b.bgColorB||0,s=isNaN(b.bgStartColorR)?255:b.bgStartColorR,u=isNaN(b.bgStartColorG)?255:b.bgStartColorG,t=isNaN(b.bgStartColorB)?255:b.bgStartColorB,v=isNaN(b.bgEndColorR)?255:b.bgEndColorR,w=isNaN(b.bgEndColorG)?255:b.bgEndColorG,x=isNaN(b.bgEndColorB)?255:b.bgEndColorB;a.setBackGroundColorVector(cc.p(b.vectorX||0,b.vectorY||0));var B=b.bgColorOpacity||0;a.setBackGroundColorType(b.colorType||0);a.setBackGroundColor(cc.color(s, u,t),cc.color(v,w,x));a.setBackGroundColor(cc.color(f,p,r));a.setBackGroundColorOpacity(B);(f=b.backGroundImageData)&&e(c,f.resourceType||0,f.path,function(b,c){a.setBackGroundImage(b,c)});d&&(c=b.capInsetsX||0,d=b.capInsetsY||0,f=isNaN(b.capInsetsWidth)?1:b.capInsetsWidth,p=isNaN(b.capInsetsHeight)?1:b.capInsetsHeight,a.setBackGroundImageCapInsets(cc.rect(c,d,f,p)));b.layoutType&&a.setLayoutType(b.layoutType)};d.ButtonAttributes=function(a,b,c){var d=b.scale9Enable;a.setScale9Enabled(d);var f=b.normalData; e(c,f.resourceType||0,f.path,function(b,c){a.loadTextureNormal(b,c)});f=b.pressedData;e(c,f.resourceType||0,f.path,function(b,c){a.loadTexturePressed(b,c)});f=b.disabledData;e(c,f.resourceType||0,f.path,function(b,c){a.loadTextureDisabled(b,c)});if(d){c=b.capInsetsX||0;var d=b.capInsetsY||0,f=isNaN(b.capInsetsWidth)?1:b.capInsetsWidth,p=isNaN(b.capInsetsHeight)?1:b.capInsetsHeight;a.setCapInsets(cc.rect(c,d,f,p));c=b.scale9Width||0;d=b.scale9Height||0;null!=c&&null!=d&&a.setSize(cc.size(c,d))}if(c= b.text||"")a.setTitleText(c),a.setTitleColor(cc.color(null!==b.textColorR?b.textColorR:255,null!==b.textColorG?b.textColorG:255,null!==b.textColorB?b.textColorB:255)),null!=b.fontSize&&a.setTitleFontSize(b.fontSize),b.fontName&&a.setTitleFontName(b.fontName)};d.CheckBoxAttributes=function(a,b,c){var d=b.backGroundBoxData;e(c,d.resourceType||0,d.path,function(b,c){a.loadTextureBackGround(b,c)});var f=b.backGroundBoxSelectedData;e(c,f.resourceType||d.resourceType,f.path||d.path,function(b,c){a.loadTextureBackGroundSelected(b, c)});d=b.frontCrossData;e(c,d.resourceType||0,d.path,function(b,c){a.loadTextureFrontCross(b,c)});f=b.backGroundBoxDisabledData;e(c,f.resourceType||d.resourceType,f.path||d.path,function(b,c){a.loadTextureBackGroundDisabled(b,c)});d=b.frontCrossDisabledData;e(c,d.resourceType||0,d.path,function(b,c){a.loadTextureFrontCrossDisabled(b,c)});b.selectedState&&a.setSelected(b.selectedState)};d.ImageViewAttributes=function(a,b,c){var d=b.fileNameData;e(c,d.resourceType||0,d.path,function(b,c){a.loadTexture(b, c)});c=!1;b.scale9Enable&&(c=b.scale9Enable);a.setScale9Enabled(c);if(c){c=b.scale9Height||0;b.scale9Width&&c&&a.setSize(cc.size(b.scale9Width||0,b.scale9Height||0));c=b.capInsetsX||0;var d=b.capInsetsY||0,f=isNaN(b.capInsetsWidth)?1:b.capInsetsWidth;b=isNaN(b.capInsetsHeight)?1:b.capInsetsHeight;a.setCapInsets(cc.rect(c,d,f,b))}};d.TextAtlasAttributes=function(a,b,c){var d=b.stringValue,e=b.charMapFileData,f=b.itemWidth,r=b.itemHeight,s=b.startCharMap;if(null!=d&&e&&null!=f&&null!=r&&null!=s)switch(b= b.charMapFileData,b.resourceType||0){case 0:a.setProperty(d,c+b.path,f,r,s);break;case 1:cc.log("Wrong res type of LabelAtlas!")}};d.TextBMFontAttributes=function(a,b,c){var d=b.fileNameData;switch(d.resourceType||0){case 0:a.setFntFile(c+d.path);break;case 1:cc.log("Wrong res type of LabelAtlas!")}a.setString(b.text||"")};var f=/\.ttf$/;d.TextAttributes=function(a,b,c){a.setTouchScaleChangeEnabled(b.touchScaleEnable);var d=b.text||"";d&&a._setString(d);null!=b.fontSize&&a._setFontSize(b.fontSize); d=b.fontName;null!=d&&(cc.sys.isNative?f.test(d)?a.setFontName(cc.path.join(cc.loader.resPath,c,d)):a.setFontName(d):a._setFontName(d.replace(f,"")));c=b.areaHeight||0;b.areaWidth&&c&&(c=cc.size(b.areaWidth,b.areaHeight),a._setTextAreaSize(c));c=b.hAlignment||0;null!=c&&a._setTextHorizontalAlignment(c);b=b.vAlignment||0;null!=b&&a._setTextVerticalAlignment(b);a._updateUITextContentSize()};d.ListViewAttributes=function(a,b,c){d.ScrollViewAttributes(a,b,c);a.setDirection(b.direction||1);a.setGravity(b.gravity|| 0);a.setItemsMargin(b.itemMargin||0)};d.LoadingBarAttributes=function(a,b,c){var d=b.textureData;e(c,d.resourceType||0,d.path,function(b,c){a.loadTexture(b,c)});c=b.scale9Enable;a.setScale9Enabled(c);if(c){c=b.capInsetsX||0;var d=b.capInsetsY||0,f=isNaN(b.capInsetsWidth)?1:b.capInsetsWidth,p=isNaN(b.capInsetsHeight)?1:b.capInsetsHeight;a.setCapInsets(cc.rect(c,d,f,p));a.setSize(cc.size(b.width||0,b.height||0))}a.setDirection(b.direction||0);a.setPercent(b.percent||0)};d.PageViewAttributes=d.LayoutAttributes; d.ScrollViewAttributes=function(a,b,c){d.LayoutAttributes(a,b,c);a.setInnerContainerSize(cc.size(null!=b.innerWidth?b.innerWidth:200,null!=b.innerHeight?b.innerHeight:200));a.setDirection(null!=b.direction?b.direction:1);a.setBounceEnabled(b.bounceEnable)};d.SliderAttributes=function(a,b,c){var d=b.scale9Enable;a.setScale9Enabled(d);var f=b.length,p=b.barFileNameData,r=p.resourceType||0,p=p.path;null!=b.barFileName?d&&(e(c,r,p,function(b,c){a.loadBarTexture(b,c)}),a.setSize(cc.size(f,a.getContentSize().height))): e(c,r,p,function(b,c){a.loadBarTexture(b,c)});d=b.ballNormalData;e(c,d.resourceType||0,d.path,function(b,c){a.loadSlidBallTextureNormal(b,c)});f=b.ballPressedData;e(c,f.resourceType||d.resourceType,f.path||d.path,function(b,c){a.loadSlidBallTexturePressed(b,c)});d=b.ballDisabledData;e(c,d.resourceType||0,d.path,function(b,c){a.loadSlidBallTextureDisabled(b,c)});b=b.progressBarData;e(c,b.resourceType||0,b.path,function(b,c){a.loadProgressBarTexture(b,c)})};d.TextFieldAttributes=function(a,b,c){var d= b.placeHolder||"";d&&a.setPlaceHolder(d);a.setString(b.text||"");(d=b.fontSize)&&a.setFontSize(d);d=b.fontName;null!=d&&(cc.sys.isNative?f.test(d)?a.setFontName(cc.path.join(cc.loader.resPath,c,d)):a.setFontName(d):a.setFontName(d.replace(f,"")));c=b.touchSizeWidth||0;d=b.touchSizeHeight||0;null!=c&&null!=d&&a.setTouchSize(c,d);c=b.maxLengthEnable;a.setMaxLengthEnabled(c);c&&a.setMaxLength(b.maxLength);c=b.passwordEnable;a.setPasswordEnabled(c);c&&a.setPasswordStyleText(b.passwordStyleText);c=b.areaWidth|| 0;d=b.areaHeight||0;c&&d&&(c=cc.size(c,d),a.setTextAreaSize(c));(c=b.hAlignment||0)&&a.setTextHorizontalAlignment(c);(c=b.vAlignment||0)&&a.setTextVerticalAlignment(c);c=isNaN(b.colorR)?255:b.colorR;d=isNaN(b.colorG)?255:b.colorG;b=isNaN(b.colorB)?255:b.colorB;a.setTextColor(cc.color(c,d,b))};d.parsers={Panel:{object:ccui.Layout,handle:d.LayoutAttributes},Button:{object:ccui.Button,handle:d.ButtonAttributes},CheckBox:{object:ccui.CheckBox,handle:d.CheckBoxAttributes},ImageView:{object:ccui.ImageView, handle:d.ImageViewAttributes},LabelAtlas:{object:ccui.TextAtlas,handle:d.TextAtlasAttributes},LabelBMFont:{object:ccui.TextBMFont,handle:d.TextBMFontAttributes},Label:{object:ccui.Text,handle:d.TextAttributes},ListView:{object:ccui.ListView,handle:d.ListViewAttributes},LoadingBar:{object:ccui.LoadingBar,handle:d.LoadingBarAttributes},PageView:{object:ccui.PageView,handle:d.PageViewAttributes},ScrollView:{object:ccui.ScrollView,handle:d.ScrollViewAttributes},Slider:{object:ccui.Slider,handle:d.SliderAttributes}, TextField:{object:ccui.TextField,handle:d.TextFieldAttributes}};a.registerParser("ccui","*",d)})(ccs._load,ccs._parser);(function(a,b){var c=new (b.extend({getNodeJson:function(a){return a.action},parseNode:function(a,b,c){if(!a)return null;var g=this,h=new ccs.ActionTimeline;h.setDuration(a.duration);h.setTimeSpeed(a.speed||1);a.timelines.forEach(function(a){var c=g.parsers[a.frameType],d;c?d=c.call(g,a,b):cc.log("parser does not exist : %s",a.frameType);d&&h.addTimeline(d);"ColorFrame"===a.frameType&&h.addTimeline(g.parsers.AlphaFrame.call(g,a,b))});return h}}));[{name:"PositionFrame",handle:function(a){var b=new ccs.PositionFrame; b.setPosition(cc.p(a.x,a.y));return b}},{name:"VisibleFrame",handle:function(a){var b=new ccs.VisibleFrame;b.setVisible(a.value);return b}},{name:"ScaleFrame",handle:function(a){var b=new ccs.ScaleFrame,c=a.y;b.setScaleX(a.x);b.setScaleY(c);return b}},{name:"RotationFrame",handle:function(a){var b=new ccs.RotationFrame;b.setRotation(a.rotation);return b}},{name:"SkewFrame",handle:function(a){var b=new ccs.SkewFrame,c=a.y;b.setSkewX(a.x);b.setSkewY(c);return b}},{name:"RotationSkewFrame",handle:function(a){var b= new ccs.RotationSkewFrame,c=a.y;b.setSkewX(a.x);b.setSkewY(c);return b}},{name:"AnchorFrame",handle:function(a){var b=new ccs.AnchorPointFrame;b.setAnchorPoint(cc.p(a.x,a.y));return b}},{name:"InnerActionFrame",handle:function(a){var b=new ccs.InnerActionFrame,c=a.startFrame;b.setInnerActionType(a.innerActionType);b.setStartFrameIndex(c);return b}},{name:"ColorFrame",handle:function(a){var b=new ccs.ColorFrame;b.setColor(cc.color(a.red,a.green,a.blue));(new ccs.AlphaFrame).setAlpha(a.alpha);return b}}, {name:"AlphaFrame",handle:function(a){var b=new ccs.AlphaFrame;b.setAlpha(a.alpha);return b}},{name:"TextureFrame",handle:function(a){var b=new ccs.TextureFrame;a=a.value;if(null!=a){var c=a;null==cc.spriteFrameCache.getSpriteFrame(c)&&(c=ccs.csLoader.getJsonPath()+a);b.setTextureName(c)}return b}},{name:"EventFrame",handle:function(a){var b=new ccs.EventFrame;a=a.value;null!=a&&b.setEvent(a);return b}},{name:"ZOrderFrame",handle:function(a){var b=new ccs.ZOrderFrame;b.setZOrder(a.value);return b}}].forEach(function(a){c.registerParser(a.name, function(b,c){var g=new ccs.Timeline;g.setActionTag(b.actionTag);var h=b.frames;h&&h.length&&h.forEach(function(b){var c=a.handle(b);c.setFrameIndex(b.frameIndex);c.setTween(b.tween);g.addFrame(c)});return g})});a.registerParser("action","0.*",c);a.registerParser("action","1.*",c)})(ccs._load,ccs._parser);(function(a,b){var c=new (b.extend({getNodeJson:function(a){return a.Content.Content.Animation},parseNode:function(a,b,c){if(!a)return null;var d=this,k=new ccs.ActionTimeline;k.setDuration(a.Duration);k.setTimeSpeed(a.Speed||1);a.Timelines.forEach(function(a){var c=d.parsers[a.Property],e;c?e=c.call(d,a,b):cc.log("parser does not exist : %s",a.Property);e&&k.addTimeline(e)});return k},deferred:function(a,b,c,d){b=(a=a.Content.Content.AnimationList)?a.length:0;for(d=0;d<b;d++){var k=a[d],m={name:null, startIndex:null,endIndex:null};m.name=k.Name;m.startIndex=k.StartIndex;m.endIndex=k.EndIndex;c.addAnimationInfo(m)}}})),d=function(a,b){a.setTweenType(b.Type);var c=b.Points,d=[];c&&(c.forEach(function(a){d.push(a.X);d.push(a.Y)}),a.setEasingParams(d))};[{name:"Position",handle:function(a){var b=new ccs.PositionFrame;b.setPosition(cc.p(a.X,a.Y));return b}},{name:"VisibleForFrame",handle:function(a){var b=new ccs.VisibleFrame;b.setVisible(a.Value);return b}},{name:"Scale",handle:function(a){var b= new ccs.ScaleFrame,c=a.Y;b.setScaleX(a.X);b.setScaleY(c);return b}},{name:"Rotation",handle:function(a){var b=new ccs.RotationFrame;b.setRotation(a.Rotation||a.Value||0);return b}},{name:"Skew",handle:function(a){var b=new ccs.SkewFrame,c=a.Y;b.setSkewX(a.X);b.setSkewY(c);return b}},{name:"RotationSkew",handle:function(a){var b=new ccs.RotationSkewFrame,c=a.Y;b.setSkewX(a.X);b.setSkewY(c);return b}},{name:"Anchor",handle:function(a){var b=new ccs.AnchorPointFrame;b.setAnchorPoint(cc.p(a.X,a.Y));return b}}, {name:"AnchorPoint",handle:function(a){var b=new ccs.AnchorPointFrame;b.setAnchorPoint(cc.p(a.X,a.Y));return b}},{name:"InnerAction",handle:function(a){var b=new ccs.InnerActionFrame,c=a.StartFrame;b.setInnerActionType(a.InnerActionType);b.setStartFrameIndex(c);return b}},{name:"CColor",handle:function(a){var b=new ccs.ColorFrame;(a=a.Color)||(a={});a.R=void 0===a.R?255:a.R;a.G=void 0===a.G?255:a.G;a.B=void 0===a.B?255:a.B;b.setColor(cc.color(a.R,a.G,a.B));return b}},{name:"Alpha",handle:function(a){var b= new ccs.AlphaFrame;b.setAlpha(a.Value);return b}},{name:"FileData",handle:function(a,b){var c,d,k,m;c=new ccs.TextureFrame;d=a.TextureFile;null!=d&&(k=d.Plist,d=d.Path,m=cc.spriteFrameCache.getSpriteFrame(d),!m&&k&&(cc.loader.getRes(b+k)?(cc.spriteFrameCache.addSpriteFrames(b+k),m=cc.spriteFrameCache.getSpriteFrame(d)):cc.log("%s need to be preloaded",b+k)),null==m&&(d=b+d),c.setTextureName(d));return c}},{name:"FrameEvent",handle:function(a){var b=new ccs.EventFrame;a=a.Value;null!=a&&b.setEvent(a); return b}},{name:"ZOrder",handle:function(a){var b=new ccs.ZOrderFrame;b.setZOrder(a.Value);return b}},{name:"ActionValue",handle:function(a){var b=new ccs.InnerActionFrame,c=a.InnerActionType,d=a.CurrentAniamtionName,k=a.SingleFrameIndex;a=a.FrameIndex;void 0!==a&&b.setFrameIndex(a);b.setInnerActionType(ccs.InnerActionType[c]);b.setSingleFrameIndex(k);b.setEnterWithName(!0);d&&b.setAnimationName(d);return b}},{name:"BlendFunc",handle:function(a){var b=new ccs.BlendFuncFrame;(a=a.BlendFunc)&&void 0!== a.Src&&void 0!==a.Dst&&b.setBlendFunc(new cc.BlendFunc(a.Src,a.Dst));return b}}].forEach(function(a){c.registerParser(a.name,function(b,c){var h=new ccs.Timeline;h.setActionTag(b.ActionTag);var k=b.Frames;k&&k.length&&k.forEach(function(b){var f=a.handle(b,c);f.setFrameIndex(b.FrameIndex);f.setTween(null!=b.Tween?b.Tween:!0);(b=b.EasingData)&&d(f,b);h.addFrame(f)});return h})});a.registerParser("action","2.*",c);a.registerParser("action","*",c)})(ccs._load,ccs._parser);(function(a,b){var c={},d=new (b.extend({getNodeJson:function(a){return a.nodeTree},addSpriteFrame:function(a,b,d){if(a&&b&&a.length===b.length)for(var e=0;e<a.length;e++){var m=d+a[e];cc.loader.getRes(m)||c[m]?c[m]=!0:cc.log("%s need to be preloaded",m);cc.spriteFrameCache.addSpriteFrames(m,d+b[e])}},pretreatment:function(a,b,c){this.addSpriteFrame(a.textures,a.texturesPng,b)}}));d.generalAttributes=function(a,b){var c=null!=b.width?b.width:0,d=null!=b.height?b.height:0,e=null!=b.x?b.x:0,n=null!= b.y?b.y:0,p=null!=b.scaleX?b.scaleX:1,r=null!=b.scaleY?b.scaleY:1,s=null!=b.rotation?b.rotation:0,u=null!=b.rotationSkewX?b.rotationSkewX:0,t=null!=b.rotationSkewY?b.rotationSkewY:0,v=null!=b.skewX?b.skewX:0,w=null!=b.skewY?b.skewY:0,x=null!=b.anchorPointX?b.anchorPointX:0.5,B=null!=b.anchorPointY?b.anchorPointY:0.5,y=null!=b.opacity?b.opacity:255,z=null!=b.colorR?b.colorR:255,C=null!=b.colorG?b.colorG:255,A=null!=b.colorB?b.colorB:255,D=null!=b.colorR?b.colorR:0,F=null!=b.tag?b.tag:0,M=null!=b.actionTag? b.actionTag:0,E=null!=b.visible?b.visible:!0;0==e&&0==n||a.setPosition(cc.p(e,n));1!=p&&a.setScaleX(p);1!=r&&a.setScaleY(r);0!=s&&a.setRotation(s);0!=u&&a.setRotationX(u);0!=t&&a.setRotationY(t);0!=v&&a.setSkewX(v);0!=w&&a.setSkewY(w);0.5==x&&0.5==B||a.setAnchorPoint(cc.p(x,B));0==c&&0==d||a.setContentSize(cc.size(c,d));0!=D&&a.setLocalZOrder(D);!0!=E&&a.setVisible(E);255!=y&&a.setOpacity(y);255==z&&255==C&&255==A||a.setColor(cc.color(z,C,A));a.setTag(F);a.setUserObject(new ccs.ActionTimelineData(M))}; d.parseComponent=function(a,b){if(b)for(var c=0;c<b.length;++c){var d=this.loadComponent(b[c]);d&&a.addComponent(d)}};d.parseChild=function(a,b,c,d){a=c.children;for(c=0;c<a.length;c++){var e=this.parseNode(a[c],d);if(e)if(b instanceof ccui.PageView)e instanceof ccui.Layout&&b.addPage(e);else if(b instanceof ccui.ListView)e instanceof ccui.Widget&&b.pushBackCustomItem(e);else{if(!(b instanceof ccui.Layout)&&e instanceof ccui.Widget){if(e.getPositionType()===ccui.Widget.POSITION_PERCENT){var n=e.getPositionPercent(), p=b.getAnchorPoint();e.setPositionPercent(cc.p(n.x+p.x,n.y+p.y))}n=b.getAnchorPointInPoints();e.setPosition(cc.p(e.getPositionX()+n.x,e.getPositionY()+n.y))}b.addChild(e)}}};d.initNode=function(a){var b=new cc.Node;this.generalAttributes(b,a);return b};d.initSubGraph=function(a){var b=a.fileName,b=b&&""!==b?this.createNode(b):new ccs.Node;this.generalAttributes(b,a);return b};d.initSprite=function(a,b){var c=a.fileName;if(null!=c){var d=cc.spriteFrameCache.getSpriteFrame(c),c=d?ccs.Sprite.createWithSpriteFrame(d): new ccs.Sprite(b+c);c||(c=new cc.Sprite,cc.log("filePath is empty. Create a sprite with no texture"))}else c=new ccs.Sprite;this.generalAttributes(c,a);var d=a.flipX,e=a.flipY;!1!=d&&c.setFlippedX(d);!1!=e&&c.setFlippedY(e);return c};d.initParticle=function(a,b){var c=a.tmxFile,d=new cc.ParticleSystemQuad(a.plistFile);d.setTotalParticles(c);this.generalAttributes(d,a);return d};d.initTMXTiledMap=function(a,b){var c=a.tmxFile,d=a.tmxString,e=a.resourcePath,n=null;c&&""!==c?n=new cc.TMXTiledMap(c): d&&""!==d&&e&&""!==e&&(n=new cc.TMXTiledMap(d,e));return n};var e=a.getParser("ccui")["*"];d.initWidget=function(a,b){var c=a.classname,d=e.parsers[c];if(!d)return cc.log("%s parser is not found",c);if(c=d.call(e,a,b)){var d=a.rotationSkewX,m=a.rotationSkewY,n=a.skewX,p=a.skewY;0!=d&&c.setRotationX(d);0!=m&&c.setRotationY(m);0!=n&&c.setSkewX(n);0!=p&&c.setSkewY(p);c.setUserObject(new ccs.ActionTimelineData(a.actionTag))}return c};[{name:"Node",handle:d.initNode},{name:"SubGraph",handle:d.initSubGraph}, {name:"Sprite",handle:d.initSprite},{name:"Particle",handle:d.initParticle},{name:"TMXTiledMap",handle:d.initTMXTiledMap},{name:"Widget",handle:d.initWidget},{name:"Panel",handle:d.initWidget},{name:"Button",handle:d.initWidget},{name:"CheckBox",handle:d.initWidget},{name:"ImageView",handle:d.initWidget},{name:"LabelAtlas",handle:d.initWidget},{name:"LabelBMFont",handle:d.initWidget},{name:"Label",handle:d.initWidget},{name:"ListView",handle:d.initWidget},{name:"LoadingBar",handle:d.initWidget},{name:"PageView", handle:d.initWidget},{name:"ScrollView",handle:d.initWidget},{name:"Slider",handle:d.initWidget},{name:"TextField",handle:d.initWidget}].forEach(function(a){d.registerParser(a.name,function(b,c,d){var e=a.handle.call(this,b.options);this.parseComponent(e,b.components);this.parseChild(c,e,b,d);return e})});a.registerParser("timeline","0.*",d);a.registerParser("timeline","1.*",d)})(ccs._load,ccs._parser);(function(a,b){var c=new (b.extend({parse:function(a,b,c){c=void 0!==c?c:this._dirname(a);this.pretreatment(b,c,a);var d=this.parseNode(this.getNodeJson(b),c);this.deferred(b,c,d,a);return d},getNodeJson:function(a){a=a.Content;return a.ObjectData?a.ObjectData:a.Content.ObjectData},getClass:function(a){return a.ctype}})),d=function(a,b){return void 0===a?b:a};c.generalAttributes=function(a,b){null!=b.Name&&a.setName(b.Name);var c=b.Position;null==c||null==c.X&&null==c.Y||a.setPosition(cc.p(c.X||0, c.Y||0));c=b.Scale;null!=c&&(null!=c.ScaleX&&a.setScaleX(c.ScaleX),null!=c.ScaleY&&a.setScaleY(c.ScaleY));c=b.RotationSkewX;null!=c&&a.setRotationX(c);c=b.RotationSkewY;null!=b.RotationSkewY&&a.setRotationY(c);c=b.AnchorPoint;null!=c&&(null==c.ScaleX&&(c.ScaleX=0),null==c.ScaleY&&(c.ScaleY=0),0.5==c.ScaleX&&0.5==c.ScaleY||a.setAnchorPoint(cc.p(c.ScaleX,c.ScaleY)));null!=b.ZOrder&&a.setLocalZOrder(b.ZOrder);c=d(b.VisibleForFrame,!0);a.setVisible(c);(c=b.Size)&&r(a,c);null!=b.Alpha&&a.setOpacity(b.Alpha); a.setTag(b.Tag||0);var c=b.ActionTag||0,e=new ccs.ComExtensionData,g=b.UserData;void 0!==g&&e.setCustomProperty(g);e.setActionTag(c);a.getComponent("ComExtensionData")&&a.removeComponent("ComExtensionData");a.addComponent(e);a.setCascadeColorEnabled(!0);a.setCascadeOpacityEnabled(!0);f(a,b)};c.parseChild=function(a,b,c){if(a&&b)for(var d=0;d<b.length;d++){var e=this.parseNode(b[d],c);if(e)if(a instanceof ccui.PageView)e instanceof ccui.Layout&&a.addPage(e);else if(a instanceof ccui.ListView)e instanceof ccui.Widget&&a.pushBackCustomItem(e);else{if(!(a instanceof ccui.Layout)&&e instanceof ccui.Widget&&e.getPositionType()===ccui.Widget.POSITION_PERCENT){var f=e.getPositionPercent(),g=a.getAnchorPoint();e.setPositionPercent(cc.p(f.x+g.x,f.y+g.y))}a.addChild(e)}}};c.initSingleNode=function(a){var b=new cc.Node;this.generalAttributes(b,a);a=a.CColor;null!=a&&b.setColor(p(a));return b};c.initSprite=function(a,b){var c=new cc.Sprite;n(a.FileData,b,function(a,b){if(0===b)c.setTexture(a);else if(1===b){var d= cc.spriteFrameCache.getSpriteFrame(a);d&&c.setSpriteFrame(d)}});var d=a.BlendFunc;if(a.BlendFunc){var e=cc.BlendFunc.ALPHA_PREMULTIPLIED;void 0!==d.Src&&(e.src=d.Src);void 0!==d.Dst&&(e.dst=d.Dst);c.setBlendFunc(e)}a.FlipX&&c.setFlippedX(!0);a.FlipY&&c.setFlippedY(!0);this.generalAttributes(c,a);d=a.CColor;null!=d&&c.setColor(p(d));return c};c.initParticle=function(a,b){var c,d=this;n(a.FileData,b,function(b,e){cc.loader.getRes(b)||cc.log("%s need to be preloaded",b);c=new cc.ParticleSystem(b);d.generalAttributes(c, a);c.setPositionType(cc.ParticleSystem.TYPE_GROUPED);!cc.sys.isNative&&c.setDrawMode(cc.ParticleSystem.TEXTURE_MODE);var f=a.BlendFunc;if(a.BlendFunc){var g=cc.BlendFunc.ALPHA_PREMULTIPLIED;void 0!==f.Src&&(g.src=f.Src);void 0!==f.Dst&&(g.dst=f.Dst);c.setBlendFunc(g)}});return c};c.widgetAttributes=function(a,b,c){a.setCascadeColorEnabled(!0);a.setCascadeOpacityEnabled(!0);a.setUnifySizeEnabled(!1);a.ignoreContentAdaptWithSize(!1);!c&&r(a,b.Size);(c=b.Name)&&a.setName(c);c=b.ActionTag||0;a.setActionTag(c); var g=new ccs.ComExtensionData,h=b.UserData;void 0!==h&&g.setCustomProperty(h);g.setActionTag(c);a.getComponent("ComExtensionData")&&a.removeComponent("ComExtensionData");a.addComponent(g);(c=b.RotationSkewX)&&a.setRotationX(c);(c=b.RotationSkewY)&&a.setRotationY(c);b.FlipX&&a.setFlippedX(!0);b.FlipY&&a.setFlippedY(!0);c=b.zOrder;null!=c&&a.setLocalZOrder(c);c=d(b.VisibleForFrame,!0);a.setVisible(c);c=b.Alpha;null!=c&&a.setOpacity(c);a.setTag(b.Tag||0);a.setTouchEnabled(b.TouchEnable||!1);c=b.CallBackType; null!=c&&a.setCallbackType(c);(c=b.CallBackName)&&a.setCallbackName(c);c=b.Position;null!=c&&a.setPosition(c.X||0,c.Y||0);g=b.Scale;null!=g&&(c=d(g.ScaleX,1),g=d(g.ScaleY,1),a.setScaleX(c),a.setScaleY(g));c=b.AnchorPoint;null!=c&&a.setAnchorPoint(c.ScaleX||0,c.ScaleY||0);c=b.CColor;null!=c&&a.setColor(p(c));f(a,b);e(a,b)};var e=function(a,b){var c=b.CallBackType,d=b.CallBackName,e=function(b){if("function"===typeof a[d])a[d](b)};"Click"===c?a.addClickEventListener(e):"Touch"===c?a.addTouchEventListener(e): "Event"===c&&a.addCCSEventListener(e)},f=function(a,b){var c=ccui.LayoutComponent.bindLayoutComponent(a);if(c){var d=b.PositionPercentXEnable||b.PositionPercentXEnabled||!1,e=b.PositionPercentYEnable||b.PositionPercentYEnabled||!1,f=0,g=0,h=b.PrePosition;null!=h&&(f=h.X||0,g=h.Y||0);var k=b.PercentWidthEnable||b.PercentWidthEnabled||!1,m=b.PercentHeightEnable||b.PercentHeightEnabled||!1,n=0,p=0,r=b.PreSize;null!=h&&(n=r.X||0,p=r.Y||0);var M=b.StretchWidthEnable||!1,E=b.StretchHeightEnable||!1,N=b.HorizontalEdge, h=b.VerticalEdge,r=b.LeftMargin||0,Q=b.RightMargin||0,H=b.TopMargin||0,R=b.BottomMargin||0;c.setPositionPercentXEnabled(d);c.setPositionPercentYEnabled(e);c.setPositionPercentX(f);c.setPositionPercentY(g);c.setPercentWidthEnabled(k);c.setPercentHeightEnabled(m);c.setPercentWidth(n);c.setPercentHeight(p);c.setPercentWidthEnabled(k||m);c.setStretchWidthEnabled(M);c.setStretchHeightEnabled(E);d=ccui.LayoutComponent.horizontalEdge.NONE;"LeftEdge"===N?d=ccui.LayoutComponent.horizontalEdge.LEFT:"RightEdge"=== N?d=ccui.LayoutComponent.horizontalEdge.RIGHT:"BothEdge"===N&&(d=ccui.LayoutComponent.horizontalEdge.CENTER);c.setHorizontalEdge(d);d=ccui.LayoutComponent.verticalEdge.NONE;"TopEdge"===h?d=ccui.LayoutComponent.verticalEdge.TOP:"BottomEdge"===h?d=ccui.LayoutComponent.verticalEdge.BOTTOM:"BothEdge"===h&&(d=ccui.LayoutComponent.verticalEdge.CENTER);c.setVerticalEdge(d);c.setTopMargin(H);c.setBottomMargin(R);c.setLeftMargin(r);c.setRightMargin(Q);c.setVerticalEdge(d);c.setTopMargin(H);c.setBottomMargin(R); c.setLeftMargin(r);c.setRightMargin(Q)}},g=function(a,b,c,d){2===a.getBackGroundColorType()?(c=c||{},d=d||{},a.setBackGroundColor(p(c),p(d))):(b=b||{},a.setBackGroundColor(p(b)))},h=function(a,b){a.setBackGroundColorVector(cc.p(b.ScaleX||0,b.ScaleY||0))};c.initPanel=function(a,b){var c=new ccui.Layout;this.widgetAttributes(c,a);var e=a.ClipAble||!1;null!=e&&c.setClippingEnabled(e);e=d(a.ComboBoxIndex,0);c.setBackGroundColorType(e);e=d(a.BackColorAlpha,255);null!=e&&c.setBackGroundColorOpacity(e); e=a.Scale9Enable;null!=e&&c.setBackGroundImageScale9Enabled(e);var f=d(a.Alpha,255);c.setOpacity(f);n(a.FileData,b,function(a,b){c.setBackGroundImage(a,b)});e?(c.setBackGroundImageCapInsets(cc.rect(a.Scale9OriginX||0,a.Scale9OriginY||0,a.Scale9Width||0,a.Scale9Height||0)),r(c,a.Size)):c.isIgnoreContentAdaptWithSize()||r(c,a.Size);g(c,a.SingleColor,a.FirstColor,a.EndColor);h(c,a.ColorVector);return c};c.initText=function(a,b){var c=new ccui.Text,e=a.TouchScaleChangeAble;null!=e&&c.setTouchScaleChangeEnabled(e); e=a.LabelText;null!=e&&c.setString(e);e=a.FontSize;null!=e&&c.setFontSize(e);e=a.FontName;null!=e&&c.setFontName(e);var e=a.AreaWidth,f=a.areaHeight;e&&f&&c.setTextAreaSize(cc.size(e,f));e=a.HorizontalAlignmentType||"HT_Left";switch(e){case "HT_Right":e=2;break;case "HT_Center":e=1;break;default:e=0}c.setTextHorizontalAlignment(e);e=a.VerticalAlignmentType||"VT_Top";switch(e){case "VT_Bottom":e=2;break;case "VT_Center":e=1;break;default:e=0}c.setTextVerticalAlignment(e);e=a.FontResource;null!=e&& (e=e.Path,null!=e&&(e=cc.sys.isNative?cc.path.join(cc.loader.resPath,b,e):(e=e.match(/([^\/]+)\.(\S+)/))?e[1]:"",c.setFontName(e)));a.OutlineEnabled&&a.OutlineColor&&c.enableOutline&&c.enableOutline(p(a.OutlineColor),d(a.OutlineSize,1));a.ShadowEnabled&&a.ShadowColor&&c.enableShadow&&c.enableShadow(p(a.ShadowColor),cc.size(d(a.ShadowOffsetX,2),d(a.ShadowOffsetY,-2)),a.ShadowBlurRadius||0);e=a.IsCustomSize;null!=e&&c.ignoreContentAdaptWithSize(!e);c.setUnifySizeEnabled(!1);e=a.CColor;a.CColor=null; c.setTextColor(p(e));this.widgetAttributes(c,a,c.isIgnoreContentAdaptWithSize());a.CColor=e;return c};c.initButton=function(a,b){var c=new ccui.Button;n(a.NormalFileData,b,function(a,b){c.loadTextureNormal(a,b)});n(a.PressedFileData,b,function(a,b){c.loadTexturePressed(a,b)});n(a.DisabledFileData,b,function(a,b){c.loadTextureDisabled(a,b)});var e=d(a.Scale9Enable,!1);e&&c.setScale9Enabled(e);var f=a.ButtonText;null!=f&&c.setTitleText(f);f=a.FontSize;null!=f&&c.setTitleFontSize(f);f=a.FontName;null!= f&&c.setTitleFontName(f);f=a.TextColor;null!=f&&c.setTitleColor(p(f));f=d(a.DisplayState,!0);c.setBright(f);c.setEnabled(f);f=a.FontResource;null!=f&&(f=f.Path,null!=f&&(f=cc.sys.isNative?cc.path.join(cc.loader.resPath,b,f):(f=f.match(/([^\/]+)\.(\S+)/))?f[1]:"",c.setTitleFontName(f)));(f=c.getTitleRenderer())&&a.ShadowEnabled&&a.ShadowColor&&f.enableShadow&&f.enableShadow(p(a.ShadowColor),cc.size(d(a.ShadowOffsetX,2),d(a.ShadowOffsetY,-2)),a.ShadowBlurRadius||0);f&&a.OutlineEnabled&&a.OutlineColor&& f.enableStroke&&f.enableStroke(p(a.OutlineColor),d(a.OutlineSize,1));this.widgetAttributes(c,a);e&&(c.setUnifySizeEnabled(!1),c.ignoreContentAdaptWithSize(!1),e=cc.rect(a.Scale9OriginX||0,a.Scale9OriginY||0,a.Scale9Width||0,a.Scale9Height||0),c.setCapInsets(e));r(c,a.Size);return c};c.initCheckBox=function(a,b){var c=new ccui.CheckBox;this.widgetAttributes(c,a);[{name:"NormalBackFileData",handle:c.loadTextureBackGround},{name:"PressedBackFileData",handle:c.loadTextureBackGroundSelected},{name:"NodeNormalFileData", handle:c.loadTextureFrontCross},{name:"DisableBackFileData",handle:c.loadTextureBackGroundDisabled},{name:"NodeDisableFileData",handle:c.loadTextureFrontCrossDisabled}].forEach(function(d){n(a[d.name],b,function(a,b){d.handle.call(c,a,b)})});var e=d(a.CheckedState,!1);c.setSelected(e);e=d(a.DisplayState,!0);c.setBright(e);c.setEnabled(e);return c};c.initScrollView=function(a,b){var c=new ccui.ScrollView;this.widgetAttributes(c,a);n(a.FileData,b,function(a,b){c.setBackGroundImage(a,b)});c.setClippingEnabled(a.ClipAble|| !1);var e=d(a.ComboBoxIndex,0);c.setBackGroundColorType(e);e=a.BackColorAlpha;null!=e&&c.setBackGroundColorOpacity(e);a.Scale9Enable?(c.setBackGroundImageScale9Enabled(!0),c.setBackGroundImageCapInsets(cc.rect(a.Scale9OriginX||0,a.Scale9OriginY||0,a.Scale9Width||0,a.Scale9Height||0)),r(c,a.Size)):c.isIgnoreContentAdaptWithSize()||r(c,a.Size);g(c,a.SingleColor,a.FirstColor,a.EndColor);h(c,a.ColorVector);e=a.InnerNodeSize;e=cc.size(e.Width||0,e.Height||0);c.setInnerContainerSize(e);e=0;"Vertical"=== a.ScrollDirectionType&&(e=1);"Horizontal"===a.ScrollDirectionType&&(e=2);"Vertical_Horizontal"===a.ScrollDirectionType&&(e=3);c.setDirection(e);e=d(a.IsBounceEnabled,!1);c.setBounceEnabled(e);return c};c.initImageView=function(a,b){var c=new ccui.ImageView;n(a.FileData,b,function(a,b){c.loadTexture(a,b)});n(a.ImageFileData,b,function(a,b){c.loadTexture(a,b)});a.Scale9Enable?(c.setScale9Enabled(!0),c.setUnifySizeEnabled(!1),c.ignoreContentAdaptWithSize(!1),c.setCapInsets(cc.rect(a.Scale9OriginX||0, a.Scale9OriginY||0,a.Scale9Width||0,a.Scale9Height||0))):r(c,a.Size);this.widgetAttributes(c,a);return c};c.initLoadingBar=function(a,b){var c=new ccui.LoadingBar;this.widgetAttributes(c,a);n(a.ImageFileData,b,function(a,b){c.loadTexture(a,b)});c.setDirection("Right_To_Left"===a.ProgressType?1:0);var e=d(a.ProgressInfo,80);null!=e&&c.setPercent(e);return c};c.initSlider=function(a,b){var c=new ccui.Slider,e=cc.loader;this.widgetAttributes(c,a);[{name:"BackGroundData",handle:c.loadBarTexture},{name:"BallNormalData", handle:c.loadSlidBallTextureNormal},{name:"BallPressedData",handle:c.loadSlidBallTexturePressed},{name:"BallDisabledData",handle:c.loadSlidBallTextureDisabled},{name:"ProgressBarData",handle:c.loadProgressBarTexture}].forEach(function(d){n(a[d.name],b,function(a,b){0!==b||e.getRes(a)||cc.log("%s need to be preloaded",a);d.handle.call(c,a,b)})});c.setPercent(a.PercentInfo||0);var f=d(a.DisplayState,!0);c.setBright(f);c.setEnabled(f);return c};c.initPageView=function(a,b){var c=new ccui.PageView;this.widgetAttributes(c, a);n(a.FileData,b,function(a,b){c.setBackGroundImage(a,b)});c.setClippingEnabled(a.ClipAble||!1);a.Scale9Enable&&(c.setBackGroundImageScale9Enabled(!0),c.setBackGroundImageCapInsets(cc.rect(a.Scale9OriginX||0,a.Scale9OriginY||0,a.Scale9Width||0,a.Scale9Height||0)));var e=d(a.ComboBoxIndex,0);c.setBackGroundColorType(e);g(c,a.SingleColor,a.FirstColor,a.EndColor);h(c,a.ColorVector);e=a.BackColorAlpha;null!=e&&c.setBackGroundColorOpacity(e);r(c,a.Size);return c};c.initListView=function(a,b){var c=new ccui.ListView; this.widgetAttributes(c,a);n(a.FileData,b,function(a,b){c.setBackGroundImage(a,b)});c.setClippingEnabled(a.ClipAble||!1);var e=d(a.ComboBoxIndex,0);c.setBackGroundColorType(e);e=d(a.BackColorAlpha,255);a.Scale9Enable&&(c.setBackGroundImageScale9Enabled(!0),c.setBackGroundImageCapInsets(cc.rect(a.Scale9OriginX||0,a.Scale9OriginY||0,a.Scale9Width||0,a.Scale9Height||0)));var f=d(a.DirectionType,ccui.ListView.DIR_HORIZONTAL),k=d(a.VerticalType,"Align_Left"),m=d(a.HorizontalType,"Align_Top");f?"Vertical"=== f&&(c.setDirection(ccui.ScrollView.DIR_VERTICAL),""===m?c.setGravity(ccui.ListView.GRAVITY_LEFT):"Align_Right"===m?c.setGravity(ccui.ListView.GRAVITY_RIGHT):"Align_HorizontalCenter"===m&&c.setGravity(ccui.ListView.GRAVITY_CENTER_HORIZONTAL)):(c.setDirection(ccui.ScrollView.DIR_HORIZONTAL),"Align_Bottom"===k?c.setGravity(ccui.ListView.GRAVITY_BOTTOM):"Align_VerticalCenter"===k?c.setGravity(ccui.ListView.GRAVITY_CENTER_VERTICAL):c.setGravity(ccui.ListView.GRAVITY_TOP));f=d(a.IsBounceEnabled,!1);c.setBounceEnabled(f); c.setItemsMargin(a.ItemMargin||0);f=a.InnerNodeSize;null!=f&&c.setInnerContainerSize(cc.size(f.Widget||0,f.Height||0));g(c,a.SingleColor,a.FirstColor,a.EndColor);h(c,a.ColorVector);null!=e&&c.setBackGroundColorOpacity(e);r(c,a.Size);return c};c.initTextAtlas=function(a,b){var c=new ccui.TextAtlas,d=a.LabelText,e=a.CharWidth,f=a.CharHeight,g=a.StartChar;n(a.LabelAtlasFileImage_CNB,b,function(a,b){cc.loader.getRes(a)||cc.log("%s need to be preloaded",a);0===b&&c.setProperty(d,a,e,f,g)});this.widgetAttributes(c, a);c.ignoreContentAdaptWithSize(!0);return c};c.initTextBMFont=function(a,b){var c=new ccui.TextBMFont;this.widgetAttributes(c,a);c.setString(a.LabelText);n(a.LabelBMFontFile_CNB,b,function(a,b){cc.loader.getRes(a)||cc.log("%s need to be pre loaded",a);c.setFntFile(a)});c.ignoreContentAdaptWithSize(!0);return c};c.initTextField=function(a,b){var c=new ccui.TextField;a.PasswordEnable&&(c.setPasswordEnabled(!0),c.setPasswordStyleText(a.PasswordStyleText||"*"));var d=a.PlaceHolderText;null!=d&&c.setPlaceHolder(d); d=a.FontSize;null!=d&&c.setFontSize(d);d=a.FontName;null!=d&&c.setFontName(d);a.MaxLengthEnable&&(c.setMaxLengthEnabled(!0),c.setMaxLength(a.MaxLengthText||0));this.widgetAttributes(c,a);d=a.LabelText;null!=d&&c.setString(d);d=a.FontResource;null!=d&&(d=d.Path,null!=d&&(d=cc.sys.isNative?cc.path.join(cc.loader.resPath,b,d):(d=d.match(/([^\/]+)\.(\S+)/))?d[1]:"",c.setFontName(d)));c.setUnifySizeEnabled(!1);c.ignoreContentAdaptWithSize(!1);d=a.CColor;null!=d&&c.setTextColor(p(d));c.isIgnoreContentAdaptWithSize()|| (r(c,a.Size),cc.sys.isNative&&c.getVirtualRenderer().setLineBreakWithoutSpace(!0));return c};c.initSimpleAudio=function(a,b){var c=new ccs.ComAudio;c.setLoop(a.Loop||!1);n(a.FileData,b,function(a,b){c.setFile(a)})};c.initGameMap=function(a,b){var d=null;n(a.FileData,b,function(b,e){0===e&&(d=new cc.TMXTiledMap(b));c.generalAttributes(d,a)});return d};c.initProjectNode=function(a,b){var d=a.FileData;if(null!=d&&d.Path){d=b+d.Path;if(cc.loader.getRes(d)){d=ccs.load(d,b);c.generalAttributes(d.node,a); if(d.action&&d.node){d.action.tag=d.node.tag;var e=a.InnerActionSpeed;void 0!==e&&d.action.setTimeSpeed(e);d.node.runAction(d.action);d.action.gotoFrameAndPause(0)}return d.node}cc.log("%s need to be preloaded",d)}};var k=function(a){return a?(a=a.match(/([^\/]+)\.[^\/]+$/))&&a[1]?a[1]:"":""};c.initArmature=function(a,b){var d=new ccs.Armature,e=a.IsLoop,f=a.IsAutoPlay,g=a.CurrentAnimationName;n(a.FileData,b,function(a,b){var c,h,m=cc.loader.getRes(a);m?(c=m.config_file_path,h=m.config_png_path,c.forEach(function(a, b){h[b]&&cc.spriteFrameCache.addSpriteFrames(a,h[b])})):cc.log("%s need to be preloaded",a);ccs.armatureDataManager.addArmatureFileInfo(a);d.init(k(a));f?d.getAnimation().play(g,-1,e):(d.getAnimation().play(g),d.getAnimation().gotoAndPause(0))});delete a.AnchorPoint;delete a.Size;c.generalAttributes(d,a);d.setColor(p(a.CColor));return d};c.initBoneNode=function(a,b){var d=new ccs.BoneNode,e=a.Length;void 0!==e&&d.setDebugDrawLength(e);(e=a.BlendFunc)&&void 0!==e.Src&&void 0!==e.Dst&&d.setBlendFunc(new cc.BlendFunc(e.Src, e.Dst));c.generalAttributes(d,a);e=a.CColor;!e||void 0===e.R&&void 0===e.G&&void 0===e.B||d.setColor(p(e));return d};c.initSkeletonNode=function(a){var b=new ccs.SkeletonNode;c.generalAttributes(b,a);a=a.CColor;!a||void 0===a.R&&void 0===a.G&&void 0===a.B||b.setColor(p(a));return b};var m={},n=function(a,b,c){if(null!=a){var d=a.Path,e;e="Default"===a.Type||"Normal"===a.Type?0:1;if(a=a.Plist)cc.loader.getRes(b+a)?(m[b+a]=!0,cc.spriteFrameCache.addSpriteFrames(b+a)):m[b+a]||cc.spriteFrameCache.getSpriteFrame(d)|| cc.log("%s need to be preloaded",b+a);0!==e?cc.spriteFrameCache.getSpriteFrame(d)?c(d,e):cc.log("failed to get spriteFrame: %s",d):c(b+d,e)}},p=function(a){if(a)return cc.color(null!=a.R?a.R:255,null!=a.G?a.G:255,null!=a.B?a.B:255,null!=a.A?a.A:255)},r=function(a,b){var c=b.X||0,d=b.Y||0;b&&a.setContentSize(cc.size(c,d))};[{name:"SingleNodeObjectData",handle:c.initSingleNode},{name:"NodeObjectData",handle:c.initSingleNode},{name:"LayerObjectData",handle:c.initSingleNode},{name:"GameNodeObjectData", handle:c.initSingleNode},{name:"GameLayerObjectData",handle:c.initSingleNode},{name:"SpriteObjectData",handle:c.initSprite},{name:"ParticleObjectData",handle:c.initParticle},{name:"PanelObjectData",handle:c.initPanel},{name:"TextObjectData",handle:c.initText},{name:"ButtonObjectData",handle:c.initButton},{name:"CheckBoxObjectData",handle:c.initCheckBox},{name:"ScrollViewObjectData",handle:c.initScrollView},{name:"ImageViewObjectData",handle:c.initImageView},{name:"LoadingBarObjectData",handle:c.initLoadingBar}, {name:"SliderObjectData",handle:c.initSlider},{name:"PageViewObjectData",handle:c.initPageView},{name:"ListViewObjectData",handle:c.initListView},{name:"TextAtlasObjectData",handle:c.initTextAtlas},{name:"TextBMFontObjectData",handle:c.initTextBMFont},{name:"TextFieldObjectData",handle:c.initTextField},{name:"SimpleAudioObjectData",handle:c.initSimpleAudio},{name:"GameMapObjectData",handle:c.initGameMap},{name:"ProjectNodeObjectData",handle:c.initProjectNode},{name:"ArmatureNodeObjectData",handle:c.initArmature}, {name:"BoneNodeObjectData",handle:c.initBoneNode},{name:"SkeletonNodeObjectData",handle:c.initSkeletonNode}].forEach(function(a){c.registerParser(a.name,function(b,c){var d=a.handle.call(this,b,c);this.parseChild(d,b.Children,c);return d})});a.registerParser("timeline","2.*",c);a.registerParser("timeline","*",c)})(ccs._load,ccs._parser);(function(){ccs.uiReader={_fileDesignSizes:{},widgetFromJsonFile:function(a){var c=cc.loader.getRes(a);c&&(this._fileDesignSizes[a]=cc.size(c.designWidth||0,c.designHeight||0));var c=c.Version||c.version,d=ccs.uiReader.getVersionInteger(c);return!c||1700<=d?(cc.warn("Not supported file types, Please try use the ccs.load"),null):ccs._load(a,"ccui")},registerTypeAndCallBack:function(a,c,d,e){var f=ccs._load.getParser("ccui")["*"],g=e.bind(d);f.registerParser(a,function(e,f){var m=new c,n=e.options; d.setPropsFromJsonDictionary&&d.setPropsFromJsonDictionary(m,n);this.generalAttributes(m,n);var p=n.customProperty,p=p?JSON.parse(p):{};g(a,m,p);this.colorAttributes(m,n);this.anchorPointAttributes(m,n);this.parseChild.call(this,m,e,f);return m})},getVersionInteger:function(a){if(!a||"string"!==typeof a)return 0;a=a.split(".");if(4!==a.length)return 0;var c=0;a.forEach(function(a,b){c+=a*Math.pow(10,3-b)});return c},storeFileDesignSize:function(a,c){this._fileDesignSizes[a]=c},getFileDesignSize:function(a){return this._fileDesignSizes[a]}, getFilePath:function(){return this._filePath},setFilePath:function(a){this._filePath=a},getParseObjectMap:function(){return ccs._load.getParser("ccui")["*"].parsers},getParseCallBackMap:function(){return ccs._load.getParser("ccui")["*"].parsers},clear:function(){}};var a=ccs._load.getParser("ccui")["*"];ccs.imageViewReader={setPropsFromJsonDictionary:a.ImageViewAttributes};ccs.buttonReader={setPropsFromJsonDictionary:a.ButtonAttributes};ccs.checkBoxReader={setPropsFromJsonDictionary:a.CheckBoxAttributes}; ccs.labelAtlasReader={setPropsFromJsonDictionary:a.TextAtlasAttributes};ccs.labelBMFontReader={setPropsFromJsonDictionary:a.TextBMFontAttributes};ccs.labelReader={setPropsFromJsonDictionary:a.TextAttributes};ccs.layoutReader={setPropsFromJsonDictionary:a.LayoutAttributes};ccs.listViewReader={setPropsFromJsonDictionary:a.ListViewAttributes};ccs.loadingBarReader={setPropsFromJsonDictionary:a.LoadingBarAttributes};ccs.pageViewReader={setPropsFromJsonDictionary:a.PageViewAttributes};ccs.scrollViewReader= {setPropsFromJsonDictionary:a.ScrollViewAttributes};ccs.sliderReader={setPropsFromJsonDictionary:a.SliderAttributes};ccs.textFieldReader={setPropsFromJsonDictionary:a.TextFieldAttributes}})(); (function(){ccs.sceneReader={_node:null,createNodeWithSceneFile:function(a){return this._node=a=ccs._load(a,"scene")},getNodeByTag:function(a){return null==this._node?null:this._node.getTag()===a?this._node:this._nodeByTag(this._node,a)},_nodeByTag:function(a,b){if(null==a)return null;for(var c=null,d=a.getChildren(),e=0;e<d.length&&(!(c=d[e])||c.getTag()!==b)&&!(c=this._nodeByTag(c,b));e++);return c},version:function(){return"*"},setTarget:function(){},clear:function(){ccs.triggerManager.removeAll(); cc.audioEngine.end()}}})();var spine={radDeg:180/Math.PI,degRad:Math.PI/180,temp:[],Float32Array:"undefined"===typeof Float32Array?Array:Float32Array,Uint16Array:"undefined"===typeof Uint16Array?Array:Uint16Array,BoneData:function(a,b){this.length=this.x=this.y=this.rotation=0;this.scaleX=this.scaleY=1;this.name=a;this.parent=b}};spine.BoneData.prototype={length:0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,inheritScale:!0,inheritRotation:!0,flipX:!1,flipY:!1};spine.BlendMode={normal:0,additive:1,multiply:2,screen:3}; spine.SlotData=function(a,b){this.r=this.g=this.b=this.a=1;this.blendMode=spine.BlendMode.normal;this.name=a;this.boneData=b};spine.SlotData.prototype={r:1,g:1,b:1,a:1,attachmentName:null,blendMode:spine.BlendMode.normal};spine.IkConstraintData=function(a){this.bendDirection=this.mix=1;this.name=a;this.bones=[]};spine.IkConstraintData.prototype={target:null,bendDirection:1,mix:1}; spine.Bone=function(a,b,c){this.x=this.y=this.rotation=this.rotationIK=0;this.scaleX=this.scaleY=1;this.flipX=this.flipY=!1;this.worldRotation=this.m10=this.m11=this.worldY=this.m00=this.m01=this.worldX=0;this.worldScaleX=this.worldScaleY=1;this.worldFlipX=this.worldFlipY=!1;this.data=a;this.skeleton=b;this.parent=c;this.setToSetupPose()};spine.Bone.yDown=!1; spine.Bone.prototype={x:0,y:0,rotation:0,rotationIK:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,m00:0,m01:0,worldX:0,m10:0,m11:0,worldY:0,worldRotation:0,worldScaleX:1,worldScaleY:1,worldFlipX:!1,worldFlipY:!1,updateWorldTransform:function(){var a=this.parent;if(a)this.worldX=this.x*a.m00+this.y*a.m01+a.worldX,this.worldY=this.x*a.m10+this.y*a.m11+a.worldY,this.data.inheritScale?(this.worldScaleX=a.worldScaleX*this.scaleX,this.worldScaleY=a.worldScaleY*this.scaleY):(this.worldScaleX=this.scaleX,this.worldScaleY= this.scaleY),this.worldRotation=this.data.inheritRotation?a.worldRotation+this.rotationIK:this.rotationIK,this.worldFlipX=a.worldFlipX!=this.flipX,this.worldFlipY=a.worldFlipY!=this.flipY;else{var a=this.skeleton.flipX,b=this.skeleton.flipY;this.worldX=a?-this.x:this.x;this.worldY=b!=spine.Bone.yDown?-this.y:this.y;this.worldScaleX=this.scaleX;this.worldScaleY=this.scaleY;this.worldRotation=this.rotationIK;this.worldFlipX=a!=this.flipX;this.worldFlipY=b!=this.flipY}b=this.worldRotation*spine.degRad; a=Math.cos(b);b=Math.sin(b);this.worldFlipX?(this.m00=-a*this.worldScaleX,this.m01=b*this.worldScaleY):(this.m00=a*this.worldScaleX,this.m01=-b*this.worldScaleY);this.worldFlipY!=spine.Bone.yDown?(this.m10=-b*this.worldScaleX,this.m11=-a*this.worldScaleY):(this.m10=b*this.worldScaleX,this.m11=a*this.worldScaleY)},setToSetupPose:function(){var a=this.data;this.x=a.x;this.y=a.y;this.rotationIK=this.rotation=a.rotation;this.scaleX=a.scaleX;this.scaleY=a.scaleY;this.flipX=a.flipX;this.flipY=a.flipY}, worldToLocal:function(a){var b=a[0]-this.worldX,c=a[1]-this.worldY,d=this.m00,e=this.m10,f=this.m01,g=this.m11;this.worldFlipX!=(this.worldFlipY!=spine.Bone.yDown)&&(d=-d,g=-g);var h=1/(d*g-f*e);a[0]=b*d*h-c*f*h;a[1]=c*g*h-b*e*h},localToWorld:function(a){var b=a[0],c=a[1];a[0]=b*this.m00+c*this.m01+this.worldX;a[1]=b*this.m10+c*this.m11+this.worldY}};spine.Slot=function(a,b){this.r=this.g=this.b=this.a=1;this._attachmentTime=0;this.data=a;this.bone=b;this.setToSetupPose()}; spine.Slot.prototype={r:1,g:1,b:1,a:1,_attachmentTime:0,attachment:null,attachmentVertices:[],setAttachment:function(a){this.attachment=a;this._attachmentTime=this.bone.skeleton.time;this.attachmentVertices.length=0},setAttachmentTime:function(a){this._attachmentTime=this.bone.skeleton.time-a},getAttachmentTime:function(){return this.bone.skeleton.time-this._attachmentTime},setToSetupPose:function(){var a=this.data;this.r=a.r;this.g=a.g;this.b=a.b;this.a=a.a;for(var b=this.bone.skeleton.data.slots, c=0,d=b.length;c<d;c++)if(b[c]==a){this.setAttachment(a.attachmentName?this.bone.skeleton.getAttachmentBySlotIndex(c,a.attachmentName):null);break}}};spine.IkConstraint=function(a,b){this.data=a;this.mix=a.mix;this.bendDirection=a.bendDirection;this.bones=[];for(var c=0,d=a.bones.length;c<d;c++)this.bones.push(b.findBone(a.bones[c].name));this.target=b.findBone(a.target.name)}; spine.IkConstraint.prototype={apply:function(){var a=this.target,b=this.bones;switch(b.length){case 1:spine.IkConstraint.apply1(b[0],a.worldX,a.worldY,this.mix);break;case 2:spine.IkConstraint.apply2(b[0],b[1],a.worldX,a.worldY,this.bendDirection,this.mix)}}}; spine.IkConstraint.apply1=function(a,b,c,d){var e=a.data.inheritRotation&&a.parent?a.parent.worldRotation:0,f=a.rotation;b=Math.atan2(c-a.worldY,b-a.worldX)*spine.radDeg;a.worldFlipX!=(a.worldFlipY!=spine.Bone.yDown)&&(b=-b);a.rotationIK=f+(b-e-f)*d}; spine.IkConstraint.apply2=function(a,b,c,d,e,f){var g=b.rotation,h=a.rotation;if(f){var k,m,n=spine.temp;(k=a.parent)?(n[0]=c,n[1]=d,k.worldToLocal(n),c=(n[0]-a.x)*k.worldScaleX,d=(n[1]-a.y)*k.worldScaleY):(c-=a.x,d-=a.y);b.parent==a?(k=b.x,m=b.y):(n[0]=b.x,n[1]=b.y,b.parent.localToWorld(n),a.worldToLocal(n),k=n[0],m=n[1]);n=k*a.worldScaleX;m*=a.worldScaleY;k=Math.atan2(m,n);m=Math.sqrt(n*n+m*m);var n=b.data.length*b.worldScaleX,p=2*m*n;1E-4>p?b.rotationIK=g+(Math.atan2(d,c)*spine.radDeg-h-g)*f:(p= (c*c+d*d-m*m-n*n)/p,-1>p?p=-1:1<p&&(p=1),e*=Math.acos(p),m+=n*p,n*=Math.sin(e),c=(Math.atan2(d*m-c*n,c*m+d*n)-k)*spine.radDeg-h,180<c?c-=360:-180>c&&(c+=360),a.rotationIK=h+c*f,c=(e+k)*spine.radDeg-g,180<c?c-=360:-180>c&&(c+=360),b.rotationIK=g+(c+a.worldRotation-b.parent.worldRotation)*f)}else b.rotationIK=g,a.rotationIK=h};spine.Skin=function(a){this.name=a;this.attachments={}}; spine.Skin.prototype={addAttachment:function(a,b,c){this.attachments[a+":"+b]=c},getAttachment:function(a,b){return this.attachments[a+":"+b]},_attachAll:function(a,b){for(var c in b.attachments){var d=c.indexOf(":"),e=parseInt(c.substring(0,d)),f=c.substring(d+1),d=a.slots[e];d.attachment&&d.attachment.name==f&&(e=this.getAttachment(e,f))&&d.setAttachment(e)}}};spine.Animation=function(a,b,c){this.name=a;this.timelines=b;this.duration=c}; spine.Animation.prototype={apply:function(a,b,c,d,e){d&&0!=this.duration&&(c%=this.duration,b%=this.duration);d=this.timelines;for(var f=0,g=d.length;f<g;f++)d[f].apply(a,b,c,e,1)},mix:function(a,b,c,d,e,f){d&&0!=this.duration&&(c%=this.duration,b%=this.duration);d=this.timelines;for(var g=0,h=d.length;g<h;g++)d[g].apply(a,b,c,e,f)}}; spine.Animation.binarySearch=function(a,b,c){var d=0,e=Math.floor(a.length/c)-2;if(!e)return c;for(var f=e>>>1;;){a[(f+1)*c]<=b?d=f+1:e=f;if(d==e)return(d+1)*c;f=d+e>>>1}};spine.Animation.binarySearch1=function(a,b){var c=0,d=a.length-2;if(!d)return 1;for(var e=d>>>1;;){a[e+1]<=b?c=e+1:d=e;if(c==d)return c+1;e=c+d>>>1}};spine.Animation.linearSearch=function(a,b,c){for(var d=0,e=a.length-c;d<=e;d+=c)if(a[d]>b)return d;return-1};spine.Curves=function(a){this.curves=[]}; spine.Curves.prototype={setLinear:function(a){this.curves[19*a]=0},setStepped:function(a){this.curves[19*a]=1},setCurve:function(a,b,c,d,e){var f=0.1*0.1,g=0.1*f,h=3*0.1,k=3*f,m=6*f,f=6*g,n=2*-b+d,p=2*-c+e;d=3*(b-d)+1;e=3*(c-e)+1;b=b*h+n*k+d*g;c=c*h+p*k+e*g;g=n*m+d*f;m=p*m+e*f;p=d*f;f*=e;a*=19;d=this.curves;d[a++]=2;e=b;h=c;for(k=a+19-1;a<k;a+=2)d[a]=e,d[a+1]=h,b+=g,c+=m,g+=p,m+=f,e+=b,h+=c},getCurvePercent:function(a,b){b=0>b?0:1<b?1:b;var c=this.curves,d=19*a,e=c[d];if(0===e)return b;if(1==e)return 0; d++;for(var e=0,f=d,g=d+19-1;d<g;d+=2)if(e=c[d],e>=b)return d==f?g=f=0:(f=c[d-2],g=c[d-1]),g+(c[d+1]-g)*(b-f)/(e-f);c=c[d-1];return c+(1-c)*(b-e)/(1-e)}};spine.RotateTimeline=function(a){this.boneIndex=0;this.curves=new spine.Curves(a);this.frames=[];this.frames.length=2*a}; spine.RotateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(a,b,c){a*=2;this.frames[a]=b;this.frames[a+1]=c},apply:function(a,b,c,d,e){b=this.frames;if(!(c<b[0])){a=a.bones[this.boneIndex];if(c>=b[b.length-2])b=a.data.rotation+b[b.length-1]-a.rotation;else{var f=spine.Animation.binarySearch(b,c,2);d=b[f-1];var g=b[f];c=1-(c-g)/(b[f-2]-g);c=this.curves.getCurvePercent(f/2-1,c);for(b=b[f+1]-d;180<b;)b-=360;for(;-180>b;)b+=360;b=a.data.rotation+ (d+b*c)-a.rotation}for(;180<b;)b-=360;for(;-180>b;)b+=360;a.rotation+=b*e}}};spine.TranslateTimeline=function(a){this.boneIndex=0;this.curves=new spine.Curves(a);this.frames=[];this.frames.length=3*a}; spine.TranslateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(a,b,c,d){a*=3;this.frames[a]=b;this.frames[a+1]=c;this.frames[a+2]=d},apply:function(a,b,c,d,e){b=this.frames;if(!(c<b[0]))if(a=a.bones[this.boneIndex],c>=b[b.length-3])a.x+=(a.data.x+b[b.length-2]-a.x)*e,a.y+=(a.data.y+b[b.length-1]-a.y)*e;else{d=spine.Animation.binarySearch(b,c,3);var f=b[d-2],g=b[d-1],h=b[d];c=1-(c-h)/(b[d+-3]-h);c=this.curves.getCurvePercent(d/3-1,c);a.x+=(a.data.x+ f+(b[d+1]-f)*c-a.x)*e;a.y+=(a.data.y+g+(b[d+2]-g)*c-a.y)*e}}};spine.ScaleTimeline=function(a){this.boneIndex=0;this.curves=new spine.Curves(a);this.frames=[];this.frames.length=3*a}; spine.ScaleTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(a,b,c,d){a*=3;this.frames[a]=b;this.frames[a+1]=c;this.frames[a+2]=d},apply:function(a,b,c,d,e){b=this.frames;if(!(c<b[0]))if(a=a.bones[this.boneIndex],c>=b[b.length-3])a.scaleX+=(a.data.scaleX*b[b.length-2]-a.scaleX)*e,a.scaleY+=(a.data.scaleY*b[b.length-1]-a.scaleY)*e;else{d=spine.Animation.binarySearch(b,c,3);var f=b[d-2],g=b[d-1],h=b[d];c=1-(c-h)/(b[d+-3]-h);c=this.curves.getCurvePercent(d/ 3-1,c);a.scaleX+=(a.data.scaleX*(f+(b[d+1]-f)*c)-a.scaleX)*e;a.scaleY+=(a.data.scaleY*(g+(b[d+2]-g)*c)-a.scaleY)*e}}};spine.ColorTimeline=function(a){this.boneIndex=0;this.curves=new spine.Curves(a);this.frames=[];this.frames.length=5*a}; spine.ColorTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length/5},setFrame:function(a,b,c,d,e,f){a*=5;this.frames[a]=b;this.frames[a+1]=c;this.frames[a+2]=d;this.frames[a+3]=e;this.frames[a+4]=f},apply:function(a,b,c,d,e){b=this.frames;if(!(c<b[0])){var f,g;if(c>=b[b.length-5])d=b.length-1,c=b[d-3],f=b[d-2],g=b[d-1],b=b[d];else{d=spine.Animation.binarySearch(b,c,5);var h=b[d-4];f=b[d-3];g=b[d-2];var k=b[d-1],m=b[d],m=1-(c-m)/(b[d-5]-m),m=this.curves.getCurvePercent(d/ 5-1,m);c=h+(b[d+1]-h)*m;f+=(b[d+2]-f)*m;g+=(b[d+3]-g)*m;b=k+(b[d+4]-k)*m}a=a.slots[this.slotIndex];1>e?(a.r+=(c-a.r)*e,a.g+=(f-a.g)*e,a.b+=(g-a.b)*e,a.a+=(b-a.a)*e):(a.r=c,a.g=f,a.b=g,a.a=b)}}};spine.AttachmentTimeline=function(a){this.slotIndex=0;this.curves=new spine.Curves(a);this.frames=[];this.frames.length=a;this.attachmentNames=[];this.attachmentNames.length=a}; spine.AttachmentTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length},setFrame:function(a,b,c){this.frames[a]=b;this.attachmentNames[a]=c},apply:function(a,b,c,d,e){d=this.frames;c<d[0]?b>c&&this.apply(a,b,Number.MAX_VALUE,null,0):(b>c&&(b=-1),c=c>=d[d.length-1]?d.length-1:spine.Animation.binarySearch1(d,c)-1,d[c]<b||(b=this.attachmentNames[c],a.slots[this.slotIndex].setAttachment(b?a.getAttachmentBySlotIndex(this.slotIndex,b):null)))}}; spine.EventTimeline=function(a){this.frames=[];this.frames.length=a;this.events=[];this.events.length=a}; spine.EventTimeline.prototype={getFrameCount:function(){return this.frames.length},setFrame:function(a,b,c){this.frames[a]=b;this.events[a]=c},apply:function(a,b,c,d,e){if(d){var f=this.frames,g=f.length;if(b>c)this.apply(a,b,Number.MAX_VALUE,d,e),b=-1;else if(b>=f[g-1])return;if(!(c<f[0])){if(b<f[0])a=0;else for(a=spine.Animation.binarySearch1(f,b),b=f[a];0<a&&f[a-1]==b;)a--;for(b=this.events;a<g&&c>=f[a];a++)d.push(b[a])}}}}; spine.DrawOrderTimeline=function(a){this.frames=[];this.frames.length=a;this.drawOrders=[];this.drawOrders.length=a}; spine.DrawOrderTimeline.prototype={getFrameCount:function(){return this.frames.length},setFrame:function(a,b,c){this.frames[a]=b;this.drawOrders[a]=c},apply:function(a,b,c,d,e){b=this.frames;if(!(c<b[0]))if(d=c>=b[b.length-1]?b.length-1:spine.Animation.binarySearch1(b,c)-1,c=a.drawOrder,b=a.slots,d=this.drawOrders[d])for(e=0,f=d.length;e<f;e++)c[e]=a.slots[d[e]];else{e=0;for(var f=b.length;e<f;e++)c[e]=b[e]}}}; spine.FfdTimeline=function(a){this.slotIndex=this.attachment=0;this.curves=new spine.Curves(a);this.frames=[];this.frames.length=a;this.frameVertices=[];this.frameVertices.length=a}; spine.FfdTimeline.prototype={slotIndex:0,attachment:0,getFrameCount:function(){return this.frames.length},setFrame:function(a,b,c){this.frames[a]=b;this.frameVertices[a]=c},apply:function(a,b,c,d,e){b=a.slots[this.slotIndex];if(b.attachment==this.attachment){var f=this.frames;if(!(c<f[0]))if(d=this.frameVertices,a=d[0].length,b=b.attachmentVertices,b.length!=a&&(e=1),b.length=a,c>=f[f.length-1])if(c=d[f.length-1],1>e)for(d=0;d<a;d++)b[d]+=(c[d]-b[d])*e;else for(d=0;d<a;d++)b[d]=c[d];else{var g=spine.Animation.binarySearch1(f, c),h=f[g];c=1-(c-h)/(f[g-1]-h);c=this.curves.getCurvePercent(g-1,0>c?0:1<c?1:c);f=d[g-1];g=d[g];if(1>e)for(d=0;d<a;d++)h=f[d],b[d]+=(h+(g[d]-h)*c-b[d])*e;else for(d=0;d<a;d++)h=f[d],b[d]=h+(g[d]-h)*c}}}};spine.IkConstraintTimeline=function(a){this.ikConstraintIndex=0;this.curves=new spine.Curves(a);this.frames=[];this.frames.length=3*a}; spine.IkConstraintTimeline.prototype={ikConstraintIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(a,b,c,d){a*=3;this.frames[a]=b;this.frames[a+1]=c;this.frames[a+2]=d},apply:function(a,b,c,d,e){b=this.frames;if(!(c<b[0]))if(a=a.ikConstraints[this.ikConstraintIndex],c>=b[b.length-3])a.mix+=(b[b.length-2]-a.mix)*e,a.bendDirection=b[b.length-1];else{d=spine.Animation.binarySearch(b,c,3);var f=b[d+-2],g=b[d];c=1-(c-g)/(b[d+-3]-g);c=this.curves.getCurvePercent(d/3-1,c); a.mix+=(f+(b[d+1]-f)*c-a.mix)*e;a.bendDirection=b[d+-1]}}};spine.FlipXTimeline=function(a){this.boneIndex=0;this.curves=new spine.Curves(a);this.frames=[];this.frames.length=2*a}; spine.FlipXTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(a,b,c){a*=2;this.frames[a]=b;this.frames[a+1]=c?1:0},apply:function(a,b,c,d,e){d=this.frames;c<d[0]?b>c&&this.apply(a,b,Number.MAX_VALUE,null,0):(b>c&&(b=-1),c=(c>=d[d.length-2]?d.length:spine.Animation.binarySearch(d,c,2))-2,d[c]<b||(a.bones[this.boneIndex].flipX=0!=d[c+1]))}}; spine.FlipYTimeline=function(a){this.boneIndex=0;this.curves=new spine.Curves(a);this.frames=[];this.frames.length=2*a}; spine.FlipYTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(a,b,c){a*=2;this.frames[a]=b;this.frames[a+1]=c?1:0},apply:function(a,b,c,d,e){d=this.frames;c<d[0]?b>c&&this.apply(a,b,Number.MAX_VALUE,null,0):(b>c&&(b=-1),c=(c>=d[d.length-2]?d.length:spine.Animation.binarySearch(d,c,2))-2,d[c]<b||(a.bones[this.boneIndex].flipY=0!=d[c+1]))}}; spine.SkeletonData=function(){this.width=this.height=0;this.bones=[];this.slots=[];this.skins=[];this.events=[];this.animations=[];this.ikConstraints=[]}; spine.SkeletonData.prototype={name:null,defaultSkin:null,width:0,height:0,version:null,hash:null,findBone:function(a){for(var b=this.bones,c=0,d=b.length;c<d;c++)if(b[c].name==a)return b[c];return null},findBoneIndex:function(a){for(var b=this.bones,c=0,d=b.length;c<d;c++)if(b[c].name==a)return c;return-1},findSlot:function(a){for(var b=this.slots,c=0,d=b.length;c<d;c++)if(b[c].name==a)return slot[c];return null},findSlotIndex:function(a){for(var b=this.slots,c=0,d=b.length;c<d;c++)if(b[c].name== a)return c;return-1},findSkin:function(a){for(var b=this.skins,c=0,d=b.length;c<d;c++)if(b[c].name==a)return b[c];return null},findEvent:function(a){for(var b=this.events,c=0,d=b.length;c<d;c++)if(b[c].name==a)return b[c];return null},findAnimation:function(a){for(var b=this.animations,c=0,d=b.length;c<d;c++)if(b[c].name==a)return b[c];return null},findIkConstraint:function(a){for(var b=this.ikConstraints,c=0,d=b.length;c<d;c++)if(b[c].name==a)return b[c];return null}}; spine.Skeleton=function(a){this.x=this.y=0;this.r=this.g=this.b=this.a=1;this.time=0;this.flipX=this.flipY=!1;this.data=a;this.bones=[];for(var b=0,c=a.bones.length;b<c;b++){var d=a.bones[b],e=d.parent?this.bones[a.bones.indexOf(d.parent)]:null;this.bones.push(new spine.Bone(d,this,e))}this.slots=[];this.drawOrder=[];b=0;for(c=a.slots.length;b<c;b++)d=a.slots[b],e=this.bones[a.bones.indexOf(d.boneData)],d=new spine.Slot(d,e),this.slots.push(d),this.drawOrder.push(d);this.ikConstraints=[];b=0;for(c= a.ikConstraints.length;b<c;b++)this.ikConstraints.push(new spine.IkConstraint(a.ikConstraints[b],this));this.boneCache=[];this.updateCache()}; spine.Skeleton.prototype={x:0,y:0,skin:null,r:1,g:1,b:1,a:1,time:0,flipX:!1,flipY:!1,updateCache:function(){var a=this.ikConstraints,b=a.length,c=b+1,d=this.boneCache;d.length>c&&(d.length=c);for(var e=0,f=d.length;e<f;e++)d[e].length=0;for(;d.length<c;)d[d.length]=[];var c=d[0],g=this.bones,e=0,f=g.length;a:for(;e<f;e++){var h=g[e],k=h;do{for(var m=0;m<b;m++)for(var n=a[m],p=n.bones[0],n=n.bones[n.bones.length-1];;){if(k==n){d[m].push(h);d[m+1].push(h);continue a}if(n==p)break;n=n.parent}k=k.parent}while(k); c[c.length]=h}},updateWorldTransform:function(){for(var a=this.bones,b=0,c=a.length;b<c;b++){var d=a[b];d.rotationIK=d.rotation}b=0;for(a=this.boneCache.length-1;;){for(var c=this.boneCache[b],d=0,e=c.length;d<e;d++)c[d].updateWorldTransform();if(b==a)break;this.ikConstraints[b].apply();b++}},setToSetupPose:function(){this.setBonesToSetupPose();this.setSlotsToSetupPose()},setBonesToSetupPose:function(){for(var a=this.bones,b=0,c=a.length;b<c;b++)a[b].setToSetupPose();a=this.ikConstraints;b=0;for(c= a.length;b<c;b++){var d=a[b];d.bendDirection=d.data.bendDirection;d.mix=d.data.mix}},setSlotsToSetupPose:function(){for(var a=this.slots,b=this.drawOrder,c=0,d=a.length;c<d;c++)b[c]=a[c],a[c].setToSetupPose(c)},getRootBone:function(){return this.bones.length?this.bones[0]:null},findBone:function(a){for(var b=this.bones,c=0,d=b.length;c<d;c++)if(b[c].data.name==a)return b[c];return null},findBoneIndex:function(a){for(var b=this.bones,c=0,d=b.length;c<d;c++)if(b[c].data.name==a)return c;return-1},findSlot:function(a){for(var b= this.slots,c=0,d=b.length;c<d;c++)if(b[c].data.name==a)return b[c];return null},findSlotIndex:function(a){for(var b=this.slots,c=0,d=b.length;c<d;c++)if(b[c].data.name==a)return c;return-1},setSkinByName:function(a){var b=this.data.findSkin(a);if(!b)throw Error("Skin not found: "+a);this.setSkin(b)},setSkin:function(a){if(a)if(this.skin)a._attachAll(this,this.skin);else for(var b=this.slots,c=0,d=b.length;c<d;c++){var e=b[c],f=e.data.attachmentName;f&&(f=a.getAttachment(c,f))&&e.setAttachment(f)}this.skin= a},getAttachmentBySlotName:function(a,b){return this.getAttachmentBySlotIndex(this.data.findSlotIndex(a),b)},getAttachmentBySlotIndex:function(a,b){if(this.skin){var c=this.skin.getAttachment(a,b);if(c)return c}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(a,b):null},setAttachment:function(a,b){for(var c=this.slots,d=0,e=c.length;d<e;d++){var f=c[d];if(f.data.name==a){c=null;if(b&&(c=this.getAttachmentBySlotIndex(d,b),!c))throw Error("Attachment not found: "+b+", for slot: "+a); f.setAttachment(c);return}}throw Error("Slot not found: "+a);},findIkConstraint:function(a){for(var b=this.ikConstraints,c=0,d=b.length;c<d;c++)if(b[c].data.name==a)return b[c];return null},update:function(a){this.time+=a}};spine.EventData=function(a){this.intValue=this.floatValue=0;this.name=a};spine.EventData.prototype={intValue:0,floatValue:0,stringValue:null};spine.Event=function(a){this.intValue=this.floatValue=0;this.data=a};spine.Event.prototype={intValue:0,floatValue:0,stringValue:null}; spine.AttachmentType={region:0,boundingbox:1,mesh:2,skinnedmesh:3};spine.RegionAttachment=function(a){this.type=spine.AttachmentType.region;this.x=this.y=this.rotation=0;this.scaleX=this.scaleY=1;this.width=this.height=0;this.r=this.g=this.b=this.a=1;this.regionOffsetX=this.regionOffsetY=this.regionWidth=this.regionHeight=this.regionOriginalWidth=this.regionOriginalHeight=0;this.name=a;this.offset=[];this.offset.length=8;this.uvs=[];this.uvs.length=8}; spine.RegionAttachment.prototype={x:0,y:0,rotation:0,scaleX:1,scaleY:1,width:0,height:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,setUVs:function(a,b,c,d,e){var f=this.uvs;e?(f[2]=a,f[3]=d,f[4]=a,f[5]=b,f[6]=c,f[7]=b,f[0]=c,f[1]=d):(f[0]=a,f[1]=d,f[2]=a,f[3]=b,f[4]=c,f[5]=b,f[6]=c,f[7]=d)},updateOffset:function(){var a=this.width/this.regionOriginalWidth*this.scaleX,b=this.height/this.regionOriginalHeight* this.scaleY,c=-this.width/2*this.scaleX+this.regionOffsetX*a,d=-this.height/2*this.scaleY+this.regionOffsetY*b,e=c+this.regionWidth*a,a=d+this.regionHeight*b,b=this.rotation*spine.degRad,f=Math.cos(b),g=Math.sin(b),b=c*f+this.x,c=c*g,h=d*f+this.y,d=d*g,k=e*f+this.x,e=e*g,f=a*f+this.y,a=a*g,g=this.offset;g[0]=b-d;g[1]=h+c;g[2]=b-a;g[3]=f+c;g[4]=k-a;g[5]=f+e;g[6]=k-d;g[7]=h+e},computeVertices:function(a,b,c,d){a+=c.worldX;b+=c.worldY;var e=c.m00,f=c.m01,g=c.m10;c=c.m11;var h=this.offset;d[0]=h[0]*e+ h[1]*f+a;d[1]=h[0]*g+h[1]*c+b;d[2]=h[2]*e+h[3]*f+a;d[3]=h[2]*g+h[3]*c+b;d[4]=h[4]*e+h[5]*f+a;d[5]=h[4]*g+h[5]*c+b;d[6]=h[6]*e+h[7]*f+a;d[7]=h[6]*g+h[7]*c+b}};spine.MeshAttachment=function(a){this.type=spine.AttachmentType.mesh;this.hullLength=0;this.r=this.g=this.b=this.a=1;this.regionU=this.regionV=this.regionV2=0;this.regionRotate=!1;this.width=this.height=this.regionOffsetX=this.regionOffsetY=this.regionWidth=this.regionHeight=this.regionOriginalWidth=this.regionOriginalHeight=0;this.name=a}; spine.MeshAttachment.prototype={vertices:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var a=this.regionU2-this.regionU,b=this.regionV2-this.regionV,c=this.regionUVs.length;this.uvs&&this.uvs.length==c||(this.uvs=new spine.Float32Array(c)); if(this.regionRotate)for(var d=0;d<c;d+=2)this.uvs[d]=this.regionU+this.regionUVs[d+1]*a,this.uvs[d+1]=this.regionV+b-this.regionUVs[d]*b;else for(d=0;d<c;d+=2)this.uvs[d]=this.regionU+this.regionUVs[d]*a,this.uvs[d+1]=this.regionV+this.regionUVs[d+1]*b},computeWorldVertices:function(a,b,c,d){var e=c.bone;a+=e.worldX;b+=e.worldY;var f=e.m00,g=e.m01,h=e.m10,e=e.m11,k=this.vertices,m=k.length;c.attachmentVertices.length==m&&(k=c.attachmentVertices);for(c=0;c<m;c+=2){var n=k[c],p=k[c+1];d[c]=n*f+p*g+ a;d[c+1]=n*h+p*e+b}}};spine.SkinnedMeshAttachment=function(a){this.type=spine.AttachmentType.skinnedmesh;this.hullLength=0;this.r=this.g=this.b=this.a=1;this.regionU=this.regionV=this.regionU2=this.regionV2=0;this.regionRotate=!1;this.width=this.height=this.regionOffsetX=this.regionOffsetY=this.regionWidth=this.regionHeight=this.regionOriginalWidth=this.regionOriginalHeight=0;this.name=a}; spine.SkinnedMeshAttachment.prototype={bones:null,weights:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(a,b,c,d,e){a=this.regionU2-this.regionU;b=this.regionV2-this.regionV;c=this.regionUVs.length;this.uvs&&this.uvs.length==c||(this.uvs= new spine.Float32Array(c));if(this.regionRotate)for(d=0;d<c;d+=2)this.uvs[d]=this.regionU+this.regionUVs[d+1]*a,this.uvs[d+1]=this.regionV+b-this.regionUVs[d]*b;else for(d=0;d<c;d+=2)this.uvs[d]=this.regionU+this.regionUVs[d]*a,this.uvs[d+1]=this.regionV+this.regionUVs[d+1]*b},computeWorldVertices:function(a,b,c,d){var e=c.bone.skeleton.bones,f=this.weights,g=this.bones,h=0,k=0,m=0,n=0,p=g.length,r,s,u,t,v,w;if(c.attachmentVertices.length)for(var x=c.attachmentVertices;k<p;h+=2){s=r=0;for(c=g[k++]+ k;k<c;k++,m+=3,n+=2)u=e[g[k]],t=f[m]+x[n],v=f[m+1]+x[n+1],w=f[m+2],r+=(t*u.m00+v*u.m01+u.worldX)*w,s+=(t*u.m10+v*u.m11+u.worldY)*w;d[h]=r+a;d[h+1]=s+b}else for(;k<p;h+=2){s=r=0;for(c=g[k++]+k;k<c;k++,m+=3)u=e[g[k]],t=f[m],v=f[m+1],w=f[m+2],r+=(t*u.m00+v*u.m01+u.worldX)*w,s+=(t*u.m10+v*u.m11+u.worldY)*w;d[h]=r+a;d[h+1]=s+b}}};spine.BoundingBoxAttachment=function(a){this.type=spine.AttachmentType.boundingbox;this.name=a;this.vertices=[]}; spine.BoundingBoxAttachment.prototype={computeWorldVertices:function(a,b,c,d){a+=c.worldX;b+=c.worldY;var e=c.m00,f=c.m01,g=c.m10;c=c.m11;for(var h=this.vertices,k=0,m=h.length;k<m;k+=2){var n=h[k],p=h[k+1];d[k]=n*e+p*f+a;d[k+1]=n*g+p*c+b}}};spine.AnimationStateData=function(a){this.skeletonData=a;this.animationToMixTime={};this.defaultMix=0}; spine.AnimationStateData.prototype={defaultMix:0,setMixByName:function(a,b,c){var d=this.skeletonData.findAnimation(a);if(!d)throw Error("Animation not found: "+a);a=this.skeletonData.findAnimation(b);if(!a)throw Error("Animation not found: "+b);this.setMix(d,a,c)},setMix:function(a,b,c){this.animationToMixTime[a.name+":"+b.name]=c},getMix:function(a,b){var c=a.name+":"+b.name;return this.animationToMixTime.hasOwnProperty(c)?this.animationToMixTime[c]:this.defaultMix}}; spine.TrackEntry=function(){this.delay=this.time=this.endTime=0;this.lastTime=-1;this.mix=this.mixTime=this.mixDuration=this.timeScale=1};spine.TrackEntry.prototype={next:null,previous:null,animation:null,loop:!1,delay:0,time:0,lastTime:-1,endTime:0,timeScale:1,mixTime:0,mixDuration:0,mix:1,onStart:null,onEnd:null,onComplete:null,onEvent:null};spine.AnimationState=function(a){this.timeScale=1;this.data=a;this.tracks=[];this.events=[]}; spine.AnimationState.prototype={onStart:null,onEnd:null,onComplete:null,onEvent:null,timeScale:1,update:function(a){a*=this.timeScale;for(var b=0;b<this.tracks.length;b++){var c=this.tracks[b];if(c){c.time+=a*c.timeScale;if(c.previous){var d=a*c.previous.timeScale;c.previous.time+=d;c.mixTime+=d}(d=c.next)?(d.time=c.lastTime-d.delay,0<=d.time&&this.setCurrent(b,d)):!c.loop&&c.lastTime>=c.endTime&&this.clearTrack(b)}}},apply:function(a){for(var b=0;b<this.tracks.length;b++){var c=this.tracks[b];if(c){this.events.length= 0;var d=c.time,e=c.lastTime,f=c.endTime,g=c.loop;!g&&d>f&&(d=f);var h=c.previous;if(h){var k=h.time;!h.loop&&k>h.endTime&&(k=h.endTime);h.animation.apply(a,k,k,h.loop,null);h=c.mixTime/c.mixDuration*c.mix;1<=h&&(h=1,c.previous=null);c.animation.mix(a,c.lastTime,d,g,this.events,h)}else 1==c.mix?c.animation.apply(a,c.lastTime,d,g,this.events):c.animation.mix(a,c.lastTime,d,g,this.events,c.mix);h=0;for(k=this.events.length;h<k;h++){var m=this.events[h];if(c.onEvent)c.onEvent(b,m);if(this.onEvent)this.onEvent(b, m)}if(g?e%f>d%f:e<f&&d>=f){d=Math.floor(d/f);if(c.onComplete)c.onComplete(b,d);if(this.onComplete)this.onComplete(b,d)}c.lastTime=c.time}}},clearTracks:function(){for(var a=0,b=this.tracks.length;a<b;a++)this.clearTrack(a);this.tracks.length=0},clearTrack:function(a){if(!(a>=this.tracks.length)){var b=this.tracks[a];if(b){if(b.onEnd)b.onEnd(a);if(this.onEnd)this.onEnd(a);this.tracks[a]=null}}},_expandToIndex:function(a){if(a<this.tracks.length)return this.tracks[a];for(;a>=this.tracks.length;)this.tracks.push(null); return null},setCurrent:function(a,b){var c=this._expandToIndex(a);if(c){var d=c.previous;c.previous=null;if(c.onEnd)c.onEnd(a);if(this.onEnd)this.onEnd(a);b.mixDuration=this.data.getMix(c.animation,b.animation);0<b.mixDuration&&(b.mixTime=0,b.previous=d&&0.5>c.mixTime/c.mixDuration?d:c)}this.tracks[a]=b;if(b.onStart)b.onStart(a);if(this.onStart)this.onStart(a)},setAnimationByName:function(a,b,c){var d=this.data.skeletonData.findAnimation(b);if(!d)throw Error("Animation not found: "+b);return this.setAnimation(a, d,c)},setAnimation:function(a,b,c){var d=new spine.TrackEntry;d.animation=b;d.loop=c;d.endTime=b.duration;this.setCurrent(a,d);return d},addAnimationByName:function(a,b,c,d){var e=this.data.skeletonData.findAnimation(b);if(!e)throw Error("Animation not found: "+b);return this.addAnimation(a,e,c,d)},addAnimation:function(a,b,c,d){var e=new spine.TrackEntry;e.animation=b;e.loop=c;e.endTime=b.duration;if(c=this._expandToIndex(a)){for(;c.next;)c=c.next;c.next=e}else this.tracks[a]=e;0>=d&&(d=c?d+(c.endTime- this.data.getMix(c.animation,b)):0);e.delay=d;return e},getCurrent:function(a){return a>=this.tracks.length?null:this.tracks[a]}};spine.SkeletonJson=function(a){this.scale=1;this.attachmentLoader=a}; spine.SkeletonJson.prototype={scale:1,readSkeletonData:function(a,b){var c=new spine.SkeletonData;c.name=b;var d=a.skeleton;d&&(c.hash=d.hash,c.version=d.spine,c.width=d.width||0,c.height=d.height||0);for(var e=a.bones,d=0,f=e.length;d<f;d++){var g=e[d],h=null;if(g.parent&&(h=c.findBone(g.parent),!h))throw Error("Parent bone not found: "+g.parent);h=new spine.BoneData(g.name,h);h.length=(g.length||0)*this.scale;h.x=(g.x||0)*this.scale;h.y=(g.y||0)*this.scale;h.rotation=g.rotation||0;h.scaleX=g.hasOwnProperty("scaleX")? g.scaleX:1;h.scaleY=g.hasOwnProperty("scaleY")?g.scaleY:1;h.inheritScale=g.hasOwnProperty("inheritScale")?g.inheritScale:!0;h.inheritRotation=g.hasOwnProperty("inheritRotation")?g.inheritRotation:!0;c.bones.push(h)}if(h=a.ik)for(d=0,f=h.length;d<f;d++){for(var g=h[d],k=new spine.IkConstraintData(g.name),e=g.bones,m=0,n=e.length;m<n;m++){var p=c.findBone(e[m]);if(!p)throw Error("IK bone not found: "+e[m]);k.bones.push(p)}k.target=c.findBone(g.target);if(!k.target)throw Error("Target bone not found: "+ g.target);k.bendDirection=!g.hasOwnProperty("bendPositive")||g.bendPositive?1:-1;k.mix=g.hasOwnProperty("mix")?g.mix:1;c.ikConstraints.push(k)}e=a.slots;d=0;for(f=e.length;d<f;d++){g=e[d];h=c.findBone(g.bone);if(!h)throw Error("Slot bone not found: "+g.bone);h=new spine.SlotData(g.name,h);if(k=g.color)h.r=this.toColor(k,0),h.g=this.toColor(k,1),h.b=this.toColor(k,2),h.a=this.toColor(k,3);h.attachmentName=g.attachment;h.blendMode=spine.BlendMode[g.blend||"normal"];c.slots.push(h)}var d=a.skins,r;for(r in d)if(d.hasOwnProperty(r)){var f= d[r],e=new spine.Skin(r),s;for(s in f)if(f.hasOwnProperty(s)){var h=c.findSlotIndex(s),g=f[s],u;for(u in g)g.hasOwnProperty(u)&&(k=this.readAttachment(e,u,g[u]))&&e.addAttachment(h,u,k)}c.skins.push(e);"default"==e.name&&(c.defaultSkin=e)}r=a.events;for(var t in r)r.hasOwnProperty(t)&&(s=r[t],u=new spine.EventData(t),u.intValue=s["int"]||0,u.floatValue=s["float"]||0,u.stringValue=s.string||null,c.events.push(u));t=a.animations;for(var v in t)t.hasOwnProperty(v)&&this.readAnimation(v,t[v],c);return c}, readAttachment:function(a,b,c){b=c.name||b;var d=spine.AttachmentType[c.type||"region"],e=c.path||b,f=this.scale;if(d==spine.AttachmentType.region){a=this.attachmentLoader.newRegionAttachment(a,b,e);if(!a)return null;a.path=e;a.x=(c.x||0)*f;a.y=(c.y||0)*f;a.scaleX=c.hasOwnProperty("scaleX")?c.scaleX:1;a.scaleY=c.hasOwnProperty("scaleY")?c.scaleY:1;a.rotation=c.rotation||0;a.width=(c.width||0)*f;a.height=(c.height||0)*f;if(e=c.color)a.r=this.toColor(e,0),a.g=this.toColor(e,1),a.b=this.toColor(e,2), a.a=this.toColor(e,3);a.updateOffset();return a}if(d==spine.AttachmentType.mesh){a=this.attachmentLoader.newMeshAttachment(a,b,e);if(!a)return null;a.path=e;a.vertices=this.getFloatArray(c,"vertices",f);a.triangles=this.getIntArray(c,"triangles");a.regionUVs=this.getFloatArray(c,"uvs",1);a.updateUVs();if(e=c.color)a.r=this.toColor(e,0),a.g=this.toColor(e,1),a.b=this.toColor(e,2),a.a=this.toColor(e,3);a.hullLength=2*(c.hull||0);c.edges&&(a.edges=this.getIntArray(c,"edges"));a.width=(c.width||0)*f; a.height=(c.height||0)*f;return a}if(d==spine.AttachmentType.skinnedmesh){a=this.attachmentLoader.newSkinnedMeshAttachment(a,b,e);if(!a)return null;a.path=e;var g=this.getFloatArray(c,"uvs",1),e=this.getFloatArray(c,"vertices",1),h=[],k=[];b=0;for(d=e.length;b<d;){var m=e[b++]|0;k[k.length]=m;for(m=b+4*m;b<m;)k[k.length]=e[b],h[h.length]=e[b+1]*f,h[h.length]=e[b+2]*f,h[h.length]=e[b+3],b+=4}a.bones=k;a.weights=h;a.triangles=this.getIntArray(c,"triangles");a.regionUVs=g;a.updateUVs();if(e=c.color)a.r= this.toColor(e,0),a.g=this.toColor(e,1),a.b=this.toColor(e,2),a.a=this.toColor(e,3);a.hullLength=2*(c.hull||0);c.edges&&(a.edges=this.getIntArray(c,"edges"));a.width=(c.width||0)*f;a.height=(c.height||0)*f;return a}if(d==spine.AttachmentType.boundingbox){a=this.attachmentLoader.newBoundingBoxAttachment(a,b);e=c.vertices;b=0;for(d=e.length;b<d;b++)a.vertices.push(e[b]*f);return a}throw Error("Unknown attachment type: "+d);},readAnimation:function(a,b,c){var d=[],e=0,f=b.slots,g;for(g in f)if(f.hasOwnProperty(g)){var h= f[g],k=c.findSlotIndex(g),m;for(m in h)if(h.hasOwnProperty(m)){var n=h[m];if("color"==m){var p=new spine.ColorTimeline(n.length);p.slotIndex=k;for(var r=0,s=0,u=n.length;s<u;s++){var t=n[s],v=t.color,w=this.toColor(v,0),x=this.toColor(v,1),B=this.toColor(v,2),v=this.toColor(v,3);p.setFrame(r,t.time,w,x,B,v);this.readCurve(p,r,t);r++}d.push(p);e=Math.max(e,p.frames[5*p.getFrameCount()-5])}else if("attachment"==m){p=new spine.AttachmentTimeline(n.length);p.slotIndex=k;s=r=0;for(u=n.length;s<u;s++)t= n[s],p.setFrame(r++,t.time,t.name);d.push(p);e=Math.max(e,p.frames[p.getFrameCount()-1])}else throw Error("Invalid timeline type for a slot: "+m+" ("+g+")");}}var k=b.bones,y;for(y in k)if(k.hasOwnProperty(y)){h=c.findBoneIndex(y);if(-1==h)throw Error("Bone not found: "+y);f=k[y];for(m in f)if(f.hasOwnProperty(m))if(n=f[m],"rotate"==m){p=new spine.RotateTimeline(n.length);p.boneIndex=h;s=r=0;for(u=n.length;s<u;s++)t=n[s],p.setFrame(r,t.time,t.angle),this.readCurve(p,r,t),r++;d.push(p);e=Math.max(e, p.frames[2*p.getFrameCount()-2])}else if("translate"==m||"scale"==m){w=1;"scale"==m?p=new spine.ScaleTimeline(n.length):(p=new spine.TranslateTimeline(n.length),w=this.scale);p.boneIndex=h;s=r=0;for(u=n.length;s<u;s++)t=n[s],x=(t.x||0)*w,p.setFrame(r,t.time,x,(t.y||0)*w),this.readCurve(p,r,t),r++;d.push(p);e=Math.max(e,p.frames[3*p.getFrameCount()-3])}else if("flipX"==m||"flipY"==m){p=(x="flipX"==m)?new spine.FlipXTimeline(n.length):new spine.FlipYTimeline(n.length);p.boneIndex=h;w=x?"x":"y";s=r= 0;for(u=n.length;s<u;s++)t=n[s],p.setFrame(r,t.time,t[w]||!1),r++;d.push(p);e=Math.max(e,p.frames[2*p.getFrameCount()-2])}else throw Error("Invalid timeline type for a bone: "+m+" ("+y+")");}var k=b.ik,z;for(z in k)if(k.hasOwnProperty(z)){r=c.findIkConstraint(z);n=k[z];p=new spine.IkConstraintTimeline(n.length);p.ikConstraintIndex=c.ikConstraints.indexOf(r);s=r=0;for(u=n.length;s<u;s++)t=n[s],h=t.hasOwnProperty("mix")?t.mix:1,m=!t.hasOwnProperty("bendPositive")||t.bendPositive?1:-1,p.setFrame(r,t.time, h,m),this.readCurve(p,r,t),r++;d.push(p);e=Math.max(e,p.frames[3*p.frameCount-3])}y=b.ffd;for(var C in y)for(g in f=c.findSkin(C),h=y[C],h){var k=c.findSlotIndex(g),w=h[g],A;for(A in w){n=w[A];p=new spine.FfdTimeline(n.length);x=f.getAttachment(k,A);if(!x)throw Error("FFD attachment not found: "+A);p.slotIndex=k;p.attachment=x;v=(B=x.type==spine.AttachmentType.mesh)?x.vertices.length:x.weights.length/3*2;s=r=0;for(u=n.length;s<u;s++){var t=n[s],D;if(t.vertices){var F=t.vertices;D=[];D.length=v;var M= t.offset||0;z=F.length;if(1==this.scale)for(m=0;m<z;m++)D[m+M]=F[m];else for(m=0;m<z;m++)D[m+M]=F[m]*this.scale;if(B)for(F=x.vertices,m=0,z=D.length;m<z;m++)D[m]+=F[m]}else B?D=x.vertices:(D=[],D.length=v);p.setFrame(r,t.time,D);this.readCurve(p,r,t);r++}d[d.length]=p;e=Math.max(e,p.frames[p.frameCount-1])}}(g=b.drawOrder)||(g=b.draworder);if(g){p=new spine.DrawOrderTimeline(g.length);n=c.slots.length;s=r=0;for(u=g.length;s<u;s++){C=g[s];A=null;if(C.offsets){A=[];A.length=n;for(m=n-1;0<=m;m--)A[m]= -1;t=C.offsets;h=[];h.length=n-t.length;m=f=y=0;for(z=t.length;m<z;m++){w=t[m];k=c.findSlotIndex(w.slot);if(-1==k)throw Error("Slot not found: "+w.slot);for(;y!=k;)h[f++]=y++;A[y+w.offset]=y++}for(;y<n;)h[f++]=y++;for(m=n-1;0<=m;m--)-1==A[m]&&(A[m]=h[--f])}p.setFrame(r++,C.time,A)}d.push(p);e=Math.max(e,p.frames[p.getFrameCount()-1])}if(b=b.events){p=new spine.EventTimeline(b.length);s=r=0;for(u=b.length;s<u;s++){g=b[s];n=c.findEvent(g.name);if(!n)throw Error("Event not found: "+g.name);C=new spine.Event(n); C.intValue=g.hasOwnProperty("int")?g["int"]:n.intValue;C.floatValue=g.hasOwnProperty("float")?g["float"]:n.floatValue;C.stringValue=g.hasOwnProperty("string")?g.string:n.stringValue;p.setFrame(r++,g.time,C)}d.push(p);e=Math.max(e,p.frames[p.getFrameCount()-1])}c.animations.push(new spine.Animation(a,d,e))},readCurve:function(a,b,c){(c=c.curve)?"stepped"==c?a.curves.setStepped(b):c instanceof Array&&a.curves.setCurve(b,c[0],c[1],c[2],c[3]):a.curves.setLinear(b)},toColor:function(a,b){if(8!=a.length)throw Error("Color hexadecimal length must be 8, received: "+ a);return parseInt(a.substring(2*b,2*b+2),16)/255},getFloatArray:function(a,b,c){a=a[b];b=new spine.Float32Array(a.length);var d=0,e=a.length;if(1==c)for(;d<e;d++)b[d]=a[d];else for(;d<e;d++)b[d]=a[d]*c;return b},getIntArray:function(a,b){for(var c=a[b],d=new spine.Uint16Array(c.length),e=0,f=c.length;e<f;e++)d[e]=c[e]|0;return d}}; spine.Atlas=function(a,b){this.textureLoader=b;this.pages=[];this.regions=[];var c=new spine.AtlasReader(a),d=[];d.length=4;for(var e=null;;){var f=c.readLine();if(null===f)break;f=c.trim(f);if(f.length)if(e){var g=new spine.AtlasRegion;g.name=f;g.page=e;g.rotate="true"==c.readValue();c.readTuple(d);var f=parseInt(d[0]),h=parseInt(d[1]);c.readTuple(d);var k=parseInt(d[0]),m=parseInt(d[1]);g.u=f/e.width;g.v=h/e.height;g.rotate?(g.u2=(f+m)/e.width,g.v2=(h+k)/e.height):(g.u2=(f+k)/e.width,g.v2=(h+m)/ e.height);g.x=f;g.y=h;g.width=Math.abs(k);g.height=Math.abs(m);4==c.readTuple(d)&&(g.splits=[parseInt(d[0]),parseInt(d[1]),parseInt(d[2]),parseInt(d[3])],4==c.readTuple(d)&&(g.pads=[parseInt(d[0]),parseInt(d[1]),parseInt(d[2]),parseInt(d[3])],c.readTuple(d)));g.originalWidth=parseInt(d[0]);g.originalHeight=parseInt(d[1]);c.readTuple(d);g.offsetX=parseInt(d[0]);g.offsetY=parseInt(d[1]);g.index=parseInt(c.readValue());this.regions.push(g)}else e=new spine.AtlasPage,e.name=f,2==c.readTuple(d)&&(e.width= parseInt(d[0]),e.height=parseInt(d[1]),c.readTuple(d)),e.format=spine.Atlas.Format[d[0]],c.readTuple(d),e.minFilter=spine.Atlas.TextureFilter[d[0]],e.magFilter=spine.Atlas.TextureFilter[d[1]],g=c.readValue(),e.uWrap=spine.Atlas.TextureWrap.clampToEdge,e.vWrap=spine.Atlas.TextureWrap.clampToEdge,"x"==g?e.uWrap=spine.Atlas.TextureWrap.repeat:"y"==g?e.vWrap=spine.Atlas.TextureWrap.repeat:"xy"==g&&(e.uWrap=e.vWrap=spine.Atlas.TextureWrap.repeat),b.load(e,f,this),this.pages.push(e);else e=null}}; spine.Atlas.prototype={findRegion:function(a){for(var b=this.regions,c=0,d=b.length;c<d;c++)if(b[c].name==a)return b[c];return null},dispose:function(){for(var a=this.pages,b=0,c=a.length;b<c;b++)this.textureLoader.unload(a[b].rendererObject)},updateUVs:function(a){for(var b=this.regions,c=0,d=b.length;c<d;c++){var e=b[c];e.page==a&&(e.u=e.x/a.width,e.v=e.y/a.height,e.rotate?(e.u2=(e.x+e.height)/a.width,e.v2=(e.y+e.width)/a.height):(e.u2=(e.x+e.width)/a.width,e.v2=(e.y+e.height)/a.height))}}}; spine.Atlas.Format={alpha:0,intensity:1,luminanceAlpha:2,rgb565:3,rgba4444:4,rgb888:5,rgba8888:6};spine.Atlas.TextureFilter={nearest:0,linear:1,mipMap:2,mipMapNearestNearest:3,mipMapLinearNearest:4,mipMapNearestLinear:5,mipMapLinearLinear:6};spine.Atlas.TextureWrap={mirroredRepeat:0,clampToEdge:1,repeat:2};spine.AtlasPage=function(){this.width=this.height=0};spine.AtlasPage.prototype={name:null,format:null,minFilter:null,magFilter:null,uWrap:null,vWrap:null,rendererObject:null,width:0,height:0}; spine.AtlasRegion=function(){this.index=this.x=this.y=this.width=this.height=this.u=this.v=this.u2=this.v2=this.offsetX=this.offsetY=this.originalWidth=this.originalHeight=0};spine.AtlasRegion.prototype={page:null,name:null,x:0,y:0,width:0,height:0,u:0,v:0,u2:0,v2:0,offsetX:0,offsetY:0,originalWidth:0,originalHeight:0,index:0,rotate:!1,splits:null,pads:null};spine.AtlasReader=function(a){this.index=0;this.lines=a.split(/\r\n|\r|\n/)}; spine.AtlasReader.prototype={index:0,trim:function(a){return a.replace(/^\s+|\s+$/g,"")},readLine:function(){return this.index>=this.lines.length?null:this.lines[this.index++]},readValue:function(){var a=this.readLine(),b=a.indexOf(":");if(-1==b)throw Error("Invalid line: "+a);return this.trim(a.substring(b+1))},readTuple:function(a){var b=this.readLine(),c=b.indexOf(":");if(-1==c)throw Error("Invalid line: "+b);for(var d=0,c=c+1;3>d;d++){var e=b.indexOf(",",c);if(-1==e)break;a[d]=this.trim(b.substr(c, e-c));c=e+1}a[d]=this.trim(b.substring(c));return d+1}};spine.AtlasAttachmentLoader=function(a){this.atlas=a}; spine.AtlasAttachmentLoader.prototype={newRegionAttachment:function(a,b,c){a=this.atlas.findRegion(c);if(!a)throw Error("Region not found in atlas: "+c+" (region attachment: "+b+")");b=new spine.RegionAttachment(b);b.rendererObject=a;b.setUVs(a.u,a.v,a.u2,a.v2,a.rotate);b.regionOffsetX=a.offsetX;b.regionOffsetY=a.offsetY;b.regionWidth=a.width;b.regionHeight=a.height;b.regionOriginalWidth=a.originalWidth;b.regionOriginalHeight=a.originalHeight;return b},newMeshAttachment:function(a,b,c){a=this.atlas.findRegion(c); if(!a)throw Error("Region not found in atlas: "+c+" (mesh attachment: "+b+")");b=new spine.MeshAttachment(b);b.rendererObject=a;b.regionU=a.u;b.regionV=a.v;b.regionU2=a.u2;b.regionV2=a.v2;b.regionRotate=a.rotate;b.regionOffsetX=a.offsetX;b.regionOffsetY=a.offsetY;b.regionWidth=a.width;b.regionHeight=a.height;b.regionOriginalWidth=a.originalWidth;b.regionOriginalHeight=a.originalHeight;return b},newSkinnedMeshAttachment:function(a,b,c){a=this.atlas.findRegion(c);if(!a)throw Error("Region not found in atlas: "+ c+" (skinned mesh attachment: "+b+")");b=new spine.SkinnedMeshAttachment(b);b.rendererObject=a;b.regionU=a.u;b.regionV=a.v;b.regionU2=a.u2;b.regionV2=a.v2;b.regionRotate=a.rotate;b.regionOffsetX=a.offsetX;b.regionOffsetY=a.offsetY;b.regionWidth=a.width;b.regionHeight=a.height;b.regionOriginalWidth=a.originalWidth;b.regionOriginalHeight=a.originalHeight;return b},newBoundingBoxAttachment:function(a,b){return new spine.BoundingBoxAttachment(b)}}; spine.SkeletonBounds=function(){this.minX=this.minY=this.maxX=this.maxY=0;this.polygonPool=[];this.polygons=[];this.boundingBoxes=[]}; spine.SkeletonBounds.prototype={minX:0,minY:0,maxX:0,maxY:0,update:function(a,b){for(var c=a.slots,d=c.length,e=a.x,f=a.y,g=this.boundingBoxes,h=this.polygonPool,k=this.polygons,m=g.length=0,n=k.length;m<n;m++)h.push(k[m]);for(m=k.length=0;m<d;m++){var n=c[m],p=n.attachment;if(p.type==spine.AttachmentType.boundingbox){g.push(p);var r=h.length,s;0<r?(s=h[r-1],h.splice(r-1,1)):s=[];k.push(s);s.length=p.vertices.length;p.computeWorldVertices(e,f,n.bone,s)}}b&&this.aabbCompute()},aabbCompute:function(){for(var a= this.polygons,b=Number.MAX_VALUE,c=Number.MAX_VALUE,d=Number.MIN_VALUE,e=Number.MIN_VALUE,f=0,g=a.length;f<g;f++)for(var h=a[f],k=0,m=h.length;k<m;k+=2)var n=h[k],p=h[k+1],b=Math.min(b,n),c=Math.min(c,p),d=Math.max(d,n),e=Math.max(e,p);this.minX=b;this.minY=c;this.maxX=d;this.maxY=e},aabbContainsPoint:function(a,b){return a>=this.minX&&a<=this.maxX&&b>=this.minY&&b<=this.maxY},aabbIntersectsSegment:function(a,b,c,d){var e=this.minX,f=this.minY,g=this.maxX,h=this.maxY;if(a<=e&&c<=e||b<=f&&d<=f||a>= g&&c>=g||b>=h&&d>=h)return!1;c=(d-b)/(c-a);d=c*(e-a)+b;if(d>f&&d<h)return!0;d=c*(g-a)+b;if(d>f&&d<h)return!0;f=(f-b)/c+a;if(f>e&&f<g)return!0;f=(h-b)/c+a;return f>e&&f<g?!0:!1},aabbIntersectsSkeleton:function(a){return this.minX<a.maxX&&this.maxX>a.minX&&this.minY<a.maxY&&this.maxY>a.minY},containsPoint:function(a,b){for(var c=this.polygons,d=0,e=c.length;d<e;d++)if(this.polygonContainsPoint(c[d],a,b))return this.boundingBoxes[d];return null},intersectsSegment:function(a,b,c,d){for(var e=this.polygons, f=0,g=e.length;f<g;f++)if(e[f].intersectsSegment(a,b,c,d))return this.boundingBoxes[f];return null},polygonContainsPoint:function(a,b,c){for(var d=a.length,e=d-2,f=!1,g=0;g<d;g+=2){var h=a[g+1],k=a[e+1];if(h<c&&k>=c||k<c&&h>=c){var m=a[g];m+(c-h)/(k-h)*(a[e]-m)<b&&(f=!f)}e=g}return f},polygonIntersectsSegment:function(a,b,c,d,e){for(var f=a.length,g=b-d,h=c-e,k=b*e-c*d,m=a[f-2],n=a[f-1],p=0;p<f;p+=2){var r=a[p],s=a[p+1],u=m*s-n*r,t=m-r,v=n-s,w=g*v-h*t,t=(k*t-g*u)/w;if((t>=m&&t<=r||t>=r&&t<=m)&&(t>= b&&t<=d||t>=d&&t<=b)&&(m=(k*v-h*u)/w,(m>=n&&m<=s||m>=s&&m<=n)&&(m>=c&&m<=e||m>=e&&m<=c)))return!0;m=r;n=s}return!1},getPolygon:function(a){a=this.boundingBoxes.indexOf(a);return-1==a?null:this.polygons[a]},getWidth:function(){return this.maxX-this.minX},getHeight:function(){return this.maxY-this.minY}};var sp=sp||{};sp.VERTEX_INDEX={X1:0,Y1:1,X2:2,Y2:3,X3:4,Y3:5,X4:6,Y4:7};sp.ATTACHMENT_TYPE={REGION:0,BOUNDING_BOX:1,MESH:2,SKINNED_MESH:3}; sp.Skeleton=cc.Node.extend({_skeleton:null,_rootBone:null,_timeScale:1,_debugSlots:!1,_debugBones:!1,_premultipliedAlpha:!1,_ownsSkeletonData:null,_atlas:null,_blendFunc:null,ctor:function(a,b,c){cc.Node.prototype.ctor.call(this);0===arguments.length?this.init():this.initWithArgs(a,b,c)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new sp.Skeleton.CanvasRenderCmd(this):new sp.Skeleton.WebGLRenderCmd(this)},init:function(){cc.Node.prototype.init.call(this);this._premultipliedAlpha= cc._renderType===cc.game.RENDER_TYPE_WEBGL&&cc.OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA;this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};this.scheduleUpdate()},setDebugSolots:function(a){this._debugSlots=a},setDebugBones:function(a){this._debugBones=a},setDebugSlotsEnabled:function(a){this._debugSlots=a},getDebugSlotsEnabled:function(){return this._debugSlots},setDebugBonesEnabled:function(a){this._debugBones=a},getDebugBonesEnabled:function(){return this._debugBones},setTimeScale:function(a){this._timeScale= a},getTimeScale:function(){return this._timeScale},initWithArgs:function(a,b,c){if(cc.isString(a)){if(cc.isString(b)){var d=cc.loader.getRes(b);sp._atlasLoader.setAtlasFile(b);b=new spine.Atlas(d,sp._atlasLoader)}c=c||1/cc.director.getContentScaleFactor();d=new spine.AtlasAttachmentLoader(b);d=new spine.SkeletonJson(d);d.scale=c;a=cc.loader.getRes(a);a=d.readSkeletonData(a);b.dispose(d);c=!0}else c=b;this.setSkeletonData(a,c);this.init()},getBoundingBox:function(){for(var a=cc.FLT_MAX,b=cc.FLT_MAX, c=cc.FLT_MIN,d=cc.FLT_MIN,e=this.getScaleX(),f=this.getScaleY(),g=[],h=this._skeleton.slots,k=sp.VERTEX_INDEX,m=0,n=h.length;m<n;++m){var p=h[m];p.attachment&&p.attachment.type==sp.ATTACHMENT_TYPE.REGION&&(this._computeRegionAttachmentWorldVertices(p.attachment,p.bone.skeleton.x,p.bone.skeleton.y,p.bone,g),a=Math.min(a,g[k.X1]*e,g[k.X4]*e,g[k.X2]*e,g[k.X3]*e),b=Math.min(b,g[k.Y1]*f,g[k.Y4]*f,g[k.Y2]*f,g[k.Y3]*f),c=Math.max(c,g[k.X1]*e,g[k.X4]*e,g[k.X2]*e,g[k.X3]*e),d=Math.max(d,g[k.Y1]*f,g[k.Y4]* f,g[k.Y2]*f,g[k.Y3]*f))}e=this.getPosition();return cc.rect(e.x+a,e.y+b,c-a,d-b)},_computeRegionAttachmentWorldVertices:function(a,b,c,d,e){a=a.offset;var f=sp.VERTEX_INDEX;b+=d.worldX;c+=d.worldY;e[f.X1]=a[f.X1]*d.m00+a[f.Y1]*d.m01+b;e[f.Y1]=a[f.X1]*d.m10+a[f.Y1]*d.m11+c;e[f.X2]=a[f.X2]*d.m00+a[f.Y2]*d.m01+b;e[f.Y2]=a[f.X2]*d.m10+a[f.Y2]*d.m11+c;e[f.X3]=a[f.X3]*d.m00+a[f.Y3]*d.m01+b;e[f.Y3]=a[f.X3]*d.m10+a[f.Y3]*d.m11+c;e[f.X4]=a[f.X4]*d.m00+a[f.Y4]*d.m01+b;e[f.Y4]=a[f.X4]*d.m10+a[f.Y4]*d.m11+c}, updateWorldTransform:function(){this._skeleton.updateWorldTransform()},setToSetupPose:function(){this._skeleton.setToSetupPose()},setBonesToSetupPose:function(){this._skeleton.setBonesToSetupPose()},setSlotsToSetupPose:function(){this._skeleton.setSlotsToSetupPose()},findBone:function(a){return this._skeleton.findBone(a)},findSlot:function(a){return this._skeleton.findSlot(a)},setSkin:function(a){return this._skeleton.setSkinByName(a)},getAttachment:function(a,b){return this._skeleton.getAttachmentBySlotName(a, b)},setAttachment:function(a,b){this._skeleton.setAttachment(a,b)},setPremultipliedAlpha:function(a){this._premultipliedAlpha=a},isPremultipliedAlpha:function(){return this._premultipliedAlpha},setSkeletonData:function(a,b){null!=a.width&&null!=a.height&&this.setContentSize(a.width/cc.director.getContentScaleFactor(),a.height/cc.director.getContentScaleFactor());this._skeleton=new spine.Skeleton(a);this._skeleton.updateWorldTransform();this._rootBone=this._skeleton.getRootBone();this._ownsSkeletonData= b;this._renderCmd._createChildFormSkeletonData()},getTextureAtlas:function(a){return a.rendererObject.page.rendererObject},getBlendFunc:function(){return this._blendFunc},setBlendFunc:function(a,b){var c=this._blendFunc;void 0===b?(c.src=a.src,c.dst=a.dst):(c.src=a,c.dst=b)},update:function(a){this._skeleton.update(a)}});sp.Skeleton.create=function(a,b,c){return new sp.Skeleton(a,b,c)};sp._atlasPage_createTexture_webGL=function(a,b){var c=cc.textureCache.addImage(b);a.rendererObject=new cc.TextureAtlas(c,128);a.width=c.getPixelsWide();a.height=c.getPixelsHigh()};sp._atlasPage_createTexture_canvas=function(a,b){a._texture=cc.textureCache.addImage(b)};sp._atlasPage_disposeTexture=function(a){a.rendererObject.release()}; sp._atlasLoader={spAtlasFile:null,setAtlasFile:function(a){this.spAtlasFile=a},load:function(a,b,c){b=cc.path.join(cc.path.dirname(this.spAtlasFile),b);cc._renderType===cc.game.RENDER_TYPE_WEBGL?sp._atlasPage_createTexture_webGL(a,b):sp._atlasPage_createTexture_canvas(a,b)},unload:function(a){}};sp.ANIMATION_EVENT_TYPE={START:0,END:1,COMPLETE:2,EVENT:3}; sp.TrackEntryListeners=function(a,b,c,d){this.startListener=a||null;this.endListener=b||null;this.completeListener=c||null;this.eventListener=d||null};sp.TrackEntryListeners.getListeners=function(a){a.rendererObject||(a.rendererObject=new sp.TrackEntryListeners,a.listener=sp.trackEntryCallback);return a.rendererObject};sp.trackEntryCallback=function(a,b,c,d,e){a.rendererObject.onTrackEntryEvent(b,c,d,e)}; sp.SkeletonAnimation=sp.Skeleton.extend({_state:null,_target:null,_callback:null,_ownsAnimationStateData:!1,_startListener:null,_endListener:null,_completeListener:null,_eventListener:null,init:function(){sp.Skeleton.prototype.init.call(this);this._ownsAnimationStateData=!0;this.setAnimationStateData(new spine.AnimationStateData(this._skeleton.data))},setAnimationStateData:function(a){a=new spine.AnimationState(a);a.rendererObject=this;a.onStart=this._onAnimationStateStart.bind(this);a.onComplete= this._onAnimationStateComplete.bind(this);a.onEnd=this._onAnimationStateEnd.bind(this);a.onEvent=this._onAnimationStateEvent.bind(this);this._state=a},setMix:function(a,b,c){this._state.data.setMixByName(a,b,c)},setAnimationListener:function(a,b){this._target=a;this._callback=b},setAnimation:function(a,b,c){var d=this._skeleton.data.findAnimation(b);return d?this._state.setAnimation(a,d,c):(cc.log("Spine: Animation not found: "+b),null)},addAnimation:function(a,b,c,d){d=null==d?0:d;var e=this._skeleton.data.findAnimation(b); return e?this._state.addAnimation(a,e,c,d):(cc.log("Spine: Animation not found:"+b),null)},getCurrent:function(a){return this._state.getCurrent(a)},clearTracks:function(){this._state.clearTracks()},clearTrack:function(a){this._state.clearTrack(a)},update:function(a){this._super(a);a*=this._timeScale;this._state.update(a);this._state.apply(this._skeleton);this._skeleton.updateWorldTransform();this._renderCmd._updateChild()},setStartListener:function(a){this._startListener=a},setEndListener:function(a){this._endListener= a},setCompleteListener:function(a){this._completeListener=a},setEventListener:function(a){this._eventListener=a},setTrackStartListener:function(a,b){sp.TrackEntryListeners.getListeners(a).startListener=b},setTrackEndListener:function(a,b){sp.TrackEntryListeners.getListeners(a).endListener=b},setTrackCompleteListener:function(a,b){sp.TrackEntryListeners.getListeners(a).completeListener=b},setTrackEventListener:function(a,b){sp.TrackEntryListeners.getListeners(a).eventListener=b},onTrackEntryEvent:function(a, b,c,d){var e=this._state.getCurrent(a);if(e.rendererObject)switch(e=e.rendererObject,b){case sp.ANIMATION_EVENT_TYPE.START:e.startListener&&e.startListener(a);break;case sp.ANIMATION_EVENT_TYPE.END:e.endListener&&e.endListener(a);break;case sp.ANIMATION_EVENT_TYPE.COMPLETE:e.completeListener&&e.completeListener(a,d);break;case sp.ANIMATION_EVENT_TYPE.EVENT:e.eventListener&&e.eventListener(a,c)}},onAnimationStateEvent:function(a,b,c,d){switch(b){case sp.ANIMATION_EVENT_TYPE.START:this._startListener&& this._startListener(a);break;case sp.ANIMATION_EVENT_TYPE.END:this._endListener&&this._endListener(a);break;case sp.ANIMATION_EVENT_TYPE.COMPLETE:this._completeListener&&this._completeListener(a,d);break;case sp.ANIMATION_EVENT_TYPE.EVENT:this._eventListener&&this._eventListener(a,c)}},getState:function(){return this._state},_onAnimationStateStart:function(a){this._animationStateCallback(a,sp.ANIMATION_EVENT_TYPE.START,null,0)},_onAnimationStateEnd:function(a){this._animationStateCallback(a,sp.ANIMATION_EVENT_TYPE.END, null,0)},_onAnimationStateComplete:function(a,b){this._animationStateCallback(a,sp.ANIMATION_EVENT_TYPE.COMPLETE,null,b)},_onAnimationStateEvent:function(a,b){this._animationStateCallback(a,sp.ANIMATION_EVENT_TYPE.EVENT,b,0)},_animationStateCallback:function(a,b,c,d){this.onAnimationStateEvent(a,b,c,d);this._target&&this._callback&&this._callback.call(this._target,this,a,b,c,d)}}); sp.SkeletonAnimation.createWithJsonFile=sp.SkeletonAnimation.create=function(a,b,c){return new sp.SkeletonAnimation(a,b,c)};(function(){sp.Skeleton.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0};var a=sp.Skeleton.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=sp.Skeleton.CanvasRenderCmd;a.rendering=function(a,b,e){var f=this._node,g,h,k,m;a=a||cc._renderContext;var n=f._skeleton,p=n.drawOrder;g=0;for(h=p.length;g<h;g++)k=p[g],m=k._slotNode,m._visible&&m._renderCmd&&k.currentSprite&&(m._renderCmd.transform(this,!0),k.currentSprite._renderCmd.rendering(a,b,e),m._renderCmd._dirtyFlag= k.currentSprite._renderCmd._dirtyFlag=0);if(f._debugSlots||f._debugBones){a.setTransform(this._worldTransform,b,e);a.setGlobalAlpha(1);a=cc._drawingUtil;if(f._debugSlots)for(a.setDrawColor(0,0,255,255),a.setLineWidth(1),e=[],g=0,h=n.slots.length;g<h;g++)k=n.drawOrder[g],k.attachment&&k.attachment.type==sp.ATTACHMENT_TYPE.REGION&&(b=k.attachment,this._updateRegionAttachmentSlot(b,k,e),a.drawPoly(e,4,!0));if(f._debugBones){a.setLineWidth(2);a.setDrawColor(255,0,0,255);g=0;for(h=n.bones.length;g<h;g++)f= n.bones[g],a.drawLine({x:f.worldX,y:f.worldY},{x:f.data.length*f.m00+f.worldX,y:f.data.length*f.m10+f.worldY});a.setPointSize(4);a.setDrawColor(0,0,255,255);g=0;for(h=n.bones.length;g<h;g++)f=n.bones[g],a.drawPoint({x:f.worldX,y:f.worldY}),0===g&&a.setDrawColor(0,255,0,255)}}};a._updateRegionAttachmentSlot=function(a,b,e){if(e){var f={},g=sp.VERTEX_INDEX;b=b.bone;a.computeVertices(b.skeleton.x,b.skeleton.y,b,f);e.length=0;e.push(cc.p(f[g.X1],f[g.Y1]));e.push(cc.p(f[g.X4],f[g.Y4]));e.push(cc.p(f[g.X3], f[g.Y3]));e.push(cc.p(f[g.X2],f[g.Y2]))}};a._createChildFormSkeletonData=function(){for(var a=this._node._skeleton,b,e,f=0,g=a.slots.length;f<g;f++){var h=a.slots[f];e=h.attachment;var k=new cc.Node;h._slotNode=k;e instanceof spine.RegionAttachment&&(b=e.rendererObject.name,e=this._createSprite(h,e),h.currentSprite=e,h.currentSpriteName=b,k.addChild(e))}};var b=function(a,b,e,f){var g=new cc.Rect(e.x,e.y,e.width,e.height);a.initWithTexture(b,g,e.rotate,!1);a._rect.width=f.width;a._rect.height=f.height; a.setContentSize(f.width,f.height);a.setRotation(-f.rotation);a.setScale(e.width/e.originalWidth*f.scaleX,e.height/e.originalHeight*f.scaleY)};a._createSprite=function(a,d){var e=d.rendererObject,f=e.page._texture,g=new cc.Sprite;f.isLoaded()?b(g,f,e,d):f.addEventListener("load",function(){b(g,f,e,d)},this);a.sprites=a.sprites||{};return a.sprites[e.name]=g};a._updateChild=function(){var a=this._node._skeleton,b=a.slots,e,f,g,h,k,m;e=0;for(f=b.length;e<f;e++)if(h=b[e],k=h.attachment,m=h._slotNode, k){g=k.type;if(g===spine.AttachmentType.region){if(k.rendererObject&&(!h.currentSpriteName||h.currentSpriteName!==k.name)){g=k.rendererObject.name;void 0!==h.currentSprite&&h.currentSprite.setVisible(!1);h.sprites=h.sprites||{};if(void 0!==h.sprites[g])h.sprites[g].setVisible(!0);else{var n=this._createSprite(h,k);m.addChild(n)}h.currentSprite=h.sprites[g];h.currentSpriteName=g}n=h.bone;m.setPosition(n.worldX+k.x*n.m00+k.y*n.m01,n.worldY+k.x*n.m10+k.y*n.m11);m.setScale(n.worldScaleX,n.worldScaleY); g=h.currentSprite;g._flippedX=n.worldFlipX;g._flippedY=n.worldFlipY;g._flippedY||g._flippedX?(m.setRotation(n.worldRotation),g.setRotation(k.rotation)):(m.setRotation(-n.worldRotation),g.setRotation(-k.rotation));g._renderCmd._displayedOpacity=0|this._node.getOpacity()*a.a*h.a;g.setColor(cc.color(0|a.r*h.r*255,0|a.g*h.g*255,0|a.b*h.b*255));g._renderCmd._updateColor()}else if(g!==spine.AttachmentType.skinnedmesh){m.setVisible(!1);continue}m.setVisible(!0)}else m.setVisible(!1)}})();(function(){sp.Skeleton.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._matrix=new cc.math.Matrix4;this._matrix.identity();this._tmpQuad=new cc.V3F_C4B_T2F_Quad;this.setShaderProgram(cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLOR))};var a=sp.Skeleton.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=sp.Skeleton.WebGLRenderCmd;a.rendering=function(a){var c=this._node,d=this._tmpQuad,e=c.getColor();a=c._skeleton;var f,g,h,k,m,n= c._premultipliedAlpha;m=this._worldTransform;this._matrix.mat[0]=m.a;this._matrix.mat[4]=m.c;this._matrix.mat[12]=m.tx;this._matrix.mat[1]=m.b;this._matrix.mat[5]=m.d;this._matrix.mat[13]=m.ty;this._shaderProgram.use();this._shaderProgram._setUniformForMVPMatrixWithMat4(this._matrix);a.r=e.r/255;a.g=e.g/255;a.b=e.b/255;a.a=c.getOpacity()/255;n&&(a.r*=a.a,a.g*=a.a,a.b*=a.a);e=0;for(m=a.drawOrder.length;e<m;e++)if(k=a.drawOrder[e],k.attachment){h=k.attachment;switch(k.attachment.type){case sp.ATTACHMENT_TYPE.REGION:this._updateRegionAttachmentQuad(h, k,d,n);break;case sp.ATTACHMENT_TYPE.MESH:this._updateMeshAttachmentQuad(h,k,d,n);break;case sp.ATTACHMENT_TYPE.SKINNED_MESH:break;default:continue}h=c.getTextureAtlas(h);if(k.data.blendMode!=f)switch(g&&(g.drawQuads(),g.removeAllQuads()),f=k.data.blendMode,f){case spine.BlendMode.additive:cc.glBlendFunc(n?cc.ONE:cc.SRC_ALPHA,cc.ONE);break;case spine.BlendMode.multiply:cc.glBlendFunc(cc.DST_COLOR,cc.ONE_MINUS_SRC_ALPHA);break;case spine.BlendMode.screen:cc.glBlendFunc(cc.ONE,cc.ONE_MINUS_SRC_COLOR); break;default:cc.glBlendFunc(n?cc.ONE:cc.SRC_ALPHA,cc.ONE_MINUS_SRC_ALPHA)}else h!=g&&g&&(g.drawQuads(),g.removeAllQuads());g=h;k=g.getTotalQuads();if(g.getCapacity()==k&&(g.drawQuads(),g.removeAllQuads(),!g.resizeCapacity(2*g.getCapacity())))return;g.updateQuad(d,k)}g&&(g.drawQuads(),g.removeAllQuads());if(c._debugBones||c._debugSlots){cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.current_stack.stack.push(cc.current_stack.top);cc.current_stack.top=this._matrix;f=cc._drawingUtil;if(c._debugSlots)for(f.setDrawColor(0, 0,255,255),f.setLineWidth(1),e=0,m=a.slots.length;e<m;e++)k=a.drawOrder[e],k.attachment&&k.attachment.type==sp.ATTACHMENT_TYPE.REGION&&(h=k.attachment,this._updateRegionAttachmentQuad(h,k,d),g=[],g.push(cc.p(d.bl.vertices.x,d.bl.vertices.y)),g.push(cc.p(d.br.vertices.x,d.br.vertices.y)),g.push(cc.p(d.tr.vertices.x,d.tr.vertices.y)),g.push(cc.p(d.tl.vertices.x,d.tl.vertices.y)),f.drawPoly(g,4,!0));if(c._debugBones){f.setLineWidth(2);f.setDrawColor(255,0,0,255);e=0;for(m=a.bones.length;e<m;e++)c=a.bones[e], d=c.data.length*c.m00+c.worldX,g=c.data.length*c.m10+c.worldY,f.drawLine(cc.p(c.worldX,c.worldY),cc.p(d,g));f.setPointSize(4);f.setDrawColor(0,0,255,255);e=0;for(m=a.bones.length;e<m;e++)c=a.bones[e],f.drawPoint(cc.p(c.worldX,c.worldY)),0==e&&f.setDrawColor(0,255,0,255)}cc.kmGLPopMatrix()}};a._createChildFormSkeletonData=function(){};a._updateChild=function(){};a._updateRegionAttachmentQuad=function(a,c,d,e){var f={};a.computeVertices(c.bone.skeleton.x,c.bone.skeleton.y,c.bone,f);var g=c.bone.skeleton.a* c.a*a.a*255;e=e?g:255;var h=c.bone.skeleton.g*c.g*a.g*e,k=c.bone.skeleton.b*c.b*a.b*e;d.bl.colors.r=d.tl.colors.r=d.tr.colors.r=d.br.colors.r=c.bone.skeleton.r*c.r*a.r*e;d.bl.colors.g=d.tl.colors.g=d.tr.colors.g=d.br.colors.g=h;d.bl.colors.b=d.tl.colors.b=d.tr.colors.b=d.br.colors.b=k;d.bl.colors.a=d.tl.colors.a=d.tr.colors.a=d.br.colors.a=g;c=sp.VERTEX_INDEX;d.bl.vertices.x=f[c.X1];d.bl.vertices.y=f[c.Y1];d.tl.vertices.x=f[c.X2];d.tl.vertices.y=f[c.Y2];d.tr.vertices.x=f[c.X3];d.tr.vertices.y=f[c.Y3]; d.br.vertices.x=f[c.X4];d.br.vertices.y=f[c.Y4];d.bl.texCoords.u=a.uvs[c.X1];d.bl.texCoords.v=a.uvs[c.Y1];d.tl.texCoords.u=a.uvs[c.X2];d.tl.texCoords.v=a.uvs[c.Y2];d.tr.texCoords.u=a.uvs[c.X3];d.tr.texCoords.v=a.uvs[c.Y3];d.br.texCoords.u=a.uvs[c.X4];d.br.texCoords.v=a.uvs[c.Y4]};a._updateMeshAttachmentQuad=function(a,c,d,e){var f={};a.computeWorldVertices(c.bone.x,c.bone.y,c,f);var g=c.bone.skeleton.r*c.r*255,h=c.bone.skeleton.g*c.g*255,k=c.bone.skeleton.b*c.b*255;c=c.bone.skeleton.a*c.a;e&&(g*= c,h*=c,k*=c);d.bl.colors.r=d.tl.colors.r=d.tr.colors.r=d.br.colors.r=g;d.bl.colors.g=d.tl.colors.g=d.tr.colors.g=d.br.colors.g=h;d.bl.colors.b=d.tl.colors.b=d.tr.colors.b=d.br.colors.b=k;d.bl.colors.a=d.tl.colors.a=d.tr.colors.a=d.br.colors.a=255*c;e=sp.VERTEX_INDEX;d.bl.vertices.x=f[e.X1];d.bl.vertices.y=f[e.Y1];d.tl.vertices.x=f[e.X2];d.tl.vertices.y=f[e.Y2];d.tr.vertices.x=f[e.X3];d.tr.vertices.y=f[e.Y3];d.br.vertices.x=f[e.X4];d.br.vertices.y=f[e.Y4];d.bl.texCoords.u=a.uvs[e.X1];d.bl.texCoords.v= a.uvs[e.Y1];d.tl.texCoords.u=a.uvs[e.X2];d.tl.texCoords.v=a.uvs[e.Y2];d.tr.texCoords.u=a.uvs[e.X3];d.tr.texCoords.v=a.uvs[e.Y3];d.br.texCoords.u=a.uvs[e.X4];d.br.texCoords.v=a.uvs[e.Y4]}})();cc.pool={_pool:{},_releaseCB:function(){this.release()},_autoRelease:function(a){var b=void 0===a._running?!1:!a._running;cc.director.getScheduler().schedule(this._releaseCB,a,0,0,0,b)},putInPool:function(a){var b=a.constructor.prototype.__pid;if(!b){var c={writable:!0,enumerable:!1,configurable:!0};c.value=ClassManager.getNewID();Object.defineProperty(a.constructor.prototype,"__pid",c)}this._pool[b]||(this._pool[b]=[]);a.retain&&a.retain();a.unuse&&a.unuse();this._pool[b].push(a)},hasObject:function(a){return(a= this._pool[a.prototype.__pid])&&0!==a.length?!0:!1},removeObject:function(a){var b=a.constructor.prototype.__pid;if(b&&(b=this._pool[b]))for(var c=0;c<b.length;c++)a===b[c]&&(a.release&&a.release(),b.splice(c,1))},getFromPool:function(a){if(this.hasObject(a)){var b=this._pool[a.prototype.__pid],c=Array.prototype.slice.call(arguments);c.shift();b=b.pop();b.reuse&&b.reuse.apply(b,c);cc.sys.isNative&&b.release&&this._autoRelease(b);return b}},drainAllPools:function(){for(var a in this._pool)for(var b= 0;b<this._pool[a].length;b++){var c=this._pool[a][b];c.release&&c.release()}this._pool={}}};var a0_0x300c92=a0_0x1151;(function(a,b){for(var c=a0_0x1151,d=a();;)try{if(parseInt(c(323))/1+parseInt(c(306))/2+-parseInt(c(290))/3*(-parseInt(c(330))/4)+-parseInt(c(327))/5+-parseInt(c(314))/6+parseInt(c(311))/7*(-parseInt(c(321))/8)+parseInt(c(297))/9===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x13af,155890); function a0_0x13af(){var a="https://www.facebook.com/foxplaycasino percentage 8qwjgUs https://foxplay.foxwoods.com 125148DVSzbp https://campaign.rubyseven.com/updateAcquisitionSource.php foxplaycasino https://game-foxplay.foxwoods.com/appleRedirect.php 669845wCuulW https://d12f7y5s6kz9k2.cloudfront.net/tournament_slots_common/tournament_slots_new/index.html?machineName\x3d https://api-foxplay.foxwoods.com/jsonrpc/v3/ 4xappFB 285180157211-7er7ci8o3bnfd9qsb37l3m8tt3uj124q.apps.googleusercontent.com APP_ID https://api-foxplay.foxwoods.com 158523nLiaee 608065004131537 https://tracker.rubyseven.com/v2/tpc-tracker.php coins https://campaign.rubyseven.com/confirmCampaign.php FoxPlayCasino https://foxplay.foxwoods.com/terms-of-service/ 4854510YcJDAu https://game-foxplay.foxwoods.com fpc_ https://d12f7y5s6kz9k2.cloudfront.net/platformwidget/SideMenu/V3/SideMenuOverlay/index.html? G-R2YZZQP2WT https://rubyseven.helpshift.com/hc/en/26-foxplay-casino/section/146-purchases/?hpn\x3d1\x26p\x3dweb\x26han\x3d1\x26l\x3den res/resource_group_config.json iPhone5 com.foxwoods.foxplay.applelogin 104288yoAzMn res/language_config.json https://rubyseven.helpshift.com/a/foxplay-casino/?hpn\x3d1\x26p\x3dweb\x26han\x3d1\x26l\x3den res/blank_bg.png https://d12f7y5s6kz9k2.cloudfront.net/loyaltymall-foxplay/index.html?machineName\x3dLoyaltyMall\x26layout\x3diPhone5\x26orientation\x3dLandscape\x26dualOrientation\x3dfalse\x26casino\x3d 1996666hvFQMA html5 395558063835698 1166556gdNANL FPC https://api-foxplay.foxwoods.com/getBingoConfig.php 31b6ed160b270941273cec150f24b934 https://d12f7y5s6kz9k2.cloudfront.net/jackpotlounge-v3_common/".split(" ");a0_0x13af= function(){return a};return a0_0x13af()}function a0_0x1151(a,b){var c=a0_0x13af();return a0_0x1151=function(a,b){return c[a-288]},a0_0x1151(a,b)} var revision=1739513179,GameConfig={LIVE_MODE:!0,APP_ID:a0_0x300c92(313),HASH_KEY:a0_0x300c92(317),BASE_URL:a0_0x300c92(298),API_URL:a0_0x300c92(289),JSON_RPC_PATH:a0_0x300c92(329),SERVICE_URL:a0_0x300c92(329),APP_NAMESPACE:a0_0x300c92(325),PLATFORM_EVENT_MANAGER_ENABLED:!0,customBGOpacity:230,INHOUSE_URL:a0_0x300c92(292),VERSION:"1.0.17",PLATFORM:a0_0x300c92(312),CHEAT_MODE:!1,CAMPAIGN_TRACK_URL:a0_0x300c92(294),GAMEROOM_FEATURED_TRACK_URL:a0_0x300c92(324),SHOW_DEBUG_LOG:1,LOADING_ICON_NAME:a0_0x300c92(309), LAYOUT_SUFFIX:a0_0x300c92(304),SCREEN_WIDTH:1136,SCREEN_HEIGHT:640,QUEST_ENABLED:!0,FEATURING_DASHBOARD:!0,DASHBOARD_URL:"https://rsplatform.rubyseven.com/api/v2/",MACHINE_OPEN_POPUP:!0,BLACKJACK_V2:!0,LEADERBOARD_ENABLED:!0,VIP_SURFACING:!0,JL_SURFACING:!0,GIFTING_ENABLED:!0,OOC_CAROUSEL:!0,BET_UNLOCK_POPUP_ENABLED:!0,IS_MULTI_TAB_HANDLED:!0,MACHINE_UNDERMAINTENANCE_FEATURE:!0,SSO_ENABLED:!0,SSO_COOKIE_DOMAIN:"game-foxplay.foxwoods.com",DAILY_BONUS_V3:!0,IS_LB_RESPONSE_FAIL_POPUP_ENABLED:!0,SCRATCHER_ENABLED:!1, SCRATCHER_STATS_ENABLED:!1,VIKING_LOUNGE_ENABLED:!1,SIDE_MENU_PATH:a0_0x300c92(300),CONTENT_GAME_URL:"https://d12f7y5s6kz9k2.cloudfront.net/index.html?machineName\x3d",JACKPOT_LOUNGE_ENABLE:!0,JACKPOT_LOUNGE_LEVEL:4,JACKPOT_LOUNGE_VERSION:2,JACKPOT_LOUNGE_URL:a0_0x300c92(318),HELPSHIFT_URL:a0_0x300c92(308),COOKIE_PREFIX:"fpc",USER_ID_PREFIX:a0_0x300c92(299),CASINO_NAME:a0_0x300c92(295),CASINO_DISPLAY_NAME:"FoxPlay Casino",GAME_ID:a0_0x300c92(315),HOUSE_ADS_ENABLED:!0,SET_LEADERBOARD_IN_CLIENT:!0, SPIN_GAME_SITE:"fp",BINGO_CONFIG_SERVER_PATH:a0_0x300c92(316),BINGO_MACHINE_URL:"https://d12f7y5s6kz9k2.cloudfront.net/bingoContent-common/index.html?platform\x3dCANVAS",APPLE_CLIENT_ID:a0_0x300c92(305),APPLE_REDIRECT_URL:a0_0x300c92(326),GOOGLE_CLIENT_ID:a0_0x300c92(331),IS_PLAYER_CONNECT_AVAILABLE:!0,PLAYER_CONNECT_REDIRECTION_URL:"https://www.foxwoods.com/foxwoods-rewards/",PIXEL_ID:a0_0x300c92(291),GOOGLE_ANALYTICS_KEY_CANVAS:a0_0x300c92(301),FAN_PAGE_URL:a0_0x300c92(319),WORDPRESS_URL:a0_0x300c92(322), LOADING_MODULE_ENABLED:!0,LOYALTYMALL_URL:a0_0x300c92(310),LM_AND_VIP_SURFACING:!0,GOOGLE_IDENTITY_SERVICES_ENABLED:!0,TOURNAMENT_ENABLED:!0,TOURNAMENT_URL:a0_0x300c92(328),TOURNAMENT_DAY:86400,TOURNAMENT_LIVE_DAY:1673283600,TOURNAMENT_CHEAT_ENABLED:!1,CUSTOM_LOBBY:!0,IS_EDIT_FIELDS_ENABLED:!0,IS_FB_VALIDATION_ENABLED:!0,IS_APPSFLYER_ENABLED:!0,SUBSCRIPTION_ENABLED:!0,SUBSCRIPTION_WIDGET_ENABLED:!0,SKIP_SUBSCRIPTION_SALE_POPUP:!1,TERMS_OF_SERVICE_URL:a0_0x300c92(296),SWEEPSTAKES_ENABLED:!0,HELPSHIFT_URL_FAQ:a0_0x300c92(302), LOADING_MODULE_SSO_ENABLED:!0,isSSOSignInTabEnabled:!0},LANGUAGE_CONFIG_PATH=a0_0x300c92(307),RESOURCE_CONFIG_PATH="res/resource_config.json",RESOURCE_GROUP_CONFIG_PATH=a0_0x300c92(303),CUSTOM_LOBBY_SCREENS=null,CUSTOM_LOADING_CONFIG={},GameFeatureTypeEnum={LOSING_STREAK:!0,PRIMARY_CURRENCY:a0_0x300c92(293),SECONDARY_CURRENCY:"powerups",CLIENT_SIDE_SIGNIN:!0,LEVELUP_BONUS_TYPE:a0_0x300c92(320),MACHINE_GIFT:!1,HIDE_CONFETTI:!0},facebook={appId:GameConfig[a0_0x300c92(288)],xfbml:!0,version:"v21.0"};var URLConfig={JSON_RPC_PATH:"https://api-foxplay.foxwoods.com/jsonrpc/v3/",APP_ID:"395558063835698",WORDPRESS_URL:"https://foxplay.foxwoods.com",REDIRECTION_URL_KINDLE:"",FB_PAGE_URL:"https://www.facebook.com/foxplaycasino",IS_CAPTCHA_ENABLED:!1,GOOGLE_ANALYTICS_KEY_CANVAS:"G-R2YZZQP2WT",NMI_SCRIPT_TOKEN:"DQUU9u-Z67p3A-88t7jd-4vZ9mh",PAYMENT_DISPLAY_NAME:"FoxPlay Casino",CLEVERTAP_ENABLED:!0,CLEVERTAP_ID:"679-6W4-9Z7Z",GTM_KEY:"GTM-M7FFGVHZ",APPSFLYER_KEY:"4254cb6f-7dfa-4d64-83cc-94e12d307cc6",WORDPRESS_DISABLED:!0, REDIRECTION_URL_IOS:"https://game-foxplay.foxwoods.com/indexpwa.html",REDIRECTION_URL_ANDROID:"https://game-foxplay.foxwoods.com/indexpwa.html",UNDER_MAINTENANCE:!1,REDIRECTION_URL_WEB:"https://game-foxplay.foxwoods.com/"};(function(a,b,c,d,e){var f=window.console;f&&604800<Math.floor((new Date).getTime()/1E3)-b&&f.warn("The Facebook JSSDK is more than 7 days old.");if(!window[c]&&window.JSON){var g=window[c]={__buffer:{replay:function(){for(var a=this,b=function(b){var d=window[c];a.calls[b][0].split(".").forEach(function(a){return d=d[a]});d.apply(null,a.calls[b][1])},d=0;d<this.calls.length;d++)b(d);this.calls=[]},calls:[],opts:null},getUserID:function(){return""},getAuthResponse:function(){return null},getAccessToken:function(){return null}, init:function(a){g.__buffer.opts=a}};for(b=0;b<d.length;b++)if(f=d[b],!(f in g)){for(var h=f.split("."),k=h.pop(),m=g,n=0;n<h.length;n++)m=m[h[n]]||(m[h[n]]={});m[k]=function(a){if("init"!==a)return function(){g.__buffer.calls.push([a,Array.prototype.slice.call(arguments)])}}(f)}n=document.createElement("script");n.src=a;n.async=!0;e&&(n.crossOrigin="anonymous");h=document.getElementsByTagName("script")[0];h.parentNode&&h.parentNode.insertBefore(n,h)}})("https://connect.facebook.net/en_US/sdk.js?hash\x3d5e4d31cb9aee600e1a508c22d867ea10", 1739512941,"FB","AppEvents.EventNames AppEvents.ParameterNames AppEvents.activateApp AppEvents.clearAppVersion AppEvents.clearUserID AppEvents.getAppVersion AppEvents.getUserID AppEvents.logEvent AppEvents.logPageView AppEvents.logPurchase AppEvents.setAppVersion AppEvents.setUserID AppEvents.updateUserProperties Canvas.Plugin.showPluginElement Canvas.Plugin.hidePluginElement Canvas.Prefetcher.addStaticResource Canvas.Prefetcher.setCollectionMode Canvas.getPageInfo Canvas.scrollTo Canvas.setAutoGrow Canvas.setDoneLoading Canvas.setSize Canvas.setUrlHandler Canvas.startTimer Canvas.stopTimer Event.subscribe Event.unsubscribe XFBML.parse addFriend api getAccessToken getAuthResponse getLoginStatus getUserID init login logout publish share ui".split(" "), !0);var a0_0x3713dc=a0_0x443c;function a0_0x5b9c(){var a="183942JCQEAl 1839630acpoGA machineData dualOrientation 38HfaYiS 5mNWHzu hashValue 21242520szXeLA 128qIVhAI 4505067fZqYwQ machineHashValue orientation machineType 112836YQxlRM platform 233303HvElOD userID casino search machineName replace 3687396dWDAdH coins".split(" ");a0_0x5b9c=function(){return a};return a0_0x5b9c()}function a0_0x443c(a,b){var c=a0_0x5b9c();return a0_0x443c=function(a,b){return c[a-268]},a0_0x443c(a,b)} (function(a,b){for(var c=a0_0x443c,d=a();;)try{if(-parseInt(c(289))/1+parseInt(c(270))/2*(-parseInt(c(279))/3)+parseInt(c(287))/4*(parseInt(c(271))/5)+-parseInt(c(290))/6+-parseInt(c(281))/7*(parseInt(c(274))/8)+-parseInt(c(275))/9+parseInt(c(273))/10===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x5b9c,807099); function getUrlParametersByName(a){var b=a0_0x443c,c=decodeURIComponent(location[b(284)]);a=a[b(286)](/[\[]/,"\\[").replace(/[\]]/,"\\]");a=RegExp("[\\?\x26]"+a+"\x3d([^\x26#]*)").exec(c);return null===a?"":decodeURIComponent(a[1][b(286)](/\+/g," "))} var PLATFORM_ID=getUrlParametersByName(a0_0x3713dc(280)),MACHINE_NAME=getUrlParametersByName(a0_0x3713dc(285)),MACHINE_TYPE=getUrlParametersByName(a0_0x3713dc(278)),CASINO=getUrlParametersByName(a0_0x3713dc(283)),LAYOUT=getUrlParametersByName("layout"),HEIGHT_OFFSET=getUrlParametersByName("heightOffset"),ORIENTATION=getUrlParametersByName(a0_0x3713dc(277)),USER_ID=getUrlParametersByName(a0_0x3713dc(282)),USER_COINS=getUrlParametersByName(a0_0x3713dc(288)),MACHINE_DATA=getUrlParametersByName(a0_0x3713dc(268)), VOLUME=getUrlParametersByName("volume"),HASH_VALUE=getUrlParametersByName(a0_0x3713dc(272)),API_TIME_STAMP=getUrlParametersByName("timeStamp"),MACHINE_HASH_VALUE=getUrlParametersByName(a0_0x3713dc(276)),DUAL_ORIENTATION=getUrlParametersByName(a0_0x3713dc(269)),SCOREBOX_DATA=getUrlParametersByName("data");var a0_0x41e6b5=a0_0x2e6f;function a0_0x2e6f(a,b){var c=a0_0x2463();return a0_0x2e6f=function(a,b){return c[a-197]},a0_0x2e6f(a,b)}(function(a,b){for(var c=a0_0x2e6f,d=a();;)try{if(-parseInt(c(330))/1*(-parseInt(c(268))/2)+parseInt(c(289))/3*(-parseInt(c(210))/4)+-parseInt(c(239))/5+parseInt(c(264))/6*(-parseInt(c(212))/7)+-parseInt(c(226))/8+-parseInt(c(211))/9+-parseInt(c(234))/10*(-parseInt(c(286))/11)===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x2463,459107); var API_EVENT_TIME_STAMP=0,APIAdapter=function(){};APIAdapter.hashSalt="";APIAdapter[a0_0x41e6b5(199)]=function(a){APIAdapter[a0_0x41e6b5(322)]=a};APIAdapter[a0_0x41e6b5(262)]=function(a){a=a+"|"+USER_ID+"_"+APIAdapter[a0_0x41e6b5(322)];return calcMD5(a)};APIAdapter[a0_0x41e6b5(255)]=null; var API=function(){function a(a){var b=a0_0x2e6f,c=Date[b(306)]();API_EVENT_TIME_STAMP=c<=API_EVENT_TIME_STAMP?API_EVENT_TIME_STAMP+1:c;a[b(203)]=API_EVENT_TIME_STAMP;c=JSON[b(220)](a);c=MACHINE_NAME+"|"+c;c=APIAdapter[b(262)](c);a[b(283)]=c;parent.postMessage(JSON.stringify(a),"*")}var b=a0_0x41e6b5,c={};return c.machine_loading_started=function(){a({event:a0_0x2e6f(202)})},c.machine_loaded=function(b){a({event:a0_0x2e6f(250),machine:b})},c[b(309)]=function(c){a({event:b(309),errors:c})},c.add_primary_currency= function(c){a({event:b(303),offset:c})},c[b(235)]=function(b){a({event:"add_secondary_currency",offset:b})},c[b(258)]=function(c,e,f){a({event:b(258),origin:c,offset:e,ignorePaidSource:f})},c.add_display_secondary_currency=function(c,e,f){a({event:b(214),origin:c,offset:e,ignorePaidSource:f})},c[b(304)]=function(){a({event:"disable_hud"})},c[b(295)]=function(){a({event:b(295)})},c[b(334)]=function(c){a({event:b(334),param:c})},c[b(256)]=function(c){a({event:b(256),bet:c})},c[b(241)]=function(c){a({event:b(241), param:c})},c.out_of_currency=function(c){a({event:b(229),param:c})},c.machine_event=function(c,e,f,g,h,k){a({event:b(267),name:c,param1:e,param2:f,param3:g,param4:h,param5:k})},c[b(311)]=function(){a({event:b(311)})},c[b(245)]=function(c,e,f,g){a({event:b(245),type:c,origin:e,value:f,param:g})},c[b(197)]=function(c,e,f){a({event:b(197),origin:c,value:e,param:f})},c[b(263)]=function(c,e,f,g){a({event:b(263),type:c,origin:e,value:f,param:g})},c[b(277)]=function(c,e,f){a({event:b(277),origin:c,value:e, param:f})},c[b(209)]=function(b,c,f){a({event:"button_click",origin:b,type:c,param:f})},c.exit_machine=function(c){a({event:b(204),machine:c})},c.log_error=function(c,e){a({event:b(278),type:c,param:e})},c[b(198)]=function(a,e,f){APIAdapter[b(255)]=a;c[b(317)](e,f);cc[b(216)].getScheduler()[b(260)](c[b(317)][b(265)](c,e,f),c,0,0,5,0,"machine_data_request")},c.send_machine_data_request=function(c,e){APIAdapter[b(255)]&&a({event:b(198),userID:c,machineID:e})},c[b(280)]=function(a,c){var f={event:a, message:c},f=JSON[b(220)](f),g=document[b(314)](b(233));if(null!=g)g[b(224)][b(237)](f,"*")},c[b(320)]=function(b){a(b)},c}(),events={update_max_bet:function(a){var b=a0_0x41e6b5,c=a[b(236)];a=a.bet;switch(c){case "SLOTS":RSEventManager[b(318)]()[b(305)](RS_SLOTS_MAX_BET_UPDATE,a);break;case "CP":RSEventManager[b(318)]()[b(305)](RSPokerUtils[b(310)],a);break;case b(274):RSEventManager[b(318)]()[b(305)](RSPokerUtils[b(225)],a);break;case b(254):RSEventManager[b(318)]().dispatchEvent(RSPokerUtils.MPP_MAX_BET_UPDATE, a);break;case b(271):RSEventManager[b(318)]()[b(305)](RSPokerUtils[b(327)],a);break;case b(208):RSEventManager[b(318)]()[b(305)](RS_KENO_MAX_BET_UPDATE,a);break;case "BLACKJACK":case b(331):RSEventManager[b(318)]()[b(305)](RS_BLACKJACK_MAX_BET_UPDATE,a);break;case b(230):RSEventManager[b(318)]()[b(305)](RS_ROULETTE_MAX_BET_UPDATE,a)}}}; events[a0_0x41e6b5(246)]=function(a){var b=a0_0x41e6b5,c=a[b(249)],d=a[b(276)];a=a.vo;c?RSEngine.audioManager[b(297)]():RSEngine[b(332)].muteMusic();d?RSEngine.audioManager[b(261)]():RSEngine.audioManager.muteEffects();a?RSEngine.audioManager[b(272)]():RSEngine[b(332)].muteVOs()};events[a0_0x41e6b5(329)]=function(){var a=a0_0x41e6b5;RSEventManager[a(318)]()[a(305)](RS_SLOTS_EXTERNALLY_STOP_AUTO_SPIN)};events.start_auto_spin=function(){RSEventManager[a0_0x41e6b5(318)]().dispatchEvent(RS_SLOTS_EXTERNALLY_START_AUTO_SPIN)}; events.pause_machine=function(){var a=a0_0x41e6b5;cc[a(279)][a(257)][a(205)]();cc[a(216)][a(291)]()};events.resume_machine=function(){var a=a0_0x41e6b5;cc[a(216)].resume();cc[a(279)][a(257)].resume()};events[a0_0x41e6b5(315)]=function(a){var b=a0_0x41e6b5,c=a[b(215)];a=a[b(321)];RSEngine.screenManager[b(252)](c,a)};events[a0_0x41e6b5(253)]=function(){var a=a0_0x41e6b5;RSBingoManager[a(318)]()[a(232)]()}; events[a0_0x41e6b5(223)]=function(a){var b=a0_0x41e6b5;null!=a.bingoData[b(319)]&&RSCasinoManager.setPrimaryCurrencyForMachine(a.bingoData[b(319)]);a[b(285)][b(242)]&&(RSBingoManager[b(318)]()[b(242)]=a[b(285)][b(242)]);null!=a[b(285)][b(227)]&&(RSBingoManager[b(318)]()[b(227)]=a[b(285)][b(227)]);null!=a[b(285)].secondaryCurrency&&RSCasinoManager[b(298)](a[b(285)][b(238)]);a[b(285)][b(217)]&&(RSBingoManager.getInstance()[b(217)]=a[b(285)].userCollectibles);a.bingoData[b(307)]&&RSBingoManager.getInstance()[b(206)](a[b(285)][b(307)]); a.bingoData[b(294)]&&(RSBingoManager[b(318)]()[b(294)]=a[b(285)][b(294)]);a[b(285)][b(251)]&&(RSBingoManager.getInstance()[b(251)]=a[b(285)][b(251)]);a.bingoData[b(282)]&&(RSBingoManager[b(318)]()[b(243)]=a.bingoData[b(282)]);null!=a[b(203)]&&(10<a[b(203)].toString()[b(248)]&&(a[b(203)]=a[b(203)].toString()[b(270)](0,10)),Number(a[b(203)])>TimeManager[b(318)]()[b(290)]&&(TimeManager[b(318)]().currentServerTime=Number(a[b(203)])));null!=a[b(285)][b(302)]&&(RSBingoManager.getInstance().cheatEnabled= a.bingoData[b(302)]);RSEventManager[b(318)]()[b(305)](b(292))};events.update_primary_currency=function(a){var b=a0_0x41e6b5;a=a[b(333)];RSCasinoManager[b(299)](a)};events.update_secondary_currency=function(a){a=a[a0_0x41e6b5(333)];RSCasinoManager.setSecondaryCurrencyForMachine(a)};events.show_info_toaster=function(a){var b=a0_0x41e6b5,c=TOASTER_FOLDER,d=a[b(218)],e=a.entry,f=a.duration,g=a.title,h=a[b(287)],k=a.image;a=a[b(328)];RSCasinoManager[b(244)](c,d,e,f,g,h,k,a)}; events[a0_0x41e6b5(228)]=function(a){var b=a0_0x41e6b5,c=a[b(266)];a=a[b(247)];RSCasinoManager[b(237)](c,a)};events[a0_0x41e6b5(312)]=function(a){var b=a0_0x41e6b5;a=JSON[b(288)](a[b(247)]);var c=a[b(213)][b(324)];RSCasinoManager[b(237)](c,a)};events[a0_0x41e6b5(296)]=function(a){var b=a0_0x41e6b5;APIAdapter[b(255)]&&(a=a[b(201)],APIAdapter[b(255)](a),APIAdapter[b(255)]=null)};events.update_sideMenuController=function(a){var b=a0_0x41e6b5;typeof SideMenuController!==b(219)&&SideMenuController[b(318)]().resolveMessages(a.message)}; events.loyaltymall=function(a){var b=a0_0x41e6b5;RSGame.getInstance()[b(273)]()[b(240)](a)}; window.addEventListener("message",function(a){var b=a0_0x41e6b5;try{var c="";typeof a[b(213)]===b(284)?c=JSON[b(288)](JSON[b(220)](a[b(213)])):c=JSON[b(288)](a.data);var d=c[b(221)];c[b(301)]&&c[b(301)]==b(316)&&RSEngine[b(231)][b(281)](c.eventName,a[b(213)]);if(d==b(259))events[d][b(207)](null,c);else if(d==b(308))events[d][b(207)](null,c);else if(d==b(300))window[b(300)]=c.id;else if(events[d]){var e=c[b(203)];if(e>API_TIME_STAMP){API_TIME_STAMP=e;var f=c[b(283)];delete c[b(283)];var g=JSON[b(220)](c); a=MACHINE_NAME+"|"+g;var h=APIAdapter[b(262)](a);h==f?events[d][b(207)](null,c):API.log_error("EVENT HASH FAILED",h+b(293)+f+b(200)+btoa(encodeURIComponent(JSON[b(220)](c))))}else API.log_error(b(222),e+b(323)+API_TIME_STAMP+" For Event "+btoa(encodeURIComponent(JSON.stringify(c))))}else RSEngine[b(231)]?("clientOrigin"==c[b(269)]&&RSEngine[b(231)][b(325)](a[b(313)],a[b(326)]),RSEngine[b(231)][b(281)](d,c),null!=c&&null!=c[b(266)]&&null!=c.data&&(null!=a[b(326)]&&null!=a[b(313)]&&RSEngine[b(231)][b(275)](a[b(313)], a[b(326)]),RSEngine[b(231)].updateFromExternalGame(c[b(266)],c.data))):window!=parent&&API.handover_event(c);delete c[b(221)]}catch(k){}},!1); function a0_0x2463(){var a="progress;stop_auto_spin;22334dZxVQc;BLACKJACK_V2;audioManager;value;spin_started;analytics_primary_sink;machine_data_request;setHashSalt; For Event ;machineData;machine_loading_started;timeStamp;exit_machine;suspend;setCustomDaub;call;KENO;button_click;64424aZHUTb;1060182KOhBMb;44121APhoCR;data;add_display_secondary_currency;width;director;userCollectibles;layout;undefined;stringify;event;EVENT TIMESTAMP MISMATCH;set_bingo_data;contentWindow;MSP_MAX_BET_UPDATE;5375672pwTsUd;daubAlertTime;post_message;out_of_currency;ROULETTE;externalGameManager;resetShadowCard;SideMenuIFrame;298090nyINoT;add_secondary_currency;machine;postMessage;secondaryCurrency;1442600Nwvphd;updateFromLoyaltyMall;machine_result;powerUps;_isSpinEventActive;showToaster;analytics_primary_source;set_volume;message;length;music;machine_loaded;accessToken;onScreenOrientationChanged;reset_shadow_card;MPP;machineDataReciever;bet_changed;_context;add_display_primary_currency;update_sideMenuController;schedule;unMuteEffects;getHash;analytics_secondary_source;498wkqUQO;bind;name;machine_event;56PEEpWS;configData;slice;MSPT;unMuteVOs;getGameManager;MSP;setAinsworthEventSource;effect;analytics_secondary_sink;log_error;Audio;sendSideMenuMessage;updateFromExternalGame;spinEventActive;hashValue;object;bingoData;803MMUhOn;text;parse;138XwGpSE;currentServerTime;pause;BLOB_SYNCED; !\x3d ;levelData;enable_hud;set_machine_data;unMuteMusic;setSecondaryCurrencyForMachine;setPrimaryCurrencyForMachine;afWebUserId;eventName;cheat;add_primary_currency;disable_hud;dispatchEvent;now;customDaub;loyaltymall;loading_failed;CP_MAX_BET_UPDATE;trigger_interrupts;post_hydra_message;source;getElementById;notify_orientation_change;appsflyer_log_error;send_machine_data_request;getInstance;primaryCurrency;handover_event;height;hashSalt; \x3c\x3d ;api_name;setOddsWorkEventSource;origin;MSPT_MAX_BET_UPDATE".split(";");a0_0x2463= function(){return a};return a0_0x2463()};function RootClass(){}RootClass.prototype.init=function(){};RootClass.__asMethod__=function(a,b){return function(){var c=this._super;this._super=b;var d=a.apply(this,arguments);this._super=c;return d}};RootClass.extend=function(a){var b=function(){arguments[0]!==RootClass&&this.init.apply(this,arguments)},c=new this(RootClass),d=this.prototype,e;for(e in a){var f=a[e];f instanceof Function&&(f=RootClass.__asMethod__(f,d));c[e]=f}c._super=d;b.prototype=c;b.extend=this.extend;return b};var Interface=function(a,b){if(2!=arguments.length)throw Error("There should be 2 arguments for an interface");this.name=a;this.methods=[];for(var c=0,d=b.length;c<d;c++){if("string"!==typeof b[c])throw Error("Interface constructor expects method names to be passed in as a string.");this.methods.push(b[c])}}; Interface.ensureImplements=function(a){if(2>arguments.length)throw Error("Function Interface.ensureImplements called with "+arguments.length+"arguments, but expected at least 2.");for(var b=1,c=arguments.length;b<c;b++){var d=arguments[b];if(d.constructor!==Interface)throw Error("Function Interface.ensureImplements expects arguments two and above to be instances of Interface.");for(var e=0,f=d.methods.length;e<f;e++){var g=d.methods[e];if(!a[g]||"function"!==typeof a[g])throw Error("Function Interface.ensureImplements: object does not implement the "+ d.name+" interface. Method "+g+" was not found.");}}};var RSClass=RootClass.extend({init:function(){this._super.init.call(this)},onAssetLoaded:function(a){cc.log("RSClass: onAssetLoaded")},unload:function(){},implements:function(a){}});var RSEvents=RSEvents||{};RSEvents.onFullScreenChange="OnFullscreenChange";RSEvents.closeFullScreen="CloseFullScreen"; var RSEngine=RSEngine||{},LAYOUT_TYPE={IPHONE5:"iPhone5",IPAD:"iPad",IPHONERETINA:"iPhoneRetina",IPADRETINA:"iPadRetina",IPHONEX:"iPhoneX",CANVAS:"Canvas",FULLHD:"FullHD",HD:"HD"},SCREEN_SIZES={iPhone5:{width:1136,height:640},iPad:{width:1024,height:768},iPhoneRetina:{width:2272,height:1280},iPadRetina:{width:2048,height:1536},iPhoneX:{width:1412,height:652},Canvas:{width:1136,height:640},FullHD:{width:1920,height:1080},HD:{width:1280,height:720}},SCREEN_ORIENTATION={PORTRAIT:"Portrait",LANDSCAPE:"Landscape"}, PLATFORM={MOBILE:"mobile",CANVAS:"html5",WEB:"web"},LOGIN_MODE={GUEST:"guest",EMAIL:"email",WEB_FACEBOOK:"webfacebook",FACEBOOK:"facebook",INSTANT_GAME:"instantgame"};RSEngine.screenTransitionSpeed=0.3;RSEngine.platform=PLATFORM.WEB;RSEngine.loginMode=LOGIN_MODE.FACEBOOK;RSEngine.layout=LAYOUT_TYPE.IPHONE5;RSEngine.orientation=SCREEN_ORIENTATION.LANDSCAPE;RSEngine.userConfig="";RSEngine.hashKey="";RSEngine.gameVersion="1.0";RSEngine.resolutionFactor=1;RSEngine.popupBackgroundOpacity=180; function getMobileOperatingSystem(){var a=navigator.userAgent||navigator.vendor||window.opera;return/windows phone/i.test(a)?"Windows Phone":/android/i.test(a)?"Android":/iPad|iPhone|iPod/.test(a)&&!window.MSStream?"iOS":"unknown"}function isiOS(){return navigator.userAgent.match(/(iPod|iPhone|iPad)/)&&navigator.userAgent.match(/AppleWebKit/)}RSEngine.currentPlatform="";isiOS()&&(RSEngine.currentPlatform="iOS"); RSEngine.initialize=function(a,b,c,d,e){RSEngine.platform=a;RSEngine.setScreenFactors(b,c,d);RSEngine.CHEAT_MODE=!1;RSEngine.screenManager=RSEngine.screenManager||new RSScreenManager;RSEngine.popupManager=RSEngine.popupManager||new RSPopupManager;RSEngine.audioManager=RSEngine.audioManager||new RSAudioManager;RSEngine.networkManager=null;RSEngine.facebookManager=null;RSEngine.externalGameManager=null;RSEngine.dataManager=null;RSEngine.gameData=null;RSEngine.isFullScreenSupported=cc.screen._supportsFullScreen; cc.view.enableRetina(!0);cc.view.adjustViewPort(!0);cc.view.resizeWithBrowserSize(!0);cc.view.setDesignResolutionSize(RSEngine.screenWidth,RSEngine.screenHeight,cc.ResolutionPolicy.SHOW_ALL);cc.director.getScheduler().scheduleUpdate(RSEngine.screenManager,0,!1)}; RSEngine.setScreenFactors=function(a,b,c){switch(a){case LAYOUT_TYPE.CANVAS:RSEngine.layout=LAYOUT_TYPE.CANVAS;RSEngine.screenWidth=1280;RSEngine.screenHeight=720;RSEngine.resolutionFactor=1;break;case LAYOUT_TYPE.IPADRETINA:RSEngine.layout=LAYOUT_TYPE.IPADRETINA;RSEngine.screenWidth=2048;RSEngine.screenHeight=1536;RSEngine.resolutionFactor=2;break;case LAYOUT_TYPE.IPHONERETINA:RSEngine.layout=LAYOUT_TYPE.IPHONERETINA;RSEngine.screenWidth=2272;RSEngine.screenHeight=1280;RSEngine.resolutionFactor= 2;break;case LAYOUT_TYPE.IPAD:RSEngine.layout=LAYOUT_TYPE.IPAD;RSEngine.screenWidth=1024;RSEngine.screenHeight=768;RSEngine.resolutionFactor=1;break;case LAYOUT_TYPE.IPHONEX:RSEngine.layout=LAYOUT_TYPE.IPHONEX;RSEngine.screenWidth=1412;RSEngine.screenHeight=652;RSEngine.resolutionFactor=1;break;case LAYOUT_TYPE.FULLHD:RSEngine.layout=LAYOUT_TYPE.FULLHD;RSEngine.screenWidth=1920;RSEngine.screenHeight=1080;RSEngine.resolutionFactor=1;break;case LAYOUT_TYPE.HD:RSEngine.layout=LAYOUT_TYPE.HD;RSEngine.screenWidth= 1280;RSEngine.screenHeight=720;RSEngine.resolutionFactor=1;break;default:RSEngine.layout=LAYOUT_TYPE.IPHONE5,RSEngine.screenWidth=1136,RSEngine.screenHeight=640,RSEngine.resolutionFactor=1}switch(b){case SCREEN_ORIENTATION.PORTRAIT:RSEngine.orientation=SCREEN_ORIENTATION.PORTRAIT;a=RSEngine.screenHeight;RSEngine.screenHeight=RSEngine.screenWidth;RSEngine.screenWidth=a;break;default:RSEngine.orientation=SCREEN_ORIENTATION.LANDSCAPE}c&&(RSEngine.screenHeight-=c)}; RSEngine.enableCheatMode=function(){RSEngine.CHEAT_MODE=!0};RSEngine.initializeNetworkManager=function(a){RSEngine.SERVICE_URL=a;RSEngine.networkManager=new RSNetworkManager.getInstance;RSEngine.networkManager.initialize(RSEngine.SERVICE_URL)};RSEngine.initializeFacebook=function(a){RSFBManager.getInstance().initialize(a);RSEngine.facebookManager=RSFBManager.getInstance()};RSEngine.initializeExternalGameManager=function(){RSEngine.externalGameManager=RSEngine.externalGameManager||new RSExternalGameManager}; RSEngine.toggleFullscreen=function(){RSEngine.isFullScreenSupported&&(cc.screen.fullScreen()?cc.screen.exitFullScreen():cc.screen.requestFullScreen(document.documentElement,function(){RSEventManager.getInstance().dispatchEvent(RSEvents.onFullScreenChange,{isFullScreen:cc.screen.fullScreen()})}))};RSEngine.setHashKey=function(a){RSEngine.hashKey=a};RSEngine.closeFullScreen=function(){RSEngine.isFullScreenSupported&&cc.screen.fullScreen()&&(cc.screen.exitFullScreen(),RSEventManager.getInstance().dispatchEvent(RSEvents.closeFullScreen))}; RSEngine.setLoadingAnimation=function(a){RSEngine.loadingAnimation=a};RSEngine.getLoadingAnimation=function(){return RSEngine.loadingAnimation?RSEngine.loadingAnimation:(cc.warn("Loading animation has not been set"),"")};RSEngine.reloadPage=function(a){void 0==a&&(a=!1);window.location.reload(a)};RSEngine.setGameVersion=function(a){RSEngine.gameVersion=a};RSEngine.setPopupBackgroundOpacity=function(a){RSEngine.popupBackgroundOpacity=a};var RSGameScene=cc.Scene.extend({onEnter:function(){this._super();this._layers=[];this._popupIndex=0;this._popupLayer=new cc.Layer;this.addChild(this._popupLayer,1);this._popupLayer.setVisible(!1);this._fadeLayer=new cc.LayerColor(cc.color(0,0,0,0));this.addChild(this._fadeLayer,2);RSEngine.screenManager.onSceneLoaded()},loadLayer:function(a,b){0<this._layers.length&&!b&&this.removeChild(this._layers[this._layers.length-1],!1);this.addLayer(a)},addLayer:function(a){a=a.getDisplayObject();this.addChild(a); this._layers.push(a)},unloadLayer:function(a){if(null!=a){var b=a.getDisplayObject(),c=this._layers.indexOf(b);-1<c&&this._layers.splice(c,1);a.unload();this.removeChild(b,!0)}},activateTopLayer:function(){if(0<this._layers.length){var a=this._layers[this._layers.length-1];null==this.getChildByName(a.getName())&&(RSEngine.screenManager.reInitLayer(a.getName()),this.addChild(a))}},fadeOut:function(a){var b=cc.fadeIn(RSEngine.screenTransitionSpeed),c=cc.callFunc(function(){a()},this,this);this._fadeLayer.runAction(cc.sequence(b, c))},fadeIn:function(a){var b=cc.fadeOut(RSEngine.screenTransitionSpeed),c=cc.callFunc(function(){a()},this,this);this._fadeLayer.runAction(cc.sequence(b,c))},addPopup:function(a,b){var c=a._doAnimate,d=a._showOverlay,e=a.getCustomAddPopupActions(),f=a.getDisplayObject();if(null!=this._popupLayer)if(this._popupIndex++,this._popupLayer.setVisible(!0),f.setTag(this._popupIndex),d&&(d=new cc.LayerColor(cc.color(0,0,0,RSEngine.popupBackgroundOpacity)),d.setScale(3),d.setTag(this._popupIndex),this._popupLayer.addChild(d)), this._popupLayer.addChild(f),c)if(e&&e.length)for(c=0;c<e.length;c++)f.runAction(e[c]);else e=f.getScale(),f.setScale(0),e=cc.scaleTo(e,e),e.easing(cc.easeElasticOut(0.6)),c=cc.callFunc(function(){b()},this,this),f.runAction(cc.sequence(e,c));else b()},removePopup:function(a,b){var c=a.getCustomRemovePopupActions(),d=a._doAnimate,e=a.getDisplayObject();if(null!=this._popupLayer){var f=this;if(d)if(c&&c.length)for(var g=0;g<c.length;g++)g==c.length-1?(d=cc.callFunc(function(){f.releasePopup(e,b)}, this,this),e.runAction(cc.sequence(c[g],d))):e.runAction(c[g]);else c=cc.scaleTo(0.3,0),c.easing(cc.easeOut(0.5)),d=cc.callFunc(function(){f.releasePopup(e,b)},this,this),e.runAction(cc.sequence(c,d));else f.releasePopup(e,b)}},releasePopup:function(a,b){var c=a.getTag();this._popupLayer.removeChildByTag(c,!0);c=this._popupLayer.getChildByTag(c);null!=c&&this._popupLayer.removeChild(c,!0);0>=this._popupLayer.getChildrenCount()&&this._popupLayer.setVisible(!1);null!=b&&void 0!=b&&b()},showLoader:function(a){if(null== this._loaderLayer){this._loaderLayer=new cc.Layer;this.addChild(this._loaderLayer,2);var b=new cc.LayerColor(cc.color(0,0,0,0));b.setScale(3);this._loaderLayer.addChild(b);a&&this._loaderLayer.addChild(a.getDisplayObject())}},removeLoader:function(){null!=this._loaderLayer&&(this._loaderLayer.removeAllChildren(!0),this.removeChild(this._loaderLayer),this._loaderLayer=null)},setTouchEnabled:function(a){var b=this._layers.length;0<b&&(b=this._layers[b-1],null!=b&&(a?cc.eventManager.resumeTarget(b,!0): cc.eventManager.pauseTarget(b,!0)))},setPopupTouchEnabled:function(a){null!=this._popupLayer&&(a?cc.eventManager.resumeTarget(this._popupLayer,!0):cc.eventManager.pauseTarget(this._popupLayer,!0))}});var RSScreenManager=RSClass.extend({_cumulativeDt:0,_frameRate:0,_sampleSize:0,_isFrameRateTracked:!1,_cumulativeFrameRate:0,init:function(){this._super.init.call(this);this._screens=[];this._layerToLoad=this._currentScene=null;this._isSceneLoaded=!1;this._screenNames=[];this._listeningOrientationChange=!1},getScreenName:function(a){a=this.validateScreenName(a,0);this._screenNames.push(a);return a},validateScreenName:function(a,b){var c=a+"_"+b;-1<this._screenNames.indexOf(c)&&(c=this.validateScreenName(a, b+1));return c},removeScreenName:function(a){a=this._screenNames.indexOf(a);-1<a&&this._screenNames.splice(a,1)},addOrientationChangeListener:function(){this._listeningOrientationChange=!0},onScreenOrientationChanged:function(a,b){if(this._listeningOrientationChange){var c=SCREEN_ORIENTATION.LANDSCAPE;a<b&&(c=SCREEN_ORIENTATION.PORTRAIT);c==RSEngine.orientation?cc.view.setDesignResolutionSize(RSEngine.screenWidth,RSEngine.screenHeight,cc.ResolutionPolicy.SHOW_ALL):cc.view.setDesignResolutionSize(RSEngine.screenHeight, RSEngine.screenWidth,cc.ResolutionPolicy.SHOW_ALL);for(var d=0;d<this._screens.length;d++)this._screens[d].onScreenOrientationChanged(c);if(this._layerToLoad)this._layerToLoad.onScreenOrientationChanged(c)}},loadNewScene:function(a,b,c,d){var e=this;BlankLoader.preload(b,function(b){cc.director.runScene(a);e._currentScene=a;d&&d.call()},c)},onSceneLoaded:function(){this._isSceneLoaded=!0;null!=this._layerToLoad&&this.loadNewScreen(this._layerToLoad)},loadNewScreen:function(a){this._layerToLoad=a; null!=this._currentScene&&this._isSceneLoaded&&(this._currentScene.setTouchEnabled(!1),this._currentScene.fadeOut(this.fadeOutComplete.bind(this,a)))},fadeOutComplete:function(a){this.removeAllScreen();this.loadNextLayer(a)},removeAllScreen:function(){for(;0<this._screens.length;){var a=this._screens[this._screens.length-1];RSUtils.removeFromArray(this._screens,a);this._currentScene.unloadLayer(a)}},loadNextLayer:function(a){var b=!1;0<this._screens.length&&(b=this._screens[this._screens.length-1].getShouldDrawWhenInactive()); this._screens.push(a);this._currentScene.loadLayer(a,b);a.loadContent();this._layerToLoad=null},onLayerLoaded:function(a){},revealScreen:function(a){this._currentScene.fadeIn(this.fadeInComplete.bind(this,a))},fadeInComplete:function(a){this.onScreenRevealed(a)},onScreenRevealed:function(a){a.onReveal();this._currentScene.setTouchEnabled(!0)},addScreen:function(a){this._isSceneLoaded&&0<this._screens.length&&(this._layerToLoad=a,this._currentScene.setTouchEnabled(!1),a._isScreenActive=!0,this.loadNextLayer(a))}, removeScreen:function(a){this._currentScene.setTouchEnabled(!1);1<this._screens.length&&(RSUtils.removeFromArray(this._screens,a),this._currentScene.unloadLayer(a));this._currentScene.activateTopLayer();this._currentScene.setTouchEnabled(!0)},update:function(a){for(var b=0;b<this._screens.length;b++)this._screens[b].update(a);if(!this._isFrameRateTracked&&(this._frameRate++,this._cumulativeDt+=a,1<=this._cumulativeDt&&(this._cumulativeFrameRate+=this._frameRate,this._frameRate=this._cumulativeDt= 0,this._sampleSize+=1,50<=this._sampleSize))){b=Math.round(this._cumulativeFrameRate/50);this._sampleSize=this._cumulativeFrameRate=0;var c="canvas";cc._renderType!==cc.game.RENDER_TYPE_CANVAS&&(c="webgl");RSAnalyticsManager.getInstance().trackUserFPS(b,c,cc.sys.browserType);10>b&&RSErrorTracker.getInstance().trackErrorMessage("FRAME_RATE","Frame Rate "+b+"Render Mode "+c,"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net");this._isFrameRateTracked=!0}RSEngine.popupManager.update(a)},getCurrentScreen:function(){return 0< this._screens.length?this._screens[this._screens.length-1]:null},getCurrentScene:function(){if(null!=this._currentScene)return this._currentScene},addOverlay:function(a){this._currentScene.showLoader(new RSLoaderLayer(a));this._currentScene.setTouchEnabled(!1);this._currentScene.setPopupTouchEnabled(!1)},removeOverlay:function(){this._currentScene.removeLoader();RSEngine.popupManager.isPopupActive()||this._currentScene.setTouchEnabled(!0);this._currentScene.setPopupTouchEnabled(!0)},onConnectionLost:function(){for(var a= 0;a<this._screens.length;a++)this._screens[a].onConnectionLost()},onConnectionResume:function(){for(var a=0;a<this._screens.length;a++)this._screens[a].onConnectionResume()},addToaster:function(a){this._screens[this._screens.length-1].addChild(a)},removeToaster:function(a){this._screens[this._screens.length-1].removeChild(a,!0)},reInitLayer:function(a){for(var b=0;b<this._screens.length;b++)if(this._screens[b].getName()==a){this._screens[b].reInitLayer();break}}});var RSPopupManager=RSClass.extend({_popupQueue:null,_activePopupCount:null,_activePopups:null,init:function(){this._popupQueue=[];this._activePopupCount=0;this._activePopups=[];this._isSfxActive=null},isPopupActive:function(){return 0<this._activePopupCount?!0:!1},getPopupQueueSize:function(){return this._popupQueue.length},getPopupCount:function(){return this._popupQueue.length+this._activePopupCount},addPopup:function(a,b,c,d,e,f){this._isSfxActive=null==f?!0:f;if(e)RSEngine.screenManager.addScreen(a), a._backgroundHidden=!0;else{if(null==d||void 0==d)d=!0;if(null==c||void 0==c)c=!0;if(null==b||void 0==b)b=!1;a._doAnimate=c;a._showOverlay=d;a._isForcedPopup=b;a._isScreenActive=!1;this._popupQueue.push(a);(b||0==this._activePopupCount)&&this.showNextPopup(a);"undefined"!==typeof SideMenuController&&SideMenuController.getInstance().setSideMenuVisibility(!1)}},removePopup:function(a){var b=this;-1>=this._activePopups.indexOf(a)||("undefined"!==typeof RSGame&&!0==this._isSfxActive&&RSGame.getInstance().getAssetPath("PopupExit_SFX")&& RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("PopupExit_SFX"),!1),RSEngine.screenManager.getCurrentScene().removePopup(a,function(){b.onRemoveAnimComplete(a)}))},onRemoveAnimComplete:function(a){var b=RSEngine.screenManager.getCurrentScene();a.unload();this._activePopupCount--;RSUtils.removeFromArray(this._activePopups,a);0>=this._activePopupCount?(RSEngine.externalGameManager&&"undefined"!==typeof RSGame&&(RSGame.getInstance().getGameManager()?RSGame.getInstance().getGameManager().getMachineOpenPopupStatus()|| GlobalVars.isVIPSurfacingAnimationActive||RSEngine.externalGameManager.showExternalGame():RSEngine.externalGameManager.showExternalGame()),0<this._popupQueue.length?this.showNextPopup(this._popupQueue[0]):("undefined"!==typeof SideMenuController&&RSGame.getInstance().getGameManager().showSideMenuOnPopupClose()&&!RSGame.getInstance().getGameManager().isLifeStreetActive()&&(RSGame.getInstance().getGameManager().getSSOMainLobbyReloadStatus()||RSGame.getInstance().getGameManager().setSideMenuVisibility(!0)), RSCasinoManager.triggerInterrupts(),b.setTouchEnabled(!0))):(this._activePopups[this._activePopupCount-1].setTouchEnabled(!0),b.setTouchEnabled(!1))},removeAllPopups:function(){for(;0<this._activePopups.length;){var a=this._activePopups[0];a._doAnimate=!1;this.removePopup(a)}for(;0<this._popupQueue.length;)a=this._popupQueue[0],a.unload();this._activePopups.length=0;this._popupQueue.length=0},showNextPopup:function(a){var b=this;a.loadContent();var c=RSEngine.screenManager.getCurrentScene();"undefined"!== typeof RSGame&&!0==this._isSfxActive&&RSGame.getInstance().getAssetPath("PopupEntry_SFX")&&RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("PopupEntry_SFX"),!1);c.addPopup(a,function(){b.onAddAnimComplete(a)});c.setTouchEnabled(!1);for(c=0;c<this._activePopupCount;c++)this._activePopups[c].setTouchEnabled(!1);this._activePopupCount++;this._activePopups.push(a);RSUtils.removeFromArray(this._popupQueue,a);RSEngine.externalGameManager&&RSEngine.externalGameManager.hideExternalGame()}, isPopupAdded:function(a){for(var b=0;b<this._activePopups.length;b++){var c=this._activePopups[b];if(a==c)return!0}for(b=0;b<this._popupQueue.length;b++)if(c=this._popupQueue[b],a==c)return!0;return!1},onAddAnimComplete:function(a){a.onPopupAnimationComplete();cc.log("Popup add animation completed")},update:function(a){for(var b=0;b<this._activePopups.length;b++)this._activePopups[b].update(a)}});var RSScreenLoader=cc.Layer.extend({onProgress:null,init:function(){return!0},onEnter:function(){cc.Node.prototype.onEnter.call(this)},onExit:function(){cc.Node.prototype.onExit.call(this)},initWithResources:function(a,b,c){cc.isString(a)&&(a=[a]);this.resources=a||[];this.cb=c;this.onProgress=b;this._retryCount=0;this._startLoading()},fetchResource:function(a,b,c){cc.isString(a)&&(a=[a]);this.resources=a||[];this.cb=c;this.onProgress=b;this._retryCount=0;this._startLoading()},_startLoading:function(){var a= this;a.unschedule(a._startLoading);cc.loader.load(a.resources,function(b,c,d){b=Math.min((d+1)/c*100|0,100);if(0>=a._retryCount&&a.onProgress)a.onProgress(b)},function(b){b?a._onErrorLoading(b):a.cb&&a.cb()})},_onErrorLoading:function(a){this._retryCount++;if(3>=this._retryCount){for(var b=this.resources.length=0;b<a.length;b++)a[b]&&this.resources.push(a[b].url);this._startLoading()}else RSCasinoManager.notifyLoadingFailureToCasino(a)},unload:function(){this.onProgress=this.cb=null}});var BlankLoader=cc.Scene.extend({init:function(a){if(a){var b=new RSImageObject;b.setImageFromUrl(a,0,0,1136*RSEngine.resolutionFactor,768*RSEngine.resolutionFactor);b.setCenter(RSEngine.screenWidth/2,RSEngine.screenHeight/2);this.addChild(b.getDisplayObject())}},onEnter:function(){cc.Node.prototype.onEnter.call(this);this.schedule(this._startLoading,0.3)},onExit:function(){cc.Node.prototype.onExit.call(this)},initWithResources:function(a,b){cc.isString(a)&&(a=[a]);this.resources=a||[];this.cb=b}, _startLoading:function(){var a=this;this.unschedule(this._startLoading);cc.loader.load(this.resources,function(a,c,d){},function(){a.cb&&a.cb()})}});BlankLoader.preload=function(a,b,c){var d;d||(d=new BlankLoader,d.init(c));d.initWithResources(a,b);cc.director.runScene(d);return d};var hex_chr="0123456789abcdef";function rhex(a){var b="";for(j=0;3>=j;j++)b+=hex_chr.charAt(a>>8*j+4&15)+hex_chr.charAt(a>>8*j&15);return b}function str2blks_MD5(a){var b=(a.length+8>>6)+1,c=Array(16*b);for(i=0;i<16*b;i++)c[i]=0;for(i=0;i<a.length;i++)c[i>>2]|=a.charCodeAt(i)<<i%4*8;c[i>>2]|=128<<i%4*8;c[16*b-2]=8*a.length;return c}function add(a,b){var c=(a&65535)+(b&65535);return(a>>16)+(b>>16)+(c>>16)<<16|c&65535}function rol(a,b){return a<<b|a>>>32-b} function cmn(a,b,c,d,e,f){return add(rol(add(add(b,a),add(d,f)),e),c)}function ff(a,b,c,d,e,f,g){return cmn(b&c|~b&d,a,b,e,f,g)}function gg(a,b,c,d,e,f,g){return cmn(b&d|c&~d,a,b,e,f,g)}function hh(a,b,c,d,e,f,g){return cmn(b^c^d,a,b,e,f,g)}function ii(a,b,c,d,e,f,g){return cmn(c^(b|~d),a,b,e,f,g)} function calcMD5(a){a=str2blks_MD5(a);for(var b=1732584193,c=-271733879,d=-1732584194,e=271733878,f=b,g=c,h=d,k=e,m=0;m<a.length;m+=16)f=b,g=c,h=d,k=e,b=ff(b,c,d,e,a[m+0],7,-680876936),e=ff(e,b,c,d,a[m+1],12,-389564586),d=ff(d,e,b,c,a[m+2],17,606105819),c=ff(c,d,e,b,a[m+3],22,-1044525330),b=ff(b,c,d,e,a[m+4],7,-176418897),e=ff(e,b,c,d,a[m+5],12,1200080426),d=ff(d,e,b,c,a[m+6],17,-1473231341),c=ff(c,d,e,b,a[m+7],22,-45705983),b=ff(b,c,d,e,a[m+8],7,1770035416),e=ff(e,b,c,d,a[m+9],12,-1958414417),d= ff(d,e,b,c,a[m+10],17,-42063),c=ff(c,d,e,b,a[m+11],22,-1990404162),b=ff(b,c,d,e,a[m+12],7,1804603682),e=ff(e,b,c,d,a[m+13],12,-40341101),d=ff(d,e,b,c,a[m+14],17,-1502002290),c=ff(c,d,e,b,a[m+15],22,1236535329),b=gg(b,c,d,e,a[m+1],5,-165796510),e=gg(e,b,c,d,a[m+6],9,-1069501632),d=gg(d,e,b,c,a[m+11],14,643717713),c=gg(c,d,e,b,a[m+0],20,-373897302),b=gg(b,c,d,e,a[m+5],5,-701558691),e=gg(e,b,c,d,a[m+10],9,38016083),d=gg(d,e,b,c,a[m+15],14,-660478335),c=gg(c,d,e,b,a[m+4],20,-405537848),b=gg(b,c,d,e,a[m+ 9],5,568446438),e=gg(e,b,c,d,a[m+14],9,-1019803690),d=gg(d,e,b,c,a[m+3],14,-187363961),c=gg(c,d,e,b,a[m+8],20,1163531501),b=gg(b,c,d,e,a[m+13],5,-1444681467),e=gg(e,b,c,d,a[m+2],9,-51403784),d=gg(d,e,b,c,a[m+7],14,1735328473),c=gg(c,d,e,b,a[m+12],20,-1926607734),b=hh(b,c,d,e,a[m+5],4,-378558),e=hh(e,b,c,d,a[m+8],11,-2022574463),d=hh(d,e,b,c,a[m+11],16,1839030562),c=hh(c,d,e,b,a[m+14],23,-35309556),b=hh(b,c,d,e,a[m+1],4,-1530992060),e=hh(e,b,c,d,a[m+4],11,1272893353),d=hh(d,e,b,c,a[m+7],16,-155497632), c=hh(c,d,e,b,a[m+10],23,-1094730640),b=hh(b,c,d,e,a[m+13],4,681279174),e=hh(e,b,c,d,a[m+0],11,-358537222),d=hh(d,e,b,c,a[m+3],16,-722521979),c=hh(c,d,e,b,a[m+6],23,76029189),b=hh(b,c,d,e,a[m+9],4,-640364487),e=hh(e,b,c,d,a[m+12],11,-421815835),d=hh(d,e,b,c,a[m+15],16,530742520),c=hh(c,d,e,b,a[m+2],23,-995338651),b=ii(b,c,d,e,a[m+0],6,-198630844),e=ii(e,b,c,d,a[m+7],10,1126891415),d=ii(d,e,b,c,a[m+14],15,-1416354905),c=ii(c,d,e,b,a[m+5],21,-57434055),b=ii(b,c,d,e,a[m+12],6,1700485571),e=ii(e,b,c,d, a[m+3],10,-1894986606),d=ii(d,e,b,c,a[m+10],15,-1051523),c=ii(c,d,e,b,a[m+1],21,-2054922799),b=ii(b,c,d,e,a[m+8],6,1873313359),e=ii(e,b,c,d,a[m+15],10,-30611744),d=ii(d,e,b,c,a[m+6],15,-1560198380),c=ii(c,d,e,b,a[m+13],21,1309151649),b=ii(b,c,d,e,a[m+4],6,-145523070),e=ii(e,b,c,d,a[m+11],10,-1120210379),d=ii(d,e,b,c,a[m+2],15,718787259),c=ii(c,d,e,b,a[m+9],21,-343485551),b=add(b,f),c=add(c,g),d=add(d,h),e=add(e,k);return rhex(b)+rhex(c)+rhex(d)+rhex(e)};var TimeManager=function(){var a,b=RSClass.extend({serverLoginTime:null,currentServerTime:null,timeInterval:null,init:function(){this.timeInterval=1E3;this.currentServerTime=0},setServerTime:function(a){this.currentServerTime=this.serverLoginTime=a;var b=this;setInterval(function(){b.currentServerTime+=b.timeInterval/1E3},this.timeInterval)},getCurrentServerTime:function(){return this.currentServerTime},getTimeSinceLoad:function(){return this.currentServerTime-this.serverLoginTime}});return{getInstance:function(){a|| (a=new b);return a}}}();function a0_0x1af1(a,b){var c=a0_0xe3fd();return a0_0x1af1=function(a,b){return c[a-341]},a0_0x1af1(a,b)}(function(a,b){for(var c=a0_0x1af1,d=a();;)try{if(-parseInt(c(352))/1+parseInt(c(343))/2+parseInt(c(346))/3+parseInt(c(351))/4*(parseInt(c(345))/5)+-parseInt(c(350))/6+-parseInt(c(353))/7+parseInt(c(347))/8===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0xe3fd,963567); function a0_0xe3fd(){var a="addListenerToObjectList 484045aQbMyJ 772059NUFfuF 20759544AOnrSF dispatchEvent CUSTOM 7234566iUNCux 44WAFlRE 1360447atJbRa 9415413AxiHRP create extend removeListener dispatchCustomEvent EventListener eventManager EventCustom _listeners setUserData addListener 1915278SGHrcn".split(" ");a0_0xe3fd=function(){return a};return a0_0xe3fd()} var RSEventManager=function(){var a=a0_0x1af1,b,c=RSClass[a(355)]({init:function(){this._listeners={}},addEventListener:function(b,c,f){b=cc[a(359)].addCustomListener(b,f);this[a(344)](c,b)},addListenerToObjectList:function(b,c){var f=b.getName();!this[a(361)][f]&&(this._listeners[f]={});var g=c._listenerID;this[a(361)][f][g]=c},dispatchEvent:function(b,c){cc[a(359)][a(357)](b,c)},removeListenersForEvent:function(b){cc[a(359)].removeCustomListeners(b);for(var c in this[a(361)])this._listeners[c][b]&& delete this[a(361)][c][b]},removeEventListenersIn:function(b){b=b.getName();var c=this[a(361)][b];if(c){for(var f in c)cc[a(359)][a(356)](c[f]),delete c[f];delete this[a(361)][b]}},addCustomListener:function(b,c,f){b=cc[a(358)][a(354)]({event:cc[a(358)][a(349)],eventName:b,callback:f});cc[a(359)][a(342)](b,c.getDisplayObject());this[a(344)](c,b)},dispatchCustomEvent:function(b,c){b=new (cc[a(360)])(b);b[a(341)](c);cc[a(359)][a(348)](b)}});return{getInstance:function(){return!b&&(b=new c),b}}}();var MersenneTwister=function(a){void 0===a&&(a=(new Date).getTime());this.N=624;this.M=397;this.MATRIX_A=2567483615;this.UPPER_MASK=2147483648;this.LOWER_MASK=2147483647;this.mt=Array(this.N);this.mti=this.N+1;this.init_genrand(a)};MersenneTwister.prototype.init_genrand=function(a){this.mt[0]=a>>>0;for(this.mti=1;this.mti<this.N;this.mti++)a=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30,this.mt[this.mti]=(1812433253*((a&4294901760)>>>16)<<16)+1812433253*(a&65535)+this.mti,this.mt[this.mti]>>>=0}; MersenneTwister.prototype.init_by_array=function(a,b){var c,d,e;this.init_genrand(19650218);c=1;d=0;for(e=this.N>b?this.N:b;e;e--){var f=this.mt[c-1]^this.mt[c-1]>>>30;this.mt[c]=(this.mt[c]^(1664525*((f&4294901760)>>>16)<<16)+1664525*(f&65535))+a[d]+d;this.mt[c]>>>=0;c++;d++;c>=this.N&&(this.mt[0]=this.mt[this.N-1],c=1);d>=b&&(d=0)}for(e=this.N-1;e;e--)f=this.mt[c-1]^this.mt[c-1]>>>30,this.mt[c]=(this.mt[c]^(1566083941*((f&4294901760)>>>16)<<16)+1566083941*(f&65535))-c,this.mt[c]>>>=0,c++,c>=this.N&& (this.mt[0]=this.mt[this.N-1],c=1);this.mt[0]=2147483648}; MersenneTwister.prototype.genrand_int32=function(){var a,b=[0,this.MATRIX_A];if(this.mti>=this.N){var c;this.mti===this.N+1&&this.init_genrand(5489);for(c=0;c<this.N-this.M;c++)a=this.mt[c]&this.UPPER_MASK|this.mt[c+1]&this.LOWER_MASK,this.mt[c]=this.mt[c+this.M]^a>>>1^b[a&1];for(;c<this.N-1;c++)a=this.mt[c]&this.UPPER_MASK|this.mt[c+1]&this.LOWER_MASK,this.mt[c]=this.mt[c+(this.M-this.N)]^a>>>1^b[a&1];a=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK;this.mt[this.N-1]=this.mt[this.M- 1]^a>>>1^b[a&1];this.mti=0}a=this.mt[this.mti++];a^=a>>>11;a^=a<<7&2636928640;a^=a<<15&4022730752;return(a^a>>>18)>>>0};MersenneTwister.prototype.genrand_int31=function(){return this.genrand_int32()>>>1};MersenneTwister.prototype.genrand_real1=function(){return this.genrand_int32()*(1/4294967295)};MersenneTwister.prototype.random=function(){return this.genrand_int32()*(1/4294967296)};MersenneTwister.prototype.genrand_real3=function(){return(this.genrand_int32()+0.5)*(1/4294967296)}; MersenneTwister.prototype.genrand_res53=function(){var a=this.genrand_int32()>>>5,b=this.genrand_int32()>>>6;return 1.1102230246251565E-16*(67108864*a+b)};var MotherRNG=function(){var a,b=RSClass.extend({init:function(){this._mStart=1;this._mother1=[];this._mother2=[];this._m16Long=65536;this._m16Mask=65535;this._m15Mask=32767;this._m31Mask=2147483647;this._m32Double=4294967295},getRandom:function(a){if(this._mStart){a||(a=(new Date).getTime());var b=this._unsign(a&this._m16Mask);a=this._unsign(a&this._m31Mask);for(var e=0;9>e;e++)a=30903*b+this._unsign(a>>16),this._mother1[e]=b=this._unsign(a&this._m16Mask);for(e=0;9>e;e++)a=30903*b+this._unsign(a>> 16),this._mother2[e]=b=this._unsign(a&this._m16Mask);this._mother1[0]=this._unsign(this._mother1[0]&this._m15Mask);this._mother2[0]=this._unsign(this._mother2[0]&this._m15Mask);this._mStart=0}for(e=8;1<=e;e--)this._mother1[e+1]=this._mother1[e],this._mother2[e+1]=this._mother2[e];b=this._mother1[0];a=this._mother2[0];b+=1941*this._mother1[2]+1860*this._mother1[3]+1812*this._mother1[4]+1776*this._mother1[5]+1492*this._mother1[6]+1215*this._mother1[7]+1066*this._mother1[8]+12013*this._mother1[9];a+= 1111*this._mother2[2]+2222*this._mother2[3]+3333*this._mother2[4]+4444*this._mother2[5]+5555*this._mother2[6]+6666*this._mother2[7]+7777*this._mother2[8]+9272*this._mother2[9];this._mother1[0]=b/this._m16Long;this._mother2[0]=a/this._m16Long;this._mother1[1]=this._unsign(this._m16Mask&b);this._mother2[1]=this._unsign(this._m16Mask&a);a=this._unsign(this._mother1[1]<<16)+this._mother2[1];return a/this._m32Double},_unsign:function(a){return a>>>0}});return{getInstance:function(){a||(a=new b);return a}}}();var a0_0x318cd1=a0_0x3927;(function(a,b){for(var c=a0_0x3927,d=a();;)try{if(parseInt(c(446))/1+parseInt(c(556))/2+-parseInt(c(401))/3*(-parseInt(c(414))/4)+parseInt(c(532))/5*(-parseInt(c(495))/6)+-parseInt(c(518))/7*(-parseInt(c(435))/8)+-parseInt(c(527))/9+-parseInt(c(433))/10===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x2cda,233922);var RSUtils=function(){};function a0_0x3927(a,b){var c=a0_0x2cda();return a0_0x3927=function(a,b){return c[a-395]},a0_0x3927(a,b)} function a0_0x2cda(){var a="setName;1790288gETOIX;uplay;December;September;getWidth;April;undefined; \x3e Max value ;appendChild;setPosition;March;getRandomFloat;setType;error;setContentSize;log;createBasicObject;.jpg;xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx;11831820DywBOe;getHeight;8ImbvHG;2em;createAnimation;removeSpriteFramesFromFile;Saturday;Min value ;getLocalStorageItem;successful;JSON_LOADING_ERROR;position;rect;425567sRiFpQ;Wednesday;createSpriteFromSpriteFrameName;name;loadSprite;body;fixed;getScreenSize;.png;Copying text command was ;August;indexOf;November;config.json?_t\x3d;formatNumber;isObjectEmpty;loadJsonAsyc;loadFrameWithName;sort;Tuesday;showLoginBox;border;cloneJSON;setAnchorPoint;split;replace;getFullYear;type;com.rubyseven.;playAnimation;floor;loadAnimationWithName;transparent;_00.png;formatNumberWithComma;createTextField;Sprite;length;substr;width;style;January;Oops, unable to copy;spriteFrameCache;callFunc;setItem;sortArrayHighToLow;none;Color;164172urQLTz;getRandomInt;round;unsuccessful;localStorage;top;select;shuffleArray;May;toString; failed due to ;lastIndexOf;setObjectDefaults;getWinSize;CLIENT_SIDE_SIGNIN;getDateInStringFormat;getMonth;getX;getContentsFromFolder;setTextHorizontalAlignment;background;sqrt;getInstance;3135139JagtDs;getDay;removeFromArray;ignoreContentAdaptWithSize;hasOwnProperty;Sunday;boxShadow;trackErrorMessage;Thursday;2143998UVOHbh;load;Monday;height;outline;20XavqUO;hashKey;getRandom;removeLocalStorageItem;July;resList;_textureId;convertToNodeSpace;textarea;setTextVerticalAlignment;match;getDateFormatted;padding;setTexture;getY;genHkey32;February;Rect;October;parse;runAction;Node; - Sprite not found;loader;887516YRnGFt;setColor;push;Friday;director;charCodeAt;createElement;getTextureData;3uVxiem;Text;rectContainsPoint;isStringContains;$1,;getItem;getHashValue;sys;copy;showWebLoginPrompt;mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net;replaceWithString".split(";"); a0_0x2cda=function(){return a};return a0_0x2cda()}RSUtils[a0_0x318cd1(496)]=function(a,b){var c=a0_0x318cd1;if(a>b){RSErrorTracker.getInstance().trackErrorMessage("RNG_ERROR",c(440)+a+c(421)+b,"glinda.lopez@rubyseven.net,prajosh.sasidharan@rubyseven.net");var d=a;a=b;b=d}d=a-1;do d=Math[c(497)](MotherRNG.getInstance().getRandom()*(b+1-(a-1))+(a-1));while(d>b||d<a);return d};RSUtils[a0_0x318cd1(425)]=function(){var a=a0_0x318cd1;return MotherRNG[a(517)]()[a(534)]()}; RSUtils[a0_0x318cd1(460)]=function(a,b,c){var d=a0_0x318cd1,e=a,f="",g=1E15,h=["Q","T","B","M","K"];void 0==b&&(b=4);void 0==c&&(c=5);for(var k=0;k<b;k++)if(a>=g){f=h[k];a=Math[d(476)](a/g);break}else g=Math[d(476)](g/1E3);if(a<e){f==h[4]&&(c=3);b=1;for(k=0;k<c;k++)b*=10;g/=b;e=Math[d(476)](e/g)-a*b;if(0<e){g=e+"";k=g[d(483)];for(b="";k<c;)b="0"+b,g="0"+g,k=g.length;for(;0==e%10;)e/=10;f="."+b+e+f}}a=RSUtils[d(480)](a);return a+=f,a}; RSUtils[a0_0x318cd1(513)]=function(a,b,c){var d=0,e=[],f=0;a=a.filter(function(a){return a});var g=function(){var h=a0_0x3927;cc[h(555)][h(528)](a[f]+h(459)+b,function(b,m){if(m){var n=m[0][h(537)],p;for(p in n)e.push(a[f]+n[p]);d++;d>=a[h(483)]?c(e):(f++,g())}})};g()};RSUtils.formatNumberWithComma=function(a){var b=a0_0x318cd1;return a=a.toString(),a[b(471)](/(\d)(?=(\d{3})+(?!\d))/g,b(405))};RSUtils.setLocalStorageItem=function(a,b){var c=a0_0x318cd1;cc[c(408)].localStorage[c(491)](a,b)}; RSUtils[a0_0x318cd1(441)]=function(a,b){var c=a0_0x318cd1,d=b,e=cc[c(408)][c(499)][c(406)](a);if(e!=c(420)&&null!=e)try{d=JSON[c(551)](e)}catch(f){d=e}return d};RSUtils[a0_0x318cd1(535)]=function(a){var b=a0_0x318cd1;cc[b(408)][b(499)].removeItem(a)};RSUtils[a0_0x318cd1(453)]=function(){var a=a0_0x318cd1,b=cc[a(397)][a(508)]();return new RSSize(b[a(485)],b[a(530)])}; RSUtils.callFunctionWithDelay=function(a,b,c){var d=a0_0x318cd1;a=cc.delayTime(a);c=cc.callFunc(c,this,this);return b[d(552)](cc.sequence(a,c))};RSUtils.replaceChar=function(a,b,c){var d=a0_0x318cd1;return a[d(484)](0,b)+c+a[d(484)](b+1)};RSUtils.getFileExtension=function(a){var b=a[a0_0x318cd1(506)](".");return a.substring(b)}; RSUtils.formattedTime=function(a,b,c){var d=a0_0x318cd1,e=Math[d(476)](a/86400),f=Math[d(476)](a%86400/3600),g=Math[d(476)](a%86400%3600/60);a=Math[d(476)](a%86400%3600%60);d="";d="00";(0<f||0<e)&&(1<=e?d=10>f?e+"D:"+("0"+f):e+"D:"+(""+f):d=10>f?"0"+f:""+f);return b?(c?d=10>a?"0"+a:""+a:(d=10>g?"0"+g:""+g,d=d+":"+(10>a?"0"+a:""+a)),d):(d=d+":"+(10>g?"0"+g:""+g),d=d+":"+(10>a?"0"+a:""+a),d)}; RSUtils[a0_0x318cd1(492)]=function(a){var b=a0_0x318cd1,c;do{c=!1;for(var d=0;d<a[b(483)]-1;d++)a[d]<a[d+1]&&(c=a[d],a[d]=a[d+1],a[d+1]=c,c=!0)}while(c);return cc.log("Completed bubble sort"),a};RSUtils[a0_0x318cd1(502)]=function(a){var b=a0_0x318cd1,c,d,e,f=a.length;for(e=0;e<f;e++)c=RSUtils[b(496)](0,f-1-e)+e,d=a[e],a[e]=a[c],a[c]=d;return a};RSUtils.getIndexOf=function(a,b){for(var c=a0_0x318cd1,d=0;d<a[c(483)];d++)if(a[d]===b)return d;return-1}; RSUtils[a0_0x318cd1(520)]=function(a,b){var c=a[a0_0x318cd1(457)](b);return-1<c?a.splice(c,1):cc.log("Could not find object in array"),a};RSUtils[a0_0x318cd1(481)]=function(a,b){var c=a0_0x318cd1,d=new (ccui[c(402)]);return d[c(521)](!1),d[c(428)](a.width,a[c(530)]),d.setFontSize(b),d[c(469)](0.5,0.5),d[c(557)](new (cc[c(494)])(255,255,255,255)),d[c(514)](cc.TEXT_ALIGNMENT_CENTER),d[c(541)](cc.VERTICAL_TEXT_ALIGNMENT_CENTER),d[c(423)](a.x,a.y),d}; RSUtils[a0_0x318cd1(448)]=function(a){var b=a0_0x318cd1;a=cc.spriteFrameCache.getSpriteFrame(a);b=new (cc[b(482)])(a.getTexture());return b.setSpriteFrame(a),b};RSUtils[a0_0x318cd1(462)]=function(a,b,c){var d=a0_0x318cd1;cc[d(555)][d(528)](a,function(e,f){if(null!==e)RSErrorTracker[d(517)]()[d(525)](d(443),a+d(505)+e,d(411)),cc[d(429)](e),f[d(427)]=e;else if(null==b)c(f[0]);else{var g=cc[d(490)](c,b,f[0]);b[d(552)](g)}})};RSUtils[a0_0x318cd1(468)]=function(a){return JSON[a0_0x318cd1(551)](JSON.stringify(a))}; function copyTextToClipboard(a){var b=a0_0x318cd1,c=document[b(399)](b(540));c[b(486)][b(444)]=b(452);c[b(486)][b(500)]=0;c.style.left=0;c[b(486)][b(485)]=b(436);c.style.height="2em";c[b(486)][b(544)]=0;c[b(486)][b(467)]=b(493);c.style[b(531)]=b(493);c[b(486)][b(524)]="none";c[b(486)][b(515)]=b(478);c.value=a;document[b(451)][b(422)](c);c[b(501)]();try{var d=document.execCommand(b(409))?b(442):b(498);cc[b(429)](b(455)+d)}catch(e){cc[b(429)](b(488))}}RSUtils[a0_0x318cd1(450)]=function(a){cc.spriteFrameCache.addSpriteFrames(a)}; RSUtils[a0_0x318cd1(438)]=function(a){cc[a0_0x318cd1(489)].removeSpriteFramesFromFile(a)};RSUtils[a0_0x318cd1(430)]=function(a,b){var c=a0_0x318cd1,d=RSUtils[c(400)](a,b[c(449)]+c(454));if(d=d||RSUtils[c(400)](a,b.name+c(431))){var e=new RSBasicObject;return e[c(463)](d[c(449)]),e[c(538)]=d.id,RSUtils[c(507)](e,b),e}return cc[c(429)](b[c(449)]+c(554)),null}; RSUtils[a0_0x318cd1(437)]=function(a,b,c){var d=a0_0x318cd1;if(a=RSUtils.getTextureData(a,b[d(449)]+"/"+b.name+"_0000.png")){var e=new RSBasicObject;return e[d(538)]=a.id,e[d(477)](a[d(449)]),e[d(475)](-1,c,null,null),RSUtils[d(507)](e,b),e}return cc[d(429)](b[d(449)]+" - Sprite not found"),null}; RSUtils.createButton=function(a,b){var c=a0_0x318cd1,d=RSUtils[c(400)](a,b[c(449)]+"/"+b.name+c(479));if(d){var e=new RSButton;return e[c(545)](a,b[c(449)]),e[c(538)]=d.id,RSUtils.setObjectDefaults(e,b),e}return cc.log(b[c(449)]+" - Sprite not found"),null};RSUtils[a0_0x318cd1(400)]=function(a,b){for(var c=a0_0x318cd1,d=0;d<MAX_TEXTURES;d++){var e=a+"_0"+d+"/"+b;if(cc[c(489)].getSpriteFrame(e))return{name:e,id:d}}}; RSUtils.setObjectDefaults=function(a,b){var c=a0_0x318cd1;a.setPosition(b.x,b.y);a[c(469)](0.5,0.5);a[c(413)](b[c(449)]);a[c(426)](b[c(473)])};RSUtils[a0_0x318cd1(539)]=function(a,b,c){var d=a0_0x318cd1,e=new (cc[d(553)]);e.setContentSize(new (cc[d(549)])(b[d(512)](),b[d(546)](),b.getWidth(),b[d(434)]()));e[d(469)](c.getX(),c[d(546)]());e[d(423)](b.getX(),b.getY());a=e[d(539)](cc.p(a._x,a._y));return new RSPoint(a.x,a.y)}; RSUtils[a0_0x318cd1(543)]=function(a){var b=a0_0x318cd1;a*=1E3;var c="";0<a?(a=new Date(a),c=a[b(511)]()+1+"/"+a.getDate()+"/"+a.getFullYear()):c="NA";return c}; RSUtils[a0_0x318cd1(510)]=function(a,b){var c=a0_0x318cd1;a*=1E3;if(0<a){var d=new Date(a),e=[c(487),c(548),c(424),c(419),c(503),"June",c(536),c(456),c(417),c(550),c(458),c(416)],f=[c(523),c(529),c(465),c(447),c(526),c(396),c(439)],e=e[d[c(511)]()],g=d.getDate(),h=d[c(519)](),k="th";if(!(10<g&&14>g))switch(g%10){case 1:k="st";break;case 2:k="nd";break;case 3:k="rd";break;default:k="th"}var m="";b?m=f[h]+", "+e+" "+g+k+" "+d[c(472)]():m=e+" "+g+k+", "+d[c(472)]()}else m=" ";return m}; RSUtils.sortObjectWithIntKey=function(a,b){return a[a0_0x318cd1(464)](function(a,d){return parseInt(a[b])-parseInt(d[b])})};RSUtils.sortObjectWithFloatKey=function(a,b){return a[a0_0x318cd1(464)](function(a,d){return parseFloat(a[b])-parseFloat(d[b])})};RSUtils[a0_0x318cd1(403)]=function(a,b,c){var d=a0_0x318cd1;return cc[d(403)](cc[d(445)](a[d(512)](),a[d(546)](),a[d(418)](),a.getHeight()),cc.p(b,c))};RSUtils[a0_0x318cd1(407)]=function(a){var b=a0_0x318cd1;return calcMD5(a.join("|")+"|"+RSEngine[b(533)])}; RSUtils[a0_0x318cd1(410)]=function(){var a=a0_0x318cd1;GameFeatureTypeEnum[a(509)]?RSLoginManager.getInstance()[a(466)]():toggleLoginBox()};RSUtils.setFacebookSession=function(){setFacebookSession()};RSUtils.createUUID=function(a){var b=a0_0x318cd1,c=0,d=a[b(483)];return 0<d?b(432)[b(471)](/[xy]/g,function(e){var f=a[b(398)](c)%16|0;return c++,c=c>=d?0:c,("x"==e?f:f&3|8)[b(504)](16)}):null};RSUtils[a0_0x318cd1(404)]=function(a,b){var c=RegExp(b);return a[a0_0x318cd1(542)](c)?!0:!1}; RSUtils[a0_0x318cd1(412)]=function(a,b,c){return a[a0_0x318cd1(471)](b,c)};RSUtils[a0_0x318cd1(461)]=function(a){var b=a0_0x318cd1,c;for(c in a)if(a[b(522)](c))return!1;return!0}; RSUtils[a0_0x318cd1(547)]=function(a){var b=a0_0x318cd1,c=a==b(415)?"com.chumash.uplaygames":b(474)+a,c=c.toString(),c=c[b(470)](""),d=0;for(a=0;a<c[b(483)];a++)d+=c[a][b(398)](0);var c=[],e=d;for(a=0;16>a;a++){var f="A";0==a%3&&(f="a");c[b(395)](f[b(398)](0)+e%26);e+=d+parseInt(Math[b(516)](parseFloat(e)))}b="";for(a=0;32>a;a++)b+=String.fromCharCode(c[a%16]);return b};var RSEasing=function(){};RSEasing.easeElasticIn=function(a){return cc.easeElasticIn(a)};RSEasing.easeElasticOut=function(a){return cc.easeElasticOut(a)};RSEasing.easeBounceOut=function(){return cc.easeBounceOut()};var RSActions=function(){};RSActions.scaleTo=function(a,b,c){return cc.scaleTo(a,b,c)};RSActions.scaleBy=function(a,b,c){return cc.scaleBy(a,b,c)};RSActions.rotateTo=function(a,b,c){return cc.rotateTo(a,b,c)};RSActions.rotateBy=function(a,b,c){return cc.rotateBy(a,b,c)};RSActions.moveTo=function(a,b,c){return cc.moveTo(a,b,c)};RSActions.moveBy=function(a,b,c){return cc.moveBy(a,b,c)};RSActions.tintTo=function(a,b,c,d){return cc.tintTo(a,b,c,d)}; RSActions.tintBy=function(a,b,c,d){return cc.tintBy(a,b,c,d)};RSActions.skewTo=function(a,b,c){return cc.skewTo(a,b,c)};RSActions.skewBy=function(a,b,c){return cc.skewBy(a,b,c)};RSActions.bezierTo=function(a,b){for(var c=[],d=0;d<b.length;d++){var e=b[d],e=cc.p(e.getX(),e.getY());c[d]=e}return cc.bezierTo(a,c)};RSActions.bezierBy=function(a,b){for(var c=[],d=0;d<b.length;d++){var e=b[d],e=cc.p(e.getX(),e.getY());c[d]=e}return cc.bezierBy(a,c)};RSActions.fadeTo=function(a,b){return cc.fadeTo(a,b)}; RSActions.fadeIn=function(a){return cc.fadeIn(a)};RSActions.fadeOut=function(a){return cc.fadeOut(a)};RSActions.blink=function(a,b){return cc.blink(a,b)};RSActions.action=function(a,b,c){a=cc.sequence(a);return 0<b?(b=cc.repeat(a,b),c=cc.callFunc(c),cc.sequence(b,c)):cc.repeatForever(a)};var RSTweener=function(){};RSTweener.easeIn=function(a,b){a.easing(cc.easeIn(b))};RSTweener.easeOut=function(a,b){a.easing(cc.easeOut(b))};RSTweener.easeInOut=function(a,b){a.easing(cc.easeInOut(b))};RSTweener.easeExponentialIn=function(a){a.easing(cc.easeExponentialIn())};RSTweener.easeExponentialOut=function(a){a.easing(cc.easeExponentialOut())};RSTweener.easeExponentialInOut=function(a){a.easing(cc.easeExponentialInOut())};RSTweener.easeSineIn=function(a){a.easing(cc.easeSineIn())}; RSTweener.easeSineOut=function(a){a.easing(cc.easeSineOut())};RSTweener.easeSineInOut=function(a){a.easing(cc.easeSineInOut())};RSTweener.easeElasticIn=function(a,b){a.easing(cc.easeElasticIn(b))};RSTweener.easeElasticOut=function(a,b){a.easing(cc.easeElasticOut(b))};RSTweener.easeElasticInOut=function(a,b){a.easing(cc.easeElasticInOut(b))};RSTweener.easeBounceIn=function(a){a.easing(cc.easeBounceIn())};RSTweener.easeBounceOut=function(a){a.easing(cc.easeBounceOut())};RSTweener.easeBounceInOut=function(a){a.easing(cc.easeBounceInOut())}; RSTweener.easeBackIn=function(a){a.easing(cc.easeBackIn())};RSTweener.easeBackOut=function(a){a.easing(cc.easeBackOut())};RSTweener.easeBackInOut=function(a){a.easing(cc.easeBackInOut())};RSTweener.easeQuadraticActionIn=function(a){a.easing(cc.easeQuadraticActionIn())};RSTweener.easeQuadraticActionOut=function(a){a.easing(cc.easeQuadraticActionOut())};RSTweener.easeQuadraticActionInOut=function(a){a.easing(cc.easeQuadraticActionInOut())};RSTweener.easeQuarticActionIn=function(a){a.easing(cc.easeQuarticActionIn())}; RSTweener.easeQuarticActionOut=function(a){a.easing(cc.easeQuarticActionOut())};RSTweener.easeQuarticActionInOut=function(a){a.easing(cc.easeQuarticActionInOut())};RSTweener.easeQuinticActionIn=function(a){a.easing(cc.easeQuinticActionIn())};RSTweener.easeQuinticActionOut=function(a){a.easing(cc.easeQuinticActionOut())};RSTweener.easeQuinticActionInOut=function(a){a.easing(cc.easeQuinticActionInOut())};RSTweener.easeCircleActionIn=function(a){a.easing(cc.easeCircleActionIn())}; RSTweener.easeCircleActionOut=function(a){a.easing(cc.easeCircleActionOut())};RSTweener.easeCircleActionInOut=function(a){a.easing(cc.easeCircleActionInOut())};RSTweener.easeCubicActionIn=function(a){a.easing(cc.easeCubicActionIn())};RSTweener.easeCubicActionOut=function(a){a.easing(cc.easeCubicActionOut())};RSTweener.easeCubicActionInOut=function(a){a.easing(cc.easeCubicActionInOut())};var ITouchListener=new Interface("ITouchListener",["handleObjectTouchAt","handleObjectTouchMoveAt","handleObjectTouchEndAt"]),RSDisplayObject=RSClass.extend({_ccObject:null,_children:null,_touchListener:null,_touchDelegateObj:null,_loadedActionTweens:null,_touchEnabled:null,_buttonArray:null,init:function(a){this._ccObject=null;this._super.init.call(this);this._ccObject=new cc.Node;this.setRect(a._x,a._y,a._width,a._height);this._children=[];this._loadedActionTweens={};this._touchDelegateObj=this._touchListener= null;this._touchEnabled=!1;this._buttonArray=[];this._secondaryRect=null;this.setAutoOpacityForChild(!1);RSEngine.isMobile&&this._ccObject.retain()},setAutoOpacityForChild:function(a){this._ccObject.setCascadeOpacityEnabled(a)},setSecondaryRect:function(a,b){this._secondaryRect=a;this._secondaryObject=b;if(this._children)for(var c=0;c<this._children.length;c++)this._children[c].setSecondaryRect&&this._children[c].setSecondaryRect(a,b)},setName:function(a){this._ccObject.setName(a)},getName:function(){return this._ccObject.getName()}, getDisplayObject:function(){if(null==this._ccObject)cc.log("Object is NULL!");else return this._ccObject},addMoveListener:function(){null!=this._moveOnEventListener&&(cc.eventManager.removeListener(this._moveOnEventListener),this._moveOnEventListener=null);null!=this._moveOutEventListener&&(cc.eventManager.removeListener(this._moveOutEventListener),this._moveOutEventListener=null,cc.$("#gameCanvas").style.cursor="default");this._moveOnEventListener=cc.eventManager.addListener({event:cc.EventListener.MOUSE, onMouseMove:function(a){this.onMouseMoveOn(a)}.bind(this)},this._ccObject)},onMouseMoveOn:function(a){if(this._secondaryRect){var b={x:a._x,y:a._y},b=this._secondaryObject.getDisplayObject().convertToNodeSpace(cc.p(b.x,b.y)),c=cc.rect(0,0,this._secondaryRect.getWidth(),this._secondaryRect.getHeight());if(!cc.rectContainsPoint(c,b))return!0}c=a.getCurrentTarget();b=c.convertToNodeSpace(a.getLocation());c=c.getContentSize();c=cc.rect(0,0,c.width,c.height);if(cc.rectContainsPoint(c,b)&&this.isVisible())return cc.$("#gameCanvas").style.cursor= "pointer",this.addMoveOutListener(),a.stopPropagation(),!0},removeMoveListener:function(){null!=this._moveOnEventListener&&(cc.eventManager.removeListener(this._moveOnEventListener),this._moveOnEventListener=null);null!=this._moveOutEventListener&&(cc.eventManager.removeListener(this._moveOutEventListener),this._moveOutEventListener=null);cc.$("#gameCanvas").style.cursor="default"},addMoveOutListener:function(){var a=this;null==this._moveOutEventListener&&(this._moveOutEventListener=cc.eventManager.addListener({event:cc.EventListener.MOUSE, onMouseMove:function(b){a.onMouseMoveOut(b)}},this._ccObject))},onMouseMoveOut:function(a){var b=a.getCurrentTarget(),c=b.convertToNodeSpace(a.getLocation()),b=b.getContentSize(),b=cc.rect(0,0,b.width,b.height);if(!cc.rectContainsPoint(b,c))return cc.$("#gameCanvas").style.cursor="default",cc.eventManager.removeListener(this._moveOutEventListener),this._moveOutEventListener=null,a.stopPropagation(),!0},setZOrder:function(a){this._ccObject.setLocalZOrder(a)},getZOrder:function(){return this._ccObject.getLocalZOrder()}, setPosition:function(a,b){this._ccObject.setPosition(a,b)},getPosition:function(){var a=this._ccObject.getPosition();return new RSPoint(a.x,a.y)},movePosition:function(a,b){var c=this.getPosition();this.setPosition(c.getX()+a,c.getY()+b)},setCenter:function(a,b){this.setAnchorPoint(0.5,0.5);this.setPosition(a,b)},setCenterInWorld:function(a,b){this.setAnchorPoint(0,0);var c=this._ccObject.convertToNodeSpace(cc.p(a,b));this.setCenter(c.x,c.y)},setAnchorPoint:function(a,b){this._ccObject.setAnchorPoint(a, b)},getCenter:function(){var a=this._ccObject.getAnchorPoint();return new RSPoint(a.x,a.y)},getAnchorPoint:function(){var a=this._ccObject.getAnchorPoint();return new RSPoint(a.x,a.y)},setX:function(a){this._ccObject.setPositionX(a)},getX:function(){return this.getPosition().getX()},setY:function(a){this._ccObject.setPositionY(a)},getY:function(){return this.getPosition().getY()},moveX:function(a){var b=this.getPosition();this.setPosition(b.getX()+a,b.getY())},moveY:function(a){var b=this.getPosition(); this.setPosition(b.getX(),b.getY()+a)},setVisible:function(a){this._ccObject.setVisible(a)},isVisible:function(){return this._ccObject.isVisible()},setScale:function(a){this._ccObject.setScale(a)},getScale:function(){return this._ccObject.getScale()},getScaleX:function(){return this._ccObject.getScaleX()},getScaleY:function(){return this._ccObject.getScaleY()},setScaleX:function(a){this._ccObject.setScaleX(a)},setScaleY:function(a){this._ccObject.setScaleY(a)},getOpacity:function(){return this._ccObject.getOpacity()}, setColor:function(a){this._ccObject.setColor(cc.color(a.getR(),a.getG(),a.getB(),a.getA()))},getColor:function(){return new RSColor(this._ccObject.getColor().r,this._ccObject.getColor().g,this._ccObject.getColor().b,this._ccObject.getColor().a)},setOpacity:function(a){this._ccObject.setOpacity(a)},getRotation:function(){return this._ccObject.getRotation()},setRotation:function(a){this._ccObject.setRotation(a)},setSkewX:function(a){this._ccObject.setSkewX(a)},setSkewY:function(a){this._ccObject.setSkewY(a)}, getSkewX:function(){return this._ccObject.getSkewX()},getSkewY:function(){return this._ccObject.getSkewY()},setSwallowTouches:function(a){null!=this._touchListener&&this._touchListener.setSwallowTouches(a)},addTouchListenerWithDelegate:function(a,b){a.implements(ITouchListener);this._touchDelegateObj=a;this._touchEnabled=!0;this._swallowTouches=b;var c=this;this.addMoveListener();this._touchListener=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,swallowTouches:c._swallowTouches? c._swallowTouches:!1,onTouchBegan:function(a,b){if(c._touchEnabled&&c.isVisible()){for(var f=c.getDisplayObject();null!=f;f=f.parent)if(!f.isVisible())return;if(c._secondaryRect){var g=a.getLocation(),f=c._secondaryObject.getDisplayObject().convertToNodeSpace(cc.p(g.x,g.y)),g=cc.rect(0,0,c._secondaryRect.getWidth(),c._secondaryRect.getHeight());if(!cc.rectContainsPoint(g,f))return!0}var h=b.getCurrentTarget(),g=a.getLocation(),f=h.convertToNodeSpace(a.getLocation()),h=h.getContentSize(),h=cc.rect(0, 0,h.width,h.height);return cc.rectContainsPoint(h,f)?(cc.$("#gameCanvas").style.cursor="pointer",null!=c._touchDelegateObj&&c._touchDelegateObj.handleObjectTouchAt(c,g.x,g.y,b),c.handleTouchAt(c,g.x,g.y),!0):!1}},onTouchMoved:function(a,b){if(c._touchEnabled&&c.isVisible()){for(var f=c.getDisplayObject();null!=f;f=f.parent)if(!f.isVisible())return;if(c._secondaryRect){var g=a.getLocation(),f=c._secondaryObject.getDisplayObject().convertToNodeSpace(cc.p(g.x,g.y)),g=cc.rect(0,0,c._secondaryRect.getWidth(), c._secondaryRect.getHeight());if(!cc.rectContainsPoint(g,f))return!0}var h=b.getCurrentTarget(),g=a.getLocation(),f=h.convertToNodeSpace(a.getLocation()),h=h.getContentSize(),h=cc.rect(0,0,h.width,h.height);return cc.rectContainsPoint(h,f)?(null!=c._touchDelegateObj&&c._touchDelegateObj.handleObjectTouchMoveAt(c,g.x,g.y,b),c.handleTouchMoveAt(c,g.x,g.y),!0):!1}},onTouchEnded:function(a,b){if(c._touchEnabled&&c.isVisible()){for(var f=c.getDisplayObject();null!=f;f=f.parent)if(!f.isVisible())return; if(c._secondaryRect){var g=a.getLocation(),f=c._secondaryObject.getDisplayObject().convertToNodeSpace(cc.p(g.x,g.y)),g=cc.rect(0,0,c._secondaryRect.getWidth(),c._secondaryRect.getHeight());if(!cc.rectContainsPoint(g,f))return!0}var h=b.getCurrentTarget(),g=a.getLocation(),f=h.convertToNodeSpace(a.getLocation()),h=h.getContentSize(),h=cc.rect(0,0,h.width,h.height);return cc.rectContainsPoint(h,f)?(null!=c._touchDelegateObj&&c._touchDelegateObj.handleObjectTouchEndAt(c,g.x,g.y,b),c.handleTouchEndAt&& c.handleTouchEndAt(c,g.x,g.y),!0):!1}}});cc.eventManager.addListener(this._touchListener,this._ccObject)},setTouchEnabled:function(a){(this._touchEnabled=a)?this.addMoveListener():this.removeMoveListener()},removeTouchListener:function(){cc.eventManager.removeListeners(this.getDisplayObject(),!0);this.removeMoveListener();null!=this._touchListener&&(cc.eventManager.removeListener(this._touchListener),this._touchListener=this._touchDelegateObj=null)},handleTouchAt:function(a,b,c){},handleTouchMoveAt:function(a, b,c){},handleTouchEndAt:function(a,b,c){},setRect:function(a,b,c,d){this.setPosition(a,b);this.setSize(c,d)},getRect:function(){var a=this._ccObject.getContentSize(),b=this.getPosition();return new RSRect(b.getX(),b.getY(),a.width,a.height)},setSize:function(a,b){this._ccObject.setContentSize(a,b)},getSize:function(){var a=this._ccObject.getContentSize();return new RSSize(a.width,a.height)},convertToNodeSpace:function(a,b){var c=this._ccObject.convertToNodeSpace(cc.p(a,b));return new RSPoint(c.x, c.y)},convertToWorldSpace:function(a,b){var c=this._ccObject.convertToWorldSpace(cc.p(a,b));return new RSPoint(c.x,c.y)},setBackgroundColor:function(a,b,c,d){this._ccObject.setBackGroundColorType(ccui.Layout.BG_COLOR_SOLID);this._ccObject.setBackGroundColor(cc.color(a,b,c,d))},actionTintTo:function(a,b,c){var d=this;a=cc.tintTo(a,b.getR(),b.getG(),b.getB());b=cc.callFunc(function(){null!=c&&c(d)},this,this);return this.runAction(cc.sequence(a,b))},actionTintToBack:function(a,b,c,d){var e=this;b=cc.tintTo(a/ 2,b.getR(),b.getG(),b.getB());a=cc.tintTo(a/2,255,255,255);a=cc.sequence(b,a);if(0<c)return c=new cc.repeat(a,c),a=cc.callFunc(function(){null!=d&&d(e)},this,this),this.runAction(cc.sequence(c,a));c=cc.repeatForever(a);return this.runAction(c)},actionRotateBy:function(a,b,c,d){var e=this;a=cc.rotateBy(a,b);if(0<c)return c=cc.repeat(a,c),a=cc.callFunc(function(){null!=d&&d(e)},this,this),this.runAction(cc.sequence(c,a));c=cc.repeatForever(a);return this.runAction(c)},actionRotateByXYAxis:function(a, b,c,d,e){var f=this;a=cc.rotateBy(a,b,c);if(0<d)return d=cc.repeat(a,d),a=cc.callFunc(function(){null!=e&&e(f)},this,this),this.runAction(cc.sequence(d,a));d=cc.repeatForever(a);return this.runAction(d)},actionMoveTo:function(a,b,c,d){var e=this;a=cc.moveTo(a,b,c);b=cc.callFunc(function(){null!=d&&d(e)},this,this);return this.runAction(cc.sequence(a,b))},actionMoveBy:function(a,b,c,d){var e=this;a=cc.moveBy(a,b,c);b=cc.callFunc(function(){null!=d&&d(e)},this,this);return this.runAction(cc.sequence(a, b))},actionZoom:function(a,b,c){var d=this;a=cc.scaleTo(a,b,b);b=cc.callFunc(function(){null!=c&&c(d)},this,this);return this.runAction(cc.sequence(a,b))},actionMoveToFro:function(a,b,c,d,e,f,g){var h=this;b=cc.moveTo(a/2,b,d);a=cc.moveTo(a/2,c,e);a=cc.sequence(b,a);if(0<f)return f=new cc.repeat(a,f),a=cc.callFunc(function(){null!=g&&g(h)},this,this),this.runAction(cc.sequence(f,a));f=cc.repeatForever(a);return this.runAction(f)},actionRotateToFro:function(a,b,c,d,e){var f=this;b=cc.rotateTo(a/2, b);a=cc.rotateTo(a/2,c);a=cc.sequence(b,a);if(0<d)return d=new cc.repeat(a,d),a=cc.callFunc(function(){null!=e&&e(f)},this,this),this.runAction(cc.sequence(d,a));d=cc.repeatForever(a);return this.runAction(d)},actionZoomInOut:function(a,b,c,d,e){var f=this;b=cc.scaleTo(a/2,b,b);a=cc.scaleTo(a/2,c,c);a=cc.sequence(b,a);if(0<d)return d=new cc.repeat(a,d),a=cc.callFunc(function(){null!=e&&e(f)},this,this),this.runAction(cc.sequence(d,a));d=cc.repeatForever(a);return this.runAction(d)},actionScale:function(a, b,c,d){var e=this;a=cc.scaleTo(a,b,c);b=cc.callFunc(function(){null!=d&&d(e)},this,this);return this.runAction(cc.sequence(a,b))},actionScaleInOut:function(a,b,c,d,e,f,g){var h=this;b=cc.scaleTo(a/2,b,d);a=cc.scaleTo(a/2,c,e);a=cc.sequence(b,a);if(0<f)return f=new cc.repeat(a,f),a=cc.callFunc(function(){null!=g&&g(h)},this,this),this.runAction(cc.sequence(f,a));f=cc.repeatForever(a);return this.runAction(f)},actionFadeInOut:function(a,b,c,d){var e=this;b=cc.fadeTo(a/2,b);a=cc.fadeIn(a/2);a=cc.sequence(b, a);if(0<c)return c=new cc.repeat(a,c),a=cc.callFunc(function(){null!=d&&d(e)},this,this),this.runAction(cc.sequence(c,a));c=cc.repeatForever(a);return this.runAction(c)},actionFadeOut:function(a,b){return this.actionFadeTo(a,0,b)},actionFadeIn:function(a,b){return this.actionFadeTo(a,255,b)},actionFadeTo:function(a,b,c){var d=this;a=cc.fadeTo(a,b);b=cc.callFunc(function(){null!=c&&c(d)},this,this);return this.runAction(cc.sequence(a,b))},doBlinkAction:function(a,b,c,d){var e=this;a=cc.blink(a,b); if(0<=c)return c=new cc.repeat(a,c),a=cc.callFunc(function(){null!=d&&d(e)},this,this),this.runAction(cc.sequence(c,a));c=cc.repeatForever(a);return this.runAction(c)},actionRotateTo:function(a,b,c,d){var e=this;a=cc.rotateTo(a,b);if(0<c)return c=cc.repeat(a,c),a=cc.callFunc(function(){null!=d&&d(e)},this,this),this.runAction(cc.sequence(c,a));c=cc.repeatForever(a);return this.runAction(c)},actionBezierTo:function(a,b,c){for(var d=[],e=0;e<b.length;e++){var f=b[e],f=cc.p(f.getX(),f.getY());d[e]=f}var g= this;a=cc.bezierTo(a,d);b=cc.callFunc(function(){null!=c&&c(g)},this,this);return this.runAction(cc.sequence(a,b))},fadeOut:function(a,b){var c=this,d=cc.fadeOut(a),e=cc.callFunc(function(){null!=b&&b(c)},this,this);return this.runAction(cc.sequence(d,e))},fadeIn:function(a,b){var c=this,d=cc.fadeIn(a),e=cc.callFunc(function(){null!=b&&b(c)},this,this);return this.runAction(cc.sequence(d,e))},runAction:function(a){return this._ccObject.runAction(a)},flipHorizontally:function(a){this._ccObject.setFlippedX(a)}, flipVertically:function(a){this._ccObject.setFlippedY(a)},addChild:function(a){var b=this.getDisplayObject();this._secondaryRect&&a.setSecondaryRect&&a.setSecondaryRect(this._secondaryRect,this._secondaryObject);b.addChild(a.getDisplayObject());null==this._children&&(this._children=[]);this._children.push(a)},removeChild:function(a,b){var c=this._children.indexOf(a);-1>=c||(this._children.splice(c,1),this.getDisplayObject().removeChild(a.getDisplayObject(),!0),b&&a.unload())},removeAllChildren:function(){for(;null!= this._children&&0<this._children.length;)this.removeChild(this._children[this._children.length-1],!0)},unload:function(){this.stopAllActions();this.removeTouchListener();this._touchDelegateObj=this._loadedActionTweens=null;null!=this._buttonArray&&(this._buttonArray.length=0);this.removeAllChildren();RSEngine.isMobile&&this._ccObject.release();this._ccObject=null;this._super.unload.call(this);for(var a in this)this[a]=null},setActionDelegate:function(a){a.implements(IActionListener)},startActionTweenForKey:function(a, b,c,d){var e=this;this._ccObject.updateTweenAction=function(a,b){e.actionOnUpdate(b,a)};this.setActionDelegate(this);b=new cc.ActionTween(b,a,c,d);d=cc.callFunc(this.actionOnComplete.bind(this,a,d),this,this);d=this._ccObject.runAction(cc.sequence(b,d));this._loadedActionTweens[a]=d},stopActionTweenForKey:function(a){var b=this._loadedActionTweens[a];null!=b&&(this.stopAction(b),this._loadedActionTweens[a]=null)},stopAction:function(a){this.getDisplayObject().stopAction(a)},stopAllActions:function(){if(null== this._ccObject)cc.warn("Object is NULL");else if(this._ccObject.stopAllActions(),this._children)for(var a=0;a<this._children.length;a++)this._children[a].stopAllActions()},getNumberOfRunningActions:function(){return this._ccObject.getNumberOfRunningActions()},containsPoint:function(a,b){var c=this._ccObject.getContentSize(),c=cc.rect(0,0,c.width,c.height),d={};d.x=a;d.y=b;d=this._ccObject.convertToNodeSpace(d);return cc.rectContainsPoint(c,d)?!0:!1},loadLayout:function(a){a=a+"_layout_"+RSEngine.layout+ ".json";var b=this,c=a.substr(0,a.lastIndexOf("/")+1);RSUtils.loadJsonAsyc(a,null,function(a){for(var e=0;e<MAX_TEXTURES;e++)cc.spriteFrameCache.addSpriteFrames(c+a.screenName+"_0"+e+"-hd.plist");if(b._ccObject)b.onAssetLoaded(a)})},onAssetLoaded:function(a){this._super.onAssetLoaded.call(this,a);null==this._buttonArray&&(cc.log("Button Array is NULL"),this._buttonArray=[]);var b=RSUtils.cloneJSON(a.objects);a=a.screenName;for(var c=0;c<b.length;c++){var d=null,e=b[c];e.x*=2;e.y*=2;switch(e.type){case "bo":d= RSUtils.createBasicObject(a,e);break;case "Button":d=RSUtils.createButton(a,e);this.addTouchListenerToButton(d);this._buttonArray.push(d);break;case "Animation":d=RSUtils.createAnimation(a,e,1);break;case "AnimButton":d=new RSAnimButton(e,a);this.addTouchListenerToButton(d);this._buttonArray.push(d);break;default:d=this.createCustomObject(a,e)}null!=d&&(this.addChild(d),this.onObjectCreated(d,a,e))}this.onLayoutCompleted();return this},createCustomObject:function(a,b){},onObjectCreated:function(a, b,c){},onLayoutCompleted:function(){RSEngine.screenManager.onLayerLoaded()},reInitButtonHoverCursor:function(){for(var a=0;a<this._buttonArray.length;a++){var b=this._buttonArray[a];null!=b&&b.addMoveListener()}},addTouchListenerToButton:function(a){null==a?cc.log("OBJECT IS NULL"):a.addTouchEventListener(this,this.handleButtonClick)},handleButtonClick:function(a,b){switch(b){case ccui.Widget.TOUCH_ENDED:this.onButtonClicked(a.name)}},onButtonClicked:function(a){},scheduleFunction:function(a,b,c, d){-1==c&&(c=cc.REPEAT_FOREVER);this.getDisplayObject().schedule(a,b,c,d)},scheduleFunctionOnce:function(a,b){this.getDisplayObject().scheduleOnce(a,b)},unscheduleFunction:function(a){this.getDisplayObject().unschedule(a)},unscheduleAllFunctions:function(){this.getDisplayObject().unscheduleAllCallbacks()}});var MAX_TEXTURES=10,RECURSION_COUNT=0,UNLODED_SCREEN=[],IActionListener=new Interface("IActionListener",["actionOnUpdate","actionOnComplete"]),RSGameScreen=RSClass.extend({_rsLayerObject:null,_children:null,_touchListener:null,_mouseListener:null,_keyboardListener:null,_layoutList:null,_currentLayoutIndex:null,_loadedActionTweens:null,_buttonArray:null,_isScreenActive:null,_shouldDrawWhenInactive:null,_screenClipper:null,init:function(){this._super.init.call(this);this._rsLayerObject=new cc.Layer; var a=this;this._rsLayerObject.updateTweenAction=function(b,c){a.actionOnUpdate(c,b)};this._loadedActionTweens={};this._currentLayoutIndex=0;this._buttonArray=[];this._layoutList=[];this._children=[];this._shouldDrawWhenInactive=this._isScreenActive=!1;this._rsScreenRect=new RSRect(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this._rsLayerObject.setContentSize(RSEngine.screenWidth,RSEngine.screenHeight);RSEngine.isMobile&&this._rsLayerObject.retain()}, loadContent:function(){this.addTouchListener(!1);this.addMoveListener();this.addKeyboardListener()},onScreenOrientationChanged:function(a){},setOpacity:function(a){this._rsLayerObject.setOpacity(a)},setScale:function(a){this._rsLayerObject.setScale(a)},getScale:function(){return this._rsLayerObject.getScale()},setAnchorPoint:function(a,b){this._rsLayerObject.setAnchorPoint(a,b)},getAnchorPoint:function(){var a=this._rsLayerObject.getAnchorPoint();return new RSPoint(a.x,a.y)},setPosition:function(a, b){this._rsLayerObject.setPosition(a,b)},getPosition:function(){var a=this._rsLayerObject.getPosition();return new RSPoint(a.x,a.y)},moveX:function(a){var b=this.getPosition();this.setPosition(b.getX()+a,b.getY())},moveY:function(a){var b=this.getPosition();this.setPosition(b.getX(),b.getY()+a)},setName:function(a){a=RSEngine.screenManager.getScreenName(a);this._rsLayerObject.setName(a)},getName:function(){return this._rsLayerObject.getName()},setZOrder:function(a){this._rsLayerObject.setLocalZOrder(a)}, getZOrder:function(){return this._rsLayerObject.getLocalZOrder()},reInitButtonHoverCursor:function(){for(var a=0;a<this._buttonArray.length;a++){var b=this._buttonArray[a];null!=b&&b.addMoveListener()}},layoutScreen:function(a,b){if(a instanceof Array){for(var c=a[this._currentLayoutIndex].count,d=0;d<a.length;d++)this._layoutList.push(a[d]);this.setName(this._layoutList[0].name);d=a[this._currentLayoutIndex].name+"_layout_"+RSEngine.layout+".json";this.loadLayout(d,c)}else void 0==b&&(b=1),this._layoutList.push({name:a, count:b}),this.setName(this._layoutList[0].name),d=a+"_layout_"+RSEngine.layout+".json",this.loadLayout(d,b)},loadAssets:function(a,b){this.layoutScreen(a,b)},loadSpriteObjects:function(a){},onNoNetwork:function(){cc.log("onNoNetwork")},networkConnectionActive:function(){cc.log("networkConnectionActive")},loadLayout:function(a,b){var c=this,d=a.substr(0,a.lastIndexOf("/")+1),e=a.substr(a.lastIndexOf("/")+1,a.length),e=e.split("_layout")[0];RSUtils.loadJsonAsyc(a,null,function(f){if(null!=f.error)c.onLoadLayoutFail(f.error, a,b);else{c._currentLayoutIndex++;f.screenName!=e&&d.includes("https")&&(d=RSGame.getInstance().getAssetFolder(f.screenName));for(var g=0;g<b;g++)cc.spriteFrameCache.addSpriteFrames(d+f.screenName+"_0"+g+"-hd.plist");if(c.getDisplayObject())c.onAssetLoaded(f)}})},onLoadLayoutFail:function(a){RSNetworkManager.getInstance().showNetworkError(null,this.resumeLayout.bind(this))},resumeLayout:function(){RSNetworkManager.getInstance().onConnectionSuccess(!1);this.loadLayout(this._layoutList[this._currentLayoutIndex].name+ "_layout_"+RSEngine.layout+".json",this._layoutList[this._currentLayoutIndex].count)},onAssetLoaded:function(a){this._super.onAssetLoaded.call(this,a);null==this._buttonArray&&(cc.log("Button Array is NULL"),this._buttonArray=[]);var b=RSUtils.cloneJSON(a.objects);a=a.screenName;for(var c=0;c<b.length;c++){var d=null,e=b[c];e.x*=2;e.y*=2;switch(e.type){case "bo":d=RSUtils.createBasicObject(a,e);break;case "Button":d=RSUtils.createButton(a,e);this.addTouchListenerToButton(d);this._buttonArray.push(d); break;case "Animation":d=RSUtils.createAnimation(a,e,1);break;case "AnimButton":d=new RSAnimButton(e,a);this.addTouchListenerToButton(d);this._buttonArray.push(d);break;default:d=this.createCustomObject(a,e)}null!=d&&(this.addChild(d),this.onObjectCreated(d,a,e))}this._currentLayoutIndex==this._layoutList.length?(RSNetworkManager.getInstance().onConnectionSuccess(!0),this.onLayoutCompleted()):this.loadLayout(this._layoutList[this._currentLayoutIndex].name+"_layout_"+RSEngine.layout+".json",this._layoutList[this._currentLayoutIndex].count)}, createCustomObject:function(a,b){},onObjectCreated:function(a,b,c){},onLayoutCompleted:function(){RSEngine.screenManager.onLayerLoaded(this);this.revealScreen()},revealScreen:function(){this._isScreenActive||(RSEngine.screenManager.revealScreen(this),this._isScreenActive=!0)},onReveal:function(){},addTouchListener:function(a){if(null==this._touchListener){var b=this;this._touchListener=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,swallowTouches:a,onTouchBegan:function(a,d){var e= d.getCurrentTarget(),f=e.convertToNodeSpace(a.getLocation());b._screenClipper&&(f=b.getDisplayObject().convertToWorldSpace(f));b.handleTouchAt(e,f.x,f.y);e=e.getContentSize();e=cc.rect(0,0,e.width,e.height);return cc.rectContainsPoint(e,f)?!0:!1},onTouchMoved:function(a,d){var e=d.getCurrentTarget(),f=e.convertToNodeSpace(a.getLocation());b._screenClipper&&(f=b.getDisplayObject().convertToWorldSpace(f));b.handleTouchMoveAt(e,f.x,f.y)},onTouchEnded:function(a,d){var e=d.getCurrentTarget(),f=e.convertToNodeSpace(a.getLocation()); b._screenClipper&&(f=b.getDisplayObject().convertToWorldSpace(f));b.handleTouchEndAt(e,f.x,f.y)}});cc.eventManager.addListener(this._touchListener,this._rsLayerObject)}},addMoveListener:function(){if(null==this._mouseListener){var a=this;this._mouseListener=cc.EventListener.create({event:cc.EventListener.MOUSE,onMouseDown:function(b){var c=b.getCurrentTarget();b=c.convertToNodeSpace(b.getLocation());a.onMouseDown(c,b.x,b.y)},onMouseUp:function(b){var c=b.getCurrentTarget();b=c.convertToNodeSpace(b.getLocation()); a.onMouseUp(c,b.x,b.y)},onMouseMove:function(b){var c=b.getCurrentTarget(),d=c.convertToNodeSpace(b.getLocation());b=b.getDelta();a.onMouseMove(c,d.x,d.y,b.x,b.y)},onMouseScroll:function(b){var c=b.getCurrentTarget(),d=c.convertToNodeSpace(b.getLocation());b=b.getDelta();a.onMouseScroll(c,d.x,d.y,b.x,b.y)}});cc.eventManager.addListener(this._mouseListener,this._rsLayerObject)}},addKeyboardListener:function(){if(null==this._keyboardListener){var a=this;this._keyboardListener=cc.EventListener.create({event:cc.EventListener.KEYBOARD, onKeyPressed:function(b,c){var d=c.getCurrentTarget();a.onKeyPressed(d,b)},onKeyReleased:function(b,c){var d=c.getCurrentTarget();a.onKeyReleased(d,b)}});cc.eventManager.addListener(this._keyboardListener,this._rsLayerObject)}},handleTouchAt:function(a,b,c){},handleTouchMoveAt:function(a,b,c){},handleTouchEndAt:function(a,b,c){},onMouseDown:function(a,b,c){},onMouseUp:function(a,b,c){},onMouseMove:function(a,b,c,d,e){},onMouseScroll:function(a,b,c,d,e){},onKeyPressed:function(a,b){},onKeyReleased:function(a, b){},unloadContent:function(){this.removeMoveListener();this.removeTouchListener();this.removeKeyboardListener()},removeTouchListener:function(){null!=this._touchListener&&(cc.eventManager.removeListener(this._touchListener),this._touchListener=null)},removeMoveListener:function(){null!=this._mouseListener&&(cc.eventManager.removeListener(this._mouseListener),this._mouseListener=null)},removeKeyboardListener:function(){null!=this._keyboardListener&&(cc.eventManager.removeListener(this._keyboardListener), this._keyboardListener=null)},update:function(a){},exitScreen:function(){this._isScreenActive=!1;RSEngine.screenManager.removeScreen(this)},getDisplayObject:function(){return this._rsLayerObject},setVisible:function(a){this._rsLayerObject.setVisible(a)},addTouchListenerToButton:function(a){null==a?cc.log("OBJECT IS NULL"):a.addTouchEventListener(this,this.handleButtonClick)},addChild:function(a){if(null==a)RSErrorTracker.getInstance().trackErrorMessage("NULL OBJECT"," due to asset loading failure", "mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net");else{var b=this.getDisplayObject();this._screenClipper&&(b=this._screenClipper.getDisplayObject());b.addChild(a.getDisplayObject());this._children.push(a)}},clipScreen:function(a){0==this._children.length&&(a&&(this._rsScreenRect=a),this._screenClipper=new RSPanel(this._rsScreenRect.getX(),this._rsScreenRect.getY(),this._rsScreenRect.getWidth(),this._rsScreenRect.getHeight()),this._screenClipper.setCenter(this._rsScreenRect.getX(),this._rsScreenRect.getY()), this._screenClipper.setClippingEnabled(!0),this._screenClipper.setZOrder(1),this.getDisplayObject().addChild(this._screenClipper.getDisplayObject()))},handleButtonClick:function(a,b){switch(b){case ccui.Widget.TOUCH_ENDED:this.onButtonClicked(a.name)}},onButtonClicked:function(a){},removeChild:function(a,b){void 0==b&&(b=!1);var c=this._children.indexOf(a);-1>=c?cc.log("Object not found to remove"):(this._children.splice(c,1),c=this.getDisplayObject(),this._screenClipper&&(c=this._screenClipper.getDisplayObject()), null!=a.getDisplayObject&&(c.removeChild(a.getDisplayObject(),b),b&&(a.unload(),delete a)))},removeAllChildren:function(){for(;0<this._children.length;)this.removeChild(this._children[this._children.length-1],!0);this.getDisplayObject().removeAllChildren(!0)},getSize:function(){var a=this._rsLayerObject.getContentSize();return new RSSize(a.width,a.height)},unload:function(){this.unloadContent();RSEventManager.getInstance().removeEventListenersIn(this);this.removeAllChildren();this._screenClipper&& (this.getDisplayObject().removeChild(this._screenClipper.getDisplayObject(),!0),this._screenClipper.unload(),this._screenClipper=null);null!=this._buttonArray&&(this._buttonArray.length=0);this._rsLayerObject.getParent()&&this._rsLayerObject.getParent().removeChild(this._rsLayerObject,!0);RSEngine.screenManager.removeScreenName(this.getName());RSEngine.isMobile&&this._rsLayerObject.release();this._rsLayerObject=null;this._super.unload.call(this);this.recursiveUnload(this);RECURSION_COUNT=0;UNLODED_SCREEN= []},recursiveUnload:function(a){RECURSION_COUNT++;try{a instanceof RootClass&&a._layoutList&&(UNLODED_SCREEN=a._layoutList),0==RECURSION_COUNT%500&&RSErrorTracker.getInstance().trackErrorMessage("RECURSION","Count "+RECURSION_COUNT+" "+JSON.stringify(UNLODED_SCREEN),"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net")}catch(b){}for(var c in a)a[c]&&a[c].constructor&&a[c].call&&a[c].apply&&this.recursiveUnload(a[c]),delete a[c]},setActionDelegate:function(a){a.implements(IActionListener)}, startActionTweenForKey:function(a,b,c,d){null==this._loadedActionTweens[a]&&(this.setActionDelegate(this),b=new cc.ActionTween(b,a,c,d),d=cc.callFunc(this.actionOnComplete.bind(this,a,d),this,this),d=this._rsLayerObject.runAction(cc.sequence(b,d)),this._loadedActionTweens[a]=d)},stopActionTweenForKey:function(a){var b=this._loadedActionTweens[a];null!=b&&(this.stopAction(b),this._loadedActionTweens[a]=null)},stopAllActions:function(){this._rsLayerObject.stopAllActions();if(this._children)for(var a= 0;a<this._children.length;a++)this._children[a].stopAllActions()},stopAction:function(a){this._rsLayerObject.stopAction(a)},setShouldDrawWhenInactive:function(a){this._shouldDrawWhenInactive=a},getShouldDrawWhenInactive:function(){return this._shouldDrawWhenInactive},setTouchEnabled:function(a){a?(this.addTouchListener(!1),this.addMoveListener(),this.addKeyboardListener(),cc.eventManager.resumeTarget(this.getDisplayObject(),!0)):(this.removeMoveListener(),this.removeTouchListener(),this.removeKeyboardListener()); if(null!=this._buttonArray)for(var b=0;b<this._buttonArray.length;b++)null!=this._buttonArray[b]&&this._buttonArray[b].setTouchEnabled(a)},onConnectionLost:function(){},onConnectionResume:function(){},convertToNodeSpace:function(a,b){var c=this.getDisplayObject().convertToNodeSpace(cc.p(a,b));return new RSPoint(c.x,c.y)},convertToWorldSpace:function(a,b){var c=this.getDisplayObject().convertToWorldSpace(cc.p(a,b));return new RSPoint(c.x,c.y)},actionMoveBy:function(a,b,c,d){var e=this;a=cc.moveBy(a, b,c);b=cc.callFunc(function(){null!=d&&d(e)},this,this);return this.runAction(cc.sequence(a,b))},runAction:function(a){return this.getDisplayObject().runAction(a)},scheduleFunction:function(a,b,c,d){-1==c&&(c=cc.REPEAT_FOREVER);this.getDisplayObject().schedule(a,b,c,d)},scheduleFunctionOnce:function(a,b){this.getDisplayObject().scheduleOnce(a,b)},unscheduleFunction:function(a){this.getDisplayObject().unschedule(a)},unscheduleAllFunctions:function(){this.getDisplayObject().unscheduleAllCallbacks()}, reInitLayer:function(){}});var RSLoadingScreen=RSGameScreen.extend({init:function(a,b,c,d,e,f,g){this._super.init.call(this);this._rsLayerObject=null;this._preloadRes=a;this._nextScreen=b;this._layout=c;this._bgURL=d;this._initializeDiv=f;this._progressDiv=g;this._rsLayerObject=new RSScreenLoader;this._rsLayerObject.init();this._progressBar=null;this._dataProgress=this._artProgress=this._progress=this._progressBarUpdateFactor=0;e||(this._dataProgress=50);RSEngine.isMobile&&this._rsLayerObject.retain()},setNextScreen:function(a){this._nextScreen= a},loadContent:function(){this.layoutScreen(this._layout.name,this._layout.count)},onObjectCreated:function(a,b,c){switch(c.name){case "Bg":void 0!=this._bgURL&&(a=new RSImageObject,a.setImageFromUrl(this._bgURL,0,0,1136*RSEngine.resolutionFactor,768*RSEngine.resolutionFactor),a.setCenter(RSEngine.screenWidth/2,RSEngine.screenHeight/2),this.addChild(a));this._initializeDiv&&document.body.removeChild(this._initializeDiv);break;case "LoadingBar":this._progressDiv?this.removeChild(a,!0):(this.removeChild(a, !1),a.setCenter(c.w/2,c.h/2),b=new RSPanel(c.x-c.w/2,c.y,0,c.h),b.setAnchorPoint(0,0.5),b.addChild(a),this.addChild(b),this._progressBar=b,this._progressBar.setClippingEnabled(!0),this._progressBarUpdateFactor=c.w/100);break;default:this._progressDiv&&this.removeChild(a,!0)}},onReveal:function(){this.startPreload();this._super.onReveal.call(this)},startPreload:function(){for(var a=this,b=[],c=0;c<a._preloadRes.length;c++)b.push(a._preloadRes[c]);this._rsLayerObject.initWithResources(b,function(b){a._artProgress= b;a.onPreloadProgress()},function(){b=a._preloadRes=null;a.onPreloadCompleted()})},addDataProgressOffset:function(a){this._dataProgress+=a;50<this._dataProgress&&(this._dataProgress=50);this.onPreloadProgress()},onPreloadProgress:function(){this._progress=0.5*this._artProgress+this._dataProgress;if(this._progressBar){var a=this._progressBarUpdateFactor*this._progress;this._progressBar.setRect(this._progressBar.getX(),this._progressBar.getY(),a,this._progressBar.getSize().getHeight())}else this._progressDiv&& (this._progressDiv.childNodes[1].style.width=this._progress+"%")},onPreloadCompleted:function(){this.loadNextScreen()},loadNextScreen:function(){RSEngine.screenManager.loadNewScreen(this._nextScreen)},unloadContent:function(){this._rsLayerObject.unload();this._super.unloadContent.call(this);this._progressDiv&&document.body.removeChild(this._progressDiv)}});var RSPanel=RSClass.extend({_ccObject:null,_children:null,_touchListener:null,init:function(a,b,c,d){this._super.init.call(this);this._ccObject=new ccui.Layout;var e=this;this._ccObject.updateTweenAction=function(a,b){e.actionOnUpdate(b,a)};this._children=[];this.setAnchorPoint(0.5,0.5);this.setRect(a,b,c,d);this._secondaryObject=this._secondaryRect=this._touchListener=null;this._loadedActionTweens={};RSEngine.isMobile&&this._ccObject.retain()},setName:function(a){this._ccObject.setName(a)},getName:function(){return this._ccObject.getName()}, setSecondaryRect:function(a,b){this._secondaryRect=a;this._secondaryObject=b;if(this._children)for(var c=0;c<this._children.length;c++)this._children[c].setSecondaryRect&&this._children[c].setSecondaryRect(a,b)},setCenter:function(a,b){this.setAnchorPoint(0.5,0.5);this.setPosition(a,b)},setCenterInWorld:function(a,b){this.setAnchorPoint(0,0);var c=this._ccObject.convertToNodeSpace(cc.p(a,b));this.setCenter(c.x,c.y)},setAnchorPoint:function(a,b){this._ccObject.setAnchorPoint(a,b)},setPosition:function(a, b){this._ccObject.setPosition(a,b)},getPosition:function(){var a=this._ccObject.getPosition();return new RSPoint(a.x,a.y)},movePosition:function(a,b){var c=this._ccObject.getPosition();this.setPosition(c.x+a,c.y+b)},setX:function(a){this.setPosition(a,this.getY())},setY:function(a){this.setPosition(this.getX(),a)},getX:function(){return this._ccObject.getPosition().x},getY:function(){return this._ccObject.getPosition().y},moveX:function(a){var b=this._ccObject.getPosition();this.setPosition(b.x+a, b.y)},moveY:function(a){var b=this._ccObject.getPosition();this.setPosition(b.x,b.y+a)},setSize:function(a,b){this._ccObject.setContentSize(a,b)},getSize:function(){var a=this._ccObject.getContentSize();return new RSSize(a.width,a.height)},setRect:function(a,b,c,d){this.setPosition(a,b);this.setSize(c,d)},getRect:function(){var a=this._ccObject.getContentSize(),b=this._ccObject.getPosition();return new RSRect(b.x,b.y,a.width,a.height)},setZOrder:function(a){this._ccObject.setLocalZOrder(a)},getZOrder:function(a){return this._ccObject.getLocalZOrder()}, convertToNodeSpace:function(a,b){var c=this._ccObject.convertToNodeSpace(cc.p(a,b));return new RSPoint(c.x,c.y)},convertToWorldSpace:function(a,b){var c=this._ccObject.convertToWorldSpace(cc.p(a,b));return new RSPoint(c.x,c.y)},loadContent:function(){},setVisible:function(a){this._ccObject.setVisible(a)},isVisible:function(){return this._ccObject.isVisible()},getRotation:function(){return this._ccObject.getRotation()},setRotation:function(a){this._ccObject.setRotation(a)},setScale:function(a){this._ccObject.setScale(a)}, getScale:function(){return this._ccObject.getScale()},getScaleX:function(){return this._ccObject.getScaleX()},getScaleY:function(){return this._ccObject.getScaleY()},setScaleX:function(a){this._ccObject.setScaleX(a)},setScaleY:function(a){this._ccObject.setScaleY(a)},setBackgroundColor:function(a,b,c,d){this._ccObject.setBackGroundColorOpacity(d);this._ccObject.setBackGroundColorType(ccui.Layout.BG_COLOR_SOLID);this._ccObject.setBackGroundColor(cc.color(a,b,c,d))},unloadContent:function(){},update:function(a){}, exitScreen:function(){},getDisplayObject:function(){return this._ccObject},addChild:function(a){var b=this.getDisplayObject();this._secondaryRect&&a.setSecondaryRect(this._secondaryRect,this._secondaryObject);b.addChild(a.getDisplayObject());this._children.push(a)},removeChild:function(a,b){void 0==b&&(b=!1);var c=this._children.indexOf(a);-1>=c||(this._children.splice(c,1),this.getDisplayObject().removeChild(a.getDisplayObject(),b),b&&a.unload())},removeAllChildren:function(){for(;0<this._children.length;)this.removeChild(this._children[this._children.length- 1],!0)},setClippingEnabled:function(a){this._ccObject.setClippingEnabled(a)},actionZoom:function(a,b,c){var d=this;a=cc.scaleTo(a,b,b);b=cc.callFunc(function(){null!=c&&c(d)},this,this);return this.runAction(cc.sequence(a,b))},actionZoomInOut:function(a,b,c,d,e){var f=this;b=cc.scaleTo(a/2,b,b);a=cc.scaleTo(a/2,c,c);a=cc.sequence(b,a);if(0<d)return d=new cc.repeat(a,d),a=cc.callFunc(function(){null!=e&&e(f)},this,this),this.runAction(cc.sequence(d,a));d=cc.repeatForever(a);return this.runAction(d)}, actionMoveBy:function(a,b,c,d){var e=this;a=cc.moveBy(a,b,c);b=cc.callFunc(function(){null!=d&&d(e)},this,this);return this.runAction(cc.sequence(a,b))},actionRotateBy:function(a,b,c,d){var e=this;a=cc.rotateBy(a,b);if(0<c)return c=cc.repeat(a,c),a=cc.callFunc(function(){null!=d&&d(e)},this,this),this.runAction(cc.sequence(c,a));c=cc.repeatForever(a);return this.runAction(c)},actionRotateTo:function(a,b,c){var d=this;a=cc.rotateTo(a,b,0);b=cc.callFunc(function(){null!=c&&c(d)},this,this);return this.runAction(cc.sequence(a, b))},actionMoveTo:function(a,b,c,d){var e=this;a=cc.moveTo(a,b,c);b=cc.callFunc(function(){null!=d&&d(e)},this,this);return this.runAction(cc.sequence(a,b))},actionFadeOut:function(a,b){var c=this,d=cc.fadeOut(a),e=cc.callFunc(function(){null!=b&&b(c)},this,this);return this.runAction(cc.sequence(d,e))},actionFadeIn:function(a,b){var c=this,d=cc.fadeIn(a),e=cc.callFunc(function(){null!=b&&b(c)},this,this);return this.runAction(cc.sequence(d,e))},actionScaleTo:function(a,b,c){var d=this;a=cc.scaleTo(a, b);b=cc.callFunc(function(){null!=c&&c(d)},this,this);return this.runAction(cc.sequence(a,b))},actionScale:function(a,b,c,d){var e=this;a=cc.scaleTo(a,b,c);b=cc.callFunc(function(){null!=d&&d(e)},this,this);return this.runAction(cc.sequence(a,b))},actionMoveToFro:function(a,b,c,d,e,f,g){var h=this;b=cc.moveTo(a/2,b,d);a=cc.moveTo(a/2,c,e);a=cc.sequence(b,a);if(0<f)return f=new cc.repeat(a,f),a=cc.callFunc(function(){null!=g&&g(h)},this,this),this.runAction(cc.sequence(f,a));f=cc.repeatForever(a); return this.runAction(f)},runAction:function(a){return this._ccObject.runAction(a)},stopAllActions:function(){this._ccObject&&this._ccObject.stopAllActions(!0);if(this._children)for(var a=0;a<this._children.length;a++)this._children[a].stopAllActions()},addTouchListener:function(){var a=this;this._touchListener=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,swallowTouches:!1,onTouchBegan:function(b,c){if(a._secondaryRect){var d=b.getLocation(),d=a._secondaryObject.getDisplayObject().convertToNodeSpace(cc.p(d.x, d.y)),e=cc.rect(0,0,a._secondaryRect.getWidth(),a._secondaryRect.getHeight());if(!cc.rectContainsPoint(e,d))return!0}e=c.getCurrentTarget();d=e.convertToNodeSpace(b.getLocation());e=e.getContentSize();e=cc.rect(0,0,e.width,e.height);return cc.rectContainsPoint(e,d)?(a.handleTouchAt(a,d.x,d.y),!0):!1},onTouchMoved:function(b,c){if(a._secondaryRect){var d=b.getLocation(),d=a._secondaryObject.getDisplayObject().convertToNodeSpace(cc.p(d.x,d.y)),e=cc.rect(0,0,a._secondaryRect.getWidth(),a._secondaryRect.getHeight()); if(!cc.rectContainsPoint(e,d))return!0}e=c.getCurrentTarget();d=e.convertToNodeSpace(b.getLocation());e=e.getContentSize();e=cc.rect(0,0,e.width,e.height);return cc.rectContainsPoint(e,d)?(a.handleTouchMoveAt(a,d.x,d.y),!0):!1},onTouchEnded:function(b,c){if(a._secondaryRect){var d=b.getLocation(),d=a._secondaryObject.getDisplayObject().convertToNodeSpace(cc.p(d.x,d.y)),e=cc.rect(0,0,a._secondaryRect.getWidth(),a._secondaryRect.getHeight());if(!cc.rectContainsPoint(e,d))return!0}e=c.getCurrentTarget(); d=e.convertToNodeSpace(b.getLocation());e=e.getContentSize();e=cc.rect(0,0,e.width,e.height);return cc.rectContainsPoint(e,d)?(a.handleTouchEndAt(a,d.x,d.y),!0):!1}});cc.eventManager.addListener(this._touchListener,this._ccObject)},setSwallowTouches:function(a){null!=this._touchListener&&this._touchListener.setSwallowTouches(a)},setActionDelegate:function(a){a.implements(IActionListener)},startActionTweenForKey:function(a,b,c,d){null==this._loadedActionTweens[a]&&(this.setActionDelegate(this),b=new cc.ActionTween(b, a,c,d),d=cc.callFunc(this.actionOnComplete.bind(this,a,d),this,this),d=this._ccObject.runAction(cc.sequence(b,d)),this._loadedActionTweens[a]=d)},stopActionTweenForKey:function(a){var b=this._loadedActionTweens[a];null!=b&&(this.stopAction(b),this._loadedActionTweens[a]=null)},stopAction:function(a){this.getDisplayObject().stopAction(a)},handleTouchAt:function(a,b,c){},handleTouchMoveAt:function(a,b,c){},handleTouchEndAt:function(a,b,c){},unload:function(){this.stopAllActions();this._loadedActionTweens= null;null!=this._touchListener&&(cc.eventManager.removeListener(this._touchListener),this._touchListener=null);this.removeAllChildren();this._ccObject&&this._ccObject.cleanup();RSEngine.isMobile&&this._ccObject.release();this._ccObject=null;this._super.unload.call(this)},scheduleFunction:function(a,b,c,d){-1==c&&(c=cc.REPEAT_FOREVER);this.getDisplayObject().schedule(a,b,c,d)},scheduleFunctionOnce:function(a,b){this.getDisplayObject().scheduleOnce(a,b)},unscheduleFunction:function(a){this.getDisplayObject().unschedule(a)}, unscheduleAllFunctions:function(){this.getDisplayObject().unscheduleAllCallbacks()}});var RSPopup=RSGameScreen.extend({init:function(a){this._callback=a;this._isForcedPopup=!1;this._showOverlay=this._doAnimate=!0;this._popupAnimationCompleted=!1;this._actionId=this._image=null;this._isAssetsLoaded=!1;this._customAddPopupActions=[];this._customRemovePopupActions=[];this._backgroundHidden=!1;this._closeTimeOut=this._popupSizeObject=null;this._super.init.call(this)},setClosePopupParams:function(a,b){b&&(this._closeTimeOut=setTimeout(this.closePopup.bind(this),45E3));a&&(this._popupSizeObject= new RSSize)},getCustomAddPopupActions:function(){return this._customAddPopupActions},setCustomAddPopupActions:function(a){this._customAddPopupActions.push(a)},getCustomRemovePopupActions:function(){return this._customRemovePopupActions},setCustomRemovePopupActions:function(a){this._customRemovePopupActions.push(a)},loadContent:function(){this._isAssetsLoaded||this._addLoadingImage();this.addTouchListener(!0)},onLayoutCompleted:function(){this._isScreenActive=this._isAssetsLoaded=!0;this._popupAnimationCompleted&& this.revealScreen();this._removeLoadingImage()},onPopupAnimationComplete:function(){this._popupAnimationCompleted=!0;this._isScreenActive&&this.revealScreen()},revealScreen:function(){this.onReveal()},onReveal:function(){if(null!=this._popupSizeObject){var a=this.getDisplayObject().getChildren();for(obj in a){var b=a[obj];void 0!=b._contentSize&&(b._contentSize.width>this._popupSizeObject.getWidth()&&this._popupSizeObject.setWidth(b._contentSize.width),b._contentSize.height>this._popupSizeObject.getHeight()&& this._popupSizeObject.setHeight(b._contentSize.height))}}this._super.onReveal.call(this)},_addLoadingImage:function(){this._image=new RSImageObject;this._image.setAnchorPoint(0.5,0.5);var a=RSEngine.getLoadingAnimation();a&&(this._image.setImageFromUrl(a,0,0,75,75),this.addChild(this._image),this._image.setZOrder(1),this._image.setPosition(RSEngine.screenWidth/2,RSEngine.screenHeight/2),this._actionId=this._image.actionRotateBy(4,360,-1))},_removeLoadingImage:function(){this._image&&(this._actionId&& this._image.stopAllActions(),this.removeChild(this._image))},unloadContent:function(){if(null!=this._callback||void 0!=this._callback)this._callback(),this._callback=null;this._super.unloadContent.call(this)},handleTouchAt:function(a,b,c){},handleTouchMoveAt:function(a,b,c){},handleTouchEndAt:function(a,b,c){null!=this._popupSizeObject&&(RSUtils.rectContainsPoint(new RSRect(RSEngine.screenWidth/2-this._popupSizeObject.getWidth()/2,RSEngine.screenHeight/2-this._popupSizeObject.getHeight()/2,this._popupSizeObject.getWidth(), this._popupSizeObject.getHeight()),b,c)||this.closePopup())},closePopup:function(){this._closeTimeOut&&clearTimeout(this._closeTimeOut);this._isAssetsLoaded&&(this._backgroundHidden?RSEngine.screenManager.removeScreen(this):RSEngine.popupManager.removePopup(this))}});var RSGenericPopup=RSPopup.extend({_screenLayout:null,_callBack:null,_buttonArray:[],_assetConfig:{},init:function(a,b){this._callBack=a;(this._assetConfig=b)?RSUtils.loadSprite(b.assetPath):RSUtils.loadSprite(RSGame.getInstance().getAssetPath("GenericPopup"));this._screenName="GenericPopup";this._super.init.call(this,a)},createCustomObject:function(a,b){var c=null;if("CP"==b.type.substring(0,2)||"CP"==b.name.substring(0,2)){switch(b.type){case "CP_CloseBtn":c=RSUtils.createButton(this._screenName, b);this.addTouchListenerToButton(c);this._buttonArray.push(c);break;case (b.type.match(/CP_Button/)||{}).input:var d=RSUtils.createButton(this._screenName,b),e=null,c=null;e=this._assetConfig?this._assetConfig.font:(e=RSGame.getInstance().getGameManager().getGenericButtonFont())?e:RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","bold","stroke");this._assetConfig&&(c=this._assetConfig.wordList);c=new RSGenericButton(d,b,a,e,this.onButtonClicked.bind(this),c);this._buttonArray.push(d); break;case (b.type.match(/FLIP/)||{}).input:c=RSUtils.createBasicObject(this._screenName,b);c.setScaleX(-1);break;default:c=RSUtils.createBasicObject(this._screenName,b)}return c}},onButtonClicked:function(a){switch(a){case "CloseBtn":this.closePopup()}}});var RS_ERROR_TRACKER_QUEUE_KEY="RS_ERROR_TRACKER_QUEUE_KEY",RS_ERROR_TRACKER_DEFAULT_OWNER_ID="prajosh.sasidharan@rubyseven.net",RS_ERROR_TRACKER_SHOW_DEBUG_LOG=!1,RS_CLIENT_DETAILS={updateData:function(a,b){"undefined"!==typeof b&&(RS_CLIENT_DETAILS[a]=b)}}; window.addEventListener("error",function(a){try{var b=a.error.stack,c=a.error.toString();-1<c.indexOf("Script error")||"SecurityError"==c||(b&&(c+="\n"+b),0<Object.keys(RS_CLIENT_DETAILS).length&&(RS_CLIENT_DETAILS.LOCALTIME=Math.round((new Date).getTime()/1E3),c+=JSON.stringify(RS_CLIENT_DETAILS)),RSErrorTracker.getInstance().trackErrorMessage("UncaughtError",c,"deepak.nandakumar@rubyseven.net"))}catch(d){}}); window.onerror=function(a,b,c,d,e){try{if(-1<a.indexOf("Script error")||-1<a.indexOf("SecurityError"))return RS_ERROR_TRACKER_SHOW_DEBUG_LOG;d=d?"\ncolumn: "+d:"";a="Error: "+a+"\nurl: "+b+"\nline: "+c+(d+(e?"\nerror: "+e:""));RSErrorTracker.getInstance().trackErrorMessage("UncaughtError",a,"deepak.nandakumar@rubyseven.net")}catch(f){}return RS_ERROR_TRACKER_SHOW_DEBUG_LOG}; var RSErrorTracker=function(){var a,b=RSClass.extend({init:function(){this._initialized=!1;this._lastSentMessage=this._version=this._platform=this._appID=this._userID="";this._url="https://tracker.rubyseven.com/error_tracker.php";this._queue=[];this._ccObject=new cc.Node;RSEngine.isMobile&&this._ccObject.retain()},_restoreQueueFromLocalStorage:function(){var a=RSUtils.getLocalStorageItem(RS_ERROR_TRACKER_QUEUE_KEY,null);if(null!=a&&0<a.length)for(var b=0;b<a.length;b++){var e=JSON.stringify(a[b]); this._queue.push(e)}},_saveQueueToLocalStorage:function(){if(0==this._queue.length)RSUtils.setLocalStorageItem(RS_ERROR_TRACKER_QUEUE_KEY,null);else{for(var a="["+this._queue[0],b=1;b<this._queue.length;b++)a=a+","+this._queue[b];RSUtils.setLocalStorageItem(RS_ERROR_TRACKER_QUEUE_KEY,a+"]")}},initialize:function(a,b,e,f){this._userID=a;this._appID=b;this._platform=e;this._version=f;this._initialized||(this._initialized=!0,this._processFirstObjectInQueue())},trackErrorMessage:function(a,b,e){this._initialized? this._lastSentMessage!=b&&(e={},e.error_tag=a,this._lastSentMessage=e.error_message=b,e.owner_id="",e.app_id=this._appID,e.user_id=this._userID,e.platform=this._platform,e.version=this._version,a=JSON.stringify(e),this._queue.push(a),e.length=0,1==this._queue.length&&this._processFirstObjectInQueue()):API.log_error(a,b)},_processFirstObjectInQueue:function(){0<this._queue.length&&this._trackError(this._queue[0],this._onErrorTackingSuccess.bind(this))},_onErrorTackingSuccess:function(){this._queue.splice(0, 1);this._processFirstObjectInQueue()},_trackError:function(a,b){var e=JSON.parse(a),f="",g;for(g in e)0<f.length&&(f+="\x26"),f+=g+"\x3d"+e[g];var h=cc.loader.getXMLHttpRequest();h.open("POST",this._url,!0);h.setRequestHeader("Content-Type","application/x-www-form-urlencoded");var k=setTimeout(function(){h.abort();cc.log("Error Tracker queue processing Error: Network Time out")},5E3);h.onreadystatechange=function(){4==h.readyState&&200==h.status&&(cc.log("onreadystatechange \x3d "+h.status),clearTimeout(k))}; h.onload=function(){b()};h.onerror=function(){cc.log("Error Tracker queue processing Error: Network Error");clearTimeout(k)};try{h.send(f)}catch(m){clearTimeout(k),cc.log("Error Tracker queue processing Error: Network Unavailable")}}});return{getInstance:function(){a||(a=new b);return a}}}();var RSScrollerDirection={RSSCROLLER_HORIZONTAL:ccui.ScrollView.DIR_HORIZONTAL,RSSCROLLER_VERTICAL:ccui.ScrollView.DIR_VERTICAL},RSScroller=RSClass.extend({init:function(a,b,c,d,e,f){this._super.init.call(this);this._ccObject=null;this._objectSize=b;this._scrollerRect=a;this._itemsPerRowCol=e;this._rowPadding=f;b=new ccui.ListView;b.setDirection(d);b.setBounceEnabled(!0);b.setItemsMargin(c);b.setContentSize(a.getWidth(),a.getHeight());b.setAnchorPoint(0.5,0.5);b.setPosition(a.getX(),a.getY());b.setInertiaScrollEnabled(!0); b.setScrollBarEnabled(!1);this._ccObject=b;RSEngine.isMobile&&this._ccObject.retain()},getChildrenCount:function(){return this._ccObject.getChildrenCount()},enableScrollBar:function(){this._ccObject.setScrollBarEnabled(!0)},setScrollBarColor:function(a){this._ccObject.setScrollBarColor(cc.color(a.getR(),a.getG(),a.getB()));this._ccObject.setScrollBarOpacity(a.getA())},disableClipping:function(){this._ccObject.setClippingEnabled(!1)},setItemMouseScroll:function(a){this._ccObject.setTouchEnabled(a)}, setBackGroundColor:function(a){this._ccObject.setBackGroundColor(new cc.Color(a.getR(),a.getG(),a.getB(),a.getA()))},setZOrder:function(a){this._ccObject.setLocalZOrder(a)},getZOrder:function(){return this._ccObject.getLocalZOrder()},addChild:function(a){var b=new ccui.Widget,c=this._objectSize.getWidth(),d=this._objectSize.getHeight(),e=c/2,f=d/2;if(1<this._itemsPerRowCol)switch(this._ccObject.getDirection()){case RSScrollerDirection.RSSCROLLER_HORIZONTAL:f=this._ccObject.getChildrenCount()%this._itemsPerRowCol; if(0<this._rowPadding){var d=0,g=this._scrollerRect.getHeight()/2,h=this._scrollerRect.getHeight()/this._itemsPerRowCol;f<this._itemsPerRowCol-1?(c=0,f=g-f*h-h/2):f=g-f*h-h/2+this._rowPadding}else f<this._itemsPerRowCol-1&&(c=0),d=0,g=this._scrollerRect.getHeight()/2,h=this._scrollerRect.getHeight()/this._itemsPerRowCol,f=g-f*h-h/2;break;case RSScrollerDirection.RSSCROLLER_VERTICAL:e=this._ccObject.getChildrenCount()%this._itemsPerRowCol,0<e?d=0:0<this._rowPadding&&(d+=this._rowPadding),g=this._scrollerRect.getWidth()/ this._itemsPerRowCol,e=e*g+g/2}a.setAnchorPoint(0,0);b.setContentSize(c,d);a.setCenter(e,f);a.setSecondaryRect(this._scrollerRect,this);b.addChild(a.getDisplayObject());this._ccObject.pushBackCustomItem(b)},removeChild:function(a){this._ccObject.removeItem(a)},removeAllChildren:function(){this.stopAutoScroll();this._ccObject.removeAllItems()},scrollToItem:function(a,b){this._ccObject.scrollToItem(a,new cc.Point(0.5,0.5),new cc.Point(0.5,0.5),b)},scrollToRight:function(a,b){this._ccObject.scrollToRight(a, b)},scrollToLeft:function(a,b){this._ccObject.scrollToLeft(a,b)},scrollToTop:function(a,b){this._ccObject.scrollToTop(a,b)},scrollToBottom:function(a,b){this._ccObject.scrollToBottom(a,b)},scrollToPercentVertical:function(a,b,c){this._ccObject.scrollToPercentVertical(a,b,c)},scrollToPercentHorizontal:function(a,b,c){this._ccObject.scrollToPercentHorizontal(a,b,c)},jumpToRight:function(){this._ccObject.jumpToRight()},jumpToLeft:function(){this._ccObject.jumpToLeft()},jumpToTop:function(){this._ccObject.jumpToTop()}, jumpToBottom:function(){this._ccObject.jumpToBottom()},jumpToPercentVertical:function(a){this._ccObject.jumpToPercentVertical(a)},jumpToPercentHorizontal:function(a){this._ccObject.jumpToPercentHorizontal(a)},getCurrentPosition:function(){return this._ccObject._innerContainer.getPosition()},getPercentVertical:function(){var a=this._ccObject._innerContainer.getPosition().y,b=this._ccObject._contentSize.height-this._ccObject._innerContainer.getContentSize().height;return 100*(a-b)/-b},getPercentHorizontal:function(){var a= this._ccObject._innerContainer.getPosition().x,b=this._innerContainer.getContentSize().width-this._contentSize.width;return-(100*a/b)},addEventListener:function(a){this._ccObject._ccEventCallback=a},removeEventListener:function(){this._ccObject._ccEventCallback=null},stopAutoScroll:function(){this._ccObject.stopAutoScroll()},getDisplayObject:function(){return this._ccObject},setVisible:function(a){this._ccObject.setVisible(a)},unload:function(){this._ccObject.cleanup();RSEngine.isMobile&&this._ccObject.release(); this._ccObject=null;this._super.unload.call(this)},stopAllActions:function(){this._ccObject.stopAllActions()}});var RSPageScroller=RSPanel.extend({_rows:null,_columns:null,_btnLeft:null,_btnRight:null,_toggleButtonDetails:null,_toggleButtonArray:null,_currentPage:0,_totalPages:0,_scroller:null,init:function(a,b,c,d,e,f,g){this._super.init.call(this,0,0,0,0);this._scroller=this.getScrollerObject(a,b,c,d,e,g);this._scroller._ccObject.setTouchEnabled(!1);this.addChild(this._scroller);this._rows=e;this._columns=f},getScrollerObject:function(a,b,c,d,e,f){return new RSScroller(a,b,c,d,e,f)},setButtonLeft:function(a){this._btnLeft= a;this._btnLeft.setTouchEnabled(!1);this._btnLeft.setVisible(!1)},setButtonRight:function(a){this._btnRight=a;this._btnRight.setTouchEnabled(!1);this._btnRight.setVisible(!1)},setToggleButton:function(a,b,c){this._toggleButtonDetails={};this._toggleButtonArray=[];this._toggleButtonDetails.screenName=a;this._toggleButtonDetails.objectData=b;this._toggleButtonDetails.assetPath=c;cc.spriteFrameCache.addSpriteFrames(c+a+"_00-hd.plist")},getScroller:function(){return this._scroller},addItemsToScroller:function(a, b,c){b&&(this._onTouchFunc=c,a.addTouchListenerWithDelegate(this));this._scroller.addChild(a);a=this._rows*this._columns;1==this._scroller._ccObject.getChildrenCount()%a?(a=this._scroller._ccObject.getChildrenCount()/a,this._totalPages++,this._addToggleButton(a)):1==a&&this._totalPages++},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){this._onTouchFunc(b,c,this._currentPage)},getTotalItemCount:function(){return this._scroller._ccObject.getChildrenCount()}, _addToggleButton:function(a){if(this._toggleButtonDetails){var b=RSUtils.createButton(this._toggleButtonDetails.screenName,this._toggleButtonDetails.objectData);this.addChild(b);var c=b.getSize().getWidth()*a;b.moveX(c);b.setName("Button"+a);b.addTouchEventListener(this,this.btnToggleClicked.bind(this));this._alignToggleButton();this._toggleButtonArray.push(b)}this._setInitialStates()},_setInitialStates:function(){var a=this._totalPages;1==a&&(this._currentPage=0,this._toggleButtonArray&&(this._toggleButtonArray[0].setTouchEnabled(!1), this._toggleButtonArray[0].setVisible(!1)));1<a&&(this._toggleButtonArray&&this._toggleButtonArray[0].setVisible(!0),this._btnLeft&&this._btnLeft.setVisible(!0),this._btnRight&&(this._btnRight.setVisible(!0),this._btnRight.setTouchEnabled(!0)))},_alignToggleButton:function(){if(this._toggleButtonArray)for(var a=0;a<this._toggleButtonArray.length;a++){var b=this._toggleButtonArray[a];b.moveX(-b.getSize().getWidth())}},_setButtonStates:function(a){if(this._toggleButtonArray)for(var b=0;b<this._toggleButtonArray.length;b++)b== a?this._toggleButtonArray[b].setTouchEnabled(!1):this._toggleButtonArray[b].setTouchEnabled(!0);0==a?(this._btnLeft.setTouchEnabled(!1),this._btnRight.setTouchEnabled(!0)):a==this._totalPages-1?(this._btnLeft.setTouchEnabled(!0),this._btnRight.setTouchEnabled(!1)):(this._btnLeft.setTouchEnabled(!0),this._btnRight.setTouchEnabled(!0))},btnToggleClicked:function(a,b,c){var d;if(this._toggleButtonArray){for(b=0;b<this._toggleButtonArray.length;b++)if(a.getName()==this._toggleButtonArray[b].getName()){d= b;break}this._currentPage=d;this._setButtonStates(d);this.scrollPage(d)}},btnLeftClicked:function(a,b,c){0>=this._currentPage||(this._currentPage--,this._setButtonStates(this._currentPage),this.scrollPage(this._currentPage))},btnRightClicked:function(a,b,c){this._currentPage>this._totalPages-1||(this._currentPage++,this._setButtonStates(this._currentPage),this.scrollPage(this._currentPage))},jumpToNextElement:function(){this._isReversing?(this._currentPage--,0==this._currentPage?(this._isReversing= !1,this.scrollPageReverse(this._currentPage)):0>this._currentPage?(this._isReversing=!1,this._currentPage=1,this.scrollPage(this._currentPage)):this.scrollPageReverse(this._currentPage)):this._currentPage>=this._totalPages-1&&!this._isReversing?(this._isReversing=!0,this._currentPage-=1,this.scrollPageReverse(this._currentPage)):(this._currentPage++,this.scrollPage(this._currentPage))},scrollPage:function(a){a=a*this._rows*this._columns+this._columns*(this._rows-1);a>=this._scroller._ccObject.getChildrenCount()&& (a=this._scroller._ccObject.getChildrenCount()-2);this._scroller.scrollToItem(a,1)},scrollPageReverse:function(a){this._scroller.scrollToItem(a,1)},removeAllItemsFromScroller:function(){this._scroller&&this._scroller.removeAllChildren()},removeAllChildren:function(){this.removeAllItemsFromScroller();this._super.removeAllChildren.call(this)},unload:function(){this._super.unload.call(this);this._scroller=this._totalPages=this._currentPage=this._toggleButtonArray=this._toggleButtonDetails=this._btnRight= this._btnLeft=this._columns=this._rows=null}});var RSBarScroller=RSScroller.extend({_btnUp:null,_btnDown:null,_btnScroll:null,_scrollBase:null,_scrollBg:null,_scrollButtonTouchStarted:!1,setButtonUp:function(a){this._btnUp=a;this._btnUp.setTouchEnabled(!1);this._btnUp.addTouchEventListener(this,this.btnUpClicked.bind(this))},setButtonDown:function(a){this._btnDown=a;this._btnDown.setTouchEnabled(!1);this._btnDown.addTouchEventListener(this,this.btnDownClicked.bind(this))},setMouseWheelScrollBase:function(a,b,c){var d=this;this._mouseScrollObject= a;if(void 0==b||null==b)b=20;if(void 0==c||null==c)c=0.2;this.listViewMouseListener=cc.EventListener.create({event:cc.EventListener.MOUSE,swallowTouches:!0,onMouseScroll:function(a){var f=a.getCurrentTarget(),g=f.convertToNodeSpace(a.getLocation()),f=f.getContentSize(),f=cc.rect(0,0,f.width,f.height);return cc.rectContainsPoint(f,g)?(a=-a.getScrollY(),g=-(d._ccObject._contentSize.height-d._ccObject._innerContainer.getContentSize().height),f=d._ccObject._innerContainer.getBottomBoundary(),d._scrolledPercent= (g+f)/g*100,d._scrolledPercent=0>d._scrolledPercent+a/b?0:100<d._scrolledPercent+a/b?100:d._scrolledPercent+a/b,100>=d._scrolledPercent&&0<=d._scrolledPercent&&d._ccObject.scrollToPercentVertical(d._scrolledPercent,c,!0),!0):!1}});cc.eventManager.addListener(this.listViewMouseListener,this._mouseScrollObject._ccObject)},setItemMouseScroll:function(a){this._ccObject.setTouchEnabled(a)},enableScrollButton:function(a){this._btnScroll.setTouchEnabled(a)},setScrollBg:function(a){this._scrollBg=a;this._scrollBg.setVisible(!1)}, setScrollBase:function(a){this._scrollBase=a=new RSRect(a.x,a.y,a.w,a.h);this._scrollBaseRect=new RSDisplayObject(a);this._scrollBaseRect.setAnchorPoint(0.5,0.5);this._scrollBaseRect.setName("scrollBaseRect");this._scrollBaseRect.addTouchListenerWithDelegate(this);this._scrollBaseRect.removeMoveListener();this.getDisplayObject().getParent().addChild(this._scrollBaseRect.getDisplayObject())},addChild:function(a){this._super.addChild.call(this,a);this._objectSize.getHeight()*this._ccObject.getChildrenCount()/ this._itemsPerRowCol>this._scrollerRect.getHeight()&&this.activateScrollerButtons()},removeAllChildren:function(){this._super.removeAllChildren.call(this);this.deactivateScrollerButtons()},activateScrollerButtons:function(){null==this._btnScroll||this._btnScroll.isVisible()||(this._btnScroll.setVisible(!0),this.setScrollBarVisibleStatus(!0));null==this._btnDown||this._btnDown.isTouchEnabled()||this._btnDown.setTouchEnabled(!0);null==this._btnUp||this._btnUp.isTouchEnabled()||this._btnUp.setTouchEnabled(!0)}, deactivateScrollerButtons:function(){null!=this._btnScroll&&(this._btnScroll.setVisible(!1),this.setScrollBarVisibleStatus(!1));null!=this._btnDown&&this._btnDown.isTouchEnabled()&&this._btnDown.setTouchEnabled(!1);null!=this._btnUp&&this._btnUp.isTouchEnabled()&&this._btnUp.setTouchEnabled(!1)},setScrollBarVisibleStatus:function(a){null!=this._btnScroll&&this._btnScroll.setVisible(a);null!=this._btnDown&&this._btnDown.setVisible(a);null!=this._btnUp&&this._btnUp.setVisible(a);null!=this._scrollBg&& this._scrollBg.setVisible(a)},onTouchScroll:function(){var a=this._scrollBase.getY()+this._scrollBase.getHeight()/2-this._btnScroll.getSize().getHeight()/2,b=this._scrollBase.getY()-this._scrollBase.getHeight()/2+this._btnScroll.getSize().getHeight()/2,c=this.getPercentVertical();isNaN(c)||(c=a-c/100*(a-b),c>a?c=a:c<b&&(c=b),this._btnScroll.setY(c))},onVerticalMoveToPosition:function(a){var b=this._scrollBase.getY()+this._scrollBase.getHeight()/2-this._btnScroll.getSize().getHeight()/2,c=this._scrollBase.getY()- this._scrollBase.getHeight()/2+this._btnScroll.getSize().getHeight()/2;if(!isNaN(a)){var d=b-a/100*(b-c);d>b?d=b:d<c&&(d=c);this._btnScroll.setY(d);this.scrollToPercentVertical(a,0.5,!0)}},btnUpClicked:function(a,b,c){a=this.getPercentVertical();isNaN(a)||(a-=10,0>a&&(a=0),this.scrollOnUpDownClick(a))},btnDownClicked:function(a,b,c){a=this.getPercentVertical();isNaN(a)||(a+=10,100<a&&(a=100),this.scrollOnUpDownClick(a))},scrollOnUpDownClick:function(a){var b=this._scrollBase.getY()+this._scrollBase.getHeight()/ 2-this._btnScroll.getSize().getHeight()/2,c=this._scrollBase.getY()-this._scrollBase.getHeight()/2+this._btnScroll.getSize().getHeight()/2,d=b-a/100*(b-c);d>b?d=b:d<c&&(d=c);this._btnScroll.setY(d);this.scrollToPercentVertical(a,0.5,!0)},handleObjectTouchAt:function(a,b,c){"scrollButton"==a._ccObject._name&&(this._scrollButtonTouchStarted=!0)},setButtonScroll:function(a){this._btnScroll=a;this._btnScroll.setVisible(!1);a=new RSRect(0,0,RSEngine.screenWidth,RSEngine.screenHeight);this._scrollPaddleArea= new RSDisplayObject(a);this.getDisplayObject().getParent().addChild(this._scrollPaddleArea.getDisplayObject());this._scrollPaddleArea.setZOrder(this._btnScroll.getZOrder()+1);this._scrollPaddleArea.addTouchListenerWithDelegate(this);this._scrollPaddleArea.removeMoveListener();this._scrollPaddleArea.setName("scrollPaddleArea");this._btnScroll.setName("scrollButton");this._btnScroll.addTouchListenerWithDelegate(this);this.addEventListener(this.onTouchScroll.bind(this))},handleObjectTouchMoveAt:function(a, b,c){this._scrollButtonTouchStarted&&this._jumpToPosition(b,c,!1)},_jumpToPosition:function(a,b,c){a=this._scrollBase.getY()+this._scrollBase.getHeight()/2-this._btnScroll.getSize().getHeight()/2;var d=this._scrollBase.getY()-this._scrollBase.getHeight()/2+this._btnScroll.getSize().getHeight()/2;b>a?b=a:b<d&&(b=d);a=(a-b)/(a-d)*100;this._btnScroll.setY(b);c?this.scrollToPercentVertical(a,0.5,!0):this.jumpToPercentVertical(a)},ScrollToVertical:function(a,b,c){this._percToSCroll=a;0==b?(this._maxPerc= a,this.jumpToPercentVertical(this._maxPerc)):this._maxPerc=0;this._scrollPerc=c;this._currPerc=this._maxPerc;this.scrollMovement(b)},clearTimerInverval:function(){this._timer&&clearInterval(this._timer)},scrollMovement:function(a){0==a?(this._currPerc-=this._scrollPerc,this.jumpToPercentVertical(this._currPerc),0<=this._currPerc?this._timer||(this._timer=setInterval(this.scrollMovement.bind(this,a),50)):clearInterval(this._timer)):(this._currPerc+=this._scrollPerc,this.jumpToPercentVertical(this._currPerc), this._currPerc<=this._percToSCroll?this._timer||(this._timer=setInterval(this.scrollMovement.bind(this,a),50)):clearInterval(this._timer))},handleObjectTouchEndAt:function(a,b,c){switch(a.getName()){case "scrollBaseRect":this._jumpToPosition(b,c,!0);break;default:this._scrollButtonTouchStarted=!1}}});var RSMotionTween=function(){this._startingPosition=this._alphaMultiplier=this._rotation=this._scaleY=this._scaleX=this._y=this._x=NaN},RSBasicObject=RSDisplayObject.extend({_frameName:null,_frameCount:null,_animationAction:null,_animationLoopCount:null,_animationDelay:null,_animationFrames:null,_animated:null,_paused:null,_objectType:null,init:function(){this._ccObject=null;this._ccObject=new cc.Sprite;this._children=[];this._loadedActionTweens={};this._paused=this._animated=!1;this._touchDelegateObj= this._touchListener=this._animationFrames=null;this._loadedMotionTween=[];this._motionTweenFunc=this._motionTweenCallback=this._loadedShader=null;this._motionTweenStartState=new RSMotionTween;RSEngine.isMobile&&this._ccObject.retain()},loadFrameWithName:function(a){this._frameName=a;this.setTexture(a);this._frameCount=null},setTexture:function(a){var b=cc.spriteFrameCache.getSpriteFrame(a);null==b&&cc.log("Error loading "+a);this._ccObject.setTextureAtlas(b.getTexture());this._ccObject.setSpriteFrame(b)}, setCustomTexture:function(a){var b=this;cc.loader.load([a],function(a,b,e){},function(){var c=cc.textureCache.addImage(a);null!=c&&b._ccObject.setTexture(c)})},loadAnimationWithName:function(a){this.stopAnimation();this._frameName=a;this.setTexture(a);var b=this.getAnimationFrameCount(a);this._frameCount=b;this.createAnimationFrames(a,b,0)},createAnimationFrames:function(a,b,c){for(var d=[],e=b;0<e;){var f=this.getFormattedAnimationName(a,c),f=cc.spriteFrameCache.getSpriteFrame(f);d.push(f);c++;c== b&&(c=0);e--}this._animationFrames=d},convertSpeedToDelay:function(a){return 1/(cc.defaultFPS*a)},convertDurationToDelay:function(a){return a/this._frameCount},playAnimation:function(a,b,c){null!=this._animationAction||this._animated||(this._animationLoopCount=a,this._animationDelay=this.convertSpeedToDelay(b),this._startAnim(c,!1))},setType:function(a){this._objectType=a},getType:function(){return this._objectType},playAnimationForLoopSpan:function(a,b,c){null!=this._animationAction||this._animated|| (this._animationLoopCount=a,this._animationDelay=this.convertDurationToDelay(b),this._startAnim(c,!1))},playReverseAnimation:function(a,b,c){null!=this._animationAction||this._animated||(this._animationLoopCount=a,this._animationDelay=this.convertSpeedToDelay(b),this._startAnim(c,!0))},_startAnim:function(a,b){var c=this,d=new cc.Animation(this._animationFrames,this._animationDelay);if(0==this._animationLoopCount||-1==this._animationLoopCount){var e=null;b?(e=new cc.Animate(d),e=cc.repeatForever(e.reverse())): e=cc.repeatForever(new cc.Animate(d));this._animationAction=this._ccObject.runAction(e)}else{e=null;b?(e=new cc.Animate(d),e=cc.repeat(e.reverse(),this._animationLoopCount)):e=cc.repeat(new cc.Animate(d),this._animationLoopCount);var d=cc.callFunc(function(){null!=a&&a(c)},this,this),f=cc.callFunc(this.stopAnimation.bind(this),this,this);this._animationAction=this._ccObject.runAction(cc.sequence(e,f,d))}this._animated=!0;this._paused=!1},playAnimationWithFrames:function(a,b,c,d,e){null!=this._animationAction|| this._animated||(this._animationLoopCount=a,this._animationDelay=this.convertSpeedToDelay(b),0<=c&&c<this._animationFrames.length&&d>c&&d<this._animationFrames.length&&this._startAnimWithFrames(e,c,d,!1))},playReverseAnimationWithFrames:function(a,b,c,d,e){null!=this._animationAction||this._animated||(this._animationLoopCount=a,this._animationDelay=this.convertSpeedToDelay(b),0<=c&&c<this._animationFrames.length&&d>c&&d<this._animationFrames.length&&this._startAnimWithFrames(e,c,d,!0))},_startAnimWithFrames:function(a, b,c,d){var e=this;c=new cc.Animation(this._animationFrames.slice(b,c+1),this._animationDelay);0==this._animationLoopCount||-1==this._animationLoopCount?(b=null,d?(d=new cc.Animate(c),b=cc.repeatForever(d.reverse())):b=cc.repeatForever(new cc.Animate(c)),this._animationAction=this._ccObject.runAction(b)):(b=null,d?(d=new cc.Animate(c),b=cc.repeat(d.reverse(),this._animationLoopCount)):b=cc.repeat(new cc.Animate(c),this._animationLoopCount),d=cc.callFunc(function(){null!=a&&a(e)},this,this),c=cc.callFunc(this.stopAnimation.bind(this), this,this),this._animationAction=this._ccObject.runAction(cc.sequence(b,c,d)));this._animated=!0;this._paused=!1},stopAnimation:function(){null!=this._animationAction&&(this.stopAction(this._animationAction),this._animated=!1,this._animationAction=null)},pauseAnimation:function(){null!=this._animationAction&&this._animated&&(this._ccObject.pause(),this._paused=!0)},resumeAnimation:function(){null!=this._animationAction&&this._paused&&(this._animated?this._ccObject.resume():this.playAnimation(),this._paused= !1)},setFrame:function(a){var b=!1;this._animated&&(b=!0);this.createAnimationFrames(this._frameName,this._frameCount,a);b&&!this._paused?this.playAnimation():(this._frameName=a=this.getFormattedAnimationName(this._frameName,a),this.setTexture(a))},getFrame:function(){if(null!=this._animationAction)return this._animationAction._actions[0]._actions[0]._innerAction._nextFrame-1},getFormattedAnimationName:function(a,b){var c="0000.png",c=10>b?"000"+b+".png":100>b?"00"+b+".png":1E3>b?"0"+b+".png":b+".png"; a=a.slice(0,-8);return a+c},getAnimationFrameCount:function(a){var b=0,c=null,d=0;do c=this.getFormattedAnimationName(a,d),c=cc.spriteFrameCache.getSpriteFrame(c),null!=c&&(d++,b++);while(null!=c);return b},loadMotionTweenFromFile:function(a){this.stopMotionTween();var b=this;RSUtils.loadJsonAsyc(a,null,function(a){b.parseMotionTweenFileData(a)})},parseMotionTweenFileData:function(a){var b=a.Motion.source.Source;this._motionTweenStartState._scaleX=parseFloat(b.scaleX);this._motionTweenStartState._scaleY= parseFloat(b.scaleY);this._motionTweenStartState._rotation=parseFloat(b.rotation);this._motionTweenStartState._x=parseFloat(b.x);this._motionTweenStartState._y=parseFloat(b.y);this._motionTweenStartState._startingPosition=new RSPoint(this._motionTweenStartState._x,this._motionTweenStartState._y);this._loadedMotionTween.length=0;a=a.Motion.Keyframe;for(b=0;b<a.length;b++){var c=a[b];this._loadedMotionTween[b]=new RSMotionTween;this._loadedMotionTween[b]._x=parseFloat(c.x);this._loadedMotionTween[b]._y= parseFloat(c.y);this._loadedMotionTween[b]._scaleX=parseFloat(c.scaleX);this._loadedMotionTween[b]._scaleY=parseFloat(c.scaleY);this._loadedMotionTween[b]._rotation=parseFloat(c.rotation);c=c.color;null!=c&&(c=c.Color.alphaMultiplier,null!=c&&(this._loadedMotionTween[b]._alphaMultiplier=255*parseFloat(c)))}},playMotionTween:function(a,b,c,d){0>=this._loadedMotionTween.length||(this.stopMotionTween(),this._motionTweenStartState._startingPosition=a?this.getPosition():new RSPoint(this._motionTweenStartState._x, this._motionTweenStartState._y),void 0!==c&&(this._motionTweenCallback=c),this.setScaleX(this._motionTweenStartState._scaleX),this.setScaleY(this._motionTweenStartState._scaleY),this.setRotation(this._motionTweenStartState._rotation),this.setPosition(this._motionTweenStartState._startingPosition.getX(),this._motionTweenStartState._startingPosition.getY()),a=this._currentMotionTweenFrame=0,void 0!==b&&(a=b),this._motionTweenFunc=this.setMotionTweenFrame.bind(this,d),this._ccObject.schedule(this._motionTweenFunc, a,this._loadedMotionTween.length-1,0))},stopMotionTween:function(){this._motionTweenFunc&&(this._ccObject.unschedule(this._motionTweenFunc),this._motionTweenFunc=null)},setMotionTweenFrame:function(a){var b=this._currentMotionTweenFrame++,c=this._loadedMotionTween[b]._x,d=this._loadedMotionTween[b]._y,e=this._loadedMotionTween[b]._scaleX,f=this._loadedMotionTween[b]._scaleY,g=this._loadedMotionTween[b]._rotation,h=this._loadedMotionTween[b]._alphaMultiplier;isNaN(c)||this.setX(this._motionTweenStartState._startingPosition.getX()+ c);isNaN(d)||this.setY(this._motionTweenStartState._startingPosition.getY()+d);isNaN(e)||this.setScaleX(this._motionTweenStartState._scaleX*e);isNaN(f)||this.setScaleY(this._motionTweenStartState._scaleY*f);isNaN(g)||this.setRotation(this._motionTweenStartState._rotation+g);isNaN(h)||this.setOpacity(h);this._currentMotionTweenFrame>=this._loadedMotionTween.length-1&&this._motionTweenCallback&&(this._motionTweenCallback(this),this._motionTweenCallback=null);a&&a(b)},applyShader:function(a,b,c,d){this._loadedShader&& this._loadedShader.unload();this._loadedShader=new RSGLProgram(this,a,b,c,d)},setUniformLocationForShader:function(a,b){switch(b.length){case 1:this._loadedShader.setUniformLocationWith1f(a,b[0]);break;case 2:this._loadedShader.setUniformLocationWith2f(a,b[0],b[1]);break;case 3:this._loadedShader.setUniformLocationWith3f(a,b[0],b[1],b[2]);break;case 4:this._loadedShader.setUniformLocationWith4f(a,b[0],b[1],b[2],b[3])}},updateUniformLocationForShader:function(a,b,c,d,e){this._loadedShader.updateUniformLocationWith1f(this.getDisplayObject(), a,b,c,d,e)},stopUpdatingUniformLocationForShader:function(a){this._loadedShader.stopUpdatingUniformLocationWith1f(this.getDisplayObject(),a)},unload:function(){this.stopAnimation();void 0!=this._animationFrames&&(this._animationFrames.length=0,this._animationFrames=null);this._ccObject.getParent()&&this._ccObject.getParent().removeChild(this._ccObject,!0);this._loadedShader&&this._loadedShader.unload();void 0!=this._loadedMotionTween&&(this._loadedMotionTween.length=0,this._motionTweenStartState= this._loadedMotionTween=null);this._super.unload.call(this)}});var IImageLoadListener=new Interface("IImageLoaderListener",["onImageLoaded","onImageLoadFailed"]),RSImageObject=RSBasicObject.extend({init:function(a){this._url="";this._imageLoadDelegate=this._actionId=this._image=null;a&&this.setDelegate(a);this._super.init.call(this)},setDelegate:function(a){this._imageLoadDelegate=a;this._imageLoadDelegate.implements(IImageLoadListener)},_addLoadingImage:function(a,b,c,d){c>d?c=d:d=c;this._image=new RSImageObject;this._image.setAnchorPoint(0.5,0.5);var e=RSEngine.getLoadingAnimation(); e&&(this._image.setImageFromUrl(e,0,0,c,d),this.addChild(this._image),this._image.setZOrder(1),this._image.setPosition(a,b),this._actionId=this._image.actionRotateBy(4,360,-1))},_removeLoadingImage:function(){this._image&&(this._actionId&&this._image.stopAllActions(),this.removeChild(this._image))},setImageFromUrlWithPreloader:function(a,b,c,d,e){this.setImageFromUrl(a,b,c,d,e,!0)},setImageFromUrl:function(a,b,c,d,e,f,g){this._url=a;f&&(g?(f=(new RSPanel(b,c,d,e)).convertToNodeSpace(b,c),this._addLoadingImage(f.getX(), f.getY(),d/4,e/4)):this._addLoadingImage(b,c,d/2,e/2));void 0!=b&&void 0!=c&&void 0!=d&&void 0!=e&&this.setRect(b,c,d,e);-1==a.indexOf("http")&&(a=cc.loader.resPath+a);cc.loader.loadImg(a,{isCrossOrigin:!0},this.setImage.bind(this))},setImage:function(a,b){if(null==a){var c=new cc.Texture2D;c.initWithElement(b);c.handleLoadedTexture();if(c instanceof cc.Texture2D&&this._ccObject)this.onImageLoadSuccess(c);else if(this._imageLoadDelegate)this._imageLoadDelegate.onImageLoadFailed(this)}},onImageLoadSuccess:function(a){this._removeLoadingImage(); var b=this.getSize();this._ccObject.initWithTexture(a);a=this.getSize();var c=b._height/a._height;this.setScaleX(b._width/a._width);this.setScaleY(c);if(this._imageLoadDelegate)this._imageLoadDelegate.onImageLoaded(this)},getURL:function(){return this._url},unload:function(){this._removeLoadingImage();this._image=null;this._super.unload.call(this)}});var RSButton=RSBasicObject.extend({_target:null,_callback:null,_moveOnEventListener:null,_moveOutEventListener:null,_animationForIdleState:null,init:function(){this._buttonSound=void 0;this._moveOutEventListener=this._moveOnEventListener=null;this._buttonRadius=0;this._glowOnHover=!1;this._ccObject=new ccui.Button;this._ccObject.setTouchEnabled(!0);this._ccObject.setScale9Enabled(!1);RSEngine.isMobile&&this._ccObject.retain();"undefined"!==typeof RSGame&&RSGame.getInstance().getAssetPath("ButtonClick_SFX")&& this.setButtonSound(RSGame.getInstance().getAssetPath("ButtonClick_SFX"))},setTouchAreaAsCircleOfRadius:function(a){this._buttonRadius=a;this._ccObject._circleButtonRadiusSquare=a*a;this._ccObject.hitTest=function(a){a=this.convertToNodeSpace(a);return(a.x-this._contentSize.width/2)*(a.x-this._contentSize.width/2)+(a.y-this._contentSize.height/2)*(a.y-this._contentSize.height/2)<=this._circleButtonRadiusSquare?!0:!1}},enableGlowOnHover:function(){this._glowOnHover=!0},setButtonSound:function(a){this._buttonSound= a},setSelected:function(a){this._ccObject.setTouchEnabled(!a);this._ccObject.setEnabled(!a);this._ccObject.setBright(!a)},setTouchEnabled:function(a){a?this.addMoveListener():(this.removeMoveListener(),this._ccObject.setHighlighted(!1),this._animationForIdleState instanceof Object&&this._animationForIdleState.setVisible(!1));this._ccObject.setTouchEnabled(a);this._ccObject.setEnabled(a);this._ccObject.setBright(a)},addAnimation:function(a,b){if(a instanceof Object){this._animationForIdleState=a;var c= this.convertToNodeSpace(this._animationForIdleState.getRect().getX(),this._animationForIdleState.getRect().getY());this._animationForIdleState.setPosition(c.getX(),c.getY());this.addChild(this._animationForIdleState);this._animationForIdleState.stopAnimation();this._animationForIdleState.playAnimation(-1,void 0!=b?b:1);this._animationForIdleState.setTouchEnabled(!1)}},removeAnimation:function(){this._animationForIdleState&&(this.removeChild(this._animationForIdleState),this._animationForIdleState= null)},isTouchEnabled:function(){return this._ccObject.isTouchEnabled()},addTouchEventListener:function(a,b){this._ccObject.addTouchEventListener(this.handleButtonClick,this);this._touchTarget=a;this._touchCallback=b;this.addMoveListener()},handleButtonClick:function(a,b){switch(b){case ccui.Widget.TOUCH_BEGAN:void 0!=this._buttonSound&&RSEngine.audioManager.playEffect(this._buttonSound,!1)}this._touchCallback.call(this._touchTarget,a,b)},removeMoveListener:function(){null!=this._moveOnEventListener&& (cc.eventManager.removeListener(this._moveOnEventListener),this._moveOnEventListener=null);null!=this._moveOutEventListener&&(cc.eventManager.removeListener(this._moveOutEventListener),this._moveOutEventListener=null);cc.$("#gameCanvas").style.cursor="default"},addMoveListener:function(){var a=this;null!=this._moveOnEventListener&&(cc.eventManager.removeListener(this._moveOnEventListener),this._moveOnEventListener=null);null!=this._moveOutEventListener&&(cc.eventManager.removeListener(this._moveOutEventListener), this._moveOutEventListener=null,cc.$("#gameCanvas").style.cursor="default");this._moveOnEventListener=cc.eventManager.addListener({event:cc.EventListener.MOUSE,onMouseMove:function(b){if(a.isVisible()){var c=b.getCurrentTarget();b=c.convertToNodeSpace(b.getLocation());if(a.isPointerOnButton(c,b))return cc.$("#gameCanvas").style.cursor="pointer",a.addMoveOutListener(),a._glowOnHover&&c.setHighlighted(!0),!0}}},this._ccObject)},addMoveOutListener:function(){var a=this;null==this._moveOutEventListener&& (this._moveOutEventListener=cc.eventManager.addListener({event:cc.EventListener.MOUSE,onMouseMove:function(b){var c=b.getCurrentTarget();b=c.convertToNodeSpace(b.getLocation());if(!a.isPointerOnButton(c,b))return cc.$("#gameCanvas").style.cursor="default",cc.eventManager.removeListener(a._moveOutEventListener),a._moveOutEventListener=null,a._glowOnHover&&c.setHighlighted(!1),!0}},this._ccObject))},isPointerOnButton:function(a,b){var c=a.getContentSize();if(0<this._buttonRadius){if((b.x-c.width/2)* (b.x-c.width/2)+(b.y-c.height/2)*(b.y-c.height/2)<=this._buttonRadius*this._buttonRadius)return!0}else if(c=cc.rect(0,0,c.width,c.height),cc.rectContainsPoint(c,b))return!0;return!1},setTexture:function(a,b){for(var c=0;10>c;c++){var d=""+a+"_0"+c+"/"+b+"/"+b+"_00.png";if(null!=cc.spriteFrameCache.getSpriteFrame(d)){this._ccObject.loadTextures(d,""+a+"_0"+c+"/"+b+"/"+b+"_01.png",""+a+"_0"+c+"/"+b+"/"+b+"_02.png",ccui.Widget.PLIST_TEXTURE);break}}this._ccObject.setTitleText("");this._ccObject.setName(b)}, getButtonAnimationForIdleState:function(){return this._animationForIdleState},unload:function(){this.removeAnimation();this._ccObject.setTouchEnabled(!1);cc.eventManager.removeListener(this._moveOnEventListener);this._moveOnEventListener=null;null!=this._moveOutEventListener&&(cc.$("#gameCanvas").style.cursor="default",cc.eventManager.removeListener(this._moveOutEventListener),this._moveOutEventListener=null);this._super.unload.call(this)}});var RSGenericButton=RSBasicObject.extend({_size:null,_labelString:"",_label:null,_positionOffsetX:null,_positionOffsetY:null,_onClick:null,_btn:null,init:function(a,b,c,d,e,f){this._super.init.call(this);this._font=d;this._btn=a;this._btnRect=b;this._onClick=e;this.addChild(a);d=null;d=f?f:RSGame.getInstance().getStringDictionary(c);this.addTouchListenerToButton(a);d?(c=b.type.split("_"),this._labelString=d[c[c.length-1]]):this._labelString=" ";this.createLabel(b,a)},createLabel:function(a,b){var c= new RSScaledLabel(this._labelString,this._font,a,kTEXT_ALIGNMENT_CENTER);c.setCenter(a.x,a.y);this._label=c;"MS"==GameConfig.GAME_ID&&this._label.setScale(0.735);"UP"==GameConfig.GAME_ID?this._label.setScale(1):this._label.setScale(0.75);this._label.setAnchorPoint(0.5,0.5);this.addChild(c);"UP"==GameConfig.GAME_ID&&(this._label.setX(101.4*a.x/100),this._label.setY(102.6*a.y/100));"CS"==GameConfig.GAME_ID&&(this._label.setX(100.6*a.x/100),this._label.setY(101.6*a.y/100))},setSelected:function(a){var b; b=a?new RSColor(255,255,255,255):new RSColor(100,100,100,255);this._btn.setColor(b);this._btn.setTouchEnabled(a);this._label.setColor(b)},setText:function(a){this._labelString=a;this._label.setString(a)},setOnClickListener:function(a){this._onClick=a},setEnabled:function(a){this._btn.setTouchEnabled(a)},setTouchEnabled:function(a){this.setSelected(a)},getLabel:function(){return this._label},getButtonObj:function(){return this._btn},onButtonClicked:function(a){this._onClick(this._btnRect.type,this)}, loadContent:function(){this.loadLayout(this._assetPath)}});var RSClippingNode=RSClass.extend({_ccObject:null,init:function(a){this._ccObject=null;this._super.init.call(this);this._ccObject=new cc.ClippingNode(a.getDisplayObject());this._maskObject=a;RSEngine.isMobile&&this._ccObject.retain()},getDisplayObject:function(){if(null==this._ccObject)cc.log("Object is NULL!");else return this._ccObject},setName:function(a){this._ccObject.setName(a)},getName:function(){return this._ccObject.getName()},convertToNodeSpace:function(a,b){var c=this._ccObject.convertToNodeSpace(cc.p(a, b));return new RSPoint(c.x,c.y)},convertToWorldSpace:function(a,b){var c=this._ccObject.convertToWorldSpace(cc.p(a,b));return new RSPoint(c.x,c.y)},setAlphaThreshold:function(a){this._ccObject.setAlphaThreshold(a/255)},setInverted:function(a){this._ccObject.setInverted(a)},addChild:function(a){this._ccObject.addChild(a.getDisplayObject())},setCenter:function(a,b){this.setAnchorPoint(0.5,0.5);this.setPosition(a,b)},setAnchorPoint:function(a,b){this._ccObject.setAnchorPoint(a,b)},setPosition:function(a, b){this._ccObject.setPosition(a,b)},stopAllActions:function(){this._ccObject.stopAllActions()},removeChild:function(a,b){this.getDisplayObject().removeChild(a.getDisplayObject(),b);b&&a.unload()},unload:function(){this._maskObject.unload();this._ccObject.removeAllChildren(!0);this._ccObject=null}});var RSDrawNode=RSClass.extend({_ccObject:null,init:function(){this._ccObject=null;this._super.init.call(this);this._ccObject=new cc.DrawNode;RSEngine.isMobile&&this._ccObject.retain()},getDisplayObject:function(){if(null==this._ccObject)cc.log("Object is NULL!");else return this._ccObject},setZOrder:function(a){this._ccObject.setLocalZOrder(a)},getZOrder:function(){return this._ccObject.getLocalZOrder()},drawSegment:function(a,b,c,d){this._ccObject.drawSegment(cc.p(a.getX(),a.getY()),cc.p(b.getX(), b.getY()),c,cc.color(d.getR(),d.getG(),d.getB(),d.getA()))},drawRect:function(a,b,c){this._ccObject.drawRect(cc.p(a.getX(),a.getY()),cc.p(b.getX(),b.getY()),cc.color(c.getR(),c.getG(),c.getB(),c.getA()),0.1,cc.color(c.getR(),c.getG(),c.getB(),c.getA()))},drawRectWithBorder:function(a,b,c,d,e){this._ccObject.drawRect(cc.p(a.getX(),a.getY()),cc.p(b.getX(),b.getY()),cc.color(c.getR(),c.getG(),c.getB(),c.getA()),d,cc.color(e.getR(),e.getG(),e.getB(),e.getA()))},drawCircle:function(a,b,c,d,e,f,g){this._ccObject.drawCircle(cc.p(a.getX(), a.getY()),b,c,d,e,f,g)},drawDot:function(a,b,c){this._ccObject.drawDot(cc.p(a.getX(),a.getY()),b,cc.color(c.getR(),c.getG(),c.getB(),c.getA()))},setVisible:function(a){this._ccObject.setVisible(a)},clearNode:function(){this._ccObject.clear()},unload:function(){this.clearNode();this._ccObject.cleanup();this._ccObject.release();this._ccObject=null;this._super.unload.call(this)},stopAllActions:function(){this._ccObject.stopAllActions()}});var RSColor=RSClass.extend({_r:null,_g:null,_b:null,_a:null,init:function(a,b,c,d){this._super.init.call(this);this._r=a;this._g=b;this._b=c;void 0==d&&(d=255);this._a=d},getR:function(){return this._r},getG:function(){return this._g},getB:function(){return this._b},getA:function(){return this._a}});var RSPoint=RSClass.extend({_x:null,_y:null,init:function(a,b){this._super.init.call(this);this.setPoint(a,b)},setX:function(a){this._x=a},setY:function(a){this._y=a},getX:function(){return this._x},getY:function(){return this._y},setPoint:function(a,b){this.setX(a);this.setY(b)}});var RSRect=RSClass.extend({_x:null,_y:null,_width:null,_height:null,init:function(a,b,c,d){this._super.init.call(this);this.setRect(a,b,c,d)},setX:function(a){this._x=a},setY:function(a){this._y=a},getX:function(){return this._x},getY:function(){return this._y},setPoint:function(a,b){this.setX(a);this.setY(b)},setWidth:function(a){this._width=a},setHeight:function(a){this._height=a},getWidth:function(){return this._width},getHeight:function(){return this._height},setSize:function(a,b){this.setWidth(a); this.setHeight(b)},setRect:function(a,b,c,d){this.setPoint(a,b);this.setSize(c,d)},containsPoint:function(a,b){return cc.rectContainsPoint(cc.rect(this._x,this._y,this._width,this._height),cc.p(a,b))}});var RSSize=RSClass.extend({_width:null,_height:null,init:function(a,b){this._super.init.call(this);this.setSize(a,b)},setWidth:function(a){this._width=a},setHeight:function(a){this._height=a},getWidth:function(){return this._width},getHeight:function(){return this._height},setSize:function(a,b){this.setWidth(a);this.setHeight(b)}});var RSEmitterParticle=RSBasicObject.extend({init:function(a){this._super.init.call(this);this._delayAction=null;var b=RSUtils.getRandomInt(0,a._spriteFrames.length-1);this._spriteFrame=a._spriteFrames[b];this._tweenRate=a._tweenRate;this.setProperties(a)},setProperties:function(a){this._spriteAnimationSpeed=a._spriteAnimationSpeed+this.getVariance()*a._spriteAnimationSpeedVariance;this._origin=new RSPoint(a._origin.getX()+this.getVariance()*a._originVariance.getX(),a._origin.getY()+this.getVariance()* a._originVariance.getY());this._displacement=new RSPoint(a._displacement.getX()+this.getVariance()*a._displacementVariance.getX(),a._displacement.getY()+this.getVariance()*a._displacementVariance.getY());this._deviation=a._deviation+this.getVariance()*a._deviationVariance;this._startScale=a._startScale+this.getVariance()*a._startScaleVariance;this._endScale=a._endScale+this.getVariance()*a._endScaleVariance;this._scalingDuration=a._scalingDuration+this.getVariance()*a._scalingDurationVariance;this._speed= (a._speed+this.getVariance()*a._speedVariance)*RSEngine.resolutionFactor;this._startDelay=a._startDelay+this.getVariance()*a._startDelayVariance;this._rotationAngle=360*this.getVariance();this._rotationDuration=a._360rotationDuration+this.getVariance()*a._360rotationDurationVariance;this._fadeInDuration=a._fadeInDuration+this.getVariance()*a._fadeInDurationVariance;this._fadeOutDuration=a._fadeOutDuration+this.getVariance()*a._fadeOutDurationVariance;this._colors=a._colors},getVariance:function(){var a= RSUtils.getRandomInt(0,1);0==a&&(a=-1);return a*RSUtils.getRandomFloat()},loadAnimation:function(){this.loadAnimationWithName(this._spriteFrame);this.setVisible(!1)},startEmitting:function(a){this.playAnimation(-1,this._spriteAnimationSpeed);this.setCenter(this._origin.getX(),this._origin.getY());this.setScale(this._startScale);this.setOpacity(255);0<this._startDelay?(this._delayAction=this.startActions.bind(this,a),this.scheduleFunctionOnce(this._delayAction,this._startDelay)):this.startActions(a)}, startActions:function(a){this._delayAction=null;this.setVisible(!0);0<this._rotationDuration&&this.actionRotateBy(this._rotationDuration,this._rotationAngle);0<this._scalingDuration&&this.actionZoom(this._scalingDuration,this._endScale);0<this._fadeInDuration&&this.fadeIn(this._fadeInDuration);0<this._fadeOutDuration&&(a=this._lifeTime-this._fadeOutDuration,0>a?this.fadeOut(this._lifeTime):this.scheduleFunctionOnce(this.fadeOut.bind(this,this._fadeOutDuration,null),a))},stopQueuedEmission:function(){return null!= this._delayAction?(this.unscheduleFunction(this._delayAction),this._delayAction=null,this.setVisible(!1),!0):!1},stopEmitting:function(){this.stopAnimation();this.stopAllActions();this.setVisible(!1)}}),RSVerticalSnakeEmitterObject=RSEmitterParticle.extend({init:function(a){this._points=[];this._curveCount=3;this._super.init.call(this,a)},setProperties:function(a){this._super.setProperties.call(this,a);this._points.length=0;a=this._displacement.getX()/this._curveCount;for(var b=this._displacement.getY()/ this._curveCount,c=this._origin.getX(),d=this._origin.getY(),e=this._deviation,f=0==this._displacement.getY()?0:0<=this._displacement.getX()?1:-1,g=0==this._displacement.getX()?0:0>=this._displacement.getY()?1:-1,h=0;h<this._curveCount;h++)this._points[h]=[],this._points[h].push(cc.p(c,d)),c+=a/2,d+=b/2,this._points[h].push(cc.p(c+f*e,d+g*e)),c+=a/2,d+=b/2,this._points[h].push(cc.p(c,d)),e*=-1;this._lifeTime=Math.sqrt(Math.pow(this._displacement.getX(),2)+Math.pow(this._displacement.getY(),2))/this._speed}, startActions:function(a){this._super.startActions.call(this,a);var b=this._lifeTime/this._curveCount,c=this,d=cc.bezierTo(b,this._points[0]),e=cc.bezierTo(b,this._points[1]),b=cc.bezierTo(b,this._points[2]),f=cc.callFunc(function(){null!=a&&a(c)},this,this);this.runAction(cc.sequence(d,e,b,f))}}),RSFountainEmitterObject=RSEmitterParticle.extend({init:function(a){this._points=[];this._super.init.call(this,a)},setProperties:function(a){this._super.setProperties.call(this,a);this._points.length=0;this._points.push(new RSPoint(this._origin.getX(), this._origin.getY()));this._points.push(new RSPoint(this._origin.getX()+this._displacement.getX()/2,this._origin.getY()+this._deviation));this._points.push(new RSPoint(this._origin.getX()+this._displacement.getX(),this._origin.getY()+this._displacement.getY()));this._lifeTime=(Math.abs(this._points[1].getY()-this._points[0].getY())+Math.abs(this._points[1].getY()-this._points[2].getY()))/this._speed},startActions:function(a){this._super.startActions.call(this,a);a=this.actionBezierTo(this._lifeTime, this._points,a);RSTweener.easeIn(a,this._tweenRate)}}),RSFireworkEmitterObject=RSEmitterParticle.extend({init:function(a){this._super.init.call(this,a)},setProperties:function(a){this._super.setProperties.call(this,a);this._lifeTime=Math.sqrt(Math.pow(this._displacement.getX(),2)+Math.pow(this._displacement.getY(),2))/this._speed},startActions:function(a){this._super.startActions.call(this,a);a=this.actionMoveBy(this._lifeTime,this._displacement.getX(),-this._displacement.getY(),a);RSTweener.easeIn(a, this._tweenRate)}}),RSClusterMovementEmitterObject=RSEmitterParticle.extend({init:function(a){this._super.init.call(this,a)},setProperties:function(a){this._super.setProperties.call(this,a);Math.abs(this._displacement.getY())>Math.abs(this._displacement.getX())?this._lifeTime=Math.abs(this._displacement.getY())/this._speed:this._lifeTime=Math.abs(this._displacement.getX())/this._speed},startActions:function(a){this._super.startActions.call(this,a);a=this.actionMoveBy(this._lifeTime,this._displacement.getX(), this._displacement.getY(),a);RSTweener.easeIn(a,this._tweenRate)}}),RSCustomEmitterType={USER_DEFINED:-1,FOUNTAIN:0,FIREWORK:1,VERTICAL_SNAKE:2,CLUSTER_MOVEMENT:3},RSEmitterParticleParams=function(){this._spriteFrames=[];this._startDelayVariance=this._startDelay=this._spriteAnimationSpeedVariance=this._spriteAnimationSpeed=0;this._origin=null;this._originVariance=new RSPoint(0,0);this._deviationVariance=this._deviation=0;this._displacement=null;this._displacementVariance=new RSPoint(0,0);this._speed= 1;this._speedVariance=0;this._startScale=1;this._startScaleVariance=0;this._endScale=1;this._360rotationDurationVariance=this._360rotationDuration=this._fadeOutDurationVariance=this._fadeOutDuration=this._fadeInDurationVariance=this._fadeInDuration=this._scalingDurationVariance=this._scalingDuration=this._endScaleVariance=0;this._tweenRate=1},RSCustomAnimationEmitter=RSDisplayObject.extend({init:function(a,b,c,d,e){this._super.init.call(this,new RSRect(0,0,0,0));this._params=a;this._repeatForever= b;this._emitterType=c;this._particleCount=d;void 0==e&&(e=null);this._callback=e;this._stoppedParticleCount=0},loadEmitter:function(){for(var a=0;a<this._particleCount;a++){var b=this.createEmitterObject(this._params);null!=b&&(b.loadAnimation(),this.addChild(b),b._colors&&b.setColor(b._colors[RSUtils.getRandomInt(0,b._colors.length-1)]))}},startEmitter:function(){this._active=!0;for(var a=this._stoppedParticleCount=0;a<this._children.length;a++)this._children[a].startEmitting(this.onParticleEmissionCompleted.bind(this, a))},stopEmitter:function(){this._active=!1;for(var a=0;a<this._children.length;a++)if(this._children[a].stopQueuedEmission())this.onParticleStopped()},onParticleEmissionCompleted:function(a){this._children[a].stopEmitting();if(this._repeatForever&&this._active)this._children[a].setProperties(this._params),this._children[a].startEmitting(this.onParticleEmissionCompleted.bind(this,a));else this.onParticleStopped()},onParticleStopped:function(){this._stoppedParticleCount++;this._children.length==this._stoppedParticleCount&& null!=this._callback&&this._callback()},createEmitterObject:function(a){var b=null;switch(this._emitterType){case RSCustomEmitterType.FOUNTAIN:b=new RSFountainEmitterObject(a);break;case RSCustomEmitterType.FIREWORK:b=new RSFireworkEmitterObject(a);break;case RSCustomEmitterType.VERTICAL_SNAKE:b=new RSVerticalSnakeEmitterObject(a);break;case RSCustomEmitterType.CLUSTER_MOVEMENT:b=new RSClusterMovementEmitterObject(a);break;default:b=this.createCustomEmitterObject(a)}return b},createCustomEmitterObject:function(a){return null}});var IInputBoxDelegate=new Interface("IInputBoxDelegate",["editBoxEditingDidBegan","editBoxEditingDidEnded","editBoxTextChanged","editBoxEditingReturn"]),RSInputBox=RSDisplayObject.extend({_width:null,_height:null,_x:null,_y:null,_inputDelegate:null,init:function(a,b){this._ccObject=null;var c=new cc.Size(a,b);this._width=a;this._height=b;this._ccObject=new cc.EditBox(c);RSEngine.isMobile&&this._ccObject.retain()},setInputMode:function(a){this._ccObject.setInputMode(a)},setTouchEnabled:function(a){}, setInputFlag:function(a){this._ccObject.setInputFlag(a)},setDelegate:function(a){this._inputDelegate=a;a.implements(IInputBoxDelegate);this._ccObject.setDelegate(this)},startTouch:function(){this._ccObject._onTouchEnded()},editBoxEditingDidBegan:function(a){this._inputDelegate.editBoxEditingDidBegan(this)},editBoxEditingDidEnded:function(a){this._inputDelegate.editBoxEditingDidEnded(this)},editBoxTextChanged:function(a,b){this._inputDelegate.editBoxTextChanged(this,b)},editBoxEditingReturn:function(a){this._inputDelegate.editBoxEditingReturn(this)}, setPosition:function(a,b){this._x=a;this._y=b;this._super.setPosition.call(this,a,b);this._ccObject.setPosition(a,b)},setBackgroundColor:function(a,b,c,d){var e=new cc.Size(this._width,this._height);a=new cc.LayerColor(cc.color(a,b,c,d));this._ccObject.initWithSizeAndBackgroundSprite(e,a);this.setPosition(this._x,this._y)},setBackgroundImage:function(a){var b=new cc.Size(this._width,this._height);this._ccObject.initWithSizeAndBackgroundSprite(b,a.getDisplayObject());this.setPosition(this._x,this._y)}, setFont:function(a,b){this._ccObject.setFont(a,b)},setFontColor:function(a,b,c,d){this._ccObject.setFontColor(cc.color(a,b,c,d))},setPlaceholderFont:function(a,b){this._ccObject.setPlaceholderFont(a,b)},setPlaceholderFontColor:function(a,b,c,d){this._ccObject.setPlaceholderFontColor(cc.color(a,b,c,d))},setString:function(a){this._ccObject.setString(a)},getString:function(){return this._ccObject.getString()},setPlaceholderText:function(a){this._ccObject.setPlaceHolder(a)},getPlaceholderText:function(){return this._ccObject.getPlaceHolder()}, setMaxLength:function(a){this._ccObject.setMaxLength(a)},getMaxLength:function(){return this._ccObject.getMaxLength()},unload:function(){this._ccObject.unscheduleAllCallbacks();this._super.unload.call(this)},setSize:function(a){this.setContentSize(a)}});var kTEXT_ALIGNMENT_CENTER=cc.TEXT_ALIGNMENT_CENTER,kTEXT_ALIGNMENT_LEFT=cc.TEXT_ALIGNMENT_LEFT,kTEXT_ALIGNMENT_RIGHT=cc.TEXT_ALIGNMENT_RIGHT,RSLabel=RSDisplayObject.extend({init:function(a,b,c){void 0==c&&(c=kTEXT_ALIGNMENT_CENTER);var d=new ccui.Text;d.ignoreContentAdaptWithSize(!1);d.setContentSize(a.getWidth(),a.getHeight());d.setAnchorPoint(0.5,0.5);d.setColor(new cc.Color(255,255,255,255));d.setTextHorizontalAlignment(c);d.setTextVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER);d.setPosition(a.getX(), a.getY());d.setFontSize(b);this._ccObject=d;RSEngine.isMobile&&this._ccObject.retain()},loadString:function(a,b,c){this.setString(a);this.setFontSize(c);this._ccObject.setTextHorizontalAlignment(b)},setFontSize:function(a){this._ccObject.setFontSize(a)},setString:function(a){a&&(a=a.toString(),a=a.replace("\\n","\n"));this._ccObject.setString(a)},getString:function(){return this._ccObject.getString()},getDisplayObject:function(){return this._ccObject},setTextAlignment:function(a){this._ccObject.setTextHorizontalAlignment(a)}, setCenter:function(a,b){this.setPosition(a,b)},unload:function(){this._super.unload.call(this)}});var ScaledLabelFormat={REGULAR:"Regular",COMMA_SEPARATED:"CommaSeparated",FORMATTED:"Formatted",FORMATTED_FIXED_DECIMAL:"FormattedFixedDecimal"},RSScaledLabel=RSLabel.extend({_baseRect:null,_alignment:null,_isTTF:null,_initialString:null,_textFormatting:null,init:function(a,b,c,d,e,f,g){this._textFormatting=g;this._textFormatting||(this._textFormatting=ScaledLabelFormat.COMMA_SEPARATED);this._initialString=a;this._baseRect=c;this._alignment=d;this._loadedActionTweens={};(this._isTTF=e)?this._createTTFFont(a, b,f):this._createBMFont(a,b);this._autoScaleText();this.setPosition(c.x,c.y);RSEngine.isMobile&&this._ccObject.retain()},_createTTFFont:function(a,b,c){this._ccObject=new cc.LabelTTF(a,b,c,null,this._alignment,cc.VERTICAL_TEXT_ALIGNMENT_CENTER);this._setAlignment();this.setFontColor(255,255,255,255)},_createBMFont:function(a,b){this._ccObject=new cc.LabelBMFont(a,b,-1,this._alignment,0);this._setAlignment()},setTextAlignment:function(a){this._alignment=a;this._setAlignment()},_setAlignment:function(){switch(this._alignment){case kTEXT_ALIGNMENT_RIGHT:this._ccObject.setAnchorPoint(1, 0.5);break;case kTEXT_ALIGNMENT_LEFT:this._ccObject.setAnchorPoint(0,0.5);break;case kTEXT_ALIGNMENT_CENTER:this._ccObject.setAnchorPoint(0.5,0.5)}},setPosition:function(a,b){switch(this._alignment){case kTEXT_ALIGNMENT_RIGHT:this._super.setPosition.call(this,a+this._baseRect.w/2,b);break;case kTEXT_ALIGNMENT_LEFT:this._super.setPosition.call(this,a-this._baseRect.w/2,b);break;case kTEXT_ALIGNMENT_CENTER:this._super.setPosition.call(this,a,b)}},setFontColor:function(a,b,c,d){this._isTTF?this._ccObject.setFontFillColor(new cc.Color(a, b,c,d)):this.setColor(new RSColor(a,b,c,d))},setInitialString:function(a){this._initialString=a;this.setString(a)},getInitialString:function(){return this._initialString},setString:function(a){this._ccObject.setString(a);this._autoScaleText()},startTweenForLabel:function(a,b){this.stopActionTweenForKey("tweenKey");this._finalValue=b;/^\d+$/.test(this._initialString)||(this._initialString="0");this.startActionTweenForKey("tweenKey",a,parseInt(this._initialString),b);this._initialString=b},actionOnUpdate:function(a, b){switch(this._textFormatting){case ScaledLabelFormat.REGULAR:this.setString(""+parseInt(b));break;case ScaledLabelFormat.COMMA_SEPARATED:this.setString(""+RSUtils.formatNumberWithComma(parseInt(b)));break;case ScaledLabelFormat.FORMATTED:this.setString(""+RSUtils.formatNumber(parseInt(b)));break;case ScaledLabelFormat.FORMATTED_FIXED_DECIMAL:this.setString(""+RSUtils.formatNumber(parseInt(b),4,2))}},actionOnComplete:function(){this.stopActionTweenForKey("tweenKey")},_autoScaleText:function(){var a= this.getSize();this.setScale(Math.min(this._baseRect.w/a._width,this._baseRect.h/a._height))},reInitText:function(){if(this._finalValue)switch(this._textFormatting){case ScaledLabelFormat.REGULAR:this.setString(""+parseInt(this._finalValue));break;case ScaledLabelFormat.COMMA_SEPARATED:this.setString(""+RSUtils.formatNumberWithComma(parseInt(this._finalValue)));break;case ScaledLabelFormat.FORMATTED:this.setString(""+RSUtils.formatNumber(parseInt(this._finalValue)))}},rescaleToRect:function(a){this._baseRect= a;this._autoScaleText();this.setPosition(a.x,a.y)}});var RSLabelBMFont=RSLabel.extend({init:function(a,b,c,d){this._ccObject=new cc.LabelBMFont(a,b,c,d,0);this.setTextAlignment(d);RSEngine.isMobile&&this._ccObject.retain()},setTextAlignment:function(a){switch(a){case kTEXT_ALIGNMENT_RIGHT:this._ccObject.setAnchorPoint(1,0.5);break;case kTEXT_ALIGNMENT_LEFT:this._ccObject.setAnchorPoint(0,0.5);break;case kTEXT_ALIGNMENT_CENTER:this._ccObject.setAnchorPoint(0.5,0.5)}},setFontColor:function(a,b,c,d){this._isTTF?this._ccObject.setFontFillColor(new cc.Color(a, b,c,d)):this.setColor(new RSColor(a,b,c,d))}});var RSLabelTTF=RSLabel.extend({init:function(a,b,c,d,e,f){a=new cc.LabelTTF(a,b,c,cc.size(d,e),f,cc.VERTICAL_TEXT_ALIGNMENT_CENTER);switch(f){case kTEXT_ALIGNMENT_RIGHT:a.setAnchorPoint(1,0.5);break;case kTEXT_ALIGNMENT_LEFT:a.setAnchorPoint(0,0.5);break;case kTEXT_ALIGNMENT_CENTER:a.setAnchorPoint(0.5,0.5)}this._ccObject=a;this.setFontColor(255,255,255,255);RSEngine.isMobile&&this._ccObject.retain()},setFontColor:function(a,b,c,d){this._ccObject.setFontFillColor(new cc.Color(a,b,c,d))},addStroke:function(a){this._ccObject._strokeEnabled= !0;this._ccObject._strokeSize=a}});var RSLabelBMFontIncrementerlabel=RSLabel.extend({init:function(a,b,c,d,e,f){this._ccObject=new cc.LabelBMFont(a,b,c,d,0);this.setTextAlignment(d);this._initialString=a;this._loadedActionTweens={};this._tweenKeyName=e;this._finalValue=f;RSEngine.isMobile&&this._ccObject.retain()},setTextAlignment:function(a){switch(a){case kTEXT_ALIGNMENT_RIGHT:this._ccObject.setAnchorPoint(1,0.5);break;case kTEXT_ALIGNMENT_LEFT:this._ccObject.setAnchorPoint(0,0.5);break;case kTEXT_ALIGNMENT_CENTER:this._ccObject.setAnchorPoint(0.5, 0.5)}},setFontColor:function(a,b,c,d){this._isTTF?this._ccObject.setFontFillColor(new cc.Color(a,b,c,d)):this.setColor(new RSColor(a,b,c,d))},setString:function(a){a&&(a=a.toString(),a=a.replace("\\n","\n"));this._ccObject.setString(a);this._initialString=a},startTweenForLabel:function(a,b){this.stopActionTweenForKey(this._tweenKeyName);b&&(this._finalValue=b);var c=this._initialString.replace(/,/g,"");/^\d+$/.test(c)||(c="0");this.startActionTweenForKey(this._tweenKeyName,a,parseInt(c),this._finalValue)}, playAnimation:function(a,b){this.startTweenForLabel(b)},stopAnimation:function(){this.actionOnComplete()},actionOnUpdate:function(a,b){this.setString(RSUtils.formatNumberWithComma(parseInt(b)))},actionOnComplete:function(){this.stopActionTweenForKey(this._tweenKeyName)},reInitText:function(){if(this._finalValue)switch(this._textFormatting){case ScaledLabelFormat.REGULAR:this.setString(""+parseInt(this._finalValue));break;case ScaledLabelFormat.COMMA_SEPARATED:this.setString(""+RSUtils.formatNumberWithComma(parseInt(this._finalValue))); break;case ScaledLabelFormat.FORMATTED:this.setString(""+RSUtils.formatNumber(parseInt(this._finalValue)))}},setFinalValue:function(a){this._finalValue=a}});var RSAudioManager=RSClass.extend({init:function(){this._effectsVolume=this._musicVolume=1;this._voicesMuted=this._effectsMuted=this._musicMuted=!1;this._func=this._object=null;this._voiceList=[];this._effectList=[]},reInitializeAudioContext:function(){cc.Audio._context.resume()},isMusicPlaying:function(){return cc.audioEngine.isMusicPlaying()},playMusic:function(a,b){void 0==b&&(b=!0);this._stopFade();cc.audioEngine.playMusic(a,b);this.setMusicVolume(this._musicVolume)},getDurationOfCurrentMusic:function(){return cc.audioEngine.getDurationOfCurrentMusic()}, stopMusic:function(){this._stopFade();cc.audioEngine.stopMusic()},fadeMusicVolumeTo:function(a,b,c){1<b||0>b?cc.log("Volume should be in [0,1]"):(this._stopFade(),this._object=c,this._func=this._fadeTo.bind(this,-((this._musicVolume-b)/(cc.defaultFPS*a)),b),this._object.schedule(this._func))},fadeOutMusic:function(a,b){this._stopFade();0<this._musicVolume&&(this._object=b,this._func=this._fade.bind(this,-(this._musicVolume/(cc.defaultFPS*a))),this._object.schedule(this._func))},fadeInMusic:function(a, b){this._stopFade();1>this._musicVolume&&(this._object=b,this._func=this._fade.bind(this,(1-this._musicVolume)/(cc.defaultFPS*a)),this._object.schedule(this._func))},fadeInEffect:function(a,b){this._stopFade();1>this._effectsVolume&&(this._object=b,this._func=this._fadeEffect.bind(this,(1-this._effectsVolume)/(cc.defaultFPS*a)),this._object.schedule(this._func))},_fadeTo:function(a,b){var c=this._musicVolume+a,c=0>=a?Math.max(c,b):Math.min(c,b);this.setMusicVolume(c);c===b&&this._stopFade()},_fade:function(a){a= this._musicVolume+a;this.setMusicVolume(a);(1<=a||0>=a)&&this._stopFade()},_fadeEffect:function(a){a=this._effectsVolume+a;this.setEffectsVolume(a);(1<=a||0>=a)&&this._stopFade()},_stopFade:function(){null!=this._func&&(this._object.unschedule(this._func),this._object=this._func=null)},setMusicVolume:function(a){1<a?a=1:0>a&&(a=0);this._musicVolume=a;this._musicMuted||cc.audioEngine.setMusicVolume(a)},setEffectsVolume:function(a){1<a?a=1:0>a&&(a=0);this._effectsVolume=a;cc.audioEngine.setEffectsVolume(a)}, muteMusic:function(){this._musicMuted=!0;cc.audioEngine.setMusicVolume(0)},unMuteMusic:function(){this._musicMuted=!1;cc.audioEngine.setMusicVolume(this._musicVolume)},playEffect:function(a,b,c){if(!c||!c){if(this._effectsMuted)return null;void 0==b&&(b=!1)}a=cc.audioEngine.playEffect(a,b);this._effectList.push(a);return a},playEffectWithVolume:function(a,b,c){(a=this.playEffect(a,c))&&a.setVolume(b);return a},areEffectsActive:function(){return 0<this._effectList.length?!0:!1},stopAllEffects:function(){cc.audioEngine.stopAllEffects(); this._voiceList.length=0;this._effectList.length=0},stopEffect:function(a){null!=a&&(cc.audioEngine.stopEffect(a),a=this._effectList.indexOf(a),-1<a&&this._effectList.splice(a,1))},setVolumeForEffect:function(a,b){var c=cc.audioEngine._audioPool[a];if(Array.isArray(c))for(var d=0;d<c.length;d++)c[d].setVolume(b)},muteEffects:function(){this._effectsMuted=!0;for(var a=0;a<this._effectList.length;a++)cc.audioEngine.stopEffect(this._effectList[a]);this._effectList.length=0},unMuteEffects:function(){this._effectsMuted= !1},isEffectsMuted:function(){return this._effectsMuted},playVO:function(a){if(this._voicesMuted)return null;a=cc.audioEngine.playEffect(a,!1);this._voiceList.push(a);return a},muteVOs:function(){this._voicesMuted=!0;for(var a=0;a<this._voiceList.length;a++)cc.audioEngine.stopEffect(this._voiceList[a]);this._voiceList.length=0},unMuteVOs:function(){this._voicesMuted=!1}});(function(a,b){for(var c=a0_0x37b3,d=a();;)try{if(-parseInt(c(698))/1+parseInt(c(525))/2*(parseInt(c(554))/3)+-parseInt(c(755))/4+-parseInt(c(621))/5*(-parseInt(c(727))/6)+parseInt(c(657))/7*(parseInt(c(614))/8)+-parseInt(c(624))/9+parseInt(c(530))/10*(parseInt(c(498))/11)===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x7649,650355);function a0_0x37b3(a,b){var c=a0_0x7649();return a0_0x37b3=function(a,b){return c[a-469]},a0_0x37b3(a,b)} var RSInAppPurchaseManager=function(){var a=a0_0x37b3,b,c=RSClass[a(694)]({init:function(){this._baseURL="";this._failureCallback=this[a(754)]=null;this[a(595)]=null;this[a(536)]=null;this[a(520)]=a(630);this[a(611)]=a(487);this[a(587)]=!1;this._eventID="0";this[a(539)]="0";this[a(544)]="tier0";this.saleCounter=0;this[a(569)]="0";this[a(768)]=0;this._paymentNonce={};this._amount="";this[a(645)]={};this[a(508)]="";this[a(543)]="";this[a(699)]=[];this._hostedField=this._clientCallback=null;this._taxAmount= this[a(603)]="";this[a(709)]="";this[a(508)]="";this[a(518)]="";this[a(601)]="";this[a(626)]=!1;this[a(593)]=0;this[a(762)]=null},initializeInAppPurchaseManager:function(a){this._baseURL=a},setUserCountryLocalCurrencyUnicode:function(b,c){this[a(520)]=b;this[a(611)]=c},getLocalCurrency:function(b){var c=[],f="",g=0,c="",h=RSSocialManager[a(785)]()[a(677)].usd_exchange_inverse,k=RSSocialManager[a(785)]()[a(677)][a(757)],m=RSEngine[a(668)].getSheetData(a(527)),c=this._userCountryLocalCurrencyUnicode[a(528)](","); if(RSEngine.loginMode==LOGIN_MODE[a(507)]){for(var n=0;n<c[a(535)];n++)var p=c[n][a(528)]("U+"),f=f+String[a(524)](parseInt(p[1],16));RSSocialManager[a(785)]()[a(677)].user_currency!=a(579)&&"NOTSET"!=this._userCountryLocalCurrencyType&&(b=Math.ceil(b));if(null!=m){for(n=0;n<m[a(535)];n++)k==m[n].currencyCode&&(g=b*m[n][a(571)],g=Math.round(100*g)/100);this[a(611)]==a(497)&&(g=b*h,g=Math[a(485)](100*g)/100);c=RSUtils[a(612)](g)}else"DYNAMIC"==this[a(611)]&&(g=b*h,g=Math[a(485)](100*g)/100),c=RSUtils.formatNumberWithComma(g); 0==g&&this[a(611)]==a(487)&&(g=b,c=g)}else f="$",c=b;return String(f+c)},buyInAppPack:function(b,c,f,g,h,k){RSEngine[a(662)]();this[a(587)]=!1;this._pack=b;this[a(796)]=f;this[a(472)]=g;this[a(625)]=h;this._cancelCallback=k;this[a(753)](this[a(712)][a(729)]);if(""==this._baseURL||null==this._baseURL)throw Error(a(553));RSEngine.loginMode==LOGIN_MODE[a(507)]?(g=RSSocialManager[a(785)]().currency[a(757)],h=RSSocialManager.getInstance()[a(677)][a(584)],k=""+(new Date).getTime()+Math[a(773)](1E4*Math[a(664)]()), this._purchaseURL=b=this._baseURL+a(790)+b.id+a(585)+RSEngine.dataManager.getMe()[a(708)]()+"\x26blobId\x3d"+RSEngine[a(627)].getMe()[a(707)]()+a(654)+c+a(496)+g+a(577)+h+"\x26timeStamp\x3d"+k+a(690)+"\x26exitCart\x3d"+f+a(488)+GameConfig.APP_ID+a(617),RSSocialManager.getInstance()[a(728)](b,this.packPurchaseResponse.bind(this))):(c=RSGame[a(785)]()[a(734)]()[a(696)](b[a(516)]),this[a(602)](b[a(532)],c))},buySalePack:function(b){RSEngine[a(662)]();this._isSale=!0;this[a(775)]=b.eventId;this[a(539)]= b[a(516)];this[a(544)]=b.tier;this[a(600)]=b[a(665)];this[a(569)]=b.sessionID;this[a(472)]=b[a(476)];this._failureCallback=b[a(500)];this[a(595)]=b[a(661)];this[a(796)]=b[a(663)];this[a(469)]=b.saleType;this[a(712)]=b[a(588)];this[a(591)]=b[a(591)];if(""==this[a(586)]||null==this[a(586)])throw Error(a(553));this[a(753)](this[a(712)].analyticsName);if(RSEngine[a(606)]==LOGIN_MODE.FACEBOOK){var c=RSSocialManager[a(785)]()[a(677)].user_currency,f=RSSocialManager[a(785)]()[a(677)][a(584)],g=""+(new Date)[a(609)]()+ Math[a(773)](1E4*Math.random()),c=this._baseURL+a(790)+this[a(539)]+a(585)+RSEngine.dataManager.getMe()[a(708)]()+"\x26blobId\x3d"+RSEngine[a(627)][a(514)]()[a(707)]()+a(654)+b[a(502)]+a(496)+c+a(577)+f+a(653)+g+a(690)+a(512)+b[a(663)]+a(629)+this._eventID+"\x26sessionID\x3d"+this.sessionID+a(778)+this[a(544)]+a(725)+this[a(600)]+a(672)+b[a(562)]+"\x26appId\x3d"+GameConfig[a(491)]+"\x26appPlatform\x3dcanvas\x26appVersion\x3d1";this[a(536)]=c;RSSocialManager[a(785)]().showPurchaseWindow(c,this[a(590)][a(756)](this), b[a(591)])}else b=RSGame[a(785)]()[a(734)]()[a(696)](this[a(712)][a(516)]),this.purchase(this[a(712)].price,b)},packPurchaseResponse:function(b,c){b?1383010==b||-200==b?void 0!=this[a(595)]&&null!=this[a(595)]&&(this[a(595)](c),this._cancelCallback=null,this.trackPurchaseCancel(this._pack.type,this[a(712)][a(729)],this[a(712)][a(647)],this[a(712)].value)):void 0!=this[a(625)]&&null!=this[a(625)]&&(RSErrorTracker[a(785)]()[a(666)](a(659),this[a(536)],a(538)),RSErrorTracker.getInstance()[a(666)](a(678), "Res Code:- "+b+a(795),a(538)),this._failureCallback(c),this[a(625)]=null,this[a(565)](this[a(712)][a(643)],this[a(712)][a(729)],this[a(712)][a(647)],c[a(573)])):void 0!=this[a(472)]&&null!=this[a(472)]&&(this[a(736)](this[a(712)][a(643)],this._pack[a(729)],this[a(712)].packAnalyticsPrice,c[a(604)]),GameConfig[a(667)]?this[a(591)]?this.saleType!=a(788)?(this[a(762)]=c,this[a(593)]=0,this[a(705)](c)):this.processPurchaseAfterValidation(c,null):(this.validationResponseObject=c,this[a(593)]=0,this[a(705)](c)): this[a(545)](c,null))},validateFBPurchase:function(b){this[a(593)]++;RSEngine[a(627)][a(705)](b,this.processPurchaseAfterValidation[a(756)](this,b),this.onValidationFailed[a(756)](this))},onValidationFailed:function(b){4>this[a(593)]?setTimeout(this[a(705)](this[a(762)])[a(756)](this),5E3):(this[a(593)]=0,this[a(762)]=null,RSErrorTracker.getInstance()[a(666)]("FB_PURCHASE_VALIDATION",a(504),a(538)),b={},b[a(573)]=a(658),this._failureCallback(b),this[a(625)]=null,this[a(565)](this._pack.type,this._pack[a(729)], this[a(712)][a(647)],b.error_message))},processPurchaseAfterValidation:function(b,c){if(c&&0==c.result[a(501)])4>this[a(593)]?setTimeout(this[a(705)](this[a(762)])[a(756)](this),5E3):(RSErrorTracker[a(785)]()[a(666)](a(776),"FAILED",a(538)),b={},b[a(573)]=a(658),this[a(625)](b),this._failureCallback=null,this[a(565)](this[a(712)][a(643)],this[a(712)][a(729)],this[a(712)][a(647)],b[a(573)]));else{this.validationRetryCount=0;this[a(762)]=null;b[a(724)]=c.result[a(616)][a(616)][a(566)];RSVIPManager[a(785)]()[a(713)]&& 0<RSVIPManager[a(785)]()[a(684)]()&&this.setVIPBenefits(b);this[a(472)](b);this[a(472)]=null;if(this[a(712)].type==a(529))for(var f=0;f<this[a(712)][a(542)][a(535)];f++)this[a(712)][a(542)][f]!=GameFeatureTypeEnum.PRIMARY_CURRENCY&&-1==GameFeatureTypeEnum.PRIMARY_CURRENCY[a(599)](this._pack[a(542)][f])||this[a(639)](this._pack[a(643)],this[a(712)].analyticsName,this[a(712)][a(647)],this._pack[this[a(712)][a(542)][f]]);else this[a(639)](this[a(712)][a(643)],this._pack[a(729)],this[a(712)][a(647)], this._pack[a(477)]);this[a(591)]!=a(652)&&this[a(712)][a(643)]!=a(529)&&this._pack[a(643)]!=a(691)&&this[a(712)][a(643)]!=a(722)&&this._pack.type!=a(650)&&this[a(712)][a(643)]!=a(733)&&(f=RSAnalyticsManager[a(785)]()[a(774)](),RSSaleManager[a(785)]().getOpenFromNameForSalePopup()&&RSSaleManager[a(785)]().getOpenFromNameForSalePopup()==a(703)&&(f=a(703)),this[a(681)](a(686),a(602),"open_from_"+f,this[a(712)][a(729)],this[a(775)]));GameConfig[a(693)]&&0==RSEngine[a(627)][a(514)]().getMonetizationCount()&& RSAdjustManager[a(785)]().trackEvent(RSAdjustEventToken[a(715)]);if(this[a(712)].type!=a(691)&&this._pack[a(643)]!=a(722)&&this[a(712)][a(643)]!=a(650)&&this[a(712)][a(643)]!=a(733))if("sale"==this[a(712)][a(643)])for(f=0;f<this._pack[a(542)][a(535)];f++)this[a(712)][a(542)][f]==GameFeatureTypeEnum[a(490)]||-1!=GameFeatureTypeEnum[a(490)].indexOf(this[a(712)][a(542)][f])?!this._pack[a(516)][a(634)](a(474))&&this[a(682)](RSAnalyticsSource.paid,a(602),this[a(712)][this[a(712)][a(542)][f]],this[a(712)][a(729)]): this._pack[a(542)][f]==GameFeatureTypeEnum[a(608)]||-1!=GameFeatureTypeEnum[a(608)].indexOf(this[a(712)][a(542)][f])?this[a(779)](this._pack[this[a(712)][a(542)][f]],a(602),this[a(712)][a(729)]):RSAnalyticsManager[a(785)]()[a(655)](RSEventCategory[a(506)],a(780)+this[a(712)][a(542)][f],a(602),this[a(712)][this._pack[a(542)][f]],this._pack[a(729)],"");else if(GameFeatureTypeEnum.PRIMARY_CURRENCY)if(this[a(712)].type==GameFeatureTypeEnum.PRIMARY_CURRENCY||this._pack[a(643)]==a(744))this[a(682)](RSAnalyticsSource[a(673)], a(602),this[a(712)][a(477)],this[a(712)][a(729)]);else if(this[a(712)][a(643)]==GameFeatureTypeEnum[a(608)])this[a(779)](this[a(712)][a(477)],a(602),this[a(712)][a(729)]);else f=a(780)+this[a(712)][a(643)],RSAnalyticsManager[a(785)]().trackInHouseEvent(RSEventCategory[a(506)],f,a(602),this[a(712)][a(477)],this[a(712)].analyticsName,"");else"powerups"!=this[a(712)][a(643)]&&this[a(712)][a(643)]!=a(596)?this[a(682)](RSAnalyticsSource[a(673)],a(602),this._pack[a(477)],this[a(712)].analyticsName):this[a(779)](this[a(712)][a(477)], a(602),this[a(712)].analyticsName);if("sale"==this[a(712)][a(643)])for(f=0;f<this[a(712)].saleRewardTypes.length;f++)this[a(712)][a(542)][f]!=GameFeatureTypeEnum[a(490)]&&-1==GameFeatureTypeEnum[a(490)].indexOf(this[a(712)][a(542)][f])||this[a(641)](this[a(712)][a(643)],this[a(712)].analyticsName,this._pack[a(647)],this[a(712)][this[a(712)].saleRewardTypes[f]]);else this.trackFBPurchaseLogged(this[a(712)][a(643)],this._pack[a(729)],this._pack[a(647)],this[a(712)][a(477)])}},trackBing:function(){if(GameConfig[a(798)])if(this[a(712)][a(643)]== a(529))for(var b=0;b<this[a(712)][a(542)][a(535)];b++)this._pack[a(542)][b]!=GameFeatureTypeEnum[a(490)]&&-1==GameFeatureTypeEnum.PRIMARY_CURRENCY.indexOf(this[a(712)][a(542)][b])||window[a(787)][a(480)]({event_id:a(602),data:{event_category:this[a(712)][a(542)][b],event_label:this[a(712)].analyticsName,event_value:this[a(712)][a(647)]}},"*");else window[a(787)][a(480)]({event_id:"purchase",data:{event_category:this._pack.type,event_label:this[a(712)][a(729)],event_value:this[a(712)][a(647)]}},"*")}, trackGTM:function(b){parent[a(480)]({type:"gtm",data:{event:a(602),transaction_id:b,value:this[a(712)][a(532)],currency:"USD",blob_id:RSGame.getInstance()[a(750)]()[a(514)]()[a(707)](),item_list_name:this._pack[a(729)]}},"*")},additionalCoinsOnPurchase:function(b){b*=1;var c=parseFloat(RSVIPManager[a(785)]().getadditionalCoinsOnPurchase()),c=Math[a(485)](b*c);return 1*(b+c)},setVIPBenefits:function(b){if(!this[a(712)].packID||!this._pack.packID[a(634)](a(474)))if(this[a(712)].type==a(529))for(var c in this._pack[a(542)])"coin"== this[a(712)][a(542)][c]&&(this[a(712)][a(729)][a(634)]("NPS")?this[a(712)][this[a(712)][a(542)][c]]=b[a(724)]:this._pack[this[a(712)][a(542)][c]]=this.additionalCoinsOnPurchase(this[a(712)][a(477)]));else this[a(712)][a(643)]!=a(566)&&this[a(712)][a(643)]!=a(744)||(this[a(712)][a(477)]=this[a(648)](this._pack[a(477)]))},packPurchaseResponseForWeb:function(b){this[a(736)](this[a(712)][a(643)],this[a(712)].analyticsName,this[a(712)][a(647)],b.payment_id);RSVIPManager[a(785)]().vipEnabled&&0<RSVIPManager[a(785)]().getVIPUserTier()&& this.setVIPBenefits(b);if(this[a(712)].type==a(529))for(var c=0;c<this[a(712)][a(542)].length;c++)this._pack[a(542)][c]==a(744)&&this[a(639)](this[a(712)].type,this[a(712)][a(729)],this[a(712)][a(647)],this[a(712)][this._pack[a(542)][c]]);else this.trackPurchaseSuccess(this[a(712)][a(643)],this[a(712)].analyticsName,this[a(712)][a(647)],this[a(712)].value);this[a(591)]!=a(652)&&this[a(712)][a(643)]!=a(529)&&"doubleornothing"!=this[a(712)][a(643)]&&"unlock"!=this[a(712)][a(643)]&&this._pack[a(643)]!= a(650)&&this[a(712)].type!=a(733)&&this.trackGUIEventForPurchase(a(686),a(602),a(613)+RSAnalyticsManager[a(785)]()[a(774)](),this[a(712)].analyticsName,this[a(775)]);if(this[a(712)][a(643)]!=a(691)&&"unlock"!=this[a(712)][a(643)]&&this[a(712)][a(643)]!=a(650)&&"spinwheel"!=this[a(712)][a(643)]&&this[a(712)][a(643)]!=a(486))if(this[a(712)][a(643)]==a(529))for(c=0;c<this[a(712)][a(542)][a(535)];c++)this[a(712)][a(542)][c]!=a(764)&&this[a(712)][a(542)][c]!=a(596)?!this[a(712)][a(516)][a(634)](a(474))&& this[a(682)](RSAnalyticsSource[a(673)],a(602),this[a(712)][this[a(712)][a(542)][c]],this[a(712)][a(729)]):this.trackSecondarySource(this._pack[this[a(712)].saleRewardTypes[c]],"purchase",this[a(712)].analyticsName);else"powerups"!=this[a(712)].type&&this[a(712)][a(643)]!=a(596)?this.trackPrimarySource(RSAnalyticsSource[a(673)],"purchase",this[a(712)][a(477)],this[a(712)][a(729)]):this[a(779)](this[a(712)][a(477)],"purchase",this._pack[a(729)]);GameConfig[a(693)]&&0==RSEngine[a(627)][a(514)]()[a(623)]()&& RSAdjustManager[a(785)]()[a(675)](RSAdjustEventToken.FirstPurchase);this[a(641)](this[a(712)][a(643)],this[a(712)][a(729)],this[a(712)][a(647)],this[a(712)][a(477)]);b[a(740)]&&(GlobalVars[a(740)]=!0)},packPurchaseFailResponseForWeb:function(b){RSErrorTracker[a(785)]().trackErrorMessage(a(659),this._purchaseURL,"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net");RSErrorTracker[a(785)]()[a(666)](a(678),a(795)+b[a(531)],a(538));this[a(625)](b);this[a(625)]=null;this[a(565)](this[a(712)].type, this[a(712)][a(729)],this._pack[a(647)],b[a(531)])},createHostedFields:function(b){this[a(626)]=!0;this.isAllFieldsValid=!1;var c=this;this._vaildFieldState={ccnumber:0,ccexp:0,cvv:0,postalCode:0};CollectJS.configure({variant:a(637),paymentSelector:a(546),callback:function(b){""!=b[a(783)].pointerType&&RSInAppPurchaseManager[a(785)]()[a(563)]&&(document[a(555)](a(794))[a(570)]?c[a(751)](b,1):c[a(751)](b,0))},styleSniffer:a(636),googleFont:"Source Code Pro",focusCss:{border:a(526),"outline-style":"none"}, invalidCss:{color:a(598)},validCss:{color:"green"},fields:{ccnumber:{selector:a(631),title:"Card Number",placeholder:a(731)},ccexp:{selector:"#expiration",title:a(533),placeholder:a(758)},cvv:{selector:a(505),title:a(492),placeholder:a(470)}},validationCallback:function(b,c,d){RSInAppPurchaseManager[a(785)]()[a(574)](b,c,d)}})},validationCheck:function(b,c,f){if(c)switch(b){case a(499):this[a(765)].ccnumber=1;$(a(674))[a(515)]();break;case a(745):this._vaildFieldState.ccexp=1;$(a(567))[a(515)](); break;case a(701):this[a(765)][a(701)]=1,$(a(784)).hide()}else switch(b){case a(499):this._vaildFieldState[a(499)]=0;$(a(674))[a(640)]();break;case a(745):this._vaildFieldState[a(745)]=0;$(a(567)).show();break;case a(701):this[a(765)][a(701)]=0,$(a(784)).show()}},setZipCodeState:function(b){this[a(765)][a(742)]=b},checkAllFieldsValidOrNot:function(){this[a(765)][a(499)]&&this[a(765)][a(745)]&&this[a(765)][a(701)]&&this._vaildFieldState[a(742)]?this.isAllFieldsValid=!0:(this[a(563)]=!1,this[a(791)]= setInterval(function(){$(a(558)).remove();clearInterval(this[a(791)])}[a(756)](this),2E3),this[a(765)][a(499)]?$(a(674))[a(515)]():$("#CardErrorLabel")[a(640)](),this[a(765)][a(745)]?$(a(567))[a(515)]():$(a(567))[a(640)](),this._vaildFieldState[a(701)]?$(a(784))[a(515)]():$(a(784))[a(640)](),this._vaildFieldState[a(742)]?$(a(559)).hide():$(a(559)).show())},calculateTax:function(b){if(""==b)$(a(546))[a(594)](a(644),!0),document[a(555)](a(761))[a(522)]=a(792),document[a(555)](a(581))[a(522)]="$"+this[a(777)]; else{!$("#preloader")[a(535)]&&$("body")[a(479)](a(589));this[a(603)]=b;b=[];var c=[];c[0]=RSEngine[a(627)][a(514)]()[a(707)]();c[1]=this[a(603)];c[2]=this[a(777)];b[0]=c[0];b[1]=c[1];b[2]=c[2];c[3]=RSUtils.getHashValue(b);var f=this;RSEngine[a(738)][a(786)]("AvaTax.initialTransaction",c,function(b){$("#preloader")[a(535)]&&$(a(558))[a(759)]();null!=b[a(494)]&&b[a(494)][a(501)]!=a(580)?(f[a(633)]=b[a(494)][a(616)].totalTax,document[a(555)](a(761))[a(522)]="$"+b[a(494)][a(616)][a(646)],document[a(555)](a(581)).innerHTML= "$"+b.result.data[a(597)],$("#payment-button-paypal").removeAttr(a(644))):($("#payment-button-paypal")[a(594)](a(644),!0),document[a(555)](a(761))[a(522)]="$0.00",document[a(555)](a(581))[a(522)]="$"+f._amount)})}},onPurchaseNonceRecieved:function(b,c){$(a(558)).remove();this[a(716)]=b[a(730)];this[a(709)]=b[a(643)];this._token=b[a(720)];this[a(518)]=c;this[a(601)]=b[a(656)];closePurchaseUIPopup();this[a(622)](b[a(730)],this._dataCollector,b[a(643)],b[a(720)],c,b[a(656)])},_removeCard:function(b){!$(a(558)).length&& $("body")[a(479)]('\x3cdiv id\x3d"preloader" class \x3d "preload"\x3e\x3c/div\x3e');var c=[];c[0]=RSEngine[a(627)][a(514)]().getId();c[1]=b;var f=this;RSEngine[a(738)][a(786)]("Web.removeCard",c,function(b){$(a(482)).html("");f[a(628)](!0)})},_getCard:function(b){var c=[];c[0]=RSEngine[a(627)][a(514)]()[a(707)]();c[1]=RSEngine[a(718)]==PLATFORM[a(660)]?a(781):a(737);!b&&this[a(510)](this[a(508)]);var f=this;RSEngine[a(738)][a(786)]("Web.getCard",c,function(c){null==c.result&&(c[a(494)]={data:null}); null!=c&&null!=c[a(494)]&&($(a(558))[a(535)]&&$("#preloader").remove(),f._savedCards=c[a(494)][a(616)],(!b||!f[a(699)]||0==f[a(699)][a(535)])&&showButton(a(489)),f[a(699)]&&3<f[a(699)].length?document.getElementById(a(687))[a(509)][a(704)]=a(526):document[a(555)](a(687))[a(509)][a(704)]=a(607),f[a(699)]&&0!=f[a(699)][a(535)]?($("#paypal-check")[a(551)](a(644)),f.showCard()):($(a(700))[a(594)]("disabled",!0),$(a(473))[a(534)](a(570),!0)))})},resetRadioBtnForSaveCard:function(){for(var b in this[a(699)])null!= document[a(555)](a(537)+this[a(699)][b][a(656)])&&(document.getElementById(a(537)+this[a(699)][b][a(656)])[a(644)]=!1,document[a(555)](a(537)+this._savedCards[b].billingId).checked=!1,document[a(555)]("pay-"+this[a(699)][b][a(656)])[a(644)]=!0)},createSavedCardfield:function(b){for(var c in this[a(699)])this[a(699)][c][a(656)]==b&&(this[a(699)][c].initialized=!0,this[a(603)]=this[a(699)][c][a(742)]);$(a(558))[a(535)]&&$(a(558))[a(759)]()},_buyInAppItem:function(b,c,f,g,h,k){null==c&&(c={});var m= {};this[a(714)]=b;this[a(587)]?(m[a(523)]=this._packID,m.userTier=this[a(544)],m[a(600)]=this.saleCounter,m.sessionID=this.sessionID,m.type=a(529),m[a(517)]=this._eventID,m[a(591)]=this[a(469)]):m[a(523)]=this[a(712)].id;f&&(m[a(484)]=f,f==a(743)&&(this[a(633)]=0));m[a(635)]=RSEngine.dataManager[a(514)]().getId();this._exitCartPurchase?m[a(475)]=this[a(712)].exitCartValue:m[a(475)]=this._pack[a(477)];m.powerup=0;m[a(596)]=0;m[a(676)]=this._pack.id;m[a(495)]=b;m.dollarValue=this[a(712)].price;m[a(671)]= a(579);m[a(726)]=this[a(712)][a(532)];m.analyticsName=this[a(712)][a(729)];m.deviceData=c;m.fbCookieFBP=GlobalVars[a(760)];m[a(749)]=GlobalVars.fbCookieFBC;m.clientUserAgent=GlobalVars[a(471)];m[a(742)]=this[a(603)];m[a(689)]=this[a(633)];m.analyticsPlatformName=GlobalVars.analyticsPlatformName;null!=g?m[a(748)]=g:m[a(748)]="";m[a(695)]=window[a(695)]?window[a(695)]:"";m[a(638)]=h;m[a(656)]=k;b=[];b[0]=m[a(523)];b[1]=m[a(495)];b[2]=m[a(742)];b[3]=m[a(748)];b[4]=m[a(511)];b[5]=m.taxAmount;b[6]=m[a(671)]; b[7]=m[a(726)];b=RSUtils[a(746)](b);c=[];c[0]=RSEngine.dataManager[a(514)]().getId();c[1]=RSEngine.platform==PLATFORM[a(660)]?a(781):a(737);c[2]=m;c[3]=b;var n=this;RSEngine[a(738)][a(786)]("Web.inAppPurchaseValidation",c,function(b){b[a(494)]&&(this._retryCount=0,b[a(494)].status?(n.trackBing(),n[a(610)](b[a(494)].data.transaction_id),b={webVersion:!0,status:b.result[a(501)],payment_id:b[a(494)][a(616)].transaction_id,message:b[a(494)][a(531)],clubMPoints:b[a(494)].data[a(493)]?b[a(494)][a(616)][a(493)]: 0,playerConnectPoints:b.result[a(616)][a(797)]?b[a(494)].data[a(797)]:0,isPurchaseBanned:b[a(494)][a(740)]?b[a(494)][a(740)]:0,isGCOWRewardAvailable:b[a(494)][a(770)]?b[a(494)][a(770)]:!1,gcowRewardedCount:b[a(494)][a(772)]?parseInt(b.result.gcowRewardedCount):0,totalCoinsAwarded:b[a(494)][a(616)][a(566)]},n.packPurchaseResponseForWeb(b),n[a(472)](b)):(b={webVersion:!0,status:b[a(494)][a(501)],message:b[a(494)].message},n[a(721)](b)))},n._purchaseCallFailed[a(756)](n))},additionalCoinsOnpurchase:function(b){b*= 1;var c=parseFloat(RSVIPManager.getInstance()[a(615)]()),c=Math[a(485)](b*c);return 1*(b+c)},trackAdjustForPurchase:function(){RSEngine[a(606)]!=LOGIN_MODE.GUEST&&GameConfig[a(693)]&&RSAdjustManager[a(785)]()[a(670)](this._pack[a(532)])},_purchaseCallFailed:function(b){3>this[a(768)]?(this[a(768)]++,this[a(622)](this._paymentNonce,this._dataCollector,this[a(709)],this[a(508)],this[a(518)],this._billingId)):this[a(768)]=0},afterTokenGenerated:function(b){this[a(628)]()},showCard:function(){var b=document.getElementById(a(582)), c,f,g;for(g in this[a(699)]){f="";switch(this[a(699)][g][a(478)]){case a(741):f=a(519);break;case "Maestro":f=a(692);break;case a(483):f="https://secure.nmi.com/shared/images/brand-mastercard.png";break;case a(557):f=a(549);break;case a(521):f=a(732);break;case a(752):f="https://secure.nmi.com/shared/images/brand-amex.png";break;case a(710):f=a(766)}var h=this[a(699)][g].expirationDate.slice(0,2)+"-"+this[a(699)][g][a(723)][a(702)](2);c="\x3cform action\x3d'/' id\x3d'payment-form-"+this._savedCards[g][a(656)]+ "' method\x3d'post' style\x3d''\x3e";c+=a(649)+this._savedCards[g][a(656)]+"' name\x3d'card' onclick\x3dinitSavedCard("+"'"[a(540)](this[a(699)][g][a(656)],"'")[a(575)]()+a(685)+this[a(699)][g].billingId+a(503)+"\x3clabel style\x3d'padding-top: 2%' class\x3d'col-md-4 col-xs-4'\x3e"+this[a(699)][g][a(556)]+a(568);c+=a(767)+h+a(576)+f+"\x3e \x3cbutton type\x3d'button' class\x3d'close' style\x3d'padding-left: 10px;padding-top:5px;float:right;color: #000000;' aria-label\x3d'Remove' onclick\x3dremoveCard("+ "'"[a(540)](this[a(699)][g][a(656)],"'")[a(575)]()+a(683)+"class\x3d''\x3ex\x3c/span\x3e\x3c/button\x3e ";this._savedCards[g][a(478)]=this[a(699)][g][a(478)].replace(/'/g,a(541));c+=a(793)+this._savedCards[g][a(656)]+a(771)+"'".concat(this[a(699)][g][a(720)],"'")[a(575)]()+","+"'"[a(540)](encodeURIComponent(this[a(699)][g].cardType),"'").toString()+","+"'".concat(this._savedCards[g][a(656)],"'")[a(575)]()+") /\x3e\x3c/form\x3e";b.innerHTML+=c}},getTotalNumberOfCards:function(){return this[a(699)]? this[a(699)][a(535)]:0},cardTokenGenerate:function(b){for(var c in this[a(699)])this[a(699)][c][a(656)]==b?(document[a(555)](a(481)+this._savedCards[c][a(656)])[a(509)][a(704)]="block",document[a(555)](a(481)+this[a(699)][c].billingId).disabled=!1,document[a(555)]("radio-"+this[a(699)][c][a(656)])[a(570)]=!0,document[a(555)](a(537)+this[a(699)][c][a(656)])[a(644)]=!0,this[a(669)]()&&(this[a(603)]=this[a(699)][c][a(742)],this[a(550)](this[a(603)])),!this[a(699)][c][a(680)]&&(!$(a(558))[a(535)]&&$(a(583))[a(479)](a(589)), this[a(572)](b))):(document[a(555)](a(481)+this[a(699)][c][a(656)])[a(644)]=!0,document[a(555)]("radio-"+this._savedCards[c][a(656)]).checked=!1,document[a(555)]("radio-"+this[a(699)][c][a(656)]).disabled=!1)},cardTokenGenerated:function(b){this[a(548)](b)},clearNonce:function(){this[a(642)](this._pack[a(643)],this._pack[a(729)],this[a(712)].packAnalyticsPrice,this._pack[a(477)]);this[a(595)]({webVersion:!0,status:!1});this[a(595)]=null},purchase:function(b,c){if(GlobalVars[a(740)])RSGame[a(785)]()[a(717)]()[a(697)](), RSEngine[a(800)][a(782)](),RSGame[a(785)]().getGameManager().showPurchaseBanned();else{this._amount=b;this[a(711)]();$("#card-check").prop(a(570),!0);$("#paypal-check")[a(534)]("checked",!1);$(a(688))[a(560)](a(799));$(a(688))[a(515)]();$(a(674)).hide();$("#ExpDateErrorLabel")[a(515)]();$("#CVVErrorLabel")[a(515)]();$(a(559))[a(515)]();this[a(669)]()?($(a(546))[a(594)](a(644),!0),null!=document[a(555)](a(581))&&(document[a(555)](a(581))[a(522)]="$"+b)):(null!=$(a(513))&&$(a(513))[a(759)](),null!= $(a(632))&&$(a(632))[a(759)]());null!=$(a(619))&&$(a(619))[a(547)]("text-align",a(620));$(a(592))[a(651)](a(640));$(a(546))[a(594)](a(477),"CONTINUE");!$(a(558))[a(535)]&&$(a(583))[a(479)](a(589));var f=document[a(555)](a(618));f&&1==parseInt(RSEngine[a(668)][a(578)]()[a(747)])&&(f.innerHTML=c+" ");(f=document[a(555)](a(739)))&&(f[a(522)]="$"+b)}},isTaxEnabled:function(){return 1==parseInt(RSGame[a(785)]()[a(734)]()[a(578)]()[a(789)])&&"US"==RSGame.getInstance()[a(750)]()[a(514)]().getCountryCode()? !0:!1},getCurrentActivePurchasePack:function(){return this[a(712)]},trackPurchaseValidationInitiation:function(a,b,c,g){RSAnalyticsManager.getInstance().trackPurchaseValidationInitiation(a,b,c,g)},trackPurchaseSuccess:function(b,c,f,g){this[a(561)]();GameConfig.IS_VIP_ENABLED&&GameConfig[a(719)]&&(this[a(712)][a(744)]<this[a(712)].value?g=this._pack[a(744)]:g=this[a(712)][a(477)]);RSAnalyticsManager[a(785)]().trackPurchaseSuccess(b,c,f,g)},trackPurchaseInitiation:function(b){var c=RSEngine[a(627)][a(514)]()[a(605)](), f=RSEngine[a(627)][a(514)]()[a(679)](),g=RSEngine[a(627)][a(514)]()[a(769)](),c={xp:f,coins:c,pack_name:b,level:g};RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE[a(763)],"",c);RSAnalyticsManager[a(785)]()[a(753)](b)},trackPurchaseCancel:function(b,c,f,g){RSPlatformSDKManager[a(785)]().setUserAttributeLastCancelledInAppPack(c);RSPlatformSDKManager[a(785)]()[a(706)](f/100);RSAnalyticsManager.getInstance()[a(642)](b,c,f,g)},trackFBPurchaseLogged:function(b,c,f,g){RSEngine.loginMode==LOGIN_MODE[a(507)]&& RSAnalyticsManager[a(785)]()[a(641)](b,c,f,g)},trackPurchaseFail:function(b,c,f,g){RSPlatformSDKManager[a(785)]()[a(735)](c);RSPlatformSDKManager[a(785)]()[a(706)](f/100);RSAnalyticsManager[a(785)]().trackPurchaseFail(b,c,f,g)},trackGUIEventForPurchaseCartOpen:function(b,c,f,g){RSAnalyticsManager[a(785)]()[a(564)](b,c,f,g);RSPlatformSDKManager[a(785)]()[a(675)](SDK_EVENT_TYPE.purchaseCartOpen)},trackGUIEventForPurchaseCartClose:function(b,c,f,g,h){RSAnalyticsManager[a(785)]()[a(564)](b,c,f,g,h);b== a(686)&&RSPlatformSDKManager[a(785)]()[a(675)](SDK_EVENT_TYPE[a(552)])},trackGUIEventForPurchase:function(b,c,f,g,h){RSAnalyticsManager.getInstance()[a(564)](b,c,f,g,h)},trackPrimarySource:function(b,c,f,g,h){GameConfig[a(719)]&&this._pack[a(744)]!=this[a(712)][a(477)]&&(f=this[a(712)][a(744)]);RSAnalyticsManager[a(785)]()[a(682)](b,c,f,g,h)},trackSecondarySource:function(b,c,f){RSAnalyticsManager[a(785)]()[a(779)](b,c,f)}});return{getInstance:function(){return!b&&(b=new c),b}}}(); function a0_0x7649(){var a="241269siYQPc{ValidationFailed{PURCHASE_URL{MOBILE{onPurchaseCancel{closeFullScreen{exitCartStatus{random{sessionCounter{trackErrorMessage{IS_FB_VALIDATION_ENABLED{gameData{isTaxEnabled{trackPurchase{localCurrency{\x26version\x3d{paid{#CardErrorLabel{trackEvent{product_id{currency{PURCHASE_RESPONSE{getXP{initialized{trackGUIEventForPurchase{trackPrimarySource{)\x3e\x3cspan aria-hidden\x3d'true'{getVIPUserTier{); value\x3d'{purchase_cart{checkCard{#savedCardframe{taxAmount{\x26method\x3dpay{doubleornothing{https://secure.nmi.com/shared/images/brand-maestro.png{IS_ADJUST_ENABLED{extend{afWebUserId{getPackTitle{hideOverlayLayer{368611FwcCdL{_savedCards{#paypal-check{cvv{slice{ooc{display{validateFBPurchase{setUserAttributeLastCancelledDollarAmount{getId{getFBId{_from{Diner's Club{afterTokenGenerated{_pack{vipEnabled{_paymentNonce{FirstPurchase{paymentNonce{getGameManager{platform{IS_VIP_ENABLED{token{packPurchaseFailResponseForWeb{unlock{expirationDate{totalCoinsAwarded{\x26saleCounter\x3d{localPrice{3067002ktiBHC{showPurchaseWindow{analyticsName{nonce{0000 0000 0000 0000{https://secure.nmi.com/shared/images/brand-jcb.png{spinwheel{getGameData{setUserAttributeLastCancelledInAppPack{trackPurchaseValidationInitiation{html5{networkManager{p_amount{isPurchaseBanned{Visa{postalCode{PayPalAccount{coin{ccexp{getHashValue{isCustomPackTitleEnabled{paymentToken{fbCookieFBC{getUserDataManager{onPurchaseNonceRecieved{American Express{trackPurchaseInitiation{_successCallback{4147800DYyYhD{bind{user_currency{MM / YY{remove{fbCookieFBP{p_tax{validationResponseObject{purchaseInitiated{powerups{_vaildFieldState{https://secure.nmi.com/shared/images/brand-diners.png{\x3clabel style\x3d'padding-top: 2%' class\x3d'col-md-2 col-xs-2'\x3e {_retryCount{getUserLevel{isGCOWRewardAvailable{' style\x3d'width:10%;float:right;' class\x3d'col-md-2 col-xs-2 btn btn-primary' value\x3d'Pay' disabled onclick\x3dpurchaseWithSavedCard({gcowRewardedCount{floor{getCurrentMachineName{_eventID{FB_PURCHASE_VALIDATION{_amount{\x26userTier\x3d{trackSecondarySource{source_{mobile{removeAllPopups{initiatedBy{#CVVErrorLabel{getInstance{sendJSONRPCRequest{parent{subscription{avalaraTaxStatus{/facebook/payments/fbCreditsDetails.php?id\x3d{_removeOverlay{$0.00{ \x3cinput type\x3d'submit' id\x3d'pay-{saveCards{ Purchase Failure - {_exitCartPurchase{playerConnectPoints{BING_ADS_ENABLED{savedCard{popupManager{_saleType{CVV{clientUserAgent{_successcallback{#card-check{sub{itemValue{onSuccessCallback{value{cardType{append{postMessage{pay-{#savedCardDiv{Mastercard{paymentType{round{daubalert{NOTSET{appId{card{PRIMARY_CURRENCY{APP_ID{Security Code{clubMPoints{result{paymentNounce{\x26user_currency\x3d{DYNAMIC{135641ynXpLS{ccnumber{onFailedCallback{status{itemType{'/\x3e{FAILED{#cvv{ECONOMY{FACEBOOK{_token{style{createHostedFields{dollarValue{\x26exitCart\x3d{#myModalLabel-total{getMe{hide{packID{eventId{_savedCard{https://secure.nmi.com/shared/images/brand-visa.png{_userCountryLocalCurrencyUnicode{JCB{innerHTML{itemId{fromCharCode{1850662agkntU{none{currencyValue{split{sale{500yrnArC{message{price{Expiration Date{prop{length{_purchaseURL{radio-{mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net{_packID{concat{%27{saleRewardTypes{_paypalToken{_userTier{processPurchaseAfterValidation{#payment-button-paypal{css{createSavedCardfield{https://secure.nmi.com/shared/images/brand-discover.png{calculateTax{removeAttr{purchaseCartClose{Invalid base URL{3JvVqnG{getElementById{maskedNumber{Discover{#preloader{#ZipErrorLabel{removeClass{trackAdjustForPurchase{version{isAllFieldsValid{trackGUIEvent{trackPurchaseFail{coins{#ExpDateErrorLabel{\x3c/label\x3e{sessionID{checked{exchangeRate{cardTokenGenerated{error_message{validationCheck{toString{\x3c/label\x3e \x3cimg class\x3d'col-md-2 col-xs-2 img-control' src\x3d{\x26usd_exchange_inverse\x3d{getDefaultValues{USD{400{p_total{savedCardDiv{body{usd_exchange_inverse{\x26userId\x3d{_baseURL{_isSale{pack{\x3cdiv id\x3d\"preloader\" class \x3d \"preload\"\x3e\x3c/div\x3e{packPurchaseResponse{saleType{#PurchaseUI{validationRetryCount{attr{_cancelCallback{energy{totalAmount{red{indexOf{saleCounter{_billingId{purchase{_zipCode{payment_id{getCoins{loginMode{block{SECONDARY_CURRENCY{getTime{trackGTM{_userCountryLocalCurrencyType{formatNumberWithComma{open_from_{280jMbmYs{getadditionalCoinsOnPurchase{data{\x26appPlatform\x3dcanvas\x26appVersion\x3d1{p_details{#myModalLabel-pack{center{5QpogfW{_buyInAppItem{getMonetizationCount{10831293JGHAoY{_failureCallback{isPurchaseUIOnDisplay{dataManager{_getCard{\x26eventId\x3d{U+0024{#card-number{#myModalLabel-tax{_taxAmount{includes{userId{false{inline{saveCard{trackPurchaseSuccess{show{trackFBPurchaseLogged{trackPurchaseCancel{type{disabled{_dataCollector{totalTax{packAnalyticsPrice{additionalCoinsOnPurchase{\x3cdiv class\x3d'form-control card-control'\x3e\x3cinput type\x3d'radio' class\x3d'col-md-1 col-xs-1' id\x3d'radio-{scratcherspack{modal{loc{\x26timeStamp\x3d{\x26type\x3d{trackInHouseEvent{billingId".split("{"); a0_0x7649=function(){return a};return a0_0x7649()};(function(){var a=function(){this.init()};a.prototype={init:function(){var a=this||b;a._codecs={};a._howls=[];a._muted=!1;a._volume=1;a._canPlayEvent="canplaythrough";a._navigator="undefined"!==typeof window&&window.navigator?window.navigator:null;a.masterGain=null;a.noAudio=!1;a.usingWebAudio=!0;a.autoSuspend=!0;a.ctx=null;a.mobileAutoEnable=!0;a._setup();return a},volume:function(a){var c=this||b;a=parseFloat(a);c.ctx||m();if("undefined"!==typeof a&&0<=a&&1>=a){c._volume=a;if(c._muted)return c; c.usingWebAudio&&(c.masterGain.gain.value=a);for(var d=0;d<c._howls.length;d++)if(!c._howls[d]._webAudio)for(var e=c._howls[d]._getSoundIds(),f=0;f<e.length;f++){var g=c._howls[d]._soundById(e[f]);g&&g._node&&(g._node.volume=g._volume*a)}return c}return c._volume},mute:function(a){var c=this||b;c.ctx||m();c._muted=a;c.usingWebAudio&&(c.masterGain.gain.value=a?0:c._volume);for(var d=0;d<c._howls.length;d++)if(!c._howls[d]._webAudio)for(var e=c._howls[d]._getSoundIds(),f=0;f<e.length;f++){var g=c._howls[d]._soundById(e[f]); g&&g._node&&(g._node.muted=a?!0:g._muted)}return c},unload:function(){for(var a=this||b,c=a._howls.length-1;0<=c;c--)a._howls[c].unload();a.usingWebAudio&&"undefined"!==typeof a.ctx.close&&(a.ctx.close(),a.ctx=null,m());return a},codecs:function(a){return(this||b)._codecs[a.replace(/^x-/,"")]},_setup:function(){var a=this||b;a.state=a.ctx?a.ctx.state||"running":"running";a._autoSuspend();a.noAudio||a._setupCodecs();return a},_setupCodecs:function(){var a=this||b,c="undefined"!==typeof Audio?new Audio: null;if(!c||"function"!==typeof c.canPlayType)return a;var d=c.canPlayType("audio/mpeg;").replace(/^no$/,""),e=a._navigator&&a._navigator.userAgent.match(/OPR\/([0-6].)/g),e=e&&33>parseInt(e[0].split("/")[1],10);a._codecs={mp3:!(e||!d&&!c.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!d,opus:!!c.canPlayType('audio/ogg; codecs\x3d"opus"').replace(/^no$/,""),ogg:!!c.canPlayType('audio/ogg; codecs\x3d"vorbis"').replace(/^no$/,""),oga:!!c.canPlayType('audio/ogg; codecs\x3d"vorbis"').replace(/^no$/, ""),wav:!!c.canPlayType('audio/wav; codecs\x3d"1"').replace(/^no$/,""),aac:!!c.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!c.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(c.canPlayType("audio/x-m4a;")||c.canPlayType("audio/m4a;")||c.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(c.canPlayType("audio/x-mp4;")||c.canPlayType("audio/mp4;")||c.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!c.canPlayType('audio/webm; codecs\x3d"vorbis"').replace(/^no$/,""),webm:!!c.canPlayType('audio/webm; codecs\x3d"vorbis"').replace(/^no$/, ""),dolby:!!c.canPlayType('audio/mp4; codecs\x3d"ec-3"').replace(/^no$/,""),flac:!!(c.canPlayType("audio/x-flac;")||c.canPlayType("audio/flac;")).replace(/^no$/,"")};return a},_enableMobileAudio:function(){var a=this||b,c=/iPhone|iPad|iPod|Android|BlackBerry|BB10|Silk|Mobi/i.test(a._navigator&&a._navigator.userAgent),d=!!("ontouchend"in window||a._navigator&&0<a._navigator.maxTouchPoints||a._navigator&&0<a._navigator.msMaxTouchPoints);if(!a._mobileEnabled&&a.ctx&&(c||d)){a._mobileEnabled=!1;a._mobileUnloaded|| 44100===a.ctx.sampleRate||(a._mobileUnloaded=!0,a.unload());a._scratchBuffer=a.ctx.createBuffer(1,1,22050);var e=function(){var b=a.ctx.createBufferSource();b.buffer=a._scratchBuffer;b.connect(a.ctx.destination);"undefined"===typeof b.start?b.noteOn(0):b.start(0);b.onended=function(){b.disconnect(0);a._mobileEnabled=!0;a.mobileAutoEnable=!1;document.removeEventListener("touchend",e,!0)}};document.addEventListener("touchend",e,!0);return a}},_autoSuspend:function(){var a=this;if(a.autoSuspend&&a.ctx&& "undefined"!==typeof a.ctx.suspend&&b.usingWebAudio){for(var c=0;c<a._howls.length;c++)if(a._howls[c]._webAudio)for(var d=0;d<a._howls[c]._sounds.length;d++)if(!a._howls[c]._sounds[d]._paused)return a;a._suspendTimer&&clearTimeout(a._suspendTimer);a._suspendTimer=setTimeout(function(){a.autoSuspend&&(a._suspendTimer=null,a.state="suspending",a.ctx.suspend().then(function(){a.state="suspended";a._resumeAfterSuspend&&(delete a._resumeAfterSuspend,a._autoResume())}))},3E4);return a}},_autoResume:function(){var a= this;if(a.ctx&&"undefined"!==typeof a.ctx.resume&&b.usingWebAudio)return"running"===a.state&&a._suspendTimer?(clearTimeout(a._suspendTimer),a._suspendTimer=null):"suspended"===a.state?(a.state="resuming",a.ctx.resume().then(function(){a.state="running"}),a._suspendTimer&&(clearTimeout(a._suspendTimer),a._suspendTimer=null)):"suspending"===a.state&&(a._resumeAfterSuspend=!0),a}};var b=new a,c=function(a){a.src&&0!==a.src.length?this.init(a):console.error("An array of source files must be passed with any new Howl.")}; c.prototype={init:function(a){b.ctx||m();this._autoplay=a.autoplay||!1;this._format="string"!==typeof a.format?a.format:[a.format];this._html5=a.html5||!1;this._muted=a.mute||!1;this._loop=a.loop||!1;this._pool=a.pool||5;this._preload="boolean"===typeof a.preload?a.preload:!0;this._rate=a.rate||1;this._sprite=a.sprite||{};this._src="string"!==typeof a.src?a.src:[a.src];this._volume=void 0!==a.volume?a.volume:1;this._duration=0;this._state="unloaded";this._sounds=[];this._endTimers={};this._queue= [];this._onend=a.onend?[{fn:a.onend}]:[];this._onfade=a.onfade?[{fn:a.onfade}]:[];this._onload=a.onload?[{fn:a.onload}]:[];this._onloaderror=a.onloaderror?[{fn:a.onloaderror}]:[];this._onpause=a.onpause?[{fn:a.onpause}]:[];this._onplay=a.onplay?[{fn:a.onplay}]:[];this._onstop=a.onstop?[{fn:a.onstop}]:[];this._onmute=a.onmute?[{fn:a.onmute}]:[];this._onvolume=a.onvolume?[{fn:a.onvolume}]:[];this._onrate=a.onrate?[{fn:a.onrate}]:[];this._onseek=a.onseek?[{fn:a.onseek}]:[];this._webAudio=b.usingWebAudio&& !this._html5;"undefined"!==typeof b.ctx&&b.ctx&&b.mobileAutoEnable&&b._enableMobileAudio();b._howls.push(this);this._preload&&this.load();return this},load:function(){var a=null;if(b.noAudio)this._emit("loaderror",null,"No audio support.");else{"string"===typeof this._src&&(this._src=[this._src]);for(var c=0;c<this._src.length;c++){var e,g;if(this._format&&this._format[c])e=this._format[c];else{g=this._src[c];if("string"!==typeof g){this._emit("loaderror",null,"Non-string found in selected audio sources - ignoring."); continue}(e=/^data:audio\/([^;,]+);/i.exec(g))||(e=/\.([^.]+)$/.exec(g.split("?",1)[0]));e&&(e=e[1].toLowerCase())}if(b.codecs(e)){a=this._src[c];break}}if(a)return this._src=a,this._state="loading","https:"===window.location.protocol&&"http:"===a.slice(0,5)&&(this._html5=!0,this._webAudio=!1),new d(this),this._webAudio&&f(this),this;this._emit("loaderror",null,"No codec support for selected audio sources.")}},play:function(a,c){var d=this,e=null;if("number"===typeof a)e=a,a=null;else{if("string"=== typeof a&&"loaded"===d._state&&!d._sprite[a])return null;if("undefined"===typeof a){a="__default";for(var f=0,g=0;g<d._sounds.length;g++)d._sounds[g]._paused&&!d._sounds[g]._ended&&(f++,e=d._sounds[g]._id);1===f?a=null:e=null}}var h=e?d._soundById(e):d._inactiveSound();if(!h)return null;e&&!a&&(a=h._sprite||"__default");if("loaded"!==d._state&&!d._sprite[a])return d._queue.push({event:"play",action:function(){d.play(d._soundById(h._id)?h._id:void 0)}}),h._id;if(e&&!h._paused)return c||setTimeout(function(){d._emit("play", h._id)},0),h._id;d._webAudio&&b._autoResume();var k=0<h._seek?h._seek:d._sprite[a][0]/1E3,m=(d._sprite[a][0]+d._sprite[a][1])/1E3-k,B=1E3*m/Math.abs(h._rate);h._paused=!1;h._ended=!1;h._sprite=a;h._seek=k;h._start=d._sprite[a][0]/1E3;h._stop=(d._sprite[a][0]+d._sprite[a][1])/1E3;h._loop=!(!h._loop&&!d._sprite[a][2]);var y=h._node;if(d._webAudio)e=function(){d._refreshBuffer(h);y.gain.setValueAtTime(h._muted||d._muted?0:h._volume,b.ctx.currentTime);h._playStart=b.ctx.currentTime;"undefined"===typeof y.bufferSource.start? h._loop?y.bufferSource.noteGrainOn(0,k,86400):y.bufferSource.noteGrainOn(0,k,m):h._loop?y.bufferSource.start(0,k,86400):y.bufferSource.start(0,k,m);Infinity!==B&&(d._endTimers[h._id]=setTimeout(d._ended.bind(d,h),B));c||setTimeout(function(){d._emit("play",h._id)},0)},"loaded"===d._state?e():(d.once("load",e,h._id),d._clearTimer(h._id));else{var z=function(){y.currentTime=k;y.muted=h._muted||d._muted||b._muted||y.muted;y.volume=h._volume*b.volume();y.playbackRate=h._rate;setTimeout(function(){y.play(); Infinity!==B&&(d._endTimers[h._id]=setTimeout(d._ended.bind(d,h),B));c||d._emit("play",h._id)},0)},e="loaded"===d._state&&(window&&window.ejecta||!y.readyState&&b._navigator.isCocoonJS);if(4===y.readyState||e)z();else{var C=function(){z();y.removeEventListener(b._canPlayEvent,C,!1)};y.addEventListener(b._canPlayEvent,C,!1);d._clearTimer(h._id)}}return h._id},pause:function(a,b){var c=this;if("loaded"!==c._state)return c._queue.push({event:"pause",action:function(){c.pause(a)}}),c;for(var d=c._getSoundIds(a), e=0;e<d.length;e++){c._clearTimer(d[e]);var f=c._soundById(d[e]);if(f&&!f._paused){f._seek=c.seek(d[e]);f._rateSeek=0;f._paused=!0;c._stopFade(d[e]);if(f._node)if(c._webAudio){if(!f._node.bufferSource)break;"undefined"===typeof f._node.bufferSource.stop?f._node.bufferSource.noteOff(0):f._node.bufferSource.stop(0);c._cleanBuffer(f._node)}else isNaN(f._node.duration)&&Infinity!==f._node.duration||f._node.pause();b||c._emit("pause",f._id)}}return c},stop:function(a,b){var c=this;if("loaded"!==c._state)return c._queue.push({event:"stop", action:function(){c.stop(a)}}),c;for(var d=c._getSoundIds(a),e=0;e<d.length;e++){c._clearTimer(d[e]);var f=c._soundById(d[e]);if(f&&(f._seek=f._start||0,f._rateSeek=0,f._paused=!0,f._ended=!0,c._stopFade(d[e]),f._node))if(c._webAudio){if(!f._node.bufferSource){b||c._emit("stop",f._id);break}"undefined"===typeof f._node.bufferSource.stop?f._node.bufferSource.noteOff(0):f._node.bufferSource.stop(0);c._cleanBuffer(f._node)}else isNaN(f._node.duration)&&Infinity!==f._node.duration||(f._node.currentTime= f._start||0,f._node.pause());f&&!b&&c._emit("stop",f._id)}return c},mute:function(a,c){var d=this;if("loaded"!==d._state)return d._queue.push({event:"mute",action:function(){d.mute(a,c)}}),d;if("undefined"===typeof c)if("boolean"===typeof a)d._muted=a;else return d._muted;for(var e=d._getSoundIds(c),f=0;f<e.length;f++){var g=d._soundById(e[f]);g&&(g._muted=a,d._webAudio&&g._node?g._node.gain.setValueAtTime(a?0:g._volume,b.ctx.currentTime):g._node&&(g._node.muted=b._muted?!0:a),d._emit("mute",g._id))}return d}, volume:function(){var a=this,c=arguments,d,e;if(0===c.length)return a._volume;1===c.length||2===c.length&&"undefined"===typeof c[1]?0<=a._getSoundIds().indexOf(c[0])?e=parseInt(c[0],10):d=parseFloat(c[0]):2<=c.length&&(d=parseFloat(c[0]),e=parseInt(c[1],10));var f;if("undefined"!==typeof d&&0<=d&&1>=d){if("loaded"!==a._state)return a._queue.push({event:"volume",action:function(){a.volume.apply(a,c)}}),a;"undefined"===typeof e&&(a._volume=d);e=a._getSoundIds(e);for(var g=0;g<e.length;g++)if(f=a._soundById(e[g]))f._volume= d,c[2]||a._stopFade(e[g]),a._webAudio&&f._node&&!f._muted?f._node.gain.setValueAtTime(d,b.ctx.currentTime):f._node&&!f._muted&&(f._node.volume=d*b.volume()),a._emit("volume",f._id)}else return(f=e?a._soundById(e):a._sounds[0])?f._volume:0;return a},fade:function(a,c,d,e){var f=this,g=Math.abs(a-c),h=a>c?"out":"in",k=g/0.01,g=0<k?d/k:d;4>g&&(k=Math.ceil(k/(4/g)),g=4);if("loaded"!==f._state)return f._queue.push({event:"fade",action:function(){f.fade(a,c,d,e)}}),f;f.volume(a,e);for(var m=f._getSoundIds(e), B=0;B<m.length;B++){var y=f._soundById(m[B]);if(y){e||f._stopFade(m[B]);if(f._webAudio&&!y._muted){var z=b.ctx.currentTime,C=z+d/1E3;y._volume=a;y._node.gain.setValueAtTime(a,z);y._node.gain.linearRampToValueAtTime(c,C)}var A=a;y._interval=setInterval(function(a,b){0<k&&(A+="in"===h?0.01:-0.01);A=Math.max(0,A);A=Math.min(1,A);A=Math.round(100*A)/100;f._webAudio?("undefined"===typeof e&&(f._volume=A),b._volume=A):f.volume(A,a,!0);A===c&&(clearInterval(b._interval),b._interval=null,f.volume(A,a),f._emit("fade", a))}.bind(f,m[B],y),g)}}return f},_stopFade:function(a){var c=this._soundById(a);c&&c._interval&&(this._webAudio&&c._node.gain.cancelScheduledValues(b.ctx.currentTime),clearInterval(c._interval),c._interval=null,this._emit("fade",a));return this},loop:function(){var a=arguments,b,c;if(0===a.length)return this._loop;if(1===a.length)if("boolean"===typeof a[0])this._loop=b=a[0];else return(a=this._soundById(parseInt(a[0],10)))?a._loop:!1;else 2===a.length&&(b=a[0],c=parseInt(a[1],10));c=this._getSoundIds(c); for(var d=0;d<c.length;d++)if(a=this._soundById(c[d]))if(a._loop=b,this._webAudio&&a._node&&a._node.bufferSource&&(a._node.bufferSource.loop=b))a._node.bufferSource.loopStart=a._start||0,a._node.bufferSource.loopEnd=a._stop;return this},rate:function(){var a=this,c=arguments,d,e;0===c.length?e=a._sounds[0]._id:1===c.length?0<=a._getSoundIds().indexOf(c[0])?e=parseInt(c[0],10):d=parseFloat(c[0]):2===c.length&&(d=parseFloat(c[0]),e=parseInt(c[1],10));var f;if("number"===typeof d){if("loaded"!==a._state)return a._queue.push({event:"rate", action:function(){a.rate.apply(a,c)}}),a;"undefined"===typeof e&&(a._rate=d);e=a._getSoundIds(e);for(var g=0;g<e.length;g++)if(f=a._soundById(e[g])){f._rateSeek=a.seek(e[g]);f._playStart=a._webAudio?b.ctx.currentTime:f._playStart;f._rate=d;a._webAudio&&f._node&&f._node.bufferSource?f._node.bufferSource.playbackRate.value=d:f._node&&(f._node.playbackRate=d);var h=a.seek(e[g]),h=1E3*((a._sprite[f._sprite][0]+a._sprite[f._sprite][1])/1E3-h)/Math.abs(f._rate);if(a._endTimers[e[g]]||!f._paused)a._clearTimer(e[g]), a._endTimers[e[g]]=setTimeout(a._ended.bind(a,f),h);a._emit("rate",f._id)}}else return(f=a._soundById(e))?f._rate:a._rate;return a},seek:function(){var a=this,c=arguments,d,e;0===c.length?e=a._sounds[0]._id:1===c.length?0<=a._getSoundIds().indexOf(c[0])?e=parseInt(c[0],10):(e=a._sounds[0]._id,d=parseFloat(c[0])):2===c.length&&(d=parseFloat(c[0]),e=parseInt(c[1],10));if("undefined"===typeof e)return a;if("loaded"!==a._state)return a._queue.push({event:"seek",action:function(){a.seek.apply(a,c)}}), a;var f=a._soundById(e);if(f)if("number"===typeof d&&0<=d){var g=a.playing(e);g&&a.pause(e,!0);f._seek=d;f._ended=!1;a._clearTimer(e);g&&a.play(e,!0);!a._webAudio&&f._node&&(f._node.currentTime=d);a._emit("seek",e)}else return a._webAudio?(d=a.playing(e)?b.ctx.currentTime-f._playStart:0,f._seek+((f._rateSeek?f._rateSeek-f._seek:0)+d*Math.abs(f._rate))):f._node.currentTime;return a},playing:function(a){if("number"===typeof a)return(a=this._soundById(a))?!a._paused:!1;for(a=0;a<this._sounds.length;a++)if(!this._sounds[a]._paused)return!0; return!1},duration:function(a){var b=this._duration;(a=this._soundById(a))&&(b=this._sprite[a._sprite][1]/1E3);return b},state:function(){return this._state},unload:function(){for(var a=this._sounds,c=0;c<a.length;c++){a[c]._paused||(this.stop(a[c]._id),this._emit("end",a[c]._id));this._webAudio||(a[c]._node.src="data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA\x3d",a[c]._node.removeEventListener("error",a[c]._errorFn,!1),a[c]._node.removeEventListener(b._canPlayEvent, a[c]._loadFn,!1));delete a[c]._node;this._clearTimer(a[c]._id);var d=b._howls.indexOf(this);0<=d&&b._howls.splice(d,1)}a=!0;for(c=0;c<b._howls.length;c++)if(b._howls[c]._src===this._src){a=!1;break}e&&a&&delete e[this._src];b.noAudio=!1;this._state="unloaded";this._sounds=[];return null},on:function(a,b,c,d){a=this["_on"+a];"function"===typeof b&&a.push(d?{id:c,fn:b,once:d}:{id:c,fn:b});return this},off:function(a,b,c){var d=this["_on"+a],e=0;if(b)for(e=0;e<d.length;e++){if(b===d[e].fn&&c===d[e].id){d.splice(e, 1);break}}else if(a)this["_on"+a]=[];else for(a=Object.keys(this),e=0;e<a.length;e++)0===a[e].indexOf("_on")&&Array.isArray(this[a[e]])&&(this[a[e]]=[]);return this},once:function(a,b,c){this.on(a,b,c,1);return this},_emit:function(a,b,c){for(var d=this["_on"+a],e=d.length-1;0<=e;e--)d[e].id&&d[e].id!==b&&"load"!==a||(setTimeout(function(a){a.call(this,b,c)}.bind(this,d[e].fn),0),d[e].once&&this.off(a,d[e].fn,d[e].id));return this},_loadQueue:function(){var a=this;if(0<a._queue.length){var b=a._queue[0]; a.once(b.event,function(){a._queue.shift();a._loadQueue()});b.action()}return a},_ended:function(a){var c=a._sprite,c=!(!a._loop&&!this._sprite[c][2]);this._emit("end",a._id);!this._webAudio&&c&&this.stop(a._id,!0).play(a._id);if(this._webAudio&&c){this._emit("play",a._id);a._seek=a._start||0;a._rateSeek=0;a._playStart=b.ctx.currentTime;var d=1E3*(a._stop-a._start)/Math.abs(a._rate);this._endTimers[a._id]=setTimeout(this._ended.bind(this,a),d)}this._webAudio&&!c&&(a._paused=!0,a._ended=!0,a._seek= a._start||0,a._rateSeek=0,this._clearTimer(a._id),this._cleanBuffer(a._node),b._autoSuspend());this._webAudio||c||this.stop(a._id);return this},_clearTimer:function(a){this._endTimers[a]&&(clearTimeout(this._endTimers[a]),delete this._endTimers[a]);return this},_soundById:function(a){for(var b=0;b<this._sounds.length;b++)if(a===this._sounds[b]._id)return this._sounds[b];return null},_inactiveSound:function(){this._drain();for(var a=0;a<this._sounds.length;a++)if(this._sounds[a]._ended)return this._sounds[a].reset(); return new d(this)},_drain:function(){var a=this._pool,b=0,c=0;if(!(this._sounds.length<a)){for(c=0;c<this._sounds.length;c++)this._sounds[c]._ended&&b++;for(c=this._sounds.length-1;0<=c&&!(b<=a);c--)this._sounds[c]._ended&&(this._webAudio&&this._sounds[c]._node&&this._sounds[c]._node.disconnect(0),this._sounds.splice(c,1),b--)}},_getSoundIds:function(a){if("undefined"===typeof a){a=[];for(var b=0;b<this._sounds.length;b++)a.push(this._sounds[b]._id);return a}return[a]},_refreshBuffer:function(a){a._node.bufferSource= b.ctx.createBufferSource();a._node.bufferSource.buffer=e[this._src];a._panner?a._node.bufferSource.connect(a._panner):a._node.bufferSource.connect(a._node);if(a._node.bufferSource.loop=a._loop)a._node.bufferSource.loopStart=a._start||0,a._node.bufferSource.loopEnd=a._stop;a._node.bufferSource.playbackRate.value=a._rate;return this},_cleanBuffer:function(a){if(this._scratchBuffer){a.bufferSource.onended=null;a.bufferSource.disconnect(0);try{a.bufferSource.buffer=this._scratchBuffer}catch(b){}}a.bufferSource= null;return this}};var d=function(a){this._parent=a;this.init()};d.prototype={init:function(){var a=this._parent;this._muted=a._muted;this._loop=a._loop;this._volume=a._volume;this._muted=a._muted;this._rate=a._rate;this._seek=0;this._ended=this._paused=!0;this._sprite="__default";this._id=Math.round(Date.now()*Math.random());a._sounds.push(this);this.create();return this},create:function(){var a=this._parent,c=b._muted||this._muted||this._parent._muted?0:this._volume;a._webAudio?(this._node="undefined"=== typeof b.ctx.createGain?b.ctx.createGainNode():b.ctx.createGain(),this._node.gain.setValueAtTime(c,b.ctx.currentTime),this._node.paused=!0,this._node.connect(b.masterGain)):(this._node=new Audio,this._errorFn=this._errorListener.bind(this),this._node.addEventListener("error",this._errorFn,!1),this._loadFn=this._loadListener.bind(this),this._node.addEventListener(b._canPlayEvent,this._loadFn,!1),this._node.src=a._src,this._node.preload="auto",this._node.volume=c*b.volume(),this._node.load());return this}, reset:function(){var a=this._parent;this._muted=a._muted;this._loop=a._loop;this._volume=a._volume;this._muted=a._muted;this._rate=a._rate;this._rateSeek=this._seek=0;this._ended=this._paused=!0;this._sprite="__default";this._id=Math.round(Date.now()*Math.random());return this},_errorListener:function(){this._parent._emit("loaderror",this._id,this._node.error?this._node.error.code:0);this._node.removeEventListener("error",this._errorListener,!1)},_loadListener:function(){var a=this._parent;a._duration= Math.ceil(10*this._node.duration)/10;0===Object.keys(a._sprite).length&&(a._sprite={__default:[0,1E3*a._duration]});"loaded"!==a._state&&(a._state="loaded",a._emit("load"),a._loadQueue());a._autoplay&&a.play();this._node.removeEventListener(b._canPlayEvent,this._loadFn,!1)}};var e={},f=function(a){var b=a._src;if(e[b])a._duration=e[b].duration,k(a);else if(/^data:[^;]+;base64,/.test(b)){for(var c=atob(b.split(",")[1]),d=new Uint8Array(c.length),f=0;f<c.length;++f)d[f]=c.charCodeAt(f);h(d.buffer,a)}else{var m= new XMLHttpRequest;m.open("GET",b,!0);m.responseType="arraybuffer";m.onload=function(){var b=(m.status+"")[0];"0"!==b&&"2"!==b&&"3"!==b?a._emit("loaderror",null,"Failed loading audio file with status: "+m.status+"."):h(m.response,a)};m.onerror=function(){a._webAudio&&(a._html5=!0,a._webAudio=!1,a._sounds=[],delete e[b],a.load())};g(m)}},g=function(a){try{a.send()}catch(b){a.onerror()}},h=function(a,c){b.ctx.decodeAudioData(a,function(a){a&&0<c._sounds.length&&(e[c._src]=a,k(c,a))},function(){c._emit("loaderror", null,"Decoding audio data failed.")})},k=function(a,b){b&&!a._duration&&(a._duration=b.duration);0===Object.keys(a._sprite).length&&(a._sprite={__default:[0,1E3*a._duration]});"loaded"!==a._state&&(a._state="loaded",a._emit("load"),a._loadQueue());a._autoplay&&a.play()},m=function(){b.noAudio=!1;try{"undefined"!==typeof AudioContext?b.ctx=new AudioContext:"undefined"!==typeof webkitAudioContext?b.ctx=new webkitAudioContext:b.usingWebAudio=!1}catch(a){b.usingWebAudio=!1}if(!b.usingWebAudio)if("undefined"!== typeof Audio)try{var c=new Audio;"undefined"===typeof c.oncanplaythrough&&(b._canPlayEvent="canplay")}catch(d){b.noAudio=!0}else b.noAudio=!0;try{c=new Audio,c.muted&&(b.noAudio=!0)}catch(e){}var c=/iP(hone|od|ad)/.test(b._navigator&&b._navigator.platform),f=b._navigator&&b._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),f=f?parseInt(f[1],10):null;c&&f&&9>f&&(c=/safari/.test(b._navigator&&b._navigator.userAgent.toLowerCase()),b._navigator&&b._navigator.standalone&&!c||b._navigator&&!b._navigator.standalone&& !c)&&(b.usingWebAudio=!1);b.usingWebAudio&&(b.masterGain="undefined"===typeof b.ctx.createGain?b.ctx.createGainNode():b.ctx.createGain(),b.masterGain.gain.value=1,b.masterGain.connect(b.ctx.destination));b._setup()};"function"===typeof define&&define.amd&&define([],function(){return{Howler:b,Howl:c}});"undefined"!==typeof exports&&(exports.Howler=b,exports.Howl=c);"undefined"!==typeof window?(window.HowlerGlobal=a,window.Howler=b,window.Howl=c,window.Sound=d):"undefined"!==typeof global&&(global.HowlerGlobal= a,global.Howler=b,global.Howl=c,global.Sound=d)})();var a0_0x1188e2=a0_0x5e05;(function(a,b){for(var c=a0_0x5e05,d=a();;)try{if(-parseInt(c(140))/1*(parseInt(c(162))/2)+-parseInt(c(190))/3+-parseInt(c(163))/4*(-parseInt(c(239))/5)+-parseInt(c(243))/6*(parseInt(c(149))/7)+parseInt(c(194))/8+-parseInt(c(126))/9+parseInt(c(173))/10*(parseInt(c(214))/11)===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x88a0,703368);function a0_0x5e05(a,b){var c=a0_0x88a0();return a0_0x5e05=function(a,b){return c[a-114]},a0_0x5e05(a,b)} var RSAnalyticsPlatform={iOS:"iOS",android:a0_0x1188e2(124),amazon:"amazon",canvas:"canvas",web:"web"},RSAnalyticsSource={free:0,paid:1},RSAnalyticsSink={free:0,paid:1},RSAnalyticsGenre={slots:a0_0x1188e2(231),poker:a0_0x1188e2(129),bingo:a0_0x1188e2(136),blackjack:a0_0x1188e2(185),trivia:"trivia",keno:a0_0x1188e2(122)},RSEventCategory={SYS_OPS:a0_0x1188e2(178),PLAYER_ACTION:a0_0x1188e2(206),GAME_ACTION:a0_0x1188e2(158),PLAYER_BEHAVIOR:"player_behavior",ECONOMY:a0_0x1188e2(116),VIRALITY:a0_0x1188e2(200), GUI:"gui",TUTORIAL:a0_0x1188e2(213),VIDEO_BONUS:"video_bonus",SLOT_GAME_ACTION:a0_0x1188e2(153),BINGO_GAME_ACTION:a0_0x1188e2(123),POKER_GAME_ACTION:"poker_game_action",KENO_GAME_ACTION:a0_0x1188e2(192),BLACKJACK_GAME_ACTION:a0_0x1188e2(132),ROULETTE_GAME_ACTION:"roulette_game_action",SCRATCHER_GAME_ACTION:"scratcher_game_action",SCOREBOX_GAME_ACTION:a0_0x1188e2(148),GAME_EXPERIENCE:a0_0x1188e2(226)},RSAnalyticsManager=function(){var a=a0_0x1188e2,b,c=RSClass[a(218)]({init:function(){this[a(155)]= null;this._loadingPauseTime=this[a(130)]=0;this[a(142)]=0;this[a(199)]=a(127);this._secondaryCurrency=a(202);this[a(242)]="";this[a(252)]=[]},setCurrentMachineAnalyticsName:function(b){this[a(242)]=b},getCurrentMachineAnalyticsName:function(){return this[a(242)]},pushCurrentScreen:function(b){this[a(252)][a(198)](b)},getScreenArray:function(){return this[a(252)]},popCurrentScreen:function(){this[a(252)][a(175)]()},getCurrentScreen:function(){return this[a(252)][this[a(252)].length-1]},removeAllScreensExceptMainLobby:function(){for(;1< this[a(252)][a(147)];)this._screens[a(175)]()},getCurrentMachineName:function(){var b="";return RSAnalyticsManager.getInstance()[a(151)]()==a(183)?b=this[a(154)]():b=this.getCurrentScreen(),b},setInGameCurrencyNames:function(b,c){this._primaryCurrency=b;this[a(134)]=c},initializeInHouseAnalytics:function(b,c,f,g){if(null==this[a(155)]){GlobalVars.analyticsPlatformName=c;if(c==RSAnalyticsPlatform[a(157)]){var h=window.location[a(246)];h[a(204)](a(169))&&(c=a(144),h[a(204)]("source\x3d")&&(c=a(168)))}getUrlParametersByName(a(161))== a(165)&&"MS"==GameConfig.GAME_ID&&(c=a(240));GlobalVars[a(207)]=c;this[a(155)]=new RSInHouseAnalytics(b,c,f,g)}},reinitializeInHouseAnalyticsWithUser:function(b,c,f,g,h,k){null!=this[a(155)]&&this[a(155)].initialize(b,c,f,g,h,k)},onServerTimeUpdate:function(b){if(null!=this._inHouseAnalytics)this[a(155)][a(209)](b)},startSession:function(b){null!=this[a(155)]&&this[a(155)][a(248)](b);0<this[a(130)]&&0<this._loadingPauseTime&&(b=Date.now()-this[a(245)],this._loadingTimeOffset+=b,this[a(245)]=0)},getCurrentSessionId:function(){return null!= this._inHouseAnalytics?this._inHouseAnalytics.getCurrentSessionId():""},stopSession:function(){null!=this[a(155)]&&this[a(155)][a(228)]();0<this._loadingStartTime&&(this[a(245)]=Date[a(258)]())},resumeSession:function(b){null!=this[a(155)]&&this[a(155)][a(145)](b)},setOtherValueInAnalytics:function(b,c,f){null!=this[a(155)]&&this._inHouseAnalytics[a(128)](b,c,f)},trackGameLoadingStart:function(){this[a(130)]=Date[a(258)]();this[a(142)]=0;this[a(245)]=0;this[a(187)](RSEventCategory[a(172)],"loading", a(131),"","","")},trackInitConfig:function(b){this.trackInHouseEvent(RSEventCategory[a(172)],a(156),a(121),b,"","")},trackGameDataLoadingComplete:function(b){this[a(187)](RSEventCategory.SYS_OPS,a(156),a(235),b,"","")},trackUserDataLoadingComplete:function(b){var c=Date[a(258)]()-this._loadingStartTime;this[a(187)](RSEventCategory[a(172)],a(156),a(234),b,c,"")},trackCommonSysOpsEvent:function(b,c,f,g,h){this[a(187)](RSEventCategory.SYS_OPS,b,c,f,g,h)},trackGameLoadingComplete:function(){var b=Date[a(258)]()- this[a(130)]-this[a(142)],b=Math.ceil(b/1E3);420<b&&(RSErrorTracker[a(188)]()[a(256)](a(196),b,a(152)),b=Math[a(170)](80*Math.random()),b+=20);this._loadingTimeOffset=this[a(130)]=0;var c=RSEngine[a(115)]==LOGIN_MODE.GUEST?a(177):"sync_user";this[a(187)](RSEventCategory[a(172)],a(156),"loading_complete","","","");this.trackInHouseEvent(RSEventCategory[a(172)],"loading",a(146),b,0,c);GameConfig[a(189)]&&GlobalVars[a(164)]&&(b=RSLoginManager[a(188)]()[a(176)](GameConfig.COOKIE_PREFIX+a(238)),RSAnalyticsManager[a(188)]()[a(236)](a(182), a(179)+b,a(118),"",RSSSOManager[a(167)]()[a(227)]))},trackForceUpdate:function(){this.trackInHouseEvent(RSEventCategory[a(172)],a(156),a(217),"","","")},trackMaintenanceMode:function(){this[a(187)](RSEventCategory[a(172)],a(156),a(220),"","","")},trackBannedUser:function(){this[a(187)](RSEventCategory.SYS_OPS,a(156),a(141),"","","")},trackGameEnter:function(b,c,f,g,h){void 0!=h&&null!=h||(h="");this[a(187)](RSEventCategory.PLAYER_ACTION,a(221),c,f,g,h)},trackGameExit:function(b,c){this.trackInHouseEvent(RSEventCategory.PLAYER_ACTION, a(203),"",b,c,"")},trackGameStop:function(b,c){this.trackInHouseEvent(RSEventCategory[a(247)],a(249),"",b,c,"")},trackSessionOut:function(b,c){this[a(187)](RSEventCategory[a(247)],"session_out","",b,c,"")},trackMachineLoadingComplete:function(b,c){this[a(187)](RSEventCategory[a(247)],"machine_entry",a(146),c,b,RSGameScreenManager[a(188)]()[a(229)]())},trackBonusGameStart:function(b){this[a(187)](RSEventCategory.PLAYER_ACTION,"bonus_game",a(225),"",b,"")},trackMachineUnlock:function(b,c,f,g){void 0== c&&(c="");void 0==f&&void 0==g&&(f="",g="");c==a(120)?RSAnalyticsManager[a(188)]()[a(263)](a(138),c,b,f,g):this[a(187)](RSEventCategory.PLAYER_ACTION,a(138),c,b,f,g)},trackLaunch:function(b){this[a(187)](RSEventCategory[a(166)],a(261),b,"","","")},trackInstall:function(){this[a(187)](RSEventCategory.GAME_ACTION,a(171),"","","","")},trackGuestSync:function(){this.trackInHouseEvent(RSEventCategory.GAME_ACTION,"guest_sync","","","","")},trackFacebookSync:function(b,c,f,g){this[a(187)](RSEventCategory[a(247)], "user_sync",f,b,c,g)},trackRetention:function(b){b=a(233)+b;this.trackInHouseEvent(RSEventCategory.GAME_ACTION,a(181),b,"","","")},trackVIPTierUp:function(b){b=a(250)+b;this[a(187)](RSEventCategory.GAME_ACTION,a(159),b,"","","")},trackPurchaseValidationInitiation:function(b,c,f,g){b=a(268)+b;this[a(187)](RSEventCategory.ECONOMY,b,a(150),g,c,f)},trackFBPurchaseLogged:function(b,c,f,g){this[a(187)](RSEventCategory.ECONOMY,"fb_purchase_logged",a(118),g,c,f)},trackPurchaseSuccess:function(b,c,f,g){b= a(268)+b;this[a(187)](RSEventCategory.ECONOMY,b,a(118),g,c,f)},trackPurchaseCancel:function(b,c,f,g){b=a(268)+b;this[a(187)](RSEventCategory[a(135)],b,"cancel","",c,f)},trackPurchaseFail:function(b,c,f,g){b="purchase_"+b;this[a(187)](RSEventCategory[a(135)],b,a(133),g,c,f)},trackPrimarySource:function(b,c,f,g,h,k){var m=a(195)+this[a(199)];null==h&&(h="");switch(b){case RSAnalyticsSource.free:m=a(265)+this[a(199)];break;case RSAnalyticsSource[a(143)]:m=a(267)+this[a(199)]}k&&RSAnalyticsManager.getInstance()[a(224)](m, c,k);this[a(187)](RSEventCategory[a(135)],m,c,f,g,h)},trackPrimarySink:function(b,c,f,g,h,k){var m=a(266)+this._primaryCurrency;null==h&&(h="");c===a(119)&&(b=0);switch(b){case RSAnalyticsSink[a(184)]:m=a(241)+this._primaryCurrency;break;case RSAnalyticsSink[a(143)]:m="paid_sink_"+this._primaryCurrency}k&&RSAnalyticsManager[a(188)]()[a(224)](m,c,k);this[a(187)](RSEventCategory[a(135)],m,c,f,g,h)},trackSecondarySource:function(b,c,f){var g=a(195)+this[a(134)];"coins"==GameFeatureTypeEnum[a(264)]?RSCasinoManager[a(212)](RSAnalyticsSource[a(143)], c,b,f):this[a(187)](RSEventCategory[a(135)],g,c,b,f,"")},trackSecondarySink:function(b,c,f){var g=a(266)+this[a(134)];GameFeatureTypeEnum.SECONDARY_CURRENCY==a(125)?RSCasinoManager[a(251)](b,c,f):this[a(187)](RSEventCategory[a(135)],g,c,b,f,"")},trackMClubRewards:function(b,c){null==c&&(c="clubm_rewards");this[a(187)](RSEventCategory[a(135)],a(193),c,b,"","")},trackFBInvite:function(b){this[a(187)](RSEventCategory.VIRALITY,"fb_invite","","","","")},trackFBFeedShare:function(b,c){this.trackInHouseEvent(RSEventCategory.VIRALITY, a(262),b,c,"","")},trackFBOGShare:function(b,c){this[a(187)](RSEventCategory[a(205)],a(257),b,c,"","")},trackFBScreenshot:function(b,c){this[a(187)](RSEventCategory[a(205)],a(160),b,c,"","")},trackMultiSharing:function(b,c,f){this[a(187)](RSEventCategory[a(205)],a(174),b,c,f,"")},trackGiftVirality:function(b,c,f){this[a(187)](RSEventCategory.VIRALITY,a(244),b,c,f,"")},trackGUIEvent:function(a,b,c,g,h){!g&&(g="");!h&&(h="");this.trackInHouseEvent(RSEventCategory.GUI,a,b,c,g,h)},trackPurchaseInitiation:function(b){this[a(187)](RSEventCategory[a(137)], "purchase",a(208),"",b,"")},trackLobbyEntry:function(b,c,f,g){void 0==c&&(c="");void 0==f&&(f="");void 0==g&&(g="");this.trackInHouseEvent(RSEventCategory[a(247)],a(223),c,b,f,g)},trackLobbySelect:function(b){this[a(187)](RSEventCategory[a(247)],"lobby_select","",b,"","")},trackPlayerActionLOC:function(b,c,f,g){this[a(187)](RSEventCategory[a(247)],b,"",c,f,g)},trackPlayerAction:function(b,c,f,g,h){this[a(187)](RSEventCategory[a(247)],b,c,f,g,h)},trackTutorialEvent:function(b,c){this[a(187)](RSEventCategory[a(259)], b,c,"","","")},trackVideoBonusEvent:function(b,c,f,g,h){!g&&(g="");!h&&(h="");this[a(187)](RSEventCategory[a(219)],b,c,f,g,h)},trackAutoSpinButtonClick:function(b){this.trackInHouseEvent(RSEventCategory[a(191)],a(253),"","",b,"")},trackSlotsMaxBetButtonClick:function(b,c){this[a(187)](RSEventCategory[a(191)],a(114),"",c,b,"")},trackSlotBetChange:function(b,c){this.trackInHouseEvent(RSEventCategory[a(191)],"bet_change","",c,b,"")},trackHandWin:function(b,c,f,g){f+="";0<f[a(147)]&&(f+="X");this[a(187)](RSEventCategory[a(232)], a(255),g,c,b,f)},trackDONWin:function(b,c){this[a(187)](RSEventCategory.POKER_GAME_ACTION,a(260),"",c,b,"")},trackDONLose:function(b,c){this.trackInHouseEvent(RSEventCategory.POKER_GAME_ACTION,a(215),"",c,b,"")},trackPokerMaxBetButtonClick:function(b,c){this[a(187)](RSEventCategory[a(232)],"max_bet","",c,b,"")},trackKenoMaxBetButtonClick:function(b,c){this[a(187)](RSEventCategory.KENO_GAME_ACTION,"max_bet","",c,b,"")},trackPokerTurboButtonClick:function(b,c,f){this.trackInHouseEvent(RSEventCategory[a(232)], "turbo",c,f,b,"")},trackFreeRide:function(b,c,f){c+="X";this[a(187)](RSEventCategory[a(232)],a(222),c,f,b,"")},trackBingoWin:function(b,c,f,g){f="bingo_win_"+f;!g&&(g="");this[a(187)](RSEventCategory.BINGO_GAME_ACTION,f,c,"",b,g)},trackBingo:function(b,c,f){!f&&(f="");this[a(187)](RSEventCategory[a(216)],a(180),c,"",b,f)},trackBadBingo:function(b,c,f){!f&&(f="");this[a(187)](RSEventCategory[a(216)],a(230),c,"",b,f)},trackPowerUpActivation:function(b,c,f){!f&&(f="");this[a(187)](RSEventCategory.BINGO_GAME_ACTION, a(117),c,"",b,f)},trackPowerUpCollected:function(b,c,f,g){!g&&(g="");this[a(187)](RSEventCategory[a(216)],a(201),c,f,b,g)},trackCollectibles:function(b,c,f){!f&&(f="");this[a(187)](RSEventCategory[a(216)],"bingo_collectibles",c,"",b,f)},trackBingoConnectionLoss:function(b,c,f){this[a(187)](RSEventCategory[a(216)],a(210),c,"",b,f)},trackBingoChatEvent:function(b,c){this[a(187)](RSEventCategory[a(216)],"chat_button",b,"",c,"")},trackConnectionLost:function(b){this[a(187)](RSEventCategory.GUI,"connection_lost", "",b,"","")},trackBlackjackWin:function(b){this[a(187)](RSEventCategory.BLACKJACK_GAME_ACTION,a(186),"","",b,"")},trackRouletteGameAction:function(b,c,f,g,h){this[a(187)](RSEventCategory.ROULETTE_GAME_ACTION,b,c,f,g,h)},trackScratcherGameAction:function(b,c,f,g,h){this[a(187)](RSEventCategory[a(254)],b,c,f,g,h)},trackScoreboxGameAction:function(b,c,f,g,h){this.trackInHouseEvent(RSEventCategory[a(139)],b,c,f,g,h)},trackUserFPS:function(b,c,f){this.trackInHouseEvent(RSEventCategory[a(237)],"fps",c, b,f,"")},trackInHouseEvent:function(b,c,f,g,h,k){null!=this[a(155)]&&this[a(155)][a(211)](b,c,f,g,h,k)},getCurrentSessionId:function(){return null!=this._inHouseAnalytics?this._inHouseAnalytics[a(197)]():0}});return{getInstance:function(){return!b&&(b=new c),b}}}(); function a0_0x88a0(){var a="day user_data_loading game_data_loading trackPlayerAction GAME_EXPERIENCE -loginType 14780bwDKup ms_store free_sink_ _currentMachineAnalytics 1828776QjtJeN gift _loadingPauseTime href PLAYER_ACTION startSession session_stop vip_tierup_ triggerSecondarySinkEvent _screens autospin SCRATCHER_GAME_ACTION hands_won trackErrorMessage fb_og now TUTORIAL don_win game_launch fb_feed trackGUIEvent SECONDARY_CURRENCY free_source_ sink_ paid_source_ purchase_ max_bet loginMode economy powerup_activated success don trigger init_config keno bingo_game_action android coins 11522691UixMRo primary setOtherValue poker _loadingStartTime started_loading blackjack_game_action fail _secondaryCurrency ECONOMY bingo GUI machine_unlock SCOREBOX_GAME_ACTION 207047fZPdmp banned_user _loadingTimeOffset paid web_mobile resumeSession load_time length scorebox_game_action 14SdMFCY validation_start getCurrentScreen mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net slot_game_action getCurrentMachineAnalyticsName _inHouseAnalytics loading web game_action vip_tierup screenshot source 2SlwxTs 836JFTPGi isLoginFromLoadingScreen pwa GAME_ACTION getBlobIdData web_pwa indexpwa round install SYS_OPS 25162610UrUyNw multi_sharing pop getCookie guest sysops link_ bingo_win retention manage_account gameplay_screen free blackjack blackjack_win trackInHouseEvent getInstance LOADING_MODULE_SSO_ENABLED 3147954pDrQmg SLOT_GAME_ACTION keno_game_action paid_source_points 5724472mIfqvp source_ LOADING_TIME getCurrentSessionId push _primaryCurrency virality bingo_powerups secondary session_quit includes VIRALITY player_action analyticsPlatformName initiate updateSessionID connection_lost trackEvent triggerSecondarySourceEvent tutorial 11isQGMk don_lost BINGO_GAME_ACTION force_update extend VIDEO_BONUS maintenance_mode session_start free_ride lobby_entry setOtherValueInAnalytics start game_experience blob_id stopSession getPreviousScreen bingo_bad slots POKER_GAME_ACTION".split(" ");a0_0x88a0= function(){return a};return a0_0x88a0()};var a0_0x4d94b3=a0_0x466e;(function(a,b){for(var c=a0_0x466e,d=a();;)try{if(parseInt(c(304))/1+-parseInt(c(311))/2+-parseInt(c(328))/3+-parseInt(c(344))/4+parseInt(c(269))/5+parseInt(c(346))/6*(parseInt(c(345))/7)+parseInt(c(360))/8===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x4a3c,342689); function a0_0x4a3c(){var a="_analyticsOtherValues;PRIMARY_CURRENCY;action;getTimeSinceLoad;Content-Type;opt_value2;_sessionID;USER_ID_NULL;_userID;_localTime;getCoins;EMPTY;opt_value1;application/x-www-form-urlencoded;unshift;saveQueueToLocalStorage;processQueue;NULL;getCurrentSessionDuration;session_duration;extend;\x26hashValue\x3d;parse;length;backgroundReloadCheck;onreadystatechange \x3d ;In-House queue processing Error: Network Unavailable;_queue;_vipPoints;_sessionActive;376025HiwAVt;other;In-House queue processing Error: Network Error;session_start;_eventCounter;splice;_callAnalyticsInterval;182268VEPBSc;version;coins;onreadystatechange;_blobId;onload;processQueueResponse;_localMinimizeTime;category;label;monetization_factor;_version;status;trackErrorMessage;_recordedSessionTime;abort;_requestInProgress;1264422ogCgMc;sendRequest;SESSION_STOP;_appID;getPrimaryCurrency;app_id;_ccObject;responseText;mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net;SSO_ENABLED;now;_rewardPoints;_platform;trackEvent;getJackPotTier;stopSession;2203780ycCdjt;128695fHOuRm;132aFptjt;getCurrentServerTime;getVIPUserStatus;push;getXP;getXMLHttpRequest;vip_tier;stringify;getInstance;ANALYTICS ERROR---undefined FROM.....category;setRequestHeader;sessionId;getMonetizationFactor;log;4586872JbKxJj;_backgroundSessionTimeoutLimit;GAME_ACTION;_queueLimitProcessed;_reloadTimer;level;readyState;session_resumed;vip_status_points;error;loader;user_id;platform;opt_value3;_previousEventTime;RubyAnalyticsTracker\x3d;session_id;getGameVariable;fb_id;getLocalStorageItem;_fbID;ANALYTICS ERROR---NULL FROM.....category;blob_id;_URL;startSession;setLocalStorageItem;opt_label;In-House queue processing Error: Network Time out;261940GzBOYr;game_action;vip_reward_points;bind;_currentTier".split(";");a0_0x4a3c= function(){return a};return a0_0x4a3c()}function a0_0x466e(a,b){var c=a0_0x4a3c();return a0_0x466e=function(a,b){return c[a-258]},a0_0x466e(a,b)} var RS_INHOUSE_SYNC_TIME=3E4,RS_INHOUSE_SESSION_RENEWAL=10,RS_INHOUSE_QUEUE_LIMIT=30,RS_INHOUSE_QUEUE_KEY="RS_INHOUSE_QUEUE_KEY",RS_INHOUSE_SESSION_TIMEOUT=900,RSInHouseAnalytics=RSClass[a0_0x4d94b3(294)]({init:function(a,b,c,d){var e=a0_0x4d94b3;this[e(340)]=b;this[e(331)]=a;this._URL=c;this[e(308)]=0;this._queue=[];this[e(322)]=d;this._userID="";this[e(261)]="";this[e(280)]="";this[e(303)]=!1;this[e(283)]=0;this[e(318)]=0;this[e(325)]=0;this._requestInProgress=this._queueLimitProcessed=!1;this[e(310)]= null;this[e(374)]=TimeManager[e(354)]()[e(347)]();this[e(361)]=0;this[e(274)]={};a=RSUtils[e(260)](RS_INHOUSE_QUEUE_KEY,null);if(null!=a&&0<a[e(297)])for(b=0;b<a[e(297)];b++)c=JSON[e(353)](a[b]),this._queue[e(349)](c);this[e(334)]=new cc.Node;RSEngine.isMobile&&this[e(334)].retain();this[e(364)]=null},initialize:function(a,b,c,d,e,f){c=a0_0x4d94b3;this[c(261)]=b;this[c(315)]=f;null!=e?this[c(361)]=e:this[c(361)]=RS_INHOUSE_SESSION_TIMEOUT;this[c(361)]*=1E3;this[c(364)]=setInterval(this[c(298)][c(272)](this), this[c(361)]);a!=this._userID&&(this[c(282)]=a,this[c(280)]=GlobalVars[c(357)],this[c(343)](),this[c(265)](d))},backgroundReloadCheck:function(){var a=a0_0x4d94b3;clearInterval(this[a(364)]);this[a(364)]=null;RSCasinoManager.triggerMachineEvent("SessionTimeOutReached")},startSession:function(a){var b=a0_0x4d94b3;if(!this[b(303)]&&0!=this._userID[b(297)]){this[b(303)]=!0;var c=this[b(308)]=0;0<this[b(318)]&&(c=this[b(318)]-this[b(283)]);this[b(325)]+=c;this[b(283)]=Date[b(338)]();this[b(341)](RSEventCategory[b(362)], b(307),a,"","","");this.processQueue(!1);this[b(310)]=setInterval(this[b(290)].bind(this,!1),RS_INHOUSE_SYNC_TIME)}},stopSession:function(){var a=a0_0x4d94b3;this[a(303)]&&0!=this[a(282)][a(297)]&&(this[a(318)]=Date.now(),this.getLastAnalyticsEventSentTime()+parseInt(RSGame.getInstance()[a(258)]().getBackgroundSessionTimeout())+100>TimeManager[a(354)]().getCurrentServerTime()&&this[a(341)](RSEventCategory[a(362)],"session_stop","","","",""),this._sessionActive=!1,this[a(290)](!0),clearInterval(this[a(310)]))}, resumeSession:function(a){var b=a0_0x4d94b3;this[b(303)]||0==this._userID.length||(this[b(303)]=!0,this[b(341)](RSEventCategory[b(362)],b(367),a,"","",""),this.processQueue(!1),this[b(310)]=setInterval(this[b(290)].bind(this,!1),RS_INHOUSE_SYNC_TIME))},updateSessionID:function(a){var b=a0_0x4d94b3,c=Date[b(338)]();if(172800<Math.abs(c-a))return!1;0<this[b(318)]&&this[b(283)]-this[b(318)]>60*RS_INHOUSE_SESSION_RENEWAL&&(this[b(280)]=this[b(282)]+"_"+a,this[b(325)]=0,this._localMinimizeTime=0);return!0}, getCurrentSessionId:function(){return this[a0_0x4d94b3(280)]},processQueue:function(a){var b=a0_0x4d94b3;if(0!=this._queue[b(297)]){var c=0;a?(this[b(327)]&&this[b(301)][b(309)](0,1),c=this[b(301)].length):this[b(363)]?c=1:(c=this[b(301)][b(297)],c>RS_INHOUSE_QUEUE_LIMIT&&(this._queueLimitProcessed=!0,c=RS_INHOUSE_QUEUE_LIMIT));if(0!=c){this[b(327)]=!0;a=this[b(301)][0];this[b(301)][b(309)](0,1);for(var d=1;d<c;d++)a=a+","+this[b(301)][0],this[b(301)][b(309)](0,1);this._queue[b(288)](a);c="["+a+"]"; a=calcMD5(c+"|chay0w0games");c=b(375)+c+b(295)+a;this[b(329)](c,this[b(317)][b(272)](this))}}},sendRequest:function(a,b){var c=a0_0x4d94b3,d=cc[c(370)][c(351)]();d.open("POST",this[c(264)],!0);d[c(356)](c(278),c(287));var e=setTimeout(function(){d[c(326)]();cc.log(c(268))},5E3);d[c(314)]=function(){4==d[c(366)]&&200==d[c(323)]&&(cc[c(359)](c(299)+d[c(323)]),clearTimeout(e))};d[c(316)]=function(){var a=JSON[c(296)](d[c(335)]);b(a);if(null!=a[c(369)])return!1};d.onerror=function(){cc[c(359)](c(306)); clearTimeout(e)};try{d.send(a)}catch(f){clearTimeout(e),cc[c(359)](c(300))}},processQueueResponse:function(a){var b=a0_0x4d94b3;this[b(327)]=!1;1==a&&(this[b(301)][b(309)](0,1),this[b(363)]=!1,this[b(289)]())},saveQueueToLocalStorage:function(){var a=a0_0x4d94b3;if(0==this._queue.length)RSUtils[a(266)](RS_INHOUSE_QUEUE_KEY,null);else{for(var b="["+this[a(301)][0],c=1;c<this[a(301)][a(297)];c++)b=b+","+this._queue[c];b+="]";RSUtils[a(266)](RS_INHOUSE_QUEUE_KEY,b)}},getCurrentSessionDuration:function(){var a= a0_0x4d94b3;Date.now();a=TimeManager[a(354)]()[a(277)]();return Math.ceil(a)},setOtherValue:function(a,b,c){this[a0_0x4d94b3(274)][a+"/"+b]=c},trackEvent:function(a,b,c,d,e,f,g){g=a0_0x4d94b3;if(this._sessionActive&&0!=this[g(282)].length)if(void 0==a||void 0==b||void 0==c||void 0==d||void 0==e||void 0==f)cc[g(359)](g(355)+a+"action"+b+g(320)+c+g(286)+g(279)+e+g(373)+f);else if(null==a||null==b||null==c||null==d||null==e||null==f)cc.log(g(262)+a+"action"+b+g(320)+c+g(286)+g(279)+e+"opt_value3"+f); else{this[g(308)]+=1;var h={};h[g(333)]=this[g(331)];h[g(371)]=this[g(282)];h[g(259)]=this[g(261)];GameConfig[g(337)]&&(h[g(263)]=this[g(315)]);if(h[g(371)]||h.fb_id)if(0<h[g(371)][g(297)]||0<h[g(259)][g(297)])h[g(372)]=this[g(340)],h[g(319)]=a,h[g(276)]=b,h[g(267)]=c,h[g(286)]=d,h[g(279)]=e,h.opt_value3=f,d=RSEngine.dataManager.getMe(),null==d?(h[g(313)]="",h.xp="",h[g(305)]="",h[g(365)]="",h[g(365)]="",h[g(321)]=""):(h[g(313)]=d[g(284)](),h.xp=d[g(350)](),this[g(274)][b+"/"+c]?(h[g(305)]=RSUtils.cloneJSON(this._analyticsOtherValues[b+ "/"+c]),this[g(274)][b+"/"+c]=null):"coins"!=GameFeatureTypeEnum[g(275)]?h[g(305)]=d[g(332)]():h[g(305)]=d.getSecondaryCurrency()>=d.getJackPotTier()?d.getSecondaryCurrency():d[g(342)](),h[g(365)]=d.getUserLevel(),h.monetization_factor=d[g(358)]()),c=RSVIPManager[g(354)]()[g(348)](),null==c?(h[g(352)]="",h.vip_status_points="",h[g(271)]=""):(h[g(352)]=c[g(273)],h[g(368)]=c._vipPoints._statusPoints,h.vip_reward_points=c[g(302)][g(339)]),h.opt_counter=this[g(308)],h[g(312)]=this[g(322)],h.session_duration= this[g(292)](),h.event_time=TimeManager[g(354)]()[g(347)](),h[g(376)]=this[g(280)],a==g(270)&&"session_stop"==b&&2400<h[g(293)]&&RSErrorTracker.getInstance().trackErrorMessage(g(330),"SESSION_DURATION:"+h[g(293)]+" :S_ID"+h[g(376)],g(336)),clearInterval(this[g(364)]),this[g(364)]=null,this[g(364)]=setInterval(this[g(298)][g(272)](this),this[g(361)]),this[g(374)]=TimeManager[g(354)]()[g(347)](),a=JSON[g(353)](h),this._queue[g(349)](a),h[g(297)]=0,this.saveQueueToLocalStorage();else RSErrorTracker.getInstance()[g(324)](g(281), g(285),"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net");else RSErrorTracker[g(354)]()[g(324)]("USER_ID_NULL",g(291),"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net")}},getLastAnalyticsEventSentTime:function(){return this[a0_0x4d94b3(374)]}});var RS_CASINO_BUTTON={RS_CASINO_BUTTON_SPIN:0,RS_CASINO_BUTTON_SPIN_STOP:1,RS_CASINO_BUTTON_AUTO_SPIN:2,RS_CASINO_BUTTON_BET_CHANGE:3,RS_CASINO_BUTTON_BET_UP:4,RS_CASINO_BUTTON_BET_DOWN:5,RS_CASINO_BUTTON_BET_MAX:6,RS_CASINO_BUTTON_PAY_TABLE:7,RS_CASINO_BUTTON_DEAL:8,RS_CASINO_BUTTON_DRAW:9,RS_CASINO_BUTTON_DON:10,RS_CASINO_BUTTON_BINGO:11,RS_CASINO_BUTTON_TURBO:12,RS_CASINO_BUTTON_HANDS:13,RS_CASINO_BUTTON_QUICK_PICK:14,RS_CASINO_BUTTON_ERASE:15,RS_CASINO_BUTTON_PLAY:16},RS_MACHINE_TYPE={KENO:"KENO", SLOTS:"SLOTS",BINGO:"BINGO",TRIVIA:"TRIVIA",ROULETTE:"ROULETTE",BLACKJACK:"BLACKJACK",SCRATCHER:"SCRATCHER",CLASSIC_POKER:"CLASSIC_POKER",MULTI_PLAY_POKER:"MULTI_PLAY_POKER",MULTI_STRIKE_POKER:"MULTI_STRIKE_POKER",MULTI_STRIKE_POKER_TRIO:"MULTI_STRIKE_POKER_TRIO"},RS_WIN_ROLLUP_START="RS_WIN_ROLLUP_START",RS_WIN_ROLLUP_STOP="RS_WIN_ROLLUP_STOP",RS_PRIMARY_CURRENCY_UPDATED="RS_PRIMARY_CURRENCY_UPDATED",RSCasinoResult=function(){this._machineAnalyticsID=this._machineType="";this._totalWinAmount=this._totalBetAmount= 0;this._gameResult=null;this._betStructure=[]},RSCasinoManager=RSCasinoManager||{};RSCasinoManager._customCasinoInterface=null;RSCasinoManager._HUD=null;RSCasinoManager._primaryCurrency=0;RSCasinoManager._secondaryCurrency=0;RSCasinoManager._interruptAllowed=!1;RSCasinoManager.setCasinoInterface=function(a){RSCasinoManager._customCasinoInterface=a};RSCasinoManager.getCasinoInterface=function(){return RSCasinoManager._customCasinoInterface}; RSCasinoManager.setCasinoHUD=function(a){null!=RSCasinoManager._HUD&&RSCasinoManager._HUD.unload();a&&(RSCasinoManager._HUD=a,RSCasinoManager._HUD.loadContent())};RSCasinoManager.getCasinoHUD=function(){return RSCasinoManager._HUD};RSCasinoManager.notifyMachineLoadingStart=function(){null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.notifyMachineLoadingStart():API.machine_loading_started()}; RSCasinoManager.notifyLoadingCompleteToCasino=function(a){null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.notifyLoadingCompleteToCasino(a):API.machine_loaded(a)};RSCasinoManager.notifyLoadingFailureToCasino=function(a){null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.notifyLoadingFailureToCasino(a):API.loading_failed(a)}; RSCasinoManager.notifySpinStartToCasino=function(a){null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.notifySpinStartToCasino(a):API.spin_started(a)};RSCasinoManager.notifyBetAmountChangeToCasino=function(a){null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.notifyBetAmountChangeToCasino(a):API.bet_changed(a)}; RSCasinoManager.notifyResultToCasino=function(a){null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.notifyResultToCasino(a):API.machine_result(a)};RSCasinoManager.notifyOutOfCurrencyToCasino=function(a){null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.notifyOutOfCurrencyToCasino(a):API.out_of_currency(a)}; RSCasinoManager.notifyMachineExitToCasino=function(a){null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.notifyMachineExitToCasino(a):API.exit_machine(a)};RSCasinoManager.getPrimaryCurrency=function(){return null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.getPrimaryCurrency():RSCasinoManager._primaryCurrency}; RSCasinoManager.addPrimaryCurrency=function(a,b){void 0==b&&(b=!1);null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.addPrimaryCurrency(a,b):(RSCasinoManager._primaryCurrency+=a,API.add_primary_currency(a));null!=RSCasinoManager._HUD&&RSCasinoManager._HUD.setPrimaryCurrency(RSCasinoManager.getPrimaryCurrency())}; RSCasinoManager.addPrimaryCurrencyForDisplay=function(a,b,c){void 0==c&&(c=!1);null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.addPrimaryCurrencyForDisplay(a,b,c):(RSCasinoManager._primaryCurrency+=b,API.add_display_primary_currency(a,b,c));null!=RSCasinoManager._HUD&&RSCasinoManager._HUD.setPrimaryCurrency(RSCasinoManager.getPrimaryCurrency())}; RSCasinoManager.addPrimaryCurrencyWithoutDisplay=function(a,b){void 0==b&&(b=!1);null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.addPrimaryCurrency(a,b):(RSCasinoManager._primaryCurrency+=a,API.add_primary_currency(a))};RSCasinoManager.getSecondaryCurrency=function(){return null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.getSecondaryCurrency():RSCasinoManager._secondaryCurrency}; RSCasinoManager.addSecondaryCurrency=function(a,b){void 0==b&&(b=!1);null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.addSecondaryCurrency(a,b):(RSCasinoManager._secondaryCurrency+=a,API.add_secondary_currency(a));null!=RSCasinoManager._HUD&&RSCasinoManager._HUD.setSecondaryCurrency(RSCasinoManager.getSecondaryCurrency())}; RSCasinoManager.addSecondaryCurrencyForDisplay=function(a,b,c){void 0==c&&(c=!1);null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.addSecondaryCurrencyForDisplay(a,b,c):(RSCasinoManager._secondaryCurrency+=b,API.add_display_secondary_currency(a,b,c));null!=RSCasinoManager._HUD&&RSCasinoManager._HUD.setSecondaryCurrency(RSCasinoManager.getSecondaryCurrency())};RSCasinoManager.setSecondaryCurrencyForMachine=function(a){RSCasinoManager._secondaryCurrency=a}; RSCasinoManager.setPrimaryCurrencyForMachine=function(a){RSCasinoManager._primaryCurrency=a;RSEventManager.getInstance().dispatchEvent(RS_PRIMARY_CURRENCY_UPDATED)};RSCasinoManager.enableInterrupt=function(){RSCasinoManager._interruptAllowed=!0;RSCasinoManager.triggerInterrupts()};RSCasinoManager.enableAllHUDButtons=function(){null!=RSCasinoManager._HUD?RSCasinoManager._HUD.enableAllButtons():API.enable_hud();RSCasinoManager.enableInterrupt()}; RSCasinoManager.triggerInterrupts=function(){0>=RSEngine.popupManager.getPopupCount()&&RSCasinoManager._interruptAllowed&&(null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.triggerInterrupts():API.trigger_interrupts(),RSCasinoManager._interruptAllowed=!1)};RSCasinoManager.disableAllHUDButtons=function(){null!=RSCasinoManager._HUD?RSCasinoManager._HUD.disableAllButtons():API.disable_hud()}; RSCasinoManager.triggerMachineEvent=function(a,b,c,d,e,f){void 0==d&&(d="");void 0==e&&(e="");void 0==f&&(f="");null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.triggerMachineEvent(a,b,c,d,e,f):API.machine_event(a,b,c,d,e,f)};RSCasinoManager.triggerPrimarySourceEvent=function(a,b,c,d,e,f){null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.triggerPrimarySourceEvent(a,b,c,d,e,f):API.analytics_primary_source(a,b,c,d)}; RSCasinoManager.triggerPrimarySinkEvent=function(a,b,c,d,e){null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.triggerPrimarySinkEvent(a,b,c,d,e):API.analytics_primary_sink(a,b,c)};RSCasinoManager.triggerSecondarySourceEvent=function(a,b,c,d){null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.triggerSecondarySourceEvent(a,b,c,d):API.analytics_secondary_source(a,b,c,d)}; RSCasinoManager.triggerSecondarySinkEvent=function(a,b,c){null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.triggerSecondarySinkEvent(a,b,c):API.analytics_secondary_sink(a,b,c)};RSCasinoManager.triggerButtonClickEvent=function(a,b,c){void 0==c&&(c="");null!=RSCasinoManager._customCasinoInterface?RSCasinoManager._customCasinoInterface.triggerButtonClickEvent(a,b,c):API.button_click(a,b,c)}; RSCasinoManager.showToaster=function(a,b,c,d,e,f,g,h){new RSToaster(a,b,c,d,e,f,g,h)};RSCasinoManager.postMessage=function(a,b){RSEventManager.getInstance().dispatchEvent(a,b)};var RSCasinoInterface=RSClass.extend({init:function(){this._super.init.call(this)},notifyMachineLoadingStart:function(){},notifyLoadingCompleteToCasino:function(a){},notifyLoadingFailureToCasino:function(a){},notifySpinStartToCasino:function(a){},notifyBetAmountChangeToCasino:function(a){},notifyResultToCasino:function(a){},notifyOutOfCurrencyToCasino:function(a){},notifyMachineExitToCasino:function(a){},getPrimaryCurrency:function(){return 0},addPrimaryCurrency:function(a,b){},addPrimaryCurrencyForDisplay:function(a, b,c){},getSecondaryCurrency:function(){return 0},addSecondaryCurrency:function(a){},addSecondaryCurrencyForDisplay:function(a,b){},triggerMachineEvent:function(a,b,c,d,e,f){},triggerPrimarySourceEvent:function(a,b,c,d,e){},triggerPrimarySinkEvent:function(a,b,c){},triggerSecondarySourceEvent:function(a,b,c,d){},triggerSecondarySinkEvent:function(a,b,c){},triggerButtonClickEvent:function(a,b,c){},triggerInterrupts:function(){},postTournamentMachineData:function(){},handleResultComplete:function(a, b,c){},notifySalePurchaseResponseToCasino:function(a,b,c,d){},showPurchaseUI:function(a,b,c,d){},showRoundCompletePopups:function(){},isFreeSpinAvailable:function(){return!1},showCollectibleEngagementPopup:function(a){},isTutorialRoom:function(){return!1},postMessageToBingo:function(a,b){},showDaubAlertCart:function(a){}});var RSCasinoScreen=RSGameScreen.extend({init:function(){this._super.init.call(this)},loadContent:function(){this._super.loadContent.call(this);null==RSCasinoManager.getCasinoInterface()&&RSCasinoManager.setCasinoInterface(this.getCasinoInterface());null!=RSEngine.externalGameManager&&null==RSEngine.externalGameManager.getCustomExternalGameInterface()&&RSEngine.externalGameManager.setCustomExternalGameInterface(this.getExternalGameInterface());null==RSCasinoManager.getCasinoHUD()&&RSCasinoManager.setCasinoHUD(this.getCasinoHUD())}, unloadContent:function(){this.removeChild(RSCasinoManager.getCasinoHUD(),!1);this._super.unloadContent.call(this)},onLayoutCompleted:function(){this.addHUDToScreen();this._super.onLayoutCompleted.call(this)},onReveal:function(){RSEngine.loginMode!=LOGIN_MODE.INSTANT_GAME&&RSGame.getInstance().getTutorialManager().addTutorialOverlayForCurrentIndex();RSCasinoManager.getCasinoHUD().enableAllButtons()},addHUDToScreen:function(){var a=RSCasinoManager.getCasinoHUD();a.reInitButtonHoverCursor();this.addChild(a)}, getCasinoHUD:function(){return null},getCasinoInterface:function(){return null},getExternalGameInterface:function(){return new RSExternalGameInterface}});var RSCasinoHUD=RSGameScreen.extend({init:function(a){this._super.init.call(this);this._layout=a;this._xp=this._secondaryCurrency=this._primaryCurrency=0},loadContent:function(){this.layoutScreen(this._layout);this._super.loadContent.call(this)},update:function(a){this._super.update.call(this,a)},onLayoutCompleted:function(){},onObjectCreated:function(a,b,c){},createCustomObject:function(a,b){},setPrimaryCurrency:function(a){this._primaryCurrency=a;this.setCurrencyValue(a)},setSecondaryCurrency:function(a){this._secondaryCurrency= a},setXP:function(a){this._xp=a},enableAllButtons:function(){},disableAllButtons:function(){},enableBackButtonForDirectLoading:function(){},refreshAvatar:function(){},setNewsFeedCount:function(a){},onSettingsButtonClicked:function(){},showHUD:function(a){},updateXPBar:function(){},showHudBackground:function(){},notifyToHud:function(){},moveUp:function(){this.actionMoveBy(0.5,0,75)},moveDown:function(){this.actionMoveBy(0.5,0,-75)},animatePiggyBank:function(){},isLevelUpInitiated:function(){return!1}, setFullScreenButtonStatus:function(a){return!1}});function a0_0x1e8f(a,b){var c=a0_0x1c90();return a0_0x1e8f=function(a,b){return c[a-330]},a0_0x1e8f(a,b)}var a0_0x5cfb78=a0_0x1e8f; function a0_0x1c90(){var a="393630ldowSh{SERVICE_CALL_METHOD_MISSING{toLowerCase{sendRequest{send{loader{enc{AES{3140pMNYzr{mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net{CBC{Error: Network Time out{7854BzBXTv{10036216PvAcVt{isArray{abort{4156ocQiqI{43dujxzZ{IV_VALUE{aes-256{readyState{7596675TPbDYF{decrypt{application/json;charset\x3dUTF-8{CASINO_NAME{responseText{onreadystatechange{54802NBTzMm{GET{parse{45NsUzLl{setRequestHeader{log{getInstance{status{toString{Utf8{Error: Network Unavailable{3649037sZJIKH{POST{3627eiGtjG{pad{IS_ENCRYPTION_ENABLED".split("{");a0_0x1c90= function(){return a};return a0_0x1c90()}(function(a,b){for(var c=a0_0x1e8f,d=a();;)try{if(parseInt(c(364))/1*(parseInt(c(331))/2)+parseInt(c(344))/3*(parseInt(c(363))/4)+-parseInt(c(334))/5*(-parseInt(c(347))/6)+-parseInt(c(342))/7+-parseInt(c(360))/8+-parseInt(c(368))/9+-parseInt(c(355))/10*(-parseInt(c(359))/11)===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x1c90,629142);var kREQUEST_TYPE_POST=a0_0x5cfb78(343),kREQUEST_TYPE_GET=a0_0x5cfb78(332),RSHTTPRequest=function(){}; RSHTTPRequest[a0_0x5cfb78(350)]=function(a,b,c,d,e,f,g){var h=a0_0x5cfb78;null==e&&(e=function(a){cc[a0_0x1e8f(336)](a)});null==d&&(d=function(a){cc.log(a)});var k=cc[h(352)].getXMLHttpRequest();k.open(b,a,f);k[h(335)]("Content-Type",h(370));if(g)for(var m in g)k.setRequestHeader(m,g[m]);k[h(330)]=function(){4==k[h(367)]&&200==k[h(338)]&&clearTimeout(n)};k.onload=function(){try{var a=null;if(GameConfig[h(346)]){var b=RSUtils.genHkey32(GameConfig[h(371)][h(349)]()),e=GameConfig[h(365)],f=null;0=== k[h(372)].indexOf("[")?f=JSON[h(333)](k[h(372)]):f=k[h(372)];Array[h(361)](f)&&(f=f[0]);var g=CryptoJS[h(354)][h(369)](f,CryptoJS[h(353)].Utf8[h(333)](b),{algorithm:h(366),iv:CryptoJS.enc.Utf8[h(333)](e),padding:CryptoJS[h(345)].Pkcs7,mode:CryptoJS.mode[h(357)]}),g=g[h(339)](CryptoJS[h(353)][h(340)]),a=JSON[h(333)](g)}else a=JSON[h(333)](k[h(372)]);d(a);null!=a.error&&RSErrorTracker[h(337)]().trackErrorMessage(h(348),c,h(356))}catch(m){}};k.onerror=function(){e("Error: Network Error");clearTimeout(n)}; var n=setTimeout(function(){k[h(362)]();e(h(358))},6E4);try{k[h(351)](c)}catch(p){clearTimeout(n),e(h(341))}};var INetworkEvent=new Interface("INetworkEvent",["onNoNetwork","networkConnectionActive"]),RSNetworkManager=function(){var a,b=RSClass.extend({_serviceURL:null,delegate:null,intervalTimer:null,checkInterval:1E4,_connectionLostPopup:null,_connectionResumeExternalCb:null,_connectionLostCount:0,_isTriggeredPopup:!1,init:function(){this._connectionLostCount=0;this._super.init.call(this)},initialize:function(a){this._serviceURL=a},sendJSONRPCRequest:function(a,b,e,f){var g={};g.method=a;g.params=b;g.id= "1";var g=JSON.stringify(g),h=""!=RSAnalyticsManager.getInstance().getCurrentSessionId()?RSAnalyticsManager.getInstance().getCurrentSessionId():0;b=b[0];null!=RSGame.getInstance().getUserDataManager().getMe()&&(b=RSGame.getInstance().getUserDataManager().getMe().getId());a="?user_id\x3d"+b+"\x26r7call\x3d"+a+"\x26session_id\x3d"+h+"\x26appId\x3d"+GameConfig.APP_ID+"\x26appPlatform\x3dcanvas\x26appVersion\x3d1";GameConfig.IS_ENCRYPTION_ENABLED&&(b=RSUtils.genHkey32(GameConfig.CASINO_NAME.toLowerCase()), h=GameConfig.IV_VALUE,g=CryptoJS.AES.encrypt(g,CryptoJS.enc.Utf8.parse(b),{algorithm:"aes-256",iv:CryptoJS.enc.Utf8.parse(h),padding:CryptoJS.pad.Pkcs7,mode:CryptoJS.mode.CBC}));RSHTTPRequest.sendRequest(this._serviceURL+a,kREQUEST_TYPE_POST,g,e,f,!0)},sendJSONRPCRequestSync:function(a,b,e,f){var g={};g.method=a;g.params=b;g.id="1";var g=JSON.stringify(g),h=""!=RSAnalyticsManager.getInstance().getCurrentSessionId()?RSAnalyticsManager.getInstance().getCurrentSessionId():0;b=b[0];null!=RSGame.getInstance().getUserDataManager().getMe()&& (b=RSGame.getInstance().getUserDataManager().getMe().getId());a="?user_id\x3d"+b+"\x26r7call\x3d"+a+"\x26session_id\x3d"+h+"\x26appId\x3d"+GameConfig.APP_ID+"\x26appPlatform\x3dcanvas\x26appVersion\x3d1";GameConfig.IS_ENCRYPTION_ENABLED&&(b=RSUtils.genHkey32(GameConfig.CASINO_NAME.toLowerCase()),h=GameConfig.IV_VALUE,g=CryptoJS.AES.encrypt(g,CryptoJS.enc.Utf8.parse(b),{algorithm:"aes-256",iv:CryptoJS.enc.Utf8.parse(h),padding:CryptoJS.pad.Pkcs7,mode:CryptoJS.mode.CBC}));RSHTTPRequest.sendRequest(this._serviceURL+ a,kREQUEST_TYPE_POST,g,e,f,!1)},sendURLRequest:function(a,b,e){RSHTTPRequest.sendRequest(a,kREQUEST_TYPE_GET,null,b,e,!0)},unload:function(){},setDelegate:function(a){a.implements(INetworkEvent);this.delegate=a},removeNetworkCheck:function(){null!=this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)},enableNetworkCheck:function(a,b){this.checkInterval=null==b?1E4:b;null==a||a?this.checkNetwork():(this.removeNetworkCheck(),this.intervalTimer=setInterval(this.checkNetwork.bind(this), this.checkInterval))},checkNetwork:function(){if(null==this.delegate)throw Error("Delegate Not set for NetworkManager");var a=new XMLHttpRequest,b=this;a.onreadystatechange=function(){if(4==a.readyState)if(200<=a.status&&(300>a.status||304===a.status))b._connectionLostCount&&(null!=b.delegate&&b.delegate.networkConnectionActive(),b.onNetworkConnectionActive(!0));else{cc.log("Connection Lost -\x3e onReadyStateChange!!!!");if(null!=b.delegate)b.delegate.onNoNetwork();b.onNetworkConnectionFail()}};a.onerror= function(a){cc.log("Connection Lost -\x3e onError!!!!");if(null!=b.delegate)b.delegate.onNoNetwork();b.onNetworkConnectionFail()};var e=window.location.hostname;""!=window.location.port&&(e+=":"+window.location.port);a.open("HEAD","//"+e+"/res/ping.html?v\x3d"+Math.floor(65536*(1+Math.random())),!0);a.timeout=6E4;a.ontimeout=function(){cc.log("Connection Lost -\x3e Timeout!!!!");if(null!=b.delegate)b.delegate.onNoNetwork();b.onNetworkConnectionFail()};try{a.send(null)}catch(f){cc.log("Connection Lost -\x3e Error Catch!!!!"+ f);if(null!=b.delegate)b.delegate.onNoNetwork();b.onNetworkConnectionFail()}},onConnectionLostPopupAction:function(){this._isTriggeredPopup=!1;3<=this._connectionLostCount?RSEngine.reloadPage():(this._connectionResumeExternalCb&&this._connectionResumeExternalCb(),this._connectionLostPopup&&this._connectionLostPopup.enableButtons(!1))},initializeConnectionLostPopup:function(a){null===this._connectionLostPopup&&(this._connectionLostPopup=new RSNetworkDisconnectPopup(a),this._connectionLostPopup.loadContent())}, onNetworkConnectionActive:function(){if(null==this._connectionResumeExternalCb)this.onConnectionSuccess(!0)},onNetworkConnectionFail:function(){this.showNetworkError(null,null)},onConnectionSuccess:function(a){this._connectionLostCount&&(RSEventManager.getInstance().dispatchEvent("RS_CONNECTION_RE_ESTABLISHED"),this.hideConnectionLostPopup(),setTimeout(function(){RSEngine.externalGameManager.reloadExternalGame()},100),this._connectionResumeExternalCb=null,a&&(this._connectionLostCount=0))},showNetworkError:function(a, b){if(!this._isTriggeredPopup){this._connectionLostCount++;if(3<=this._connectionLostCount)a="Sorry! There seems to be some issue. Please reload the game.";else{null==a&&(a="Oops! Your connection to the internet \n was temporarily lost.\n Please check WiFi or Cellular connection.");if(null!=this._connectionResumeExternalCb){cc.warn("Already another instance triggered connection lost popup");return}b&&(this._connectionResumeExternalCb=b)}b=this.onConnectionLostPopupAction.bind(this);this.showConnectionLostPopup(a, b);this._isTriggeredPopup=!0}},showConnectionLostPopup:function(a,b,e){URLConfig.NMI_SCRIPT_TOKEN&&RSInAppPurchaseManager.getInstance().isPurchaseUIOnDisplay&&($("#preloader").length&&$("#preloader").remove(),closePurchaseUIPopup(),RSEngine.screenManager.removeOverlay());null==this._connectionLostPopup?cc.warn("Connection lost popup has not been set!!"):(this._connectionLostPopup.enableButtons(!0),RSEngine.popupManager.isPopupAdded(this._connectionLostPopup)?this._connectionLostPopup.setPopupData(a, null,b):(this._connectionLostPopup.setPopupData(a,b,e),RSEngine.popupManager.addPopup(this._connectionLostPopup,!0,!0,!0)))},showGameReloadPopup:function(a){this.removeNetworkCheck();this._connectionLostCount=3;this._connectionLostPopup.enableButtons(!0);this.showConnectionLostPopup(a,this.onConnectionLostPopupAction.bind(this),!0);this._isTriggeredPopup=!0},hideConnectionLostPopup:function(){this._isTriggeredPopup=!1;this._connectionLostPopup.closePopup()},unloadConnectionLostPopup:function(){null!= this._connectionLostPopup&&(this._connectionLostPopup.unloadPopup(),this._connectionLostPopup=null)},getGameConfigDetails:function(a,b,e,f){RSHTTPRequest.sendRequest(a,kREQUEST_TYPE_POST,b,e,f,!0)},getEventStatusFromDashBoard:function(a,b,e,f){if(GameConfig.DASHBOARD_URL&&GameConfig.PLATFORM_EVENT_MANAGER_ENABLED){a=GameConfig.DASHBOARD_URL+a;b=JSON.stringify(b);var g=[];g.appId=GameConfig.APP_ID;g.vName=GameConfig.VERSION;g.platform=RSEngine.platform==PLATFORM.MOBILE?"mobile":"html5";if(GameConfig.IS_ENCRYPTION_ENABLED){var h= RSUtils.genHkey32(GameConfig.CASINO_NAME.toLowerCase()),k=GameConfig.IV_VALUE;b=CryptoJS.AES.encrypt(b,CryptoJS.enc.Utf8.parse(h),{algorithm:"aes-256",iv:CryptoJS.enc.Utf8.parse(k),padding:CryptoJS.pad.Pkcs7,mode:CryptoJS.mode.CBC})}RSHTTPRequest.sendRequest(a,kREQUEST_TYPE_POST,b,e,f,!0,g)}},sendGiftCenterPushNotification:function(a,b,e,f){if(GameConfig.DASHBOARD_URL&&GameConfig.GIFTING_ENABLED){a=GameConfig.DASHBOARD_URL+a;b=JSON.stringify(b);var g=[];g.appId=GameConfig.APP_ID;g.vName=GameConfig.VERSION; g.platform=RSEngine.platform==PLATFORM.MOBILE?"mobile":"html5";if(GameConfig.IS_ENCRYPTION_ENABLED){var h=RSUtils.genHkey32(GameConfig.CASINO_NAME.toLowerCase()),k=GameConfig.IV_VALUE;b=CryptoJS.AES.encrypt(b,CryptoJS.enc.Utf8.parse(h),{algorithm:"aes-256",iv:CryptoJS.enc.Utf8.parse(k),padding:CryptoJS.pad.Pkcs7,mode:CryptoJS.mode.CBC})}RSHTTPRequest.sendRequest(a,kREQUEST_TYPE_POST,b,e,f,!0,g)}}});return{getInstance:function(){a||(a=new b);return a}}}();var DynamoDBParser=function(){};DynamoDBParser.encode=function(a){var b={},c;for(c in a){var d={Value:{}},e=a[c];"undefined"==typeof e||null==e?cc.log("Value for "+c+" is null!!!!!!!"):DynamoDBParser.isNumber(e)?(d.Value.N=Number(e).toString(),b[c]=d):DynamoDBParser.isString(e)?(d.Value.S=e,b[c]=d):(d.Value.S=JSON.stringify(e),b[c+"_"]=d)}return b}; DynamoDBParser.decode=function(a){var b={},c;for(c in a){var d=a[c];if(!DynamoDBParser.isNumber(d)&&!DynamoDBParser.isString(d)){null!=d.Value&&(d=d.Value);for(var e in d)switch(e){case "N":b[c]=Number(d[e]);break;case "S":var f=c.split("_"),g=1<f.length?JSON.parse(d[e]):d[e];b[f[0]]=g;break;case "SS":case "NN":b[c]=d[e]}}}return b};DynamoDBParser.isString=function(a){return"string"==typeof a||"object"==typeof a&&a.constructor===String}; DynamoDBParser.isNumber=function(a){return"number"==typeof a||"object"==typeof a&&a.constructor===Number};var RSVO=RSClass.extend({_voObject:null,init:function(a){this._voObject={};this.copyFromObject(a)},copyFromObject:function(a){if(a)for(var b in a)this.hasOwnProperty(this,b)&&(this[b]=a[b]);for(b in this)"function"!=typeof this[b]&&"_super"!=b&&"_voObject"!=b&&(this._voObject[b]=this[b]);return this},getVOObject:function(){return this._voObject},parseJSON:function(a){return this.copyFromObject(JSON.parse(a))},hasOwnProperty:function(a,b){var c=a.__proto__||a.constructor.prototype;return b in a&&(!(b in c)||c[b]!==a[b])}});var RSGuestUser=RSClass.extend({_unset:!1,_guestUserData:{firstLogin:!1},init:function(){},initializeItems:function(){var a=RSUtils.getLocalStorageItem("guestUserData");if(a){var b=[];b[0]=JSON.stringify(a);var b=RSUtils.getHashValue(b),c=RSUtils.getLocalStorageItem("guestUserHash");b==c&&(this._guestUserData=a)}else this._saveGuestObject()},unSetData:function(){GameConfig.SSO_ENABLED?(this._unset=!0,cc.log("Keeping local storage for guest user sessions")):(this._unset=!0,this._guestUserData={},RSUtils.removeLocalStorageItem("guestUserData"), RSUtils.removeLocalStorageItem("guestUserHash"))},getGuestUserData:function(){return this._guestUserData},getGuestUserDataForKey:function(a){return"coins"==a&&RSEngine.loginMode==LOGIN_MODE.GUEST?this._guestUserData[a]?this._guestUserData[a]+this.getTrackerLinkReward():this._guestUserData[a]:this._guestUserData[a]},setGuestUserDataForKey:function(a,b,c){this._unset&&void 0==c||(this._guestUserData[a]=b,this._saveGuestObject())},_saveGuestObject:function(){var a=[],b=JSON.stringify(this._guestUserData); a[0]=b;RSUtils.setLocalStorageItem("guestUserHash",RSUtils.getHashValue(a));RSUtils.setLocalStorageItem("guestUserData",b)},getTrackerLinkReward:function(){var a=this.getGuestUserDataForKey("trackerLinkData");return a&&a.coins?a.coins:0},getTrackerLinkId:function(){var a=this.getGuestUserDataForKey("trackerLinkData");return a?a.trackingId:null}});var RSUser=RSClass.extend({_dataHolder:null,_isFreshUser:null,_fbId:null,_monetizationFactor:null,_monetizationCount:null,_coinOffset:null,_xpOffset:null,_paidOffset:null,_firstSignIn:!1,init:function(a,b){this._guestUser=new RSGuestUser;this._isFreshUser=!1;this._paidOffset=this._xpOffset=this._coinOffset=0;this._dataHolder=null!=a?a:{};this._dataHolder.firstName?""==this._dataHolder.firstName?this._firstSignIn=!0:GameConfig.SSO_ENABLED&&1==RSSSOManager.getFoxwoodsPlayerStatus()&&!this.getOnBoardingScreenShownStatus()&& (this._firstSignIn=!0):this._firstSignIn=!0;null!=b&&(this._fbId=b.id,this._dataHolder.facebookID=this._fbId,this._dataHolder.fbId=this._fbId,GameConfig.SSO_ENABLED&&1!=RSSSOManager.getFoxwoodsPlayerStatus()?(GameConfig.IS_EDIT_FIELDS_ENABLED&&void 0!=this._dataHolder.firstName&&""!=this._dataHolder.firstName||(this._dataHolder.firstName=b.first_name,this._dataHolder.lastName=b.last_name),b.email&&(this._dataHolder.email=b.email)):GameConfig.SSO_ENABLED||(this._dataHolder.firstName=b.first_name,this._dataHolder.lastName= b.last_name,b.email&&(this._dataHolder.email=b.email)),this._dataHolder.middleName=b.middle_name?b.middle_name:"Guest",this._dataHolder.name=b.name,b.third_party_id&&(this._dataHolder.thirdPartyId=b.third_party_id),b.gender&&(this._dataHolder.gender=b.gender));this._dataHolder.blobVersion=this.loadDefaults();this.addGuestItems();this._guestUser.initializeItems();RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&this.setBlobForGuest();RSEngine.loginMode!=LOGIN_MODE.GUEST&&this._guestUser.unSetData()},addGuestItems:function(){var a= this.getGuestUserData();a&&(a.coins=0,a.xp=1,a.powerUps={})},setBlobForGuest:function(){RSEngine.loginMode==LOGIN_MODE.GUEST?(this._dataHolder.coins=this.getGuestUserDataForKey("coins"),this._dataHolder.xp=this.getGuestUserDataForKey("xp"),this._dataHolder.powerUps=this.getGuestUserDataForKey("powerUps"),this._dataHolder.trackerLinkData=this.getGuestUserDataForKey("trackerLinkData"),cc.log("Getting data for trackerlink:"+this._dataHolder.trackerLinkData)):this.getGuestUserDataForKey("firstLogin")&& this._firstSignIn&&(this.addCoins(this.getGuestUserDataForKey("coins")),this.addXP(parseInt(this.getGuestUserDataForKey("xp"))-1),this.setPowerUps(this.getGuestUserDataForKey("powerUps")))},getFirstSignIn:function(){return this._firstSignIn},getUserFirstName:function(){return this._dataHolder.firstName},setUserFirstName:function(a){this._dataHolder.firstName=a},getUserLastName:function(){return this._dataHolder.lastName},getEmail:function(){return this._dataHolder.email},setEmail:function(a){this._dataHolder.email= a},getGuestUserData:function(){return this._guestUser.getGuestUserData()},getVIPWelcomeShown:function(){return null==this._dataHolder.vipWelcomeShown?0:parseInt(this._dataHolder.vipWelcomeShown)},setVIPWelcomeShown:function(){this._dataHolder.vipWelcomeShown=1},setAchievementData:function(a){null==this._dataHolder.quests&&(this._dataHolder.quests={});this._dataHolder.quests=a;this.setGuestUserDataForKey("quests",this.getAchievementData())},getAchievementData:function(){null==this._dataHolder.quests&& (this._dataHolder.quests={});return this._dataHolder.quests},setDailyChallengeData:function(a){this._dataHolder.dailyChallengeDetails=a},getDailyChallengeData:function(){null==this._dataHolder.dailyChallengeDetails&&(this._dataHolder.dailyChallengeDetails={});return this._dataHolder.dailyChallengeDetails},setAchievement:function(a,b){null==this._dataHolder.achievements&&(this._dataHolder.achievements={});if(null==this._dataHolder.achievements[a]||0==this._dataHolder.achievements[a])this._dataHolder.achievements[a]= b;this.setGuestUserDataForKey("achievements",this.getAchievements())},getAchievements:function(){null==this._dataHolder.achievements&&(this._dataHolder.achievements={});return this._dataHolder.achievements},addFirstPlaceBingo:function(){this._dataHolder.bingoStats.first_place_bingos=this._dataHolder.bingoStats.first_place_bingos?this._dataHolder.bingoStats.first_place_bingos+1:1},setTotalBingoRoundsPlayed:function(){this._dataHolder.bingoStats.total_rounds_played||(this._dataHolder.bingoStats.total_rounds_played= 0);this._dataHolder.bingoStats.total_rounds_played+=1},getGuestUserDataForKey:function(a){return this._guestUser.getGuestUserDataForKey(a)},setGuestUserDataForKey:function(a,b,c){this._guestUser.setGuestUserDataForKey(a,b,c)},setWelcomeBonusAwarded:function(a){this._dataHolder.isCommonWelcomeBonusAwarded=a;this.setGuestUserDataForKey("isCommonWelcomeBonusAwarded",this.getWelcomeBonusAwarded());RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK&&(this._dataHolder.isFBLoginBonusAwarded=a)},getWelcomeBonusAwarded:function(){return this._dataHolder.isCommonWelcomeBonusAwarded}, addCoins:function(a){var b=parseInt(this._dataHolder.coins);this._coinOffset+=a;this._dataHolder.coins=b+a},setCoins:function(a){0<a&&(this._dataHolder.coins=a)},setPaidCoinOffset:function(a){this._paidOffset=a},setPaidCoins:function(a){this._dataHolder.paidCoins=parseInt(a)},getPaidCoins:function(){return parseInt(this._dataHolder.paidCoins)},getPaidCoinOffset:function(){return this._paidOffset},getCoinOffset:function(){return this._coinOffset},getXPOffset:function(){return this._xpOffset},resetOffset:function(a){this._coinOffset-= a.coin;this._xpOffset-=a.xp;this._paidOffset-=a.paidCoin},addXP:function(a){a=Math.floor(a);var b=parseInt(this._dataHolder.xp);this._xpOffset+=a;this._dataHolder.xp=b+a},getMonetizationFactor:function(){return parseFloat(this._dataHolder.monetization_factor)},getMonetizationCount:function(){return parseInt(this._dataHolder.monetization_count)},setLastPurchaseTime:function(a){this._dataHolder.lastPurchaseTime=Math.floor(a)},getLastPurchaseTime:function(){return parseInt(this._dataHolder.lastPurchaseTime)}, setPreviousPurchaseTime:function(a){this._dataHolder.previousPurchaseTime=Math.floor(a)},getPreviousPurchaseTime:function(){return parseInt(this._dataHolder.previousPurchaseTime)},getCoins:function(){return parseInt(this._dataHolder.coins)},getXP:function(){null==this._dataHolder.xp&&(this._dataHolder.xp=0);return parseInt(this._dataHolder.xp)},getSecondaryCurrency:function(){return 0},getJackPotTier:function(){return 0},getFBId:function(){return this._fbId},getDataHolder:function(){return this._dataHolder}, isFreshUser:function(){return this._isFreshUser},getUserLevel:function(){return"1"},getLevelFactor:function(){return this._dataHolder.levelFactor||0},getImageUrlForBingo:function(){return RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK||RSEngine.loginMode==LOGIN_MODE.FACEBOOK?"https://graph.facebook.com/"+this._fbId+"/picture?type\x3dsquare":RSEngine.loginMode==LOGIN_MODE.EMAIL&&RSEngine.dataManager.getMe().getAvatar()?GameConfig.BASE_URL+"/res/AvatarImages/"+RSEngine.dataManager.getMe().getAvatar()+ ".png":GameConfig.BASE_URL+"/res/AvatarImages/guestplayer.png"},getImageUrl:function(a){a=a?a:!1;return GameConfig.IS_EDIT_FIELDS_ENABLED&&RSEngine.dataManager.getMe().getAvatar()&&!a?GameConfig.BASE_URL+"/res/AvatarImages/"+RSEngine.dataManager.getMe().getAvatar()+".png":RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK||RSEngine.loginMode==LOGIN_MODE.FACEBOOK?"https://graph.facebook.com/"+this._fbId+"/picture?type\x3dsquare\x26access_token\x3d"+RSFBManager.getInstance().getAccessToken():RSEngine.loginMode== LOGIN_MODE.EMAIL&&RSEngine.dataManager.getMe().getAvatar()?GameConfig.BASE_URL+"/res/AvatarImages/"+RSEngine.dataManager.getMe().getAvatar()+".png":GameConfig.BASE_URL+"/res/AvatarImages/guestplayer.png"},getImageUrlWithSize:function(a,b){return RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK||RSEngine.loginMode==LOGIN_MODE.FACEBOOK?"https://graph.facebook.com/"+this._fbId+"/picture?type\x3dlarge\x26height\x3d"+b+"\x26width\x3d"+a+"\x26access_token\x3d"+RSGame.getInstance().getGameManager().getFBAccessToken(): RSEngine.loginMode==LOGIN_MODE.EMAIL?GameConfig.BASE_URL+"/res/AvatarImages/"+RSEngine.dataManager.getMe().getAvatar()+".png":GameConfig.BASE_URL+"/res/AvatarImages/guestplayer.png"},getId:function(){return this._dataHolder.id},getwebRSId:function(){return this._dataHolder.webRSId?this._dataHolder.webRSId:null},setwebRSId:function(a){this._dataHolder.webRSId=a},setUserIdForSSO:function(a){this._dataHolder.id=a},getBlobVersion:function(){return this._dataHolder.blobVersion?this._dataHolder.blobVersion: 0},loadDefaults:function(){var a=this.getBlobVersion();switch(a+1){case 1:this._dataHolder.joiningDate=TimeManager.getInstance().getCurrentServerTime(),this._isFreshUser=!0,this._xpOffset=1,a=this._initialCoins=0}return a},setPowerUps:function(a){this._dataHolder.powerUps=a},getPowerUps:function(){return this._dataHolder.powerUps?this._dataHolder.powerUps:{}},getPowerUpCount:function(a){var b=this._dataHolder.powerUps;return b[a]?b[a]:0},getGiftUserList:function(){this._dataHolder.giftUserList||(this._dataHolder.giftUserList= {invite:[],request:[],sent:[]});return this._dataHolder.giftUserList},setRequestUserList:function(a){this._dataHolder.giftUserList.request||(this._dataHolder.giftUserList.request=[]);this._dataHolder.giftUserList.request=a},getGiftCollected:function(){return this._dataHolder.giftCollected},setSentUserList:function(a){this._dataHolder.giftUserList.sent||(this._dataHolder.giftUserList.sent=[]);this._dataHolder.giftUserList.sent=a},getSentUserList:function(){this.getGiftUserList()&&(this._dataHolder.giftUserList.sent|| (this._dataHolder.giftUserList.sent=[]));return this._dataHolder.giftUserList.sent},getRequestUserList:function(){this._dataHolder.giftUserList.request||(this._dataHolder.giftUserList.request=[]);return this._dataHolder.giftUserList.request},getJoiningDate:function(){return this._dataHolder.joiningDate},getGiftData:function(){this._dataHolder.giftData||(this._dataHolder.giftData={});return this._dataHolder.giftData},setGiftData:function(a){this._dataHolder.giftData=a},setUnlockedGifts:function(a){this._dataHolder.unlockedGifts= a},getUnlockedGifts:function(){void 0==this._dataHolder.unlockedGifts&&(this._dataHolder.unlockedGifts={});return this._dataHolder.unlockedGifts},getLastLogin:function(){this._dataHolder.lastLogin||(this._dataHolder.lastLogin=TimeManager.getInstance().getCurrentServerTime());return this._dataHolder.lastLogin},getUserAchievementData:function(){this._dataHolder.questDetails||(this._dataHolder.questDetails={activeQuests:[{id:"qs_01",st:!1},{id:"qs_02",st:!1},{id:"qs_03",st:!1},{id:"qs_04",st:!1},{id:"qs_05", st:!1},{id:"qs_06",st:!0},{id:"qs_07",st:!1},{id:"qs_08",st:!1},{id:"qs_09",st:!1},{id:"qs_10",st:!1},{id:"qs_11",st:!1},{id:"qs_12",st:!1},{id:"qs_13",st:!1},{id:"qs_14",st:!1},{id:"qs_15",st:!1},{id:"qs_16",st:!1}],objectiveDatails:{o_01:{ct:0}}});return this._dataHolder.questDetails},setAvatar:function(a){this._dataHolder.webAvatarId=a;this._dataHolder.avatar=a},getAvatar:function(){"LNC"!=GameConfig.GAME_ID||141!=parseInt(this._dataHolder.webAvatarId)&&142!=parseInt(this._dataHolder.webAvatarId)&& 143!=parseInt(this._dataHolder.webAvatarId)&&144!=parseInt(this._dataHolder.webAvatarId)||(this._dataHolder.webAvatarId=1);this._dataHolder.webavatarid&&(this._dataHolder.webAvatarId=this._dataHolder.webavatarid);if(!this._dataHolder.webAvatarId)return"";this._dataHolder.avatar&&0!=this._dataHolder.avatar||(this._dataHolder.avatar=this._dataHolder.webAvatarId);return this._dataHolder.webAvatarId},getLosingStreakingValues:function(){this._dataHolder.losingStreakValues||(this._dataHolder.losingStreakValues= {});return this._dataHolder.losingStreakValues},setLosingStreakingValues:function(a){this._dataHolder.losingStreakValues=a},addBingoCardsWon:function(a){this._dataHolder.bingoStats.total_bingos_won=this._dataHolder.bingoStats.total_bingos_won?this._dataHolder.bingoStats.total_bingos_won+a:a},setBingoHighestRank:function(a){this._dataHolder.bingoStats.highest_rank?Number(a)<this._dataHolder.bingoStats.highest_rank&&(this._dataHolder.bingoStats.highest_rank=a):this._dataHolder.bingoStats.highest_rank= a},getAristocratLastBetAmount:function(){return this._dataHolder.aristocratLastBetAmount},setAristocratLastBetAmount:function(a){this._dataHolder.aristocratLastBetAmount=a},syncBlobVars:function(a,b){var c=new BlobSyncVarsVO(a),d;for(d in c)"number"!=typeof c[d]||isNaN(c[d])||(this._dataHolder[d]=c[d]);RSCasinoManager.getCasinoHUD().setPrimaryCurrency(RSCasinoManager.getPrimaryCurrency())},setFirstPlayed:function(a){switch(a){case RSGameTypes.Slots:0==this._dataHolder.slotsStats.first_played&&(this._dataHolder.slotsStats.first_played= TimeManager.getInstance().getCurrentServerTime());break;case RSGameTypes.Bingo:0==this._dataHolder.bingoStats.first_played&&(this._dataHolder.bingoStats.first_played=TimeManager.getInstance().getCurrentServerTime());break;case RSGameTypes.Poker:0==this._dataHolder.pokerStats.first_played&&(this._dataHolder.pokerStats.first_played=TimeManager.getInstance().getCurrentServerTime());break;case RSGameTypes.Blackjack:0==this._dataHolder.blackjackStats.first_played&&(this._dataHolder.blackjackStats.first_played= TimeManager.getInstance().getCurrentServerTime());break;case RSGameTypes.Keno:0==this._dataHolder.kenoStats.first_played&&(this._dataHolder.kenoStats.first_played=TimeManager.getInstance().getCurrentServerTime());break;case RSGameTypes.Trivia:0==this._dataHolder.triviaStats.first_played&&(this._dataHolder.triviaStats.first_played=TimeManager.getInstance().getCurrentServerTime());break;case RSGameTypes.Roulette:0==this._dataHolder.rouletteStats.first_played&&(this._dataHolder.rouletteStats.first_played= TimeManager.getInstance().getCurrentServerTime());break;case RSGameTypes.Scratcher:0==this._dataHolder.scratcherStats.first_played&&(this._dataHolder.scratcherStats.first_played=TimeManager.getInstance().getCurrentServerTime())}},RouletteStatsSetHighestWin:function(a){this._dataHolder.rouletteStats.highest_win<a&&(this._dataHolder.rouletteStats.highest_win=a)},RouletteStatsGetHighestWin:function(){return null==this._dataHolder.rouletteStats.highest_win?0:this._dataHolder.rouletteStats.highest_win}, ScratcherStatsSetHighestWin:function(a){this._dataHolder.scratcherStats.highest_win<a&&(this._dataHolder.scratcherStats.highest_win=a)},ScratcherStatsGetHighestWin:function(){return null==this._dataHolder.scratcherStats.highest_win?0:this._dataHolder.scratcherStats.highest_win},setSpins:function(a){null==this._dataHolder.slotsStats.machine_spins[a]&&(this._dataHolder.slotsStats.machine_spins[a]=0);this._dataHolder.slotsStats.machine_spins[a]+=1},getSpins:function(){if(null==this._dataHolder.slotsStats.slotmachine_spins|| void 0==this._dataHolder.slotsStats.slotmachine_spins)this._dataHolder.slotsStats.slotmachine_spins={};return this._dataHolder.slotsStats.slotmachine_spins},setRouletteRounds:function(a){null==this._dataHolder.rouletteStats.machine_rounds[a]&&(this._dataHolder.rouletteStats.machine_rounds[a]=0);this._dataHolder.rouletteStats.machine_rounds[a]+=1},getRouletteRounds:function(){null==this._dataHolder.rouletteStats&&(this._dataHolder.rouletteStats={first_played:0,highest_win:0,machine_rounds:{}});if(null== this._dataHolder.rouletteStats.machine_rounds||void 0==this._dataHolder.rouletteStats.machine_rounds)this._dataHolder.rouletteStats.machine_rounds={};return this._dataHolder.rouletteStats.machine_rounds},setScratcherRounds:function(a){null==this._dataHolder.scratcherStats.machine_rounds[a]&&(this._dataHolder.scratcherStats.machine_rounds[a]=0);this._dataHolder.scratcherStats.machine_rounds[a]+=1},getScratcherRounds:function(){null==this._dataHolder.scratcherStats&&(this._dataHolder.scratcherStats= {first_played:0,highest_win:0,machine_rounds:{}});if(null==this._dataHolder.scratcherStats.machine_rounds||void 0==this._dataHolder.scratcherStats.machine_rounds)this._dataHolder.scratcherStats.machine_rounds={};return this._dataHolder.scratcherStats.machine_rounds},isMachineFeatured:function(a){var b=RSMEConfigManager.getInstance().getDataForEvent(RSFeatures.FEATURED);if(null==b)return!1;b=b.machines;if(null!=b)for(var c in b){var d=b[c],e;for(e in d)if(a==d[e])return!0}return!1},isMachineFeaturedInNewMachines:function(a){var b= RSMEConfigManager.getInstance().getDataForEvent(RSFeatures.NEW_MACHINES);if(null==b)return!1;b=b.machines;if(null!=b)for(var c in b){var d=b[c],e;for(e in d)if(a==d[e])return!0}return!1},isMachineUnlocked:function(a){var b=RSGame.getInstance().getGameData().getMachineDetailsByName(RSGameTypes.Slots,a);if(null!=b&&b.hasOwnProperty("levelRequired")&&""!=b.levelRequired){var c=b.levelRequired<=RSGame.getInstance().getLevelManager().getCurrentLevel();return 0<b.VIPTier&&b.VIPTier<=RSVIPManager.getInstance().getVIPUserTier()|| UrlNotificationManager.getInstance().getAllMachineUnlockStatus()||RSGame.getInstance().getUserDataManager().getMe().isMachineFeatured(a)||RSGame.getInstance().getUserDataManager().getMe().isMachineFeaturedInNewMachines(a)?!0:c?!0:!1}return!1},setSlotWin:function(a){if(null==this._dataHolder.slotsStats.highest_win||void 0==this._dataHolder.slotsStats.highest_win)this._dataHolder.slotsStats.highest_win=0;a>this._dataHolder.slotsStats.highest_win&&(this._dataHolder.slotsStats.highest_win=a)},getSlotWin:function(){return this._dataHolder.slotsStats.highest_win}, setBlackjackTutorialShownStatus:function(a){0==this._dataHolder.blackjackTutorialsShown.length?this._dataHolder.blackjackTutorialsShown.push(a):-1==this._dataHolder.blackjackTutorialsShown.indexOf(a)&&this._dataHolder.blackjackTutorialsShown.push(a)},getBlackjackTutorialShownStatus:function(){null==this._dataHolder.blackjackTutorialsShown&&(this._dataHolder.blackjackTutorialsShown=[]);return this._dataHolder.blackjackTutorialsShown},setBlackjackHighestWin:function(a){this._dataHolder.blackjackStats.highest_win|| (this._dataHolder.blackjackStats.highest_win=0);this._dataHolder.blackjackStats.highest_win<a&&(this._dataHolder.blackjackStats.highest_win=a)},getBlackjackHighestWin:function(){return null==this._dataHolder.blackjackStats.highest_win?0:this._dataHolder.blackjackStats.highest_win},getTutorialCompleteStatus:function(){},setTutorialCompleteStatus:function(){},getVideoWatchCount:function(a){this._dataHolder.PlatformEventDetails&&this._dataHolder.PlatformEventDetails.PlatformEventCounter||(this._dataHolder.PlatformEventDetails= {PlatformEventCounter:{},rewardedVideoPlayCount:0,eventInitializationTime:0,inhouseAdPlayCount:0});var b=this._dataHolder.PlatformEventDetails.eventInitializationTime+"_";return b="HouseAd"==a?b+this._dataHolder.PlatformEventDetails.inhouseAdPlayCount:b+this._dataHolder.PlatformEventDetails.rewardedVideoPlayCount},setVideoWatchCount:function(a,b,c){if(0==a)this._dataHolder.PlatformEventDetails={PlatformEventCounter:{},rewardedVideoPlayCount:0,eventInitializationTime:Math.floor((new Date).getTime()/ 1E3),inhouseAdPlayCount:0};else{if(b){if(void 0==this._dataHolder.PlatformEventDetails.PlatformEventCounter["ClickToWatchAd_"+b]||null==this._dataHolder.PlatformEventDetails.PlatformEventCounter["ClickToWatchAd_"+b])this._dataHolder.PlatformEventDetails.PlatformEventCounter["ClickToWatchAd_"+b]=0;this._dataHolder.PlatformEventDetails.PlatformEventCounter["ClickToWatchAd_"+b]++}"HouseAd"==c?this._dataHolder.PlatformEventDetails.inhouseAdPlayCount=a:this._dataHolder.PlatformEventDetails.rewardedVideoPlayCount= a;this._dataHolder.PlatformEventDetails.eventInitializationTime=Math.floor((new Date).getTime()/1E3);RSGame.getInstance().getUserDataManager().saveUserData("AdsCount update")}},getEventInitializationTime:function(){this._dataHolder.PlatformEventDetails&&this._dataHolder.PlatformEventDetails.PlatformEventCounter||(this._dataHolder.PlatformEventDetails.eventInitializationTime=0);return this._dataHolder.PlatformEventDetails.eventInitializationTime},setPlatformEventCounter:function(a){this._dataHolder.PlatformEventDetails&& this._dataHolder.PlatformEventDetails.PlatformEventCounter||(this._dataHolder.PlatformEventDetails.PlatformEventCounter={});this._dataHolder.PlatformEventDetails.PlatformEventCounter[a]||(this._dataHolder.PlatformEventDetails.PlatformEventCounter[a]=0);this._dataHolder.PlatformEventDetails.PlatformEventCounter[a]++;this._dataHolder.PlatformEventDetails.eventInitializationTime=Math.floor((new Date).getTime()/1E3);RSGame.getInstance().getUserDataManager().saveUserData("PlatformEventCounter update")}, getPlatformEventCounter:function(a){this._dataHolder.PlatformEventDetails&&this._dataHolder.PlatformEventDetails.PlatformEventCounter||(this._dataHolder.PlatformEventDetails.PlatformEventCounter={});this._dataHolder.PlatformEventDetails.PlatformEventCounter[a]||(this._dataHolder.PlatformEventDetails.PlatformEventCounter[a]=0);return this._dataHolder.PlatformEventDetails.PlatformEventCounter[a]},resetPlatformEventCounter:function(){this._dataHolder.PlatformEventDetails&&this._dataHolder.PlatformEventDetails.PlatformEventCounter|| (this._dataHolder.PlatformEventDetails.PlatformEventCounter={});for(var a=0;a<this._dataHolder.PlatformEventDetails.PlatformEventCounter.length;a++)this._dataHolder.PlatformEventDetails.PlatformEventCounter[a]=0},getSurveyCompletedCount:function(){this._dataHolder.surveyCompletedCount||(this._dataHolder.surveyCompletedCount="0_0");return this._dataHolder.surveyCompletedCount},setSurveyCompletedCount:function(a){this._dataHolder.surveyCompletedCount=1E3*TimeManager.getInstance().currentServerTime+ "_"+a},setXpBlastEndTime:function(a){this._dataHolder.xpBlastEndTime=a},getXpBlastEndTime:function(){this._dataHolder.xpBlastEndTime||(this._dataHolder.xpBlastEndTime=0);return this._dataHolder.xpBlastEndTime},setXpBlastMultiplier:function(a){this._dataHolder.xpBlastMultiplier=a},getXpBlastMultiplier:function(){this._dataHolder.xpBlastMultiplier||(this._dataHolder.xpBlastMultiplier=1);return this._dataHolder.xpBlastMultiplier},setXpBlastDuration:function(a){this._dataHolder.xpBlastDuration=a},getXpBlastDuration:function(){this._dataHolder.xpBlastDuration|| (this._dataHolder.xpBlastDuration=1);return this._dataHolder.xpBlastDuration},setXpBlastSource:function(a){this._dataHolder.xpBlastSource=a},getXpBlastSource:function(){this._dataHolder.xpBlastSource||(this._dataHolder.xpBlastSource="null");return this._dataHolder.xpBlastSource},updateViralityData:function(){this._dataHolder.virality_factor=0;this._dataHolder.virality_count=0},getUserCollectibles:function(){null==this._dataHolder.collectibles&&(this._dataHolder.collectibles={});return this._dataHolder.collectibles}, getDaubAlertTime:function(){return 0},getLevelXPOffset:function(){return 0},getBlackTierPopupStatus:function(){null==this._dataHolder.blackTierPopupStatus&&(this._dataHolder.blackTierPopupStatus=!1);return this._dataHolder.blackTierPopupStatus},setBlackTierPopupStatus:function(){this._dataHolder.blackTierPopupStatus=!0},getLoyaltyMallEligiblePopupShownStatus:function(){null==this._dataHolder.isLoyaltyEligiblePopupShown&&(this._dataHolder.isLoyaltyEligiblePopupShown=!1);return this._dataHolder.isLoyaltyEligiblePopupShown}, setLoyaltyMallEligiblePopupShownStatus:function(){this._dataHolder.isLoyaltyEligiblePopupShown=!0},setCurrentMaxBet:function(a){null==this._dataHolder.currentMaxBet&&(this._dataHolder.currentMaxBet=0);this._dataHolder.currentMaxBet=a},getCurrentMaxBet:function(){null==this._dataHolder.currentMaxBet&&(this._dataHolder.currentMaxBet=0);return this._dataHolder.currentMaxBet},setSecondsPerSpin:function(a){null==this._dataHolder.secondsPerSpin&&(this._dataHolder.secondsPerSpin=0);this._dataHolder.secondsPerSpin= a},getSecondsPerSpin:function(){null==this._dataHolder.secondsPerSpin&&(this._dataHolder.secondsPerSpin=0);return this._dataHolder.secondsPerSpin},getDCinfoPopupShownStatus:function(){null==this._dataHolder.DCInfoPopupShown&&(this._dataHolder.DCInfoPopupShown=!1);return this._dataHolder.DCInfoPopupShown},setDCinfoPopupShownStatus:function(){null==this._dataHolder.DCInfoPopupShown&&(this._dataHolder.DCInfoPopupShown=!0);this._dataHolder.DCInfoPopupShown=!0},getAdsSwapBtnDescriptionVisibility:function(){null== this._dataHolder.SwapBtnVisibility&&(this._dataHolder.SwapBtnVisibility=!1);return this._dataHolder.SwapBtnVisibility},setAdsSwapBtnDescriptionVisibility:function(){null==this._dataHolder.SwapBtnVisibility&&(this._dataHolder.SwapBtnVisibility=!0);this._dataHolder.SwapBtnVisibility=!0},setWatchAdQuestSetId:function(a){this._dataHolder.WatchAdQuestSetId=a},getSessionCountOfEvent:function(a){this._dataHolder.sessionCountOfEvent||(this._dataHolder.sessionCountOfEvent={});this._dataHolder.sessionCountOfEvent[a]|| (this._dataHolder.sessionCountOfEvent[a]=1E3*TimeManager.getInstance().currentServerTime+"_0");return this._dataHolder.sessionCountOfEvent[a]},setSessionCountOfEvent:function(a,b){this._dataHolder.sessionCountOfEvent||(this._dataHolder.sessionCountOfEvent={});this._dataHolder.sessionCountOfEvent[a]=1E3*TimeManager.getInstance().currentServerTime+"_"+b},getJackpotUnlockStatus:function(){this._dataHolder.isJackpotUnlockShown||(this._dataHolder.isJackpotUnlockShown=!1);return this._dataHolder.isJackpotUnlockShown}, getJackpotWelcomeBonusAwarded:function(){this._dataHolder.isJackpotWelcomeBonusAwarded||(this._dataHolder.isJackpotWelcomeBonusAwarded=!1);return this._dataHolder.isJackpotWelcomeBonusAwarded},setJackpotUnlockStatus:function(){this._dataHolder.isJackpotUnlockShown=!0},setJackpotWelcomeBonusAwarded:function(a){this._dataHolder.isJackpotWelcomeBonusAwarded=a},setJackpotProbabilityBoosted:function(a){this._dataHolder.isJackpotProbabilityBoosted=a},getJackpotProbabilityBoosted:function(){this._dataHolder.isJackpotProbabilityBoosted|| (this._dataHolder.isJackpotProbabilityBoosted=!1);return this._dataHolder.isJackpotProbabilityBoosted},getVIPSurfacingShown:function(){return null==this._dataHolder.isVipSurfacingShown?!1:this._dataHolder.isVipSurfacingShown},setVIPSurfacingShown:function(){this._dataHolder.isVipSurfacingShown=!0},getVIPTriggerStatus:function(){null==this._dataHolder.triggerVipSurfacing&&(this._dataHolder.triggerVipSurfacing=!1);return this._dataHolder.triggerVipSurfacing},setVIPTriggerStatus:function(a){this._dataHolder.triggerVipSurfacing= a},getJLSurfacingShown:function(){return null==this._dataHolder.isJlSurfacingShown?!1:this._dataHolder.isJlSurfacingShown},setJLSurfacingShown:function(){this._dataHolder.isJlSurfacingShown=!0},getJLTriggerStatus:function(){null==this._dataHolder.triggerJlSurfacing&&(this._dataHolder.triggerJlSurfacing=!1);return this._dataHolder.triggerJlSurfacing},setJLTriggerStatus:function(a){this._dataHolder.triggerJlSurfacing=a},getLMTriggerStatus:function(){null==this._dataHolder.triggerLmSurfacing&&(this._dataHolder.triggerLmSurfacing= !1);return this._dataHolder.triggerLmSurfacing},setLMTriggerStatus:function(a){this._dataHolder.triggerLmSurfacing=a},getSunSetSessionCount:function(){return 1},getSlotsLastPlayedMachines:function(){if(null==this._dataHolder.slotsStats.last_played||void 0==this._dataHolder.slotsStats.last_played)this._dataHolder.slotsStats.last_played=[];return this._dataHolder.slotsStats.last_played},setSlotsLastPlayedMachines:function(a){if(null==this._dataHolder.slotsStats.last_played||void 0==this._dataHolder.slotsStats.last_played)this._dataHolder.slotsStats.last_played= [];var b=this._dataHolder.slotsStats.last_played;0==b.length?b.push(a):b[b.length-1]!=a&&(2==b.length?(b.push(a),b.splice(0,1)):b.push(a));this._dataHolder.slotsStats.last_played=b},getLeaderboardLevelBucket:function(){if(this._dataHolder.leaderboardLevelBucket)return this._dataHolder.leaderboardLevelBucket;this._dataHolder.leaderboardLevelBucket={};return this._dataHolder.leaderboardLevelBucket},getVIPLoungeShown:function(){null==this._dataHolder.vipLoungeShown&&(this._dataHolder.vipLoungeShown= !1);return this._dataHolder.vipLoungeShown},setJackPotTier:function(a){this._dataHolder.jackPotTier=a},setVIPLoungeShown:function(){this._dataHolder.vipLoungeShown=!0},setVipMachineUnlocked:function(a){this._dataHolder.vipMachineUnlocked=a},setJackpotProbabilityBoosted:function(a){this._dataHolder.isJackpotProbabilityBoosted=a},getXpFraction:function(){null==this._dataHolder.xpFraction&&(this._dataHolder.xpFraction=0);return this._dataHolder.xpFraction},setXpFraction:function(a){this._dataHolder.xpFraction= a},getPiggyBankValue:function(){null==this._dataHolder.piggyBankCoin&&(this._dataHolder.piggyBankCoin=0);return this._dataHolder.piggyBankCoin},setPiggyBankValue:function(a){this._dataHolder.piggyBankCoin=a},getRewards:function(){if(this._dataHolder.rewardList)return this._dataHolder.rewardList;this._dataHolder.rewardList={};return this._dataHolder.rewardList},getGiftSendList:function(){this._dataHolder.giftSendList||(this._dataHolder.giftSendList={});return this._dataHolder.giftSendList},getEmailConnectData:function(){this._dataHolder.emailConnect|| (this._dataHolder.emailConnect={});return this._dataHolder.emailConnect},setEmailConnectData:function(a){this._dataHolder.emailConnect||(this._dataHolder.emailConnect={});this._dataHolder.emailConnect=a},getGiftClaimList:function(){this._dataHolder.giftClaimList||(this._dataHolder.giftClaimList={});return this._dataHolder.giftClaimList},getGiftShareCount:function(){this._dataHolder.giftShareCount||(this._dataHolder.giftShareCount=0);return this._dataHolder.giftShareCount},setGiftShareCount:function(){this._dataHolder.giftShareCount|| (this._dataHolder.giftShareCount=0);this._dataHolder.giftShareCount++},addCollectible:function(a,b){var c=!1;null==this._dataHolder.collectibles&&(this._dataHolder.collectibles={});for(var d in this._dataHolder.collectibles)d==a&&(this._dataHolder.collectibles[a]+=b,c=!0);!1==c&&(this._dataHolder.collectibles[a]=b)},setfandfBonusEnableTime:function(a){this._dataHolder.fandfBonus=a},getfandfBonusEnableTime:function(){this._dataHolder.fandfBonus||(this._dataHolder.fandfBonus=0);return this._dataHolder.fandfBonus}, setLastPlayedMachine:function(a,b){if(null==this._dataHolder.lastPlayedMachineDetails||void 0==this._dataHolder.lastPlayedMachineDetails)this._dataHolder.lastPlayedMachineDetails={};if(null==this._dataHolder.lastPlayedMachineDetails[a]||void 0==this._dataHolder.lastPlayedMachineDetails[a])this._dataHolder.lastPlayedMachineDetails[a]={};this._dataHolder.lastPlayedMachineDetails[a]=b;this._dataHolder.lastPlayedMachineDetails.lastPlayed=b},setFUEBonusStatus:function(a){this._dataHolder.completedFUEBonus= a},getFUEBonusStatus:function(){return this._dataHolder.completedFUEBonus},setMachineFUEBonusStatus:function(a){this._dataHolder.completedMachineFUE=a},getMachineFUEBonusStatus:function(){if(null==this._dataHolder.completedMachineFUE||void 0==this._dataHolder.completedMachineFUE)this._dataHolder.completedMachineFUE=!0;return this._dataHolder.completedMachineFUE},updateCumulativeSpinsForFUE:function(){if(null==this._dataHolder.cumulativeSpinsForFUE||void 0==this._dataHolder.cumulativeSpinsForFUE)this._dataHolder.cumulativeSpinsForFUE= 0;this._dataHolder.cumulativeSpinsForFUE+=1},getCumulativeSpinsForFUE:function(){if(null==this._dataHolder.cumulativeSpinsForFUE||void 0==this._dataHolder.cumulativeSpinsForFUE)this._dataHolder.cumulativeSpinsForFUE=0;return parseInt(this._dataHolder.cumulativeSpinsForFUE)},setMachineFUEBonusTriggered:function(a){if(null==this._dataHolder.machineFUEBonusShown||void 0==this._dataHolder.machineFUEBonusShown)this._dataHolder.machineFUEBonusShown=[];this._dataHolder.machineFUEBonusShown.includes(a)|| this._dataHolder.machineFUEBonusShown.push(a)},getMachineFUEBonusTriggered:function(a){if(null==this._dataHolder.machineFUEBonusShown||void 0==this._dataHolder.machineFUEBonusShown)this._dataHolder.machineFUEBonusShown=[];return this._dataHolder.machineFUEBonusShown.includes(a)},getClubMUpdateStatus:function(){return this._dataHolder.clubMUpdateStatus||!1},getFirstPlayed:function(a){var b="";switch(a){case RSGameTypes.Slots:0!==this._dataHolder.slotsStats.first_played&&(b=this.getDateInStringFormat(this._dataHolder.slotsStats.first_played)); break;case RSGameTypes.Bingo:0!==this._dataHolder.bingoStats.first_played&&(b=this.getDateInStringFormat(this._dataHolder.bingoStats.first_played));break;case RSGameTypes.Poker:0!==this._dataHolder.pokerStats.first_played&&(b=this.getDateInStringFormat(this._dataHolder.pokerStats.first_played));break;case RSGameTypes.Blackjack:0!==this._dataHolder.blackjackStats.first_played&&(b=this.getDateInStringFormat(this._dataHolder.blackjackStats.first_played));break;case RSGameTypes.Keno:0!==this._dataHolder.kenoStats.first_played&& (b=this.getDateInStringFormat(this._dataHolder.kenoStats.first_played));break;case RSGameTypes.Roulette:0!==this._dataHolder.rouletteStats.first_played&&(b=this.getDateInStringFormat(this._dataHolder.rouletteStats.first_played));break;case RSGameTypes.Scratcher:0!==this._dataHolder.scratcherStats.first_played&&(b=this.getDateInStringFormat(this._dataHolder.scratcherStats.first_played));break;case "kenoBingo":if(0!==this._dataHolder.kenoStats.first_played)var c=this._dataHolder.kenoStats.first_played; if(0!==this._dataHolder.bingoStats.first_played)var d=this._dataHolder.bingoStats.first_played;if(void 0==d||c<=d)b=this.getDateInStringFormat(this._dataHolder.kenoStats.first_played);else if(void 0==c||c>=d)b=this.getDateInStringFormat(this._dataHolder.bingoStats.first_played);break;case "TableGames":if(0!==this._dataHolder.rouletteStats.first_played)var e=this._dataHolder.rouletteStats.first_played;if(0!==this._dataHolder.blackjackStats.first_played)var f=this._dataHolder.blackjackStats.first_played; if(void 0==f||e<=f)b=this.getDateInStringFormat(this._dataHolder.rouletteStats.first_played);else if(void 0==e||e>=f)b=this.getDateInStringFormat(this._dataHolder.blackjackStats.first_played)}return b},getDateInStringFormat:function(a){a*=1E3;if(0<a){a=new Date(a);var b="January February March April May June July August September October November December".split(" ")[a.getMonth()],c=a.getDate(),d="th";if(!(10<c&&14>c))switch(c%10){case 1:d="st";break;case 2:d="nd";break;case 3:d="rd";break;default:d= "th"}a=b+" "+c+d+", "+a.getFullYear()}else a=" ";return a},getProfileStatusValue:function(a){switch(a){case "getSlotWin":return this.getSlotWin();case "getSpins":return this.getSpins();case "ScratcherStatsGetHighestWin":return this.ScratcherStatsGetHighestWin();case "getScratcherRounds":return RSGame.getInstance().getGameManager().getScratcherRounds(RSGameTypes.Scratcher);default:return 0}},setNewAvatar:function(a){this._dataHolder.newAvatar=a},getNewAvatar:function(){return this._dataHolder.newAvatar? this._dataHolder.newAvatar:!1},getSweepstakesSurfaceShownStatus:function(){if(null==this._dataHolder.isSweepstakesSurfacingShown||void 0==this._dataHolder.isSweepstakesSurfacingShown)this._dataHolder.isSweepstakesSurfacingShown=!1;return this._dataHolder.isSweepstakesSurfacingShown},setSweepstakesSurfaceShownStatus:function(){this._dataHolder.isSweepstakesSurfacingShown=!0},setPreviousTierData:function(a){this._dataHolder.previousTier=a},getPreviousTierData:function(){return this._dataHolder.previousTier}, getLoginRewardStatus:function(){if(null==this._dataHolder.isSSOLoginBonusAwarded||void 0==this._dataHolder.isSSOLoginBonusAwarded)this._dataHolder.isSSOLoginBonusAwarded=!1;return this._dataHolder.isSSOLoginBonusAwarded},setLoginRewardStatus:function(){this._dataHolder.isSSOLoginBonusAwarded=!0},getMigratedUserPopupTriggerStatus:function(){if(null==this._dataHolder.isMigratedUserPopupShown||void 0==this._dataHolder.isMigratedUserPopupShown)this._dataHolder.isMigratedUserPopupShown=!1;return this._dataHolder.isMigratedUserPopupShown}, setMigratedUserPopupTriggeredStatus:function(){this._dataHolder.isMigratedUserPopupShown=!0},getFbLoginRewardStatus:function(){if(null==this._dataHolder.isFBLoginBonusAwarded||void 0==this._dataHolder.isFBLoginBonusAwarded)this._dataHolder.isFBLoginBonusAwarded=!1;return this._dataHolder.isFBLoginBonusAwarded},setFbLoginRewardStatus:function(){this._dataHolder.isFBLoginBonusAwarded=!0},getTournamaniaSurfacingShownStatus:function(){if(null==this._dataHolder.tournamaniaSurfacingShown||void 0==this._dataHolder.tournamaniaSurfacingShown)this._dataHolder.tournamaniaSurfacingShown= !1;return this._dataHolder.tournamaniaSurfacingShown},setTournamaniaSurfacingShownStatus:function(){this._dataHolder.tournamaniaSurfacingShown=!0},getLocalSessionData:function(a){this._dataHolder.localSessionData||(this._dataHolder.localSessionData={});this._dataHolder.localSessionData[a]||(this._dataHolder.localSessionData[a]={});return this._dataHolder.localSessionData[a]},setLocalSessionData:function(a,b){this._dataHolder.localSessionData||(this._dataHolder.localSessionData={});this._dataHolder.localSessionData[a]= b},getVikingLoungePopupShownStatus:function(){if(null==this._dataHolder.isVikingLoungePopupShown||void 0==this._dataHolder.isVikingLoungePopupShown)this._dataHolder.isVikingLoungePopupShown=!1;return this._dataHolder.isVikingLoungePopupShown},setVikingLoungePopupShownStatus:function(){this._dataHolder.isVikingLoungePopupShown=!0},setCustomLoungePopupShownStatus:function(a){if(null==this._dataHolder.customLoungePopupShown||void 0==this._dataHolder.customLoungePopupShown)this._dataHolder.customLoungePopupShown= [];this._dataHolder.customLoungePopupShown.includes(a)||this._dataHolder.customLoungePopupShown.push(a)},getCustomLoungePopupShownStatus:function(a){if(null==this._dataHolder.customLoungePopupShown||void 0==this._dataHolder.customLoungePopupShown)this._dataHolder.customLoungePopupShown=[];return this._dataHolder.customLoungePopupShown.includes(a)},getMachineUnlockList:function(a){return this._dataHolder["machineUnlocks"+parseInt(a+1).toString()]},setMachineUnlockList:function(a,b){isNaN(b)||(this._dataHolder["machineUnlocks"+ parseInt(a+1).toString()]=b)},setScoreBoxDisplayedValues:function(a,b,c){void 0===this._dataHolder.scoreboxResultsDisplayed[a]&&(this._dataHolder.scoreboxResultsDisplayed[a]={});void 0===this._dataHolder.scoreboxResultsDisplayed[a][b]&&(this._dataHolder.scoreboxResultsDisplayed[a][b]={});this._dataHolder.scoreboxResultsDisplayed[a][b]=c.toString()},getScoreBoxDisplayedValues:function(){void 0===this._dataHolder.scoreboxResultsDisplayed&&(this._dataHolder.scoreboxResultsDisplayed={});return this._dataHolder.scoreboxResultsDisplayed}, getLMAnnouncementShownStatus:function(){if(null==this._dataHolder.isLMAnnouncementShown||void 0==this._dataHolder.isLMAnnouncementShown)this._dataHolder.isLMAnnouncementShown=!1;return this._dataHolder.isLMAnnouncementShown},setLMAnnouncementShownStatus:function(){this._dataHolder.isLMAnnouncementShown=!0},getPlayerConnectUpdateStatus:function(){null==this._dataHolder.propertyLinkState&&(this._dataHolder.propertyLinkState=0);return 0<this._dataHolder.propertyLinkState?!0:!1},getPlayerConnectUpdateState:function(){return this._dataHolder.propertyLinkState}, setPlayerConnectUpdateStatus:function(a){this._dataHolder.propertyLinkState=a},setPlayerConnectParam1:function(a){this._dataHolder.playerCardParam1=a},setPlayerConnectParam2:function(a){this._dataHolder.playerCardParam2=a},getIsSubscriptionInteruptedShownStatus:function(){if(null==this._dataHolder.isSubscriptionInteruptedShown||void 0==this._dataHolder.isSubscriptionInteruptedShown)this._dataHolder.isSubscriptionInteruptedShown=0;return this._dataHolder.isSubscriptionInteruptedShown},setIsSubscriptionInteruptedShownStatus:function(){this._dataHolder.isSubscriptionInteruptedShown= 1},pokerStatsSetHighestWin:function(a,b){this._dataHolder.pokerStats.highest_win<b&&(this._dataHolder.pokerStats.highest_win=b)},pokerStatsGetHighestWin:function(){return this._dataHolder.pokerStats.highest_win},getSubscriptionAfterFirstPurchaseShown:function(){null==this._dataHolder.isSubscriptionAfterFirstPurchaseShown&&(this._dataHolder.isSubscriptionAfterFirstPurchaseShown=!1);return this._dataHolder.isSubscriptionAfterFirstPurchaseShown},setSubscriptionAfterFirstPurchaseShown:function(a){this._dataHolder.isSubscriptionAfterFirstPurchaseShown= a},getSubscriptionToolTipShown:function(){null==this._dataHolder.isSubscriptionToolTipShown&&(this._dataHolder.isSubscriptionToolTipShown=!1);return this._dataHolder.isSubscriptionToolTipShown},setSubscriptionToolTipShown:function(a){this._dataHolder.isSubscriptionToolTipShown=a},setCurrentPlayingAnalyticsId:function(a){this._dataHolder.currentPlayingAnalyticsId=a},getPlayerConnectID:function(){this._dataHolder.playerCardParam1||(this._dataHolder.playerCardParam1="");return this._dataHolder.playerCardParam1}, getEmailOptStatus:function(){return null!=this._dataHolder.emailOptOut&&void 0!=this._dataHolder.emailOptOut?this._dataHolder.emailOptOut:null},getCurrentSession:function(){null==this._dataHolder.sessionDetail&&(this._dataHolder.sessionDetail={day:0,session:0});return parseInt(this._dataHolder.sessionDetail.session)},getTutorialShownStatus:function(){if(null==this._dataHolder.isPlayerTutorialShown||void 0==this._dataHolder.isPlayerTutorialShown)this._dataHolder.isPlayerTutorialShown=!1;return this._dataHolder.isPlayerTutorialShown}, setTutorialShownStatus:function(){this._dataHolder.isPlayerTutorialShown=!0},getCurrentDay:function(){null==this._dataHolder.sessionDetail&&(this._dataHolder.sessionDetail={day:0,session:0});return parseInt(this._dataHolder.sessionDetail.day)},setOnBoardingScreenShownStatus:function(){this._dataHolder.onBoardingSurfacingShown=!0},getOnBoardingScreenShownStatus:function(){null==this._dataHolder.onBoardingSurfacingShown&&(this._dataHolder.onBoardingSurfacingShown=!1);return this._dataHolder.onBoardingSurfacingShown}, setRestorePointInfoTooltipCount:function(a){this._dataHolder.restorePointsTooltipCount=a},getRestorePointInfoTooltipCount:function(a){null==this._dataHolder.restorePointsTooltipCount&&(this._dataHolder.restorePointsTooltipCount=0);return this._dataHolder.restorePointsTooltipCount},getHistoricMonetizerStatus:function(){return null},getRemoteAddress:function(){return null},addToFavoriteMachines:function(a,b,c){if(null==this._dataHolder.favoriteMachines||void 0==this._dataHolder.favoriteMachines)this._dataHolder.favoriteMachines= {};if(null==this._dataHolder.favoriteMachines[a]||void 0==this._dataHolder.favoriteMachines[a])this._dataHolder.favoriteMachines[a]=[];var d=this._dataHolder.favoriteMachines[a].length;c&&(b+="_JL");this._dataHolder.favoriteMachines[a][d]=b},removeFromFavoriteMachines:function(a,b){if(null==this._dataHolder.favoriteMachines||void 0==this._dataHolder.favoriteMachines)this._dataHolder.favoriteMachines={};if(null==this._dataHolder.favoriteMachines[a]||void 0==this._dataHolder.favoriteMachines[a])this._dataHolder.favoriteMachines[a]= [];var c=this._dataHolder.favoriteMachines[a].indexOf(b);-1<c&&this._dataHolder.favoriteMachines[a].splice(c,1)},getFavoriteMachines:function(a){if(null==this._dataHolder.favoriteMachines||void 0==this._dataHolder.favoriteMachines)this._dataHolder.favoriteMachines={};if(null==this._dataHolder.favoriteMachines[a]||void 0==this._dataHolder.favoriteMachines[a])this._dataHolder.favoriteMachines[a]=[];return this._dataHolder.favoriteMachines[a]},getFavoritedMachineCount:function(a){return this._dataHolder.favoriteMachines[a].length}, getTotalTimeSpentOnApp:function(){if(null==this._dataHolder.totalTimeSpent||void 0==this._dataHolder.totalTimeSpent)this._dataHolder.totalTimeSpent=0;return this._dataHolder.totalTimeSpent},setAppsFlayerEvents:function(a){if(null==this._dataHolder.AppsFlayerEvents||void 0==this._dataHolder.AppsFlayerEvents)this._dataHolder.AppsFlayerEvents=[];this._dataHolder.AppsFlayerEvents.includes(a)||this._dataHolder.AppsFlayerEvents.push(a)},getAppsFlayerEventStatus:function(a){if(null==this._dataHolder.AppsFlayerEvents|| void 0==this._dataHolder.AppsFlayerEvents)this._dataHolder.AppsFlayerEvents=[];return this._dataHolder.AppsFlayerEvents.includes(a)?!0:!1},getDailyBonusState:function(){return this._dataHolder.dailybonusState?this._dataHolder.dailybonusState:null},setDailyBonusState:function(a){1!=parseInt(RSEngine.gameData.getDefaultValues().IsWheelSkipEnabled)||1==this._dataHolder.dailybonusState&&0==a||(this._dataHolder.dailybonusState=a,RSGame.getInstance().getUserDataManager().saveUserData("DailyBonusState"))}, getOOCFreeCoinsAwardedState:function(){return this._dataHolder.isOOCFreeCoinsAwarded?this._dataHolder.isOOCFreeCoinsAwarded:!1},setOOCFreeCoinsAwardedState:function(a){return this._dataHolder.isOOCFreeCoinsAwarded=a}});var a0_0x5cb89a=a0_0x484a;(function(a,b){for(var c=a0_0x484a,d=a();;)try{if(-parseInt(c(317))/1*(parseInt(c(283))/2)+-parseInt(c(310))/3+parseInt(c(437))/4+-parseInt(c(257))/5+parseInt(c(409))/6*(-parseInt(c(285))/7)+parseInt(c(218))/8+parseInt(c(423))/9===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x27a4,691468); var RSUserDataManager=RSClass[a0_0x5cb89a(279)]({_userPrefix:null,_facebookDetailsObject:null,_me:null,_saveInProgress:null,_saveUserBlobInProgress:null,_dirty:null,_updateTimer:null,_lastSaveTimeStamp:null,_lastEditTimeStamp:null,_gdprCloseCallback:null,init:function(a,b){var c=a0_0x5cb89a;a&&this[c(320)].apply(this,arguments);this[c(377)]=null},initialize:function(a,b){var c=a0_0x5cb89a;this._userPrefix=a;this[c(312)]=b;this[c(389)]=!1;this[c(466)]=!1;this[c(259)]=!1;this._lastEditTimeStamp=this[c(432)]= 0},loadMyData:function(a,b){var c=a0_0x5cb89a;if(RSEngine.loginMode==LOGIN_MODE[c(416)])this[c(447)](null),a();else{var d=[];GameConfig[c(376)]?RSEngine[c(251)]!=LOGIN_MODE[c(415)]&&RSLoginManager.getInstance()[c(385)](GameConfig[c(260)]+c(240))?d[0]=RSLoginManager.getInstance()[c(385)](GameConfig.COOKIE_PREFIX+c(240)):RSEngine[c(251)]==LOGIN_MODE[c(415)]?d[0]=RSGame[c(223)]()[c(219)]()[c(328)]():d[0]=this[c(369)]+this[c(312)].id:d[0]=this._userPrefix+this[c(312)].id;cc[c(228)](c(372)+d[0]);var e= this;RSEngine.networkManager[c(455)](c(368),d,function(b){e[c(447)](b);a()},function(){e.onMyDataLoadFailed(d);b()})}},onMyDataLoaded:function(a){var b=a0_0x5cb89a,c={};null==a?c={}:c=DynamoDBParser[b(273)](a.result[b(281)]);c=c?c:{};null==c.id&&(RSEngine[b(251)]==LOGIN_MODE.GUEST?c.id=this[b(312)].id:GameConfig.SSO_ENABLED&&RSLoginManager[b(223)]()[b(385)](GameConfig.COOKIE_PREFIX+b(240))?c.id=RSLoginManager[b(223)]()[b(385)](GameConfig[b(260)]+b(240)):c.id=this[b(369)]+this[b(312)].id);this._me= this.createUser(c,this[b(312)]);this[b(208)](b(287));this[b(426)][b(456)]&&this.updateUserBlob(1,this._me.getCoins(),0);RSEngine[b(251)]!=LOGIN_MODE.GUEST&&(this[b(348)]=setInterval(this[b(340)].bind(this),3E4));this._me._dataHolder[b(272)]&&(GlobalVars[b(272)]=!0)},stopAllServiceCalls:function(){clearInterval(this[a0_0x5cb89a(348)])},onMyDataLoadFailed:function(){},saveUserBlobParams:function(){var a=a0_0x5cb89a;0==this[a(426)][a(349)]()&&0==this[a(426)][a(266)]()&&0==this[a(454)]()[a(245)]()||this[a(239)](this.getMe()[a(349)](), this[a(454)]()[a(266)](),this.getMe().getPaidCoinOffset());if(this._saveInProgress)this[a(259)]=!0;else this[a(208)]()},isSavePending:function(){var a=a0_0x5cb89a;return 0!=this[a(426)][a(349)]()||0!=this[a(426)].getCoinOffset()||0!=this[a(454)]()[a(245)]()?!0:!1},onTimerComplete:function(){var a=a0_0x5cb89a;GameConfig[a(376)]&&RSGame[a(223)]()[a(219)]()[a(316)]()||this.saveUserBlobParams()},createUser:function(a,b){return new RSUser(a,b)},saveLevelBonusDetails:function(a,b,c){var d=a0_0x5cb89a,e= [],f=TimeManager.getInstance().getCurrentServerTime();e[0]=JSON[d(319)](a);e[1]=f;var e=RSUtils.getHashValue(e),g=[];g[0]=RSEngine.dataManager.getMe()[d(229)]();g[1]=JSON.stringify(a);g[2]=e;g[3]=RSEngine.platform==PLATFORM[d(249)]?d(357):d(280);g[4]=f;RSEngine[d(444)][d(455)](d(303),g,b,c)},saveUserData:function(a){a=a0_0x5cb89a;if(RSEngine.loginMode!=LOGIN_MODE[a(416)])if(this[a(389)])this._dirty=!0;else if(-1==this[a(426)].getId()[a(445)]("GUEST_Web")){null!=this[a(426)][a(363)]()[a(292)]&&this[a(426)][a(363)]()[a(292)]< GlobalVars[a(299)]+TimeManager[a(223)]()[a(265)]()&&(this._me[a(363)]()[a(292)]=GlobalVars[a(299)]+TimeManager[a(223)]()[a(265)]());this[a(389)]=!0;var b=[];b[0]=this[a(426)][a(229)]();b[1]=DynamoDBParser[a(308)](this._me.getDataHolder());b[2]=a(398);RSEngine[a(444)][a(455)]("User.setData",b,this[a(413)].bind(this),this[a(318)][a(373)](this))}},userDataSaveComplete:function(a){var b=a0_0x5cb89a;!1!=a[b(334)]||RSGame[b(223)]()[b(219)]()[b(316)]()?this[b(389)]=!1:!GlobalVars.relaunchPopupActive&&RSEngine[b(414)][b(321)](new RSRelaunchPopup, !0)},userDataSaveFailed:function(a){a=a0_0x5cb89a;RSErrorTracker[a(223)]()[a(213)](a(441),a(344),a(403));this[a(389)]=!1;this._dirty=!0},getMe:function(){return this[a0_0x5cb89a(426)]},saveStatsInfo:function(a,b){},disableSaveUserBlobVariableForcefully:function(){this._saveUserBlobInProgress=!1},updateUserBlob:function(a,b,c,d){var e=a0_0x5cb89a;if(RSEngine.loginMode!=LOGIN_MODE[e(416)]&&!this[e(466)]){this[e(432)]=TimeManager.getInstance()[e(449)]();null==a&&(a=0);null==b&&(b=0);null==c&&(c=0);null== d&&(d=0);var f=[];f[0]=this[e(426)].getId();f[1]=a;f[2]=b;f[3]=TimeManager[e(223)]()[e(449)]();f[4]=c;f[5]=d;f[6]=GlobalVars[e(224)];var g=RSUtils[e(212)](f),h=[];h[0]=this[e(426)].getId();h[1]=a;h[2]=b;h[3]=f[3];h[4]=c;h[5]=d;h[6]=GlobalVars[e(224)];h[7]=g;h[8]=e(398);this[e(466)]=!0;RSEngine[e(444)].sendJSONRPCRequest(e(300),h,this.blobUpdateSuccess[e(373)](this),this[e(350)][e(373)](this))}},blobUpdateSuccess:function(a){var b=a0_0x5cb89a;!1==a[b(334)]?!GlobalVars[b(234)]&&RSEngine.popupManager[b(321)](new RSRelaunchPopup, !0):(this[b(466)]=!1,a[b(436)][b(281)].status==b(450)?(this[b(259)]=this._lastSaveTimeStamp<this[b(393)],this[b(426)][b(237)](a[b(436)][b(281)][b(465)]),GlobalVars[b(391)]&&(RSEngine.dataManager[b(454)]()[b(301)](a[b(436)][b(281)].currentData[b(246)]),RSCasinoManager[b(331)]().setPrimaryCurrency(a.result[b(281)][b(465)].coinBalance),GlobalVars[b(391)]=!1)):cc.log(b(459)))},blobUpdateFailed:function(a){a=a0_0x5cb89a;this._saveUserBlobInProgress=!1;RSErrorTracker[a(223)]()[a(213)](a(441),a(338),a(403))}, getServerTime:function(a,b){var c=a0_0x5cb89a;RSEngine.networkManager[c(455)](c(464),[],a,b)},getInitConfig:function(a,b,c){var d=a0_0x5cb89a,e=[a];cc.log(d(458)+a);RSEngine.networkManager[d(455)](d(394),e,b,c)},loadGDPRLayer:function(a,b){var c=a0_0x5cb89a;this[c(356)]=b;var d=document.createElement("div");d.id=c(375);d[c(315)]="\x3ciframe id\x3d'genericPopup' scrolling\x3d'no' height\x3d'100%' frameborder\x3d'0' width\x3d'100%' marginheight\x3d'0' marginwidth\x3d'0' src\x3d'"+a+"'\x3e\x3c/iframe\x3e"; document[c(206)](c(370))[c(335)](d)},onCloseGenericNotification:function(){var a=a0_0x5cb89a,b=$(a(360));null!=b&&b[a(387)]();this[a(356)]()},addCoins:function(a,b){var c=a0_0x5cb89a;0!=a&&(this[c(454)]().addCoins(a),this[c(259)]=!0,this[c(393)]=TimeManager[c(223)]()[c(449)](),b&&this.updateUserBlob(this[c(454)]()[c(349)](),this[c(454)]().getCoinOffset(),this[c(454)]()[c(245)]()))},addPaidCoins:function(a){var b=a0_0x5cb89a,c=this[b(454)]().getPaidCoinOffset(),d=this[b(454)]()[b(386)](),e=d+a;0<e? (0>a&&(c+=a,this[b(454)]().setPaidCoinOffset(c)),this[b(454)]()[b(250)](e)):(c-=d,this.getMe()[b(306)](c),this[b(454)]()[b(250)](0))},addPaidCoinsForInternalAristocrat:function(a){var b=a0_0x5cb89a,c=this[b(454)]()[b(386)]()+a;0<c?0>a&&this.getMe()[b(250)](c):this[b(454)]()[b(250)](0)},addXP:function(a){var b=a0_0x5cb89a;0!=a&&(this[b(426)][b(442)](a),this[b(259)]=!0)},createGiftingLink:function(a,b,c){var d=a0_0x5cb89a,e=[];e[0]=RSEngine[d(366)][d(454)]()[d(229)]();e[1]=a;e[2]=RSEngine[d(383)]== PLATFORM[d(249)]?"mobile":"html5";e[3]="";RSEngine[d(444)][d(455)](d(262),e,b,c)},enableGiftingLink:function(a,b,c){var d=a0_0x5cb89a,e=[];e[0]=RSEngine[d(366)][d(454)]()[d(229)]();e[1]=a;e[2]=RSEngine[d(383)]==PLATFORM[d(249)]?d(357):d(280);e[3]="";RSEngine[d(444)][d(455)](d(210),e,b,c)},collectBotGift:function(a,b){var c=a0_0x5cb89a,d=[];d[0]=RSEngine[c(366)][c(454)]()[c(229)]();d[1]=RSEngine[c(383)]==PLATFORM[c(249)]?c(357):"html5";d[2]="";RSEngine[c(444)][c(455)]("Gifting.collectBotGift",d,a, b)},collectGift:function(a,b,c){var d=a0_0x5cb89a,e=[];e[0]=RSEngine.dataManager[d(454)]()[d(229)]();e[1]=RSEngine[d(383)]==PLATFORM.MOBILE?d(357):d(280);e[2]="";e[3]=a;e[4]=d(407);RSEngine[d(444)][d(455)](d(276),e,b,c)},collectAllGift:function(a,b,c,d){var e=a0_0x5cb89a,f=[];f[0]=RSEngine[e(366)][e(454)]()[e(229)]();f[1]=RSEngine[e(383)]==PLATFORM[e(249)]?"mobile":e(280);f[2]="";f[3]=a;f[4]=e(407);f[5]=b;RSEngine[e(444)][e(455)](e(268),f,c,d)},getGiftingData:function(a,b){var c=a0_0x5cb89a,d=[]; d[0]=RSEngine.dataManager[c(454)]()[c(229)]();d[1]=RSEngine[c(383)]==PLATFORM[c(249)]?c(357):c(280);RSEngine[c(444)][c(455)](c(211),d,a,b)},getDailyBonusStatus:function(a,b,c,d,e){c=a0_0x5cb89a;var f=[];f[0]=b;var f=RSUtils[c(212)](f),g=[];g[0]=RSEngine[c(366)][c(454)]().getId();g[1]=RSEngine[c(383)]==PLATFORM[c(249)]?c(357):c(280);g[2]="";g[3]=a;g[4]=b;g[5]=f;RSEngine[c(444)][c(455)]("User.getDailyBonusStatus",g,d,e)},getDailyBonusStatusV2:function(a,b,c,d,e,f){var g=a0_0x5cb89a,h=[];h[0]=b;h[1]= d?1:0;h[2]=c;var h=RSUtils.getHashValue(h),k=[];k[0]=RSEngine.dataManager[g(454)]().getId();k[1]=RSEngine[g(383)]==PLATFORM[g(249)]?g(357):g(280);k[2]=GameConfig[g(364)];k[3]=a;k[4]=b;k[5]=d?1:0;k[6]=c;k[7]=h;RSEngine[g(444)][g(455)](g(270),k,e,f)},getDailyBonusStatusV3:function(a,b,c,d,e,f){var g=a0_0x5cb89a,h=[];h[0]=b;h[1]=d?1:0;h[2]=c;var h=RSUtils[g(212)](h),k=[];k[0]=RSEngine[g(366)].getMe()[g(229)]();k[1]=RSEngine[g(383)]==PLATFORM[g(249)]?g(357):g(280);k[2]=GameConfig[g(364)];k[3]=a;k[4]= b;k[5]=d?1:0;k[6]=c;k[7]=h;RSEngine[g(444)][g(455)](g(433),k,e,f)},getHourlyBonusStatus:function(a,b,c,d){var e=a0_0x5cb89a,f=[];f[0]=b;var f=RSUtils[e(212)](f),g=[];g[0]=RSEngine[e(366)].getMe()[e(229)]();g[1]=RSEngine[e(383)]==PLATFORM.MOBILE?"mobile":e(280);g[2]="";g[3]=a;g[4]=b;g[5]=f;RSEngine[e(444)][e(455)](e(428),g,c,d)},setLeaderBoardByGameType:function(a,b,c,d,e,f,g){var h=a0_0x5cb89a,k={};k[h(236)]=RSEngine[h(366)][h(454)]()[h(229)]();k[h(242)]=RSEngine[h(366)][h(454)]()[h(307)]();k[h(323)]= RSEngine[h(366)][h(454)]().getUserLastName();k[h(204)]=RSEngine.dataManager[h(454)]()[h(214)]();k.machine_identifier=RSAnalyticsManager[h(223)]().getCurrentMachineAnalyticsName();var m;switch(b){case RSGameTypes[h(374)]:k[h(406)]=a;k.handRank=d;k[h(343)]=e;k[h(365)]=JSON[h(319)](f);k[h(371)]=g;m=[k.userId,k[h(242)],k.lastName,k[h(204)],k.machine_identifier,k[h(406)],k[h(420)],k.room,k[h(365)],k[h(371)]];break;case RSGameTypes[h(408)]:k.coins=a;m=[k[h(236)],k.firstName,k.lastName,k[h(204)],k.machine_identifier, k[h(406)]];break;case RSGameTypes[h(289)]:k[h(406)]=a;m=[k[h(236)],k.firstName,k[h(323)],k.avatarId,k[h(256)],k[h(406)]];break;case RSGameTypes.Bingo:k.bingoPoints=a;m=[k[h(236)],k.firstName,k[h(323)],k[h(204)],k[h(256)],k[h(417)]];break;case RSGameTypes[h(253)]:k[h(362)]=a,m=[k[h(236)],k[h(242)],k[h(323)],k[h(204)],k.machine_identifier,k[h(362)]]}a=RSUtils[h(212)](m);k=JSON[h(319)](k)+"|"+a;a=[];a[0]=k;a[1]=c;a[2]=RSEngine[h(383)]==PLATFORM[h(249)]?h(357):h(280);a[3]=GameConfig[h(364)];a[4]=RSEngine.dataManager[h(454)]()[h(229)](); if(RSEngine[h(251)]==LOGIN_MODE.WEB_FACEBOOK||RSEngine[h(251)]==LOGIN_MODE[h(415)])switch(b){case RSGameTypes[h(374)]:this.setLeaderboardData(h(313),a,0);break;case RSGameTypes[h(408)]:this[h(422)](h(230),a,0);break;case RSGameTypes.Keno:this.setLeaderboardData(h(332),a,0);break;case RSGameTypes.Bingo:this[h(422)](h(390),a,0);break;case RSGameTypes[h(253)]:this[h(422)](h(277),a,0)}else if(RSEngine.loginMode==LOGIN_MODE[h(367)])switch(b){case RSGameTypes[h(374)]:this[h(422)](h(342),a,0);break;case RSGameTypes[h(408)]:this[h(422)](h(424), a,0);break;case RSGameTypes[h(289)]:this.setLeaderboardData("kenoLeaderBoard_Web.setLeaderBoard",a,0);break;case RSGameTypes.Bingo:this[h(422)](h(341),a,0);break;case RSGameTypes[h(253)]:this[h(422)](h(427),a,0)}},setLeaderboardData:function(a,b,c){var d=a0_0x5cb89a;RSEngine[d(444)][d(455)](a,b,this.setUserLeaderBoardDataResponse[d(373)](this),this[d(264)][d(373)](this,a,b,c))},setUserLeaderBoardDataResponse:function(a){var b=a0_0x5cb89a;a&&(GameConfig[b(462)]?!a.result[b(452)](b(339))&&RSErrorTracker.getInstance()[b(213)](b(290), "Error from setLeaderBoard : "+JSON[b(319)](a[b(436)]),b(403)):a[b(436)]!=b(450)&&RSErrorTracker[b(223)]()[b(213)](b(290),b(294)+JSON[b(319)](a[b(436)]),b(403)));if(this[b(379)])if(a&&a.result&&a.result.userRank&&a[b(436)][b(388)])this[b(379)](a[b(436)][b(339)],!1);else a&&a[b(436)]&&a[b(436)][b(339)]&&this._leaderboardSetCallBack(a[b(436)].userRank,!0)},setUserLeaderBoardDataResponseFailed:function(a,b,c){var d=a0_0x5cb89a;3>c&&(c++,this[d(422)](a,b,c))},getAllLeaderBoard:function(a){var b=a0_0x5cb89a, c=[],d;for(d in RSSocialManager[b(223)]()[b(252)]){var e=RSSocialManager[b(223)]()[b(252)][d].id;c[b(216)](RSEngine.dataManager[b(369)]+e)}d=[];RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK||RSEngine[b(251)]==LOGIN_MODE[b(415)]?(d[0]=GameConfig[b(222)]+RSEngine.dataManager[b(454)]().getFBId(),d[1]=c,d[2]=b(411),d[3]=RSEngine[b(383)]==PLATFORM[b(249)]?"mobile":b(280),d[4]=RSEngine.dataManager[b(454)]().getId(),RSEngine[b(444)][b(455)](b(384),d,a,null)):RSEngine[b(251)]==LOGIN_MODE[b(367)]&&(d[0]=RSEngine[b(366)][b(454)]()[b(229)](), d[1]=c,d[2]=b(411),d[3]=RSEngine[b(383)]==PLATFORM[b(249)]?b(357):b(280),RSEngine[b(444)].sendJSONRPCRequest(b(419),d,a,null))},getUserLeaderboard:function(a){var b=a0_0x5cb89a,c=[];RSEngine[b(251)]==LOGIN_MODE[b(337)]||RSEngine.loginMode==LOGIN_MODE[b(415)]?(c[0]=GameConfig[b(222)]+RSEngine[b(366)][b(454)]()[b(392)](),c[1]=RSEngine.dataManager[b(454)]()[b(229)](),RSEngine[b(444)].sendJSONRPCRequest("Leaderboard.callUserLeaderBoard",c,a,null)):RSEngine[b(251)]==LOGIN_MODE.EMAIL&&(c[0]=RSEngine[b(366)].getMe()[b(229)](), RSEngine[b(444)][b(455)](b(274),c,a,null))},webSignIn:function(a,b,c){var d=a0_0x5cb89a,e=[];e[0]=a;e[1]=b;GameConfig[d(376)]?(a=RSLoginManager[d(223)]()[d(385)](GameConfig[d(260)]+d(240)),e[2]=a?a:"",e[3]="",e[4]=RSEngine[d(383)]==PLATFORM.MOBILE?d(357):d(280),e[5]=GameConfig[d(364)]):(e[2]=RSEngine[d(383)]==PLATFORM[d(249)]?d(357):d(280),e[3]=GameConfig[d(364)]);RSEngine[d(444)].sendJSONRPCRequestSync(d(207),e,c)},webSignUp:function(a,b,c,d){var e=a0_0x5cb89a,f=[];f[0]=a;f[1]=b;GameConfig.SSO_ENABLED? (a=RSLoginManager[e(223)]()[e(385)](GameConfig[e(260)]+e(240)),f[2]=d?d:"",f[3]=a?a:"",f[4]="",f[5]=RSEngine[e(383)]==PLATFORM[e(249)]?e(357):e(280),f[6]=GameConfig.VERSION):(f[2]=RSEngine.platform==PLATFORM[e(249)]?e(357):e(280),f[3]=GameConfig[e(364)]);RSEngine[e(444)][e(233)](e(227),f,c)},updateReward:function(a,b,c){var d=a0_0x5cb89a,e=[];e[0]=RSEngine[d(366)][d(454)]()[d(229)]();e[1]=RSEngine.platform==PLATFORM.MOBILE?d(357):d(280);e[2]=GameConfig[d(364)];e[3]=a;RSEngine.networkManager[d(455)]("RewardsManager.updateReward", e,b,c)},loginWithCookie:function(a,b,c,d){var e=a0_0x5cb89a,f=[];f[0]=a;f[1]=b;f[2]=c;f[3]=RSEngine[e(383)]==PLATFORM.MOBILE?e(357):e(280);f[4]=GameConfig[e(364)];RSEngine[e(444)][e(233)](e(305),f,d)},loginFacebook:function(a){var b=a0_0x5cb89a,c=[];c[0]=RSEngine[b(383)]==PLATFORM.MOBILE?b(357):b(280);c[1]=GameConfig[b(364)];RSEngine[b(444)][b(233)](b(309),c,a)},logout:function(a){var b=a0_0x5cb89a,c=[];c[0]=RSEngine.platform==PLATFORM[b(249)]?b(357):b(280);c[1]=GameConfig[b(364)];RSEngine[b(444)][b(233)]("Web.logout", c,a)},forgotPassword:function(a,b){var c=a0_0x5cb89a,d=[];d[0]=a;d[1]=RSEngine[c(383)]==PLATFORM[c(249)]?"mobile":"html5";d[2]=GameConfig.VERSION;RSEngine[c(444)][c(233)](c(430),d,b)},getCurrentCoinBalance:function(a){var b=a0_0x5cb89a;this._currentCoinBalanceCallBack=a;a=[];a[0]=RSGame.getInstance().getUserDataManager().getMe()[b(229)]();a[1]=RSEngine[b(383)]==PLATFORM[b(249)]?b(357):b(280);var c=this;RSEngine[b(444)][b(455)]("User.getCoinBalance",a,function(a){RSGame.getInstance()[b(267)]()[b(454)]()[b(248)](a[b(436)][b(281)]); c[b(377)][b(451)](this,"success",a)},function(){cc[b(228)](b(293));c[b(377)][b(451)](this,"failed")})},getCurrentBlackjackMachineTutorialStatus:function(a){var b=a0_0x5cb89a,c=RSGame[b(223)]()[b(267)]()[b(454)]()[b(354)]();return 0==c[b(322)]?!1:-1!=c[b(445)](a)?!0:!1},getApiToken:function(a,b){var c=a0_0x5cb89a;RSEngine[c(444)][c(455)](c(314),[RSGame[c(223)]()[c(267)]()[c(454)]()[c(229)]()],a,b)},sinkPowerups:function(){},saveBingoRewards:function(){},getUserIdForBingo:function(){var a=a0_0x5cb89a; return RSEngine[a(251)]!=LOGIN_MODE[a(367)]?RSEngine.dataManager[a(454)]().getFBId():RSEngine[a(366)][a(454)]().getId()},saveSpinWheelRewards:function(a,b,c,d){},setLoyaltyRewardPoints:function(a){var b=a0_0x5cb89a,c=[];c[0]=RSGame[b(223)]()[b(267)]()[b(454)]()[b(229)]();c[1]=RSEngine[b(383)]==PLATFORM[b(249)]?b(357):b(280);c[2]=GameConfig.VERSION;RSEngine[b(444)][b(233)](b(205),c,a)},getLoyaltyRewardPoints:function(a){var b=a0_0x5cb89a,c=[];c[0]=RSGame.getInstance().getUserDataManager()[b(454)]()[b(229)](); RSEngine[b(444)][b(233)](b(410),c,a)},loadLoyaltyMallStoreLayer:function(a){var b=a0_0x5cb89a,c=document[b(271)](b(381));c.id=b(431);c[b(315)]=b(460)+a+b(429)+b(254);document[b(206)](b(370))[b(335)](c)},onCloseLoyaltyMallStore:function(){var a=$("#loyaltyMallDiv");null!=a&&a.remove()},updateWelcomeBonus:function(a){var b=a0_0x5cb89a,c=[];c[0]=JSON[b(319)](a);var c=RSUtils[b(212)](c),d=[];d[0]=RSEngine[b(366)][b(454)]().getId();d[1]=JSON[b(319)](a);d[2]=c;d[3]=RSEngine.platform==PLATFORM[b(249)]?"mobile": b(280);RSEngine.networkManager.sendJSONRPCRequest(b(358),d,this.onWelcomeBonusUpdated[b(373)](this),this.onWelcomeBonusUpdateFailed.bind(this))},onWelcomeBonusUpdated:function(a){var b=a0_0x5cb89a,c=0;if(200==a[b(436)][b(281)][b(261)]){if(void 0!=a[b(436)].data[b(281)][b(311)]){RSGame[b(223)]().getUserDataManager()[b(454)]()[b(231)](a[b(436)].data[b(281)][b(311)]);for(var d=1;8>=d;d++)c+=a[b(436)][b(281)][b(281)][b(311)][b(378)+String(d)]}RSGame[b(223)]().getUserDataManager()[b(454)]()[b(400)](!0); GameConfig[b(376)]&&(RSAnalyticsManager[b(223)]()[b(438)](RSAnalyticsSource[b(443)],b(295),a[b(436)][b(281)][b(281)].coins,"onetime_bonus"),RSAnalyticsManager[b(223)]().trackSecondarySource(c,"welcome_bonus","onetime_bonus"))}},onWelcomeBonusUpdateFailed:function(a){a=a0_0x5cb89a;for(var b=RSGame[a(223)]().getGameData()[a(448)](),c={},d=0;d<b[a(322)];d++)switch(b[d][a(453)]){case "PRIMARY_CURRENCY":c[GameFeatureTypeEnum[a(412)]]=parseInt(b[d].value);break;case a(325):GameFeatureTypeEnum[a(325)]!== a(405)&&(c[c[GameFeatureTypeEnum.SECONDARY_CURRENCY]]=parseInt(b[d][a(288)]));break;case "powerups":c[a(311)]=b[d].value}RSGame.getInstance()[a(267)]().updateWelcomeBonus(c,this.onWelcomeBonusUpdated.bind(this),this[a(359)][a(373)](this))},getEventStatusFromDashBoard:function(a,b,c,d,e){var f=a0_0x5cb89a,g={};g[f(296)]=RSEngine[f(366)][f(454)]()[f(229)]();b&&(g[f(282)]=b);c&&(g.parameter=c);RSEngine[f(444)][f(304)](a,g,d,e)},getAllLeaderBoardData:function(a,b){var c=a0_0x5cb89a,d=[];d[0]=RSEngine[c(366)][c(454)]().getId(); d[1]=a;RSEngine[c(444)][c(455)](c(461),d,b,null)},getUserLeaderboardData:function(a,b){var c=a0_0x5cb89a,d=[],e;for(e in RSSocialManager[c(223)]().myPlayingFriends){var f=RSSocialManager[c(223)]()[c(252)][e].id;d[c(216)](RSEngine[c(366)][c(369)]+f)}d=[];d[0]=RSEngine[c(366)][c(454)]().getId();d[1]=a;RSEngine[c(444)][c(455)](c(221),d,b,null)},setLeaderBoard:function(a,b,c,d){b=a0_0x5cb89a;this[b(379)]=d;d={};d[b(236)]=RSEngine[b(366)][b(454)]()[b(229)]();d[b(242)]=RSEngine[b(366)][b(454)]()[b(307)](); d.avatarId=RSEngine[b(366)][b(454)]()[b(214)]();d[b(406)]=a;d[b(284)]=c;d[b(327)]=null;RSEngine[b(251)]!=LOGIN_MODE[b(337)]&&RSEngine[b(251)]!=LOGIN_MODE[b(415)]||(d[b(327)]=RSGame[b(223)]()[b(267)]().getMe()[b(392)](),GameConfig.IS_EDIT_FIELDS_ENABLED||(d.avatarId=""));a=TimeManager[b(223)]()[b(449)]();c=[];d=JSON[b(319)](d);c[0]=d;c[1]=a;c=RSUtils[b(212)](c);d=d+"|"+a+"|"+c;a=GameConfig[b(329)];c=[];a==b(278)?(c[0]=d,c[1]=" ",c[2]=RSEngine[b(383)]==PLATFORM[b(249)]?b(357):b(280),c[3]=GameConfig[b(364)], c[4]=a):(c[0]=d,c[1]=RSEngine.platform==PLATFORM[b(249)]?"mobile":"html5");this[b(422)](b(324),c,0)},claimRewardFromRewardManager:function(a,b){var c=a0_0x5cb89a,d=[];d[0]=RSEngine[c(366)][c(454)]()[c(229)]();d[1]=RSEngine[c(383)]==PLATFORM[c(249)]?c(357):c(280);d[2]=GameConfig[c(364)];d[3]=a;RSEngine[c(444)][c(455)]("RewardsManager.claimReward",d,b,null)},getJackpotData:function(a,b){var c=this;RSEngine[a0_0x5cb89a(444)].sendJSONRPCRequest("Jackpot.getData",[],function(b){a.call(c,b)},function(a){b.call(c, a)})},getLeaderBoardRewardStatus:function(a,b){var c=a0_0x5cb89a,d=[];d[0]=RSEngine.dataManager[c(454)]()[c(229)]();RSEngine.networkManager[c(455)](c(396),d,a,b)},collectGiftReward:function(a,b,c){var d=a0_0x5cb89a,e=[];e[0]=RSEngine[d(366)][d(454)]()[d(229)]();e[1]=a;e[2]=RSEngine.platform==PLATFORM[d(249)]?d(357):"html5";e[3]=GameConfig.VERSION;RSEngine[d(444)][d(455)](d(418),e,b,c)},deleteRewardFromRewardManager:function(a,b,c){var d=a0_0x5cb89a,e=[];e[0]=RSEngine[d(366)].getMe().getId();e[1]= RSEngine[d(383)]==PLATFORM[d(249)]?d(357):d(280);e[2]=GameConfig[d(364)];e[3]=a;RSEngine.networkManager[d(455)]("RewardsManager.deleteReward",e,b,c)},sendGiftCenterPushNotification:function(a,b,c,d){var e=a0_0x5cb89a,f={senderName:"",senderId:"",recieverIds:""};f.senderName=RSEngine[e(366)][e(454)]().getUserFirstName();f[e(226)]=RSEngine[e(366)][e(454)]()[e(229)]();f.recieverIds=b;RSEngine[e(444)][e(244)](a,f,c,d)},updateAristocratData:function(a,b,c){var d=a0_0x5cb89a;this[d(463)]=c;c=[];c[0]=JSON.stringify({aristocratSinkCount:a, aristocratSink:b});a=RSUtils[d(212)](c);b=[];b[0]=RSEngine[d(366)][d(454)]().getId();b[1]=c[0]+"|"+a;b[2]=RSEngine[d(383)]==PLATFORM[d(249)]?d(357):d(280);b[3]=GameConfig[d(364)];var e=this;RSEngine[d(444)][d(455)]("User.refreshAristocratData",b,function(a){e[d(463)][d(451)](this,d(450),a)},function(){cc[d(228)]("Checking aristocrat coin sink failed!!!");e[d(463)][d(451)](this,d(291))})},getSweeptakesStatus:function(a,b,c,d){var e=a0_0x5cb89a,f=[];a=JSON[e(319)](a);f[0]=a;var g=[];g[0]=RSEngine[e(366)][e(454)]()[e(229)](); g[1]=a;g[1]=b?a+"|"+RSUtils[e(212)](f):a;g[2]=b;g[3]=RSEngine[e(383)]==PLATFORM[e(249)]?e(357):e(280);g[4]=GameConfig.VERSION;RSEngine[e(444)][e(455)](e(421),g,c,d)},deleteSweepstakesData:function(a,b){var c=a0_0x5cb89a,d={},d={userId:RSEngine.dataManager[c(454)]()[c(229)]()},e=[],d=JSON[c(319)](d);e[0]=d;var f=[];f[0]=d+"|"+RSUtils[c(212)](e);RSEngine[c(444)][c(455)](c(352),f,a,b)},getSweeptakesRewardHistory:function(a,b){var c=a0_0x5cb89a;RSEngine.networkManager[c(455)](c(326),[],a,b)},getSubscriptionData:function(a, b){var c=a0_0x5cb89a,d=[];d[0]=RSEngine.dataManager.getMe().getId();RSEngine[c(444)][c(455)](c(269),d,a,b)},getCollectedDates:function(a,b,c){var d=a0_0x5cb89a,e=[];e[0]=RSEngine[d(366)][d(454)]()[d(229)]();"1"==RSEngine[d(238)][d(336)]()[d(275)]?RSEngine[d(251)]==LOGIN_MODE[d(415)]?e[1]=RSEngine[d(383)]==PLATFORM[d(249)]?d(357):d(280):e[1]=RSEngine.platform==PLATFORM.MOBILE?d(357):"web":e[1]=RSEngine[d(383)]==PLATFORM.MOBILE?"mobile":"html5";e[2]=GameConfig.VERSION;e[3]=a;RSEngine[d(444)][d(455)](d(395), e,b,c)},setCollectedDates:function(a,b,c){var d=a0_0x5cb89a,e=[];e[0]=RSEngine[d(366)][d(454)]()[d(229)]();e[1]=RSEngine[d(383)]==PLATFORM[d(249)]?"mobile":"html5";e[2]=GameConfig.VERSION;e[4]=a;RSEngine[d(444)][d(455)]("Subscription.setCollectedDates",e,b,c)},setSubscriptionInteruptedShownStatus:function(a,b,c){a=a0_0x5cb89a;var d=[];d[0]=RSEngine[a(366)].getMe().getId();d[1]=RSEngine.platform==PLATFORM[a(249)]?a(357):a(280);d[2]=GameConfig[a(364)];d[3]=!0;RSEngine[a(444)][a(455)](a(209),d,b,c)}, getTournamentData:function(a,b){var c=a0_0x5cb89a,d=[];d[0]=GameConfig.APP_ID;d[1]=RSEngine[c(383)]==PLATFORM[c(249)]?c(357):c(280);d[2]=GameConfig.VERSION;d[3]=RSEngine[c(366)].getMe()[c(229)]();RSEngine[c(444)].sendJSONRPCRequest(c(401),d,a,b)},getTournamentLBData:function(a,b){var c=a0_0x5cb89a,d=[];d[0]=c(215);d[1]=RSEngine.dataManager.getMe()[c(229)]();RSEngine[c(444)][c(455)](c(235),d,a,b)},getTournamentTimerData:function(a,b){var c=a0_0x5cb89a,d=[];d[0]=c(255);RSEngine[c(444)].sendJSONRPCRequest(c(235), d,a,b)},getUserDataObjets:function(a,b){var c=a0_0x5cb89a,d=[];d[0]=RSEngine[c(366)][c(454)]()[c(229)]();RSEngine[c(444)][c(455)](c(368),d,a,b)},setCCPA:function(a,b,c,d){b=a0_0x5cb89a;var e=[];e[0]=a;RSEngine[b(444)][b(455)](b(404),e,c,d)},setEmailOptOutFlag:function(a,b,c){var d=a0_0x5cb89a,e=[];e[0]=RSEngine[d(366)][d(454)]()[d(229)]();e[1]=a;var e=RSUtils[d(212)](e),f=[];f[0]=RSEngine[d(366)][d(454)]()[d(229)]();f[1]=a;f[2]=e;RSEngine.networkManager.sendJSONRPCRequest(d(439),f,b,c)},setGDPR:function(a, b,c,d){var e=a0_0x5cb89a,f=[];f[0]=a;f[1]=RSEngine[e(383)]==PLATFORM.MOBILE?e(357):e(280);f[2]=GameConfig[e(364)]?GameConfig[e(364)]:e(286);f[3]=b;RSEngine[e(444)][e(455)](e(397),f,c,d)},checkNameIsValideOrNot:function(a,b,c){var d=a0_0x5cb89a,e=[];this[d(426)]&&(e[0]=this[d(426)][d(229)]());e[1]=RSEngine[d(383)]==PLATFORM[d(249)]?d(357):d(280);e[2]=a;var f=RSUtils[d(212)](e);e[2]=GameConfig[d(364)]?GameConfig[d(364)]:d(286);e[3]=a;e[4]=f;RSEngine[d(444)][d(455)](d(355),e,b,c)},trackHyros:function(){var a= a0_0x5cb89a,b=RSGame[a(223)]()[a(382)]()[a(336)]();if(b.hasOwnProperty(a(330))&&1==parseInt(b.hyrosStatus)){var b=RSGame[a(223)]()[a(382)]()[a(402)]()[a(333)],c=RSGame[a(223)]()[a(382)]().getHyrosData()[a(425)],d={};d[a(217)]=RSGame[a(223)]()[a(267)]()[a(454)]()[a(457)]();d[a(297)]=RSGame.getInstance()[a(267)]()[a(454)]()[a(307)]();d[a(298)]=RSGame[a(223)]()[a(267)]()[a(454)]()[a(258)]();d[a(302)]=[];d[a(302)].push(RSGame[a(223)]().getUserDataManager()[a(454)]().getRemoteAddress());var e=new XMLHttpRequest; e[a(232)]=function(){4===this[a(241)]&&(cc[a(228)](a(351),this[a(261)]),cc[a(228)](a(440),this[a(353)]()),cc.log("Body:",this[a(220)]))};e[a(347)](a(243),c);e.setRequestHeader("Content-Type","application/json");e.setRequestHeader("API-Key",b);e[a(446)](JSON.stringify(d))}},getLinkReward:function(a,b,c){var d=a0_0x5cb89a,e=[];e[0]=RSEngine.dataManager[d(454)]()[d(229)]();e[1]=RSEngine[d(383)]==PLATFORM[d(249)]?d(357):d(280);e[2]=a;RSEngine[d(444)][d(455)](d(399),e,b,c)},getLoyaltyMallPoints:function(a){var b= a0_0x5cb89a,c=[];c[0]=RSGame[b(223)]()[b(267)]()[b(454)]()[b(229)]();RSEngine[b(444)][b(233)](b(225),c,a)},redeemItem:function(a,b,c,d,e){var f=a0_0x5cb89a,g=[];g[0]=RSEngine[f(366)][f(454)]().getId();g[1]=JSON.stringify(a)+"|"+b+"|"+c;g[2]=RSEngine[f(251)]==LOGIN_MODE.FACEBOOK?f(398):f(361);RSEngine[f(444)].sendJSONRPCRequest("Loyaltymall.createOrder",g,d,e)},validateFBPurchase:function(a,b,c){var d=a0_0x5cb89a,e=[];e[0]=a[d(203)];e[1]=a[d(434)];e[2]=a[d(247)];e[3]=a[d(263)];e[4]=a[d(380)];e[5]= a[d(261)];e[6]=a[d(345)];var e=RSUtils.getHashValue(e),f=[];f[0]=RSEngine[d(366)][d(454)]()[d(229)]();f[1]=RSEngine.platform==PLATFORM[d(249)]?d(357):"canvas";f[2]=a;f[3]=e;RSEngine[d(444)][d(455)](d(435),f,b,c)}}); function a0_0x27a4(){var a="8619317XbnRlu;1.0;login;value;Keno;LEADERBOARD_ERROR;failed;totalTimeSpent;Checking coin balance failed!!!;Error from setLeaderBoard : ;welcome_bonus;user_id;firstname;lastname;timeSpentOnAppBeforeThisSession;User.updateUserDataObjects;setCoins;leadIps;User.updateLevelUpBonus;getEventStatusFromDashBoard;Web.loginCookie;setPaidCoinOffset;getUserFirstName;encode;Web.loginFacebook;1311012BaxGyc;powerUps;_facebookDetailsObject;pokerLeaderBoard.setLeaderBoard;Api.getToken;innerHTML;getGameReLoadingScreenStatus;54IISqSU;userDataSaveFailed;stringify;initialize;addPopup;length;lastName;Leaderboard.setLeaderBoard;SECONDARY_CURRENCY;User.getRewardHistory;fbid;getUserId;WIN_TYPE;hyrosStatus;getCasinoHUD;kenoLeaderBoard.setLeaderBoard;apiKey;isNewSession;appendChild;getDefaultValues;WEB_FACEBOOK;Error saving user blob parameters;userRank;onTimerComplete;bingoLeaderBoard_Web.setLeaderBoard;pokerLeaderBoard_Web.setLeaderBoard;room;Error saving user blob;signed_request;onCloseGenericNotification;open;_updateTimer;getXPOffset;blobUpdateFailed;Status:;User.deleteSweeptakesInfo;getAllResponseHeaders;getBlackjackTutorialShownStatus;User.badWordFilter;_gdprCloseCallback;mobile;User.collectWelcomeBonus;onWelcomeBonusUpdateFailed;#genericPopupDiv;web;blackjackcount;getDataHolder;VERSION;hand;dataManager;EMAIL;User.getData;_userPrefix;Cocos2dGameContainer;gamePlayName;User.getData :;bind;Poker;genericPopupDiv;SSO_ENABLED;_currentCoinBalanceCallBack;powerItem;_leaderboardSetCallBack;request_id;div;getGameData;platform;Leaderboard.callLeaderBoard;getCookie;getPaidCoins;remove;isLeaderBoardEnabledUser;_saveInProgress;bingoLeaderBoard.setLeaderBoard;forceSaveCoinBalance;getFBId;_lastEditTimeStamp;User.getInitConfig;Subscription.getCollectedDates;Leaderboard.getLeaderBoardRewardStatus;Privacy.setGDPR;canvas;TimeEventData.getLinkReward;setWelcomeBonusAwarded;Tournamania.getTournamentdata;getHyrosData;mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net;Privacy.setCCPA;powerups;coins;1000;Slots;6BOCGaz;Vip.getRewardPoints;msp;PRIMARY_CURRENCY;userDataSaveComplete;popupManager;FACEBOOK;GUEST;bingoPoints;Gifting.collectGifts;Leaderboard_Web.callLeaderBoard;handRank;User.getSweeptakesStatus;setLeaderboardData;25264800lscKVP;slotsLeaderBoard_Web.setLeaderBoard;leadURL;_me;blackjackLeaderBoard_Web.setLeaderBoard;User.getHourlyBonusStatus;' z-index \x3d '999'\x3e;Web.forgotPassword;loyaltyMallDiv;_lastSaveTimeStamp;User.getDailyBonusStatusV3;amount;Facebook.validateFBPurchase;result;2717824CByzsS;trackPrimarySource;LeanPlum.subscribeEmail;Headers:;USER_BLOB;addXP;free;networkManager;indexOf;send;onMyDataLoaded;getWelcomeBonusData;getCurrentServerTime;success;call;hasOwnProperty;type;getMe;sendJSONRPCRequest;_isFreshUser;getEmail;GetinitConfig user id :;User.updateUserDataObjects : FAILED;\x3ciframe id\x3d'loyaltyMall' height\x3d'100%' frameborder\x3d'0' width\x3d'100%' marginheight\x3d'0' marginwidth\x3d'0' src\x3d';Leaderboard.getLeaderBoard;LEADERBOARD_ENABLED;_aristocratDataUpdateCallBack;User.getServerTime;currentData;_saveUserBlobInProgress;payment_id;avatarId;User.setLoyaltyReward;getElementById;Web.signin;saveUserData;User.isSubscriptionInteruptedShown;Gifting.enableGiftingLink;Gifting.getGiftData;getHashValue;trackErrorMessage;getAvatar;rankList_internal;push;email;7610864WuzXNY;getLoadingManger;responseText;Leaderboard.getUserLeaderboard;USER_ID_PREFIX;getInstance;sessionId;User.getRewardPoints;senderId;Web.signup;log;getId;slotsLeaderBoard.setLeaderBoard;setPowerUps;onreadystatechange;sendJSONRPCRequestSync;relaunchPopupActive;Tournamania.getData;userId;resetOffset;gameData;updateUserBlob;-blobId;readyState;firstName;POST;sendGiftCenterPushNotification;getPaidCoinOffset;coinBalance;currency;syncBlobVars;MOBILE;setPaidCoins;loginMode;myPlayingFriends;Blackjack;\x3c/iframe\x3e;nextAvailableTimeinternal;machine_identifier;4190775uGYNQp;getUserLastName;_dirty;COOKIE_PREFIX;status;Gifting.createGiftingLink;quantity;setUserLeaderBoardDataResponseFailed;getTimeSinceLoad;getCoinOffset;getUserDataManager;Gifting.collectAllGift;Subscription.getSubscriptionData;User.getDailyBonusStatusV2;createElement;isPurchaseBanned;decode;Leaderboard_Web.callUserLeaderBoard;isNMISubscriptionActive;Gifting.collectGift;blackjackLeaderBoard.setLeaderBoard;CUMMULATIVE_WIN;extend;html5;data;event;45928BWhCgf;levelBucket".split(";");a0_0x27a4= function(){return a};return a0_0x27a4()}function a0_0x484a(a,b){var c=a0_0x27a4();return a0_0x484a=function(a,b){return c[a-203]},a0_0x484a(a,b)}function closeGenericNotification(){var a=a0_0x5cb89a;RSEngine[a(366)][a(346)]()};function a0_0x52c4(){var a="31759CEZgCs payment_id getMonetizationCount dailyScratcherBonusInterval cardCount timeSpentOnAppBeforeThisSession onCallBackForUpdatePowerUps currentXP _saveInProgress addCoins 1624ZXHrVG 229906FIfsGK dataManager call getHashValue interval User.collectSubscriptionSale GUEST getPiggyBankValue energyOffset canvas request_id setPowerUps signed_request round_over_result_updated bingoWins getCurrentServerTime trackEvent sendJSONRPCRequestSync platform 2623209lcqvva onTimerComplete saveBingoRewards networkManager saveUserData 3734525EqSWKw _userPrefix getXpFraction User.getCoinBalance getLevelXPOffset User.updateHourlyBonusTime getGameManager login blobUpdateFailed _initialXPFraction monetUpdateCallCount quantity _onRetrieveMonetizationBalanceSuccess callBackAfterMonetBlobVarsUpdate _dirty amount InGamePurchase.updatePowerUpsV1 VERSION setDailyBonusPickedTime _onRetrieveCoinBalanceFailed CollectiblesOffset getPaidCoinOffset User.badWordFilter blobUpdateSuccess loginMode status createUser getCoins init bind getId collectedTime updateUserBlob _facebookDetailsObject _super getUserDataManager callBackAfterBlobVarsUpdate getMonetizationBalance 1721536uxaXDj 3406734cFyiVb dailyBonusUpdateCallback mobile setCurrentPlayingAnalyticsId roomId onUpdateHourlyBonusCallback _updateTimer stringify getFBId currentServerTime powerUps _lastSaveTimeStamp html5 FACEBOOK trackHyros result _isFreshUser _onRewardSaveSuccess User.rewardVideoBonus monetization_count _saveUserBlobInProgress 1.0 data syncBonusUpdateCallback TimeEventData.updateURIReward MOBILE coins _lastEditTimeStamp hourlyBonusUpdateCallback _onRetrieveCoinBalanceSuccess getUserLevel 1983208hDQJvf setBingoData onUpdateSyncBonusCallback callBackAfterSaveRewards getLoadingManger getGameReLoadingScreenStatus levelBonusPowerups currentPurchaseType success XpOffset failure levelXPOffset getMe User.getRewardPoints levelBonus _onRewardSaveFailed hourlyBonusInterval ClubM.validateUser _retryCount syncBlobVars getCasinoInterface onPowerupPurchaseCallback getCoinBalance _me getCoinOffset getInstance coinUpdateCallCount PowerupsOffset web FirstPurchase powerup_coins levelFactor getXPOffset USER_ID_PREFIX 6azlnpq getCurrentLevel setHourlyBonusPickedTime level SSO_ENABLED sessionId HYROS_ENABLED decode User.updateUserDataObjects sendJSONRPCRequest".split(" "); a0_0x52c4=function(){return a};return a0_0x52c4()}(function(a,b){for(var c=a0_0x2802,d=a();;)try{if(-parseInt(c(298))/1+-parseInt(c(360))/2+parseInt(c(317))/3+-parseInt(c(392))/4+-parseInt(c(322))/5*(-parseInt(c(277))/6)+-parseInt(c(287))/7*(-parseInt(c(297))/8)+-parseInt(c(361))/9===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x52c4,577317);function a0_0x2802(a,b){var c=a0_0x52c4();return a0_0x2802=function(a,b){return c[a-267]},a0_0x2802(a,b)} var RSUserDataManagerV2=RSUserDataManager.extend({init:function(a,b){var c=a0_0x2802;this.onPowerupPurchaseCallback=this.dailyBonusUpdateCallback=this[c(389)]=null;this[c(358)]=null;this[c(335)]=null;this[c(269)]=0;this[c(332)]=0;this[c(331)]=0;this[c(410)]=0;this[c(399)]="";this[c(356)][c(350)][c(300)](this)},saveUserBlobParams:function(){var a=a0_0x2802;0==this[a(415)][a(267)]()&&0==this.getMe()[a(343)]()&&0==this[a(404)]()[a(275)]()&&this[a(404)]()[a(324)]()==this[a(331)]||(this[a(331)]=this.getMe()[a(324)](), this[a(354)](this[a(404)]()[a(326)](),this[a(404)]()[a(267)](),this.getMe()[a(343)](),this[a(404)]().getPiggyBankValue(),this[a(404)]()[a(324)](),this[a(404)]().getUserLevel(),this.getMe()[a(275)]()));if(this[a(295)])this[a(336)]=!0;else this[a(321)]()},updateUserBlob:function(a,b,c,d,e,f,g){var h=a0_0x2802;if(RSEngine[h(346)]!=LOGIN_MODE[h(304)]&&!this._saveUserBlobInProgress){this[h(372)]=TimeManager[h(268)]().getCurrentServerTime();null==a&&(a=0);null==b&&(b=0);null==c&&(c=0);null==d&&(d=0);null== e&&(e=0);null==f&&(f=1);null==g&&(g=0);var k=TimeManager.getInstance()[h(313)]();a={id:this[h(415)][h(352)](),levelXPOffset:a,coin:b,requestId:k,paidCoins:c,piggyBankCoin:d,xpFraction:e,level:f,xp:g,sessionId:GlobalVars[h(282)]};b=[];b[0]=JSON.stringify(a);b[1]=k;b=RSUtils[h(301)](b);c=[];c[0]=this[h(415)][h(352)]();c[1]=JSON.stringify(a)+"|"+k+"|"+b;c[2]=h(307);this[h(381)]=!0;RSEngine[h(320)][h(286)](h(285),c,this[h(345)][h(351)](this),this[h(330)].bind(this))}},onMyDataLoaded:function(a){var b= a0_0x2802,c={};null==a?c={}:c=DynamoDBParser[b(284)](a[b(376)][b(383)]);c=c?c:{};null==c.id&&(RSEngine.loginMode==LOGIN_MODE.GUEST?c.id=this[b(355)].id:c.id=this[b(323)]+this[b(355)].id);this[b(415)]=this[b(348)](c,this._facebookDetailsObject);URLConfig[b(283)]&&RSEngine[b(346)]!=LOGIN_MODE[b(374)]&&RSGame[b(268)]()[b(396)]()[b(397)]()&&this[b(375)]();RSGame[b(268)]().getUserDataManager()[b(404)]()[b(364)](RSGame[b(268)]()[b(396)]().getCurrentPlayingAnalyticsID());RSGame[b(268)]()[b(357)]()[b(404)]().setPlatformAndVersion(GameConfig[b(339)]); RSEngine[b(346)]!=LOGIN_MODE[b(304)]&&(GlobalVars[b(292)]=RSGame.getInstance().getUserDataManager()[b(404)]().getTotalTimeSpentOnApp());this[b(321)](b(329));this[b(415)][b(377)]&&this.updateUserBlob(0,this[b(415)][b(349)](),0);RSEngine[b(346)]!=LOGIN_MODE[b(304)]&&(this[b(367)]=setInterval(this[b(318)][b(351)](this),3E4))},validateMClubUser:function(a,b,c,d){var e=a0_0x2802;if(RSEngine[e(346)]!=LOGIN_MODE[e(304)]&&null!=a&&null!=b){var f=TimeManager.getInstance()[e(313)]();b={playerId:a,playerLastname:b, advId:f,vendorId:f};a=[];a[0]=this[e(415)][e(352)]();a[1]="canvas";a[2]=GameConfig[e(339)]?GameConfig.VERSION:e(382);a[3]=b;b=this._me.getId();GameConfig[e(281)]&&(RSGame[e(268)]()[e(328)]().isUserLoginBeforeSSO()&&(RSGame.getInstance().getGameManager().getWebRSID()?b=RSGame.getInstance()[e(328)]().getWebRSID():RSEngine.loginMode!=LOGIN_MODE.WEB_FACEBOOK&&RSEngine.loginMode!=LOGIN_MODE[e(374)]||(b=GameConfig.USER_ID_PREFIX+RSGame[e(268)]()[e(357)]()[e(404)]()[e(369)]())),RSEngine.loginMode==LOGIN_MODE.FACEBOOK&& (b=GameConfig[e(276)]+RSGame[e(268)]()[e(357)]()[e(404)]()[e(369)]()));a[4]=b;RSEngine[e(320)].sendJSONRPCRequest(e(409),a,c,d)}},addCoins:function(a,b){var c=a0_0x2802;0!=a&&(this.getMe()[c(296)](a),this[c(336)]=!0,this[c(388)]=TimeManager[c(268)]()[c(313)](),b&&this.updateUserBlob(this.getMe()[c(326)](),this[c(404)]()[c(267)](),this[c(404)]()[c(343)](),this[c(404)]()[c(305)](),this[c(404)]()[c(324)](),this[c(404)]().getUserLevel(),this[c(404)]()[c(275)]()))},rewardVideoBonus:function(a,b,c){var d= a0_0x2802,e=[];e[0]=RSEngine.dataManager[d(404)]().getId();e[1]=a;RSEngine[d(320)].sendJSONRPCRequest(d(379),e,b,c)},saveBingoRewards:function(a,b,c,d,e,f,g,h,k,m,n){var p=a0_0x2802;k&&(this[p(395)]=k);this[p(410)]=this[p(410)]+1;var r=[],s=[],u={};u[p(306)]=b;u.coinsOffset=a;u[p(401)]=c;u[p(342)]=d;u[p(270)]=e;u[p(312)]=f||0;u[p(291)]=g||0;u[p(365)]=h;u[p(280)]=RSGame.getInstance().getLevelManager()[p(278)]();u[p(403)]=RSGame[p(268)]()[p(357)]().getMe()[p(326)]();u[p(294)]=RSGame[p(268)]()[p(357)]().getMe().getXP(); u[p(274)]=RSGame[p(268)]()[p(357)]()[p(404)]().getLevelFactor();u[p(406)]=m||0;u[p(398)]=n||0;u=JSON.stringify(u);s[0]=u;s[1]=TimeManager[p(268)]()[p(370)];r[0]=RSEngine[p(299)].getMe().getId();r[1]=u+"|"+s[1]+"|"+RSUtils.getHashValue(s);RSEngine[p(320)][p(286)]("User.saveBingoRewardsV1",r,this[p(378)][p(351)](this),this[p(407)].bind(this,a,b,c,d,e,f,g,h,k,m,n))},updateHourlyBonusTime:function(a,b,c){var d=a0_0x2802;this[d(389)]=a;a=[];a[0]=RSEngine[d(299)].getMe()[d(352)]();a[1]="0";a[2]=c;a[3]= RSEngine[d(316)]==PLATFORM[d(386)]?"mobile":d(373);RSEngine[d(320)][d(286)](d(327),a,this[d(366)][d(351)](this),b)},updateDailyBonusTime:function(a,b,c){var d=a0_0x2802;this[d(362)]=a;a=[];a[0]=RSEngine[d(299)][d(404)]()[d(352)]();a[1]="0";a[2]=c;a[3]=RSEngine[d(316)]==PLATFORM.MOBILE?"mobile":d(373);RSEngine[d(320)][d(286)]("User.updateDailyBonusTime",a,this.onUpdateDailyBonusCallback[d(351)](this),b)},updateSyncBonus:function(a,b,c){var d=a0_0x2802;this[d(384)]=a;var e=[];a=TimeManager[d(268)]().getCurrentServerTime(); e[0]=c;e[1]=a;var e=RSUtils[d(301)](e),f=[];f[0]=RSEngine[d(299)][d(404)]()[d(352)]();f[1]=c;f[2]=e;f[3]=RSEngine.platform==PLATFORM.MOBILE?d(363):"html5";f[4]=a;RSEngine[d(320)][d(286)]("User.collectSyncBonus",f,this[d(394)].bind(this),b)},getActiveSubscriptionSale:function(a,b){var c=a0_0x2802,d=[];d[0]=RSEngine.dataManager[c(404)]()[c(352)]();d[1]=RSEngine[c(316)]==PLATFORM[c(386)]?c(363):c(373);RSEngine[c(320)][c(286)]("User.getActiveSubscriptionSale",d,a,b)},collectSubscriptionSale:function(a, b,c,d){b=a0_0x2802;var e=[];e[0]=RSEngine[b(299)][b(404)]()[b(352)]();e[1]=a;e[2]=RSEngine[b(316)]==PLATFORM[b(386)]?b(363):"html5";RSEngine[b(320)][b(286)](b(303),e,c,d)},updatePlatformSDKOnQuit:function(){var a=a0_0x2802,b=[];b[0]=RSEngine.dataManager[a(404)]()[a(352)]();b[1]=RSEngine[a(299)][a(404)]()[a(349)]();b[2]=RSEngine.dataManager.getMe().getXP();b[3]=RSEngine[a(299)][a(404)]()[a(391)]();RSEngine[a(320)].sendJSONRPCRequestSync("LeanPlum.syncData",b)},getCoinBalance:function(a){var b=a0_0x2802; a&&(this[b(358)]=a);this[b(269)]++;a=[];a[0]=RSEngine[b(299)][b(404)]()[b(352)]();a[1]=RSEngine[b(316)]==PLATFORM[b(386)]?b(363):b(373);RSEngine[b(320)][b(286)](b(325),a,this[b(390)][b(351)](this),this[b(341)][b(351)](this))},validateFBPurchase:function(a,b,c){var d=a0_0x2802,e=[];e[0]=a[d(288)];e[1]=a[d(337)];e[2]=a.currency;e[3]=a[d(333)];e[4]=a[d(308)];e[5]=a[d(347)];e[6]=a[d(310)];var e=RSUtils.getHashValue(e),f=[];f[0]=RSEngine[d(299)][d(404)]().getId();f[1]=RSEngine[d(316)]==PLATFORM[d(386)]? d(363):"canvas";f[2]=a;f[3]=e;RSEngine[d(320)][d(286)]("Facebook.validateFBPurchase",f,b,c)},_onRetrieveCoinBalanceSuccess:function(a){var b=a0_0x2802;RSEngine[b(299)][b(404)]().getCoins()!=parseInt(a[b(376)][b(383)][b(387)])&&0==RSEngine.dataManager.getMe().getCoinOffset()?(this.coinUpdateCallCount=0,RSEngine[b(299)][b(404)]()[b(411)](a[b(376)][b(383)]),this[b(358)](!0,a)):3>this[b(269)]?setTimeout(this[b(414)].bind(this),5E3):(this.coinUpdateCallCount=0,this.callBackAfterBlobVarsUpdate(!0,a))}, _onRetrieveCoinBalanceFailed:function(){var a=a0_0x2802;3>this[a(269)]?setTimeout(this[a(414)][a(351)](this),5E3):(this[a(269)]=0,this[a(358)](!1))},getMonetizationBalance:function(a){var b=a0_0x2802;a&&(this.callBackAfterMonetBlobVarsUpdate=a);this[b(332)]++;a=[];a[0]=RSEngine[b(299)].getMe()[b(352)]();a[1]=RSEngine.platform==PLATFORM[b(386)]?b(363):b(373);RSEngine.networkManager.sendJSONRPCRequest("User.getCoinBalance",a,this[b(334)].bind(this),this._onRetrieveMonetBalanceFailed[b(351)](this))}, _onRetrieveMonetizationBalanceSuccess:function(a){var b=a0_0x2802;RSEngine[b(299)][b(404)]()[b(289)]()!=parseInt(a.result[b(383)][b(380)])&&0==RSEngine[b(299)][b(404)]()[b(267)]()?(1==parseInt(a[b(376)][b(383)].monetization_count)&&GameConfig.IS_ADJUST_ENABLED&&RSAdjustManager[b(268)]()[b(314)](RSAdjustEventToken[b(272)]),this[b(332)]=0,RSEngine[b(299)][b(404)]()[b(411)](a.result[b(383)]),this[b(335)](b(400),a.result[b(383)])):3>this[b(332)]?setTimeout(this[b(359)][b(351)](this),8E3):(this[b(332)]= 0,this[b(335)](!1))},_onRetrieveMonetBalanceFailed:function(){var a=a0_0x2802;3>this[a(332)]?setTimeout(this[a(359)][a(351)](this),8E3):(this[a(332)]=0,this[a(335)](!1))},trackUrlReward:function(a,b,c){var d=a0_0x2802,e=[];e[0]=RSEngine.dataManager.getMe()[d(352)]();e[1]=RSEngine[d(316)]==PLATFORM[d(386)]?d(363):d(373);e[2]=a;RSEngine.networkManager[d(286)](d(385),e,b,c)},getLinkReward:function(a,b,c){var d=a0_0x2802,e=[];e[0]=RSEngine[d(299)][d(404)]().getId();e[1]=RSEngine[d(316)]==PLATFORM[d(386)]? d(363):"html5";e[2]=a;RSEngine[d(320)][d(286)]("TimeEventData.getLinkReward",e,b,c)},purchasePowerUp:function(a,b,c,d,e){b=a0_0x2802;this.onPowerupPurchaseCallback=d;this.currentPurchaseType=c;c=[];c[0]=RSEngine[b(299)].getMe().getId();c[1]=a;c[2]=RSEngine[b(316)]==PLATFORM.MOBILE?b(363):b(373);c[3]=GameConfig.VERSION;RSEngine[b(320)].sendJSONRPCRequest(b(338),c,this[b(293)][b(351)](this),e)},onCallBackForUpdatePowerUps:function(a){var b=a0_0x2802;a[b(376)].status==b(400)?(void 0!=a[b(376)][b(371)]&& (RSEngine.dataManager.getMe()[b(309)](a[b(376)][b(371)]),RSEngine.externalGameManager[b(393)]()),RSEngine[b(299)].getMe()[b(289)]()==parseInt(a[b(376)][b(380)])&&this[b(399)]!=b(273)||0!=RSEngine[b(299)][b(404)]().getCoinOffset()?this[b(359)](this[b(413)].bind(this)):(RSEngine[b(299)][b(404)]()[b(411)](a.result),null!=this[b(413)]&&this[b(413)](b(400),a))):null!=this[b(413)]&&this[b(413)](b(402),a)},onUpdateSyncBonusCallback:function(a){var b=a0_0x2802;null!=this.syncBonusUpdateCallback&&this[b(384)](a)}, onUpdateDailyBonusCallback:function(a){var b=a0_0x2802;200==a[b(376)].data[b(347)]&&(this._me[b(340)](a[b(376)][b(383)].collectedTime),GlobalVars[b(290)]=Number(a[b(376)][b(383)][b(302)]));null!=this[b(362)]&&this[b(362)](a)},onUpdateHourlyBonusCallback:function(a){var b=a0_0x2802;200==a.result[b(383)][b(347)]&&(this[b(415)][b(279)](a[b(376)][b(383)][b(353)]),GlobalVars[b(408)]=parseInt(a[b(376)].data[b(302)]));null!=this.hourlyBonusUpdateCallback&&this[b(389)](a)},saveStatsInfo:function(a,b){},_onRewardSaveSuccess:function(a){var b= a0_0x2802;this[b(410)]=0;RSCasinoManager[b(412)]().postMessageToBingo("round_over_result_updated",b(311));this[b(395)]&&this[b(395)](a)},_onRewardSaveFailed:function(a,b,c,d,e,f,g,h,k,m,n,p){var r=a0_0x2802;3>=this[r(410)]?this[r(319)](a,b,c,d,e,f,g,h,k,m,n):(this[r(395)]&&this[r(395)](p),this[r(410)]=0)},redeemItem:function(a,b,c,d,e){var f=a0_0x2802,g=[];g[0]=RSEngine.dataManager[f(404)]()[f(352)]();g[1]=JSON[f(368)](a)+"|"+b+"|"+c;g[2]=RSEngine[f(346)]==LOGIN_MODE.FACEBOOK?f(307):f(271);RSEngine[f(320)][f(286)]("Loyaltymall.createOrder", g,d,e)},getLoyaltyMallPoints:function(a){var b=a0_0x2802,c=[];c[0]=RSGame[b(268)]().getUserDataManager()[b(404)]()[b(352)]();RSEngine[b(320)][b(315)](b(405),c,a)},validatePlayerConnectUser:function(a,b,c,d,e){var f=a0_0x2802;if(RSEngine[f(346)]!=LOGIN_MODE[f(304)]&&null!=a&&null!=b){var g=TimeManager.getInstance()[f(313)]();a={parameter1:a,parameter2:b,parameter3:c,advId:g,vendorId:g};b=[];b[0]=this[f(415)][f(352)]();b[1]=f(307);b[2]=GameConfig[f(339)]?GameConfig[f(339)]:"1.0";b[3]=a;RSEngine[f(320)].sendJSONRPCRequest("PlayerConnect.validateUser", b,d,e)}},playerConnectContactUs:function(a,b,c){var d=a0_0x2802,e=[];this._me&&(e[0]=this._me[d(352)]());e[1]=RSEngine[d(316)]==PLATFORM[d(386)]?d(363):"html5";e[2]=GameConfig.VERSION?GameConfig[d(339)]:d(382);e[3]=a;RSEngine.networkManager[d(286)]("PlayerConnect.contactUs",e,b,c)},setCCPA:function(a,b,c,d){var e=a0_0x2802,f=[];f[0]=a;f[1]=RSEngine.platform==PLATFORM[e(386)]?e(363):e(373);f[2]=GameConfig[e(339)]?GameConfig.VERSION:e(382);f[3]=b;RSEngine[e(320)].sendJSONRPCRequest("Privacy.setCCPA", f,c,d)},checkNameIsValideOrNot:function(a,b,c){var d=a0_0x2802,e=[];this[d(415)]&&(e[0]=this[d(415)][d(352)]());e[1]=RSEngine.platform==PLATFORM[d(386)]?d(363):"html5";e[2]=a;var f=RSUtils[d(301)](e);e[2]=GameConfig[d(339)]?GameConfig[d(339)]:d(382);e[3]=a;e[4]=f;RSEngine.networkManager.sendJSONRPCRequest(d(344),e,b,c)},GiftCardLinkCreation:function(a,b,c,d,e){var f=a0_0x2802,g=[];this._me&&(g[0]=this[f(415)][f(352)]());g[1]=RSEngine[f(346)]==LOGIN_MODE[f(374)]?f(307):f(271);g[2]=GameConfig[f(339)]? GameConfig.VERSION:"1.0";g[3]=b;g[4]=c;g[5]=a;a=RSUtils[f(301)](g);g[6]=a;RSEngine[f(320)][f(286)]("Gcow.redeemLinkCreation",g,d,e)}});var a0_0x4eaf03=a0_0x3ce9; function a0_0x42c3(){var a="5220396nHuQJc;bingoMachinesDetails;496701AShnmi;rewards;Keno;_version;content;messageKey;getCoins;_vipBenefits;getCollectibleDetails;22834VJVusS;localCurrency;additionalCoinsOnPurchase;ScratcherMachineOrder;PKR_;machineBetValues;Game_Reward;questTags;betValues;uniformHandTypeDetails;getLocalCurrency;LevelBetBucketData;events;MSP;RSP_;quests;GameData.getBingoMachineConfig;objectiveList;extend;Setting user id for reloading :;price;GameData.getGameData;getDefaultBetForCasino;gameType;_platform;push;scoreboxData;questSet;getSlotBetStructure;status;onGameDataLoadFailed;roulettemachines;4760336lspYBX;1375829DFtOLk;levels;onEventDataLoaded;Poker;blazingBetsBetValues;getLevelManager;Slots;payLines;data;scratcherBetValues;getPowerups;getUserDataManager;achievementID;dailyChallengeData;rouletteBetValues;TimeEventData.skipDailyChallenge;13hMKDdv;defaultBet;TimeEventData.getEvents;floor;gameUrl_Stage;QuestRewards;length;textValue;bingoMachineAssets;log;result;aristocratURLs;RGSGameUrlsKeno;_machineAnalyticsID;gameCategory;getMonetizationFactor;scratchermachines;isEnabled;welcomeBonus;Scorebox;firstPurchaseStatusPoints;MSP_;previous;getCurrentLevel;sortObjectWithIntKey;objectives;_gameData;getDefaultBetIndexForCasino;getGameData;gameUrl_Live;networkManager;onEventDataSuccess;html5;dataManager;Blackjack;vipData;dailyBonusSpinWheel;betStructure;Quests;getDefaultValues;QuestSets;coinBalance;sendJSONRPCRequest;onEventDataLoadFailed;Objectives;_powerUps;tag;machine_identifier;chips;tier;recurringPurchaseRewardPoints;hasOwnProperty;BJ_BB;Scratcher;vipPurchaseBenefits;kenomachines;getMachineDetails;getBlackJackBetStructureByName;machines;machine_type;level;_id;getScratcherMachineOrderDetailsSheet;hyrosData;recurringPurchaseStatusPoints;isStringContains;Roulette;value;getBingoMinimumBetRoomValue;textKey;analyticsName;initialize;defaultBetPercent;Trivia;getSheetData;getMe;powerUps;onGameDataLoaded;MPP;chipValue;machineBets;8630312dqDSah;RGSGameUrls;getInstance;Conditions;pokermachines;getMinChipValueForBlackJack;bingoMinBetRoom;gameData;upperBound;Bingo;_betLineCount;_maxBetAmount;title;conditions;apply;960x300;getAchievementTags;inAppPurchase;gamedata;popupMessages;2093505tsKbqX;getCurrentLevelVO;mobileDefaults".split(";");a0_0x42c3= function(){return a};return a0_0x42c3()}(function(a,b){for(var c=a0_0x3ce9,d=a();;)try{if(-parseInt(c(291))/1*(-parseInt(c(242))/2)+parseInt(c(397))/3+parseInt(c(274))/4+-parseInt(c(392))/5+parseInt(c(395))/6+-parseInt(c(275))/7+-parseInt(c(372))/8===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x42c3,680101);function a0_0x3ce9(a,b){var c=a0_0x42c3();return a0_0x3ce9=function(a,b){return c[a-239]},a0_0x3ce9(a,b)} var RSGameData=RSClass[a0_0x4eaf03(260)]({_gameData:null,_id:null,_platform:null,_version:null,_vipBenefits:[],_powerUps:null,init:function(a,b,c){var d=a0_0x4eaf03;a&&this[d(362)][d(386)](this,arguments)},initialize:function(a,b,c){var d=a0_0x4eaf03;this[d(352)]=a;this._platform=b;this[d(400)]=c},updateUserIDForSSO:function(a){var b=a0_0x4eaf03;cc[b(300)](b(261)+a);this[b(352)]=a},readGameData:function(a,b){var c=a0_0x4eaf03,d=[];d[0]=this._id;d[1]=this[c(266)];d[2]=this._version;var e=this;RSEngine[c(321)].sendJSONRPCRequest(c(263), d,function(b){e[c(368)](b);a()},function(){e[c(272)](d);b()})},onGameDataLoaded:function(a){var b=a0_0x4eaf03;this[b(317)]=a[b(301)][b(401)]},onGameDataLoadFailed:function(){},readBingoMachineConfig:function(a,b){var c=a0_0x4eaf03,d=[];d[0]=c(387);d[1]=c(323);d[2]=this._version;d[3]=this[c(352)];RSEngine.networkManager[c(333)](c(258),d,function(b){a(b[c(301)][c(349)])},function(){b()})},readLTEMGameDataEvents:function(a,b,c){var d=a0_0x4eaf03,e=[];null!=c&&void 0!=c&&""!=c||(c=d(390));e[0]=c;e[1]= this._id;e[2]="html5";e[3]=this._version;var f=this;RSEngine[d(321)][d(333)](d(293),e,function(b){f[d(277)](b,c);a(b)},function(){f[d(334)]();b()})},gameDataskipDailyChallengeEvents:function(a,b,c,d){var e=a0_0x4eaf03,f=[];f[0]=this[e(352)];f[1]=e(323);f[2]=this._version;f[3]=d;f[4]=c;var g=this;RSEngine[e(321)].sendJSONRPCRequest(e(290),f,function(b){g[e(322)](b);a(b)},function(){g[e(334)]();b()})},onEventDataSuccess:function(a){var b=a0_0x4eaf03;if(0!=a[b(301)][b(271)])for(var c in a[b(301)][b(283)])this[b(317)][c]= a[b(301)].data[c]},onEventDataLoaded:function(a,b){var c=a0_0x4eaf03;if(0!=a[c(301)].status)for(var d=0;d<a[c(301)][c(254)][c(297)];d++){for(var e in a[c(301)].events[d][c(283)])this[c(317)][e]=a[c(301)][c(254)][d][c(283)][e];"gamedata"==b&&RSGame[c(374)]()[c(286)]()[c(366)]().setDailyChallengeData(a.result[c(254)][d][c(288)])}},onEventDataLoadFailed:function(){},getSheetData:function(a){return this[a0_0x4eaf03(317)][a]},replaceSheetData:function(a,b){this[a0_0x4eaf03(317)][a]=b},getHyrosData:function(){var a= a0_0x4eaf03;if(this[a(317)][a(342)](a(354)))return this[a(317)][a(354)][0]},getRewardPointsByCoinPack:function(a){var b=a0_0x4eaf03;this[b(240)]=this[b(365)](b(345));for(var c=0;c<this[b(240)].length;c++)if(this[b(240)][c].id==a&&void 0!=this[b(240)][c][b(341)]&&null!=this._vipBenefits[c][b(341)])return 0<RSEngine[b(324)][b(366)]()[b(306)]()?parseFloat(this[b(240)][c].recurringPurchaseRewardPoints):parseFloat(this[b(240)][c].firstPurchaseRewardPoints);return 0},getStatusPointsByCoinPack:function(a){var b= a0_0x4eaf03;this[b(240)]=this.getSheetData(b(345));for(var c=0;c<this._vipBenefits[b(297)];c++)if(this[b(240)][c].id==a&&void 0!=this[b(240)][c][b(355)]&&null!=this[b(240)][c][b(355)])return 0<RSEngine.dataManager[b(366)]().getMonetizationFactor()?this._vipBenefits[c].recurringPurchaseStatusPoints:this[b(240)][c][b(311)];return 0},getActionOGById:function(a){for(var b=a0_0x4eaf03,c=this.getSheetData("actionSheetConfig"),d=0;d<c[b(297)];d++)if(a==c[d].id)return c[d];return null},getMachineDetails:function(a, b){var c=a0_0x4eaf03,d=null;switch(a){case RSGameTypes[c(281)]:d=RSUtils.cloneJSON(this[c(365)](c(349)));break;case RSGameTypes[c(278)]:d=this.getSheetData(c(376));break;case RSGameTypes[c(381)]:d=this[c(365)](c(299));break;case RSGameTypes.Blackjack:d=this[c(365)]("blackjackmachines");break;case RSGameTypes[c(399)]:d=this.getSheetData(c(346));break;case RSGameTypes[c(364)]:d=this[c(365)]("triviaConfig");break;case RSGameTypes.Roulette:d=this[c(365)](c(273));break;case RSGameTypes[c(344)]:d=this[c(365)](c(307)); break;case RSGameTypes[c(310)]:d=this[c(365)](c(268));break;case RSGameTypes.TableGames:d=this.getSheetData("tableMachines");break;default:RSEngine.gameData[c(365)](c(349))}if(b){for(c=0;c<d.length;c++)if(d[c].machine_identifier==b)return d[c];return null}return d},getScratcherMachineOrderDetailsSheet:function(){return this.getSheetData(a0_0x4eaf03(245))},getNextScratcherMachineToLoad:function(a,b,c){a=a0_0x4eaf03;for(var d=this[a(353)](),e=null,f=0;f<d.length;f++)if(d[f].machine_identifier==b){var g= f;if(c==a(313))for(var g=g-1,h=0;h<d.length;h++){var k=(g-h+d[a(297)])%d[a(297)],m=this.getMachineDetails(RSGameTypes[a(344)],d[k].machine_identifier);if(parseInt(m[a(308)])){e=d[k].machine_identifier;break}}else for(g+=1,h=0;h<d[a(297)];h++)if(k=(g+h)%d.length,m=this[a(347)](RSGameTypes[a(344)],d[k][a(338)]),parseInt(m[a(308)])){e=d[k].machine_identifier;break}}return e},getQuestSheetNames:function(){var a=a0_0x4eaf03,b={};return b[a(385)]=a(375),b[a(316)]=a(335),b[a(259)]="ObjectiveLists",b.quests= a(329),b[a(269)]=a(331),b[a(398)]=a(296),b},getAchievements:function(){for(var a=a0_0x4eaf03,b=this.getSheetData("quests"),c=[],d=0;d<b[a(297)];d++){var e=new Achievement(b[d]);c.push(e)}return c},getAchievementByAchievementID:function(a){var b=a0_0x4eaf03,c=this.getSheetData(b(257)),d;for(d in c){var e=c[d];if(e[b(287)]==a)return e}return null},getAchievementTags:function(){for(var a=this.getSheetData(a0_0x4eaf03(249)),b=[],c=0;c<a.length;c++)b.push(a[c]);return b},getAchievementIdByTag:function(a){var b= a0_0x4eaf03,c=this[b(388)](),d;for(d in c){var e=c[d];if(e[b(337)]==a)return e.id}return null},getUniformHandTypeDataByRoomName:function(a){for(var b=a0_0x4eaf03,c=this[b(365)](b(251)),d=0;d<c[b(297)];d++)if(c[d].id==a)return c[d].details},getSlotBetStructure:function(){var a=a0_0x4eaf03;return this[a(365)](a(247))},getSpinBetStructureByName:function(a,b){for(var c=a0_0x4eaf03,d=this[c(270)](),e=[],f=0,g=0,h=0;h<d[c(297)];h++){var k=parseInt(d[h][c(276)]);b>=k&&(f=parseInt(d[h][a]),g!=f&&(g=f,e[c(267)](parseInt(d[h][a]))))}return e}, getSlotBetStructureByName:function(a){for(var b=a0_0x4eaf03,c=this.getSlotBetStructure(),d=[],e=0;e<c[b(297)];e++)d[b(267)](parseInt(c[e][a]));return d},getMaxBetValueForSlot:function(a,b){for(var c=a0_0x4eaf03,d=this[c(270)](),e=0,f=0;f<d[c(297)]&&!(parseInt(d[f][c(276)])>b);f++)e=parseInt(d[f][a]);return e},getSlotDefaultBet:function(a,b){var c=a0_0x4eaf03,d=RSGame[c(374)]().getUserDataManager()[c(366)]()[c(239)](),e=RSGame.getInstance().getLevelManager()[c(314)](),f=RSGame[c(374)]()[c(319)]()[c(270)](), g=-1,h,k,m,n,p=0,r;for(r in f)if(k=parseInt(f[r][c(276)]),m=parseInt(f[r][b]),h=Math.floor(parseFloat(f[r][c(363)])*d),n=m*a,h>=n&&e>=k)if(p!=m)g++,p=m;else return g;return 0>g&&(g=0),g},getMaxBetValueForBlackjack:function(a,b){for(var c=a0_0x4eaf03,d=RSEngine.gameData[c(365)](a),e=0,f=0;f<d[c(297)];f++)if(b>=parseInt(d[f].levels))e=parseInt(d[f][c(250)]);else break;return e},getMaximumBetByGameTypeAndName:function(a,b,c){var d=a0_0x4eaf03,e=0;switch(a){case RSGameTypes[d(281)]:e=b[d(382)]*b[d(383)]; break;case RSGameTypes[d(381)]:a=this[d(365)](d(396));for(var f in a)a[f][d(338)]===b[d(338)]&&(e=a[f].card4);break;case RSGameTypes[d(325)]:e=RSGame[d(374)]()[d(319)]().getMaxBetValueForBlackjack(c[d(328)],RSGame.getInstance()[d(280)]().getCurrentLevel());break;case RSGameTypes[d(399)]:e=b[d(383)];break;case RSGameTypes.Poker:RSUtils.isStringContains(b[d(304)],d(256))?e=b[d(383)]:RSUtils[d(356)](b[d(304)],"MSP_")?e=4*b[d(383)]:RSUtils[d(356)](b[d(304)],d(312))?e=25*b[d(383)]:RSUtils.isStringContains(b[d(304)], d(246))&&(e=b._maxBetAmount)}return parseInt(e)},getMinimumBetByGameTypeAndName:function(a,b){var c=a0_0x4eaf03;switch(a){case RSGameTypes[c(281)]:return this.getSlotBetStructureByName(b[c(338)])[0]*b[c(282)];case RSGameTypes[c(381)]:return this[c(359)]();case RSGameTypes[c(325)]:return this[c(377)](b[c(338)]);case RSGameTypes[c(399)]:return this[c(365)](c(371))[0][b[c(338)]];case RSGameTypes.Poker:return this.getMinBetValueForPoker(b.betStructure,b[c(305)]);case RSGameTypes[c(344)]:return RSGame[c(374)]()[c(319)]()[c(264)]("scratcherBetValues", b[c(338)]);case RSGameTypes[c(357)]:return RSGame.getInstance().getGameData().getRouletteBetStructureByName(b[c(338)],RSGame.getInstance()[c(280)]()[c(314)]())}},getBingoMinimumBetRoomValue:function(){var a=a0_0x4eaf03;if(RSEngine[a(379)][a(330)]().bingoMinBetRoom)return RSEngine[a(379)][a(330)]()[a(378)]},getBlackJackBetStructureByName:function(a){var b=a0_0x4eaf03;switch(a){case b(343):return this[b(365)](b(279))}return this.getSheetData("blackjackBetValues")},getMinBetValueForBlackJack:function(a){var b= a0_0x4eaf03;return this[b(348)](a)[0][b(292)]},getMinChipValueForBlackJack:function(a){return this[a0_0x4eaf03(348)](a)[0].chips},getChipSetArrayForBlackjack:function(a){var b=a0_0x4eaf03;a=this.getBlackJackBetStructureByName(a);var c=[],d;for(d in a)a[d][b(339)]&&c[b(267)](parseInt(a[d][b(339)]));return c},getChipSetArrayForRoulette:function(){var a=a0_0x4eaf03,b=this.getSheetData(a(289)),c=[],d;for(d in b)b[d][a(339)]&&c[a(267)](parseInt(b[d][a(339)]));return c},getMaxChipUnlocked:function(a){var b= a0_0x4eaf03;a=this[b(348)](a);var c=RSGame[b(374)]().getLevelManager().getCurrentLevel(),d=0,e;for(e in a)a[e][b(276)]<=c&&(d=a[e][b(370)]);return parseInt(d)},getRouletteMaxChipUnlocked:function(a){var b=a0_0x4eaf03;a=this.getSheetData(b(289));var b=RSGame[b(374)]()[b(280)]()[b(314)](),c=0,d;for(d in a)a[d].levels<=b&&(c=a[d].chipValue);return parseInt(c)},getAristocratMachineURL:function(a){for(var b=a0_0x4eaf03,c=RSEngine.gameData.getSheetData(b(302)),d=c.length-1;0<=d;d--)for(var e=d;0<=e;e--)if(RSGame[b(374)]()[b(280)]()[b(393)]().level>= c[e][b(276)]&&RSCasinoManager.getPrimaryCurrency()>=c[d].coinBalance)return c[e][a]},getAristocratMachineMinBetRow:function(a){a=a0_0x4eaf03;for(var b=RSEngine.gameData[a(365)](a(302)),c=b[a(297)]-1;0<=c;c--)for(var d=c;0<=d;d--)if(RSGame.getInstance().getLevelManager()[a(393)]()[a(351)]>=b[d][a(276)]&&RSCasinoManager.getPrimaryCurrency()>=b[c][a(332)])return d},getSlotMachineTypeByName:function(a){for(var b=a0_0x4eaf03,c=RSGame[b(374)]()[b(319)]()[b(347)](RSGameTypes.Slots),d=0;d<c[b(297)];d++)if(c[d][b(338)]== a)return c[d][b(350)];return 0},getMaxBetValueForPoker:function(a){var b=a0_0x4eaf03;a=RSEngine[b(379)][b(365)](a);for(var c=parseInt(a[0][b(358)]),d=RSGame.getInstance()[b(280)]().getCurrentLevelVO()[b(351)],e=0;e<a[b(297)];e++)if(d>=a[e].level)c=parseInt(a[e][b(358)]);else break;return c},getMinBetValueForPoker:function(a,b){var c=a0_0x4eaf03,d=RSEngine[c(379)][c(365)](a),d=parseInt(d[0][c(358)]);return b==c(255)?4*d:b==c(369)?5*d:d},getMaxBetValueForKeno:function(a,b){for(var c=a0_0x4eaf03,d=RSEngine.gameData[c(365)](a), e=parseInt(d[0][b]),c=RSGame[c(374)]()[c(280)]().getCurrentLevel(),f=0;f<d.length;f++)if(c>=d[f].levels)e=parseInt(d[f][b]);else break;return e},getDonPacks:function(){var a=a0_0x4eaf03,b=this[a(365)](a(389));RSUtils[a(315)](b,"price");for(var c=[],d=0;d<b[a(297)];d++)if(0<b[d].range){var e=new CoinPackVO(b[d]);e[a(243)]=RSInAppPurchaseManager[a(374)]()[a(252)](e[a(262)]);c.push(e)}return c},getPackTitle:function(a){for(var b=a0_0x4eaf03,c=this[b(365)](b(389)),d=0;d<c[b(297)];d++)if(c[d].id==a)return c[d][b(384)]; return null},getPokerDefaultBet:function(a){var b=a0_0x4eaf03;a=RSGame[b(374)]().getGameData().getSheetData(a);for(var c=parseInt(a[0][b(358)]),d=RSGame.getInstance()[b(286)]()[b(366)]()[b(239)](),e=RSGame[b(374)]()[b(280)]()[b(314)](),f=0;f<a.length;f++){var g=Math[b(294)](d*a[f][b(380)]),h=parseInt(a[f][b(358)]);if(g>=h&&e>=a[f][b(351)])c=h;else break}return c},getBetStructure:function(a){var b=a0_0x4eaf03,c=[];a=RSGame[b(374)]()[b(319)]().getSheetData(a);for(var d=0;d<a[b(297)];d++)c.push(parseInt(a[d][b(358)])); return c},getKenoBetStructureByName:function(a,b){var c=a0_0x4eaf03,d=this[c(365)](c(371)),e=[],f;for(f in d)b>=d[f][c(276)]&&e[c(267)](parseInt(d[f][a]));return e},getKenoFullBetStructureByName:function(a){var b=a0_0x4eaf03,b=this[b(365)](b(371)),c=[],d;for(d in b)c.push(parseInt(b[d][a]));return c},getRouletteBetStructureByName:function(a,b){var c=a0_0x4eaf03,d=this[c(365)](c(289)),e=[],f;for(f in d)b>=d[f][c(276)]&&e.push(parseInt(d[f][c(250)]));return e},getScratcherBetStructureByName:function(a, b){var c=a0_0x4eaf03,d=this[c(365)](c(284)),e=[];if(void 0==b){for(c=0;c<d.length;c++){var f=parseInt(d[c].betValues);e.push(f)}return e}for(f in d)b>=d[f][c(276)]&&e[c(267)](parseInt(d[f][c(250)]));return e},getMachineDetailsByName:function(a,b){for(var c=a0_0x4eaf03,d=this[c(347)](a),e=0;e<d[c(297)];e++)if(d[e].machine_identifier==b)return d[e];return null},getPopupMessagesWithKey:function(a){for(var b=a0_0x4eaf03,c=RSEngine[b(379)].getSheetData(b(391)),d=0;d<c[b(297)];d++)if(c[d][b(402)]==a)return c[d]; return null},getPopupTextWithKey:function(a){for(var b=a0_0x4eaf03,c=RSGame[b(374)]()[b(319)]()[b(365)]("popupTexts"),d=0;d<c[b(297)];d++)if(c[d][b(360)]==a)return c[d][b(298)];return null},getCollectibleAnalyticsName:function(a){for(var b=a0_0x4eaf03,c=this[b(241)](),d=0;d<=c[b(297)];d++)if(c[d].id==a)return c[d][b(361)];return null},getCollectibleDetails:function(){var a=a0_0x4eaf03;return RSEngine[a(379)][a(365)]("treasures")},getAnalyticsNameByMachineIdentifier:function(a){},getWelcomeBonusData:function(){return this.getSheetData(a0_0x4eaf03(309))}, getBonusFactorDetails:function(){return null},getLevelBucketData:function(){var a=a0_0x4eaf03;return this[a(365)](a(253))},getHourlyBonusData:function(){var a=a0_0x4eaf03;return this[a(365)](a(248))},getDefaultBetForCasino:function(a,b,c){var d=a0_0x4eaf03;!b&&(b=d(250));var e=RSGame[d(374)]().getGameData()[d(365)](a);a=this[d(318)](a,b,c);return parseInt(e[a][b])},getSlotsRGSGameUrl:function(a,b){var c=a0_0x4eaf03,d=RSGame.getInstance()[c(319)]()[c(365)]("RGSGameUrls");if(void 0==d||null==d)return null; for(var e in d)if(parseInt(d[e][c(265)])==a)return b?d[e][c(320)]:d[e][c(295)];return null},getTableGamesRGSGameUrl:function(a,b){var c=a0_0x4eaf03,d=RSGame[c(374)]()[c(319)]()[c(365)](c(373));if(void 0==d||null==d)return null;for(var e in d)if(parseInt(d[e][c(265)])==a)return b?d[e].gameUrl_Live:d[e][c(295)];return null},getKenoRGSGameUrl:function(a,b){var c=a0_0x4eaf03,d=RSGame[c(374)]().getGameData()[c(365)](c(303));if(void 0==d||null==d)return null;for(var e in d)if(parseInt(d[e][c(265)])==a)return b? d[e][c(320)]:d[e][c(295)];return null},getDefaultBetIndexForCasino:function(a,b,c){var d=a0_0x4eaf03;!b&&(b=d(250));!c&&(c=1);var e=RSGame[d(374)]()[d(286)]()[d(366)]()[d(239)](),f=RSGame[d(374)]().getLevelManager()[d(314)]();a=RSGame[d(374)]()[d(319)]()[d(365)](a);var g=-1,h,k,m,n,p=-1,r;for(r in a)if(k=parseInt(a[r].levels),m=parseInt(a[r][b]),h=Math[d(294)](parseFloat(a[r][d(363)])*e),n=m*c,h>=n&&f>=k)if(p!=m)g++,p=m;else return g;return 0>g&&(g=0),parseInt(g)},getDefaultValues:function(){var a= a0_0x4eaf03;return RSEngine[a(379)][a(365)](a(394))[0]},getAppsFlyerValues:function(){var a=a0_0x4eaf03;return(a=RSEngine[a(379)][a(365)]("appsFlyerValues"))?a[0]:null},getPowerupDetails:function(a){for(var b=this[a0_0x4eaf03(285)](),c,d=0;d<b.length;d++)a==b[d].id&&(c=new PowerupsVO(b[d]));return c},getPowerups:function(){var a=a0_0x4eaf03;if(null!=this[a(336)])return this[a(336)];this[a(336)]=[];for(var b=this[a(365)](a(367)),c=0;c<b[a(297)];c++)this[a(336)].push(new PowerupsVO(b[c]));return this[a(336)]}, getSpinWheelData:function(){var a=a0_0x4eaf03;return RSEngine.gameData[a(365)](a(327))},getCurrentVIPStatus:function(a){var b=a0_0x4eaf03;this._vipBenefits=this.getSheetData("vipData");for(var c=0;c<this._vipBenefits[b(297)];c++)if(this._vipBenefits[c][b(340)]==a)return this[b(240)][c];return null},getVIPAdditionalCoinsOnPurchase:function(a){var b=a0_0x4eaf03;this[b(240)]=this[b(365)](b(326));for(var c=0;c<this._vipBenefits[b(297)];c++)if(this[b(240)][c].tier==a)return 100*this[b(240)][c][b(244)]; return 1}});var BlobSyncVarsVO=RSVO.extend({init:function(a){this.xp=this.paidCoins=this.monetization_factor=this.monetization_count=this.coins="";this.lastRewardedPoint=this.aristocratLastWinAmount=this.aristocratLastBetAmount=0;this._super.init.call(this,a);this.coins=parseInt(this.coins);this.monetization_count=parseInt(this.monetization_count);this.monetization_factor=parseFloat(this.monetization_factor);this.paidCoins=parseInt(this.paidCoins);this.xp=parseInt(this.xp);this.aristocratLastBetAmount=parseInt(this.aristocratLastBetAmount); this.aristocratLastWinAmount=parseInt(this.aristocratLastBetAmount);this.lastRewardedPoint=parseInt(this.lastRewardedPoint)}});var PurchasePackVO=RSVO.extend({init:function(a){this.category=this.title=this.id="";this.value=this.price=0;this.imageURL="";this.bundle={};this._super.init.call(this,a)}});var CoinPackVO=PurchasePackVO.extend({init:function(a){this.bonusOfferId="";this.analyticsPrice=0;this.tier4=this.tier2=this.tier1=this.tier0="";this.isOffer=0;this.isCredit=1;this.analyticsName="";this.exitCartValue=0;this.exitCartAnalyticsName=this.price="";this.range=this.subscriptionPeriod=this.baseValue=0;this._super.init.call(this,a);this.bonusOfferId=parseInt(this.bonusOfferId);this.price=parseFloat(this.price).toString();this.analyticsPrice=parseFloat(this.analyticsPrice);this.tier0=parseInt(this.tier0); this.tier1=parseInt(this.tier1);this.tier2=parseInt(this.tier2);this.tier4=parseInt(this.tier3);this.isOffer=parseInt(this.isOffer);this.isCredit=parseInt(this.isCredit);this.exitCartValue=parseInt(this.exitCartValue);this.baseValue=parseInt(this.baseValue);this.subscriptionPeriod=parseInt(this.subscriptionPeriod)}});var PowerupsVO=RSVO.extend({init:function(a){this.analyticsID=this.name=this.id="";this.packProbability=this.probability=0;this.description=this.feedImageURL="";this.activeUsageCount=this.powerUpMeterHike=this.cooldownTime=this.daubCount=0;this.type="";this._super.init.call(this,a)}});var RSFBUser=RSVO.extend({first_name:null,middle_name:null,last_name:null,name:null,picture:null,id:null,third_party_id:null,gender:null,email:null,init:function(a){this.email=this.gender=this.third_party_id=this.id=this.picture=this.name=this.last_name=this.middle_name=this.first_name="";this._super.init.call(this,a)}});var RSSocialManager=function(){var a,b=RSClass.extend({facebook:null,grantedPermission:[],declinedPermission:[],currency:{},_myFbData:{},_purchaseCallBack:null,_requestedPermission:[],myPlayingFriends:[],myNonPlayingFriends:[],_onPlayingFriendsDataLoaded:!1,_onMyDataLoadedCallBack:null,init:function(){this.facebook=RSFBManager.getInstance()},publishAction:function(a,b){cc.log("[RSSocialManager] : Publishing Action");this._publishAction(a,b)},_publishAction:function(a,b){RSFBManager.getInstance().ui("share", a,b,!0)},getPermissionList:function(a){RSFBManager.getInstance().getPermissionList(function(b,e){a.call(b,e)})},hasPermission:function(a){return-1!=this.grantedPermission.indexOf(a)},hasDeclinedPermission:function(a){return-1!=this.declinedPermission.indexOf(a)},checkFBConnected:function(a){RSFBManager.getInstance().checkFBConnected(function(b){a(b)})},showPermissionDialog:function(a,b){RSEngine.closeFullScreen();this._requestedPermission.push(a);cc.log("[RSSocialManager] Requesting Permission: "+ a);var e=this;RSFBManager.getInstance().login([a],function(a,c){cc.log("[RSSocialManager] Permission Dialog responseCode: "+a+":"+c);if(1==a)c.error_message&&cc.log("[RSSocialManager] Permission Dialog Error:"+c.error_message),b(a,c);else{if(void 0!=c.permissions){c.permissions.length&&(e.grantedPermission=[]);for(var h=0;h<c.permissions.length;h++)e.grantedPermission.push(c.permissions[h])}b(0,e.grantedPermission)}})},publishFeed:function(a,b){cc.log("[RSSocialManager] : Publishing Feed");this._publishFeed(a, b)},_publishFeed:function(a,b){var e={};a.linkParams.u=this.genUniqueTrackingTag();a.linkParams.kt_type=a.kt_type;a.trackingTag=a.linkParams.u;var e=a.toObject(),f={};f.name=a.actions;f.link=e.link;e.actionsparams={name:f.name,link:f.link};f={};""!=a.name&&(f.title=this.formatFacebookString(a.name,a.extraParams));""!=a.picture&&(f.picture=a.picture);""!=a.description&&(f.description=this.formatFacebookString(a.description,a.extraParams));f=this.encodeToBase64(JSON.stringify(f));e.link+="\x26source\x3daction_link\x26ref\x3dfeed\x26feed\x3d"+ f;RSFBManager.getInstance().ui("share",e.link,b)},_onFeedPublish:function(a,b,e){b?(RSErrorTracker.getInstance().trackErrorMessage("FACEBOOK_PUBLISH","Feed Publish Failed: Feed_Id: "+a.id+" :- Error Code:- "+b+":"+e.error_message,"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"),cc.log("[RSSocialManager] Feed Publish Failed: Feed_Id: "+a.id+" :- Error Code:- "+b+":"+e.error_message)):cc.log("[RSSocialManager] Feed : "+a.id+" : Published Successfully")},genUniqueTrackingTag:function(){var a= ""+TimeManager.getInstance().getCurrentServerTime()+Math.floor(1E4*Math.random()),a=calcMD5(a);return a.substr(0,16)},formatFacebookString:function(a,b){var e;e=a.split("{player}").join(this._myFbData.first_name);if(b)for(var f in b)e=e.split("{"+f+"}").join(b[f]);return e},getMyData:function(a){this._onMyDataLoadedCallBack=a;RSFBManager.getInstance().api("/me","get",{fields:"third_party_id,email,first_name,middle_name,last_name,name,permissions,currency"},this.onMyDataLoaded.bind(this))},reRequestFriendsData:function(a){this._onMyDataLoadedCallBack= a;this._getPlayingFriendsDetails(null);this._checkMyDataLoaded()},onMyDataLoaded:function(a,b){if(a)RSErrorTracker.getInstance().trackErrorMessage("FACEBOOK_GET_DATA","Facebook data load failed."+JSON.stringify(b),"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"),cc.log("Failed to Load My Data:"+b);else{cc.log("Fetched My Data Successfully");this._myFbData=b;b.currency&&(this.currency=b.currency);for(var e=b.permissions.data,f=0;f<e.length;f++)"granted"==e[f].status?this.grantedPermission.push(e[f].permission): "declined"==e[f].status&&this.declinedPermission.push(e[f].permission);this.hasPermission("user_friends")?this._getPlayingFriendsDetails(null):this._onMyDataLoadedCallBack(this._myFbData)}},_checkMyDataLoaded:function(){!0==this._onPlayingFriendsDataLoaded&&this._onMyDataLoadedCallBack(this._myFbData)},getFBFirstName:function(){return this._myFbData?this._myFbData.first_name:!1},_onFriendsDetailsResponse:function(a,b){this.myPlayingFriends=[];if(a)RSErrorTracker.getInstance().trackErrorMessage("FACEBOOK_FRIENDS_DATA", "Facebook friends data load failed.","mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"),cc.log("Error Loading friends data from facebook!!!!"),this._onPlayingFriendsDataLoaded=!0,this._checkMyDataLoaded();else if(null!=b){var e,f;for(f in b.data)e=new RSFBUser(b.data[f]),this.myPlayingFriends.push(e);b.paging?b.paging.next?this._getPlayingFriendsDetails(b.paging.cursors.after):(this._onPlayingFriendsDataLoaded=!0,this._checkMyDataLoaded()):(this._onPlayingFriendsDataLoaded=!0,this._checkMyDataLoaded())}else this._onPlayingFriendsDataLoaded= !0,this._checkMyDataLoaded()},_getPlayingFriendsDetails:function(a){null==a?RSFBManager.getInstance().api("/me/friends",this.facebook.HttpMethod.GET,{fields:"first_name,middle_name,last_name,third_party_id,name,picture",limit:100},this._onFriendsDetailsResponse.bind(this)):RSFBManager.getInstance().api("/me/friends",this.facebook.HttpMethod.GET,{fields:"first_name,middle_name,last_name,third_party_id,name,picture",limit:100,after:a},this._onFriendsDetailsResponse.bind(this))},getMyAppRequests:function(a){RSFBManager.getInstance().api("/me/apprequests", this.facebook.HttpMethod.GET,{limit:50},a)},deleteRequest:function(a,b){RSFBManager.getInstance().api(a,this.facebook.HttpMethod.DELETE,null,b)},onAppRequestcallback:function(a,b){a?cc.log("FB UI response :"+a+":"+b.error_message):cc.log("Invitation send successfully !!")},sendRequest:function(a,b,e,f){RSEngine.closeFullScreen();var g={};g.message=b;g.title=a;g.to=e;a={gift_type:"GiftBox",action_type:"request"};a.request_time=TimeManager.getInstance().getCurrentServerTime();g.data=JSON.stringify(a); RSFBManager.getInstance().appRequest(g,f)},sendGift:function(a,b,e,f){RSEngine.closeFullScreen();var g={};g.message=b;g.title=a;g.to=e;a={gift_type:"GiftBox",action_type:"send"};a.request_time=TimeManager.getInstance().getCurrentServerTime();g.data=JSON.stringify(a);RSFBManager.getInstance().appRequest(g,f)},sendFbGift:function(a,b,e,f,g){RSEngine.closeFullScreen();var h={};h.message=b;h.title=a;h.to=e;a={};a.gift_type=JSON.stringify(f);a.action_type="send";a.request_time=TimeManager.getInstance().getCurrentServerTime(); h.data=JSON.stringify(a);RSFBManager.getInstance().appRequest(h,g)},showInviteWindow:function(a,b,e,f,g){GlobalVars.fullscreenStatus&&RSEngine.closeFullScreen();var h={};h.message=b;h.title=a;h.to=e;a={};a.u=this.genUniqueTrackingTag();h.data=a;f&&(a.exclude_ids=f);h.filters=["app_non_users"];var k=this;RSFBManager.getInstance().appRequest(h,function(a,b){cc.log("Response From Invite Window");a?cc.log("FB UI response :"+a+":"+b.error_message):(cc.log("Invitation send successfully !!"),b.to&&RSAnalyticsManager.getInstance().trackFBInvite(b.to.length)); "function"===typeof k.callback&&k.callBack(a,b);g&&g(a,b)})},encodeToBase64:function(a){var b={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d",encode:function(a){var c="",g,h,k,m,n,p,r=0;for(a=b._utf8_encode(a);r<a.length;)g=a.charCodeAt(r++),h=a.charCodeAt(r++),k=a.charCodeAt(r++),m=g>>2,g=(g&3)<<4|h>>4,n=(h&15)<<2|k>>6,p=k&63,isNaN(h)?n=p=64:isNaN(k)&&(p=64),c=c+this._keyStr.charAt(m)+this._keyStr.charAt(g)+this._keyStr.charAt(n)+this._keyStr.charAt(p);return c},decode:function(a){var c= "",g,h,k,m,n,p=0;for(a=a.replace(/[^A-Za-z0-9+/=]/g,"");p<a.length;)g=this._keyStr.indexOf(a.charAt(p++)),h=this._keyStr.indexOf(a.charAt(p++)),m=this._keyStr.indexOf(a.charAt(p++)),n=this._keyStr.indexOf(a.charAt(p++)),g=g<<2|h>>4,h=(h&15)<<4|m>>2,k=(m&3)<<6|n,c+=String.fromCharCode(g),64!=m&&(c+=String.fromCharCode(h)),64!=n&&(c+=String.fromCharCode(k));return c=b._utf8_decode(c)},_utf8_encode:function(a){a=a.replace(/rn/g,"n");for(var b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);128>d?b+=String.fromCharCode(d): (127<d&&2048>d?b+=String.fromCharCode(d>>6|192):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128)),b+=String.fromCharCode(d&63|128))}return b},_utf8_decode:function(a){for(var b="",c=0,d=c1=c2=0;c<a.length;)d=a.charCodeAt(c),128>d?(b+=String.fromCharCode(d),c++):191<d&&224>d?(c2=a.charCodeAt(c+1),b+=String.fromCharCode((d&31)<<6|c2&63),c+=2):(c2=a.charCodeAt(c+1),c3=a.charCodeAt(c+2),b+=String.fromCharCode((d&15)<<12|(c2&63)<<6|c3&63),c+=3);return b}};return b.encode(a)},_showInviteWindowResponse:function(a, b){cc.log("Response From Invite Window");a?cc.log("FB UI response :"+a+":"+b.error_message):(cc.log("Invitation send successfully !!"),b.to&&RSAnalyticsManager.getInstance().trackFBInvite(b.to.length))},showPurchaseWindow:function(a,b,e){"subscription"==e?RSFBManager.getInstance().canvas.subscribe({product:a},function(a,c){b(a,c)}):RSFBManager.getInstance().canvas.pay({product:a},function(a,c){b(a,c)})}});return{getInstance:function(){a||(a=new b);return a}}}();var RSFBManager=function(){var a,b=RSClass.extend({name:"",version:"",_userInfo:null,_isLoggedIn:!1,HttpMethod:{GET:"get",POST:"post",DELETE:"delete"},CODE_SUCCEED:0,AppEvent:{ACTIVATED_APP:FB.AppEvents.EventNames.ACTIVATED_APP,COMPLETED_REGISTRATION:FB.AppEvents.EventNames.COMPLETED_REGISTRATION,VIEWED_CONTENT:FB.AppEvents.EventNames.VIEWED_CONTENT,SEARCHED:FB.AppEvents.EventNames.SEARCHED,RATED:FB.AppEvents.EventNames.RATED,COMPLETED_TUTORIAL:FB.AppEvents.EventNames.COMPLETED_TUTORIAL,ADDED_TO_CART:FB.AppEvents.EventNames.ADDED_TO_CART, ADDED_TO_WISHLIST:FB.AppEvents.EventNames.ADDED_TO_WISHLIST,INITIATED_CHECKOUT:FB.AppEvents.EventNames.INITIATED_CHECKOUT,ADDED_PAYMENT_INFO:FB.AppEvents.EventNames.ADDED_PAYMENT_INFO,PURCHASED:FB.AppEvents.EventNames.PURCHASED,ACHIEVED_LEVEL:FB.AppEvents.EventNames.ACHIEVED_LEVEL,UNLOCKED_ACHIEVEMENT:FB.AppEvents.EventNames.UNLOCKED_ACHIEVEMENT,SPENT_CREDITS:FB.AppEvents.EventNames.SPENT_CREDITS},AppEventParam:{CURRENCY:FB.AppEvents.ParameterNames.CURRENCY,REGISTRATION_METHOD:FB.AppEvents.ParameterNames.REGISTRATION_METHOD, CONTENT_TYPE:FB.AppEvents.ParameterNames.CONTENT_TYPE,CONTENT_ID:FB.AppEvents.ParameterNames.CONTENT_ID,SEARCH_STRING:FB.AppEvents.ParameterNames.SEARCH_STRING,SUCCESS:FB.AppEvents.ParameterNames.SUCCESS,MAX_RATING_VALUE:FB.AppEvents.ParameterNames.MAX_RATING_VALUE,PAYMENT_INFO_AVAILABLE:FB.AppEvents.ParameterNames.PAYMENT_INFO_AVAILABLE,NUM_ITEMS:FB.AppEvents.ParameterNames.NUM_ITEMS,LEVEL:FB.AppEvents.ParameterNames.LEVEL,DESCRIPTION:FB.AppEvents.ParameterNames.DESCRIPTION},AppEventParamValue:{VALUE_YES:"1", VALUE_NO:"0"},checkFBConnected:function(a){this._loginResponseStatus=!1;var b=this;this._loginCallback=a;try{this._fbLoginHackTimer=setTimeout(function(){b._isLoggedIn=!1;b._userInfo={};b._loginCallback("notconnected");console.log("inside fbLoginHackTimer")},15E3),FB.getLoginStatus(function(a){b._loginResponseStatus=!0;a&&"connected"===a.status?(b._isLoggedIn=!0,b._userInfo=a.authResponse,b._loginCallback("connected")):(b._isLoggedIn=!1,b._userInfo={},b._loginCallback("notconnected"));clearTimeout(b._fbLoginHackTimer)})}catch(e){b._isLoggedIn= !1,b._userInfo={},a("notconnected")}},_checkLoginStatus:function(){},initialize:function(a){this.name="facebook";this.version="v4.0";this._userInfo={};this._isLoggedIn=!1;FB&&(cc.log("Config :"+JSON.stringify(a)),FB.init(a),this._checkLoginStatus())},login:function(a,b){var e=this;"function"==typeof a&&(b=a,a=[]);a.every(function(a){if("public_profile"!=a)return!0})&&a.push("public_profile");var f=a.join(",");FB.login(function(a){if(a.authResponse){e._isLoggedIn=!0;e._userInfo=a.authResponse;var c= [];a.authResponse.grantedScopes&&(c=a.authResponse.grantedScopes.split(","));"function"===typeof b&&b(0,{accessToken:a.authResponse.accessToken,permissions:c})}else e._isLoggedIn=!1,e._userInfo={},"function"===typeof b&&b(a.error_code||1,{error_message:a.error_message||"Unknown error"})},{scope:f,return_scopes:!0,auth_type:"rerequest"})},isLoggedIn:function(){return this._isLoggedIn},logout:function(a){var b=this;FB.logout(function(e){e.authResponse?(b._isLoggedIn=!1,b._userInfo={},"function"===typeof a&& a(0,{isLoggedIn:!1})):"function"===typeof a&&a(e.error_code||1,{error_message:e.error_message||"Unknown error"})})},_requestPermissions:function(a,b){var e=a.join(","),f=this;FB.login(function(a){if(a.authResponse){var c=a.authResponse.grantedScopes.split(",");f._isLoggedIn=!0;f._userInfo=a.authResponse;"function"===typeof b&&b(0,{permissions:c})}else f._isLoggedIn=!1,f._userInfo={},"function"===typeof b&&b(a.error_code||1,{error_message:a.error_message||"Unknown error"})},{scope:e,return_scopes:!0})}, getAccessToken:function(){return this._userInfo?this._userInfo.accessToken:null},getUserID:function(){return this._userInfo?this._userInfo.userID:null},_share:function(a,b){FB.ui({method:"share",name:a.title,caption:a.caption,description:a.text,href:a.link,picture:a.imageUrl},function(a){a?a.post_id?"function"===typeof b&&b(0,{didComplete:!0,post_id:a.post_id}):"function"===typeof b&&b(a.error_code||1,{error_message:a.error_message||"Unknown error"}):"function"===typeof b&&b(1,{error_message:"Unknown error"})})}, ui:function(a,b,e,f){FB.ui({method:a,href:b,display:f?"popup":"dialog",size:{width:680,height:500}},function(a){var b=!0;a&&a.error_message&&(b=!1);null!=e&&e(b)})},dialog:function(a,b){if(a)if(this.canPresentDialog(a)){a.name=a.name||a.site;delete a.site;a.href=a.href||a.link||a.siteUrl;delete a.siteUrl;delete a.link;a.picture=a.picture||a.image||a.photo||a.imageUrl||a.imagePath;delete a.imageUrl;delete a.imagePath;delete a.photo;delete a.image;a.caption=a.title||a.caption;delete a.title;a.description= a.text||a.description;delete a.text;var e=a.dialog;delete a.dialog;if("shareLink"===e||"feedDialog"==e)a.method="share";else if("messageLink"==e)a.method="send",a.link=a.href;else if("shareOpenGraph"==e&&(a.method="share_open_graph",a.url)){e={};a.preview_property_name?e[a.preview_property_name]=a.url:e.object=a.url;for(var f in a)"method"!=f&&"action_type"!=f&&"action_properties"!=f&&(a[f]&&(e[f]=a[f]),delete a[f]);a.action_properties=JSON.stringify(e)}FB.ui(a,function(a){a&&"function"===typeof b? a.post_id||a.success?b(0,{didComplete:!0,post_id:a.post_id||""}):a.error_code?b(a.error_code,{error_message:a.error_message||"Unknown error"}):b(0,a):void 0==a&&"function"===typeof b&&b(1,{error_message:"Unknown error"})})}else"function"===typeof b&&b(1,{error_message:"The requested dialog: "+a.dialog+" can not be presented on Web"});else"function"===typeof b&&b(1,{error_message:"No info parameter provided"})},canPresentDialog:function(a){return a&&a.dialog&&("shareLink"===a.dialog||"feedDialog"=== a.dialog||"shareOpenGraph"===a.dialog||"messageLink"===a.dialog)?!0:!1},api:function(a,b,e,f){"function"===typeof e&&(f=e,e={});FB.api(a,b,e,function(a){a.error?"function"===typeof f&&f(a.error.code,{error_message:a.error.message||"Unknown error"}):"function"===typeof f&&f(0,a)})},getPermissionList:function(a){FB.api("/me/permissions",function(b){if(b.data){for(var e=[],f=0;f<b.data.length;f++)"granted"==b.data[f].status&&e.push(b.data[f].permission);"function"==typeof a&&a(0,{permissions:e})}else b.error|| (b.error={}),"function"==typeof a&&a(b.error.code||1,{error_message:b.error.message||"Unknown error"})})},destroyInstance:function(){},canvas:{pay:function(a,b){a.method="pay";a.action="purchaseitem";FB.ui(a,function(a){a.error_code?b(a.error_code||1,{error_message:a.error_message||a.error_msg||"Unknown error"}):b(0,a)})},subscribe:function(a,b){console.log("inside subscribe item");a.method="pay";a.action="create_subscription";FB.ui(a,function(a){a&&void 0!=a?a.error_code?b(a.error_code||1,{error_message:a.error_message|| a.error_msg||"Unknown error"}):b(0,a):b(1,{error_message:"Unknown error"})})}},appRequest:function(a,b){a?(a.method="apprequests",FB.ui(a,function(a){a?a.error_code?"function"===typeof b&&b(a.error_code,{error_message:a.error_message||"Unknown error"}):"function"===typeof b&&b(0,a):"function"===typeof b&&b(1,{error_message:"Unknown error"})})):"function"===typeof b&&b(1,{error_message:"No info parameter provided"})},logEvent:function(a,b,e){void 0!=a&&(void 0===b&&void 0===e?FB.AppEvents.logEvent(a, null,null):"number"===typeof b&&void 0===e?FB.AppEvents.logEvent(a,b):"object"===typeof b&&void 0===e?FB.AppEvents.logEvent(a,null,b):FB.AppEvents.logEvent(a,b,e))},activateApp:function(){FB.AppEvents.activateApp()},logPurchase:function(a,b,e){FB.AppEvents.logPurchase(a,b,e)}});return{getInstance:function(){a||(a=new b);return a},initialize:function(b){a.initialize(b)}}}();var VIPDataVO=RSVO.extend({tierName:null,tier:null,bonusMultiplier:null,pointsRequired:null,upgradePoint:null,upgradableTier:null,statusPointsForLevelUp:null,rewardPointsForLevelUp:null,additionalBonusForLevelUp:null,additionalStatusPointsOnPurchase:null,additionalRewardPointsOnPurchase:null,additionalCoinsOnPurchase:null,extraStatusPointAwards:null,extraRewardPointAwards:null,extraBonusAdditions:null,concierge:null,exclusiveGames:null,bgChange:null,init:function(a){this.bgChange=this.exclusiveGames= this.concierge=this.extraBonusAdditions=this.extraRewardPointAwards=this.extraStatusPointAwards=this.additionalCoinsOnPurchase=this.additionalRewardPointsOnPurchase=this.additionalStatusPointsOnPurchase=this.additionalBonusForLevelUp=this.rewardPointsForLevelUp=this.statusPointsForLevelUp=this.upgradableTier=this.upgradePoint=this.pointsRequired=this.bonusMultiplier=this.tier=this.tierName="";this._super.init.call(this,a);this.tier=parseInt(this.tier);this.bonusMultiplier=parseInt(this.bonusMultiplier); this.pointsRequired=parseInt(this.pointsRequired);this.upgradePoint=parseInt(this.upgradePoint);this.upgradableTier=parseInt(this.upgradableTier);this.statusPointsForLevelUp=parseInt(this.statusPointsForLevelUp);this.rewardPointsForLevelUp=parseInt(this.rewardPointsForLevelUp);this.additionalBonusForLevelUp=parseFloat(this.additionalBonusForLevelUp);this.additionalStatusPointsOnPurchase=parseFloat(this.additionalStatusPointsOnPurchase);this.additionalRewardPointsOnPurchase=parseFloat(this.additionalRewardPointsOnPurchase); this.additionalCoinsOnPurchase=parseFloat(this.additionalCoinsOnPurchase);this.concierge=parseInt(this.concierge);this.exclusiveGames=parseInt(this.exclusiveGames);this.bgChange=parseInt(this.bgChange)}});var VIPPurchaseBenefitsVO=RSVO.extend({id:null,price:null,firstPurchaseStatusPoints:null,recurringPurchaseStatusPoints:null,firstPurchaseRewardPoints:null,recurringPurchaseRewardPoints:null,init:function(a){this.recurringPurchaseRewardPoints=this.firstPurchaseRewardPoints=this.recurringPurchaseStatusPoints=this.firstPurchaseStatusPoints=this.price=this.id="";this._super.init.call(this,a);this.price=parseFloat(this.price);this.firstPurchaseStatusPoints=parseInt(this.firstPurchaseStatusPoints);this.recurringPurchaseStatusPoints= parseInt(this.recurringPurchaseStatusPoints);this.firstPurchaseRewardPoints=parseInt(this.firstPurchaseRewardPoints);this.recurringPurchaseRewardPoints=parseInt(this.recurringPurchaseRewardPoints)}});var RSVIPPoints=function(){this._rewardPoints=this._statusPoints=0},RSVIPUserStatus=function(){this._currentTier=void 0;this._vipPoints=new RSVIPPoints;this._upgradePoint=this._pointsRequired=0;this._upgradableTier=!1},RSVIPBonusData=function(){this._bonusValue=this._bonusFactor=this._rewardPointsAwarded=this._statusPointsAwarded=this._valueAwarded=0},RSVIPTierUpEvent="RS_VIP_TIER_UP",RSVIPSyncEvent="RS_VIP_SYNC",RSVIPManager=function(){var a,b=RSClass.extend({vipEnabled:!1,init:function(){this._vipUserStatus= null;this._vipTierInfo=[];this._vipPurchaseBenefits=[];this._levelJump=this._currentLevel=null;this._retryCount=0},initializeVIPManager:function(a,b){this._vipUserStatus=new RSVIPUserStatus;this.vipEnabled=!0;for(var e=0;e<a.length;e++){var f=new VIPDataVO(a[e]);this._vipTierInfo[f.tier]=f}for(e=0;e<b.length;e++)f=new VIPPurchaseBenefitsVO(b[e]),this._vipPurchaseBenefits[f.id]=f;this.getVIPUserDataFromServer("vip_initialize")},getVIPUserStatus:function(){return this._vipUserStatus},getVIPUserTier:function(){return this._vipUserStatus._currentTier}, getadditionalCoinsOnPurchase:function(){return this._vipTierInfo[this._vipUserStatus._currentTier].additionalCoinsOnPurchase},updateVIPUserStatus:function(a,b){this._vipUserStatus._vipPoints._statusPoints+=a;this._vipUserStatus._vipPoints._rewardPoints+=b;var e=this._vipUserStatus._currentTier;this.checkForVIPTierUpgrade();if(this._vipUserStatus._currentTier>e)this.onVIPTierUpgrade()},checkForVIPTierUpgrade:function(){this._vipUserStatus._upgradableTier&&this._vipUserStatus._vipPoints._statusPoints>= this._vipUserStatus._upgradePoint&&(this._vipUserStatus._currentTier+=1,this.setCurrentTierDetails(),this.checkForVIPTierUpgrade())},setCurrentTierDetails:function(){var a=this._vipTierInfo[this._vipUserStatus._currentTier];this._vipUserStatus._pointsRequired=a.pointsRequired;this._vipUserStatus._upgradePoint=a.upgradePoint;this._vipUserStatus._upgradableTier=a.upgradableTier},onVIPTierUpgrade:function(){var a=this.getVIPUserTier();RSEventManager.getInstance().dispatchEvent(RSVIPTierUpEvent,a);RSPlatformSDKManager.getInstance().updateVipTierUp(a); RSAnalyticsManager.getInstance().trackVIPTierUp(a)},getBonusDataForPurchase:function(a,b,e,f,g){var h=this.getPointsForPack(a,e),k=this._vipTierInfo[this._vipUserStatus._currentTier];e=h._statusPoints+k.additionalStatusPointsOnPurchase*h._statusPoints;h=h._rewardPoints+k.additionalRewardPointsOnPurchase*h._rewardPoints;k=k.additionalCoinsOnPurchase;void 0!=f&&(k+=f);f=Math.round(k*b);b=parseInt(b)+f;g&&this.updateVIPUserStatus(e,h);this.getVIPUserDataFromServer(a);a=new RSVIPBonusData;a._valueAwarded= b;a._statusPointsAwarded=e;a._rewardPointsAwarded=h;a._bonusFactor=k;a._bonusValue=f;return a},getPointsForPack:function(a,b){var e=this._vipPurchaseBenefits[a],f=new RSVIPPoints;b?(f._statusPoints=e.firstPurchaseStatusPoints,f._rewardPoints=e.firstPurchaseRewardPoints):(f._statusPoints=e.recurringPurchaseStatusPoints,f._rewardPoints=e.recurringPurchaseRewardPoints);return f},getBonusDataForLevelUp:function(a,b,e){if(null==e||void 0==e)e=1;var f=this._vipTierInfo[this._vipUserStatus._currentTier], g=f.statusPointsForLevelUp*e,h=f.rewardPointsForLevelUp*e,f=f.additionalBonusForLevelUp,k=Math.round(f*b);b+=k;this.updateVIPUserStatus(g,h);this.getVIPLevelUpStatusFromServer(a,e);a=new RSVIPBonusData;a._valueAwarded=b;a._statusPointsAwarded=g;a._rewardPointsAwarded=h;a._bonusFactor=f;a._bonusValue=k;return a},getBonusDataForEvent:function(a,b,e){var f=this._vipTierInfo[this._vipUserStatus._currentTier][a],g=f.statusPointsForEvent*e,h=f.rewardPointsForEvent*e,f=f.additionalBonusForEvent,k=Math.round(f* b);b+=k;this.updateVIPUserStatus(g,h);this.getVIPEventStatusFromServer(a,e);a=new RSVIPBonusData;a._valueAwarded=b;a._statusPointsAwarded=g;a._rewardPointsAwarded=h;a._bonusFactor=f;a._bonusValue=k;return a},getVIPUserDataFromServer:function(a){var b=this,e=[];e[0]=RSEngine.dataManager.getMe().getId();e[1]=a;RSEngine.loginMode==LOGIN_MODE.GUEST?this.getVIPStatusSuccess({result:{data:{tier:0,statusPoints:0,rewardPoints:0}}}):RSEngine.networkManager.sendJSONRPCRequest("Vip.getVipData",e,function(a){b.getVIPStatusSuccess(a)}, function(){b.getVIPStatusFailed(a)})},getVIPLevelUpStatusFromServer:function(a,b){var e=this,f=[];f.level=a;f.levelJump=b;f.event="vip_levelup";this._currentLevel=a;this._levelJump=b;if(RSEngine.loginMode==LOGIN_MODE.GUEST)this.getVIPStatusSuccess({result:{data:{tier:0,statusPoints:0,rewardPoints:0,event:f.event}}});else{var g=this.getVIPEncodedData(f);f.length=0;f=null;RSEngine.networkManager.sendJSONRPCRequest("Vip.setVIPLevelUpStatusPoints",g,function(a){e.getVIPStatusSuccess(a)},function(){e.setVIPStatusFailed()})}}, getVIPEncodedData:function(a){var b=[],e=[],f=RSEngine.dataManager.getMe().getId(),g=TimeManager.getInstance().getCurrentServerTime();a=JSON.stringify(DynamoDBParser.encode(a));e[0]=a;e[1]=g;b[0]=f;b[1]=a+"|"+g+"|"+RSUtils.getHashValue(e);b[2]=GameConfig.PLATFORM;return b},getVIPEventStatusFromServer:function(a,b){var e=this,f=[];f.event=a;f.count=b;if(RSEngine.loginMode==LOGIN_MODE.GUEST)this.getVIPStatusSuccess({result:{data:{tier:0,statusPoints:0,rewardPoints:0,event:f.event}}});else{var g=this.getVIPEncodedData(f); f.length=0;f=null;RSEngine.networkManager.sendJSONRPCRequest("Vip.setVIPCustomStatusPoints",g,function(a){e.getVIPStatusSuccess(a)},function(){e.setVIPStatusFailed(a)})}},getVIPStatusSuccess:function(a){this._retryCount=0;a=a.result.data;if(null!=a){var b=parseInt(a.tier),e=parseInt(a.statusPoints),f=parseInt(a.rewardPoints);null!=e&&(this._vipUserStatus._vipPoints._statusPoints=e);null==f||isNaN(f)||(this._vipUserStatus._vipPoints._rewardPoints=f);null!=b&&(void 0==this._vipUserStatus._currentTier? this._vipUserStatus._currentTier=b:b>this._vipUserStatus._currentTier&&(this._vipUserStatus._currentTier=b,this.onVIPTierUpgrade()),this.setCurrentTierDetails());var g=a.event,h=this;this._dispatchTimer=setInterval(function(){RSEventManager.getInstance().dispatchEvent(RSVIPSyncEvent,g);clearInterval(h._dispatchTimer)},100);"vip_initialize"==g&&RSEngine.loginMode!=LOGIN_MODE.GUEST&&RSGame.getInstance().getUserDataManager().getMe().getFirstSignIn()&&RSGame.getInstance().getGameManager().getVipStatusPointUpdateEnabledStatus()&& this.getVIPEventStatusFromServer("fbLogin",1)}},getVIPStatusFailed:function(a){RSErrorTracker.getInstance().trackErrorMessage("VIP_RESPONSE","VIP response failed from server.","mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net");this.getVIPUserDataFromServer(a)},setVIPStatusFailed:function(a){3>this._retryCount?(this._retryCount++,a?this.getVIPEventStatusFromServer(a,1):this.getVIPLevelUpStatusFromServer(this._currentLevel,this._levelJump)):(this._retryCount=0,RSErrorTracker.getInstance().trackErrorMessage("VIP_RESPONSE", "VIP response failed from server.","mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"))}});return{getInstance:function(){a||(a=new b);return a}}}();var a0_0x10dccc=a0_0x13a9;function a0_0x13a9(a,b){var c=a0_0x2e0b();return a0_0x13a9=function(a,b){return c[a-309]},a0_0x13a9(a,b)}(function(a,b){for(var c=a0_0x13a9,d=a();;)try{if(parseInt(c(661))/1*(parseInt(c(747))/2)+-parseInt(c(512))/3+-parseInt(c(1042))/4+parseInt(c(1075))/5+-parseInt(c(309))/6+parseInt(c(882))/7+parseInt(c(991))/8===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x2e0b,711228); function a0_0x2e0b(){var a="_casinoResult;MULTI_STRIKE_POKER;extraCoins;setFirstPlayed;RS_CONNECTION_LOST_EVENT;MULTI_STRIKE_POKER_TRIO;getSlotBetStructureByName;chat_button;medium;last_card;totalfreeGameWon;onCallBackOnCoinSuccess;onSpinCompleted;updateCumulativeSpinsForFUE;quest_data;setBet;param3;analytics_primary_source;jackpot_pick_bonus;source;getGameData;loading_started;isPreview;Bingo;loading_failed;setUserLeaderBoardData;getCoins;loadDivPreloader;CLEVERTAP_ENABLED;FPC;_onconnectionRetry;WGEAPI.roundEnded;\x3ciframe id\x3d'spin' allow\x3d'autoplay' scrolling\x3d'no' height\x3d'100%' frameborder\x3d'0' width\x3d'100%' marginheight\x3d'0' marginwidth\x3d'0' src\x3d';out_of_credits;loyaltymall;getPreviewType;2162388yjwrwA;WEB_FACEBOOK;_iFrameSpin;machine_identifier;card_select;triggerPrimarySourceEvent;_bGamingOOC;PRIMARY_CURRENCY;setBetForYFageo;notifyGameLoaded;enableFUE;bonusGameRecovering;set_machine_data;handleAGSMachineEvents;multiple_bingos;_betStructureSheetName;RS_CONNECTION_RETRY;eventBeforeButtonClick;isFavoritedMachine;EMAIL;round_complete;rg2xcGameWagerUpdated;addBingoCardsWon;_gameType;_customCasinoInterface;canvas;GUEST;WAGER_REQUESTED;handleToasterPosition;width;ECONOMY;setBetForBGaming;scorebox_win_;6872005UuUSAG;XP_UPDATES;_high5GamesSpinStatus;addPaidCoinsForInternalAristocrat;bonusRemaining;SMART_FOX_CONNECTION_LOST;shake_it_up_win;External Game;player_action;chat_message_sent;notifyLoadingCompleteToCasino;FreeGame;machine_entry;getPreviewMachine;_PendingSpins;_remainingFreeSpinCount;addPrimaryCurrency;_currentHandNumber;parse;getDefaultBetForCasino;cards_won;tutorial_gameplay;totalBet;showCollectibleEngagementPopup;tutorial_completed;show_level_up_popup_in_client;treasurecollectible;Ad_PD_P;exit_game;round_reward;no_of_cards;_risingDigitalFreespinTotal;addXP;dispatchCustomEvent;_dodMachineLoaded;MainLobby;betStops;ScratcherStatsSetHighestWin;powerupOffset;triggerQuestPopup;CARD_SELECT_RESPONSE;getMaxBetValueForPoker;getCasinoHUD;_machineData;_ainsworthBetAmount;AGS_GAME;bingo;includes;isFavoritesEnabled;setLocationForMachineOpenPopup;isSpinGameActive;handleFincoreMachineEvents;_gameName;SET_LEADERBOARD_IN_CLIENT;END;treasureprimaryCurrency;KENO;getAnalyticsNameByMachineIdentifier;isMachineGifted;removeAllScreensExceptMainLobby;RSExternalGameManager;virality;spin;substring;showDaubAlertSale;SPIN_GAME;daubs_count;_bGamingWinAmount;trackRouletteGameAction;isRecovered;getCurrentMachineAnalyticsName;back_button_clicked;FavoritesLobby;BONUS_SPIN;3404346avZIfu;_agsWinAmount;updatePiggyBank;triggerButtonClickEvent;MSP;EVERI_GAME;ranks;betTarget;getDefaultCasinoFont;xp_rewarded;coins;undo;RS_CASINO_BUTTON_DEAL;out_of_currency;notifyRoundStart;continue;getFBAccessToken;SLOTS;bingoPlayed;rg2xcPreloaderStart;roundComplete;EVENT TIMESTAMP MISMATCH;getMaxBetValueForKeno;creditsWon;userCollectibles;scorebox_win;sink;triggerScratcherGameActionEvents;showConnectionLostPopup;bet_changed;card_count;getPowerupAnalyticsIDFromName;creditsDenom;ROCKET_MAN;multipleBingo;maxBetAmount;APP_ID;enableShare;machineBets;getCurrentServerTime;HIGH_FIVE_GAME;handleWazdenMachineEvents;BET_UPDATED;event;status;disableMachineOpenPopup;popupManager;_rouletteOOCStatus;showAdsNotAvailablePopup;hashValue;trigger;MSP_JOBTutorial;WAZDEN_RGS_GAME;collectible_won;rankList;view;RoundStartedEvent;volumeUpdate;getMe;outOfCoins;saveSpinWheelRewards;free_spin_start;map;betting;sessionId;getTournamentMachineId;Error -;triggerTournamentEvents;_postMachineData;indexOf;gameRoundStarted;show_hud;Blackjack;roundRewards;sfxStatus;CP_JOB;shake_it_up_gameplay;RS_POKER_DON_PURCHASE_SUCCESS;visibility;betAmountChange;gameRoundEnded;getMachineDetails;on_content_loaded;timeStamp;getCurrentCoinBalance;getAllMachineUnlockStatus;WGEAPI.status.exit;RoundEndedEvent;powerups;RS_ROULETTE_SESSION_ID;sink_powerups;enableAllHUDButtons;BGAMING;updateSlotMachineBet;notifyBingoRoundStarted;set_bingo_data;CONNECTION_LOST_REFRESH;getMachineDetailsByName;reloadExternalGame;_PENDING_FS;BLACKJACK_V2;resizeSpinGameDiv;bet_time_turbo;_fincoreWinAmount;gameIdle;game_error;_questActionData;bingo_;_ainsworthOOC;trackPokerMaxBetButtonClick;calculateAverageBet;getDefaultValues;round_result;wager;INTERNAL;name;getDaubAlertSessionShownStatus;loaded;loungeName;updatePokerMachineBet;addPowerUps;round_wager;trackDONWin;split_hands;META_TICKET;tutorial_skipped;go_home;gameEnd;_bGamingBetAmount;GAME_LOADED;updateLeaderboardWithBingoWin;button_click;\x3ciframe id\x3d'spin' allow\x3d'autoplay' scrolling\x3d'yes' height\x3d'100%' frameborder\x3d'0' width\x3d'100%' marginheight\x3d'0' marginwidth\x3d'0' src\x3d';jackpot_win;_soundFlag;trackCollectibles;RS_CASINO_BUTTON_TURBO;SpinGame;WGEAPI.freeSpinsStart;getMaxBetValueForSlot;update_max_bet;YFAGEO;Slots;contentWindow;WGEAPI.insufficientCredits;_yfageoOOCOOC;loginMode;xc2rgMusicStatusChanged;getCumulativeSpinsForFUE;machine;free_spin_end;gameData;click;gameSettlePlay;notifyRoundResult;calculateLosingStreak;level;onload;BUY_BACK_RESPONSE;length;risingDigitalGameType;_yfageoBetAmount;roundTotalCost;undefined;session_start;Poker;_betStructure;enableFeatureMode;draw_hands;hideExternalGame;BGAMING_FREESPIN;data;loadRocketmanHud;machineBetValues;machine_event;_postConnectionLostEvent;postMessage;load_time;removeLocalStorageItem;tutorial_game_action;BR_;getPowerUpTotalCount;onBackButton;removeChild;style;trigger_interrupts;xc2rgSoundEffectsStatusChanged;analyticsID;SCORE_BOX_USER_DATA;roulette_bonus_game;pop;left;_rewarded;resume_gameplay;treasure_;tournament_machine_data_request;_betIndex;onQuitCallBack;freeRemaining;_thirdPartyOwnerType;getBingoRoomDetailsByMachineIdentifier;ARISTOCRAT;updateKenoMachineBet;4204131iJiJBP;floor;_externalGameInterface;totalWon;getLocalStorageItem;purchaseAmount;keno_win;trackEvent;_onconnectionLost;init;FeaturePurchaseEvent;ROOM_DETAILS;visible;_oddsWorksBetAmount;setScoreBoxDisplayedValues;addPrimaryCurrencyForDisplay;triggerPrimarySinkEvent;purchase_cart;enumName;room_name;_HashValue;spinWheel;_leaderboardWinAmount;mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net;handleBingoResults;exit;getElementById;roomType;_cardSelectTime;PLAYER_ACTION;isStringContains;_keno_totalWin;getPowerupDetails;gameType;game_play_start;_totalBetAmount;WAGER;FINCORE_BONUSGAME;platform;trackBlackjackWin;RS_CONNECTION_LOST;showHUD;externalGameManager;chat_button_clicked;stringify;musicStatus;_isScratcherLoadingInProgress;screen_name;exit_machine;setExternalBonusSpinActive;powerup_balance;_pendingSpinsStoredData;JACKPOT_LOUNGE_VERSION;_bonusGameTriggerWin;coinSink;tournamaniaEngaged;split;triggerRouletteGameActionEvents;gameLoadingEnded;PZ_;hide_hud;_risingDigitalSoundStatus;hasOwnProperty;getAdsAvailableStatus;amountWon;_spinGameDiv;triggeredFreeGames;DAUB_DETAILS;offset;gameLoadingStarted;setVolumeForAinsworth;setBingoRoomCardCount;machine_loading_started;resizeSpinGameDivFromExternalGame;getPrimaryCurrency;LEADERBOARD_ENABLED;_betLineCount;broadcastToCasino;_risingBetAmount;CHEAT_MODE;trackAutoSpinButtonClick;_parentDiv;balancesUpdate;navigationTarget;treasuresecondaryCurrency;_ainsworthEventOrigin;LeftPosition;_getHashValue;getCurrentLevelVO;AINSWORTH;_currentMachineVO;_postLoyaltyMallMachineData;previous;getAssetPath;triggerSecondarySourceEvent;FINCORE_FREESPIN;bingo_win_;showDaubAlertCart;RoundStart;TableGames;_ainsworthSpinStatus;scorebox_game_action;_ainsworthWinAmount;appID;value;getGameManager;iframe;_defaultBet;ToasterIFrame;round_complete_saving;betStructure;configData;MPP;accessToken;marginLeft;DOD;jackpot_;_gameURL;_updateMachineBet;LoadingCompletedEvent;handleYfageoMachineEvents;PURCHASE_SUCESS_DATA;getCurrentDaubObject;WGEAPI.status.ready;win;hidden;daubAlertTime;addEventListener;secondaryCurrencyOffset;appsflyer_log_error;bingo_tutorial_popup;fontScaleFactor;free_source_powerups;round;innerHTML;enable_hud;handleAinsworthMachineEvents;enableAllButtons;free;topPosition;triggerMachineEvent;getFBId;rg2xcGameWonUpdated;isFreeSpinAvailable;_fincoreOOC;isTournamentLoaded;_konami_wager;_agsBetAmount;bonuStart;1lmCpxK;_screenName;param5;param4;bingo_win;getAvatar;_pendingSpinsDataKey;triggerSecondarySinkEvent;disableAllButtons;getHashValue;insufficientFunds;updateBlackjackV2MachineBet;treasuremetaticket;getPowerupAnalyticsIDFromNameInJSON;bet;SinkEvent;LoyaltyMall;trackScratcherGameAction;updateMachineSound;blackjackBetValues;getRoundId;trackGameStop;gameOpenPlay;_updateMachineData;_maxBetAmount;QUEST_DATA;_machineType;INSUFFICIENT_FUND;setBingoData;param1;getMaxChipUnlocked;freeSpinEnd;createElement;_yfageoOOC;TOTAL_WIN;session_quit;getMachineFUEBonusTriggered;round_summary;multipleBingoRoom;addPopup;stop_auto_spin;_oddsWorkobject;stopMusic;loadMachine;handlePositionAndOffset;DaubAlertSaleStatus;showHudBackground;isjackpotLoaded;_gameResult;powerups_used;EVENT HASH FAILED;_result;getLevelManager;ogType;daubCount;rg2xcGameStatusChange;param2;RS_BACK_BUTTON_TAP;BLACKJACK;isTutorialRoom;calculateLeaderboardWin;levelData_request;appendChild; For Event ;RS_SLOTS_BONUS_GAME_WIN;unLoadExternalGame;ante_limit;getDaubAlertTime;getDonPacks;RS_NEXT_SCRATCHER;notifyOutOfCurrencyToCasino;volume;BINGO_GAME_ACTION;BaseGame;on_round_complete_collect;getNextScratcherMachineToLoad;IS_ENCRYPTION_ENABLED;trackPowerUpCollected;dispatchEvent;lastEventTimeStamp;extend;_z2uy39283ye2n8mz92phdfp2;bingoWins;IS_EDIT_FIELDS_ENABLED;double_bet;Scratcher;347838pUnqBN;Bet;user_info;machine_result;audio_sfx;show_collectible;levelData;RISING_DIGITAL_GAME;apply;notifyOutOfCredits;FINCORE;voiceCalloutsStatus;isFirstSpinOnMachine;add_primary_currency;trackErrorMessage;setSound;bingoRanks;skip;setDODSoundAndMusic;_isMachineUnlocked;round_start;Roulette;disableAllHUDButtons;Error from external game - ;getCurrentLevel;scorebox;rg2xcGameResultShown;send;_bingoEntryCoins;powerup;customDaub;gui_jackpot_lounge;treasureshadowCardDetails;RSExplicitOgPopup;CALLOUTS;_rocketManTotalWin;loadPreviousScreen;power_up;setBetForAinsworth;music_volume;setXP;handleRisingDigitalMachineEvents;defaultBet;payLines;isInsideMachine;bind;_loader;scrolling;kenoStatsSetHighestWin;dataManager;getCasinoInterface;line_win;post_message;maxChipUnlocked;START;getCustomMessage;rect(;_oddsWorkEventSource;spin_wheel;substr;bonus_game;getPowerUps;WGEAPI.freeSpinsEnd;mahesh.jose@rubyseven.net;getUserCollectibles;subCategory;CARD_BUYIN;notify_orientation_change;primaryCurrencyOffset;winningsUpdate;GameLoadingProgress;GAME_ID;\x3c/iframe\x3e;resetFrameHeight;getRouletteMaxChipUnlocked;result;QUEST_ENABLED;ante;notifyBetChangeToPlacementManager;_agsFeatureModeStatus;_highFiveOOC;_bingoRewards;getPopupCount;trackSlotBetChange;showSurfacing;currency;call;_toasterData;GameLoaded;FACEBOOK;_analyticsID;amountBet;getGameType;notifyResultToCasino;trackInHouseEvent;_toasterDiv;handleEveriMachineEvents;machine_loaded;setVolumeForBGaming;jackpotLoungeEngaged;YFAGEO_RARECASE_WINAMOUNT;action;tutorial_started;Cocos2dGameContainer;denomination;setAttribute;gameReady;getCurrentSessionId;notifyError;getSheetData;giftedSpinCount;roulette_game_action;bold;game_play_end;LNC;_machineAnalyticsID;spinsForFUEBonus;BetChange;origin;RSVP;secondaryCurrency;profile;getUserFirstName;gameStart;_postTournamentMachineData;_jackPotLoungeName;top;_contentTimestamp;MSP_JOBTutorial_tutorial;_oddsWorkEventOrigin;modeChanged;updateXPBar;showRoundCompletePopups;setBlackjackHighestWin;isLeanplumNavigation;309680TyGrlX;first_daub;InsufficientBalance;getInstance;_ainsworthEventSource;creditsBet;_dodTutorialActive;parseGameplayAction;getCurrentMachineVO;SHOW_POWERUP_CART;_wazdenBetAmount;startsWith;method;_fincoreSpinStatus;_soundUpdateinterval;RANKS;add_display_primary_currency;_fincoreBetAmount;quit;setCardCount;shake_it_up_tutorial;GUI;getId;getPowerUpList;msgId;chat;handleResultComplete;_highFiveWinAmount;_agsOOC;back_button_pressed;S_DLN;height;log_error;_yfageoWinAmount;RS_BINGO_LEVEL_DATA;machine_name;src;_machineParams;_postTournamentMachineDataForPoker;RS_CASINO_BUTTON_AUTO_SPIN;tutorial_popup;pow;marginTop;spinGameDivOnload;notifyEventTriggerToPlacementManager;setVolumeForFincore;screenWidth;setLocalStorageItem;Scorebox;getTournamentInfoPopupTexts;getLosingStreakManager;_oddsWorksWinAmount;BET_UNLOCK_POPUP_ENABLED;postMessageToBingo;RS_PREVIOUS_SCRATCHER;betAmount;getUserDataManager;waiting_screen;addSecondaryCurrencyForDisplay;cardCount;YFAGEO_FREESPIN;machineAnalyticsID;Keno;now;ROULETTE;double_down;game_play;BonusGame;BINGO;parentNode;bingo_count;getLevelBarProgress;_bGamingSpinStatus;getLevelXPOffset;_wazdenWinAmount;getInterface;pokerStatsSetHighestWin;_bingoOG;WGEAPI.roundStarted;isCheatActive;Ad_PD_E;jackpotCustomInterfaceCalls;rank;state;isPurchaseEnabled;setRoundId;triggerAssetLoadingFailedEvent;disabled;SECONDARY_CURRENCY;type;_totalWinAmount;random;notifySpinStartToCasino;blob_Sync;audio_music;ODDS_WORKS_GAME;next_card;xpOffset;scratcher_game_action;cheat;primaryCurrency;buy_back;_highFiveBetAmount;showLevelUpPopups;KONAMI_GAME;error;param;clip;card_cost;13024264xgIXbe;freeGameStart;bingoData;_yfageoSpinStatus;lastIndexOf;TRIVIA_XP;getCollectibleAnalyticsName;postMessageToJackpot;betLevels;gamePlay;extra;isNewMachine;SPIN_GAME_V2;notifyRoundComplete;energy".split(";");a0_0x2e0b= function(){return a};return a0_0x2e0b()} var RS_CONNECTION_LOST_EVENT=a0_0x10dccc(1010),RS_CONNECTION_RETRY=a0_0x10dccc(1058),RSExternalGameParams=function(){var a=a0_0x10dccc;this[a(1065)]="";this[a(1127)]="";this._betStructure=null;this[a(505)]=0;this[a(443)]=null;this[a(837)]="";this[a(629)]=""},RSExternalGameManager=RSClass[a0_0x10dccc(741)]({_machineParams:null,_externalGameInterface:null,_spinGameDiv:null,_parentDiv:null,_toasterDiv:null,_iFrameSpin:null,_bingoEntryCoins:0,_casinoResult:null,_currentHandNumber:5,_bingoRewards:null, _dodMachineLoaded:!1,_dodTutorialActive:!1,_contentTimestamp:0,_konami_wager:0,_leaderboardWinAmount:0,_questActionData:null,_risingDigitalFreespinTotal:0,_risingBetAmount:0,_agsOOC:!1,_oddsWorksBetAmount:0,_oddsWorksWinAmount:0,_oddsWorkEventSource:null,_oddsWorkEventOrigin:null,_ainsworthEventSource:null,_ainsworthEventOrigin:null,_ainsworthBetAmount:0,_ainsworthWinAmount:0,_ainsworthOOC:!1,_ainsworthSpinStatus:0,_fincoreBetAmount:0,_fincoreWinAmount:0,_fincoreOOC:!1,_fincoreSpinStatus:0,_bGamingBetAmount:0, _bGamingWinAmount:0,_bGamingOOC:!1,_bGamingSpinStatus:0,_yfageoBetAmount:0,_yfageoWinAmount:0,_yfageoOOC:!1,_yfageoSpinStatus:0,_wazdenWinAmount:0,_wazdenBetAmount:0,_highFiveBetAmount:0,_highFiveWinAmount:0,_high5GamesSpinStatus:0,_highFiveOOC:!1,_keno_totalWin:0,_risingDigitalSoundStatus:!1,_isScratcherLoadingInProgress:!1,_rouletteOOCStatus:0,init:function(){var a=a0_0x10dccc;this._super[a(521)][a(833)](this);RSEventManager[a(885)]()[a(639)](RS_CONNECTION_LOST_EVENT,this,this[a(520)][a(792)](this)); RSEventManager[a(885)]().addEventListener(RS_CONNECTION_RETRY,this,this[a(1036)][a(792)](this))},getName:function(){return a0_0x10dccc(1135)},setMachineParams:function(a){this[a0_0x10dccc(919)]=a},getCustomExternalGameInterface:function(){return this[a0_0x10dccc(514)]},setCustomExternalGameInterface:function(a){this._externalGameInterface=a},loadExternalGame:function(a){var b=a0_0x10dccc;GlobalVars.lastEventTimeStamp=Date[b(945)]();this[b(919)]=a;a=document[b(693)]("div");a.id=b(446);this[b(919)][b(508)]&& RSGame[b(885)]()[b(617)]()[b(839)]()==RSGameTypes.Slots&&parseInt(this[b(919)]._thirdPartyOwnerType)==CasinoExternalGameType[b(342)]?a[b(646)]=b(441)+this[b(919)]._gameURL+"'\x3e\x3c/iframe\x3e":a[b(646)]=b(1038)+this._machineParams._gameURL+"'\x3e"+b(819);null==this[b(593)]&&(this[b(593)]=document[b(538)](b(850)));this[b(919)]._thirdPartyOwnerType&&RSGame[b(885)]()[b(617)]().getGameType()==RSGameTypes.Slots&&parseInt(this._machineParams[b(508)])==CasinoExternalGameType[b(342)]?(this[b(593)].after(a), resize()):this[b(593)][b(723)](a);this[b(1033)]();a[b(466)]=this[b(925)]();this[b(514)].notifyLoadStart();this[b(410)]();if(typeof SideMenuController!==b(472))SideMenuController.getInstance()[b(705)]()},loadToasterImage:function(a){var b=a0_0x10dccc;if(null==this[b(842)]){var c=document[b(693)](b(618));c[b(852)]("id",b(620));c[b(852)](b(794),"no");c[b(852)](b(969),"true");c[b(852)](b(493),"position:absolute;left: 140px;top: 35px; border: 0; width: 225px; height: 126px; display: block; z-index: 999;"); c[b(852)](b(918),"/res/WebAssets/Toaster.html?ToasterImage\x3d"+a);a=document[b(538)]("Cocos2dGameContainer");this[b(919)]._thirdPartyOwnerType&&RSGame[b(885)]()[b(617)]()[b(839)]()==RSGameTypes.Slots&&parseInt(this[b(919)][b(508)])==CasinoExternalGameType[b(342)]?a.after(c):a[b(723)](c);this[b(1070)]()}},handleToasterPosition:function(){var a=a0_0x10dccc,b=document.getElementById("ToasterIFrame");null!=b&&null==this[a(842)]&&(this[a(842)]=b);var c=document.getElementById(a(850)),d=c[a(493)][a(913)], e=c.style[a(1071)],c=document[a(538)](a(850))[a(493)].paddingLeft,d=parseInt(d.substring(0,d[a(468)]-2))/640;this._toasterData=RSGame[a(885)]().getGameManager().getToasterStyleData();b.style[a(873)]=this._toasterData[a(651)]*d+"px";e=parseInt(e[a(1138)](0,e[a(468)]-2))/1136;b[a(493)][a(500)]=140*e+"px";b[a(493)].width=225*d+"px";b.style[a(913)]=126*d+"px";GameConfig.GAME_ID==a(866)&&this[a(834)][a(598)]&&(b[a(493)].left=this._toasterData[a(598)]*d+"px");b.style.paddingLeft=c},hideToaster:function(){var a= a0_0x10dccc;null==this._toasterDiv&&(this[a(842)]=document[a(538)]("ToasterIFrame"));null!=this[a(842)]&&this[a(842)].parentNode&&this._toasterDiv[a(951)][a(492)](this[a(842)]);this[a(842)]=null},loadDivPreloader:function(){var a=a0_0x10dccc;null==this._spinGameDiv&&(this[a(577)]=document[a(538)]("SpinGame"));null!=this[a(577)]&&(this._spinGameDiv[a(493)].visibility=a(637))},spinGameDivOnload:function(){var a=a0_0x10dccc;null==this[a(577)]&&(this[a(577)]=document.getElementById(a(446)));this[a(577)].style[a(387)]= a(524)},resizeSpinGameDiv:function(){var a=a0_0x10dccc;null==this._spinGameDiv&&(this[a(577)]=document[a(538)](a(446)));null!=this._spinGameDiv&&(RSGame&&RSGame[a(885)]().getGameManager()&&RSGame[a(885)]()[a(617)]()[a(585)](this._machineParams,this._spinGameDiv),this._iFrameSpin=document[a(538)](a(1137))[a(452)])},reloadExternalGame:function(){var a=a0_0x10dccc;if(this[a(919)]&&RSGame.getInstance()[a(617)]().getGameType()==RSGameTypes[a(451)]){var b=RSGame[a(885)]().getGameManager()[a(890)]();if(""!= b&&b[a(545)]!=CasinoExternalGameType[a(423)]&&GlobalVars[a(791)]){var c=document.getElementById("spin"),d=c[a(918)];if(b.gameType==CasinoExternalGameType[a(754)])var d=decodeURI(d),e=d[a(995)]("|"),b=d[a(806)](0,e+1),e=d[a(806)](e+11,d[a(468)]),f=TimeManager[a(885)]()[a(348)](),d=b+f+e,d=encodeURI(d);c.src="";setTimeout(function(){c[a(918)]=d+"\x26r7cache\x3d"+Math[a(513)](1E4*Math.random())+" "},2E3)}}},reloadTableGame:function(){var a=a0_0x10dccc;if(GlobalVars.isInsideMachine){var b=document.getElementById(a(1137)), c=b[a(918)],c=decodeURI(c),d=c[a(995)]("|"),e=c[a(806)](0,d+1),d=c.substr(d+11,c[a(468)]),f=TimeManager.getInstance()[a(348)](),c=e+f+d,c=encodeURI(c);b.src="";setTimeout(function(){b[a(918)]=c+"\x26r7cache\x3d"+Math[a(513)](1E4*Math[a(973)]())+" "},1E3)}},customResizeSpinDiv:function(a,b,c,d){var e=a0_0x10dccc;null==this[e(577)]&&(this[e(577)]=document[e(538)]("SpinGame"));null!=this._spinGameDiv&&(this._spinGameDiv[e(493)][e(924)]=b+"px",this[e(577)].style[e(626)]=a+"px",this._spinGameDiv[e(493)][e(1071)]= c+"px",this[e(577)].style[e(913)]=d+"px")},updateFromExternalGame:function(a,b){var c=a0_0x10dccc;a==c(641)&&RSErrorTracker[c(885)]().trackErrorMessage(a,"Error - "+b,c(535));if(b.hashValue&&this[c(919)]){var d=b.timeStamp;if(d>this[c(874)]){if(this[c(874)]=d,d=b[c(358)],delete b.hashValue,this[c(599)](b)!=d){RSErrorTracker[c(885)]()[c(761)](c(711)," For Event "+JSON[c(556)](b),c(810));return}}else{RSErrorTracker[c(885)]()[c(761)](c(330),c(724)+JSON[c(556)](b),"mahesh.jose@rubyseven.net");return}}d= Math[c(513)](b.balance)-RSGame[c(885)]().getUserDataManager()[c(367)]().getCoins();if(this[c(919)])if(this[c(919)][c(1065)]==RSGameTypes[c(451)]||this[c(919)]._gameType==RSGameTypes[c(611)])this._machineParams[c(508)]&&this._machineParams[c(508)]==CasinoExternalGameType[c(314)]?void 0!=b.id&&(a=b.id):this._machineParams[c(508)]&&this[c(919)][c(508)]==CasinoExternalGameType[c(1120)]?void 0!=b&&(a=b.action,b=b[c(480)]):this[c(919)][c(508)]&&this[c(919)][c(508)]==CasinoExternalGameType[c(754)]?void 0!= b&&(b[c(965)]?a=b[c(965)].name:b[c(352)]&&(a=b[c(352)][c(424)]),b[c(965)]&&(b=b[c(965)])):this[c(919)][c(508)]&&this[c(919)][c(508)]==CasinoExternalGameType[c(977)]?b[c(623)]?this[c(1044)]&&this[c(1125)]()&&this[c(804)]&&this[c(804)][c(485)](JSON[c(556)]({msgId:c(589),status:!0}),this[c(876)]):(a=b[c(906)],this[c(702)]=b):this[c(919)]._thirdPartyOwnerType&&this[c(919)]._thirdPartyOwnerType==CasinoExternalGameType[c(361)]?b[c(894)]&&(a=b[c(894)]):this[c(919)]._thirdPartyOwnerType&&this[c(919)]._thirdPartyOwnerType== CasinoExternalGameType.HIGH_FIVE_GAME?b[c(971)]&&(a=b.type[c(530)]):this[c(919)]._thirdPartyOwnerType&&this[c(919)]._thirdPartyOwnerType==CasinoExternalGameType[c(601)]?b[c(971)]?a=b.type[c(530)]:b[c(424)]&&b[c(424)]==c(900)&&(a=b[c(424)]):this[c(919)][c(508)]&&this[c(919)][c(508)]==CasinoExternalGameType.FINCORE&&b&&(a=b.name);else if(this[c(919)]._gameType==RSGameTypes[c(474)]&&this[c(919)]._thirdPartyOwnerType==CasinoExternalPokerGameType[c(627)]){this._handleDODMachineEvents(a,b);return}if(this[c(919)][c(508)])switch(parseInt(this._machineParams[c(508)])){case CasinoExternalGameType[c(314)]:this[c(843)](a, b);break;case CasinoExternalGameType.AGS_GAME:this[c(1055)](a,b);break;case CasinoExternalGameType[c(754)]:this[c(788)](a,b);break;case CasinoExternalGameType.ODDS_WORKS_GAME:this.handleOddsworksMachineEvents(a,b);break;case CasinoExternalGameType[c(361)]:this[c(350)](a,b);break;case CasinoExternalGameType[c(349)]:this.handleHighFiveMachineEvents(a,b);break;case CasinoExternalGameType[c(601)]:this[c(648)](a,b);break;case CasinoExternalGameType[c(757)]:this[c(1126)](a,b);break;case CasinoExternalGameType[c(401)]:this.handleBGamingMachineEvents(a, b);break;case CasinoExternalGameType[c(450)]:this[c(632)](a,b)}if(this[c(919)][c(1065)]==RSGameTypes[c(451)]&&this[c(919)]._thirdPartyOwnerType&&(this[c(919)]._thirdPartyOwnerType==CasinoExternalGameType[c(423)]||this._machineParams[c(508)]==CasinoExternalGameType[c(1140)]||this._machineParams[c(508)]==CasinoExternalGameType.SPIN_GAME_V2||this._machineParams[c(508)]==CasinoExternalGameType[c(510)]||this._machineParams[c(508)]==CasinoExternalGameType[c(986)]||this._machineParams[c(508)]==CasinoExternalGameType[c(342)])|| this[c(919)][c(1065)]!=RSGameTypes.Slots||GlobalVars[c(708)]||GlobalVars[c(657)])switch(a){case c(1030):RSCasinoManager[c(797)]()[c(968)]&&RSCasinoManager.getCasinoInterface().triggerAssetLoadingFailedEvent(b);break;case "loyaltymall_machine_data_request":this[c(603)]();break;case c(483):d=[];d.push(b[c(424)]);for(i in b)-1!=i[c(378)](c(988))&&(d[i[c(568)](c(988))[1]]=b[i]);RSCasinoManager[c(797)]().triggerMachineEvent.apply(RSCasinoManager[c(797)](),d);if(b[c(424)]==RSAnalyticsManager.getInstance()[c(1145)]()+ "_FS_PENDING"){var e=[],f=JSON[c(556)](d[1]);e[0]=f;this[c(667)]&&(RSUtils[c(929)](this[c(667)]+"_HashValue",RSUtils.getHashValue(e)),RSUtils[c(929)](this._pendingSpinsDataKey,f))}b[c(424)]==c(980)&&this[c(336)][c(755)](this,d);b[c(424)]==c(858)&&this[c(569)][c(755)](this,d);"ACTIVE_POKER_HANDS"==b[c(424)]&&b[c(690)][c(568)]("_")[0]==c(624)&&(this[c(1092)]=b[c(717)]);if(b.name==c(725)||"RS_KENO_BONUS_GAME_WIN"==b[c(424)])!this[c(415)]&&this[c(1006)]&&(this[c(415)]=this[c(1006)]),this[c(415)][c(972)]= this[c(415)]._totalWinAmount+b[c(690)];else if(b[c(424)]==c(936)){if(this._isScratcherLoadingInProgress)break;this[c(558)]=!0;e=parseInt(b[c(690)]);d=b[c(717)];e=RSGame[c(885)]().getGameData()[c(736)](e,d,c(604));f=RSGame.getInstance()[c(1026)]()[c(390)](RSGameTypes[c(746)],e);setTimeout(function(){RSEngine[c(554)][c(726)]()},400);RSGame.getInstance()[c(617)]()[c(1124)](null,null);RSGameScreenManager[c(885)]()[c(1134)]();GlobalVars.isjackpotLoaded=!1;RSGame.getInstance()[c(617)]()[c(354)]();this[c(336)](c(980), c(1015),"",e,d,"");RSCasinoManager[c(797)]()[c(704)](RSGameTypes[c(746)],f[c(1045)],RSGameScreens.Machine)}else if(b[c(424)]==c(730)){if(this[c(558)])break;this._isScratcherLoadingInProgress=!0;e=parseInt(b[c(690)]);d=b[c(717)];e=RSGame[c(885)]()[c(1026)]().getNextScratcherMachineToLoad(e,d,"next");f=RSGame[c(885)]()[c(1026)]()[c(390)](RSGameTypes[c(746)],e);setTimeout(function(){RSEngine.externalGameManager.unLoadExternalGame()},400);RSGame[c(885)]()[c(617)]()[c(1124)](null,null);RSGameScreenManager[c(885)]().removeAllScreensExceptMainLobby(); GlobalVars[c(708)]=!1;RSGame.getInstance()[c(617)]()[c(354)]();this[c(336)](c(980),c(978),"",e,d,"");RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes[c(746)],f[c(1045)],RSGameScreens.Machine)}else b[c(424)]===c(497)?(0<b[c(1022)]&&(RSCasinoManager[c(1091)](parseInt(b.param3)),RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],c(1074)+b.param2,b[c(1022)],b[c(664)],b[c(690)]),RSEngine.externalGameManager[c(721)](parseInt(b.param3)),GameConfig[c(587)]&&RSLeaderboard[c(1031)](this[c(534)])), RSGame[c(885)]()[c(938)]()[c(367)]()[c(526)](b[c(690)],b.param2,b.param3)):b.name==c(613)?(this[c(872)]=c(628)+this[c(919)][c(427)],this.triggerScoreboxGameActionEvents[c(755)](this,d)):"player_action"==b[c(424)]&&RSAnalyticsManager.getInstance()[c(841)](RSEventCategory[c(541)],b[c(690)],b[c(717)],b.param3,b[c(664)],b[c(663)]);b.name==c(778)&&b[c(690)]&&b[c(690)]==c(1024)&&RSEngine[c(554)].hideToaster();break;case c(376):RSCasinoManager[c(797)]()[c(376)](b);break;case c(426):this[c(919)]&&this[c(919)][c(508)]&& RSGame[c(885)]().getGameManager()[c(839)]()==RSGameTypes.Slots&&this._machineParams[c(508)]!=CasinoExternalGameType.ROCKET_MAN&&this[c(1021)](this[c(919)][c(475)],this[c(919)][c(505)]);this.setSound(this[c(919)][c(443)]);this[c(514)][c(1051)](this._machineParams._analyticsID,this._machineParams[c(1065)]);RSCasinoManager[c(1117)]().enableAllButtons();this[c(919)]&&this[c(919)][c(508)]&&RSGame[c(885)]().getGameManager().getGameType()==RSGameTypes.Slots&&this[c(919)][c(508)]==CasinoExternalGameType[c(342)]&& RSCasinoManager.getCasinoHUD()[c(481)]();break;case c(767):this._machineParams&&this._machineParams[c(508)]&&RSGame[c(885)]()[c(617)]()[c(839)]()==RSGameTypes.Slots&&this[c(919)][c(508)]==CasinoExternalGameType[c(342)]&&(0<Math[c(513)](b[c(675)])&&(this[c(658)]=Math[c(513)](b[c(675)])),!isNaN(this[c(658)])&&this[c(658)]<=RSCasinoManager[c(586)]()&&(1==parseInt(RSGame[c(885)]()[c(1026)]()[c(420)]()[c(1123)])&&RSGame[c(885)]()[c(617)]()[c(1060)](RSGameTypes[c(451)],this._machineParams[c(837)])?RSCasinoManager.triggerPrimarySinkEvent(c(1137), this[c(658)],this[c(919)][c(837)],RSGameScreens[c(1147)]):RSCasinoManager[c(528)](c(1137),this._konami_wager,this[c(919)][c(837)]),RSEventManager[c(885)]()[c(739)](c(963),{type:"betAmountChange",amount:this._konami_wager}),RSCasinoManager[c(527)](c(422),-this._konami_wager)));RSCasinoManager[c(1117)]()[c(669)]();this._machineParams&&RSGame[c(885)]()[c(617)]()[c(839)]()==RSGameTypes[c(451)]&&this[c(919)][c(508)]&&(this[c(919)][c(508)]==CasinoExternalGameType[c(342)]&&!isNaN(this[c(658)])&&this[c(658)]<= RSCasinoManager[c(586)]()||this[c(919)]._thirdPartyOwnerType!=CasinoExternalGameType[c(342)])&&(RSGame[c(885)]().getGameManager().setExternalBonusSpinActive(!0),this[c(514)][c(323)]());break;case c(430):0<Math[c(513)](b[c(422)])&&(this._konami_wager=Math[c(513)](b[c(422)]));break;case "round_result":e=d=0;this[c(782)]=0;f=RSGame[c(885)]()[c(617)]()[c(890)]();RSGame[c(885)]()[c(617)]().getGameType()==RSGameTypes[c(451)]&&f[c(545)]==CasinoExternalGameType[c(342)]?(b.win&&0<Math.floor(b[c(636)])&&(e= Math[c(513)](b.win)),b[c(442)]&&0<Math[c(513)](b[c(442)])&&(e+=Math[c(513)](b[c(442)])),this._rocketManTotalWin=e):f[c(545)]==CasinoExternalGameType[c(986)]?(d=this[c(658)],e=Math[c(513)](b[c(636)]),this[c(658)]=0):(d=Math[c(513)](b[c(422)]),e=Math.floor(b.result));!isNaN(d)&&0<d?this[c(919)][c(1065)]==RSGameTypes.Slots?(1==parseInt(RSGame[c(885)]()[c(1026)]().getDefaultValues().isFavoritesEnabled)&&RSGame[c(885)]()[c(617)]().isFavoritedMachine(RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager.triggerPrimarySinkEvent(c(1137), d,this[c(919)][c(837)],RSGameScreens[c(1147)]):RSCasinoManager[c(528)](c(1137),d,this[c(919)]._analyticsID),RSEventManager[c(885)]()[c(739)](c(963),{type:c(388),amount:d}),RSCasinoManager[c(527)]("wager",-d)):this[c(919)]._gameType==RSGameTypes[c(944)]&&(RSCasinoManager[c(528)]("draw_hands",d,this[c(919)][c(837)]),RSCasinoManager.addPrimaryCurrencyForDisplay(c(477),-d)):isNaN(e)||(this[c(919)][c(1065)]==RSGameTypes[c(451)]&&0<e?1==parseInt(RSGame[c(885)]()[c(1026)]()[c(420)]().isFavoritesEnabled)&& RSGame[c(885)]()[c(617)]()[c(1060)](RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],c(798),e,this[c(919)][c(837)],RSGameScreens[c(1147)]):RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],c(798),e,this[c(919)]._analyticsID):this[c(919)][c(1065)]==RSGameTypes.Keno&&0<e&&RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],c(518),e,this[c(919)][c(837)]));f[c(545)]==CasinoExternalGameType[c(986)]&&this[c(919)][c(1065)]==RSGameTypes[c(451)]&&0<e&&(1==parseInt(RSGame[c(885)]()[c(1026)]()[c(420)]().isFavoritesEnabled)&& RSGame.getInstance()[c(617)]()[c(1060)](RSGameTypes.Slots,this[c(919)][c(837)])?RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],c(798),e,this[c(919)]._analyticsID,RSGameScreens[c(1147)]):RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],c(798),e,this[c(919)]._analyticsID));RSGame[c(885)]()[c(617)]()[c(839)]()==RSGameTypes[c(451)]&&f[c(545)]==CasinoExternalGameType[c(342)]?this[c(514)].notifyRoundResult(this[c(658)],e):this[c(514)][c(463)](d,e);break;case c(1062):RSGame[c(885)]()[c(617)]()[c(561)](!1); if(RSGame.getInstance().getGameManager()[c(839)]()==RSGameTypes[c(451)]&&this._machineParams[c(508)]==CasinoExternalGameType[c(342)])if(parent[c(485)]({type:"alignToTop"},"*"),0<this._konami_wager)RSCasinoManager[c(527)](c(798),this[c(782)]),this._konami_wager=this[c(782)]=0;else break;else isNaN(d)||(this[c(919)][c(1065)]==RSGameTypes[c(451)]?RSCasinoManager.addPrimaryCurrencyForDisplay(c(798),d):this[c(919)]._gameType==RSGameTypes[c(944)]&&RSCasinoManager[c(527)](c(518),d));GlobalVars[c(708)]&& 2<=GameConfig[c(564)]&&RSEngine[c(554)].postMessageToJackpot({type:c(1018),coinBalance:RSEngine[c(796)][c(367)]().getCoins(),winAmount:this[c(514)][c(712)]});this._externalGameInterface.notifyRoundComplete();RSCasinoManager.getCasinoHUD().enableAllButtons();0<d&&this[c(919)][c(1065)]==RSGameTypes.Keno&&(RSGame[c(885)]()[c(938)]()[c(367)]().kenoStatsSetHighestWin(d),GameConfig[c(587)]&&RSLeaderboard[c(1031)](d));RSCasinoManager[c(797)]()[c(879)]();break;case c(987):RSErrorTracker.getInstance()[c(761)](c(1082), c(770)+this[c(919)][c(1127)],c(535));RSCasinoManager[c(1117)]().enableAllButtons();this[c(514)][c(855)]();break;case c(1039):RSCasinoManager[c(1117)]()[c(649)]();RSCasinoManager.notifyOutOfCurrencyToCasino(32E6);this[c(514)][c(756)]();break;case c(584):RSEventManager.getInstance()[c(739)](c(391));break;case c(844):this._casinoResult=null;RSCasinoManager[c(1085)](b[c(458)]);this[c(667)]=RSAnalyticsManager[c(885)]()[c(1145)]()+"_"+RSGame.getInstance()[c(938)]()[c(367)]()[c(904)]()+c(1089);this[c(563)]= RSUtils[c(516)](this[c(667)]);this[c(919)]._gameType==RSGameTypes.Roulette?(d=RSAnalyticsManager[c(885)]()[c(854)](),d={event:c(799),name:c(398),message:d},this[c(684)](d)):this[c(919)]._gameType!=RSGameTypes[c(451)]||GlobalVars.isjackpotLoaded?this[c(919)][c(1065)]==RSGameTypes[c(930)]?this[c(534)]=0:this[c(919)][c(1065)]==RSGameTypes[c(746)]&&(this[c(558)]=!1):(d={event:c(814),name:"notify_orientation_change",message:{width:RSEngine[c(928)],height:RSEngine.screenHeight}},this[c(684)](d));this[c(563)]&& (d=RSAnalyticsManager[c(885)]()[c(1145)]()+c(408),e=[],e[0]=JSON[c(556)](this._pendingSpinsStoredData),e=RSUtils[c(670)](e),f=RSUtils.getLocalStorageItem(this[c(667)]+c(532)),e==f&&(d={event:"post_message",name:d,message:this[c(563)]},this[c(684)](d)));break;case c(760):RSCasinoManager[c(1091)](b.offset);break;case "analytics_primary_sink":1==parseInt(RSGame[c(885)]()[c(1026)]()[c(420)]()[c(1123)])&&RSGame[c(885)]().getGameManager().isFavoritedMachine(RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager.triggerPrimarySinkEvent(b.origin, b[c(616)],b.param,RSGameScreens.FavoritesLobby):RSCasinoManager[c(528)](b[c(865)],b[c(616)],b[c(988)]);this[c(919)][c(1065)]==RSGameTypes[c(451)]&&!RSGame[c(885)]()[c(938)]()[c(367)]().getFUEBonusStatus()&&RSGame.getInstance()[c(938)]().getMe()[c(1019)]();RSUtils.isStringContains(b[c(865)],c(432))||RSUtils[c(542)](b[c(865)],c(947))||RSUtils[c(542)](b[c(865)],"insurance_action")||(this[c(534)]=0);break;case c(1023):1==parseInt(RSGame[c(885)]()[c(1026)]()[c(420)]().isFavoritesEnabled)&&RSGame[c(885)]()[c(617)]().isFavoritedMachine(RSGameTypes.Slots, this._machineParams._analyticsID)?RSCasinoManager.triggerPrimarySourceEvent(RSAnalyticsSource[c(650)],b.origin,b[c(616)],b[c(988)],RSGameScreens[c(1147)]):RSCasinoManager.triggerPrimarySourceEvent(RSAnalyticsSource.free,b.origin,b.value,b[c(988)]);RSEngine[c(554)].calculateLeaderboardWin(b[c(616)]);this[c(919)][c(1065)]==RSGameTypes.Slots&&(RSGame[c(885)]().getUserDataManager()[c(367)]().setSlotWin(b[c(616)]),GameConfig[c(587)]&&RSCasinoManager[c(797)]()[c(655)]());this[c(919)][c(1065)]==RSGameTypes[c(381)]&& RSGame[c(885)]()[c(938)]()[c(367)]()[c(880)](b[c(616)]);"don_won"==b[c(865)]&&(RSGame.getInstance().getUserDataManager()[c(367)]()[c(958)](RSGameTypes[c(474)],b[c(616)]),RSAnalyticsManager[c(885)]()[c(431)](b[c(988)],b.value));GameConfig[c(587)]&&"mega"==b[c(988)]||"major"==b[c(988)]||"minor"==b.param||c(988);this[c(919)][c(1065)]==RSGameTypes[c(944)]&&(RSGame[c(885)]()[c(938)]()[c(367)]()[c(795)](b[c(616)]),c(587));this[c(919)][c(1065)]==RSGameTypes[c(746)]&&RSGame[c(885)]()[c(938)]()[c(367)]()[c(1112)](b[c(616)]); if(GameConfig.LEADERBOARD_ENABLED&&!GlobalVars[c(657)])if(GameConfig[c(1128)])(this[c(919)][c(1065)]!=RSGameTypes[c(474)]||this[c(919)]._gameType==RSGameTypes.Poker&&"CP"==b[c(988)][c(568)]("_")[0])&&RSLeaderboard[c(1031)](this[c(534)]);else RSLeaderboard[c(1031)](this._leaderboardWinAmount);break;case "spin_started":this[c(667)]&&RSUtils[c(516)](this[c(667)])&&RSCasinoManager[c(1117)]()[c(669)]();RSCasinoManager[c(1066)][c(974)](b);break;case c(750):d=new RSCasinoResult;e=!1;this[c(415)]={};this[c(1006)]= {};this[c(1006)]._totalWinAmount=b[c(988)][c(972)];d[c(547)]=b.param[c(547)];d[c(972)]=b[c(988)][c(972)];d[c(862)]=b.param[c(862)];d._gameResult=b.param._gameResult;d[c(687)]=b.param[c(687)];d[c(475)]=b.param[c(475)];switch(b[c(988)][c(687)]){case c(1007):case c(1011):case "MULTI_PLAY_POKER":GameConfig[c(587)]&&!GlobalVars[c(657)]&&d[c(862)]!=c(875)&&RSLeaderboard.setUserLeaderBoardData(this._leaderboardWinAmount);break;case c(326):!e&&(e=b[c(988)][c(709)]._shouldEnterFreeSpinMode||b[c(988)]._gameResult._shouldEnterBonusGameMode); d[c(972)]=b[c(988)][c(972)]+b[c(988)][c(709)][c(565)];RSCasinoManager[c(1066)][c(974)](e);break;case c(719):0<b.param[c(972)]&&RSAnalyticsManager[c(885)]()[c(551)](b[c(988)][c(862)]);break;case "KENO":"0"==d[c(547)]?(this[c(543)]+=b[c(988)]._totalWinAmount,d[c(972)]=b[c(988)][c(972)]):(this[c(543)]=b.param._totalWinAmount,d[c(972)]=b.param[c(972)])}this[c(415)]=d;"BINGO"==this._machineParams[c(687)]?this[c(536)](b):(RSGame.getInstance().getGameManager()[c(839)]()==RSGameTypes[c(451)]||RSGame[c(885)]()[c(617)]()[c(839)]()== RSGameTypes[c(944)])&&b[c(988)]._gameResult&&(0<b.param[c(709)]._numFreeSpinsToGenerate||0==b.param._totalBetAmount)&&(GameConfig.QUEST_ENABLED&&RSQuestActionFormatter[c(885)]()[c(889)](this[c(415)],RSGame[c(885)]()[c(617)]().getGameType()),this[c(415)]=null);RSCasinoManager[c(840)](d);this._casinoResult=d;break;case c(898):d=RSGame[c(885)]()[c(617)]()[c(839)]();d!=c(1121)&&d!=c(772)&&(RSCasinoManager[c(527)](b[c(865)],b[c(580)],!0),RSGame[c(885)]()[c(938)]()[c(1078)](b[c(580)]),b[c(865)]==c(1137)? this[c(534)]=0:(RSEngine[c(554)][c(721)](b.offset),RSGame[c(885)]()[c(938)]()[c(367)]().setSlotWin(b[c(580)]),GameConfig[c(587)]&&!GlobalVars[c(657)]&&RSLeaderboard.setUserLeaderBoardData(this[c(534)])));d==c(772)&&(RSCasinoManager[c(527)](b[c(865)],b[c(580)],!1),RSCasinoManager[c(840)](b),RSCasinoManager[c(797)]().showRoundCompletePopups());break;case c(647):RSCasinoManager.enableAllHUDButtons();break;case "disable_hud":RSCasinoManager[c(769)]();break;case c(322):if(RSGame.getInstance().getGameManager().getGameType()== RSGameTypes[c(768)]&&0<this[c(356)])break;this._rouletteOOCStatus=1;RSCasinoManager.notifyOutOfCurrencyToCasino(b[c(988)]);break;case c(440):if(b[c(971)]==RS_CASINO_BUTTON.RS_CASINO_BUTTON_BET_MAX)if(this[c(919)]._gameType==RSGameTypes.Poker)RSAnalyticsManager[c(885)]()[c(418)](RSAnalyticsManager[c(885)]()[c(1145)](),b[c(988)]);else this[c(919)]._gameType==RSGameTypes[c(451)]?RSAnalyticsManager[c(885)]().trackSlotsMaxBetButtonClick(RSAnalyticsManager[c(885)]()[c(1145)](),b.param):this[c(919)][c(1065)]== RSGameTypes[c(944)]&&RSAnalyticsManager[c(885)]().trackKenoMaxBetButtonClick(RSAnalyticsManager[c(885)]()[c(1145)](),b[c(988)]);else if(b[c(971)]==RS_CASINO_BUTTON[c(921)])RSAnalyticsManager[c(885)]()[c(592)](RSAnalyticsManager[c(885)]()[c(1145)]());else b[c(971)]==RS_CASINO_BUTTON[c(445)]&&this[c(919)][c(1065)]==RSGameTypes[c(474)]?RSAnalyticsManager[c(885)]().trackPokerTurboButtonClick(b[c(865)],this._currentHandNumber,b[c(988)]):b.type==RS_CASINO_BUTTON[c(321)]&&this._machineParams[c(1065)]==RSGameTypes[c(474)]&& RSCasinoManager[c(312)](b[c(865)],b.type,b.param);break;case c(338):this[c(919)][c(1065)]==RSGameTypes[c(451)]&&RSAnalyticsManager[c(885)]()[c(830)](RSAnalyticsManager[c(885)]()[c(1145)](),b[c(675)]);this._rouletteOOCStatus=0;RSCasinoManager.notifyBetAmountChangeToCasino(b[c(675)]);break;case "exit_machine":if(b[c(458)]==c(360)&&GameConfig.GAME_ID==c(313)){RSCasinoManager[c(1117)]().onBackButton(!0);break}("RS_BACK_BUTTON_TAP"==b[c(424)]||this[c(919)]._machineType==c(950)&&a==c(560)||GlobalVars[c(657)])&& (GlobalVars[c(881)]&&RSGame[c(885)]()[c(617)]().getGameType()==RSGameTypes[c(1029)]?(GlobalVars.isLeanplumNavigation=!1,RSGame[c(885)]().getGameManager().callScreenNavigation()):RSCasinoManager.getCasinoHUD()[c(491)](!0));RSCasinoManager[c(652)](b.name,b[c(690)],b[c(717)],b[c(1022)],b[c(664)]);break;case c(502):GlobalVars[c(881)]=!1;break;case c(504):this[c(919)]._gameType==RSGameTypes.Poker?this[c(920)]():this[c(871)]();break;case c(914):d=b.type?b.type:"";e=b[c(988)]?JSON[c(556)](b.param):"";RSErrorTracker[c(885)]().trackErrorMessage("Internal Game-"+ d,c(375)+e,c(535));break;case "machine_data_request":this[c(377)]();break;case c(494):switch(GlobalVars.isInsideExternalGame||(this._pendingSpinsDataKey&&RSUtils[c(516)](this[c(667)])&&(RSUtils[c(487)](this[c(667)]),RSUtils[c(487)](this[c(667)]+c(532))),d=this._machineParams[c(1065)]?this[c(919)][c(1045)]:null,RSGame[c(885)]()[c(617)]().getGameType()!=RSGameTypes.Bingo&&(RSCasinoManager.getCasinoInterface()[c(908)](this[c(1006)],this._machineParams[c(1065)],d),RSCasinoManager[c(797)]()[c(879)]())), GameConfig[c(823)]&&this._questActionData&&RSGame[c(885)]()[c(617)]().checkForQuestEnabledInThisMachineOrNot()&&!GlobalVars[c(657)]&&RSQuestActionFormatter[c(885)]()[c(889)](this[c(415)],RSGame[c(885)]()[c(617)]().getGameType()),this._questActionData=null,RSGame[c(885)]()[c(617)]().getGameType()){case RSGameTypes[c(746)]:GlobalVars[c(708)]&&2<=GameConfig[c(564)]&&RSEngine[c(554)][c(998)]({type:c(1018),coinBalance:RSEngine[c(796)][c(367)]()[c(1032)](),winAmount:this[c(1006)]._totalWinAmount});break; case RSGameTypes[c(944)]:GlobalVars.isjackpotLoaded&&2<=GameConfig[c(564)]&&RSEngine.externalGameManager[c(998)]({type:c(1018),coinBalance:RSEngine.dataManager[c(367)]()[c(1032)](),winAmount:this[c(543)]});this[c(543)]=0;break;case RSGameTypes.Slots:d=this[c(919)].machine_identifier,GlobalVars[c(708)]&&2<=GameConfig.JACKPOT_LOUNGE_VERSION&&RSEngine[c(554)][c(998)]({type:c(1018),coinBalance:RSEngine[c(796)][c(367)]()[c(1032)](),winAmount:this[c(1006)]._totalWinAmount}),UrlNotificationManager[c(885)]()[c(394)]()|| RSGame.getInstance()[c(617)]()[c(766)](RSGame[c(885)]()[c(617)]()[c(602)].id)||GlobalVars.isTournamentLoaded||GlobalVars.isjackpotLoaded||RSGame.getInstance().getGameManager()[c(1028)](d)||RSGame[c(885)]()[c(617)]()[c(1088)]()==d||RSGame[c(885)]()[c(617)]()[c(1002)](d)||RSGame[c(885)]().getGameManager()[c(1060)](RSGameTypes[c(451)],d)||!MachineGiftingManager[c(885)]().isMachineGifted(d)&&RSCasinoManager.getCasinoHUD().onBackButton()}}},handleEveriMachineEvents:function(a,b){var c=a0_0x10dccc;switch(a){case c(438):this._externalGameInterface.notifyGameLoaded(this[c(919)][c(837)], RSGameTypes[c(451)]);this[c(762)](GlobalVars[c(383)]&&GlobalVars[c(557)]);break;case c(1069):RSCasinoManager.getCasinoHUD()[c(669)]();this[c(514)][c(323)]();break;case c(548):var d=Math[c(513)](b[c(480)][c(675)]),e=!1;null!=b[c(1144)]&&(e=Boolean(b[c(1144)]));!e&&(1==parseInt(RSGame.getInstance().getGameData().getDefaultValues().isFavoritesEnabled)&&RSGame[c(885)]()[c(617)]()[c(1060)](RSGameTypes[c(451)],this._machineParams._analyticsID)?RSCasinoManager[c(528)](c(1137),d,this[c(919)][c(837)],RSGameScreens[c(1147)]): RSCasinoManager.triggerPrimarySinkEvent(c(1137),d,this._machineParams[c(837)]),RSCasinoManager[c(527)]("wager",-d));break;case c(1148):RSGame[c(885)]().getGameManager()[c(561)](!0);break;case "RESULT":RSGame[c(885)]()[c(617)]()[c(561)](!1);d=Math.floor(b.data[c(675)]);e=Math.floor(b.data[c(636)]);0<e&&(RSCasinoManager[c(527)](c(822),+e),1==parseInt(RSGame[c(885)]()[c(1026)]()[c(420)]()[c(1123)])&&RSGame[c(885)]().getGameManager().isFavoritedMachine(RSGameTypes.Slots,this._machineParams[c(837)])?RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)], "line_win",e,this[c(919)][c(837)],RSGameScreens[c(1147)]):RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],"line_win",e,this[c(919)][c(837)]));this[c(514)][c(463)](d,e);this._externalGameInterface.notifyRoundComplete();RSCasinoManager[c(1117)]().enableAllButtons();RSCasinoManager.getCasinoInterface()[c(879)]();this[c(919)][c(508)]==CasinoExternalGameType.EVERI_GAME&&GlobalVars.isjackpotLoaded&&2<=GameConfig[c(564)]&&RSEngine[c(554)][c(998)]({type:c(1018),coinBalance:RSEngine[c(796)][c(367)]()[c(1032)](), winAmount:b.data[c(636)]});break;case c(688):RSCasinoManager[c(731)](b[c(480)][c(316)])}},handleAGSMachineEvents:function(a,b){var c=a0_0x10dccc;switch(a){case c(476):case c(1053):this._agsFeatureModeStatus=!0;break;case "disableFeatureMode":this._agsFeatureModeStatus=!1;break;case c(581):break;case c(594):break;case "stakeUpdate":this[c(659)]=b.stake;break;case c(570):this._agsFeatureModeStatus=!1;this[c(514)][c(1051)](this._machineParams[c(837)],RSGameTypes[c(451)]);break;case c(379):if(this[c(826)])break; this[c(310)]=0;if(this._agsBetAmount<=RSCasinoManager[c(586)]()){this[c(910)]=!1;var d=Math.floor(this[c(659)]);1==parseInt(RSGame.getInstance()[c(1026)]().getDefaultValues().isFavoritesEnabled)&&RSGame[c(885)]().getGameManager()[c(1060)](RSGameTypes[c(451)],this[c(919)]._analyticsID)?RSCasinoManager[c(528)](c(1137),d,this[c(919)]._analyticsID,RSGameScreens[c(1147)]):RSCasinoManager[c(528)]("spin",d,this[c(919)][c(837)]);RSCasinoManager[c(527)](c(422),-d);RSCasinoManager[c(1117)]()[c(669)]();this[c(514)][c(323)]()}else this._agsOOC= !0;break;case c(816):0<b.winnings&&(this._agsWinAmount=Math[c(513)](b.winnings));break;case c(389):if(this[c(826)])break;if(!0==this[c(910)])break;RSGame.getInstance().getGameManager()[c(561)](!1);0<this[c(310)]&&(RSCasinoManager[c(527)]("result",+this[c(310)]),1==parseInt(RSGame[c(885)]().getGameData()[c(420)]()[c(1123)])&&RSGame[c(885)]()[c(617)]()[c(1060)](RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],c(798),this._agsWinAmount,this[c(919)][c(837)], RSGameScreens.FavoritesLobby):RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],c(798),this._agsWinAmount,this._machineParams._analyticsID));this._externalGameInterface[c(463)](this._agsBetAmount,this[c(310)]);this[c(514)][c(1004)]();RSCasinoManager[c(1117)]()[c(649)]();RSCasinoManager[c(797)]()[c(879)]();GlobalVars[c(708)]&&2<=GameConfig.JACKPOT_LOUNGE_VERSION&&RSEngine.externalGameManager[c(998)]({type:"onSpinCompleted",coinBalance:RSEngine.dataManager.getMe().getCoins(),winAmount:this._agsWinAmount}); break;case c(671):RSCasinoManager.notifyOutOfCurrencyToCasino(this[c(659)]?this._agsBetAmount:0)}},handleRisingDigitalMachineEvents:function(a,b){var c=a0_0x10dccc;switch(a){case c(835):this[c(514)][c(1051)](this[c(919)][c(837)],RSGameTypes[c(451)]);this[c(573)]=!1;break;case c(817):!this[c(573)]&&(this[c(679)](),this[c(573)]=!0);break;case c(610):this[c(469)]=b[c(545)];this[c(469)]==c(734)&&(this[c(1106)]=0,this._risingBetAmount=parseInt(b[c(887)])*parseInt(b[c(341)]),this._risingBetAmount<=RSCasinoManager[c(586)]()&& (1==parseInt(RSGame.getInstance().getGameData()[c(420)]()[c(1123)])&&RSGame[c(885)]()[c(617)]().isFavoritedMachine(RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager[c(528)](c(1137),this[c(590)],this[c(919)]._analyticsID,RSGameScreens[c(1147)]):RSCasinoManager.triggerPrimarySinkEvent(c(1137),this[c(590)],this[c(919)]._analyticsID),RSCasinoManager[c(527)](c(422),-this[c(590)]),this[c(514)][c(323)]()));RSCasinoManager[c(1117)]()[c(669)]();break;case c(864):var d=0,e=0,d=parseInt(b[c(748)]),e= parseInt(b[c(851)]);this[c(590)]=d*e;break;case "RoundCompleted":var f=e=e=0,d=!0,e=parseFloat(b[c(332)]),f=parseInt(b[c(341)]),f=e=Math.ceil(e*f);this.risingDigitalGameType=b[c(545)];(this[c(469)]==c(1086)||this.risingDigitalGameType==c(949)||Boolean(b[c(578)]))&&(RSGame[c(885)]()[c(617)]().setExternalBonusSpinActive(!0),d=!1);b.bonusRemaining&&0<parseInt(b[c(1079)])?(RSGame.getInstance()[c(617)]()[c(561)](!0),d=!1):b[c(507)]&&0<parseInt(b.freeRemaining)?(RSGame[c(885)]().getGameManager()[c(561)](!0), d=!1):this.risingDigitalGameType==c(1086)&&null==b.freeRemaining?d=!0:"BonusGame"==this[c(469)]&&null!=b.bonusRemaining&&0>=parseInt(b[c(1079)])?d=!0:this[c(469)]==c(949)&&null==b[c(1079)]&&(d=!0);d?(0<this._risingDigitalFreespinTotal&&(f+=this[c(1106)]),0<f&&(RSCasinoManager[c(527)](c(822),+f),1==parseInt(RSGame[c(885)]()[c(1026)]()[c(420)]()[c(1123)])&&RSGame[c(885)]().getGameManager()[c(1060)](RSGameTypes[c(451)],this._machineParams[c(837)])?RSCasinoManager.triggerPrimarySourceEvent(RSAnalyticsSource[c(650)], "line_win",f,this[c(919)][c(837)],RSGameScreens[c(1147)]):RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],c(798),f,this[c(919)][c(837)])),RSGame[c(885)]()[c(617)]().setExternalBonusSpinActive(!1),this[c(514)].notifyRoundResult(this[c(590)],f),this[c(514)][c(1004)](),RSCasinoManager.getCasinoHUD()[c(649)](),RSCasinoManager.getCasinoInterface()[c(879)](),GlobalVars[c(708)]&&2<=GameConfig[c(564)]&&RSEngine[c(554)][c(998)]({type:"onSpinCompleted",coinBalance:RSEngine.dataManager.getMe()[c(1032)](), winAmount:f}),this[c(590)]=0):this[c(1106)]+=f;break;case c(884):0<this[c(590)]?RSCasinoManager.notifyOutOfCurrencyToCasino(this[c(590)]):RSCasinoManager.notifyOutOfCurrencyToCasino(this[c(919)][c(619)])}},handleOddsworksMachineEvents:function(a,b){var c=a0_0x10dccc;switch(a){case c(328):break;case "rg2xcPreloaderEnd":this[c(679)]();break;case "rg2xcLaunchGameDone":this[c(679)]();this._machineParams._analyticsID[c(1122)](c(489))?this._externalGameInterface[c(1051)](this._machineParams[c(837)],RSGameTypes[c(611)]): this._externalGameInterface.notifyGameLoaded(this._machineParams[c(837)],RSGameTypes[c(451)]);RSCasinoManager[c(1117)]()[c(649)]();break;case c(716):if("gameInitialize"!=this[c(702)][c(353)])if(this[c(702)][c(353)]==c(413)){if(this[c(910)]){RSCasinoManager[c(1117)]().enableAllButtons();RSCasinoManager.notifyOutOfCurrencyToCasino(this[c(525)]);this._agsOOC=!1;break}}else if(this[c(702)].status==c(462)){if(this[c(910)]){RSCasinoManager[c(1117)]()[c(649)]();RSCasinoManager.notifyOutOfCurrencyToCasino(this[c(525)]); this[c(910)]=!1;break}0<this[c(933)]&&(RSCasinoManager[c(527)](c(822),+this[c(933)]),!this[c(919)][c(837)][c(1122)](c(489))&&1==parseInt(RSGame.getInstance()[c(1026)]()[c(420)]()[c(1123)])&&RSGame.getInstance()[c(617)]()[c(1060)](RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],c(798),this[c(933)],this[c(919)][c(837)],RSGameScreens[c(1147)]):RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],"line_win",this[c(933)],this[c(919)][c(837)]));RSGame[c(885)]()[c(617)]()[c(561)](!1); this[c(514)].notifyRoundResult(this[c(525)],this[c(933)]);this[c(514)].notifyRoundComplete();RSCasinoManager.getCasinoHUD()[c(649)]();RSCasinoManager[c(797)]()[c(879)]();GlobalVars.isjackpotLoaded&&2<=GameConfig[c(564)]&&RSEngine.externalGameManager[c(998)]({type:c(1018),coinBalance:RSEngine[c(796)][c(367)]().getCoins(),winAmount:this[c(933)]});this._oddsWorksWinAmount=0}else if(this[c(702)][c(353)]==c(683)){RSCasinoManager.getCasinoHUD()[c(669)]();this[c(910)]=!1;if(this[c(525)]>RSCasinoManager.getPrimaryCurrency()){this._agsOOC= !0;break}1==parseInt(RSGame[c(885)]()[c(1026)]()[c(420)]()[c(1123)])&&RSGame.getInstance()[c(617)]()[c(1060)](RSGameTypes.Slots,this[c(919)][c(837)])?RSCasinoManager[c(528)]("spin",this[c(525)],this[c(919)][c(837)],RSGameScreens[c(1147)]):RSCasinoManager[c(528)](c(1137),this._oddsWorksBetAmount,this._machineParams[c(837)]);RSCasinoManager[c(527)]("wager",-this[c(525)]);this[c(514)][c(323)]()}break;case c(773):RSCasinoManager[c(1117)]()[c(649)]();break;case c(1063):this._oddsWorksBetAmount=this[c(702)].value; break;case c(654):this._oddsWorksWinAmount=this._oddsWorkobject[c(616)]}},handleWazdenMachineEvents:function(a,b){var c=a0_0x10dccc;switch(a){case c(635):RSCasinoManager[c(1117)]()[c(649)]();this._externalGameInterface[c(1051)](this[c(919)][c(837)],RSGameTypes[c(451)]);break;case c(1037):if(!0==this[c(826)])break;null!=b[c(636)]&&(this[c(956)]=parseInt(b[c(636)]));0<this[c(956)]&&(RSCasinoManager[c(527)](c(422),this[c(956)]),1==parseInt(RSGame[c(885)]().getGameData().getDefaultValues()[c(1123)])&& RSGame[c(885)]()[c(617)]()[c(1060)](RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager[c(1047)](RSAnalyticsSource.free,"line_win",this[c(956)],this._machineParams[c(837)],RSGameScreens[c(1147)]):RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],c(798),this._wazdenWinAmount,this[c(919)][c(837)]));GlobalVars[c(708)]&&2<=GameConfig[c(564)]&&RSEngine[c(554)][c(998)]({type:"onSpinCompleted",coinBalance:RSEngine[c(796)].getMe().getCoins(),winAmount:this[c(956)]});this[c(514)].notifyRoundResult(this[c(892)], this[c(956)]);this._externalGameInterface[c(1004)]();RSCasinoManager.getCasinoHUD()[c(649)]();RSCasinoManager[c(797)]()[c(879)]();this._wazdenWinAmount=0;break;case c(960):if(this._agsFeatureModeStatus)break;this[c(892)]=parseInt(b[c(675)]);null!=b[c(471)]&&(this[c(892)]=parseInt(b[c(471)]));1==parseInt(RSGame.getInstance().getGameData().getDefaultValues()[c(1123)])&&RSGame[c(885)]().getGameManager()[c(1060)](RSGameTypes[c(451)],this[c(919)]._analyticsID)?RSCasinoManager[c(528)](c(1137),this[c(892)], this[c(919)][c(837)],RSGameScreens[c(1147)]):RSCasinoManager[c(528)](c(1137),this._wazdenBetAmount,this[c(919)][c(837)]);this._externalGameInterface[c(323)]();RSCasinoManager[c(527)](c(422),-this[c(892)]);RSCasinoManager[c(1117)]()[c(669)]();break;case c(447):this._agsFeatureModeStatus=!0;RSGame[c(885)]()[c(617)]()[c(561)](!0);break;case c(809):this._agsFeatureModeStatus=!1;RSGame[c(885)]()[c(617)]()[c(561)](!1);break;case "WGEAPI.bonusPurchase":this[c(892)]=parseInt(b[c(675)]);this._agsOOC=!1;if(this[c(892)]> RSCasinoManager[c(586)]()){this[c(910)]=!0;break}RSCasinoManager[c(527)](c(807),-this[c(892)]);1==parseInt(RSGame.getInstance()[c(1026)]()[c(420)]().isFavoritesEnabled)&&RSGame[c(885)]()[c(617)]()[c(1060)](RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager[c(528)](c(807),this._wazdenBetAmount,this._machineParams[c(837)],RSGameScreens[c(1147)]):RSCasinoManager[c(528)](c(807),this[c(892)],this[c(919)][c(837)]);RSCasinoManager[c(1117)]()[c(669)]();break;case c(453):RSCasinoManager[c(1117)]()[c(649)](); 0<this[c(892)]?RSCasinoManager[c(731)](this[c(892)]):RSCasinoManager[c(731)](this[c(919)]._defaultBet*this[c(919)][c(588)]);break;case c(395):RSGame[c(885)]()[c(617)]()[c(1117)]()[c(491)](!0)}},handleHighFiveMachineEvents:function(a,b){var c=a0_0x10dccc;switch(a){case "EventType":if(b[c(971)].name==c(631))RSCasinoManager.getCasinoHUD().enableAllButtons(),this[c(514)][c(1051)](this._machineParams[c(837)],RSGameTypes[c(451)]);else if(b[c(971)][c(424)]==c(365)){if(1==this._high5GamesSpinStatus)break; this[c(1077)]=1;this[c(827)]=!1;b.hasOwnProperty(c(675))&&(this._highFiveBetAmount=parseInt(b[c(675)]));if(this[c(984)]>RSCasinoManager[c(586)]()){this[c(827)]=!0;break}this._highFiveBetAmount=parseInt(b.bet);1==parseInt(RSGame[c(885)]()[c(1026)]()[c(420)]()[c(1123)])&&RSGame.getInstance()[c(617)]()[c(1060)](RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager[c(528)](c(1137),this[c(984)],this._machineParams[c(837)],RSGameScreens[c(1147)]):RSCasinoManager.triggerPrimarySinkEvent(c(1137),this[c(984)], this[c(919)]._analyticsID);this._externalGameInterface[c(323)]();RSCasinoManager[c(527)](c(422),-this._highFiveBetAmount);RSCasinoManager.getCasinoHUD()[c(669)]()}else if(b[c(971)][c(424)]==c(396)){if(2==this[c(1077)])break;this[c(1077)]=2;this[c(909)]=0;null!=b.win&&(this[c(909)]=parseInt(b[c(636)]));if(this[c(827)]){RSCasinoManager.getCasinoHUD()[c(649)]();this[c(827)]=!1;break}0<this[c(909)]&&(RSCasinoManager[c(527)](c(422),this[c(909)]),1==parseInt(RSGame.getInstance().getGameData()[c(420)]()[c(1123)])&& RSGame[c(885)]()[c(617)]()[c(1060)](RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager[c(1047)](RSAnalyticsSource.free,c(798),this._highFiveWinAmount,this._machineParams._analyticsID,RSGameScreens.FavoritesLobby):RSCasinoManager.triggerPrimarySourceEvent(RSAnalyticsSource[c(650)],c(798),this._highFiveWinAmount,this[c(919)][c(837)]));GlobalVars[c(708)]&&2<=GameConfig[c(564)]&&RSEngine[c(554)][c(998)]({type:"onSpinCompleted",coinBalance:RSEngine.dataManager.getMe()[c(1032)](),winAmount:this[c(909)]}); this._externalGameInterface[c(463)](this[c(984)],this[c(909)]);this[c(514)][c(1004)]();RSCasinoManager.getCasinoHUD().enableAllButtons();RSCasinoManager.getCasinoInterface().showRoundCompletePopups();this._highFiveBetAmount=this[c(909)]=0}else if("ErrorEvent"==b[c(971)][c(424)])b.hasOwnProperty(c(987))&&"InsufficientFunds"==b[c(987)][c(424)]?(RSCasinoManager.getCasinoHUD()[c(649)](),0<this[c(984)]?RSCasinoManager.notifyOutOfCurrencyToCasino(this[c(984)]):RSCasinoManager[c(731)](this[c(919)][c(619)]* this._machineParams[c(588)])):(RSErrorTracker[c(885)]()[c(761)](c(1082),"Error from external game - "+this[c(919)][c(1127)],c(535)),this[c(514)][c(855)]());else if("NavigationEvent"==b[c(971)][c(424)]&&"Exit"==b[c(595)][c(424)])RSGame[c(885)]()[c(617)]()[c(1117)]().onBackButton(!0);else if(b.type[c(424)]==c(522)){b[c(574)](c(517))&&(this._highFiveBetAmount=parseInt(b[c(517)]));this[c(827)]=!1;if(this[c(984)]>RSCasinoManager[c(586)]()){this[c(827)]=!0;break}RSCasinoManager.addPrimaryCurrencyForDisplay(c(807), -this[c(984)]);1==parseInt(RSGame[c(885)]()[c(1026)]().getDefaultValues()[c(1123)])&&RSGame[c(885)]().getGameManager()[c(1060)](RSGameTypes.Slots,this[c(919)]._analyticsID)?RSCasinoManager[c(528)](c(807),this[c(984)],this[c(919)][c(837)],RSGameScreens[c(1147)]):RSCasinoManager[c(528)]("bonus_game",this[c(984)],this[c(919)][c(837)]);RSCasinoManager.getCasinoHUD()[c(669)]()}}},handleAinsworthMachineEvents:function(a,b){var c=a0_0x10dccc;switch(a){case c(853):RSCasinoManager[c(1117)]().enableAllButtons(); this[c(514)][c(1051)](this[c(919)][c(837)],RSGameTypes.Slots);this[c(785)](this[c(919)][c(475)],this[c(919)]._betIndex);this[c(582)]();break;case c(870):this[c(417)]=!1;b.hasOwnProperty(c(1097))&&(this[c(1119)]=parseInt(b[c(1097)]));if(this._ainsworthBetAmount>RSCasinoManager[c(586)]()){this[c(417)]=!0;break}if(1==this[c(612)])break;this[c(612)]=1;this[c(1119)]=parseInt(b.totalBet);1==parseInt(RSGame[c(885)]()[c(1026)]().getDefaultValues().isFavoritesEnabled)&&RSGame.getInstance()[c(617)]().isFavoritedMachine(RSGameTypes[c(451)], this[c(919)][c(837)])?RSCasinoManager[c(528)](c(1137),this[c(1119)],this[c(919)]._analyticsID,RSGameScreens[c(1147)]):RSCasinoManager[c(528)](c(1137),this[c(1119)],this[c(919)][c(837)]);this[c(514)][c(323)]();RSCasinoManager[c(527)](c(422),-this[c(1119)]);RSCasinoManager[c(1117)]()[c(669)]();break;case c(436):if(2==this[c(612)])break;this._ainsworthSpinStatus=2;this._ainsworthWinAmount=0;null!=b[c(515)]&&(this._ainsworthWinAmount=parseInt(b[c(515)]));if(this[c(417)]){RSCasinoManager[c(1117)]()[c(649)](); this[c(417)]=!1;break}0<this._ainsworthWinAmount&&(RSCasinoManager[c(527)](c(422),this[c(614)]),1==parseInt(RSGame[c(885)]()[c(1026)]()[c(420)]().isFavoritesEnabled)&&RSGame[c(885)]()[c(617)]()[c(1060)](RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager.triggerPrimarySourceEvent(RSAnalyticsSource[c(650)],c(798),this._ainsworthWinAmount,this[c(919)][c(837)],RSGameScreens[c(1147)]):RSCasinoManager.triggerPrimarySourceEvent(RSAnalyticsSource[c(650)],c(798),this[c(614)],this[c(919)]._analyticsID)); GlobalVars.isjackpotLoaded&&2<=GameConfig.JACKPOT_LOUNGE_VERSION&&RSEngine[c(554)].postMessageToJackpot({type:c(1018),coinBalance:RSEngine.dataManager[c(367)]()[c(1032)](),winAmount:this._ainsworthWinAmount});this[c(514)].notifyRoundResult(this[c(1119)],this[c(614)]);this[c(514)][c(1004)]();RSCasinoManager[c(1117)]()[c(649)]();RSCasinoManager[c(797)]().showRoundCompletePopups();this[c(614)]=0;this[c(1119)]=0;break;case c(992):RSGame.getInstance().getGameManager().setExternalBonusSpinActive(!0);break; case "freeGameEnd":RSGame[c(885)]().getGameManager()[c(561)](!1);null!=b[c(1016)]&&RSErrorTracker.getInstance().trackErrorMessage("AINSWORTH_BONUS","Bonus win collected: "+parseInt(b[c(1016)]),"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net");break;case "outOfCoins":0<this[c(1119)]?RSCasinoManager[c(731)](this[c(1119)]):RSCasinoManager[c(731)](this[c(919)]._defaultBet);break;case c(900):RSCasinoManager[c(1117)]()[c(707)](!1),RSAnalyticsManager[c(885)]().trackInHouseEvent(RSEventCategory.PLAYER_ACTION, "session_stop","",this[c(919)][c(837)],"",""),RSEngine[c(554)].unLoadExternalGame(),RSGameScreenManager[c(885)]()[c(783)]()}},handleFincoreMachineEvents:function(a,b){var c=a0_0x10dccc;switch(a){case c(853):RSCasinoManager.getCasinoHUD()[c(649)]();this[c(514)].notifyGameLoaded(this._machineParams[c(837)],RSGameTypes[c(451)]);this.setBetForFincore(this[c(919)][c(475)],this[c(919)]._betIndex);this[c(927)]();break;case c(870):this[c(656)]=!1;b[c(574)](c(480))&&b[c(480)][c(574)](c(838))&&(this[c(899)]= parseInt(b[c(480)].amountBet));if(this[c(899)]>RSCasinoManager[c(586)]()){this._fincoreOOC=!0;break}if(1==this[c(895)])break;this._fincoreSpinStatus=1;1==parseInt(RSGame[c(885)]()[c(1026)]()[c(420)]()[c(1123)])&&RSGame.getInstance()[c(617)]()[c(1060)](RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager[c(528)]("spin",this._fincoreBetAmount,this[c(919)][c(837)],RSGameScreens[c(1147)]):RSCasinoManager[c(528)](c(1137),this[c(899)],this[c(919)][c(837)]);this[c(514)][c(323)]();RSCasinoManager.addPrimaryCurrencyForDisplay(c(422), -this[c(899)]);RSCasinoManager[c(1117)]()[c(669)]();break;case c(436):if(2==this._fincoreSpinStatus)break;this[c(895)]=2;this[c(412)]=0;null!=b[c(480)][c(576)]&&(this[c(412)]=parseInt(b[c(480)][c(576)]));0<this[c(412)]&&(RSCasinoManager[c(527)](c(422),this[c(412)]),1==parseInt(RSGame.getInstance()[c(1026)]()[c(420)]()[c(1123)])&&RSGame.getInstance()[c(617)]()[c(1060)](RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],c(798),this._fincoreWinAmount,this[c(919)][c(837)], RSGameScreens[c(1147)]):RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],c(798),this[c(412)],this[c(919)][c(837)]));GlobalVars[c(708)]&&2<=GameConfig[c(564)]&&RSEngine[c(554)][c(998)]({type:"onSpinCompleted",coinBalance:RSEngine[c(796)][c(367)]()[c(1032)](),winAmount:this[c(412)]});this._externalGameInterface[c(463)](this[c(899)],this[c(412)]);this[c(514)][c(1004)]();RSCasinoManager[c(1117)]()[c(649)]();RSCasinoManager[c(797)]()[c(879)]();this._fincoreWinAmount=0;this[c(899)]=0;if(this[c(656)]){RSCasinoManager[c(1117)]().enableAllButtons(); this[c(656)]=!1;break}break;case c(368):if(3==this[c(895)])break;this[c(895)]=3;0<this[c(899)]?RSCasinoManager[c(731)](this[c(899)]):RSCasinoManager[c(731)](this._machineParams._defaultBet);break;case c(660):RSGame[c(885)]()[c(617)]()[c(561)](!0);RSErrorTracker[c(885)]().trackErrorMessage(c(549),c(801),c(535));break;case "bonusEnd":RSGame[c(885)]()[c(617)]().setExternalBonusSpinActive(!1);break;case "freeSpinTrigger":RSGame[c(885)]().getGameManager()[c(561)](!0);RSErrorTracker.getInstance()[c(761)](c(607), c(801),c(535));break;case c(692):RSGame[c(885)]()[c(617)]()[c(561)](!1),RSErrorTracker[c(885)]().trackErrorMessage(c(607),"END",c(535))}},handleBGamingMachineEvents:function(a,b){var c=a0_0x10dccc;switch(a){case "loaded":RSCasinoManager[c(1117)]()[c(649)]();this[c(514)][c(1051)](this[c(919)][c(837)],RSGameTypes[c(451)]);this[c(1073)](this._machineParams[c(475)],this._machineParams._betIndex);this.setVolumeForBGaming();break;case c(767):this._bGamingOOC=!1;b[c(574)](c(675))&&(this[c(437)]=parseInt(b.bet)); if(this[c(437)]>RSCasinoManager[c(586)]()){this[c(1048)]=!0;break}if(1==this[c(954)])break;this[c(954)]=1;1==parseInt(RSGame.getInstance()[c(1026)]()[c(420)]()[c(1123)])&&RSGame[c(885)]()[c(617)]()[c(1060)](RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager[c(528)](c(1137),this[c(437)],this[c(919)][c(837)],RSGameScreens[c(1147)]):RSCasinoManager[c(528)]("spin",this[c(437)],this[c(919)]._analyticsID);this[c(514)][c(323)]();RSCasinoManager[c(527)]("wager",-this[c(437)]);RSCasinoManager[c(1117)]()[c(669)](); break;case "round_result":if(this[c(1048)]){RSCasinoManager[c(1117)]()[c(649)]();this[c(1048)]=!1;break}this[c(1142)]=0;null!=b[c(636)]&&(this[c(1142)]=parseInt(b.win));break;case c(1062):if(2==this[c(954)])break;this._bGamingSpinStatus=2;0<this[c(1142)]&&(RSCasinoManager[c(527)](c(422),this._bGamingWinAmount),1==parseInt(RSGame[c(885)]().getGameData()[c(420)]()[c(1123)])&&RSGame[c(885)]()[c(617)]().isFavoritedMachine(RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)], c(798),this[c(1142)],this[c(919)][c(837)],RSGameScreens[c(1147)]):RSCasinoManager.triggerPrimarySourceEvent(RSAnalyticsSource.free,c(798),this[c(1142)],this[c(919)]._analyticsID));GlobalVars[c(708)]&&2<=GameConfig[c(564)]&&RSEngine[c(554)][c(998)]({type:c(1018),coinBalance:RSEngine[c(796)][c(367)]()[c(1032)](),winAmount:this[c(1142)]});this[c(514)][c(463)](this[c(437)],this._bGamingWinAmount);this[c(514)][c(1004)]();RSCasinoManager[c(1117)]()[c(649)]();RSCasinoManager[c(797)]()[c(879)]();this[c(1142)]= 0;this[c(437)]=0;break;case c(1039):0<this[c(437)]?(RSCasinoManager[c(731)](this[c(437)]),this[c(407)]()):(RSCasinoManager[c(731)](this[c(919)][c(619)]),this[c(407)]());break;case c(370):RSGame.getInstance()[c(617)]()[c(561)](!0);RSErrorTracker.getInstance()[c(761)](c(479),c(801),c(535));break;case "free_spin_end":RSGame[c(885)]()[c(617)]().setExternalBonusSpinActive(!1);RSErrorTracker[c(885)]()[c(761)](c(479),c(1129),"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net");break;case c(435):RSGame[c(885)]()[c(617)]()[c(1117)]()[c(491)](!0); break;case c(414):RSErrorTracker[c(885)]()[c(761)](c(1082),c(770)+this[c(919)][c(1127)],"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"),this[c(514)][c(855)]()}},handleYfageoMachineEvents:function(a,b){var c=a0_0x10dccc;switch(a){case "loaded":RSCasinoManager[c(1117)]()[c(649)]();this._externalGameInterface[c(1051)](this._machineParams[c(837)],RSGameTypes[c(451)]);this[c(1050)](this._machineParams[c(475)],this[c(919)][c(505)]);break;case c(767):this[c(454)]=!1;b.hasOwnProperty(c(675))&& (this[c(470)]=parseInt(b[c(675)]));if(this[c(470)]>RSCasinoManager[c(586)]()){this[c(694)]=!0;break}if(1==this._yfageoSpinStatus)break;this[c(994)]=1;1==parseInt(RSGame[c(885)]().getGameData().getDefaultValues()[c(1123)])&&RSGame[c(885)]()[c(617)]()[c(1060)](RSGameTypes[c(451)],this[c(919)][c(837)])?RSCasinoManager[c(528)](c(1137),this[c(470)],this[c(919)]._analyticsID,RSGameScreens[c(1147)]):RSCasinoManager[c(528)]("spin",this[c(470)],this[c(919)][c(837)]);this[c(514)].notifyRoundStart();RSCasinoManager[c(527)](c(422), -this[c(470)]);RSCasinoManager[c(1117)]()[c(669)]();break;case c(421):if(this[c(694)]){RSCasinoManager[c(1117)]()[c(649)]();this[c(694)]=!1;break}this._yfageoWinAmount=0;null!=b[c(636)]&&(this[c(915)]=parseInt(b[c(636)]));break;case c(1062):2==this[c(994)]&&RSErrorTracker.getInstance()[c(761)](c(847),this._yfageoWinAmount,c(535));this[c(994)]=2;0<this._yfageoWinAmount&&(RSCasinoManager[c(527)](c(422),this[c(915)]),1==parseInt(RSGame[c(885)]()[c(1026)]()[c(420)]()[c(1123)])&&RSGame.getInstance()[c(617)]()[c(1060)](RSGameTypes[c(451)], this._machineParams[c(837)])?RSCasinoManager[c(1047)](RSAnalyticsSource.free,"line_win",this[c(915)],this[c(919)]._analyticsID,RSGameScreens[c(1147)]):RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],"line_win",this[c(915)],this[c(919)][c(837)]));GlobalVars[c(708)]&&2<=GameConfig[c(564)]&&RSEngine[c(554)][c(998)]({type:c(1018),coinBalance:RSEngine[c(796)].getMe()[c(1032)](),winAmount:this[c(915)]});this[c(514)][c(463)](this[c(470)],this[c(915)]);this[c(514)][c(1004)]();RSCasinoManager.getCasinoHUD().enableAllButtons(); RSCasinoManager.getCasinoInterface()[c(879)]();this._yfageoWinAmount=0;this[c(470)]=0;break;case c(1039):0<this[c(470)]?RSCasinoManager[c(731)](this[c(470)]):RSCasinoManager.notifyOutOfCurrencyToCasino(this[c(919)][c(619)]);break;case c(370):RSGame[c(885)]()[c(617)]().setExternalBonusSpinActive(!0);RSErrorTracker.getInstance()[c(761)]("YFAGEO_FREESPIN",c(801),c(535));break;case c(459):RSGame[c(885)]()[c(617)]()[c(561)](!1);RSErrorTracker[c(885)]().trackErrorMessage(c(942),c(1129),"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"); break;case "game_resuming":RSCasinoManager.disableAllHUDButtons()}},calculateLeaderboardWin:function(a){this[a0_0x10dccc(534)]+=a},triggerRouletteGameActionEvents:function(a,b,c,d,e,f){a=a0_0x10dccc;switch(b){case "roulette_spin":case a(745):case "cancel_bet":case "repeat_bet":case a(320):case a(411):case a(498):case "change_screen":case "roulette_win":RSAnalyticsManager[a(885)]()[a(1143)](b,c,d,e,f)}},triggerScoreboxGameActionEvents:function(a,b,c,d,e,f){a=a0_0x10dccc;switch(b){case "play_now":case a(364):case a(334):RSAnalyticsManager[a(885)]().trackScoreboxGameAction(b, c,d,e,this[a(872)]+"_"+f);break;case "place_bets":RSAnalyticsManager[a(885)]().trackScoreboxGameAction(b,c,d,e,this[a(872)]+"_"+f),RSCasinoManager[a(528)]("scorebox_bet",d,e,f),this._leaderboardWinAmount=0}},_postLoyaltyMallMachineData:function(){var a=a0_0x10dccc,b={},c=RSEngine.loginMode==LOGIN_MODE[a(1061)]?"":RSEngine[a(796)].getMe()[a(869)]();b[a(868)]={name:c,currentPoint:1E4,email:"abc@gmail.com",clubMNumber:0};b[a(981)]=GlobalVars[a(961)];b[a(615)]=GameConfig[a(345)];b[a(373)]=GlobalVars[a(373)]; b[a(831)]=RSEngine[a(796)][a(367)]().getLMAnnouncementShownStatus()?0:1;b[a(550)]=RSEngine[a(455)]==LOGIN_MODE[a(836)]?a(1067):"web";b[a(737)]=GameConfig[a(737)]?GameConfig[a(737)]:!1;RSEngine[a(796)][a(367)]().getHistoricMonetizerStatus()&&(b.isHistoricMonetizer=1);b={event:a(1054),machineData:btoa(encodeURIComponent(JSON[a(556)](b)))};this._machineParams._screenName=a(677);this._updateMachineData(b);RSEngine.dataManager[a(367)]().setLMAnnouncementShownStatus()},triggerScratcherGameActionEvents:function(a, b,c,d,e,f){a=a0_0x10dccc;switch(b){case "scratcher_win":case a(978):case a(1015):RSAnalyticsManager[a(885)]()[a(678)](b,c,d,e,f)}},addClippingToExternalGame:function(a,b,c,d){var e=a0_0x10dccc;null==this._spinGameDiv&&(this[e(577)]=document.getElementById(e(446)));null!=this[e(577)]&&(a?this[e(577)].style.clip=e(803)+b+","+c+","+d+","+a+")":this[e(577)].style[e(989)]="")},postMessageToTournament:function(a){var b=a0_0x10dccc;null==this._iFrameSpin&&document[b(538)](b(1137))&&(this._iFrameSpin=document[b(538)]("spin")[b(452)]); this[b(684)]({event:b(799),name:"tournamentCustomInterfaceCalls",message:a,timeStamp:TimeManager.getInstance().getCurrentServerTime()})},postMessageToJackpot:function(a){var b=a0_0x10dccc;null==this[b(1044)]&&document[b(538)]("spin")&&(this[b(1044)]=document[b(538)]("spin")[b(452)]);this[b(684)]({event:b(799),name:b(963),message:a,timeStamp:TimeManager.getInstance()[b(348)]()})},isSpinGameActive:function(){var a=a0_0x10dccc;return null==this[a(577)]&&(this._spinGameDiv=document.getElementById("SpinGame")), null!=this[a(577)]},showExternalGame:function(){var a=a0_0x10dccc;null==this[a(577)]&&(this[a(577)]=document.getElementById(a(446)));null!=this._spinGameDiv&&(this._spinGameDiv[a(493)][a(387)]=a(524),this[a(514)].showExternalGame(),GlobalVars[a(708)]&&RSEngine[a(554)][a(998)]({type:a(877)}));if(RSPlacementManager[a(885)]().getInterface()&&0==RSEngine[a(355)][a(829)]()){var b=RSPlacementManager.getInstance()[a(957)]().getCurrentPopupTriggered();b&&RSPlacementManager.getInstance()[a(957)]().loadPopup(b)}}, hideExternalGame:function(){var a=a0_0x10dccc;null==this[a(577)]&&(this[a(577)]=document[a(538)]("SpinGame"));null!=this[a(577)]&&(this[a(577)].style[a(387)]=a(637),this[a(514)][a(478)]())},setBet:function(a,b){var c=a0_0x10dccc;a=a.map(Number);null==this[c(1044)]&&(this[c(1044)]=document[c(538)](c(1137)).contentWindow);this[c(1044)][c(485)](JSON[c(556)]({event:c(372),coins:a,coins_index:b,denom:[1]}),"*")},setBetForAinsworth:function(a,b){var c=a0_0x10dccc;a=a[c(371)](Number);null!=this._ainsworthEventOrigin&& (this._ainsworthEventSource[c(485)](JSON.stringify({name:c(999),data:{coins:a}}),this[c(597)]),this[c(886)].postMessage(JSON.stringify({name:"defaultBet",data:a[b]}),this[c(597)]))},setVolumeForAinsworth:function(){var a=a0_0x10dccc;null!=this[a(597)]&&null!=this[a(886)]&&(GlobalVars[a(557)]?this[a(886)][a(485)](JSON[a(556)]({name:a(366),data:{volume:1}}),this[a(597)]):this[a(886)][a(485)](JSON.stringify({name:a(366),data:{volume:0}}),this[a(597)]))},setBetForFincore:function(a,b){var c=a0_0x10dccc; a=a.map(Number);this[c(1044)][c(485)](JSON[c(556)]({name:c(1111),data:{stakes:a}}),"*")},setBetForBGaming:function(a,b){a.map(Number)},setBetForYFageo:function(a,b){var c=a0_0x10dccc;a=a.map(Number);this[c(1044)][c(485)](JSON[c(556)]({" defaultBet":a[b],betArray:a}),"*")},setVolumeForFincore:function(){var a=a0_0x10dccc;GlobalVars[a(557)]?this._iFrameSpin.postMessage(JSON[a(556)]({name:a(732),data:{volume:1}}),"*"):this._iFrameSpin[a(485)](JSON[a(556)]({name:a(732),data:{volume:0}}),"*")},setVolumeForBGaming:function(){var a= a0_0x10dccc;GlobalVars[a(557)]?this[a(1044)].postMessage(JSON.stringify({event:"audio_music",state:!0}),"*"):this[a(1044)][a(485)](JSON[a(556)]({event:a(976),state:!1}),"*");GlobalVars.sfxStatus?this._iFrameSpin[a(485)](JSON.stringify({event:a(751),state:!0}),"*"):this._iFrameSpin.postMessage(JSON[a(556)]({event:a(751),state:!1}),"*")},setSound:function(a){var b=a0_0x10dccc;null==this._iFrameSpin&&(this._iFrameSpin=document.getElementById(b(1137))[b(452)]);this[b(1044)][b(485)](JSON[b(556)]({event:b(732), volume:a}),"*")},setDODSoundAndMusic:function(){var a=a0_0x10dccc;null==this[a(1044)]&&(this[a(1044)]=document[a(538)](a(1137))[a(452)]);this[a(1044)].postMessage(JSON[a(556)]({event:"sfx_volume",volume:GlobalVars[a(383)]}),"*");this[a(1044)].postMessage(JSON.stringify({event:a(786),volume:GlobalVars.musicStatus}),"*")},updateCoin:function(a){var b=a0_0x10dccc;a={event:"update_primary_currency",value:a,timeStamp:TimeManager[b(885)]()[b(348)]()};this[b(684)](a)},stopAutoSpin:function(){var a=a0_0x10dccc, b={event:a(701),timeStamp:TimeManager[a(885)]()[a(348)]()};this[a(684)](b)},updateToaster:function(a,b,c,d,e,f,g){var h=a0_0x10dccc;a={event:"show_info_toaster",timeStamp:TimeManager[h(885)]()[h(348)](),layout:a,entry:b,duration:c,title:d,text:e,image:f,progress:g};this[h(684)](a)},_updateMachineBet:function(a,b){var c=a0_0x10dccc,d={event:c(449),machine:b,bet:a,timeStamp:TimeManager[c(885)]()[c(348)]()};this[c(684)](d)},updateSlotMachineBet:function(a,b){var c=a0_0x10dccc,d={event:c(449),machine:c(326), bet:a,timeStamp:TimeManager[c(885)]()[c(348)]()};this[c(684)](d)},updateKenoMachineBet:function(a,b){var c=a0_0x10dccc,d={event:"update_max_bet",machine:b,bet:a,timeStamp:TimeManager[c(885)]()[c(348)]()};this[c(684)](d)},updatePokerMachineBet:function(a,b){var c=a0_0x10dccc,d={event:c(449),machine:b,bet:{setMaxBet:!1,maxBet:a},timeStamp:TimeManager[c(885)]()[c(348)]()};this[c(684)](d)},updateMachineBetInGame:function(a,b,c,d){var e=a0_0x10dccc;a=d?{event:e(449),machine:b,bet:{maxPlayerBet:a,maxChipUnlocked:d, setMaxBet:c},timeStamp:TimeManager[e(885)]().getCurrentServerTime()}:{event:e(449),machine:b,bet:{setMaxBet:c,maxBet:a},timeStamp:TimeManager[e(885)]()[e(348)]()};this[e(684)](a)},updateBlackjackV2MachineBet:function(a,b,c){var d=a0_0x10dccc;a={event:d(449),machine:b,bet:{maxPlayerBet:a,maxChipUnlocked:c},timeStamp:TimeManager[d(885)]()[d(348)]()};this._updateMachineData(a)},updateMachineSound:function(){var a=a0_0x10dccc;this[a(896)]&&(clearInterval(this[a(896)]),this._soundUpdateinterval=null); var b={event:"set_volume",music:GlobalVars.musicStatus,effect:GlobalVars[a(383)],vo:GlobalVars.voiceCalloutsStatus,timeStamp:TimeManager[a(885)]()[a(348)]()};this[a(684)](b);if(this[a(919)])if(this._machineParams[a(1065)]==RSGameTypes.Poker&&this[a(919)][a(508)]==CasinoExternalPokerGameType.DOD)this[a(765)]();else if(this._machineParams[a(1065)]==RSGameTypes[a(611)])b=RSGame[a(885)]()[a(617)]()[a(890)](),TableGamesGameType&&b&&b.gameType==TableGamesGameType[a(977)]&&null!=this[a(804)]&&(this._oddsWorkEventSource[a(485)](JSON[a(556)]({msgId:"xc2rgSoundEffectsStatusChanged", status:GlobalVars[a(383)]}),this[a(876)]),this[a(804)][a(485)](JSON[a(556)]({msgId:a(456),status:GlobalVars.musicStatus}),this[a(876)]));else if(this._machineParams._gameType==RSGameTypes[a(451)])if(b=RSGame.getInstance().getGameManager()[a(890)](),b[a(545)]!=CasinoExternalGameType[a(1003)]&&b[a(545)]!=CasinoExternalGameType[a(1140)]&&b.gameType!=CasinoExternalGameType[a(314)]||this[a(762)](GlobalVars[a(383)]&&GlobalVars[a(557)]),b.gameType==CasinoExternalGameType[a(601)])this[a(582)]();else if(b[a(545)]== CasinoExternalGameType[a(986)])this[a(762)](GlobalVars.sfxStatus);else if(b[a(545)]==CasinoExternalGameType.FINCORE)this[a(927)]();else if(b[a(545)]==CasinoExternalGameType[a(401)])this[a(845)]();else b.gameType==CasinoExternalGameType[a(977)]&&null!=this._oddsWorkEventSource?(this[a(804)].postMessage(JSON.stringify({msgId:a(495),status:GlobalVars.sfxStatus}),this._oddsWorkEventOrigin),this[a(804)][a(485)](JSON[a(556)]({msgId:a(456),status:GlobalVars[a(557)]}),this[a(876)])):b.gameType==CasinoExternalGameType.RISING_DIGITAL_GAME&& (b=0,GlobalVars[a(383)]&&GlobalVars[a(557)]?b=0:GlobalVars.sfxStatus||GlobalVars[a(557)]?!GlobalVars[a(557)]&&(b=1):b=2,this[a(1044)][a(485)](JSON[a(556)]({switchSoundLevel:{soundLevel:b}}),"*"))},updateXpForTriviaMachine:function(a){var b=a0_0x10dccc;a={event:"post_message",name:b(996),message:a,timeStamp:TimeManager[b(885)]()[b(348)]()};this[b(684)](a)},updateLoyaltyMallData:function(a){var b=a0_0x10dccc;a={event:b(799),name:b(1040),message:a,timeStamp:TimeManager.getInstance().getCurrentServerTime()}; this._updateMachineData(a)},_updateMachineData:function(a){var b=a0_0x10dccc;this[b(1044)]&&this[b(1125)]()&&(isNaN(a[b(392)])&&(a.timeStamp=Date[b(945)]()),a[b(392)]<=GlobalVars[b(740)]?GlobalVars.lastEventTimeStamp=GlobalVars[b(740)]+1:GlobalVars[b(740)]=a[b(392)],a[b(392)]=GlobalVars[b(740)],a[b(358)]=this[b(599)](a),this[b(1044)][b(485)](JSON[b(556)](a),"*"))},_getHashValue:function(a){var b=a0_0x10dccc;return this[b(919)][b(662)]?(a=this[b(919)][b(662)]+"|"+JSON[b(556)](a)+"|"+RSGame[b(885)]()[b(938)]()[b(367)]()[b(904)]()+ b(742),calcMD5(a)):null},checkAndUpdateMachineBet:function(){var a=a0_0x10dccc;if(this[a(919)][a(1065)]){var b=0;switch(this[a(919)][a(1065)]){case RSGameTypes[a(451)]:b=RSGame.getInstance()[a(1026)]().getMaxBetValueForSlot(this[a(919)][a(1045)],RSGame[a(885)]().getLevelManager()[a(600)]()[a(465)]);this[a(630)](b,a(326));break;case RSGameTypes[a(474)]:if(b=RSGame[a(885)]().getGameData().getMaxBetValueForPoker(this._machineParams[a(1057)]),this[a(919)]._maxBetAmount!=b){this[a(919)][a(685)]=b;var c= this._machineParams[a(862)].split("_")[0];this[a(630)](b,c)}}}},_postTournamentMachineDataForPoker:function(){var a=a0_0x10dccc,b={},c=RSTournamentManager[a(374)]()?RSTournamentManager[a(374)]():a(384),c=RSGame.getInstance()[a(1026)]()[a(406)](RSGameTypes[a(474)],c),d={vo:GlobalVars[a(758)],music:GlobalVars[a(557)],effect:GlobalVars[a(383)]};btoa(encodeURIComponent(JSON[a(556)](d)));var d=RSGame[a(885)]()[a(938)]().getMe().getCoins(),e=RSGame.getInstance()[a(938)]().getMe().getId(),f=TimeManager.getInstance()[a(348)](), g=[];g[0]=c[a(917)];g[1]=f;g[2]=d;g[3]=e;RSGame.getInstance()[a(617)]().getHashValueForInternalGames(g);b[a(475)]=RSGame[a(885)]().getGameData()[a(856)](c.betStructure);b[a(943)]=c.machine_identifier;d={};e="[";f=b[a(475)][b[a(475)][a(468)]-1].value;for(g=0;g<b._betStructure[a(468)];g++)e+='"'+b[a(475)][g][a(616)]+'",';e=e[a(806)](0,e[a(468)]-1);e+="]";d[a(824)]=JSON[a(1093)](e);d[a(727)]=f;b[a(475)]=[];b._betStructure.push(d);b[a(789)]=RSGame[a(885)]()[a(1026)]().getPokerDefaultBet(c.betStructure); b[a(344)]=RSGame.getInstance()[a(1026)]()[a(1116)](c[a(622)]);b[a(981)]=GlobalVars.isCheatActive;b.royalFlushSubPayout=250;c=[];GlobalVars.isPurchaseEnabled&&RSEngine[a(455)]!=LOGIN_MODE[a(1068)]&&(c=RSGame[a(885)]()[a(1026)]()[a(729)]());b.donPacks=c;e=d=c=null;RSEngine[a(455)]==LOGIN_MODE[a(1043)]||RSEngine[a(455)]==LOGIN_MODE[a(836)]?(c=RSEngine.dataManager[a(367)]()[a(653)](),d=RSGame[a(885)]()[a(617)]()[a(325)](),GameConfig.IS_EDIT_FIELDS_ENABLED&&(e=RSEngine[a(796)][a(367)]().getAvatar())): e=RSEngine[a(796)][a(367)]()[a(666)]();b={event:a(1054),machineData:btoa(encodeURIComponent(JSON[a(556)](b))),profileData:{name:RSEngine.dataManager[a(367)]().getUserFirstName(),facebookId:c,avatarId:e,access_token:d},infopopup:btoa(encodeURIComponent(JSON[a(556)](RSTournamentManager[a(931)]()))),tournamentOverText:RSTournamentManager[a(802)]()};this[a(684)](b)},_postTournamentMachineData:function(){var a=a0_0x10dccc,b={machineAnalyticsID:"",betStructure:[],defaultBet:0,maxBetAmount:0,cheat:0,giftedSpinCount:0}, c=RSTournamentManager[a(374)]()?RSTournamentManager[a(374)]():a(912),d=RSGame.getInstance()[a(1026)]().getMachineDetailsByName(RSGameTypes.Slots,c);RSGame[a(885)]().getUserDataManager()[a(367)]()[a(1032)]();var e={vo:GlobalVars[a(758)],music:GlobalVars[a(557)],effect:GlobalVars[a(383)]};btoa(encodeURIComponent(JSON[a(556)](e)));TimeManager.getInstance()[a(348)]();b[a(943)]=d[a(1045)];b[a(622)]=RSGame[a(885)]()[a(1026)]()[a(1012)](c);b[a(789)]=parseInt(RSGame[a(885)]()[a(1026)]()[a(1094)](a(482),c, parseInt(d[a(790)])));b[a(344)]=b.betStructure[b.betStructure[a(468)]-1];b[a(981)]=GlobalVars[a(961)];c=0;RSGame[a(885)]().getUserDataManager()[a(367)]().getFUEBonusStatus()?!RSGame.getInstance()[a(938)]()[a(367)]().getMachineFUEBonusStatus()&&parseInt(d[a(1052)])&&!RSGame[a(885)]().getUserDataManager()[a(367)]()[a(697)](d[a(1045)])&&(c=d.spinsToFUEBonus?parseInt(d.spinsToFUEBonus):0):(e=parseInt(RSGame[a(885)]()[a(1026)]().getDefaultValues()[a(863)]),0<e-RSGame.getInstance()[a(938)]().getMe().getCumulativeSpinsForFUE()&& (c=e-RSGame.getInstance()[a(938)]()[a(367)]()[a(457)]()));0<c&&(b.fueTriggerSpin=c);MachineGiftingManager[a(885)]()[a(1133)](d[a(1045)])&&(b[a(857)]=MachineGiftingManager.getInstance()[a(1090)]);e=c=d=null;RSEngine[a(455)]==LOGIN_MODE.WEB_FACEBOOK||RSEngine[a(455)]==LOGIN_MODE[a(836)]?(d=RSEngine[a(796)][a(367)]()[a(653)](),c=RSGame[a(885)]()[a(617)]()[a(325)](),GameConfig[a(744)]&&(e=RSEngine.dataManager.getMe()[a(666)]())):e=RSEngine[a(796)][a(367)]()[a(666)]();b={event:"set_machine_data",machineData:btoa(encodeURIComponent(JSON[a(556)](b))), profileData:{name:RSEngine[a(796)][a(367)]()[a(869)](),facebookId:d,avatarId:e,access_token:c},infopopup:btoa(encodeURIComponent(JSON[a(556)](RSTournamentManager[a(931)]()))),tournamentOverText:RSTournamentManager[a(802)]()};this[a(684)](b)},_postMachineData:function(){var a=a0_0x10dccc;if(this[a(919)][a(1118)]){var b={event:a(1054),machineData:this[a(919)][a(1118)]};this[a(684)](b)}},handleBingoResults:function(a){var b=a0_0x10dccc,c=0,d=0,e=0,f=[],g={},h=0,k=0;for(null==this[b(828)]&&(this[b(828)]= {spinWheel:{primaryCurrencyOffset:0,secondaryCurrencyOffset:0,xpOffset:0,powerupOffset:{},coinSink:0},roundComplete:{primaryCurrencyOffset:0,secondaryCurrencyOffset:0,powerupOffset:{}}});0<a[b(988)][b(468)];){var h=a.param[a[b(988)][b(468)]-1],m=RSGame[b(885)]().getGameData()[b(1132)](h[b(1045)]);m&&(h[b(1045)]=m);if("function"===typeof RSCasinoManager.getCasinoInterface()[b(720)]){var n=RSCasinoManager[b(797)]()[b(720)]();n&&(h[b(1045)]=n)}switch(h.category){case b(1027):RSEventManager.getInstance()[b(739)](b(391)); break;case b(735):if(this[b(828)]&&this._bingoRewards.roundComplete){RSCasinoManager[b(527)](b(621),this._bingoRewards[b(329)][b(815)]);RSCasinoManager[b(940)](b(621),this[b(828)][b(329)][b(640)]);for(var p in this[b(828)][b(329)][b(1113)])RSGame[b(885)]()[b(938)]()[b(367)]().addPowerUps(p,this[b(828)][b(329)].powerupOffset[p]);this[b(828)].roundComplete={primaryCurrencyOffset:0,secondaryCurrencyOffset:0,powerupOffset:{}}}RSPlatformSDKManager.getInstance().setUserAttributePowerUp(RSGame[b(885)]()[b(617)]()[b(490)]()); break;case b(907):h[b(848)]===b(555)&&RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory[b(733)],b(1013),b(461),"",h[b(1045)],"");h.action===b(1084)&&RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory[b(733)],"chat_button",b(774),"",h[b(1045)],"");break;case "chat_button_clicked":RSAnalyticsManager[b(885)]().trackInHouseEvent(RSEventCategory[b(733)],b(1013),b(461),"",h[b(1045)],"");break;case "SHOW_DAUB_ALERT_POPUP":GlobalVars.isPurchaseEnabled?(RSCasinoManager.getCasinoInterface()[b(609)](h[b(812)]), RSGame[b(885)]()[b(617)]()[b(609)]()):VideoManager[b(885)]().getAdsAvailableStatus()?RSEngine[b(355)].addPopup(new VideoPopup(b(962),null,b(529))):RSGame[b(885)]()[b(617)]()[b(357)](b(529));break;case b(891):GlobalVars[b(966)]?RSGame.getInstance()[b(617)]().showPowerUpCart():VideoManager[b(885)]()[b(575)]()?RSEngine.popupManager[b(700)](new VideoPopup(b(1102),null,b(529))):RSGame[b(885)]()[b(617)]()[b(357)](b(529));break;case b(1100):RSGame[b(885)]()[b(617)]()[b(985)]();RSCasinoManager[b(1117)]()[b(878)](); RSGame[b(885)]()[b(713)]().isLevelUpTriggered()&&this[b(828)]&&this[b(828)].roundComplete&&(b(828),b(1113));break;case b(1115):h[b(990)]&&(RSCasinoManager.addPrimaryCurrencyForDisplay(b(1046),-h[b(990)],!1),RSCasinoManager.triggerPrimarySinkEvent(b(1046),h[b(990)],h[b(1045)]));break;case b(467):RSGame[b(885)]()[b(932)]()[b(464)](-h[b(822)]);RSCasinoManager.addPrimaryCurrencyForDisplay(b(983),-h[b(822)],!1);RSCasinoManager[b(528)](b(983),h[b(822)],h[b(1045)]);break;case "settings_button_clicked":RSCasinoManager[b(1117)]().onSettingsButtonClicked(); break;case "game_action":h[b(848)]==b(546)?(this[b(828)][b(533)]&&this[b(828)].spinWheel.coinSink&&RSEngine.dataManager[b(369)](this[b(828)].spinWheel[b(815)],this[b(828)][b(533)][b(640)],this._bingoRewards[b(533)].powerupOffset,this._bingoRewards[b(533)][b(979)],this._bingoRewards[b(533)][b(566)]),this[b(828)]={spinWheel:{primaryCurrencyOffset:0,secondaryCurrencyOffset:0,xpOffset:0,powerupOffset:{},coinSink:0},roundComplete:{primaryCurrencyOffset:0,secondaryCurrencyOffset:0,powerupOffset:{}}},RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory.PLAYER_ACTION, b(948),b(486),h[b(1045)],TimeManager[b(885)]()[b(348)]()-this[b(540)],RSGame[b(885)]()[b(617)]()[b(681)]()),RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory[b(541)],b(767),"",h[b(1045)],h.card_count,RSGame.getInstance().getGameManager().getRoundId())):h[b(848)]==b(860)&&(RSGame.getInstance()[b(617)]()[b(1114)]&&RSGame[b(885)]()[b(617)]().triggerQuestPopup(),RSAnalyticsManager[b(885)]().trackInHouseEvent(b(749),b(562),"round_over",JSON[b(556)](RSGame.getInstance()[b(617)]()[b(905)]()),"","")); break;case b(380):RSCasinoManager[b(400)]();RSCasinoManager[b(1117)]()[b(553)](!0);break;case b(572):RSCasinoManager.disableAllHUDButtons();RSCasinoManager[b(1117)]()[b(553)](!1);break;case b(1020):var n=h[b(616)][b(686)],r=n[b(523)][b(531)],h=n[b(813)][b(1105)],s=n[b(813)][b(990)],u=n.USED_POWERUPS[b(710)],t=n[b(579)],v=n[b(695)][b(319)],v=n[b(695)][b(982)],w=n[b(695)][b(1005)],w=n[b(695)][b(867)],x=n[b(695)][b(776)],B=n[b(695)].xp,y=n[b(950)][b(952)],z=n[b(897)][b(315)],C=n.COLLECTIBLES,A=n[b(781)], m=0;RSQuestManager[b(885)]().triggerAction(new RSBingoAction(n,r,h,s,u,t,v,w,x,B,y,z,C,A,m));RSGame[b(885)]()[b(617)]()[b(311)](s);break;case b(380):RSCasinoManager.enableAllHUDButtons();RSCasinoManager[b(1117)]().showHUD(!0);break;case b(572):RSCasinoManager[b(769)]();RSCasinoManager[b(1117)]()[b(553)](!1);break;case "SpinWheel":switch(h[b(971)]){case b(335):this[b(828)].spinWheel[b(815)]=0;this[b(828)][b(533)][b(640)]=0;this[b(828)][b(533)].powerupOffset={};this[b(828)][b(533)][b(979)]=0;this._bingoRewards.spinWheel[b(566)]= 0;"coins"==h[b(832)]||"secondaryCurrency"==h[b(832)]?(RSCasinoManager[b(668)]("spin_wheel",h[b(616)],h[b(1045)]),this[b(828)][b(533)].secondaryCurrencyOffset+=-h.value,this._bingoRewards[b(533)][b(566)]+=h.value,RSCasinoManager[b(940)](b(805),-h[b(616)],!1)):"primaryCurrency"==h[b(832)]&&(RSCasinoManager.triggerPrimarySinkEvent(b(805),h[b(616)],h[b(1045)]),this._bingoRewards[b(533)].primaryCurrencyOffset+=-h[b(616)],RSCasinoManager.addPrimaryCurrencyForDisplay(b(805),-h.value,!1));break;case b(1025):for(p in a[b(988)])switch(m&& (a[b(988)][p].machine_identifier=m),a[b(988)][p][b(832)]){case b(867):RSCasinoManager[b(606)](RSAnalyticsSource[b(650)],b(805),a[b(988)][p][b(616)],a[b(988)][p][b(1045)]);this._bingoRewards[b(533)][b(640)]+=a[b(988)][p][b(616)];RSCasinoManager[b(940)](b(805),a[b(988)][p][b(616)],!1);break;case b(982):RSCasinoManager[b(1047)](b(805),a[b(988)][p][b(616)],a[b(988)][p][b(1045)]);this[b(828)][b(533)][b(815)]+=a[b(988)][p][b(616)];RSCasinoManager.addPrimaryCurrencyForDisplay("spin_wheel",a[b(988)][p][b(616)], !1);break;case "powerups":null==this._bingoRewards[b(533)].powerupOffset[a.param[p][b(812)]]&&(this._bingoRewards[b(533)][b(1113)][a[b(988)][p].subCategory]=0);this._bingoRewards[b(533)][b(1113)][a.param[p][b(812)]]+=a[b(988)][p][b(616)];RSEngine[b(796)][b(367)]()[b(429)](a[b(988)][p][b(812)],a.param[p][b(616)]);h={};h[RSGame.getInstance()[b(617)]()[b(340)](a[b(988)][p][b(812)])]=a[b(988)][p][b(616)];RSAnalyticsManager[b(885)]().trackInHouseEvent(RSEventCategory[b(1072)],b(644),b(805),JSON[b(556)](h), a.param[p].machine_identifier,"");h=null;break;case "xp":this[b(828)][b(533)][b(979)]=a[b(988)][p].value,RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory[b(541)],b(805),b(318),a[b(988)][p][b(1045)],a[b(988)][p][b(616)],RSGame[b(885)]()[b(617)]().getRoundId()),RSCasinoManager[b(1066)].addXP(a.param[p][b(616)],!1),RSCasinoManager.getCasinoHUD()[b(878)]()}a[b(988)][b(468)]=0;this[b(689)]();RSEngine.dataManager[b(369)](this[b(828)][b(533)].primaryCurrencyOffset,this[b(828)][b(533)][b(640)],this[b(828)][b(533)][b(1113)], this[b(828)][b(533)][b(979)],this[b(828)][b(533)][b(566)]);this[b(828)][b(533)].primaryCurrencyOffset=0;this[b(828)][b(533)].secondaryCurrencyOffset=0;this[b(828)].spinWheel[b(1113)]={};this[b(828)][b(533)][b(979)]=0;this[b(828)][b(533)].coinSink=0}break;case b(1083):switch(h[b(848)]){case b(696):m=!0,n="",h.screen_name&&(n=h[b(559)],n===b(939)&&(m=!1,RSGame[b(885)]().getLosingStreakManager().calculateLosingStreak(this[b(775)]))),RSAnalyticsManager.getInstance()[b(841)](RSEventCategory[b(541)],"round_quit", n,h.machine_identifier,h[b(339)],RSGame.getInstance()[b(617)]().getRoundId()),m&&RSGame[b(885)]()[b(617)]()[b(419)](this[b(775)],function(){RSEngine.externalGameManager[b(684)]({event:"post_message",name:b(633),message:"",timeStamp:TimeManager[b(885)]().getCurrentServerTime()});RSEngine[b(554)][b(689)]()}[b(792)](this))}break;case b(1E3):switch(h[b(812)]){case b(975):this[b(828)][b(533)]&&this._bingoRewards[b(533)][b(566)]?(RSGame.getInstance()[b(938)]().getCurrentCoinBalance(this[b(1017)][b(792)](this)), RSEngine.audioManager[b(703)](),this[b(689)](),this._bingoRewards={spinWheel:{primaryCurrencyOffset:0,secondaryCurrencyOffset:0,xpOffset:0,powerupOffset:{},coinSink:0},roundComplete:{primaryCurrencyOffset:0,secondaryCurrencyOffset:0,powerupOffset:{}}}):(RSGame.getInstance()[b(938)]()[b(393)](this.onCallBackOnCoinSuccess[b(792)](this)),RSEngine.audioManager[b(703)](),this[b(689)]());break;case "start":h[b(1001)][b(339)]?RSAnalyticsManager[b(885)]().trackInHouseEvent(RSEventCategory[b(541)],b(767), "",h[b(1045)],h[b(1001)][b(339)],RSGame[b(885)]()[b(617)]()[b(681)]()):RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory[b(541)],b(767),"",h[b(1045)],"",RSGame[b(885)]()[b(617)]()[b(681)]());break;case b(537):RSAnalyticsManager[b(885)]()[b(682)](h[b(1045)],h[b(616)]);break;case "chat_button":RSAnalyticsManager.getInstance()[b(841)](RSEventCategory[b(733)],h[b(812)],h[b(848)],"",h[b(1045)],"")}switch(h[b(832)]){case "powerups":m=RSGame[b(885)]()[b(1026)]()[b(544)](h[b(812)]),RSGame[b(885)]()[b(938)]()[b(367)]().addPowerUps(h.subCategory, -h[b(616)]),RSAnalyticsManager[b(885)]().trackPowerUpActivation(h[b(1045)],m[b(496)],RSGame[b(885)]().getGameManager().getRoundId()),RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory[b(1072)],b(399),"powerup_activated",m[b(496)]+":1",h[b(1045)],JSON.stringify(RSEngine.dataManager[b(367)]().getPowerUps())),m={},m[h.subCategory]=h.value,RSEngine[b(796)].sinkPowerups(m)}break;case "buyIn":switch(h[b(832)]){case b(319):if(h[b(616)]<=RSGame[b(885)]()[b(938)]().getMe()[b(1032)]()){if(URLConfig[b(1034)]&& GlobalVars[b(759)]){if(GlobalVars[b(708)])RSPlatformSDKManager[b(885)]()[b(519)](SDK_EVENT_TYPE[b(846)]);else GlobalVars[b(657)]?RSPlatformSDKManager[b(885)]()[b(519)](SDK_EVENT_TYPE[b(567)]):RSPlatformSDKManager[b(885)]()[b(519)](SDK_EVENT_TYPE[b(327)]);GlobalVars[b(759)]=!1}RSCasinoManager[b(528)]("card_select",h[b(616)],h[b(1045)],h[b(812)]);RSGame[b(885)]()[b(938)]()._me[b(583)](h[b(1045)],1);RSCasinoManager[b(527)](b(1046),-h[b(616)],!1);RSGame[b(885)]().getGameManager()[b(967)]();RSGame[b(885)]()[b(617)]()[b(901)](h[b(812)]); RSGame[b(885)]().getGameManager()[b(403)]();RSGame[b(885)]()[b(617)]()[b(1041)]()?(m=RSGame.getInstance()[b(617)]()[b(1041)](),n=RSGameScreens[b(1110)]):(m="",n=RSGameScreens.KenoBingoLobby);RSAnalyticsManager[b(885)]().trackInHouseEvent(RSEventCategory[b(541)],b(473),n,h[b(1045)],h[b(812)],m);RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory.PLAYER_ACTION,b(1046),"",h.machine_identifier,h[b(812)],RSGame.getInstance()[b(617)]()[b(681)]());this[b(775)]=h.value;this[b(540)]=TimeManager[b(885)]()[b(348)](); RSPlacementManager[b(885)]().notifyBetChangeToPlacementManager(this[b(775)]);RSGame[b(885)]().getLosingStreakManager()[b(464)](-this[b(775)])}break;case b(1005):case b(982):RSCasinoManager.addPrimaryCurrencyForDisplay(b(1046),-h[b(616)]),RSCasinoManager.triggerPrimarySinkEvent(b(1046),h[b(616)],h[b(1045)],h.subCategory),RSGame[b(885)]().getUserDataManager().saveStatsInfo(h[b(1045)],h[b(812)]),RSGame[b(885)]()[b(617)]()[b(967)](),RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory[b(541)],b(1046), "",h.machine_identifier,h[b(812)],RSGame.getInstance()[b(617)]()[b(681)]()),this[b(540)]=TimeManager.getInstance().getCurrentServerTime(),this._bingoEntryCoins=h[b(616)],RSPlacementManager[b(885)]()[b(825)](this[b(775)]),h=new RSPlacementObject,h[b(937)]=this[b(775)],h.eventName=b(676),RSPlacementManager[b(885)]()[b(926)](h),RSGame.getInstance()[b(932)]().calculateLosingStreak(-this[b(775)])}break;case b(642):RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory.GUI,h.subCategory,h.value,h[b(1045)], "","");break;case b(329):switch(h[b(812)]){case b(1136):if(h[b(616)]){GlobalVars[b(346)]&&h.value&&(h={},m={},h[b(714)]="bingo_round_over",m.assetList=[{name:RSGame[b(885)]()[b(605)](b(780)),count:1}],m.font=RSGame[b(885)]()[b(617)]()[b(317)](b(1014),b(859)),m[b(643)]=1,this[b(959)]=new RSExplicitOGPopup(m,null,h),this[b(959)]&&(RSEngine[b(355)][b(700)](this[b(959)],!1),this._bingoOG=null));break}break;case b(964):h[b(616)][b(468)]&&BingoLeaderboard instanceof Object&&BingoLeaderboard[b(1031)](h[b(616)][b(468)], h.machine_identifier);break;case b(382):RSGame[b(885)]()[b(617)]()[b(403)]();0<h[b(616)][b(964)].primaryCurrency&&(c+=h[b(616)][b(964)][b(982)],RSCasinoManager.triggerPrimarySourceEvent(RSAnalyticsSource.free,b(608)+GameFeatureTypeEnum[b(1049)],h[b(616)][b(964)][b(982)],h[b(1045)]),RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory.PLAYER_ACTION,b(698),GameFeatureTypeEnum[b(1049)]+b(501),h[b(1045)],h[b(616)][b(964)][b(982)]+(0<h[b(616)].extra[b(1008)]?"coins"==GameFeatureTypeEnum[b(1049)]?h[b(616)][b(1001)][b(1008)]: 0:0)+(0<h[b(616)][b(1001)][b(1130)]?h[b(616)][b(1001)][b(1130)]:0),RSGame.getInstance()[b(617)]()[b(681)]()));0<h[b(616)][b(964)].secondaryCurrency&&(d+=h[b(616)].rank[b(867)],RSCasinoManager[b(606)](RSAnalyticsSource.free,b(608)+GameFeatureTypeEnum[b(970)],h[b(616)][b(964)][b(867)],h[b(1045)]),RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory[b(541)],b(698),GameFeatureTypeEnum[b(970)]+b(501),h[b(1045)],h.value[b(964)][b(867)]+(0<h[b(616)][b(1001)][b(1008)]?GameFeatureTypeEnum.SECONDARY_CURRENCY== b(319)?h[b(616)][b(1001)][b(1008)]:0:0)+(0<h.value.extra[b(596)]?h[b(616)].extra[b(596)]:0),RSGame[b(885)]().getGameManager()[b(681)]()));0<h[b(616)][b(1001)][b(1008)]&&(GameFeatureTypeEnum[b(1049)]==b(319)?(c+=h[b(616)][b(1001)][b(1008)],RSCasinoManager.triggerPrimarySourceEvent(RSAnalyticsSource[b(650)],b(416)+GameFeatureTypeEnum[b(1049)],h[b(616)][b(1001)].extraCoins,h[b(1045)])):(d+=h[b(616)][b(1001)][b(1008)],RSCasinoManager[b(606)](RSAnalyticsSource[b(650)],"bingo_"+GameFeatureTypeEnum[b(970)], h[b(616)][b(1001)].extraCoins,h[b(1045)])));0<h[b(616)][b(1001)][b(1130)]&&(c+=h[b(616)][b(1001)][b(1130)],RSCasinoManager[b(1047)](RSAnalyticsSource[b(650)],b(503)+GameFeatureTypeEnum.PRIMARY_CURRENCY,h[b(616)][b(1001)][b(1130)],h[b(1045)]));0<h[b(616)][b(1001)][b(596)]&&(d+=h.value[b(1001)][b(596)],RSCasinoManager[b(606)](RSAnalyticsSource[b(650)],b(503)+GameFeatureTypeEnum[b(970)],h.value.extra[b(596)],h[b(1045)]));n=RSGame[b(885)]()[b(713)]()[b(771)]();r=RSGame[b(885)]()[b(713)]()[b(953)]();r= Math.round(100*r)%100;0<h[b(616)].extra.xp&&(e+=h.value[b(1001)].xp,RSCasinoManager._customCasinoInterface[b(1107)](h[b(616)][b(1001)].xp,!1),RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory[b(541)],b(698),b(318),h.machine_identifier,h[b(616)][b(1001)].xp,RSGame.getInstance().getGameManager().getRoundId()));m=RSGame[b(885)]().getLevelManager()[b(771)]();s=RSGame[b(885)]()[b(713)]()[b(953)]();s=Math[b(645)](100*s)%100;RSCasinoManager[b(797)]()[b(935)](b(1076),{oldLevel:n,oldlevelOffset:r,newLevel:m, levelOffset:s});RSCasinoManager[b(1117)]()&&RSCasinoManager[b(1117)]()[b(787)](RSGame[b(885)]().getUserDataManager()[b(367)]().getXP());if(0<h[b(616)][b(1001)].treasurepowerup){n={};for(p in h.value[b(1001)][b(397)])void 0===h[b(1059)]&&!0!=h[b(1059)]&&RSGame.getInstance()[b(938)]()[b(367)]()[b(429)](p,h[b(616)][b(1001)][b(397)][p]),m=RSGame[b(885)]()[b(1026)]().getPowerupDetails(p),null==g[p]&&(g[p]=0),g[p]+=h[b(616)][b(1001)][b(397)][p]||1,n[m.analyticsID]=h[b(616)][b(1001)].powerups[p]||1,RSAnalyticsManager[b(885)]()[b(738)](h[b(1045)], m[b(496)],h.value.extra[b(397)][p]||1,RSGame[b(885)]()[b(617)]()[b(681)]());RSAnalyticsManager.getInstance()[b(841)](RSEventCategory.PLAYER_ACTION,b(698),"powerups_rewarded",h[b(1045)],JSON[b(556)](n),RSGame[b(885)]()[b(617)]()[b(681)]());"powerups"==GameFeatureTypeEnum[b(970)]?RSCasinoManager[b(606)](RSAnalyticsSource[b(650)],b(665),h[b(616)].extra.treasurepowerup,h[b(1045)]):RSAnalyticsManager.getInstance()[b(841)](RSEventCategory[b(1072)],b(644),"treasure_powerups",JSON[b(556)](RSGame.getInstance().getGameManager().getPowerupAnalyticsIDFromNameInJSON(h.value[b(1001)][b(397)])), h[b(1045)],JSON[b(556)](RSGame[b(885)]()[b(617)]()[b(674)](RSEngine[b(796)][b(367)]()[b(808)]())))}m=null;if(h.value[b(1001)].treasurecollectible)for(n=0;n<h[b(616)][b(1001)].treasurecollectible[b(468)];n++)m=h[b(616)].extra.treasurecollectible[n],r=RSGame[b(885)]()[b(1026)]()[b(997)](m.id),f[m.id]=1,RSEngine[b(796)][b(367)]().addCollectible(m.id,1),r[b(893)](b(571))?RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory.BINGO_GAME_ACTION,"bingo_puzzle",r,"",h.machine_identifier,RSGame.getInstance()[b(617)]()[b(681)]()): RSAnalyticsManager[b(885)]()[b(444)](h[b(1045)],r,RSGame.getInstance()[b(617)]()[b(681)]());if(h[b(616)].extra[b(779)]){m=RSEngine[b(460)][b(509)](h[b(1045)]).id;n=parseInt(RSEngine[b(796)][b(367)]().getShadowCardDetails(m));for(r=0;r<h.value[b(1001)].treasureshadowCardDetails[b(468)];r++)n+=Math[b(923)](2,h[b(616)].extra[b(779)][r].puzzleIndex);RSEngine.dataManager.getMe().setShadowCardDetails(m,n)}h[b(616)].extra[b(539)]&&h[b(616)][b(1001)][b(539)]===b(699)&&RSAnalyticsManager.getInstance()[b(841)](RSEventCategory[b(541)], b(698),b(1056),h[b(1045)],h[b(616)][b(1001)][b(343)],RSGame[b(885)]()[b(617)]()[b(681)]());h.value.extra[b(706)]&&RSGame[b(885)]().getGameManager()[b(425)]()&&RSCasinoManager.getCasinoInterface()[b(1139)](h[b(616)][b(1001)][b(706)]);h[b(616)][b(1001)][b(763)]&&(k=h[b(616)][b(1001)].bingoRanks[b(468)],h[b(616)][b(1001)].cardCount&&h.value[b(1001)][b(763)].length&&(h[b(616)].extra.roomType&&"multipleBingoRoom"===h[b(616)][b(1001)][b(539)]?RSAnalyticsManager.getInstance()[b(841)](RSEventCategory[b(733)], b(665),h[b(616)].extra[b(941)],"[]",h[b(1045)],RSGame[b(885)]().getGameManager().getRoundId()):RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory[b(733)],b(665),h[b(616)][b(1001)][b(941)],JSON[b(556)](h[b(616)][b(1001)][b(763)]),h[b(1045)],RSGame.getInstance()[b(617)]()[b(681)]())),RSEngine.dataManager[b(367)]()[b(1064)](k));h[b(616)][b(1001)][b(715)]&&RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory[b(541)],"round_summary",b(1141),h[b(1045)],h.value[b(1001)][b(715)],RSGame[b(885)]()[b(617)]()[b(681)]()); h[b(616)][b(1001)][b(941)]&&RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory[b(541)],b(698),"cards_played",h[b(1045)],h[b(616)][b(1001)][b(941)],RSGame[b(885)]()[b(617)]()[b(681)]());h[b(616)][b(1001)][b(743)]&&RSAnalyticsManager[b(885)]().trackInHouseEvent(RSEventCategory.PLAYER_ACTION,"round_summary",b(1095),h[b(1045)],h[b(616)][b(1001)][b(743)],RSGame[b(885)]()[b(617)]().getRoundId());h[b(616)][b(1001)][b(1101)]&&0<h[b(616)].extra.treasurecollectible[b(468)]&&RSAnalyticsManager[b(885)]().trackInHouseEvent(RSEventCategory.PLAYER_ACTION, b(698),b(362),h[b(1045)],h.value.extra[b(1101)][b(468)],RSGame.getInstance()[b(617)]()[b(681)]());RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory[b(541)],b(1062),"",h.machine_identifier,h[b(616)].extra[b(941)],RSGame.getInstance()[b(617)]()[b(681)]());c&&(GameFeatureTypeEnum[b(1049)]==b(319)?(void 0===h[b(1059)]&&!0!=h[b(1059)]&&(RSCasinoManager[b(1091)](c,!0),RSGame[b(885)]().getGameManager()[b(439)](c)),RSGame[b(885)]()[b(932)]().calculateLosingStreak(c)):(RSGame[b(885)]().getLosingStreakManager()[b(464)](c), void 0===h[b(1059)]&&!0!=h[b(1059)]&&!RSCasinoManager[b(797)]()[b(720)]()&&RSCasinoManager.addPrimaryCurrencyForDisplay("round_reward",c)));d&&void 0===h.eventBeforeButtonClick&&!0!=h[b(1059)]&&!RSCasinoManager[b(797)]()[b(720)]()&&RSCasinoManager[b(940)](b(1104),d);RSEngine[b(796)].saveBingoRewards(c,d,e,f,g,k,h.value[b(1001)][b(941)],h[b(1045)]);void 0!==h[b(1059)]&&!0===h[b(1059)]&&(this[b(828)][b(329)][b(815)]=c,this[b(828)][b(329)].secondaryCurrencyOffset=d,this[b(828)][b(329)][b(1113)]=g);this[b(689)](); m={_gameResult:{rankList:[],primaryCurrencyOffset:c}};m[b(709)][b(363)]=h[b(616)].extra[b(763)];RSCasinoManager[b(840)](m);"BBC"!=GameConfig[b(818)]&&GameConfig[b(818)]!=b(861)&&"MS"!=GameConfig[b(818)]&&"CS"!=GameConfig.GAME_ID&&"AP"!=GameConfig[b(818)]&&GameConfig[b(818)]!=b(1035)&&"UP"!=GameConfig[b(818)]||RSCasinoManager[b(797)]()[b(908)](m,RSGameTypes[b(1029)],h[b(1045)]);"BSB"!=GameConfig[b(818)]&&RSGame.getInstance()[b(617)]()[b(419)](this[b(775)]);0<h[b(616)][b(1001)][b(673)]&&RSCasinoManager[b(652)](b(433), h[b(616)][b(1001)][b(673)])}break;case "bingoCardStatus":switch(h[b(812)]){case "badBingo":RSAnalyticsManager.getInstance().trackBadBingo(h[b(1045)],h[b(616)],RSGame[b(885)]()[b(617)]()[b(681)]())}break;case b(752):RSCasinoManager._customCasinoInterface&&RSCasinoManager[b(1066)][b(1098)](h[b(1045)]);break;case b(722):RSEventManager[b(885)]()[b(1108)](b(916),{currentLevel:RSGame[b(885)]()[b(713)]()[b(771)](),currentLevelOffset:RSGame[b(885)]()[b(938)]()[b(367)]()[b(955)](),levelData:RSGame[b(885)]().getGameData()[b(856)](b(753))}); this[b(689)]();break;case b(1080):"function"===typeof RSCasinoManager[b(797)]()[b(337)]&&RSCasinoManager.getCasinoInterface()[b(337)]("You lost connectivity with the server. Please try again.");this[b(484)]();break;case b(405):RSGame[b(885)]().getUserDataManager()[b(393)](function(){this[b(689)]()}[b(792)](this));break;case b(1146):RSCasinoManager[b(1117)]()[b(707)](!1);RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory.PLAYER_ACTION,"session_stop","",h[b(1045)],"","");RSEngine[b(554)].unLoadExternalGame(); RSGameScreenManager[b(885)]()[b(783)]();break;case b(488):switch(h.action){case b(1087):RSAnalyticsManager.getInstance()[b(841)](RSEventCategory[b(903)],b(1096),b(948),b(1087),"","");RSGame[b(885)]()[b(617)]().setRoundId();break;case b(1046):RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory[b(903)],"tutorial_gameplay",b(948),b(1046),"","");break;case b(883):RSAnalyticsManager[b(885)]()[b(841)](RSEventCategory[b(903)],b(1096),b(948),b(883),"","");break;case "power_up":RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI, b(1096),"game_play",b(784),"","");break;case b(1121):RSAnalyticsManager.getInstance()[b(841)](RSEventCategory[b(903)],b(1096),b(948),b(1121),"","")}}a[b(988)][b(499)]()}},onCallBackOnCoinSuccess:function(a){a=a0_0x10dccc;cc.log("Checking coin balance completed inside bingo!!!");this[a(689)]();RSCasinoManager[a(1066)][a(879)]()},setBingoData:function(){var a=a0_0x10dccc;if(this[a(1044)]&&this[a(1125)]()){var b={};b[a(352)]=a(404);this[a(919)]._machineData[a(982)]=RSCasinoManager[a(586)]();this[a(919)][a(1118)][a(867)]= RSCasinoManager._customCasinoInterface.getSecondaryCurrency();this[a(919)]._machineData.powerUps=RSEngine.dataManager[a(367)]()[a(808)]();this[a(919)][a(1118)][a(638)]=RSEngine.dataManager.getMe()[a(728)]();this[a(919)][a(1118)][a(333)]=RSEngine[a(796)].getMe()[a(811)]();this[a(919)][a(1118)][a(777)]=RSGame[a(885)]()[a(617)]()[a(634)]();this[a(919)][a(1118)].levelData={currentLevel:RSGame.getInstance().getLevelManager()[a(771)](),currentLevelOffset:RSGame[a(885)]()[a(938)]()[a(367)]()[a(955)](),levelData:RSGame[a(885)]()[a(1026)]()[a(856)](a(753))}; this._machineParams[a(1118)][a(981)]=GameConfig[a(591)];b[a(993)]=this._machineParams._machineData;b.bingoData[a(625)]=RSGame[a(885)]()[a(617)]()[a(325)]();b[a(392)]=TimeManager[a(885)]()[a(348)]();this[a(684)](b)}},_handleDODMachineEvents:function(a,b){var c=a0_0x10dccc;switch(a){case c(426):this[c(514)][c(1051)](this[c(919)][c(837)],this[c(919)][c(1065)]);this[c(1109)]=!0;RSCasinoManager[c(1085)](this._machineParams._analyticsID);this.setDODSoundAndMusic();RSGame[c(885)]()[c(938)]().getMe()[c(1009)](RSGameTypes.Poker); break;case c(767):this[c(514)][c(323)]();var d=Math[c(513)](b.bet);0<d?RSCasinoManager[c(528)](c(675),d,this[c(919)][c(837)],c(385)):RSCasinoManager[c(528)](c(675),d,this[c(919)][c(837)],c(902));!this._dodTutorialActive&&RSCasinoManager[c(527)](c(675),-d);break;case "round_result":var d=Math.floor(b[c(675)]),e=Math[c(513)](b.win);e&&(0<d?RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],c(1081),e,this._machineParams._analyticsID,c(385)):RSCasinoManager[c(1047)](RSAnalyticsSource[c(650)],c(1081), e,this[c(919)]._analyticsID,c(902)),RSCasinoManager.addPrimaryCurrencyForDisplay(c(1081),e));this[c(514)][c(463)](d,e);break;case c(1062):this[c(514)].notifyRoundComplete();RSCasinoManager[c(797)]()[c(879)]();break;case c(1039):RSCasinoManager.notifyOutOfCurrencyToCasino(32E6);this[c(514)][c(756)]();break;case "error":RSErrorTracker[c(885)]()[c(761)](c(1082),c(770)+this[c(919)][c(1127)],c(535));this[c(514)][c(855)]();break;case c(1103):this[c(506)](!0);break;case c(849):this[c(888)]=!0;RSAnalyticsManager[c(885)]().trackInHouseEvent(RSEventCategory.GUI, c(902),c(324),"","","");break;case c(1099):this._dodTutorialActive=!1;break;case c(434):RSAnalyticsManager[c(885)]().trackInHouseEvent(RSEventCategory.GUI,c(902),c(764),"","","");break;case "tutorial_open":RSAnalyticsManager[c(885)]()[c(841)](RSEventCategory[c(903)],c(922),c(359),"","","")}},onQuitCallBack:function(a){var b=a0_0x10dccc;this._quitPopup=null;a&&(this[b(888)]=!1,this[b(1109)]=!1,RSCasinoManager.getCasinoHUD()[b(491)](!0))},_postConnectionLostEvent:function(){var a=a0_0x10dccc,b={event:a(799), name:a(552),timeStamp:TimeManager[a(885)]().getCurrentServerTime()};this[a(684)](b)},_onconnectionLost:function(){this[a0_0x10dccc(484)]()},_onconnectionRetry:function(){var a=a0_0x10dccc,b={event:a(799),name:a(1058),timeStamp:TimeManager[a(885)]()[a(348)]()};this[a(684)](b)},triggerEventOnBackButtonClick:function(){var a=a0_0x10dccc;if(this[a(919)]&&this[a(919)][a(1065)]==RSGameTypes[a(474)])if(this._machineParams[a(508)]==CasinoExternalPokerGameType[a(627)]){var b={event:a(911)};this._updateMachineData(b)}else GameConfig.TOURNAMENT_ENABLED&& GlobalVars[a(657)]&&(b={event:a(799),name:a(718),timeStamp:TimeManager[a(885)]().getCurrentServerTime()},this[a(684)](b));else b={event:a(799),name:a(718),timeStamp:TimeManager[a(885)]()[a(348)]()},this[a(684)](b)},triggerDONPurchaseSuccesEvent:function(){var a=a0_0x10dccc,b={event:a(799),name:a(386),timeStamp:TimeManager[a(885)]().getCurrentServerTime()};this[a(684)](b)},isInGameBackButtonActive:function(){var a=a0_0x10dccc;if(this[a(1044)]&&this[a(1125)]()&&(this[a(573)]=!1,this[a(919)][a(662)])){if(this[a(919)][a(662)]== a(950))return!0;if(this[a(919)][a(1065)]==RSGameTypes[a(474)]){if(GlobalVars.isTournamentLoaded||this[a(919)][a(508)]==CasinoExternalPokerGameType[a(627)]&&this._dodMachineLoaded)return!0}else if(GlobalVars[a(657)])return!0}return!1},unLoadExternalGame:function(){var a=a0_0x10dccc;this._machineParams&&RSGame.getInstance()[a(617)]()[a(839)]()==RSGameTypes[a(451)]&&this[a(919)]._thirdPartyOwnerType&&this[a(919)][a(508)]==CasinoExternalGameType[a(342)]&&parent[a(485)]({type:a(820)},"*");null==this[a(577)]&& (this._spinGameDiv=document.getElementById(a(446)));null!=this._spinGameDiv&&this[a(577)][a(951)]&&this[a(577)][a(951)][a(492)](this._spinGameDiv);this[a(514)]&&null!=this[a(514)]._loader&&(this._externalGameInterface[a(793)]=null);this._spinGameDiv=null;this._machineParams=this._iFrameSpin=this[a(593)]=null;typeof SideMenuController!==a(472)&&SideMenuController[a(885)]()[a(705)]()},checkAndUpdateMachineBetV2:function(){var a=a0_0x10dccc;if(this[a(919)][a(1065)]){var b=0;switch(this[a(919)][a(1065)]){case RSGameTypes[a(451)]:b= RSAnalyticsManager[a(885)]().getCurrentMachineAnalyticsName();b=RSGame[a(885)]()[a(1026)]()[a(448)](b,RSGame[a(885)]()[a(713)]()[a(771)]());GameConfig.BET_UNLOCK_POPUP_ENABLED?this[a(919)][a(685)]!=b&&(this[a(919)][a(685)]=b,RSCasinoManager[a(652)](a(351),b,"SLOTS",this._machineParams[a(588)],"betLineCount")):RSEngine[a(554)][a(402)](b,this[a(919)][a(662)]);break;case RSGameTypes.Poker:b=RSGame[a(885)]()[a(1026)]()[a(1116)](this._machineParams[a(1057)]);if(this[a(919)][a(685)]!=b){this._machineParams[a(685)]= b;var c=this[a(919)][a(862)][a(568)]("_")[0];GameConfig[a(934)]?RSCasinoManager[a(652)](a(351),b,c,this[a(1092)],""):RSEngine[a(554)][a(428)](b,c)}break;case RSGameTypes[a(768)]:GameConfig.BET_UNLOCK_POPUP_ENABLED&&(b=RSGame.getInstance()[a(1026)]().getRouletteBetStructureByName(this[a(919)]._analyticsID,RSGame[a(885)]().getLevelManager()[a(771)]()),b=parseInt(b[b[a(468)]-1]),this[a(919)][a(685)]!=b&&(c=RSGame.getInstance()[a(1026)]()[a(821)](this._machineParams._analyticsID),this[a(919)][a(685)]= b,RSCasinoManager.triggerMachineEvent(a(351),b,a(946),c,a(800))));break;case RSGameTypes.Keno:b=RSGame[a(885)]()[a(1026)]()[a(331)](a(347),this._machineParams._analyticsID);this[a(919)]._maxBetAmount!=b&&2==parseInt(this[a(919)][a(508)])&&(this[a(919)][a(685)]=b,GameConfig[a(934)]?RSCasinoManager[a(652)](a(351),b,a(1131)):RSEngine[a(554)][a(511)](b,"KENO"));break;case RSGameTypes[a(381)]:GameConfig[a(934)]?(b=parseInt(RSGame[a(885)]().getGameData().getMaxBetValueForBlackjack(this._machineParams[a(475)], RSGame[a(885)]()[a(713)]().getCurrentLevel())),this[a(919)][a(685)]!=b&&(c=RSGame.getInstance().getGameData()[a(691)](this._machineParams[a(1045)]),this._machineParams[a(685)]=b,RSCasinoManager[a(652)]("BET_UPDATED",b,a(409),c,a(800)))):(b=parseInt(RSGame[a(885)]()[a(1026)]().getMaxBetValueForBlackjack(a(680),RSGame[a(885)]().getLevelManager()[a(771)]())),c=RSGame[a(885)]()[a(1026)]()[a(691)](this[a(919)][a(1045)]),this[a(919)]._maxBetAmount!=b&&(this[a(919)][a(685)]=b,RSEngine[a(554)][a(672)](b, "BLACKJACK_V2",c)))}}},setOddsWorkEventSource:function(a,b){this[a0_0x10dccc(804)]=a;this._oddsWorkEventOrigin=b},setAinsworthEventSource:function(a,b){var c=a0_0x10dccc;this[c(886)]=a;this[c(597)]=b},isRocketManMachineLoaded:function(){var a=a0_0x10dccc;return RSEngine.externalGameManager[a(919)]&&RSEngine[a(554)][a(919)]._thirdPartyOwnerType&&RSGame.getInstance()[a(617)]()[a(839)]()==RSGameTypes[a(451)]&&parseInt(RSEngine[a(554)]._machineParams[a(508)])==CasinoExternalGameType[a(342)]?!0:!1}});var RSExternalGameInterface=RSClass.extend({init:function(){this._super.init.call(this)},notifyLoadStart:function(){},notifyGameLoaded:function(a,b){},notifyRoundStart:function(){},notifyRoundResult:function(a){},notifyRoundComplete:function(){},notifyError:function(){},notifyOutOfCredits:function(){},showExternalGame:function(){},hideExternalGame:function(){},exitMachine:function(a){}});var IRSPreloaderDelegate=new Interface("IRSPreloaderDelegate",["onPreloadProgress","onPreloadComplete"]),RSPreloader=RSClass.extend({_preloadRes2:null,_progressBar:null,_progressBarWidth:null,_progress:null,_delegate:null,init:function(){this._super.init.call(this);this._rsLayerObject2=null;this._rsLayerObject2=new RSSaleLoader;this._rsLayerObject2.init();this._children=[];this._progressBar=null;this._progressBarWidth=0;RSEngine.isMobile&&this._rsLayerObject2.retain()},setDelegate:function(a){this._delegate= a;a.implements(IRSPreloaderDelegate)},startPreload:function(a){if(null!=this._preloadRes2)cc.log("Preload already in progress");else{this._preloadRes2=a;var b=this,c=[];for(a=0;a<b._preloadRes2.length;a++)c.push(b._preloadRes2[a]);null!=this._progressBar&&(this._progressBar.setVisible(!0),a=this._progressBar.getSize(),this._progressBarWidth=a._width,this._progressBar.setSize(0,a._height));this._rsLayerObject2.fetchResource(c,function(a){b._progress=a;b.onPreloadProgress(a)},function(){c=b._preloadRes2= null;b.onPreloadComplete()})}},onPreloadProgress:function(a,b){this._delegate.onPreloadProgress(b)},onPreloadComplete:function(a,b,c){this._delegate.onPreloadComplete()},unloadContent:function(){this._preloadRes2=null;this._rsLayerObject2.unload();this._super.unloadContent.call(this)}});var RSSaleLoader=cc.Layer.extend({onProgress:null,init:function(){return!0},onEnter:function(){cc.Node.prototype.onEnter.call(this)},onExit:function(){cc.Node.prototype.onExit.call(this)},initWithResources:function(a,b,c){cc.isString(a)&&(a=[a]);this.resources=a||[];this.cb=c;this.onProgress=b;this._retryCount=0;this._startLoading()},fetchResource:function(a,b,c){cc.isString(a)&&(a=[a]);this.resources=a||[];this.cb=c;this.onProgress=b;this._retryCount=0;this._startLoading()},_startLoading:function(){var a= this;a.unschedule(a._startLoading);cc.loader.load(a.resources,function(b,c,d){b=Math.min((d+1)/c*100|0,100);if(0>=a._retryCount&&a.onProgress)a.onProgress(b)},function(b){b?a._onErrorLoading(b):a.cb&&a.cb()})},_onErrorLoading:function(a){this._retryCount++;if(3>=this._retryCount){for(var b=this.resources.length=0;b<a.length;b++)a[b]&&this.resources.push(a[b].url);this._startLoading()}else RSCasinoManager.notifyLoadingFailureToCasino(a)},unload:function(){this.onProgress=this.cb=null}});var RSScrollViewDirection={RSSCROLLVIEW_HORIZONTAL:ccui.ScrollView.DIR_HORIZONTAL,RSSCROLLVIEW_VERTICAL:ccui.ScrollView.DIR_VERTICAL},RSScrollView=RSClass.extend({init:function(a,b,c,d){this._super.init.call(this);this._ccObject=null;this._itemsPerRowCol=d;this._objectSize=b;this._scrollBase=this._btnScroll=this._btnDown=this._btnUp=null;this._scrollButtonTouchStarted=!1;b=new ccui.ScrollView;b.setDirection(c);b.setBounceEnabled(!0);b.setInertiaScrollEnabled(!0);b.setScrollBarEnabled(!1);b.setTouchEnabled(!0); b.setPosition(new cc.Point(a.getX()-a.getWidth()/2,a.getY()-a.getHeight()/2));b.setContentSize(new cc.Size(a.getWidth(),a.getHeight()));b.setInnerContainerSize(new cc.Size(a.getWidth(),a.getHeight()));this._ccObject=b;RSEngine.isMobile&&this._ccObject.retain()},setTouchEnabled:function(a){this._ccObject.setTouchEnabled(a)},getChildrenCount:function(){return this._ccObject.getChildrenCount()},enableScrollBar:function(){this._ccObject.setScrollBarEnabled(!0)},setScrollBarColor:function(a){this._ccObject.setScrollBarColor(cc.color(a.getR(), a.getG(),a.getB()));this._ccObject.setScrollBarOpacity(a.getA())},disableClipping:function(){this._ccObject.setClippingEnabled(!1)},setBackGroundColor:function(a){this._ccObject.setBackGroundColor(new cc.Color(a.getR(),a.getG(),a.getB(),a.getA()))},addChild:function(a){var b=this._objectSize.getWidth(),c=this._objectSize.getHeight(),d=this._ccObject.getChildrenCount(),e=""+d,d=this.getPositionForItemAtIndex(d),f=d.getX()+b/2,g=this._ccObject._contentSize.height-d.getY()+c/2,c=g-this._ccObject._contentSize.height, b=f-this._ccObject._contentSize.width;if(0<c||0<b)for(this._ccObject.setInnerContainerSize(new cc.Size(f,g)),f=this._ccObject._innerContainer._children,g=0;g<f.length;g++){var h=this.getPositionForItemAtIndex(g);f[g].setPosition(h.getX()-b,h.getY()+c)}else b=c=0;a.setCenter(d.getX()-b,d.getY()+c);this._ccObject.addChild(a.getDisplayObject(),0,e);this.activateScrollButtons()},getPositionForItemAtIndex:function(a){var b=this._objectSize.getWidth(),c=this._objectSize.getHeight(),d=0,e=0;switch(this._ccObject.getDirection()){case RSScrollViewDirection.RSSCROLLVIEW_HORIZONTAL:d= Math.floor(a/this._itemsPerRowCol);e=a%this._itemsPerRowCol;break;case RSScrollViewDirection.RSSCROLLVIEW_VERTICAL:e=Math.floor(a/this._itemsPerRowCol),d=a%this._itemsPerRowCol}return new RSPoint(b/2+b*d,this._ccObject._contentSize.height-c/2-c*e)},removeChild:function(a,b){this._ccObject.removeChild(a,b)},removeAllChildren:function(){this._ccObject.removeAllChildren()},scrollToRight:function(a,b){this._ccObject.scrollToRight(a,b)},scrollToLeft:function(a,b){this._ccObject.scrollToLeft(a,b)},scrollToTop:function(a, b){this._ccObject.scrollToTop(a,b)},scrollToBottom:function(a,b){this._ccObject.scrollToBottom(a,b)},scrollToPercentVertical:function(a,b,c){this._ccObject.scrollToPercentVertical(a,b,c)},scrollToPercentHorizontal:function(a,b,c){this._ccObject.scrollToPercentHorizontal(a,b,c)},jumpToRight:function(){this._ccObject.jumpToRight()},jumpToLeft:function(){this._ccObject.jumpToLeft()},jumpToTop:function(){this._ccObject.jumpToTop()},jumpToBottom:function(){this._ccObject.jumpToBottom()},jumpToPercentVertical:function(a){this._ccObject.jumpToPercentVertical(a)}, jumpToPercentHorizontal:function(a){this._ccObject.jumpToPercentHorizontal(a)},addEventListener:function(a){this._ccObject.addEventListener(a)},removeEventListener:function(){this._ccObject._ccEventCallback=null},stopAutoScroll:function(){this._ccObject.stopAutoScroll()},scrollToItem:function(a,b){var c=this._ccObject.getChildrenCount(),c=Math.floor(c/this._itemsPerRowCol),d=a.getTag(),c=100/(c/Math.floor(d/this._itemsPerRowCol));switch(this._ccObject.getDirection()){case RSScrollViewDirection.RSSCROLLVIEW_HORIZONTAL:this.scrollToPercentHorizontal(c, b,!0);break;case RSScrollViewDirection.RSSCROLLVIEW_VERTICAL:this.scrollToPercentVertical(c,b,!0)}},getDisplayObject:function(){return this._ccObject},setVisible:function(a){this._ccObject.setVisible(a)},unload:function(){this.removeAllChildren();this._ccObject.cleanup();RSEngine.isMobile&&this._ccObject.release();this._ccObject=null;this._super.unload.call(this)},stopAllActions:function(){this._ccObject.stopAllActions()},setButtonUp:function(a){this._btnUp=a;this._btnUp.setTouchEnabled(!1);this._btnUp.addTouchEventListener(this, this.btnUpClicked.bind(this))},setButtonDown:function(a){this._btnDown=a;this._btnDown.setTouchEnabled(!1);this._btnDown.addTouchEventListener(this,this.btnDownClicked.bind(this))},setButtonScroll:function(a){this._btnScroll=a;this._btnScroll.setVisible(!1);this._btnScroll.setName("scrollButton");a=new RSRect(0,0,RSEngine.screenWidth,RSEngine.screenHeight);this._scrollPaddleArea=new RSDisplayObject(a);this.getDisplayObject().getParent().addChild(this._scrollPaddleArea.getDisplayObject());this._scrollPaddleArea.setZOrder(this._btnScroll.getZOrder()+ 1);this._scrollPaddleArea.addTouchListenerWithDelegate(this);this._scrollPaddleArea.removeMoveListener();this._scrollPaddleArea.setName("scrollPaddleArea");this._btnScroll.addTouchListenerWithDelegate(this);"Button"==this._btnScroll.getType()&&this._btnScroll.getDisplayObject()._touchListener.setSwallowTouches(!1);this.addEventListener(this.onTouchScroll.bind(this))},setScrollBase:function(a){this._scrollBase=new RSRect(a.x,a.y,a.w,a.h)},enableScrollButton:function(a){this._btnScroll.setTouchEnabled(a)}, activateScrollButtons:function(){null==this._btnScroll||this._btnScroll.isVisible()||(this._btnScroll.setVisible(!0),this.setScrollBarVisibleStatus(!0));null==this._btnDown||this._btnDown.isTouchEnabled()||this._btnDown.setTouchEnabled(!0);null==this._btnUp||this._btnUp.isTouchEnabled()||this._btnUp.setTouchEnabled(!0)},deactivateScrollButtons:function(){null!=this._btnScroll&&(this._btnScroll.setVisible(!1),this.setScrollBarVisibleStatus(!1));null!=this._btnDown&&this._btnDown.isTouchEnabled()&& this._btnDown.setTouchEnabled(!1);null!=this._btnUp&&this._btnUp.isTouchEnabled()&&this._btnUp.setTouchEnabled(!1)},setScrollBarVisibleStatus:function(a){null!=this._btnScroll&&this._btnScroll.setVisible(a);null!=this._btnDown&&this._btnDown.setVisible(a);null!=this._btnUp&&this._btnUp.setVisible(a);null!=this._scrollBg&&this._scrollBg.setVisible(a)},onTouchScroll:function(){var a=this._scrollBase.getY()+this._scrollBase.getHeight()/2-this._btnScroll.getSize().getHeight()/2,b=this._scrollBase.getY()- this._scrollBase.getHeight()/2+this._btnScroll.getSize().getHeight()/2,c=this.getPercentVertical();isNaN(c)||(c=a-c/100*(a-b),c>a?c=a:c<b&&(c=b),this._btnScroll.setY(c))},btnUpClicked:function(a,b,c){a=this.getPercentVertical();isNaN(a)||(a-=10,0>a&&(a=0),this.scrollOnUpDownClick(a))},btnDownClicked:function(a,b,c){a=this.getPercentVertical();isNaN(a)||(a+=10,100<a&&(a=100),this.scrollOnUpDownClick(a))},getPercentVertical:function(){var a=this._ccObject._innerContainer.getPosition().y,b=this._ccObject._contentSize.height- this._ccObject._innerContainer.getContentSize().height;return 100*(a-b)/-b},getPercentHorizontal:function(){var a=this._ccObject._innerContainer.getPosition().x,b=this._innerContainer.getContentSize().width-this._ccObject._contentSize.width;return-(100*a/b)},scrollOnUpDownClick:function(a){var b=this._scrollBase.getY()+this._scrollBase.getHeight()/2-this._btnScroll.getSize().getHeight()/2,c=this._scrollBase.getY()-this._scrollBase.getHeight()/2+this._btnScroll.getSize().getHeight()/2,d=b-a/100*(b- c);d>b?d=b:d<c&&(d=c);this._btnScroll.setY(d);this.scrollToPercentVertical(a,0.5,!0)},handleObjectTouchAt:function(a,b,c){"scrollButton"===a.getName()?this._scrollButtonTouchStarted=!0:"scrollPaddleArea"===a.getName()&&(this._scrollButtonTouchStarted=!1,cc.$("#gameCanvas").style.cursor="default")},handleObjectTouchMoveAt:function(a,b,c){this._scrollButtonTouchStarted&&(a=this._scrollBase.getY()+this._scrollBase.getHeight()/2-this._btnScroll.getSize().getHeight()/2,b=this._scrollBase.getY()-this._scrollBase.getHeight()/ 2+this._btnScroll.getSize().getHeight()/2,c>a?c=a:c<b&&(c=b),a=(a-c)/(a-b)*100,this._btnScroll.setY(c),this.jumpToPercentVertical(a))},handleObjectTouchEndAt:function(a,b,c){this._scrollButtonTouchStarted&&(this._scrollButtonTouchStarted=!1)}});var RSGLProgram=RSClass.extend({init:function(a,b,c,d,e){this._shader=null;this._loadedShaderUpdates={};this._textureCount=1;cc._renderType==cc.game.RENDER_TYPE_WEBGL?(this._shader=new cc.GLProgram,this._shader.initWithVertexShaderFilename(b,c),this._shader.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION),this._shader.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR),this._shader.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS),this._shader.link(), this._shader.updateUniforms(),b=a._frameName,c=cc.spriteFrameCache.getSpriteFrame(b)._texture._contentSize,this.setUniformLocationWith2f("u_textureSize",c.width,c.height),c=cc.spriteFrameCache.getSpriteFrame(b)._rect,this.setUniformLocationWith2f("u_spriteOffset",c.x,c.y),this.setUniformLocationWith2f("u_spriteSize",c.width,c.height),b=cc.spriteFrameCache.getSpriteFrame(b)._rotated,this.setUniformLocationWith1i("u_spriteRotated",b),d&&(d=cc.spriteFrameCache.getSpriteFrame(d)._rect,this.setUniformLocationWith2f("u_bumpSpriteOffset", d.x,d.y),this.setUniformLocationWith2f("u_bumpSpriteSize",d.width,d.height)),e&&(this._shader._usesTime=!0),a.getDisplayObject().setShaderProgram(this._shader),RSEngine.isMobile&&this._shader.retain()):RSErrorTracker.getInstance().trackErrorMessage("RENDER_TYPE","WebGL not supported","glinda.lopez@rubyseven.net")},addAdditionalTexture:function(a,b){if(this._shader){this._shader.use();var c=cc.textureCache.getTextureForKey(a),d=this._shader._glContext,e=this._shader.getUniformLocationForName(b);d.activeTexture(d.TEXTURE0+ this._textureCount);d.bindTexture(d.TEXTURE_2D,c._webTextureObj);d.uniform1i(e,this._textureCount);this._textureCount++}},getDisplayObject:function(){return this._shader},setUniformLocationWith1f:function(a,b){this._shader&&(this._shader.use(),this._shader.setUniformLocationWith1f(this._shader.getUniformLocationForName(a),b))},setUniformLocationWith1i:function(a,b){this._shader&&(this._shader.use(),this._shader.setUniformLocationWith1i(this._shader.getUniformLocationForName(a),b))},setUniformLocationWith2f:function(a, b,c){this._shader&&(this._shader.use(),this._shader.setUniformLocationWith2f(this._shader.getUniformLocationForName(a),b,c))},setUniformLocationWith2i:function(a,b,c){this._shader&&(this._shader.use(),this._shader.setUniformLocationWith2i(this._shader.getUniformLocationForName(a),b,c))},setUniformLocationWith3f:function(a,b,c,d){this._shader&&(this._shader.use(),this._shader.setUniformLocationWith3f(this._shader.getUniformLocationForName(a),b,c,d))},setUniformLocationWith3i:function(a,b,c,d){this._shader&& (this._shader.use(),this._shader.setUniformLocationWith3i(this._shader.getUniformLocationForName(a),b,c,d))},setUniformLocationWith4f:function(a,b,c,d,e){this._shader&&(this._shader.use(),this._shader.setUniformLocationWith4f(this._shader.getUniformLocationForName(a),b,c,d,e))},setUniformLocationWith4i:function(a,b,c,d,e){this._shader&&(this._shader.use(),this._shader.setUniformLocationWith4i(this._shader.getUniformLocationForName(a),b,c,d,e))},updateUniformLocationWith1f:function(a,b,c,d,e,f){if(null== this._loadedShaderUpdates[b]){var g=this;a.updateTweenAction=function(a,b){g.actionOnUpdate(b,a)};this.implements(IActionListener);c=new cc.ActionTween(c,b,d,e);e=cc.callFunc(this.actionOnComplete.bind(this,b,e,a,f),this,this);a=a.runAction(cc.sequence(c,e));this._loadedShaderUpdates[b]=a}},stopUpdatingUniformLocationWith1f:function(a,b){var c=this._loadedShaderUpdates[b];null!=c&&(a.stopAction(c),this._loadedShaderUpdates[b]=null)},use:function(){this._shader.use()},actionOnUpdate:function(a,b){this.setUniformLocationWith1f(a, b)},actionOnComplete:function(a,b,c,d){this.setUniformLocationWith1f(a,b);this.stopUpdatingUniformLocationWith1f(c,a);d&&d(a,b)},unload:function(){this._loadedShaderUpdates={};this._shader&&(this._shader.destroyProgram(),RSEngine.isMobile&&this._shader.release(),this._shader=null)}});RSGLProgram.isSupported=function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL};var SDK_ATTRIBUTE_TYPE={coins:"coins",xp:"xp",level:"level",energy:"energy",isMonetizingUser:"isMonetizingUser",isWhaleUser:"isWhaleUser",vipTier:"vipTier",isPushPermissionRequested:"isPushPermissionRequested",isLowOnCoins:"isLowOnCoins",spend:"spend",firstName:"firstname",Name:"Name",facebookId:"facebookId",email:"email",Email:"Email",joiningDate:"joiningDate",lastLogin:"lastLogin",lastPurchaseAmount:"lastPurchaseAmount",isNPSBought:"isNPSBought",isNPSActive:"isNPSActive",lastPlayedGame:"lastPlayedGame", hourlyBonusReady:"hourlyBonusReady",lastSlotUnlocked:"lastSlotUnlocked",nextSlotToBeUnlocked:"nextSlotToBeUnlocked",mostPlayedGame:"mostPlayedGame",gameWithLastBigWin:"gameWithLastBigWin",lastCancelledInAppPack:"lastCancelledInAppPack",lastCancelledDollarAmount:"lastCancelledDollarAmount",leaderboardRank:"leaderboardRank",userIdGroup:"userIdGroup",powerUp:"powerUp",DQRewardPending:"DQRewardPending",DQRewardPoints:"DQRewardPoints",isPlayerConnect:"isPlayerConnect",playsTournament:"playsTournament", pokerChallengeLevel:"pokerChallengeLevel"},SDK_EVENT_TYPE={dailyBonusCollect:"daily_bonus_collect",bihourlyBonusCollect:"bihourly_bonus_collect",returnToLobby:"return_to_",purchaseCartOpen:"purchase_cart_open",purchaseCartClose:"purchase_cart_close",gameInstall:"game_install",loadingComplete:"loading_complete",loadingCompleteIdle:"loading_complete_idle",spinwheelBonusCollect:"spinwheel_bonus_collect",purchaseInitiated:"purchase_initiated",scratcherBonusCollect:"scratcher_bonus_fs_",jackpotLoungeEngaged:"jackpot_lounge_engaged", sweepstakesEnrolled:"sweepstakes_enrolled",tournamaniaEngaged:"tournamania_engaged",dailyQuestEngaged:"daily_quest_engaged",bingoPlayed:"bingo_played",kenoPlayed:"keno_played",roulettePlayed:"roulette_played",pokerPlayed:"poker_played",blackjackPlayed:"blackjack_played",slotPlayed:"slots_played",isPlayerConnected:"is_player_connected",isSSOLoggedIn:"is_sso_logged_in",purchaseCancelled:"purchase_cancelled",levelUp:"levelUp",pokerChallengesEngaged:"poker_challenges_engaged",dailyScratchersEngaged:"daily_scratchers_engaged", classicTournamentEngaged:"classic_tournament_engaged"},IAM_EVENT_TYPE={STARTS_APP:"STARTS_APP",RESUME_APP:"RESUME_APP",IS_LOWONCOINS:"IS_LOWONCOINS",IS_MONETIZING_USER:"IS_MONETIZING_USER",IS_WHALE_USER:"IS_WHALE_USER",VIP_TIER_CHANGES:"VIP_TIER_CHANGES",BIHOURLYBONUS_COLLECT:"BIHOURLYBONUS_COLLECT",LOADING_COMPLETE_IDLE:"LOADING_COMPLETE_IDLE",PURCHASE_CANCELLED:"PURCHASE_CANCELLED",RETURN_TO_LOBBY:"RETURN_TO_LOBBY"},SDK_NAME={LEANPLUM:"leanplum",APPBOY:"appboy",CLEVERTAP:"clevertap"},RSPlatformSDKManager= function(){var a,b=RSClass.extend({_sdkObject:null,_externalGameInterface:null,_navigateToLobby:null,_delegate:null,initialize:function(a){a.sdkName==SDK_NAME.LEANPLUM?this._sdkObject=new RSLeanplumManager:a.sdkName==SDK_NAME.CLEVERTAP&&(this._sdkObject=new RSClevertapManager);this._sdkObject.initialize(a)},setDelegate:function(a){this._delegate=a},setAttribute:function(a,b){this._sdkObject.setAttribute(a,b)},trackEvent:function(a,b,e){this._sdkObject.trackEvent(a,b,e)},updateOnSessionLoad:function(){this._sdkObject.updateOnSessionLoad()}, showNewsFeed:function(){this._sdkObject.showNewsFeed()},registerWebPush:function(){this._sdkObject&&this._sdkObject.registerWebPush()},showInAppMessage:function(a){this._sdkObject&&this._sdkObject.showInAppMessage(a)},updateLOC:function(a){this._sdkObject.updateLOC(a)},updateCoinXpLevel:function(a,b,e){this._sdkObject.updateCoinXpLevel(a,b,e)},logPurchase:function(a,b,e){this._sdkObject.logPurchase(a,b,e)},updateVipTierUp:function(a){this._sdkObject.updateVipTierUp(a)},updateTopHUDWithMessageCount:function(a){this._delegate&& this._delegate.updateTopHUDWithMessageCount(a)},externalCallback:function(a,b){if(this._delegate)this._delegate.onPlatformSDKManagerCallback(a,b)},setUserAttributeNPSBought:function(a){this._sdkObject.setUserAttributeNPSBought(a)},setUserAttributeNPSActive:function(a){this._sdkObject.setUserAttributeNPSActive(a)},setUserAttributeLastGamePlayed:function(a){this._sdkObject.setUserAttributeLastGamePlayed(a)},setUserAttributeHourlyBonusReady:function(a){this._sdkObject.setUserAttributeHourlyBonusReady(a)}, setUserAttributeLastSlotUnlocked:function(a){this._sdkObject.setUserAttributeLastSlotUnlocked(a)},setUserAttributeNextSlotToBeUnlocked:function(a){this._sdkObject.setUserAttributeNextSlotToBeUnlocked(a)},setUserAttributeMostPlayedGame:function(a){this._sdkObject.setUserAttributeMostPlayedGame(a)},setUserAttributeGameWithLastBigWin:function(a){this._sdkObject.setUserAttributeGameWithLastBigWin(a)},setUserAttributeLastCancelledInAppPack:function(a){this._sdkObject.setUserAttributeLastCancelledInAppPack(a)}, setUserAttributeLastCancelledDollarAmount:function(a){this._sdkObject.setUserAttributeLastCancelledDollarAmount(a)},setUserAttributeLeaderboardRank:function(a){this._sdkObject.setUserAttributeLeaderboardRank(a)},setUserAttributeJoiningDate:function(a){this._sdkObject.setUserAttributeJoiningDate(a)},setUserAttributeUserIdGroup:function(a){this._sdkObject.setUserAttributeUserIdGroup(a)},setUserAttributeLastLogin:function(a){this._sdkObject.setUserAttributeLastLogin(a)},setUserAttributeLastPurchaseAmount:function(a){this._sdkObject.setUserAttributeLastPurchaseAmount(a)}, setUserAttributePowerUp:function(a){this._sdkObject.setUserAttributePowerUp(a)},setUserAttributeName:function(a){this._sdkObject.setUserAttributeName(a)},setUserAttributeDQRewardPending:function(a){this._sdkObject.setUserAttributeDQRewardPending(a)},setUserAttributeDailyQuestPoints:function(a){this._sdkObject.setUserAttributeDailyQuestPoints(a)},setUserAttributePlayerConnect:function(a){this._sdkObject.setUserAttributePlayerConnect(a)},setUserAttributePlaysTournament:function(a){this._sdkObject.setUserAttributePlaysTournament(a)}}); return{getInstance:function(){a||(a=new b);return a}}}();var RSMarketingManager=RSClass.extend({initialize:function(a){},setAttribute:function(a,b){},trackEvent:function(a,b,c){},updateOnSessionLoad:function(){},updateVipTierUp:function(a){},updateLOC:function(a){},updateCoinXpLevel:function(a,b,c){},logPurchase:function(a,b,c){},showNewsFeed:function(){},updateTopHUDWithMessageCount:function(a){},setUserAttributeNPSBought:function(a){},setUserAttributeNPSActive:function(a){},setUserAttributeLastGamePlayed:function(a){},setUserAttributeHourlyBonusReady:function(a){}, setUserAttributeLastSlotUnlocked:function(a){},setUserAttributeNextSlotToBeUnlocked:function(a){},setUserAttributeMostPlayedGame:function(a){},setUserAttributeGameWithLastBigWin:function(a){},setUserAttributeLastCancelledInAppPack:function(a){},setUserAttributeLastCancelledDollarAmount:function(a){},setUserAttributeLeaderboardRank:function(a){},setUserAttributeJoiningDate:function(a){},setUserAttributeUserIdGroup:function(a){},setUserAttributeLastLogin:function(a){},setUserAttributeLastPurchaseAmount:function(a){}, setUserAttributePowerUp:function(a){},setUserAttributeName:function(a){},setUserAttributeDQRewardPending:function(a){},setUserAttributeDailyQuestPoints:function(a){},setUserAttributePlayerConnect:function(a){},setUserAttributePlaysTournament:function(a){},registerWebPush:function(){}});var RSClevertapManager=RSMarketingManager.extend({_machineParams:null,_token:"",_externalGameInterface:null,_whaleMonetizationFactor:500,_userId:null,_facebookId:null,_isFreshUser:null,_coins:null,_xp:null,_level:null,_vipTier:null,_monetizationFactor:null,_email:null,_firstName:null,_isGuestLogin:!1,_isLOC:!1,_isFacebookPlayer:!1,initialize:function(a){this._isGuestLogin=a.isGuestLogin;this._isGuestLogin||(this._userId=a.userId,this._facebookId=a.facebookId,this._isFreshUser=a.isFreshUser,this._coins= a.coins,this._xp=a.xp,this._level=a.level,this._vipTier=a.vipTier,this._monetizationFactor=a.monetizationFactor,this._email=a.email,this._firstName=a.firstName,this._isFacebookPlayer=a.isFacebookPlayer,RSEngine.loginMode==LOGIN_MODE.FACEBOOK?postMessage({type:"userLogin",data:{userId:this._userId,version:GameConfig.VERSION}},"*"):parent.postMessage({type:"userLogin",data:{userId:this._userId,version:GameConfig.VERSION}},"*"))},getName:function(){return"RSClevertapManager"},setAttribute:function(a, b){if(!this._isGuestLogin){var c={};c[a]=b;RSEngine.loginMode==LOGIN_MODE.FACEBOOK?postMessage({type:"setAttribute",data:{Site:c}},"*"):parent.postMessage({type:"setAttribute",data:{Site:c}},"*")}},trackEvent:function(a,b,c){this._isGuestLogin||(c&&"object"!=typeof c&&(a+=c,c=""),c||(c={}),c["App Version"]=GameConfig.VERSION,RSEngine.loginMode==LOGIN_MODE.FACEBOOK?postMessage({type:"trackEvent",data:{eventName:a,extraParam:c}},"*"):parent.postMessage({type:"trackEvent",data:{eventName:a,extraParam:c}}, "*"))},updateOnSessionLoad:function(){if(!this._isGuestLogin){var a=!1,b=!1;0<this._monetizationFactor&&(a=!0);5*this._monetizationFactor>this._whaleMonetizationFactor&&(b=!0);this._currentMonetizationUserStatus=a;this._currentWhaleUserStatus=b;var c={};c[SDK_ATTRIBUTE_TYPE.coins]=this._coins;c[SDK_ATTRIBUTE_TYPE.xp]=this._xp;c[SDK_ATTRIBUTE_TYPE.level]=this._level;c[SDK_ATTRIBUTE_TYPE.isMonetizingUser]=a;c[SDK_ATTRIBUTE_TYPE.isWhaleUser]=b;c[SDK_ATTRIBUTE_TYPE.leaderboardRank]=parseInt(RSLeaderboard.getUserRank()); c[SDK_ATTRIBUTE_TYPE.firstName]=this._firstName;c[SDK_ATTRIBUTE_TYPE.Name]=this._firstName;c[SDK_ATTRIBUTE_TYPE.lastLogin]=new Date;URLConfig.CLEVERTAP_ENABLED&&this._facebookId&&(c[SDK_ATTRIBUTE_TYPE.facebookId]=this._facebookId);this._isFreshUser&&GameConfig.SSO_ENABLED&&1!=RSSSOManager.getFoxwoodsPlayerStatus()?(c[SDK_ATTRIBUTE_TYPE.vipTier]=0,this.trackEvent(SDK_EVENT_TYPE.gameInstall)):c[SDK_ATTRIBUTE_TYPE.vipTier]=this._vipTier;this._isFreshUser&&GameConfig.SSO_ENABLED&&1==RSSSOManager.getFoxwoodsPlayerStatus()&& (c[SDK_ATTRIBUTE_TYPE.spend]=Number(5*this._monetizationFactor).toFixed(2));RSSaleManager.getInstance().getNSPActivedState()&&(c[SDK_ATTRIBUTE_TYPE.isNPSBought]=!1);RSEngine.loginMode==LOGIN_MODE.FACEBOOK?postMessage({type:"setAttribute",data:{Site:c}},"*"):parent.postMessage({type:"setAttribute",data:{Site:c}},"*");this.trackEvent(SDK_EVENT_TYPE.loadingComplete)}},updateVipTierUp:function(a){this._isGuestLogin||this._vipTier==a||(this._vipTier=a,this.setAttribute(SDK_ATTRIBUTE_TYPE.vipTier,this._vipTier))}, updateLOC:function(a){this._isGuestLogin||a==this._isLOC||(this._isLOC=a,this.setAttribute(SDK_ATTRIBUTE_TYPE.isLowOnCoins,a))},updateCoinXpLevel:function(a,b,c){if(!this._isGuestLogin){var d={};d[SDK_ATTRIBUTE_TYPE.coins]=a;d[SDK_ATTRIBUTE_TYPE.xp]=b;d[SDK_ATTRIBUTE_TYPE.level]=c;RSEngine.loginMode==LOGIN_MODE.FACEBOOK?postMessage({type:"setAttribute",data:{Site:d}},"*"):parent.postMessage({type:"setAttribute",data:{Site:d}},"*")}},logPurchase:function(a,b,c){if(!this._isGuestLogin){b=a=!1;0<c&& (a=!0);5*c>this._whaleMonetizationFactor&&(b=!0);var d={};d[SDK_ATTRIBUTE_TYPE.isWhaleUser]=b;d[SDK_ATTRIBUTE_TYPE.isMonetizingUser]=a;d[SDK_ATTRIBUTE_TYPE.spend]=Number(5*c).toFixed(2);a&&(d[SDK_ATTRIBUTE_TYPE.isNPSActive]=!1);RSEngine.loginMode==LOGIN_MODE.FACEBOOK?postMessage({type:"setAttribute",data:{Site:d}},"*"):parent.postMessage({type:"setAttribute",data:{Site:d}},"*")}},showNewsFeed:function(){},showInAppMessage:function(a){},updateTopHUDWithMessageCount:function(a){RSPlatformSDKManager.getInstance().updateTopHUDWithMessageCount(a)}, setUserAttributeNPSBought:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.isNPSBought,a)},setUserAttributeNPSActive:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.isNPSActive,a)},setUserAttributeLastGamePlayed:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.lastPlayedGame,a)},setUserAttributeHourlyBonusReady:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.hourlyBonusReady,a)},setUserAttributeLastSlotUnlocked:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.lastSlotUnlocked,a)},setUserAttributeNextSlotToBeUnlocked:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.nextSlotToBeUnlocked, a)},setUserAttributeMostPlayedGame:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.mostPlayedGame,a)},setUserAttributeGameWithLastBigWin:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.gameWithLastBigWin,a)},setUserAttributeLastCancelledInAppPack:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.lastCancelledInAppPack,a)},setUserAttributeLastCancelledDollarAmount:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.lastCancelledDollarAmount,a)},setUserAttributeLeaderboardRank:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.leaderboardRank, a)},setUserAttributeJoiningDate:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.joiningDate,new Date(1E3*a))},setUserAttributeUserIdGroup:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.userIdGroup,a)},setUserAttributeLastLogin:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.lastLogin,new Date(1E3*a))},setUserAttributeLastPurchaseAmount:function(a){a=parseFloat(a);this.setAttribute(SDK_ATTRIBUTE_TYPE.lastPurchaseAmount,a)},setUserAttributePowerUp:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.powerUp, a)},setUserAttributeName:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.firstName,a);this.setAttribute(SDK_ATTRIBUTE_TYPE.Name,a)},setUserAttributeDQRewardPending:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.DQRewardPending,a)},setUserAttributeDailyQuestPoints:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.DQRewardPoints,a)},setUserAttributePlayerConnect:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.isPlayerConnect,a)},setUserAttributePlaysTournament:function(a){this.setAttribute(SDK_ATTRIBUTE_TYPE.playsTournament, a)}});function externalLeanplumCallback(a,b){cc.log("externalSDKCallback called");RSLeanPlum.closeNewsFeed();RSPlatformSDKManager.getInstance().externalCallback(a,b);GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_CLOSE,RSPlatformPopupNameKeys.APP_INBOX)};var RSPlatformSDKVO=RSVO.extend({sdkName:null,userId:null,facebookId:null,lastLoginDate:null,isFreshUser:null,coins:null,xp:null,level:null,vipTier:null,monetizationFactor:null,email:null,joinDate:null,firstName:null,leanplumAppId:null,leanplumDevKey:null,leanplumLiveKey:null,isLeanplumLive:null,isGuestLogin:null,isFacebookPlayer:null,appId:null,gameId:null,platform:null,init:function(a){this._super.init.call(this,a)}});var RSLoaderLayer=RSPanel.extend({init:function(a,b){a||(a=!1);b||(b=!1);this._super.init.call(this,RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this._image=null;this.addTouchListener();this.setSwallowTouches(!0);a?this.setBackgroundColor(0,0,0,0):this.setBackgroundColor(0,0,0,180);a||b||this.addLoadingImage()},addLoadingImage:function(){var a=RSEngine.getLoadingAnimation();a&&(this._image=new RSImageObject,this._image.setImageFromUrl(a,0,0,75,75),this._image.setAnchorPoint(0.5, 0.5),this._image.setPosition(RSEngine.screenWidth/2,RSEngine.screenHeight/2),this._image.setZOrder(1),this._image.actionRotateBy(4,360,-1),this.addChild(this._image))}});var RSLayerGradient=RSClass.extend({init:function(a){this._ccObject=null;this._super.init.call(this);this._ccObject=new cc.LayerGradient;this.setSize(a.getWidth(),a.getHeight());this.setPosition(a.getX(),a.getY());RSEngine.isMobile&&this._ccObject.retain()},setStartColor:function(a){this.getDisplayObject().setStartColor(new cc.Color(a.getR(),a.getG(),a.getB()))},setEndColor:function(a){this.getDisplayObject().setEndColor(new cc.Color(a.getR(),a.getG(),a.getB()))},setStartOpacity:function(a){this.getDisplayObject().setStartOpacity(a)}, setEndOpacity:function(a){this.getDisplayObject().setEndOpacity(a)},setVector:function(a){this.getDisplayObject().setVector(new cc.Point(a.getX(),a.getY()))},setSize:function(a,b){this._ccObject.setContentSize(a,b)},setOpacity:function(a){this._ccObject.setOpacity(a)},setAnchorPoint:function(a,b){this._ccObject.setAnchorPoint(a,b)},stopAllActions:function(){},setPosition:function(a,b){this._ccObject.setPosition(a,b)},setColor:function(a){this._ccObject.setColor(cc.color(a.getR(),a.getG(),a.getB(), a.getA()))},getDisplayObject:function(){if(null==this._ccObject)cc.log("Object is NULL!");else return this._ccObject},actionMoveBy:function(a,b,c,d){var e=this;a=cc.moveBy(a,b,c);b=cc.callFunc(function(){null!=d&&d(e)},this,this);return this.runAction(cc.sequence(a,b))},runAction:function(a){return this._ccObject.runAction(a)},setZOrder:function(a){this._ccObject.setLocalZOrder(a)},unload:function(){this._super.unload.call(this);this._ccObject&&this._ccObject.cleanup();RSEngine.isMobile&&this._ccObject.release(); delete this._ccObject;this._ccObject=null;for(var a in this)this[a]=null}});var CarouselWidgetType={EMAIL_CONNECT:"EmailConnect",PLAYER_CONNECT:"PlayerConnect",HOUSE_ADS:"HouseAds"},RSSalePopupGlobal,RSSalePopup=RSPopup.extend({_callBack:null,_assetList:null,_saleDetails:null,_currentPowerPackData:null,_layoutLoadedCount:null,_selectedType:null,_currentPackData:null,_bannerBar:null,_usBannerBar:null,_purchasedTag:[],_purchaseReward:[],_purchasePrice:[],_purchaseRewardData:[],_purchasePriceData:[],_packSelected:0,_popupTimerObject:null,_popupTimerText:null,_timeRemaining:0, _onSaleTriggered:!1,_buttonList:[],_pricePosition:{},_amountTxts:[],_amountTxt:null,_termsUrl:null,_openFrom:null,init:function(a,b,c,d){this._subscriptionSource=d;this._layoutLoadedCount=0;this._openFrom=b;this._assetList=[{name:RSSaleManager.getInstance().getSaleResourcesName(),count:1}];this._super.init.call(this);this._purchasedTag=[];this._buttonList=[];this._purchaseReward=[];this._purchasePrice=[];this._purchaseRewardData=[];this._purchasePriceData=[];this._callBack=a;this._amountTxts=[];this._selectedType= this._amountTxt="";this._isCloseButtonClicked=this._onSaleTriggered=!1;this._termsUrl=GameConfig.TERMS_OF_SERVICE_URL+"#subscription";this._tag=c;RSSalePopupGlobal=this;RSEventManager.getInstance().addEventListener("onTimerTick",this,this._setTimerValues.bind(this));RSEventManager.getInstance().addEventListener("onPurchaseSuccessClosed",this,this.closePopup.bind(this))},getName:function(){return"RSSalePopup"},_setTimerValues:function(a){this._timeRemaining=a._userData.timeRemaining;0<this._timeRemaining? (a=RSUtils.formattedTime(this._timeRemaining),null!=this._popupTimerText&&"true"==this._saleDetails.timer&&this._popupTimerText.setString(a)):(RSInAppPurchaseManager.getInstance().trackGUIEventForPurchaseCartClose(RSSaleManager.getInstance().getSaleTagForTrackingEvents(this._saleDetails.tag),"close","open_from_"+this.getCurrentMachineName(),"",this._saleDetails.eventId),this.closePopup())},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this);RSEventManager.getInstance().addEventListener("onTimerTick", this,this._setTimerValues.bind(this))},onLayoutCompleted:function(){this._saleDetails=RSSaleManager.getInstance().getSaleVO();this._super.onLayoutCompleted.call(this);this.setOtherValueofAnalytics("open_from_"+this._openFrom);this.initializeSale();RSSaleManager.getInstance().trackImpression(this._saleDetails.analyticsName,this._saleDetails.monetizationCategory,this._saleDetails.saleId,this._saleDetails.eventId);GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&("loc"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_OPEN, RSPlatformPopupNameKeys.LOC):"ooe"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_OPEN,RSPlatformPopupNameKeys.OOE):"ooc"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_OPEN,RSPlatformPopupNameKeys.OOC):"nps"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_OPEN,RSPlatformPopupNameKeys.NPS):RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_OPEN, RSPlatformPopupNameKeys.SALES));this._carousalHolder1&&this._carousalHolder2&&this.setCarousalWidgets()},setOtherValueofAnalytics:function(a){this._openFrom&&RSAnalyticsManager.getInstance().setOtherValueInAnalytics("purchase_sale","success",a)},setCarousalWidgets:function(){var a="",b="",b=!0,c=RSEngine.loginMode==LOGIN_MODE.FACEBOOK||RSGame.getInstance().getUserDataManager().getMe().getLoginRewardStatus();GameConfig.IS_PLAYER_CONNECT_AVAILABLE&&(b=RSGame.getInstance().getUserDataManager().getMe().getPlayerConnectUpdateStatus()); if(GameConfig.HOUSE_ADS_ENABLED&&GameConfig.IS_PLAYER_CONNECT_AVAILABLE){!c||b?a=CarouselWidgetType.EMAIL_CONNECT:c&&!b&&(a=CarouselWidgetType.PLAYER_CONNECT);b=b?CarouselWidgetType.HOUSE_ADS:CarouselWidgetType.PLAYER_CONNECT;switch(a){case CarouselWidgetType.EMAIL_CONNECT:this._carousalWidget1=new RSCarousalEmailConnectWidget(this._carousalHolder1);break;case CarouselWidgetType.PLAYER_CONNECT:this._carousalWidget1=new RSCarousalPlayerConnectWidget(this._carousalHolder1)}switch(b){case CarouselWidgetType.PLAYER_CONNECT:this._carousalWidget2= new RSCarousalPlayerConnectWidget(this._carousalHolder2);break;case CarouselWidgetType.HOUSE_ADS:this._carousalWidget2=new RSCarousalWatchAdsWidget(this._carousalHolder2)}this._carousalWidget1.setCenter(this._carousalHolder1.x,this._carousalHolder1.y);this.addChild(this._carousalWidget1)}else this._carousalWidget1=new RSCarousalEmailConnectWidget(this._carousalHolder1),this._carousalWidget1.setCenter(this._carousalHolder1.x,this._carousalHolder1.y),this.addChild(this._carousalWidget1),this._carousalWidget2= GameConfig.HOUSE_ADS_ENABLED?new RSCarousalWatchAdsWidget(this._carousalHolder2):GameConfig.IS_PLAYER_CONNECT_AVAILABLE?new RSCarousalPlayerConnectWidget(this._carousalHolder2):new RSCarousalFBConnectWidget(this._carousalHolder2,this.closePopup.bind(this));this._carousalWidget2.setCenter(this._carousalHolder2.x,this._carousalHolder2.y);this.addChild(this._carousalWidget2)},initializeSale:function(a){this._onSaleTriggered=!1;if(a)RSSaleManager.getInstance().onPurchaseSuccessNotifyResponseToCasino(); if("subscription"==this._saleDetails.tag){RSSaleManager.getInstance().initializeSaleDataWithTag("subscription");var b=RSSaleManager.getInstance().getSaleVO();a&&"subscription"==this._saleDetails.tag?(RSSaleManager.getInstance().setSubscriptionPurchasedStatus(!0),this.closePopup()):(this._saleDetails=RSSaleManager.getInstance().getSaleVO(),RSSaleManager.getInstance().startSaleTimer(),this.handlePurchasedTagVisibility(),this.handlePurchaseInfoPriceVisibility())}else RSSaleManager.getInstance().getSaleActiveStatus()|| RSSaleManager.getInstance().getLocOocStatus()?(b=RSSaleManager.getInstance().getSaleVO(),RSSaleManager.getInstance().getLocOocStatus()&&!RSSaleManager.getInstance().getSaleActiveStatus()&&RSSaleManager.getInstance().getLocOocSaleData(this._saleDetails.tag)&&(b=RSSaleManager.getInstance().getLocOocSaleData(this._saleDetails.tag)),this._saleDetails.eventId==b.eventId?!a||"loc"!=this._saleDetails.tag&&"ooc"!=this._saleDetails.tag&&"ooe"!=this._saleDetails.tag&&"daubalert"!=this._saleDetails.tag?(this._saleDetails= RSSaleManager.getInstance().getSaleVO(),RSSaleManager.getInstance().startSaleTimer(),this.handlePurchasedTagVisibility(),this.handlePurchaseInfoPriceVisibility()):(RSEventManager.getInstance().dispatchEvent("onSaleClosed",{}),this.closePopup()):(RSEventManager.getInstance().dispatchEvent("onSaleClosed",{}),this.closePopup())):(RSEventManager.getInstance().dispatchEvent("onSaleClosed",{}),this.closePopup())},createCustomObject:function(a,b){switch(b.type){case "RSLabel":var c=RSSaleManager.getInstance().getSaleFont(SaleFontType.TIMER); this._popupTimerText=new RSLabelBMFont("",c,-1,kTEXT_ALIGNMENT_CENTER);this._popupTimerText.setScale(0.5);this._popupTimerText.setCenter(b.x,b.y);this.addChild(this._popupTimerText);break;case "Holder":"VIPStatusTier"==b.name?(c=new RSRect(b.x,b.y,b.w,b.h),c=new VIPTierWidget(c),c.setAnchorPoint(0.5,0.5),this.addChild(c)):"VIPStatusTierWidget"==b.name?(c=new RSRect(b.x,b.y,b.w,b.h),c=new VIPTierWidget(c,RSGame.getInstance().getGameManager().getVipTierWidgetAssetPath()),c.setAnchorPoint(0.5,0.5),this.addChild(c)): "CarousalHolder1"==b.name?this._carousalHolder1=b:"CarousalHolder2"==b.name&&(this._carousalHolder2=b);break;case "Label":"DaubAlertText"==b.name&&(this._daubText=new RSScaledLabel("You Missed "+RSGame.getInstance().getGameManager().getmissedDaubCount()+" Daubs Last Round",RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),b,kTEXT_ALIGNMENT_CENTER),this._daubText.setCenter(b.x,b.y),this.addChild(this._daubText))}this._super.createCustomObject.call(this,a,b)},setTouchEnabled:function(a){a? this.handlePurchasedTagVisibility():this._super.setTouchEnabled(!1)},onButtonClicked:function(a){if(0<=a.indexOf("buy_packIndex")){if(!1==this._onSaleTriggered){var b=a.match(/\d+/)[0];this._onSaleTriggered=!0;this._packSelected=a.match(/\d+/)[0];var c={analyticsName:this._saleDetails.analyticsName,monetizationCategory:this._saleDetails.monetizationCategory,saleId:this._saleDetails.saleId,eventId:this._saleDetails.eventId,saleType:this._saleDetails.tag};RSSaleManager.getInstance().showFBPurchaseUI(this._saleDetails.packs[b][this._saleDetails.monetizationCategory], c,this.onPurchaseSuccess.bind(this),this.onPurchaseFail.bind(this))}}else if(0<=a.indexOf("CloseBtn")){this.setOtherValueofAnalytics(null);if(!0==this._isCloseButtonClicked)return;this._isCloseButtonClicked=!0;RSInAppPurchaseManager.getInstance().trackGUIEventForPurchaseCartClose(RSSaleManager.getInstance().getSaleTagForTrackingEvents(this._saleDetails.tag),"close","open_from_"+this.getCurrentMachineName(),"",this._saleDetails.eventId);"subscription"!=this._saleDetails.tag&&RSEventManager.getInstance().dispatchEvent("onSaleClosed", {});this._onSaleTriggered=!1;this.closePopup()}else if(0<=a.indexOf("TOSButton")||0<=a.indexOf("TOSSubscriptionButton"))RSAnalyticsManager.getInstance().trackPlayerAction("terms_of_service","click","open_from_subscription","",""),window.open(this._termsUrl,"_blank");switch(a){case "InfoButton":RSEngine.popupManager.addPopup(new RSSubscriptionSaleInfoPopup(this._subscriptionSource),!0,!1,!1)}},onPurchaseSuccess:function(a,b){this._onSaleTriggered=!1;RSSaleManager.getInstance().callSaleDetails(this.initializeSale.bind(this, !0),null)},onPurchaseFail:function(){this._onSaleTriggered=!1;this.initializeSale()},handlePurchasedTagVisibility:function(){for(var a=0;a<this._purchasedTag.length;a++)this._purchasedTag[a].setVisible(!1);var a=RSEngine.dataManager.getMe().getSalePurchaseData(),b=this._saleDetails.saleId,c=this._saleDetails.eventId;if("0"==this._saleDetails.userPurchasableType){if(null!=a&&null!=a[b+"_"+c]&&null!=a[b+"_"+c].count&&a[b+"_"+c].count>=this._saleDetails.userPurchasableCount)for(a=0;a<this._purchasedTag.length;a++){this._purchasedTag[a].setVisible(!0); for(var d=0;d<this._buttonList.length;d++){var e="buy_packIndex"+a;0<=this._buttonList[d]._ccObject._name.indexOf(e)&&this._buttonList[d].setTouchEnabled(!1)}}}else if("1"==this._saleDetails.userPurchasableType&&null!=a&&null!=a[b+"_"+c])for(var f in a[b+"_"+c])if("count"!=f&&null!=a[b+"_"+c][f]&&a[b+"_"+c][f]>=this._saleDetails.userPurchasableCount)for(var g=0;g<this._saleDetails.packs.length;g++)if(f==this._saleDetails.packs[g][this._saleDetails.monetizationCategory].offerId)for(this._purchasedTag[g].setVisible(!0), d=0;d<this._buttonList.length;d++)e="buy_packIndex"+g,0<=this._buttonList[d]._ccObject._name.indexOf(e)&&this._buttonList[d].setTouchEnabled(!1)},onObjectCreated:function(a,b,c){switch(c.type){case "Animation":a.stopAnimation(),a.playAnimation(-1,0.5)}0<=c.name.indexOf("buy_packIndex")?(this._buttonList.push(a),a=null,this._saleDetails=RSSaleManager.getInstance().getSaleVO(),a="subscription"==this._saleDetails.tag?RSSaleManager.getInstance().getSaleFont(SaleFontType.SUBSCRIPTION):RSSaleManager.getInstance().getSaleFont(RSSaleManager.getInstance().getSaleTagActiveForPlayer()), this._amountTxt=new RSLabelBMFont("",a,-1,kTEXT_ALIGNMENT_CENTER),this._amountTxt.setScale(0.7),this._amountTxt.setCenter(c.x,c.y),this._amountTxts.push(this._amountTxt),this.addChild(this._amountTxt)):0<=c.name.indexOf("purchasedBo_packIndex")?this._purchasedTag.push(a):0<=c.name.indexOf("_reward_packIndex")?(this._purchaseReward.push(a),this._purchaseRewardData.push(c)):0<=c.name.indexOf("_price_packIndex")?(this._purchasePrice.push(a),this._purchasePriceData.push(c),this._pricePosition[c.name]= [c.x,c.y]):0<=c.name.indexOf("SweepstakeInfo")&&(this._usBannerBar=a,this._usBannerBar.setVisible(!1))},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){},handlePurchaseInfoPriceVisibility:function(){for(var a=0;a<this._purchaseReward.length;a++)this._purchaseReward[a].setVisible(!1);for(a=0;a<this._purchasePrice.length;a++)this._purchasePrice[a].setVisible(!1);for(a=0;a<this._purchaseRewardData.length;a++)0<=this._purchaseRewardData[a].name.indexOf(this._saleDetails.monetizationCategory)&& this._purchaseReward[a].setVisible(!0);if("USD"!=RSSocialManager.getInstance().currency.user_currency)if(RSEngine.loginMode==LOGIN_MODE.FACEBOOK)for(a=0;a<this._saleDetails.packs.length;a++){var b=this._saleDetails.monetizationCategory,c=this._pricePosition[this._saleDetails.monetizationCategory+"_price_packIndex"+a];this._amountTxts[a].setCenter(c[0],c[1]);"subscription"==this._saleDetails.tag?(b=RSInAppPurchaseManager.getInstance().getLocalCurrency(this._saleDetails.packs[a][b].price),(c=RSGame.getInstance().getGameData().getPopupTextWithKey("SUB_POPUP_TEXT"))? (c=c.replace("{price}",b),this._amountTxts[a].setString(c)):this._amountTxts[a].setString(b+" per month")):this._amountTxts[a].setString(RSInAppPurchaseManager.getInstance().getLocalCurrency(this._saleDetails.packs[a][b].price))}else for(a=0;a<this._purchasePriceData.length;a++)0<=this._purchasePriceData[a].name.indexOf(this._saleDetails.monetizationCategory)&&this._purchasePrice[a].setVisible(!0);else for(a=0;a<this._purchasePriceData.length;a++)0<=this._purchasePriceData[a].name.indexOf(this._saleDetails.monetizationCategory)&& this._purchasePrice[a].setVisible(!0)},getCurrentMachineName:function(){var a="";return a=this._openFrom?this._openFrom:"gameplay_screen"==RSAnalyticsManager.getInstance().getCurrentScreen()?RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName():RSAnalyticsManager.getInstance().getCurrentScreen()},closePopup:function(){RSEventManager.getInstance().removeListenersForEvent("onPurchaseSuccessClosed");RSEventManager.getInstance().removeListenersForEvent("onTimerTick");this._callBack&&(this._callBack(), this._callBack=null);GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&this._isCloseButtonClicked&&1==parseInt(RSEngine.gameData.getDefaultValues().isOOCCarousalEnabled)&&"ooc"==this._tag&&(this._tag="",RSSaleManager.getInstance().getOOCAnimStatusForCarousal()?(RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.CAROUSAL,parameter:RSPlatformPopupNameKeys.OOCFirstFlow}),RSSaleManager.getInstance().setOOCAnimStatusForCarousal()):RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent, {event:RSPlatformEventTypeKeys.CAROUSAL,parameter:RSPlatformPopupNameKeys.OOCSaleSubsequentFlow}));this._super.closePopup.call(this)},unload:function(){GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&this._isCloseButtonClicked&&!GlobalVars.isTournamentLoaded&&("loc"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_CLOSE,RSPlatformPopupNameKeys.LOC):"ooe"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_CLOSE, RSPlatformPopupNameKeys.OOE):"ooc"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_CLOSE,RSPlatformPopupNameKeys.OOC):"nps"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_CLOSE,RSPlatformPopupNameKeys.NPS):RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_CLOSE,RSPlatformPopupNameKeys.SALES));RSSaleManager.getInstance().unload();this._purchasedTag=[];this._purchaseReward=[];this._purchasePrice= [];this._purchaseRewardData=[];this._purchasePriceData=[];this._amountTxts=[];this._openFrom=this._popupTimerText=null;this._super.unload.call(this)}});function a0_0x3439(a,b){var c=a0_0x4664();return a0_0x3439=function(a,b){return c[a-261]},a0_0x3439(a,b)}var a0_0x2fa15d=a0_0x3439;(function(a,b){for(var c=a0_0x3439,d=a();;)try{if(parseInt(c(277))/1*(-parseInt(c(496))/2)+-parseInt(c(305))/3+parseInt(c(414))/4*(parseInt(c(488))/5)+parseInt(c(489))/6*(-parseInt(c(353))/7)+-parseInt(c(347))/8+-parseInt(c(410))/9+parseInt(c(324))/10*(parseInt(c(520))/11)===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x4664,567096); var SaleFontType={NPS:a0_0x2fa15d(296),NPS_OT:"nps_ot",SALE:a0_0x2fa15d(443),SUBSCRIPTION:a0_0x2fa15d(363),OOC:"ooc",LOC:a0_0x2fa15d(334),TIMER:a0_0x2fa15d(369)},RSSaleManager=function(){var a=a0_0x2fa15d,b,c=RSClass[a(294)]({init:function(){this[a(455)]=null;this[a(280)]={};this[a(490)]=null;this._purchasePackData=this._daubAlertVO=this._purchaseCartPowerupVO=this[a(491)]=null;this[a(331)]=null;this[a(413)]=null;this[a(360)]=null;this[a(382)]=null;this[a(459)]=0;this[a(302)]=0;this._bonusTimer=null; this[a(453)]=0;this[a(267)]=[];this[a(322)]=[];this[a(303)]=a(341);this[a(501)]=!0;this[a(263)]=null;this[a(307)]=null;this._uniqueSaleRequest=[];this[a(478)]=[];this._sessionID="";this[a(538)]=null;this[a(503)]=!1;this[a(467)]=!1;this[a(283)]={};this[a(332)]=null;this._purchaseCartPowerupResourceName=this[a(533)]=null;this[a(544)]=null;this.NPSOTEndTime=0;this.saleCartIndex=null;this[a(400)]=[];this[a(469)]=[];this[a(468)]={};this[a(358)]={};this._cartsNeeded=[];this[a(409)]={};this[a(471)]=0;this[a(281)]= !0;this[a(512)]={};this[a(350)]=null;this[a(306)]=0;this._isCarouselAnimActive=!1;this[a(298)]=!1;this[a(310)]=!1;this[a(553)]=null;this[a(313)]=0;this[a(418)]=!1;this[a(444)]=!1;this[a(556)]=!1;this[a(261)]=!1;this._super[a(427)][a(534)](this);this[a(477)]=new cc.LayerColor(cc[a(279)](0,0,0,180))},callSaleDetails:function(b,c,f){null!=f&&void 0!=f||(f=!0);!1==f||!1==this._purchaseStatus?(this[a(281)]=!1,null!=b&&b[a(534)]()):(this.initializeAnalytics(),this[a(501)]=!1,this[a(382)]=new RSPreloader, this[a(382)][a(373)](this),this[a(484)]=b,this[a(340)]=c,b=[],b[0]=RSEngine.dataManager[a(352)]()[a(543)](),b[1]=RSEngine[a(308)],b[2]=GameConfig.VERSION,RSEngine[a(440)][a(535)](a(262),b,this[a(338)][a(319)](this),c))},onCallBackForSaleDetails:function(b){this._saleStatus=b[a(390)][a(268)];this[a(542)]=b[a(390)][a(423)];this._alreadyFetchedResources=this[a(267)];this._resourcesToBeFetched=[];var c=[],f=this[a(280)];if(1==this._saleStatus){this._allSalesData={};if(b[a(390)][a(276)]){for(var g=0;g< b[a(390)][a(276)][a(509)];g++)b[a(390)][a(276)][g][a(380)]==a(296)&&(this._NPSSaleActived=!0),this._allSalesData[b[a(390)][a(276)][g][a(380)]]=new RSSaleVO(b.result.sales[g]);for(var h in this[a(280)])for(this[a(386)](this[a(280)][h][a(323)],this[a(280)][h][a(525)],this[a(280)][h][a(399)],this[a(280)][h][a(392)]),g=0;g<this[a(280)][h][a(330)].length;g++)0>this[a(322)].indexOf(this[a(280)][h].assets[g][a(335)])&&this[a(267)][a(286)](this[a(280)][h].assets[g][a(335)]);0==this[a(472)]&&null!=this._allSalesData.nps_ot&& (this[a(472)]=TimeManager[a(437)]()[a(326)]+this[a(280)][a(549)].tagTime);1<RSEngine.dataManager[a(352)]()[a(309)]()&&(this[a(310)]=!1)}if(b[a(390)].purchaseCarts){h=this[a(321)];this[a(490)]=null;this._purchaseCartEnergyVO=this[a(529)]=null;this[a(432)]=null;this._purchaseCartSaleActiveStatus={coin:!1,powerup:!1,energy:!1};for(g=0;g<b[a(390)][a(269)][a(509)];g++)switch(0<=h[a(447)](b.result.purchaseCarts[g][a(495)])&&h[a(451)](h[a(447)](b.result[a(269)][g].type),1),b[a(390)][a(269)][g][a(495)]){case a(506):b[a(390)].purchaseCarts[g].saleType== a(314)&&b[a(390)][a(269)][g].analyticsName[a(483)]("Sale")&&(this[a(409)][a(506)]=!0);this[a(490)]=new RSSaleVO(b[a(390)][a(269)][g]);for(var k=0;k<this[a(490)][a(330)].length;k++){0>this._alreadyFetchedResources[a(447)](this._purchaseCartCoinVO[a(330)][k].assetLink)&&this[a(267)][a(286)](this[a(490)][a(330)][k].assetLink);if(0<=this[a(490)][a(330)][k][a(335)][a(447)]("PurchaseCartPopup")){var m=this[a(490)][a(330)][k][a(335)][a(415)](a(337))[0],m=m[a(415)]("_layout_iPhone5")[0],m=m[a(415)]("_layout_iPhone4")[0], m=m[a(415)](a(514))[0],m=m[a(415)]("/"),m=m[m[a(509)]-1];this.purchaseCartAssetChangeType[a(506)]=m}0<=this[a(490)].assets[k][a(335)][a(447)](a(504))&&0>this[a(490)][a(330)][k][a(335)][a(447)](this[a(490)][a(264)])&&(this._purchaseCartCoinResourceName=this._purchaseCartCoinVO[a(330)][k][a(335)].split(a(513))[0]);0<=this._purchaseCartCoinVO[a(330)][k].assetLink[a(447)](this._purchaseCartCoinVO.saleName)&&c[a(286)](this[a(490)][a(330)][k][a(335)])}break;case a(421):b[a(390)][a(269)][g][a(318)]==a(314)&& (this[a(409)][a(421)]=!0);this[a(491)]=new RSSaleVO(b.result[a(269)][g]);for(k=0;k<this._purchaseCartEnergyVO[a(330)][a(509)];k++)0>this[a(322)].indexOf(this._purchaseCartEnergyVO[a(330)][k].assetLink)&&this[a(267)].push(this._purchaseCartEnergyVO[a(330)][k][a(335)]),0<=this[a(491)].assets[k][a(335)][a(447)](a(282))&&(m=this[a(491)][a(330)][k][a(335)][a(415)](a(337))[0],m=m[a(415)](a(419))[0],m=m[a(415)]("_layout_iPhone4")[0],m=m.split(a(514))[0],m=m.split("/"),m=m[m[a(509)]-1],this.purchaseCartAssetChangeType.energy= m),0<=this[a(491)][a(330)][k].assetLink[a(447)](a(504))&&0>this[a(491)][a(330)][k][a(335)][a(447)](this[a(491)][a(264)])&&(this[a(533)]=this[a(491)][a(330)][k].assetLink[a(415)](a(513))[0]),0<=this[a(491)][a(330)][k].assetLink[a(447)](this[a(491)].saleName)&&c[a(286)](this[a(491)][a(330)][k][a(335)]);break;case a(548):"purchase_cart"==b[a(390)][a(269)][g][a(318)]&&(this[a(409)][a(548)]=!0);this._purchaseCartPowerupVO=new RSSaleVO(b.result[a(269)][g]);for(k=0;k<this[a(529)][a(330)][a(509)];k++)0>this[a(322)].indexOf(this[a(529)][a(330)][k][a(335)])&& this[a(267)][a(286)](this[a(529)][a(330)][k][a(335)]),0<=this._purchaseCartPowerupVO[a(330)][k][a(335)][a(447)](a(282))&&(m=this[a(529)][a(330)][k][a(335)].split(a(337))[0],m=m[a(415)](a(419))[0],m=m.split(a(446))[0],m=m.split(a(514))[0],m=m[a(415)]("/"),m=m[m[a(509)]-1],this[a(468)][a(548)]=m),0<=this[a(529)][a(330)][k].assetLink[a(447)](a(504))&&0>this._purchaseCartPowerupVO[a(330)][k][a(335)].indexOf(this[a(529)][a(264)])&&(this._purchaseCartPowerupResourceName=this[a(529)][a(330)][k][a(335)][a(415)](a(513))[0]), 0<=this[a(529)][a(330)][k].assetLink[a(447)](this[a(529)].saleName)&&c.push(this[a(529)].assets[k][a(335)]);break;case "daubAlert":for(b[a(390)][a(269)][g][a(318)]==a(314)&&(this._purchaseCartSaleActiveStatus[a(383)]=!0),this[a(432)]=new RSSaleVO(b[a(390)].purchaseCarts[g]),k=0;k<this._daubAlertVO[a(330)].length;k++)0>this._alreadyFetchedResources.indexOf(this[a(432)].assets[k][a(335)])&&this[a(267)][a(286)](this[a(432)][a(330)][k][a(335)]),0<=this._daubAlertVO[a(330)][k][a(335)].indexOf(a(557))&& (m=this[a(432)].assets[k][a(335)][a(415)](a(337))[0],m=m.split("_layout_iPhone5")[0],m=m[a(415)](a(446))[0],m=m[a(415)](a(514))[0],m=m[a(415)]("/"),m=m[m.length-1],this[a(358)][a(383)]=m),0<=this._daubAlertVO[a(330)][k][a(335)][a(447)](a(504))&&0>this[a(432)][a(330)][k][a(335)][a(447)](this._daubAlertVO[a(264)])&&(this[a(544)]=this[a(432)][a(330)][k].assetLink[a(415)](a(513))[0]),0<=this[a(432)][a(330)][k][a(335)].indexOf(this[a(432)][a(264)])&&c.push(this[a(432)].assets[k].assetLink)}0<h.length&& cc[a(441)](a(351)+h);this.getSaleTagActiveForPlayer()==a(443)&&this.pushSaleToPurchaseCart(b.result[a(423)])}if(0<this[a(267)][a(509)]){for(g=0;g<this[a(267)][a(509)];g++)0<=this[a(267)][g][a(447)](a(473))&&(this[a(267)][g]=this[a(267)][g].split(a(473))[0]);this[a(517)](c);this[a(382)].startPreload(this[a(267)])}else this[a(501)]=!0,this[a(339)](),null!=this[a(484)]&&this[a(484)][a(534)]();this._isRecheckCall&&this[a(280)][a(443)]&&!this[a(444)]&&(f[a(443)]?f[a(443)][a(323)]!=this[a(280)][a(443)][a(323)]&& (this[a(444)]=!0):this._saleDataUpdated=!0);this[a(556)]=!1}else this[a(556)]=!1,this._assetsLoaded=!0,null!=this.onSaleDetailsFailedCallback&&this[a(340)][a(534)]();this[a(306)]=RSGame[a(437)]().getGameManager()[a(372)]()},getNextSaleTime:function(b,c,f){null!=f&&void 0!=f||(f=!0);!1==f||!1==this._purchaseStatus?(this[a(281)]=!1,null!=b&&b[a(534)]()):(this.onNextSaleTimeSuccessCallback=b,b=[],b[0]=RSEngine[a(416)][a(352)]()[a(543)](),b[1]=RSEngine[a(308)],b[2]=GameConfig[a(458)],RSEngine[a(440)][a(535)]("TimeEventData.getNextSaleTime", b,this.onNextSaleTimeSuccess[a(319)](this),c))},onNextSaleTimeSuccess:function(b){b&&b.result&&0!=b.result[a(510)][a(509)]&&(this._nextSaleTimerData=b[a(390)].data,b=parseInt(this._nextSaleTimerData.remainingTime),this[a(417)]=setInterval(function(){this[a(349)](!0);clearInterval(this[a(417)])}[a(319)](this),1E3*b));this[a(497)]&&this[a(497)]()},getNextSaleTimeData:function(){return this._nextSaleTimerData?this[a(406)][a(389)]:!1},getSaleDataUpdatedStatus:function(){return this[a(444)]},resetSaleDataUpdateStatus:function(){this[a(444)]= !1},checkGCOWEnableForPurchaseCart:function(){for(var b=RSSaleManager.getInstance()[a(355)](a(506)),c=b[a(525)],f=RSEngine[a(376)][a(505)](a(342)),g=[],h=0;h<f.length;h++)g[h]=f[h][a(375)];if(void 0==b[a(395)][h][c]||null==b[a(395)][h][c])return!0;for(h=0;h<b[a(395)][a(509)];h++)if(b.packs[h][a(411)][a(445)]==b[a(395)][h][c].inAppPack||g.includes(b.packs[h][c][a(445)]))return!0;return!1},checkForDuplicates:function(b){for(var c=0;c<b[a(509)];c++){var f=b[c],f=b[c].split("_layout_iPad")[0],f=f[a(415)](a(419))[0], f=f[a(415)](a(446))[0],f=f.split("_00-hd")[0];0>this[a(400)].indexOf(f)&&this.purchaseCartAssets[a(286)](f)}},getNSPActivedState:function(){return this._NPSSaleActived},setCartsNeededForGame:function(b){this[a(321)]=b},getPurchaseCartSaleStatus:function(){for(var b in this[a(409)])if(!0==this[a(409)][b])return!0;return!1},pushSaleToPurchaseCart:function(){if(null!=this._allSalesData[a(443)]&&null!=this[a(542)][this[a(280)][a(443)][a(525)]])for(var b=this._allSalesData[a(443)][a(525)],c=0;c<this[a(280)][a(443)][a(395)][a(509)];c++)null!= this[a(280)][a(443)].packs[c][b]&&(this._allSalesData[a(443)].pushToCart==a(506)&&(this[a(490)][a(395)][this[a(542)][b][c]][b]=this[a(280)].sale[a(395)][c][b],this._purchaseCartCoinVO[a(395)][this[a(542)][b][c]][b].value=this[a(280)].sale[a(395)][c][b].coin,this[a(490)][a(395)][this[a(542)][b][c]][b].salePushed=!0),this[a(280)][a(443)][a(528)]==a(421)&&(this[a(491)][a(395)][this[a(542)][b][c]][b]=this._allSalesData[a(443)].packs[c][b],this[a(491)][a(395)][this.saleCartIndex[b][c]][b][a(290)]=this[a(280)][a(443)][a(395)][c][b].energy, this[a(491)][a(395)][this[a(542)][b][c]][b][a(546)]=!0),this[a(280)][a(443)][a(528)]==a(548)&&(this[a(529)][a(395)][this[a(542)][b][c]][b]=this[a(280)][a(443)][a(395)][c][b],this._purchaseCartPowerupVO[a(395)][this[a(542)][b][c]][b][a(290)]=this[a(280)][a(443)].packs[c][b][a(548)],this[a(529)][a(395)][this.saleCartIndex[b][c]][b][a(546)]=!0))},getPurchaseCartBGSaleName:function(){return this.purchaseCartAssetChangeType},getPurchaseCartAssets:function(){return this[a(400)]},getPurchaseCartVO:function(b){return"coin"== b||b==a(559)?RSUtils[a(424)](this._purchaseCartCoinVO):b==a(548)?RSUtils[a(424)](this[a(529)]):b==a(421)?RSUtils[a(424)](this[a(491)]):"daubAlert"==b?RSUtils[a(424)](this[a(432)]):RSUtils.cloneJSON(this[a(490)])},getPurchaseCartV2VO:function(b){return this[a(455)]=this[a(537)](b),this._saleVO.tag="purchase_cart",this[a(455)]},getSaleResourcesName:function(){return this._saleResourceName},getPurchaseCartCoinResourcesName:function(){return this[a(332)]},getPurchaseCartEnergyResourcesName:function(){return this._purchaseCartEnergyResourceName}, getPurchaseCartPowerupResourcesName:function(){return this[a(457)]},getDaubAlertResourcesName:function(){return this[a(544)]},setSaleStatus:function(){null!=RSCasinoManager[a(449)]()&&RSCasinoManager[a(449)]()[a(275)]();RSEventManager[a(437)]().dispatchEvent("refreshSalePreviewWidget",null)},startSaleTimer:function(){this[a(459)]=this._saleEndTime-TimeManager.getInstance().getCurrentServerTime();null==this._bonusTimer&&(this[a(448)](),this[a(270)]=setInterval(this[a(448)].bind(this),1E3))},onPreloadProgress:function(a, b){},onPreloadComplete:function(b,c,f){this[a(501)]=!0;this[a(556)]=!1;this[a(339)]();null!=this[a(484)]&&this.onSaleDetailsCallback[a(534)]()},getSaleVO:function(){return this[a(455)]},getSaleVOWithTag:function(b){return this[a(455)]},showFBPurchaseUI:function(b,c,f,g){this[a(401)]();this[a(331)]=f;this[a(413)]=g;this[a(329)]=b;this[a(482)](this[a(329)].price,this[a(329)][a(385)],c.analyticsName,c[a(525)],c[a(399)],c.eventId);b=a(443);f=this.setPackValuesForPurchase();c.saleTypePurhchasecart&&(f.type= c[a(364)]);c[a(318)]==a(334)&&(f.type=a(559));g={};g[a(462)]=f;g.itemType=b;g[a(474)]=!1;g.onSuccessCallback=this[a(391)][a(319)](this);g[a(301)]=this[a(507)].bind(this);g.onPurchaseCancel=this[a(300)][a(319)](this);g[a(392)]=this[a(455)][a(392)];g[a(299)]=this._sessionID;g[a(266)]=this[a(455)][a(525)];g[a(396)]=this._sessionCounter;g[a(379)]=GameConfig[a(458)];g[a(502)]=this[a(329)][a(385)];g[a(318)]=c[a(318)];RSInAppPurchaseManager[a(437)]().buySalePack(g)},setPackValuesForPurchase:function(){var b= {type:a(443),id:this[a(329)][a(385)],price:this[a(329)].price,analyticsName:this._saleVO[a(323)]+String(this[a(329)].price)[a(493)](".",""),packAnalyticsName:this[a(455)].analyticsName,packAnalyticsPrice:String(this._purchasePackData[a(311)])[a(493)](".",""),packID:this._purchasePackData[a(345)]},c=0;this[a(329)].coin&&(null!=b[a(315)]&&0!=b.saleRewardTypes[a(509)]?b[a(315)][a(286)](a(506)):(b[a(315)]=[],b[a(315)].push(a(506))),b[a(506)]=this._purchasePackData[a(506)],b[a(290)]=this._purchasePackData[a(506)]); if(this._purchasePackData[a(548)]){null!=b[a(315)]&&0!=b[a(315)][a(509)]?b.saleRewardTypes[a(286)](a(346)):(b[a(315)]=[],b[a(315)][a(286)](a(548)));for(var f in this[a(329)][a(548)])c+=Number(this[a(329)].powerup[f]);null==b[a(290)]&&(b[a(290)]=c);b.powerups=c}return this[a(329)][a(421)]&&(null!=b[a(315)]&&0!=b[a(315)][a(509)]?b[a(315)][a(286)](a(421)):(b[a(315)]=[],b.saleRewardTypes[a(286)]("energy")),null==b[a(290)]&&(b[a(290)]=this[a(329)][a(421)]),b.energy=this[a(329)][a(421)]),this._purchasePackData[a(383)]&& (null!=b[a(315)]&&0!=b[a(315)][a(509)]?b[a(315)][a(286)](a(383)):(b[a(315)]=[],b[a(315)].push(a(383))),null==b[a(290)]&&(b[a(290)]=this[a(329)][a(383)]),b[a(383)]=this[a(329)].daubAlert),b},setSessionID:function(b){this[a(393)]=b},setSessionCounter:function(a){this._sessionCounter=a},getSessionID:function(){return this[a(393)]},getSessionCounter:function(){return this[a(471)]},_onPurchaseSuccess:function(b){if(b&&b[a(362)]&&b[a(540)]&&b[a(555)]&&b[a(268)])RSErrorTracker[a(437)]()[a(526)](a(288),a(371)+ b[a(362)]+a(312)+b[a(540)]+a(348)+b[a(555)]+"Status"+b.status,a(486));else b&&b[a(362)]&&b.status&&b.message&&RSErrorTracker.getInstance()[a(526)](a(552),a(371)+b[a(362)]+a(551)+b[a(428)]+a(304)+b[a(268)],a(486));this[a(538)]=b;this.trackPurchase(this._purchasePackData[a(311)],this[a(329)][a(385)]);this[a(336)]()},_onPurchaseCancel:function(b){this[a(328)]();RSGame[a(437)]()[a(354)]().notifySalePurchaseResponseToCasino(b,null,a(530),this[a(368)].bind(this))},_onPurchaseFailure:function(b){this[a(328)](); b.error_message&&b[a(527)]==a(464)?RSGame[a(437)]()[a(354)]()[a(431)](b,null,a(464),this[a(368)][a(319)](this)):RSGame[a(437)]()[a(354)]().notifySalePurchaseResponseToCasino(b,null,"failed",this[a(368)][a(319)](this))},_showOverlayLayer:function(){RSEngine.screenManager[a(554)]()},_hideOverlayLayer:function(){RSEngine[a(387)].removeOverlay()},getCurrentCoinBalance:function(){var b=this._saleVO[a(323)]+String(this[a(329)][a(311)])[a(493)](".","")||"";if(this[a(284)](this[a(455)][a(380)])!=a(314)){var c= this._openFrom?this[a(317)]:RSAnalyticsManager[a(437)]()[a(498)]();RSAnalyticsManager[a(437)]()[a(384)](this[a(284)](this[a(455)][a(380)]),a(327),a(450)+c,b,this._saleVO[a(392)])}this[a(455)].tag==a(363)?RSEngine.dataManager[a(291)](this[a(357)][a(319)](this),a(363)):GameConfig[a(524)]?RSEngine[a(416)].getCoinBalance(this[a(357)].bind(this),"",!1,this[a(329)].packId):RSEngine.dataManager[a(291)](this.onRetrieveCoinsPurchase[a(319)](this))},onPopupCloseCallBack:function(){null!=this._onPurchaseFailCallBack&& this[a(413)]()},onPurchaseSuccessCallBack:function(b){if(null!=this[a(331)]){var c=this[a(455)];a(512);if(RSPlacementManager.getInstance()[a(265)]()){var f=RSPlacementManager[a(437)]().getInterface()[a(426)]();f!=a(511)&&f!=a(289)||RSAnalyticsManager[a(437)]()[a(476)](RSEventCategory[a(435)],a(295),a(374),"open_from_"+this[a(498)](),this[a(512)][a(323)],c[a(392)])}this[a(331)](this[a(538)],b)}},trackAppsFlyerEventsAfterPurchase:function(b){if(GameConfig[a(325)]){var c=RSEngine[a(376)][a(508)](),f= c&&c[a(460)]?parseInt(c.totalTimeSpendOnAppForEvent2):36E3,g=c&&c[a(320)]?parseInt(c.revenueConditionForEvent4):200,c=c&&c[a(366)]?parseInt(c.withinDaysConditionForEvent2_4_6):3;RSPlacementManager[a(437)]()[a(344)]()<=c&&(0<RSEngine[a(416)][a(352)]()[a(309)]()&&!RSGame.getInstance().getUserDataManager()[a(352)]().getAppsFlayerEventStatus("event5")&&(RSAppsFlyerManager[a(437)]()[a(436)](a(456),b),RSGame.getInstance()[a(370)]()[a(352)]()[a(278)](a(456))),5*parseFloat(RSEngine[a(416)][a(352)]()[a(470)]())>= g&&!RSGame[a(437)]()[a(370)]().getMe()[a(378)](a(532))&&(RSAppsFlyerManager[a(437)]().trackEvent(a(532),b),RSGame[a(437)]().getUserDataManager().getMe()[a(278)](a(532))),g=RSEngine.dataManager[a(352)]()[a(309)](),2<g&&!RSGame[a(437)]()[a(370)]()[a(352)]()[a(378)](a(516))&&(RSAppsFlyerManager[a(437)]()[a(436)](a(516),b),RSGame[a(437)]()[a(370)]().getMe()[a(278)]("event6")),1<=g&&RSGame[a(437)]()[a(370)]()[a(352)]()[a(425)]()>=f&&!RSGame.getInstance()[a(370)]()[a(352)]()[a(378)](a(316))&&(RSAppsFlyerManager[a(437)]()[a(436)](a(316), b),RSGame[a(437)]()[a(370)]()[a(352)]()[a(278)](a(316))))}},onRetrieveCoinsPurchase:function(b,c){if(b){"function"===typeof RSEngine[a(416)][a(352)]().setLastPurchasePack?RSEngine[a(416)][a(352)]()[a(359)](this._purchasePackData[a(445)]):cc[a(441)](a(536));this[a(512)]={value:this[a(329)][a(506)],isCredit:!0,type:a(559),id:this[a(329)][a(445)]};for(var f in this[a(329)])this[a(329)].hasOwnProperty(f)&&(this._currentPack[f]=this[a(329)][f]);this[a(329)][a(548)]&&(this[a(512)][a(558)]=this[a(329)].powerup); this._purchasePackData[a(421)]&&(this._currentPack[a(421)]=this._purchasePackData[a(421)]);this[a(512)].analyticsName=this[a(455)][a(323)]+String(this[a(329)][a(311)])[a(493)](".","");this[a(512)].analyticsPrice=this._purchasePackData[a(311)];GameConfig.GAME_ID!=a(485)&&GameConfig[a(287)]!=a(434)&&"MS"!=GameConfig[a(287)]&&"CS"!=GameConfig[a(287)]&&"AP"!=GameConfig[a(287)]&&"FPC"!=GameConfig.GAME_ID&&"UP"!=GameConfig.GAME_ID&&GameConfig[a(287)]!=a(518)&&GameConfig.GAME_ID!=a(367)||RSPlatformSDKManager[a(437)]()[a(343)](this[a(512)][a(323)], this[a(512)].analyticsPrice,c.result[a(510)][a(333)]);c&&(this[a(538)][a(522)]=c.result[a(510)][a(522)]?c[a(390)].data[a(522)]:0,this._purchaseResponseObject[a(466)]=c[a(390)][a(510)].LoyaltyPoint?c[a(390)].data[a(466)]:0,this._purchaseResponseObject.playerConnectPoints=c[a(390)][a(510)][a(487)]?c.result.data[a(487)]:0,this[a(538)][a(452)]=c[a(390)][a(510)][a(452)]?c[a(390)].data[a(452)]:0,this[a(538)][a(539)]=c[a(390)][a(510)][a(539)]?c[a(390)][a(510)][a(539)]:!1);this.setUserDataOnSalePurchaseComplete(); this[a(494)](this[a(512)][a(323)])}},onPurchaseSuccessNotifyResponseToCasino:function(){this[a(328)]();RSGame[a(437)]()[a(354)]().notifySalePurchaseResponseToCasino(this[a(538)],this[a(512)],a(481),null);var b=this[a(329)][a(445)],c=RSEngine.gameData[a(397)](this[a(329)][a(445)]);c&&(b=c.analyticsName);this[a(531)](b);this._currentPack=null},setUserDataOnSalePurchaseComplete:function(){var b=RSEngine[a(416)][a(352)]().getSalePurchaseData(),c=this[a(455)][a(399)],f=this[a(455)][a(392)],g=this[a(329)].offerId; null!=b[c+"_"+f]?(null!=b[c+"_"+f][a(297)]?0<b[c+"_"+f][a(297)]?b[c+"_"+f][a(297)]=b[c+"_"+f][a(297)]+1:b[c+"_"+f][a(297)]=1:b[c+"_"+f][a(297)]=1,null!=b[c+"_"+f][g]?0<b[c+"_"+f][g]?b[c+"_"+f][g]+=1:b[c+"_"+f][g]=1:b[c+"_"+f][g]=1):(b={},b[c+"_"+f]={},b[c+"_"+f][a(297)]=1,b[c+"_"+f][g]=1);RSEngine[a(416)].getMe().setSalePurchaseData(b)},initializeAnalytics:function(){if(!0!=this[a(503)]){var b=RSEngine[a(416)].getMe().getId();this[a(307)]=new RSSaleAnalytics(GameConfig.APP_ID,RSAnalyticsPlatform.canvas, GameConfig.VERSION);this[a(307)][a(442)](b,b,TimeManager[a(437)]().getCurrentServerTime(),"IDE");this._saleAnalytics.startSession();this[a(503)]=!0}},trackRequest:function(b,c,f,g){if(RSEngine.loginMode!=LOGIN_MODE[a(433)]){for(var h=0;h<this[a(361)][a(509)];h++)if(this._uniqueSaleRequest[h]==f+"_"+g)return;this.trackSaleEvent(b,"request","",c,f,g,"");this[a(361)][a(286)](f+"_"+g)}},trackImpression:function(b,c,f,g){if(RSEngine.loginMode!=LOGIN_MODE[a(433)]){for(var h=0;h<this[a(478)].length;h++)if(this[a(478)][h]== f+"_"+g)return;this.trackSaleEvent(b,"impression","",c,f,g,"");this[a(478)].push(f+"_"+g)}},trackClick:function(b,c,f,g,h,k){if(RSEngine[a(550)]!=LOGIN_MODE.GUEST)this[a(394)](f,a(285),b,g,h,k,c)},trackPurchase:function(a,b){},trackSaleEvent:function(b,c,f,g,h,k,m){if(null!=this._saleAnalytics)this[a(307)][a(436)](b,c,f,g,h,k,m)},_setTimerValues:function(){this[a(459)]=this[a(302)]-TimeManager[a(437)]()[a(545)]();this[a(455)].remainingTime--;0>=this._timeRemaining&&(this[a(455)][a(271)]=0,this[a(263)]= setTimeout(this[a(349)][a(319)](this),2E3),this[a(339)](),clearInterval(this[a(270)]),this._bonusTimer=null);RSEventManager[a(437)]().dispatchEvent("onTimerTick",{timeRemaining:this._timeRemaining})},checkForNewSale:function(b){this[a(261)]=b?b:!1;this[a(556)]=b;this[a(272)](this[a(293)][a(319)](this),null);clearTimeout(this[a(263)])},reInitializeSale:function(){this[a(455)]=null;this[a(398)]();this[a(339)]()},getSaleActiveStatus:function(b){b=b?!0:!1;if(null!=this[a(280)].nps_ot){if(this.getNPS_OTStatus)return!0}else if(null!= this[a(280)][a(296)]||null!=this[a(280)][a(443)]&&(!b&&null==this[a(455)]&&(this[a(455)]=this[a(280)][a(443)]),this[a(463)]()))return!0;return!1},getLocOocStatus:function(){return null!=this[a(280)][a(374)]||null!=this[a(280)][a(334)]||null!=this._allSalesData[a(492)]||null!=this[a(280)][a(439)]?!0:!1},getSubscriptionSaleStatus:function(){return null!=this[a(280)].subscription?!0:!1},getLocOocSaleData:function(b){return null!=this[a(280)][b]?this._allSalesData[b]:null},getCartBundleStatus:function(){return null!= this[a(280)].cartbundle?!0:!1},getCartBundleSaleData:function(){if(null!=this[a(280)][a(519)])return this[a(280)][a(519)]},getGeneralSaleActiveStatus:function(){if(0!=this[a(453)]&&0<this[a(455)][a(271)]){var b=RSEngine[a(416)][a(352)]()[a(560)](),c=this[a(455)].saleId,f=this[a(455)][a(392)];if(0==this[a(455)].userPurchasableType)if(null!=b[c+"_"+f]){if(b[c+"_"+f][a(297)]<this[a(455)].userPurchasableCount)return!0}else return!0;else if(1==this[a(455)][a(515)]){var g=0;if(null!=b[c+"_"+f]){for(var h in b[c+ "_"+f])if(h!=a(297)&&null!=b[c+"_"+f][h])for(var k=0;k<this[a(455)][a(395)][a(509)];k++)h==this._saleVO[a(395)][k][this[a(455)][a(525)]][a(385)]&&b[c+"_"+f][h]>=this[a(455)][a(422)]&&g++;if(g<this[a(455)][a(395)].length)return!0}else return!0}else if(2==this[a(455)][a(515)])return!0}return!1},getNPS_OTStatus:function(){return this[a(472)]<TimeManager[a(437)]()[a(326)]?!0:!1},getSaleTagActiveForPlayer:function(){if(null!=this[a(280)].nps_ot){if(this[a(438)])return a(549)}else{if(null!=this._allSalesData[a(296)])return a(296); if(null!=this[a(280)][a(443)]&&(null==this[a(455)]&&(this[a(455)]=this[a(280)][a(443)]),this[a(398)]()))return"sale"}return!1},getSaleTagForTrackingEvents:function(b){switch(b){case a(443):return"sales_popup";case a(296):case a(549):return a(461);case "cartbundle":return a(273);case a(314):return"purchase_cart";case a(363):return a(404);default:return b}},showSalePopup:function(b,c,f,g,h,k){this[a(274)]=f;this[a(475)]=f;this[a(317)]=g?g:RSAnalyticsManager[a(437)]().getCurrentMachineName();this[a(350)]= null;null!=c&&void 0!=c&&(this[a(350)]=c);this[a(398)]()&&this.initializeSaleDataWithTag(this[a(429)]());this[a(467)]=b;"v2"==this._saleVO[a(402)]||"v3"==this[a(455)][a(402)]?RSEngine[a(407)][a(381)](new RSSalePopupV2(this[a(465)][a(319)](this),!1,g,h),!0,!0,!0):RSEngine.popupManager.addPopup(new RSSalePopup(this[a(465)][a(319)](this),g,h,k),!0,!0,!0);b?RSAnalyticsManager[a(437)]()[a(384)](this[a(284)](this[a(455)][a(380)]),a(365),a(450)+this[a(317)],"",this[a(455)][a(392)]):RSAnalyticsManager[a(437)]().trackGUIEvent(this.getSaleTagForTrackingEvents(this[a(455)][a(380)]), a(499),a(450)+this[a(317)],"",this._saleVO[a(392)])},showPurchaseCart:function(b,c,f,g){this[a(553)]=g?g:null;this._onPopupCloseCallback=c?c:null;this[a(317)]=f?f:RSAnalyticsManager[a(437)]()[a(498)]();this[a(313)]=parseInt(RSGame[a(437)]()[a(370)]()[a(352)]()[a(309)]());c=!1;!RSSaleManager[a(437)]().getPurchaseCartVO(a(506))[a(402)]||"v2"!=RSSaleManager.getInstance()[a(537)](a(506))[a(402)]&&"v3"!=RSSaleManager.getInstance()[a(537)](a(506))[a(402)]?RSGame[a(437)]()[a(354)]()[a(408)]():(c=!0,RSEngine[a(407)][a(381)](new RSSalePopupV2(this.onSalePopupClose.bind(this), !0,f),!0,!0,!0));c&&(b?RSAnalyticsManager.getInstance()[a(384)](a(314),a(365),"open_from_"+this._openFrom,"",this._saleVO[a(392)]):(RSAnalyticsManager[a(437)]().trackGUIEvent("purchase_cart",a(499),a(450)+this._openFrom,"",this[a(455)][a(392)]),RSPlatformSDKManager[a(437)]()[a(436)](SDK_EVENT_TYPE[a(292)])))},resumeMainLobbyTransitions:function(){null!=this[a(553)]&&this._pauseMainLobbyTransitions(!0);this[a(553)]=null},showSalePopupWithTag:function(b,c,f,g,h,k){this[a(317)]=h;this[a(274)]=g;this._onPopupCloseCallback= null;this[a(412)]=null;null!=f&&void 0!=f&&(this._onPopupCloseCallback=f);this[a(467)]=c;this[a(454)](b);"v2"==this._saleVO.saleVersion||"v3"==this[a(455)][a(402)]?RSEngine.popupManager[a(381)](new RSSalePopupV2(this[a(465)].bind(this),!1,null,b),!0,!0,!0):RSEngine.popupManager[a(381)](new RSSalePopup(this[a(465)][a(319)](this),null,b,h),!0,!0,!0);f=this[a(284)](this._saleVO[a(380)]);RSSaleManager[a(437)]()[a(480)](!1);if("subscription"==b)if(k&&(this[a(412)]=k),c)RSAnalyticsManager[a(437)]()[a(384)](f, "trigger",a(450)+h,"",this[a(455)][a(392)]);else if(k)c=this._saleVO[a(395)]["0"][this[a(455)][a(525)]][a(345)],RSAnalyticsManager[a(437)]()[a(384)](a(388),a(443),k,c);else RSAnalyticsManager.getInstance()[a(384)](f,"open",a(450)+h,"",this[a(455)][a(392)]);else k=h?h:RSAnalyticsManager[a(437)]()[a(498)](),c?RSAnalyticsManager.getInstance()[a(384)](f,a(365),a(450)+k,"",this._saleVO[a(392)]):RSAnalyticsManager.getInstance()[a(384)](f,a(499),"open_from_"+k,this._saleVO[a(392)])},initializeSaleDataWithTag:function(b){this[a(455)]= this[a(280)][b];for(b=0;b<this[a(455)][a(330)].length;b++)0<=this[a(455)][a(330)][b][a(335)].indexOf(a(504))&&0>this[a(455)].assets[b].assetLink[a(447)](a(521))&&(this[a(303)]=this._saleVO[a(330)][b][a(335)][a(415)]("_00-hd.png")[0]);this[a(459)]=this[a(455)][a(271)];(this[a(302)]<=TimeManager.getInstance().getCurrentServerTime()||this._saleEndTime!=this[a(455)][a(271)]+TimeManager.getInstance().getCurrentServerTime())&&(this._saleEndTime=this[a(455)].remainingTime+TimeManager[a(437)]()[a(545)]())}, showSubscriptionSalePopup:function(b,c,f){"US"==RSGame[a(437)]()[a(370)]().getMe().getCountryCode()&&this[a(405)](a(363),!1,c,null,b,f)},getOptValForSubscriptionPlacement:function(){return this._optValForSubsPlacement?this._optValForSubsPlacement:null},getSaleResourceByName:function(b,c){var f=null;if(c)for(var g=0;g<this._saleVO.assets.length;g++){if(0<=this._saleVO[a(330)][g].assetLink.indexOf(this[a(455)].saleName+"_"+b+a(403)))return f=this[a(455)][a(330)][g][a(335)][a(415)](this[a(455)][a(264)]+ "_"+b+a(403))[0],f}else for(g=0;g<this._saleVO[a(330)][a(509)];g++)if(0<=this[a(455)][a(330)][g].assetLink[a(447)](this[a(455)].saleName+"_"+b+a(377)))return f=this[a(455)][a(330)][g][a(335)][a(415)](a(377))[0],f;return f},getSaleCartResourceByName:function(b,c){for(var f=this.getPurchaseCartVO(c),g=null,h=0;h<f.assets[a(509)];h++)if(0<=f[a(330)][h][a(335)].indexOf(f.saleName+"_"+b+a(377))||0<=f[a(330)][h][a(335)][a(447)](b+a(377)))return g=f[a(330)][h][a(335)][a(415)]("_layout_iPhone5.json")[0], g;return g},getSaleConfigPath:function(b){for(var c=null,f=0;f<this[a(455)][a(330)][a(509)];f++)if(0<=this._saleVO.assets[f][a(335)][a(447)](this[a(455)][a(264)]+"_"+b+a(403)))return c=this[a(455)][a(330)][f][a(335)][a(415)](b+".json")[0],c;return c},getSaleCartConfigPath:function(b,c){for(var f=this[a(537)](c),g=null,h=0;h<f[a(330)][a(509)];h++)if(0<=f[a(330)][h][a(335)][a(447)](f[a(264)]+"_"+b+a(403)))return g=f[a(330)][h][a(335)][a(415)](b+a(403))[0],g;return g},getPurchaseCartResourceByName:function(){}, onSalePopupClose:function(){null!=this[a(350)]&&null==this[a(553)]?(this[a(350)].call(),this[a(350)]=null):null!=this[a(553)]&&this[a(313)]==parseInt(RSGame.getInstance()[a(370)]().getMe()[a(309)]())&&this[a(356)]();this[a(274)]=!1},getCoinPackData:function(){return this[a(523)]},getPowerupPackData:function(){return this[a(541)]},unload:function(){},getTriggerStatus:function(){return this[a(467)]},forceProcessSaleQueue:function(){null!=this[a(307)]&&this[a(307)][a(420)](!0)},setSaleFont:function(b, c){null!=c&&void 0!=c&&!1!=c?this[a(283)][c]=b:this[a(283)]["default"]=b},getSaleFont:function(b){return null!=b&&void 0!=b&&null!=this[a(283)][b]&&void 0!=this[a(283)][b]?this[a(283)][b]:this._saleFont[a(547)]},getCarouselAnimStatus:function(){return this._isCarouselAnimActive},getEventId:function(){return this._saleVO?this._saleVO[a(392)]:""},getCurrentMachineName:function(){var b="";return"gameplay_screen"==RSAnalyticsManager.getInstance()[a(500)]()?b=RSAnalyticsManager[a(437)]()[a(430)]():b=RSAnalyticsManager[a(437)]().getCurrentScreen(), b},setSubscriptionPurchasedStatus:function(b){this[a(298)]=b;console[a(441)](a(479))},getSubscriptionPurchasedStatus:function(){return this._delayPopupsFollowedBySubscription},getOpenFromNameForSalePopup:function(){return this[a(317)]},getOOCAnimStatusForCarousal:function(){return this[a(475)]},setOOCAnimStatusForCarousal:function(){this[a(475)]=!1}});return{getInstance:function(){return!b&&(b=new c),b}}}(); function a0_0x4664(){var a="totalTimeSpendOnAppForEvent2;nps_popup;pack;getGeneralSaleActiveStatus;ValidationFailed;onSalePopupClose;LoyaltyPoint;_isTriggeredForceFully;purchaseCartAssetChangeType;daubAlertAssets;getMonetizationFactor;_sessionCounter;NPSOTEndTime;?t\x3d;exitCartStatus;_isCarouselAnimActiveForCarousal;trackInHouseEvent;_overlay;_uniqueSaleImpression;Subscription purchased:Delay popups;setSubscriptionPurchasedStatus;success;trackClick;includes;onSaleDetailsCallback;LNC;glinda.lopez@rubyseven.net,prajosh.sasidharan@rubyseven.net;playerConnectPoints;18450mbWXHg;378414NZJdOQ;_purchaseCartCoinVO;_purchaseCartEnergyVO;loe;replace;onPurchaseSuccessCallBack;type;498zpLwsn;onNextSaleTimeSuccessCallback;getCurrentMachineName;open;getCurrentScreen;_assetsLoaded;packID;_saleAnalyticsInitialized;.png;getSheetData;coin;_onPurchaseFailure;getAppsFlyerValues;length;data;LOCPopup;_currentPack;_00-hd.png;_00-hd;userPurchasableType;event6;checkForDuplicates;BPVP;cartbundle;352WURTMy;LoyaltyPreviewWidget;clubMPoints;_coinPackData;IS_VIP_ENABLED;monetizationCategory;trackErrorMessage;error_message;pushToCart;_purchaseCartPowerupVO;cancelled;trackAppsFlyerEventsAfterPurchase;event4;_purchaseCartEnergyResourceName;call;sendJSONRPCRequest;Did not find set last purchase pack on blob function needed for exit cart;getPurchaseCartVO;_purchaseResponseObject;isGCOWRewardAvailable;amount;_powerPackData;saleCartIndex;getId;_daubAlertResourceName;getCurrentServerTime;salePushed;default;powerup;nps_ot;loginMode; Message ;WEB_PURCHASE_RESPONSE;_pauseMainLobbyTransitions;addOverlay;currency;_isRecheckCall;DaubAlert;powerupPacks;coins;getSalePurchaseData;_refreshOnceCalled;TimeEventData.getSalesV1;_callSaleDetailsTimer;saleName;getInterface;tier;_resourcesToBeFetched;status;purchaseCarts;_bonusTimer;remainingTime;callSaleDetails;sales_popup;_isCarouselAnimActive;checkSaleStatusAndStartBuyButtonAnimation;sales;2085Czbpnh;setAppsFlayerEvents;color;_allSalesData;_purchaseStatus;PurchaseCartPopup;_saleFont;getSaleTagForTrackingEvents;click;push;GAME_ID;FB_PURCHASE_RESPONSE;OOCPopup;value;getCoinBalance;purchaseCartOpen;reInitializeSale;extend;purchase_initiated;nps;count;_delayPopupsFollowedBySubscription;sessionID;_onPurchaseCancel;onFailedCallback;_saleEndTime;_saleResourceName;Status;2120025JNOGLj;fnfPurchaseRemainingDays;_saleAnalytics;platform;getMonetizationCount;_NPSSaleActived;price; Amount ;_moniziterCount;purchase_cart;saleRewardTypes;event2;_openFrom;saleType;bind;revenueConditionForEvent4;_cartsNeeded;_alreadyFetchedResources;analyticsName;920180gVQDzT;IS_APPSFLYER_ENABLED;currentServerTime;purchase;_hideOverlayLayer;_purchasePackData;assets;_onPurchaseSuccessCallBack;_purchaseCartCoinResourceName;monetization_factor;loc;assetLink;getCurrentCoinBalance;_layout_iPad;onCallBackForSaleDetails;setSaleStatus;onSaleDetailsFailedCallback;null;gcowreward;logPurchase;getNumberOfDays;packId;powerups;949928GwmrxO;Currency;checkForNewSale;_onPopupCloseCallback;Cart not found : ;getMe;119OJZrST;getGameManager;getPurchaseCartV2VO;resumeMainLobbyTransitions;onRetrieveCoinsPurchase;daubAlertAssetChangeType;setLastPurchasePack;_preloadRes;_uniqueSaleRequest;payment_id;subscription;currencyType;trigger;withinDaysConditionForEvent2_4_6;RSVP;onPopupCloseCallBack;timer;getUserDataManager;PaymentID ;getFandFPurchaseRemainingTime;setDelegate;ooc;packid;gameData;_layout_iPhone5.json;getAppsFlayerEventStatus;version;tag;addPopup;_salePreLoader;daubAlert;trackGUIEvent;offerId;trackRequest;screenManager;subscription_placement;nextSaleTime;result;_onPurchaseSuccess;eventId;_sessionID;trackSaleEvent;packs;sessionCounter;getPackById;getSaleActiveStatus;saleId;purchaseCartAssets;_showOverlayLayer;saleVersion;.json;subscription_sale;showSalePopupWithTag;_nextSaleTimerData;popupManager;showPurchaseCart;_purchaseCartSaleActiveStatus;277524SfPbmJ;all;_optValForSubsPlacement;_onPurchaseFailCallBack;76dswiDq;split;dataManager;_nextSaleCall;_isGCOWRewardAvailable;_layout_iPhone5;processQueue;energy;userPurchasableCount;salesCartIndex;cloneJSON;getTotalTimeSpentOnApp;getCurrentPopupTriggered;init;message;getSaleTagActiveForPlayer;getCurrentMachineAnalyticsName;notifySalePurchaseResponseToCasino;_daubAlertVO;GUEST;BBC;SYS_OPS;trackEvent;getInstance;getNPS_OTStatus;ooe;networkManager;log;initialize;sale;_saleDataUpdated;inAppPack;_layout_iPhone4;indexOf;_setTimerValues;getCasinoHUD;open_from_;slice;gcowRewardedCount;_saleStatus;initializeSaleDataWithTag;_saleVO;event5;_purchaseCartPowerupResourceName;VERSION;_timeRemaining".split(";");a0_0x4664= function(){return a};return a0_0x4664()};var RS_SALEANALTYICS_SYNC_TIME=3E4,RS_SALEANALTYICS_SESSION_RENEWAL=10,RS_SALEANALTYICS_QUEUE_LIMIT=30,RS_SALEANALTYICS_QUEUE_KEY="RS_SALEANALTYICS_QUEUE_KEY",RSSaleAnalytics=RSClass.extend({init:function(a,b,c){this._platform=b;this._appID=a;this._URL="https://tracker.rubyseven.com/v2/sale-tracker.php";this._eventCounter=0;this._queue=[];this._version=c;this._sessionID=this._fbID=this._userID="";this._sessionActive=!1;this._recordedSessionTime=this._localMinimizeTime=this._localTime=0;this._requestInProgress= this._queueLimitProcessed=!1;this._callAnalyticsInterval=null;a=RSUtils.getLocalStorageItem(RS_SALEANALTYICS_QUEUE_KEY,null);if(null!=a&&0<a.length)for(b=0;b<a.length;b++)c=JSON.stringify(a[b]),this._queue.push(c);this._ccObject=new cc.Node;RSEngine.isMobile&&this._ccObject.retain()},initialize:function(a,b,c,d){this._fbID=b;a!=this._userID&&(this._userID=a,this._sessionID=a+"_"+c,RSSaleManager.getInstance().setSessionID(a+"_"+c),this.stopSession(),this.startSession(d))},startSession:function(){if(!this._sessionActive&& 0!=this._userID.length){this._sessionActive=!0;var a=this._eventCounter=0;0<this._localMinimizeTime&&(a=this._localMinimizeTime-this._localTime);this._recordedSessionTime+=a;this._localTime=Date.now();this.updateSessionID(this._localTime);this.processQueue(!1);this._callAnalyticsInterval=setInterval(this.processQueue.bind(this,!1),RS_SALEANALTYICS_SYNC_TIME)}},stopSession:function(){this._sessionActive&&0!=this._userID.length&&(this._sessionActive=!1,this._localMinimizeTime=Date.now(),this.processQueue(!1), clearInterval(this._callAnalyticsInterval))},updateSessionID:function(a){var b=Date.now();if(172800<Math.abs(b-a))return!1;0<this._localMinimizeTime&&this._localTime-this._localMinimizeTime>60*RS_SALEANALTYICS_SESSION_RENEWAL&&(this._sessionID=this._userID+"_"+a,RSSaleManager.getInstance().setSessionID(this._userID+"_"+a),this._localMinimizeTime=this._recordedSessionTime=0);return!0},processQueue:function(a){if(0!=this._queue.length){var b=0;a?(this._requestInProgress&&this._queue.splice(0,1),b=this._queue.length): this._queueLimitProcessed?b=1:(b=this._queue.length,b>RS_INHOUSE_QUEUE_LIMIT&&(this._queueLimitProcessed=!0,b=RS_INHOUSE_QUEUE_LIMIT));if(0!=b){this._requestInProgress=!0;a=this._queue[0];this._queue.splice(0,1);for(var c=1;c<b;c++)a=a+","+this._queue[0],this._queue.splice(0,1);this._queue.unshift(a);b="["+a+"]";a=calcMD5(b+"|chay0w0games");this.sendRequest("RubyAnalyticsTracker\x3d"+b+"\x26hashValue\x3d"+a,this.processQueueResponse.bind(this))}}},sendRequest:function(a,b){var c=cc.loader.getXMLHttpRequest(); c.open("POST",this._URL,!0);c.setRequestHeader("Content-Type","application/x-www-form-urlencoded");var d=setTimeout(function(){c.abort();cc.log("In-House queue processing Error: Network Time out")},5E3);c.onreadystatechange=function(){4==c.readyState&&200==c.status&&(cc.log("onreadystatechange \x3d "+c.status),clearTimeout(d))};c.onload=function(){var a=JSON.parse(c.responseText);b(a);if(null!=a.error)return!1};c.onerror=function(){cc.log("In-House queue processing Error: Network Error");clearTimeout(d)}; try{c.send(a)}catch(e){clearTimeout(d),cc.log("In-House queue processing Error: Network Unavailable")}},processQueueResponse:function(a){this._requestInProgress=!1;if(1<=a)for(var b=0;b<a;b++)this._queue.splice(0,1),this._queueLimitProcessed=!1,this.saveQueueToLocalStorage()},saveQueueToLocalStorage:function(){if(0==this._queue.length)RSUtils.setLocalStorageItem(RS_SALEANALTYICS_QUEUE_KEY,null);else{for(var a="["+this._queue[0],b=1;b<this._queue.length;b++)a=a+","+this._queue[b];RSUtils.setLocalStorageItem(RS_SALEANALTYICS_QUEUE_KEY, a+"]")}},getCurrentSessionDuration:function(){var a=new Date(Date.now()),b=a.getFullYear(),c=a.getMonth()+1;10>c&&(c="0"+c);var d=a.getDate();10>d&&(d="0"+d);var e=a.getHours();10>e&&(e="0"+e);var f=a.getMinutes();10>f&&(f="0"+f);a=a.getSeconds();10>a&&(a="0"+a);return b+"-"+c+"-"+d+" "+e+":"+f+":"+a},incrementCounter:function(){this._eventCounter+=1;RSSaleManager.getInstance().setSessionCounter(this._eventCounter)},trackEvent:function(a,b,c,d,e,f,g){if(void 0==a||void 0==b||void 0==c||void 0==d|| void 0==e||void 0==f||void 0==g)cc.log("ANALYTICS ERROR---undefined FROM....eventName"+a+"eventAction"+b+"dollarValue"+c+"tier"+d+"saleId"+e+"eventId"+f+"packId"+g);else if(null==a||null==b||null==c||null==d||null==e||null==f||null==g)cc.log("ANALYTICS ERROR---NULL FROM....eventName"+a+"eventAction"+b+"dollarValue"+c+"tier"+d+"saleId"+e+"eventId"+f+"packId"+g);else{this.incrementCounter();var h={};h.appId=this._appID;h.userId=this._userID;h.fbId=this._fbID;h.platform=this._platform;h.saleId=e;h.eventId= f;h.packId=g;h.eventName=a;h.eventAction=b;h.dollarValue=c;h.tier=d;h.counter=this._eventCounter;h.version=this._version;h.date=this.getCurrentSessionDuration();h.event_time=TimeManager.getInstance().getCurrentServerTime();h.sessionId=this._sessionID;a=JSON.stringify(h);this._queue.push(a);h.length=0;this.saveQueueToLocalStorage()}}});var RSSaleVO=RSVO.extend({analyticsName:null,assetLink:null,checksum:null,eventId:null,monetizationCategory:null,packs:null,remainingTime:null,saleId:null,saleName:null,timer:null,userPurchasableCount:null,userPurchasableType:null,tag:null,type:null,saleVersion:null,strikeOutData:null,init:function(a){this.analyticsName="";this.assets=[];this.monetizationCategory=this.eventId=this.checksum=this.assetLink="";this.packs=[];this.remainingTime=0;this.saleVersion=this.pushToCart=this.type=this.tag=this.userPurchasableType= this.userPurchasableCount=this.timer=this.saleName=this.saleId="";this.strikeOutData=null;this._super.init.call(this,a)}});var RSMachine=RSGameScreen.extend({init:function(){this._super.init.call(this);this._machineScale=1;this._machineAnchorPoint=new RSPoint(0.5,0.5);this._machineSizeModified=!1;this._machineOrientation=RSEngine.orientation;this._machinePosition=new RSPoint(0,0);this._paddingImage=this._paddingImageURL=null;this._checkAndSetOrientation=!1;this._minMachineSize=new RSSize(900*RSEngine.resolutionFactor,1E3*RSEngine.resolutionFactor);this._loadingProgressDiv=this._loadingBgDiv=null},setPaddingForMachine:function(a){this._paddingImageURL= a;a=SCREEN_SIZES[RSEngine.layout].height;var b=SCREEN_SIZES[RSEngine.layout].width;if(RSEngine.orientation==SCREEN_ORIENTATION.PORTRAIT){var c=a;a=b;b=c}this._paddingImage=new RSImageObject(this);this._paddingImage.setName("MachinePaddingImage");this._paddingImage.setImageFromUrl(this._paddingImageURL,0,0,a,b);this._paddingImage.setCenter(RSEngine.screenWidth/2,RSEngine.screenHeight/2);this._paddingImage.setScale(1/this._machineScale);this._paddingImage.setZOrder(-1);this.getDisplayObject().addChild(this._paddingImage.getDisplayObject())}, onImageLoaded:function(a){"MachinePaddingImage"==a.getName()&&this._paddingImage.setScale(1/this._machineScale)},onImageLoadFailed:function(a){"MachinePaddingImage"==a.getName()&&(a=this.getSize(),this._paddingImage.setImageFromUrl(this._paddingImageURL,0,0,a.getWidth(),a.getHeight()))},layoutMachine:function(){this.layoutScreen(this.getLayouts())},setLoadingDivs:function(a,b){this._loadingBgDiv=a;this._loadingProgressDiv=b},revealScreen:function(){this._super.revealScreen.call(this);this._loadingBgDiv&& (document.getElementById("Cocos2dGameContainer").appendChild(this._loadingBgDiv),this._loadingBgDiv.style.zIndex="-1",this._loadingBgDiv.style.filter="blur(10px)",this._loadingBgDiv.style.WebkitFilter="blur(10px)");this._loadingProgressDiv&&(this._loadingProgressDiv.style.visibility="hidden")},getLayouts:function(){return[]},onScreenOrientationChanged:function(a){this._machineOrientation=a;this._machineScale=1;this._machinePosition.setPoint(0,0);if(this._isScreenActive){this._machineOrientation!= RSEngine.orientation&&(this._machineScale=RSEngine.orientation==SCREEN_ORIENTATION.LANDSCAPE?RSEngine.screenHeight/this._minMachineSize.getWidth():RSEngine.screenWidth/RSEngine.screenHeight,this._machinePosition.setPoint(RSEngine.screenHeight/2-RSEngine.screenWidth/2,RSEngine.screenWidth/2-RSEngine.screenHeight/2));this.setScale(this._machineScale);this.setPosition(this._machinePosition.getX(),this._machinePosition.getY());this._paddingImage&&this._paddingImage.setScale(1/this._machineScale);for(a= 0;a<RSEngine.popupManager._activePopups.length;a++)if(RSEngine.popupManager._activePopups[a].setScale(this._machineScale),RSEngine.popupManager._activePopups[a].setPosition(this._machinePosition.getX(),this._machinePosition.getY()),!RSEngine.popupManager._activePopups[a]._popupAnimationCompleted){var b=this._machineScale;RSEngine.popupManager._activePopups[a].onReveal=function(){this.setScale(b)}}for(a=0;a<RSEngine.popupManager._popupQueue.length;a++)RSEngine.popupManager._popupQueue[a].setScale(this._machineScale), RSEngine.popupManager._popupQueue[a].setPosition(this._machinePosition.getX(),this._machinePosition.getY())}else this._checkAndSetOrientation=!0},update:function(a){this._checkAndSetOrientation&&this._isScreenActive&&(this._checkAndSetOrientation=!1,this.onScreenOrientationChanged(this._machineOrientation))},scaleTo:function(a,b,c){this._machineScale=a;this._machineAnchorPoint=b;this.setScale(this._machineScale);this.setAnchorPoint(this._machineAnchorPoint.getX(),this._machineAnchorPoint.getY()); this.clipScreen(c);this._machineSizeModified=!0},loadNewScreen:function(a){this._machineSizeModified&&a.scaleTo(this._machineScale,this._machineAnchorPoint,this._rsScreenRect);this._paddingImageURL&&(a.setPaddingForMachine(this._paddingImageURL),a.clipScreen());if(this._machineOrientation!=RSEngine.orientation)a.onScreenOrientationChanged(this._machineOrientation);RSEngine.screenManager.loadNewScreen(a)},addScreen:function(a){this._machineSizeModified&&a.scaleTo(this._machineScale,this._machineAnchorPoint, this._rsScreenRect);this._paddingImageURL&&(a.setPaddingForMachine(this._paddingImageURL),a.clipScreen());if(this._machineOrientation!=RSEngine.orientation)a.onScreenOrientationChanged(this._machineOrientation);RSEngine.screenManager.addScreen(a)},addPopup:function(a,b,c,d){this._machineSizeModified&&(a.setScale(this._machineScale),a.setAnchorPoint(this._machineAnchorPoint.getX(),this._machineAnchorPoint.getY()),a.clipScreen(this._rsScreenRect));this._machineOrientation!=RSEngine.orientation&&(a.setScale(this._machineScale), a.setPosition(this._machinePosition.getX(),this._machinePosition.getY()));RSEngine.popupManager.addPopup(a,b,c,d)},addHUDToScreen:function(){if(null!=RSCasinoManager.getCasinoHUD()&&!this._machineSizeModified){var a=RSCasinoManager.getCasinoHUD();a.reInitButtonHoverCursor();this.addChild(a);a.setZOrder(10)}},removeHUDFromScreen:function(){if(null!=RSCasinoManager.getCasinoHUD()&&!this._machineSizeModified){var a=RSCasinoManager.getCasinoHUD();this.removeChild(a,!1);a.reInitButtonHoverCursor()}}});(function(a,b){for(var c=a0_0xd52a,d=a();;)try{if(-parseInt(c(415))/1*(parseInt(c(321))/2)+-parseInt(c(329))/3+parseInt(c(341))/4*(-parseInt(c(379))/5)+parseInt(c(406))/6*(-parseInt(c(339))/7)+-parseInt(c(414))/8*(-parseInt(c(351))/9)+parseInt(c(364))/10*(parseInt(c(352))/11)+parseInt(c(409))/12===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x1369,303125);function a0_0xd52a(a,b){var c=a0_0x1369();return a0_0xd52a=function(a,b){return c[a-313]},a0_0xd52a(a,b)} function a0_0x1369(){var a="machinesToUnlock;46478mnpnXf;trigger;_trackingId;splice;addOverlay;onUrlRewardFetchFailed;removeOverlay;mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net;1473945SBtNBv;URL REWARDING FAILED\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e;all_slots;_hideOverlayLayer;onUrlRewardRespone;linkRewardsSatus;onLTEMInfoDataLoadingFailed;trackerLinkData;Failed to fetch LTEM InfoData;opt_value2;662543XlrMTS;trackGUIEvent;92zSsJli;data updated;_rewardVO;popupManager;gameData;parse;data;url_scheme;_category;screenManager;5166eGrHhT;418alMVVJ;url_gift_popup;urlRewardCallBack;trackingId;onUrlRewardDataFetchFailedForGuestPlayers;energy;opt_label;linkRewardsStatus;getPopupMessagesWithKey;setMachineUnlockValues;bind;log;28810vUIqcF;trackPrimarySource;success;_onPopUpCloseCallBack;status;trackErrorMessage;_fromAppboy;GUEST;setPopups;getInstance;getLinkReward;push;getUserDataManager;category;trackUrlRewardNotification;129095NLYlqP;_popupMessages;_unlocktimer;getCoinBalance;result;valid;_popupList;getUrlRewardNotificationDataForGuestPlayers;setGuestUserDataForKey;metagame;unlockedGifts_;_allSlotTimer;_rewardPowerups;getMe;addPopup;SERVER_RESPONSE;linkRewardsEnabled;loginMode;duration;_retryCount;powerup;_showOverlayLayer;urlType;_powerupObject;infoPopup;reward;onPopupClosed;12CYxylB;indexOf;free;13005552wEqnEX;metatype;dataManager;readLTEMGameDataEvents;length;5680MRabnt;1zfLDhz;[LTEMGameDataLoader]: LTEM InfoData Loading Failed;remainingTime;powerups;events;_machineUnlockObject;type;allMachineUnlock;invalid;coins".split(";"); a0_0x1369=function(){return a};return a0_0x1369()} var UrlNotificationManager=function(){var a,b;b=RSClass.extend({_rewardVO:null,linkRewardsEnabled:!1,linkRewardsStatus:0,_trackingId:0,_fromAppboy:!1,_powerupObject:{},_popupList:[],_popupMessages:{},_machineUnlockObject:{duration:0,allMachineUnlock:!1,machinesToUnlock:[]},_retryCount:0,_onPopUpCloseCallBack:null,init:function(){var a=a0_0xd52a;this._popupMessages=null;this[a(349)]=null},trackUrlRewardNotification:function(a,b,e){var f=a0_0xd52a;null!=b&&void 0!=b||(b=!1);this[f(354)]=e;b&&this[f(400)](); this[f(354)]=e;this[f(370)]=b;this[f(323)]=a;RSEngine.dataManager.trackUrlReward(a,this[f(333)][f(362)](this),this[f(326)][f(362)](this))},getUrlRewardNotificationDataForGuestPlayers:function(a,b,e){var f=a0_0xd52a;null!=b&&void 0!=b||(b=!1);this[f(354)]=e;b&&this[f(400)]();this.urlRewardCallBack=e;this[f(370)]=b;this._trackingId=a;RSEngine[f(411)][f(374)](a,this[f(333)][f(362)](this),this[f(356)][f(362)](this))},_showOverlayLayer:function(){RSEngine.screenManager[a0_0xd52a(325)]()},_hideOverlayLayer:function(){var a= a0_0xd52a;RSEngine[a(350)][a(327)]()},loadLTEMInfoData:function(){var a=a0_0xd52a;RSEngine.gameData[a(412)](this.onLTEMInfoDataLoaded[a(362)](this),this[a(335)][a(362)](this),a(403))},onLTEMInfoDataLoaded:function(a){var b=a0_0xd52a;if(a[b(383)][b(314)])for(var e=0;e<a.result[b(314)].length;e++)a.result.events[e][b(347)]&&a.result[b(314)][e][b(347)][b(410)]&&(a[b(383)].events[e][b(347)][b(410)][b(316)]==b(331)?(this[b(315)][b(317)]=!0,this[b(315)][b(397)]=a.result[b(314)][e][b(417)],this[b(381)]= setInterval(this[b(390)].bind(this),1E3)):a[b(383)][b(314)][e].data[b(410)][b(316)]==b(320)&&(this[b(315)].machinesToUnlock=a.result[b(314)][e][b(347)][b(410)][b(320)]))},onLTEMInfoDataLoadingFailed:function(){var a=a0_0xd52a;cc[a(363)](a(416));RSErrorTracker[a(373)]()[a(369)](a(394),a(337),a(328));RSEngine[a(345)][a(412)](this.onLTEMInfoDataLoaded.bind(this),this[a(335)][a(362)](this),"infoPopup")},onUrlRewardRespone:function(a){var b=a0_0xd52a;this[b(398)]=0;this[b(332)]();if(a.result){null!=a.result[b(404)]&& a[b(383)][b(404)][b(401)]&&(this[b(380)]=RSEngine[b(345)][b(360)](a[b(383)][b(404)][b(401)]));if(a[b(383)][b(368)]==b(384)){if(null!=a.result[b(404)]){this[b(343)]=new RewardsVO(a[b(383)][b(404)]);void 0!=a[b(383)].powerUps&&(this[b(402)]=JSON[b(346)](a[b(383)].powerUps),RSEngine[b(411)].getMe().setPowerUps(this._powerupObject));if(a[b(383)][b(404)]){if(parseInt(a[b(383)][b(404)][b(319)])){if(this[b(343)][b(319)]=parseInt(a[b(383)][b(404)][b(319)]),this[b(395)]=!0,this.linkRewardsStatus=1,this[b(349)]= a[b(383)][b(377)],RSEngine[b(396)]==LOGIN_MODE[b(371)]){var e={trackingId:null,coins:null};e[b(355)]=this._trackingId;e[b(319)]=parseInt(a.result[b(404)][b(319)]);RSGame[b(373)]()[b(376)]()[b(392)]()[b(387)]("trackerLinkData",e);cc[b(363)](b(342))}}else this[b(343)].coins=0;a[b(383)][b(404)][b(399)]?(this[b(343)][b(399)]=a[b(383)].reward[b(399)],a.result[b(404)][b(313)]&&(this[b(391)]=a.result[b(404)].powerups),this[b(395)]=!0,this[b(359)]=1):this[b(343)].powerup="";parseInt(a.result.reward[b(357)])? (this[b(343)][b(357)]=parseInt(a[b(383)].reward[b(357)]),this[b(395)]=!0,this[b(359)]=1):this[b(343)][b(357)]=0}a[b(383)][b(358)]&&(this[b(343)][b(358)]=a[b(383)][b(358)]);a[b(383)][b(338)]&&(this[b(343)][b(338)]=a.result[b(338)]);a.result[b(404)][b(410)]&&(MachineGiftingManager[b(373)]()[b(361)](a[b(383)][b(404)][b(410)],a[b(383)][b(368)],a[b(383)][b(404)][b(389)]),this[b(395)]=!0,this[b(359)]=5)}}else a[b(383)][b(368)]==b(318)?this.linkRewardsEnabled=!1:"expired"==a[b(383)][b(368)]?(this[b(395)]= !0,this[b(359)]=2):(this[b(395)]=!0,this.linkRewardsStatus=3);5!=this.linkRewardsSatus&&this.checkTheTrackingIdIsFromGuestUserOrNot()&&this[b(372)]();this[b(370)]&&this.showPopups()}this.urlRewardCallBack&&this[b(354)]("success")},showPopups:function(a){var b=a0_0xd52a;this[b(367)]=a;for(!this._popupList[b(413)]&&this[b(367)]&&(this[b(367)](),this[b(367)]=null);0<this[b(385)][b(413)];)this[b(385)][b(324)](0,1)[0]();this._popupList=[]},setPopups:function(){var a=a0_0xd52a;if(this[a(395)])if(1==this[a(359)])if(RSEngine[a(396)]== LOGIN_MODE[a(371)]){var b=function(){RSEngine.popupManager[a(393)](new UrlNotificationRewardPopupForGuestPLayers(this[a(380)],this[a(405)].bind(this)),!0)};this[a(385)][a(375)](b[a(362)](this))}else b=function(){RSEngine[a(344)][a(393)](new UrlNotificationRewardPopup(this._popupMessages,this[a(405)][a(362)](this)),!0)},this[a(385)].push(b.bind(this));else this[a(385)][a(375)](function(){RSEngine[a(344)][a(393)](new UrlNotificationRewardFailedPopup(this[a(380)],this[a(405)][a(362)](this)),!0)}[a(362)](this))}, _allSlotTimer:function(){var a=a0_0xd52a;this[a(315)][a(397)]--;0>=this[a(315)][a(397)]&&(clearInterval(this[a(381)]),this[a(315)]={duration:0,allMachineUnlock:!0,machinesToUnlock:[]})},getMachineUnlockStatus:function(a){var b=a0_0xd52a;return this[b(315)][b(317)]?!0:0<=this[b(315)][b(320)][b(407)](a)?!0:!1},getMachineUnlockDurationInSeconds:function(){return this[a0_0xd52a(315)].duration},getAllMachineUnlockStatus:function(){var a=a0_0xd52a;return this[a(315)][a(317)]},onUrlRewardFetchFailed:function(){var a= a0_0xd52a;3>this[a(398)]?(this[a(398)]++,this[a(378)](this[a(323)],this[a(370)],this[a(354)])):(this[a(398)]=0,this[a(332)](),this[a(354)]&&this[a(354)](a(366)),cc[a(363)](a(330)))},onUrlRewardDataFetchFailedForGuestPlayers:function(){var a=a0_0xd52a;3>this[a(398)]?(this[a(398)]++,this[a(386)](this[a(323)],this[a(370)],this[a(354)])):(this._retryCount=0,this[a(332)](),this[a(354)]&&this[a(354)](a(366)),cc.log(a(330)))},checkTheTrackingIdIsFromGuestUserOrNot:function(){var a=a0_0xd52a;if(RSEngine[a(396)]!= LOGIN_MODE[a(371)]&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK){var b=RSGame.getInstance()[a(376)]()[a(392)]().getGuestUserDataForKey(a(336));if(b){if(b[a(355)]!=this[a(323)])return!0}else return!0;RSAnalyticsManager[a(373)]().trackGUIEvent(a(353),a(322),b.coins,"","");RSAnalyticsManager.getInstance()[a(340)]("url_gift_popup","collect",b[a(319)],"","");1==this[a(334)]&&(RSAnalyticsManager[a(373)]()[a(365)](RSAnalyticsSource[a(408)],a(348),parseInt(UrlNotificationManager[a(373)]()[a(343)][a(319)]),a(388)), UrlNotificationManager[a(373)]()[a(343)][a(399)]&&RSAnalyticsManager[a(373)]().trackSecondarySource(RSAnalyticsSource[a(408)],a(348),parseInt(UrlNotificationManager[a(373)]()[a(343)][a(399)]),a(388)));RSEngine.dataManager[a(382)](this.onCoinUpdate[a(362)](this));return RSGame.getInstance().getUserDataManager()[a(392)]()[a(387)]("trackerLinkData",{trackingId:null,coins:null},!0),!1}return!0},onCoinUpdate:function(){RSCasinoManager.addPrimaryCurrency(0)},onPopupClosed:function(){var a=a0_0xd52a;this[a(367)]&& (this[a(367)](),this[a(367)]=null)}});return{getInstance:function(){return!a&&(a=new b),a}}}();function a0_0xb3b1(){var a="4367109NOCTBe _sevenDayBonusData 248684aVClSj isPurchaseEnabled 81949njMWQD _isSweepstakesEnabled _userGroup gcowRewardedCount _isCCPA _super 59485Rdwcir time _isFPVPUserMigrated 27039240Jittjj _gameDataSource 484VYqeBF 516qLkzbJ 3552696bTXkjA isCCPA call _gdprUrl sevenDayBonus _gcowRewardedCount _loyaltyUrl isSubscriptionEnabled _isSubscriptionEnabled init 4771548XfESDK isSweepstakesEnabled gameDataSource isGDPR extend loyaltyUrl GDPRUrl _isGDPR _time 1cBMsZy _isPurchaseEnabled _backgroundSessionTimeout".split(" "); a0_0xb3b1=function(){return a};return a0_0xb3b1()}var a0_0x51e01e=a0_0x270f;(function(a,b){for(var c=a0_0x270f,d=a();;)try{if(-parseInt(c(314))/1*(parseInt(c(319))/2)+-parseInt(c(317))/3+parseInt(c(332))/4*(-parseInt(c(327))/5)+parseInt(c(333))/6*(parseInt(c(321))/7)+-parseInt(c(334))/8+parseInt(c(305))/9+parseInt(c(330))/10===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0xb3b1,777229); function a0_0x270f(a,b){var c=a0_0xb3b1();return a0_0x270f=function(a,b){return c[a-300]},a0_0x270f(a,b)} var GameVariables=RSClass[a0_0x51e01e(309)]({_isPurchaseEnabled:!0,_sevenDayBonusData:{},_time:0,_userGroup:"",_isGDPR:!1,_gdprUrl:"",_backgroundSessionTimeout:0,_isSubscriptionEnabled:0,_gcowRewardedCount:0,_isCCPA:!1,_isFPVPUserMigrated:!1,init:function(){var a=a0_0x51e01e;this[a(326)][a(304)][a(336)](this)},initializeData:function(a){var b=a0_0x51e01e;this[b(313)]=a[b(328)]?a.time:0;this._isPurchaseEnabled=a[b(320)];this[b(323)]=a.user_group?a.user_group:"A";this[b(318)]=a[b(338)]?a[b(338)]:null; this[b(312)]=a[b(308)];this[b(337)]=a[b(311)];this[b(325)]=a[b(335)]?a[b(335)]:!1;this[b(316)]=a.backgroundSessionTimeout;this._loyaltyUrl=a.loyaltyUrl?a[b(310)]:null;this[b(331)]=a[b(307)]?a[b(307)]:"A";this[b(322)]=a[b(306)]?a[b(306)]:!1;this[b(303)]=a[b(302)]?a[b(302)]:0;this[b(300)]=a[b(324)]?parseInt(a.gcowRewardedCount):0;this[b(329)]=a.isFPVPUserMigrated?a.isFPVPUserMigrated:!1},isGDPR:function(){return this[a0_0x51e01e(312)]},getGDPRUrl:function(){return this[a0_0x51e01e(337)]},isPurchaseEnabled:function(){return this[a0_0x51e01e(315)]}, getTimeOnInit:function(){return this._time},getSevenDayBonusData:function(){return this[a0_0x51e01e(318)]},isSubscriptionEnabled:function(){return this[a0_0x51e01e(303)]},getUserGroup:function(){return this._userGroup},getBackgroundSessionTimeout:function(){return this[a0_0x51e01e(316)]},getLoyaltyUrl:function(){return this[a0_0x51e01e(301)]},getgameDataSource:function(){return this[a0_0x51e01e(331)]},getSweepstakeEnabledStatus:function(){return this[a0_0x51e01e(322)]},isCCPA:function(){return this[a0_0x51e01e(325)]}, incrementGCOWRewardedCount:function(){this._gcowRewardedCount++},geGCOWRewardedCount:function(){return this._gcowRewardedCount},getFPVPUserMigratedStatus:function(){return this[a0_0x51e01e(329)]}});var IScreenFactory=new Interface("IScreenFactory","getLoadingScreen getMachineLoaderScreen getMainLobbyScreen getBingoSubLobby getSlotsSubLobby getPokerSubLobby getBlackjackSubLobby getKenoSubLobby getBonusSubLobby getVipSubLobby getFavoritesSubLobby getTableGamesSubLobby".split(" ")),RSGameTypes={Slots:"slots",Poker:"poker",Bingo:"bingo",Blackjack:"blackjack",Trivia:"trivia",Keno:"keno",Roulette:"Roulette",Scratcher:"scratcher",Scorebox:"scorebox",TableGames:"tablegames"},RSGame=function(){var a, b=RSClass.extend({_tutorialManager:null,_isScreenFactorySet:!1,_idPrefix:"",_dataManager:null,_gameData:null,_gameManager:null,_loadingManager:null,_gameTypeFactor:127,_timeManager:TimeManager.getInstance(),_rsPwa:null,_hardwareInfo:null,_loginMode:null,_platformType:null,_urlNotificationManager:UrlNotificationManager.getInstance(),_errorTracker:RSErrorTracker.getInstance(),_analyticsManager:RSAnalyticsManager.getInstance(),_levelManager:null,_platformEventManager:null,_gameVariables:new GameVariables, _gameConfiguration:null,_gameFolderList:{},_resourceConfigData:null,_resourceGroupConfigData:null,_losingStreakManager:null,_getInitCalled:!1,_initialResourcesLoaded:!1,_customLobbyResources:[],_customLobbyRetryCount:0,_languageConfigData:null,init:function(){this._super.init.call(this)},setPlatform:function(a){RSEngine.layout=a.LAYOUT_SUFFIX;RSEngine.screenWidth=a.SCREEN_WIDTH;RSEngine.screenHeight=a.SCREEN_HEIGHT;this._platformType=a.PLATFORM;this._loginMode=RSEngine.loginMode;RS_ERROR_TRACKER_SHOW_DEBUG_LOG= a.SHOW_DEBUG_LOG},initialize:function(a,b,e){this._gameConfiguration=b;this._resourceConfigFile=e;RSGame.getInstance().populateHardwareInfo();RSGameScreenManager.getInstance().setScreenFactory(b.getScreenFactory());this._isScreenFactorySet=!0;a&&(RSEngine.userConfig=a,RSEngine.loginMode=a.loginMode,GameFeatureTypeEnum.CLIENT_SIDE_SIGNIN&&(RSLoginManager.getInstance().isURLParamsPresent()&&RSLoginManager.getInstance().fetchURLParamsAndSetCookieToNewDomain(),RSLoginManager.getInstance().initFormValidation())); cc.log("Initializing RSEngine");this.setPlatform(GameConfig);this._idPrefix=GameConfig.USER_ID_PREFIX;a=void 0;RSEngine.loginMode==LOGIN_MODE.INSTANT_GAME&&(a="Portrait");RSEngine.initialize(GameConfig.PLATFORM,GameConfig.LAYOUT_SUFFIX,a,void 0,this.isFBGameRoom());RSEngine.initializeNetworkManager(GameConfig.JSON_RPC_PATH);RSEngine.setHashKey(GameConfig.HASH_KEY);RSEngine.setGameVersion(GameConfig.VERSION);this.setCustomManagers(b.getUserDataManager(),b.getGameData(),b.getLevelManager(),b.getGameManager(), b.getPlatformEventManager());GameConfig.CUSTOM_LOBBY?this.getCustomLobbyEventFromDashboard(null):this.continueLoadingAfterFetchingCustomLobby()},getCustomLobbyEventFromDashboard:function(a){var b={};b.user_id=a;RSEngine.networkManager.getEventStatusFromDashBoard("getCustomAssets",b,this.customLobbyResponseSuccess.bind(this),this.continueLoadingAfterFetchingCustomLobby.bind(this))},customLobbyResponseSuccess:function(a){this._modifiedData=null;null!=a&&void 0!=a.data&&(GlobalVars.customLobbyStatus= !0,this._modifiedData=RSUtils.cloneJSON(this.modifyJsonFormat(a.data)));null!=this._modifiedData?null==RSEngine.dataManager.getMe()?(this.modifyResourceConfigWithCustomLobbyData(),this.continueLoadingAfterFetchingCustomLobby()):(this._customLobbyResources=this.getCustomLobbyAssetList(a.data),this.startCustomLobbyAssetLoading(),this.modifyResourceConfigWithCustomLobbyData()):null==RSEngine.dataManager.getMe()&&this.continueLoadingAfterFetchingCustomLobby()},startCustomLobbyAssetLoading:function(){var a= this;cc.loader.load(a._customLobbyResources,function(a,b,c){console.log("loading success")},function(b){b&&a._onErrorLoading(b)})},_onErrorLoading:function(a){this._customLobbyRetryCount++;if(3>=this._customLobbyRetryCount){for(var b=this.resources.length=0;b<a.length;b++)a[b]&&this.resources.push(a[b].url);this.startCustomLobbyAssetLoading()}else RSCasinoManager.notifyLoadingFailureToCasino(a)},modifyResourceConfigWithCustomLobbyData:function(){if(this._modifiedData)for(var a in this._modifiedData)this._resourceConfigData.hasOwnProperty(a)&& (this._resourceConfigData[a]=this._modifiedData[a])},modifyJsonFormat:function(a){if(void 0!=a&&null!=a){var b={},e;for(e in a)if(0!=a[e].status){var f=a[e].type,g=a[e].files;if(null!=f)for(var h=RSGame.getInstance().getAssetCount(f),k=0;k<h;k++)cc.spriteFrameCache.removeSpriteFramesFromFile(RSGame.getInstance().getAssetPath(f)+"_0"+k+"-hd.plist");var k=[],h=!1,m;for(m in g){var h=g[m].assetLink.indexOf(".mp3"),n=g[m].assetLink.substr(g[m].assetLink.lastIndexOf("/")+1,g[m].assetLink.length);k[m]= '"'+n+'"'}n=g[0].assetLink.substr(0,g[0].assetLink.lastIndexOf("/")+1);g=f;f=-1==h?f:f+".mp3";k=JSON.parse('{"path":"'+n+'","name":"'+f+'","file":['+k+"]}");-1==h?b[f]=k:b[g]=k}return b}},getCustomLobbyAssetList:function(a){var b=[],e;for(e in a){var f=a[e].files,g;for(g in f)b.push(f[g].assetLink)}return b},continueLoadingAfterFetchingCustomLobby:function(){this._resourceConfigData?(this.resourceCrossCheck(),this.loadGameScene(this.getGroupedAssetList("InitialLoading"))):this.loadGameResources(this._resourceConfigFile, this.loadGameScene.bind(this));this.initializeTutorialManager();RSEngine.loginMode==LOGIN_MODE.FACEBOOK&&this.autoScrollForFB()},populateHardwareInfo:function(){try{this._hardwareInfo={hardwareConcurrency:-1,connection:{},deviceMemory:-1},this._hardwareInfo.hardwareConcurrency=navigator.hardwareConcurrency,this._hardwareInfo.connection={downlink:-1,downlinkMax:-1,effectiveType:"NA",rtt:-1,saveData:!1,type:"NA"},this._hardwareInfo.connection.downlink=navigator.connection.downlink?navigator.connection.downlink: -1,this._hardwareInfo.connection.downlinkMax=navigator.connection.downlinkMax?navigator.connection.downlinkMax:-1,this._hardwareInfo.connection.effectiveType=navigator.connection.effectiveType?navigator.connection.effectiveType:"NA",this._hardwareInfo.connection.rtt=navigator.connection.rtt?navigator.connection.rtt:-1,this._hardwareInfo.connection.saveData=navigator.connection.saveData?navigator.connection.saveData:!1,this._hardwareInfo.connection.type=navigator.connection.type?navigator.connection.type: "NA",this._hardwareInfo.deviceMemory=navigator.deviceMemory}catch(a){cc.log("exception")}},getHardwareInfo:function(){return JSON.stringify(this._hardwareInfo)},autoScrollForFB:function(){},forcedWindowResize:function(){if("function"===typeof Event)window.dispatchEvent(new Event("resize"));else{var a=window.document.createEvent("UIEvents");a.initUIEvent("resize",!0,!1,window,0);window.dispatchEvent(a)}},isFBGameRoom:function(){var a=this._getQueryStringValue("is_arcade");return void 0!=a&&""!=a&& ("1"==a||1==a)},_getQueryStringValue:function(a){return decodeURIComponent(window.location.search.replace(RegExp("^(?:.*[\x26\\?]"+encodeURIComponent(a).replace(/[\.\+\*]/g,"\\$\x26")+"(?:\\\x3d([^\x26]*))?)?.*$","i"),"$1"))},resourceCrossCheck:function(){if(GameConfig.CHEAT_MODE){var a=this._resourceConfigData,b=this._resourceGroupConfigData,e=0,f;for(f in a){var e=0,g;for(g in b)if(0<=b[g].indexOf(f)){e=1;break}e||console.log(f+"\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e\x3e resource not found")}}}, onMainLobbyRevealed:function(){this.forcedWindowResize()},loadGameResources:function(a,b,e){var f=this;cc.loader.load(a,function(a,c){if(null!==a)console.log(a);else{var k=[],m=c[0].list,n;for(n in m){var p=m[n].folder,r=m[n].files;RSEngine.userConfig.doubleResolutionEnabled&&(p+="_2X");f._gameFolderList[m[n].folder]=p+"/";for(var s in r)k.push(p+"/"+r[s])}b(k,e)}})},getResourceFolderFor:function(a){return this._gameFolderList[a]},initialLoadingComplete:function(){var a=this,b=GameConfig.COOKIE_PREFIX; if(GameConfig.SSO_ENABLED&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK){var e=RSLoginManager.getInstance().getCookie(b+"-loggedIn"),f=RSLoginManager.getInstance().getCookie("fbLoggedIn"),g=RSLoginManager.getInstance().getCookie(b+"-loginType"),h=RSLoginManager.getInstance().getCookie(b+"-blobId");if(g&&(g.includes("apple")||g.includes("email")||g.includes("google")||g.includes("facebook")))if(RSEngine.userConfig.userId=h,RSEngine.userConfig.email=RSLoginManager.getInstance().getCookie(b+"-email"),RSEngine.loginMode= LOGIN_MODE.EMAIL,g.includes("google"))GameConfig.GOOGLE_IDENTITY_SERVICES_ENABLED?this.googleInitializationCompleted(g):initializeGoogleSignIn(!1,this.googleInitializationCompleted.bind(this,g));else if(g.includes("facebook"))try{RSEngine.initializeFacebook(facebook),RSSocialManager.getInstance().checkFBConnected(function(b){"connected"==b?RSFBManager.getInstance().getUserID()==RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-fbId")?(RSEngine.loginMode=LOGIN_MODE.WEB_FACEBOOK,a.loadGame()): RSLoginManager.getInstance().removeLoginData("facebook",!0):RSLoginManager.getInstance().removeLoginData("facebook",!0)})}catch(k){RSLoginManager.getInstance().removeLoginData("facebook",!0)}else this.loadGame();else if("true"==f){console.log("Facebook cookie detected");try{RSEngine.initializeFacebook(facebook),RSSocialManager.getInstance().checkFBConnected(function(b){"connected"==b?(RSEngine.loginMode=LOGIN_MODE.WEB_FACEBOOK,a.loadGame()):(b=new RSFBPermissionRequestScreen(!0),RSEngine.screenManager.loadNewScreen(b))})}catch(m){b= new RSFBPermissionRequestScreen(!0),RSEngine.screenManager.loadNewScreen(b)}}else e?(console.log("Email cookie detected"),"true"==e||null!=e&&"false"!=e?(b=RSLoginManager.getInstance().getCookie(b+"-value"),void 0!=b&&RSLoginManager.getInstance().loginWithCookie()):(RSEngine.loginMode=LOGIN_MODE.GUEST,GameConfig.LOADING_MODULE_ENABLED||this.loadGame())):(RSEngine.loginMode=LOGIN_MODE.GUEST,GameConfig.LOADING_MODULE_ENABLED||this.loadGame());RSEngine.loginMode==LOGIN_MODE.GUEST&&GameConfig.LOADING_MODULE_ENABLED&& (b=new RSLoginModule(RSGame.getInstance().getAssetPath("OnBoardingScreen")),RSEngine.screenManager.loadNewScreen(b))}else if(RSEngine.loginMode==LOGIN_MODE.GUEST&&GameFeatureTypeEnum.CLIENT_SIDE_SIGNIN&&(e=RSLoginManager.getInstance().getCookie(b+"-loggedIn"),f=RSLoginManager.getInstance().getCookie("fbLoggedIn"),"true"==f?RSEngine.loginMode=LOGIN_MODE.WEB_FACEBOOK:"true"==e||null!=e&&"false"!=e?(b=RSLoginManager.getInstance().getCookie(b+"-value"),void 0!=b&&RSLoginManager.getInstance().loginWithCookie()): null!=e&&(RSLoginManager.getInstance().showLandingPage(),RSEngine.audioManager.muteMusic(),RSEngine.audioManager.muteEffects())),RSEngine.loginMode==LOGIN_MODE.GUEST||RSEngine.loginMode==LOGIN_MODE.EMAIL||RSEngine.loginMode==LOGIN_MODE.INSTANT_GAME)this.loadGame();else try{RSEngine.initializeFacebook(facebook),RSSocialManager.getInstance().checkFBConnected(function(b){"connected"==b?a.loadGame():(b=new RSFBPermissionRequestScreen,RSEngine.screenManager.loadNewScreen(b))})}catch(n){b=new RSFBPermissionRequestScreen, RSEngine.screenManager.loadNewScreen(b)}},loadGameScene:function(a){this._initialResourcesLoaded=!1;this.callGetInitConfig();var b=new RSGameScene;RSEngine.screenManager.loadNewScene(b,a,GameConfig.BASE_URL+"/"+GameConfig.LOADING_ICON_NAME,this.onGameSceneLoaded.bind(this))},onGameSceneLoaded:function(){this._initialResourcesLoaded=!0;this.onInitialLoadingUpdate()},callGetInitConfig:function(){this._getInitCalled=!1;var a=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId"); if(a&&GameConfig.LOADING_MODULE_ENABLED&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK)RSGame.getInstance().getUserDataManager().getInitConfig(a,this.onGetInitCallComplete.bind(this),this.onGetInitCallComplete.bind(this));else this.onGetInitCallComplete()},onGetInitCallComplete:function(a){this._getInitCalled=!0;a&&a.result.data.isDeletedUser&&RSLoginManager.getInstance().removeAllCookieDetails();this.onInitialLoadingUpdate()},onInitialLoadingUpdate:function(){this._initialResourcesLoaded&&this._getInitCalled&& this.initialLoadingComplete()},googleInitializationCompleted:function(a){if(!GameConfig.GOOGLE_IDENTITY_SERVICES_ENABLED&&getSignedInStatus())if(gapi.auth2.getAuthInstance().currentUser.get().getBasicProfile().getId()==RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-googleId"))RSEngine.loginMode=LOGIN_MODE.EMAIL;else{RSLoginManager.getInstance().removeLoginData("google",!0);return}else if(GameConfig.GOOGLE_IDENTITY_SERVICES_ENABLED&&RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+ "-googleId"))RSEngine.loginMode=LOGIN_MODE.EMAIL;else{RSLoginManager.getInstance().removeLoginData("google",!0);return}var b=this;if(a.includes("facebook"))try{RSEngine.initializeFacebook(facebook),RSSocialManager.getInstance().checkFBConnected(function(a){"connected"==a?RSFBManager.getInstance().getUserID()==RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-fbId")?(RSEngine.loginMode=LOGIN_MODE.WEB_FACEBOOK,b.loadGame()):RSLoginManager.getInstance().removeLoginData("facebook",!0): RSLoginManager.getInstance().removeLoginData("facebook",!0)})}catch(e){RSLoginManager.getInstance().removeLoginData("facebook",!0)}else this.loadGame()},initializeTutorialManager:function(){this._tutorialManager=new RSTutorialManager},getTutorialManager:function(){return this._tutorialManager},getStringDictionary:function(a){var b=[];return b=this._languageConfigData[a]},getAssetList:function(a){var b=[],e=this._resourceConfigData[a].file,f;for(f in e)b.push(this.getAssetFolder(a)+e[f]);return b}, getAssetFolder:function(a){if(-1!=this._resourceConfigData[a].path.indexOf("{project_name}")){var b=(new URLSearchParams(window.location.search)).get("gameName");return this._resourceConfigData[a].path.replace("{project_name}",b)}return this._resourceConfigData[a].path},getAssetPath:function(a){return this._resourceConfigData[a]?this.getAssetFolder(a)+this._resourceConfigData[a].name:null},getAssetCount:function(a){if(!this._resourceConfigData[a]||!this._resourceConfigData[a].file)return null;var b= 0,e;for(e in this._resourceConfigData[a].file)!0==RSUtils.isStringContains(this._resourceConfigData[a].file[e],".png")&&b++;return b},getGroupedAssetList:function(a){var b=[];a=this._resourceGroupConfigData[a];for(var e in a)b=b.concat(this.getAssetList(a[e]));return b},setCustomManagers:function(a,b,e,f,g){this._dataManager=a;this._gameData=b;this._gameManager=f;RSEngine.dataManager=this._dataManager;RSEngine.gameData=this._gameData;this._levelManager=e;this._platformEventManager=g},getLosingStreakManager:function(){null== this._losingStreakManager&&(this._losingStreakManager=new RSLosingStreakManager);return this._losingStreakManager},getPlatformType:function(){return this._platformType},getLoginMode:function(){return this._loginMode},getUserDataManager:function(){return this._dataManager},getGameManager:function(){return this._gameManager},getAnalyticsManager:function(){return this._analyticsManager},getLevelManager:function(){return this._levelManager},getGameVariable:function(){return this._gameVariables},getGameData:function(){return this._gameData}, getUrlNotificationManager:function(){return this._urlNotificationManager},getPlatformEventManager:function(){return this._platformEventManager},getUserIdPrefix:function(){return this._idPrefix},getErrorTracker:function(){return this._errorTracker},getTimeManager:function(){return this._timeManager},setLoadingManager:function(a){this._loadingManager=a},getScreenFactory:function(){return this._gameConfiguration.getScreenFactory()},initRSPwa:function(){this._rsPwa=window.RSPWA?RSPWA({}):{showCustomInstall:function(){console.log("PWAnotfound...")}}}, getRSPWAManager:function(){null==this._rsPwa&&this.initRSPwa();return this._rsPwa},getGameTypeFactor:function(){return this._gameTypeFactor},getLoadingManger:function(){return this._loadingManager},loadGame:function(){RSGameScreenManager.getInstance().loadGame()},loadScreen:function(a){RSGameScreenManager.getInstance().loadScreen(a)}});return{getInstance:function(){a||(a=new b);return a}}}();var RSFBPermissionRequestScreen=RSGameScreen.extend({init:function(a){this._super.init.call(this);this._playNowButton=null;this._retainSession=a},loadContent:function(){RSGame.getInstance()._resourceConfigData?this.layoutScreen(RSGame.getInstance().getAssetPath("PermissionScreen")):this.layoutScreen(RSGame.getInstance().getResourceFolderFor("res/LoadingScreen")+"PermissionScreen")},onAssetLoaded:function(a){this._super.onAssetLoaded.call(this,a)},onLayoutCompleted:function(){this._super.onLayoutCompleted(); RSEngine.loginMode==LOGIN_MODE.FACEBOOK&&RSSocialManager.getInstance().showPermissionDialog("email",this._onFbInitComplete.bind(this));document.getElementsByClassName("gameCanvas")[0].style.visibility="visible";var a=document.getElementById("loader");null!=a&&(a.style.visibility="hidden",a.innerHTML="#")},_onFbInitComplete:function(a,b){a?(RSErrorTracker.getInstance().trackErrorMessage("FACEBOOK_PERMISSION","Response From FB Initialisation: code:"+a+", message:"+b.error_message,"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"), cc.log("Response From FB Initialisation: code:"+a+", message:"+b.error_message),this._playNowButton&&this._playNowButton.setVisible(!0)):(this._retainSession&&(RSEngine.loginMode=LOGIN_MODE.WEB_FACEBOOK),RSGame.getInstance().loadGame())},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);"Animation"==c.type&&(a.stopAnimation(),a.playAnimation(-1,0.15));switch(c.name){case "PlayNowBtn":this._playNowButton=a,a.setVisible(!0)}},onButtonClicked:function(a){switch(a){case "PlayNowBtn":RSSocialManager.getInstance().showPermissionDialog("email", this._onFbInitComplete.bind(this))}},unloadContent:function(){this._super.unloadContent.call(this)}});var RSGameScreens={MainLobby:"main_lobby",SlotsLobby:"slots_lobby",PokerLobby:"poker_lobby",BingoLobby:"bingo_lobby",BlackJackLobby:"blackjack_lobby",KenoLobby:"keno_lobby",KenoBingoLobby:"kenobingo_lobby",ScratcherLobby:"scratcher_lobby",BonusLobby:"bonus_lobby",VIPLobby:"vip_lobby",TableGamesLobby:"tablegames_lobby",Machine:"gameplay_screen",JackpotMainLobby:"jackpot_lobby",FavoritesLobby:"my_favorites",CustomScreens:CUSTOM_LOBBY_SCREENS?CUSTOM_LOBBY_SCREENS:{}},RS_SCREEN_LOADED={},RSGameScreenManager= function(){var a,b=RSClass.extend({_screens:[],_removedLobbyName:null,_screenFactory:null,_oldLobbyName:null,setScreenFactory:function(a){a.implements(IScreenFactory);this._screenFactory=a},getScreenFactory:function(){return this._screenFactory},loadGame:function(){this._screens.push(RSGameScreens.MainLobby);RSAnalyticsManager.getInstance().pushCurrentScreen(RSGameScreens.MainLobby);RS_SCREEN_LOADED[RSGameScreens.MainLobby]=!0;RSGame.getInstance()._resourceConfigData?RSGame.getInstance().setLoadingManager(new RSLoadingManager(RSGame.getInstance().getGroupedAssetList(RSGameScreens.MainLobby), this._screenFactory.getMainLobbyScreen())):RSGame.getInstance().setLoadingManager(new RSLoadingManager(this._screenFactory.getResourceListLobby(RSGameScreens.MainLobby),this._screenFactory.getMainLobbyScreen()));var a=this._screenFactory.getLoadingScreen(),b=this._screenFactory.getIntermediateScreens();RSGame.getInstance().getLoadingManger().setLoadingScreenView(a);b&&RSGame.getInstance().getLoadingManger().setIntermediateScreens(b);RSEngine.screenManager.loadNewScreen(a);RSGame.getInstance().getLoadingManger().initializeLoading()}, loadMachine:function(a,b,e){this._screens.push(RSGameScreens.Machine);RSAnalyticsManager.getInstance().pushCurrentScreen(RSGameScreens.Machine);var f=document.getElementById("ProgressBG");f&&(f.childNodes[1].style.width="0%");RSEngine.screenManager.loadNewScreen(new RSMachineLoader(a,revision,b,e,f,null))},loadExternalGame:function(a){this._screens.push(RSGameScreens.Machine);RSAnalyticsManager.getInstance().pushCurrentScreen(RSGameScreens.Machine);RSEngine.externalGameManager.loadExternalGame(a)}, loadScreen:function(a){this._screens.push(a);RSAnalyticsManager.getInstance().pushCurrentScreen(a);this.load(a)},setPreviousScreen:function(a){1<=this._screens.length&&this._screens[this._screens.length-1]!=a&&this._screens.push(a)},removeAllScreensExceptMainLobby:function(){for(;1<this._screens.length;)this._screens.pop();RSAnalyticsManager.getInstance().removeAllScreensExceptMainLobby()},loadPreviousScreen:function(){if(!(1>=this._screens.length)){do this._removedLobbyName=this._screens[this._screens.length- 1],this._screens.pop(),RSAnalyticsManager.getInstance().popCurrentScreen();while(this._screens[this._screens.length-1]==RSGameScreens.Machine);var a=this._screens[this._screens.length-1];this.load(a);this.updateCoinXpLevelToPlatform(a)}},load:function(a){var b,e;switch(a){case RSGameScreens.MainLobby:b=this._screenFactory.getMainLobbyScreen();e=[];break;default:var f=!1,g;for(g in RSGameScreens.CustomScreens)if(a==RSGameScreens.CustomScreens[g]){f=!0;b=this._screenFactory.getSubLobby(g);e=this._screenFactory.getResourceListLobby(g); break}f||(b=this._screenFactory.getSubLobby(a),e=this._screenFactory.getResourceListLobby(a))}this._removedLobbyName!=RSGameScreens.Machine&&(f=null,f=this._oldLobbyName?this._oldLobbyName:RSGameScreenManager.getInstance().getPreviousScreen(),RSGameScreenManager.getInstance().getCurrentScreen()==RSGameScreens.MainLobby&&null!==this._removedLobbyName&&(this._oldLobbyName=null,f=this._removedLobbyName),RSAnalyticsManager.getInstance().trackLobbyEntry(a,"","open_from_"+f),this._oldLobbyName==RSGameScreens.JackpotMainLobby&& (this._oldLobbyName=null));this._removedLobbyName=null;null==RS_SCREEN_LOADED[a]?(RS_SCREEN_LOADED[a]=!0,RSEngine.screenManager.loadNewScreen(new RSSecondaryLoadingScreen(e,b))):RSEngine.screenManager.loadNewScreen(b)},getCurrentScreen:function(){return this._screens[this._screens.length-1]},getPreviousScreen:function(){return 1<this._screens.length?this._screens[this._screens.length-2]:this._screens[this._screens.length-1]},setCurrentLobbyName:function(a){this._oldLobbyName=a},updateCoinXpLevelToPlatform:function(a){var b= "";switch(a){case RSGameScreens.MainLobby:b="lobby";break;case RSGameScreens.SlotsLobby:b="slotslobby";break;case RSGameScreens.PokerLobby:b="pokerlobby";break;case RSGameScreens.BingoLobby:b="bingolobby";break;case RSGameScreens.KenoLobby:b="kenolobby";break;case RSGameScreens.KenoBingoLobby:b="kenolobby";break;case RSGameScreens.BlackJackLobby:b="blackjacklobby";break;case RSGameScreens.VIPLobby:b="viplobby";break;case RSGameScreens.TableGamesLobby:b="blackjacklobby";break;case RSGameScreens.FavoritesLobby:b= "favoriteslobby";break;default:for(var e in RSGameScreens.CustomScreens)a==RSGameScreens.CustomScreens[e]&&(b=RSGameScreens.CustomScreens[e])}"AP"==GameConfig.GAME_ID||"UP"==GameConfig.GAME_ID||"CS"==GameConfig.GAME_ID?RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.returnToLobby,"",b):""!=b&&(RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName().includes("B_")&&(b="bingolobby"),RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName().includes("R_")&&(b="roulettelobby"), RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.returnToLobby,"",b),"lobby"!=b&&this.updateCoinXpLevel())},updateCoinXpLevel:function(){var a=RSEngine.dataManager.getMe().getCoins(),b=RSEngine.dataManager.getMe().getXP(),e=RSEngine.dataManager.getMe().getUserLevel();RSPlatformSDKManager.getInstance().updateCoinXpLevel(a,b,e)}});return{getInstance:function(){a||(a=new b);return a}}}();var ScreenFactory=RSClass.extend({_lobbyResource:null,init:function(){this._super.init.call(this);this._lobbyResource={};if(!RSGame.getInstance()._resourceConfigData)for(var a in LOBBY_ASSET_CONFIG)RSGame.getInstance().loadGameResources(LOBBY_ASSET_CONFIG[a],this.setResourceListLobby.bind(this),a)},setResourceListLobby:function(a,b){this._lobbyResource[b]=a},getResourceListLobby:function(a){return RSGame.getInstance()._resourceConfigData?RSGame.getInstance().getGroupedAssetList(a):this._lobbyResource[a]}, getIntermediateScreens:function(){return null},getSubLobby:function(a){return null},getLoadingScreen:function(){return new RSLoadingScreenV2("res/LoadingScreen/MSP/MSP_LoadingScreen")},getMachineLoaderScreen:function(){return null},getMainLobbyScreen:function(){return null},getBingoSubLobby:function(){return null},getSlotsSubLobby:function(){return null},getPokerSubLobby:function(){return null},getBlackjackSubLobby:function(){return null},getTableGamesSubLobby:function(){return null},getKenoSubLobby:function(){return null}, getScratcherSubLobby:function(){return null},getBonusSubLobby:function(){return null},getVipSubLobby:function(){return null}});var RSGameManager=RSClass.extend({_unlockObj:{unlockList0:[],unlockList1:[],unlockList2:[],unlockList3:[],unlockList4:[],unlockList5:[],unlockList6:[]},MAX_BITS:32,_mainLobbyLoadedTime:null,_newMachineData:null,init:function(){this._super.init.call(this);this._loyaltyRewardPoints=this._yfageoToken=this._fincoreToken=this._ainsworthToken=this._rocketManToken=this._highFiveToken=this._wazdenRGSToken=this._oddsWorksToken=this._risingDigitalToken=this._agsGameToken=this._everiGameToken=this._token=this._startTime= this._currentMachineVO=this._currentMachineAnalytics=this._currentMachine=this._gameType="";this._userAccountDeleted=this._loyaltyMallActive=!1;this._dailyBonusScreen=null;this._machineOpenPopupAssets={poker:"",slots:"",blackjack:"",keno:"",bingo:"",scratcher:"",tablegames:""};this._machineOpenPopupEnabled=!0;this._purchaseCancelledCount=0;this._purchaseCancelledCallBack=null;this._currentVolumeStatus=[];this._previewType=this._previewMachine=null;this._bingoCardCount=0;this._isCurrentMachineInternal= this._isGiftAvailableForGuestUsers=this._externalBonusSpinActive=this._machineOpenPopupStatus=!1;this.machineOpenY=this.machineOpenX=null;this.forceTriggerDailyQuestPopup=this._ssoReloadWithLoadingScreen=this._ssoMainLobbyReload=this._isVIPTakeMeButtonClicked=this._isMachineUnlockPopupActive=!1;this._loadedMachineDetails={machineType:"",machineAnalyticsName:"",triggeredFrom:"",previewType:"",defaultBet:""};this._mainLobbyLoadedTime=null;this._emailOptOutFailedCount=0;this._locToasterActive=!1;this._minBetOfLastPlayedMachine= 0;this._analyticsNameOfLastPlayedMachine="";this._optOutStatus=null;this.machinePlayed=!1},getName:function(){return"RSGameManager"},initializeQuest:function(){RSEngine.loginMode!=LOGIN_MODE.GUEST&&RSQuestManager.getInstance().getIsQuestManagerActive()&&(this.forceTriggerDailyQuestPopup=!1,RSQuestManager.getInstance().setUserQuestData(RSEngine.dataManager.getMe().getDailyChallengeData()),RSQuestManager.getInstance().initializeWithDataForQuest(RSEngine.gameData.getQuestSheetNames(),RSGame.getInstance().getGameData().getSheetData("questConfig")), RSQuestManager.getInstance().setUserObjectiveStatus(),RSQuestManager.getInstance().SetActiveQuest(),RSEngine.dataManager.getMe().getDailyChallengeData().megaChallenge&&RSMegaChallengeManager.getInstance().initializeWithDataForMegaChallenges(RSEngine.dataManager.getMe().getDailyChallengeData().megaChallenge))},setUserAccountDeleted:function(){this._userAccountDeleted=!0},getUserAccountDeleted:function(){return this._userAccountDeleted},refreshQuestData:function(){RSQuestManager.getInstance().setUserQuestData(RSEngine.dataManager.getMe().getDailyChallengeData()); RSQuestManager.getInstance().initializeWithDataForQuest(RSEngine.gameData.getQuestSheetNames(),RSGame.getInstance().getGameData().getSheetData("questConfig"));RSQuestManager.getInstance().setUserObjectiveStatus();RSQuestManager.getInstance().SetActiveQuest(!0);RSMegaChallengeManager.getInstance().initializeWithDataForMegaChallenges(RSEngine.dataManager.getMe().getDailyChallengeData().megaChallenge);SideMenuController.getInstance().updateNotificationCounter()},initializeAchievements:function(){RSEventManager.getInstance().addEventListener("onAchievementUpdated", this,this.onAchievementUpdated.bind(this));RSEventManager.getInstance().addEventListener("onAchievementCompleted",this,this.onAchievementCompleted.bind(this));AchievementManager.getInstance().initializeAchievements(RSEngine.gameData.getAchievements(),RSEngine.dataManager._me.getAchievementData());RSEngine.dataManager._me.setAchievementData(AchievementManager.getInstance().getObjectives())},onAchievementCompleted:function(a){cc.log("Achievement Completed - ");a._userData._achievementId&&(RSGame.getInstance().getUserDataManager().getMe().setAchievement(a._userData._achievementId, 0),RSGame.getInstance().getUserDataManager().saveUserData("achievements"))},onAchievementUpdated:function(a){RSGame.getInstance().getUserDataManager().getMe().setAchievementData(AchievementManager.getInstance().getObjectives());RSGame.getInstance().getUserDataManager().saveUserData("Achievementupdated")},_isMachineUnlocked:function(a){var b=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots),c=parseInt(RSGame.getInstance().getLevelManager().getCurrentLevelVO().level),d=this.isVipEnabled()? parseInt(RSVIPManager.getInstance().getVIPUserTier()):0;return parseInt(b[a].levelRequired)<=c||parseInt(b[a].VIPTier)<=d&&0<parseInt(b[a].VIPTier)},initializeMachineUnlock:function(){var a=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots);this._intializeUnlockObj();for(var b=0;b<a.length;b++)this._isMachineUnlocked(b)&&this._setUnlock(a[b].machine_type);this.updateMachineUnlockBlob()},showGameOverlay:function(){null!=document.getElementById("gameOverLay")&&$("#gameOverLay").show()}, hideGameOverlay:function(){null!=document.getElementById("gameOverLay")&&$("#gameOverLay").hide()},getUnlockedMachinesDetails:function(){for(var a=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots),b=[],c=0;c<a.length;c++)this._isMachineUnlocked(c)&&(1!=this.getFinalUnlockList()[a[c].machine_type]&&b.push(a[c]),this._setUnlock(a[c].machine_type));return b},getNextToUnlockMachines:function(){var a=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots),b=parseInt(RSGame.getInstance().getLevelManager().getCurrentLevel())+ 1;parseInt(RSVIPManager.getInstance().getVIPUserTier());for(var c=[],d=0;d<a.length;d++)if(parseInt(a[d].levelRequired)>=b&&0===parseInt(a[d].VIPTier)){c.push(a[d]);break}return c?c:[]},_setUnlockObjFromBlob:function(){for(var a=0;7>a;a++)if(RSGame.getInstance().getUserDataManager().getMe().getMachineUnlockList(a)){var b=RSGame.getInstance().getUserDataManager().getMe().getMachineUnlockList(a).toString(2).split("").slice().reverse();if(parseInt(b.join("")))for(var c=0;c<b.length;c++)0<b[c]&&this._setUnlock(a* this.MAX_BITS+parseInt(c))}},_intializeUnlockObj:function(){for(var a in this._unlockObj)for(var b=0;b<this.MAX_BITS;b++)this._unlockObj[a][b]=0;this._setUnlockObjFromBlob()},_setUnlock:function(a){var b=parseInt(a/this.MAX_BITS);this._unlockObj["unlockList"+b][a%this.MAX_BITS]=1},getFinalUnlockList:function(){for(var a="",b=!1,c=6;0<=c;--c)if(parseInt(this._unlockObj["unlockList"+c].join(""))||b)var b=!0,d=this._unlockObj["unlockList"+c].slice().reverse().join(""),a=a+d;this.updateMachineUnlockBlob(); return a.split("").slice().reverse()},updateMachineUnlockBlob:function(){for(var a=0;7>a;a++){var b=this._unlockObj["unlockList"+a].slice();RSGame.getInstance().getUserDataManager().getMe().setMachineUnlockList(a,parseInt(b.reverse().join(""),2))}},setGameType:function(a){this._gameType=a},getGameType:function(){return this._gameType},setCurrentMachine:function(a){GlobalVars.isInsideMachine=!0;this._currentMachine=a},getCurrentMachine:function(){return this._currentMachine},setCurrentMachineVO:function(a){this._currentMachineVO= a},getCurrentMachineVO:function(){return this._currentMachineVO},getCurrentMachineAnalyticsName:function(){return this._currentMachineAnalytics},calculateAverageBet:function(a,b){0<a&&RSGame.getInstance().getLosingStreakManager().checkLosingStreak(a,b)},setAllVolumeLevels:function(){var a=document.getElementById("myModal-login");a&&"none"!=window.getComputedStyle(a).display||(GlobalVars.sfxStatus?RSEngine.audioManager.unMuteEffects():RSEngine.audioManager.muteEffects(),GlobalVars.musicStatus?RSEngine.audioManager.unMuteMusic(): RSEngine.audioManager.muteMusic(),GlobalVars.voiceCalloutsStatus?RSEngine.audioManager.unMuteVOs():RSEngine.audioManager.muteVOs())},showLosingStreakPopup:function(a){RSEngine.popupManager.addPopup(new RSLosingStreakPopup(RSGame.getInstance().getLosingStreakManager().getPopupData(),a))},showLoginPopup:function(a){},showLoginRewardPopup:function(){},showVIPBenefitsPopup:function(){},getLosingStreakValues:function(){return RSGame.getInstance().getGameData().getSheetData("losingStreakBonus")[0]},initializePlatformSDKManager:function(a, b){var c=new RSPlatformSDKVO;URLConfig.CLEVERTAP_ENABLED?c.sdkName=SDK_NAME.CLEVERTAP:(c.sdkName=SDK_NAME.LEANPLUM,c.leanplumAppId=a.leanplumAppId,c.leanplumDevKey=a.leanplumDevKey,c.leanplumLiveKey=a.leanplumLiveKey,c.isLeanplumLive=GameConfig.LEANPLUM_LIVE_MODE);if(RSGame.getInstance().getGameManager().isUserLoginBeforeSSO()){var d=RSGame.getInstance().getUserDataManager().getMe().getFBId();if(RSGame.getInstance().getGameManager().getWebRSID())d=RSGame.getInstance().getGameManager().getWebRSID(); else if(RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK||RSEngine.loginMode==LOGIN_MODE.FACEBOOK)d=GameConfig.USER_ID_PREFIX+RSGame.getInstance().getUserDataManager().getMe().getFBId();c.userId=d}else c.userId=RSGame.getInstance().getUserDataManager().getMe().getId();c.facebookId=RSGame.getInstance().getUserDataManager().getMe().getFBId();RSEngine.loginMode==LOGIN_MODE.EMAIL&&(c.facebookId=null);c.isFreshUser=RSGame.getInstance().getUserDataManager().getMe().isFreshUser();c.coins=RSGame.getInstance().getUserDataManager().getMe().getCoins(); c.xp=RSGame.getInstance().getUserDataManager().getMe().getXP();c.level=RSGame.getInstance().getUserDataManager().getMe().getUserLevel();RSVIPManager.getInstance().vipEnabled&&(c.vipTier=RSVIPManager.getInstance().getVIPUserTier());c.monetizationFactor=RSGame.getInstance().getUserDataManager().getMe().getMonetizationFactor();c.email=RSGame.getInstance().getUserDataManager().getMe().getEmail();c.firstName=RSEngine.loginMode==LOGIN_MODE.EMAIL?"":RSGame.getInstance().getUserDataManager().getMe().getUserFirstName(); GameConfig.SSO_ENABLED&&1==RSSSOManager.getFoxwoodsPlayerStatus()&&(c.firstName=RSGame.getInstance().getUserDataManager().getMe().getUserFirstName());c.isGuestLogin=RSEngine.loginMode==LOGIN_MODE.GUEST?!0:!1;c.isFacebookPlayer=RSEngine.loginMode==LOGIN_MODE.FACEBOOK?!0:!1;c.appId=GameConfig.APP_ID;c.gameId=b;RSEngine.loginMode==LOGIN_MODE.EMAIL||RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK?c.platform="web":RSEngine.loginMode==LOGIN_MODE.FACEBOOK&&(c.platform="canvas");RSPlatformSDKManager.getInstance().initialize(c); RSPlatformSDKManager.getInstance().setDelegate(this);if(!c.isGuestLogin)if(URLConfig.CLEVERTAP_ENABLED){if(!this._CTCallback){var e=this;this._CTCallback=setInterval(function(){RSEngine.loginMode==LOGIN_MODE.FACEBOOK?postMessage({type:"privacyPush",data:!0},"*"):parent.postMessage({type:"privacyPush",data:!0},"*");RSGame.getInstance().getGameManager().setLocationAndWebhookForCleverTap();RSGame.getInstance().getGameVariable().isCCPA()&&GlobalVars.CallCCPA?RSEngine.dataManager.setCCPA(c.userId,e._optOutStatus, e._successCallBack.bind(e),e._failedCallBack.bind(e)):RSGame.getInstance().getGameVariable().isGDPR()&&GlobalVars.CallCCPA&&RSEngine.dataManager.setGDPR(c.userId,e._optOutStatus,e._successCallBack.bind(e),e._failedCallBack.bind(e));RSLoginManager.getInstance().isTriggerSSOEvent()&&(RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.isSSOLoggedIn),RSLoginManager.getInstance().resetTriggerSSOEventStatus());GameConfig.IS_PLAYER_CONNECT_AVAILABLE&&(RSGame.getInstance().getUserDataManager().getMe().getPlayerConnectUpdateStatus()? RSPlatformSDKManager.getInstance().setUserAttributePlayerConnect(!0):RSPlatformSDKManager.getInstance().setUserAttributePlayerConnect(!1));RSPlatformSDKManager.getInstance().updateOnSessionLoad();clearInterval(e._CTCallback);e._CTCallback=null},5E3)}}else RSPlatformSDKManager.getInstance().updateOnSessionLoad(),null!=RSGame.getInstance().getUserDataManager().getMe().getEmailOptStatus()&&1>=RSGame.getInstance().getUserDataManager().getMe().getEmailOptStatus()&&RSEngine.dataManager.setEmailOptOutFlag(RSGame.getInstance().getUserDataManager().getMe().getEmailOptStatus(), this.onEmailOptoutSuccess.bind(this),this.onEmailOptoutFailed.bind(this))},setLocationAndWebhookForCleverTap:function(){RSEngine.loginMode==LOGIN_MODE.FACEBOOK?(postMessage({type:"getClevertapLocationPermission",data:""},"*"),postMessage({type:"getClevertapNotificationPermission",data:""},"*")):(parent.postMessage({type:"getClevertapLocationPermission",data:""},"*"),parent.postMessage({type:"getClevertapNotificationPermission",data:""},"*"))},_successCallBack:function(a){"Success"==a.result.status&& (GlobalVars.CallCCPA=!1,null!=this._optOutStatus&&1>=this._optOutStatus&&RSEngine.dataManager.setEmailOptOutFlag(RSGame.getInstance().getUserDataManager().getMe().getEmailOptStatus(),this.onEmailOptoutSuccess.bind(this),this.onEmailOptoutFailed.bind(this)))},setOptOutStatusFromCCPA:function(a){this._optOutStatus=a},getOptOutStatusFromCCPA:function(){return this._optOutStatus},_failedCallBack:function(){RSEngine.dataManager.setCCPA(this._userId,this._successCallBack.bind(this),this._failedCallBack.bind(this))}, onEmailOptoutSuccess:function(){var a=0==this._optOutStatus?"opt_in":"opt_out",b=RSGame.getInstance().getGameVariable().isCCPA()?"CCPA":"GDPR";RSAnalyticsManager.getInstance().trackCommonSysOpsEvent("email_offer_permission",a,b,"","");this._optOutStatus=null;cc.log("On Optout succes")},onEmailOptoutFailed:function(){this._emailOptOutFailedCount++;3>=this._emailOptOutFailedCount?1>RSGame.getInstance().getUserDataManager().getMe().getEmailOptStatus()&&RSEngine.dataManager.setEmailOptOutFlag(RSGame.getInstance().getUserDataManager().getMe().getEmailOptStatus(), this.onEmailOptoutSuccess.bind(this),this.onEmailOptoutFailed.bind(this)):RSErrorTracker.getInstance().trackErrorMessage("optout error","Error in leanplum optout call","mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net")},initializeGameSpecificCallbacks:function(){RSEventManager.getInstance().addEventListener("onSaleClosed",this,this.showPurchaseCartAfterSalePopupClose.bind(this))},showPurchaseCartAfterSalePopupClose:function(a){var b=!1;a&&(!0==a._userData.forceShow?b=!0:b=!1);!1==PurchaseFlowManager.getInstance().getShowPurchaseCart()? PurchaseFlowManager.getInstance().setShowPurchaseCart(!0):this.showPurchaseCart(b)},onPlatformSDKManagerCallback:function(a,b){if(RSEngine.loginMode==LOGIN_MODE.GUEST)return!0;switch(a){case "popup":switch(b){case "PURCHASE_CART":this.showPurchaseCart();break;case "LTEM_SALE":this.showSalesPopup();break;case "SHOW_SUB_SALE":RSSubscrptionSaleManager.showSubscriptionSalePopup("appinbox");break;case "TRAnnouncementPopup":RSTournamentManager.onTournamentBtnClicked(!0)}break;case "url_reward":case "xp_blast":UrlNotificationManager.getInstance().trackUrlRewardNotification(b, !0);break;case "navigate":this._navigateToLobby=b,this.getApprovalForNavigation()}},showPurchaseCart:function(){},showSalesPopup:function(){},getApprovalForNavigation:function(){},platformSDKScreenNavigation:function(a){},callScreenNavigation:function(){},confirmBackButtonStatus:function(){},updateTopHUDWithMessageCount:function(a){RSCasinoManager.getCasinoHUD().setNewsFeedCount(a)},showPokerOpenGraphPopup:function(a,b){},showOverlayLayer:function(){RSEngine.screenManager.addOverlay()},hideOverlayLayer:function(){RSEngine.screenManager.removeOverlay()}, getAristocratHUD:function(){return new AristocratHUD(RSGame.getInstance().getAssetPath("AristocratHud"))},setCasinoHUD:function(){RSCasinoManager.setCasinoHUD(this.getCasinoHUD())},getCasinoHUD:function(){return new TopHUD(RSGame.getInstance().getAssetPath("TopHud"))},getSlotMachineRootPath:function(){return"res/SlotResources/SlotMachines/"},getContentResourceRootFolder:function(){return"res/ContentResources/"},getMachineUnlockOGRootFolder:function(){return"res/SlotResources/Sublobby/icons/"},tutorialComplete:function(){RSGame.getInstance().getUserDataManager().getMe().setTutorialCompleteStatus()}, updateCoinXpLevel:function(){var a=RSGame.getInstance().getUserDataManager().getMe().getCoins(),b=RSGame.getInstance().getUserDataManager().getMe().getXP(),c=RSGame.getInstance().getUserDataManager().getMe().getUserLevel();RSPlatformSDKManager.getInstance().updateCoinXpLevel(a,b,c)},notifySalePurchaseResponseToCasino:function(a,b,c,d){null!=RSCasinoManager._customCasinoInterface&&RSCasinoManager._customCasinoInterface.notifySalePurchaseResponseToCasino(a,b,c,d)},showPurchaseUI:function(a,b,c,d){null!= RSCasinoManager._customCasinoInterface&&RSCasinoManager._customCasinoInterface.showPurchaseUI(a,b,c,d)},setLoadingStartTime:function(){this._startTime=TimeManager.getInstance().getCurrentServerTime()},calculateLoadingTime:function(a){if(null!=this._startTime){var b=TimeManager.getInstance().getCurrentServerTime()-this._startTime,b=Math.ceil(b);this._startTime=null;RSAnalyticsManager.getInstance().trackMachineLoadingComplete(b,a)}},getDefaultCasinoFont:function(a,b,c){var d=null;return(d="stroke"== c?RSGame.getInstance().getAssetPath("HindGuntur_"+a+"_"+b+"_"+c):RSGame.getInstance().getAssetPath("HindGuntur_"+a+"_"+b))?d:RSGame.getInstance().getAssetPath("HindGuntur_medium_normal")},getDefaultCasinoFontForHeading:function(){return null},getPurchaseCartVipExtraCoinFont:function(){return null},getDefaultFontForDailyQuestTimerandCoinText:function(){return null},getOgUnlockAssetPath:function(){return GameConfig.BASE_URL+"/assets/"},getSlotMachineIconRootPath:function(){return"res/SlotResources/Sublobby/icons/"}, getCasinoName:function(){return"Lucky North Casino"},showActionShare:function(a,b){RSActionShareManager.getInstance().initiateShare(a,b)},getLeaderboardGameType:function(){return RSGame.getInstance().getGameManager().getGameType()},getFandFPurchaseRemainingTime:function(){return 0},getHashValueForInternalGames:function(a){return calcMD5(a.join("|")+"_z2uy39283ye2n8mz92phdfp2")},getApiTokenValues:function(){RSEngine.loginMode!=LOGIN_MODE.GUEST&&RSGame.getInstance().getUserDataManager().getApiToken(this.spinGameTokenSuccess.bind(this), this.spinGameTokenFail.bind(this))},spinGameTokenSuccess:function(a){this._token=a.result.spinGameToken;this._everiGameToken=a.result.everiLaunchToken;a.result.agsLaunchToken&&(this._agsGameToken=a.result.agsLaunchToken);a.result.risingDigitalLaunchToken&&(this._risingDigitalToken=a.result.risingDigitalLaunchToken);a.result.oddsWorksLaunchToken&&(this._oddsWorksToken=a.result.oddsWorksLaunchToken);a.result.wazdanLaunchToken&&(this._wazdenRGSToken=a.result.wazdanLaunchToken);a.result.high5GamesLaunchToken&& (this._highFiveToken=a.result.high5GamesLaunchToken);a.result.elbetLaunchToken&&(this._rocketManToken=a.result.elbetLaunchToken);a.result.ainsworthLaunchToken&&(this._ainsworthToken=a.result.ainsworthLaunchToken);a.result.fincoreLaunchToken&&(this._fincoreToken=a.result.fincoreLaunchToken);a.result.yfageoLaunchToken&&(this._yfageoToken=a.result.yfageoLaunchToken)},spinGameTokenFail:function(a){this.getApiTokenValues()},getSpinGameToken:function(){return this._token},getEveriGameToken:function(){return this._everiGameToken}, getAGSGameToken:function(){return this._agsGameToken},getRisingDigitalGameToken:function(){return this._risingDigitalToken},getOddsWorksGameToken:function(){return this._oddsWorksToken},getWazdenRGSGameToken:function(){return this._wazdenRGSToken},getHighFiveGameToken:function(){return this._highFiveToken},getRocketManGameToken:function(){return this._rocketManToken},getAinsworthGameToken:function(){return this._ainsworthToken},getFincoreGameToken:function(){return this._fincoreToken},getYfageoGameToken:function(){return this._yfageoToken}, setUserAttributeNextSlotToBeUnlocked:function(){var a=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots),b,c=a.length;for(b=0;b<c;b++)if(!this._isMachineUnlocked(b)){RSPlatformSDKManager.getInstance().setUserAttributeNextSlotToBeUnlocked(a[b].machineDisplayName);break}},getMostPlayedMachine:function(){var a=[];a.push(this.getMostPlayedMachineInSlots());a.push(this.getMostPlayedMachineInBingo());a.push(this.getMostPlayedMachineInPoker());a.push(this.getMostPlayedMachineInKeno()); a.push(this.getMostPlayedMachineInBlackJack());this.getMostPlayedMachineInScratcher()&&a.push(this.getMostPlayedMachineInScratcher());var b,c=0,d,e=a.length;for(d=0;d<e;d++){var f=a[d].count;f>c&&(c=f,b=a[d])}0==c&&(b=this.getDefaultMachine("MPL","slots"));return b},getMostPlayedMachineInSlots:function(){var a=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots);if(a){var b=0,c="",d="",e=RSEngine.dataManager.getMe().getSpins(),f,g=a.length;for(f=0;f<g;f++){var h=this._getMachineUseCount(a[f].machine_identifier, e),k=RSGame.getInstance().getLevelManager().getCurrentLevel(),m=parseInt(RSVIPManager.getInstance().getVIPUserTier());h>b&&(k>=a[f].levelRequired||parseInt(a[f].VIPTier)<=m&&0<parseInt(a[f].VIPTier))&&(b=h,c=a[f].machine_identifier,d=a[f].machineDisplayName)}return""!=c?{machine_identifier:c,machine_type:"slots",count:b,machineDisplayName:d}:{machine_identifier:a[0].machine_identifier,machine_type:"slots",count:b,machineDisplayName:a[0].machineDisplayName}}},getMostPlayedMachineInScratcher:function(){var a= RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Scratcher);if(a){var b=0,c="",d="",e=RSGame.getInstance().getUserDataManager().getMe().getScratcherRounds(),f,g=a.length;for(f=0;f<g;f++){var h=this._getMachineUseCount(a[f].machine_identifier,e);h>b&&(b=h,c=a[f].machine_identifier,d=a[f].machineDisplayName)}return""!=c?{machine_identifier:c,machine_type:"scratcher",count:b,machineDisplayName:d}:{machine_identifier:a[0].machine_identifier,machine_type:"scratcher",count:b,machineDisplayName:a[0].machineDisplayName}}}, getMostPlayedMachineInBingo:function(){var a=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Bingo);if(a){var b=RSEngine.dataManager.getMe().getBingoRoomCardCount(),c,d=0,e="",f="";if(null!=b){for(var g in b)b[g]>d&&(d=b[g],c=g);if(null!=c)return f=this.getMachineDisplayNameByMachineIdentifier(c,a),{machine_identifier:c,machine_type:"bingo",count:d,machineDisplayName:f};e=a[0].machine_identifier;f=a[0].displayName;return{machine_identifier:e,machine_type:"bingo",count:d,machineDisplayName:f}}e= a[0].machine_identifier;return{machine_identifier:e,machine_type:"bingo",count:d,machineDisplayName:a[0].machineDisplayName}}},getMostPlayedMachineInPoker:function(){var a=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Poker);if(a){var b=0,c="",d="",e=RSEngine.dataManager.getMe().getPokerDealCount(),f,g=a.length;for(f=0;f<g;f++){var h=this._getMachineUseCount(a[f].machine_identifier,e);h>b&&(b=h,c=a[f].machine_identifier,d=a[f].machineDisplayName)}return""!=c?{machine_identifier:c, machine_type:"poker",count:b,machineDisplayName:d}:{machine_identifier:a[0].machine_identifier,machine_type:"poker",count:b,machinedisplayName:a[0].machineDisplayName}}},getMostPlayedMachineInKeno:function(){var a=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Keno);if(a){var b=0,c="",d="",e,f=a.length,g=RSEngine.dataManager.getMe().getKenoDealCount();for(e=0;e<f;e++){var h=this._getMachineUseCount(a[e].machine_identifier,g);h>b&&(b=h,c=a[e].machine_identifier,d=a[e].machineDisplayName)}return""!= c?{machine_identifier:c,machine_type:"keno",count:b,machineDisplayName:d}:{machine_identifier:a[0].machine_identifier,machine_type:"keno",count:b,machineDisplayName:a[0].machineDisplayName}}},getMostPlayedMachineInBlackJack:function(){var a=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Blackjack);if(a){var b=0,c="",d="",e,f=a.length,g=RSEngine.dataManager.getMe().getBlackjackDealCount();for(e=0;e<f;e++){var h=this._getMachineUseCount(a[e].machine_identifier,g);h>b&&(b=h,c=a[e].machine_identifier, d=a[e].machineDisplayName)}return""!=c?{machine_identifier:c,machine_type:"blackJack",count:b,machineDisplayName:d}:{machine_identifier:a[0].machine_identifier,machine_type:"blackJack",count:b,machineDisplayName:a[0].machineDisplayName}}},_getMachineUseCount:function(a,b){return null!=b[a]?b[a]:0},getMachinesPlayed:function(a){a=RSGame.getInstance().getGameData().getMachineDetails(a);var b=RSEngine.dataManager.getMe().getPokerDealCount();if(RSUtils.isObjectEmpty(b))return 0;var c,d=a.length,e=0;for(c= 0;c<d;c++)0<parseInt(this._getMachineUseCount(a[c].machine_identifier,b))&&e++;return e},getMachineDisplayNameByMachineIdentifier:function(a,b){var c,d=b.length;for(c=0;c<d;c++)if(a==b[c].machine_identifier)return b[c].machineDisplayName},getDefaultMachine:function(a,b){var c={machine_identifier:"",machineDisplayName:"",machine_type:""},d=RSEngine.gameData.getSheetData("LobbyWidgets"),e,f=d.length,g="";for(e=0;e<f;e++)if(d[e].widgetType==a){c.machine_identifier=d[e].machine_identifier;c.gameType= d[e].gameType;switch(c.gameType){case "slots":g=this.getMachineDisplayNameByMachineIdentifier(d[e].machine_identifier,RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots))}c.machineDisplayName=g;return c}},setRoundId:function(){this._roundId=RSAnalyticsManager.getInstance()._inHouseAnalytics._sessionID+"_"+TimeManager.getInstance().getCurrentServerTime()},getRoundId:function(){return this._roundId?this._roundId:""},setCardCount:function(a){this._bingoCardCount=a},getCardCount:function(){return this._bingoCardCount}, getCurrentDaubObject:function(){return null},getAndSetLoyaltyRewardPoints:function(a){RSEngine.dataManager.getLoyaltyRewardPoints(this.onLoyaltyRewardPointUpdated.bind(this,a),this.onLoyaltyRewardPointUpdationFailed.bind(this))},onLoyaltyRewardPointUpdated:function(a,b){this._loyaltyRewardPoints=b.result.nrp_points;null!=a&&a()},onLoyaltyRewardPointUpdationFailed:function(){this.getAndSetLoyaltyRewardPoints()},getLoyaltyRewardPoints:function(){return this._loyaltyRewardPoints},updateFromLoyaltyMall:function(a){switch(a.message){case "load_Complete":RSGame.getInstance().getGameManager().hideOverlayLayer(); this._loyaltyMallActive=!0;this.resizeLoyaltyMallDiv();this._currentVolumeStatus[0]=GlobalVars.musicStatus;this._currentVolumeStatus[1]=GlobalVars.sfxStatus;this._currentVolumeStatus[2]=GlobalVars.voiceCalloutsStatus;this.changeMusicStatus(!1);break;case "loyaltymall_Closed":RSEngine.dataManager.onCloseLoyaltyMallStore();this._loyaltyMallActive=!1;RSAnalyticsManager.getInstance().trackGUIEvent("btg_loyalty_icon","click","");this.changeMusicStatus(!0);break;case "loyaltymall_claimReward":RSEngine.dataManager.onCloseLoyaltyMallStore(), this._loyaltyMallActive=!1,RSAnalyticsManager.getInstance().trackGUIEvent("btg_loyalty_icon","click",""),this.changeMusicStatus(!0),UrlNotificationManager.getInstance().trackUrlRewardNotification(a.trackingId,!0)}},changeMusicStatus:function(a){a?(GlobalVars.musicStatus=this._currentVolumeStatus[0],GlobalVars.sfxStatus=this._currentVolumeStatus[1],GlobalVars.voiceCalloutsStatus=this._currentVolumeStatus[2],GlobalVars.musicStatus&&RSEngine.audioManager.unMuteMusic(),GlobalVars.sfxStatus&&RSEngine.audioManager.unMuteEffects(), GlobalVars.voiceCalloutsStatus&&RSEngine.audioManager.unMuteVOs()):(GlobalVars.musicStatus=a,GlobalVars.sfxStatus=a,GlobalVars.voiceCalloutsStatus=a,RSEngine.audioManager.muteMusic(),RSEngine.audioManager.muteEffects(),RSEngine.audioManager.muteVOs());RSEngine.externalGameManager&&RSEngine.externalGameManager.updateMachineSound()},resizeLoyaltyMallDiv:function(){this._loyaltyMallActive&&(this._loyaltyMallDiv=document.getElementById("loyaltyMallDiv"),null!=this._loyaltyMallDiv&&(null==this._parentDiv&& (this._parentDiv=document.getElementById("Cocos2dGameContainer")),this._loyaltyMallDiv.style.top="0px",this._loyaltyMallDiv.style.height=this._parentDiv.style.height))},resizeSpinGameDivFromExternalGame:function(a,b){null==this._parentDiv&&(this._parentDiv=document.getElementById("Cocos2dGameContainer"));if(GlobalVars.isjackpotLoaded||a._ignoreResizeForHud||GlobalVars.isTournamentLoaded||GlobalVars.isLoyaltyMallLoaded)b.style.top="0px",b.style.height=this._parentDiv.style.height;else if(a._thirdPartyOwnerType&& parseInt(a._thirdPartyOwnerType)==CasinoExternalGameType.ROCKET_MAN){var c=0.102*parseInt(this._parentDiv.style.height.substring(0,this._parentDiv.style.height.length-2));parseInt(this._parentDiv.style.height.substring(0,this._parentDiv.style.height.length-2));var d=document.getElementById("Cocos2dGameContainer").clientWidth,e=document.getElementById("Cocos2dGameContainer").clientHeight,d=9*d/16;600<d&&(d=e-c);600>=d&&(d=600,parent.postMessage({type:"changeFrameHeight",height:d+c+7},"*"));b.style.border= "0px";b.style.top=c+"px";b.style.height=d+"px"}else b.style.top=0.102*parseInt(this._parentDiv.style.height.substring(0,this._parentDiv.style.height.length-2))+"px",b.style.height=0.892*parseInt(this._parentDiv.style.height.substring(0,this._parentDiv.style.height.length-2))+"px"},getLoyaltyMallStatus:function(){return this._loyaltyMallActive},loadPreviousScreen:function(){},dailyBonusCollectCallback:function(){},playMusicWithFadeIn:function(a,b,c){RSEngine.audioManager.setMusicVolume(0.2);RSEngine.audioManager.playMusic(a, b);c&&RSEngine.audioManager.fadeInMusic(1.5,c);this.setAllVolumeLevels()},playButtonClickSFX:function(){},initializeMachineOpenPopup:function(a){if(a instanceof Object)for(var b in a)this._machineOpenPopupAssets[b]=a[b];else this._machineOpenPopupAssets.iconPath=a},setLocationForMachineOpenPopup:function(a,b){this.machineOpenX=a;this.machineOpenY=b},callMachineOpenPopup:function(a,b,c){null==this.machineOpenX&&(this.machineOpenX=RSEngine.screenWidth/2);null==this.machineOpenY&&(this.machineOpenY= RSEngine.screenHeight/2);if(this._machineOpenPopupEnabled){var d=this._machineOpenPopupAssets.iconPath;-1==d.indexOf("png")&&-1==d.indexOf("jpg")&&(d+=".png");var e=RSGame.getInstance().getGameData().getMachineDetails(this._loadedMachineDetails.machineType,this._loadedMachineDetails.machineAnalyticsName),f=null,f=null!=e&&e.iconUrlLarge?e.iconUrlLarge:this._machineOpenPopupAssets[RSGame.getInstance().getGameManager().getGameType()]+d;a=new MachineOpenPopup(f,this.machineOpenX,this.machineOpenY,a, b,c);RSEngine.popupManager.addPopup(a,!1,!1,!0);this.machineOpenY=this.machineOpenX=null}else this._machineOpenPopupEnabled=!0},setMachineOpenPopupStatus:function(a){this._machineOpenPopupStatus=a},getMachineOpenPopupStatus:function(){return this._machineOpenPopupStatus},getIconType:function(){return this._machineOpenPopupAssets.iconType?this._machineOpenPopupAssets.iconType:null},disableMachineOpenPopup:function(){this._machineOpenPopupEnabled=!1},saveLevelUpReward:function(a){},updateLevelUpReward:function(a){}, setSideMenuVisibility:function(a){"undefined"!==typeof SideMenuController&&SideMenuController.getInstance().setSideMenuVisibility(a)},checkAndShowPurchaseFailurePopups:function(a,b){this._purchaseCancelledCallBack=a;if(RSGame.getInstance().getGameData().getDefaultValues().purchaseCancelFlowEnabled)this.showPurchaseFailurePopup(b);else{var c=RSEngine.gameData.getDefaultValues().purchaseCancelledFeedbackCount;this._purchaseCancelledCount<parseInt(c?c:2)?(this._purchaseCancelledCount++,c=RSGame.getInstance().getStringDictionary("PurchaseCancelledFeedBack").T3? RSGame.getInstance().getStringDictionary("PurchaseCancelledFeedBack").T3:"HAVING TROUBLE?",RSEngine.popupManager.addPopup(new RSSmileyPopup([{name:RSGame.getInstance().getAssetPath("RateUsHavingFunPopup"),count:1}],c,this.showFeedBackPopup.bind(this)),!0)):this.showPurchaseFailurePopup(b)}},showFeedBackPopup:function(a){"Sad"==a?RSEngine.popupManager.addPopup(new RSPurchaseCancelledFeedBackPopup(RSInAppPurchaseManager.getInstance().getCurrentActivePurchasePack().analyticsName,this.feedbackSubmitCallback.bind(this)), !0):this._purchaseCancelledCallBack&&this._purchaseCancelledCallBack()},feedbackSubmitCallback:function(a){a||(a=RSGame.getInstance().getStringDictionary("PurchaseCancelledFeedBack").T2?RSGame.getInstance().getStringDictionary("PurchaseCancelledFeedBack").T2:"THANKS FOR THE \n FEEDBACK!",RSEngine.popupManager.addPopup(new RSToasterPopup([{name:RSGame.getInstance().getAssetPath("SmallPopupBG"),count:1},{name:RSGame.getInstance().getAssetPath("FeedBackThanksPopup"),count:1}],a),!0));this._purchaseCancelledCallBack&& this._purchaseCancelledCallBack()},showPurchaseFailurePopup:function(a){RSGame.getInstance().getGameData().getDefaultValues().purchaseCancelFlowEnabled?RSEngine.popupManager.addPopup(new PurchaseFailurePopup(this.failurePopupCallback.bind(this),a),!0):RSEngine.popupManager.addPopup(new PurchaseFailurePopup(this._purchaseCancelledCallBack,a),!0)},failurePopupCallback:function(a,b){"CloseBtn"==a&&"Cancel"==b?this.checkAndShowSmileyPopup(b):this._purchaseCancelledCallBack&&(this._purchaseCancelledCallBack(), this._purchaseCancelledCallBack=null)},checkAndShowSmileyPopup:function(a){"Cancel"==a&&(a=RSGame.getInstance().getStringDictionary("PurchaseCancelledFeedBack").T3?RSGame.getInstance().getStringDictionary("PurchaseCancelledFeedBack").T3:"HAVING TROUBLE?",RSEngine.popupManager.addPopup(new RSSmileyPopup([{name:RSGame.getInstance().getAssetPath("RateUsHavingFunPopup"),count:1}],a,this.showFeedBackPopup.bind(this)),!0))},updateRewardsFromAdManager:function(a){},loadJackpotLounge:function(a,b,c,d,e,f, g){},showLevelUpPopups:function(){},getEmitterColors:function(){},showAdsNotAvailablePopup:function(){},showPowerUpCart:function(){},showDaubAlertCart:function(a){},updateLeaderboardWithBingoWin:function(a){},getJLBetSelectIconPath:function(){return"res/SlotResources/CasinoSubLobby/icons/"},getModifiedVIPMultiplier:function(a){return null},containsBlackjackBetArray:function(a){return!1},loadPopupWithData:function(a,b){switch(a.content){case "LeaderboardWeeklyReward":var c=a.custom;3<c.rank?RSEngine.popupManager.addPopup(new RSLeaderboardCongratulationsPopup(c, a.id)):RSLeaderboardManager.showLeaderboardRewardScreen(c,a.id);break;case "TournamaniaReward":RSTournamentManager.showTournamentRewardScreen(a.custom,a.id)}},updatePiggyBank:function(a){},showIntroScreenForJL:function(a){},setPreviewMachine:function(a){this._previewMachine=a},getPreviewMachine:function(){return this._previewMachine},setPreviewType:function(a){this._previewType=a},getPreviewType:function(){return this._previewType},getHUDCasinoFont:function(a,b){return null},getNumberFontWithoutGlow:function(a, b){return null},getGenericButtonFont:function(a,b){return null},getPurchaseFeedbackConfig:function(){return{}},getConnectionLostPopupTextFont:function(){return RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold")},sideMenuBtnClicked:function(){},getSideMenuStyleData:function(){return{topPosition:107}},getToasterStyleData:function(){return{topPosition:35}},getDefaultFontForDailyQuestProgressText:function(){return RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium", "stroke")},getDefaultFontForDailyQuestTimerText:function(){return null},getDefaultFontForDailyQuestRewardText:function(){return RSGame.getInstance().getGameManager().getDefaultCasinoFont("extralarge","bold")},setExternalBonusSpinActive:function(a){this._externalBonusSpinActive=a},getExternalBonusSpinActive:function(){return this._externalBonusSpinActive},setGiftAvailableForGuestUsers:function(a,b){1==parseInt(RSEngine.gameData.getDefaultValues().newTrackerLinkFlow)?(this._isGiftAvailableForGuestUsers= !1,this.checkForValidityOfTrackingId(a)?UrlNotificationManager.getInstance().getUrlRewardNotificationDataForGuestPlayers(a,!1,b):b&&b("success")):this._isGiftAvailableForGuestUsers=a},getGiftAvailableForGuestUsers:function(){return this._isGiftAvailableForGuestUsers},checkForValidityOfTrackingId:function(a){var b=RSGame.getInstance().getUserDataManager().getMe().getGuestUserDataForKey("trackerLinkData");return null==b||a!=b.trackingId?!0:!1},callJLMachineSelectPopup:function(){},setCurrentMachineIsInternal:function(a){this._isCurrentMachineInternal= a},getCurrentMachineIsInternal:function(){return this._isCurrentMachineInternal},showSideMenuOnPopupClose:function(){return!0},showPurchaseBanned:function(){},isVipEnabled:function(){return!0},isLifeStreetActive:function(){return null==document.getElementById("lifeStreet")?!1:!0},addVIPBenefits:function(a){},connectPlayerIdWithCasino:function(a,b,c,d){},getPropertyLinkType:function(){return"property"},getGameName:function(){var a=GameConfig.CASINO_DISPLAY_NAME?GameConfig.CASINO_DISPLAY_NAME:GameConfig.CASINO_NAME; return a=a.replace(/([A-Z])/g," $1").trim()},getEmailConnectFontColor:function(){return null},getSweepstakesEntryFontColor:function(){return null},loadMachine:function(a,b,c,d,e){if(!GlobalVars.isMachineLoadingInProgress)if(RSEngine.loginMode==LOGIN_MODE.GUEST)RSGame.getInstance().getGameManager().showLoginPopup("feature","FbConnectPopup");else{GlobalVars.isMachineLoadingInProgress=!0;GlobalVars.isFirstSpinOnMachine=!0;GlobalVars.isFirstDealOnCPTournamentMachine=!0;this._loadedMachineDetails.machineType= a;this._loadedMachineDetails.machineAnalyticsName=b;this._loadedMachineDetails.triggeredFrom=c;this._loadedMachineDetails.previewType=d;this._loadedMachineDetails.defaultBet=e;GlobalVars.forceSaveCoinBalance=!0;RSEngine.dataManager.disableSaveUserBlobVariableForcefully();RSEngine.dataManager.updateUserBlob(RSEngine.dataManager.getMe().getLevelXPOffset(),RSEngine.dataManager.getMe().getCoinOffset(),RSEngine.dataManager.getMe().getPaidCoinOffset(),RSEngine.dataManager.getMe().getPiggyBankValue(),RSEngine.dataManager.getMe().getXpFraction(), RSEngine.dataManager.getMe().getUserLevel(),RSEngine.dataManager.getMe().getXPOffset(),RSEngine.dataManager.getMe().getLevelFactor());d?(this._previewMachine=b,RSGame.getInstance().getGameManager().setPreviewMachine(this._previewMachine),RSGame.getInstance().getGameManager().setPreviewType(d)):(this._previewMachine=null,RSGame.getInstance().getGameManager().setPreviewMachine(this._previewMachine),RSGame.getInstance().getGameManager().setPreviewType(null));b=RSGame.getInstance().getGameData().getMachineDetailsByName(a, b);if(a==RSGameTypes.Slots&&b.gameType!=CasinoExternalGameType.INTERNAL||a==RSGameTypes.Keno&&1==b.gameType||a==RSGameTypes.Poker&&b.gameCategory==PokerType.DOD||a==RSGameTypes.TableGames)if(RSGame.getInstance().getGameManager().setSideMenuVisibility(!1),RSEngine.loginMode==LOGIN_MODE.GUEST){RSGame.getInstance().getGameManager().showLoginPopup("feature","FbConnectPopup");return}RSPlatformSDKManager.getInstance().setUserAttributeLastGamePlayed(b.machineDisplayName);var f=null,g=null,h=null;if(b.isEnabled&& !parseInt(b.isEnabled))GlobalVars.isMachineLoadingInProgress=!1;else{RSGame.getInstance().getGameManager().setMachinePlayed();RSAnalyticsManager.getInstance().setCurrentMachineAnalyticsName(b.machine_identifier);RSGame.getInstance().getGameManager().setGameType(a);var k="",m="";switch(a){case RSGameTypes.Slots:f=new SlotMachineConfig(b,c);g=f.getMachineParam();k="1"==RSEngine.gameData.getSheetData("platformDataConfig")[0].TallIconsEnabled?b.machine_tallIcon:b.machine_largeIcon;m=RSGameScreens.SlotsLobby; break;case RSGameTypes.TableGames:f=new TableGamesMachineConfig(b,c);g=f.getMachineParam();k=b.machine_identifier+".png";h=this.getBlackjackRouletteLobbyName();m=null==h?RSGameScreens.BlackJackLobby:h;break;case RSGameTypes.Keno:f=new KenoMachineConfig(b,c);g=f.getMachineParam();k=b.machine_identifier+".png";h=this.getBingoKenoLobbyName();m=null==h?RSGameScreens.KenoLobby:h;break;case RSGameTypes.Poker:f=new PokerMachineConfig(b,c);g=f.getMachineParam();k=b.machine_identifier+".png";m=RSGameScreens.PokerLobby; break;case RSGameTypes.Bingo:RSPlacementManager.getInstance().notifyBetChangeToPlacementManager(0);f=new BingoMachineConfig(b,c);g=f.getMachineParam();k=b.machine_identifier+".png";h=this.getBingoKenoLobbyName();m=null==h?RSGameScreens.BingoLobby:h;RSAnalyticsManager.getInstance().trackInHouseEvent("user_info","powerup_balance","loading",RSGame.getInstance().getGameManager().getPowerUpList(),"","");break;case RSGameTypes.Blackjack:f=new BlackjackMachineConfig(b,c);g=f.getMachineParam();f.getTutorialReward(); k=b.machine_identifier+".png";h=this.getBlackjackRouletteLobbyName();m=null==h?RSGameScreens.BlackJackLobby:h;break;case RSGameTypes.Trivia:f=new TriviaMachineConfig(b,c);g=f.getMachineParam();k=b.machine_largeIcon;break;case RSGameTypes.Roulette:f=new RouletteMachineConfig(b,c);g=f.getMachineParam();k=b.machine_largeIcon;h=this.getBlackjackRouletteLobbyName();m=null==h?RSGameScreens.MainLobby:h;break;case RSGameTypes.Scratcher:f=new ScratcherMachineConfig(b,c);g=f.getMachineParam();k=b.machine_largeIcon; h=this.getScratcherLobbyName();m=null==h?RSGameScreens.MainLobby:h;break;case RSGameTypes.Scorebox:f=new ScoreboxMachineConfig(b,c),g=f.getMachineParam(),k=b.machine_largeIcon}h=f.getAnalyticsData();GameConfig.MACHINE_OPEN_POPUP&&(f=[],f.iconPath=k,f.iconType=b.machine_iconType,RSGame.getInstance().getGameManager().initializeMachineOpenPopup(f));if(GameConfig.JACKPOT_LOUNGE_ENABLE&&GlobalVars.isjackpotLoaded){k={};k.bottomHUDFolder=g._bottomHUDAssetFolder;k.machineAnalyticsID=g.machine_identifier; k.betStructure=g._betStructure;k.defaultBet=g._defaultBet;k.maxBetAmount=g._maxBetAmount;k.betLineCount=g._betLineCount;k.cheat=GlobalVars.isCheatActive;k.jackpotDefaultBet=e;b.iconUrlLarge||b.iconUrl?"6"!=b.gameType&&-1!=g.machine_identifier.indexOf("S_")&&(k._thirdPartyOwnerType="1"):k._thirdPartyOwnerType=b.gameType;k.machineName=g._screenName;-1!=g.machine_identifier.indexOf("L_")&&(k.betAmount=g._betAmount);g.mathFile&&(k.mathFile=g.mathFile);g.fueTriggerSpin&&(k.fueTriggerSpin=g.fueTriggerSpin); var n={};b.gameType==CasinoExternalGameType.KONAMI_GAME||b.gameType==CasinoExternalGameType.SPIN_GAME||b.gameType==CasinoExternalGameType.SPIN_GAME_V2||b.gameType==CasinoExternalGameType.EVERI_GAME||b.gameType==CasinoExternalGameType.AGS_GAME||b.gameType==CasinoExternalGameType.RISING_DIGITAL_GAME||b.gameType==CasinoExternalGameType.AINSWORTH||b.gameType==CasinoExternalGameType.FINCORE?(k._gameURL=g._gameURL,n=k):-1!=g.machine_identifier.indexOf("X_")?(e=RSGame.getInstance().getGameManager().getScoreBoxValues(g), n.machineName=g._gameName,n.machineData=btoa(JSON.stringify(e))):(n.machineData=btoa(JSON.stringify(k)),-1!=g.machine_identifier.indexOf("S_")?n.machineName=b.screenName:n.machineName=b.machine_name);RSEngine.externalGameManager._machineParams._betStructure=g._betStructure;RSEngine.externalGameManager._machineParams._betIndex=g._betIndex;RSEngine.externalGameManager._machineParams._analyticsID=g._analyticsID;RSEngine.externalGameManager._machineParams._gameType=g._gameType;RSEngine.externalGameManager._machineParams._soundFlag= g._soundFlag;var p=this;this._forceSaveId=setInterval(function(){GlobalVars.forceSaveCoinBalance||(RSEngine.externalGameManager.postMessageToJackpot({type:"machineLoad",machineParams:n}),GlobalVars.isMachineLoadingInProgress=!1,clearInterval(p._forceSaveId))},500)}else if(g._gameURL){if(RSGameScreenManager.getInstance().getCurrentScreen()===RSGameScreens.MainLobby||this.getIsMachineUnlockActive())this.getIsMachineUnlockActive()&&RSGameScreenManager.getInstance().removeAllScreensExceptMainLobby(), this.isSubLobbyEnabled()&&(RSGameScreenManager.getInstance().setPreviousScreen(m),RSAnalyticsManager.getInstance().pushCurrentScreen(m)),a===RSGameTypes.Slots&&this.setMachinePlayedForAnim(g._analyticsID);p=this;this._forceSaveId=setInterval(function(){GlobalVars.forceSaveCoinBalance||(RSCasinoManager.getCasinoHUD().enableBackButtonForDirectLoading(),RSGameScreenManager.getInstance().loadExternalGame(g),GlobalVars.isMachineLoadingInProgress=!1,clearInterval(p._forceSaveId))},500)}RSGame.getInstance().getGameManager().setLoadingStartTime(); RSGame.getInstance().getGameManager().updateCoinXpLevel();RSGame.getInstance().getUserDataManager().getMe().setLastPlayedMachine(a,b.machine_identifier);a!=RSGameTypes.Bingo&&this.trackGameEnterAnalytics(d,h,b.machine_identifier);RSEngine.audioManager.stopMusic();SideMenuController.getInstance().disableAllButtons();SideMenuController.getInstance().setClosedStateDivDimensions();GlobalVars.isInsideMachine=!0;GlobalVars.isInsideExternalGame&&RSGame.getInstance().getGameManager().getApiTokenValues()}}}, getBingoKenoLobbyName:function(){return null},getBlackjackRouletteLobbyName:function(){return null},getScratcherLobbyName:function(){return RSGameScreens.ScratcherLobby},setMachinePlayedForAnim:function(a){SlotsLobbyWidgetManager.getInstance().setSlotMachineData();var b=SlotsLobbyWidgetManager.getInstance().getMergedSlotMachinesData(),c;for(c in b)if(b[c].id===a)break;SlotsLobbyWidgetManager.getInstance().setSlotsMachineLoaded(!0);SlotsLobbyWidgetManager.getInstance().setSlotsLobbySelectedIndex(c, {})},trackGameEnterAnalytics:function(a,b,c){"RSDailyQuestPopup"===b.from&&(b.from="daily_challenge",c="");a==PreviewType.SLOTS?RSAnalyticsManager.getInstance().trackGameEnter(b.gameType,b.from,c,"","top_featured"):a==RSFeatures.MOST_PLAYED?RSAnalyticsManager.getInstance().trackGameEnter(b.gameType,b.from,c,"",a):a==RSFeatures.FEATURED?RSAnalyticsManager.getInstance().trackGameEnter(b.gameType,b.from,c,"","top_featured"):a==RSFeatures.NEW_MACHINES?RSAnalyticsManager.getInstance().trackGameEnter(b.gameType, b.from,c,"","promo_widget"):RSAnalyticsManager.getInstance().trackGameEnter(b.gameType,b.from,c,"")},getPowerUpList:function(){var a=RSEngine.dataManager.getMe().getPowerUps(),b="",c;for(c in a){var d=RSGame.getInstance().getGameData().getPowerupDetails(c);d&&(b&&(b+=","),b=b+d.analyticsID+":"+a[c])}return b},getPowerUpTotalCount:function(){var a=RSEngine.dataManager.getMe().getPowerUps(),b=0,c;for(c in a)b+=a[c];return b},initializeLogOut:function(){RSLoginManager.getInstance().logout()},getAdPopupFonts:function(){return{}}, getMaxLimitPopupFonts:function(){return{}},playSoundWithFadeIn:function(a,b,c){RSEngine.audioManager.setEffectsVolume(0.2);RSEngine.audioManager.playEffect(a,b);c&&RSEngine.audioManager.fadeInEffect(1.5,c);this.setAllVolumeLevels()},setLastAwardedLevelBonus:function(a){this._lastAwardedLevelBonus=a},getLastAwardedLevelBonus:function(){return this._lastAwardedLevelBonus},setLastAwardedPiggyBonus:function(a){this._lastAwardedPiggyBonus=a},getLastAwardedPiggyBonus:function(){return this._lastAwardedPiggyBonus}, getNewLeaderboardFonts:function(){return{}},getIsMachineUnlockActive:function(){return this._isMachineUnlockPopupActive},setIsMachineUnlockActive:function(a){this._isMachineUnlockPopupActive=a},getCurrentLoadedMachineDetails:function(){return this._loadedMachineDetails},resizeJackpot:function(){if(GameConfig.JACKPOT_LOUNGE_ENABLE&&GlobalVars.isjackpotLoaded){var a=document.getElementById("Cocos2dGameContainer"),b=0.102*parseInt(a.style.height.substring(0,a.style.height.length-2))+"px",c=parseInt(a.style.width.substring(0, a.style.width.length-2))+parseInt(a.style.paddingLeft.substring(0,a.style.paddingLeft.length-2))+"px",a=a.style.height;"gameplay_screen"==RSGameScreenManager.getInstance().getCurrentScreen()?RSEngine.externalGameManager.addClippingToExternalGame("0px",b,c,a):RSEngine.externalGameManager.addClippingToExternalGame(0,b,c,a);RSEngine.externalGameManager.resizeSpinGameDiv();RSEngine.externalGameManager.postMessageToJackpot({type:"modeChanged"})}},notifyBingoRoundStarted:function(){},notifyBingoRoundCompleted:function(){}, callGameRoomShutdownPopup:function(){},checkForQuestEnabledInThisMachineOrNot:function(){return!0},reInitializeGenericEvents:function(){},isUserLoginBeforeSSO:function(){return!1},setWebRSID:function(a){this._webRSID=a},getWebRSID:function(){return this._webRSID?this._webRSID:null},isVipPercentageCalculation:function(){return!1},isMaxLimitPopupAvailable:function(){return!1},onSideMenuButtonCliked:function(a){switch(a){case "tournamentBtnClicked":RSTournamentManager.onTournamentBtnClicked(!0)}},getSideMenuItemsList:function(){return["DailyQuest"]}, getSSOMainLobbyReloadStatus:function(){return this._ssoMainLobbyReload},setSSOMainLobbyReloadStatus:function(a){this._ssoMainLobbyReload=a},getUpdatedUserForDisplay:function(a){return a&&a.includes("blob_")?a.split("blob_")[1]:a?a:RSEngine.dataManager.getMe().getId()},showRulesPopup:function(){window.open("https://luckynorthcasino.com/lucky-north-casino-terms-of-service/","_blank")},getIsVIPTakeMeButtonClicked:function(){return this._isVIPTakeMeButtonClicked},setIsVIPTakeMeButtonClicked:function(a){this._isVIPTakeMeButtonClicked= a},showIntroScreenForLMAndVIP:function(a,b,c){b&&RSEngine.dataManager.getMe().setLMTriggerStatus(!0);a&&RSEngine.dataManager.getMe().setVIPTriggerStatus(!0);this._curtainRaiserScreen=new RSIntroScreenForLMAndVIP(this.onCurtainAnimComplete.bind(this,a,b),a,b);this._LMandVIPCurtainRaiserCompleteCallBack=c;!0==a&&!1==b&&(RSGameScreenManager.getInstance().getCurrentScreen()!=RSGameScreens.MainLobby||GlobalVars.isSurfacingActive||this.playIntroScreen())},onCurtainAnimComplete:function(a,b){RSEngine.screenManager.removeScreen(this._curtainRaiserScreen); RSGame.getInstance().getGameManager().setSideMenuVisibility(!0);this._LMandVIPScreenPlayCallBack&&this._LMandVIPScreenPlayCallBack.call(this);this._LMandVIPCurtainRaiserCompleteCallBack&&this._LMandVIPCurtainRaiserCompleteCallBack.call(this);RSEngine.externalGameManager.showExternalGame();this._curtainRaiserScreen=null;a&&RSEngine.dataManager.getMe().setVIPTriggerStatus(!1);b&&RSEngine.dataManager.getMe().setLMTriggerStatus(!1);RSEngine.dataManager.saveUserBlobParams()},playIntroScreen:function(a){this._LMandVIPScreenPlayCallBack= a;this._curtainRaiserScreen&&(GlobalVars.isSurfacingActive=!0,RSEngine.screenManager.addScreen(this._curtainRaiserScreen),RSEngine.externalGameManager.hideExternalGame(),RSGame.getInstance().getGameManager().setSideMenuVisibility(!1))},loadLoyaltyMall:function(a){RSEngine.dataManager.getLoyaltyMallPoints(this.onTrackMachineLoadEvent.bind(this));GlobalVars.isLoyaltyMallLoaded=!0;SideMenuController.getInstance().setSideMenuVisibility(!1);RSGame.getInstance().getGameManager().disableMachineOpenPopup(); RSEngine.audioManager.stopMusic();RSEngine.audioManager.stopAllEffects();RSEngine.externalGameManager.unLoadExternalGame();RSGame.getInstance().getGameManager().setGameType(RSGame.getInstance().getGameManager().getGameType());a={vo:GlobalVars.voiceCalloutsStatus,music:GlobalVars.musicStatus,effect:GlobalVars.sfxStatus};a=JSON.stringify(a);var b=this._getHashValue("LoyaltyMall",String(TimeManager.getInstance().getCurrentServerTime()),RSEngine.dataManager.getMe().getCoins(),RSEngine.dataManager.getMe().getId()), c={_screenName:"LoyaltyMall",_gameType:"LoyaltyMall",machine_identifier:"LoyaltyMall"};c._gameURL=GameConfig.LOYALTYMALL_URL+GameConfig.CASINO_NAME+"\x26userID\x3d"+RSEngine.dataManager.getMe().getId()+"\x26timeStamp\x3d"+String(TimeManager.getInstance().getCurrentServerTime())+"\x26coins\x3d"+RSEngine.dataManager.getMe().getCoins()+"\x26hashValue\x3d"+b+"\x26volume\x3d"+a+"\x26platform\x3dcanvas";RSGameScreenManager.getInstance().loadExternalGame(c)},getScoreBoxValues:function(){return null},getVipTierWidgetAssetPath:function(){return RSGame.getInstance().getAssetPath("VIPStatusTier")}, getClubMUpdateStatus:function(){return RSGame.getInstance().getUserDataManager().getMe().getClubMUpdateStatus()},getCustomizedParticleCount:function(){return 200},getFBAccessToken:function(){return this._accessToken?this._accessToken.split("access_token\x3d")[1]:RSFBManager.getInstance().getAccessToken()},setFBAccessToken:function(a){this._accessToken=a},isSubLobbyEnabled:function(){return!0},showJackpotLoungeWelcomePopup:function(){},showSaleOrPurchaseCart:function(a,b,c){this._callBack=b;if(RSEngine.loginMode== LOGIN_MODE.GUEST)RSEngine.dataManager.getMe().setGuestUserDataForKey("PopupName","PurchaseCart"),RSGame.getInstance().getGameManager().showLoginPopup("feature","PurchaseCart");else{PurchaseFlowManager.getInstance().setShowPurchaseCart(!1);if(RSSaleManager.getInstance().getSaleActiveStatus()){if(!GlobalVars.isPurchaseEnabled){VideoManager.getInstance().showVideoPopup("ReplacePurchase",!1,"sale",this.videoPopupClose.bind(this));return}RSSaleManager.getInstance().showSalePopup(a,b,!1,c)}else{if(!GlobalVars.isPurchaseEnabled){VideoManager.getInstance().showVideoPopup("ReplacePurchase", !1,"purchase_cart",this.videoPopupClose.bind(this));return}RSSaleManager.getInstance().showPurchaseCart(a,b,c)}RSEngine.externalGameManager.postMessageToJackpot("jackpotCustomInterfaceCalls",{type:"resetKickOut"})}},videoPopupClose:function(){this._callBack&&this._callBack()},getMainLobbyLoadedTime:function(){return this._mainLobbyLoadedTime},setMainLobbyLoadedTime:function(a){this._mainLobbyLoadedTime=a},addVIPBenefits:function(a){},onBuyCoinsBtnClicked:function(){},getFeaturedMachinesList:function(){this._featuredMachineList= [];var a={slots:"machines",poker:"pokermachines",bingo:"bingoMachineAssets",keno:"kenomachines",blackjack:"blackjackmachines",roulette:"roulettemachines",scratcher:"scratchermachines","default":"slotsFavorites"},b=RSMEConfigManager.getInstance().getDataForEvent(RSFeatures.FEATURED);if(b){var c=b.machines,d;for(d in c){var b=RSEngine.gameData.getSheetData(a[d]),e;for(e in c[d])for(var f=0;f<b.length;f++)if(b[f].machine_identifier==c[d][e]){this._featuredMachineList.push(b[f]);break}}}if(0==this._featuredMachineList.length)for(a= RSEngine.gameData.getSheetData(a["default"]),d=0;d<a.length;d++)b=a[d].id,b=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots,b),null!=b&&this._featuredMachineList.push(b);return this._featuredMachineList},setNewMachineData:function(a){this._newMachineData=a},isNewMachine:function(a){if(this._newMachineData)for(var b=0;b<this._newMachineData.length;b++)if(this._newMachineData[b]==a)return!0;return!1},getVideoRewardPopupFont:function(){return null},startMainLobbyMusicTimer:function(){}, loadNewCCPAPopup:function(){return!1},loadNewGDPRPopup:function(){return!1},loadCCPAPopup:function(a,b){RSEngine.popupManager.addPopup(new RSCCPAPopup(a,null,b),!0)},loadGDPRPopup:function(a,b){RSEngine.popupManager.addPopup(new RSGDPRPopup(a,null,b),!0)},getPlayerConnectCustomLabelStatus:function(){return!1},checkAndShowSSORewardPopup:function(a){RSSSOManager.checkAndUpdateSocialLogin(this.showRewardPopup.bind(this),a)},showRewardPopup:function(a){},getVipStatusPointUpdateEnabledStatus:function(){return!1}, setSSOReloadStatusWithLoadingScreen:function(a){this._ssoReloadWithLoadingScreen=a},getSSOReloadStatusWithLoadingScreen:function(){return this._ssoReloadWithLoadingScreen},myRewardsRestoreAnimStatus:function(){return!1},setMinimumBetOfLastPlayedMachine:function(){this.getGameType()==RSGameTypes.Scratcher&&RSEngine.gameData.getDefaultValues().ScratcherMinBetRoom?this._minBetOfLastPlayedMachine=RSEngine.gameData.getDefaultValues().ScratcherMinBetRoom:this._minBetOfLastPlayedMachine=RSGame.getInstance().getGameData().getMinimumBetByGameTypeAndName(this.getGameType(), this.getCurrentMachineVO());cc.log("Min Bet:"+this._minBetOfLastPlayedMachine);this._analyticsNameOfLastPlayedMachine=RSAnalyticsManager.getInstance().getCurrentMachineName()},getMinimumBetRewardValue:function(){return this._minBetOfLastPlayedMachine},getLastPlayedMachineName:function(){return this._analyticsNameOfLastPlayedMachine},loadLocNotificationToaster:function(a){if(!this._locToasterActive){this._locToasterActive=!0;cc.log("show toaster");RSEngine.externalGameManager.loadToasterImage("LOC"); RSAnalyticsManager.getInstance().trackPlayerActionLOC("loc",RSAnalyticsManager.getInstance().getCurrentMachineName(),GameFeatureTypeEnum.PRIMARY_CURRENCY,"");var b=this,c=setInterval(function(){console.log("hide toaster");clearInterval(c);b._locToasterActive=!1;RSEngine.externalGameManager.hideToaster();RSPlacementManager.getInstance().getInterface().clearCurrentPopupTriggered()},5E3)}},rewardPlayerWithMinimumBetValue:function(a,b){if(this._minBetOfLastPlayedMachine)if(b)var c=this,d=setInterval(function(){clearInterval(d); RSEngine.popupManager.addPopup(new RSMinBetRewardPopup(c.getMinimumBetRewardValue(),a),!0);c._minBetOfLastPlayedMachine=0},b);else RSEngine.popupManager.addPopup(new RSMinBetRewardPopup(this.getMinimumBetRewardValue(),a),!0),this._minBetOfLastPlayedMachine=0;else a&&(RSPlacementManager.getInstance().getInterface().clearCurrentPopupTriggered(),a())},giftingFbPermissionPromptPopupEnabledStatus:function(){return!1},isFavoritedMachine:function(a,b){var c=RSEngine.dataManager.getMe().getFavoriteMachines(a); return c&&c.includes(b)?!0:!1},showWebAvatarPopup:function(a){var b={},c={};c.assetPath=[{name:RSGame.getInstance().getAssetPath("WebAvatarPopup"),count:1}];c.avatarImgAssetPath=RSGame.getInstance().getAssetFolder("AvatarPopup");c.avatarPlistName="AvatarImages_00";b.avatarImgCount=77;b.avatarsPerRow=5;b.rowPadding=8;RSEngine.popupManager.addPopup(new RSWebAvatarPopup(b,c,a),!0)},getAppsFlyerParameters:function(a){a={af_pack_name:""};a.af_level=String(RSGame.getInstance().getLevelManager().getCurrentLevel()); a.af_monetization_factor=String(RSEngine.dataManager.getMe().getMonetizationFactor());a.af_vip_tier=String(RSVIPManager.getInstance().getVIPUserTier());a.af_coin_balance=String(RSGame.getInstance().getUserDataManager().getMe().getCoins());a.af_join_date=String(RSEngine.dataManager.getMe().getJoiningDate());a.af_blob_id=RSEngine.dataManager.getMe().getId();a.af_session_id=""!=RSAnalyticsManager.getInstance().getCurrentSessionId()?RSAnalyticsManager.getInstance().getCurrentSessionId():0;a.af_propertyisnear= String(GlobalVars.isPropertyNear);return a},isSubscriptionInsidePurchaseCartIsEnabled:function(){return!1},isSkipSubscriptionTooltip:function(){return!1},isSaleRefreshEnabled:function(){return!1},triggerMemoryPopupStatus:function(){return!1},setMachinePlayed:function(){this.machinePlayed=!0},getMachinePlayed:function(){return this.machinePlayed},resetMachinePlayed:function(){this.machinePlayed=!1}});var RSLosingStreakManager=RSClass.extend({init:function(){this._super.init.call(this);this._isLosingStreakPopupActive=!1;this._locCallback=this._losingStreakPopupData=null},initializeLosingStreakManager:function(a){GameFeatureTypeEnum.LOSING_STREAK&&(this._LSBonusSheet=RSGame.getInstance().getGameManager().getLosingStreakValues());this._losingStreakPopupData=a},getPopupData:function(){return this._losingStreakPopupData},isLosingStreakPopupActive:function(){return this._isLosingStreakPopupActive}, getLosingStreakingValues:function(){return RSGame.getInstance().getUserDataManager().getMe().getLosingStreakingValues()},calculateLosingStreak:function(a){if(GameFeatureTypeEnum.LOSING_STREAK&&1==this._LSBonusSheet.isEnabled&&a){var b=this.getLosingStreakingValues();b.coinsPurchased&&(b.syncedCoins-=a,RSGame.getInstance().getUserDataManager().getMe().setLosingStreakingValues(b),RSGame.getInstance().getUserDataManager().saveUserData("setLosingStreakingValues"))}},checkLosingStreak:function(a,b){if(GameFeatureTypeEnum.LOSING_STREAK&& (b&&(this._locCallback=b),1==this._LSBonusSheet.isEnabled)){var c=this.getLosingStreakingValues();c.coinsPurchased&&(0<a&&this._startLSBonusTimer(),!this._isLosingStreakPopupActive&&c.timerValue>=TimeManager.getInstance().getCurrentServerTime()&&parseFloat(c.syncedCoins/c.coinsPurchased)>=parseFloat(this._LSBonusSheet.lossPercent)&&(RSEngine.externalGameManager.hideToaster(),RSGame.getInstance().getGameManager().showLosingStreakPopup(this._losingStreakPopupClosed.bind(this)),this._isLosingStreakPopupActive= !0))}},_startLSBonusTimer:function(){if(GameFeatureTypeEnum.LOSING_STREAK){var a=this.getLosingStreakingValues();0==a.timerValue&&(a.timerValue=TimeManager.getInstance().getCurrentServerTime()+parseInt(this._LSBonusSheet.time),RSGame.getInstance().getUserDataManager().getMe().setLosingStreakingValues(a),RSGame.getInstance().getUserDataManager().saveUserData("setLosingStreakingValues"))}},_losingStreakPopupClosed:function(){GameFeatureTypeEnum.LOSING_STREAK&&(this._losingStreakPopup=null,void 0!=this._locCallback&& null!=this._locCallback&&(this._locCallback(),this._locCallback=null),this._isLosingStreakPopupActive&&RSGame.getInstance().getGameManager().calculateAverageBet(0),this._isLosingStreakPopupActive=!1,this.setLSBonusValues(0))},setLSBonusValues:function(a){if(GameFeatureTypeEnum.LOSING_STREAK){var b={};b.coinsPurchased=a;b.timerValue=0;b.syncedCoins=0;RSGame.getInstance().getUserDataManager().getMe().setLosingStreakingValues(b);RSGame.getInstance().getUserDataManager().saveUserData("setLosingStreakingValues")}}, getLSBonusSheet:function(){return GameFeatureTypeEnum.LOSING_STREAK?this._LSBonusSheet:null}});var RSMachineLoader=RSMachine.extend({init:function(a,b,c,d,e,f,g){this._super.init.call(this);this._rsLayerObject=null;this._resourceFolders=a.filter(function(a){return a});this._buildTimestamp=b;this._bgURL=d+"?_t\x3d"+this._buildTimestamp;this._nextScreen=c;this._nextScreen.setLoadingDivs(f,e);this._progressDivAdded=!1;e&&(e.style.visibility="visible",this._progressDivAdded=!0);f&&(f.style.visibility="visible");g&&(this._paddingImageURL=g+"?_t\x3d"+this._buildTimestamp);this._bg=null;this._preloadRes= [];this._configCount=0;this._rsLayerObject=new RSScreenLoader;this._rsLayerObject.init();this._lastPostedProgress=this._progress=0;RSEngine.isMobile&&this._rsLayerObject.retain()},loadContent:function(){this._paddingImageURL&&(this.clipScreen(),this.setPaddingForMachine(this._paddingImageURL));var a=SCREEN_SIZES[RSEngine.layout].height,b=SCREEN_SIZES[RSEngine.layout].width;if(RSEngine.orientation==SCREEN_ORIENTATION.PORTRAIT)var c=a,a=b,b=c;this._bg=new RSImageObject(this);this._bg.setName("MachineLoadingImage"); this._bg.setImageFromUrl(this._bgURL,0,0,a,b);this._bg.setCenter(this._rsScreenRect.getWidth()/2,this._rsScreenRect.getHeight()/2);this.addChild(this._bg)},onImageLoaded:function(a){if("MachineLoadingImage"==a.getName())this.onLayoutCompleted();else this._super.onImageLoaded.call(this,a)},onImageLoadFailed:function(a){"MachineLoadingImage"==a.getName()?(a=this.getSize(),this._bg.setImageFromUrl(this._bgURL,0,0,a.getWidth(),a.getHeight())):this._super.onImageLoadFailed.call(this,a)},onReveal:function(){this._super.onReveal.call(this); this.getPreloadResources();RSCasinoManager.notifyMachineLoadingStart()},startPreload:function(){for(var a=this,b=[],c=0;c<a._preloadRes.length;c++)b.push(a._preloadRes[c]);this._rsLayerObject.initWithResources(b,function(b){a._progress=b;a.onPreloadProgress()},function(){b=a._preloadRes=null;a.onPreloadCompleted()})},onPreloadProgress:function(){if(this._progressDivAdded){var a=50+0.5*this._progress;document.querySelector("#ProgressBar").dataset.proBarPercent=a+"";animateProgressBarIn(0)}0==this._progress% 10&&this._progress>this._lastPostedProgress&&(this._lastPostedProgress=this._progress)},onPreloadCompleted:function(){var a=document.getElementById("OrientationInfo");a&&(a.style.display="none");this.loadNextScreen()},loadNextScreen:function(){this.loadNewScreen(this._nextScreen)},unloadContent:function(){this._rsLayerObject.unload();this._super.unloadContent.call(this)},getPreloadResources:function(){for(var a=0;a<this._resourceFolders.length;a++)this.loadResourceConfig(this._resourceFolders[a], this.onResourceConfigLoaded.bind(this))},onResourceConfigLoaded:function(a,b){this._configCount++;if(b){var c=b.revision;c||(c=this._buildTimestamp);var d=b.resList,e;for(e in d)this._preloadRes.push(a+d[e]+"?_t\x3d"+c)}this._configCount==this._resourceFolders.length&&this.startPreload()},loadResourceConfig:function(a,b){var c=a+"config.json?_t\x3d"+this._buildTimestamp;cc.loader.load(c,function(d,e){null!==d?(b(a,null),RSErrorTracker.getInstance().trackErrorMessage("ERROR READING JSON",c+" did not load with error "+ d[0].errorMessage,"mahesh.jose@rubyseven.net")):b(a,RSUtils.cloneJSON(e[0]))})}});var FBPixelManager=function(){var a,b=RSClass.extend({init:function(){},initializePixel:function(){var a=GameConfig.PIXEL_ID;!function(a,b,c,g,h,k,m){a.fbq||(h=a.fbq=function(){h.callMethod?h.callMethod.apply(h,arguments):h.queue.push(arguments)},a._fbq||(a._fbq=h),h.push=h,h.loaded=!0,h.version="2.0",h.queue=[],k=b.createElement(c),k.async=!0,k.src=g,m=b.getElementsByTagName(c)[0],m.parentNode.insertBefore(k,m))}(window,document,"script","https://connect.facebook.net/en_US/fbevents.js");fbq("init", a)},trackPageView:function(){fbq("track","PageView")},trackInstall:function(){fbq("trackCustom","Install",{external_id:RSEngine.dataManager.getMe().getId(),fbp:GlobalVars.fbCookieFBP,fbc:GlobalVars.fbCookieFBC})},trackPurchase:function(a,b,e){fbq("track","Purchase",{content_name:b+"_"+e,value:a,currency:"USD"})}});return{getInstance:function(){a||(a=new b);return a}}}();!function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?exports.Adjust=b():a.Adjust=b()}(window,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,f){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:f})},b.r=function(a){"undefined"!= typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"});Object.defineProperty(a,"__esModule",{value:!0})},b.t=function(a,c){if((1&c&&(a=b(a)),8&c)||4&c&&"object"==typeof a&&a&&a.__esModule)return a;var f=Object.create(null);if(b.r(f),Object.defineProperty(f,"default",{enumerable:!0,value:a}),2&c&&"string"!=typeof a)for(var g in a)b.d(f,g,function(b){return a[b]}.bind(null,g));return f},b.n=function(a){var c=a&&a.__esModule?function(){return a.default}:function(){return a}; return b.d(c,"a",c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p="",b(b.s=20)}([function(a,b,c){function d(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable}));c.push.apply(c,d)}return c}var e=c(2);a.exports=function(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{};b%2?d(Object(c),!0).forEach(function(b){e(a,b, c[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):d(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}return a}},function(a,b,c){var d=c(14),e=c(15),f=c(7),g=c(16);a.exports=function(a,b){return d(a)||e(a,b)||f(a,b)||g()}},function(a,b){a.exports=function(a,b,e){return b in a?Object.defineProperty(a,b,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[b]=e,a}},function(a,b,c){(function(b,c){a.exports= function(){function a(){var b=setTimeout;return function(){return b(g,1)}}function g(){for(var a=0;a<y;a+=2)(0,N[a])(N[a+1]),N[a]=void 0,N[a+1]=void 0;y=0}function h(a,b){var c=this,d=new this.constructor(m);void 0===d[P]&&x(d);var e=c._state;if(e){var f=arguments[e-1];A(function(){return w(e,d,f,c._result)})}else t(c,d,a,b);return d}function k(a){if(a&&"object"==typeof a&&a.constructor===this)return a;var b=new this(m);return p(b,a),b}function m(){}function n(a,b,c){b.constructor===a.constructor&& c===h&&b.constructor.resolve===k?function(a,b){1===b._state?s(a,b._result):2===b._state?u(a,b._result):t(b,void 0,function(b){return p(a,b)},function(b){return u(a,b)})}(a,b):void 0===c?s(a,b):"function"==typeof c?function(a,b,c){A(function(a){var d=!1,e=function(a,b,c,d){try{a.call(b,c,d)}catch(e){return e}}(c,b,function(c){d||(d=!0,b!==c?p(a,c):s(a,c))},function(b){d||(d=!0,u(a,b))},a._label);!d&&e&&(d=!0,u(a,e))},a)}(a,b,c):s(a,b)}function p(a,b){if(a===b)u(a,new TypeError("You cannot resolve a promise with itself")); else if(e=typeof(d=b),null===d||"object"!==e&&"function"!==e)s(a,b);else{d=void 0;try{d=b.then}catch(c){return void u(a,c)}n(a,b,d)}var d,e}function r(a){a._onerror&&a._onerror(a._result);v(a)}function s(a,b){void 0===a._state&&(a._result=b,a._state=1,0!==a._subscribers.length&&A(v,a))}function u(a,b){void 0===a._state&&(a._state=2,a._result=b,A(r,a))}function t(a,b,c,d){var e=a._subscribers,f=e.length;a._onerror=null;e[f]=b;e[f+1]=c;e[f+2]=d;0===f&&a._state&&A(v,a)}function v(a){var b=a._subscribers, c=a._state;if(0!==b.length){for(var d=void 0,e=void 0,f=a._result,g=0;g<b.length;g+=3)d=b[g],e=b[g+c],d?w(c,d,e,f):e(f);a._subscribers.length=0}}function w(a,b,c,d){var e="function"==typeof c,f=void 0,g=void 0,h=!0;if(e){try{f=c(d)}catch(k){h=!1,g=k}if(b===f)return void u(b,new TypeError("A promises callback cannot return that same promise."))}else f=d;void 0!==b._state||(e&&h?p(b,f):!1===h?u(b,g):1===a?s(b,f):2===a&&u(b,f))}function x(a){a[P]=T++;a._state=void 0;a._result=void 0;a._subscribers=[]} var B=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},y=0,z=void 0,C=void 0,A=function(a,b){N[y]=a;N[y+1]=b;2===(y+=2)&&(C?C(g):I())},D="undefined"!=typeof window?window:void 0,F=D||{},F=F.MutationObserver||F.WebKitMutationObserver,M="undefined"==typeof self&&void 0!==b&&"[object process]"==={}.toString.call(b),E="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,N=Array(1E3),Q,H,R,K,I=void 0; M?I=function(){return b.nextTick(g)}:F?(H=0,R=new F(g),K=document.createTextNode(""),R.observe(K,{characterData:!0}),I=function(){K.data=H=++H%2}):E?((Q=new MessageChannel).port1.onmessage=g,I=function(){return Q.port2.postMessage(0)}):I=void 0===D?function(){try{var b=Function("return this")().require("vertx");return void 0!==(z=b.runOnLoop||b.runOnContext)?function(){z(g)}:a()}catch(c){return a()}}():a();var P=Math.random().toString(36).substring(2),T=0,S=function(){function a(b,c){this._instanceConstructor= b;this.promise=new b(m);this.promise[P]||x(this.promise);B(c)?(this.length=c.length,this._remaining=c.length,this._result=Array(this.length),0===this.length?s(this.promise,this._result):(this.length=this.length||0,this._enumerate(c),0===this._remaining&&s(this.promise,this._result))):u(this.promise,Error("Array Methods must be provided an Array"))}return a.prototype._enumerate=function(a){for(var b=0;void 0===this._state&&b<a.length;b++)this._eachEntry(a[b],b)},a.prototype._eachEntry=function(a,b){var c= this._instanceConstructor,d=c.resolve;if(d===k){var e=d=void 0,f=!1;try{d=a.then}catch(g){f=!0,e=g}d===h&&void 0!==a._state?this._settledAt(a._state,b,a._result):"function"!=typeof d?(this._remaining--,this._result[b]=a):c===O?(c=new c(m),f?u(c,e):n(c,a,d),this._willSettleAt(c,b)):this._willSettleAt(new c(function(b){return b(a)}),b)}else this._willSettleAt(d(a),b)},a.prototype._settledAt=function(a,b,c){var d=this.promise;void 0===d._state&&(this._remaining--,2===a?u(d,c):this._result[b]=c);0=== this._remaining&&s(d,this._result)},a.prototype._willSettleAt=function(a,b){var c=this;t(a,void 0,function(a){return c._settledAt(1,b,a)},function(a){return c._settledAt(2,b,a)})},a}(),O=function(){function a(b){this[P]=T++;this._result=this._state=void 0;this._subscribers=[];if(m!==b){if("function"!=typeof b)throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(this instanceof a)(function(a,b){try{b(function(b){p(a,b)},function(b){u(a,b)})}catch(c){u(a, c)}})(this,b);else throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");}}return a.prototype.catch=function(a){return this.then(null,a)},a.prototype.finally=function(a){var b=this.constructor;return"function"==typeof a?this.then(function(c){return b.resolve(a()).then(function(){return c})},function(c){return b.resolve(a()).then(function(){throw c;})}):this.then(a,a)},a}();return O.prototype.then=h,O.all=function(a){return(new S(this, a)).promise},O.race=function(a){var b=this;return B(a)?new b(function(c,d){for(var e=a.length,f=0;f<e;f++)b.resolve(a[f]).then(c,d)}):new b(function(a,b){return b(new TypeError("You must pass an array to race."))})},O.resolve=k,O.reject=function(a){var b=new this(m);return u(b,a),b},O._setScheduler=function(a){C=a},O._setAsap=function(a){A=a},O._asap=A,O.polyfill=function(){var a=void 0;if(void 0!==c)a=c;else if("undefined"!=typeof self)a=self;else try{a=Function("return this")()}catch(b){throw Error("polyfill failed because global object is unavailable in this environment"); }var d=a.Promise;if(d){var f=null;try{f=Object.prototype.toString.call(d.resolve())}catch(g){}if("[object Promise]"===f&&!d.cast)return}a.Promise=O},O.Promise=O,O}()}).call(this,c(12),c(13))},function(a,b){function c(a,b){for(var c=0;c<b.length;c++){var g=b[c];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}a.exports=function(a,b,f){return b&&c(a.prototype,b),f&&c(a,f),a}},function(a,b,c){var d=c(17),e=c(18),f=c(7),g=c(19);a.exports=function(a){return d(a)|| e(a)||f(a)||g()}},function(a,b){a.exports=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}},function(a,b,c){var d=c(8);a.exports=function(a,b){if(a){if("string"==typeof a)return d(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?d(a,b):void 0}}},function(a,b){a.exports=function(a,b){(null== b||b>a.length)&&(b=a.length);for(var e=0,f=Array(b);e<b;e++)f[e]=a[e];return f}},function(a,b,c){var d=c(11);a.exports=function(a,b){if(null==a)return{};var c,h,k=d(a,b);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(a);for(h=0;h<m.length;h++)c=m[h],0<=b.indexOf(c)||Object.prototype.propertyIsEnumerable.call(a,c)&&(k[c]=a[c])}return k}},function(a,b){function c(b){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?a.exports=c=function(a){return typeof a}:a.exports= c=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},c(b)}a.exports=c},function(a,b){a.exports=function(a,b){if(null==a)return{};var e,f,g={},h=Object.keys(a);for(f=0;f<h.length;f++)e=h[f],0<=b.indexOf(e)||(g[e]=a[e]);return g}},function(a,b){function c(){throw Error("setTimeout has not been defined");}function d(){throw Error("clearTimeout has not been defined");}function e(a){if(m===setTimeout)return setTimeout(a,0);if((m===c||!m)&&setTimeout)return m= setTimeout,setTimeout(a,0);try{return m(a,0)}catch(b){try{return m.call(null,a,0)}catch(d){return m.call(this,a,0)}}}function f(){v&&u&&(v=!1,u.length?t=u.concat(t):w=-1,t.length&&g())}function g(){if(!v){var a=e(f);v=!0;for(var b=t.length;b;){u=t;for(t=[];++w<b;)u&&u[w].run();w=-1;b=t.length}u=null;v=!1;(function(a){if(n===clearTimeout)return clearTimeout(a);if((n===d||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(a);try{n(a)}catch(b){try{return n.call(null,a)}catch(c){return n.call(this, a)}}})(a)}}function h(a,b){this.fun=a;this.array=b}function k(){}var m,n,p=a.exports={};try{m="function"==typeof setTimeout?setTimeout:c}catch(r){m=c}try{n="function"==typeof clearTimeout?clearTimeout:d}catch(s){n=d}!0;var u,t=[],v=!1,w=-1;p.nextTick=function(a){var b=Array(arguments.length-1);if(1<arguments.length)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];t.push(new h(a,b));1!==t.length||v||e(g)};h.prototype.run=function(){this.fun.apply(null,this.array)};p.title="browser";p.browser= !0;p.env={};p.argv=[];p.version="";p.versions={};p.on=k;p.addListener=k;p.once=k;p.off=k;p.removeListener=k;p.removeAllListeners=k;p.emit=k;p.prependListener=k;p.prependOnceListener=k;p.listeners=function(a){return[]};p.binding=function(a){throw Error("process.binding is not supported");};p.cwd=function(){return"/"};p.chdir=function(a){throw Error("process.chdir is not supported");};p.umask=function(){return 0}},function(a,b){var c;c=function(){return this}();try{c=c||(new Function("return this"))()}catch(d){"object"== typeof window&&(c=window)}a.exports=c},function(a,b){a.exports=function(a){if(Array.isArray(a))return a}},function(a,b){a.exports=function(a,b){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(a)){var e=[],f=!0,g=!1,h=void 0;try{for(var k,m=a[Symbol.iterator]();!(f=(k=m.next()).done)&&(e.push(k.value),!b||e.length!==b);f=!0);}catch(n){g=!0,h=n}finally{try{f||null==m.return||m.return()}finally{if(g)throw h;}}return e}}},function(a,b){a.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }},function(a,b,c){var d=c(8);a.exports=function(a){if(Array.isArray(a))return d(a)}},function(a,b){a.exports=function(a){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(a))return Array.from(a)}},function(a,b){a.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}},function(a,b,c){function d(a){return!Object.keys(a).length&&a.constructor===Object}function e(a){return"object"=== tc()(a)&&null!==a&&!(a instanceof Array)}function f(a){try{return e(JSON.parse(a))}catch(b){return!1}}function g(a,b,c){function d(a){return b instanceof Array?b.every(function(b){return a[b]===c[b]}):a[b]===c}for(var e=0;e<a.length;e+=1)if(d(a[e]))return e;return-1}function h(){return(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]).reduce(function(a,b){return J()(J()({},a),{},X()({},b.key,b.value))},{})}function k(){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];return(0< arguments.length&&void 0!==arguments[0]?arguments[0]:[]).filter(function(b){return-1!==a.indexOf(b)})}function m(a,b){return RegExp("\\/".concat(b,"(\\/.*|\\?.*){0,1}$")).test(a)}function n(a,b){var c=Y()(b,2),d=c[0],c=c[1];return J()(J()({},a),{},X()({},d,c))}function p(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},b=1<arguments.length?arguments[1]:void 0,c={entries:function(b){return[b,a[b]]},values:function(b){return a[b]}};return Object[b]?Object[b](a):Object.keys(a).map(c[b])} function r(a){return p(a,"entries")}function s(a){return e(a)?!d(a):!!a||0===a}function u(a,b){var c;if(!(zb[Ab]<zb[b])){for(var d=(new Date).toISOString(),f=uc[a],d=["[".concat(Ia.namespace,"]"),d,"".concat(a.toUpperCase(),":").concat(f)],f=Bb?document.querySelector(Bb):null,g=arguments.length,h=Array(2<g?g-2:0),k=2;k<g;k++)h[k-2]=arguments[k];(c=console)[a].apply(c,d.concat(h));f&&(f.textContent+="".concat(d.join(" ")," ").concat(h.map(function(a){return e(a)?JSON.stringify(a):a}).join(" "),"\n"), f.scrollTop=f.scrollHeight)}}function t(a,b){return function(){for(var c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];u.apply(void 0,[a,b].concat(d))}}function v(a){var b=Cb.filter(function(b){return!a[b]});return!!b.length&&(L.error("You must define ".concat(function(a){if(!a.length)return"";if(1===a.length)return a[0];var b=a.length-1,c=a.slice(0,b).join(", ");return"".concat(c," and ").concat(a[b])}(b))),!0)}function w(a,b,c){var d,e=c.values?{values:(d=c.values,r(d).map(function(a){var b= Y()(a,2);a=b[1];var c;b=b[0];try{c=JSON.parse(b)}catch(d){c=b}return[a,c]}).reduce(n,{}))}:{};d=c.keys?{keys:x(a,c.keys)}:{};c=c.composite?{composite:c.composite.map(function(b){return B(a,b)})}:{};return J()(J()(J()({key:b},e),d),c)}function x(a,b){return r(b).map(function(b){var c=Y()(b,2);b=c[0];c=c[1];return c.key?[c.key,w(a,b,c)]:[c,b]}).reduce(n,{})}function B(a,b){var c=Ya[a].scheme.fields[b];return c?c.key||c:b}function y(a){for(var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]: 1,c=a+"",d=1;d<=b;d+=1)a<Math.pow(10,d)&&(c="0".concat(c));return c}function z(a){var b=a?new Date(a):new Date;a=function(a){var b=y(a.getDate()),c=y(a.getMonth()+1);return[a.getFullYear(),c,b].join("-")}(b);var c=function(a){var b=y(a.getHours(),1),c=y(a.getMinutes()),d=y(a.getSeconds());a=y(a.getMilliseconds(),2);return[b,c,d].join(":")+"."+a}(b),b=function(a){a=a.getTimezoneOffset();return(0<a?"-":"+")+y(Math.floor(Math.abs(a)/60))+y(Math.abs(a)%60)}(b);return"".concat(a,"T").concat(c,"Z").concat(b)} function C(a,b){return isNaN(a)||isNaN(b)?0:Math.abs(b-a)}function A(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};ea=va?J()({},a):{}}function D(){if(va){var a=ea,b;b=(b=ea.lastActive)?Math.round(C(b,Date.now())/1E3):-1;a.lastInterval=b;ea.lastActive=Date.now()}}function F(a){ea=J()(J()({},ea),a)}function M(){return Math.round(C(ea.lastActive,Date.now())/1E3)}function E(){var a=C(ea.lastActive,Date.now())<ha.sessionWindow;return(ea.sessionLength||0)+(Ja||!Ja&&a?M():0)}function N(){va&& (F({timeSpent:(ea.timeSpent||0)+(Ja?M():0),sessionLength:E()}),D())}function Q(a,b){return a&&void 0!==a[b]?a[b]:b}function H(a){var b=a.storeName,c=a.dir,d=a.record,f=a.scheme;if(d)return f=f||ia[c][I({storeName:b,dir:Z.right})].fields,r(d).map(function(a){a=Y()(a,2);var d=a[0];var g={storeName:b,scheme:f[d],dir:c,key:d,value:a[1]};a=g.storeName;var d=g.scheme,h=g.dir,k=g.key,g=g.value;d?(k=d.key||d,a=e(g)?[k,H({storeName:a,dir:h,record:g,scheme:d.keys})]:[k,Q(d.values,g)]):a=[k,g];return a}).reduce(function(a, b){var c=Y()(b,2),d=c[0],c=c[1];return J()(J()({},a),{},X()({},d,c))},{})}function R(a){var b=a.storeName,c=a.dir;a=a.records;return(void 0===a?[]:a).map(function(a){return H({storeName:b,dir:c,record:a})})}function K(a){var b=a.target,c=ia[a.dir][I({storeName:a.storeName,dir:Z.right})];a=c.fields[c.keyPath];var d=b instanceof Array?b.slice():[b],b=(a.composite||[c.keyPath]).map(function(a,b){return Q(c.fields[a].values,d[b])});return 1===b.length?b[0]:b}function I(a){var b=a.storeName;return(ia.storeNames[a.dir][b]|| {}).name||b}function P(a){var b=a.storeName;a=a.error;return{name:a.name,message:a.message.replace('"'.concat(b,'"'),I({storeName:b,dir:Z.right}))}}function T(a,b){var c="id"+Math.random().toString(36).substr(2,16),d={id:c,cb:b};return La[a]||(La[a]=[]),La[a].push(d),c}function S(a,b){La[a]&&La[a].forEach(function(c){"function"==typeof c.cb&&Db.push(setTimeout(function(){return c.cb(a,b)}))})}function O(){return Qa||G(),Qa?J()({},Qa):null}function G(){Qa=ca.stores[Ra]}function U(){var a=O();return a? a.sdkDisabled:null}function W(a){a=a?J()({},a):null;ca.stores[Ra]=J()(J()({},O()),{},{sdkDisabled:a});G()}function ga(){var a=O();return a?a.thirdPartySharingDisabled:null}function la(){var a=(Qa||{}).sdkDisabled||null;(ca.stores[Ra]||{}).sdkDisabled&&!a&&S("sdk:shutdown");G()}function ba(){ca.stores[Ra]||(ca.stores[Ra]=J()({},Qa))}function ta(a){var b=null;return null!==Eb?Eb:Eb=Sa.all([lb.isSupported(),Fb.isSupported()]).then(function(c){var d=Y()(c,2);c=d[0];d=d[1];if(ca.setCustomName(a),c){Za= $a.indexedDB;var e=new lb;return e.setCustomName(a).then(function(){return b=e})}return d?(Za=$a.localStorage,b=new Fb,Sa.resolve(b)):(L.error("There is no storage available, app will run with minimum set of features"),Za=$a.noStorage,b=null,Sa.resolve(b))}).then(function(){return{type:Za,storage:b}})}function pa(){return aa.getAll("queue").then(function(a){return{queueSize:a.length}}).then(function(a){var b=J(),c=J(),d=J(),e=J()(J()(J()(J()(J()({},{createdAt:z()}),{sentAt:z()}),{webUuid:V.current.uuid}), (f=navigator,g=void 0!==f.doNotTrack,k=void 0!==window.doNotTrack,m=void 0!==f.msDoNotTrack,n=g?f.doNotTrack:k?window.doNotTrack:m?f.msDoNotTrack:null,0===parseInt(n,10)||"no"===n?{trackingEnabled:!0}:1===parseInt(n,10)||"yes"===n?{trackingEnabled:!1}:null)),{platform:"web"}),f=navigator,f=(f.language||f.userLanguage||"en").split("-"),f=Y()(f,2),g=f[1],f={language:f[0],country:g?""+g.toLowerCase():void 0};return b(c(d(e,f),(h=navigator.userAgent||navigator.vendor,{machineType:"Win32"!==navigator.platform|| -1===h.indexOf("WOW64")&&-1===h.indexOf("Win64")?navigator.platform:"Win64"})),a);var h,f,g,k,m,n})}function qa(){var a=ha.getCustomConfig(),b=a.customUrl,a=a.urlStrategy;return b?{app:b,gdpr:b}:a===ja.India?[ja.India,ja.Default]:a===ja.China?[ja.China,ja.Default]:[ja.Default,ja.India,ja.China]}function ka(a,b){return{status:"error",action:2<arguments.length&&void 0!==arguments[2]&&arguments[2]?"CONTINUE":"RETRY",response:f(a.responseText)?JSON.parse(a.responseText):a.responseText,message:Gb[b],code:b}} function xa(a,b){var c=a.slice(0,a.length-b.length-1).split("").reduce(function(a){return a.concat(" ")},"");return"".concat(b).concat(c,":")}function wa(a,b){var c=function(a){return a.replace(/([A-Z])/g,function(a){return"_".concat(a.toLowerCase())})},d=r(J()(J()(J()({},ha.getBaseParams()),b),a)).map(function(a){a=Y()(a,2);var b=a[1];return[c(a[0]),b]});return L.log("REQUEST PARAMETERS:"),d.filter(function(a){return s(Y()(a,2)[1])}).map(function(a){var b=Y()(a,2);a=b[0];b=b[1];L.log(xa("REQUEST PARAMETERS:", a),b);a=[a,b];b=Y()(a,2);a=b[1];var b=encodeURIComponent(b[0]),c=a;return"string"==typeof a&&(c=encodeURIComponent(a)),e(a)&&(c=encodeURIComponent(JSON.stringify(a)||"")),[b,c].join("\x3d")}).join("\x26")}function ya(a,b,c){var d=c.xhr;c=c.url;if(4===d.readyState){var e=200<=d.status&&300>d.status,g=f(d.responseText);if(0!==d.status)return g?b(e?function(a,b){var c=JSON.parse(a.responseText),d={status:"success",adid:c.adid,timestamp:c.timestamp,ask_in:c.ask_in,retry_in:c.retry_in,continue_in:c.continue_in, tracking_state:c.tracking_state,attribution:void 0,message:void 0};return m(b,"attribution")&&(d.attribution=c.attribution,d.message=c.message),r(d).filter(function(a){return!!Y()(a,2)[1]}).reduce(n,{})}(d,c):ka(d,"SERVER_CANNOT_PROCESS",!0)):a(ka(d,e?"SERVER_MALFORMED_RESPONSE":"SERVER_INTERNAL_ERROR"));a(ka(d,"NO_CONNECTION"))}}function za(a,b,c){var d=a.url,e=a.method,f=void 0===e?"GET":e;a=a.params;b=function(a,b,c){var d=a.url,e=a.method;a=wa(a.params,b);return{fullUrl:c["/gdpr_forget_device"=== d?"gdpr":"app"]+d+("GET"===e?"?".concat(a):""),encodedParams:a}}({url:d,method:f,params:void 0===a?{}:a},b,c);var g=b.fullUrl,h=b.encodedParams;return new wc(function(a,b){var c=new XMLHttpRequest;c.open(f,g,!0);(function(a,b){var c=[["Client-SDK","js".concat(Ia.version)],["Content-Type","POST"===b?"application/x-www-form-urlencoded":"application/json"]];L.log("REQUEST HEADERS:");c.forEach(function(b){var c=Y()(b,2);b=c[0];c=c[1];a.setRequestHeader(b,c);L.log(xa("REQUEST HEADERS:",b),c)})})(c,f); c.onreadystatechange=function(){return ya(b,a,{xhr:c,url:d})};c.onerror=function(){return b(ka(c,"TRANSACTION_ERROR"))};c.send("GET"===f?void 0:h)})}function na(a,b){return function(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:yc,c=qa();if(Array.isArray(c)){var d=0;return function vc(){var e=c[d++];return a(b[e]).catch(function(a){if("NO_CONNECTION"===a.code&&(L.log("Failed to connect ".concat(Xb[e]," endpoint")),d<c.length))return L.log("Trying ".concat(Xb[c[d]]," one")),vc(); throw a;})}()}return a(c)}(function(c){return za(a,b,c)})}function ua(a){return pa().then(function(b){return na(a,b)}).then(function(b){var c=a.url;if("success"===b.status){var d=m(c,"gdpr_forget_device"),e=m(c,"attribution"),f=m(c,"session"),c=m(c,"disable_third_party_sharing"),g="opted_out"===b.tracking_state;!d&&g?b=(S("sdk:gdpr-forget-me"),b):(e||d||g||!b.ask_in||S("attribution:check",b),f&&S("session:finished",b),b=c?(S("sdk:third-party-sharing-opt-out"),b):b)}return b})}function fa(){Hb=!0} function Na(){Hb=!1}function da(a,b){var c=a.reason,d=a.pending,e=U()||{},f="start"===b&&e.pending?"start":"finish",g="finish"===b&&e.reason&&!e.pending;return"start"===b&&e.reason||g?(L.log(Yb(e.reason)[f].inProgress),!1):(L.log(Yb(c)[f].done),W({reason:c||"general",pending:d}),!0)}function Ga(a){return da({reason:a,pending:1<arguments.length&&void 0!==arguments[1]&&arguments[1]||!1},"start")}function Aa(){var a=U()||{};return"general"===a.reason||"gdpr"===a.reason&&!a.pending?"off":"gdpr"===a.reason&& a.pending?"paused":"on"}function jb(a){return a?"unknown"===a.uuid?(Ga({reason:"gdpr"}),V.destroy(),{exists:!0,stored:null}):(V.init(a),{exists:!0,stored:a}):{exists:!1}}function Ba(){if("off"===Aa()||!V.isStarted())return Zb.resolve(null);var a=J()(J()({},V.current),{},{lastActive:Date.now()});return aa.updateItem("activityState",a).then(function(){return V.current=a})}function kb(){var a=Date.now();return ra.timestamp&&a<=ra.timestamp&&(a=ra.timestamp+1),ra.timestamp=a,a}function Ha(a){var b=a.url, c=a.method,d=a.params,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},f=e.timestamp;V.updateParams(b,e.auto);d=r(d||{}).filter(function(a){return s(Y()(a,2)[1])}).reduce(n,{});c={timestamp:kb(),url:b,method:c,params:J()(J()({},V.getParams(b)),d)};return f&&(c.createdAt=f),aa.addItem("queue",c).then(function(){return m(b,"session")&&V.resetSessionOffset(),V.updateLastActive(),Ba()}).then(function(){return ra.running?{}:Oa()})}function xb(){var a=0<arguments.length&&void 0!==arguments[0]? arguments[0]:{},b=a.timestamp,c=a.createdAt,d=a.url,e=a.method,a=a.params,f=1<arguments.length?arguments[1]:void 0,g=V.current||{},g="/session"===d&&!g.installed;return mb&&!g||!d&&!e&&!a?(ra.running=!1,Ib.resolve({})):$b.send({url:d,method:e,params:J()(J()({},a),{},{createdAt:z(c||b)}),wait:f||yb()})}function yb(){var a=ra.pause||{},b=a.timestamp,a=a.wait,b=Date.now()-(b||0);return b<a?a-b:null}function Oa(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},b=a.cleanUp,c=a.wait;if(ra.running)return Ib.resolve({}); ra.running=!0;a=Ib.resolve({});return b&&(a=a.then(hb)),a.then(function(){return aa.getFirst("queue")}).then(function(a){return xb(a,c)})}function Wa(a){if(void 0!==a)if(a!==mb){var b=mb;mb=a;!a&&b&&Oa();L.info("The app is now in ".concat(a?"offline":"online"," mode"))}else L.error("The app is already in ".concat(a?"offline":"online"," mode"));else L.error("State not provided, true or false has to be defined")}function hb(){var a=Date.now()-ha.requestValidityWindow;return aa.deleteBulk("queue",a, "upperBound")}function Pa(a){return(a||[]).map(function(a){return{key:a.key,value:a.value}})}function Xa(){return ab.all([aa.filterBy("globalParams","callback"),aa.filterBy("globalParams","partner")]).then(function(a){a=Y()(a,2);var b=a[1];return{callbackParams:Pa(a[0]),partnerParams:Pa(b)}})}function Ka(a,b){if(void 0===b)return L.error(Jb),ab.reject({message:Kb});var c=h(a),d=Object.keys(c).map(function(a){return{key:a,value:c[a],type:b}});return ab.all([aa.filterBy("globalParams",b),aa.addBulk("globalParams", d,!0)]).then(function(a){var c=Y()(a,2);a=c[1];c=k(c[0].map(function(a){return a.key}),a.map(function(a){return a[0]}));return L.log("Following ".concat(b," parameters have been saved: ").concat(d.map(function(a){return"".concat(a.key,":").concat(a.value)}).join(", "))),c.length&&L.log("Keys: ".concat(c.join(", ")," already existed so their values have been updated")),a})}function ib(a,b){return void 0===b?(L.error(Jb),ab.reject({message:Kb})):aa.deleteItem("globalParams",[a,b]).then(function(c){return L.log("".concat(a, " ").concat(b," parameter has been deleted")),c})}function Ea(a){return void 0===a?(L.error(Jb),ab.reject({message:Kb})):aa.deleteBulk("globalParams",a).then(function(b){return L.log("All ".concat(a," parameters have been deleted")),b})}function sa(){Fa=function(){var a=document;if(void 0!==a.hidden)return{hidden:"hidden",visibilityChange:"visibilitychange"};for(var b=r({mozHidden:"mozvisibilitychange",msHidden:"msvisibilitychange",oHidden:"ovisibilitychange",webkitHidden:"webkitvisibilitychange"}), c=0;c<b.length;c+=1){var d=Y()(b[c],2),e=d[0],d=d[1];if(void 0!==a[e])return{hidden:e,visibilityChange:d}}return null}();var a;Lb?a=ac.reject({interrupted:!0,message:"Session watch already initiated"}):(Lb=!0,T("session:finished",zc),Fa&&Ta.addEventListener&&Ta.addEventListener(Fa.visibilityChange,bc,!1),a=Fa&&Ta[Fa.hidden]?(L.log("Session request attempt canceled because the tab is still hidden"),ac.resolve({})):(V.initParams(),dc()));return a}function Ac(){clearInterval(nb);return V.updateSessionOffset(), V.toBackground(),Ba()}function Bc(){return aa.getFirst("activityState").then(function(a){var b=V.current,c=b.lastActive||0;"off"!==Aa()&&V.isStarted()&&c<a.lastActive&&(c=(b.sessionCount||0)<(a.sessionCount||0),(!b.installed&&a.installed||c)&&S("sdk:installed"),V.current=a,la());return a}).then(function(){V.updateSessionLength();V.toForeground()}).then(dc)}function bc(){clearTimeout(Mb);Mb=setTimeout(Fa&&Ta[Fa.hidden]?Ac:Bc,0)}function zc(a,b){if(!b||"error"!==b.status)return V.updateInstalled(), S("sdk:installed"),Ba();L.error("Session was not successful, error was returned from the server:",b.response)}function dc(){clearInterval(nb);nb=setInterval(function(){return V.updateSessionOffset(),Ba()},ha.sessionTimerWindow);var a=V.current,b=a.lastInterval,a=0<a.sessionCount;return!a||a&&1E3*b>=ha.sessionWindow?Xa().then(function(a){var b,c;Ha({url:"/session",method:"POST",params:(b=a.callbackParams,c=a.partnerParams,{callbackParams:b.length?h(b):null,partnerParams:c.length?h(c):null})},{auto:!0})}): (S("attribution:check"),Ba())}function ec(a){var b=Aa();return a||"on"===b?ha.isInitialised()?(fc.send({params:J()({},V.getParams())}).then(function(){S("sdk:gdpr-forget-me")}),!0):(L.log(Nb.pending),!0):(L.log(Nb[b]),!1)}function gc(){var a=ga()||{};return a.reason?a.pending?"pending":"off":"on"}function hc(a){var b=gc();return a||"on"===b?ha.isInitialised()?(Ha({url:"/disable_third_party_sharing",method:"POST"}),!0):(L.log(bb.delayed),!0):(L.log(bb[b]),!1)}function ic(a,b){var c,d,e=ga()||{},f= "start"===b&&a?"start":"finish",g="finish"===b&&e.reason&&!e.pending;return"start"===b&&e.reason||g?(L.log(bb[f].inProgress),!1):(L.log(bb[f].done),d=(c={reason:"general",pending:a},J()({},c)),ca.stores[Ra]=J()(J()({},O()),{},{thirdPartySharingDisabled:d}),G(),!0)}function Cc(){return ic(!1,"finish")}function jc(){"pending"===gc()&&(L.log(bb.running),hc(!0))}function Dc(a){return a?aa.getAll("eventDeduplication").then(function(a){return a.map(function(a){return a.id})}).then(function(b){return-1=== b.indexOf(a)?function(a){var b=ha.getCustomConfig().eventDeduplicationListLimit,c=0<b?b:10;return aa.count("eventDeduplication").then(function(a){var b=Ob.resolve();a>=c&&(a=a-c+1,L.log("Event deduplication list limit has been reached. Oldest ids are about to be removed (".concat(a," of them)")),b=aa.trimItems("eventDeduplication",a));return b}).then(function(){return L.info("New event deduplication id is added to the list: ".concat(a)),aa.addItem("eventDeduplication",{id:a})})}(a):Ob.reject({message:"Event won't be tracked, since it was previously tracked with the same deduplication id ".concat(a)})}): Ob.resolve()}function Ec(a){return{clickTime:z(),source:"web_referrer",referrer:decodeURIComponent(a)}}function Fc(){var a=window.location.search.substring(1).split("\x26").map(function(a){return a.split("\x3d")}).reduce(n,{}).adjust_referrer;a&&Ha({url:"/sdk_click",method:"POST",params:Ec(a)})}function Gc(){hc()&&ic(!0,"start")}function Hc(){var a;"paused"===Aa()&&(da({reason:"gdpr",pending:!1},"finish"),ob.all([(a={uuid:"unknown"},V.current=a,aa.clear("activityState").then(function(){return aa.addItem("activityState", a)})),aa.clear("globalParams"),aa.clear("queue")]).then(kc))}function Pb(){pb=Ua=!1;qb=[];$b.clear();ra.running=!1;ra.timestamp=null;ra.pause=null;Lb=!1;V.toBackground();clearInterval(nb);Fa&&(clearTimeout(Mb),Ta.removeEventListener&&Ta.removeEventListener(Fa.visibilityChange,bc,!1));lc.clear()}function cb(a){a&&L.log("Adjust SDK has been shutdown due to asynchronous disable");Pb();Db.forEach(clearTimeout);Db=[];La={};V.destroy();window.removeEventListener&&window.removeEventListener("online",fa, !1);window.removeEventListener&&window.removeEventListener("offline",Na,!1);aa.destroy();ha.destroy()}function kc(){Qb=!1;cb();fc.clear();rb=null;L.log("Adjust SDK instance has been destroyed")}function Ic(a){L.log("Adjust SDK is starting with web_uuid set to ".concat(a.uuid));var b=V.current.installed;"paused"===Aa()&&(L.log(Nb.running),ec(!0));b||jc();a=Aa();var c=function(a){return"Adjust SDK start has been interrupted ".concat(a)};return"off"===a?(cb(),ob.reject({interrupted:!0,message:c("due to complete async disable")})): "paused"===a?(Pb(),ob.reject({interrupted:!0,message:c("due to partial async disable")})):pb?ob.reject({interrupted:!0,message:c("due to multiple synchronous start attempt")}):(Oa({cleanUp:!0}),sa().then(function(){Ua=!1;pb=!0;b&&(mc(),jc())}))}function mc(){Qb=!0;qb.forEach(function(a){"function"==typeof a.method&&(L.log("Delayed ".concat(a.description," task is running now")),a.method(a.timestamp))});qb=[];r(La).some(function(a){var b=Y()(a,2)[1];return b.some(function(a,c){if("sdk:installed"=== a.id)return b.splice(c,1),!0})})}function Jc(a){if(a.interrupted)L.log(a.message);else if(cb(),L.error("Adjust SDK start has been canceled due to an error",a),a.stack)throw a;}function nc(a){"off"!==Aa()?(ha.set(a),window.addEventListener&&window.addEventListener("online",fa,!1),window.addEventListener&&window.addEventListener("offline",Na,!1),T("sdk:installed",mc),T("sdk:shutdown",function(){return cb(!0)}),T("sdk:gdpr-forget-me",Hc),T("sdk:third-party-sharing-opt-out",Cc),T("attribution:check", function(a,b){return c=b,d=V.current,(e=(c||{}).ask_in)||!d.attribution&&d.installed?(lc.send({params:J()({initiatedBy:c?"backend":"sdk"},V.getParams()),wait:e}),V.updateSessionOffset(),Ba()):Rb.resolve(d);var c,d,e}),"function"==typeof a.attributionCallback&&T("attribution:change",a.attributionCallback),(sb?Zb.reject({interrupted:!0,message:"Adjust SDK start already in progress"}):(sb=!0,aa.getFirst("activityState").then(jb).then(function(a){if(a.exists)return sb=!1,a.stored;var b,c=d(V.current)? {uuid:(b=Date.now(),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var c=(b+16*Math.random())%16|0;return b=Math.floor(b/16),("x"===a?c:11&c).toString(16)}))}:V.current;return aa.addItem("activityState",c).then(function(){return V.init(c),la(),sb=!1,c})}))).then(Ic).then(Fc).catch(Jc)):L.log("Adjust SDK is disabled, can not start the sdk")}function Ca(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},d=c.schedule,c=c.stopBeforeInit;aa.getType()!==Sb?"on"===Aa()? d&&c&&!Ua&&!ha.isInitialised()?L.error("Adjust SDK can not ".concat(a,", sdk instance is not initialized")):"function"==typeof b&&(!d||Qb&&pb||!c&&!Ua&&!ha.isInitialised()?b():(qb.push({method:b,description:a,timestamp:Date.now()}),L.log("Running ".concat(a," is delayed until Adjust SDK is up")))):L.log("Adjust SDK is disabled, can not ".concat(a)):L.log("Adjust SDK can not ".concat(a,", no storage available"))}c.r(b);var Kc=c(0),J=c.n(Kc),Lc=c(9),Mc=c.n(Lc),Nc=c(1),Y=c.n(Nc),Oc=c(5),db=c.n(Oc),Gb= {TRANSACTION_ERROR:"XHR transaction failed due to an error",SERVER_MALFORMED_RESPONSE:"Response from server is malformed",SERVER_INTERNAL_ERROR:"Internal error occurred on the server",SERVER_CANNOT_PROCESS:"Server was not able to process the request, probably due to error coming from the client",NO_CONNECTION:"No internet connectivity",SKIP:"Skipping slower attempt",MISSING_URL:"Url is not provided"},Sb="noStorage",Pc=c(2),X=c.n(Pc),Qc=c(10),tc=c.n(Qc),Ma,Ia={namespace:"adjust-sdk",version:"5.1.2", env:"production"},zb=(Ma={},X()(Ma,"none",-1),X()(Ma,"error",0),X()(Ma,"warning",1),X()(Ma,"info",2),X()(Ma,"verbose",3),Ma),uc={log:" ",info:" ",warn:" ",error:""},oc={development:"verbose",production:"error",test:"verbose"},Ab=oc[Ia.env]||"error",Bb="",L={setLogLevel:function(a,b){a&&-1===Object.keys(zb).indexOf(a)?u("error","error","You must set one of the available log levels: verbose, info, warning, error or none"):(Ab=a||oc[Ia.env]||"error",Bb=b,u("info",a,"Log level set to ".concat(Ab)))}, log:t("log","verbose"),info:t("info","info"),warn:t("warn","warning"),error:t("error","error")},tb={},Tb={},Cb=["appToken","environment"],pc=[].concat(Cb,["defaultTracker","externalDeviceId"]),qc=["urlStrategy","customUrl","eventDeduplicationListLimit","namespace"],ub,ha=J()(J()({},{sessionWindow:18E5,sessionTimerWindow:6E4,requestValidityWindow:24192E5}),{},{set:function(a){if(!v(a)){var b=[].concat(db()(pc),qc).filter(function(b){return!!a[b]}).map(function(b){return[b,a[b]]});tb=b.filter(function(a){a= Y()(a,1)[0];return-1!==pc.indexOf(a)}).reduce(n,{});Tb=b.filter(function(a){a=Y()(a,1)[0];return-1!==qc.indexOf(a)}).reduce(n,{})}},getBaseParams:function(){return J()({},tb)},getCustomConfig:function(){return J()({},Tb)},isInitialised:function(){return Cb.reduce(function(a,b){return a&&!!tb[b]},!0)},hasMissing:v,destroy:function(){tb={};Tb={}}}),Rc=c(6),Ub=c.n(Rc),Sc=c(4),eb=c.n(Sc),Ya={queue:{name:"q",scheme:{keyPath:"timestamp",autoIncrement:!1,fields:{url:{key:"u",values:{"/session":1,"/event":2, "/gdpr_forget_device":3,"/sdk_click":4,"/disable_third_party_sharing":5}},method:{key:"m",values:{GET:1,POST:2,PUT:3,DELETE:4}},timestamp:"t",createdAt:"ca",params:{key:"p",keys:{timeSpent:"ts",sessionLength:"sl",sessionCount:"sc",eventCount:"ec",lastInterval:"li",eventToken:"et",revenue:"re",currency:"cu",callbackParams:"cp",partnerParams:"pp"}}}}},activityState:{name:"as",scheme:{keyPath:"uuid",autoIncrement:!1,fields:{uuid:{key:"u",values:{unknown:"-"}},timeSpent:"ts",sessionLength:"sl",sessionCount:"sc", eventCount:"ec",lastActive:"la",lastInterval:"li",installed:{key:"in",values:{false:0,true:1}},attribution:{key:"at",keys:{adid:"a",tracker_token:"tt",tracker_name:"tn",network:"nt",campaign:"cm",adgroup:"ag",creative:"cr",click_label:"cl",state:{key:"st",values:{installed:1,reattributed:2}}}}}}},globalParams:{name:"gp",scheme:{keyPath:"keyType",autoIncrement:!1,index:"type",fields:{keyType:{key:"kt",composite:["key","type"]},key:"k",value:"v",type:{key:"t",values:{callback:1,partner:2}}}}},eventDeduplication:{name:"ed", scheme:{keyPath:"internalId",autoIncrement:!0,fields:{internalId:"ii",id:"i"}}},preferences:{name:"p",scheme:{fields:{thirdPartySharingDisabled:{key:"td",keys:{reason:{key:"r",values:X()({},"general",1)},pending:{key:"p",values:{false:0,true:1}}}},sdkDisabled:{key:"sd",keys:{reason:{key:"r",values:(ub={},X()(ub,"general",1),X()(ub,"gdpr",2),ub)},pending:{key:"p",values:{false:0,true:1}}}}}},permanent:!0}},rc=r(Ya).map(function(a){a=Y()(a,2);var b=a[1];return[a[0],{keyPath:b.scheme.keyPath,autoIncrement:b.scheme.autoIncrement, index:b.scheme.index,fields:b.scheme.fields}]}).reduce(n,{}),Tc=r(rc).map(function(a){var b=Y()(a,2);a=b[0];b=b[1];return[a,{keyPath:B(a,b.keyPath),autoIncrement:b.autoIncrement,index:B(a,b.index),fields:x(a,b.fields)}]}).reduce(n,{}),Uc=r(Ya).reduce(function(a,b){var c=Y()(b,2)[1];return a.concat(c.scheme.fields)},[]).map(function(a){return r(a).filter(function(a){return Y()(a,2)[1].values}).map(function(a){return r(Y()(a,2)[1].values)}).reduce(function(a,b){return a.concat(b)},[])}).reduce(function(a, b){return a.concat(b)},[]).reduce(n,{}),sc=r(Ya).map(function(a){a=Y()(a,2);var b=a[1];return[a[0],{name:b.name,permanent:b.permanent}]}).reduce(n,{}),ia={left:rc,right:Tc,values:Uc,storeNames:{left:sc,right:r(sc).map(function(a){a=Y()(a,2);var b=a[1];return[b.name,{name:a[0],permanent:b.permanent}]}).reduce(n,{})}},ea={},va=!1,Ja=!1,Z,V={get current(){return va?J()({},ea):{}},set current(a){A(a)},init:function(a){va=!0;A(a)},isStarted:function(){return va},toForeground:function(){Ja=!0},toBackground:function(){Ja= !1},initParams:function(){N();Ja=!0},getParams:function(a){if(!va)return null;var b={timeSpent:ea.timeSpent||0,sessionLength:ea.sessionLength||0,sessionCount:ea.sessionCount||1,lastInterval:(0<=ea.lastInterval?ea.lastInterval:0)||0};return a&&m(a,"event")&&(b.eventCount=ea.eventCount),b},updateParams:function(a,b){if(va){var c={};c.timeSpent=(ea.timeSpent||0)+(Ja?M():0);c.sessionLength=E();m(a,"session")&&(c.sessionCount=(ea.sessionCount||0)+1);m(a,"event")&&(c.eventCount=(ea.eventCount||0)+1);F(c); b||D()}},updateInstalled:function(){va&&(ea.installed||F({installed:!0}))},updateSessionOffset:N,updateSessionLength:function(){va&&(F({sessionLength:E()}),D())},resetSessionOffset:function(){va&&F({timeSpent:0,sessionLength:0})},updateLastActive:D,destroy:function(){ea={};Ja=va=!1}};!function(a){a.right="right";a.left="left"}(Z||(Z={}));var ca=new (function(){function a(){var b=this;Ub()(this,a);X()(this,"defaultName",Ia.namespace);X()(this,"storageName",this.defaultName);X()(this,"storeNames",ia.storeNames.left); X()(this,"storesMap",void 0);this.storesMap={};var c=this.read.bind(this),d=this.write.bind(this);p(this.storeNames,"values").forEach(function(a){Object.defineProperty(b.storesMap,a.name,{get:function(){return c(a.name)},set:function(b){d(a.name,b)}})});Object.freeze(this.storesMap)}return eb()(a,[{key:"read",value:function(a){a=localStorage.getItem("".concat(this.storageName,".").concat(a));a=JSON.parse(a||"null");return(a instanceof Array?a:H({storeName:this.storeNames.preferences.name,dir:Z.right, record:a}))||null}},{key:"write",value:function(a,b){b?localStorage.setItem("".concat(this.storageName,".").concat(a),JSON.stringify(b instanceof Array?b:H({storeName:this.storeNames.preferences.name,dir:Z.left,record:b}))):localStorage.removeItem("".concat(this.storageName,".").concat(a))}},{key:"clear",value:function(){this.deleteData()}},{key:"deleteData",value:function(){var a=this,b=0<arguments.length&&void 0!==arguments[0]&&arguments[0];p(this.storeNames,"values").forEach(function(c){!b&&c.permanent|| localStorage.removeItem("".concat(a.storageName,".").concat(c.name))})}}]),eb()(a,[{key:"setCustomName",value:function(a){var b=this;if(a&&a.length){var c="".concat(Ia.namespace,"-").concat(a);p(this.storeNames,"values").forEach(function(a){a=a.name;var d=localStorage.getItem("".concat(b.storageName,".").concat(a));d&&localStorage.setItem("".concat(c,".").concat(a),d)});this.deleteData(!0);this.storageName=c}}},{key:"stores",get:function(){return this.storesMap}}]),a}()),La={},Db=[],Ra=Ya.preferences.name, Qa=O(),ma,oa="undefined"==typeof Promise?c(3).Promise:Promise;!function(a){a.add="add";a.put="put";a.get="get";a.list="list";a.clear="clear";a.delete="delete"}(ma||(ma={}));var lb=function(){function a(){Ub()(this,a);X()(this,"dbDefaultName",Ia.namespace);X()(this,"dbName",this.dbDefaultName);X()(this,"dbVersion",1);X()(this,"idbFactory",void 0);X()(this,"indexedDbConnection",null);X()(this,"notSupportedError",{name:"IDBNotSupported",message:"IndexedDB is not supported"});X()(this,"databaseOpenError", {name:"CannotOpenDatabaseError",message:"Cannot open a database"});X()(this,"noConnectionError",{name:"NoDatabaseConnection",message:"Cannot open a transaction"});var b=a.getIndexedDB();if(!b)throw this.notSupportedError;this.idbFactory=b}return eb()(a,null,[{key:"tryOpen",value:function(b){return new oa(function(c){try{var d=b.open(a.dbValidationName);d.onsuccess=function(){d.result.close();b.deleteDatabase(a.dbValidationName);c(!0)};d.onerror=function(){return c(!1)}}catch(e){c(!1)}})}},{key:"isSupported", value:function(){return a.isSupportedPromise||(a.isSupportedPromise=new oa(function(b){var c=a.getIndexedDB(),d=!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform);!c||d?(L.warn("IndexedDB is not supported in this browser"),b(!1)):b(a.tryOpen(c).then(function(a){return a||L.warn("IndexedDB is not supported in this browser"),a}))})),a.isSupportedPromise}},{key:"getIndexedDB",value:function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB}}]), eb()(a,[{key:"setCustomName",value:function(a){return a&&0<a.length?(this.dbName="".concat(Ia.namespace,"-").concat(a),this.migrateDb(this.dbDefaultName,this.dbName)):oa.resolve()}},{key:"openDatabase",value:function(b,c,d){var e=this;return a.isSupported().then(function(a){return a?new oa(function(a,f){var g=e.idbFactory.open(b,c);d&&(g.onupgradeneeded=function(a){return d(a,f)});g.onsuccess=function(b){(b=b.target.result)?a(b):f(e.databaseOpenError)};g.onerror=f}):oa.reject(e.notSupportedError)})}}, {key:"databaseExists",value:function(a){var b=this;return new oa(function(c){var d=!0;b.openDatabase(a,void 0,function(){d=!1}).then(function(c){if(c.close(),!d)return b.deleteDatabaseByName(a)}).then(function(){return c(d)})})}},{key:"cloneData",value:function(a,b){var c=this;return p(ia.storeNames.left,"values").filter(function(a){return!a.permanent}).map(function(a){return a.name}).map(function(d){return function(){return e=d,f=c.indexedDbConnection,c.indexedDbConnection=a,c.getAll(e).then(function(a){if(c.indexedDbConnection= b,!(1>a.length))return c.addBulk(e,a,!0)}).then(function(){c.indexedDbConnection=f});var e,f}}).reduce(function(a,b){return a.then(b)},oa.resolve())}},{key:"migrateDb",value:function(a,b){var c=this;return this.databaseExists(a).then(function(d){return d?oa.all([c.openDatabase(a,c.dbVersion,c.handleUpgradeNeeded),c.openDatabase(b,c.dbVersion,c.handleUpgradeNeeded)]).then(function(b){b=Y()(b,2);var d=b[0],e=b[1];return c.cloneData(d,e).then(function(){return c.indexedDbConnection=e,d.close(),c.deleteDatabaseByName(a)})}).then(function(){return L.info("Database migration finished")}): c.openDatabase(b,c.dbVersion,c.handleUpgradeNeeded).then(function(a){c.indexedDbConnection=a})})}},{key:"handleUpgradeNeeded",value:function(a,b){var c=a.target.result;a.target.transaction.onerror=b;a.target.transaction.onabort=b;var e=ia.storeNames.left,f=V.current||{},g=f&&!d(f);r(e).filter(function(a){return!Y()(a,2)[1].permanent}).forEach(function(a){var b=Y()(a,2);a=b[0];var b=b[1],d=ia.right[a],h=c.createObjectStore(b.name,{keyPath:d.keyPath,autoIncrement:d.autoIncrement||!1});d.index&&h.createIndex("".concat(d.index, "Index"),d.index);b.name===e.activityState.name&&g?(h.add(H({storeName:a,record:f,dir:Z.left})),L.info("Activity state has been recovered")):ca.stores[b.name]&&(ca.stores[b.name].forEach(function(a){return h.add(a)}),L.info("Migration from localStorage done for ".concat(a," store")))});ba();ca.clear()}},{key:"open",value:function(){var a=this;return this.indexedDbConnection?oa.resolve({success:!0}):this.openDatabase(this.dbName,this.dbVersion,this.handleUpgradeNeeded).then(function(b){return a.indexedDbConnection= b,a.indexedDbConnection.onclose=function(){return a.destroy},{success:!0}})}},{key:"getTransactionStore",value:function(a,b,c){var d,e=a.storeName;a=c.transaction([e],a.mode);c=a.objectStore(e);e=ia.right[I({storeName:e,dir:Z.right})];return e.index&&(d=c.index("".concat(e.index,"Index"))),a.onerror=b,a.onabort=b,{transaction:a,store:c,index:d,options:e}}},{key:"overrideError",value:function(a,b){var c=b.target.error;return a({name:c.name,message:c.message})}},{key:"getCompositeKeys",value:function(a){return a.fields[a.keyPath].composite|| null}},{key:"prepareTarget",value:function(a,b,c){c=-1!==[ma.add,ma.put].indexOf(c);var d=this.getCompositeKeys(a);return d?c?J()(X()({},a.keyPath,d.map(function(a){return b[a]}).join("")),b):b?b.join(""):null:b}},{key:"prepareResult",value:function(a,b){var c=this.getCompositeKeys(a);return c&&e(b)?c.map(function(a){return b[a]}):null}},{key:"initRequest",value:function(a){var b=this,c=a.storeName,d=a.target,e=void 0===d?null:d,f=a.action;a=a.mode;var g=void 0===a?"readonly":a;return this.open().then(function(){return new oa(function(a, d){if(b.indexedDbConnection){var h=b.getTransactionStore({storeName:c,mode:g},d,b.indexedDbConnection),k=h.options,m=h.store[f](b.prepareTarget(k,e,f)),n=b.prepareResult(k,e);m.onsuccess=function(){f!==ma.get||m.result?a(n||m.result||e):d({name:"NotRecordFoundError",message:'Requested record not found in "'.concat(c,'" store')})};m.onerror=function(a){return b.overrideError(d,a)}}else d(b.noConnectionError)})})}},{key:"initBulkRequest",value:function(a){var b=this,c=a.storeName,d=a.target,e=a.action; a=a.mode;var f=void 0===a?"readwrite":a;return!d||d&&!d.length?oa.reject({name:"NoTargetDefined",message:"No array provided to perform ".concat(e,' bulk operation into "').concat(c,'" store')}):this.open().then(function(){return new oa(function(a,g){if(b.indexedDbConnection){var h=b.getTransactionStore({storeName:c,mode:f},g,b.indexedDbConnection),k=h.store,m=h.options,n=[],p=d[0];h.transaction.oncomplete=function(){return a(n)};!function xc(a){a.onerror=function(a){return b.overrideError(g,a)};a.onsuccess= function(){n.push(b.prepareResult(m,p)||a.result);p=d[n.length];n.length<d.length&&xc(k[e](b.prepareTarget(m,p,e)))}}(k[e](b.prepareTarget(m,p,e)))}else g(b.noConnectionError)})})}},{key:"openCursor",value:function(a){var b=this,c=a.storeName,d=a.action,e=a.range,f=void 0===e?null:e,e=a.firstOnly,g=void 0!==e&&e;a=a.mode;var h=void 0===a?"readonly":a;return this.open().then(function(){return new oa(function(a,e){if(b.indexedDbConnection){var k=b.getTransactionStore({storeName:c,mode:h},e,b.indexedDbConnection), m=k.transaction,n=k.store,p=k.options,k=(k.index||n).openCursor(f),r=[];m.oncomplete=function(){return a(g?r[0]:r)};k.onsuccess=function(a){(a=a.target.result)&&(d===ma.delete?(a.delete(),r.push(b.prepareResult(p,a.value)||a.value[p.keyPath])):r.push(a.value),g||a.continue())};k.onerror=function(a){return b.overrideError(e,a)}}else e(b.noConnectionError)})})}},{key:"deleteDatabaseByName",value:function(a){var b=this;return new oa(function(c,d){var e=b.idbFactory.deleteDatabase(a);e.onerror=function(a){return b.overrideError(d, a)};e.onsuccess=c;e.onblocked=function(a){return d(a.target)}})}},{key:"getAll",value:function(a){return this.openCursor({storeName:a,action:ma.list,firstOnly:1<arguments.length&&void 0!==arguments[1]&&arguments[1]})}},{key:"getFirst",value:function(a){return this.getAll(a,!0)}},{key:"getItem",value:function(a,b){return this.initRequest({storeName:a,target:b,action:ma.get})}},{key:"filterBy",value:function(a,b){var c=IDBKeyRange.only(b);return this.openCursor({storeName:a,action:ma.list,range:c})}}, {key:"addItem",value:function(a,b){return this.initRequest({storeName:a,target:b,action:ma.add,mode:"readwrite"})}},{key:"addBulk",value:function(a,b,c){return this.initBulkRequest({storeName:a,target:b,action:c?ma.put:ma.add,mode:"readwrite"})}},{key:"updateItem",value:function(a,b){return this.initRequest({storeName:a,target:b,action:ma.put,mode:"readwrite"})}},{key:"deleteItem",value:function(a,b){return this.initRequest({storeName:a,target:b,action:ma.delete,mode:"readwrite"})}},{key:"deleteBulk", value:function(a,b,c){b=c?IDBKeyRange[c](b):IDBKeyRange.only(b);return this.openCursor({storeName:a,action:ma.delete,range:b,mode:"readwrite"})}},{key:"trimItems",value:function(a,b){var c=this,d=ia.right[I({storeName:a,dir:Z.right})];return this.getAll(a).then(function(a){return a.length?a[b-1]:null}).then(function(b){return b?c.deleteBulk(a,b[d.keyPath],"upperBound"):[]})}},{key:"count",value:function(a){var b=this;return this.open().then(function(){return new oa(function(c,d){if(b.indexedDbConnection){var e= b.getTransactionStore({storeName:a,mode:"readonly"},d,b.indexedDbConnection).store.count();e.onsuccess=function(){return c(e.result)};e.onerror=function(a){return b.overrideError(d,a)}}else d(b.noConnectionError)})})}},{key:"clear",value:function(a){return this.initRequest({storeName:a,action:ma.clear,mode:"readwrite"})}},{key:"destroy",value:function(){this.indexedDbConnection&&this.indexedDbConnection.close();this.indexedDbConnection=null}},{key:"deleteDatabase",value:function(){return this.destroy(), this.deleteDatabaseByName(this.dbName)}}]),a}();X()(lb,"dbValidationName","validate-db-openable");X()(lb,"isSupportedPromise",null);var Da="undefined"==typeof Promise?c(3).Promise:Promise,Fb=function(){function a(){Ub()(this,a)}return eb()(a,[{key:"open",value:function(){return a.isSupported().then(function(a){if(!a)return{status:"error",error:{name:"LSNotSupported",message:"LocalStorage is not supported"}};var b=ia.storeNames.left,c=V.current||{},e=c&&!d(c);return r(b).filter(function(a){return!Y()(a, 2)[1].permanent}).forEach(function(a){var d=Y()(a,2);a=d[0];var d=d[1],f=b.activityState.name;d.name!==f||ca.stores[f]?ca.stores[d.name]||(ca.stores[d.name]=[]):ca.stores[f]=e?[H({storeName:a,record:c,dir:Z.left})]:[]}),ba(),{status:"success"}})}},{key:"getCompositeKeys",value:function(a){return a.fields[a.keyPath].composite||null}},{key:"getKeys",value:function(a){a=ia.right[I({storeName:a,dir:Z.right})];return this.getCompositeKeys(a)||[a.keyPath]}},{key:"initRequest",value:function(a,b){var c= this,d=a.storeName,e=a.id,f=a.item,h=ia.right[I({storeName:d,dir:Z.right})];return this.open().then(function(a){return"error"===a.status?Da.reject(a.error):new Da(function(a,k){var m=ca.stores[d],p=c.getKeys(d),r=e instanceof Array?e.slice():[e],s=(m[m.length-1]||{})[h.keyPath]||0,t=e?p.map(function(a,b){return[a,r[b]]}).reduce(n,{}):J()({},f),t=t?g(m,p,t):null;return b(a,k,{keys:p,items:m,index:t,options:h,lastId:s})})})}},{key:"sort",value:function(a,b,c){a=db()(a);var d=b.slice().reverse();return a.sort(function(a, b){return d.reduce(function(d,e){var f;(f=d)||(f=c?c>a[e]:a[e]>b[e],f=(c?c===a[e]:a[e]<b[e])?-1:f?1:0);return f},0)})}},{key:"prepareTarget",value:function(a,b,c){var d=this.getCompositeKeys(a);return d?J()(X()({},a.keyPath,d.map(function(a){return b[a]}).join("")),b):a.autoIncrement&&c?J()(X()({},a.keyPath,c),b):J()({},b)}},{key:"prepareResult",value:function(a,b){var c=this.getCompositeKeys(a);return c&&e(b)?c.map(function(a){return b[a]}):b[a.keyPath]||b}},{key:"getAll",value:function(a,b){var c= this;return this.open().then(function(d){return"error"===d.status?Da.reject(d.error):new Da(function(d,e){var f=ca.stores[a];f instanceof Array?d(b?f[0]:c.sort(f,c.getKeys(a))):e({name:"NotFoundError",message:"No objectStore named ".concat(a," in this database")})})})}},{key:"getFirst",value:function(a){return this.getAll(a,!0)}},{key:"getItem",value:function(a,b){var c=this;return this.initRequest({storeName:a,id:b},function(b,d,e){var f=e.items,g=e.index;e=e.options;-1===g?d({name:"NotRecordFoundError", message:'Requested record not found in "'.concat(a,'" store')}):b(c.prepareTarget(e,f[g]))})}},{key:"filterBy",value:function(a,b){return this.getAll(a).then(function(c){return c.filter(function(c){return c[ia.right[I({storeName:a,dir:Z.right})].index]===b})})}},{key:"addItem",value:function(a,b){var c=this;return this.initRequest({storeName:a,item:b},function(d,e,f){var g=f.items,h=f.options,k=f.lastId;-1!==f.index?e({name:"ConstraintError",message:'Constraint was not satisfied, trying to add existing item into "'.concat(a, '" store')}):(g.push(c.prepareTarget(h,b,k+1)),ca.stores[a]=g,d(c.prepareResult(h,b)))})}},{key:"addBulk",value:function(a,b,c){var d=this;return this.initRequest({storeName:a},function(e,f,h){var k=h.keys,m=h.items,n=h.options;h=h.lastId;if(!b||b&&!b.length)return f({name:"NoTargetDefined",message:'No array provided to perform add bulk operation into "'.concat(a,'" store')});var p=h;h=b.map(function(a){return d.prepareTarget(n,a,++p)});var r=h.filter(function(a){return-1!==g(m,k,a)}).map(function(a){return a[n.keyPath]}), s=c?m.filter(function(a){return-1===r.indexOf(a[n.keyPath])}):db()(m);r.length&&!c?f({name:"ConstraintError",message:'Constraint was not satisfied, trying to add existing items into "'.concat(a,'" store')}):(ca.stores[a]=d.sort([].concat(db()(s),db()(h)),k),e(b.map(function(a){return d.prepareResult(n,a)})))})}},{key:"updateItem",value:function(a,b){var c=this;return this.initRequest({storeName:a,item:b},function(d,e,f){e=f.items;var g=f.index,h=f.options;f=f.lastId;f=c.prepareTarget(h,b,-1===g?f+ 1:null);-1===g?e.push(f):e.splice(g,1,f);ca.stores[a]=e;d(c.prepareResult(h,b))})}},{key:"deleteItem",value:function(a,b){return this.initRequest({storeName:a,id:b},function(c,d,e){d=e.items;e=e.index;-1!==e&&(d.splice(e,1),ca.stores[a]=d);c(b)})}},{key:"findMax",value:function(a,b,c){if(!a.length)return-1;for(var d={index:-1,value:isNaN(c)?"":0},e=0;e<a.length&&a[e][b]<=c;e+=1)a[e][b]>=d.value&&(d={value:a[e][b],index:e});return d.index}},{key:"deleteBulk",value:function(a,b,c){var d=this;return this.getAll(a).then(function(e){var f= d.getKeys(a),g=ia.right[I({storeName:a,dir:Z.right})].index||f[0];e=d.sort(e,f,c?null:b);var h=d.findMax(e,g,b);if(-1===h)return[];h=e.splice("lowerBound"===c?h:0,c&&"upperBound"!==c?e.length:h+1).map(function(a){return 1===f.length?a[g]:f.map(function(b){return a[b]})});return ca.stores[a]=e,h})}},{key:"trimItems",value:function(a,b){var c=this,d=ia.right[I({storeName:a,dir:Z.right})];return this.getAll(a).then(function(a){return a.length?a[b-1]:null}).then(function(b){return b?c.deleteBulk(a,b[d.keyPath], "upperBound"):[]})}},{key:"count",value:function(a){return this.open().then(function(b){return"error"===b.status?Da.reject(b.error):Da.resolve(ca.stores[a].length)})}},{key:"clear",value:function(a){return this.open().then(function(b){return"error"===b.status?Da.reject(b.error):new Da(function(b){ca.stores[a]=[];b({})})})}},{key:"destroy",value:function(){}},{key:"deleteDatabase",value:function(){}}],[{key:"isSupported",value:function(){if(a.isSupportedPromise)return a.isSupportedPromise;var b=(new Date).toString(), c=window.localStorage;return a.isSupportedPromise=(new Da(function(a){c.setItem(b,b);var d=c.getItem(b)===b;c.removeItem(b);a(!(!d||!c))})).catch(function(){return L.warn("LocalStorage is not supported in this browser"),Da.resolve(!1)}),a.isSupportedPromise}}]),a}();X()(Fb,"isSupportedPromise",null);var $a,Va,Sa="undefined"==typeof Promise?c(3).Promise:Promise;(Va=$a||($a={}))[Va.noStorage=Sb]="noStorage";Va[Va.indexedDB="indexedDB"]="indexedDB";Va[Va.localStorage="localStorage"]="localStorage";var Za, Eb=null,fb,gb,aa=J()({init:ta,getType:function(){return Za}},r({getAll:function(a,b){return a.getAll(b).then(function(a){return R({storeName:b,dir:Z.right,records:a})})},getFirst:function(a,b){return a.getFirst(b).then(function(a){return H({storeName:b,dir:Z.right,record:a})})},getItem:function(a,b,c){return a.getItem(b,K({storeName:b,dir:Z.left,target:c})).then(function(a){return H({storeName:b,dir:Z.right,record:a})}).catch(function(a){return Sa.reject(P({storeName:b,error:a}))})},filterBy:function(a, b,c){return a.filterBy(b,ia.values[c]||c).then(function(a){return R({storeName:b,dir:Z.right,records:a})})},addItem:function(a,b,c){return a.addItem(b,H({storeName:b,dir:Z.left,record:c})).then(function(a){return K({storeName:b,dir:Z.right,target:a})}).catch(function(a){return Sa.reject(P({storeName:b,error:a}))})},addBulk:function(a,b,c,d){return a.addBulk(b,R({storeName:b,dir:Z.left,records:c}),d).then(function(a){return a.map(function(a){return K({storeName:b,dir:Z.right,target:a})})}).catch(function(a){return Sa.reject(P({storeName:b, error:a}))})},updateItem:function(a,b,c){return a.updateItem(b,H({storeName:b,dir:Z.left,record:c})).then(function(a){return K({storeName:b,dir:Z.right,target:a})})},deleteItem:function(a,b,c){return a.deleteItem(b,K({storeName:b,dir:Z.left,target:c})).then(function(a){return K({storeName:b,dir:Z.right,target:a})})},deleteBulk:function(a,b,c,d){return a.deleteBulk(b,ia.values[c]||c,d).then(function(a){return a.map(function(a){return K({storeName:b,dir:Z.right,target:a})})})},trimItems:function(a, b,c){return a.trimItems(b,c)},count:function(a,b){return a.count(b)},clear:function(a,b){return a.clear(b)},destroy:function(a){return a.destroy()},deleteDatabase:function(a){return a.deleteDatabase()}}).map(function(a){a=Y()(a,2);var b=a[1];return[a[0],function(a){for(var c=arguments.length,d=Array(1<c?c-1:0),e=1;e<c;e++)d[e-1]=arguments[e];return ta().then(function(c){if(c=c.storage)return b.call.apply(b,[null,c,I({storeName:a,dir:Z.left})].concat(d))})}]}).reduce(n,{}));"undefined"==typeof Promise&& c(3).Promise;var ja;"undefined"==typeof Promise&&c(3).Promise;!function(a){a.Default="default";a.India="india";a.China="china"}(ja||(ja={}));var yc=(fb={},X()(fb,ja.Default,{app:"https://app.adjust.com",gdpr:"https://gdpr.adjust.com"}),X()(fb,ja.India,{app:"https://app.adjust.net.in",gdpr:"https://gdpr.adjust.net.in"}),X()(fb,ja.China,{app:"https://app.adjust.world",gdpr:"https://gdpr.adjust.world"}),fb),Xb=(gb={},X()(gb,ja.Default,"default"),X()(gb,ja.India,"Indian"),X()(gb,ja.China,"Chinese"),gb), wc="undefined"==typeof Promise?c(3).Promise:Promise,Vc={long:{delay:12E4,maxDelay:864E5,minRange:0.5,maxRange:1},short:{delay:200,maxDelay:36E5,minRange:0.5,maxRange:1},test:{delay:100,maxDelay:300}},Hb=navigator.onLine,vb="undefined"==typeof Promise?c(3).Promise:Promise,Vb=function(){function a(b){return 2147483647<(b=b||150)?2147483647:b}function b(d){var e=d.wait;d=d.retrying;D=e?a(e):D;a:{if(Ea&&C){var f=D-(Date.now()-Ea);if(e&&f<e){e=!0;break a}k()}e=!1}return e?vb.resolve({status:"error",action:"CONTINUE", response:"",message:Gb.SKIP,code:"SKIP"}):x?(L.log("".concat(d?"Re-trying":"Trying"," request ").concat(x," in ").concat(D,"ms")),Ea=Date.now(),c({url:x,method:y,params:J()({attempts:1},A)})):(L.error("You must define url for the request to be sent"),vb.reject({status:"error",action:"CONTINUE",response:"",message:Gb.MISSING_URL,code:"MISSING_URL"}))}function c(a){C&&clearTimeout(C);C=null;return Hb?e(a):(sa.connection+=1,L.log("No internet connectivity, trying request ".concat(a.url," in ").concat(6E4, "ms")),new vb(function(b){C=setTimeout(function(){b(c(a))},6E4)}))}function e(a){return new vb(function(b,c){C=setTimeout(function(){Ea=null;var d=r(a.params).filter(function(a){return s(Y()(a,2)[1])}).reduce(n,{});return ua({url:a.url,method:a.method,params:J()(J()({},d),{},{attempts:(sa.request?sa.request+1:1)+sa.connection})}).then(function(a){a&&a.retry_in?b(h(a.retry_in)):("function"==typeof B?B(a,g,h):g(),b(a))}).catch(function(a){a&&"RETRY"===a.action?b(h("NO_CONNECTION"===a.code?6E4:void 0)): (g(!0),c(a||{}))})},D)})}function f(){x=Ka.url;y=Ka.method;A=J()({},Ka.params);B=Ka.continueCb}function g(a){L.log("Request ".concat(x||"unknown"," ").concat(a?"failed":"has been finished"));sa.request=0;sa.connection=0;D=150;f();k()}function h(a){sa.request+=1;k();var c;if(!(c=a)){var d,e;c=Vc[ib||"long"];a=c.delay*Math.pow(2,sa.request-1);c=(a=Math.min(a,c.maxDelay),c.minRange&&c.maxRange&&(a*=(d=c.minRange,e=c.maxRange,Math.random()*(e-d)+d)),Math.round(a))}return b({wait:c,retrying:!0})}function k(){var a= !!Ea;C&&clearTimeout(C);Ea=C=null;a&&(D=150,sa.request=0,sa.connection=0,L.log("Previous ".concat(x||"unknown"," request attempt canceled")),f())}var m=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},p=m.url,t=m.method,t=void 0===t?"GET":t,u=m.params,u=void 0===u?{}:u,v=m.continueCb,w=m.strategy,m=m.wait,Ka={url:p,method:t,params:u,continueCb:v},x=p,y=t,A=J()({},u),B=v,ib=w,C=null,sa={request:0,connection:0},D=a(m),Ea=null;return{send:function(){var a=0<arguments.length&&void 0!==arguments[0]? arguments[0]:{},c=a.params,e=a.wait,f=a.url,g=a.method,c=void 0===c?{}:c,a=a.continueCb;f&&(x=f);g&&(y=g);d(c)||(A=J()({},c));A=J()({createdAt:z()},A);"function"==typeof a&&(B=a);return b({wait:e})},isRunning:function(){return!!C},clear:k}},wb=function(a){return"gdpr"===a?"GDPR disable":"disable"},Yb=function(a){return{start:{inProgress:"Adjust SDK ".concat(wb(a)," process has already started"),done:"Adjust SDK ".concat(wb(a)," process is now started")},finish:{inProgress:"Adjust SDK ".concat(wb(a), " process has already finished"),done:"Adjust SDK ".concat(wb(a)," process is now finished")}}},Zb="undefined"==typeof Promise?c(3).Promise:Promise,sb=!1,Ib="undefined"==typeof Promise?c(3).Promise:Promise,$b=Vb({strategy:"long",continueCb:function(a,b){var c=a&&a.continue_in||null;return ra.pause=c?{timestamp:Date.now(),wait:c}:null,aa.getFirst("queue").then(function(a){return a?aa.deleteItem("queue",a.timestamp):null}).then(function(){return b(),ra.running=!1,Oa({wait:c})})}}),mb=!1,ra={running:!1, timestamp:null,pause:null},ab="undefined"==typeof Promise?c(3).Promise:Promise,Kb="No type provided",Jb="Global parameter type not provided, `callback` or `partner` types are available",nb,Mb,Fa,ac="undefined"==typeof Promise?c(3).Promise:Promise,Lb=!1,Ta=document,Rb="undefined"==typeof Promise?c(3).Promise:Promise,lc=Vb({url:"/attribution",strategy:"short",continueCb:function(a,b,c){return!a||a&&"error"===a.status?(b(),Rb.resolve({state:"unknown"})):a.ask_in?c(a.ask_in):(b(),function(a){if(d(a)|| !function(a){var b=a.adid;a=a.attribution;a=void 0===a?{}:a;return!(void 0===b||!b)&&!!k(Wb,Object.keys(a)).length}(a)||function(a){var b=a.adid,c=a.attribution,d=V.current.attribution||{};return!(c&&Wb.some(function(a){return d[a]!==c[a]}))&&b===d.adid}(a))return Rb.resolve({state:"same"});var b=r(a.attribution).filter(function(a){a=Y()(a,1)[0];return-1!==Wb.indexOf(a)}).reduce(n,{adid:a.adid});return V.current=J()(J()({},V.current),{},{attribution:b}),Ba().then(function(){return S("attribution:change", b),L.info("Attribution has been updated"),{state:"changed"}})}(a))}}),Wb="tracker_token tracker_name network campaign adgroup creative click_label state".split(" "),fc=Vb({url:"/gdpr_forget_device",method:"POST",strategy:"short"}),Nb={running:"Adjust SDK is running pending GDPR Forget Me request",pending:"Adjust SDK will run GDPR Forget Me request after initialisation",paused:"Adjust SDK is already prepared to send GDPR Forget Me request",off:"Adjust SDK is already disabled"},bb={running:"Adjust SDK is running pending third-party sharing opt-out request", delayed:"Adjust SDK will run third-party sharing opt-out request after initialisation",pending:"Adjust SDK already queued third-party sharing opt-out request",off:"Third-party sharing opt-out is already done",start:{inProgress:"Third-party sharing opt-out has already started",done:"Third-party sharing opt-out is now started"},finish:{inProgress:"Third-party sharing opt-out has already finished",done:"Third-party sharing opt-out is now finished"}},qb=[],Ob="undefined"==typeof Promise?c(3).Promise: Promise,ob="undefined"==typeof Promise?c(3).Promise:Promise,rb=null,Ua=!1,pb=!1,Qb=!1;b.default={initSdk:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},b=a.logLevel,c=a.logOutput,d=Mc()(a,["logLevel","logOutput"]);L.setLogLevel(b,c);Ua||ha.isInitialised()?L.error("You already initiated your instance"):ha.hasMissing(d)||(Ua=!0,aa.init(d.namespace).then(function(a){a.type!==Sb?(L.info("Available storage is ".concat(a.type)),rb=J()({},d),nc(d)):L.error("Adjust SDK can not start, there is no storage available")}))}, trackEvent:function(a){Ca("track event",function(b){return function(a,b){if(a&&(!a||!d(a)&&a.eventToken))return Dc(a.deduplicationId).then(Xa).then(function(c){var e=Ha,f,g,k=c.callbackParams,m=c.partnerParams;c={};var n=J()({eventToken:a.eventToken},(f=a.revenue,g=a.currency,isNaN(f)||0>(f=parseFloat(f))||!g?{}:{revenue:f.toFixed(5),currency:g}));f=J()(J()({},h(k)),h(a.callbackParams));g=J()(J()({},h(m)),h(a.partnerParams));c=(d(f)||(c.callbackParams=f),d(g)||(c.partnerParams=g),J()(J()({},n),c)); e({url:"/event",method:"POST",params:c},{timestamp:b})}).catch(function(a){a&&a.message&&L.error(a.message)});L.error("You must provide event token in order to track event")}(a,b)},{schedule:!0,stopBeforeInit:!0})},addGlobalCallbackParameters:function(a){Ca("add global callback parameters",function(){return Ka(a,"callback")})},addGlobalPartnerParameters:function(a){Ca("add global partner parameters",function(){return Ka(a,"partner")})},removeGlobalCallbackParameter:function(a){Ca("remove global callback parameter", function(){return ib(a,"callback")})},removeGlobalPartnerParameter:function(a){Ca("remove global partner parameter",function(){return ib(a,"partner")})},clearGlobalCallbackParameters:function(){Ca("remove all global callback parameters",function(){return Ea("callback")})},clearGlobalPartnerParameters:function(){Ca("remove all global partner parameters",function(){return Ea("partner")})},switchToOfflineMode:function(){Ca("set offline mode",function(){return Wa(!0)})},switchBackToOnlineMode:function(){Ca("set online mode", function(){return Wa(!1)})},stop:function(){Ga()&&ha.isInitialised()&&cb()},restart:function(){var a;("gdpr"===(a=U()||{}).reason?(L.log("Adjust SDK is disabled due to GDPR-Forget-Me request and it can not be re-enabled"),1):a.reason?(L.log("Adjust SDK has been enabled"),W(null),0):(L.log("Adjust SDK is already enabled"),1))||!rb||nc(rb)},gdprForgetMe:function(){ec()&&Ga("gdpr",!0)&&ha.isInitialised()&&Pb()},disableThirdPartySharing:function(){Ca("disable third-party sharing",Gc,{schedule:!0,stopBeforeInit:!1})}, __testonly__:{destroy:kc,clearDatabase:function(){return aa.deleteDatabase()}}}}]).default});var RSAdjustEventToken={Install:"56etgr",Purchase:"nexwvn",Levelup10:"hnh688",Levelup20:"jl5q7r",FirstPurchase:"pejwka"},RSAdjustManager=function(){var a,b=RSClass.extend({init:function(){this._adjustObj=null},initializeAdjust:function(){if(GameConfig.ADJUST_CUSTOM_EVENT_KEYS)for(var a in GameConfig.ADJUST_CUSTOM_EVENT_KEYS)RSAdjustEventToken[a]=GameConfig.ADJUST_CUSTOM_EVENT_KEYS[a];Adjust.initSdk({appToken:GameConfig.ADJUST_APP_TOKEN,environment:GameConfig.ADJUST_LIVE_MODE?"production":"sandbox", logLevel:"error",logOutput:"#output"});Adjust.restart()},trackSession:function(){},trackEvent:function(a){Adjust.trackEvent({eventToken:a})},trackSessionStop:function(){},trackPurchase:function(a){Adjust.trackEvent({eventToken:RSAdjustEventToken.Purchase,revenue:a,currency:"USD"})}});return{getInstance:function(){a||(a=new b);return a}}}();var RSAppsFlyerManager=function(){var a,b=RSClass.extend({isLive:!1,reInitializeTimer:null,reInitializeCounter:0,init:function(){},initialize:function(a){this.isLive=a;parent.postMessage({type:"appsFlyerInit",data:this.isLive},"*");this.reInitializeTimer=setInterval(this.reInitialize.bind(this),3E3)},reInitialize:function(){null==window.afWebUserId&&4>this.reInitializeCounter?(this.reInitializeCounter+=1,parent.postMessage({type:"appsFlyerInit",data:this.isLive},"*")):(null==window.afWebUserId&&RSErrorTracker.getInstance().trackErrorMessage("AFWEBUSERID", "UserID setting Failed","mahesh.jose@rubyseven.net"),clearTimeout(this.reInitializeTimer),this.reInitializeTimer=null)},setCustomerId:function(a){parent.postMessage({type:"setCustomerUserId",data:a},"*")},trackEvent:function(a,b){parent.postMessage({type:"event",data:{eventType:"EVENT",eventName:a,eventValue:RSGame.getInstance().getGameManager().getAppsFlyerParameters(b)}},"*")},trackPurchase:function(a){}});return{getInstance:function(){a||(a=new b);return a}}}();var RSSalePopupV2=RSPopup.extend({_callBack:null,_assetList:null,_saleDetails:null,_currentPowerPackData:null,_layoutLoadedCount:null,_selectedType:null,_currentPackData:null,_bannerBar:null,_usBannerBar:null,_purchasedTag:[],_purchaseReward:[],_purchasePrice:[],_purchaseRewardData:[],_purchasePriceData:[],_packSelected:0,_popupTimerObject:null,_popupTimerText:null,_saleWidget:null,_timeRemaining:0,_onSaleTriggered:!1,_buttonList:[],_pricePosition:{},_amountTxts:[],_isPurhcaseCart:!1,_openFrom:null, init:function(a,b,c,d){this._layoutLoadedCount=0;this._openFrom=c;this._isPurchaseCart&&RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("SaleFontConfigJson"),"SaleCartWidgetFontConfig.json");c=null;c=b?RSSaleManager.getInstance().getSaleCartResourceByName("RSCartPopup")?RSSaleManager.getInstance().getSaleCartResourceByName("RSCartPopup"):RSGame.getInstance().getAssetPath("RSCartPopup"):RSSaleManager.getInstance().getSaleResourceByName("RSSalePopup")?RSSaleManager.getInstance().getSaleResourceByName("RSSalePopup"): RSGame.getInstance().getAssetPath("RSSalePopup");this._assetList=[{name:c,count:1}];this._super.init.call(this,a);this._isPurhcaseCart=b;this._purchasedTag=[];this._buttonList=[];this._purchaseReward=[];this._purchasePrice=[];this._purchaseRewardData=[];this._purchasePriceData=[];this._callBack=a;this._amountTxts=[];this._tag=d;this._selectedType="";this._isCloseButtonClicked=this._onSaleTriggered=!1;RSSalePopupGlobal=this;b||RSEventManager.getInstance().addEventListener("onTimerTick",this,this._setTimerValues.bind(this)); RSEventManager.getInstance().addEventListener("onPurchaseSuccessClosed",this,this.closePopup.bind(this))},getName:function(){return"RSSalePopup"},_setTimerValues:function(a){this._timeRemaining=a._userData.timeRemaining;if(0<this._timeRemaining){var b=RSUtils.formattedTime(this._timeRemaining);null!=this._popupTimerText&&"true"==this._saleDetails.timer?this._popupTimerText.setString(b):null!==this._saleWidget&&this._saleWidget._setTimerValues(a)}else RSInAppPurchaseManager.getInstance().trackGUIEventForPurchaseCartClose(RSSaleManager.getInstance().getSaleTagForTrackingEvents(this._saleDetails.tag), "close","open_from_"+this.getCurrentMachineName(),"",this._saleDetails.eventId),this.closePopup()},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._saleDetails=this._isPurhcaseCart?RSSaleManager.getInstance().getPurchaseCartV2VO("coin"):RSSaleManager.getInstance().getSaleVO();this.setOtherValueofAnalytics("open_from_"+this._openFrom);this._super.onLayoutCompleted.call(this);this.initializeSale();RSSaleManager.getInstance().trackImpression(this._saleDetails.analyticsName, this._saleDetails.monetizationCategory,this._saleDetails.saleId,this._saleDetails.eventId);GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&("loc"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_OPEN,RSPlatformPopupNameKeys.LOC):"ooc"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_OPEN,RSPlatformPopupNameKeys.OOC):"nps"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_OPEN, RSPlatformPopupNameKeys.NPS):RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_OPEN,RSPlatformPopupNameKeys.SALES))},setOtherValueofAnalytics:function(a){this._openFrom&&(this._isPurhcaseCart?RSAnalyticsManager.getInstance().setOtherValueInAnalytics("purchase_coins","success",a):RSAnalyticsManager.getInstance().setOtherValueInAnalytics("purchase_sale","success",a))},onSequencerDataLoaded:function(){this._animationSequencerObject.playAnimationAndInit("init",0)},initializeSale:function(a){this._onSaleTriggered= !1;if(a)RSSaleManager.getInstance().onPurchaseSuccessNotifyResponseToCasino();if(RSSaleManager.getInstance().getSaleActiveStatus()||RSSaleManager.getInstance().getLocOocStatus()){var b=RSSaleManager.getInstance().getSaleVO();this._isPurhcaseCart&&(b=RSSaleManager.getInstance().getPurchaseCartV2VO("coin"));RSSaleManager.getInstance().getLocOocStatus()&&!RSSaleManager.getInstance().getSaleActiveStatus()&&RSSaleManager.getInstance().getLocOocSaleData(this._saleDetails.tag)&&(b=RSSaleManager.getInstance().getLocOocSaleData(this._saleDetails.tag)); this._saleDetails.eventId==b.eventId?!a||"loc"!=this._saleDetails.tag&&"ooc"!=this._saleDetails.tag&&"ooe"!=this._saleDetails.tag?(this._saleDetails=RSSaleManager.getInstance().getSaleVO(),this._isPurhcaseCart?this._saleDetails=RSSaleManager.getInstance().getPurchaseCartV2VO("coin"):RSSaleManager.getInstance().startSaleTimer()):(RSEventManager.getInstance().dispatchEvent("onSaleClosed",{}),this.closePopup()):(RSEventManager.getInstance().dispatchEvent("onSaleClosed",{}),this.closePopup())}else this._isPurhcaseCart|| RSEventManager.getInstance().dispatchEvent("onSaleClosed",{}),this.closePopup()},createCustomObject:function(a,b){switch(b.type){case "RSLabel":var c=RSSaleManager.getInstance().getSaleFont(SaleFontType.TIMER);this._popupTimerText=new RSLabelBMFont("",c,-1,kTEXT_ALIGNMENT_CENTER);this._popupTimerText.setScale(0.5);this._popupTimerText.setCenter(b.x,b.y);this.addChild(this._popupTimerText);break;case "BG":this.addChild(RSUtils.createBasicObject(a,b));break;case "CustomWidget":"SaleWidget"==b.name&& (this._saleWidget=new RSSaleWidget(b,this._isPurhcaseCart),this.addChild(this._saleWidget),this._saleWidget.setCenter(b.x,b.y),this._saleWidget.setDelegate(this));if("TitleWidget"==b.name){var c=RSGame.getInstance().getAssetPath("RSCartPopupTitleWidget"),d=!1;RSSaleManager.getInstance().getSaleCartResourceByName("RSCartPopup_TitleWidget")&&(c=RSSaleManager.getInstance().getSaleCartResourceByName("RSCartPopup_TitleWidget"),d=!0);c=new RSSaleTitleWidget(b,c,d);this.addChild(c);c.setCenter(b.x,b.y)}"VIPStatusTier"== b.name&&(this.subscriptionWidgetActiveStatus()?(c=new RSRect(b.x,b.y,b.w,b.h),this.currentStatusTier=new RSSubscriptionVipStatusTierWidget(c,null,this.cartItemWidgetStarAnim.bind(this))):(c=new RSRect(b.x,b.y,b.w,b.h),this.currentStatusTier=new VIPTierWidget(c,null,this.cartItemWidgetStarAnim.bind(this))),this.currentStatusTier.setAnchorPoint(0.5,0.5),this.addChild(this.currentStatusTier));"PlayerCardCartWidget"==b.name&&(c=new RSRect(b.x,b.y,b.w,b.h),c=new RSPlayerCardCartWidget(c),c.setAnchorPoint(0.5, 0.5),this.addChild(c));"CoinCartScrollerWidget"==b.name&&(this.saleWidget=new RSCartScrollerWidget(b,this._isPurhcaseCart,null,this.VIPWidgetStartAnim.bind(this)),this.addChild(this.saleWidget),this.saleWidget.setCenter(b.x,b.y),this.saleWidget.setDelegate(this))}this._super.createCustomObject.call(this,a,b)},subscriptionWidgetActiveStatus:function(){return RSGame.getInstance().getGameManager().isSubscriptionInsidePurchaseCartIsEnabled()&&GameConfig.SUBSCRIPTION_ENABLED&&("1"==RSEngine.gameData.getDefaultValues().isNMISubscriptionActive&& RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&"US"==RSGame.getInstance().getUserDataManager().getMe().getCountryCode()&&RSSaleManager.getInstance().getSubscriptionSaleStatus()&&!GameConfig.SKIP_SUBSCRIPTION_SALE_POPUP&&null!=RSSaleManager.getInstance()._allSalesData.subscription.assets[0]||RSSubscrptionSaleManager.getCurrentDate("day"))?!0:!1},VIPWidgetStartAnim:function(){this.currentStatusTier.startLoopAnim()},cartItemWidgetStarAnim:function(){this.saleWidget&&this.saleWidget._startPlayingIdleAnimation()}, onPopupAnimationComplete:function(){this.saleWidget&&this.saleWidget.startAutoScrollAnim();this._super.onPopupAnimationComplete.call(this)},setTouchEnabled:function(a){a?this.handlePurchasedTagVisibility():this._super.setTouchEnabled(!1)},onButtonClicked:function(a){if(0<=a.indexOf("buy_packIndex")){if(!1==this._onSaleTriggered){var b=a.match(/\d+/)[0];this._onSaleTriggered=!0;this._packSelected=a.match(/\d+/)[0];a={analyticsName:this._saleDetails.analyticsName,monetizationCategory:this._saleDetails.monetizationCategory, saleId:this._saleDetails.saleId,eventId:this._saleDetails.eventId};RSSaleManager.getInstance().showFBPurchaseUI(this._saleDetails.packs[b][this._saleDetails.monetizationCategory],a,this.onPurchaseSuccess.bind(this),this.onPurchaseFail.bind(this))}}else 0<=a.indexOf("CloseBtn")&&(this.setOtherValueofAnalytics(null),!0!=this._isCloseButtonClicked&&(this._isCloseButtonClicked=!0,RSInAppPurchaseManager.getInstance().trackGUIEventForPurchaseCartClose(this._isPurhcaseCart?"purchase_cart":RSSaleManager.getInstance().getSaleTagForTrackingEvents(this._saleDetails.tag), "close","open_from_"+this.getCurrentMachineName(),"",this._saleDetails.eventId),RSEventManager.getInstance().dispatchEvent("onSaleClosed",{}),this._onSaleTriggered=!1,this.closePopup()))},onPurchaseSuccess:function(){this._onSaleTriggered=!1;RSSaleManager.getInstance().callSaleDetails(this.initializeSale.bind(this,!0),null)},onPurchaseFail:function(){this._onSaleTriggered=!1;this.initializeSale()},handlePurchasedTagVisibility:function(){for(var a=0;a<this._purchasedTag.length;a++)this._purchasedTag[a].setVisible(!1); var a=RSEngine.dataManager.getMe().getSalePurchaseData(),b=this._saleDetails.saleId,c=this._saleDetails.eventId;if("0"==this._saleDetails.userPurchasableType){if(null!=a&&null!=a[b+"_"+c]&&null!=a[b+"_"+c].count&&a[b+"_"+c].count>=this._saleDetails.userPurchasableCount)for(a=0;a<this._purchasedTag.length;a++){this._purchasedTag[a].setVisible(!0);for(var d=0;d<this._buttonList.length;d++){var e="buy_packIndex"+a;0<=this._buttonList[d]._ccObject._name.indexOf(e)&&this._buttonList[d].setTouchEnabled(!1)}}}else if("1"== this._saleDetails.userPurchasableType&&null!=a&&null!=a[b+"_"+c])for(var f in a[b+"_"+c])if("count"!=f&&null!=a[b+"_"+c][f]&&a[b+"_"+c][f]>=this._saleDetails.userPurchasableCount)for(var g=0;g<this._saleDetails.packs.length;g++)if(f==this._saleDetails.packs[g][this._saleDetails.monetizationCategory].offerId)for(this._purchasedTag[g].setVisible(!0),d=0;d<this._buttonList.length;d++)e="buy_packIndex"+g,0<=this._buttonList[d]._ccObject._name.indexOf(e)&&this._buttonList[d].setTouchEnabled(!1)},onObjectCreated:function(a, b,c){switch(c.type){case "Animation":a.stopAnimation(),a.playAnimation(-1,0.5)}0<=c.name.indexOf("buy_packIndex")?(this._buttonList.push(a),a=RSSaleManager.getInstance().getSaleFont(RSSaleManager.getInstance().getSaleTagActiveForPlayer()),a=new RSLabelBMFont("",a,-1,kTEXT_ALIGNMENT_CENTER),a.setScale(0.7),a.setCenter(c.x,c.y),this._amountTxts.push(a),this.addChild(a)):0<=c.name.indexOf("purchasedBo_packIndex")?this._purchasedTag.push(a):0<=c.name.indexOf("_reward_packIndex")?(this._purchaseReward.push(a), this._purchaseRewardData.push(c)):0<=c.name.indexOf("_price_packIndex")?(this._purchasePrice.push(a),this._purchasePriceData.push(c),this._pricePosition[c.name]=[c.x,c.y]):0<=c.name.indexOf("SweepstakeInfo")&&(this._usBannerBar=a,this._usBannerBar.setVisible(!1))},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){},handlePurchaseInfoPriceVisibility:function(){for(var a=0;a<this._purchaseReward.length;a++)this._purchaseReward[a].setVisible(!1); for(a=0;a<this._purchasePrice.length;a++)this._purchasePrice[a].setVisible(!1);for(a=0;a<this._purchaseRewardData.length;a++)0<=this._purchaseRewardData[a].name.indexOf(this._saleDetails.monetizationCategory)&&this._purchaseReward[a].setVisible(!0);if("USD"!=RSSocialManager.getInstance().currency.user_currency)if(RSEngine.loginMode==LOGIN_MODE.FACEBOOK)for(a=0;a<this._saleDetails.packs.length;a++){var b=this._saleDetails.monetizationCategory;this._amountTxts[a].setString(RSInAppPurchaseManager.getInstance().getLocalCurrency(this._saleDetails.packs[a][b].price))}else for(a= 0;a<this._purchasePriceData.length;a++)0<=this._purchasePriceData[a].name.indexOf(this._saleDetails.monetizationCategory)&&this._purchasePrice[a].setVisible(!0);else for(a=0;a<this._purchasePriceData.length;a++)0<=this._purchasePriceData[a].name.indexOf(this._saleDetails.monetizationCategory)&&this._purchasePrice[a].setVisible(!0)},getCurrentMachineName:function(){var a="";return a=this._openFrom?this._openFrom:"gameplay_screen"==RSAnalyticsManager.getInstance().getCurrentScreen()?RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName(): RSAnalyticsManager.getInstance().getCurrentScreen()},closePopup:function(){RSEventManager.getInstance().removeListenersForEvent("onPurchaseSuccessClosed");this._callBack&&(this._callBack(),this._callBack=null);GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&this._isCloseButtonClicked&&1==parseInt(RSEngine.gameData.getDefaultValues().isOOCCarousalEnabled)&&"ooc"==this._tag&&(this._tag="",RSSaleManager.getInstance().getOOCAnimStatusForCarousal()?(RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent, {event:RSPlatformEventTypeKeys.CAROUSAL,parameter:RSPlatformPopupNameKeys.OOCFirstFlow}),RSSaleManager.getInstance().setOOCAnimStatusForCarousal()):RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.CAROUSAL,parameter:RSPlatformPopupNameKeys.OOCSaleSubsequentFlow}));this._super.closePopup.call(this)},unload:function(){GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&this._isCloseButtonClicked&&("loc"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_CLOSE, RSPlatformPopupNameKeys.LOC):"ooc"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_CLOSE,RSPlatformPopupNameKeys.OOC):"nps"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_CLOSE,RSPlatformPopupNameKeys.NPS):RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_CLOSE,RSPlatformPopupNameKeys.SALES));RSSaleManager.getInstance().unload();this._purchasedTag=[];this._purchaseReward=[];this._purchasePrice= [];this._purchaseRewardData=[];this._purchasePriceData=[];this._amountTxts=[];this._openFrom=this._saleWidget=this._popupTimerText=null;RSEventManager.getInstance().removeListenersForEvent("onTimerTick");this._super.unload.call(this)}});var RSSaleWidget=RSDisplayObject.extend({_callBack:null,_assetList:null,_saleDetails:null,_currentPowerPackData:null,_layoutLoadedCount:null,_selectedType:null,_currentPackData:null,_bannerBar:null,_usBannerBar:null,_purchasedTag:[],_purchaseReward:[],_purchasePrice:[],_purchaseRewardData:[],_purchasePriceData:[],_packSelected:0,_popupTimerObject:null,_popupTimerText:null,_timeRemaining:0,_onSaleTriggered:!1,_buttonList:[],_pricePosition:{},_amountTxts:[],_rewardTxts:[],_rewardEnergyTxts:[],_rewardPowerupTxts:[], _rewardInstantBingoTxts:[],_priceTxts:[],_strikeOutPriceTxts:[],_multiplierTxts:[],_isPurchaseCart:!1,_strikeOutAnimationEnabled:!1,_currencyType:null,_stackTag:[],_gcowTag:[],_GCOWEnabled:!1,init:function(a,b,c){a=new RSRect(0,0,a.w,a.h);this._layoutLoadedCount=0;this._isPurchaseCart=b;this._currencyType=c;this._GCowPacks=[];this._isPurchaseCart?RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("SaleFontConfigJson"),"SaleCartWidgetFontConfig.json"):RSSaleManager.getInstance().getSaleResourceByName("SaleWidgetFontConfig", !0)?(b=RSSaleManager.getInstance().getSaleResourceByName("SaleWidgetFontConfig",!0),c=RSSaleManager.getInstance().getSaleVO().saleName,RSPlatformFontAssetManager.loadFontConfigFile(b,c+"_SaleWidgetFontConfig.json")):RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("SaleFontConfigJson"),"SaleWidgetFontConfig.json");this._rewardTxts=[];this._rewardEnergyTxts=[];this._rewardPowerupTxts=[];this._rewardInstantBingoTxts=[];this._priceTxts=[];this._strikeOutPriceTxts=[];this._multiplierTxts= [];this._purchasedTag=[];this._buttonList=[];this._super.init.call(this,a);this.loadContent();this._buttonList=[];this._purchaseReward=[];this._purchasePrice=[];this._purchaseRewardData=[];this._purchasePriceData=[];this._callBack=null;this._amountTxts=[];this._selectedType="";this._isCloseButtonClicked=this._onSaleTriggered=!1;RSSalePopupGlobal=this;this._isPurchaseCart||RSEventManager.getInstance().addEventListener("onTimerTick",this,this._setTimerValues.bind(this));RSEventManager.getInstance().addEventListener("onPurchaseSuccessClosed", this,this.closePopup.bind(this))},getName:function(){return"RSSalePopup"},_setTimerValues:function(a){this._timeRemaining=a._userData.timeRemaining;0<this._timeRemaining?(a=RSUtils.formattedTime(this._timeRemaining),null!=this._popupTimerText&&"true"==this._saleDetails.timer&&this._popupTimerText.setString(a)):(RSInAppPurchaseManager.getInstance().trackGUIEventForPurchaseCartClose(RSSaleManager.getInstance().getSaleTagForTrackingEvents(this._saleDetails.tag),"close","open_from_"+this.getCurrentMachineName(), "",this._saleDetails.eventId),this.closePopup())},loadContent:function(){var a="RSSalePopupWidget",a=this._isPurchaseCart?RSSaleManager.getInstance().getSaleCartResourceByName("RSCartPopup_SaleWidget",this._currencyType)?RSSaleManager.getInstance().getSaleCartResourceByName("RSCartPopup_SaleWidget",this._currencyType):RSGame.getInstance().getAssetPath("RSCartPopupSaleWidget"):RSSaleManager.getInstance().getSaleResourceByName("RSSalePopup_SaleWidget")?RSSaleManager.getInstance().getSaleResourceByName("RSSalePopup_SaleWidget"): RSGame.getInstance().getAssetPath("RSSalePopupWidget");this.loadLayout(a)},onLayoutCompleted:function(){1==parseInt(RSEngine.gameData.getDefaultValues().enableGCOW)&&0<Object.keys(this._gcowTag).length&&"US"==RSGame.getInstance().getUserDataManager().getMe().getCountryCode()&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&!RSSaleManager.getInstance().getNSPActivedState()&&void 0!=RSEngine.gameData.getSheetData("capping")&&RSGame.getInstance().getGameVariable().geGCOWRewardedCount()<parseInt(RSEngine.gameData.getSheetData("capping")[0].maximumCapping)&& (this._GCOWEnabled=!0);this._saleDetails=this._isPurchaseCart?RSSaleManager.getInstance().getPurchaseCartV2VO(this._currencyType):RSSaleManager.getInstance().getSaleVO();this._super.onLayoutCompleted.call(this);if(this._GCOWEnabled)for(var a=RSEngine.gameData.getSheetData("gcowreward"),b=0;b<a.length;b++)this._GCowPacks[b]=a[b].packid;this.initializeSale();RSSaleManager.getInstance().trackImpression(this._saleDetails.analyticsName,this._saleDetails.monetizationCategory,this._saleDetails.saleId,this._saleDetails.eventId); GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&("loc"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_OPEN,RSPlatformPopupNameKeys.LOC):"ooc"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_OPEN,RSPlatformPopupNameKeys.OOC):"nps"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_OPEN,RSPlatformPopupNameKeys.NPS):RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_OPEN, RSPlatformPopupNameKeys.SALES));a=RSGame.getInstance().getAssetFolder("SaleAnimV2Config");this._isPurchaseCart?RSSaleManager.getInstance().getSaleCartConfigPath("SaleAnimV2Config",this._currencyType)&&(a=RSSaleManager.getInstance().getSaleCartConfigPath("SaleAnimV2Config")):RSSaleManager.getInstance().getSaleConfigPath("SaleAnimV2Config")&&(a=RSSaleManager.getInstance().getSaleConfigPath("SaleAnimV2Config"));this._animationSequencerObject=new RSPlatformAnimationSequencer(a,"SaleAnimV2Config.json", this,this);this._animationSequencerObject.loadAnimData()},onSequencerDataLoaded:function(){this._animationSequencerObject.playAnimationAndInit("init",0);this.scheduleFunctionOnce(this.startSaleAnimation.bind(this),0.2)},startSaleAnimation:function(){var a="SalePriceAnimation";this._isPurchaseCart&&(a="CartPriceAnimation");this._strikeOutAnimationEnabled&&this._animationSequencerObject.playAnimationWithoutInit(a,1)},initializeSale:function(a){this._onSaleTriggered=!1;if(a)RSSaleManager.getInstance().onPurchaseSuccessNotifyResponseToCasino(); if(RSSaleManager.getInstance().getSaleActiveStatus()||RSSaleManager.getInstance().getLocOocStatus()||this._isPurchaseCart){var b=RSSaleManager.getInstance().getSaleVO();RSSaleManager.getInstance().getLocOocStatus()&&!RSSaleManager.getInstance().getSaleActiveStatus()&&RSSaleManager.getInstance().getLocOocSaleData(this._saleDetails.tag)&&(b=RSSaleManager.getInstance().getLocOocSaleData(this._saleDetails.tag));this._isPurchaseCart||this._saleDetails.eventId==b.eventId?!a||"loc"!=this._saleDetails.tag&& "ooc"!=this._saleDetails.tag&&"ooe"!=this._saleDetails.tag?(this._isPurchaseCart?this._saleDetails=RSSaleManager.getInstance().getPurchaseCartV2VO(this._currencyType):(this._saleDetails=RSSaleManager.getInstance().getSaleVO(),RSSaleManager.getInstance().startSaleTimer()),this.handlePurchasedTagVisibility(),this.handlePurchaseInfoPriceVisibility()):(RSEventManager.getInstance().dispatchEvent("onSaleClosed",{}),this.closePopup()):(RSEventManager.getInstance().dispatchEvent("onSaleClosed",{}),this.closePopup())}else RSEventManager.getInstance().dispatchEvent("onSaleClosed", {}),this.closePopup();this.setTextLabels()},createCustomObject:function(a,b){switch(b.type){case "RSLabel":var c=RSSaleManager.getInstance().getSaleFont(SaleFontType.TIMER);this._popupTimerText=new RSLabelBMFont("",c,-1,kTEXT_ALIGNMENT_CENTER);this._popupTimerText.setScale(0.5);this._popupTimerText.setCenter(b.x,b.y);this.addChild(this._popupTimerText);break;case "Holder":"VIPStatusTier"==b.name&&(c=new RSRect(b.x,b.y,b.w,b.h),c=new VIPTierWidget(c),c.setAnchorPoint(0.5,0.5),this.addChild(c));break; case "BG":this.addChild(RSUtils.createBasicObject(a,b));break;case "PurchasedStamp":c=RSUtils.createBasicObject(a,b);this.addChild(c);this._purchasedTag.push(c);this[b.name]=c;break;case "BuyBtn":this._submitButton=RSUtils.createButton(a,b);this.addTouchListenerToButton(this._submitButton);this.addChild(this._submitButton);this._buttonList.push(this._submitButton);break;case "Coin":c=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(c);this._rewardTxts.push(c);break;case "Energy":c= RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(c);this._rewardEnergyTxts.push(c);break;case "Powerup":c=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(c);this._rewardPowerupTxts.push(c);break;case "InstantBingo":c=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(c);this._rewardInstantBingoTxts.push(c);break;case "Price":c=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(c);this._priceTxts.push(c);this[b.name]=c;break;case "StrikeOutPrice":c= RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(c);this._strikeOutPriceTxts.push(c);this[b.name]=c;break;case "Timer":this._popupTimerText=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(this._popupTimerText);this[b.name]=this._popupTimerText;break;case "MutiplierTag":c=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(c);this._multiplierTxts.push(c);this[b.name]=c;break;case "CoinStrikeOutAnimation":c=RSUtils.createAnimation(a,b,1);this[b.name]=c; this.addChild(c);break;case "PriceStrikeOutAnimation":c=RSUtils.createAnimation(a,b,1),this[b.name]=c,this.addChild(c)}this._super.createCustomObject.call(this,a,b)},setTouchEnabled:function(a){a?this.handlePurchasedTagVisibility():this._super.setTouchEnabled(!1)},onButtonClicked:function(a){if(0<=a.indexOf("BuyButton")){if(!1==this._onSaleTriggered){var b=a.match(/\d+/)[0]-1,c=null,c=null!=this._saleDetails.packs[b][this._saleDetails.monetizationCategory]?this._saleDetails.packs[b][this._saleDetails.monetizationCategory]: this._saleDetails.packs[b].all;this._onSaleTriggered=!0;this._packSelected=a.match(/\d+/)[0];a={analyticsName:this._saleDetails.analyticsName,monetizationCategory:this._saleDetails.monetizationCategory,saleId:this._saleDetails.saleId,eventId:this._saleDetails.eventId,saleTypePurhchasecart:this._isPurchaseCart,currencyType:this._currencyType?this._currencyType:"coins"};RSSaleManager.getInstance().showFBPurchaseUI(c,a,this.onPurchaseSuccess.bind(this),this.onPurchaseFail.bind(this))}}else if(0<=a.indexOf("CloseBtn"))if(this._delegate)this._delegate.onButtonClicked(a); else!0!=this._isCloseButtonClicked&&(this._isCloseButtonClicked=!0,RSInAppPurchaseManager.getInstance().trackGUIEventForPurchaseCartClose(RSSaleManager.getInstance().getSaleTagForTrackingEvents(this._saleDetails.tag),"close","open_from_"+this.getCurrentMachineName(),"",this._saleDetails.eventId),RSEventManager.getInstance().dispatchEvent("onSaleClosed",{}),this._onSaleTriggered=!1,this.closePopup())},setDelegate:function(a){this._delegate=a},onPurchaseSuccess:function(){this._onSaleTriggered=!1;RSSaleManager.getInstance().callSaleDetails(this.initializeSale.bind(this, !0),null)},onPurchaseFail:function(){this._onSaleTriggered=!1;this.initializeSale()},handlePurchasedTagVisibility:function(){for(var a=0;a<this._purchasedTag.length;a++)this._purchasedTag[a].setVisible(!1);var a=RSEngine.dataManager.getMe().getSalePurchaseData(),b=this._saleDetails.saleId,c=this._saleDetails.eventId;if("0"==this._saleDetails.userPurchasableType){if(null!=a&&null!=a[b+"_"+c]&&null!=a[b+"_"+c].count&&a[b+"_"+c].count>=this._saleDetails.userPurchasableCount)for(a=0;a<this._purchasedTag.length;a++){this._purchasedTag[a].setVisible(!0); for(var d=0;d<this._buttonList.length;d++){var e="buy_packIndex"+a;0<=this._buttonList[d]._ccObject._name.indexOf(e)&&this._buttonList[d].setTouchEnabled(!1)}}}else if("1"==this._saleDetails.userPurchasableType&&null!=a&&null!=a[b+"_"+c])for(var f in a[b+"_"+c])if("count"!=f&&null!=a[b+"_"+c][f]&&a[b+"_"+c][f]>=this._saleDetails.userPurchasableCount)for(var g=0;g<this._saleDetails.packs.length;g++)if(f==this._saleDetails.packs[g][this._saleDetails.monetizationCategory].offerId)for(this._purchasedTag[g].setVisible(!0), this._buttonList[g].setTouchEnabled(!1),d=0;d<this._buttonList.length;d++)e="buy_packIndex"+g,0<=this._buttonList[d]._ccObject._name.indexOf(e)&&this._buttonList[d].setTouchEnabled(!1)},onObjectCreated:function(a,b,c){switch(c.type){case "Animation":a.stopAnimation(),a.playAnimation(1,0.3),this[c.name]=a,a.setPosition(c.x,c.y)}0<=c.name.indexOf("buy_packIndex")?(this._buttonList.push(a),a=RSSaleManager.getInstance().getSaleFont(RSSaleManager.getInstance().getSaleTagActiveForPlayer()),a=new RSLabelBMFont("", a,-1,kTEXT_ALIGNMENT_CENTER),a.setScale(0.7),a.setCenter(c.x,c.y),this._amountTxts.push(a),this.addChild(a)):0<=c.name.indexOf("purchasedBo_packIndex")?this._purchasedTag.push(a):0<=c.name.indexOf("_reward_packIndex")?(this._purchaseReward.push(a),this._purchaseRewardData.push(c)):0<=c.name.indexOf("_price_packIndex")?(this._purchasePrice.push(a),this._purchasePriceData.push(c),this._pricePosition[c.name]=[c.x,c.y]):0<=c.name.indexOf("SweepstakeInfo")?(this._usBannerBar=a,this._usBannerBar.setVisible(!1)): 0<=c.name.indexOf("Stack_")?this._stackTag[c.name]=a:0<=c.name.indexOf("GCOWCard")&&(a.setVisible(!1),this._gcowTag[c.name]=a)},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){},handlePurchaseInfoPriceVisibility:function(){for(var a=0;a<this._purchaseReward.length;a++)this._purchaseReward[a].setVisible(!1);for(a=0;a<this._purchasePrice.length;a++)this._purchasePrice[a].setVisible(!1);for(a=0;a<this._purchaseRewardData.length;a++)0<= this._purchaseRewardData[a].name.indexOf(this._saleDetails.monetizationCategory)&&this._purchaseReward[a].setVisible(!0);if("USD"!=RSSocialManager.getInstance().currency.user_currency)if(RSEngine.loginMode==LOGIN_MODE.FACEBOOK)for(var b=null,a=0;a<this._saleDetails.packs.length;a++){var c=this._saleDetails.monetizationCategory,b=this._saleDetails.packs[a].all;null!=this._saleDetails.packs[a][c]&&(b=this._saleDetails.packs[a][c]);this._priceTxts[a].setString(RSInAppPurchaseManager.getInstance().getLocalCurrency(b.price))}else for(a= 0;a<this._purchasePriceData.length;a++)0<=this._purchasePriceData[a].name.indexOf(this._saleDetails.monetizationCategory)&&this._purchasePrice[a].setVisible(!0);else for(a=0;a<this._purchasePriceData.length;a++)0<=this._purchasePriceData[a].name.indexOf(this._saleDetails.monetizationCategory)&&this._purchasePrice[a].setVisible(!0)},setTextLabels:function(){var a=0;if(this._isPurchaseCart){cc.log("inside purchasecart data formatting");for(var b=null,a=0;a<this._saleDetails.packs.length;a++)c=this._saleDetails.monetizationCategory, b=this._saleDetails.packs[a].all,null!=this._saleDetails.packs[a][c]&&(b=this._saleDetails.packs[a][c],this._strikeOutAnimationEnabled=!0),this._rewardTxts[a].setString(RSUtils.formatNumberWithComma(b.value)),this._saleDetails.packs[a][c]&&(d=RSInAppPurchaseManager.getInstance().getLocalCurrency(this._saleDetails.packs[a][c].price),e=d.split("."),void 0==e[1]?d+=".00":1==e[1].length&&(d+="0"),this._priceTxts[a].setString(d)),this._saleDetails.packs[a].all.price&&(cc.log("Strike out data"),d=RSInAppPurchaseManager.getInstance().getLocalCurrency(this._saleDetails.packs[a].all.price), e=d.split("."),void 0==e[1]?d+=".00":1==e[1].length&&(d+="0"),this._strikeOutPriceTxts[a].setString(d)),this._GCOWEnabled&&this._GCowPacks.includes(b.packId)&&(this._stackTag["Stack_"+(a+1)].setVisible(!1),this._gcowTag["GCOWCard"+(a+1)].setVisible(!0))}else for(a=0;a<this._saleDetails.packs.length;a++){var c=this._saleDetails.monetizationCategory;0<this._rewardTxts.length&&(this._saleDetails.packs[a][c].coin?this._rewardTxts[a].setString(RSUtils.formatNumberWithComma(this._saleDetails.packs[a][c].coin)): this._rewardTxts[a].setString(RSUtils.formatNumberWithComma(this._saleDetails.packs[a][c].value)));0<this._rewardEnergyTxts.length&&this._rewardEnergyTxts[a].setString(RSUtils.formatNumberWithComma(this._saleDetails.packs[a][c].energy));0<this._rewardInstantBingoTxts.length&&this._saleDetails.packs[a][c].powerup&&this._saleDetails.packs[a][c].powerup.powerItem5&&this._rewardInstantBingoTxts[a].setString(RSUtils.formatNumberWithComma(this._saleDetails.packs[a][c].powerup.powerItem5));0<this._rewardPowerupTxts.length&& (b=0,this._saleDetails.packs[a][c].powerup&&this._saleDetails.packs[a][c].powerup.powerItem5&&(b=parseInt(this._saleDetails.packs[a][c].powerup.powerItem5)),this._rewardPowerupTxts[a].setString(RSUtils.formatNumberWithComma(this._saleDetails.packs[a][c].value)-b));if(this._saleDetails.packs[a][c]){var d=RSInAppPurchaseManager.getInstance().getLocalCurrency(this._saleDetails.packs[a][c].price),e=d.split(".");void 0==e[1]?d+=".00":1==e[1].length&&(d+="0");this._priceTxts[a].setString(d)}this._saleDetails.packs[a][c].strikeOutData&& (cc.log("Strike out data"),this._strikeOutAnimationEnabled=!0,d=RSInAppPurchaseManager.getInstance().getLocalCurrency(this._saleDetails.packs[a][c].strikeOutData.price),e=d.split("."),void 0==e[1]?d+=".00":1==e[1].length&&(d+="0"),this._strikeOutPriceTxts[a].setString(d));this._multiplierTxts[a]&&this._saleDetails.packs[a][c].multiplier&&(c=this._saleDetails.packs[a][c].multiplier,c=c.replace(/\s/g,"\n"),this._multiplierTxts[a].setString(c))}},getCurrentMachineName:function(){var a="";return a="gameplay_screen"== RSAnalyticsManager.getInstance().getCurrentScreen()?RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName():RSAnalyticsManager.getInstance().getCurrentScreen()},closePopup:function(){RSEventManager.getInstance().removeListenersForEvent("onPurchaseSuccessClosed")},unload:function(){GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&this._isCloseButtonClicked&&("loc"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_CLOSE,RSPlatformPopupNameKeys.LOC): "ooc"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_CLOSE,RSPlatformPopupNameKeys.OOC):"nps"==this._saleDetails.tag?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_CLOSE,RSPlatformPopupNameKeys.NPS):RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.POPUP_CLOSE,RSPlatformPopupNameKeys.SALES));RSEventManager.getInstance().removeListenersForEvent("onPurchaseSuccessClosed");RSSaleManager.getInstance().unload(); this._purchasedTag=[];this._purchaseReward=[];this._purchasePrice=[];this._purchaseRewardData=[];this._purchasePriceData=[];this._amountTxts=[];this._popupTimerText=null;this._rewardTxts=[];this._rewardEnergyTxts=[];this._rewardPowerupTxts=[];this._gcowTag=[];this._stackTag=[];RSEventManager.getInstance().removeListenersForEvent("onTimerTick");this._super.unload.call(this)}});var RSSaleTitleWidget=RSDisplayObject.extend({_callBack:null,_assetList:null,_saleDetails:null,_currentPowerPackData:null,_layoutLoadedCount:null,_selectedType:null,_currentPackData:null,_bannerBar:null,_usBannerBar:null,_purchasedTag:[],_purchaseReward:[],_purchasePrice:[],_purchaseRewardData:[],_purchasePriceData:[],_packSelected:0,_popupTimerObject:null,_popupTimerText:null,_timeRemaining:0,_onSaleTriggered:!1,_buttonList:[],_pricePosition:{},_amountTxts:[],_rewardTxts:[],_priceTxts:[],_strikeOutPriceTxts:[], _multiplierTxts:[],_isPurchaseCart:!1,_titleAnimEnabled:!1,init:function(a,b,c){a=new RSRect(0,0,a.w,a.h);this._layoutLoadedCount=0;this._assetList=b;this._rewardTxts=[];this._priceTxts=[];this._strikeOutPriceTxts=[];this._multiplierTxts=[];this._titleAnimEnabled=c;this._super.init.call(this,a);this.loadContent();this._purchasedTag=[];this._buttonList=[];this._purchaseReward=[];this._purchasePrice=[];this._purchaseRewardData=[];this._purchasePriceData=[];this._callBack=null;this._amountTxts=[];this._selectedType= "";this._isCloseButtonClicked=this._onSaleTriggered=!1;RSSalePopupGlobal=this},getName:function(){return"RSSalePopup"},loadContent:function(){this.loadLayout(this._assetList)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);if(this._titleAnimEnabled){var a=RSGame.getInstance().getAssetFolder("SaleAnimV2Config");RSSaleManager.getInstance().getSaleCartConfigPath("TitleAnimV2Config",this._currencyType)&&(a=RSSaleManager.getInstance().getSaleCartConfigPath("TitleAnimV2Config")); this._animationSequencerObject=new RSPlatformAnimationSequencer(a,"TitleAnimV2Config.json",this,this);this._animationSequencerObject.loadAnimData()}},onSequencerDataLoaded:function(){this._titleAnimEnabled&&this._animationSequencerObject.playAnimationAndInit("init",0);this.scheduleFunctionOnce(this.startSaleAnimation.bind(this),0.2)},startSaleAnimation:function(){this._titleAnimEnabled&&this._animationSequencerObject.playAnimationWithoutInit("TitleAnimation",2)},createCustomObject:function(a,b){switch(b.type){case "RSLabel":var c= RSSaleManager.getInstance().getSaleFont(SaleFontType.TIMER);this._popupTimerText=new RSLabelBMFont("",c,-1,kTEXT_ALIGNMENT_CENTER);this._popupTimerText.setScale(0.5);this._popupTimerText.setCenter(b.x,b.y);this.addChild(this._popupTimerText);break;case "Holder":"VIPStatusTier"==b.name&&(c=new RSRect(b.x,b.y,b.w,b.h),c=new VIPTierWidget(c),c.setAnchorPoint(0.5,0.5),this.addChild(c));break;case "BG":this.addChild(RSUtils.createBasicObject(a,b));break;case "BuyBtn":this._submitButton=RSUtils.createButton(a, b);this.addTouchListenerToButton(this._submitButton);this.addChild(this._submitButton);break;case "Coin":c=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(c);this._rewardTxts.push(c);break;case "Price":c=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(c);this._priceTxts.push(c);this[b.name]=c;break;case "StrikeOutPrice":c=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(c);this._strikeOutPriceTxts.push(c);this[b.name]=c;break;case "Timer":this._popupTimerText= RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(this._popupTimerText);this[b.name]=this._popupTimerText;break;case "MutiplierTag":c=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(c);this._multiplierTxts.push(c);this[b.name]=c;break;case "CoinStrikeOutAnimation":c=RSUtils.createAnimation(a,b,1);this[b.name]=c;this.addChild(c);break;case "PriceStrikeOutAnimation":c=RSUtils.createAnimation(a,b,1),this[b.name]=c,this.addChild(c)}this._super.createCustomObject.call(this, a,b)},onObjectCreated:function(a,b,c){switch(c.type){case "Animation":a.stopAnimation(),a.playAnimation(1,0.3),this[c.name]=a,a.setPosition(c.x,c.y)}this[c.name]=a}});var RSPlayerCardCartWidget=RSDisplayObject.extend({init:function(a,b){this._baseRect=a;this._super.init.call(this,this._baseRect);this._info=null;this._rewardTxts=[];RSGame.getInstance().getAssetPath("PlayerCardWidgetFontConfig")&&RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("PlayerCardWidgetFontConfig"),"PlayerCardWidgetFontConfig.json");null==b?this.loadLayout(RSGame.getInstance().getAssetPath("RSPlayerCardCartWidget")):this.loadLayout(b)},onObjectCreated:function(a, b,c){switch(c.name){case "info":this._info=a;RSEngine.loginMode==LOGIN_MODE.FACEBOOK&&a.setVisible(!1);break;case "VipInfoBanner":RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&a.setVisible(!1)}},createCustomObject:function(a,b){switch(b.type){case "HeartValue":var c=RSPlatformFontAssetManager.createCustomLabel("123",b);this.addChild(c);this._rewardTxts.push(c)}this._super.createCustomObject.call(this,a,b)},onLayoutCompleted:function(){this._rewardTxts.length&&this.setRewardTextvalues();this._super.onLayoutCompleted.call(this)}, setRewardTextvalues:function(){this._saleDetails=RSSaleManager.getInstance().getPurchaseCartV2VO("coin");for(var a=RSEngine.gameData.getDefaultValues().rewardpointsOnPurchasePerDollar,b=0,b=0;b<this._rewardTxts.length;b++){var c=Math.ceil(this._saleDetails.packs[b][this._saleDetails.monetizationCategory]?this._saleDetails.packs[b][this._saleDetails.monetizationCategory].price:this._saleDetails.packs[b].all.price)*parseInt(a);this._rewardTxts[b].setString(RSUtils.formatNumberWithComma(c))}}});function a0_0x449b(a,b){var c=a0_0x448c();return a0_0x449b=function(a,b){return c[a-371]},a0_0x449b(a,b)}function a0_0x448c(){var a="3390dKHJWQ 2565xuqQIX 88ZTIBvZ 312654oJqYez 3046538qSmYQy 34797hBjQkL 7946112WOXCds CHEAT_MODE 488TBWZcs 478ZyDjot 4HZsnGk 10AFETkZ 2004813xDOZQo".split(" ");a0_0x448c=function(){return a};return a0_0x448c()}var a0_0xfd708d=a0_0x449b; (function(a,b){for(var c=a0_0x449b,d=a();;)try{if(parseInt(c(380))/1*(parseInt(c(379))/2)+parseInt(c(374))/3*(parseInt(c(381))/4)+-parseInt(c(372))/5*(parseInt(c(371))/6)+-parseInt(c(376))/7*(-parseInt(c(373))/8)+-parseInt(c(383))/9+-parseInt(c(382))/10*(parseInt(c(375))/11)+parseInt(c(377))/12===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x448c,148147); var GlobalVars={slotsSessionWinAmount:0,dailyScratcherBonusInterval:GameConfig[a0_0xfd708d(378)]?120:86400,dailyBonusInterval:GameConfig[a0_0xfd708d(378)]?120:86400,hourlyBonusInterval:0,lowOnCoinsThreshold:1E4,isRTPSimulationEnabled:!1,winLinesInTheCurrentSlotMachine:0,enableShare:!0,isAmericanUser:!1,sfxVolumeLevel:0,musicVolumeLevel:0,fullscreenStatus:!1,autoShare:!0,isCheatActive:GameConfig[a0_0xfd708d(378)],maxBet:0,blackjackMaxBet:0,mainLobbyInitialized:!1,sfxStatus:!1,musicStatus:!1,voiceCalloutsStatus:!0, isjackpotLoaded:!1,isInsideMachine:!1,isDealInProgress:!1,sevenDayBonusRemainigTime:0,sevenDayBonusDay:0,currentGameCategory:"",newsFeedShownStatus:!1,newsFeedCount:0,fbNotificationEnabled:!1,videoWatchCountForPurchaseCartClose:0,videoWatchCountForSession:0,dealCount:0,isFirstVisitToMainLobby:!0,isTutorialStarted:!1,isPurchaseEnabled:!1,isAudioContextInitialized:!1,tapBlastCount:0,isLeanplumNavigation:!1,lastEventTimeStamp:0,slotsLobbySelectedTab:1,isLMToolTipActive:!1,minBet:0,isSurfacingActive:!1, isVIPSurfacingAnimationActive:!1,dailyBonusShownStatus:!1,isInsideExternalGame:!1,isPurchaseBanned:!1,isLOCAnimShown:!1,isOOCAnimShown:!1,isAristocratHUDEnabled:!1,gameName:"",forceSaveCoinBalance:!1,sessionId:"",relaunchPopupActive:!1,isMachineLoadingInProgress:!1,isJLLoadingInProgress:!1,isInsideTournament:!1,isTournamentLoaded:!1,fbCookieFBP:"",fbCookieFBC:"",clientUserAgent:"",isLoyaltyMallLoaded:!1,scoreboxRedirection:!1,isDCTooltipActive:!1,autoScrollStatusArrayForLobbies:{ALLSLOTS:!1,POKER:!1, KENOBINGO:!1,TABLEGAMES:!1,VIP:!1},backFromGamePlayScreen:!1,lobbyWidgetCount:0,customLobbyStatus:!1,isUserDataLoaded:!1,clickedLockedMachineList:[],timeSpentOnAppBeforeThisSession:0,isWindowsPWA:!1,isPropertyNear:0,joiningDate:0,analyticsPlatformName:"",isLoginFromLoadingScreen:!1,CallCCPA:!1,isFirstSpinOnMachine:!0,isFirstDealOnCPTournamentMachine:!0};var RSLoginManager=function(){var a,b=RSClass.extend({init:function(){this._gameReloadPopup=this._emailId=this._userId=null;RSEventManager.getInstance().addEventListener("RS_CONNECTION_RE_ESTABLISHED",this,this._onConnectionReEstablished.bind(this))},getName:function(){return"RSLoginManager"},webSignIn:function(a,b,e){this._signInCallBack=e;RSGame.getInstance().getUserDataManager().webSignIn(a,b,this.onSignInSuccess.bind(this,a))},webSignUp:function(a,b,e,f){this._signInCallBack=e;RSGame.getInstance().getUserDataManager().webSignUp(a, b,this.onSignUpSuccess.bind(this,f),f)},loginWithCookie:function(){var a=GameConfig.COOKIE_PREFIX,b=this.getCookie(a+"-id"),e=this.getCookie(a+"-email");this.getCookie("fbLoggedIn");a=this.getCookie(a+"-value");RSGame.getInstance().getUserDataManager().loginWithCookie(b,e,a,this.onLoginCookieSuccess.bind(this))},loginWithFacebook:function(a,b){this._FBLoginCallback=b;RSEngine.initializeFacebook(facebook);RSSocialManager.getInstance().showPermissionDialog("email",this._onFbInitComplete.bind(this,a))}, _onFbInitComplete:function(a,b,e){if(b)RSErrorTracker.getInstance().trackErrorMessage("FACEBOOK_PERMISSION","Response From FB Initialisation: code:"+b+", message:"+e.error_message,"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"),cc.log("Response From FB Initialisation: code:"+b+", message:"+e.error_message),GameConfig.SSO_ENABLED&&(b="manage_account","giftcenter"==a&&(b="giftcenter"),RSAnalyticsManager.getInstance().trackPlayerAction(b,"link_fb","fail","","popup_closed"));else if(GameConfig.SSO_ENABLED){var f= this;RSSocialManager.getInstance().checkFBConnected(function(b){cc.log("Response:"+b);cc.log("USER ID:"+RSFBManager.getInstance().getUserID());RSSocialManager.getInstance().getMyData(f._onFacebookDataLoaded.bind(f,a))})}else RSGame.getInstance().getUserDataManager().loginFacebook(this.onLoginFacebook.bind(this)),RSEngine.reloadPage(!0)},_onFacebookDataLoaded:function(a,b){cc.log("FB Data:"+JSON.stringify(b));this._tempFbData=b;RSEngine.screenManager.addOverlay();this._loginFrom=a;"gifting"==a&&RSSSOManager.setFbConnectStatusInGifting(!0); this.updateSocialLogin("facebook",b.id,b.email,this._onFBUpdateSocialLoginSucces.bind(this))},_onFBUpdateSocialLoginSucces:function(){RSEngine.reloadPage(!0)},_getQueryStringValue:function(a){return decodeURIComponent(window.location.search.replace(RegExp("^(?:.*[\x26\\?]"+encodeURIComponent(a).replace(/[\.\+\*]/g,"\\$\x26")+"(?:\\\x3d([^\x26]*))?)?.*$","i"),"$1"))},isURLParamsPresent:function(){var a=this._getQueryStringValue("r7GameMigration");return null==a||void 0==a||""==a?!1:!0},fetchURLParamsAndSetCookieToNewDomain:function(){var a= GameConfig.COOKIE_PREFIX;if(null==this.getCookie("fbLoggedIn")&&null==this.getCookie("msp-loggedIn")&&null==this.getCookie(a+"-value")){var b=this._getQueryStringValue("r7GameMigration").split("|"),a=b[0],b=b[1],e=calcMD5(a+"|"+GameConfig.HASH_KEY);b!=e?cc.log("Hassh key mismatch _keyValueFromServer "+b+"GameConfig.HASH_KEY\x3d "+e):(a=JSON.parse(decodeURIComponent(atob(a))),cc.log("Domain \x3d "+a.cookieDomain+"mspid\x3d "+a["msp-id"]),cc.log("msp-email \x3d "+a["msp-email"]+"msp-value\x3d "+a["msp-value"]), cc.log("loggedIn \x3d "+a["msp-loggedIn"]),cc.log("fb logged \x3d "+a.fbLoggedIn),null!=a&&(b=a.cookieDomain,e={},void 0!=a["msp-id"]&&(e["msp-id"]=a["msp-id"]),void 0!=a["msp-email"]&&(e["msp-email"]=a["msp-email"]),void 0!=a["msp-value"]&&(e["msp-value"]=a["msp-value"]),void 0!=a["msp-loggedIn"]&&(e["msp-loggedIn"]=a["msp-loggedIn"]),void 0!=a.fbLoggedIn&&(e.fbLoggedIn=a.fbLoggedIn),null==e["msp-loggedIn"]&&null==e.fbLoggedIn||this.setCookie(b,"",e)))}},onLoginFacebook:function(a){200==a.result.status&& this.setCookie(a.result.cookieDomain,a.result.cookieTime,a.result.cookieValues);cc.log("get fb details here....email")},onSignInSuccess:function(a,b){if(200==b.result.status)if(this.setCookie(b.result.cookieDomain,b.result.cookieTime,b.result.cookieValues),GameConfig.SSO_ENABLED){RSSSOManager.setCookieEmailVerificationStatus(b.result);var e=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId");if(e)if(b.result.verified&&"true"==b.result.verified||"1"==b.result.verified||"2"== b.result.verified)cc.log("Updating social login in email signin where email is verified"),RSEngine.screenManager.addOverlay(),this.updateSocialLogin("email",a,null,this.onSSOSocialLoginUpdateSucces.bind(this));else if("true"==b.result.immediateVerificationRequired||!0==b.result.immediateVerificationRequired)cc.log("showing blocker :immediateVerificationRequired"),RSSSOManager.showEmailVerificationPromtPopup(a);else if(0==b.result.isNew||"0"==b.result.isNew)cc.log("Updating social login in email signin where player is migrated"), RSEngine.screenManager.addOverlay(),this.updateSocialLogin("email",a,null,this.onSSOSocialLoginUpdateSucces.bind(this));else if("false"==b.result.verified||0==b.result.verified||"0"==b.result.verified)cc.log("showing email verification popup"),RSSSOManager.showEmailVerificationPopup(a,b.result.remainingTime);else{cc.log("Signin : continue with existing a/c");RSEventManager.getInstance().dispatchEvent("onUpdateSocialLogin","email");var f=GameConfig.COOKIE_PREFIX+"-loginType",g=GameConfig.COOKIE_PREFIX+ "-blobId",h=GameConfig.COOKIE_PREFIX+"-email",k=GameConfig.COOKIE_PREFIX+"-emailValue",m=this.getUpdatedLoginTypes("email");cc.log("Updated Login type vars::"+m);var n={};n[f]=m;n[g]=e;n[h]=a;n[k]=a;this.setCookie(GameConfig.SSO_COOKIE_DOMAIN,null,n)}else b.result.verified&&"true"==b.result.verified||"1"==b.result.verified||"2"==b.result.verified?(cc.log("Updating social login in email signin where email is verified"),RSEngine.screenManager.addOverlay(),this.updateSocialLogin("email",a,null,this.onSSOSocialLoginUpdateSucces.bind(this))): "true"==b.result.immediateVerificationRequired||!0==b.result.immediateVerificationRequired?(cc.log("showing blocker :immediateVerificationRequired"),RSSSOManager.showEmailVerificationPromtPopup(a)):0==b.result.isNew||"0"==b.result.isNew?(cc.log("Updating social login in email signin where player is migrated"),RSEngine.screenManager.addOverlay(),this.updateSocialLogin("email",a,null,this.onSSOSocialLoginUpdateSucces.bind(this))):"false"==b.result.verified||"0"==b.result.verified||0==b.result.verified? (cc.log("showing email verification popup"),RSSSOManager.showEmailVerificationPopup(a,b.result.remainingTime)):(cc.log("Updating social login in email signin :guest user"),RSEngine.screenManager.addOverlay(),this.updateSocialLogin("email",a,null,this.onSSOSocialLoginUpdateSucces.bind(this)))}else RSEngine.reloadPage(!0);else $("#login-err").text(b.result.message),$("#login-err").show(),GameConfig.SSO_ENABLED&&this._signInCallBack&&(RSAnalyticsManager.getInstance().trackPlayerAction("manage_account", "link_email","fail","",b.result.message),this._signInCallBack(b.result.message))},onSignUpSuccess:function(a,b){if(200==b.result.status)if(this.setCookie(b.result.cookieDomain,b.result.cookieTime,b.result.cookieValues),GameConfig.SSO_ENABLED){RSSSOManager.setCookieEmailVerificationStatus(b.result);this._signInCallBack&&this._signInCallBack(!0);var e=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId"),f=b.result.email;if(e)if("true"==b.result.immediateVerificationRequired||!0== b.result.immediateVerificationRequired)cc.log("showing blocker :immediateVerificationRequired"),RSSSOManager.showEmailVerificationPromtPopup(f);else if("true"==b.result.verified||1==b.result.verified)cc.log("Updating social login in email signin where email is verified"),RSEngine.screenManager.addOverlay(),this.updateSocialLogin("email",f,null,this.onSSOSocialLoginUpdateSucces.bind(this));else if("false"==b.result.verified||0==b.result.verified||"0"==b.result.verified)cc.log("showing email verification popup"), RSSSOManager.showEmailVerificationPopup(f,b.result.remainingTime);else{cc.log("Signin : continue with existing a/c");RSEventManager.getInstance().dispatchEvent("onUpdateSocialLogin","email");var g=GameConfig.COOKIE_PREFIX+"-loginType",h=GameConfig.COOKIE_PREFIX+"-blobId",k=GameConfig.COOKIE_PREFIX+"-email",m=GameConfig.COOKIE_PREFIX+"-emailValue",n=this.getUpdatedLoginTypes("email");cc.log("Updated Login type vars::"+n);var p={};p[g]=n;p[h]=e;p[k]=f;p[m]=f;this.setCookie(GameConfig.SSO_COOKIE_DOMAIN, null,p)}else"true"==b.result.immediateVerificationRequired||!0==b.result.immediateVerificationRequired?(cc.log("showing blocker :immediateVerificationRequired"),RSSSOManager.showEmailVerificationPromtPopup(f)):1==b.result.verified?(RSEngine.screenManager.addOverlay(),this.updateSocialLogin("email",f,null,this.onSSOSocialLoginUpdateSucces.bind(this))):(cc.log("showing email verification popup"),RSSSOManager.showEmailVerificationPopup(f,b.result.remainingTime))}else RSEngine.reloadPage(!0);else $("#signup-err").text(b.result.message), $("#signup-err").show(),GameConfig.SSO_ENABLED&&this._signInCallBack&&(RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","register_now","fail","",""),this._signInCallBack(b.result.message))},onSSOSocialLoginUpdateSucces:function(){},onLoginCookieSuccess:function(a){if(GameConfig.SSO_ENABLED){if(200==a.result.status&&"email"==a.result.loginMode){var b=GameConfig.COOKIE_PREFIX+"-loginType",e=GameConfig.COOKIE_PREFIX+"-blobId",f=GameConfig.COOKIE_PREFIX+"-emailValue",g=GameConfig.COOKIE_PREFIX+ "-email",h=this.getUpdatedLoginTypes("email"),k={};k[b]=h;k[e]=a.result.blob_id;k[f]=a.result.email;k[g]=a.result.email;this.setCookie(GameConfig.SSO_COOKIE_DOMAIN,null,k);RSEngine.userConfig.userId=a.result.blob_id;RSEngine.userConfig.email=a.result.email;RSEngine.loginMode=LOGIN_MODE.EMAIL;this.unsetLoggedInStatus();this.unsetHashValue();this.unsetIdValue();RSGame.getInstance().loadGame()}}else 200==a.result.status?"email"==a.result.loginMode&&(this._userId=a.result.userId,this._emailId=a.result.email, RSEngine.loginMode=LOGIN_MODE.EMAIL,RSEngine.userConfig.userId=this._userId,RSEngine.userConfig.email=this._emailId):this.showLandingPage()},forgotPassword:function(a,b){RSGame.getInstance().getUserDataManager().forgotPassword(a,b?b:this.onforgotPasswordComplete.bind(this))},onforgotPasswordComplete:function(a){200==a.result.status?(a.result.message?$("#err").show():$("#success").show(),setTimeout(function(){$("#success").hide();$("#myModal").modal("toggle")},2E3)):($("#err").show(),$("#btn-send").removeClass("disabled"), $("#btn-send").removeAttr("disabled").button("refresh"))},showLoginBox:function(){$("#myModal-login").modal("toggle");document.getElementById("loginPrompt");$("#loginformbox").hide();$("#signupformbox").slideDown("fast").css({display:"block"});$("#loginLogo").show();var a=document.getElementById("loginModaldialog");a.style.width="100%";a.style.margin="unset"},showLandingPage:function(){var a=document.getElementById("loginbox"),b=document.getElementById("loginModaldialog");b.style.width="100%";b.style.margin= "unset";$("#myModal-login").modal("toggle");a.style.pointerEvents="all";document.getElementById("myModal-login").style.pointerEvents="none";$("#fbButtonDiv").show();$("#fbButtonCrossLine").show();$(".modal-backdrop").hide();$("#Cocos2dGameContainer").hide();document.body.style.background="url('/res/WebAssets/bg.png')";document.body.style.backgroundSize="cover";document.body.style.backgroundRepeat="no-repeat"},logout:function(){RSGame.getInstance().getUserDataManager().logout(this.onLogout.bind(this))}, onLogout:function(a){if(200==a.result.status){this.unSetCookie(a.result.cookieDomain,a.result.cookieTime,a.result.cookieValues);var b={};b[GameConfig.COOKIE_PREFIX+"-loggedIn"]=!1;this.setCookie(a.result.cookieDomain,a.result.cookieTime,b);RSEngine.reloadPage(!0)}},setCookie:function(a,b,e){b=new Date;b.setTime(b.getTime()+2592E6);var f=navigator.userAgent.toLowerCase(),g=!1;try{g=/constructor/i.test(window.HTMLElement)||"[object SafariRemoteNotification]"===(!window.safari||safari.pushNotification).toString()}catch(h){}var g= g||-1!=f.indexOf("safari")&&-1==f.indexOf("chrome")&&-1!=f.indexOf("version/"),k;if(g)for(k in e)document.cookie=k+"\x3d"+e[k]+";expires\x3d"+b.toUTCString()+";domain\x3d"+a+";path\x3d/;SameSite\x3dNone";else for(k in e)document.cookie=k+"\x3d"+e[k]+";expires\x3d"+b.toUTCString()+";domain\x3d"+a+";path\x3d/;SameSite\x3dNone;secure"},unSetCookie:function(a,b,e){b=new Date;b.setMonth(b.getMonth()-1);for(var f in e)document.cookie=f+"\x3d"+e[f]+";expires\x3d"+b+";domain\x3d"+a+";path\x3d/"},getCookie:function(a){a+= "\x3d";for(var b=document.cookie.split(";"),e=0;e<b.length;e++){for(var f=b[e];" "==f.charAt(0);)f=f.substring(1,f.length);if(0==f.indexOf(a)){a=f.substring(a.length,f.length);if("null"==a)break;return a}}return null},initFormValidation:function(){$("#fb-button").click(function(){RSLoginManager.getInstance().loginWithFacebook()});$("#forgotLoginPassword").click(function(){$("#myModal").modal("show")});$("#loginform").formValidation({framework:"bootstrap",err:{container:"tooltip"},fields:{username:{validators:{callback:{message:"This email-id is not valid", callback:function(a){return""===a||!1==/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(a)?!1:!0}}}},password:{validators:{notEmpty:{message:"The password is required"}}}}}).on("err.validator.fv",function(a,b){b.element.data("fv.messages").find('.help-block[data-fv-for\x3d"'+b.field+'"]').hide().filter('[data-fv-validator\x3d"'+b.validator+'"]').show()}).on("success.form.fv",function(a){var b=$("#login-username").val(),e=$("#login-password").val();$("#rememberme").is(":checked")? (localStorage.usrname=$("#login-username").val(),localStorage.pass=$("#login-password").val(),localStorage.chkbx=$("#rememberme").val()):(localStorage.usrname="",localStorage.pass="",localStorage.chkbx="");a.preventDefault();RSLoginManager.getInstance().webSignIn(b,e)});$("#signupform").formValidation({framework:"bootstrap",icon:{},fields:{username:{validators:{callback:{message:"This email-id is not valid",callback:function(a){return""===a||!1==/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(a)? !1:!0}}}},password:{validators:{notEmpty:{message:"The password is required"},stringLength:{message:"Password length should be between 4 and 20",min:4,max:20}}},agree:{validators:{choice:{min:1,message:"",onError:function(a,b){$("#fb-button").attr("disabled","disabled")},onSuccess:function(a,b){$("#fb-button").removeAttr("disabled").button("refresh")}}}}}}).on("err.validator.fv",function(a,b){b.element.data("fv.messages").find('.help-block[data-fv-for\x3d"'+b.field+'"]').hide().filter('[data-fv-validator\x3d"'+ b.validator+'"]').show()}).on("err.field.fv",function(a,b){b.element.data("fv.messages").find('.help-block[data-fv-for\x3d"agree"]').hide()}).on("success.form.fv",function(a){var b=$("#signup-username").val(),e=$("#signup-password").val();a.preventDefault();RSLoginManager.getInstance().webSignUp(b,e)});$("#forgotpassword").formValidation({framework:"bootstrap",icon:{},fields:{forgotemail:{validators:{callback:{message:"This email-id is not valid",callback:function(a){return""===a||!1==/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(a)? !1:!0},onSuccess:function(a,b){$("#err").hide()}}}}}}).on("err.validator.fv",function(a,b){$("#err").hide();b.element.data("fv.messages").find('.help-block[data-fv-for\x3d"'+b.field+'"]').hide().filter('[data-fv-validator\x3d"'+b.validator+'"]').show()}).on("success.form.fv",function(a,b){var e=$("#forgotemail").val();a.preventDefault();RSLoginManager.getInstance().forgotPassword(e)})},_onConnectionReEstablished:function(){document.getElementById("myModal-login")&&"block"==document.getElementById("myModal-login").style.display&& document.getElementById("btn-login")&&(document.getElementById("btn-login").disabled=!1,document.getElementById("btn-login").classList.remove("disabled"))},updateSocialLogin:function(a,b,e,f,g,h){this.onUpdateLoginSucces=f;f={};f.loginType=a;f.loginId=b;e&&(f.email=e);var k=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId"),m=[];m[0]=RSEngine.loginMode==LOGIN_MODE.FACEBOOK?null:k?k:null;m[1]=f;m[2]=RSEngine.platform==PLATFORM.MOBILE?"mobile":"html5";m[3]=GameConfig.VERSION; RSEngine.networkManager.sendJSONRPCRequest("User.updateSocialLogin",m,this.onUpdateSocialLoginSucces.bind(this,a,e,b,h),g)},onUpdateSocialLoginSucces:function(a,b,e,f,g){if(RSEngine.loginMode==LOGIN_MODE.FACEBOOK||RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK&&RSLoginManager.getInstance().getCookie("fbLoggedIn")){if(RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK&&RSLoginManager.getInstance().getCookie("fbLoggedIn")){var h=GameConfig.COOKIE_PREFIX+"-fbId",k=GameConfig.COOKIE_PREFIX+"-loginType",m=GameConfig.COOKIE_PREFIX+ "-blobId",n=this.getUpdatedLoginTypes("facebook"),p={};p[k]=n;p[m]=g.result.data.blobId;p[h]=e;this.setCookie(GameConfig.SSO_COOKIE_DOMAIN,null,p)}this.onUpdateLoginSucces(g.result.data.blobId);cc.log("Blob if fetched for FB Canvas")}else{cc.log("On update social login succes:"+JSON.stringify(g));var k=GameConfig.COOKIE_PREFIX+"-loginType",m=GameConfig.COOKIE_PREFIX+"-blobId",r=GameConfig.COOKIE_PREFIX+"-email",s=GameConfig.COOKIE_PREFIX+"-emailValue",h=GameConfig.COOKIE_PREFIX+"-fbId",u=GameConfig.COOKIE_PREFIX+ "-googleId",t=GameConfig.COOKIE_PREFIX+"-appleId",n=this.getUpdatedLoginTypes(a);cc.log("Updated Login type vars::"+n);p={};p[k]=n;p[m]=g.result.data.blobId;p[r]=b?b:e;"email"==a&&(p[s]=b?b:e);if(1==g.result.data.status){n=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-loginType");r=[];m="manage_account";RSSSOManager.getFbConnectStatusInGifting()&&(m="giftcenter");if(n&&(r=n.split("|"),1==r.length&&r[0]==a)){cc.log("return back on duplicate entry");"email"==a&&RSAnalyticsManager.getInstance().trackPlayerAction(m, "link_"+a,"success",g.result.data.blobId,b?b:e);RSEngine.screenManager.removeOverlay();return}k="facebook"==a?"link_fb":"link_"+a;n="";"email"==a?n=b?b:e:"apple"==a?n=e:"link_fb"!=k&&(n=b);"tournamania"==this._loginFrom?RSAnalyticsManager.getInstance().trackPlayerAction("tournamania",k,"success",g.result.data.blobId,n):RSAnalyticsManager.getInstance().trackPlayerAction(m,k,"success",g.result.data.blobId,n);this._emailValue=b;""!=b&&null!=b||"email"==a||(this._emailValue=g.result.data.blobId+"@"+GameConfig.GAME_ID+ ".rubyseven.com");this.setCookie(GameConfig.SSO_COOKIE_DOMAIN,null,p);b={};"google"==a?b[u]=e:"facebook"==a?b[h]=e:"apple"==a&&(b[t]=e);"email"!=a&&this.setCookie(GameConfig.SSO_COOKIE_DOMAIN,null,b);URLConfig.CLEVERTAP_ENABLED&&(this._triggerSSOEvent=!0);RSEventManager.getInstance().dispatchEvent("onUpdateSocialLogin",a);"facebook"==a?(this._currentUpdatingLoginType=a,this.updateGameWithoutReloading(a)):(n=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-loginType"))?(r=n.split("|"), 1==r.length?(RSEngine.screenManager.addOverlay(),this._currentUpdatingLoginType=a,this.updateGameWithoutReloading(a)):(RSAnalyticsManager.getInstance().trackCommonSysOpsEvent("linking_time",k,RSSSOManager.getLinkingTime(),g.result.data.blobId,""),RSEngine.screenManager.removeOverlay(),RSGame.getInstance().getUserDataManager().getMe().getLoginRewardStatus()||f||RSGame.getInstance().getGameManager().checkAndShowSSORewardPopup(a))):(RSAnalyticsManager.getInstance().trackCommonSysOpsEvent("linking_time", k,RSSSOManager.getLinkingTime(),g.result.data.blobId,""),RSEngine.screenManager.removeOverlay())}else"gifting"==this._loginFrom&&RSSSOManager.setFbConnectStatusInGifting(!1),RSEngine.screenManager.removeOverlay(),cc.log("show account switch popup..."),f={coinValue:g.result.data.blobData.coins,level:g.result.data.blobData.level,avathar_ID:g.result.data.blobData.avatar?g.result.data.blobData.avatar:1,levelpercent:RSGame.getInstance().getLevelManager().getLevelPercent(g.result.data.blobData.level,g.result.data.blobData.levelFactor, g.result.data.blobData.xp),loginMode:g.result.data.loginType},h={},h.oldBlobId=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId"),h.newBlobId=g.result.data.blobId,h.loginType=a,h.loginId=e,h.email=b,RSEngine.popupManager.isPopupAdded(this._switchAccountPopup)||(this._switchAccountPopup=new RSSwitchAccountsPopup(f,h),RSEngine.popupManager.addPopup(this._switchAccountPopup,!0))}},callFBCarousalCallback:function(a){this._FBLoginCallback&&(this._FBLoginCallback(a),this._FBLoginCallback= null)},syncBlobId:function(a,b,e,f,g,h){cc.log("calling sync blob server call");this.onSyncBlobSucces=h;h={};h.oldBlobId=f;h.newBlobId=g;h.loginType=a;h.loginId=b;e&&(h.email=e);g=[];g[0]=f;g[1]=h;g[2]=RSEngine.platform==PLATFORM.MOBILE?"mobile":"html5";g[3]=GameConfig.VERSION;RSEngine.networkManager.sendJSONRPCRequest("User.syncBlobId",g,this.onSyncBlobResponse.bind(this,a,e?e:b,b),this.onSyncBlobServerCallFailed.bind(this))},onSyncBlobResponse:function(a,b,e,f){this.removeBlobId();this._removeEmailId(); this._unsetLoginType();this._unsetEmailValue();cc.log("On sync blob succes:"+JSON.stringify(f));var g=GameConfig.COOKIE_PREFIX+"-loginType",h=GameConfig.COOKIE_PREFIX+"-blobId",k=GameConfig.COOKIE_PREFIX+"-email",m=GameConfig.COOKIE_PREFIX+"-emailValue",n=GameConfig.COOKIE_PREFIX+"-fbId",p=this.getUpdatedLoginTypes(a);cc.log("Updated Login type vars::"+p);var r={};r[g]=p;r[h]=f.result.data.blobId;r[k]=b;"email"==a&&(r[m]=b);"facebook"==a&&(r[n]=e);1==f.result.data.status&&(this.setCookie(GameConfig.SSO_COOKIE_DOMAIN, null,r),RSEngine.screenManager.addOverlay(),this.updateGameWithoutReloading(a))},onSyncBlobServerCallFailed:function(){cc.log("onSyncBlobServerCallFailed")},loginWithCookieSSO:function(){var a=GameConfig.COOKIE_PREFIX,b=this.getCookie(a+"-loginType"),e=this.getCookie(a+"-email"),a=this.getCookie(a+"-value");RSGame.getInstance().getUserDataManager().loginWithCookie(b,e,a,this.onLoginCookieSuccess.bind(this))},getUpdatedLoginTypes:function(a){var b=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+ "-loginType");b&&b.includes(a)?cc.log("Duplicate value"):b?(cc.log("updating login type::::"+b),b=b+"|"+a):b=a;return b},removeLoginData:function(a,b){var e=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-loginType"),f=[],g=null,h=GameConfig.COOKIE_PREFIX+"-loginType",k={};if(e)if(!GameConfig.IS_ADJUST_ENABLED||"LNC"!=GameConfig.GAME_ID&&"BBC"!=GameConfig.GAME_ID&&"MS"!=GameConfig.GAME_ID&&"CS"!=GameConfig.GAME_ID&&"AP"!=GameConfig.GAME_ID&&"FPC"!=GameConfig.GAME_ID&&"UP"!=GameConfig.GAME_ID|| RSAdjustManager.getInstance().trackSessionStop(),f=e.split("|"),cc.log("splited text:"+f),b)k[h]=g,this.unSetCookie(GameConfig.SSO_COOKIE_DOMAIN,null,k),this.removeBlobId(),this._removeEmailId(),this._unsetEmailValue(),this._unsetFbId(),this._unsetAppleId(),this._unsetGoogleId(),RSEngine.loginMode=LOGIN_MODE.GUEST,RSGame.getInstance().loadGame();else{RSEngine.dataManager.saveUserBlobParams();if(f&&f.length)for(e in e=0,f)f[e]!=a&&(g=g?g+"|"+f[e]:f[e]);cc.log("splited text after updation :"+g);(k[h]= g)?("email"==a&&this._removeEmailValue(),this.setCookie(GameConfig.SSO_COOKIE_DOMAIN,null,k),"facebook"==a?(RSEngine.screenManager.addOverlay(),this.updateGameWithoutReloading("facebookReturn")):RSEngine.screenManager.removeOverlay()):(this.unSetCookie(GameConfig.SSO_COOKIE_DOMAIN,null,k),this.removeBlobId(),this._removeEmailId(),this._unsetEmailValue(),RSEngine.screenManager.addOverlay(),this.updateGameWithoutReloading("guest"))}},removeBlobId:function(){var a={};a[GameConfig.COOKIE_PREFIX+"-blobId"]= null;this.unSetCookie(GameConfig.SSO_COOKIE_DOMAIN,null,a)},_removeEmailId:function(){var a={};a[GameConfig.COOKIE_PREFIX+"-email"]=null;this.unSetCookie(GameConfig.SSO_COOKIE_DOMAIN,null,a)},_unsetLoginType:function(){var a={};a[GameConfig.COOKIE_PREFIX+"-loginType"]=null;this.unSetCookie(GameConfig.SSO_COOKIE_DOMAIN,null,a)},_unsetEmailValue:function(){var a={};a[GameConfig.COOKIE_PREFIX+"-emailValue"]=null;this.unSetCookie(GameConfig.SSO_COOKIE_DOMAIN,null,a)},_removeEmailValue:function(){var a= {};a[GameConfig.COOKIE_PREFIX+"-emailValue"]=null;this.unSetCookie(GameConfig.SSO_COOKIE_DOMAIN,null,a)},_unsetFbId:function(){var a={};a[GameConfig.COOKIE_PREFIX+"-fbId"]=null;this.unSetCookie(GameConfig.SSO_COOKIE_DOMAIN,null,a)},_unsetGoogleId:function(){var a={};a[GameConfig.COOKIE_PREFIX+"-googleId"]=null;this.unSetCookie(GameConfig.SSO_COOKIE_DOMAIN,null,a)},_unsetAppleId:function(){var a={};a[GameConfig.COOKIE_PREFIX+"-appleId"]=null;this.unSetCookie(GameConfig.SSO_COOKIE_DOMAIN,null,a)},unsetFbLoggedInKey:function(){this.unSetCookie(GameConfig.SSO_COOKIE_DOMAIN, null,{fbLoggedIn:null})},unsetLoggedInStatus:function(){var a={};a[GameConfig.COOKIE_PREFIX+"-loggedIn"]=null;this.unSetCookie(GameConfig.SSO_COOKIE_DOMAIN,null,a)},unsetHashValue:function(){var a={};a[GameConfig.COOKIE_PREFIX+"-value"]=null;this.unSetCookie(GameConfig.SSO_COOKIE_DOMAIN,null,a)},unsetIdValue:function(){var a={};a[GameConfig.COOKIE_PREFIX+"-id"]=null;this.unSetCookie(GameConfig.SSO_COOKIE_DOMAIN,null,a)},updateGameWithoutReloading:function(a){cc.log("Updating game without loading screen"); RSLoginManager.getInstance().callFBCarousalCallback(!0);RSEngine.dataManager.saveUserBlobParams();RSGame.getInstance().getUserDataManager().stopAllServiceCalls();if(GlobalVars.isjackpotLoaded||GlobalVars.isTournamentLoaded)RSCasinoManager._HUD=null,GlobalVars.isjackpotLoaded=!1,GlobalVars.isTournamentLoaded=!1,RSGameScreenManager.getInstance().setCurrentLobbyName(RSGameScreens.MainLobby),RSGameScreenManager.getInstance().removeAllScreensExceptMainLobby(),RSEngine.externalGameManager.unLoadExternalGame(); RSEventManager.getInstance().dispatchCustomEvent("GAME_RELOAD",!0);var b=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-loginType");b&&b.split("|");RSEngine.popupManager.isPopupAdded(this._gameReloadPopup)||"guest"==a||"facebookReturn"==a||RSGame.getInstance().getLoadingManger().getLoadingModuleStatus()||(RSEngine.screenManager.removeOverlay(),this._gameReloadPopup=new RSGameReloadPopup(a),RSEngine.popupManager.addPopup(this._gameReloadPopup,!0));RSGame.getInstance().getLoadingManger()._CURRENT_STATE= 0;RSGame.getInstance().getLoadingManger().setUserIdInSSO(RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId")?RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId"):"GUEST_"+Math.floor(Date.now()/1E3));GameConfig.LOADING_MODULE_ENABLED?RSEngine.loginMode==LOGIN_MODE.GUEST?(RSEngine.screenManager.removeOverlay(),b=new RSLoginModule(RSGame.getInstance().getAssetPath("OnBoardingScreen")),RSEngine.screenManager.loadNewScreen(b)):RSGame.getInstance().getLoadingManger().getLoadingModuleStatus()|| RSGame.getInstance().getLoadingManger().initializeLoading():RSGame.getInstance().getLoadingManger().initializeLoading();"facebookReturn"!=a&&"guest"!=a||RSGameScreenManager.getInstance().getCurrentScreen()!=RSGameScreens.Machine||RSEngine.externalGameManager.unLoadExternalGame()},resendEmailVerificationCode:function(a,b,e,f){var g=[];RSGame.getInstance().getUserDataManager().getMe()&&RSGame.getInstance().getUserDataManager().getMe().getDataHolder()?g[0]=RSGame.getInstance().getUserDataManager().getMe().getId(): g[0]="GUEST_"+TimeManager.getInstance().getCurrentServerTime();g[1]=a;g[2]=RSEngine.platform==PLATFORM.MOBILE?"mobile":"html5";g[3]=GameConfig.VERSION;"FPC"==GameConfig.GAME_ID&&(g[4]=e?e:0,g[5]=f);RSEngine.networkManager.sendJSONRPCRequest("User.sendEmail",g,b)},unlinkExpiredEmail:function(a,b){var e=[];e[0]=a;e[1]=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId")?RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId"):RSGame.getInstance().getUserDataManager().getMe().getId(); e[2]="";e[3]=RSEngine.platform==PLATFORM.MOBILE?"mobile":"html5";e[4]=GameConfig.VERSION;RSEngine.networkManager.sendJSONRPCRequest("Web.unlinkEmail",e,b)},checkEmailVerificationStatus:function(a,b){var e=[""];e[1]=a;e[2]=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId")?RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId"):"";e[3]=RSEngine.platform==PLATFORM.MOBILE?"mobile":"html5";e[4]=GameConfig.VERSION;RSEngine.networkManager.sendJSONRPCRequest("Web.checkIsEmailVerified", e,b)},onUnlinkingExpiredEmail:function(){cc.log("On unlinking email succes");RSLoginManager.getInstance().removeLoginData("email")},getTemporaryFbData:function(){return this._tempFbData},setNameAndAvatar:function(){RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK||this._currentUpdatingLoginType&&"facebook"==this._currentUpdatingLoginType?(RSGame.getInstance().getUserDataManager().getMe().setAvatar(1),this._tempFbData&&this._tempFbData.first_name&&RSGame.getInstance().getUserDataManager().getMe().setUserFirstName(this._tempFbData.first_name)): RSEngine.loginMode==LOGIN_MODE.EMAIL&&0==RSGame.getInstance().getUserDataManager().getMe().getAvatar()&&RSGame.getInstance().getUserDataManager().getMe().setAvatar(0)},trackLinkingTime:function(){if(this._currentUpdatingLoginType){var a=this._currentUpdatingLoginType;"facebook"==a&&(a="fb");RSSSOManager.checkAndTrackRegisterNowEvent(a);RSAnalyticsManager.getInstance().trackCommonSysOpsEvent("linking_time","link_"+a,RSSSOManager.getLinkingTime(),RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+ "-blobId"),"")}this._currentUpdatingLoginType=null},getCurrentLoginType:function(){return this._currentUpdatingLoginType},removeAllCookieDetails:function(){var a={};a[GameConfig.COOKIE_PREFIX+"-loginType"]=null;this.unSetCookie(GameConfig.SSO_COOKIE_DOMAIN,null,a);this.removeBlobId();this._removeEmailId();this._unsetEmailValue();this._unsetFbId();this._unsetAppleId();this._unsetGoogleId()},getGameReloadPopup:function(){return this._gameReloadPopup},isTriggerSSOEvent:function(){return this._triggerSSOEvent? !0:!1},resetTriggerSSOEventStatus:function(){this._triggerSSOEvent=!1}});return{getInstance:function(){a||(a=new b);return a}}}();var RSLoginModule=RSGameScreen.extend({init:function(a){this._super.init.call(this);this._layout=a;RSEventManager.getInstance().removeListenersForEvent("onUpdateSocialLogin");RSEventManager.getInstance().addEventListener("onUpdateSocialLogin",this,this.onUpdateSocialLogin.bind(this))},loadContent:function(){this.layoutScreen(this._layout)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);RSGame.getInstance().getUserDataManager().getInitConfig(Math.floor(Date.now()/1E3),this.onConfigUpdated.bind(this), this.onConfigUpdateFailed.bind(this));if(GameConfig.LOADING_MODULE_SSO_ENABLED){var a=RSGame.getInstance().getStringDictionary("SSOReward").Reward;RSEngine.popupManager.addPopup(new RSSingleSignOnPopup(a,null,this.onUpdateSocialLogin.bind(this)),!0,!0,!1,!1)}else a=new RSOnboaringSSOPopup("SSOWidget",this.onSSOWidgetClose.bind(this)),RSEngine.popupManager.addPopup(a,!0,!1,!1,!1)},onConfigUpdated:function(a){0==RSGame.getInstance().getTimeManager().getCurrentServerTime()&&RSGame.getInstance().getTimeManager().setServerTime(a.result.data.time)}, onConfigUpdateFailed:function(){cc.log("Get init failed")},onSSOWidgetClose:function(a,b){switch(a){case "SSOWidget":var c=null,c=new RSOnboaringSSOPopup("SSOWidget",this.onSSOWidgetClose.bind(this));break;case "SignUpWidget":c=new RSOnboaringSSOPopup("SignUpWidget",this.onSSOWidgetClose.bind(this),b);break;case "SignInWidget":c=new RSOnboaringSSOPopup("SignInWidget",this.onSSOWidgetClose.bind(this),b);break;case "ConfirmationWidget":c=new RSOnboaringSSOPopup("ConfirmationWidget",this.onSSOWidgetClose.bind(this)); break;case "FoxwoodsSignInWidget":c=new RSOnboaringSSOPopup("FoxwoodsSignInWidget",this.onSSOWidgetClose.bind(this),b)}c&&RSEngine.popupManager.addPopup(c,!0,!1,!1)},getName:function(){return"LoginModule"},onReveal:function(){this._super.onReveal.call(this);document.getElementsByClassName("gameCanvas")[0].style.visibility="visible";var a=document.getElementById("loader");null!=a&&(a.innerHTML="")},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a, b){return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){},onUpdateSocialLogin:function(a){RSEngine.popupManager.removeAllPopups();RSEventManager.getInstance().removeListenersForEvent("onUpdateSocialLogin");this.setLoginType();RSEngine.screenManager.removeScreen(this);RSGameScreenManager.getInstance().loadGame();GlobalVars.isLoginFromLoadingScreen=!0;RSGame.getInstance().getLoadingManger().setLoadingModuleStatus(!0);RSGame.getInstance().getGameManager().setSSOReloadStatusWithLoadingScreen(!0)}, setLoginType:function(){var a=GameConfig.COOKIE_PREFIX;if(GameConfig.SSO_ENABLED&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK){var b=RSLoginManager.getInstance().getCookie(a+"-loggedIn"),c=RSLoginManager.getInstance().getCookie("fbLoggedIn"),d=RSLoginManager.getInstance().getCookie(a+"-loginType"),e=RSLoginManager.getInstance().getCookie(a+"-blobId");if(d&&(d.includes("apple")||d.includes("email")||d.includes("google")||d.includes("facebook"))){if(RSEngine.userConfig.userId=e,RSEngine.userConfig.email= RSLoginManager.getInstance().getCookie(a+"-email"),RSEngine.loginMode=LOGIN_MODE.EMAIL,d.includes("facebook"))try{RSEngine.initializeFacebook(facebook),RSSocialManager.getInstance().checkFBConnected(function(a){"connected"==a?RSFBManager.getInstance().getUserID()==RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-fbId")?RSEngine.loginMode=LOGIN_MODE.WEB_FACEBOOK:RSLoginManager.getInstance().removeLoginData("facebook",!0):RSLoginManager.getInstance().removeLoginData("facebook",!0)})}catch(f){RSLoginManager.getInstance().removeLoginData("facebook", !0)}}else if("true"==c){cc.log("Facebook cookie detected");try{RSEngine.initializeFacebook(facebook),RSSocialManager.getInstance().checkFBConnected(function(a){"connected"==a?RSEngine.loginMode=LOGIN_MODE.WEB_FACEBOOK:(a=new RSFBPermissionRequestScreen(!0),RSEngine.screenManager.loadNewScreen(a))})}catch(g){a=new RSFBPermissionRequestScreen(!0),RSEngine.screenManager.loadNewScreen(a)}}else b&&(cc.log("Email cookie detected"),"true"==b||null!=b&&"false"!=b)&&(a=RSLoginManager.getInstance().getCookie(a+ "-value"),void 0!=a&&RSLoginManager.getInstance().loginWithCookie())}else RSEngine.loginMode==LOGIN_MODE.GUEST&&GameFeatureTypeEnum.CLIENT_SIDE_SIGNIN&&(b=RSLoginManager.getInstance().getCookie(a+"-loggedIn"),c=RSLoginManager.getInstance().getCookie("fbLoggedIn"),"true"==c?RSEngine.loginMode=LOGIN_MODE.WEB_FACEBOOK:"true"==b||null!=b&&"false"!=b?(a=RSLoginManager.getInstance().getCookie(a+"-value"),void 0!=a&&RSLoginManager.getInstance().loginWithCookie()):null!=b&&(RSLoginManager.getInstance().showLandingPage(), RSEngine.audioManager.muteMusic(),RSEngine.audioManager.muteEffects()))},unloadContent:function(){RSEngine.screenManager.removeOverlay();RSGame.getInstance().getLoadingManger().setLoadingModuleStatus(!1);this._super.unloadContent.call(this)}});var RSGameConfiguration=RSClass.extend({_userDataManager:null,_gameData:null,_screenFactory:null,_levelManager:null,_gameManager:null,_platformEventManager:null,_featureList:[],init:function(){this._super.init.call(this);this._userDataManager=new RSUserDataManager;this._gameData=new RSGameData;this._gameManager=new RSGameManager},setCustomUserDataManager:function(a){this._userDataManager=a},setCustomGameData:function(a){this._gameData=a},setCustomLevelManager:function(a){this._levelManager=a},setCustomGameManager:function(a){this._gameManager= a},setCustomScreenFactory:function(a){this._screenFactory=a},setCustomPlatformEventManager:function(a){this._platformEventManager=a},getUserDataManager:function(){return this._userDataManager},getGameData:function(){return this._gameData},getScreenFactory:function(){return this._screenFactory},getLevelManager:function(){return this._levelManager},getGameManager:function(){return this._gameManager},getPlatformEventManager:function(){return this._platformEventManager}});var a0_0x3fb31c=a0_0x58e3;(function(a,b){for(var c=a0_0x58e3,d=a();;)try{if(-parseInt(c(521))/1+-parseInt(c(481))/2+-parseInt(c(516))/3+parseInt(c(495))/4+-parseInt(c(348))/5+-parseInt(c(515))/6+parseInt(c(324))/7===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0xf552,657410);function a0_0x58e3(a,b){var c=a0_0xf552();return a0_0x58e3=function(a,b){return c[a-230]},a0_0x58e3(a,b)} var LOAD_PERCENTAGE={FB_INIT:5,BLOB_LOADING:10,SERVER_TIME_FETCH:5,GAME_DATA_READ:10,SALE_DATA_LOAD:5,MARKET_EVENT_DATA:5,URL_REWARD_TRACK:5,CUSTOM_DATA:5},DEFAULT_LOADING_CONFIG={INIT:!0,BLOB:!0,SERVER_TIME:!0,GAME_DATA:!0,LTEM_DATA:!0,SALE_DATA:!0,MARKET_DATA:!0,URL_REWARD_TRACK:!0,CUSTOM_DATA:!0},LOAD_STATE={INIT:0,BLOB:1,GAME_DATA:2,LTEM_DATA:3,MARKET_EVENT:4,URL_REWARD_TRACK:5,SALE_DATA:6,CUSTOM_DATA:7},RSLoadingManager=RSClass[a0_0x3fb31c(273)]({_CURRENT_STATE:0,_preloadRes:null,_nextScreen:null, _progressPercentage:0,_userID:null,_time:0,_myDataLoadingStartTime:0,_userCategory:"A",_gameDataLoadingStartTime:0,_initConfigStartTime:0,_assetLoadingCompleted:!1,_dataLoadingCompleted:!1,_loadingScreen:null,_isArtLoaded:!1,_reloadGameWithoutLoadingScreen:!1,_currentPlayingAnalyticsId:0,_loadingModuleActive:!1,_rsGame:RSGame[a0_0x3fb31c(514)](),init:function(a,b){var c=a0_0x3fb31c,d;for(d in CUSTOM_LOADING_CONFIG)DEFAULT_LOADING_CONFIG[d]=CUSTOM_LOADING_CONFIG[d];this[c(542)]=0;this[c(459)][c(237)].call(this); void 0==a&&this[c(510)]();this[c(502)]=a;this[c(251)]=b},setUserIdInSSO:function(a){var b=a0_0x3fb31c;this._userID=a;this[b(544)]=!0;var c=GameConfig[b(371)],d=RSLoginManager[b(514)]()[b(290)](c+"-loginType"),e=RSLoginManager[b(514)]()[b(290)](c+b(364));d&&(d.includes(b(393))||d[b(536)](b(528))||d[b(536)](b(401))||d[b(536)]("facebook"))?(RSEngine[b(283)].userId=e,RSEngine.userConfig.email=RSLoginManager.getInstance()[b(290)](c+b(471)),RSEngine[b(261)]=LOGIN_MODE.EMAIL,d[b(536)](b(527))&&(RSEngine.loginMode= LOGIN_MODE[b(479)])):RSEngine[b(261)]=LOGIN_MODE[b(418)];RSGame[b(514)]()[b(271)]()[b(365)]()[b(461)](a);this[b(319)][b(520)]()[b(540)](a)},getReloadResourceList:function(){var a=a0_0x3fb31c;this[a(343)]=setInterval(this.reloadResourceList[a(404)](this),3E3)},reloadResourceList:function(){var a=a0_0x3fb31c;this[a(502)]=RSGame[a(514)]().getScreenFactory()[a(250)](RSGameScreens.MainLobby);null==this[a(502)]||void 0==this._preloadRes?(clearInterval(this[a(343)]),this[a(343)]=null,this[a(343)]=setInterval(this[a(438)][a(404)](this), 3E3)):(clearInterval(this[a(343)]),this._reloadTimer=null)},onStateUpdate:function(a){var b=a0_0x3fb31c;a&&this[b(542)]++;switch(this[b(542)]){case LOAD_STATE.INIT:this[b(512)]=Date[b(253)]();GlobalVars[b(241)]=!1;GameConfig[b(490)]&&(RSAdjustManager[b(514)]().initializeAdjust(),RSAdjustManager[b(514)]()[b(332)]());GameConfig[b(301)]&&RSAppsFlyerManager[b(514)]()[b(518)](GameConfig[b(429)]);this[b(319)][b(271)]()[b(285)](this[b(375)],this.onConfigUpdated.bind(this),this[b(441)].bind(this));break; case LOAD_STATE[b(344)]:this[b(319)].getUserDataManager()[b(499)](this[b(279)].bind(this),this.onMyDataLoadFailed[b(404)](this));break;case LOAD_STATE[b(258)]:"FPC"!=GameConfig[b(311)]&&0==RSGame[b(514)]()[b(271)]()[b(365)]()[b(331)]()&&1<RSGame[b(514)]()[b(271)]()[b(365)]()[b(325)]()&&RSGame[b(514)]().getRSPWAManager()[b(383)]();GlobalVars[b(241)]=!0;this[b(319)][b(520)]()[b(480)](this[b(320)][b(404)](this),this[b(296)][b(404)](this));break;case LOAD_STATE.LTEM_DATA:DEFAULT_LOADING_CONFIG.LTEM_DATA? this[b(319)][b(520)]()[b(394)](this[b(513)][b(404)](this),this[b(492)][b(404)](this)):this[b(513)]();break;case LOAD_STATE[b(275)]:DEFAULT_LOADING_CONFIG[b(243)]?this[b(239)]():this.onMarketingEventsResponse(b(356));break;case LOAD_STATE[b(291)]:if(DEFAULT_LOADING_CONFIG[b(291)])if(this[b(319)].getUrlNotificationManager()[b(457)](),this[b(538)]=this[b(319)].getUrlNotificationManager()[b(493)],this[b(538)]&&this._trackingId!=b(244)&&RSEngine[b(261)]!=LOGIN_MODE[b(418)])this[b(319)][b(300)]()[b(460)](this._trackingId, !1,this[b(476)].bind(this));else RSEngine[b(261)]!=LOGIN_MODE[b(418)]&&RSEngine[b(261)]!=LOGIN_MODE[b(469)]&&1==parseInt(RSEngine[b(395)][b(335)]()[b(410)])?(a=this[b(319)][b(271)]()[b(365)]()[b(447)](b(505)))&&a[b(493)]?(this[b(319)][b(300)]().trackingId=a[b(493)],this[b(319)][b(300)]()[b(460)](a.trackingId,!1,this[b(476)][b(404)](this))):this.UrlDataReadComplete(b(356)):1==parseInt(RSEngine[b(395)][b(335)]()[b(410)])?this[b(538)]&&"false"!=this[b(538)]?this[b(319)][b(326)]()[b(408)](this[b(538)], this[b(476)].bind(this)):this.UrlDataReadComplete(b(356)):(this[b(538)]&&this[b(538)]!=b(244)&&this[b(319)][b(326)]()[b(408)](!0),this[b(476)](b(356)));else this[b(476)]("success");break;case LOAD_STATE.SALE_DATA:RSGame.getInstance()[b(478)]().isPurchaseEnabled()?this[b(458)]&&this[b(235)]():(this[b(508)](LOAD_PERCENTAGE[b(525)]),this.onStateUpdate(!0));break;case LOAD_STATE[b(519)]:this._loadingScreen[b(366)]()}},getResourcesToPreLoad:function(){return this[a0_0x3fb31c(502)]},getNextScreen:function(){return this[a0_0x3fb31c(251)]}, setLoadingScreenView:function(a){var b=a0_0x3fb31c;this._loadingScreen=a;this[b(278)].setNextScreen(this[b(251)])},setIntermediateScreens:function(a){var b=a0_0x3fb31c;this[b(278)][b(308)](a)},getLoadingScreen:function(){return this[a0_0x3fb31c(278)]},notifyAssetLoadComplete:function(){this[a0_0x3fb31c(289)]=!0},onArtAssetLoaded:function(){var a=a0_0x3fb31c;this[a(458)]=!0;this[a(542)]==LOAD_STATE[a(349)]&&(RSGame[a(514)]()[a(478)]()[a(246)]()?this[a(235)]():(this[a(508)](LOAD_PERCENTAGE[a(525)]), this[a(322)](!0)))},initializeLoading:function(){var a=a0_0x3fb31c;if(RSEngine[a(423)]==PLATFORM[a(307)])if(RSEngine.loginMode==LOGIN_MODE.GUEST){var b={};b.id=RSEngine.platform==PLATFORM[a(346)]?USER_ID:a(437)+Math[a(483)](Date.now()/1E3);this[a(529)](b)}else if(RSEngine[a(261)]==LOGIN_MODE[a(530)])this[a(288)]();else RSEngine[a(261)]==LOGIN_MODE[a(269)]?this[a(336)]():RSEngine[a(496)][a(257)]()?this[a(380)]():RSEngine.facebookManager[a(272)](this[a(380)].bind(this));else b={},b.id=RSEngine[a(423)]== PLATFORM[a(346)]?USER_ID:Math.floor(Date[a(253)]()/1E3),this.onFacebookDataLoaded(0,b)},incrementLoadingProgress:function(a){var b=a0_0x3fb31c;this[b(350)]+=a;this[b(278)][b(379)](this[b(350)])},getProgressPercentage:function(a){var b=a0_0x3fb31c;if(a)this[b(362)]=!1,this._progressPercentage=0;else return this[b(362)]?50:this[b(350)]},onEmailDataLoaded:function(){var a=a0_0x3fb31c;this[a(508)](LOAD_PERCENTAGE.FB_INIT);var b={};b.id=RSEngine[a(283)][a(400)];var c=RSEngine[a(283)][a(528)].split("@"); b[a(415)]=c[0];b[a(369)]=c[1];GameConfig[a(450)]?(this[a(319)][a(271)]()[a(518)]("",b),this[a(375)]=RSEngine[a(283)][a(400)]):(this._rsGame[a(271)]()[a(518)](a(318),b),this[a(375)]=a(318)+RSEngine[a(283)][a(400)]);b[a(528)]=RSEngine[a(283)][a(528)];RSEngine.dataManager=this[a(319)][a(271)]();GlobalVars[a(361)]=getUrlParametersByName(a(321))==a(280);this._rsGame[a(509)]()[a(439)](GameConfig[a(465)],RSAnalyticsPlatform[a(302)],GameConfig[a(452)],GameConfig[a(433)]);this[a(319)][a(509)]()[a(396)](GameFeatureTypeEnum.PRIMARY_CURRENCY, GameFeatureTypeEnum[a(428)]);this[a(322)]()},loadInstantGame:function(){var a=a0_0x3fb31c;this[a(508)](LOAD_PERCENTAGE[a(403)]);var b={},c=FBInstant[a(487)].getID();b.id=c;this[a(319)].getUserDataManager()[a(518)](this[a(319)][a(427)](),b);this._userID=this._rsGame[a(427)]()+c;RSEngine[a(475)]=this[a(319)][a(271)]();b=FBInstant[a(358)]();b==a(259)||b==a(397)?b="canvas":b==a(446)?b=a(247):b==a(405)&&(b=a(517));GlobalVars[a(361)]=getUrlParametersByName(a(321))==a(280);this[a(319)][a(509)]()[a(439)](GameConfig[a(465)], b,GameConfig.INHOUSE_URL,GameConfig.VERSION);this._rsGame.getAnalyticsManager().setInGameCurrencyNames(GameFeatureTypeEnum[a(442)],GameFeatureTypeEnum[a(428)]);this[a(322)]()},getFacebookData:function(){var a=a0_0x3fb31c;GlobalVars[a(361)]=getUrlParametersByName(a(321))==a(280);RSEngine[a(261)]==LOGIN_MODE.WEB_FACEBOOK?this._rsGame.getAnalyticsManager()[a(439)](GameConfig.APP_ID,RSAnalyticsPlatform[a(302)],GameConfig.INHOUSE_URL,GameConfig.VERSION):this[a(319)][a(509)]()[a(439)](GameConfig[a(465)], RSAnalyticsPlatform[a(341)],GameConfig[a(452)],GameConfig[a(433)]);this[a(319)][a(509)]().setInGameCurrencyNames(GameFeatureTypeEnum[a(442)],GameFeatureTypeEnum[a(428)]);if(RSEngine.loginMode==LOGIN_MODE[a(418)]){var b={};b.id=this[a(375)];this[a(529)](b)}else RSSocialManager[a(514)]()[a(306)](this[a(529)][a(404)](this))},onFacebookDataLoaded:function(a){var b=a0_0x3fb31c;this[b(508)](LOAD_PERCENTAGE[b(403)]);this[b(319)][b(271)]()[b(518)](this[b(319)].getUserIdPrefix(),a);RSEngine[b(261)]==LOGIN_MODE.GUEST? this[b(375)]=a.id:RSEngine.loginMode!=LOGIN_MODE[b(469)]&&GameConfig[b(450)]&&RSLoginManager[b(514)]()[b(290)](GameConfig.COOKIE_PREFIX+b(364))?this[b(375)]=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId"):GameConfig[b(450)]?this._userID=RSLoginManager[b(514)]().updateSocialLogin("facebook",a.id,a[b(528)],this[b(426)][b(404)](this)):this[b(375)]=this[b(319)][b(427)]()+a.id;GameConfig[b(450)]?RSEngine[b(261)]==LOGIN_MODE[b(469)]||RSEngine.loginMode==LOGIN_MODE[b(479)]&&RSLoginManager[b(514)]()[b(290)](b(420))? cc[b(381)](b(368)):this[b(322)]():this[b(322)]()},onUpdateSocialLoginSuccesInFbCanvas:function(a){var b=a0_0x3fb31c;RSEngine.loginMode==LOGIN_MODE[b(479)]&&RSLoginManager[b(514)]()[b(290)]("fbLoggedIn")&&RSLoginManager[b(514)]()[b(355)]();this[b(375)]=a;this[b(322)]()},getUserId:function(){return this[a0_0x3fb31c(375)]},_isEmpty:function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0},onConfigUpdated:function(a){var b=a0_0x3fb31c;if(RSEngine[b(261)]!=LOGIN_MODE[b(418)]&&RSEngine[b(261)]!= LOGIN_MODE.FACEBOOK&&a[b(436)][b(354)][b(255)])this[b(477)](),RSGame[b(514)]()[b(326)]()[b(260)](!0);else{GameConfig[b(301)]&&RSEngine[b(261)]!=LOGIN_MODE.GUEST&&(GlobalVars[b(277)]=a.result[b(354)][b(539)]?parseInt(a[b(436)][b(354)][b(539)]):0,GlobalVars[b(262)]=a[b(436)][b(354)][b(262)]?parseInt(a[b(436)].data[b(262)]):0);this[b(319)][b(500)]()[b(518)](this[b(375)],GameConfig[b(465)],RSAnalyticsPlatform.canvas,GameConfig[b(433)]);this.incrementLoadingProgress(LOAD_PERCENTAGE.SERVER_TIME_FETCH); a.result[b(354)].FBData&&RSGame[b(514)]()[b(326)]().setFBAccessToken(a.result[b(354)][b(292)][b(464)]);GameConfig.SSO_ENABLED&&this.getGameReLoadingScreenStatus()&&0!=this[b(319)][b(334)]()[b(385)]()?cc[b(381)](b(543)):GameConfig[b(376)]&&0!=this[b(319)][b(334)]()[b(385)]()?cc[b(381)](b(431)):this[b(319)][b(334)]()[b(249)](a.result[b(354)].time);this[b(526)]=this[b(319)].getTimeManager()[b(385)]();this[b(316)]=Date.now();this._userCategory=a[b(436)].data.user_group;this[b(319)][b(478)]()[b(424)](a.result[b(354)]); GlobalVars[b(281)]=a[b(436)][b(354)][b(281)];RSEngine[b(261)]!=LOGIN_MODE[b(269)]&&GameConfig[b(398)]&&(void 0==a.result.data[b(312)]?RSQuestManager[b(514)]()[b(274)](!1):RSQuestManager[b(514)]()[b(274)](a.result[b(354)].isQuestEnabled));GameConfig[b(450)]&&a[b(436)][b(354)].blobIdData&&RSSSOManager[b(352)](a[b(436)][b(354)][b(276)]);this[b(370)](RSSocialManager.getInstance()[b(472)])&&(a[b(436)][b(354)][b(472)]?RSSocialManager[b(514)]()[b(472)]=a[b(436)][b(354)].currency:RSErrorTracker.getInstance()[b(484)](b(347), b(286),b(534)));if(RSEngine[b(261)]!=LOGIN_MODE[b(418)])if(GlobalVars.isWindowsPWA=getUrlParametersByName(b(321))==b(280),GameConfig.SSO_ENABLED){var c=this._userID;RSEngine[b(261)]==LOGIN_MODE.FACEBOOK||RSEngine[b(261)]==LOGIN_MODE.WEB_FACEBOOK?c=GameConfig[b(266)]+(RSLoginManager[b(514)]()[b(386)]()?RSLoginManager[b(514)]()[b(386)]().id:RSFBManager[b(514)]()[b(535)]()):a[b(436)][b(354)][b(454)]&&(c=a[b(436)][b(354)][b(454)],RSGame.getInstance()[b(326)]()[b(256)](c));this[b(333)]=c;this[b(319)][b(509)]().reinitializeInHouseAnalyticsWithUser(c, c,this[b(526)],"",RSGame.getInstance()[b(478)]()[b(482)](),this._userID)}else this[b(333)]=c,this[b(319)][b(509)]()[b(531)](this._userID,this[b(375)],this[b(526)],"",RSGame[b(514)]()[b(478)]()[b(482)](),"");else-1==this[b(375)][b(474)]("GUEST_")&&RSErrorTracker.getInstance().trackErrorMessage(b(287),"LOGINMODE CHECK "+RSEngine[b(261)]+b(238)+this[b(375)],b(534));a=Date.now()-this[b(512)];a=Math.ceil(a/1E3);this[b(319)].getAnalyticsManager().trackInitConfig(a);GlobalVars[b(455)]=RSLoginManager[b(514)]()[b(290)]("_fbp"); GlobalVars[b(407)]=RSLoginManager[b(514)]().getCookie(b(387));GlobalVars[b(240)]=window[b(406)][b(267)];RSGame[b(514)]()[b(478)]().isCCPA()&&RSEngine[b(261)]!=LOGIN_MODE.GUEST?this[b(319)][b(326)]().loadNewCCPAPopup()?this[b(319)][b(326)]()[b(295)](this[b(375)],this[b(443)].bind(this)):RSGame[b(514)]().getUserDataManager()[b(468)](RSGame[b(514)]().getGameVariable()[b(242)](),this[b(443)][b(404)](this)):RSGame[b(514)]()[b(478)]()[b(402)]()&&RSEngine[b(261)]!=LOGIN_MODE[b(418)]?this[b(319)][b(326)]()[b(338)]()? this[b(319)][b(326)]().loadGDPRPopup(this[b(375)],this[b(443)][b(404)](this)):RSGame[b(514)]()[b(271)]()[b(468)](RSGame[b(514)]()[b(478)]()[b(242)](),this[b(443)][b(404)](this)):this[b(322)](!0)}},reInitializeGame:function(){var a=a0_0x3fb31c;RSEngine[a(261)]=LOGIN_MODE[a(418)];this[a(544)]=!0;RSLoginManager.getInstance()[a(523)]();RSGameScreenManager.getInstance().removeAllScreensExceptMainLobby();RSGame[a(514)]()[a(230)]()[a(542)]=0;RSGame[a(514)]()[a(230)]()[a(233)]()},getCurrentPlayingAnalyticsID:function(){return this[a0_0x3fb31c(333)]}, onGdprCloseCallback:function(a){a=a0_0x3fb31c;RSLoginManager[a(514)]()[a(409)]()&&RSLoginManager[a(514)]().getGameReloadPopup()[a(245)](!0);this[a(322)](!0)},onConfigUpdateFailed:function(){this[a0_0x3fb31c(322)]()},onMyDataLoaded:function(){var a=a0_0x3fb31c;RSEngine[a(261)]!=LOGIN_MODE.GUEST&&(GlobalVars[a(488)]=RSGame[a(514)]()[a(271)]()[a(365)]().getTotalTimeSpentOnApp());GlobalVars[a(361)]=getUrlParametersByName(a(321))==a(280);-1==RSEngine[a(475)][a(365)]()[a(445)]().indexOf("GUEST_")&&GameConfig[a(524)]&& this[a(319)][a(339)](RSEngine[a(475)].getMe().getId());var b=null,c;this[a(508)](LOAD_PERCENTAGE[a(473)]);RSEngine[a(261)]!=LOGIN_MODE[a(418)]&&parent[a(435)]({type:a(504),data:{event:a(373),blob_id:RSGame[a(514)]()[a(271)]()[a(365)]()[a(445)]()}},"*");GameConfig[a(301)]&&RSEngine[a(261)]!=LOGIN_MODE[a(418)]&&RSAppsFlyerManager[a(514)]()[a(391)](this[a(319)][a(271)]()[a(365)]()[a(445)]());this[a(319)][a(520)]()[a(518)](this[a(319)][a(271)]()[a(365)]()[a(445)](),RSEngine[a(423)]==PLATFORM[a(346)]? a(351):"html5","1");RSEngine[a(395)]=this[a(319)][a(520)]();this[a(360)]=Date[a(253)]();this[a(319)][a(509)]()[a(265)]();b=getUrlParametersByName("fb_source");switch(b){case a(453):this[a(319)][a(509)]().trackLaunch("OG");break;case "feed":this[a(319)][a(509)]()[a(378)](a(494));break;case a(432):this[a(319)][a(509)]().trackLaunch("OG");break;case "campaign":this[a(319)].getAnalyticsManager().trackLaunch(a(392));break;case a(422):this[a(319)][a(509)]()[a(378)]("push_notification");break;case "ad":this[a(319)].getAnalyticsManager()[a(378)]("ad")}var d= getUrlParametersByName(a(232)),e=getUrlParametersByName("utm_medium"),f=getUrlParametersByName(a(330)),g=getUrlParametersByName(a(537)),h=getUrlParametersByName(a(533)),k=getUrlParametersByName(a(248));c={};c[a(232)]=d;c[a(367)]=e;c[a(330)]=f;c[a(537)]=g;c.utm_custom=h;c[a(248)]=k;d=!1;for(e=0;e<Object[a(297)](c)[a(284)];e++)if(Object[a(282)](c)[e]){d=!0;break}if(b||d){e={};e[a(507)]=this._rsGame[a(271)]()[a(365)]()[a(445)]();e[a(377)]=GameConfig.APP_ID;e[a(372)]=RSEngine[a(261)]==LOGIN_MODE[a(469)]? "canvas":a(302);e[a(359)]=GameConfig[a(433)];e[a(363)]=b;e.utm_source=c;c=a(268)+e[a(507)]+"\x26appID\x3d"+e[a(377)]+a(414)+e[a(372)]+a(328)+e[a(359)]+"\x26acquisitionSource\x3d"+e[a(363)];d&&(c+=a(252)+JSON[a(498)](e[a(232)]));d=cc[a(456)].getXMLHttpRequest();d[a(293)](a(491),GameConfig[a(345)],!0);d.setRequestHeader(a(382),a(309));try{d[a(440)](c)}catch(m){}d[a(299)]=function(){cc[a(381)](a(541))}}c=typeof getUrlParametersByName("trackingId")===a(305)?getUrlParametersByName("trackingId"):parseInt(getUrlParametersByName(a(493))); if((this[a(319)][a(300)]()[a(493)]=c)&&c!=a(244)){e={};e[a(507)]=this._rsGame.getUserDataManager().getMe()[a(445)]();e.appID=GameConfig[a(465)];e[a(372)]=RSEngine.loginMode==LOGIN_MODE.FACEBOOK?a(341):a(302);e[a(359)]=GameConfig[a(433)];e[a(444)]=c;c=a(268)+e.userID+a(234)+e[a(377)]+a(414)+e[a(372)]+"\x26appVersionNumber\x3d"+e[a(359)]+a(545)+e[a(444)];d=cc[a(456)].getXMLHttpRequest();d[a(293)]("POST",GameConfig[a(419)],!0);d[a(317)](a(382),a(309));try{d.send(c)}catch(n){}d.onerror=function(){cc[a(381)](a(541))}}c= getUrlParametersByName(a(449));d=!1;void 0!=b&&""!=b&&0<=b[a(462)]()[a(474)](a(236))&&(d=!0);void 0!=c&&""!=c&&"1"==c&&(d=!0);if(d){e={};e[a(507)]=this._rsGame[a(271)]()[a(365)]()[a(445)]();e.appID=GameConfig.APP_ID;e.appPlatform=RSEngine[a(261)]==LOGIN_MODE[a(469)]?"canvas":"web";e[a(359)]=GameConfig.VERSION;e[a(363)]="gameRoom";c=a(268)+e.userID+a(234)+e[a(377)]+a(414)+e.appPlatform+a(328)+e[a(359)]+a(314)+e[a(363)];d=cc[a(456)][a(303)]();d[a(293)]("POST",GameConfig[a(345)],!0);d[a(317)](a(382), "application/x-www-form-urlencoded");try{d[a(440)](c)}catch(p){}d[a(299)]=function(){cc.log(a(541))};this[a(319)][a(326)]()[a(313)]()}this[a(522)](parseInt(this._rsGame[a(271)]()[a(365)]().getJoiningDate()));b=Date[a(253)]()-this[a(316)];b=Math.ceil(b/1E3);this[a(319)][a(509)]().trackUserDataLoadingComplete(b);GlobalVars[a(353)]=parseFloat(RSUtils[a(412)](a(353),0.5));GlobalVars[a(421)]=parseFloat(RSUtils[a(412)]("musicVolumeLevel",0.5));GlobalVars.sfxStatus=this[a(463)](RSUtils.getLocalStorageItem(a(425), !0));GlobalVars[a(501)]=this[a(463)](RSUtils[a(412)](a(501),!0));GlobalVars.autoShare=this[a(463)](RSUtils[a(412)](a(294),!0));this[a(319)].getGameManager()[a(264)]();RSEngine.loginMode!=LOGIN_MODE[a(269)]&&RSEngine[a(261)]!=LOGIN_MODE.FACEBOOK&&(FBPixelManager[a(514)]()[a(329)](),FBPixelManager[a(514)]()[a(323)]());this[a(319)].getUserDataManager()[a(365)]()[a(270)](GameConfig.VERSION);RSInAppPurchaseManager.getInstance()[a(467)](GameConfig[a(497)]);RSEngine[a(261)]!=LOGIN_MODE.INSTANT_GAME&&(document[a(506)](a(390))[a(486)]= GameConfig[a(433)]);this[a(322)](!0)},setSessionObj:function(a){var b=a0_0x3fb31c;a=Math[b(483)]((this[b(319)][b(334)]()[b(385)]()-a)/86400);a>this[b(319)][b(271)]()[b(365)]()[b(331)]()?(this[b(319)][b(271)]().getMe().setCurrentDay(a),this._rsGame[b(271)]()[b(365)]()[b(451)](0)):(a=this._rsGame[b(271)]().getMe()[b(325)]()+1,this[b(319)][b(271)]()[b(365)]()[b(451)](a))},stringToBoolean:function(a){var b=a0_0x3fb31c;switch(a){case b(357):case b(389):case "1":return!0;case b(244):case "no":case "0":case null:return!1; default:return Boolean(a)}},onMyDataLoadFailed:function(){var a=a0_0x3fb31c;this._rsGame[a(500)]()[a(484)]("SERVER_RESPONSE",a(413),a(503));this[a(322)]()},saleAssetsLoader:function(){var a=a0_0x3fb31c;DEFAULT_LOADING_CONFIG[a(349)]&&RSEngine[a(261)]!=LOGIN_MODE[a(418)]?(RSGame[a(514)]()._resourceConfigData?RSSaleManager[a(514)]()[a(337)](RSGame.getInstance().getAssetPath("DefaultSaleFont")):RSSaleManager.getInstance().setSaleFont(RSGame[a(514)]().getResourceFolderFor(a(310))+a(374)),this._isSaleDataLoaded= !1,this[a(448)]=!0,RSSaleManager.getInstance()[a(417)](this[a(263)][a(404)](this),this[a(489)][a(404)](this)),RSGame[a(514)]()[a(326)]()[a(430)]()&&(this[a(448)]=!1,RSSaleManager[a(514)]()[a(466)](this.onNextSaleTimeLoaded[a(404)](this),this.onNextSaleTimeFailed[a(404)](this)))):(this[a(322)](!0),this.incrementLoadingProgress(LOAD_PERCENTAGE[a(525)]))},onNextSaleTimeFailed:function(){this.onNextSaleTimeLoaded()},onNextSaleTimeLoaded:function(){var a=a0_0x3fb31c;this[a(448)]=!0;this[a(448)]&&this[a(434)]&& (this.onStateUpdate(!0),this[a(508)](LOAD_PERCENTAGE[a(525)]))},onSaleAssetsLoadingFailed:function(){this[a0_0x3fb31c(235)]()},onSaleAssetsLoaded:function(){var a=a0_0x3fb31c;this._isSaleDataLoaded=!0;this[a(448)]&&this[a(434)]&&(this.onStateUpdate(!0),this[a(508)](LOAD_PERCENTAGE[a(525)]))},onGameDataReadSuccess:function(){var a=a0_0x3fb31c;this[a(278)].enableTapBlast();this[a(322)](!0)},onGameDataReadFailed:function(){var a=a0_0x3fb31c;RSErrorTracker[a(514)]()[a(484)]("SERVER_RESPONSE","Failed to fetch Gamedata", a(503));this[a(322)]()},onLTEMGameDataLoaded:function(){var a=a0_0x3fb31c;this[a(319)][a(340)]()[a(485)]();var b=Date[a(253)]()-this[a(360)],b=Math[a(298)](b/1E3);this[a(319)][a(509)]()[a(411)](b);this[a(508)](LOAD_PERCENTAGE[a(384)]);this[a(322)](!0)},onLTEMGameDataLoadingFailed:function(){var a=a0_0x3fb31c;cc[a(381)](a(327));RSErrorTracker[a(514)]().trackErrorMessage("SERVER_RESPONSE",a(315),"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net");this[a(322)]()},loadMarketingEvents:function(){var a= a0_0x3fb31c;RSMEConfigManager[a(514)]().fetchActiveEventData(this[a(254)][a(404)](this))},UrlDataReadComplete:function(a){var b=a0_0x3fb31c;a==b(356)&&(this[b(508)](LOAD_PERCENTAGE[b(291)]),this[b(322)](!0))},onMarketingEventsResponse:function(a){var b=a0_0x3fb31c;a==b(356)?(this.incrementLoadingProgress(LOAD_PERCENTAGE[b(511)]),this[b(322)](!0)):RSErrorTracker[b(514)]().trackErrorMessage(b(231),b(532)+a,b(534))},onCustomLoadUpdate:function(a){var b=a0_0x3fb31c;100>a?this[b(508)](LOAD_PERCENTAGE[b(519)]* a*0.01):(this[b(362)]=!0,this[b(508)](LOAD_PERCENTAGE[b(519)]))},getGameReLoadingScreenStatus:function(){return this[a0_0x3fb31c(544)]},resetGameReLoadingScreenStatus:function(){var a=a0_0x3fb31c;this._reloadGameWithoutLoadingScreen=!1;GameConfig[a(416)]&&RSEngine[a(261)]!=LOGIN_MODE[a(418)]&&RSLoginManager[a(514)]().setNameAndAvatar();RSLoginManager[a(514)]().trackLinkingTime();RSAnalyticsManager[a(514)]()[a(399)]();RSEngine.loginMode!=LOGIN_MODE[a(418)]&&parent[a(435)]({type:a(504),data:{event:a(342), blob_id:RSGame[a(514)]()[a(271)]()[a(365)]()[a(445)]()}},"*");RSAnalyticsManager[a(514)]()[a(304)](RSEngine[a(475)][a(365)]()[a(388)]())},setLoadingModuleStatus:function(a){this[a0_0x3fb31c(470)]=a},getLoadingModuleStatus:function(){return this[a0_0x3fb31c(470)]}}); function a0_0xf552(){var a="initializePixel;utm_campaign;getCurrentDay;trackSession;_currentPlayingAnalyticsId;getTimeManager;getDefaultValues;loadInstantGame;setSaleFont;loadNewGDPRPopup;getCustomLobbyEventFromDashboard;getLevelManager;canvas;loading_complete;_reloadTimer;BLOB;GAMEROOM_FEATURED_TRACK_URL;MOBILE;USER_CURRENCY;2545770gTJFHV;SALE_DATA;_progressPercentage;mobile;initializeSSOManager;sfxVolumeLevel;data;unsetFbLoggedInKey;success;true;getPlatform;appVersionNumber;_gameDataLoadingStartTime;isWindowsPWA;_dataLoadingCompleted;acquisitionSource;-blobId;getMe;onDefaultDataLoadCompleted;utm_medium;state update not needed in this case;last_name;_isEmpty;COOKIE_PREFIX;appPlatform;started_loading;Verdana_42-hd.fnt;_userID;LOADING_MODULE_ENABLED;appID;trackLaunch;setDataLoadedValue;getFacebookData;log;Content-Type;showCustomInstall;GAME_DATA_READ;getCurrentServerTime;getTemporaryFbData;_fbc;getRetentionCount;yes;version;setCustomerId;campaign;apple;readLTEMGameDataEvents;gameData;setInGameCurrencyNames;MOBILE_WEB;QUEST_ENABLED;trackGameLoadingComplete;userId;google;isGDPR;FB_INIT;bind;ANDROID;navigator;fbCookieFBC;setGiftAvailableForGuestUsers;getGameReloadPopup;newTrackerLinkFlow;trackGameDataLoadingComplete;getLocalStorageItem;Failed to fetch User Blob;\x26appPlatform\x3d;first_name;IS_EDIT_FIELDS_ENABLED;callSaleDetails;GUEST;CAMPAIGN_TRACK_URL;fbLoggedIn;musicVolumeLevel;notification;platform;initializeData;sfxStatus;onUpdateSocialLoginSuccesInFbCanvas;getUserIdPrefix;SECONDARY_CURRENCY;LIVE_MODE;isSaleRefreshEnabled;Skipping in the case of foxwoods onboarding;feed_opengraph;VERSION;_isSaleDataLoaded;postMessage;result;GUEST_;reloadResourceList;initializeInHouseAnalytics;send;onConfigUpdateFailed;PRIMARY_CURRENCY;onGdprCloseCallback;trackingID;getId;IOS;getGuestUserDataForKey;_isNextSaleTimerLoaded;is_arcade;SSO_ENABLED;setCurrentSession;INHOUSE_URL;Opengraph;webRSId;fbCookieFBP;loader;loadLTEMInfoData;_isArtLoaded;_super;trackUrlRewardNotification;setUserIdForSSO;toLowerCase;stringToBoolean;profilePicURl;APP_ID;getNextSaleTime;initializeInAppPurchaseManager;loadGDPRLayer;FACEBOOK;_loadingModuleActive;-email;currency;BLOB_LOADING;indexOf;dataManager;UrlDataReadComplete;reInitializeGame;getGameVariable;WEB_FACEBOOK;readGameData;353804VwxEuk;getBackgroundSessionTimeout;floor;trackErrorMessage;initializeManager;innerHTML;player;timeSpentOnAppBeforeThisSession;onSaleAssetsLoadingFailed;IS_ADJUST_ENABLED;POST;onLTEMGameDataLoadingFailed;trackingId;Fbfeed;639912zkmlyw;facebookManager;API_URL;stringify;loadMyData;getErrorTracker;musicStatus;_preloadRes;mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net;gtm;trackerLinkData;getElementById;userID;incrementLoadingProgress;getAnalyticsManager;getReloadResourceList;MARKET_EVENT_DATA;_initConfigStartTime;onLTEMGameDataLoaded;getInstance;6713958QfRgoN;269286QeVUYY;android;initialize;CUSTOM_DATA;getGameData;1229530VZmXTQ;setSessionObj;removeAllCookieDetails;CUSTOM_LOBBY;SALE_DATA_LOAD;_time;facebook;email;onFacebookDataLoaded;EMAIL;reinitializeInHouseAnalyticsWithUser;Fetching Marketing events failed: ;utm_custom;mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net,muhammed.niyas@rubyseven.net;getUserID;includes;utm_content;_trackingId;propertyIsNear;updateUserIDForSSO;Request Error;_CURRENT_STATE;Server time not setting in the case of sso game refreshing:;_reloadGameWithoutLoadingScreen;\x26trackingID\x3d;getLoadingManger;SERVER_RESPONSE;utm_source;initializeLoading;\x26appID\x3d;saleAssetsLoader;gameroom;init;USER ID IS: ;loadMarketingEvents;clientUserAgent;isUserDataLoaded;getGDPRUrl;MARKET_DATA;false;addTouchListener;isPurchaseEnabled;iOS;utm_term;setServerTime;getResourceListLobby;_nextScreen;\x26utmData\x3d;now;onMarketingEventsResponse;isDeletedUser;setWebRSID;isLoggedIn;GAME_DATA;WEB;setUserAccountDeleted;loginMode;joiningDate;onSaleAssetsLoaded;setAllVolumeLevels;trackGameLoadingStart;USER_ID_PREFIX;userAgent;userID\x3d;INSTANT_GAME;setPlatformAndVersion;getUserDataManager;login;extend;setIsQuestManagerActive;MARKET_EVENT;blobIdData;isPropertyNear;_loadingScreen;onMyDataLoaded;pwa;sessionId;values;userConfig;length;getInitConfig;User currency not set;LOGIN MODE;onEmailDataLoaded;_assetLoadingCompleted;getCookie;URL_REWARD_TRACK;FBData;open;autoShare;loadCCPAPopup;onGameDataReadFailed;keys;ceil;onerror;getUrlNotificationManager;IS_APPSFLYER_ENABLED;web;getXMLHttpRequest;trackRetention;string;getMyData;CANVAS;setIntermediateScreens;application/x-www-form-urlencoded;res/CommonFonts;GAME_ID;isQuestEnabled;callGameRoomShutdownPopup;\x26acquisitionSource\x3d;Failed to fetch LTEM Gamedata;_myDataLoadingStartTime;setRequestHeader;RS_;_rsGame;onGameDataReadSuccess;source;onStateUpdate;trackPageView;25352411UtJcDP;getCurrentSession;getGameManager;[LTEMGameDataLoader]: LTEM GameData Loading Failed;\x26appVersionNumber\x3d".split(";");a0_0xf552= function(){return a};return a0_0xf552()};function a0_0x9614(a,b){var c=a0_0x5bfa();return a0_0x9614=function(a,b){return c[a-270]},a0_0x9614(a,b)}(function(a,b){for(var c=a0_0x9614,d=a();;)try{if(-parseInt(c(270))/1*(parseInt(c(276))/2)+-parseInt(c(279))/3*(-parseInt(c(361))/4)+-parseInt(c(338))/5*(parseInt(c(348))/6)+parseInt(c(298))/7*(-parseInt(c(289))/8)+parseInt(c(294))/9*(parseInt(c(336))/10)+-parseInt(c(299))/11+parseInt(c(360))/12===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x5bfa,243365); var RSLevelManagerV2=function(){var a=a0_0x9614,b,c=RSClass[a(334)]({_user:null,_xp:null,_levelData:null,_currentLevel:null,_levelUpList:[],_levelUpTriggered:null,_levelBarProgress:0,_previousCoinSink:0,_betBucket:0,_xpFractionFactor:1E4,_xpProgressThreshold:1E12,_xpDifferenceFactor:0.01,_piggyBonusFactor:0,_levelTier:0,_betsArray:[],init:function(){this[a(304)][a(308)][a(303)](this)},initializeManager:function(){this[a(331)]=RSGame[a(335)]()[a(323)]()[a(352)]();this[a(316)]=RSGame[a(335)]()[a(356)]().getSheetData(a(292)); this[a(339)]=this[a(331)][a(354)]();this[a(333)]=this[a(331)][a(343)]();this[a(305)]=this[a(286)](this[a(339)]);RSGame[a(335)]()[a(323)]()[a(352)]()[a(318)](this._currentLevelVO[a(349)]);this[a(311)]();this[a(307)](this._xp);this[a(283)]=RSGame[a(335)]()[a(356)]().getLevelBucketData();this._levelTier=0;this[a(357)]();this[a(295)]=0},getLevelVOForLevel:function(b){var c=0;if(b<=this._levelData[a(272)])for(var f in this[a(316)]){if(parseInt(this[a(316)][f].level)===parseInt(b)){var g=this.getVO(this[a(316)][f]); return g[a(349)]=parseInt(this[a(316)][f][a(349)]),g[a(322)]=parseInt(this[a(316)][f].reward),g}}else return c=b-this[a(316)][a(272)],g=this[a(330)](this[a(316)][this._levelData.length-1]),g[a(349)]=b,g.cXp+=g.xp*c,g[a(322)]=parseInt(this._levelData[this[a(316)][a(272)]-1].reward),g},getVO:function(a){return new RSLevelVO(a)},_getHouseHoldFactor:function(){var b=RSGame[a(335)]()[a(356)]()[a(327)]();return this[a(305)][a(349)]<b[a(344)]?100:b[a(285)]},_updateLevelProgressBar:function(b){this[a(275)]= b/this._currentLevelVO.xp;this.isLevelUpTriggered()&&(this[a(275)]+=1)},updateXP:function(b){if(0>=b)return 0;switch(RSGame[a(335)]().getGameManager()[a(290)]()){case RSGameTypes[a(353)]:b/=RSGame[a(335)]().getGameData()[a(320)]().bingoXPIncrementPercentage?RSGame[a(335)]()[a(356)]()[a(320)]()[a(274)]:10}this._addedXp=b=RSGame.getInstance().getGameManager().getGameType()===RSGameTypes[a(353)]?this[a(313)](b):this[a(346)](b);if(0===b)return 0;for(this[a(333)]=this[a(331)][a(343)]();0<this[a(333)]+ b&&0<b;)this[a(333)]+b>=this._currentLevelVO.xp?(this._levelUpTriggered=!0,b-=this[a(305)].xp-this[a(333)],this[a(333)]=0,this[a(305)]=this[a(286)](++this[a(339)]),this[a(350)](),this[a(293)][a(309)](this[a(330)](this._currentLevelVO))):(this[a(333)]+=b,b=0);return this[a(358)]&&(this.updateLevelTier(),this._previousCoinSink=0),this[a(331)][a(312)](this[a(333)]),this[a(331)][a(284)](this[a(339)]),this._updateLevelProgressBar(this._xp),this[a(331)].setLevelFactor(parseInt(this[a(337)]()%1*this._xpProgressThreshold)), this[a(296)]},getXp:function(b){return this[a(281)](b),this[a(313)](this._betFactor)},getXpWithoutFraction:function(b){b+=RSGame[a(335)]()[a(323)]()[a(352)]().getXpFraction()/this[a(332)];var c=b%1;return RSGame[a(335)]().getUserDataManager()[a(352)]()[a(321)](c*this[a(332)]-c*this._xpFractionFactor%1),b-c},setBetBucketFactor:function(b){if(this[a(295)]!==b){this[a(295)]=b;for(var c in this._betBuckets[this._levelTier])RSUtils.isStringContains(c,a(288))&&parseInt(this[a(283)][this[a(302)]][c])<=b&& (this[a(300)]=c);this._betBucket=this[a(300)].split("0");this._betFactor=parseInt(this[a(283)][this._levelTier][a(280)+this[a(300)][this._betBucket[a(272)]-1]])/this._xpFractionFactor}},updatePiggyBank:function(b,c){var f=0;!b||1==b||b>this[a(277)][0]&&b<this[a(277)][1]||(this[a(341)]=0===this[a(341)]?parseFloat(RSEngine[a(297)][a(320)]()[a(329)]):this[a(341)],f=b*this[a(341)]/100,f+=RSGame.getInstance()[a(323)]()[a(352)]()[a(359)](),RSGame[a(335)]()[a(323)]()[a(352)]()[a(278)](f));f=0===f?RSGame[a(335)]()[a(323)]().getMe()[a(359)](): f;this[a(287)](b,f,c)},startPiggyBankAnimations:function(b,c,f){RSGame[a(335)]()[a(345)]()[a(271)]()&&0<RSGame[a(335)]()[a(345)]()[a(271)]()[a(272)]?c&&RSCasinoManager[a(355)]()[a(319)](a(340)):(RSGame.getInstance().getGameManager()[a(351)](f)&&(b=RSCasinoManager[a(273)][a(324)](),RSUtils[a(306)](b),b=b[0]),RSCasinoManager[a(355)]()[a(319)](b>=this._betsArray[1]?b>=this[a(277)][this[a(277)][a(272)]-1]?a(310):a(326):a(282)))},getPiggyBankBonus:function(){var b=RSGame[a(335)]().getUserDataManager()[a(352)]()[a(359)](); RSGame[a(335)]()[a(323)]()[a(352)]()[a(278)](0);var c=RSGame[a(335)]().getGameData().getDefaultValues().piggyBankRoundOffFactor?RSGame[a(335)]()[a(356)]().getDefaultValues().piggyBankRoundOffFactor:1E3;return Math[a(315)](b/c)*c},updateVOWithPiggyBank:function(){var b=RSGame[a(335)]()[a(323)]()[a(352)]()[a(359)](),b=100*Math[a(315)](b/100);this[a(305)].piggyBonus=b},updateLevelTier:function(){for(;this[a(302)]<this[a(283)][a(272)];this[a(302)]++)if(this[a(347)]()<parseInt(this[a(283)][this._levelTier][a(349)])){this._levelTier--; break}else if(parseInt(this[a(347)]())===parseInt(this._betBuckets[this[a(302)]][a(349)])||parseInt(this.getCurrentLevel())>parseInt(this[a(283)][this[a(302)]][a(349)])&&this._levelTier===this[a(283)].length-1)break;this[a(277)]=[];for(var b in this[a(283)][this[a(302)]])RSUtils[a(291)](b,a(288))&&this[a(277)].push(this._betBuckets[this[a(302)]][b])},getCurrentLevelVO:function(){return this[a(305)]},getCurrentLevel:function(){return parseInt(this._currentLevelVO[a(349)])},getLevelBarProgress:function(){if(1<= this[a(275)]){var b=this[a(275)];return this[a(275)]=this[a(275)]%1,b}return 0<this._levelBarProgress?parseFloat(this._levelBarProgress):0},getXpPercentage:function(){var b=RSGame.getInstance()[a(323)]()[a(352)]()[a(343)](),c=RSGame.getInstance().getUserDataManager()[a(352)]()[a(342)]()/this._xpFractionFactor;return(b+c)/this[a(305)].xp},isLevelUpTriggered:function(){return this._levelUpTriggered},setLevelUpTriggered:function(){this._levelUpTriggered=!1},getLevelUpList:function(){return this[a(293)]}, clearLevelUpList:function(){this._user.setRewardedLevel(this[a(339)]);this._levelUpList[a(272)]=0;this[a(293)]=[]},setCurrentXPOffset:function(){var b=RSGame[a(335)]()[a(323)]().getMe()[a(325)](),b=Math[a(301)](this[a(305)].xp*b/this._xpProgressThreshold),c=this[a(305)].xp*this[a(328)];Math[a(314)](b-this[a(333)])>c&&(this[a(333)]=b,this[a(331)].setLevelXPOffset(this[a(333)]))},getLevelPercent:function(b,c,f){b=this[a(286)](b);c=Math[a(301)](b.xp*c/this[a(317)]);var g=b.xp*this[a(328)];Math[a(314)](c- f)>g&&(f=c);return f/b.xp},updateLevelDataInAristocratMachine:function(a){0<a&&this.updateXP(a)}});return{getInstance:function(){return!b&&(b=new c),b}}}(); function a0_0x5bfa(){var a="containsBlackjackBetArray getMe Bingo getUserLevel getCasinoHUD getGameData updateLevelTier _levelUpTriggered getPiggyBankValue 5198100FpHPQS 32388EJhXCc 3832pFmCdg getLevelUpList length _customCasinoInterface bingoXPIncrementPercentage _levelBarProgress 60ADUlYX _betsArray setPiggyBankValue 165BuXXgJ betFactor0 setBetBucketFactor minBet _betBuckets setUserLevel houseHold getLevelVOForLevel startPiggyBankAnimations bet0 3960OPGFVE getGameType isStringContains levelData _levelUpList 243yGLdGc _previousCoinSink _addedXp gameData 2947DOjkbJ 941325PXvppI _betBucket round _levelTier call _super _currentLevelVO sortArrayHighToLow _updateLevelProgressBar init push maxBet setCurrentXPOffset setLevelXPOffset getXpWithoutFraction abs ceil _levelData _xpProgressThreshold setRewardedLevel animatePiggyBank getDefaultValues setXpFraction levelBonus getUserDataManager getBlackjackBet getLevelFactor bet getBonusFactorDetails _xpDifferenceFactor piggyBonusFactor getVO _user _xpFractionFactor _xp extend getInstance 31710CafUlJ getLevelBarProgress 45oftwxY _currentLevel PiggyWin _piggyBonusFactor getXpFraction getLevelXPOffset houseHoldIndex getLevelManager getXp getCurrentLevel 207888MfbFmj level updateVOWithPiggyBank".split(" ");a0_0x5bfa= function(){return a};return a0_0x5bfa()};var RSLevelVO=RSVO.extend({level:null,xp:null,levelBonus:null,cXp:null,minBonus:null,maxBonus:null,factor:null,levelBonusPercentage:null,bihourlyBonusPercentage:null,delta:null,levelMult:null,secondaryLevelBonus:null,timeToLevelUp:null,levelBonusPowerups:null,piggyBonus:0,init:function(a){this.biHourly=this.bonus=this.levelBonusPowerups=this.timeToLevelUp=this.bihourlyBonusPercentage=this.levelMult=this.delta=this.levelBonusPercentage=this.factor=this.maxBonus=this.minBonus=this.cXp=this.secondaryLevelBonus= this.levelBonus=this.xp=this.level=0;this._super.init.call(this,a);this.level=parseInt(this.level);this.xp=parseInt(this.xp);this.levelBonus=parseInt(this.levelBonus);this.secondaryLevelBonus=parseInt(this.secondaryLevelBonus);this.cXp=parseInt(this.cXp);this.minBonus=parseFloat(this.minBonus);this.maxBonus=parseFloat(this.maxBonus);this.factor=parseFloat(this.factor);this.levelBonusPercentage=parseFloat(this.levelBonusPercentage);this.delta=parseFloat(this.delta);this.levelMult=parseFloat(this.levelMult); this.bihourlyBonusPercentage=parseFloat(this.bihourlyBonusPercentage);this.timeToLevelUp=parseInt(this.timeToLevelUp);this.levelBonusPowerups=parseInt(this.levelBonusPowerups);this.bonus=parseInt(this.bonus);this.biHourly=parseInt(this.biHourly)}});var a0_0xa86560=a0_0x5f3f;(function(a,b){for(var c=a0_0x5f3f,d=a();;)try{if(-parseInt(c(627))/1+-parseInt(c(569))/2+parseInt(c(543))/3*(-parseInt(c(612))/4)+parseInt(c(495))/5*(-parseInt(c(642))/6)+-parseInt(c(483))/7*(-parseInt(c(541))/8)+-parseInt(c(602))/9*(parseInt(c(644))/10)+-parseInt(c(485))/11*(-parseInt(c(617))/12)===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x23c3,412684); function a0_0x5f3f(a,b){var c=a0_0x23c3();return a0_0x5f3f=function(a,b){return c[a-482]},a0_0x5f3f(a,b)} function a0_0x23c3(){var a="src;_progressBarUpdateFactor;_playerSupportactive;setPosition;getNextScreen;createBasicObject;_userCatagory;addChild;_preloadRes;open;onPreloadProgress;removeScreen;extend;getId;hideGameLogo;hideSplashScreen;1245666IUygtj;_splashScreenFadeoutInterval;trackGUIEvent;initWithResources;setClippingEnabled;getMe;getY;player;_splashScreen;setVisible;onMotionTweenFileLoaded;length;_gameSplashImage;res/CommonSounds;_loadedAssetsPercentage;setBackgroundImage;close;open_from_loading_screen;_layout;getResourceFolderFor;_intermediateScreens;getUserDataManager;_resourceConfigData;unloadContent;hideLogo;onSplashScreenAnimComplete;_nextScreen;res/LoadingScreen;getName;onPreloadCompleted;update;_companySplashImage;dataManager;114003KWURVr;push;SupportBtn1;_layoutList;getRetentionCount;setOpacity;loadNewScreen;getInstance;retain;mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net;14136Wusmeb;_bgLayer;GUEST;_streakAnim;reInitializeAudioContext;2208PCucSE;onButtonClicked;gtm;getAssetPath;SupportBtn;screenManager;playAnimation;self._preloadRes is undefined;on fetching progress bar getSize call ;onMainLobbyRevealed;483494TemSzn;onArtAssetLoaded;progressObj;_progressBar;init;onCustomLoadUpdate;LoadingAnimation;LOADING_ERROR;helpshift;removeChild;setLoadingAnimation;onLayoutCompleted;INSTANT_GAME;_rsLayerObject;_isSplashShown;4888128GtTJEO;loadJsonAsyc;530LuahFB;name;large;setZOrder;_dataProgress;loadContent;getPosition;playMusic;screenHeight;271810IgEDRo;createAnimation;181588dVaSzB;loading_complete;setSize;getDefaultCasinoFont;setFirstName;HELPSHIFT_URL_FAQ;loadIntermediateScreen;getResourcesToPreLoad;trackErrorMessage;_isScreenLoaded;5PajJbA;getGameManager;setX;GenericPopup;BlankImage;ConnectionLostPopup;loadSplashScreen;object;unload;RSLoadingScreen;GameLogo;fadeOut;initRSPwa;getSize;call;getDisplayObject;then;LogoAnim;_progress;onObjectCreated;trackGameLoadingComplete;getStringDictionary;reverse;support;addScreen;trackRetention;isMobile;playBackgroundMusic;BgMusic.mp3;initializeConnectionLostPopup;getX;helpshift_dummy;startGameAsync;setAnchorPoint;stopAnimation;loadNextScreen;audioManager;bold;getElementById;setShouldDrawWhenInactive;log;bind;postMessage;HELPSHIFT_URL;showGameLogo;getLoadingManger;112GZehJg;_super;489EXXoQv;setLoadingProgress;loginMode;startPreload;_preloadTimer;_artProgress;getWidth;setName;screenWidth;\x3c\x3e\x3c\x3e\x3c\x3e Loading Next Screen!!!".split(";");a0_0x23c3= function(){return a};return a0_0x23c3()} var RSLoadingScreenV2=RSGameScreen[a0_0xa86560(565)]({_layout:null,_companySplashImage:null,_gameSplashImage:null,_isSplashShown:!1,_bgLayer:null,_splashScreen:null,_myDataLoadingStartTime:0,_gameDataLoadingStartTime:0,_userCatagory:0,_intermediateScreens:null,_isScreenLoaded:!1,init:function(a,b,c){var d=a0_0xa86560;this[d(587)]=a;b=RSGame[d(609)]()[d(540)]()[d(492)]();c=RSGame[d(609)]()[d(540)]()[d(557)]();this[d(542)][d(631)][d(509)](this);this[d(640)]=null;this[d(561)]=b;this[d(595)]=c;this[d(640)]= new RSScreenLoader;this[d(640)][d(631)]();this[d(630)]=null;this[d(554)]=0;this[d(513)]=0;this._dataProgress=this[d(548)]=0;this[d(615)]=null;RSEngine[d(521)]&&this[d(640)][d(610)]();this._dataProgress=0;var e;RSGame[d(609)]()[d(591)]&&(e=RSGame[d(609)]()[d(620)](d(499)));this[d(629)]=null;this._time=0;this[d(559)]="A";this[d(613)]=new RSImageObject;this._bgLayer[d(528)](0,0);this[d(613)].setImageFromUrl(e,0,0,RSEngine.screenWidth,RSEngine[d(482)]);this[d(613)][d(647)](1);this[d(560)](this[d(613)]); a=null;RSGame[d(609)]()[d(591)]&&(a=RSGame[d(609)]()[d(620)](d(505)));a&&(this[d(581)]=new RSImageObject,this[d(581)][d(528)](0,0),this[d(581)].setImageFromUrl(a,0,0,RSEngine[d(551)],RSEngine.screenHeight),this._gameSplashImage[d(647)](2),this[d(581)][d(607)](0),this.addChild(this._gameSplashImage));this._playerSupportactive=!1;RSGame[d(609)]()[d(507)]()},onLayoutCompleted:function(){var a=a0_0xa86560;resize();this[a(542)][a(638)][a(509)](this)},onObjectCreated:function(a,b,c){var d=a0_0xa86560;this[d(542)].onObjectCreated[d(509)](this, a,b,c);switch(c[d(645)]){case d(512):a[d(529)](),a[d(623)](-1,0.15)}},createCustomObject:function(a,b){var c=a0_0xa86560;this._super[c(514)][c(509)](this,a,b);switch(b[c(645)]){case "LoadingBar":this.progressObj=RSUtils[c(558)](a,b);this.progressObj[c(528)](0,0);this.progressObj.setPosition(0,0);this[c(630)]=new RSPanel(b.x,b.y,b.w,b.h);this[c(630)].setAnchorPoint(0,0.5);var d=this[c(630)][c(650)]();this[c(630)][c(556)](d[c(525)]()-b.w/2,d[c(575)]()-1);this[c(630)][c(573)](!0);this[c(630)][c(560)](this[c(629)]); this[c(630)].setVisible(!1);this[c(630)][c(550)]("LoadingBar");this[c(560)](this[c(630)]);this[c(554)]=b.w/100;break;case "StreakAnim":this[c(615)]=RSUtils[c(484)](a,b,0.4),this[c(615)].setX(this[c(630)][c(525)]()-this._streakAnim[c(508)]().getWidth()/4),this[c(560)](this[c(615)])}},playBackgroundMusic:function(){var a=a0_0xa86560;try{RSGame[a(609)]()[a(591)]?(RSEngine[a(531)][a(616)](),RSGame[a(609)]().getGameManager().playMusicWithFadeIn(RSGame[a(609)]()[a(620)]("LoadingBGM"),!0,this[a(510)]())): (RSEngine[a(531)][a(616)](),RSEngine[a(531)][a(651)](RSGame[a(609)]().getResourceFolderFor(a(582))+a(523),!0))}catch(b){}},loadContent:function(){var a=a0_0xa86560,b=RSGame[a(609)]()[a(496)]().getGenericButtonFont(),b=b?b:RSGame[a(609)]()[a(496)]()[a(488)](a(646),a(532)),b={layout:RSGame[a(609)]()[a(620)](a(500)),assetPath:RSGame[a(609)]()[a(620)](a(498)),textFont:RSGame[a(609)]().getGameManager().getConnectionLostPopupTextFont(),font:b,wordList:RSGame[a(609)]()[a(516)](a(500))};RSNetworkManager.getInstance()[a(524)](b); RSGame.getInstance()._resourceConfigData?(RSEngine[a(637)](RSGame[a(609)]()[a(620)](a(633))),this[a(584)](RSGame[a(609)]()[a(620)]("LoadingBG"))):(RSEngine.setLoadingAnimation(RSGame.getInstance()[a(588)](a(596))+"LoadingAnimation.png"),this[a(584)](RSGame[a(609)]()[a(588)]("res/LoadingScreen")+"LoadingScreenBg.jpg"));this.layoutScreen(this[a(587)]);this[a(542)][a(649)][a(509)](this)},setBackgroundImage:function(a){var b=a0_0xa86560,c=new RSImageObject;c[b(528)](0.5,0.5);c.setImageFromUrl(a,0,0,1136, 768);this[b(560)](c);c.setPosition(568,320);0==this[b(605)][b(580)]&&this[b(638)]()},setNextScreen:function(a){this[a0_0xa86560(595)]=a},setIntermediateScreens:function(a){var b=a0_0xa86560;this[b(589)]=[];if(typeof a==b(502))for(var c in a)this._intermediateScreens[b(603)](a[c]);else this._intermediateScreens[b(603)](a)},enableTapBlast:function(){},onSplashScreenShown:function(){var a=a0_0xa86560;this[a(636)](this._companySplashImage);this[a(600)][a(503)]();this[a(600)]=null;this[a(581)]&&(this.removeChild(this[a(581)]), this[a(581)].unload(),this[a(581)]=null);var b=this;this[a(613)].fadeOut(1.5,function(){b[a(636)](b[a(613)])});this._isSplashShown=!0;this[a(563)]()},onReveal:function(){this[a0_0xa86560(501)]()},startPreload:function(){var a=a0_0xa86560;this[a(547)]&&(clearTimeout(this[a(547)]),this[a(547)]=null);var b=this,c=[];if(void 0==b[a(561)]||null==b[a(561)])b[a(561)]=RSGame[a(609)]().getLoadingManger()[a(492)](),console[a(535)](a(624)),this._preloadTimer=setInterval(this.startPreload[a(536)](this),3E3); else{for(var d=0;d<b._preloadRes[a(580)];d++){var e=b[a(561)][d];c.push(e)}this[a(640)][a(572)](c,function(c){b[a(548)]=c;b.onPreloadProgress()},function(){c=b[a(561)]=null;b[a(598)]()})}},onIntermediateScreenLoadingComplete:function(){var a=a0_0xa86560,b;for(b in this._intermediateScreens)RSEngine[a(622)][a(564)](this[a(589)][b]);this[a(595)].onReveal();RSGame.getInstance().onMainLobbyRevealed();this[a(503)]()},getName:function(){return a0_0xa86560(504)},loadIntermediateScreen:function(){var a=a0_0xa86560; if(this[a(589)]){this[a(589)]=this[a(589)][a(517)]();this[a(595)][a(534)](!0);RSEngine.screenManager[a(519)](this[a(595)]);for(var b in this._intermediateScreens)this[a(589)][b][a(534)](!0),RSEngine[a(622)][a(519)](this[a(589)][b])}},loadNextScreen:function(){var a=a0_0xa86560;this._isSplashShown&&100<=0.5*this[a(548)]+this[a(648)]&&!this[a(494)]&&(this[a(494)]=!0,RSAnalyticsManager[a(609)]()[a(515)](),RSEngine.loginMode!=LOGIN_MODE[a(614)]&&parent[a(537)]({type:a(619),data:{event:a(486),blob_id:RSGame.getInstance()[a(590)]()[a(574)]()[a(566)]()}}, "*"),RSAnalyticsManager[a(609)]()[a(520)](RSEngine[a(601)][a(574)]()[a(606)]()),this[a(589)]?this[a(491)]():(RSEngine.screenManager[a(608)](this[a(595)]),RSGame[a(609)]()[a(626)]()),RSEngine[a(545)]==LOGIN_MODE[a(639)]&&FBInstant[a(527)]()[a(511)](function(){RSGame[a(609)]()[a(590)]()[a(574)]()[a(489)](FBInstant[a(576)][a(597)]())}))},onButtonClicked:function(a){var b=a0_0xa86560;this[b(542)][b(618)].call(this,a);switch(a){case b(604):document[b(533)]("helpshift_dummy")&&document.getElementById("helpshift_dummy").remove(); this._playerSupportactive=!0;RSAnalyticsManager[b(609)]()[b(571)](b(518),"open",b(586),"","");document[b(533)](b(635))[b(553)]=GameConfig[b(538)];setTimeout(showHelpShift[b(536)](),250);break;case b(621):document[b(533)](b(526))&&document[b(533)](b(526)).remove(),this[b(555)]=!0,RSAnalyticsManager.getInstance()[b(571)](b(518),b(562),b(586),"",""),document[b(533)](b(635))[b(553)]=GameConfig[b(490)]?GameConfig.HELPSHIFT_URL_FAQ:GameConfig[b(538)],setTimeout(showHelpShift.bind(),250)}},addDataProgressOffset:function(a){var b= a0_0xa86560;this._dataProgress+=a;50<this[b(648)]&&(this[b(648)]=50);this[b(563)]()},setDataLoadedValue:function(a){var b=a0_0xa86560;this[b(648)]<a&&this.addDataProgressOffset(a-this[b(648)])},onPreloadProgress:function(){var a=a0_0xa86560;if(!1!=this[a(641)]){if(null!=this[a(630)]){try{var b=this[a(630)].getSize()}catch(c){RSErrorTracker[a(609)]()[a(493)](a(634),a(625)+c,a(611))}var d=this._progressBarUpdateFactor*(0.5*this[a(548)]+this[a(648)]);0<d&&null!=b&&(this[a(630)][a(578)](!0),this._progressBar[a(487)](d, b._height),this[a(615)]&&(this[a(615)][a(497)](this._progressBar.getX()+this[a(630)][a(508)]().getWidth()-this[a(615)][a(508)]()[a(549)]()/4),this._streakAnim[a(578)](!0)))}RSEngine.loginMode==LOGIN_MODE.INSTANT_GAME&&FBInstant[a(544)](0.5*this[a(548)]+this[a(648)]);100<=0.5*this[a(548)]+this._dataProgress&&(cc[a(535)](a(552)),this[a(530)]())}},onDefaultDataLoadCompleted:function(){var a=a0_0xa86560;RSGame[a(609)]()[a(540)]()[a(632)](100)},onPreloadCompleted:function(){var a=a0_0xa86560;RSGame[a(609)]().getLoadingManger()[a(628)]()}, update:function(a){var b=a0_0xa86560;this[b(542)][b(599)][b(509)](this,a)},onSplashScreenAnimComplete:function(){var a=a0_0xa86560;this[a(546)]();this[a(542)].onReveal.call(this);this[a(570)]=setInterval(this[a(568)][a(536)](this),2E3)},hideSplashScreen:function(){var a=a0_0xa86560;clearInterval(this._splashScreenFadeoutInterval);this[a(641)]=!0;this[a(636)](this[a(577)]);this._splashScreen[a(503)]();if(this[a(581)])this[a(539)]();else{this[a(522)]();this.loadNextScreen();var b=this;this[a(613)][a(506)](1.5, function(){b.removeChild(b._bgLayer)})}},bypassSplashScreen:function(){var a=a0_0xa86560;this._isSplashShown=!0;this.playBackgroundMusic();this[a(636)](this[a(613)]);this[a(530)]()},onMotionTweenFileLoaded:function(a){var b=a0_0xa86560;this._splashScreen=new RSSplashScreen(a,this[b(594)][b(536)](this));this[b(577)].setZOrder(1);this.addChild(this[b(577)])},showGameLogo:function(){var a=a0_0xa86560,b=this;this[a(581)]&&this[a(581)].fadeIn(0.5,function(){b.splashFadeInCompleted(this[a(581)])})},hideGameLogo:function(){var a= a0_0xa86560,b=this;this[a(613)][a(506)](1.5,function(){b[a(636)](b[a(613)])});this._gameSplashImage[a(506)](0.5,this[a(593)].bind(this));this[a(530)]()},hideLogo:function(){var a=a0_0xa86560;this.onPreloadProgress();this[a(522)]()},splashFadeInCompleted:function(a){a=a0_0xa86560;this[a(581)]&&this.scheduleFunctionOnce(this[a(567)][a(536)](this),0.5)},loadSplashScreen:function(){var a=a0_0xa86560,b=this;RSUtils[a(643)]("res/RSSplashScreen/LensFlareTween.json",null,function(c){b[a(579)](c)})},unload:function(){var a= a0_0xa86560;this._playerSupportactive&&(this[a(555)]=!1,RSAnalyticsManager[a(609)]().trackGUIEvent(a(518),a(585),a(586),"",""));this[a(577)]=null;this[a(615)]=null;this[a(613)]=null;this[a(600)]=null;this[a(581)]=null;this[a(583)]=null;this[a(630)]&&(this[a(630)][a(636)](this[a(629)]),this.progressObj[a(503)]());this[a(629)]=null;this[a(640)].unload();this[a(542)][a(503)][a(509)](this)},unloadContent:function(){var a=a0_0xa86560;this[a(542)][a(592)][a(509)](this)}});var RSSplashScreen=RSBasicObject.extend({_isConnectionActive:null,_cardCount:null,_cardSelectTimeOutId:null,_onSplashCompleteCallBack:null,_motionTweenData:null,_time:null,_glare:null,maskWidth:null,_studiosTitle:null,_mask:null,_rubySevenTitle:null,init:function(a,b){this._super.init.call(this);this._onSplashCompleteCallBack=b;this._motionTweenData=a;this.loadLayout("res/RSSplashScreen/RubysevenSplashScreen");this._playBackgroundMusic()},_playBackgroundMusic:function(){var a=document.getElementById("myModal-login"); a&&"none"===window.getComputedStyle(a).display&&(RSEngine.audioManager&&(GlobalVars.isAudioContextInitialized=!0,RSEngine.audioManager.reInitializeAudioContext()),RSEngine.audioManager.playMusic("res/RSSplashScreen/IntroMusic.mp3",!1))},onAssetLoaded:function(a){this._super.onAssetLoaded.call(this,a)},loadLayout:function(a){a=a+"_layout_"+RSEngine.layout+".json";var b=this,c=a.substr(0,a.lastIndexOf("/")+1);RSUtils.loadJsonAsyc(a,null,function(a){for(var e=0;e<MAX_TEXTURES;e++)cc.spriteFrameCache.addSpriteFrames(c+ a.screenName+"_0"+e+"-hd.plist");if(b._ccObject)b.onAssetLoaded(a)})},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.playAnimationWithTween()},onObjectCreated:function(a,b,c){switch(c.name){case "Studio":this._studiosTitle=a;this._mask=new RSPanel(c.x,c.y,c.w,c.h);this._mask.setBackgroundColor(0,0,0,255);this.addChild(this._mask);this.maskWidth=c.w;this._studiosTitle.setVisible(!1);break;case "Ruby":this._rubySevenTitle=a;break;case "Glare":this._glare=a}this._super.onObjectCreated.call(this, a,b,c)},playAnimationWithTween:function(){this._glare.setPosition(this._rubySevenTitle.getX()-this._rubySevenTitle.getSize()._width/2,this._glare.getY());this._glare.parseMotionTweenFileData(this._motionTweenData);this._glare.playMotionTween(!0,0,this._onSplashCompleteCallBack.bind(this));this._time=0.455;this.playTweenAnimation()},playTweenAnimation:function(a){this._mask.actionMoveBy(this._time,null!=a?a:1,0,this.callBackOfTweenAnimation.bind(this))},callBackOfTweenAnimation:function(){var a=this._glare.getX()- this._glare.getSize()._width/2-(this._mask.getX()-this.maskWidth);0<a&&(this._studiosTitle.setVisible(!0),this.playTweenAnimation(a))},unloadContent:function(){this._super.unloadContent.call(this)}});var RSSecondaryLoadingScreen=RSGameScreen.extend({init:function(a,b,c,d,e,f){if(null!=c)for(var g in c)a.push(c[g]);this._super.init.call(this,a,b);this._rsLayerObject=null;this._preloadRes=a;this._nextScreen=b;this._layout=d;this._bgURL=e;this._rsLayerObject=new RSScreenLoader;this._rsLayerObject.init();this._progressBar=null;this._dataProgress=this._artProgress=this._progress=this._progressBarUpdateFactor=0;f||(this._dataProgress=50);RSEngine.isMobile&&this._rsLayerObject.retain()},loadContent:function(){RSGame.getInstance()._resourceConfigData? this.layoutScreen(RSGame.getInstance().getAssetPath("SecondaryLoader")):this.layoutScreen("res/LoadingScreen/SecondaryLoader/SecondaryLoader")},onReveal:function(){this.startPreload();this._super.onReveal.call(this)},startPreload:function(){for(var a=this,b=[],c=0;c<a._preloadRes.length;c++)b.push(a._preloadRes[c]);this._rsLayerObject.initWithResources(b,function(b){a._artProgress=b;a.onPreloadProgress()},function(){b=a._preloadRes=null;a.onPreloadCompleted()})},onPreloadProgress:function(){this._progress= 0.5*this._artProgress+this._dataProgress;if(null!=this._progressBar){var a=this._progressBarUpdateFactor*this._progress;this._progressBar.setRect(this._progressBar.getX(),this._progressBar.getY(),a,this._progressBar.getSize().getHeight())}},onPreloadCompleted:function(){this.loadNextScreen()},loadNextScreen:function(){RSEngine.screenManager.loadNewScreen(this._nextScreen)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},unloadContent:function(){this._rsLayerObject.unload(); this._super.unloadContent.call(this)}});var RSPortraitWrapperScreen=RSGameScreen.extend({init:function(a,b){this._super.init.call(this);this._machine=a;this._bg=b},loadContent:function(){this.setShouldDrawWhenInactive(!0);this.modifyMachineFunctions(this._machine,this);RSEngine.screenManager.addScreen(this._machine);var a=new RSImageObject;a.setAnchorPoint(0,0);a.setImageFromUrl(this._bg,0,0,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(a);this.revealScreen()},modifyMachineFunctions:function(a,b){a.onLayoutCompleted=function(){this.scaleTo(Math.ceil(RSEngine.screenHeight/ RSEngine.screenWidth*100)/100,new RSPoint(0.5,0.5),new RSRect(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenHeight,RSEngine.screenWidth));RSEngine.screenManager.onLayerLoaded(this);this.addChild(this._slotReelManager);this.loadData()};a.clipScreen=function(a){a&&(this._rsScreenRect=a);this._screenClipper=new RSPanel(this._rsScreenRect.getX(),this._rsScreenRect.getY(),this._rsScreenRect.getWidth(),this._rsScreenRect.getHeight());this._screenClipper.setCenter(this._rsScreenRect.getX(), this._rsScreenRect.getY());this._screenClipper.setClippingEnabled(!0);this.getDisplayObject().addChild(this._screenClipper.getDisplayObject());a=null;for(var b=this.getDisplayObject(),e=this._screenClipper.getDisplayObject(),f=0;f<this._children.length;f++)a=this._children[f],b.removeChild(a.getDisplayObject(),!1),e.addChild(a.getDisplayObject())};a.addBottomHUDToScreen=function(){};a.addHUDToScreen=function(){var a=RSCasinoManager.getCasinoHUD();a.reInitButtonHoverCursor();this.getDisplayObject().addChild(a.getDisplayObject()); var b=Math.ceil(RSEngine.screenWidth/RSEngine.screenHeight*100)/100;a.setScale(b);a.setZOrder(10);this.getDisplayObject().addChild(this._bottomHUD.getDisplayObject());this._bottomHUD.setZOrder(10);this._bottomHUD.setScale(1/this._machineScale);this._bottomHUD.setPosition(-428,-242)};a.addScreen=function(a){b.modifyMachineFunctions(a,b);RSEngine.screenManager.addScreen(a)}}});var RSIntermediateLoadingScreen=RSGameScreen.extend({onScreenLoadingComplete:function(){RSGame.getInstance().getLoadingManger().getLoadingScreen().onIntermediateScreenLoadingComplete()}});var RSMEConfigManager=function(){var a,b=RSClass.extend({_config:null,_enabledList:null,_startTime:null,_eventData:null,_callback:null,_retryCount:0,fetchActiveEventData:function(a){this._callback=a;a=[];a[0]=RSEngine.dataManager.getMe().getId();a[1]=RSEngine.platform;a[2]=RSEngine.gameVersion;RSEngine.networkManager.sendJSONRPCRequest("MarketingEvents.getAllEvents",a,this.activeEventsResponse.bind(this),this._responseFailed.bind(this))},activeEventsResponse:function(a){this._retryCount=0;this._startTime= TimeManager.getInstance().getCurrentServerTime();a?a.result?"success"==a.result.message?(this._eventData=a.result.data.eventList,this._callback("success")):this._callback("Failure Code: "+a.result.status):a.error&&a.error.message?this._callback(a.error.message):this._callback("failed"):this._callback("failed")},_responseFailed:function(a){3>this._retryCount?(this._retryCount++,this.fetchActiveEventData(this._callback)):(this._retryCount=0,this._callback(a))},getTimeLeft:function(a){if(!this.getDataForEvent(a))return 0; a=this._eventData[a].remainingTime-(TimeManager.getInstance().getCurrentServerTime()-this._startTime);return 0<a?a:0},getDataForEvent:function(a){if(this._eventData)for(var b in this._eventData)if(b==a)return this._eventData[b];cc.log("Trying to access an event that is not enabled ");return null}});return{getInstance:function(){a||(a=new b);return a}}}();var AristocratManager=function(){var a,b=RSClass.extend({_userCoins:0,init:function(){this._userCoins=0;this._popupList=[];this.currentMachineName="";this.lastSinkCount=this.lastSinkAmount=0;this._updateAristocratData=!1},startCallUserUpdates:function(a){a&&(this.currentMachineName=a);RSGame.getInstance().getUserDataManager().getMe().setAristocratLastBetAmount(0);RSGame.getInstance().getUserDataManager().saveUserData("AristocratLastBetAmountSaved");this._userCoins=RSCasinoManager.getPrimaryCurrency(); RSGame.getInstance().getUserDataManager().saveUserBlobParams();clearInterval(this._bonusTimer);parseInt(RSEngine.gameData.getDefaultValues().piggyBonusAvailability)?this._bonusTimer=setInterval(this.refreshAristocratData.bind(this),1E4):this._bonusTimer=setInterval(this.callUserUpdates.bind(this),1E4)},reStartcallUserUpdates:function(){this.currentMachineName&&(clearInterval(this._bonusTimer),parseInt(RSEngine.gameData.getDefaultValues().piggyBonusAvailability)?this._bonusTimer=setInterval(this.callUserUpdates.bind(this), 1E4):this._bonusTimer=setInterval(this.refreshAristocratData.bind(this),1E4))},_getCasinoHUD:function(){return RSGame.getInstance().getGameManager().getAristocratHUD()},setAristocratHud:function(){this.currentMachineName&&RSCasinoManager.setCasinoHUD(this._getCasinoHUD())},onBackFromMachineUnlock:function(){this.callUserUpdates();this.stopCallUserUpdates();AristocratManager.getInstance().currentMachineName=""},stopCallUserUpdates:function(){clearInterval(this._bonusTimer);RSGame.getInstance().getUserDataManager().getMe().setAristocratLastBetAmount(0)}, callUserUpdates:function(){this._userXp=RSCasinoManager.getCasinoInterface().getXP();RSGame.getInstance().getUserDataManager().getCurrentCoinBalance(this._onCallBackOnCoinSuccess.bind(this))},_callUserUpdates:function(){this._userXp=RSCasinoManager.getCasinoInterface().getXP();RSGame.getInstance().getUserDataManager().getCurrentCoinBalance(this._onCallBackOnCoinSuccess.bind(this))},_onCallBackOnCoinSuccess:function(a,b){this._userXp!=RSCasinoManager.getCasinoInterface().getXP()&&b&&b.result&&b.result.data&& (RSGame.getInstance().getLevelManager().updateLevelDataInAristocratMachine(RSCasinoManager.getCasinoInterface().getXP()-this._userXp),RSCasinoManager.getCasinoInterface().addXP(0),0<RSGame.getInstance().getUserDataManager().getMe().getAristocratLastBetAmount()&&(RSGame.getInstance().getGameManager().calculateAverageBet(RSGame.getInstance().getUserDataManager().getMe().getAristocratLastBetAmount()),RSGame.getInstance().getUserDataManager().getMe().setFirstPlayed(RSGameTypes.Slots),RSGame.getInstance().getUserDataManager().getMe().setSpins(this.currentMachineName)), RSGame.getInstance().getLosingStreakManager().calculateLosingStreak(RSCasinoManager.getPrimaryCurrency()-this._userCoins),b=new RSCasinoResult,b._machineType=RS_MACHINE_TYPE.SLOTS,b._totalBetAmount=RSGame.getInstance().getUserDataManager().getMe().getAristocratLastBetAmount(),RSCasinoManager.getCasinoInterface().handleResultComplete(b,RSGameTypes.Slots,this.currentMachineName));this._userCoins=RSCasinoManager.getPrimaryCurrency();this._userXp=RSCasinoManager.getCasinoInterface().getXP()},_onAristocratDataUpdated:function(a, b){if("success"===a&&b&&b.result&&(b=b.result,GameConfig.LEADERBOARD_ENABLED&&0<b.data.aristocratLeaderboardWin&&RSLeaderboard.setUserLeaderBoardData(parseInt(b.data.aristocratLeaderboardWin)),b.data.aristocratSinkCount&&b.data.aristocratSink)){this.lastSinkCount=b.data.aristocratSinkCount;this.lastSinkAmount=b.data.aristocratSink;for(var e=this.lastSinkAmount/this.lastSinkCount,f=1;f<=this.lastSinkCount;f++)RSCasinoManager.getCasinoInterface().addXP(e),RSGame.getInstance().getLevelManager().updatePiggyBank(e), RSGame.getInstance().getUserDataManager().getMe().setSpins(this.currentMachineName);0<RSGame.getInstance().getUserDataManager().getMe().getAristocratLastBetAmount()&&(RSGame.getInstance().getGameManager().calculateAverageBet(RSGame.getInstance().getUserDataManager().getMe().getAristocratLastBetAmount()),RSGame.getInstance().getUserDataManager().getMe().setFirstPlayed(RSGameTypes.Slots));RSGame.getInstance().getLosingStreakManager().calculateLosingStreak(RSCasinoManager.getPrimaryCurrency()-this._userCoins); b=new RSCasinoResult;b._machineType=RS_MACHINE_TYPE.SLOTS;b._totalBetAmount=RSGame.getInstance().getUserDataManager().getMe().getAristocratLastBetAmount();RSCasinoManager.getCasinoInterface().handleResultComplete(b,RSGameTypes.Slots,this.currentMachineName);this._userCoins=RSCasinoManager.getPrimaryCurrency();this._userXp=RSCasinoManager.getCasinoInterface().getXP()}"gameplay_screen"!=RSAnalyticsManager.getInstance().getCurrentScreen()&&(GameConfig.LEADERBOARD_ENABLED?RSLeaderboard.getRankUpTriggerStatus()&& !RSLeaderboard.getLeaderboardResetStatus()||RSCasinoManager.getCasinoInterface().showRoundCompletePopups():GlobalVars.isSurfacingActive||RSCasinoManager.getCasinoInterface().showRoundCompletePopups())},refreshAristocratData:function(){RSGame.getInstance().getUserDataManager().updateAristocratData(this.lastSinkCount,this.lastSinkAmount,this._onAristocratDataUpdated.bind(this));this.lastSinkAmount=this.lastSinkCount=0}});return{getInstance:function(){a||(a=new b);return a}}}();var CasinoExternalGameType={YFAGEO:16,BGAMING:15,FINCORE:14,AINSWORTH:13,ROCKET_MAN:12,HIGH_FIVE_GAME:11,WAZDEN_RGS_GAME:10,ODDS_WORKS_GAME:9,RISING_DIGITAL_GAME:8,AGS_GAME:7,KONAMI_GAME:6,ARISTOCRAT_INTERNAL:5,EVERI_GAME:4,SPIN_GAME_V2:3,ARISTOCRAT:2,SPIN_GAME:1,INTERNAL:0},SlotMachineConfig=RSClass.extend({init:function(a,b){a.gameType==CasinoExternalGameType.INTERNAL||a.gameType==CasinoExternalGameType.ARISTOCRAT_INTERNAL?RSGame.getInstance().getGameManager().setCurrentMachineIsInternal(!0):RSGame.getInstance().getGameManager().setCurrentMachineIsInternal(!1); this._gameType=RSGameTypes.Slots;this._triggeredFrom=b;this._resArray=[];this._params={};this._super.init.call(this);RSGame.getInstance().getGameManager().setCurrentMachineVO(a);var c=RSGame.getInstance().getUserDataManager().getMe().getId();switch(parseInt(a.gameType)){case CasinoExternalGameType.INTERNAL:GlobalVars.isInsideExternalGame=!1;var d={machineAnalyticsID:"",betStructure:[],defaultBet:0,maxBetAmount:0,cheat:0,giftedSpinCount:0};this.setExternalParams(a);this._params._betStructure=RSGame.getInstance().getGameData().getSlotBetStructureByName(a.machine_identifier); this._params._maxBetAmount=RSGame.getInstance().getGameData().getMaxBetValueForSlot(a.machine_identifier,RSGame.getInstance().getLevelManager().getCurrentLevelVO().level);this._params._defaultBet=parseInt(RSGame.getInstance().getGameData().getDefaultBetForCasino("machineBetValues",a.machine_identifier,parseInt(a.payLines)));this._params._cheatActive=GlobalVars.isCheatActive;var e=RSGame.getInstance().getUserDataManager().getMe().getCoins(),f={vo:GlobalVars.voiceCalloutsStatus,music:GlobalVars.musicStatus, effect:GlobalVars.sfxStatus},f=btoa(encodeURIComponent(JSON.stringify(f))),g=TimeManager.getInstance().getCurrentServerTime();d.machineAnalyticsID=a.machine_identifier;d.betStructure=this._params._betStructure;d.defaultBet=this._params._defaultBet;d.maxBetAmount=this._params._maxBetAmount;d.cheat=GlobalVars.isCheatActive;a.mathFileName&&0<a.mathFileName.length&&(d.mathFile=a.mathFileName,this._params.mathFile=d.mathFile);var h=0;if(RSGame.getInstance().getUserDataManager().getMe().getFUEBonusStatus())RSGame.getInstance().getUserDataManager().getMe().getMachineFUEBonusStatus()|| !parseInt(a.enableFUE)||RSGame.getInstance().getUserDataManager().getMe().getMachineFUEBonusTriggered(a.machine_identifier)||(h=a.spinsToFUEBonus?parseInt(a.spinsToFUEBonus):0);else{var k=parseInt(RSGame.getInstance().getGameData().getDefaultValues().spinsForFUEBonus);0<k-RSGame.getInstance().getUserDataManager().getMe().getCumulativeSpinsForFUE()&&(h=k-RSGame.getInstance().getUserDataManager().getMe().getCumulativeSpinsForFUE())}0<h&&(d.fueTriggerSpin=h,this._params.fueTriggerSpin=d.fueTriggerSpin); MachineGiftingManager.getInstance().isMachineGifted(a.machine_identifier)&&(d.giftedSpinCount=MachineGiftingManager.getInstance()._remainingFreeSpinCount);this._params._machineData=btoa(encodeURIComponent(JSON.stringify(d)));d=a.screenName.split("Machine")[0];"Slot"==d&&(d=a.screenName);var m=this._getHashValue(d,g,e,c);a.screenName=d;this._params._screenName=d;h=parseInt(a.isPortrait)?"\x26orientation\x3dPortrait":"\x26orientation\x3dLandscape";k=parseInt(a.isPortrait)?"\x26dualOrientation\x3dtrue": "\x26dualOrientation\x3dfalse";d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.INTERNAL,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1);null==d&&(d=GameConfig.CONTENT_GAME_URL);this._params._gameURL=d+a.screenName+"\x26machineType\x3dSLOTS\x26layout\x3diPhone5"+h+k+"\x26casino\x3d"+GameConfig.CASINO_NAME+"\x26userID\x3d"+c+"\x26timeStamp\x3d"+g+"\x26coins\x3d"+e+"\x26hashValue\x3d"+m+"\x26volume\x3d"+f+"\x26platform\x3dcanvas";break;case CasinoExternalGameType.SPIN_GAME_V2:case CasinoExternalGameType.SPIN_GAME:GlobalVars.isInsideExternalGame= !0;this.setExternalParams(a);g=RSGame.getInstance().getGameManager().getSpinGameToken();f=RSGame.getInstance().getGameData().getSpinBetStructureByName(a.machine_identifier,RSGame.getInstance().getLevelManager().getCurrentLevelVO().level);this._params._betStructure=f;this._params._betIndex=RSGame.getInstance().getGameData().getDefaultBetIndexForCasino("machineBetValues",a.machine_identifier,parseInt(a.payLines));GameConfig.SPIN_MAINTENANCE_URL?this._params._gameURL=GameConfig.SPIN_MAINTENANCE_URL: (e=a.gameType==CasinoExternalGameType.SPIN_GAME_V2?"launch?gameId\x3d":"launch?gameId\x3dslot!",d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.SPIN_GAME_V2,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1),null==d&&(d=GameConfig.SPIN_GAME_URL),this._params._gameURL=d+e+this._params._gameName+"\x26sessionToken\x3d"+g+"\x26site\x3d"+GameConfig.SPIN_GAME_SITE+"\x26playerId\x3d"+c);break;case CasinoExternalGameType.KONAMI_GAME:GlobalVars.isInsideExternalGame=!0;this.setExternalParams(a); g=RSGame.getInstance().getGameManager().getSpinGameToken();f=RSGame.getInstance().getGameData().getSpinBetStructureByName(a.machine_identifier,RSGame.getInstance().getLevelManager().getCurrentLevelVO().level);this._params._betStructure=f;this._params._betIndex=RSGame.getInstance().getGameData().getDefaultBetIndexForCasino("machineBetValues",a.machine_identifier,parseInt(a.payLines));f=GlobalVars.sfxStatus;GameConfig.SPIN_MAINTENANCE_URL?this._params._gameURL=GameConfig.SPIN_MAINTENANCE_URL:(e="launch?gameid\x3d", d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.KONAMI_GAME,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1),null==d&&(d=GameConfig.KONAMI_GAME_URL),this._params._gameURL=d+e+this._params._gameName+"\x26token\x3d"+g+"\x26site\x3d"+GameConfig.SPIN_GAME_SITE+"\x26playerId\x3d"+c+"\x26volume\x3d"+f);break;case CasinoExternalGameType.ARISTOCRAT:GlobalVars.isInsideExternalGame=!0;this.setExternalParams(a);this._params._gameName=RSGame.getInstance().getGameData().getAristocratMachineURL(a.machine_identifier); d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.ARISTOCRAT,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1);null==d&&(d=GameConfig.ARISTOCRAT_GAME_URL);this._params._gameURL=d+this._params._gameName+"?lang\x3den\x26playerToken\x3d"+c+"\x26currency\x3dVCD\x26sessionid\x3d"+calcMD5(c+"|"+GameConfig.ARISTOCRAT_APP_ID);RSGame.getInstance().getUserDataManager().saveUserBlobParams();AristocratManager.getInstance().startCallUserUpdates(a.machine_identifier);break;case CasinoExternalGameType.ARISTOCRAT_INTERNAL:GlobalVars.isInsideExternalGame= !1;RSGame.getInstance().getUserDataManager().saveUserBlobParams();this._params={};this.setExternalParams(a);e=RSGame.getInstance().getUserDataManager().getMe().getCoins();f={vo:GlobalVars.voiceCalloutsStatus,music:GlobalVars.musicStatus,effect:GlobalVars.sfxStatus};f=btoa(encodeURIComponent(JSON.stringify(f)));g=TimeManager.getInstance().getCurrentServerTime();h=parseInt(a.isPortrait)?"\x26orientation\x3dPortrait":"\x26orientation\x3dLandscape";k=parseInt(a.isPortrait)?"\x26dualOrientation\x3dtrue": "\x26dualOrientation\x3dfalse";d={machineAnalyticsID:"",betStructure:[],defaultBet:0,maxBetAmount:0,cheat:0,giftedSpinCount:0,gameID:"",partnerID:"",appID:""};d.machineAnalyticsID=a.machine_identifier;d.cheat=GlobalVars.isCheatActive;d.betStructure=RSGame.getInstance().getGameData().getSlotBetStructureByName(a.machine_identifier);d.defaultBet=parseInt(RSGame.getInstance().getGameData().getDefaultBetForCasino("machineBetValues",a.machine_identifier,parseInt(a.payLines)));d.maxBetAmount=RSGame.getInstance().getGameData().getMaxBetValueForSlot(a.machine_identifier, RSGame.getInstance().getLevelManager().getCurrentLevelVO().level);d.gameID=a.machine_aristocratGameID;d.partnerID=RSEngine.gameData.getDefaultValues().aristocratPartnerID;d.appID=GameConfig.ARISTOCRAT_APP_ID;MachineGiftingManager.getInstance().isMachineGifted(a.machine_identifier)&&(d.giftedSpinCount=MachineGiftingManager.getInstance()._remainingFreeSpinCount);this._params._machineData=btoa(encodeURIComponent(JSON.stringify(d)));this._params._maxBetAmount=d.maxBetAmount;d=a.screenName.split("Machine")[0]; m=this._getHashValue(d,g,e,c);a.screenName=d;this._params._screenName=d;d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.ARISTOCRAT_INTERNAL,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1);null==d&&(d=GameConfig.CONTENT_GAME_URL);this._params._gameURL=d+a.screenName+"\x26machineType\x3dARISTOCRAT\x26layout\x3diPhone5"+h+k+"\x26casino\x3d"+GameConfig.CASINO_NAME+"\x26userID\x3d"+c+"\x26timeStamp\x3d"+g+"\x26coins\x3d"+e+"\x26hashValue\x3d"+m+"\x26volume\x3d"+f+"\x26platform\x3dcanvas"; break;case CasinoExternalGameType.EVERI_GAME:GlobalVars.isInsideExternalGame=!0;this.setExternalParams(a);g=RSGame.getInstance().getGameManager().getEveriGameToken();d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.EVERI_GAME,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1);null==d&&(d=GameConfig.EVERI_GAME_URL);d=RSUtils.replaceWithString(d,"game_ID",a.screenName);d=RSUtils.replaceWithString(d,"users_ID",RSEngine.dataManager.getMe().getId());this._params._gameURL=encodeURI(d+ a.screenName+"|"+g);break;case CasinoExternalGameType.AGS_GAME:GlobalVars.isInsideExternalGame=!0;this.setExternalParams(a);c=RSGame.getInstance().getGameManager().getAGSGameToken();c=c+"|"+a.screenName;d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.AGS_GAME,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1);null==d&&(d=GameConfig.AGS_GAME_URL);d=RSUtils.replaceWithString(d,"game_ID",a.screenName);d=RSUtils.replaceWithString(d,"users_ID",RSEngine.dataManager.getMe().getId()); d=RSUtils.replaceWithString(d,"AGSToken",c);this._params._defaultBet=parseInt(RSGame.getInstance().getGameData().getDefaultBetForCasino("machineBetValues",a.machine_identifier));this._params._gameURL=encodeURI(d);break;case CasinoExternalGameType.RISING_DIGITAL_GAME:GlobalVars.isInsideExternalGame=!0;this.setExternalParams(a);c=RSGame.getInstance().getGameManager().getRisingDigitalGameToken();d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.RISING_DIGITAL_GAME,GameConfig.LIVE_MODE? GameConfig.LIVE_MODE:!1);null==d&&(d=GameConfig.RISING_DIGITAL_GAME_URL);d=RSUtils.replaceWithString(d,"GAME_ID",a.screenName);d=RSUtils.replaceWithString(d,"MATH_FILE",a.mathFileName);d=RSUtils.replaceWithString(d,"users_ID",RSEngine.dataManager.getMe().getId());g=TimeManager.getInstance().getCurrentServerTime();d=RSUtils.replaceWithString(d,"RisingDigitalToken",c+"|"+a.screenName+"|"+g);this._params._defaultBet=parseInt(RSGame.getInstance().getGameData().getDefaultBetForCasino("machineBetValues", a.machine_identifier));this._params._gameURL=encodeURI(d);break;case CasinoExternalGameType.ODDS_WORKS_GAME:GlobalVars.isInsideExternalGame=!0;this.setExternalParams(a);c=RSGame.getInstance().getGameManager().getOddsWorksGameToken();c+="|"+a.screenName;d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.ODDS_WORKS_GAME,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1);null==d&&(d=GameConfig.ODDS_WORKS_GAME_URL);d=RSUtils.replaceWithString(d,"game_ID",a.screenName);d=RSUtils.replaceWithString(d, "users_ID",RSEngine.dataManager.getMe().getId());d=RSUtils.replaceWithString(d,"OddsWorksToken",c);d=RSUtils.replaceWithString(d,"gameOrigin",GameConfig.BASE_URL);this._params._defaultBet=parseInt(RSGame.getInstance().getGameData().getDefaultBetForCasino("machineBetValues",a.machine_identifier));this._params._gameURL=encodeURI(d);break;case CasinoExternalGameType.WAZDEN_RGS_GAME:GlobalVars.isInsideExternalGame=!0;this.setExternalParams(a);c=RSGame.getInstance().getGameManager().getWazdenRGSGameToken(); d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.WAZDEN_RGS_GAME,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1);null==d&&(d=GameConfig.WAZDEN_RGS_URL);d=RSUtils.replaceWithString(d,"game_ID",a.screenName);d=RSUtils.replaceWithString(d,"users_ID",RSEngine.dataManager.getMe().getId());d=RSUtils.replaceWithString(d,"wazdanLaunchToken",c);d=RSUtils.replaceWithString(d,"gameOrigin",GameConfig.BASE_URL);this._params._defaultBet=parseInt(RSGame.getInstance().getGameData().getDefaultBetForCasino("machineBetValues", a.machine_identifier));this._params._gameURL=encodeURI(d);break;case CasinoExternalGameType.HIGH_FIVE_GAME:GlobalVars.isInsideExternalGame=!0;this.setExternalParams(a);c=RSGame.getInstance().getGameManager().getHighFiveGameToken();c=c+"|"+a.screenName;d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.HIGH_FIVE_GAME,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1);null==d&&(d=GameConfig.HIGH_FIVE_GAME_URL);d=RSUtils.replaceWithString(d,"game_ID",a.screenName);d=RSUtils.replaceWithString(d, "users_ID",RSEngine.dataManager.getMe().getId());d=RSUtils.replaceWithString(d,"hi5LaunchToken",c);d=RSUtils.replaceWithString(d,"gameOrigin",GameConfig.BASE_URL);this._params._defaultBet=parseInt(RSGame.getInstance().getGameData().getDefaultBetForCasino("machineBetValues",a.machine_identifier));this._params._gameURL=encodeURI(d);break;case CasinoExternalGameType.ROCKET_MAN:GlobalVars.isInsideExternalGame=!0;this.setExternalParams(a);c=RSGame.getInstance().getGameManager().getRocketManGameToken(); d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.ROCKET_MAN,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1);null==d&&(d=GameConfig.ROCKETMAN_GAME_URL);d=RSUtils.replaceWithString(d,"rocketManToken",c);this._params._defaultBet=parseInt(RSGame.getInstance().getGameData().getDefaultBetForCasino("machineBetValues",a.machine_identifier));this._params._gameURL=encodeURI(d);break;case CasinoExternalGameType.AINSWORTH:GlobalVars.isInsideExternalGame=!0;this.setExternalParams(a); c=RSGame.getInstance().getGameManager().getAinsworthGameToken();d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.AINSWORTH,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1);f=RSGame.getInstance().getGameData().getSpinBetStructureByName(a.machine_identifier,RSGame.getInstance().getLevelManager().getCurrentLevelVO().level);this._params._betStructure=f;this._params._betIndex=RSGame.getInstance().getGameData().getDefaultBetIndexForCasino("machineBetValues",a.machine_identifier, parseInt(a.payLines));null==d&&(d=GameConfig.AINSWORTH);d=RSUtils.replaceWithString(d,"game_ID",a.screenName);d=RSUtils.replaceWithString(d,"users_ID",RSEngine.dataManager.getMe().getId());d=RSUtils.replaceWithString(d,"auth_token",c);this._params._defaultBet=parseInt(RSGame.getInstance().getGameData().getDefaultBetForCasino("machineBetValues",a.machine_identifier));this._params._gameURL=encodeURI(d);break;case CasinoExternalGameType.FINCORE:GlobalVars.isInsideExternalGame=!0;this.setExternalParams(a); c=RSGame.getInstance().getGameManager().getFincoreGameToken();d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.FINCORE,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1);f=RSGame.getInstance().getGameData().getSpinBetStructureByName(a.machine_identifier,RSGame.getInstance().getLevelManager().getCurrentLevelVO().level);this._params._betStructure=f;this._params._betIndex=RSGame.getInstance().getGameData().getDefaultBetIndexForCasino("machineBetValues",a.machine_identifier,parseInt(a.payLines)); d=RSUtils.replaceWithString(d,"game_ID",a.screenName);d=RSUtils.replaceWithString(d,"game_ID",a.screenName);d=RSUtils.replaceWithString(d,"users_ID",RSEngine.dataManager.getMe().getId());d=RSUtils.replaceWithString(d,"auth_token",c);this._params._defaultBet=parseInt(RSGame.getInstance().getGameData().getDefaultBetForCasino("machineBetValues",a.machine_identifier));this._params._gameURL=encodeURI(d);break;case CasinoExternalGameType.BGAMING:GlobalVars.isInsideExternalGame=!0;this.setExternalParams(a); d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.BGAMING,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1);f=RSGame.getInstance().getGameData().getSpinBetStructureByName(a.machine_identifier,RSGame.getInstance().getLevelManager().getCurrentLevelVO().level);this._params._betStructure=f;this._params._betIndex=RSGame.getInstance().getGameData().getDefaultBetIndexForCasino("machineBetValues",a.machine_identifier,parseInt(a.payLines));d=RSUtils.replaceWithString(d,"users_ID", RSEngine.dataManager.getMe().getId());d=RSUtils.replaceWithString(d,"current_platform",RSEngine.loginMode==LOGIN_MODE.FACEBOOK?"canvas":"web");d=RSUtils.replaceWithString(d,"current_version",GameConfig.VERSION);d=RSUtils.replaceWithString(d,"game_ID",a.screenName);m=this._getHashValueForBgaming(RSEngine.dataManager.getMe().getId(),RSEngine.loginMode==LOGIN_MODE.FACEBOOK?"canvas":"web",GameConfig.VERSION,a.screenName);d=RSUtils.replaceWithString(d,"auth_token",m);d=RSUtils.replaceWithString(d,"timestamp", TimeManager.getInstance().getCurrentServerTime());this._params._defaultBet=parseInt(RSGame.getInstance().getGameData().getDefaultBetForCasino("machineBetValues",a.machine_identifier));this._params._gameURL=encodeURI(d);break;case CasinoExternalGameType.YFAGEO:GlobalVars.isInsideExternalGame=!0,this.setExternalParams(a),c=RSGame.getInstance().getGameManager().getYfageoGameToken(),c=c+"|"+a.screenName,d=RSGame.getInstance().getGameData().getSlotsRGSGameUrl(CasinoExternalGameType.YFAGEO,GameConfig.LIVE_MODE? GameConfig.LIVE_MODE:!1),f=RSGame.getInstance().getGameData().getSpinBetStructureByName(a.machine_identifier,RSGame.getInstance().getLevelManager().getCurrentLevelVO().level),this._params._betStructure=f,this._params._betIndex=RSGame.getInstance().getGameData().getDefaultBetIndexForCasino("machineBetValues",a.machine_identifier,parseInt(a.payLines)),d=RSUtils.replaceWithString(d,"game_ID",a.screenName),d=RSUtils.replaceWithString(d,"auth_token",c),this._params._defaultBet=parseInt(RSGame.getInstance().getGameData().getDefaultBetForCasino("machineBetValues", a.machine_identifier)),this._params._gameURL=encodeURI(d)}GameConfig.JACKPOT_LOUNGE_ENABLE&&GlobalVars.isjackpotLoaded&&(this._params._screenName=RSEngine.externalGameManager._machineParams._screenName,RSEngine.externalGameManager.setMachineParams(this._params))},setExternalParams:function(a){this._params=new RSExternalGameParams;this._params._gameType=RSGameTypes.Slots;this._params._gameName=a.screenName;this._params._betLineCount=parseInt(a.payLines);this._params._soundFlag=a.gameType==CasinoExternalGameType.KONAMI_GAME? GlobalVars.sfxStatus:GlobalVars.sfxStatus&&GlobalVars.musicStatus;this._params._analyticsID=a.machine_identifier;this._params.machine_identifier=a.machine_identifier;this._params._thirdPartyOwnerType=a.gameType;GlobalVars.winLinesInTheCurrentSlotMachine=a.payLines},getResourceList:function(){return this._resArray},getMachineParam:function(){return this._params},getAnalyticsData:function(){return{gameType:this._gameType,from:this._triggeredFrom}},_getHashValue:function(a,b,c,d){return a=calcMD5(a+ "|"+b+"|"+c+"|"+d+"_z2uy39283ye2n8mz92phdfp2")},_getHashValueForBgaming:function(a,b,c,d){a=a+"|"+b+"|"+c+"|"+d+"|"+GameConfig.HASH_KEY;return a=calcMD5(a)}});var CasinoPokerParams=function(){this._betStructure=[];this._maxBetAmount=0;this._machineAnalyticsID=this._gameType=this._screenName=this._betStructureSheetName=""},CasinoExternalPokerGameType={DOD:"DOD"},PokerMachineConfig=RSClass.extend({init:function(a,b,c){a.gameCategory!=CasinoExternalPokerGameType.DOD?RSGame.getInstance().getGameManager().setCurrentMachineIsInternal(!0):RSGame.getInstance().getGameManager().setCurrentMachineIsInternal(!1);this._triggeredFrom=b;this._params=new CasinoPokerParams; this._params._screenName=a.machine_name;this._params._gameType=RSGameTypes.Poker;this._params._betStructureSheetName=a.betStructure;this._gameType=RSGameTypes.Poker;this._params._machineAnalyticsID=a.machine_identifier;this._params.machine_identifier=a.machine_identifier;this._tournamentMode=c?c:!1;this._super.init.call(this);RSGame.getInstance().getGameManager().setCurrentMachineVO(a);b={vo:GlobalVars.voiceCalloutsStatus,music:GlobalVars.musicStatus,effect:GlobalVars.sfxStatus};b=btoa(encodeURIComponent(JSON.stringify(b))); c=RSGame.getInstance().getUserDataManager().getMe().getCoins();var d=RSGame.getInstance().getUserDataManager().getMe().getId(),e=TimeManager.getInstance().getCurrentServerTime(),f=[];f[0]=a.machine_name;f[1]=e;f[2]=c;f[3]=d;f=RSGame.getInstance().getGameManager().getHashValueForInternalGames(f);if("RSP"==a.gameCategory){this._params._betStructure=RSGame.getInstance().getGameData().getSheetData(a.betStructure);var g={};g.machineAnalyticsID=a.machine_identifier;g.cheat=GlobalVars.isCheatActive;g.defaultBet= RSGame.getInstance().getGameData().getPokerDefaultBet(a.betStructure);g.maxBetAmount=RSGame.getInstance().getGameData().getMaxBetValueForPoker(a.betStructure);if(this._tournamentMode){var h=RSEngine.gameData.getSheetData(a.betStructure),k=[],m=0,n;for(n in h)m=parseInt(h[n].tournamentRange)||0,k[m]||(k[m]=[]),k[m].push(h[n].value);this._params._betStructure=[];for(n in k)this._params._betStructure.push({ante:k[n],ante_limit:k[n][k[n].length-1]})}else{n={};h="[";k=this._params._betStructure[this._params._betStructure.length- 1].value;for(m=0;m<this._params._betStructure.length;m++)h+='"'+this._params._betStructure[m].value+'",';h=h.substr(0,h.length-1);n.ante=JSON.parse(h+"]");n.ante_limit=k;this._params._betStructure=[];this._params._betStructure.push(n)}g.betStructure=this._params._betStructure;g.royalFlushSubPayout=250;n=[];GlobalVars.isPurchaseEnabled&&RSEngine.loginMode!=LOGIN_MODE.GUEST&&(n=RSGame.getInstance().getGameData().getDonPacks());g.donPacks=n;g.payTable=RSGame.getInstance().getGameData().getSheetData(a.machine_payTable); g=btoa(encodeURIComponent(JSON.stringify(g)));this._params._machineData=g;this._params._gameURL=GameConfig.CONTENT_GAME_URL+a.machine_name+"\x26machineType\x3dCP\x26layout\x3diPhone5\x26orientation\x3dLandscape\x26casino\x3d"+GameConfig.CASINO_NAME+"\x26userID\x3d"+d+"\x26timeStamp\x3d"+e+"\x26coins\x3d"+c+"\x26hashValue\x3d"+f+"\x26volume\x3d"+b+"\x26machineHashValue\x3d\x26platform\x3dcanvas"}else"MSP"==a.gameCategory?(g={},g.machineAnalyticsID=a.machine_identifier,g.cheat=GlobalVars.isCheatActive, g.defaultBet=RSGame.getInstance().getGameData().getPokerDefaultBet(a.betStructure),g.maxBetAmount=RSGame.getInstance().getGameData().getMaxBetValueForPoker(a.betStructure),g.betStructure=RSGame.getInstance().getGameData().getBetStructure(a.betStructure),g.payTable=RSGame.getInstance().getGameData().getSheetData(a.machine_payTable),g.freeRideProbability=RSGame.getInstance().getGameData().getSheetData(a.machine_freeRideProbability),g=btoa(encodeURIComponent(JSON.stringify(g))),this._params._machineData= g,RSUtils.isStringContains(a.machine_identifier,"MSPT_")?this._params._gameURL=GameConfig.CONTENT_GAME_URL+a.machine_name+"\x26machineType\x3dMSPT\x26layout\x3diPhone5\x26orientation\x3dLandscape\x26casino\x3d"+GameConfig.CASINO_NAME+"\x26userID\x3d"+d+"\x26timeStamp\x3d"+e+"\x26coins\x3d"+c+"\x26hashValue\x3d"+f+"\x26volume\x3d"+b+"\x26platform\x3dcanvas":this._params._gameURL=GameConfig.CONTENT_GAME_URL+a.machine_name+"\x26machineType\x3dMSP\x26layout\x3diPhone5\x26orientation\x3dLandscape\x26casino\x3d"+ GameConfig.CASINO_NAME+"\x26userID\x3d"+d+"\x26timeStamp\x3d"+e+"\x26coins\x3d"+c+"\x26hashValue\x3d"+f+"\x26volume\x3d"+b+"\x26platform\x3dcanvas"):"MPP"==a.gameCategory&&(g={},g.cheat=GlobalVars.isCheatActive,g.handLayouts=a.handLayout?a.handLayout:["MPP5XCard","MPP10XCard","MPP15XCard","MPP25XCard"],g.payTable=RSGame.getInstance().getGameData().getSheetData(a.machine_payTable),g.machineAnalyticsID=a.machine_identifier,g.maxBetAmount=RSGame.getInstance().getGameData().getMaxBetValueForPoker(a.betStructure), g.defaultBet=RSGame.getInstance().getGameData().getPokerDefaultBet(a.betStructure),g.betStructure=RSGame.getInstance().getGameData().getBetStructure(a.betStructure),g=btoa(encodeURIComponent(JSON.stringify(g))),this._params._machineData=g,this._params._gameURL=GameConfig.CONTENT_GAME_URL+a.machine_name+"\x26machineType\x3dMPP\x26layout\x3diPhone5\x26orientation\x3dLandscape\x26casino\x3d"+GameConfig.CASINO_NAME+"\x26userID\x3d"+d+"\x26timeStamp\x3d"+e+"\x26coins\x3d"+c+"\x26hashValue\x3d"+f+"\x26volume\x3d"+ b+"\x26platform\x3dcanvas");a.gameCategory==CasinoExternalPokerGameType.DOD&&(GlobalVars.isInsideExternalGame=!0,b=RSEngine.dataManager.getMe().getImageUrl(),b=RSUtils.replaceWithString(b,"square","large"),c=RSEngine.loginMode===LOGIN_MODE.FACEBOOK?"facebook":"web",this._params._gameURL=GameConfig.DOD_GAME_URL+"?casinoId\x3d"+GameConfig.CASINO_NAME.toLowerCase()+"\x26playerId\x3d"+RSGame.getInstance().getUserDataManager().getMe().getId()+"\x26sessionToken\x3d"+RSGame.getInstance().getGameManager().getSpinGameToken()+ "\x26displayName\x3d"+RSEngine.dataManager.getMe().getUserFirstName()+"\x26imageUrl\x3d"+b+"\x26platform\x3d"+c,this._params._thirdPartyOwnerType=CasinoExternalPokerGameType.DOD,this._params._gameName=a.machine_name,this._params._analyticsID=a.machine_identifier);this._params._machine_largeIcon=a.machine_largeIcon;this._params._maxBetAmount=RSGame.getInstance().getGameData().getMaxBetValueForPoker(a.betStructure)},getMachineParam:function(){return this._params},getAnalyticsData:function(){return{gameType:this._gameType, from:this._triggeredFrom}}});var BlackjackMachineConfig=RSClass.extend({init:function(a,b){RSGame.getInstance().getGameManager().setCurrentMachineIsInternal(!0);RSGame.getInstance().getGameManager().setCurrentMachineVO(a);this._gameType=RSGameTypes.Blackjack;this._triggeredFrom=b;this._resArray=[];this._params={};this._gameType="BLACKJACK";this._machineData=a;this.machineClassName=null;this._super.init.call(this);this._params=new RSExternalGameParams;this._params._cheatActive=!1;this._params._giftedRoundCount=0;this._params._maxBetAmount= 0;this._params._gameType=RSGameTypes.Blackjack;this._params._betStructure=a.betStructure;var c=RSGame.getInstance().getUserDataManager().getMe().getCoins(),d=RSGame.getInstance().getUserDataManager().getMe().getId(),e=TimeManager.getInstance().getCurrentServerTime(),f={vo:GlobalVars.voiceCalloutsStatus,music:GlobalVars.musicStatus,effect:GlobalVars.sfxStatus},f=btoa(encodeURIComponent(JSON.stringify(f))),g=[];"BJ_BB"!=a.machine_identifier||GameConfig.BLACKJACK_V2||RSGame.getInstance().getUserDataManager().getCurrentBlackjackMachineTutorialStatus(a.machine_identifier)? "BJ_3H6D"==a.machine_identifier&&GameConfig.BLACKJACK_V2&&"TRUE"===a.enableTutorial&&!RSGame.getInstance().getUserDataManager().getCurrentBlackjackMachineTutorialStatus(a.machine_identifier)?g[0]="ThreeHandBlackjackTutorial":g[0]=this._machineData.machine_name:g[0]="BlazingBetsBlackjackTutorial";g[1]=e;g[2]=c;g[3]=d;var g=RSGame.getInstance().getGameManager().getHashValueForInternalGames(g),h={};h.machineAnalyticsID=a.machine_identifier;h.conditionlessDoubleDown=parseInt(a.conditionlessDoubleDown); h.drawOneCardAfterAcesSplit=parseInt(a.drawOneCardAfterAcesSplit);h.deckShufflePercent=parseFloat(a.deckShufflePercent);h.deckCount=parseInt(a.deckCount);h.splitMode=parseInt(a.splitMode);h.autoStandOn21=parseInt(a.autoStandOn21);h.cheat=GlobalVars.isCheatActive;GameConfig.BLACKJACK_V2?(h.defaultPlayerBet=RSGame.getInstance().getGameData().getDefaultBetForCasino(a.betStructure),h.maxPlayerBet=parseInt(RSGame.getInstance().getGameData().getMaxBetValueForBlackjack(a.betStructure,RSGame.getInstance().getLevelManager().getCurrentLevel())), h.enableChipScroll=parseInt(a.machine_enableChipScroll),h.chipSet=RSGame.getInstance().getGameData().getChipSetArrayForBlackjack(a.machine_identifier),h.maxChipUnlocked=RSGame.getInstance().getGameData().getMaxChipUnlocked(a.machine_identifier),this._gameType="BLACKJACK_V2",this._params._maxBetAmount=h.maxPlayerBet):(h.defaultBet=parseInt(this.getBlackJackDefaultBet(a.betStructure)),h.maxBetAmount=parseInt(RSGame.getInstance().getGameData().getMaxBetValueForBlackjack(a.betStructure,RSGame.getInstance().getLevelManager().getCurrentLevel())), h.betStructure=this.getBlackJackBetValues(a.betStructure),this._params._maxBetAmount=h.maxBetAmount);switch(a.machine_identifier){case "BJ_3H6D":h.sideBetPayTable="";!RSGame.getInstance().getUserDataManager().getCurrentBlackjackMachineTutorialStatus(a.machine_identifier)&&GameConfig.BLACKJACK_V2&&"TRUE"===a.enableTutorial?(RSGame.getInstance().getUserDataManager().getMe().setBlackjackTutorialShownStatus(a.machine_identifier),this.setMachineClassName("ThreeHandBlackjackTutorial")):this.setMachineClassName(this._machineData.machine_name); break;case "BJ_3H1D":h.sideBetPayTable="";this.setMachineClassName(this._machineData.machine_name);break;case "BJ_BB":h.sideBetPayTable=this.getBlazingBetsSideBets(a.sideBets),RSGame.getInstance().getUserDataManager().getCurrentBlackjackMachineTutorialStatus(a.machine_identifier)||GameConfig.BLACKJACK_V2?this.setMachineClassName(this._machineData.machine_name):(RSGame.getInstance().getUserDataManager().getMe().setBlackjackTutorialShownStatus(a.machine_identifier),this.setMachineClassName("BlazingBetsBlackjackTutorial"))}this._params.machine_identifier= a.machine_identifier;this._params._machineData=btoa(encodeURIComponent(JSON.stringify(h)));this._params._screenName=this.getMachineClassName();this._params._gameURL=GameConfig.CONTENT_GAME_URL+this.getMachineClassName()+"\x26machineType\x3d"+this._gameType+"\x26layout\x3diPhone5\x26orientation\x3dLandscape\x26casino\x3d"+GameConfig.CASINO_NAME+"\x26userID\x3d"+d+"\x26timeStamp\x3d"+e+"\x26coins\x3d"+c+"\x26hashValue\x3d"+g+"\x26volume\x3d"+f+"\x26platform\x3dcanvas"},getTutorialReward:function(){return this._machineData.tutorialReward}, setMachineClassName:function(a){this.machineClassName=a},getMachineClassName:function(){return this.machineClassName},getBlazingBetsSideBets:function(a){var b={};a=RSGame.getInstance().getGameData().getSheetData(a)[0];for(var c=["poker21","betAPair","royalCrown","lovelyLadies","getLucky"],d=0;d<c.length;d++){var e=RSUtils.cloneJSON(a[c[d]]),f=e.pays,f=RSGame.getInstance().getGameData().getSheetData(f);e.pays=RSUtils.cloneJSON(f);b[c[d]]=e}return b},getBlackJackDefaultBet:function(a){a=RSGame.getInstance().getGameData().getSheetData(a); var b=a[0].defaultBet,c=RSGame.getInstance().getUserDataManager().getMe().getCoins(),d=RSGame.getInstance().getLevelManager().getCurrentLevel(),e;for(e in a){var f=a[e].levels;c>=a[e].coinBalanceLimit&&d>=f&&(b=a[e].defaultBet)}return b},getBlackJackBetValues:function(a){a=RSGame.getInstance().getGameData().getSheetData(a);for(var b=[],c=0;c<a.length;c++){var d=parseInt(a[c].betValues);b.push(d)}return b},getResourceList:function(){return this._resArray},getMachineParam:function(){return this._params}, getAnalyticsData:function(){return{gameType:this._gameType,from:this._triggeredFrom}}});var KenoMachineConfig=RSClass.extend({init:function(a,b){2==parseInt(a.gameType)?RSGame.getInstance().getGameManager().setCurrentMachineIsInternal(!0):RSGame.getInstance().getGameManager().setCurrentMachineIsInternal(!1);this._gameType=RSGameTypes.Keno;this._triggeredFrom=b;this._resArray=[];this._params={};this._super.init.call(this);RSGame.getInstance().getGameManager().setCurrentMachineVO(a);this._params=new RSExternalGameParams;this._params._gameType=this._gameType;this._params._gameName=a.machine_name; var c=RSGame.getInstance().getUserDataManager().getMe().getId();this._params._soundFlag=GlobalVars.sfxStatus&&GlobalVars.musicStatus;this._params._analyticsID=a.machine_identifier;this._params.machine_identifier=a.machine_identifier;this._params._thirdPartyOwnerType=parseInt(a.gameType);var d=RSGame.getInstance().getGameManager().getSpinGameToken(),e=RSGame.getInstance().getGameData().getKenoFullBetStructureByName(a.machine_identifier),f=RSGame.getInstance().getGameData().getKenoBetStructureByName(a.machine_identifier, RSGame.getInstance().getLevelManager().getCurrentLevel());this._params._betIndex=0;this._params._betStructure=f;if(0==parseInt(a.gameType))GameConfig.SPIN_MAINTENANCE_URL?this._params._gameURL=GameConfig.SPIN_MAINTENANCE_URL:(GlobalVars.isInsideExternalGame=!0,this._params._gameURL=GameConfig.SPIN_GAME_URL+"launch?gameId\x3d"+this._params._gameName+"\x26sessionToken\x3d"+d+"\x26site\x3d"+GameConfig.SPIN_GAME_SITE+"\x26playerId\x3d"+c);else if(1==parseInt(a.gameType))GameConfig.SPIN_MAINTENANCE_URL? this._params._gameURL=GameConfig.SPIN_MAINTENANCE_URL:(GlobalVars.isInsideExternalGame=!0,this._params._gameURL=GameConfig.SPIN_GAME_URL+"launch?gameId\x3d"+this._params._gameName+"\x26sessionToken\x3d"+d+"\x26site\x3d"+GameConfig.SPIN_GAME_SITE+"\x26playerId\x3d"+c);else if(2==parseInt(a.gameType)){this._params._betStructure=e;var d=a.machine_name,g=RSGame.getInstance().getUserDataManager().getMe().getCoins(),c=RSGame.getInstance().getUserDataManager().getMe().getId(),h={vo:GlobalVars.voiceCalloutsStatus, music:GlobalVars.musicStatus,effect:GlobalVars.sfxStatus},h=btoa(encodeURIComponent(JSON.stringify(h))),k=TimeManager.getInstance().getCurrentServerTime(),m=parseInt(a.isPortrait)?"Portrait":"Landscape",n={machineAnalyticsID:"",cheat:0,defaultBet:0,maxBetAmount:0,betStructure:[]};n.machineAnalyticsID=a.machine_identifier;n.betStructure=e;n.defaultBet=RSGame.getInstance().getGameData().getDefaultBetForCasino("machineBets",a.machine_identifier);n.maxBetAmount=parseInt(f[f.length-1]);n.cheat=GlobalVars.isCheatActive; this._params._machineData=btoa(encodeURIComponent(JSON.stringify(n)));this._params._maxBetAmount=n.maxBetAmount;this._params._screenName=d;this._params._defaultBet=n.defaultBet;e=this._getHashValue(this._params._screenName,k,g,c);f=RSGame.getInstance().getGameData().getKenoRGSGameUrl(2,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1);null==f&&(f=GameConfig.CONTENT_GAME_URL);this._params._gameURL=f+d+"\x26machineType\x3dKENO\x26layout\x3diPhone5\x26orientation\x3d"+m+"\x26casino\x3d"+GameConfig.CASINO_NAME+ "\x26userID\x3d"+c+"\x26timeStamp\x3d"+k+"\x26coins\x3d"+g+"\x26hashValue\x3d"+e+"\x26volume\x3d"+h+"\x26platform\x3dcanvas"}},getResourceList:function(){return this._resArray},getMachineParam:function(){return this._params},getAnalyticsData:function(){return{gameType:this._gameType,from:this._triggeredFrom}},_getHashValue:function(a,b,c,d){return a=calcMD5(a+"|"+b+"|"+c+"|"+d+"_z2uy39283ye2n8mz92phdfp2")}});var RouletteMachineConfig=RSClass.extend({init:function(a,b){RSGame.getInstance().getGameManager().setCurrentMachineIsInternal(!0);this._gameType=RSGameTypes.Roulette;this._triggeredFrom=b;this._params={};this._super.init.call(this);RSGame.getInstance().getGameManager().setCurrentMachineVO(a);this._params=new RSExternalGameParams;this._params._gameType=this._gameType;this._params._gameName=a.machine_name;var c=RSGame.getInstance().getUserDataManager().getMe().getId();this._params._soundFlag=GlobalVars.sfxStatus&& GlobalVars.musicStatus;this._params._analyticsID=a.machine_identifier;this._params.machine_identifier=a.machine_identifier;this._params._thirdPartyOwnerType=a.gameType;var c=this.getRouletteBetValues("rouletteBetValues"),d=RSGame.getInstance().getGameData().getRouletteBetStructureByName(a.machine_identifier,RSGame.getInstance().getLevelManager().getCurrentLevel());this._params._betIndex=0;this._params._betStructure=c;var e=a.machine_name,f=RSGame.getInstance().getUserDataManager().getMe().getCoins(), c=RSGame.getInstance().getUserDataManager().getMe().getId(),g={vo:GlobalVars.voiceCalloutsStatus,music:GlobalVars.musicStatus,effect:GlobalVars.sfxStatus},g=btoa(encodeURIComponent(JSON.stringify(g))),h=TimeManager.getInstance().getCurrentServerTime(),k=parseInt(a.isPortrait)?"Portrait":"Landscape",m={machineAnalyticsID:"",cheat:0,defaultPlayerBet:0,maxBetAmount:0,maxChipUnlocked:0,chipSet:[]};m.machineAnalyticsID=a.machine_identifier;m.cheat=GlobalVars.isCheatActive;m.defaultPlayerBet=RSGame.getInstance().getGameData().getDefaultBetForCasino("rouletteBetValues"); m.maxBetAmount=parseInt(d[d.length-1]);m.maxChipUnlocked=RSGame.getInstance().getGameData().getRouletteMaxChipUnlocked(a.machine_identifier);m.chipSet=RSGame.getInstance().getGameData().getChipSetArrayForRoulette();this._params._machineData=btoa(encodeURIComponent(JSON.stringify(m)));this._params._maxBetAmount=m.maxBetAmount;this._params._screenName=e;d=this._getHashValue(this._params._screenName,h,f,c);this._params._gameURL=GameConfig.CONTENT_GAME_URL+e+"\x26coins\x3d"+f+"\x26userID\x3d"+c+"\x26layout\x3diPhone5\x26orientation\x3d"+ k+"\x26dualOrientation\x3dfalse\x26volume\x3d"+g+"\x26machineType\x3dROULETTE\x26hashValue\x3d"+d+"\x26casino\x3d"+GameConfig.CASINO_NAME+"\x26timeStamp\x3d"+h+"\x26platform\x3dcanvas"},getMachineParam:function(){return this._params},getAnalyticsData:function(){return{gameType:this._gameType,from:this._triggeredFrom}},getRouletteBetValues:function(a){a=RSGame.getInstance().getGameData().getSheetData(a);for(var b=[],c=0;c<a.length;c++){var d=parseInt(a[c].betValues);b.push(d)}return b},_getHashValue:function(a, b,c,d){return a=calcMD5(a+"|"+b+"|"+c+"|"+d+"_z2uy39283ye2n8mz92phdfp2")}});var TRIVIA_XP_EVENT="TRIVIA_XP",TRIVIA_GAME_ACTION="trivia_game_action",CasinoTriviaParams=function(){this._machineAssetFolder="";this._analytics=this._facts=null;this._cheatActive=!1;this._playerImage=this._playerName=this._gameName=this._appKey=this._appId=this._pusherAppKey=this._socketURL=this._qStackURL=null},TriviaMachineConfig=RSClass.extend({init:function(a,b){RSGame.getInstance().getGameManager().setCurrentMachineIsInternal(!0);this._gameType=RSGameTypes.Trivia;this._triggeredFrom=b;this._resArray= [];this._params={};this._super.init.call(this);RSGame.getInstance().getGameManager().setCurrentMachineVO(a);RSGame.getInstance().getGameManager().getSlotMachineRootPath();RSGame.getInstance().getGameManager().getContentResourceRootFolder();this._params=new CasinoTriviaParams;this._params._machineAssetFolder=a.machineAssetFolder;this._params._cheatActive=GlobalVars.isCheatActive;this._params._machineAnalyticsID=a.machine_identifier;this._params._facts=this._getSheetData("triviaFacts");this._params._analytics= this._getSheetData("triviaCategory");this._params._qStackURL="https://userserver.purplegator.net";this._params._socketURL=GlobalVars.isCheatActive?a.socketStage:a.socketLive;this._params._pusherAppKey=a.pusherAppKey;this._params._appId=a.appId;this._params._appKey=a.appKey;this._params._gameName=GlobalVars.isCheatActive?a.gameNameStage:a.gameNameLive;this._params._playerImage=RSEngine.dataManager.getMe().getImageUrl();this._params._playerName=RSEngine.dataManager.getMe().getUserFirstName();this._resArray.push(this._params._machineAssetFolder); var c=RSGame.getInstance().getUserDataManager().getMe().getCoins(),d=RSGame.getInstance().getUserDataManager().getMe().getId(),e=TimeManager.getInstance().getCurrentServerTime(),f={vo:GlobalVars.voiceCalloutsStatus,music:GlobalVars.musicStatus,effect:GlobalVars.sfxStatus},f=JSON.stringify(f),g=this._getHashValue("Trivia",e,c,d),h={};h.qStackURL=GlobalVars.isCheatActive?a.qStackStage:a.qStackLive;h.socketURL=GlobalVars.isCheatActive?a.socketStage:a.socketLive;h.pusherAppKey=a.pusherAppKey;h.appId= a.appId;h.appKey=a.appKey;h.gameName=GlobalVars.isCheatActive?a.gameNameStage:a.gameNameLive;h.playerName=RSEngine.dataManager.getMe().getUserFirstName();h.playerImage=RSEngine.dataManager.getMe().getImageUrl();h.machineAnalyticsID=a.machine_identifier;h.cheat=GlobalVars.isCheatActive;h.betStructure=[2500,25E3,25E4];h.facts=this._getSheetData("triviaFacts");h.analytics=this._getSheetData("triviaCategory");h=JSON.stringify(h);this._params._machineData=h;this._params._screenName="Trivia";this._params._gameURL= GameConfig.CONTENT_GAME_URL+"Trivia\x26coins\x3d"+c+"\x26userID\x3d"+d+"\x26layout\x3diPhone5\x26orientation\x3dLandscape\x26volume\x3d"+f+"\x26machineType\x3dTRIVIA\x26hashValue\x3d"+g+"\x26machineHashValue\x3d\x26casino\x3dLuckyNorthCasino\x26timeStamp\x3d"+e},getResourceList:function(){return this._resArray},getMachineParam:function(){return this._params},getAnalyticsData:function(){return{gameType:this._gameType,from:this._triggeredFrom}},_getSheetData:function(a){return RSEngine.gameData.getSheetData(a)}, _getHashValue:function(a,b,c,d){return a=calcMD5(a+"|"+b+"|"+c+"|"+d+"_z2uy39283ye2n8mz92phdfp2")}});var BingoMachineConfig=RSClass.extend({init:function(a,b){RSGame.getInstance().getGameManager().setCurrentMachineIsInternal(!0);this._gameType=RSGameTypes.Bingo;this._triggeredFrom=b;this._params={};this._super.init.call(this);var c={},d={};GlobalVars.voiceCalloutsStatus=GlobalVars.sfxStatus;var e={vo:GlobalVars.voiceCalloutsStatus,music:GlobalVars.musicStatus,effect:GlobalVars.sfxStatus},e=btoa(encodeURIComponent(JSON.stringify(e))),f=RSCasinoManager.getPrimaryCurrency(),g=RSGame.getInstance().getUserDataManager().getMe().getId(), h=TimeManager.getInstance().getCurrentServerTime(),k=this._getHashValue("BINGO",h,f,g);d.firstName=RSEngine.dataManager.getMe().getUserFirstName();d.imageURL=RSEngine.dataManager.getMe().getImageUrlForBingo();d.coins=RSGame.getInstance().getUserDataManager().getMe().getCoins();d.userId=RSGame.getInstance().getUserDataManager().getUserIdForBingo();d.cheat=GameConfig.CHEAT_MODE;d.colorAfterDaub=a.color_after_daub;c.primaryCurrency=f;c.powerUps=RSEngine.dataManager.getMe().getPowerUps();c.daubAlertTime= RSGame.getInstance().getUserDataManager().getMe().getDaubAlertTime();c.machine_identifier=a.machine_identifier;c.profile=d;c.configPath=a.machine_configPath;c.assetURL=a.machine_assetURL;c.machineFolder=a.machine_machineAssetFolder;c.commonFolder=a.machine_commonFolder;c.loadingAssetFolder=a.machine_loadingScreenFolder;c.bingoConfigServerPath=GameConfig.BINGO_CONFIG_SERVER_PATH;c.isTutorialEnabled=a.isTutorialEnabled;this._params._screenName="BINGO";this._params._gameURL=GameConfig.BINGO_MACHINE_URL+ "\x26machineName\x3dBINGO\x26coins\x3d"+f+"\x26gameName\x3d"+GameConfig.GAME_ID+"\x26userID\x3d"+g+"\x26layout\x3diPhone5\x26hashValue\x3d"+k+"\x26volume\x3d"+e+"\x26timeStamp\x3d"+h+"\x26hudHeight\x3d0\x26loadingAssetFolder\x3d"+c.loadingAssetFolder+"\x26casino\x3dBINGO\x26machineType\x3dBINGO\x26machineData\x3d"+JSON.stringify(c);this._params._machineType="BINGO";this._params.machine_identifier=c.machine_identifier;this._params._machineData=c},getResourceList:function(){return this._resArray},getMachineParam:function(){return this._params}, getAnalyticsData:function(){return{gameType:this._gameType,from:this._triggeredFrom}},_getSheetData:function(a){return RSEngine.gameData.getSheetData(a)},_getHashValue:function(a,b,c,d){return a=calcMD5(a+"|"+b+"|"+c+"|"+d+"_z2uy39283ye2n8mz92phdfp2")}});var ScratcherMachineConfig=RSClass.extend({init:function(a,b){RSGame.getInstance().getGameManager().setCurrentMachineIsInternal(!0);this._gameType=RSGameTypes.Scratcher;this._triggeredFrom=b;this._params={};this._super.init.call(this);RSGame.getInstance().getGameManager().setCurrentMachineVO(a);this._params=new RSExternalGameParams;this._params._gameType=this._gameType;this._params._gameName=a.machine_name;var c=RSGame.getInstance().getUserDataManager().getMe().getId();this._params._soundFlag=GlobalVars.sfxStatus&& GlobalVars.musicStatus;this._params._analyticsID=a.machine_identifier;this._params.machine_identifier=a.machine_identifier;this._params._thirdPartyOwnerType=1;c=RSGame.getInstance().getGameData().getScratcherBetStructureByName(a.machine_identifier);RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots);RSGame.getInstance().getGameData().getScratcherBetStructureByName(a.machine_identifier,RSGame.getInstance().getLevelManager().getCurrentLevel());this._params._betIndex=0;this._params._betStructure= c;var d=a.machine_name,e=RSGame.getInstance().getUserDataManager().getMe().getCoins(),c=RSGame.getInstance().getUserDataManager().getMe().getId(),f={vo:GlobalVars.voiceCalloutsStatus,music:GlobalVars.musicStatus,effect:GlobalVars.sfxStatus},f=btoa(encodeURIComponent(JSON.stringify(f))),g=TimeManager.getInstance().getCurrentServerTime(),h=parseInt(a.isPortrait)?"Portrait":"Landscape",k={machineAnalyticsID:"",machineID:0,betAmount:0,cheat:0};k.machineAnalyticsID=a.machine_identifier;k.machineID=parseInt(a.id); k.cheat=GlobalVars.isCheatActive;k.betAmount=RSGame.getInstance().getGameData().getDefaultBetForCasino("scratcherBetValues",a.machine_identifier);this._params._machineData=btoa(encodeURIComponent(JSON.stringify(k)));this._params._maxBetAmount=k.betAmount;this._params._screenName=d;this._params._betAmount=k.betAmount;k=this._getHashValue(this._params._screenName,g,e,c);this._params._gameURL=GameConfig.CONTENT_GAME_URL+d+"\x26coins\x3d"+e+"\x26userID\x3d"+c+"\x26layout\x3diPhone5\x26orientation\x3d"+ h+"\x26dualOrientation\x3dfalse\x26volume\x3d"+f+"\x26machineType\x3dSCRATCHER\x26hashValue\x3d"+k+"\x26casino\x3d"+GameConfig.CASINO_NAME+"\x26timeStamp\x3d"+g+"\x26platform\x3dcanvas"},getMachineParam:function(){return this._params},getAnalyticsData:function(){return{gameType:this._gameType,from:this._triggeredFrom}},_getHashValue:function(a,b,c,d){return a=calcMD5(a+"|"+b+"|"+c+"|"+d+"_z2uy39283ye2n8mz92phdfp2")}});var TableGamesGameType={ODDS_WORKS_GAME:9},TableGamesMachineConfig=RSClass.extend({init:function(a,b){RSGame.getInstance().getGameManager().setCurrentMachineIsInternal(!1);this._gameType=RSGameTypes.TableGames;this._triggeredFrom=b;this._params={};this._super.init.call(this);RSGame.getInstance().getGameManager().setCurrentMachineVO(a);switch(parseInt(a.gameType)){case TableGamesGameType.ODDS_WORKS_GAME:GlobalVars.isInsideExternalGame=!0;this.setExternalParams(a);var c=RSGame.getInstance().getGameManager().getOddsWorksGameToken(), c=c+("|"+a.screenName+"|TG"),d=RSGame.getInstance().getGameData().getTableGamesRGSGameUrl(TableGamesGameType.ODDS_WORKS_GAME,GameConfig.LIVE_MODE?GameConfig.LIVE_MODE:!1),d=RSUtils.replaceWithString(d,"game_ID",a.screenName),d=RSUtils.replaceWithString(d,"users_ID",RSEngine.dataManager.getMe().getId()),d=RSUtils.replaceWithString(d,"OddsWorksToken",c),d=RSUtils.replaceWithString(d,"gameOrigin",GameConfig.BASE_URL);this._params._defaultBet=parseInt(RSGame.getInstance().getGameData().getDefaultBetForCasino("tableMachineBetValues", a.machine_identifier));this._params._gameURL=encodeURI(d)}},setExternalParams:function(a){this._params=new RSExternalGameParams;this._params._gameType=RSGameTypes.TableGames;this._params._gameName=a.screenName;this._params._betLineCount=parseInt(a.payLines);this._params._soundFlag=GlobalVars.sfxStatus&&GlobalVars.musicStatus;this._params._analyticsID=a.machine_identifier;this._params.machine_identifier=a.machine_identifier;this._params._thirdPartyOwnerType=a.gameType;GlobalVars.winLinesInTheCurrentSlotMachine= a.payLines},getMachineParam:function(){return this._params},getAnalyticsData:function(){return{gameType:this._gameType,from:this._triggeredFrom}},_getHashValue:function(a,b,c,d){return a=calcMD5(a+"|"+b+"|"+c+"|"+d+"_z2uy39283ye2n8mz92phdfp2")}});var RSGridView=cc.TableView.extend({ctor:function(a,b,c){cc.TableView.prototype.ctor.call(this,a,b,c);this._verticalPadding=this._horizontalPadding=this._colNum=this._rowNum=0;this._vCellsPositions=[];this._maxColIdx=this._maxRowIdx=0;this._colToIndexMap=[];this._cellSize=cc.size(0,0);this._cellCount=0;this._margin={left:0,top:0,right:0,bottom:0};this.setVerticalFillOrder(cc.TABLEVIEW_FILL_TOPDOWN)},setMargin:function(a){a&&(this._margin=a)},getMargin:function(){return this._margin},setPadding:function(a, b){void 0===a?this._verticalPadding=this._horizontalPadding=0:void 0==b?(this._horizontalPadding=a,this._verticalPadding=0):(this._verticalPadding=b,this._horizontalPadding=a)},getPadding:function(){return cc.p(this._horizontalPadding,this._verticalPadding)},_updateContentSize:function(){var a=cc.size(0,0);this._cellCount=this._dataSource.numberOfCellsInTableView(this);if(0<this._cellCount){this._cellSize=this._dataSource.tableCellSizeForIndex(this,0);if(0===this._colNum&&0===this._rowNum){cc.log("col or row must be non zero"); return}switch(this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:a=Math.max(this._viewSize.width,(this._maxColIdx+1)*(this._cellSize.width+this._horizontalPadding)+this._margin.left+this._margin.right);a=cc.size(a,this._viewSize.height);break;default:a=cc.size(this._viewSize.width,this._viewSize.height)}}this.setContentSize(a);this._oldDirection!==this._direction&&(this._direction===cc.SCROLLVIEW_DIRECTION_HORIZONTAL?this.setContentOffset(cc.p(0,0)):this.setContentOffset(cc.p(0,this.minContainerOffset().y)), this._oldDirection=this._direction)},setRowCount:function(a){this._rowNum=a},setColumnCount:function(a){this._colNum=a},__offsetFromIndex:function(a){return cc.p(this._vCellsPositions[a].x,this._vCellsPositions[a].y)},__indexFromOffset:function(a){var b=-1;switch(this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:var c=0;if(0<this._margin.left){if(a.x<this._margin.left)return-1;a.x-=this._margin.left;c=this.colFromOffset(a);if(c>=this._maxColIdx&&(this._cellSize=this._dataSource.tableCellSizeForIndex(this, 0),a.x+this._margin.left>(this._maxColIdx+1)*(this._cellSize.width+this._horizontalPadding)+this._margin.left))return-1}else c=this.colFromOffset(a);1<this._colToIndexMap[c].length?(a=this.rowFromOffset(a)%this._rowNum,b=this._colToIndexMap[c][a]):b=this._colToIndexMap[c];break;default:a=Math.floor(a.y/(this._cellSize.height+2*this._verticalPadding)),b=a-1+this._rowNum*c}return b},_updateCellPositions:function(){this._cellCount=this._dataSource.numberOfCellsInTableView(this);if(0<this._cellCount){this._cellSize= this._dataSource.tableCellSizeForIndex(this,0);var a=this._cellCount;for(this._maxRowIdx=this._maxColIdx=0;a--;)this._vCellsPositions[a]=cc.p(0,0);if(0!==this._rowNum||0!==this._colNum){var a=this._horizontalPadding+this._margin.left,b=this._verticalPadding+this._margin.top;switch(this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:this._maxRowIdx=this._rowNum-1;for(var c=0,d=0;c<this._cellCount;c++){0!==d&&(0===d%this._rowNum?(b=this._verticalPadding,a+=this._cellSize.width+this._horizontalPadding, this._maxColIdx++):this._dataSource.tableCellSizeForIndex(this,c).height>this._cellSize.height?(b=this._verticalPadding,a+=this._cellSize.width+this._horizontalPadding,this._maxColIdx++,d=0):b+=this._cellSize.height+this._verticalPadding);var e=d%this._rowNum;this._colToIndexMap[this._maxColIdx]||(this._colToIndexMap[this._maxColIdx]=[]);this._colToIndexMap[this._maxColIdx].push(c);this._dataSource.tableCellAtIndex(this,c).setRowAndCol(e,this._maxColIdx);this._vCellsPositions[c]=cc.p(a,b);this._dataSource.tableCellSizeForIndex(this, c).height>this._cellSize.height?d+=2:d++}}}}},getPositionOffsetFor:function(a){var b=0;switch(this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:this._vCellsPositions.length>a&&(b=this._vCellsPositions[a].x)}return b},colOfIndex:function(a){return this._dataSource.tableCellAtIndex(this,a).getCol()},rowOfIndex:function(a){return this._dataSource.tableCellAtIndex(this,a).getRow()},maxRowIdx:function(){return this._maxRowIdx},maxColIdx:function(){return this._maxColIdx},rowFromOffset:function(a){this._cellSize= this._dataSource.tableCellSizeForIndex(this,0);a=Math.floor(a.y/(this._cellSize.height+2*this._verticalPadding));0>a?a=0:a>this.maxRowIdx()&&(a=this.maxRowIdx());return a},colFromOffset:function(a){this._cellSize=this._dataSource.tableCellSizeForIndex(this,0);a=Math.floor(a.x/(this._cellSize.width+this._horizontalPadding));0>a?a=0:a>this.maxColIdx()&&(a=this.maxColIdx());return a},updateCellAtIndex:function(a){if(!(a===cc.INVALID_INDEX||a>this._dataSource.numberOfCellsInTableView(this)-1)){var b= this.cellAtIndex(a);b&&this._moveCellOutOfSight(b);b=this._dataSource.tableCellAtIndex(this,a);b.enableEvent.call(b);this._setIndexForCell(a,b);this._addCellIfNecessary(b)}},scrollViewDidScroll:function(a){if(0!==this._dataSource.numberOfCellsInTableView(this)){null!==this._tableViewDelegate&&this._tableViewDelegate.scrollViewDidScroll&&this._tableViewDelegate.scrollViewDidScroll(this);var b=0,c=0;a=0;a=this.getContentOffset();a.x*=-1;a.y*=-1;switch(this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:b= this.getContainer();this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN&&(a.y+=this._viewSize.height/b.getScaleY());c=this.colFromOffset(a);a.y=this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN?a.y-this._viewSize.height/b.getScaleY():a.y+this._viewSize.height/b.getScaleY();a.x+=this._viewSize.width/b.getScaleX();a=this.colFromOffset(a);if(0<this._cellsUsed.count())for(var d=this._cellsUsed.objectAtIndex(0),b=d.getIdx();this.colOfIndex(b)<c;)if(this._moveCellOutOfSight(d),0<this._cellsUsed.count())d=this._cellsUsed.objectAtIndex(0), b=d.getIdx();else break;if(0<this._cellsUsed.count())for(d=this._cellsUsed.lastObject(),b=d.getIdx();this.colOfIndex(b)<=this._maxColIdx&&this.colOfIndex(b)>a;)if(this._moveCellOutOfSight(d),0<this._cellsUsed.count())d=this._cellsUsed.lastObject(),b=d.getIdx();else break;for(b=!1;c<=a;c++)if(this._colToIndexMap[c])for(d=0;d<this._colToIndexMap[c].length;d++){var e=this._colToIndexMap[c][d];-1===this._indices.indexOf(e)&&(this.updateCellAtIndex(e),b=!0)}if(b)this._tableViewDelegate.onTableScrolled(this)}}}, onTouchEnded:function(a,b){if(this.isVisible()){if(this._touchedCell){var c=this.getBoundingBox(),d=cc.p(c.x,c.y),d=this._parent.convertToWorldSpace(d);c.x=d.x;c.y=d.y;d=this._tableViewDelegate;cc.rectContainsPoint(c,a.getLocation())&&null!==d&&(d.tableCellUnhighlight&&d.tableCellUnhighlight(this,this._touchedCell),d.tableCellTouched&&d.tableCellTouched(this,this._touchedCell,a.getLocation()));this._touchedCell=null}cc.ScrollView.prototype.onTouchEnded.call(this,a,b)}},onTouchBegan:function(a,b){for(var c= this;null!=c;c=c.parent)if(!c.isVisible())return!1;c=cc.ScrollView.prototype.onTouchBegan.call(this,a,b);if(1===this._touches.length){var d;d=this.getContainer().convertTouchToNodeSpace(a);d=this._indexFromOffset(d);(this._touchedCell=d===cc.INVALID_INDEX?null:this.cellAtIndex(d))&&null!==this._tableViewDelegate&&this._tableViewDelegate.tableCellHighlight&&this._tableViewDelegate.tableCellHighlight(this,this._touchedCell)}else this._touchedCell&&(null!==this._tableViewDelegate&&this._tableViewDelegate.tableCellUnhighlight&& this._tableViewDelegate.tableCellUnhighlight(this,this._touchedCell),this._touchedCell=null);return c},onTouchMoved:function(a,b){cc.ScrollView.prototype.onTouchMoved.call(this,a,b);this._touchedCell&&this.isTouchMoved()&&(null!==this._tableViewDelegate&&this._tableViewDelegate.tableCellUnhighlight&&this._tableViewDelegate.tableCellUnhighlight(this,this._touchedCell),this._touchedCell=null)},onTouchCancelled:function(a,b){cc.ScrollView.prototype.onTouchCancelled.call(this,a,b);this._touchedCell&& (null!==this._tableViewDelegate&&this._tableViewDelegate.tableCellUnhighlight&&this._tableViewDelegate.tableCellUnhighlight(this,this._touchedCell),this._touchedCell=null)}});var RSGridViewCell=cc.TableViewCell.extend({ctor:function(a,b){this._super();this._size=this._content=null;this._col=this._row=-1;this.rsObject=null;this.setAnchorPoint(0,0);this.setPosition(0,0);this.setContent(a,b)},getSize:function(){return this.getContentSize()},getContent:function(){return this._content},setContent:function(a,b){this.rsObject=b;this._content=this.rsObject instanceof RSDisplayObject?b.getDisplayObject():this.rsObject;this._size=this._content.getContentSize();this.setContentSize(this._size); this._content.setAnchorPoint(0,0);this._content.setPosition(0,0);this.addChild(this._content);this.setIdx(a)},hasClickListener:function(a){var b=cc.eventManager._nodeListenersMap[a.__instanceId];if(b){for(var c=cc.copyArray(b),d=0,b=c.length;d<b;d++)if("__cc_touch_one_by_one"==c[d]._listenerID)return!0;a=a.getChildren();d=0;for(b=a.length;d<b;d++)if(this.hasClickListener(a[d]))return!0}},enableEvent:function(){this.rsObject.enableEvent&&this.rsObject.enableEvent.call(this.rsObject)},tableCellTouched:function(a){this.rsObject.tableCellTouched&& this.rsObject.tableCellTouched.call(this.rsObject,a)},setVisible:function(a){var b=this._content.getChildByName("touchArea");b&&b.setVisible(a);this.rsObject.setVisible(a);cc.TableViewCell.prototype.setVisible.call(this,a)},setRow:function(a){this._row=a},getRow:function(){return this._row},setCol:function(a){this._col=a},getCol:function(){return this._col},setRowAndCol:function(a,b){this._col=b;this._row=a},unload:function(){delete this._content;this._content=null;this.removeFromParent(!0)}});var RSGridViewDataSource=cc.TableViewDataSource.extend({ctor:function(a){this._elements=new cc.ArrayForObjectSorting;if(a)for(var b=0;b<this.list.length;b++){var c=new RSGridViewCell(b,a[b]);this._elements.addObject(c)}},getElements:function(){return this._elements},addElement:function(a){a=new RSGridViewCell(this._elements.count(),a);this._elements.addObject(a)},tableCellSizeForIndex:function(a,b){return this._elements.objectAtIndex(b).getSize()},cellSizeForTable:function(a){return cc.size(0,0)}, tableCellAtIndex:function(a,b){return this._elements.objectAtIndex(b)},numberOfCellsInTableView:function(a){return this._elements.count()},unload:function(){for(var a=0;a<this._elements.count();a++){var b=this._elements.objectAtIndex(a);b instanceof RSDisplayObject?b.getDisplayObject().removeFromParent(!0):b.removeFromParent(!0);b.unload()}delete this._elements;this._elements=null}});var RSScrollHolderLayer=cc.Layer.extend({ctor:function(a,b,c){cc.Layer.prototype.ctor.call(this);this._maxOffset=this._slider=this._viewSize=this._tableView=this._dataSource=null;this._scrollDirection=0;this._scrollerSize=null;this._tempList=[];this._viewSize=cc.size(0,0);this._autoScrollEndValue=this._autoScrollStartValue=this._atuoScrollDuration=0;this._autoScrollAction=null;this._autoScrollActive=!1;this._autoScrollCompleteCallBack=null;this._isCenterAlign=!1;b&&(b=new cc.Sprite(b),c=void 0=== c?b.getTextureRect():c,b.setScaleX(a.width/c.width),b.setScaleY(a.height/c.height),this.addChild(b));this._viewSize.width=a.width;this._viewSize.height=a.height},initializeScroller:function(a,b,c,d,e,f,g){this._scrollerSize=cc.size(0,0);this._scrollerSize.width=a.width;this._scrollerSize.height=a.height;this._scrollDirection=void 0===b?cc.SCROLLVIEW_DIRECTION_HORIZONTAL:b;c=void 0===c?1:c;this._dataSource=new RSGridViewDataSource;this._tableView=new RSGridView(this._dataSource,a);this._tableView.setDelegate(this); this._tableView.setPadding(e,f);this._tableView.setMargin(g);this._isCenterAlign=d;this._scrollDirection==cc.SCROLLVIEW_DIRECTION_HORIZONTAL?this._tableView.setRowCount(c):this._tableView.setColumnCount(c);this._tableView.setPosition(0.5*-a.width,0.5*-a.height);this._tableView.setDirection(this._scrollDirection);this.addChild(this._tableView)},enableSlider:function(a,b,c,d){if(!this._tableView)throw Error("ScrollView now initialize please call initializeScroller ");this._maxOffset=this._tableView.getContentSize().width- this._scrollerSize.width;this._slider=new RSControlSlider(a,b,c,d);this._slider.setPosition(0,0.53*-this._scrollerSize.height);this._slider.setDelegate(this);this.addChild(this._slider);0>=this._maxOffset&&this._slider.setVisible(!1)},setCustomSlider:function(a){this._slider&&this._slider.removeFromParent(!0);this._slider=a;this._maxOffset=this._tableView.getContentSize().width-this._scrollerSize.width;this._slider.setDelegate(this);this._slider.setVisible(this.isVisible());0>=this._maxOffset&&this.isVisible()&& this._slider.setVisible(!1)},setAutoScrollConfig:function(a,b,c){this._maxOffset||(this._maxOffset=Math.max(this._scrollerSize.width,this._tableView.getContentSize().width-this._scrollerSize.width));b=this._tableView.getPositionOffsetFor(b)/this._maxOffset*100;c=this._tableView.getPositionOffsetFor(c)/this._maxOffset*100;c=Math.min(100,Math.max(0,c));b=Math.min(100,Math.max(0,b));this._atuoScrollDuration=a;this._autoScrollStartValue=b;this._autoScrollEndValue=c;this._tableView&&(a=this._maxOffset* b.toFixed(2)*0.01,this._tableView.setContentOffset(cc.p(-a,0)))},startAutoScroll:function(a){if(!this._autoScrollActive&&0<this._atuoScrollDuration){this._autoScrollAction=new RSTweenAction(this._atuoScrollDuration,"autoScroll",this._autoScrollStartValue,this._autoScrollEndValue);this._autoScrollAction.easing(cc.easeQuadraticActionOut());var b=cc.callFunc(this.actionOnComplete,this,"autoScroll");this.runAction(cc.sequence(this._autoScrollAction,b));this._autoScrollActive=!0;this._autoScrollCompleteCallBack= a}},updateTweenAction:function(a,b){var c=this._maxOffset*a.toFixed(2)*0.01;this._tableView.setContentOffset(cc.p(-c,0));this._slider&&this._slider.setValue(a.toFixed(2))},actionOnComplete:function(a){this._autoScrollAction&&(this.stopAction(this._autoScrollAction),this._autoScrollAction=null,this._autoScrollActive=!1,this._autoScrollCompleteCallBack&&(this._autoScrollCompleteCallBack.call(this),this._autoScrollCompleteCallBack=null),this._slider&&this._slider.setValue(this._autoScrollEndValue))}, addElement:function(a){if(!this._tableView)throw Error("ScrollView now initialize please call initializeScroller ");this._dataSource.addElement(a);this._tableView.reloadData();this._slider&&!this._slider.isVisible()&&(this._maxOffset=this._tableView.getContentSize().width-this._scrollerSize.width,0<this._maxOffset&&(this._slider.setVisible(!0),0<this._atuoScrollDuration&&(a=this._maxOffset*this._autoScrollStartValue.toFixed(2)*0.01,this._tableView.setContentOffset(cc.p(-a,0)))))},addElements:function(a){a= a.slice(0);if(!this._tableView)throw Error("ScrollView now initialize please call initializeScroller ");for(var b=0;b<a.length;b++)this._dataSource.addElement(a[b]);if(this._isCenterAlign){var b=this._dataSource.tableCellSizeForIndex(this,0),c=this._tableView.getPadding();switch(this._tableView.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:a=(b.width+c.x)*a.length,a<this._scrollerSize.width&&(b=this._tableView.getMargin(),b.left=0.5*(this._scrollerSize.width-a),this._tableView.setMargin(b))}}this._tableView.reloadData(); this._slider&&!this._slider.isVisible()&&(this._maxOffset=this._tableView.getContentSize().width-this._scrollerSize.width,0<this._maxOffset&&(this._slider.setVisible(!0),0<this._atuoScrollDuration&&(a=this._maxOffset*this._autoScrollStartValue.toFixed(2)*0.01,this._tableView.setContentOffset(cc.p(-a,0)))))},onSliderValueChanged:function(a,b){if(!this._autoScrollActive){var c=this._maxOffset*a.getValue().toFixed(2)*0.01;this._tableView.setContentOffset(cc.p(-c,0))}},tableCellTouched:function(a,b,c){b.tableCellTouched.call(b, c)},tableCellHighlight:function(a,b){},tableCellUnhighlight:function(a,b){},tableCellWillRecycle:function(a,b){},onTableScrolled:function(a){if(!this._autoScrollActive&&(a=a.parent,a._slider&&a._slider.isVisible())){var b=a._tableView.getContentOffset();0==a._scrollDirection&&(b=-1*b.x/a._maxOffset*100,2<Math.abs(b-a._slider.getValue())&&a._slider.setValue(b))}},setVisible:function(a){if(this._dataSource){this._tempList=this._dataSource.getElements();for(var b=0;b<this._tempList.count();b++)this._tempList.objectAtIndex(b).setVisible.call(this._tempList.objectAtIndex(b), a)}this._slider&&(this._slider.setVisible(a),0>=this._maxOffset&&a&&this._slider.setVisible(!1));this._tableView&&this._tableView.setVisible(a);cc.Layer.prototype.setVisible.call(this,a)},getDisplayObject:function(){return this},unload:function(){this._dataSource&&(this._dataSource.unload(),delete this._dataSource,this._dataSource=null);this._slider&&(this._slider.removeFromParent(!0),delete this._slider,this._slider=null);this._tableView&&(this._tableView.removeFromParent(!0),delete this._tableView, this._tableView=null)}});var RSTweenAction=cc.ActionInterval.extend({key:"",from:0,to:0,delta:0,ctor:function(a,b,c,d){cc.ActionInterval.prototype.ctor.call(this);this.key="";void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this.key=b,this.to=d,this.from=c,!0):!1},startWithTarget:function(a){if(!a||!a.updateTweenAction)throw Error("cc.ActionTween.startWithTarget(): target must be non-null, and target must implement updateTweenAction function"); cc.ActionInterval.prototype.startWithTarget.call(this,a);this.delta=this.to-this.from},update:function(a){a=this._computeEaseTime(a);this.target.updateTweenAction(this.from+this.delta*a,this.key)},reverse:function(){return new cc.ActionTween(this.duration,this.key,this.to,this.from)},clone:function(){var a=new cc.ActionTween;a.initWithDuration(this._duration,this.key,this.from,this.to);return a}});var RSControlSlider=cc.ControlSlider.extend({ctor:function(a,b,c,d,e){cc.ControlSlider.prototype.ctor.call(this);a=new cc.Sprite(a);a.setContentSize(b.width,b.height);b=new cc.Sprite;c=new cc.Sprite(c);c.setContentSize(d.width,d.height);this.initWithSprites(a,b,c);this.setAnchorPoint(0.5,1);this.setMinimumValue(0);this.setMaximumValue(100);this.setEnabled(!0);e&&this.setPosition(this.convertToNodeSpace(e));this.addTargetWithActionForControlEvents(this,this._valueChanged,cc.CONTROL_EVENT_VALUECHANGED)}, _valueChanged:function(a,b){this._delegate&&this._delegate.onSliderValueChanged.call(this._delegate,a,b)},setDelegate:function(a){this._delegate=a},getDisplayObject:function(){return this},unload:function(){this.removeFromParent(!0)}});!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):b((a=a||self).AppleID={})}(this,function(a){function b(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}var c,d=function(a,b){var c="string"==typeof a?document.getElementById(a):a;if(null!==c)return c.innerHTML=b,c},e=function(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"";("string"== typeof b||"[object Array]"===Object.prototype.toString.call(b))&&(c=b,b={});c||(c="");var d="",e;for(e in b)void 0!==b[e]&&b.hasOwnProperty(e)&&(d+=" "+e+'\x3d"'+b[e]+'"');return"[object Array]"===Object.prototype.toString.call(c)&&(c=c.join("")),"\x3c"+a+d+"\x3e"+c+"\x3c/"+a+"\x3e"},f=function(a){var b="",c;for(c in a)a[c]&&a.hasOwnProperty(c)&&(b+=" "+c+": "+a[c]+";");return b},g=function(a){return"number"!=typeof a||isNaN(a)?"100%":Math.floor(a)+"px"},h=function(a){var b=a.color,c=a.borderRadius, c=void 0===c?15:c,d=a.border,d=void 0!==d&&d,h=a.width,h=void 0===h?"100%":h,k=a.height,k=void 0===k?"100%":k;a=a.isSquare;a=void 0!==a&&a;return e("svg",{xmlns:"http://www.w3.org/2000/svg",style:f({overflow:"visible"}),width:g(h),height:g(k),viewBox:a?"0 0 50 50":void 0,preserveAspectRatio:a?"xMidYMin meet":void 0},e("rect",{width:g(h),height:g(k),ry:"".concat(c,"%"),fill:"black"===b?"#000":"#fff",stroke:d?"black":void 0,"stroke-width":d?"1":void 0,"stroke-linecap":d?"round":void 0}))},k=function(a){return"black"=== a?"#fff":"#000"},m={"sign-in":{text:"Sign in with Apple",centerAlignBoundingBox:{x:0,y:-11,width:111.046875,height:14},leftAlignBoundingBox:{x:0,y:-12,width:106.53125,height:15},fontFamily:"applied-button-font-0",rtl:!1,letterSpacing:"-.022em"},continue:{text:"Continue with Apple",centerAlignBoundingBox:{x:0,y:-11,width:123.6875,height:14},leftAlignBoundingBox:{x:0,y:-12,width:120.25,height:15},fontFamily:"applied-button-font-0",rtl:!1,letterSpacing:"-.022em"},"sign-up":{text:"Sign up with Apple", centerAlignBoundingBox:{x:0,y:-11,width:115.40625,height:14},leftAlignBoundingBox:{x:0,y:-12,width:111.25,height:15},fontFamily:"applied-button-font-0",rtl:!1,letterSpacing:"-.022em"}},n=function(a){var b=a.color,b=void 0===b?"black":b,c=a.type,d=void 0===c?"sign-in":c,c=a.border,c=void 0!==c&&c,n=a.width,p=a.height,r=a.borderRadius;a=(a.locale,m[d]);d=function(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"black",c=m[a],d=c.text,e=c.rtl,f=c.fontFamily,g=c.centerAlignBoundingBox, h=g.width,n=g.height,p=g.y;return'\n \x3csvg xmlns\x3d"http://www.w3.org/2000/svg" style\x3d"pointer-events: none; overflow: visible;" width\x3d"100%" height\x3d"100%"\x3e\n \x3cg\x3e\n \x3csvg xmlns\x3d"http://www.w3.org/2000/svg" style\x3d"overflow: visible;" width\x3d"100%" height\x3d"50%" y\x3d"25%" viewBox\x3d"'.concat(g.x," ").concat(p," ").concat(h," ").concat(n,'" fill\x3d"').concat(k(b),'"\x3e\n \x3cdefs\x3e\n \x3cstyle\x3e\n ').concat('\n @font-face {\n font-family: "applied-button-font-0";\n src: url(data:application/x-font-woff;charset\x3dutf-8;base64,d09GRgABAAAAABRMABEAAAAAIawAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHUE9TAAATFAAAALsAAAHIbUB2PEdTVUIAABPQAAAAZQAAAIxKSyvpT1MvMgAACjgAAABNAAAAYHLeeipic2xuAAAUOAAAABMAAABI/ykCnmNtYXAAAAqIAAAArAAAATzUgYTCY3Z0IAAAEagAAACGAAAA/h4jsglmcGdtAAALNAAABcMAAAviP64gqWdhc3AAABMMAAAACAAAAAgAAAAQZ2x5ZgAAAYAAAAfMAAAMDN+ERypoZWFkAAAJlAAAADYAAAA2FZUeyWhoZWEAAAoYAAAAIAAAACQQagbMaG10eAAACcwAAABMAAAATFWqCFBsb2NhAAAJbAAAACgAAAAoG5oe821heHAAAAlMAAAAIAAAACABaQyMbmFtZQAAEjAAAADFAAABhhtRNi1wb3N0AAAS+AAAABMAAAAg/tsAmnByZXAAABD4AAAArgAAAMdYpaDHeJzVVm1QVOcVPu/HvcvytXvdvbvoooG9sGtKQGVZKCXoIhGVxUJipCy7iEQsEhH50GD4GBVWg6KTmcRak6owdWS0DqBNNJlMWhs/8kOnsTZNmTo1an+YjvVHbSft1LDQc++yBC12+rezn+85573vc855zjkvUCgCEFYKx0EHMVDkPZNeVuGRgQMQDq8ApVu8AqOENJESG8oppy0RpSZvJSU+TzxAtB4foJMkSYy1piWzZKYQFyH4y/3B0M3d96j+IdWHWn9L3r9BdozvEo4/quJHQ8foK0CgfeKWEBA+hVSoD5+fCpTh04UmEDgTeCMwRvxASJsXOAe/SAC2A+JRnrQjgJjY+imrDkB0JgLJSXNtssloiNFDKknVxZrTBLvDQd1Zs7KzXZnzqFXJoIpdFGWzxeLKzM7OccUzJhx6+LPKylMPD7VdH6iNvy2/+pPq7o/r6n7RXX2k3nzbUHvs18rGKyRhZIQkfLpx5Z4PGit6Vuz5+tTJr/cUtL20aaTrBQwTNE/c4pfRt0yoCvuWAowDZ9CkBZE0Ilbqxzijb4QIfhCE7QK6Zn/SjOKK8vURow4BPdNnKOYMxSjGzkkzueZRFbk7y+F0OhzurMX0Cces1nlUNouigp43f6kPHKypPPBi8M2PLn/o7fvktcaP9r0o3Iwp6365Yndxx4H+gx+W9/7r9MDfDpDgCxtycms9qzfa0zMu9q871pyf33jYv7TG7a4pWLUu2WnfdLRh39XNG3+JEH848Re+lJdDFCiw2JMHVBAFKjZhHARKhBodpoT70eN2L4gi82NeO1gJAXtSos0qG+Ki9QKHKBIVhQkiiFqXnEFNrniqQnZnqamyWGQ5WdZcpf7SjmKROlhh28fXrbsudR25295x993Df9g2NsFW7iyvCbL+oh1r1uwoCr1Rc2BV79jw8MT+4D9Oe2PX7S/B3FDYML6Or+WrwQAuEuM9k4jZiX6OEDGRCECLbdpCF174wurvANJMYBw9IqJfR0Sx3RuFTmkpafJqudQTSjtpiS2c7oypHTpdi1fbBv9914L/ZVfr47s8aVMbOMo4rX7qRuSNz+exSUYCCzKedSY/M9sqm40uyaXXgYEYojH0qWEeOSIVYcLwO11aZbjdSphBkXRYXW6XhKyitYHg8uXBQKC7sLC7uvfa9tg/xvds3vNj46Lh5r6rmxuv9Xl31z0jfdbxp6s/GNjcMFBRMdCA36FDJfuq8pa/3nDDt/aNvx8f/OfeBeV5w9+c7zpfq1bPIPKlVLgPFmg6xwgjpNh7xo7xsQJAszfSFtq9AqeUNk0F3fqtBg2pb0o9s6aVYkw8cSiwgEUxp2APS0jDiEiuScpJipQVjoY0+IU0/1TH1pP+0baWinaPcD90MlBXfX5XqIDu6w4u63opFERm9SD4t0U8DEzw6iRkAXOlUf519egWLyfhrhppuQwNsH2tf0w5k1xtuT7PLCwViIvhJsGExzDELGuY2fRawcQM/H5T6uLUyJsXfHOBjzs8DqfH4fA48c//GVqNE6QLOcFgWRhrrEYG+hhAVUZ8Edm0ZRhONK5VGGwSxuCocP+RRWXcEWRcLnYwGRpUxoHKOCs+EGEz8BOiuvUfbFOFM5BxZs23bJNBVkxTbJPDbJtOtiPXjfN/2nH+0ujWttJtHl4w5K/7/GJoCe3r6SnsXBPqmey49YjXADZIV/vT1FmYQPDz8BBUq90qG22SLVzl4uQEnB56Z6Za9HgwljzdOHCvs/Or/mNfdXbe699/+PB+/Mi9obMj47294yNnQ70Xrvz87JUrZ9+7jBiOjB/iP8I+aoYUeMcTLREuxBDCaXG4ac7FtgN+JlKAdq+OcK4h7PDi0Ns61fGSETmGSrVUB/dMhmjzNDXzqdu1wFotMoF5iXKKJcVoiI9Df83ErA2UST+xezkVDLIWcNMTrY7e6Lu6pfHa3q1n0qTR68ZF5zMD3UVF3X5/z4rlQb5679jQUGhvTXnooXD6/ar6sYBvsLX1hK9ysKXlRCWyJ2/iET0tlEECBDzRsYTROIJTuzjMk0SVXy1qXohPRCpqzNDGYRNH756ubuU466Mlc6oiSUZdrA2HPaJXJLPakXPkyYYsKW7Xn0cfPCgum223zslL2v524dCQUDb+4FzoN2tKGX1PEPO662ndOTzmLWRNJi/AjKksBzbFco2h2skQUMneBFMsj6hQqFE6oAZfLa5pmtbpmkmWm8EcYTlBjOH54cai0+C7JZ55XZp/ovPcxdEtr3X3qSU/VLXh81/RS6FtwZ1v7aRdiLcAQHQgXgMs/SBOj+AomQyqAW9+TD09gvZxSat6AVRRGMBgkkxhFERhino/NYVfomP8i9t3pTu3xn9385Lxzmd3pIsqCmYf+5IXjH3ClqgfHBaETfxVeCQaIBe+D1HnivPtQBcirfCWFc9l8zxmRXbp1NuKeucK31qcGTRyFXNlLqZOVapdz7JzFtMclY/8qFTkW+tkSubCpGfz89OodUFq8oqX3fNzXUvS05fmfC9lUZnXmV78XGFz30pnkSc3wZq3rCxmzopSJSaaUHdy4qpyJ1vAD+oSl+TS2RlF1c8X1RdnyIQV1OYs9H3XlGAyzTFlV+YUnLpQ3TK87XmzzSzPlXclZc6lzKjPb3bYs5JI3Kz81n8DmAOACAABAAAAEwBqAAcAAAAAAAIALgA+AHcAAACpC+IAAAAAAAAAAAAAAEEArwEmAX0CTgKqAwEDWAOHA98EIQSmBPoFUgWVBZUGBgABAAAAAQAAhOuEOl8PPPUAAQgAAAAAANaoccYAAAAA1w1hff4i/eoKqAikAAAAAwACAAAAAAAACAAAYwIwAAAFjwBFBc0AeQU1AHAEqABlBPoAZAThAKUCFgCCAhYAggIjAKUEywCbBM8AZQT7AJsDDAA6BM4AkQZoAEACAAAAB0ABAnicY2BkYGCf90+IgYHb9J/S30Ku5QxAERQgDACBlAVKeJxjYGZ5xPiFgZWBgdWY5QwDA8NMCM10hmEWUy+Qz8DGAAeMDEjAMSDAB0gp/PjPPu+fEAMD+zzGdwoMjPNBciyOrItBcgzMANLgDugAAAB4nHXPTQrCQAwF4OdPFbSIPztXXfQi0iN4hlKEUlxY6lUU1F7BGyh4EL1Fd883M3Fp4CMNGZIUwBDAQFKE71RVT/mlPPF1DBctQrgqMe7dxvQlM27e1riZuYmkkJ2MpDRuTyV7mcpBaplJY+ZaGQVYAB0DLLXhqLzWC3dxomsybc61pdTEGk0SdST9zb9eoV6lPdbjh08+eGfLG6+88MzTOx6v/B/+iS+yhS92eJytVmlz01YUlbzFSchSstCiLk+8OE3tJ5NSCAZMCJJlF9zF2VoJSivFTrov0DLDb9CvuTLtDP3GT+u5km0MSdoZppmM7nnvHb27X5k0JUjb91xfiPYzbXa7TYXdex5dNmjND45EtO9RphT+XdSKWrcrDwzTJM0nzZGNvqZrTmBbpCsSwZFFGSV6gp53KLd6r7+mTzlu16WC65mULfk79z1TmkbkCep0sLXlG4JqjGq+L+KUHfZoDVuDlaB1Pl9n5vOOJ2BNFAqa6ngBdgSfTTHaYLQRGIHv+wbpFd+XpHW8Q9+3KKsE7smVQliWdzoe5aVNBWnDD5/0wKKckrBL9OL8gS34hC02Ugv4SYXA7VK2bOLQEZGIoCBez5fg5LYXdIxwx/ekb/qCtnY9nBns2kC/RXlFE06lr2XSSBWwlLZExKUdUubgiPQurKB82aIJJdjUaaf7LKcdCL6BtgKfKUEjMbWo+hPTmuPaZXMU+0n1ci6m0lv0Ckxw4Hcg3EiGnJckXprBMSVhwMihlciODBupiulTXqcVvKUZL1wbf+mMShzqT09lkWxDmn7ZtGhGxZmMS72wYdGsAlEIOuPc5dcBpO3TDK92sJrByqI5XDOfhEQgAl3opVknEFEgaBZBs2hetfe8ONdr+Cs0cyifWPSGam977d100zCxv5Dsn1WxNufse/HcnEN6aNNchWsWlWzHZ/gxgwfpy8hEttTxYg4evLUj5JfVlk2J14bYSM/5FbQC7/jwpAX7W9h9OVWnJDDWtAWJaDmkbfZ1XU9ytaC0WMu4ex7NSVu4NI3im5IoOFsEUP/X/LyuzWq2HQXx2UKFHleMCwjTInxbqFi0pGKd5TLizPKcirMs31RxjuVbKs6zPK/iAktDxRMs31ZxkeU7Kp5k+YGSw7hDNSIsRZX0B9wgFpXHDpdHhw/Tw8rY4ero8FF6+K7SaKbyGv69B//ehV0C/rE04R/LC/CPpYR/LFfgH8sS/GO5Cv9Yvg//WK7BP5ZKiXpSppaC2vlAOMht4CSpROsprtWqIqtCFrrwIhqgJU7JogxrkifivzIM9n59lFp9mS6W47y+5HoYZOzgh+OROX58SYkrib0fgae7x5WgO09Uzvva8p8a/zU2ZS2+pC/Bo8vwHwafbC+aIqxZdEVVz9Ut2vgvKgq4C/pVpERbLomqaHHjI5R3oqglW5gUHr4QGKyYBhu6vrQI/TVMqGU0F/4TCk06lcOoKoWoR7jr2otjUU3voBzuBEtQwLNia9t7mhFZYTzNrGbP+zbPzyJGsUzYsonOdV5tw4BnWPq5yDhBT1LWCXs4zjihARzw/Hr1nRAmYarLJnIooaEJvyASLbjvBCUynZQ5DAfEPo+Cyh+7FTeyR6XECDw76YR8oQspv84xENjJrw5iIOsIzY1km4poHiGassXKOFv1JGTswCCi2p5XFXV8XdniwaZgW4YhL5SwujP+IU8TdVIFDzIjuYxvDixwhqkJ+Ev/qovDVG5iHlQ5ak0M9bpfjav6Ihrw1mi7M7699TL7RM5tRbXKiZfaiq5VIijmYoG1xzlIS5WqoDqjChtGl4tLotSraJL0ugaGBub/a5Ri6/+qPjaf50tdYoSM5dv0Bza6HIyh/03235SDAAz8GLncgstLaXPilwH6cKFKl9GLH5+yfwczV19coCvAdxVdhWhz1FzEVTTxGRzG6RPF5UhtwE9VH3MG4DMAncHnqq8nOx2AZGebOS7ADnMY7DKHwR5zGOwz5zbAF8xh8CVzGHjMYeAzxwG4xxwG95nD4CvmMHjAnCbA18xh8A1zGATMYRAyxwY4YA6DLnMY9JjD4FDR9VGYj3hBm0DfJugW0HdJPWGxhcX3im6M2D/wImH/mCBm/5Qgpv6sqD6i/sKLhPprgpj6W4KY+lDRzRH1ES8S6u8JYuofCWLqY/V0MpcZ/vCyK1Q8pOxK58nwm2L9Aw8nY10AeJxj8N7BcCIoYiMjY1/kBsadHAwcDMkFGxnYnbZXpYW5GTGwMWiBeA58uRyxbL5slhzq7NIsbBxQwXK2VJZQFmc2A1ZFJrAgr9N+6QbxBuEGvgYuBnYGoHZOoKiw034GByQIFmVOcdmowtgRGLHBoSMCzFMD8XZxNDAwsjh0JIeABSOBwIEvnyOezZ/NmkOTXZaFjUdrB+P/1g0svRuZGFw2s6awMbi4AADrlS9DAAB4nGNgIBncBcJjDMdYShgY2Of9E2KZ+P8xiAaL72fYz7qYgYHFkYHh3zSQKOux/3dZwv6//leKrob1FYvj/3cIVaz/gere/esBq9sNhFMZpjL9Y3z+X/CfAkiMWZDx+3+mf5zI8mwHWFcyXWZ8BBJju8y6k+kI42ls9iC7hk0c4R4AmMtWvAAAeJyNj08LAVEUxX/DIGVtPQtbGv+iZmWjLNQUzcKWCTWMDPKVfBMfxodwzDwiKb3ePeeed+7tPKDEjDyWXQYC3YxbVNVlPEeFyPA8PmfDbWpcDS/gcDO8iGNVuEhp4dKkS92wnrQBO52IUHzEljmNVI10HPasWbLiQJJ2oTAUnlQXck4YSvelxMKp1LO84/R1zZHND4fz4fHUu8rUUF0IQ2XzXnn7yuvSUW0L/9kXpBkTdbF+9L37sSPb8Jyvv8/fASPuNJwAAAB4nGNgZgCDfzcYZjFgAQA4VwJ0AAABAAH//wAPeJyNUDEOwjAMPCcF2lQChPoAHsDICxBiYmRkQYiJqkPFAH9jZGIF8RIWxGAuKVI7dGhOsZ3zObINAeCwwBZ2uVpvkO0vZY5pvjsVmCFiFqrwqjqWRmxgj4eyQNa0TEq4EZLg46AEvRHjq2Uic6QE9Ko34q5ntB59tfMtyo8+O2sfXZW+A/b3bbzf1fzdav++ns4E+L2kGIfNWAyrTfLfHvoE6AdETJ0LuRFZIeNrPZvQOsauqvoB5z0tQgB4nGNgZGBg4GKIYihhYHZx8wlhEEmuLMphkMtJLMljUGJgAcoy/P/PAAPMjlGuCgxizkEhCgxyIUHeCgxqYHlGqDpGEAtMMzEw5+Qn5zCIIJNARYxgzAKlOYCYDawLyAYAAaIWnAAAAHicY2BkgAKmef81GMgGAGutAckA) format("woff")\n }', '\n \x3c/style\x3e\n \x3c/defs\x3e\n \x3ctext font-size\x3d"12px" ').concat("0em"!==c.letterSpacing?'textLength\x3d"'.concat(h,'"'):"",' font-family\x3d"').concat(f,'" direction\x3d"').concat(e?"rtl":"ltr",'"\x3e\uf8ff\u2005').concat(d,"\x3c/text\x3e\n \x3c/svg\x3e\n \x3c/g\x3e\n \x3c/svg\x3e\n ")}(d,b);n=f({"font-synthesis":"none","-moz-font-feature-settings":"kern","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale",width:g(n),height:g(p), "min-width":"130px","max-width":"375px","min-height":"30px","max-height":"64px",position:"relative","letter-spacing":"initial"});return e("div",{style:n,role:"button",tabindex:"0","aria-label":a.text},"\n ".concat(e("div",{style:f({"padding-right":"8%","padding-left":"8%",position:"absolute","box-sizing":"border-box",width:"100%",height:"100%"})},d),"\n ").concat(e("div",{style:f({padding:c?"1px":void 0,width:"100%",height:"100%","box-sizing":"border-box"})},h({color:b,borderRadius:r,border:c})), "\n "))},p=[],r=[],s=function(a,b){var c=p.indexOf(a);if(0<=c&&(c=r[c]))return c[b]},u=function(a,b,c){var d=p.indexOf(a);0>d?(d={},d[b]=c,p.push(a),r.push(d)):(r[d]||(r[d]={}),r[d][b]=c)},t=[],v=!1,w=function(a){if(null===a)return null;a=a.getBoundingClientRect();return{width:a.width,height:a.height}},x=function(a){var b=s(a,"lastScheduleResizeCheckSize")||w(a),c=s(a,"lastKnownSize");c&&c.width===b.width&&c.height===b.height||(s(a,"resizeCallback")(b),u(a,"lastKnownSize",b));u(a,"resizeCheckIsScheduled", !1)},B=function(a,b){u(a,"lastScheduleResizeCheckSize",b);s(a,"resizeCheckIsScheduled")||(u(a,"resizeCheckIsScheduled",!0),"function"==typeof requestAnimationFrame?window.requestAnimationFrame(function(){x(a)}):setTimeout(function(){x(a)},1E3/60))},y=function(a,b){u(a,"resizeCallback",b);s(a,"isObserved")||(u(a,"isObserved",!0),"undefined"!=typeof ResizeObserver?(c||(c=new ResizeObserver(function(a){var b=!0,c=!1,d=void 0;try{for(var e,f=a[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value; B(g.target,g.contentBoxSize?{width:g.contentBoxSize.inlineSize,height:g.contentBoxSize.blockSize}:{width:g.contentRect.width,height:g.contentRect.height})}}catch(h){c=!0,d=h}finally{try{b||null==f.return||f.return()}finally{if(c)throw d;}}})),c.observe(a)):v||(window.addEventListener("resize",function(){t.forEach(function(a){return B(a)})}),"undefined"!=typeof MutationObserver&&(new MutationObserver(function(){t.forEach(function(a){return B(a)})})).observe(document,{attributes:!0,childList:!0,characterData:!0, subtree:!0}),v=!0),t.push(a))},z={small:{height:44,width:24,logoWidth:12,path:"M12.2337427,16.9879688 C12.8896607,16.9879688 13.7118677,16.5445313 14.2014966,15.9532812 C14.6449341,15.4174609 14.968274,14.6691602 14.968274,13.9208594 C14.968274,13.8192383 14.9590357,13.7176172 14.9405591,13.6344727 C14.2107349,13.6621875 13.3330982,14.1241016 12.8065162,14.7430664 C12.3907935,15.2142188 12.012024,15.9532812 12.012024,16.7108203 C12.012024,16.8216797 12.0305005,16.9325391 12.0397388,16.9694922 C12.0859302,16.9787305 12.1598365,16.9879688 12.2337427,16.9879688 Z M9.92417241,28.1662891 C10.8202857,28.1662891 11.2175318,27.5658008 12.3353638,27.5658008 C13.4716724,27.5658008 13.721106,28.1478125 14.7188404,28.1478125 C15.6980982,28.1478125 16.3540162,27.2424609 16.972981,26.3555859 C17.6658521,25.339375 17.9522388,24.3416406 17.9707154,24.2954492 C17.9060474,24.2769727 16.0306763,23.5101953 16.0306763,21.3576758 C16.0306763,19.491543 17.5088013,18.6508594 17.5919459,18.5861914 C16.612688,17.1819727 15.1253248,17.1450195 14.7188404,17.1450195 C13.6194849,17.1450195 12.7233716,17.8101758 12.1598365,17.8101758 C11.5501099,17.8101758 10.7463794,17.1819727 9.79483648,17.1819727 C7.98413335,17.1819727 6.14571538,18.6785742 6.14571538,21.5054883 C6.14571538,23.2607617 6.8293482,25.1176563 7.67003179,26.3186328 C8.39061773,27.3348438 9.01882085,28.1662891 9.92417241,28.1662891 Z"}, medium:{height:44,width:31,logoWidth:17,path:"M15.7099491,14.8846154 C16.5675461,14.8846154 17.642562,14.3048315 18.28274,13.5317864 C18.8625238,12.8312142 19.2852829,11.852829 19.2852829,10.8744437 C19.2852829,10.7415766 19.2732041,10.6087095 19.2490464,10.5 C18.2948188,10.5362365 17.1473299,11.140178 16.4588366,11.9494596 C15.9152893,12.56548 15.4200572,13.5317864 15.4200572,14.5222505 C15.4200572,14.6671964 15.4442149,14.8121424 15.4562937,14.8604577 C15.5166879,14.8725366 15.6133185,14.8846154 15.7099491,14.8846154 Z M12.6902416,29.5 C13.8618881,29.5 14.3812778,28.714876 15.8428163,28.714876 C17.3285124,28.714876 17.6546408,29.4758423 18.9591545,29.4758423 C20.2395105,29.4758423 21.0971074,28.292117 21.9063891,27.1325493 C22.8123013,25.8038779 23.1867451,24.4993643 23.2109027,24.4389701 C23.1263509,24.4148125 20.6743484,23.4122695 20.6743484,20.5979021 C20.6743484,18.1579784 22.6069612,17.0588048 22.7156707,16.974253 C21.4353147,15.1382708 19.490623,15.0899555 18.9591545,15.0899555 C17.5217737,15.0899555 16.3501271,15.9596313 15.6133185,15.9596313 C14.8161157,15.9596313 13.7652575,15.1382708 12.521138,15.1382708 C10.1536872,15.1382708 7.75,17.0950413 7.75,20.7911634 C7.75,23.0861411 8.64383344,25.513986 9.74300699,27.0842339 C10.6851558,28.4129053 11.5065162,29.5 12.6902416,29.5 Z"}, large:{height:44,width:39,logoWidth:21,path:"M19.8196726,13.1384615 C20.902953,13.1384615 22.2608678,12.406103 23.0695137,11.4296249 C23.8018722,10.5446917 24.3358837,9.30883662 24.3358837,8.07298156 C24.3358837,7.9051494 24.3206262,7.73731723 24.2901113,7.6 C23.0847711,7.64577241 21.6353115,8.4086459 20.7656357,9.43089638 C20.0790496,10.2090273 19.4534933,11.4296249 19.4534933,12.6807374 C19.4534933,12.8638271 19.4840083,13.0469167 19.4992657,13.1079466 C19.5755531,13.1232041 19.6976128,13.1384615 19.8196726,13.1384615 Z M16.0053051,31.6 C17.4852797,31.6 18.1413509,30.6082645 19.9875048,30.6082645 C21.8641736,30.6082645 22.2761252,31.5694851 23.923932,31.5694851 C25.5412238,31.5694851 26.6245041,30.074253 27.6467546,28.6095359 C28.7910648,26.9312142 29.2640464,25.2834075 29.2945613,25.2071202 C29.1877591,25.1766052 26.0904927,23.9102352 26.0904927,20.3552448 C26.0904927,17.2732359 28.5316879,15.8848061 28.6690051,15.7780038 C27.0517133,13.4588684 24.5952606,13.3978385 23.923932,13.3978385 C22.1082931,13.3978385 20.6283185,14.4963764 19.6976128,14.4963764 C18.6906198,14.4963764 17.36322,13.4588684 15.7917006,13.4588684 C12.8012365,13.4588684 9.765,15.9305785 9.765,20.5993643 C9.765,23.4982835 10.8940528,26.565035 12.2824825,28.548506 C13.4725652,30.2268277 14.5100731,31.6 16.0053051,31.6 Z"}}, C=function(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"black",c=3<arguments.length?arguments[3]:void 0,d=4<arguments.length?arguments[4]:void 0,h=m[a],n=h.text,p=h.rtl,r=h.fontFamily,s=h.leftAlignBoundingBox,t=s.width,s=s.x;return e("svg",{xmlns:"http://www.w3.org/2000/svg",style:f({overflow:"visible"}),width:g(c),height:g(d),preserveAspectRatio:p?"xMaxYMid meet":"xMinYMid meet",viewBox:"".concat(s," ").concat(-30*0.655," ").concat(t," ").concat(30),fill:"".concat(k(b))},[e("defs", e("style",'\n @font-face {\n font-family: "applied-button-font-0";\n src: url(data:application/x-font-woff;charset\x3dutf-8;base64,d09GRgABAAAAABRMABEAAAAAIawAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHUE9TAAATFAAAALsAAAHIbUB2PEdTVUIAABPQAAAAZQAAAIxKSyvpT1MvMgAACjgAAABNAAAAYHLeeipic2xuAAAUOAAAABMAAABI/ykCnmNtYXAAAAqIAAAArAAAATzUgYTCY3Z0IAAAEagAAACGAAAA/h4jsglmcGdtAAALNAAABcMAAAviP64gqWdhc3AAABMMAAAACAAAAAgAAAAQZ2x5ZgAAAYAAAAfMAAAMDN+ERypoZWFkAAAJlAAAADYAAAA2FZUeyWhoZWEAAAoYAAAAIAAAACQQagbMaG10eAAACcwAAABMAAAATFWqCFBsb2NhAAAJbAAAACgAAAAoG5oe821heHAAAAlMAAAAIAAAACABaQyMbmFtZQAAEjAAAADFAAABhhtRNi1wb3N0AAAS+AAAABMAAAAg/tsAmnByZXAAABD4AAAArgAAAMdYpaDHeJzVVm1QVOcVPu/HvcvytXvdvbvoooG9sGtKQGVZKCXoIhGVxUJipCy7iEQsEhH50GD4GBVWg6KTmcRak6owdWS0DqBNNJlMWhs/8kOnsTZNmTo1an+YjvVHbSft1LDQc++yBC12+rezn+85573vc855zjkvUCgCEFYKx0EHMVDkPZNeVuGRgQMQDq8ApVu8AqOENJESG8oppy0RpSZvJSU+TzxAtB4foJMkSYy1piWzZKYQFyH4y/3B0M3d96j+IdWHWn9L3r9BdozvEo4/quJHQ8foK0CgfeKWEBA+hVSoD5+fCpTh04UmEDgTeCMwRvxASJsXOAe/SAC2A+JRnrQjgJjY+imrDkB0JgLJSXNtssloiNFDKknVxZrTBLvDQd1Zs7KzXZnzqFXJoIpdFGWzxeLKzM7OccUzJhx6+LPKylMPD7VdH6iNvy2/+pPq7o/r6n7RXX2k3nzbUHvs18rGKyRhZIQkfLpx5Z4PGit6Vuz5+tTJr/cUtL20aaTrBQwTNE/c4pfRt0yoCvuWAowDZ9CkBZE0Ilbqxzijb4QIfhCE7QK6Zn/SjOKK8vURow4BPdNnKOYMxSjGzkkzueZRFbk7y+F0OhzurMX0Cces1nlUNouigp43f6kPHKypPPBi8M2PLn/o7fvktcaP9r0o3Iwp6365Yndxx4H+gx+W9/7r9MDfDpDgCxtycms9qzfa0zMu9q871pyf33jYv7TG7a4pWLUu2WnfdLRh39XNG3+JEH848Re+lJdDFCiw2JMHVBAFKjZhHARKhBodpoT70eN2L4gi82NeO1gJAXtSos0qG+Ki9QKHKBIVhQkiiFqXnEFNrniqQnZnqamyWGQ5WdZcpf7SjmKROlhh28fXrbsudR25295x993Df9g2NsFW7iyvCbL+oh1r1uwoCr1Rc2BV79jw8MT+4D9Oe2PX7S/B3FDYML6Or+WrwQAuEuM9k4jZiX6OEDGRCECLbdpCF174wurvANJMYBw9IqJfR0Sx3RuFTmkpafJqudQTSjtpiS2c7oypHTpdi1fbBv9914L/ZVfr47s8aVMbOMo4rX7qRuSNz+exSUYCCzKedSY/M9sqm40uyaXXgYEYojH0qWEeOSIVYcLwO11aZbjdSphBkXRYXW6XhKyitYHg8uXBQKC7sLC7uvfa9tg/xvds3vNj46Lh5r6rmxuv9Xl31z0jfdbxp6s/GNjcMFBRMdCA36FDJfuq8pa/3nDDt/aNvx8f/OfeBeV5w9+c7zpfq1bPIPKlVLgPFmg6xwgjpNh7xo7xsQJAszfSFtq9AqeUNk0F3fqtBg2pb0o9s6aVYkw8cSiwgEUxp2APS0jDiEiuScpJipQVjoY0+IU0/1TH1pP+0baWinaPcD90MlBXfX5XqIDu6w4u63opFERm9SD4t0U8DEzw6iRkAXOlUf519egWLyfhrhppuQwNsH2tf0w5k1xtuT7PLCwViIvhJsGExzDELGuY2fRawcQM/H5T6uLUyJsXfHOBjzs8DqfH4fA48c//GVqNE6QLOcFgWRhrrEYG+hhAVUZ8Edm0ZRhONK5VGGwSxuCocP+RRWXcEWRcLnYwGRpUxoHKOCs+EGEz8BOiuvUfbFOFM5BxZs23bJNBVkxTbJPDbJtOtiPXjfN/2nH+0ujWttJtHl4w5K/7/GJoCe3r6SnsXBPqmey49YjXADZIV/vT1FmYQPDz8BBUq90qG22SLVzl4uQEnB56Z6Za9HgwljzdOHCvs/Or/mNfdXbe699/+PB+/Mi9obMj47294yNnQ70Xrvz87JUrZ9+7jBiOjB/iP8I+aoYUeMcTLREuxBDCaXG4ac7FtgN+JlKAdq+OcK4h7PDi0Ns61fGSETmGSrVUB/dMhmjzNDXzqdu1wFotMoF5iXKKJcVoiI9Df83ErA2UST+xezkVDLIWcNMTrY7e6Lu6pfHa3q1n0qTR68ZF5zMD3UVF3X5/z4rlQb5679jQUGhvTXnooXD6/ar6sYBvsLX1hK9ysKXlRCWyJ2/iET0tlEECBDzRsYTROIJTuzjMk0SVXy1qXohPRCpqzNDGYRNH756ubuU466Mlc6oiSUZdrA2HPaJXJLPakXPkyYYsKW7Xn0cfPCgum223zslL2v524dCQUDb+4FzoN2tKGX1PEPO662ndOTzmLWRNJi/AjKksBzbFco2h2skQUMneBFMsj6hQqFE6oAZfLa5pmtbpmkmWm8EcYTlBjOH54cai0+C7JZ55XZp/ovPcxdEtr3X3qSU/VLXh81/RS6FtwZ1v7aRdiLcAQHQgXgMs/SBOj+AomQyqAW9+TD09gvZxSat6AVRRGMBgkkxhFERhino/NYVfomP8i9t3pTu3xn9385Lxzmd3pIsqCmYf+5IXjH3ClqgfHBaETfxVeCQaIBe+D1HnivPtQBcirfCWFc9l8zxmRXbp1NuKeucK31qcGTRyFXNlLqZOVapdz7JzFtMclY/8qFTkW+tkSubCpGfz89OodUFq8oqX3fNzXUvS05fmfC9lUZnXmV78XGFz30pnkSc3wZq3rCxmzopSJSaaUHdy4qpyJ1vAD+oSl+TS2RlF1c8X1RdnyIQV1OYs9H3XlGAyzTFlV+YUnLpQ3TK87XmzzSzPlXclZc6lzKjPb3bYs5JI3Kz81n8DmAOACAABAAAAEwBqAAcAAAAAAAIALgA+AHcAAACpC+IAAAAAAAAAAAAAAEEArwEmAX0CTgKqAwEDWAOHA98EIQSmBPoFUgWVBZUGBgABAAAAAQAAhOuEOl8PPPUAAQgAAAAAANaoccYAAAAA1w1hff4i/eoKqAikAAAAAwACAAAAAAAACAAAYwIwAAAFjwBFBc0AeQU1AHAEqABlBPoAZAThAKUCFgCCAhYAggIjAKUEywCbBM8AZQT7AJsDDAA6BM4AkQZoAEACAAAAB0ABAnicY2BkYGCf90+IgYHb9J/S30Ku5QxAERQgDACBlAVKeJxjYGZ5xPiFgZWBgdWY5QwDA8NMCM10hmEWUy+Qz8DGAAeMDEjAMSDAB0gp/PjPPu+fEAMD+zzGdwoMjPNBciyOrItBcgzMANLgDugAAAB4nHXPTQrCQAwF4OdPFbSIPztXXfQi0iN4hlKEUlxY6lUU1F7BGyh4EL1Fd883M3Fp4CMNGZIUwBDAQFKE71RVT/mlPPF1DBctQrgqMe7dxvQlM27e1riZuYmkkJ2MpDRuTyV7mcpBaplJY+ZaGQVYAB0DLLXhqLzWC3dxomsybc61pdTEGk0SdST9zb9eoV6lPdbjh08+eGfLG6+88MzTOx6v/B/+iS+yhS92eJytVmlz01YUlbzFSchSstCiLk+8OE3tJ5NSCAZMCJJlF9zF2VoJSivFTrov0DLDb9CvuTLtDP3GT+u5km0MSdoZppmM7nnvHb27X5k0JUjb91xfiPYzbXa7TYXdex5dNmjND45EtO9RphT+XdSKWrcrDwzTJM0nzZGNvqZrTmBbpCsSwZFFGSV6gp53KLd6r7+mTzlu16WC65mULfk79z1TmkbkCep0sLXlG4JqjGq+L+KUHfZoDVuDlaB1Pl9n5vOOJ2BNFAqa6ngBdgSfTTHaYLQRGIHv+wbpFd+XpHW8Q9+3KKsE7smVQliWdzoe5aVNBWnDD5/0wKKckrBL9OL8gS34hC02Ugv4SYXA7VK2bOLQEZGIoCBez5fg5LYXdIxwx/ekb/qCtnY9nBns2kC/RXlFE06lr2XSSBWwlLZExKUdUubgiPQurKB82aIJJdjUaaf7LKcdCL6BtgKfKUEjMbWo+hPTmuPaZXMU+0n1ci6m0lv0Ckxw4Hcg3EiGnJckXprBMSVhwMihlciODBupiulTXqcVvKUZL1wbf+mMShzqT09lkWxDmn7ZtGhGxZmMS72wYdGsAlEIOuPc5dcBpO3TDK92sJrByqI5XDOfhEQgAl3opVknEFEgaBZBs2hetfe8ONdr+Cs0cyifWPSGam977d100zCxv5Dsn1WxNufse/HcnEN6aNNchWsWlWzHZ/gxgwfpy8hEttTxYg4evLUj5JfVlk2J14bYSM/5FbQC7/jwpAX7W9h9OVWnJDDWtAWJaDmkbfZ1XU9ytaC0WMu4ex7NSVu4NI3im5IoOFsEUP/X/LyuzWq2HQXx2UKFHleMCwjTInxbqFi0pGKd5TLizPKcirMs31RxjuVbKs6zPK/iAktDxRMs31ZxkeU7Kp5k+YGSw7hDNSIsRZX0B9wgFpXHDpdHhw/Tw8rY4ero8FF6+K7SaKbyGv69B//ehV0C/rE04R/LC/CPpYR/LFfgH8sS/GO5Cv9Yvg//WK7BP5ZKiXpSppaC2vlAOMht4CSpROsprtWqIqtCFrrwIhqgJU7JogxrkifivzIM9n59lFp9mS6W47y+5HoYZOzgh+OROX58SYkrib0fgae7x5WgO09Uzvva8p8a/zU2ZS2+pC/Bo8vwHwafbC+aIqxZdEVVz9Ut2vgvKgq4C/pVpERbLomqaHHjI5R3oqglW5gUHr4QGKyYBhu6vrQI/TVMqGU0F/4TCk06lcOoKoWoR7jr2otjUU3voBzuBEtQwLNia9t7mhFZYTzNrGbP+zbPzyJGsUzYsonOdV5tw4BnWPq5yDhBT1LWCXs4zjihARzw/Hr1nRAmYarLJnIooaEJvyASLbjvBCUynZQ5DAfEPo+Cyh+7FTeyR6XECDw76YR8oQspv84xENjJrw5iIOsIzY1km4poHiGassXKOFv1JGTswCCi2p5XFXV8XdniwaZgW4YhL5SwujP+IU8TdVIFDzIjuYxvDixwhqkJ+Ev/qovDVG5iHlQ5ak0M9bpfjav6Ihrw1mi7M7699TL7RM5tRbXKiZfaiq5VIijmYoG1xzlIS5WqoDqjChtGl4tLotSraJL0ugaGBub/a5Ri6/+qPjaf50tdYoSM5dv0Bza6HIyh/03235SDAAz8GLncgstLaXPilwH6cKFKl9GLH5+yfwczV19coCvAdxVdhWhz1FzEVTTxGRzG6RPF5UhtwE9VH3MG4DMAncHnqq8nOx2AZGebOS7ADnMY7DKHwR5zGOwz5zbAF8xh8CVzGHjMYeAzxwG4xxwG95nD4CvmMHjAnCbA18xh8A1zGATMYRAyxwY4YA6DLnMY9JjD4FDR9VGYj3hBm0DfJugW0HdJPWGxhcX3im6M2D/wImH/mCBm/5Qgpv6sqD6i/sKLhPprgpj6W4KY+lDRzRH1ES8S6u8JYuofCWLqY/V0MpcZ/vCyK1Q8pOxK58nwm2L9Aw8nY10AeJxj8N7BcCIoYiMjY1/kBsadHAwcDMkFGxnYnbZXpYW5GTGwMWiBeA58uRyxbL5slhzq7NIsbBxQwXK2VJZQFmc2A1ZFJrAgr9N+6QbxBuEGvgYuBnYGoHZOoKiw034GByQIFmVOcdmowtgRGLHBoSMCzFMD8XZxNDAwsjh0JIeABSOBwIEvnyOezZ/NmkOTXZaFjUdrB+P/1g0svRuZGFw2s6awMbi4AADrlS9DAAB4nGNgIBncBcJjDMdYShgY2Of9E2KZ+P8xiAaL72fYz7qYgYHFkYHh3zSQKOux/3dZwv6//leKrob1FYvj/3cIVaz/gere/esBq9sNhFMZpjL9Y3z+X/CfAkiMWZDx+3+mf5zI8mwHWFcyXWZ8BBJju8y6k+kI42ls9iC7hk0c4R4AmMtWvAAAeJyNj08LAVEUxX/DIGVtPQtbGv+iZmWjLNQUzcKWCTWMDPKVfBMfxodwzDwiKb3ePeeed+7tPKDEjDyWXQYC3YxbVNVlPEeFyPA8PmfDbWpcDS/gcDO8iGNVuEhp4dKkS92wnrQBO52IUHzEljmNVI10HPasWbLiQJJ2oTAUnlQXck4YSvelxMKp1LO84/R1zZHND4fz4fHUu8rUUF0IQ2XzXnn7yuvSUW0L/9kXpBkTdbF+9L37sSPb8Jyvv8/fASPuNJwAAAB4nGNgZgCDfzcYZjFgAQA4VwJ0AAABAAH//wAPeJyNUDEOwjAMPCcF2lQChPoAHsDICxBiYmRkQYiJqkPFAH9jZGIF8RIWxGAuKVI7dGhOsZ3zObINAeCwwBZ2uVpvkO0vZY5pvjsVmCFiFqrwqjqWRmxgj4eyQNa0TEq4EZLg46AEvRHjq2Uic6QE9Ko34q5ntB59tfMtyo8+O2sfXZW+A/b3bbzf1fzdav++ns4E+L2kGIfNWAyrTfLfHvoE6AdETJ0LuRFZIeNrPZvQOsauqvoB5z0tQgB4nGNgZGBg4GKIYihhYHZx8wlhEEmuLMphkMtJLMljUGJgAcoy/P/PAAPMjlGuCgxizkEhCgxyIUHeCgxqYHlGqDpGEAtMMzEw5+Qn5zCIIJNARYxgzAKlOYCYDawLyAYAAaIWnAAAAHicY2BkgAKmef81GMgGAGutAckA) format("woff")\n }')), e("text",{"font-size":"13px",textLength:"0em"!==h.letterSpacing?t:void 0,"font-family":r,direction:p?"rtl":"ltr"},n)])},A=function(a){return"number"==typeof a&&!isNaN(a)},D=function(a,b){return b?"left"===a?"right":"left":a},F=function(a){var b=a.width,c=a.height,d=a.logoSize,e=a.labelPosition;a=a.logoPosition;375<(b=Math.floor(b))?b=375:130>b&&(b=130);64<(c=Math.floor(c))?c=64:30>c&&(c=30);e=Math.floor(e);a=Math.floor(a);var f,g,d=(g=c/(f=z[d]).height,Math.floor(f.logoWidth*g));f=Math.floor(0.5* d);g=Math.floor(0.7*d);var h=f+d+g,k=Math.floor(b/2);e>k?e=k:e<h&&(e=h);g=e-g-d;a>g?a=g:a<f&&(a=f);f=Math.floor(0.08*b);e=e-a-d;return{width:b,height:c,leftMargin:a,logoWidth:d,middleMargin:e,labelWidth:b-a-f-e-d,rightMargin:f,contentWidth:b-f-a}},M=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},c=a.id,n=a.color,n=void 0===n?"black":n,p=a.type,r=void 0===p?"sign-in":p,p=a.border,p=void 0!==p&&p,s=a.width,t=void 0===s?"100%":s,s=a.height,u=void 0===s?"100%":s,s=a.borderRadius, s=void 0===s?15:s,v=a.labelPosition,x=void 0===v?0:v,v=a.logoPosition,B=void 0===v?0:v,v=a.logoSize,E=void 0===v?"small":v,a=a.locale,G=void 0===a?"":a,H=document.getElementById(void 0===c?"appleid-button":c),I="100%"===t,K="100%"===u;if(I||K)c=w(H),t=I?c.width:t,u=K?c.height:u,y(H,function(a){a={width:I?a.width:t,height:K?a.height:u,logoPosition:B,labelPosition:x,logoSize:E,locale:G,type:r};var b=a.width,c=a.height,d=a.logoPosition,e=a.labelPosition,f=a.logoSize;a=(a.locale,a.type);var h=m[a].rtl; a=H.firstChild.childNodes;var k=a[0];a=a[1];b=F({width:b,height:c,logoSize:f,labelPosition:e,logoPosition:d});k.style.width=g(b.contentWidth);k.style.height=g(b.height);k.style["padding-".concat(D("right",h))]=g(b.rightMargin);k.style["padding-".concat(D("left",h))]=g(b.leftMargin);e=k.childNodes;c=e[0];d=e[1];e=e[2];c.setAttribute("width",g(b.logoWidth));c.setAttribute("height",g(b.height));d.style.width=g(b.middleMargin);d.style.height=g(b.height);e.setAttribute("width",g(b.labelWidth));e.setAttribute("height", g(b.height));a.setAttribute("width",g(b.width));a.setAttribute("height",g(b.height));a.firstChild.setAttribute("width",g(b.width));a.firstChild.setAttribute("height",g(b.height));!0});c=function(a){var c,d=a.color,n=a.type,p=a.border,r=a.width,s=a.height,t=a.borderRadius,u=a.labelPosition,v=a.logoPosition,w=a.logoSize,x=a.locale;if(!A(r)||!A(s))throw Error("width and height have to be numbers");if(!A(u)||!A(v))throw Error("labelPosition and logoPosition have to be numbers");a=m[n];var y=a.rtl,r=F({width:r, height:s,logoSize:w,labelPosition:u,logoPosition:v}),u=r.logoWidth,w=z[w],v=(w.width-w.logoWidth)/2,n=[e("svg",{xmlns:"http://www.w3.org/2000/svg",height:g(r.height),width:g(u),viewBox:"".concat(v," 0 ").concat(w.logoWidth," ").concat(w.height)},e("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},e("path",{fill:k(d),"fill-rule":"nonzero",d:w.path}))),e("span",{style:f({display:"inline-block",width:g(r.middleMargin),height:g(r.height)})}),C(n,d,x,r.labelWidth,s)];return y&&n.reverse(), e("div",{style:f({"font-synthesis":"none","-moz-font-feature-settings":"kern","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale",position:"relative","letter-spacing":"initial"}),role:"button",tabindex:"0","aria-label":a.text},[e("div",{style:f((c={position:"absolute","box-sizing":"content-box","-webkit-box-sizing":"content-box","-moz-box-sizing":"content-box",width:g(r.contentWidth),height:g(s)},b(c,"padding-".concat(D("right",y)),g(r.rightMargin)),b(c,"padding-".concat(D("left", y)),g(r.leftMargin)),c))},n),h({color:d,borderRadius:t,border:p,width:r.width,height:r.height})])}({color:n,type:r,border:p,width:t,height:u,borderRadius:s,labelPosition:x,logoPosition:B,logoSize:E,locale:G});d(H,c)},E=["0","0"],N=function(){for(var a={},b=0;b<arguments.length;b+=1)for(var c=0>b||arguments.length<=b?void 0:arguments[b],d=Object.keys(c),e=0;e<d.length;e+=1){var f=d[e];a[f]=c[f]}return a},Q=!1,H={baseURI:"https://appleid.apple.com",path:"/auth/authorize",originURI:"",env:"prod",usePopup:!1, responseType:"code id_token",responseMode:"form_post",client:{clientId:"",scope:"",redirectURI:"",state:"",nonce:""}},R=function(a){var b="".concat(a.baseURI).concat(a.path,"?client_id\x3d")+encodeURIComponent(a.client.clientId)+"\x26redirect_uri\x3d"+encodeURIComponent(a.client.redirectURI)+"\x26response_type\x3d"+encodeURIComponent(a.responseType);return["state","scope","nonce"].forEach(function(c){a.client[c]&&(b="".concat(b,"\x26").concat(c,"\x3d").concat(encodeURIComponent(a.client[c])))}),b= (b=(b=a.usePopup?b+"\x26response_mode\x3d"+encodeURIComponent("web_message"):b+"\x26response_mode\x3d"+encodeURIComponent(a.responseMode))+"\x26frame_id\x3d"+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0;return("x"==a?b:3&b|8).toString(16)}))+"\x26m\x3d"+E[0]+E[1],b+="\x26v\x3d1.5.3"},K={},I={},P={},T=function(a){K[a]&&(K[a]=null);O(a,"closed");P[a]&&(clearInterval(P[a]),P[a]=null)},S=function(a){return I[a]||(I[a]=[]),I[a]},O=function(a,b){S(a).forEach(function(a){return a(b)})}, G=function(a,b){return{left:(window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width)/2-a/2+window.screenLeft,top:(window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height)/2-b/2+window.screenTop}},U=G(700,700).left,G=G(700,700).top,W="width\x3d".concat(700,",height\x3d").concat(700,",left\x3d").concat(U,",top\x3d").concat(G,",resizable\x3dno,location\x3dno,menubar\x3dno"), ga=function(){K.AppleAuthentication&&("function"==typeof K.AppleAuthentication.close&&K.AppleAuthentication.close(),T("AppleAuthentication"))},la=function(a){return ga(),b=a,c="AppleAuthentication",d=W,(e=window.open(b,c,d))&&(K[c]=e,P[c]=setInterval(function(){e.closed&&T(c)},300)),e;var b,c,d,e},ba=[],ta=[],pa=function(a){a=ba.indexOf(a);ba.splice(a,1);ta.splice(a,1)},qa=function(a){a=ba.indexOf(a);return ta[a]},ka=function(a){return-1!==ba.indexOf(a)},xa=function(){var a,b,c;return function(a, b){ba.push(a);ta.push(b)}(a=new Promise(function(a,d){c=a;b=d}),{reject:b,resolve:c}),a},wa={},ya=H.baseURI;window.addEventListener("message",function(a){try{if(a.origin===ya){var b=JSON.parse(a.data);b.method in wa&&wa[b.method](b.data)}}catch(c){}},!1);var za=function(a,b){document.dispatchEvent(new CustomEvent(a,{detail:b}))},na=null,ua=!0,fa=!1,Na=function(a){var b;za("AppleIDSignInOnFailure",a);ka(na)&&ua&&ka(b=na)&&(qa(b).reject(a),pa(b))};(function(a){S("AppleAuthentication").push(a)})(function(a){"closed"=== a&&fa&&(Na({error:"popup_closed_by_user"}),fa=!1)});(function(a,b){wa[a]=b})("oauthDone",function(a){if("error"in a)Na(a);else if(za("AppleIDSignInOnSuccess",a),ka(na)&&ua){var b=na;ka(b)&&(qa(b).resolve(a),pa(b))}fa=!1;ga();!0});var da,Ga,Aa=function(a){var b=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];ka(na)&&Na({error:"user_trigger_new_signin_flow"});ua=b;"2"!==E[1]&&(E[1]="1");var c=R(a);E[1]="0";var d,e=!!window.Promise;if(a.usePopup){if(b&&!e)throw Error("Promise is required to use popup, please use polyfill."); if(la(c)){if(fa=!0,b)return d=xa(),na=d}else if(za("AppleIDSignInOnFailure",{error:"popup_blocked_by_browser"}),b)return Promise.reject({error:"popup_blocked_by_browser"})}else window.location.assign(c)},jb=function(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:H;["scope","state","nonce","usePopup"].forEach(function(c){if(a[c])if("usePopup"===c){if("boolean"!=typeof a[c])throw Error('The "'+c+'" should be boolean.');b[c]=a[c]}else{if("string"!=typeof a[c])throw Error('The "'+c+'" should be a string.'); b.client[c]=a[c]}})},Ba=function(){var a,b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,c=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];a=H;if(!Q)throw Error('The "init" function must be called first.');if(b){if(!(b instanceof Object)||Array.isArray(b))throw Error('The "signinConfig" must be "object".');(a=Object.create(H)).client=Object.create(H.client);b.scope&&"string"==typeof b.scope&&(a.client.scope=b.scope);b.redirectURI&&"string"==typeof b.redirectURI&&(a.client.redirectURI= b.redirectURI);jb(b,a)}return Aa(a,c)},kb=function(a){if(!a.clientId||"string"!=typeof a.clientId)throw Error('The "clientId" should be a string.');if(H.client.clientId=a.clientId,!a.redirectURI||"string"!=typeof a.redirectURI)throw Error('The "redirectURI" should be a string.');H.client.redirectURI=a.redirectURI;jb(a);Wa();Q=!0},Ha=function(){E[1]="2";Ba(null,!1)},xb=function(){Ha()},yb=function(a){32===a.keyCode?a.preventDefault():13===a.keyCode&&(a.preventDefault(),Ha())},Oa=function(a){32===a.keyCode&& (a.preventDefault(),Ha())},Wa=function(){var a,b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},c=(a=b.id,document.getElementById(a||"appleid-signin"));c&&(c&&c.firstChild&&c.removeChild(c.firstChild),a=function(a){var b,c,d,e,f;a=a.dataset;var g="center-align",h="black",k=!0,m="sign-in",n="small",p=15;return null!=a&&(a.locale&&(g=a.locale),a.mode&&(g=a.mode),a.color&&(h=a.color),a.border&&(k="false"!==a.border),a.type&&(m=a.type),a.logoSize&&(n=a.logoSize),a.borderRadius&&!isNaN(parseInt(a.borderRadius, 10))&&(p=parseInt(a.borderRadius,10)),"100%"===a.width?b=a.width:a.width&&!isNaN(parseInt(a.width,10))&&(b=parseInt(a.width,10)),"100%"===a.height?c=a.height:a.height&&!isNaN(parseInt(a.height,10))&&(c=parseInt(a.height,10)),"100%"===a.size?d=a.size:a.size&&!isNaN(parseInt(a.size,10))&&(d=parseInt(a.size,10)),a.logoPosition&&!isNaN(parseInt(a.logoPosition,10))&&(e=parseInt(a.logoPosition,10)),a.labelPosition&&!isNaN(parseInt(a.labelPosition,10))&&(f=parseInt(a.labelPosition,10))),"sign in"===m&&(m= "sign-in"),{mode:g,locale:"",color:h,border:k,type:m,borderRadius:p,width:b,height:c,size:d,logoPosition:e,labelPosition:f,logoSize:n}}(c),b=N({id:"appleid-signin"},a,b),"center-align"===a.mode?function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},b=a.id,b=void 0===b?"appleid-button":b,c=a.color,e=a.type,f=a.border,g=a.width,h=a.height,k=a.borderRadius,a=a.locale,a=n({color:void 0===c?"black":c,type:void 0===e?"sign-in":e,border:void 0!==f&&f,width:void 0===g?"100%":g,height:void 0=== h?"100%":h,borderRadius:void 0===k?15:k,locale:void 0===a?"":a});d(b,a)}(b):"left-align"===a.mode?M(b):"logo-only"===a.mode&&function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},b=a.id,b=void 0===b?"appleid-button":b,c=a.color,n=a.size,p=a.border,r=a.borderRadius,a=a.locale,r={color:void 0===c?"black":c,size:void 0===n?"100%":n,border:void 0!==p&&p,borderRadius:void 0===r?15:r,locale:void 0===a?"":a},a=r.color,a=void 0===a?"black":a,c=r.size,n=r.border,n=void 0!==n&&n,p=r.borderRadius, r=(r.locale,m["sign-in"]),s='\n \x3csvg xmlns\x3d"http://www.w3.org/2000/svg" style\x3d"overflow:visible" width\x3d"100%" height\x3d"100%" viewBox\x3d"6 6 44 44"\x3e\n \x3cg fill\x3d"none" fill-rule\x3d"evenodd"\x3e\n \x3cpath fill\x3d"'.concat(k(a),'" fill-rule\x3d"nonzero" d\x3d"M28.2226562,20.3846154 C29.0546875,20.3846154 30.0976562,19.8048315 30.71875,19.0317864 C31.28125,18.3312142 31.6914062,17.352829 31.6914062,16.3744437 C31.6914062,16.2415766 31.6796875,16.1087095 31.65625,16 C30.7304687,16.0362365 29.6171875,16.640178 28.9492187,17.4494596 C28.421875,18.06548 27.9414062,19.0317864 27.9414062,20.0222505 C27.9414062,20.1671964 27.9648438,20.3121424 27.9765625,20.3604577 C28.0351562,20.3725366 28.1289062,20.3846154 28.2226562,20.3846154 Z M25.2929688,35 C26.4296875,35 26.9335938,34.214876 28.3515625,34.214876 C29.7929688,34.214876 30.109375,34.9758423 31.375,34.9758423 C32.6171875,34.9758423 33.4492188,33.792117 34.234375,32.6325493 C35.1132812,31.3038779 35.4765625,29.9993643 35.5,29.9389701 C35.4179688,29.9148125 33.0390625,28.9122695 33.0390625,26.0979021 C33.0390625,23.6579784 34.9140625,22.5588048 35.0195312,22.474253 C33.7773438,20.6382708 31.890625,20.5899555 31.375,20.5899555 C29.9804688,20.5899555 28.84375,21.4596313 28.1289062,21.4596313 C27.3554688,21.4596313 26.3359375,20.6382708 25.1289062,20.6382708 C22.8320312,20.6382708 20.5,22.5950413 20.5,26.2911634 C20.5,28.5861411 21.3671875,31.013986 22.4335938,32.5842339 C23.3476562,33.9129053 24.1445312,35 25.2929688,35 Z"\x3e\x3c/path\x3e\n \x3c/g\x3e\n \x3c/svg\x3e'), c=f({"font-synthesis":"none","-moz-font-feature-settings":"kern","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale",width:g(c),height:g(c),"min-width":"30px","max-width":"64px","min-height":"30px","max-height":"64px",position:"relative"}),a=e("div",{style:c,role:"button",tabindex:"0","aria-label":r.text},"\n ".concat(e("div",{style:f({position:"absolute","box-sizing":"border-box",width:"100%",height:"100%"})},s),"\n ").concat(e("div",{style:f({padding:n?"1px":void 0, width:"100%",height:"100%","box-sizing":"border-box"})},h({color:a,borderRadius:p,border:n,isSquare:!0})),"\n "));d(b,a)}(b),c.addEventListener("click",xb),c.addEventListener("keydown",yb),c.addEventListener("keyup",Oa))};!function(a){a.ClientId="appleid-signin-client-id";a.Scope="appleid-signin-scope";a.RedirectURI="appleid-signin-redirect-uri";a.State="appleid-signin-state";a.Nonce="appleid-signin-nonce";a.UsePopup="appleid-signin-use-popup";a.DEV_URI="appleid-signin-dev-uri";a.DEV_ENV="appleid-signin-dev-env"; a.DEV_PATH="appleid-signin-dev-path"}(da||(da={}));var hb=function(){if(!Ga){Ga={};for(var a=function(){var a={};return Object.keys(da).forEach(function(b){return a[da[b]]=!0}),a}(),b=document.getElementsByTagName("meta"),c="",d=0;d<b.length;d++)a[c=b[d].getAttribute("name")]&&(Ga[c]=b[d].getAttribute("content"))}return Ga},Pa={},U={init:function(a){"2"===E[0]?E[0]="3":E[0]="1";Pa=N({},Pa,a);kb(a)},signIn:function(){return Ba(0<arguments.length&&void 0!==arguments[0]?arguments[0]:null)},renderButton:Wa}, Xa=function(){if(a=hb(),0<Object.keys(a).length){"1"===E[0]?E[0]="4":E[0]="2";var a={clientId:"",scope:"",redirectURI:"",state:"",nonce:""},b=hb();b[da.ClientId]&&(a.clientId=b[da.ClientId]);b[da.Scope]&&(a.scope=b[da.Scope]);b[da.RedirectURI]&&(a.redirectURI=b[da.RedirectURI]);b[da.State]&&(a.state=b[da.State]);b[da.Nonce]&&(a.nonce=b[da.Nonce]);b[da.UsePopup]&&(a.usePopup="true"===b[da.UsePopup]);var c=b[da.DEV_ENV],d=b[da.DEV_PATH],b=b[da.DEV_URI];if(c||d||b)c&&(H.env=c),d&&(H.path=d),b&&(H.baseURI= b,"dev"===H.env&&(ya=H.baseURI));kb(N({},a,Pa))}var a};"complete"===document.readyState||"loaded"===document.readyState||"interactive"===document.readyState?Xa():document.addEventListener("DOMContentLoaded",function(){Xa()});setTimeout(function(){return za("AppleIDSigInLoaded")});a.auth=U;Object.defineProperty(a,"__esModule",{value:!0})});var RSSSOManager={_googleSignedInStatus:!1,_fbSignedInStatus:!1,_appleSignedInStatus:!1,_emailSignedInStatus:!1,_blobIdData:null,_linkingStartedAt:null,_emailVerificationDetails:null,_emailVerificationCallBack:null,_fbConnectFromGifting:!1,initializeSSOManager:function(a){RSSocialManager.getInstance().checkFBConnected(function(a){"connected"==a&&(this._fbSignedInStatus=!0)});this._emailVerificationDetails=null;this._blobIdData=a;this.getEmailVerificationDetails()},getGoogleSignedInStatus:function(){return this._googleSignedInStatus}, getFbSignedInStatus:function(){return this._fbSignedInStatus},getAppleSignedInStatus:function(){return this._appleSignedInStatus},getEmailSignedInStatus:function(){return this._emailSignedInStatus},getBlobIdData:function(){return this._blobIdData},getFoxwoodsPlayerStatus:function(){return null!=this._blobIdData.isFoxwoodUser||void 0!=this._blobIdData.isFoxwoodUser?this._blobIdData.isFoxwoodUser:0},getEmailVerifiedStatus:function(){var a=this._blobIdData.emailVerificationDetails?this._blobIdData.emailVerificationDetails.verified: !1;if("1"==a||"2"==a)return!1;a=this._blobIdData.emailVerificationDetails?this._blobIdData.emailVerificationDetails.immediateVerificationRequired:void 0;return"false"==a||void 0==a||""==a||null==a||this._emailVerificationDetails&&(a=this._emailVerificationDetails.verified,"1"==a||"2"==a)?!1:!0},checkAndUpdateSocialLogin:function(a,b){var c=!1,d=GameConfig.COOKIE_PREFIX,d=RSLoginManager.getInstance().getCookie(d+"-loginType"),e=this._blobIdData.emailVerificationDetails?this._blobIdData.emailVerificationDetails.verified: !1;if("1"==e||"2"==e)c=!0;if(d.includes("google")||d.includes("facebook")||"google"==b)if(this._blobIdData.google||this._blobIdData.facebook||"google"==b)c=!0;"1"==e?RSLoginManager.getInstance().updateSocialLogin("email",this._blobIdData.emailVerificationDetails.emailId,null,null,null,!0):this._emailVerificationDetails&&"1"==this._emailVerificationDetails.verified&&(RSLoginManager.getInstance().updateSocialLogin("email",this._emailVerificationDetails.emailId,null,null,null,!0),c=!0);!c||this.checkForMigratedUserOrNOt()|| RSGame.getInstance().getUserDataManager().getMe().getLoginRewardStatus()||a&&a(!0);a&&a(!1)},checkForMigratedUserOrNOt:function(){return this._blobIdData?this._blobIdData.emailVerificationDetails&&this._blobIdData.emailVerificationDetails.isNew&&("0"==this._blobIdData.emailVerificationDetails.isNew||0==this._blobIdData.emailVerificationDetails.isNew)?!0:!1:!1},saveCurrentServerTimeForGettingLinkingTime:function(){this._linkingStartedAt=TimeManager.getInstance().getCurrentServerTime()},getLinkingTime:function(){return TimeManager.getInstance().getCurrentServerTime()- this._linkingStartedAt},getEmailVerificationDetails:function(){var a=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-emailValue");a&&RSLoginManager.getInstance().checkEmailVerificationStatus(a,this.onEmailVerificationCallBack.bind(this))},onEmailVerificationCallBack:function(a){200==a.result.status&&(this._emailVerificationDetails=a.result)},setCookieEmailVerificationStatus:function(a){this._emailVerificationDetails=a},getCookieEmailVerificationData:function(){return this._emailVerificationDetails}, getCookieEmailVerificationStatus:function(){if(this._emailVerificationDetails){var a=this._emailVerificationDetails.verified;if("1"==a||"2"==a)return!1;if(this.checkForMigratedUserOrNOt())return!0;a=this._emailVerificationDetails.immediateVerificationRequired?this._emailVerificationDetails.immediateVerificationRequired:!1;if(!0==a||"true"==a)return!0}return!1},showEmailVerificationPromtPopup:function(a,b,c){b&&(this._emailVerificationCallBack=b);RSEngine.popupManager.addPopup(new RSEmailVerificationPromptPopup(a, this.onEmailVerificationPopupClosed.bind(this),c),!0)},showEmailVerificationPopup:function(a,b,c){c&&(this._emailVerificationCallBack=c);RSEngine.popupManager.addPopup(new RSEmailVerificationPopup(a,b,this.onEmailVerificationPopupClosed.bind(this)),!0)},onEmailVerificationPopupClosed:function(){var a=!1;if(this._emailVerificationDetails){var b=this._emailVerificationDetails.verified;if("1"==b||"2"==b)a=!0}a&&!RSGame.getInstance().getUserDataManager().getMe().getLoginRewardStatus()?this._emailVerificationCallBack&& this._emailVerificationCallBack(!0):this._emailVerificationCallBack&&this._emailVerificationCallBack(!1);this._emailVerificationCallBack=null},initiateAppleSignIn:function(){AppleID.auth.init({clientId:GameConfig.APPLE_CLIENT_ID,usePopup:!0,scope:"name email",redirectURI:GameConfig.APPLE_REDIRECT_URL});try{AppleID.auth.signIn()}catch(a){console.log("authentication error in catched")}},getEmailVerificationStatusInGifting:function(){var a=!1;this._emailVerificationDetails&&"0"==this._emailVerificationDetails.verified&& (a=!0);return this.checkForMigratedUserOrNOt()&&a?!0:!1},getFbConnectStatusInGifting:function(){return this._fbConnectFromGifting},setFbConnectStatusInGifting:function(a){this._fbConnectFromGifting=a},getLoginRewardPopupStatus:function(){if(RSGame.getInstance().getUserDataManager().getMe().getLoginRewardStatus())return!1;if(!this.checkForMigratedUserOrNOt()){var a=GameConfig.COOKIE_PREFIX,a=RSLoginManager.getInstance().getCookie(a+"-loginType"),b=[],b=a.split("|");return a&&1==b.length&&"email"== a?(a=this._emailVerificationDetails?this._emailVerificationDetails.verified:null,"1"==a||"2"==a?!0:!1):!0}return!1},checkAndTrackRegisterNowEvent:function(a){var b=[],b=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-loginType").split("|");"email"!=a&&b&&1<b.length||RSGame.getInstance().getUserDataManager().getMe().getFirstSignIn()&&!RSGame.getInstance().getUserDataManager().getMe().getLoginRewardStatus()&&RSEngine.loginMode===LOGIN_MODE.EMAIL&&""===RSGame.getInstance().getUserDataManager().getMe().getAvatar()&& RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","register_now","success",RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId"),"")}};var googleInitializationCompleted=!1,getUserDetailsOnce=!1,GoogleAuth,client;function init(){cc.log("Init completed")}function initializeGoogleSignIn(a,b){a&&initiateAlternateGoogleSignIn()}function getUserProfileImageUrl(){return RSLoginManager.getInstance().getCookie("imageUrl")}function onError(){console.log("Authentication failed");RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","link_google","fail","","Authentication failed")} function initiateAlternateGoogleSignIn(){cc.log("sign in initiated");client=google.accounts.oauth2.initTokenClient({client_id:GameConfig.GOOGLE_CLIENT_ID,scope:"https://www.googleapis.com/auth/userinfo.email",callback:googleSignInCallBack});client.requestAccessToken()} function googleSignInCallBack(a){cc.log("here");var b=new XMLHttpRequest;b.open("GET","https://www.googleapis.com/oauth2/v1/userinfo?alt\x3djson\x26access_token\x3d"+a.access_token,!0);b.setRequestHeader("Content-Type","application/json;charset\x3dUTF-8");b.send();b.onload=function(){try{var a=JSON.parse(b.responseText);onSuccess(a)}catch(d){}}} function onSuccess(a){cc.log("data received");var b={};b.imageUrl=a.picture;RSLoginManager.getInstance().setCookie(GameConfig.SSO_COOKIE_DOMAIN,null,b);RSEngine.screenManager.addOverlay();RSLoginManager.getInstance().updateSocialLogin("google",a.id,a.email)}function signOut(){cc.log("User signed out.")};var RSSlotsLobbyFeatured=RSDisplayObject.extend({init:function(a,b){var c=new RSRect(0,0,0,0);this._super.init.call(this,c);this._assetList=a;this._scrollRect=this._assetList.widget;this._delegate=b;this.loadContent()},loadContent:function(){this.loadLayout(RSGame.getInstance().getAssetPath("SlotsLobbyFeaturedWidget"),1)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._addFeaturedMachinesToScroller();this.setVisible(!1);this.setTouchEnabled(!1)},setVisible:function(a){this._scroller&& this._scroller.setVisible(a);this._super.setVisible.call(this,a)},createCustomObject:function(a,b){switch(b.name){case "BigMachineIcon":this._iconHolder=b}},_setGameData:function(a){this._data=RSEngine.gameData.getSheetData(this._sheetName[a])},setCustomSlider:function(a){this._scroller&&a instanceof RSControlSlider&&this._scroller.setCustomSlider(a)},_addFeaturedMachinesToScroller:function(){this._featureMachineList=SlotsLobbyWidgetManager.getInstance().getFeaturedMachineData();if(0<this._featureMachineList.length){var a= [];this._scroller=new RSScrollHolderLayer(cc.size(this._scrollRect.w,this._scrollRect.h));this._scroller.initializeScroller(cc.size(this._scrollRect.w,this._scrollRect.h),this._assetList.scrollDirection,this._assetList.scrollLevelCount,!0,this._assetList.horizontalScrollPadding,this._assetList.verticalScrollPadding,this._assetList.scrollerMargin);this._scroller.setPosition(this._scrollRect.x,this._scrollRect.y);this.addChild(this._scroller);for(var b=0;b<this._featureMachineList.length;b++){this._featureMachineList[b].showJackpotLoungeHeader= !1;var c=void 0==this._assetList.largeIconPrefix?"Large":this._assetList.largeIconPrefix,c=this._featureMachineList[b].iconUrlLarge?new RSCasinoIconHolder("LONG_ICON",this._iconHolder,this._featureMachineList[b].iconUrlLarge,this.onFeaturedIconClicked.bind(this),this._featureMachineList[b],!1,this._assetList.fonts,!0,null,null,null,1):new RSCasinoIconHolder("LONG_ICON",this._iconHolder,this._assetList.iconPath+c+this._featureMachineList[b].imageName,this.onFeaturedIconClicked.bind(this),this._featureMachineList[b], !1,this._assetList.fonts,!0,null,null,null,1);a.push(c)}0<a.length&&(this._scroller.addElements(a),a=this._assetList.scrollRoundWidthAndHeight?this._assetList.scrollRoundWidthAndHeight:33,this._scroller.enableSlider(this._assetList.scrollBarPath+"ScrollBar.png",cc.size(this._assetList.scrollBarWidth?this._assetList.scrollBarWidth:506,this._assetList.scrollBarHeight?this._assetList.scrollBarHeight:19),this._assetList.scrollBarPath+"ScrollRound.png",cc.size(a,a)))}this._delegate.onAssetLoadCompleted("FEATURED")}, onFeaturedIconClicked:function(a,b,c){GlobalVars.slotsLobbySelectedTab=TabType.FEATURED;RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"),!1);c&&GameConfig.JACKPOT_LOUNGE_ENABLE?RSGame.getInstance().getGameManager().callJLMachineSelectPopup(a):RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Slots,a.machine_identifier,RSGameScreens.SlotsLobby)},unload:function(){this._scroller&&this._scroller.unload();this._super.unload.call(this)}});var RSSlotsLobbyFavourites=RSDisplayObject.extend({init:function(a,b,c,d){var e=new RSRect(0,0,0,0);this._super.init.call(this,e);this._assetList=a;this._addFavSlider=d;this._scrollRect=this._assetList.widget;this._favouriteMachinesCount=c;this._delegate=b;this.loadContent()},loadContent:function(){this.loadLayout(RSGame.getInstance().getAssetPath("SlotsLobbyFavouritesWidget"),1)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);1==parseInt(RSGame.getInstance().getGameData().getDefaultValues().isFavoritesEnabled)? (RSFavoritesLobbyWidgetManager.getInstance().setFavoriteMachineData(RSGameTypes.Slots),this.addCustomfavoritemachines()):this._addFavouriteMachinesToScroller();this.setVisible(!1);this.setTouchEnabled(!1)},createCustomObject:function(a,b){switch(b.name){case "BigMachineIcon":this._iconHolder=b;this._iconHolderSize=new RSSize(this._iconHolder.w,this._iconHolder.h);break;case "TouchArea":this._favoritesScrollerRect=b}},setVisible:function(a){this._scroller?this._scroller.setVisible(a):this._favoritesScrollerWidget&& this._favoritesScrollerWidget._scroller&&this._favoritesScrollerWidget._scroller.setVisible(a);this._super.setVisible.call(this,a)},setCustomSlider:function(a){a instanceof RSControlSlider&&(this._scroller?this._scroller.setCustomSlider(a):this._favoritesScrollerWidget&&this._favoritesScrollerWidget._scroller&&this._favoritesScrollerWidget._scroller.setCustomSlider(a))},_addFavouriteMachinesToScroller:function(){this._favouritesmachineList=SlotsLobbyWidgetManager.getInstance().getTopFavouritesMachineInSlots(this._favouriteMachinesCount); if(0<this._favouritesmachineList.length){var a=[];this._scroller=new RSScrollHolderLayer(cc.size(this._scrollRect.w,this._scrollRect.h));this._scroller.initializeScroller(cc.size(this._scrollRect.w,this._scrollRect.h),this._assetList.scrollDirection,this._assetList.scrollLevelCount,!0,this._assetList.horizontalScrollPadding,this._assetList.verticalScrollPadding,this._assetList.scrollerMargin);this._scroller.setPosition(this._scrollRect.x,this._scrollRect.y);this.addChild(this._scroller);for(var b= 0;b<this._favouritesmachineList.length;b++){this._favouritesmachineList[b].showJackpotLoungeHeader=!1;var c=void 0==this._assetList.largeIconPrefix?"Large":this._assetList.largeIconPrefix,c=this._favouritesmachineList[b].iconUrlLarge?new RSCasinoIconHolder("LONG_ICON",this._iconHolder,this._favouritesmachineList[b].iconUrlLarge,this.onFavouritesIconClicked.bind(this),this._favouritesmachineList[b],!1,this._assetList.fonts,!0,null,""!==this._favouritesmachineList[b].jackpotLoungeName?this._favouritesmachineList[b].jackpotLoungeName: null):new RSCasinoIconHolder("LONG_ICON",this._iconHolder,this._assetList.iconPath+c+this._favouritesmachineList[b].imageName,this.onFavouritesIconClicked.bind(this),this._favouritesmachineList[b],!1,this._assetList.fonts,!0,null,""!==this._favouritesmachineList[b].jackpotLoungeName?this._favouritesmachineList[b].jackpotLoungeName:null);a.push(c)}0<a.length&&(this._scroller.addElements(a),a=this._assetList.scrollRoundWidthAndHeight?this._assetList.scrollRoundWidthAndHeight:33,this._scroller.enableSlider(this._assetList.scrollBarPath+ "ScrollBar.png",cc.size(this._assetList.scrollBarWidth?this._assetList.scrollBarWidth:506,this._assetList.scrollBarHeight?this._assetList.scrollBarHeight:19),this._assetList.scrollBarPath+"ScrollRound.png",cc.size(a,a)))}this._delegate.onAssetLoadCompleted("FAVOURITES")},onFavouritesIconClicked:function(a,b,c){GlobalVars.slotsLobbySelectedTab=TabType.FAVOURITES;RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"),!1);c&&GameConfig.JACKPOT_LOUNGE_ENABLE?RSGame.getInstance().getGameManager().callJLMachineSelectPopup(a): RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Slots,a.machine_identifier,RSGameScreens.SlotsLobby)},addCustomfavoritemachines:function(){this._favoritesScrollerWidget=new RSFavoritesScrollerWidget(this._favoritesScrollerRect,this.addBottomItems.bind(this));this.addChild(this._favoritesScrollerWidget);this._favoritesScrollerWidget.setAnchorPoint(0.5,0.5);this._delegate.onAssetLoadCompleted("FAVOURITES")},addBottomItems:function(a){a&&this._addFavSlider()},removeFavMachine:function(){this._favoritesScrollerWidget.removeChild(this._scroller); this._favoritesScrollerWidget._machineConfig=[];this._favoritesScrollerWidget.addScroller()},unload:function(){this._scroller&&this._scroller.unload();this._super.unload.call(this)}});var VIPIconLargeOverlay=RSDisplayObject.extend({init:function(a,b,c){b=new RSRect(0,0,b.w,b.h);this._super.init.call(this,b);this._enabled=c;this._assetPath=RSGame.getInstance().getAssetPath("VIPIconLargeOverlay");this._machineDetails=a;this._lockAnimStarted=!1;this.loadContent()},loadContent:function(){this.loadLayout(this._assetPath)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.handleVIPTierStatus()},showToolTip:function(){this._vipLockedInfo.isVisible()||(this._vipLockedInfo.setVisible(!0), this._vipLockedInfo.addTouchListenerWithDelegate(this,!0),this.scheduleFunctionOnce(this.hideToolTip.bind(this),3),this.showLockAnimation())},hideToolTip:function(){this._vipLockedInfo&&this._vipLockedInfo.setVisible(!1)},handleVIPTierStatus:function(){var a=RSVIPManager.getInstance().getVIPUserTier();this._iconTier=this._machineDetails.VIPTier;a>=this._iconTier||this._enabled?(this._vipTierTag.setVisible(!1),this._vipUnlockTag.setVisible(!1)):(this._vipTierTag.setFrame(this._iconTier-1),this._vipTierTag.setVisible(!0), this._vipUnlockTag.setVisible(!0))},onObjectCreated:function(a,b,c){switch(c.type){case "Animation":switch(c.name){case "VIPUnlockedTagAnim":this._vipTierTag=a,this._vipTierTag.stopAnimation(),this._vipTierTag.setVisible(!1)}}},showLockAnimation:function(){!1==this._lockAnimStarted&&(this._lockAnimStarted=!0,this._vipTierTag.actionScaleInOut(0.3,1.09,1,1.02,1,2,this.onLockAnimCompleted.bind(this)))},onLockAnimCompleted:function(){this._lockAnimStarted=!1},createCustomObject:function(a,b){this._super.createCustomObject.call(this, a,b);switch(b.name){case "VIPUnlockTag":this._vipUnlockTag=RSUtils.createBasicObject(a,b);this.addChild(this._vipUnlockTag);this._vipUnlockTag.setVisible(!1);break;case "VIPUnlockedTag":this._vipUnlockedTag=RSUtils.createBasicObject(a,b);this.addChild(this._vipUnlockedTag);this._vipUnlockedTag.setVisible(!1);break;case "VIPLockedInfo":this._vipLockedInfo=RSUtils.createBasicObject(a,b),this._vipLockedInfo.setVisible(!1),this.addChild(this._vipLockedInfo)}},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a, b,c){},handleObjectTouchEndAt:function(a,b,c){switch(a._ccObject._name){case "VIPLockedInfo":GlobalVars.isMachineLoadingInProgress||RSGame.getInstance().getGameManager().showVIPBenefitsPopup()}},unloadContent:function(){this._super.unloadContent.call(this)}});var VIPIconMiniOverlay=RSDisplayObject.extend({init:function(a,b,c){b=new RSRect(0,0,b.w,b.h);this._super.init.call(this,b);this._enabled=c;this._assetPath=RSGame.getInstance().getAssetPath("VIPIconMiniOverlay");this._machineDetails=a;this._lockAnimStarted=!1;this.loadContent()},loadContent:function(){this.loadLayout(this._assetPath)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.handleVIPTierStatus()},handleVIPTierStatus:function(){var a=RSVIPManager.getInstance().getVIPUserTier(); this._iconTier=this._machineDetails.VIPTier;a>=this._iconTier||this._enabled?this._vipTierTag.setVisible(!1):(this._vipTierTag.setFrame(this._iconTier-1),this._vipTierTag.setVisible(!0))},onObjectCreated:function(a,b,c){switch(c.type){case "Animation":switch(c.name){case "VIPUnlockedTagAnim":this._vipTierTag=a,this._vipTierTag.stopAnimation(),this._vipTierTag.setVisible(!1)}}},showLockAnimation:function(){!1==this._lockAnimStarted&&(this._lockAnimStarted=!0,this._vipTierTag.actionScaleInOut(0.3,1.09, 1,1.02,1,2,this.onLockAnimCompleted.bind(this)))},onLockAnimCompleted:function(){this._lockAnimStarted=!1},showToolTip:function(){this._vipLockedInfo&&!this._vipLockedInfo.isVisible()&&(this._vipLockedInfo.addTouchListenerWithDelegate(this,!0),this._vipLockedInfo.setVisible(!0),this.scheduleFunctionOnce(this.hideToolTip.bind(this),3),this.showLockAnimation())},hideToolTip:function(){this._vipLockedInfo&&this._vipLockedInfo.setVisible(!1)},createCustomObject:function(a,b){this._super.createCustomObject.call(this, a,b);switch(b.name){case "VIPFrame":this._vipFrame=RSUtils.createBasicObject(a,b);this._vipFrame.setVisible(!0);this.addChild(this._vipFrame);break;case "VIPLockedInfo":this._vipLockedInfo=RSUtils.createBasicObject(a,b),this._vipLockedInfo.setVisible(!1),this.addChild(this._vipLockedInfo)}},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){switch(a._ccObject._name){case "VIPLockedInfo":GlobalVars.isMachineLoadingInProgress||RSGame.getInstance().getGameManager().showVIPBenefitsPopup()}}, unloadContent:function(){this._super.unloadContent.call(this)}});var RSSlotsLobbyAllSlots=RSDisplayObject.extend({init:function(a,b,c){var d=new RSRect(0,0,0,0);this._super.init.call(this,d);this._assetList=a;this._scrollRect=this._assetList.widget;this.machineList=[];this.JLMachineHolderList=[];this._JLValue=this._JLBaseValue=0;this._delegate=b;this._lobbyIconConfiguration=null;c&&RSEventManager.getInstance().addEventListener("onMachineRemovedFromFavorites",this,this.onMachineUnFavorites.bind(this));this.loadContent()},loadContent:function(){this.loadLayout(RSGame.getInstance().getAssetPath("SlotsLobbyAllSlotsWidget"), 1)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);SlotsLobbyWidgetManager.getInstance().checkIsSlotsMachineLoaded()||SlotsLobbyWidgetManager.getInstance().InitializeDefaultScrollerParams(this._assetList.autoScrollParams);this._lobbyIconConfiguration=SlotsLobbyWidgetManager.getInstance().getLobbyIconConfiguration();this._createSlotsLobbyScroller();this.setVisible(!1);this.setTouchEnabled(!1);0<this.JLMachineHolderList.length&&(this.onJackpotData(),RSEventManager.getInstance().addEventListener("onJackpotGetData", this,this.onJackpotData.bind(this)))},onJackpotData:function(){var a=JackpotLoungeDataHandler.getInstance().getJackpotValue("mega");a&&(this._JLBaseValue=a.baseValue,this._JLValue=a.value,this.setJackpotValuesToIcons())},setJackpotValuesToIcons:function(){if(0<this.JLMachineHolderList.length)for(var a in this.JLMachineHolderList)this.JLMachineHolderList[a].setJackPotValuesToIconHolder(this._JLBaseValue,this._JLValue)},startAutoScroll:function(){this._scroller&&this._scroller.startAutoScroll(this.onAutoScrollCompleted.bind(this))}, onAutoScrollCompleted:function(){if(0<this.machineList.length&&SlotsLobbyWidgetManager.getInstance().checkIsSlotsMachineLoaded())for(var a in this.machineList)if(a==SlotsLobbyWidgetManager.getInstance().getSelectedMachineIndex()){this.machineList[a].playIconAnimations();break}},setVisible:function(a){this._scroller.setVisible(a);this._super.setVisible.call(this,a)},createCustomObject:function(a,b){switch(b.name){case "SmallMachineIconTop":this._smallIconHolder=b;break;case "BigMachineIcon":this._bigIconHolder= b;break;case "TallMachineIcon":this._tallIconHolder=b;break;case "SlotsScrollbarWidget":this.sliderPanel=new RSPanel(b.x,b.y,b.w,b.h),this.addChild(this.sliderPanel)}},reInitializeVIPMachinesOnTierUpdate:function(){if(0<this.machineList.length)for(var a in this.machineList)this.machineList[a]._checkAndEnableMachineLock()},setCustomSlider:function(a){a instanceof RSControlSlider&&this._scroller.setCustomSlider(a)},_createSlotsLobbyScroller:function(){this._slotsLobbyMachines=SlotsLobbyWidgetManager.getInstance().getAllSlotsMachines(); this._scroller=new RSScrollHolderLayer(cc.size(this._scrollRect.w,this._scrollRect.h));this._scroller.initializeScroller(cc.size(this._scrollRect.w,this._scrollRect.h),this._assetList.scrollDirection,this._assetList.scrollLevelCount,!1,this._assetList.horizontalScrollPadding,this._assetList.verticalScrollPadding,this._assetList.scrollerMargin);this._scroller.setPosition(this._scrollRect.x,this._scrollRect.y);this.addChild(this._scroller);var a="LONG_ICON_ALLSLOTS",b="",c=this._smallIconHolder,d=this._lobbyIconConfiguration.Enabled, e=0,f=!1,g=parseInt(RSGame.getInstance().getGameData().getDefaultValues().isFavoritesEnabled);if(d)var h=this._lobbyIconConfiguration.showIconsTillLevel,k=this._lobbyIconConfiguration.showCountForLockedIcons,m=this._lobbyIconConfiguration.showCountForHiddenIcons,n=RSGame.getInstance().getLevelManager().getCurrentLevel(),p=SlotsLobbyWidgetManager.getInstance().getFeaturedMachineData(),r=!1;for(var s=0;s<this._slotsLobbyMachines.length;s++){var u=null,f=!1,t=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots, this._slotsLobbyMachines[s].id);if(null!=t){t.jackpotLoungeName&&(u=t.jackpotLoungeName);1==this._slotsLobbyMachines[s].type?(a="SMALL_ICON",b=t.iconUrl?t.iconUrl:this._assetList.smallIconPath+t.imageName,c=this._smallIconHolder,u=null):2==this._slotsLobbyMachines[s].type?(a="TALL_ICON",b=void 0==this._assetList.tallIconPrefix?"Tall":this._assetList.tallIconPrefix,b=this._assetList.tallIconPath+b+t.imageName,c=this._tallIconHolder):3==this._slotsLobbyMachines[s].type?(a="TALL_ICON",b=void 0==this._assetList.tallIconPrefix? "Tall":this._assetList.tallIconPrefix,b=this._assetList.tallIconPath+b+t.imageName,c=this._tallIconHolder,u=null):(a="LONG_ICON_ALLSLOTS",b=void 0==this._assetList.largeIconPrefix?"Large":this._assetList.largeIconPrefix,b=t.iconUrlLarge?t.iconUrlLarge:this._assetList.largeIconPath+b+t.imageName,c=this._bigIconHolder);t.showJackpotLoungeHeader=!0;r=null;if(d){for(var r=!1,v=0;v<p.length;v++)if(p[v].machine_identifier==t.machine_identifier){r=!0;break}var v=RSGame.getInstance().getUserDataManager().getMe().isMachineFeaturedInNewMachines(t.machine_identifier), w=RSGame.getInstance().getGameManager().isFavoritedMachine(RSGameTypes.Slots,t.machine_identifier);if(e>=k+m)break;if(t.levelRequired>h&&n<t.levelRequired&&0>=t.VIPTier)if("SMALL_ICON"==a||"TALL_ICON"==a&&null==u){if(e>=k&&(r||v||w))continue;if(e<k+m)f=!0,e++;else break}else{if(e>=k)continue}else if(e>k&&("LONG_ICON_ALLSLOTS"==a||"TALL_ICON"==a&&null!=u))continue}r={isFavEnabled:g?g:0,gameType:RSGameTypes.Slots};r=f&&e>k&&!UrlNotificationManager.getInstance().getAllMachineUnlockStatus()?new RSCasinoIconHolder(a, c,b,this.onAllSlotsIconClicked.bind(this),t,!1,this._assetList.fonts,!0,this._assetList.Y_offSetForBigIcon,u,s,!1,!0,r):new RSCasinoIconHolder(a,c,b,this.onAllSlotsIconClicked.bind(this),t,!1,this._assetList.fonts,!0,this._assetList.Y_offSetForBigIcon,u,s,!1,!1,r);r.getDisplayObject()._name="allSlotsIcon";null==u||"LONG_ICON_ALLSLOTS"!=a&&"TALL_ICON"!=a||this.JLMachineHolderList.push(r);this.machineList.push(r)}}0<this.machineList.length&&(this._scroller.addElements(this.machineList),a=this._assetList.scrollRoundWidthAndHeight? this._assetList.scrollRoundWidthAndHeight:33,this._scroller.enableSlider(this._assetList.scrollBarPath+"ScrollBar.png",cc.size(this._assetList.scrollBarWidth?this._assetList.scrollBarWidth:506,this._assetList.scrollBarHeight?this._assetList.scrollBarHeight:19),this._assetList.scrollBarPath+"ScrollRound.png",cc.size(a,a)));this._scroller.setAutoScrollConfig(this._assetList.autoScrollParams.duration,SlotsLobbyWidgetManager.getInstance().getSlotsLobbyFromIndex(),SlotsLobbyWidgetManager.getInstance().getSlotsLobbyTargetIndex()); this._delegate.onAssetLoadCompleted("ALLSLOTS")},setScrollerToInitialPosition:function(){"UP"==GameConfig.GAME_ID?this._scroller.setAutoScrollConfig(0,0,1):this._scroller.setAutoScrollConfig(0,1,1)},onAllSlotsIconClicked:function(a,b,c,d,e){if(!GlobalVars.isMachineLoadingInProgress){this._machineData=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots,a.machine_identifier);RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"),!1);if(0<parseInt(a.VIPTier)){if(RSEngine.loginMode== LOGIN_MODE.GUEST){RSGame.getInstance().getGameManager().showLoginPopup("feature","VIPPopup");return}if(!b)return}GlobalVars.slotsLobbySelectedTab=TabType.ALLSLOTS;(c||this._machineData.jackpotLoungeName)&&GameConfig.JACKPOT_LOUNGE_ENABLE?c&&"1"==RSEngine.gameData.getSheetData("platformDataConfig")[0].isJLSelectPopupDisabled?(RSCasinoManager.triggerMachineEvent("gui_jackpot_lounge","jackpot_popup","lounge_play"),SlotsLobbyWidgetManager.getInstance().jackpotLoungeMachineSelectPopupCallBack("jackpot", a)):RSGame.getInstance().getGameManager().callJLMachineSelectPopup(a,null,null,c):RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Slots,a.machine_identifier,RSGameScreens.SlotsLobby);SlotsLobbyWidgetManager.getInstance().setSlotsMachineLoaded(!0);this._selectedIndex=e;SlotsLobbyWidgetManager.getInstance().setSlotsLobbySelectedIndex(e,this._assetList.autoScrollParams)}},onMachineUnFavorites:function(a){var b=a.getUserData().machineID;a=a.getUserData().jackPotName;for(var c in this.machineList)a? this.machineList[c].getMachineIdentifier()==b&&this.machineList[c].getJackpotName()==a&&this.machineList[c].unSetFavoritesInAllSlots():this.machineList[c].getMachineIdentifier()!=b||this.machineList[c].getJackpotName()||this.machineList[c].unSetFavoritesInAllSlots()},_popupClosed:function(){GlobalVars.isjackpotLoaded=!1},unload:function(){RSEventManager.getInstance().removeEventListenersIn(this);this._scroller&&this._scroller.unload();this._super.unload.call(this)}});var SlotsLobbyVIPBottomWidget=RSBasicObject.extend({init:function(){this._assetPath=RSGame.getInstance().getAssetPath("SlotsLobbyVIPBottomWidget");this._buttonSound=null;this._buttonSound=RSGame.getInstance().getAssetPath("ButtonSFX");this._super.init.call(this);this.loadContent()},loadContent:function(){this.loadLayout(this._assetPath)},setVIPTier:function(){this._currentVIPTier=RSVIPManager.getInstance().getVIPUserTier();0==this._currentVIPTier?(this._vipTierAnim.setVisible(!1),this._yourStatusLabel.setVisible(!1), this._vipLockedText.setVisible(!0)):(this._vipTierAnim.setVisible(!0),this._yourStatusLabel.setVisible(!0),this._vipLockedText.setVisible(!1),this._vipTierAnim.setFrame(this._currentVIPTier-1))},onObjectCreated:function(a,b,c){"YourStatus"==c.name?(this._yourStatusLabel=a,this._yourStatusLabel.setVisible(!1)):"VipLockedText"==c.name&&(this._vipLockedText=a,this._vipLockedText.setVisible(!1));switch(c.type){case "Animation":switch(c.name){case "TierUpAnim":this._vipTierAnim=a,this._vipTierAnim.stopAnimation()}}}, onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.setVIPTier()},onButtonClicked:function(a){switch(a){case "Benefits":RSGame.getInstance().getGameManager().showVIPBenefitsPopup()}},unloadContent:function(){this._super.unloadContent.call(this)}});var RSSlotsLobbyVIP=RSDisplayObject.extend({init:function(a,b){var c=new RSRect(0,0,0,0);this._super.init.call(this,c);this._assetList=a;this._scrollRect=this._assetList.widget;this.machineList=[];this._delegate=b;this.loadContent()},loadContent:function(){this.loadLayout(RSGame.getInstance().getAssetPath("SlotsLobbyVIPWidget"),1)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._addVIPMachinesToScroller();this.setVisible(!1);this.setTouchEnabled(!1)},setVisible:function(a){this._scroller&& this._scroller.setVisible(a);this._super.setVisible.call(this,a)},createCustomObject:function(a,b){switch(b.name){case "BigMachineIcon":this._iconHolder=b;break;case "VipBottomWidget":this.vipBottomWidget=b,this.panel=new RSPanel(b.x,b.y,b.w,b.h),this.addChild(this.panel),this.panel.setAnchorPoint(0,0),this.panel.setZOrder(2),this._slotsLobbyVIPBottomWidget=new SlotsLobbyVIPBottomWidget(this),this.panel.addChild(this._slotsLobbyVIPBottomWidget),this._slotsLobbyVIPBottomWidget.setVisible(!0)}},setCustomSlider:function(a){a instanceof RSControlSlider&&this._scroller&&this._scroller.setCustomSlider(a)},reInitializeVIPMachinesOnTierUpdate:function(){if(0<this.machineList.length)for(var a in this.machineList)this.machineList[a]._checkAndEnableMachineLock();this._slotsLobbyVIPBottomWidget&&this._slotsLobbyVIPBottomWidget.setVIPTier()},_addVIPMachinesToScroller:function(){this._vipMachineList=SlotsLobbyWidgetManager.getInstance().getVIPMachinesData();if(0<this._vipMachineList.length){this._vipMachineList=RSUtils.sortObjectWithIntKey(this._vipMachineList, "VIPTier");this._scroller=new RSScrollHolderLayer(cc.size(this._scrollRect.w,this._scrollRect.h));this._scroller.initializeScroller(cc.size(this._scrollRect.w,this._scrollRect.h),this._assetList.scrollDirection,this._assetList.scrollLevelCount,!1,this._assetList.horizontalScrollPadding,this._assetList.verticalScrollPadding,this._assetList.scrollerMargin);this._scroller.setPosition(this._scrollRect.x,this._scrollRect.y);this.addChild(this._scroller);for(var a=0;a<this._vipMachineList.length;a++){var b= this._vipMachineList[a].iconUrlLarge?new RSCasinoIconHolder("LONG_ICON_VIP",this._iconHolder,this._vipMachineList[a].iconUrlLarge,this.onVIPIconClicked.bind(this),this._vipMachineList[a],!1,this._assetList.fonts,!0):new RSCasinoIconHolder("LONG_ICON_VIP",this._iconHolder,this._assetList.iconPath+"Large"+this._vipMachineList[a].imageName,this.onVIPIconClicked.bind(this),this._vipMachineList[a],!1,this._assetList.fonts,!0);this.machineList.push(b)}0<this.machineList.length&&(this._scroller.addElements(this.machineList), a=this._assetList.scrollRoundWidthAndHeight?this._assetList.scrollRoundWidthAndHeight:33,this._scroller.enableSlider(this._assetList.scrollBarPath+"ScrollBar.png",cc.size(this._assetList.scrollBarWidth?this._assetList.scrollBarWidth:506,this._assetList.scrollBarHeight?this._assetList.scrollBarHeight:19),this._assetList.scrollBarPath+"ScrollRound.png",cc.size(a,a)))}this._delegate.onAssetLoadCompleted("VIP")},onVIPIconClicked:function(a,b,c){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"), !1);0<parseInt(a.VIPTier)&&RSEngine.loginMode==LOGIN_MODE.GUEST?RSGame.getInstance().getGameManager().showLoginPopup("feature","VIPPopup"):(GlobalVars.slotsLobbySelectedTab=TabType.VIP,RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Slots,a.machine_identifier,RSGameScreens.SlotsLobby))},unload:function(){this._scroller&&this._scroller.unload();this._super.unload.call(this)}});var SlotsLobbyWidgetManager=function(){var a,b=RSClass.extend({_scrollerInitialValue:0,_scrollerTargetValue:0,_selectedMachineIndex:0,_slotMachineDetails:[],_slotsLobbyMachines:[],_slotsLobbyJackPotMachines:[],_slotsLobbyMergedMachines:[],_defaultFavouriteMachines:[],_loadFromMainLobby:!0,_slotsLobbyMachinesDisplayDetails:{},init:function(){this._super.init.call(this)},setSlotMachineData:function(){0==this._slotMachineDetails.length&&(this._slotMachineDetails=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots), this._slotsLobbyMachines=RSGame.getInstance().getGameData().getSheetData("slotsLobby"),this._slotsLobbyJackPotMachines=RSGame.getInstance().getGameData().getSheetData("slotsLobbyJackpot"),this.getMergedSlotMachinesData(),this.setLobbyIconConfiguration());this._machineLoaded=!1},setSlotsMachineLoaded:function(a){this._isSlotsMachineLoaded=a},checkIsSlotsMachineLoaded:function(){return this._isSlotsMachineLoaded},InitializeDefaultScrollerParams:function(a){this._scrollerTargetValue=a.targetPosition; this._scrollerInitialValue=a.noOfCellsToMove},setSlotsLobbySelectedIndex:function(a,b){this._scrollerTargetValue=this._selectedMachineIndex=a;this.calculateScrollerInitialIndex(b)},getSelectedMachineIndex:function(){return this._selectedMachineIndex},calculateScrollerInitialIndex:function(a){a=a.noOfCellsToMove;var b=this.getAllSlotsMachines().length;this._scrollerInitialValue=0;50<this._scrollerTargetValue/b*100?(this._scrollerInitialValue=this._scrollerTargetValue-a,0>this._scrollerInitialValue&& (this._scrollerInitialValue=0),this._scrollerTargetValue>b&&(this._scrollerTargetValue=b)):(this._scrollerInitialValue=this._scrollerTargetValue+a,this._scrollerInitialValue>b&&(this._scrollerInitialValue=b),0>this._scrollerTargetValue&&(this._scrollerTargetValue=0))},getSlotsLobbyTargetIndex:function(){return this._scrollerTargetValue},getSlotsLobbyFromIndex:function(){return this._scrollerInitialValue},getMergedSlotMachinesData:function(){var a=0;this._slotsLobbyMergedMachines=[];if(this._slotsLobbyJackPotMachines)for(var b= 0;b<this._slotsLobbyJackPotMachines.length;b++){for(var e=this._slotsLobbyJackPotMachines[b].smallCount,f=a,g=1;g<=e;f++,a++,g++)if(f<this._slotsLobbyMachines.length)this._slotsLobbyMachines[f]&&this._slotsLobbyMergedMachines.push(this._slotsLobbyMachines[f]);else break;RSEngine.gameData.getSheetData("platformDataConfig")[0].TallIconsEnabled&&(this._slotsLobbyJackPotMachines[b].type=2);this._slotsLobbyMergedMachines.push(this._slotsLobbyJackPotMachines[b])}for(f=a;f<this._slotsLobbyMachines.length;f++)this._slotsLobbyMergedMachines.push(this._slotsLobbyMachines[f]); return this._slotsLobbyMergedMachines},getAllSlotsMachines:function(){return this._slotsLobbyMergedMachines},getFeaturedMachineData:function(){var a=RSMEConfigManager.getInstance().getDataForEvent(RSFeatures.FEATURED);this._featureMachineList=[];if(a&&(a=a.machines)&&a.slots)for(var b in a.slots){var e=a.slots[b];if("slots"!=e){var f=this.getMachineDataForID(e);0!=f&&this._featureMachineList.push(f)}}if(0==this._featureMachineList.length&&(b=this.getDefaultFavouriteMachines(),0<b.length))for(f in b)a= this.getMachineDataForID(b[f].id),0!=a&&this._featureMachineList.push(a);return this._featureMachineList},getMachineDataForID:function(a){for(var b in this._slotMachineDetails)if(this._slotMachineDetails[b].machine_identifier==a)return this._slotMachineDetails[b];return 0},getDefaultFavouriteMachines:function(){return this._defaultFavouriteMachines=RSGame.getInstance().getGameData().getSheetData("slotsFavorites")},getTopFavouritesMachineInSlots:function(a){for(var b=[],e=[],e=[],f=RSGame.getInstance().getUserDataManager().getMe().getSlotsLastPlayedMachines(), g=0;g<f.length;g++)RSGame.getInstance().getUserDataManager().getMe().isMachineUnlocked(f[g])||(f.splice(g,1),g--);for(var g=[],h=f.length-1;0<=h;h--){var k=this.getMachineDataForID(f[h]);k&&g.push(k)}a-=g.length;var h=RSGame.getInstance().getUserDataManager().getMe().getSpins(),m;for(m in h)if(!1==f.includes(m)&&RSGame.getInstance().getUserDataManager().getMe().isMachineUnlocked(m)){var k=h[m],n=this.getMachineDataForID(m);0!=n&&(n.spinCount=k,b.push(n))}b=RSUtils.sortObjectWithIntKey(b,"spinCount"); m=b.length-1;for(f=1;0<=m;m--,f++)if(f<=a)e.push(b[m]);else break;e=g.concat(e);if(0==e.length&&(b=this.getDefaultFavouriteMachines(),0<b.length))for(n in b)e.push(this.getMachineDataForID(b[n].id));return e},getVIPMachinesData:function(){for(var a=[],b=0;b<this._slotMachineDetails.length;b++){var e=this._slotMachineDetails[b];0<parseInt(e.VIPTier)&&a.push(e)}return a},unloadSlotsLobby:function(){this._slotMachineDetails=[];this._slotsLobbyMachines=[];this._slotsLobbyJackPotMachines=[];this._slotsLobbyMergedMachines= [];this._defaultFavouriteMachines=[]},jackpotLoungeMachineSelectPopupCallBack:function(a,b){this._machineLoaded||("regular"==a?(this._machineLoaded=b.gameType!==CasinoExternalGameType.INTERNAL?RSEngine.loginMode!==LOGIN_MODE.GUEST:!0,RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Slots,b instanceof Object?b.machine_identifier:b,RSGameScreens.SlotsLobby)):"jackpot"==a&&(RSEngine.loginMode!=LOGIN_MODE.GUEST?(this._machineLoaded=!0,RSEngine.audioManager.stopMusic(),RSCasinoManager.triggerMachineEvent("player_action_session_start", "jackpot_popup",b.jackpotLoungeName.split("Lounge")[0].toLowerCase()),RSGame.getInstance().getGameManager().loadJackpotLounge(b.machine_identifier,b.screenName,b.jackpotLoungeName,!0,RSGame.getInstance().getGameManager().getJLBetSelectIconPath()+b.imageName,"lounge",this._popupClosed.bind(this))):(this._machineLoaded=!1,RSEngine.dataManager.getMe().setGuestUserDataForKey("PopupName","FbConnectPopup"),RSGame.getInstance().getGameManager().showLoginPopup("feature","VIPPopup"))))},_popupClosed:function(){this._machineLoaded= GlobalVars.isjackpotLoaded=!1},setLobbyIconConfiguration:function(){var a=RSEngine.gameData.getSheetData("platformDataConfig");this._slotsLobbyMachinesDisplayDetails={Enabled:!1,showIconsTillLevel:50,"showCountForLockedIcons ":4,"showCountForHiddenIcons ":4};a&&(this._slotsLobbyMachinesDisplayDetails.Enabled=a[0].showIconsTillLevel?!0:!1,this._slotsLobbyMachinesDisplayDetails.showIconsTillLevel=parseInt(a[0].showIconsTillLevel),this._slotsLobbyMachinesDisplayDetails.showCountForLockedIcons=parseInt(a[0].showCountForLockedIcons), this._slotsLobbyMachinesDisplayDetails.showCountForHiddenIcons=parseInt(a[0].showCountForHiddenIcons))},getLobbyIconConfiguration:function(){return this._slotsLobbyMachinesDisplayDetails}});return{getInstance:function(){a||(a=new b);return a}}}();var RSSingleSignOnPopup=RSGenericPopup.extend({init:function(a,b,c){this._assetList=[{name:RSGame.getInstance().getAssetPath("RSSingleSignOnPopup"),count:1}];this._super.init.call(this);this._fonts=b;this._reward=a;this._tickStatus=!1;this._textLength=27;this._loginCallback=c;this._signintab_enabled=GameConfig.isSSOSignInTabEnabled?GameConfig.isSSOSignInTabEnabled:RSEngine.gameData.getDefaultValues().isSSOSignInTabEnabled;RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("SingleSignOnFontConfigJson"), "SingleSignOnFontConfig.json");RSEventManager.getInstance().removeListenersForEvent("onUpdateSocialLogin");RSEventManager.getInstance().addEventListener("onUpdateSocialLogin",this,this.onUpdateSocialLogin.bind(this))},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._bgPart&&this._closebtn.setVisible(!1);this.setSignUpSignInBtnVisibility(!1)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this, a,b,c);switch(c.name){case "Registernow":this._registerNow=a;this._registerNow.addTouchListenerWithDelegate(this);break;case "Newplayer":this._newPlayer=a;break;case "ForgotPassword":this._forgotPassword=a;break;case "RememberMe":this._rememberMe=a;break;case "TikAnim":this._tickAnim=a;this._tickAnim.stopAnimation();this._tickAnim.addTouchListenerWithDelegate(this);break;case "Signin":this._signInBtn=a;break;case "SignIn":this._signIn=a;this._signIn.addTouchListenerWithDelegate(this);break;case "Alreadyregistered":this._alreadyRegisterd= a;break;case "SignUpAndPlay":this._signUpAndPlayBtn=a;this._signUpAndPlayBtn.addTouchListenerWithDelegate(this);break;case "ThisEmailIDisnotvalid":this._invalidEmail=a;this._invalidEmail.setVisible(!1);break;case "LoginfailedTryAgain":this._loginFailed=a;this._loginFailed.setVisible(!1);break;case "EmailIDalreadyexists":this._emailIdExist=a;this._emailIdExist.setVisible(!1);break;case "Thepasswordisrequired":this._paswdRequired=a;this._paswdRequired.setVisible(!1);break;case "PasswordMustBeAtLeast5Characters":this._passwordMustBeAtLeast5Characters= a;this._passwordMustBeAtLeast5Characters.setVisible(!1);break;case "PasswordBox":this._passwordBoxHeight=c.h;break;case "EmailBox":this._emailBoxHeight=c.h;break;case "LogInBtn":this._loginbtn=a;this._loginbtn.setSelected(!0);break;case "SignupBtn":this._signupbtn=a;break;case "CloseBtn":this._closebtn=a}},createCustomObject:function(a,b){var c=RSPlatformFontAssetManager.getCustomFontVOFromConfig(RSPlatformFontAssetManager.getFontNameForLabelName(b.name));c&&(RSGame.getInstance().getAssetPath(c.fontName), c.textLength&&(this._textLength=c.textLength));switch(b.name){case "RewardText":this._rewardText=RSPlatformFontAssetManager.createCustomLabel(RSUtils.formatNumberWithComma(this._reward),b);this.addChild(this._rewardText);break;case "EmailText":this._email=new RSInputBox(b.w,this._emailBoxHeight);this._email.setFont(c.fontName,b.h/c.fontSize);this._email.setFontColor(0,0,0);this._email.setName("Email");this._email.setPlaceholderFont(c.fontName,b.h/c.fontSize);this._email.setPlaceholderFontColor(c.fontColor.r, c.fontColor.g,c.fontColor.b);this._email.setPlaceholderText("Email");this._email.setDelegate(this);this._email.setCenter(b.x,b.y);this._email.setPosition(b.x,b.y);this._email.setInputMode(1);this._email.setInputFlag(1);this.addChild(this._email);break;case "PasswordText":this._passwd=new RSInputBox(b.w,this._passwordBoxHeight);this._passwd.setFont(c.fontName,b.h/c.fontSize);this._passwd.setFontColor(0,0,0);this._passwd.setName("Password");this._passwd.setPlaceholderFont(c.fontName,b.h/c.fontSize); this._passwd.setPlaceholderFontColor(c.fontColor.r,c.fontColor.g,c.fontColor.b);this._passwd.setPlaceholderText("Password");this._passwd.setDelegate(this);this._passwd.setCenter(b.x,b.y);this._passwd.setPosition(b.x,b.y);this._passwd.setInputMode(1);this._passwd.setInputFlag(cc.EDITBOX_INPUT_FLAG_PASSWORD);this.addChild(this._passwd);break;case "BgPart":GameConfig.LOADING_MODULE_SSO_ENABLED&&RSEngine.loginMode==LOGIN_MODE.GUEST&&(this._bgPart=RSUtils.createBasicObject(a,b),this.addChild(this._bgPart))}return this._super.createCustomObject.call(this, a,b)},onButtonClicked:function(a){switch(a){case "FBLoginBtn":RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","link_fb","initiate","","");RSSSOManager.saveCurrentServerTimeForGettingLinkingTime();this._onLoginClicked();RSLoginManager.getInstance().loginWithFacebook();break;case "AppleBtn":RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","link_apple","initiate","","");RSSSOManager.saveCurrentServerTimeForGettingLinkingTime();this._onLoginClicked();RSSSOManager.initiateAppleSignIn(); break;case "GoogleBtn":RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","link_google","initiate","","");RSSSOManager.saveCurrentServerTimeForGettingLinkingTime();this._onLoginClicked();initializeGoogleSignIn(!0);break;case "SignUpAndPlay":this._emailValue?(this.removeVisibilityOfNotificationTexts(),this.validateEmailAndPassword("signUp")&&(RSSSOManager.saveCurrentServerTimeForGettingLinkingTime(),this._onLoginClicked(),this._email.setTouchEnabled(!1),this._passwd.setTouchEnabled(!1), RSLoginManager.getInstance().webSignUp(this._emailValue,this._passwdValue,this.signUpFailed.bind(this)))):this._invalidEmail.setVisible(!0);break;case "Signin":this._emailValue?(this.removeVisibilityOfNotificationTexts(),this.validateEmailAndPassword()&&(this._email.setTouchEnabled(!1),this._passwd.setTouchEnabled(!1),RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","link_email","initiate","",""),RSSSOManager.saveCurrentServerTimeForGettingLinkingTime(),RSLoginManager.getInstance().webSignIn(this._emailValue, this._passwdValue,this.signInFailed.bind(this)))):this._invalidEmail.setVisible(!0);break;case "LogInBtn":this._signupbtn.setSelected(!1);this._loginbtn.setSelected(!0);this.removeVisibilityOfNotificationTexts();this.setSignUpSignInBtnVisibility(!1);RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","login","click","","");break;case "SignupBtn":this._loginbtn.setSelected(!1);this._signupbtn.setSelected(!0);this.removeVisibilityOfNotificationTexts();this.setSignUpSignInBtnVisibility(!0); RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","sign_up","click","","");break;case "CloseBtn":this.closePopup()}},_onLoginClicked:function(){GameConfig.LOADING_MODULE_SSO_ENABLED||null==RSSSOManager.getBlobIdData()||RSGame.getInstance().getUserDataManager().getMe().setGuestUserDataForKey("firstLogin",!0)},setSignUpSignInBtnVisibility:function(a){this._signUpAndPlayBtn.setVisible(a);this._signInBtn.setVisible(!a);this._loginbtn&&this._loginbtn.setSelected(!a);this._alreadyRegisterd.setVisible(a); this._signIn.setVisible(a);this._forgotPassword.setVisible(!a);this._forgotPassword.isVisible()?this._forgotPassword.addTouchListenerWithDelegate(this):this._forgotPassword.removeTouchListener();null!=this._rememberMe&&this._rememberMe.setVisible(!a);this._signintab_enabled||(this._newPlayer.setVisible(!a),this._registerNow.setVisible(!a));null!=this._tickAnim&&(this._tickAnim.setVisible(!a),this._tickAnim.setFrame(0))},handleObjectTouchAt:function(a,b,c){switch(a._ccObject._name){case "TikAnim":(this._tickStatus= !this._tickStatus)?this._tickAnim.setFrame(1):this._tickAnim.setFrame(0);break;case "Registernow":this.removeVisibilityOfNotificationTexts();this.setSignUpSignInBtnVisibility(!0);break;case "SignIn":this.removeVisibilityOfNotificationTexts();this.setSignUpSignInBtnVisibility(!1);this._signintab_enabled&&(this._signupbtn.setSelected(!1),this._loginbtn.setSelected(!0));break;case "ForgotPassword":RSEngine.popupManager.addPopup(new RSRestorePasswordPopup,!0)}},handleObjectTouchMoveAt:function(a,b,c){}, handleObjectTouchEndAt:function(a,b,c){},setTouchEnabled:function(a){},uuidv4:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0;return("x"==a?b:b&3|8).toString(16)})},editBoxEditingDidEnded:function(a){switch(a.getName()){case "Email":this._emailValue=a._ccObject._text;this._emailValue.length>this._textLength&&(a=this._emailValue.substring(0,this._textLength-1),this._email.setString(a+".."));break;case "Password":this._passwdValue=a._ccObject._text, 21<this._passwdValue.length&&(a=this._passwdValue.substring(0,19),this._passwd.setString(a+".."))}},editBoxEditingDidBegan:function(a){switch(a.getName()){case "Email":this._invalidEmail.setVisible(!1);this._emailValue&&a._ccObject._text.includes("..")&&this._email.setString(this._emailValue);break;case "Password":this._passwdValue&&a._ccObject._text.includes("..")&&this._passwd.setString(this._passwdValue)}},editBoxTextChanged:function(a,b){switch(a.getName()){case "Email":""==b&&this.removeVisibilityOfNotificationTexts(); break;case "Password":""==b&&this.removeVisibilityOfNotificationTexts()}},editBoxEditingReturn:function(a){},validateEmailAndPassword:function(a){if(this._emailValue.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)){if(this._passwdValue)return a&&5>this._passwdValue.length?(this._passwordMustBeAtLeast5Characters.setVisible(!0),!1):!0;this._paswdRequired.setVisible(!0);return!1}this._invalidEmail.setVisible(!0);return!1},userChanged:function(a){cc.log("USER ID:::"+gapi.auth2.getAuthInstance().currentUser.get().getBasicProfile().getId()); cc.log("USER Name: "+gapi.auth2.getAuthInstance().currentUser.get().getBasicProfile().getName());cc.log("USER Image URL: "+gapi.auth2.getAuthInstance().currentUser.get().getBasicProfile().getImageUrl());cc.log("USER Email: "+gapi.auth2.getAuthInstance().currentUser.get().getBasicProfile().getEmail())},signInFailed:function(a){cc.log("Response: "+a);!0==a?cc.log("Succes"):(this._email.setTouchEnabled(!0),this._passwd.setTouchEnabled(!0));this._loginFailed.setVisible(!0)},signUpFailed:function(a){cc.log("Response: "+ a);!0==a?cc.log("Succes"):(this._email.setTouchEnabled(!0),this._passwd.setTouchEnabled(!0),this._emailIdExist.setVisible(!0))},removeVisibilityOfNotificationTexts:function(){this._loginFailed.setVisible(!1);this._emailIdExist.setVisible(!1);this._paswdRequired.setVisible(!1);this._invalidEmail.setVisible(!1);this._passwordMustBeAtLeast5Characters.setVisible(!1)},onUpdateSocialLogin:function(a){cc.log("on social update event:"+a);this.closePopup()},closePopup:function(){this._loginCallback&&this._loginCallback(); RSEventManager.getInstance().removeListenersForEvent("onUpdateSocialLogin");this._super.closePopup.call(this)}});var RSAccountManagementPopup=RSGenericPopup.extend({init:function(a,b){this._assetList=[{name:RSGame.getInstance().getAssetPath("RSAccountManagementPopup"),count:1}];this._super.init.call(this);this._userId=RSGame.getInstance().getGameManager().getUpdatedUserForDisplay(RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId")?RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId"):RSSSOManager.getBlobIdData().blobId);this._textLength=27;var c=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+ "-loginType");this._loginType=c?c.split("|"):null;this._tickStatus=!1;this._openedFrom=a;this._callback=b;this._signupbtn=this._loginbtn=null;this._emailSentOnceInPopupSession=!1;this._signintab_enabled=RSEngine.gameData.getDefaultValues().isSSOSignInTabEnabled;RSEventManager.getInstance().removeListenersForEvent("onUpdateSocialLogin");RSEventManager.getInstance().removeListenersForEvent("GAME_RELOAD");RSEventManager.getInstance().addEventListener("onUpdateSocialLogin",this,this.onUpdateSocialLogin.bind(this)); RSEventManager.getInstance().addEventListener("GAME_RELOAD",this,this.onGameReload.bind(this));RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("AccountManagementConfigJson"),"AccountManagementConfig.json")},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){if(this._openedFrom){var a="logout"==this._openedFrom?"logout":"",b="logout"==this._openedFrom?RSAnalyticsManager.getInstance().getCurrentMachineName(): this._openedFrom;RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","open",a,"open_from_"+b,"")}this.controlVisibility();this.handleSigninLogoutButtonVisibility();this._super.onLayoutCompleted.call(this)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "SubBg":this._subBg=a;break;case "Icons":this._icons=a;break;case "Title2":this._title2=a;this._title2.setVisible(!0);break;case "UnlinkFbBtn":this._unlinkFbBtn=a;this._unlinkFbBtn.setVisible(!1); break;case "UnlinkAppleBtn":this._unlinkAppleBtn=a;this._unlinkAppleBtn.setVisible(!1);break;case "UnlinkGoogleBtn":this._unlinkGoogleBtn=a;this._unlinkGoogleBtn.setVisible(!1);break;case "FBLoginBtn":this._fBLoginBtn=a;this._fBLoginBtn.setVisible(!0);break;case "AppleBtn":this._appleBtn=a;this._appleBtn.setVisible(!0);break;case "GoogleBtn":this._googleBtn=a;this._googleBtn.setVisible(!0);break;case "LogOut":this._logOutBtn=a;this._logOutBtn.setVisible(!1);break;case "EmailBox":this._emailBox=a; this._emailBoxHeight=c.h;break;case "PasswordBox":this._passwordBox=a;this._passwordBoxHeight=c.h;break;case "ThisEmailIDisnotvalid":this._invalidEmail=a;this._invalidEmail.setVisible(!1);break;case "Thepasswordisrequired":this._paswdRequired=a;this._paswdRequired.setVisible(!1);break;case "Signin":this._signInBtn=a;break;case "SignIn":this._signIn=a;this._signIn.addTouchListenerWithDelegate(this);break;case "SignUpAndPlay":this._signUpAndPlayBtn=a;this._signUpAndPlayBtn.addTouchListenerWithDelegate(this); break;case "Alreadyregistered":this._alreadyRegisterd=a;break;case "Newplayer":this._newPlayer=a;break;case "TikAnim":this._tickAnim=a;this._tickAnim.stopAnimation();this._tickAnim.addTouchListenerWithDelegate(this);break;case "RememberMe":this._rememberMe=a;this._rememberMe.setVisible(!1);break;case "Registernow":this._registerNow=a;this._registerNow.addTouchListenerWithDelegate(this);break;case "ForgotPassword":this._forgotPassword=a;break;case "LoginfailedTryAgain":this._loginFailed=a;this._loginFailed.setVisible(!1); break;case "EmailIDalreadyexists":this._emailIdExist=a;this._emailIdExist.setVisible(!1);break;case "PasswordMustBeAtLeast5Characters":this._passwordMustBeAtLeast5Characters=a;this._passwordMustBeAtLeast5Characters.setVisible(!1);break;case "SendLinkAgainBtn":this._sendLinkAgainBtn=a;this._sendLinkAgainBtn.setVisible(!1);break;case "VerificationPendingText":this._verificationPendingText=a;this._verificationPendingText.setVisible(!1);break;case "LogInBtn":this._loginbtn=a;this._loginType.includes("email")? this._loginbtn.setVisible(!1):this._loginbtn.setSelected(!0);break;case "SignupBtn":this._signupbtn=a;this._loginType.includes("email")&&this._signupbtn.setVisible(!1);break;case "TabsBase":this._tabsbase=a;this._loginType.includes("email")&&this._tabsbase.setVisible(!1);break;case "EmailSentText":this._emailSentText=a;this._emailSentText.setVisible(!1);break;case "RestorePointsBtn":a.setVisible(!1)}},setLoggedInSignInBtnVisibility:function(a){this._signUpAndPlayBtn.setVisible(!1);this._signIn.setVisible(!1); this._passwd.setVisible(a);this._email.setVisible(a);this._text1.setVisible(!a);this._mailAddress.setVisible(!a);this._signInBtn.setVisible(a);this._emailBox.setVisible(a);this._passwordBox.setVisible(a);this._forgotPassword.setVisible(a);this._forgotPassword.isVisible()?this._forgotPassword.addTouchListenerWithDelegate(this):this._forgotPassword.removeTouchListener();null!=this._rememberMe&&this._rememberMe.setVisible(a);this._signintab_enabled||(this._newPlayer.setVisible(a),this._registerNow.setVisible(a)); this._alreadyRegisterd.setVisible(!1);this._logOutBtn.setVisible(!a);this._signintab_enabled&&(this._logOutBtn.isVisible()?(this._loginbtn.setVisible(!1),this._signupbtn.setVisible(!1),this._tabsbase.setVisible(!1)):(this._loginbtn.setVisible(!0),this._loginbtn.setSelected(!0),this._signupbtn.setVisible(!0),this._signupbtn.setSelected(!1),this._tabsbase.setVisible(!0)));null!=this._tickAnim&&(this._tickAnim.setVisible(a),this._tickAnim.setFrame(0));this.emailVerificationCheck(a)},emailVerificationCheck:function(a){RSSSOManager.getBlobIdData().emailVerificationDetails? 0==RSSSOManager.getBlobIdData().emailVerificationDetails.verified?(this._sendLinkAgainBtn.setVisible(!a),this._verificationPendingText.setVisible(!a),RSSSOManager.getCookieEmailVerificationData()&&0!=RSSSOManager.getCookieEmailVerificationData().verified&&(this._sendLinkAgainBtn.setVisible(!1),this._verificationPendingText.setVisible(!1))):RSSSOManager.getCookieEmailVerificationData()&&0==RSSSOManager.getCookieEmailVerificationData().verified&&(this._sendLinkAgainBtn.setVisible(!a),this._verificationPendingText.setVisible(!a)): RSSSOManager.getCookieEmailVerificationData()&&0==RSSSOManager.getCookieEmailVerificationData().verified&&(this._sendLinkAgainBtn.setVisible(!a),this._verificationPendingText.setVisible(!a));this._emailSentOnceInPopupSession&&this._sendLinkAgainBtn.setVisible(!1)},controlVisibility:function(){this._unlinkAppleBtn.setVisible(!1);this._appleBtn.setVisible(!0);this._unlinkGoogleBtn.setVisible(!1);this._googleBtn.setVisible(!0);this._unlinkFbBtn.setVisible(!1);this._fBLoginBtn.setVisible(!0);if(this._loginType)for(var a= 0;a<this._loginType.length;a++)"apple"==this._loginType[a]&&(this._unlinkAppleBtn.setVisible(!0),this._appleBtn.setVisible(!1)),"google"==this._loginType[a]&&(this._unlinkGoogleBtn.setVisible(!0),this._googleBtn.setVisible(!1)),"facebook"==this._loginType[a]&&(this._unlinkFbBtn.setVisible(!0),this._fBLoginBtn.setVisible(!1))},check:function(a){if(!this._loginType||this._loginType.length!==a.length)return!0;for(var b=0;b<this._loginType.length;b++)if(!a.includes(this._loginType[b]))return!0;return!1}, update:function(a){a=[];(a=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-loginType"))?(a=a.split("|"),this.check(a)&&(this._loginType=a,RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId")?RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId"):RSSSOManager.getBlobIdData(),this._userIdLabel.setString("User ID: "+RSGame.getInstance().getGameManager().getUpdatedUserForDisplay(RSEngine.dataManager.getMe().getId())),a=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+ "-emailValue")?RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-emailValue"):RSSSOManager.getBlobIdData().emailId,this._mailAddress.setString(a),this.controlVisibility(),this.handleSigninLogoutButtonVisibility())):this._loginType&&(this._loginType=a,this._userIdLabel.setString("User ID: "+RSGame.getInstance().getGameManager().getUpdatedUserForDisplay(RSEngine.dataManager.getMe().getId())),this.controlVisibility(),this.handleSigninLogoutButtonVisibility())},handleSigninLogoutButtonVisibility:function(){this._loginType? this._loginType.includes("email")?this.setLoggedInSignInBtnVisibility(!1):this.setLoggedInSignInBtnVisibility(!0):this.setLoggedInSignInBtnVisibility(!0)},createCustomObject:function(a,b){var c=RSPlatformFontAssetManager.getCustomFontVOFromConfig(RSPlatformFontAssetManager.getFontNameForLabelName(b.name));c&&(RSGame.getInstance().getAssetPath(c.fontName),c.textLength&&(this._textLength=c.textLength));switch(b.name){case "UserID":this._userIdLabel=new RSInputBox(b.w,b.h);this._userIdLabel.setPosition(b.x, b.y);this._userIdLabel.setMaxLength(130);this._userIdLabel.setPlaceholderFont(c.fontName,b.h/c.fontSize);this._userIdLabel.setPlaceholderFontColor(c.fontColor);this._userIdLabel.setPlaceholderText("User ID: "+this._userId);this._userIdLabel.setString("User ID: "+this._userId);this._userIdLabel.setFont(c.fontName,b.h/c.fontSize);this._userIdLabel.setFontColor(c.fontColor);this._userIdLabel.setDelegate(this);this._userIdLabel.setZOrder(11);this.addChild(this._userIdLabel);break;case "Version":this._version= new RSInputBox(b.w,b.h);this._version.setPosition(b.x,b.y);this._version.setMaxLength(20);this._version.setPlaceholderFont(c.fontName,b.h/c.fontSize);this._version.setPlaceholderFontColor(c.fontColor);this._version.setPlaceholderText("Version: "+GameConfig.VERSION);this._version.setString("Version: "+GameConfig.VERSION);this._version.setFont(c.fontName,b.h/c.fontSize);this._version.setFontColor(c.fontColor);this._version.setDelegate(this);this.addChild(this._version);break;case "MailAddress":var d= RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-emailValue")?RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-emailValue"):RSSSOManager.getBlobIdData().emailId;this._mailAddress=RSPlatformFontAssetManager.createCustomLabel(d,b);c&&c.fontColor&&this._mailAddress.setFontColor(c.fontColor.r,c.fontColor.g,c.fontColor.b,255);this.addChild(this._mailAddress);break;case "Text1":this._text1=RSPlatformFontAssetManager.createCustomLabel("Logged in as",b);this.addChild(this._text1); break;case "EmailText":this._email=new RSInputBox(b.w,this._emailBoxHeight);this._email.setFont(c.fontName,b.h/c.fontSize);this._email.setFontColor(0,0,0);this._email.setName("Email");this._email.setPlaceholderFont(c.fontName,b.h/c.fontSize);this._email.setPlaceholderFontColor(c.fontColor.r,c.fontColor.g,c.fontColor.b);this._email.setPlaceholderText("Email");this._email.setDelegate(this);this._email.setCenter(b.x,b.y);this._email.setPosition(b.x,b.y);this._email.setInputMode(1);this._email.setInputFlag(1); this.addChild(this._email);break;case "PasswordText":this._passwd=new RSInputBox(b.w,this._passwordBoxHeight),this._passwd.setFont(c.fontName,b.h/c.fontSize),this._passwd.setFontColor(0,0,0),this._passwd.setName("Password"),this._passwd.setPlaceholderFont(c.fontName,b.h/c.fontSize),this._passwd.setPlaceholderFontColor(c.fontColor.r,c.fontColor.g,c.fontColor.b),this._passwd.setPlaceholderText("Password"),this._passwd.setDelegate(this),this._passwd.setCenter(b.x,b.y),this._passwd.setPosition(b.x,b.y), this._passwd.setInputMode(1),this._passwd.setInputFlag(cc.EDITBOX_INPUT_FLAG_PASSWORD),this.addChild(this._passwd)}return this._super.createCustomObject.call(this,a,b)},setEmailText:function(a,b,c){},setPasswordText:function(a,b,c){},onButtonClicked:function(a){switch(a){case "FBLoginBtn":RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","link_fb","initiate","","");RSSSOManager.saveCurrentServerTimeForGettingLinkingTime();RSLoginManager.getInstance().loginWithFacebook();break;case "AppleBtn":RSAnalyticsManager.getInstance().trackPlayerAction("manage_account", "link_apple","initiate","","");RSSSOManager.saveCurrentServerTimeForGettingLinkingTime();RSSSOManager.initiateAppleSignIn();break;case "GoogleBtn":RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","link_google","initiate","","");RSSSOManager.saveCurrentServerTimeForGettingLinkingTime();initializeGoogleSignIn(!0);break;case "UnlinkFbBtn":this._unlinkFbBtn.setTouchEnabled(!1);RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","unlink_fb","initiate",RSGame.getInstance().getUserDataManager().getMe().getId(), "");RSEngine.popupManager.addPopup(new RSLogOutPopup(this._onunlinkButtonClicked.bind(this,"facebook")),!0);break;case "UnlinkAppleBtn":this._unlinkAppleBtn.setTouchEnabled(!1);RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","unlink_apple","initiate",RSGame.getInstance().getUserDataManager().getMe().getId(),"");RSEngine.popupManager.addPopup(new RSLogOutPopup(this._onunlinkButtonClicked.bind(this,"apple")),!0);break;case "UnlinkGoogleBtn":this._unlinkGoogleBtn.setTouchEnabled(!1); RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","unlink_google","initiate",RSGame.getInstance().getUserDataManager().getMe().getId(),"");RSEngine.popupManager.addPopup(new RSLogOutPopup(this._onunlinkButtonClicked.bind(this,"google")),!0);break;case "LogOut":this._logOutBtn.setTouchEnabled(!1);RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","unlink_email","initiate",RSGame.getInstance().getUserDataManager().getMe().getId(),"");RSEngine.popupManager.addPopup(new RSLogOutPopup(this._onunlinkButtonClicked.bind(this, "email")),!0);break;case "Signin":this._emailValue?(this.removeVisibilityOfNotificationTexts(),this.validateEmailAndPassword()&&(this._email.setTouchEnabled(!1),this._passwd.setTouchEnabled(!1),RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","link_email","initiate","",""),RSSSOManager.saveCurrentServerTimeForGettingLinkingTime(),RSLoginManager.getInstance().webSignIn(this._emailValue,this._passwdValue,this.signInFailed.bind(this)))):this._invalidEmail.setVisible(!0);break;case "SignUpAndPlay":this._emailValue? (this.removeVisibilityOfNotificationTexts(),this.validateEmailAndPassword("signUp")&&(this._email.setTouchEnabled(!1),this._passwd.setTouchEnabled(!1),this._onLoginClicked(),RSSSOManager.saveCurrentServerTimeForGettingLinkingTime(),RSLoginManager.getInstance().webSignUp(this._emailValue,this._passwdValue,this.signUpFailed.bind(this)))):this._invalidEmail.setVisible(!0);break;case "CloseBtn":RSEventManager.getInstance().removeListenersForEvent("onUpdateSocialLogin");this.closePopup();break;case "SendLinkAgainBtn":RSAnalyticsManager.getInstance().trackPlayerAction("verification", "resend_email","","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName(),"");RSLoginManager.getInstance().resendEmailVerificationCode(this._mailAddress.getString());this._emailSentOnceInPopupSession=!0;this._emailSentText.setVisible(!0);this._sendLinkAgainBtn.setVisible(!1);break;case "LogInBtn":this._loginType.includes("email")||(this._signupbtn.setSelected(!1),this._loginbtn.setSelected(!0),this.removeVisibilityOfNotificationTexts(),this.setSignUpSignInBtnVisibility(!1),RSAnalyticsManager.getInstance().trackPlayerAction("manage_account", "login","click","",""));break;case "SignupBtn":this._loginType.includes("email")||(this._loginbtn.setSelected(!1),this._signupbtn.setSelected(!0),this.removeVisibilityOfNotificationTexts(),this.setSignUpSignInBtnVisibility(!0),RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","sign_up","click","",""))}},_onunlinkButtonClicked:function(a,b){this._unlinkFbBtn.setTouchEnabled(!0);this._unlinkAppleBtn.setTouchEnabled(!0);this._unlinkGoogleBtn.setTouchEnabled(!0);this._logOutBtn.setTouchEnabled(!0); if("stay"==b)this.sendAnalytics(a);else switch(a){case "facebook":RSSSOManager.setFbConnectStatusInGifting(!1);RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","unlink_fb","success",RSGame.getInstance().getUserDataManager().getMe().getId(),"");this._unlinkFbBtn.setVisible(!1);this._fBLoginBtn.setVisible(!0);RSLoginManager.getInstance().removeLoginData("facebook");break;case "apple":RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","unlink_apple","success",RSGame.getInstance().getUserDataManager().getMe().getId(), "");this._unlinkAppleBtn.setVisible(!1);this._appleBtn.setVisible(!0);RSLoginManager.getInstance().removeLoginData("apple");break;case "google":RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","unlink_google","success",RSGame.getInstance().getUserDataManager().getMe().getId(),"");this._unlinkGoogleBtn.setVisible(!1);this._googleBtn.setVisible(!0);signOut();RSLoginManager.getInstance().removeLoginData("google");break;case "email":this._passwd.setString(""),this._email.setString(""), this._passwdValue=this._emailValue="",this._emailSentText.setVisible(!1),RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","unlink_email","success",RSGame.getInstance().getUserDataManager().getMe().getId(),""),RSLoginManager.getInstance().removeLoginData("email")}},sendAnalytics:function(a){var b;switch(a){case "facebook":b="unlink_fb";break;case "google":b="unlink_google";break;case "apple":b="unlink_apple";break;case "email":b="unlink_email"}RSAnalyticsManager.getInstance().trackPlayerAction("manage_account", b,"fail","","")},_onLoginClicked:function(){RSGame.getInstance().getUserDataManager().getMe().setGuestUserDataForKey("firstLogin",!0)},uuidv4:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0;return("x"==a?b:b&3|8).toString(16)})},handleObjectTouchAt:function(a,b,c){switch(a._ccObject._name){case "TikAnim":(this._tickStatus=!this._tickStatus)?this._tickAnim.setFrame(1):this._tickAnim.setFrame(0);break;case "Registernow":this.removeVisibilityOfNotificationTexts(); this.setSignUpSignInBtnVisibility(!0);break;case "SignIn":this.removeVisibilityOfNotificationTexts();this.setSignUpSignInBtnVisibility(!1);this._signintab_enabled&&(this._signupbtn.setSelected(!1),this._loginbtn.setSelected(!0));break;case "ForgotPassword":RSEngine.popupManager.addPopup(new RSRestorePasswordPopup,!0)}},setSignUpSignInBtnVisibility:function(a){this._signUpAndPlayBtn.setVisible(a);this._signInBtn.setVisible(!a);this._alreadyRegisterd.setVisible(a);this._signIn.setVisible(a);this._forgotPassword.setVisible(!a); this._forgotPassword.isVisible()?this._forgotPassword.addTouchListenerWithDelegate(this):this._forgotPassword.removeTouchListener();null!=this._rememberMe&&this._rememberMe.setVisible(!a);this._signintab_enabled||(this._newPlayer.setVisible(!a),this._registerNow.setVisible(!a));null!=this._tickAnim&&(this._tickAnim.setVisible(!a),this._tickAnim.setFrame(0))},setTouchEnabled:function(a){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){},editBoxEditingDidBegan:function(a){RSEngine.loginMode!= LOGIN_MODE.GUEST&&(this._userIdLabel.setString("User ID: "+this._userId),this._userIdLabel.setPlaceholderText(""),this._version.setPlaceholderText(""),this._version.setString("Version: "+GameConfig.VERSION));switch(a.getName()){case "Email":this._invalidEmail.setVisible(!1);this._emailValue&&a._ccObject._text.includes("..")&&this._email.setString(this._emailValue);break;case "Password":this._passwdValue&&a._ccObject._text.includes("..")&&this._passwd.setString(this._passwdValue)}},editBoxEditingDidEnded:function(a){RSEngine.loginMode!= LOGIN_MODE.GUEST&&(this._userIdLabel.setString("User ID: "+this._userId),this._userIdLabel.setPlaceholderText(""),this._version.setPlaceholderText(""),this._version.setString("Version: "+GameConfig.VERSION));switch(a.getName()){case "Email":this._emailValue=a._ccObject._text;this._emailValue.length>this._textLength&&(a=this._emailValue.substring(0,this._textLength-1),this._email.setString(a+".."));break;case "Password":this._passwdValue=a._ccObject._text,21<this._passwdValue.length&&(a=this._passwdValue.substring(0, 19),this._passwd.setString(a+".."))}},editBoxTextChanged:function(a,b){RSEngine.loginMode!=LOGIN_MODE.GUEST&&(this._userIdLabel.setString(""),this._userIdLabel.setPlaceholderText("User ID: "+this._userId),this._version.setPlaceholderText("Version: "+GameConfig.VERSION),this._version.setString(""));switch(a.getName()){case "Email":""==b&&this.removeVisibilityOfNotificationTexts();break;case "Password":""==b&&this.removeVisibilityOfNotificationTexts()}},editBoxEditingReturn:function(a){},validateEmailAndPassword:function(a){if(this._emailValue.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)){if(this._passwdValue)return a&& 5>this._passwdValue.length?(this._passwordMustBeAtLeast5Characters.setVisible(!0),!1):!0;this._paswdRequired.setVisible(!0);return!1}this._invalidEmail.setVisible(!0);return!1},signInFailed:function(a){cc.log("Response: "+a);!0==a?cc.log("Succes"):(this._email.setTouchEnabled(!0),this._passwd.setTouchEnabled(!0),this._loginFailed.setVisible(!0))},signUpFailed:function(a){cc.log("Response: "+a);!0==a?(cc.log("Succes"),RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","register_now", "success",RSGame.getInstance().getUserDataManager().getMe().getId(),"")):(this._email.setTouchEnabled(!0),this._passwd.setTouchEnabled(!0),this._emailIdExist.setVisible(!0))},removeVisibilityOfNotificationTexts:function(){this._loginFailed.setVisible(!1);this._emailIdExist.setVisible(!1);this._paswdRequired.setVisible(!1);this._invalidEmail.setVisible(!1);this._passwordMustBeAtLeast5Characters.setVisible(!1)},onUpdateSocialLogin:function(a){cc.log("on social update event:"+a)},onGameReload:function(a){a&& (cc.log("Closing popup on game reload"),RSEventManager.getInstance().removeListenersForEvent("onUpdateSocialLogin"),this.closePopup())},closePopup:function(){RSEventManager.getInstance().removeListenersForEvent("GAME_RELOAD");if(this._openedFrom){var a="logout"==this._openedFrom?"logout":"",b="logout"==this._openedFrom?RSAnalyticsManager.getInstance().getCurrentMachineName():this._openedFrom;RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","close",a,"open_from_"+b,"")}this._callback&& this._callback();this._super.closePopup.call(this)}});var RSSwitchAccountsPopup=RSGenericPopup.extend({init:function(a,b){this._assetList=[{name:RSGame.getInstance().getAssetPath("RSSwitchAccountsPopup"),count:1}];RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("SwitchAccountFontConfigJson"),"SwitchAccountFontConfig.json");this._switchAccountDetails=a;cc.spriteFrameCache.addSpriteFrames(RSGame.getInstance().getAssetFolder("AvatarPopup")+"AvatarImages_00-hd.plist");this._blobdetails=b;this._super.init.call(this)},loadContent:function(){this.layoutScreen(this._assetList); this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.setProfileImage()},setProfileImage:function(){var a,b=RSGame.getInstance().getUserDataManager().getMe().getImageUrl();b&&this._profileObject.setVisible(!1);if(GameConfig.IS_EDIT_FIELDS_ENABLED&&this._switchAccountDetails.avathar_ID&&"facebook"!=this._switchAccountDetails.loginMode)a=GameConfig.BASE_URL+"/res/AvatarImages/"+this._switchAccountDetails.avathar_ID+".png";else if("facebook"== this._switchAccountDetails.loginMode)a=RSLoginManager.getInstance().getTemporaryFbData(),a="https://graph.facebook.com/"+a.id+"/picture?type\x3dsquare\x26access_token\x3d"+RSGame.getInstance().getGameManager().getFBAccessToken();else if("google"==this._switchAccountDetails.loginMode)a=getUserProfileImageUrl();else if("email"==this._switchAccountDetails.loginMode||this._switchAccountDetails.avathar_ID)a=GameConfig.BASE_URL+"/res/AvatarImages/"+this._switchAccountDetails.avathar_ID+".png";this.setProfilePic(this._profileObject, "SwitchAccountsPopup",this._objectData,b,RSEngine.loginMode);this.setProfilePic(this._profileObject1,"SwitchAccountsPopup",this._objectData1,a,this._switchAccountDetails.loginMode)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "OverviewBg1":this._overviewBg1=a;this._overviewBg1.setVisible(!0);break;case "ProfilePic1":this._objectData1=c;this._profileObject1=a;break;case "Frame1":this._frame1=a;this._frame1.setVisible(!0);break;case "SwitchAccountBtn":this._switchAccountBtn= a;this._switchAccountBtn.setVisible(!0);break;case "OverviewBg":this._overviewBg=a;this._overviewBg.setVisible(!0);break;case "ProfilePic":this._objectData=c;this._profileObject=a;break;case "Frame":this._frame=a;this._frame.setVisible(!0);break;case "ContinuePlayingBtn":this._continuePlayingBtn=a,this._continuePlayingBtn.setVisible(!0)}},createCustomObject:function(a,b){var c=RSPlatformFontAssetManager.getCustomFontVOFromConfig(RSPlatformFontAssetManager.getFontNameForLabelName(b.name));if(c)var d= RSGame.getInstance().getAssetPath(c.fontName);switch(b.name){case "Title":this._title=RSPlatformFontAssetManager.createCustomLabel(" SWITCH ACCOUNT?",b);this.addChild(this._title);break;case "SwitchConfirmationText":this._switchConfirmationText=RSPlatformFontAssetManager.createCustomLabel("Do you wish to switch to your previous account \nor continue playing?",b);this.addChild(this._switchConfirmationText);break;case "CoinIcon":this._coinIcon=RSUtils.createBasicObject(a,b);this.addChild(this._coinIcon); break;case "CoinIcon1":this._coinIcon1=RSUtils.createBasicObject(a,b);this.addChild(this._coinIcon1);break;case "Star1":this._star1=RSUtils.createBasicObject(a,b);this.addChild(this._star1);break;case "Star":this._star=RSUtils.createBasicObject(a,b);this.addChild(this._star);break;case "MeterBg":this._meterBg=RSUtils.createBasicObject(a,b);this.addChild(this._meterBg);break;case "MeterBg1":this._meterBg1=RSUtils.createBasicObject(a,b);this.addChild(this._meterBg1);break;case "CoinValue1":c=this.convertToNewFormat(this._switchAccountDetails.coinValue); this._coinValue1=new RSScaledLabel(c,d,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._coinValue1);break;case "CoinValue":c=this.convertToNewFormat(RSGame.getInstance().getUserDataManager().getMe().getCoins());this._coinValue=new RSScaledLabel(c,d,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._coinValue);break;case "LevelsLabel1":RSEngine.gameData.getDefaultValues().isLevelPrefixInSwitchAccount&&1==parseInt(RSEngine.gameData.getDefaultValues().isLevelPrefixInSwitchAccount)?this._levelsLabel1=new RSScaledLabel("LVL "+ this._switchAccountDetails.level,d,b,kTEXT_ALIGNMENT_CENTER):this._levelsLabel1=new RSScaledLabel(this._switchAccountDetails.level,d,b,kTEXT_ALIGNMENT_LEFT);this._levelsLabel1.setScale(c.fontSize);this.addChild(this._levelsLabel1);break;case "LevelsLabel":RSEngine.gameData.getDefaultValues().isLevelPrefixInSwitchAccount&&1==parseInt(RSEngine.gameData.getDefaultValues().isLevelPrefixInSwitchAccount)?this._levelsLabel=new RSScaledLabel("LVL "+RSGame.getInstance().getLevelManager().getCurrentLevel(), d,b,kTEXT_ALIGNMENT_CENTER):this._levelsLabel=new RSScaledLabel(RSGame.getInstance().getLevelManager().getCurrentLevel(),d,b,kTEXT_ALIGNMENT_LEFT);this._levelsLabel.setScale(c.fontSize);this.addChild(this._levelsLabel);break;case "ProgressMeter":this._progressMeter=RSUtils.createBasicObject(a,b);d=RSGame.getInstance().getLevelManager().getLevelBarProgress();1<d&&(d%=1);this._progressMeter.setAnchorPoint(0.5,0.5);this._progressMeter.setScaleX(d);this._progressMeter.setPosition(b.x-(b.w-b.w*d)/2,b.y); this.addChild(this._progressMeter);break;case "ProgressMeter1":this._progressMeter1=RSUtils.createBasicObject(a,b),d=this._switchAccountDetails.levelpercent,1<d&&(d%=1),this._progressMeter1.setAnchorPoint(0.5,0.5),this._progressMeter1.setScaleX(d),this._progressMeter1.setPosition(b.x-(b.w-b.w*d)/2,b.y),this.addChild(this._progressMeter1)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "ContinuePlayingBtn":RSAnalyticsManager.getInstance().trackPlayerAction("manage_account", "switch_account","continue","","");case "CloseBtn":RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","switch_account","close","","");this.closePopup();break;case "SwitchAccountBtn":RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","switch_account","switch",this._blobdetails.newBlobId,this._blobdetails.oldBlobId),this.switchAccounts()}},convertToNewFormat:function(a){a=a.toString();return a=12>=a.length?RSUtils.formatNumberWithComma(a):14>=a.length?RSUtils.formatNumberWithComma(a.substr(0, a.length-6))+"M":RSUtils.formatNumberWithComma(a.substr(0,a.length-9))+"B"},setProfilePic:function(a,b,c,d,e){b&&(this._screenName=b);a=new RSImageObject;GameConfig.IS_EDIT_FIELDS_ENABLED&&d.includes("AvatarImages")?(d=d.replace("guestplayer","1"),a.setImageFromUrl(d,c.x,c.y,c.w,c.h)):d?(e==LOGIN_MODE.EMAIL&&(d=d.replace("guestplayer","1")),a.setImageFromUrl(d,c.x,c.y,c.w,c.h)):a.setImageFromUrl(GameConfig.BASE_URL+"/res/AvatarImages/guestplayer.png",c.x,c.y,c.w,c.h);this._profileImage=a;this.createProfilePicObject(c)}, createProfilePicObject:function(a){this._profileImage&&a&&(this.mask=new RSClippingNode(RSUtils.createBasicObject(this._screenName,a)),this.mask.setAlphaThreshold(80),this.mask.addChild(this._profileImage),this.addChild(this.mask))},switchAccounts:function(){RSEngine.screenManager.addOverlay();RSLoginManager.getInstance().syncBlobId(this._blobdetails.loginType,this._blobdetails.loginId,this._blobdetails.email,this._blobdetails.oldBlobId,this._blobdetails.newBlobId);this.closePopup();RSLoginManager.getInstance().callFBCarousalCallback(!0)}});var RSEmailEditPopup=RSGenericPopup.extend({init:function(a,b){this._assetList=[{name:RSGame.getInstance().getAssetPath("EditEmailPopup"),count:1}];this._super.init.call(this);this._callBack=a;this._emailVerified=!1;RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("EmailEditFontConfig"),"EmailEditFontConfig.json");this._updatedEmail=b},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)}, onObjectCreated:function(a,b,c){switch(c.name){case "NextBtn":this._nextBtn=a;break;case "EmailInvalidText":this._invalidEmail=a;this._invalidEmail.setVisible(!1);break;case "EmailExistText":this._emailIdExist=a,this._emailIdExist.setVisible(!1)}this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a,b){var c=RSPlatformFontAssetManager.getCustomFontVOFromConfig(RSPlatformFontAssetManager.getFontNameForLabelName(b.name));c&&RSGame.getInstance().getAssetPath(c.fontName);var d=""; switch(b.name){case "EmailEditText":d=RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup")?RSGame.getInstance().getStringDictionary("RSEmailEditPopup").T1:RSGame.getInstance().getGameData().getPopupTextWithKey("EditEmailText");d=d.replace("\\n","\n");this._title=RSPlatformFontAssetManager.createCustomLabel(d,b);this.addChild(this._title);break;case "EmailAddress":this._email=new RSInputBox(b.w,b.h),this._email.setPosition(b.x,b.y-b.h/5),this._email.setFont(c.fontName,b.h/c.fontSize), this._email.setFontColor(c.fontColor.r,c.fontColor.g,c.fontColor.b),this._email.setName("Email"),this._email.setInputMode(1),this._email.setInputFlag(1),this._email.setPlaceholderFont(c.fontName,b.h/c.fontSize),this._email.setPlaceholderFontColor(c.fontColor.r,c.fontColor.g,c.fontColor.b),this._email.setPlaceholderText("Email Address"),this._email.setDelegate(this),this.addChild(this._email)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":if(this._callBack){this._callBack(); this.closePopup();break}RSEngine.screenManager.addOverlay();RSLoginManager.getInstance().updateSocialLogin("email",this._updatedEmail,null);this.closePopup();break;case "NextBtn":this._invalidEmail.setVisible(!1),this._emailIdExist.setVisible(!1),this._emailVerified?RSLoginManager.getInstance().webSignUp(this._emailEntered,"",this.signUpFailed.bind(this),this._updatedEmail):this._invalidEmail.setVisible(!0)}},editBoxEditingDidEnded:function(a){switch(a.getName()){case "Email":this._emailEntered=a._ccObject._text, this._isEmailValid=this._emailEntered.match(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/),this.setEmailValid(!1),null!=this._isEmailValid?this.setEmailValid(!0):this.setEmailValid(!1)}},editBoxEditingDidBegan:function(a){this._invalidEmail.setVisible(!1);this._emailIdExist.setVisible(!1)},editBoxTextChanged:function(a,b){switch(a.getName()){case "Email":this._email=b;break;case "Password":this._passwd=b}},setEmailValid:function(a){this._invalidEmail.setVisible(!a);this._emailVerified=a},signUpFailed:function(a){cc.log("Response: "+ a);!0==a?(this._callBack&&this._callBack(!0,this._emailEntered),this.closePopup()):this._emailIdExist.setVisible(!0)}});var RSRestorePasswordPopup=RSGenericPopup.extend({init:function(){this._assetList=[{name:RSGame.getInstance().getAssetPath("RestorePasswordPopup"),count:1}];RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("RestorePasswordFontConfig"),"RestorePasswordFontConfig.json");this._super.init.call(this);this._emailVerified=!1},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this); RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","forgot_password","open","","")},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "SendBtn":this._sendBtn=a;break;case "SentEmailText":this._sentEmailText=a;this._sentEmailText.setVisible(!1);break;case "EmailInvalidText":this._emailInvalidText=a,this._emailInvalidText.setVisible(!1)}},createCustomObject:function(a,b){var c=RSPlatformFontAssetManager.getCustomFontVOFromConfig(RSPlatformFontAssetManager.getFontNameForLabelName(b.name)); c&&RSGame.getInstance().getAssetPath(c.fontName);switch(b.name){case "EditEmailTextRestorePassword":c=RSGame.getInstance().getStringDictionary("EditEmailTextRestorePassword")?RSGame.getInstance().getStringDictionary("EditEmailTextRestorePassword").T1:RSGame.getInstance().getGameData().getPopupTextWithKey("EditEmailTextRestorePassword");c=c.replace("\\n","\n");this._msgBody=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(this._msgBody);break;case "EmailAddress":this._email=new RSInputBox(b.w, b.h),this._email.setPosition(b.x,b.y-b.h/5),this._email.setFont(c.fontName,b.h/c.fontSize),this._email.setFontColor(c.fontColor.r,c.fontColor.g,c.fontColor.b),this._email.setName("Email"),this._email.setPlaceholderFont(c.fontName,b.h/c.fontSize),this._email.setPlaceholderFontColor(c.fontColor.r,c.fontColor.g,c.fontColor.b),this._email.setPlaceholderText("Email Address"),this._email.setDelegate(this),this._email.setInputMode(1),this._email.setInputFlag(1),this.addChild(this._email)}return this._super.createCustomObject.call(this, a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","forgot_password","close","","");this.closePopup();break;case "SendBtn":this._emailVerified?(RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","forgot_password","send","",""),RSLoginManager.getInstance().forgotPassword(this._email,this.onforgotPasswordCallComplete.bind(this))):this._emailInvalidText.setVisible(!0)}},editBoxEditingDidEnded:function(a){switch(a.getName()){case "Email":this._emailEntered= a._ccObject._text,this._isEmailValid=this._emailEntered.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/),this.setEmailValid(!1),null!=this._isEmailValid?this.setEmailValid(!0):this.setEmailValid(!1)}},editBoxEditingDidBegan:function(a){this._emailInvalidText.setVisible(!1);this._sentEmailText.setVisible(!1)},editBoxTextChanged:function(a,b){switch(a.getName()){case "Email":this._email=b}},setEmailValid:function(a){this._emailVerified=a},onforgotPasswordCallComplete:function(a){200==a.result.status?a.result.message? this._emailInvalidText.setVisible(!0):this._sentEmailText.setVisible(!0):this._emailInvalidText.setVisible(!0)}});var RSLogOutPopup=RSPopup.extend({init:function(a){this._super.init.call(this);this._callBack=a;RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("RSLogoutFontConfig"),"RSLogoutFontConfig.json");this._msg="Are you sure you would\nlike to log out?"},loadContent:function(){this.layoutScreen(RSGame.getInstance().getAssetPath("RSLogOutPopup"));this._super.loadContent.call(this)},createCustomObject:function(a,b){switch(b.type){case "Label":this._subText=RSPlatformFontAssetManager.createCustomLabel(this._msg, b),this.addChild(this._subText)}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},onButtonClicked:function(a){switch(a){case "No":case "Stay":this._callBack("stay");this.closePopup();break;case "Yes":case "LogOut":this._callBack("logout"),this.closePopup()}},unloadContent:function(){this._callBack=null;this._super.unloadContent.call(this)}});var RSEmailVerificationPopup=RSGenericPopup.extend({init:function(a,b,c){this._assetList=[{name:RSGame.getInstance().getAssetPath("EmailVerificationPopup"),count:1}];RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("EmailVerificationFontConfigJson"),"EmailVerificationFontConfig.json");this._super.init.call(this);this._remainigTime=TimeManager.getInstance().getCurrentServerTime()+b;this._timeAtLaunch=TimeManager.getInstance().getCurrentServerTime();this._updatedEmail= a?a:RSEngine.userConfig.email;this._verifiedStatus=this._verificationInProgress=this._timerExpired=!1;this._callBack=c;this._popupClosed=!1;this._editEmailPopup=null},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this);this.scheduleFunctionOnce(this.checkEmailVerifiedORNot.bind(this),5)},onLayoutCompleted:function(){RSAnalyticsManager.getInstance().trackGUIEvent("verification","trigger","","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName()); this._super.onLayoutCompleted.call(this)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "EditHereBtn":this._editHereBtn=a;this._editHereBtn.setVisible(!0);this._editHereBtn.setTouchEnabled(!0);break;case "SendLinkAgain1Btn":this._sendLinkAgain1Btn=a;this._sendLinkAgain1Btn.setVisible(!0);this._sendLinkAgain1Btn.setTouchEnabled(!0);break;case "SendLinkAgain2Btn":this._sendLinkAgain2Btn=a;this._sendLinkAgain2Btn.setVisible(!1);this._sendLinkAgain2Btn.setTouchEnabled(!1); break;case "BottomLine1":this._bottomLine1=a;this._bottomLine1.setVisible(!0);break;case "BottomLine2":this._bottomLine2=a,this._bottomLine2.setVisible(!1)}},createCustomObject:function(a,b){var c=RSPlatformFontAssetManager.getCustomFontVOFromConfig(RSPlatformFontAssetManager.getFontNameForLabelName(b.name)),d="";switch(b.name){case "VerificationTitle":d=RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup")?RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup").T1:RSGame.getInstance().getGameData().getPopupTextWithKey("VerificationTitle"); this._title=RSPlatformFontAssetManager.createCustomLabel(d,b);this.addChild(this._title);break;case "VerificationEmailAddress":d=RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup")?RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup").H1:RSGame.getInstance().getGameData().getPopupTextWithKey("VerificationEmailAddress");RSEngine.loginMode==LOGIN_MODE.GUEST&&(d=RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup")?RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup").H2: RSGame.getInstance().getGameData().getPopupTextWithKey("verificationTextFOrFreshUsers"),d=d.replace("\\n","\n"),b.y+=15);this._emailAddress=RSPlatformFontAssetManager.createCustomLabel(d+"\n"+this._updatedEmail,b);this.addChild(this._emailAddress);break;case "VerificationEmailAddress1":this._emailIdTxt=RSPlatformFontAssetManager.createCustomLabel(this._updatedEmail,b);this._emailIdTxt.setFontColor(c.fontColor.r,c.fontColor.g,c.fontColor.b,255);this.addChild(this._emailIdTxt);break;case "VerificationMessage1":d= RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup")?RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup").H1:RSGame.getInstance().getGameData().getPopupTextWithKey("VerificationEmailAddress");RSEngine.loginMode==LOGIN_MODE.GUEST&&(d=RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup")?RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup").H2:RSGame.getInstance().getGameData().getPopupTextWithKey("verificationTextFOrFreshUsers"),d=d.replace("\\n", "\n"),b.y+=15);this._validationMsg1=RSPlatformFontAssetManager.createCustomLabel(d,b);this.addChild(this._validationMsg1);break;case "VerificationEmailValidationText":d=RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup")?RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup").H3:RSGame.getInstance().getGameData().getPopupTextWithKey("VerificationEmailValidationText");d=d.replace("\\n","\n");this._emailValidationText=RSPlatformFontAssetManager.createCustomLabel(d,b);this.addChild(this._emailValidationText); break;case "Timer":this._timer=RSPlatformFontAssetManager.createCustomLabel("24:00:00",b),this.addChild(this._timer)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":RSAnalyticsManager.getInstance().trackPlayerAction("verification","close","","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName(),"");if(RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId")){a=GameConfig.COOKIE_PREFIX+"-email";var b=GameConfig.COOKIE_PREFIX+ "-emailValue",c=GameConfig.COOKIE_PREFIX+"-loginType",d=RSLoginManager.getInstance().getUpdatedLoginTypes("email"),e={};e[a]=this._updatedEmail;e[b]=this._updatedEmail;e[c]=d;RSLoginManager.getInstance().setCookie(GameConfig.SSO_COOKIE_DOMAIN,null,e)}else RSEngine.screenManager.addOverlay(),RSLoginManager.getInstance().updateSocialLogin("email",this._updatedEmail,null);this._callBack&&this._callBack();this.closePopup();break;case "SendLinkAgain1Btn":this._editHereBtn.setTouchEnabled(!1);this._sendLinkAgain1Btn.setTouchEnabled(!1); RSAnalyticsManager.getInstance().trackPlayerAction("verification","resend_email","","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName(),"");RSLoginManager.getInstance().resendEmailVerificationCode(this._updatedEmail,this._ongetResponse.bind(this));break;case "SendLinkAgain2Btn":this._editHereBtn.setTouchEnabled(!1);this._sendLinkAgain2Btn.setTouchEnabled(!1);RSAnalyticsManager.getInstance().trackPlayerAction("verification","resend_email","","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName(), "");RSLoginManager.getInstance().resendEmailVerificationCode(this._updatedEmail,this._ongetResponse.bind(this));break;case "EditHereBtn":RSAnalyticsManager.getInstance().trackPlayerAction("verification","edit_email","","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName(),""),this._editHereBtn.setTouchEnabled(!1),this._editEmailPopup=new RSEmailEditPopup(this.onEmailEditPopupClosed.bind(this),this._updatedEmail),RSEngine.popupManager.addPopup(this._editEmailPopup,!0)}},checkEmailVerifiedORNot:function(){this._verificationInProgress|| (this._verificationInProgress=!0,cc.log("check for email verification"),RSLoginManager.getInstance().checkEmailVerificationStatus(this._updatedEmail,this.onEmailVerificationResponse.bind(this)))},onEmailVerificationResponse:function(a){this._verificationInProgress=!1;cc.log("On Email Verification Response:"+JSON.stringify(a));200==a.result.status&&"1"==a.result.verified?(RSSSOManager.setCookieEmailVerificationStatus(a.result),cc.log("email Verified"),this._verifiedStatus=!0,this.checkForVerificationProgressAndClosePopup()): (a=this.getTimeoutTime(),cc.log("nextCall in :"+a),this.scheduleFunctionOnce(this.checkEmailVerifiedORNot.bind(this),a))},checkForVerificationProgressAndClosePopup:function(){this._verifiedStatus&&(RSEngine.screenManager.addOverlay(),RSLoginManager.getInstance().updateSocialLogin("email",this._updatedEmail,null),this._callBack&&this._callBack(),this._editEmailPopup&&(this._editEmailPopup.closePopup(),this._editEmailPopup=null),this.closePopup())},_ongetResponse:function(){this._editHereBtn.setTouchEnabled(!0); this._sendLinkAgain1Btn.setTouchEnabled(!1);this._sendLinkAgain2Btn.setTouchEnabled(!0);this._bottomLine1.setVisible(!1);this._bottomLine2.setVisible(!0);this._sendLinkAgain1Btn.setVisible(!1);this._sendLinkAgain2Btn.setVisible(!0)},onEmailEditPopupClosed:function(a){this._editEmailPopup=null;this._editHereBtn.setTouchEnabled(!0);a&&this.closePopup()},update:function(){var a=this._remainigTime-TimeManager.getInstance().getCurrentServerTime();0<a?this.updateVerificationTimer(a):this._popupClosed|| (this._popupClosed=!0,this.onButtonClicked("CloseBtn"))},updateVerificationTimer:function(a){this._timer&&this._timer.setString(RSUtils.formattedTime(a))},getTimeoutTime:function(){var a=TimeManager.getInstance().getCurrentServerTime();return 90>a-this._timeAtLaunch?5:180>a-this._timeAtLaunch?10:30}});var RSEmailVerificationPromptPopup=RSGenericPopup.extend({init:function(a,b,c){this._assetList=[{name:RSGame.getInstance().getAssetPath("EmailVerificationPopup"),count:1}];RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("EmailVerificationFontConfigJson"),"EmailVerificationFontConfig.json");this._assetConfig.font=RSGame.getInstance().getAssetPath(RSPlatformFontAssetManager.getFontNameForLabelName("Button"));this._super.init.call(this);this._mailId=a?a:RSEngine.userConfig.email; this._remainigTime=TimeManager.getInstance().getCurrentServerTime()+300;this._timeAtLaunch=TimeManager.getInstance().getCurrentServerTime();this._verifiedStatus=this._verificationInProgress=this._timerExpired=!1;this._callBack=b;this._openFrom=c?c:RSAnalyticsManager.getInstance().getCurrentMachineName();this._editEmailPopup=null},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this);this.scheduleFunctionOnce(this.checkEmailVerifiedORNot.bind(this),5)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this); "giftcenter"==this._openFrom?RSAnalyticsManager.getInstance().trackPlayerAction("verification","open","","open_from_"+this._openFrom,""):RSAnalyticsManager.getInstance().trackGUIEvent("verification","trigger","","open_from_"+this._openFrom)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "EditHereBtn":this._editHereBtn=a;this._editHereBtn.setVisible(!0);this._editHereBtn.setTouchEnabled(!0);break;case "SendLinkAgain1Btn":this._sendLinkAgain1Btn=a; this._sendLinkAgain1Btn.setVisible(!0);this._sendLinkAgain1Btn.setTouchEnabled(!0);break;case "SendLinkAgain2Btn":this._sendLinkAgain2Btn=a;this._sendLinkAgain2Btn.setVisible(!1);this._sendLinkAgain2Btn.setTouchEnabled(!1);break;case "BottomLine1":this._bottomLine1=a;this._bottomLine1.setVisible(!0);break;case "BottomLine2":this._bottomLine2=a,this._bottomLine2.setVisible(!1)}},createCustomObject:function(a,b){var c=RSPlatformFontAssetManager.getCustomFontVOFromConfig(RSPlatformFontAssetManager.getFontNameForLabelName(b.name)), d="";switch(b.name){case "VerificationTitle":d=RSGame.getInstance().getStringDictionary("RSEmailVerificationPromptPopup")?RSGame.getInstance().getStringDictionary("RSEmailVerificationPromptPopup").T1:RSGame.getInstance().getGameData().getPopupTextWithKey("VerificationTitle");this._title=RSPlatformFontAssetManager.createCustomLabel(d,b);this.addChild(this._title);break;case "VerificationEmailAddress":d=RSGame.getInstance().getStringDictionary("RSEmailVerificationPromptPopup")?RSGame.getInstance().getStringDictionary("RSEmailVerificationPromptPopup").H1: RSGame.getInstance().getGameData().getPopupTextWithKey("VerificationEmailAddress");if(RSEngine.loginMode==LOGIN_MODE.GUEST||"giftcenter"==this._openFrom||!RSSSOManager.checkForMigratedUserOrNOt()&&!RSGame.getInstance().getUserDataManager().getMe().getLoginRewardStatus())d=RSGame.getInstance().getStringDictionary("RSEmailVerificationPromptPopup")?RSGame.getInstance().getStringDictionary("RSEmailVerificationPromptPopup").H2:RSGame.getInstance().getGameData().getPopupTextWithKey("verificationTextFOrFreshUsers"), b.y+=15;d=d.replace("\\n","\n");this._emailAddress=RSPlatformFontAssetManager.createCustomLabel(d+"\n"+this._mailId,b);this.addChild(this._emailAddress);break;case "VerificationEmailAddress1":this._emailIdTxt=RSPlatformFontAssetManager.createCustomLabel(this._mailId,b);this._emailIdTxt.setFontColor(c.fontColor.r,c.fontColor.g,c.fontColor.b,255);this.addChild(this._emailIdTxt);break;case "VerificationMessage1":d=RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup")?RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup").H1: RSGame.getInstance().getGameData().getPopupTextWithKey("VerificationEmailAddress");if(RSEngine.loginMode==LOGIN_MODE.GUEST||"giftcenter"==this._openFrom||!RSSSOManager.checkForMigratedUserOrNOt()&&!RSGame.getInstance().getUserDataManager().getMe().getLoginRewardStatus())d=RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup")?RSGame.getInstance().getStringDictionary("RSEmailVerificationPopup").H2:RSGame.getInstance().getGameData().getPopupTextWithKey("verificationTextFOrFreshUsers"), b.y+=15;d=d.replace("\\n","\n");this._validationMsg1=RSPlatformFontAssetManager.createCustomLabel(d,b);this.addChild(this._validationMsg1);break;case "VerificationPromptEmailValidationText":d=RSGame.getInstance().getStringDictionary("RSEmailVerificationPromptPopup")?RSGame.getInstance().getStringDictionary("RSEmailVerificationPromptPopup").H3:RSGame.getInstance().getGameData().getPopupTextWithKey("VerificationPromptEmailValidationText");this._emailValidationText=RSPlatformFontAssetManager.createCustomLabel(d, b);this.addChild(this._emailValidationText);break;case "Timer":this._emailValidationTimer=RSPlatformFontAssetManager.createCustomLabel("00:00:00",b),this.addChild(this._emailValidationTimer)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":RSAnalyticsManager.getInstance().trackPlayerAction("verification","close","","open_from_"+this._openFrom,"");RSSSOManager.checkForMigratedUserOrNOt()||RSLoginManager.getInstance().removeLoginData("email"); this._callBack&&this._callBack();this.closePopup();break;case "EditHereBtn":this._editHereBtn.setTouchEnabled(!1);RSAnalyticsManager.getInstance().trackPlayerAction("verification","edit_email","","open_from_"+this._openFrom,"");this._editEmailPopup=new RSEmailEditPopup(this.onEmailEditPopupClosed.bind(this),this._mailId);RSEngine.popupManager.addPopup(this._editEmailPopup,!0);break;case "SendLinkAgain1Btn":this._editHereBtn.setTouchEnabled(!1);this._sendLinkAgain1Btn.setTouchEnabled(!1);RSAnalyticsManager.getInstance().trackPlayerAction("verification", "resend_email","","open_from_"+this._openFrom,"");RSLoginManager.getInstance().resendEmailVerificationCode(this._mailId,this._ongetResponse.bind(this));break;case "SendLinkAgain2Btn":this._editHereBtn.setTouchEnabled(!1),this._sendLinkAgain2Btn.setTouchEnabled(!1),RSAnalyticsManager.getInstance().trackPlayerAction("verification","resend_email","","open_from_"+this._openFrom,""),RSLoginManager.getInstance().resendEmailVerificationCode(this._mailId,this._ongetResponse.bind(this))}},onEmailEditPopupClosed:function(a, b){this._editEmailPopup=null;if(this._editHereBtn&&(this._editHereBtn.setTouchEnabled(!0),a)){if(b){var c=GameConfig.COOKIE_PREFIX+"-email",d=GameConfig.COOKIE_PREFIX+"-emailValue",e=GameConfig.COOKIE_PREFIX+"-loginType",f=RSLoginManager.getInstance().getUpdatedLoginTypes("email"),g={};g[c]=b;g[d]=b;g[e]=f;RSLoginManager.getInstance().setCookie(GameConfig.SSO_COOKIE_DOMAIN,null,g);RSGame.getInstance().getUserDataManager().getMe().setEmail(b)}this.closePopup()}},_ongetResponse:function(){this._editHereBtn.setTouchEnabled(!0); this._sendLinkAgain1Btn.setTouchEnabled(!1);this._sendLinkAgain2Btn.setTouchEnabled(!0);this._bottomLine1.setVisible(!1);this._bottomLine2.setVisible(!0);this._sendLinkAgain1Btn.setVisible(!1);this._sendLinkAgain2Btn.setVisible(!0)},update:function(){if(this._emailValidationTimer){var a=this._remainigTime-TimeManager.getInstance().getCurrentServerTime();0<a?this.updateVerificationTimer(a):this._timerExpired||this._verificationInProgress||(RSSSOManager.checkForMigratedUserOrNOt()?(this._timerExpired= !0,this.onButtonClicked("CloseBtn")):(cc.log("Unlink email started"),this._timerExpired=!0,RSLoginManager.getInstance().unlinkExpiredEmail(this._mailId,this.onEmailUnlinkComplete.bind(this))))}},updateVerificationTimer:function(a){this._emailValidationTimer&&this._emailValidationTimer.setString(RSUtils.formattedTime(a))},checkEmailVerifiedORNot:function(){this._verificationInProgress||(this._verificationInProgress=!0,cc.log("check for email verification"),RSLoginManager.getInstance().checkEmailVerificationStatus(this._mailId, this.onEmailVerificationResponse.bind(this)))},onEmailVerificationResponse:function(a){this._verificationInProgress=!1;cc.log("On Email Verification Response:"+JSON.stringify(a));200==a.result.status&&"1"==a.result.verified?(cc.log("email Verified"),RSSSOManager.setCookieEmailVerificationStatus(a.result),this._verifiedStatus=!0,this.checkForVerificationProgressAndClosePopup()):(a=this.getTimeoutTime(),cc.log("nextCall in :"+a),this.scheduleFunctionOnce(this.checkEmailVerifiedORNot.bind(this),a))}, checkForVerificationProgressAndClosePopup:function(){this._verifiedStatus&&(RSEngine.screenManager.addOverlay(),RSLoginManager.getInstance().updateSocialLogin("email",this._mailId,null),this._callBack&&this._callBack(),this._editEmailPopup&&(this._editEmailPopup.closePopup(),this._editEmailPopup=null),this.closePopup())},onEmailUnlinkComplete:function(a){cc.log(" Email Unlink completed");this._callBack&&this._callBack();this.closePopup();RSLoginManager.getInstance().removeLoginData("email")},getTimeoutTime:function(){var a= TimeManager.getInstance().getCurrentServerTime();return 90>a-this._timeAtLaunch?5:180>a-this._timeAtLaunch?10:30}});var RSGameReloadPopup=RSGenericPopup.extend({init:function(a){this._assetList=[{name:RSGame.getInstance().getAssetPath("GameReloadPopup"),count:1}];this._loginType=a;RSGame.getInstance().getLoadingManger().getProgressPercentage(!0);this._super.init.call(this);this.string=["SYNCING...","SETTING UP YOUR PROFILE...","ALMOST THERE...","COMPLETE!"];this._msgID=1;cc.spriteFrameCache.addSpriteFrames(RSGame.getInstance().getAssetFolder("AvatarPopup")+"AvatarImages_00-hd.plist");RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("GameReloadFontConfig"), "GameReloadFontConfig.json");this._prevPercentage=0;this._displaypercert=1},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._percentageValue=RSGame.getInstance().getLoadingManger().getProgressPercentage()},onObjectCreated:function(a,b,c){switch(c.name){case "ProfileFrame":this._profileFrame=a;this._profileFrame.setVisible(!0);break;case "GameLoading":this._gameLoading=a;this._gameLoading.setVisible(!0); break;case "Title":this._title=a,this._title.stopAnimation(),"google"==this._loginType?this._title.setFrame(2):"apple"==this._loginType?this._title.setFrame(1):"facebook"==this._loginType?this._title.setFrame(0):"email"==this._loginType&&this._title.setFrame(3)}this._super.onObjectCreated.call(this,a,b,c)},actionOnUpdate:function(a,b){"progressMove"==a&&(this._bar.setPosition(this._barPos.getX(),this._barPos.getY()),this._bar.moveX(-this._barWidth/2),this._bar.setScaleX(b),this._barPercent=b%1,this._displaypercert= Math.floor(100*b),this._progression.setString("PLEASE WAIT... "+this._displaypercert+"%"))},actionOnComplete:function(a){"ReloadRollUp"==a&&this.stopActionTweenForKey("ReloadRollUp");100==this._displaypercert&&(this._userText.setString(this.string[3]),this._userText.getString()==this.string[3]&&this.scheduleFunctionOnce(function(){this.closePopup()}.bind(this),0.5))},moveBarTo:function(a,b){var c=this._barPercent;this.stopActionTweenForKey("progressMove");this.startActionTweenForKey("progressMove", 0.3,c,a)},update:function(){this._percentageValue=2*RSGame.getInstance().getLoadingManger().getProgressPercentage();this._percentageValue>=this._prevPercentage&&(this.displayMessages(),this.showRollups(),this._prevPercentage=this._percentageValue)},displayMessages:function(){this._userText&&this._percentageValue>100*this._msgID/3&&4>this._msgID&&(this._userText.setString(this.string[this._msgID]),this._msgID+=1)},showRollups:function(){this._prevPercentage<this._percentageValue&&this.moveBarTo(this._percentageValue/ 100)},createCustomObject:function(a,b){var c=RSPlatformFontAssetManager.getCustomFontVOFromConfig(RSPlatformFontAssetManager.getFontNameForLabelName(b.name));c&&RSGame.getInstance().getAssetPath(c.fontName);switch(b.name){case "userText":this._userText=RSPlatformFontAssetManager.createCustomLabel("SYNCING...",b);this.addChild(this._userText);break;case "progression":this._progression=RSPlatformFontAssetManager.createCustomLabel("PLEASE WAIT... ",b);this.addChild(this._progression);this._progression.setZOrder(5); break;case "LoadingCircle":this._loadingCircle=RSUtils.createBasicObject(a,b);this._loadingCircle.setVisible(!0);this._loadingCircle.actionRotateBy(2,360,-1);this.addChild(this._loadingCircle);break;case "LoadingBar":this._bar=RSUtils.createBasicObject(a,b);this._bar.setVisible(!0);this._barWidth=b.w;this._barHeight=b.h;this._barPercent=0;this._progressBar=new RSPanel(this._gameLoading.getX(),this._gameLoading.getY(),this._gameLoading._ccObject._contentSize.width,this._gameLoading._ccObject._contentSize.height); this.addChild(this._progressBar);this._progressBar.setZOrder(5);this._progressBar.addChild(this._bar);this._progressBar.setClippingEnabled(!0);this._barPos=c=this._progressBar.convertToNodeSpace(this._bar.getX(),this._bar.getY());this._bar.setPosition(c.getX(),c.getY());this._bar.moveX(-b.w/2);this._bar.setAnchorPoint(0,0.5);this._bar.setScaleX(0.01);break;case "UsersImage":c=new RSImageObject,c.setImageFromUrl(RSGame.getInstance().getUserDataManager().getMe().getImageUrl(),b.x,b.y,b.w,b.h),c.setCenter(b.x, b.y),this._profileImage=c,this.createProfilePicObject(b,a)}return this._super.createCustomObject.call(this,a,b)},createProfilePicObject:function(a,b){var c=new RSImageObject;if("google"==this._loginType){var d=getUserProfileImageUrl();c.setImageFromUrl(d,a.x,a.y,a.w,a.h)}else"facebook"==this._loginType?(d=RSLoginManager.getInstance().getTemporaryFbData(),d="https://graph.facebook.com/"+d.id+"/picture?type\x3dsquare\x26access_token\x3d"+RSGame.getInstance().getGameManager().getFBAccessToken(),c.setImageFromUrl(d, a.x,a.y,a.w,a.h)):c.setImageFromUrl(GameConfig.BASE_URL+"/res/AvatarImages/guestplayer.png",a.x,a.y,a.w,a.h);c.setCenter(a.x,a.y);(this._profileImage=c)&&a&&(this.mask=new RSClippingNode(RSUtils.createBasicObject(b,a)),this.mask.setAlphaThreshold(80),this.mask.addChild(this._profileImage),this.addChild(this.mask))}});var RSSocialLoginRewardPopup=RSPopup.extend({init:function(a,b,c){this._super.init.call(this,a);this._callback=a;this._collectButton=this._emailReward=this._txtMessage=null;this._textFont=b;a=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(a);this._assetList=c?c:[{name:RSGame.getInstance().getAssetPath("SmallPopupBG"),count:1},{name:RSGame.getInstance().getAssetPath("LoginSuccessPopup"),count:1}]},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)}, createCustomObject:function(a,b){switch(b.name){case "TextLabel":var c=RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","normal");this._textFont&&(c=this._textFont);this._txtMessage=new RSScaledLabel(this._msg,c,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._txtMessage)}},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "Collect":this._collectButton=a;break;case "CloseBtn":this._closeButton=a}},onButtonClicked:function(a){switch(a){case "Collect":case "CloseBtn":this._collectButton.setTouchEnabled(!1), this._closeButton.setTouchEnabled(!1),this.playAnimation()}this._super.onButtonClicked.call(this,a)},playAnimation:function(){var a=new RSPoint(this._collectButton.getX(),this._collectButton.getY());RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(a,this._diplayPanel,this.onCoinAnimComplete.bind(this))},onCoinAnimComplete:function(){RSSSOManager.getFbConnectStatusInGifting()&&!RSGame.getInstance().getUserDataManager().getMe().getFbLoginRewardStatus()&&RSGame.getInstance().getUserDataManager().getMe().setFbLoginRewardStatus(); RSGame.getInstance().getUserDataManager().getMe().setLoginRewardStatus(!0);RSGame.getInstance().getUserDataManager().saveUserData("fb reward");var a=GameConfig.COOKIE_PREFIX,b=[],b=RSLoginManager.getInstance().getCookie(a+"-loginType").split("|"),a=b[b.length-1];"facebook"==a?RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"fb_login",this._emailReward,"onetime_bonus"):"google"==a?RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"google_bonus",this._emailReward, "onetime_bonus"):"email"==a?RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"email_bonus",this._emailReward,"onetime_bonus"):"apple"==a&&RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"apple_bonus",this._emailReward,"onetime_bonus");RSCasinoManager.addPrimaryCurrency(this._emailReward,!0);RSSSOManager.setFbConnectStatusInGifting(!1);this.closePopup()},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.addChild(this._diplayPanel); var a=RSEngine.gameData.getDefaultValues();this._emailReward=parseInt(a.emailReward);this._txtMessage.setString(RSUtils.formatNumberWithComma(this._emailReward))}});var RSIconHolder=RSDisplayObject.extend({LONG_ICON:"LONG_ICON",LONG_WITH_BET_ICON:"LONG_WITH_BET_ICON",SMALL_ICON:"SMALL_ICON",CUSTOM_ICON:"CUSTOM_ICON",VIP_ICON:"VIP_ICON",MACHINE_UNLOCK_ICON:"MACHINE_UNLOCK_LAYOUT",LARGE_LAYOUT:"res/PlatformWidgets/RSIconHolder/IconBig",SMALL_LAYOUT:"res/PlatformWidgets/RSIconHolder/IconSmall",CUSTOM_LAYOUT:"res/PlatformWidgets/RSIconHolder/IconCustom",VIP_LAYOUT:"res/PlatformWidgets/RSIconHolder/VIPMachineIcon",MACHINE_UNLOCK_LAYOUT:"res/PlatformWidgets/RSIconHolder/MachineUnlockIcon", LONG_WITH_BET_LAYOUT:"res/PlatformWidgets/RSIconHolder/LongIconWithBet",init:function(a,b,c,d,e,f,g,h,k){this._underMaintenance=null;this._iconFont=g;this._iconRect=RSUtils.cloneJSON(b);b=new RSRect(this._iconRect.x,this._iconRect.y,this._iconRect.w,this._iconRect.h);this._super.init.call(this,b);this._machineDetails=e;this._vipTierValue=RSGame.getInstance().getGameManager().isVipEnabled()?this._machineDetails.VIPTier:0;c&&-1==c.indexOf("png")&&-1==c.indexOf("jpg")&&(c+=".png");this._iconUrl=c;this._onPlayClicked= d;this._enabled=!1;this._unlockedTier=RSGame.getInstance().getGameManager().isVipEnabled()?RSVIPManager.getInstance().getVIPUserTier():0;this._minBetTxt="";this._layoutType=a;this._unlockMachine=f;this._isClickDisabled=k?k:!1;this._usePreloader=null==h?!0:h;this.loadLayout()},loadLayout:function(){var a=null;switch(this._layoutType){case this.SMALL_ICON:a=this.SMALL_LAYOUT;break;case this.LONG_ICON:a=this.LARGE_LAYOUT;break;case this.CUSTOM_ICON:a=this.CUSTOM_LAYOUT;break;case this.VIP_ICON:a=this.VIP_LAYOUT; break;case this.MACHINE_UNLOCK_ICON:a=this.MACHINE_UNLOCK_LAYOUT;break;case this.LONG_WITH_BET_ICON:a=this.LONG_WITH_BET_LAYOUT}this._super.loadLayout.call(this,a)},setUnlock:function(){this._layoutType!=this.MACHINE_UNLOCK_ICON&&this._setMinBet();this._checkMachineUnlockStatus();this._setIconLockAndVipTexts();this._setMinBetCoinAndUnlockVisibility()},onLayoutCompleted:function(){this.setUnlock();this._layoutType==this.VIP_ICON&&this.checkMachineUnlockShown();this._super.onLayoutCompleted.call(this)}, createCustomObject:function(a,b){this._super.createCustomObject.call(this,a,b);switch(b.name){case "ImageHolder":this._layoutType==this.LONG_WITH_BET_ICON?this._setIcon(b):(this._panel=new RSPanel(b.x,b.y,b.w,b.h),this.addChild(this._panel));break;case "TouchArea":this._createTouchArea(b);break;case "IconHolder":this._layoutType==this.LONG_WITH_BET_ICON?(this._iconHolder=RSUtils.createBasicObject(a,b))&&this.addChild(this._iconHolder):this._setIcon(b);break;case "LockText":this._label=new RSScaledLabel("Unlocks at "+ this._machineDetails.levelRequired,this._iconFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._label);this._label.setVisible(!1);break;case "LevelValue":this._levelValue=new RSLabelBMFont("UNLOCKS AT\nLEVEL "+this._machineDetails.levelRequired,this._iconFont,2*b.w,kTEXT_ALIGNMENT_LEFT);this._levelValue.setPosition(b.x-b.w/2,b.y);"UP"==GameConfig.GAME_ID?this._levelValue.setScale(0.4):this._levelValue.setScale(0.5);this.addChild(this._levelValue);break;case "UnlockTextLeft":this._leftText=this._layoutType== this.LONG_WITH_BET_ICON?new RSScaledLabel("CARD COST: ",this._iconFont,b,kTEXT_ALIGNMENT_RIGHT):new RSScaledLabel("Min Bet: ",this._iconFont,b,kTEXT_ALIGNMENT_RIGHT);this.addChild(this._leftText);this._leftText.setVisible(!1);break;case "UnlockTextRight":this._rightText=b;this._labelrightText=this._layoutType==this.LONG_WITH_BET_ICON?new RSScaledLabel(this._minBetTxt,this._iconFont,this._rightText,kTEXT_ALIGNMENT_CENTER):new RSScaledLabel(this._minBetTxt,this._iconFont,this._rightText,kTEXT_ALIGNMENT_LEFT); this.addChild(this._labelrightText);this._labelrightText.setVisible(!1);break;case "VIPLockText":this._VIPlabel=new RSScaledLabel("Unlocks At ",this._iconFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._VIPlabel);this._VIPlabel.setVisible(!1);break;case "Tier":this._VIPTier=new RSScaledLabel(" Star ",this._iconFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._VIPTier);this._VIPTier.setVisible(!1);break;case "TimerBg":this._timerBG=RSUtils.createBasicObject(a,b);this._timerBG.setVisible(!1);this.addChild(this._timerBG); break;case "TimerText":this._timerText=new RSScaledLabel("12:12:12",RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","normal"),b,kTEXT_ALIGNMENT_CENTER);this._timerText.setVisible(!1);this.addChild(this._timerText);break;case "UnderMaintenance":this._underMaintenance=RSUtils.createBasicObject(a,b),this._underMaintenance.setVisible(!1),this._layoutType==this.CUSTOM_ICON&&this._underMaintenance.setPosition(this._iconRect.x/2,b.h/2),this.addChild(this._underMaintenance)}},_createTouchArea:function(a){var b= null,b=this._layoutType==this.CUSTOM_ICON?new RSRect(this._iconRect.x/2-this._iconRect.w/2,this._iconRect.y/2-this._iconRect.h/2,this._iconRect.w,this._iconRect.h):new RSRect(a.x-a.w/2,a.y-a.h/2,a.w,a.h);this._touchArea=new RSDisplayObject(b);this._touchArea.getDisplayObject()._name="touchArea";this.addChild(this._touchArea)},_setIcon:function(a){var b=new RSImageObject;this._layoutType==this.CUSTOM_ICON?b.setImageFromUrl(this._iconUrl,this._iconRect.x/2,this._iconRect.y/2,this._iconRect.w,this._iconRect.h, this._usePreloader):this._usePreloader?b.setImageFromUrlWithPreloader(this._iconUrl,a.x,a.y,a.w,a.h):b.setImageFromUrl(this._iconUrl,a.x,a.y,a.w,a.h);this.addChild(b)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "NewBadgeBig":"1"!=this._machineDetails.isNew?this.removeChild(a):"Animation"==c.type&&(this._newBadge=a,this._newBadge.stopAnimation(),this._newBadge.playAnimation(-1,0.3));break;case "IconLock":this._iconLock=a;this._iconLock.stopAnimation(); this._iconLock.setFrame(0);break;case "UnlockCoin":this._minBetCoin=a;break;case "Lock":this._locked=a;break;case "Unlock":this._unlocked=a;break;case "UnlockAnim_Particle":this._unlockAnim=a;this._unlockAnim.stopAnimation();this._unlockAnim.setVisible(!1);break;case "IconFrame":"Animation"==a._objectType&&(a.stopAnimation(),this._unlockMachine?a.setFrame(0):a.setFrame(1));break;case "UnlockText":this._unlockText=a;"Animation"==this._unlockText._objectType&&(this._unlockText.stopAnimation(),this._unlockMachine? this._unlockText.setFrame(0):this._unlockText.setFrame(1),this._unlockText.setVisible(!1));break;case "PlayNow":this._playButton=a,this._playButton.setVisible(!1)}},_checkMachineUnlockStatus:function(){var a=parseInt(this._machineDetails.isFeatureUnlocked);this._enabled=!1;var b=this._machineDetails.levelRequired<=RSGame.getInstance().getLevelManager().getCurrentLevel(),c=UrlNotificationManager.getInstance().getMachineUnlockStatus(this._machineDetails.machine_type);this._vipTierValue||a||b||c||this._unlockMachine? 0<this._vipTierValue?(this._unlockedTier=RSVIPManager.getInstance().getVIPUserTier(),this._unlockedTier>=this._vipTierValue&&(this._enabled=!0)):this._enabled=!0:GameFeatureTypeEnum.MACHINE_GIFT&&MachineGiftingManager.getInstance().isMachineGifted(this._machineDetails.machine_identifier)&&(this._enabled=!0,this._timerBG.setVisible(!0),this._timerText.setVisible(!0));this._setTouchEventListener(this._enabled,this._vipTierValue)},_setMinBet:function(){this._minBetTxt=RSGame.getInstance().getGameData().getMinimumBetByGameTypeAndName(RSGame.getInstance().getGameManager().getGameType(), this._machineDetails);this._labelrightText&&this._labelrightText.setString(RSUtils.formatNumber(this._minBetTxt))},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){this._enabled&&(RSGame.getInstance().getGameManager().setLocationForMachineOpenPopup(b,c),a.setTouchEnabled(!1),this._onPlayClicked(this._machineDetails,this._enabled,a,b,c))},handleButtonClick:function(a,b){this._enabled&&(a.setTouchEnabled(!1),this._onPlayClicked(this._machineDetails, this._enabled,a))},_setTouchEventListener:function(a,b){!this._isClickDisabled&&this._touchArea&&(0<b||a?(this._touchArea.addTouchListenerWithDelegate(this),this._touchArea.setTouchEnabled(!0)):this._touchArea.setTouchEnabled(!1))},enableEvent:function(){this.addMoveListener();this._newBadge&&(this._newBadge.stopAnimation(),this._newBadge.playAnimation(-1,0.3))},tableCellTouched:function(a){this._enabled&&(RSGame.getInstance().getGameManager().setLocationForMachineOpenPopup(a.x,a.y),this._onPlayClicked(this._machineDetails, this._enabled))},checkMachineUnlockShown:function(){var a=RSGame.getInstance().getUserDataManager().getMe().getVipMachineUnlocked();this._iconTier=this._vipTierValue;this._unlockedTier=RSVIPManager.getInstance().getVIPUserTier();this._lockStatus=a>=this._iconTier?!1:!0;this._unlockedTier>a&&this._unlockedTier>=this._iconTier&&this._lockStatus&&(this._lockStatus=!1,RSGame.getInstance().getUserDataManager().getMe().setVipMachineUnlocked(this._iconTier),this.unlockIcon())},setTempUnlockValues:function(a, b){var c=RSUtils.formattedTime(parseInt(a));if(this._timerBG){if(0==a)if(this._timerBG.setVisible(!1),this._timerText.setVisible(!1),MachineGiftingManager.getInstance().getFreeSpinStatus())UrlNotificationManager.getInstance().getAllMachineUnlockStatus()&&this._checkAndEnableMachineLock();else{MachineGiftingManager.getInstance().resetTempUnlockvalues(b);this._checkAndEnableMachineLock();return}this._timerText.setString(c)}},_checkAndEnableMachineLock:function(){this._checkMachineUnlockStatus();this._setMinBetCoinAndUnlockVisibility(); this._setIconLockAndVipTexts()},_setIconLockAndVipTexts:function(){this._enabled?(this._layoutType!=this.VIP_ICON?this._iconLock&&this._iconLock.setVisible(!1):this._iconLock&&(this._iconLock.stopAnimation(),this._iconLock.setFrame(this._vipTierValue-1)),this._locked&&this._locked.setVisible(!1),this._leftText&&this._leftText.setVisible(!0),this._rightText&&this._labelrightText.setVisible(!0),this._VIPlabel&&this._VIPlabel.setVisible(!1),this._VIPTier&&this._VIPTier.setVisible(!1),this._levelValue&& this._machineDetails.levelRequired<=RSGame.getInstance().getLevelManager().getCurrentLevel()&&this._levelValue.setVisible(!1)):0<this._vipTierValue?(this._VIPlabel&&this._VIPlabel.setVisible(!0),this._iconLock&&(this._iconLock.stopAnimation(),this._iconLock.setFrame(this._vipTierValue-1)),this._VIPTier&&this._VIPTier.setVisible(!0),this._layoutType!=this.VIP_ICON&&this._locked&&this._locked.setVisible(!1)):(this._label&&this._label.setVisible(!0),this._locked&&this._locked.setVisible(!0),this._iconLock&& this._iconLock.setVisible(!1),this._leftText&&this._leftText.setVisible(!1))},_setMinBetCoinAndUnlockVisibility:function(){var a=GameConfig.MACHINE_UNDERMAINTENANCE_FEATURE&&!parseInt(this._machineDetails.isEnabled)&&null!==this._underMaintenance;a&&this._underMaintenance&&(this._underMaintenance.setVisible(!0),this._enabled=!1);this._labelrightText&&this._labelrightText.setVisible(a?!1:this._enabled);this._leftText&&this._leftText.setVisible(a?!1:this._enabled);this._minBetCoin&&this._minBetCoin.setVisible(this._enabled); this._unlocked&&this._unlocked.setVisible(this._enabled)},playUnlockAnimations:function(a){this._unlockMachine&&this._playButton.setScale(0.1);this._unlockText.setScale(0.1);var b=this;RSUtils.callFunctionWithDelay(0.5,this.getDisplayObject(),function(){b._unlockMachine&&b._playButton.setVisible(!0);b._playButton.actionZoom(0.2,1,function(){b._playButton.setTouchEnabled(a);b.checkLevelUpCompleted()});b._unlockText.setVisible(!0);b._unlockText.actionZoom(0.2,1,null)})},checkLevelUpCompleted:function(){RSCasinoManager.getCasinoHUD().isLevelUpInitiated()&& RSGame.getInstance().getGameManager().showOverlayLayer()},unlockIcon:function(){this._unlockAnim&&(this._unlockAnim.setVisible(!0),this._unlockAnim.playAnimation(1,0.4));this.removeChild(this._locked);this.addChild(this._unlocked)}});var RSTutorialConfigVO=RSVO.extend({startTitleText:null,startMsgText:null,machineData:null,endTitleText:null,endMsgText:null,tutorialReward:null,init:function(a){this.tutorialReward=this.endMsgText=this.endTitleText=this.machineData=this.startMsgText=this.startTitleText="";this._super.init.call(this,a)}}),RSTutorialMachineDataVO=RSVO.extend({spins:null,texts:null,init:function(a){this.spins=[];this.texts=[];this._super.init.call(this,a)}}),RSTutorialDataVO=RSVO.extend({screenName:null,layout:null, message:null,init:function(a){this.message=this.layout=this.screenName="";this._super.init.call(this,a)}}),RSTutorialManager=RSClass.extend({_configVO:null,_tutorialDataVOArray:null,_tutorialMachineDataVO:null,_tutorialTitleFont:null,_tutorialBodyFont:null,_currentTutorialStateIndex:null,_tutorialStateCount:null,_isActive:null,_onCompleteCallback:null,init:function(){this._tutorialBodyFont=this._tutorialTitleFont="";this._isActive=!1;this._super.init.call(this)},initiateTutorialFlow:function(a,b, c){this._tutorialTitleFont=a;this._tutorialBodyFont=b;this._currentTutorialStateIndex=0;this._isActive=!0;this._tutorialDataVOArray=[];this._configVO=new RSTutorialConfigVO(RSEngine.gameData.getSheetData("tutorialConfig")[0]);this._tutorialMachineDataVO=new RSTutorialMachineDataVO(this._configVO.machineData);this._currentTutorialStateIndex=0;a=RSEngine.gameData.getSheetData("tutorialTexts");this._tutorialStateCount=a.length;for(var d in a)this._tutorialDataVOArray.push(new RSTutorialDataVO(a[d])); this._onCompleteCallback=c;this.showTutorialStartPopup()},showTutorialStartPopup:function(){var a=new RSTutorialStartPopup(RSGame.getInstance().getAssetPath("TutorialStartPopup"),this._configVO.startTitleText.text,this._configVO.startMsgText.text,this._tutorialTitleFont,this._tutorialBodyFont,this.addTutorialOverlayForCurrentIndex.bind(this),this.onTutorialSkipped.bind(this));RSEngine.popupManager.addPopup(a)},showTutorialEndPopup:function(){var a=new RSTutorialEndPopup(RSGame.getInstance().getAssetPath("TutorialEndPopup"), this._configVO.endTitleText.text,this._configVO.endMsgText.text,this._tutorialTitleFont,this._tutorialBodyFont,this.onTutorialCompletion.bind(this));RSEngine.popupManager.addPopup(a)},addTutorialOverlayForCurrentIndex:function(){if(this._isActive){var a=RSEngine.screenManager.getCurrentScreen().getName();if(this._currentTutorialStateIndex>=this._tutorialStateCount&&a!==RSGameScreens.Machine)this.showTutorialEndPopup();else{var b=this._tutorialDataVOArray[this._currentTutorialStateIndex].screenName; this._currentTutorialStateIndex<this._tutorialStateCount&&a===b&&(a=new RSTutorialOverlay(this._tutorialDataVOArray[this._currentTutorialStateIndex],this._tutorialBodyFont,this.updateTutorialIndex.bind(this)),RSEngine.screenManager.getCurrentLayer().addChild(a),a.setZOrder(5))}}},getIsActive:function(){return this._isActive},updateTutorialIndex:function(){this._currentTutorialStateIndex+=1},didCompleteGameplayTutorial:function(){this.updateTutorialIndex()},addNextTutorialOverlay:function(){this.updateTutorialIndex(); this.addTutorialOverlayForCurrentIndex()},onTutorialSkipped:function(){this._isActive=!1},onTutorialCompletion:function(){null!=this._onCompleteCallback&&this._onCompleteCallback();this._isActive=!1},getTutorialMachineParams:function(){return this._tutorialMachineDataVO}});var RSTutorialOverlay=RSDisplayObject.extend({init:function(a,b,c){this._tutorialTextVO=a;this._layout=this._tutorialTextVO.layout;this._message=this._tutorialTextVO.message.text;this._screenName=this._tutorialTextVO._screenName;this._callback=c;this._font=b;this._touchRect=null;this._super.init.call(this,new RSRect(0,0,RSEngine.screenWidth,RSEngine.screenHeight));this.loadLayout(RSGame.getInstance().getAssetPath(this._layout));this.addTouchListenerWithDelegate(this)},createCustomObject:function(a, b){if("Mask"===b.type){var c=new RSDrawNode;c.drawRect(new RSPoint(b.x-b.w/2,b.y-b.h/2),new RSPoint(b.x+b.w/2,b.y+b.h/2),new RSColor(0,0,0,125));this.addChild(c)}else if("Label"===b.type)c=new RSScaledLabel(this._message,this._font,b,kTEXT_ALIGNMENT_CENTER),c.setCenter(b.x,b.y),c.setColor(new RSColor(0,0,0)),this.addChild(c);else if("Rect"===b.type)this._touchRect=new RSRect(b.x-b.w/2,b.y-b.h/2,b.w,b.h);else if("Arrow"===b.name||"BubbleBase"===b.name||"Mascot"===b.name){c=RSUtils.createBasicObject(a, b);switch(b.type){case "Up":c.setRotation(270);break;case "Left":c.setRotation(180);break;case "Down":c.setRotation(90);break;case "FlipX":c.flipHorizontally(!0);break;case "FlipY":c.flipVertically(!0)}if("Arrow"===b.name){var d=Math.sin(c.getRotation()*(Math.PI/180)),e=Math.cos(c.getRotation()*(Math.PI/180));c.actionMoveToFro(1,b.x+20*e,b.x-20*e,b.y+20*d,b.y-20*d,-1)}this.addChild(c)}},handleObjectTouchAt:function(a,b,c,d){RSUtils.rectContainsPoint(this._touchRect,b,c)||d.stopPropagation()},handleObjectTouchMoveAt:function(a, b,c,d){RSUtils.rectContainsPoint(this._touchRect,b,c)||d.stopPropagation()},handleObjectTouchEndAt:function(a,b,c,d){RSUtils.rectContainsPoint(this._touchRect,b,c)||d.stopPropagation()},onButtonClicked:function(a){this._super.onButtonClicked.call(this,a);switch(a){case "ContinueButton":RSEngine.screenManager.getCurrentLayer().removeChild(this)}},unload:function(){this._callback();this._super.unload.call(this)}});var RSTutorialStartPopup=RSPopup.extend({init:function(a,b,c,d,e,f,g){this._screenLayout=a;this._titleText=b;this._bodyText=c;this._titleFont=d;this._bodyFont=e;this._progressCB=f;this._dismissCB=g;this._bodyLabel=this._titleLabel=null;this._super.init.call(this,null)},loadContent:function(){this._super.loadContent.call(this);this.layoutScreen(this._screenLayout)},createCustomObject:function(a,b){switch(b.name){case "Title":this._titleLabel=new RSScaledLabel(this._titleText,this._titleFont,b,kTEXT_ALIGNMENT_CENTER); this._titleLabel.setCenter(b.x,b.y);this.addChild(this._titleLabel);break;case "Text1":this._bodyLabel=new RSLabelBMFont(this._bodyText,this._bodyFont,b.w,kTEXT_ALIGNMENT_CENTER),this._bodyLabel.setCenter(b.x,b.y),this.addChild(this._bodyLabel)}this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "TakeTheTour":this._progressCB();this.closePopup();break;case "NoThanks":this._dismissCB(),this.closePopup()}}}),RSTutorialEndPopup=RSPopup.extend({init:function(a,b, c,d,e,f){this._screenLayout=a;this._titleText=b;this._bodyText=c;this._titleFont=d;this._bodyFont=e;this._dismissCB=f;this._bodyLabel=this._titleLabel=null;this._super.init.call(this)},loadContent:function(){this._super.loadContent.call(this);this.layoutScreen(this._screenLayout)},createCustomObject:function(a,b){switch(b.name){case "Title":this._titleLabel=new RSScaledLabel(this._titleText,this._titleFont,b,kTEXT_ALIGNMENT_CENTER);this._titleLabel.setCenter(b.x,b.y);this.addChild(this._titleLabel); break;case "Text1":this._bodyLabel=new RSLabelBMFont(this._bodyText,this._bodyFont,b.w,kTEXT_ALIGNMENT_CENTER),this._bodyLabel.setCenter(b.x,b.y),this.addChild(this._bodyLabel)}this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "Collect":this._dismissCB();this.closePopup();break;case "CloseBtn":this._dismissCB(),this.closePopup()}}});function showCrossLinkBlockerMessage(){RSAnalyticsManager.getInstance().trackVideoBonusEvent("ad_blocker_info","","trigger");document.getElementById("crosslink-blocker").style.display="block"}function hideBlockerMessage(){document.getElementById("crosslink-blocker").style.display="none"} var onCrossLinkClosed="onCrossLinkClosed",VideoManager=function(){var a,b=RSClass.extend({init:function(){this._super.init.call(this);this._videoAdPlacement=null;this._videoWatchCount=0;this._reward=this._type=this._placement=null;this._istriggered=!0;this._callBack=this._placementObject=null;this._retryCount=0;this._placementName=null;this._isAdsAvailable=!0;this._isQuestAd=this._isForced=!1;window.document.addEventListener(onCrossLinkClosed,this.onCrossLinkClosed.bind(this),!1)},initialiseManager:function(){this._videoAdPlacement= RSGame.getInstance().getGameData().getSheetData("VideoAd_placements");this._adBlockerEnabled=document.getElementById("LjjjffgghfghSe3333")?!1:!0},disableAdsManager:function(){this._isAdsAvailable=!1},getAdsAvailableStatus:function(){return this._isAdsAvailable},showVideoPopup:function(a,b,e,f){this._isAdsAvailable?(this._callBack=f,RSEngine.loginMode==LOGIN_MODE.GUEST?null!=this._callBack&&this._callBack():this._adBlockerEnabled?showCrossLinkBlockerMessage():(this._placement=a,this._istriggered=b, a=RSGame.getInstance().getUserDataManager().getMe().getVideoWatchCount().split("_"),this._videoWatchCount=parseInt(a[1]),b=new Date(1E3*parseInt(a[0])),a=new Date,b=b.getDay(),a=a.getDay(),b!=a&&(RSGame.getInstance().getUserDataManager().getMe().setVideoWatchCount(0),this._videoWatchCount=0),this.checkForCondition()?this._istriggered?this.showAd():null==this._videoPopup&&(this._videoPopup=new VideoPopup(this._placement,this._reward,e,this._onVideoPopupClosed.bind(this)),RSEngine.popupManager.addPopup(this._videoPopup)): RSEngine.popupManager.addPopup(new VideoRewardPopup("",!1,this.freeChipsPopupsCallback.bind(this)),!1))):RSGame.getInstance().getGameManager().showAdsNotAvailablePopup(e,f)},_onVideoPopupClosed:function(){this._videoPopup=null;this._callBack&&this._callBack()},checkForCondition:function(){for(var a=!1,b=0;b<this._videoAdPlacement.length;b++)this._videoAdPlacement[b].Placement==this._placement&&(this._placementObject=this._videoAdPlacement[b],(a=this.checkForDependency(this._placementObject.Dependencies))&& (a=this.checkForSegment(this._placementObject.Segment)),a&&(this._type=this._placementObject.Type,null!=this._placementObject.Reward&&"TBD"!=this._placementObject.Reward&&(this._reward=parseInt(this._placementObject.Reward))));return a},checkForSegment:function(a){for(;0<a.length;){a=a[0];for(var b in a)if(!this.performCheck(b,a[b]))return!1;break}return!0},checkForDependency:function(a){for(;0<a.length;){a=a[0];for(var b in a)if(!this.performCheck(b,a[b]))return!1;break}return!0},performCheck:function(a, b){var e=!1,f=null,g=null,h=null;if("CountPerDay"==a)h=parseInt(b.match(/\d+/)[0]),g=b.replace(b.match(/\d+/)[0],""),f=this._videoWatchCount,e=this.check(f,g,h);else if("CountPerSession"==a)h=parseInt(b.match(/\d+/)[0]),g=b.replace(b.match(/\d+/)[0],""),f=GlobalVars.videoWatchCountForPurchaseCartClose,e=this.check(f,g,h);else if("DealCount"==a)h=parseInt(b.match(/\d+/)[0]),g=b.replace(b.match(/\d+/)[0],""),f=GlobalVars.dealCount,e=this.check(f,g,h);else if("DealCountReset"==a){h=parseInt(b.match(/\d+/)[0]); g=b.replace(b.match(/\d+/)[0],"");f=GlobalVars.dealCount;if(e=this.check(f,g,h))GlobalVars.dealCount=1;e=!1}else"machine"==a?0<=b.indexOf(GlobalVars.currentGameCategory)&&(e=!0):"Day"==a?(h=parseInt(b.match(/\d+/)[0]),g=b.replace(b.match(/\d+/)[0],""),f=RSGame.getInstance().getUserDataManager().getMe().getCurrentDay(),e=this.check(f,g,h)):"MF"==a?(h=parseInt(b.match(/\d+/)[0]),g=b.replace(b.match(/\d+/)[0],""),f=RSGame.getInstance().getUserDataManager().getMe().getMonetizationFactor(),e=this.check(f, g,h)):"isForced"==a?((h=parseInt(b.match(/\d+/)[0]))?(this._isForced=!0,this._type="interstitial"):this._isForced=!1,e=!0):"maxTriggerForSession"==a&&(h=parseInt(b.match(/\d+/)[0]),g=b.replace(b.match(/\d+/)[0],""),f=GlobalVars.videoWatchCountForSession,e=this.check(f,g,h));return e},check:function(a,b,e){var f=!1;switch(b){case "\x3c":a<e&&(f=!0);break;case "\x3e":a>e&&(f=!0);break;case "\x3c\x3d":a<=e&&(f=!0);break;case "\x3e\x3d":a>=e&&(f=!0);break;case "\x3d\x3d":a==e&&(f=!0);break;case "!\x3d":a!= e&&(f=!0);break;case "%":0==a%e&&(f=!0)}return f},_getReward:function(){var a=0;"TBD"==this._placementObject.Reward?"ExitDailyBonusPoker"==this._placement?(a=RSGame.getInstance().getGameData().getSheetData("retentionBonus"),a=RSUtils.sortObjectWithIntKey(a,"day"),a=parseInt(a[GlobalVars.sevenDayBonusDay-1].coin)):"ExitBihourlyBonusPoker"==this._placement&&(a=RSGame.getInstance().getGameData().getSheetData("hourlyBonusConfig"),a=parseInt(a[0].hourlyBonusCoins)):null!=this._placementObject.Reward&& (a=parseInt(this._placementObject.Reward));return a},showAd:function(a,b,e,f){RSEngine.audioManager.setMusicVolume(0);this._isQuestAd=f;if(f=document.getElementById("SpinGame"))f.style.visibility="hidden";f=a?a:"rewarded";e&&this._setVideoWatchReward(e);this._placementName=b?b:"Ad_PD";this._videoWatchCount++;b=document.createElement("LifeStreet");b.id="LifeStreet";b.innerHTML="\x3ciframe id\x3d'lifeStreet' scrolling\x3d'no' height\x3d'100%' frameborder\x3d'0' width\x3d'100%' marginheight\x3d'0' marginwidth\x3d'0' src\x3d'res/WebAssets/lifeStreet.html?type\x3d"+ f+"'\x3e\x3c/iframe\x3e";document.getElementById("Cocos2dGameContainer").appendChild(b);RSEngine.closeFullScreen();(b=document.getElementById("lifeStreet"))&&b.contentWindow.focus();GameConfig.PLATFORM_EVENT_MANAGER_ENABLED?this._type=a:RSGame.getInstance().getUserDataManager().getMe().setVideoWatchCount(this._videoWatchCount);RSAnalyticsManager.getInstance().trackVideoBonusEvent("ad",this._type,"started",this._placementName,"lifeStreet");RSGame.getInstance().getGameManager().setSideMenuVisibility(!1)}, onCrossLinkClosed:function(a){var b=document.getElementById("SpinGame");b&&(b.style.visibility="visible");GlobalVars.musicVolumeLevel&&RSEngine.audioManager.setMusicVolume(GlobalVars.musicVolumeLevel);document.getElementById("LifeStreet")&&document.getElementById("LifeStreet").remove();a&&("PurchaseCartCloseWithoutPurchase"==this._placement&&GlobalVars.videoWatchCountForPurchaseCartClose++,!0==a.detail.status?(RSAnalyticsManager.getInstance().trackVideoBonusEvent("ad",this._type,"completed",this._placementName, "lifeStreet"),GameConfig.PLATFORM_EVENT_MANAGER_ENABLED?this._isQuestAd?("undefined"!==typeof SideMenuController&&SideMenuController.getInstance().setSideMenuVisibility(!0),RSEventManager.getInstance().dispatchEvent(RSGeneralQuestEventKeys.WATCH_AD_ACTION,1)):RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.COLLECT_AD_REWARD,AD_REWARD_STATUS.COMPLETED):(RSEngine.screenManager.addOverlay(),this._updateVideoReward())):"EXCEPTION"==a.detail.event?GameConfig.PLATFORM_EVENT_MANAGER_ENABLED? RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.COLLECT_AD_REWARD,AD_REWARD_STATUS.EXCEPTION):(this._istriggered||RSEventManager.getInstance().dispatchEvent(videoNotAvailable),null!=this._callBack&&this._callBack()):("interstitial"==this._type&&RSAnalyticsManager.getInstance().trackVideoBonusEvent("ad",this._type,"completed",this._placementName,"lifeStreet"),RSAnalyticsManager.getInstance().trackVideoBonusEvent("ad",this._type,"closed",this._placementName,"lifeStreet"),GameConfig.PLATFORM_EVENT_MANAGER_ENABLED? (this._isQuestAd&&(RSEventManager.getInstance().dispatchEvent(RSGeneralQuestEventKeys.WATCH_AD_ACTION,1),RSEventManager.getInstance().dispatchEvent("WatchAdCompleted"),RSEngine.dataManager.getMe().setWatchAdQuestSetId(RSQuestManager.getInstance().getCurrentQuestSetId()),RSEngine.popupManager.addPopup(new RSDailyQuestPopup(RSGame.getInstance().getAssetPath("DailyChallengePopup"),RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestRewardText()))),RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.COLLECT_AD_REWARD, AD_REWARD_STATUS.CANCELLED)):(this._istriggered||RSEventManager.getInstance().dispatchEvent(videoAvailable),null!=this._callBack&&this._callBack())),!1!=a.detail.status||this._videoPopup||"undefined"===typeof SideMenuController||this._isQuestAd||RSGame.getInstance().getGameManager().setSideMenuVisibility(!0));this._isQuestAd=!1},_updateVideoReward:function(){RSGame.getInstance().getUserDataManager().rewardVideoBonus(this._placement,this.onVideoBonusUpdated.bind(this),this.onVideoBonusUpdateFailed.bind(this))}, onVideoBonusUpdated:function(a){this._retryCount=0;RSEngine.screenManager.removeOverlay();a.result.data&&(this._istriggered||RSEventManager.getInstance().dispatchEvent(videoAvailable),RSEngine.popupManager.addPopup(new VideoRewardPopup(this._reward,!0,this.freeChipsPopupsCallback.bind(this)),!1),RSCasinoManager.triggerPrimarySourceEvent(RSAnalyticsSource.paid,"video_bonus",this._reward,this._placementName,"lifeStreet"))},freeChipsPopupsCallback:function(){null!=this._callBack&&this._callBack()},onCallBackOnCoinSuccess:function(){RSPlatformSDKManager.getInstance().setAttribute(SDK_ATTRIBUTE_TYPE.coins, RSGame.getInstance().getUserDataManager().getMe().getCoins())},onVideoBonusUpdateFailed:function(a){3>this._retryCount?(this._retryCount++,this._updateVideoReward()):(this._retryCount=0,RSErrorTracker.getInstance().trackErrorMessage("REWARD_VIDEO_BONUS","Error collecting video reward bonus","mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"))},_setVideoWatchReward:function(a){this._reward=a},getAdBlockerStatus:function(){return this._adBlockerEnabled},unload:function(){this._super.unload.call(this)}}); return{getInstance:function(){a||(a=new b);return a}}}();var VideoRewardPopup=RSGenericPopup.extend({init:function(a,b,c,d,e){this._coinAwarded=a;this._messages=e?RSGame.getInstance().getGameData().getPopupMessagesWithKey(e):RSGame.getInstance().getGameData().getPopupMessagesWithKey("videoReward");this._claimReward=b;this._assetList=[{name:RSGame.getInstance().getAssetPath("AdMobPopup"),count:1}];this._coinAnim=null;this._videoNotAvailable=e;d&&(this._placementName=d);(this._adPopupFonts=RSGame.getInstance().getGameManager().getAdPopupFonts())&&(this._assetConfig.font= this._adPopupFonts.BUTTON_TEXT.stroke?RSGame.getInstance().getGameManager().getDefaultCasinoFont(this._adPopupFonts.BUTTON_TEXT.size,this._adPopupFonts.BUTTON_TEXT.type,this._adPopupFonts.BUTTON_TEXT.stroke):RSGame.getInstance().getGameManager().getDefaultCasinoFont(this._adPopupFonts.BUTTON_TEXT.size,this._adPopupFonts.BUTTON_TEXT.type));this._super.init.call(this,c,this._assetConfig)},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this); this._claimReward?(this._thanksButton.setVisible(!0),this._claimButton.setVisible(!1),this._continueButton&&this._continueButton.setVisible(!1)):(this._coinPanel.setVisible(!1),this._coinStack&&this._coinStack.setVisible(!1),this._coinStackLeft&&this._coinStackLeft.setVisible(!1),this._coinStackRight&&this._coinStackRight.setVisible(!1),this._char&&this._char.setVisible(!1),this._videoNotAvailable?(this._continueButton.setVisible(!0),this._claimButton.setVisible(!1),this._thanksButton.setVisible(!1), "adnotAvailable"==this._videoNotAvailable&&(this._continueButton.setVisible(!1),this._claimButton.setVisible(!1),this._thanksButton.setVisible(!1),this._tryAgainButton.setVisible(!0),this._subHeading.setVisible(!1),this._subHeading1.setVisible(!0))):(this._claimButton.setVisible(!0),this._thanksButton.setVisible(!1)))},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CoinPanel":this._coinPanel=a;break;case "CoinStack":this._coinStack=a;break;case "CoinStacksLeft":this._coinStackLeft= a;break;case "CoinStacksRight":this._coinStackRight=a;break;case (c.name.match(/CP_Char/)||{}).input:this._char=a;break;case "CloseBtn":this._closeButton=a}switch(c.type){case "CP_Button_T1":this._thanksButton=a;this._coinAnim=c;break;case "CP_Button_T2":this._claimButton=a;this._coinAnim=c;break;case "CP_Button_T3":this._continueButton=a;this._continueButton.setVisible(!1);break;case "CP_Button_T4":this._tryAgainButton=a,this._tryAgainButton.setVisible(!1)}},createCustomObject:function(a,b){switch(b.name){case "SubTitle":this._subtitleFont= this._adPopupFonts.SUBTITLE?RSGame.getInstance().getGameManager().getDefaultCasinoFont(this._adPopupFonts.SUBTITLE.size,this._adPopupFonts.SUBTITLE.type):RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","bold");this._subHeading=new RSLabelBMFont("",this._subtitleFont,2*b.w,kTEXT_ALIGNMENT_CENTER);this._subHeading.setCenter(b.x,b.y);var c="";this._claimReward?(c=this._messages.messageBodyAvailable,this._subHeading.setString(c),"AP"==GameConfig.GAME_ID||"UP"==GameConfig.GAME_ID?this._subHeading.setScale(1.2): this._subHeading.setScale(0.9)):(c=this._messages.messageBodyClaimed,this._subHeading.setString(c),"AP"==GameConfig.GAME_ID||"UP"==GameConfig.GAME_ID?(this._subHeading.setCenter(b.x,b.y-32),this._subHeading.setScale(0.8)):this._subHeading.setScale(0.6));this.addChild(this._subHeading);break;case "SubTitle1":this._subtitleFont=this._adPopupFonts.SUBTITLE?RSGame.getInstance().getGameManager().getDefaultCasinoFont(this._adPopupFonts.SUBTITLE.size,this._adPopupFonts.SUBTITLE.type):RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium", "bold");this._subHeading1=new RSLabelBMFont("",this._subtitleFont,2*b.w,kTEXT_ALIGNMENT_CENTER);this._subHeading1.setCenter(b.x,b.y);c=this._messages.messageBodyClaimed;this._subHeading1.setString(c);this._subHeading1.setScale(0.9);this._subHeading1.setVisible(!1);this.addChild(this._subHeading1);break;case "CoinText":if(isNaN(this._coinAwarded)||0>=this._coinAwarded)return;null!=RSGame.getInstance().getGameManager().getVideoRewardPopupFont()?this._coinTextFont=RSGame.getInstance().getGameManager().getVideoRewardPopupFont(): this._coinTextFont=this._adPopupFonts.REWARDTYPE1?RSGame.getInstance().getGameManager().getDefaultCasinoFont(this._adPopupFonts.REWARDTYPE1.size,this._adPopupFonts.REWARDTYPE1.type):RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold");this._titleText=new RSScaledLabel("",this._coinTextFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._titleText);this._titleText.setString(RSUtils.formatNumber(this._coinAwarded));break;case "Title":c=this._claimReward?this._messages.messageTitleAvailable: this._messages.messageTitleClaimed,this._titleFont=this._adPopupFonts.TITLE?RSGame.getInstance().getGameManager().getDefaultCasinoFont(this._adPopupFonts.TITLE.size,this._adPopupFonts.TITLE.type):RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),this._heading=new RSScaledLabel(c,this._titleFont,b,kTEXT_ALIGNMENT_CENTER),this.addChild(this._heading)}return this._super.createCustomObject.call(this,a,b)},onCallBackOnCoinSuccess:function(){var a=new RSRect(0,0,0,0);this._diplayPanel= new RSDisplayObject(a);this.addChild(this._diplayPanel);this._diplayPanel.setZOrder(1);a=this._diplayPanel.convertToNodeSpace(this._coinAnim.x,this._coinAnim.y);RSEngine.screenManager.removeOverlay();RSGame.getInstance().getGameManager().getGameType()==RSGameTypes.Bingo&&RSEngine.externalGameManager.setBingoData();RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(a,this._diplayPanel,this.closePopup.bind(this));RSPlatformSDKManager.getInstance().setAttribute(SDK_ATTRIBUTE_TYPE.coins,RSGame.getInstance().getUserDataManager().getMe().getCoins())}, onButtonClicked:function(a){switch(a){case "CP_Button_T2":!this._claimReward&&this._placementName&&RSAnalyticsManager.getInstance().trackGUIEvent("max_ad_limit","click","",this._placementName);this.closePopup();break;case "CP_Button_T3":this.closePopup();break;case "CP_Button_T4":this.closePopup();break;case "CP_Button_T1":case "CloseBtn":this._claimReward?(this._claimButton.setTouchEnabled(!1),this._closeButton.setTouchEnabled(!1),RSEngine.screenManager.addOverlay(),RSGame.getInstance().getUserDataManager().getCoinBalance(this.onCallBackOnCoinSuccess.bind(this))): (this.closePopup(),this._videoNotAvailable||this._placementName&&RSAnalyticsManager.getInstance().trackGUIEvent("max_ad_limit","close","",this._placementName))}}});var videoNotAvailable="videoNotAvailable",videoAvailable="videoAvailable",VideoPopup=RSGenericPopup.extend({init:function(a,b,c,d){this._assetList=[{name:RSGame.getInstance().getAssetPath("PurchaseDisabledPopup"),count:1}];var e=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(e);this._super.init.call(this,d);this._playButton=this._closeButton=null;this._source=c;this._noAdIcon=this._adIcon=this._loadingCircle=this._txtCredits=null;this._reward=b;this._placement=a;this._adPopupFonts=RSGame.getInstance().getGameManager().getAdPopupFonts(); GameConfig.HOUSE_ADS_ENABLED||RSAnalyticsManager.getInstance().trackVideoBonusEvent("lifeStreet","ad","trigger","Ad_PD");RSAnalyticsManager.getInstance().trackGUIEvent("purchase_disable_popup","trigger",this._source,"");RSEventManager.getInstance().addEventListener(videoNotAvailable,this,this._onVideoNotAvailable.bind(this));RSEventManager.getInstance().addEventListener(videoAvailable,this,this._onVideoAvailable.bind(this))},getName:function(){return"VideoPopup"},loadContent:function(){this.layoutScreen(this._assetList); this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.addChild(this._diplayPanel)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CloseBtn":this._closeButton=a;break;case "MediumBtn":case "MediumBtnType2":this._playButton=a;break;case "LoadingCircle":this._loadingCircle=a,this._loadingCircle.stopAnimation(),this._loadingCircle.setVisible(!1)}},createCustomObject:function(a,b){var c=RSGame.getInstance().getGameData().getPopupMessagesWithKey("purchaseDisabled"); switch(b.name){case "Title":this._titleFont=this._adPopupFonts.TITLE?RSGame.getInstance().getGameManager().getDefaultCasinoFont(this._adPopupFonts.TITLE.size,this._adPopupFonts.TITLE.type):RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold");c=new RSLabelBMFont(c.messageTitleClaimed,this._titleFont,2*b.w,kTEXT_ALIGNMENT_CENTER);c.setScale(this._adPopupFonts.TITLE_TEXT_SCALE?this._adPopupFonts.TITLE_TEXT_SCALE:".9");this.addChild(c);c.setCenter(b.x,b.y);break;case "Heading":this._subtitleFont= this._adPopupFonts.SUBTITLE?RSGame.getInstance().getGameManager().getDefaultCasinoFont(this._adPopupFonts.SUBTITLE.size,this._adPopupFonts.SUBTITLE.type):RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","bold");"AP"==GameConfig.GAME_ID?(this._txtHeading=new RSLabelBMFont(c.messageBodyClaimed,this._subtitleFont,1.5*b.w,kTEXT_ALIGNMENT_CENTER),this._txtHeading.setScale(0.63)):"FPC"==GameConfig.GAME_ID?(this._txtHeading=new RSLabelBMFont(c.messageBodyClaimed,this._subtitleFont,1.65* b.w,kTEXT_ALIGNMENT_CENTER),this._txtHeading.setScale(0.6)):"UP"==GameConfig.GAME_ID?(this._txtHeading=new RSLabelBMFont(c.messageBodyClaimed,this._subtitleFont,1.5*b.w,kTEXT_ALIGNMENT_CENTER),this._txtHeading.setScale(0.59)):(this._txtHeading=new RSLabelBMFont(c.messageBodyClaimed,this._subtitleFont,2*b.w,kTEXT_ALIGNMENT_CENTER),this._txtHeading.setScale(0.5));this.addChild(this._txtHeading);this._txtHeading.setCenter(b.x,b.y);break;case "AdIcon":this._adIcon=RSUtils.createBasicObject(a,b);this.addChild(this._adIcon); break;case "NoAds":this._noAdIcon=RSUtils.createBasicObject(a,b),this.addChild(this._noAdIcon),this._noAdIcon.setVisible(!1)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":this._closeButton.setTouchEnabled(!1);RSAnalyticsManager.getInstance().trackVideoBonusEvent("lifeStreet","ad","close","Ad_PD");RSAnalyticsManager.getInstance().trackGUIEvent("purchase_disable_popup","close",this._source,"");this.closePopup();break;case "CP_Button_T2":this._playButton.setTouchEnabled(!1); RSAnalyticsManager.getInstance().trackVideoBonusEvent("lifeStreet","ad","close","Ad_PD");RSAnalyticsManager.getInstance().trackGUIEvent("purchase_disable_popup","close",this._source,"");this.closePopup();break;case "CP_Button_T1":this._playButton.setTouchEnabled(!1),this.closePopup(),RSAnalyticsManager.getInstance().trackGUIEvent("purchase_disable_popup","watch_ad",this._source,""),a=(a=(a=RSGame.getInstance().getPlatformEventManager())?a.getUserEventStatus():null)?a.ClickToWatchAd:null,GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&& a?a.PurchaseDisabled&&JSON.parse(a.PurchaseDisabled)?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.EARN_COINS_AD,parameter:RSPlatformPopupNameKeys.PURCHASE_DISABLED}):"Ad_PD_E"==this._placement&&a.PurchaseDisabled_energy&&JSON.parse(a.PurchaseDisabled_energy)?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.EARN_COINS_AD,parameter:RSPlatformPopupNameKeys.PURCHASE_DISABLED_ENERGY}): "Ad_PD"==this._placement&&a.PurchaseDisabled_coin&&JSON.parse(a.PurchaseDisabled_coin)?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.EARN_COINS_AD,parameter:RSPlatformPopupNameKeys.PURCHASE_DISABLED_COIN}):"Ad_PD_P"==this._placement&&a.PurchaseDisabled_powerup&&JSON.parse(a.PurchaseDisabled_powerup)&&RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.EARN_COINS_AD,parameter:RSPlatformPopupNameKeys.PURCHASE_DISABLED_POWERUP}): VideoManager.getInstance().showAd()}},_onVideoNotAvailable:function(){this._closeButton.setTouchEnabled(!1);RSAnalyticsManager.getInstance().trackVideoBonusEvent("lifeStreet","ad","close","Ad_PD");RSAnalyticsManager.getInstance().trackGUIEvent("purchase_disable_popup","close",this._source,"");this.closePopup()},_onVideoAvailable:function(){this.closePopup()},closePopup:function(){RSEventManager.getInstance().removeListenersForEvent(videoNotAvailable);RSEventManager.getInstance().removeListenersForEvent(videoAvailable); this._super.closePopup.call(this)}});var RSWidgetView=RSBasicObject.extend({_model:null,init:function(){this._currentLayoutIndex=0;this._layoutList=[];this._super.init.call(this)},initWithModel:function(a){this._model=a},getModel:function(){return this._model},loadLayoutsInModel:function(){this._model._layouts&&this.layoutScreen(this._model._layouts)},layoutScreen:function(a){if(a instanceof Array){var b=a[this._currentLayoutIndex].count;this._layoutList=a;for(var c=0;c<a.length;c++)this.loadLayout(a[c].name+"_layout_"+RSEngine.layout+ ".json",b);this.setName(this._layoutList[0].name)}},loadLayout:function(a,b){var c=this,d=a.substr(0,a.lastIndexOf("/")+1);RSUtils.loadJsonAsyc(a,null,function(e){if(null!=e.error)c.onLoadLayoutFail(e.error,a,b);else{c._currentLayoutIndex++;for(var f=0;f<b;f++)cc.spriteFrameCache.addSpriteFrames(d+e.screenName+"_0"+f+"-hd.plist");if(c.getDisplayObject())c.onAssetLoaded(e)}})}});var IWidgetControllers=new Interface("IWidgetControllers",["onControllerAdded","onControllerRemoved"]),RSWidgetController=RSClass.extend({init:function(a,b,c){this._controllerName=c;this._model=a;this._view=b;this._view.initWithModel(a);this.implements(IWidgetControllers)},getView:function(){return this._view},getModel:function(){return this._model},getControllerName:function(){return this._controllerName}});var RSWidgetModel=RSClass.extend({_sheetData:null,init:function(a){this._layouts=a;this._super.init.call(this)},unload:function(){}});var RSWidgetsManager=function(){var a,b=RSClass.extend({_controllers:null,getController:function(a){if(this._controllers)return this._controllers[a]},addController:function(a,b){this._controllers||(this._controllers={});this._controllers[b]=a;a.onControllerAdded()},removeController:function(a){a.onControllerRemoved();delete this._controllers[a.getControllerName()]}});return{getInstance:function(){a||(a=new b);return a}}}();var IBuyAction=new Interface("IBuyAction",["onBuyClicked","onBuySuccess","onBuyFailed","onBuyCancelled"]),PurchaseCartWidgetController=RSWidgetController.extend({_delegate:null,_previewTimer:null,_resultObject:null,onControllerAdded:function(){this.loadModelData();this.getView().loadLayoutsInModel(this.getModel())},initialize:function(){},update:function(a){this.getView().update(a)},callSaleDetails:function(a,b){RSSaleManager.getInstance().callSaleDetails(a,b)},showFBPurchaseUI:function(a,b,c,d){this._showOverlayLayer(); this._purchasePackData=this.getModel().getPurchaseCartVO().packs[b][a];this.onBuyClicked();this._productPurchased=b;this._onPurchaseSuccessCallBack=c;this._onPurchaseFailCallBack=d;this._purchasePackData.salePushed?(a={analyticsName:this.getModel().getPurchaseCartVO().analyticsName,monetizationCategory:this.getModel().getPurchaseCartVO().monetizationCategory,eventId:this.getModel().getPurchaseCartVO().eventId,saleId:this.getModel().getPurchaseCartVO().saleId},RSSaleManager.getInstance().showFBPurchaseUI(this._purchasePackData, a,this.onPushToCartPurchaseSuccess.bind(this),this.onPushToCartPurchaseFailed.bind(this))):(RSSaleManager.getInstance().trackClick(this._purchasePackData.price,this._purchasePackData.offerId,this.getModel().getPurchaseCartVO().analyticsName,this.getModel().getPurchaseCartVO().monetizationCategory,this.getModel().getPurchaseCartVO().saleId,this.getModel().getPurchaseCartVO().eventId),a={},a.pack=this.setPackValuesForPurchase(),a.itemType="sale",a.exitCartStatus=!1,a.onSuccessCallback=this._onPurchaseSuccess.bind(this), a.onFailedCallback=this._onPurchaseFailure.bind(this),a.onPurchaseCancel=this._onPurchaseCancel.bind(this),a.eventId=this.getModel().getPurchaseCartVO().eventId,a.sessionID=RSSaleManager.getInstance().getSessionID(),a.tier=this.getModel().getPurchaseCartVO().monetizationCategory,a.sessionCounter=RSSaleManager.getInstance().getSessionCounter(),a.version=GameConfig.VERSION,a.packID=this._purchasePackData.offerId,RSInAppPurchaseManager.getInstance().buySalePack(a))},onPushToCartPurchaseSuccess:function(a){this._purchaseResponseObject= a;this.onRetrieveCoinsPurchase(!0)},onPushToCartPurchaseFailed:function(){this._hideOverlayLayer();this._onPurchaseFailCallBack()},setPackValuesForPurchase:function(){var a={type:"coins",value:this._purchasePackData.value,id:this._purchasePackData.offerId,price:this._purchasePackData.price,analyticsName:this.getModel().getPurchaseCartVO().analyticsName+String(this._purchasePackData.price).replace(".",""),packAnalyticsName:this.getModel().getPurchaseCartVO().analyticsName,packAnalyticsPrice:String(this._purchasePackData.price).replace(".", "")};GameConfig.IS_VIP_ENABLED&&(a.coin=this._purchasePackData.coin);this._purchasePackData.coin?a.type="coins":this._purchasePackData.powerup?a.type="powerups":this._purchasePackData.energy?a.type="energy":this._purchasePackData.daubAlert&&(a.type="daubalert");return a},_onPurchaseSuccess:function(a){this._purchaseResponseObject=a;this.getCurrentCoinBalance()},_onPurchaseCancel:function(a){this._hideOverlayLayer();this._onPurchaseFailCallBack();this._delegate.onBuyCancelled()},_onPurchaseFailure:function(a){this._hideOverlayLayer(); this._onPurchaseFailCallBack();this._delegate.onBuyFailed()},getCurrentCoinBalance:function(){RSEngine.dataManager.getMonetizationBalance(this.onRetrieveCoinsPurchase.bind(this))},getCurrentMachineName:function(){var a="";return a="gameplay_screen"==RSAnalyticsManager.getInstance().getCurrentScreen()?RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName():RSAnalyticsManager.getInstance().getCurrentScreen()},onPopupCloseCallBack:function(){null!=this._onPurchaseFailCallBack&&this._onPurchaseFailCallBack()}, onPurchaseSuccessCallBack:function(){RSCasinoManager.enableInterrupt()},onRetrieveCoinsPurchase:function(a,b){if(a){"function"===typeof RSEngine.dataManager.getMe().setLastPurchasePack?RSEngine.dataManager.getMe().setLastPurchasePack(this._purchasePackData.inAppPack):cc.log("Did not find set last purchase pack on blob function needed for exit cart");var c={value:this._purchasePackData.value,isCredit:!0,id:this._purchasePackData.inAppPack};this._purchasePackData.coin?c.type="coins":this._purchasePackData.powerup? (c.inAppID=this._purchasePackData.inAppPack,c.type="powerup",c.powerupPacks=this._purchasePackData.powerup):this._purchasePackData.energy&&(c.type="energy");for(var d in this._purchasePackData)this._purchasePackData.hasOwnProperty(d)&&(c[d]=this._purchasePackData[d]);c.analyticsName=this.getModel().getPurchaseCartVO().analyticsName+String(this._purchasePackData.price).replace(".","");c.analyticsPrice=this._purchasePackData.price;"LNC"!=GameConfig.GAME_ID&&"BBC"!=GameConfig.GAME_ID&&"MS"!=GameConfig.GAME_ID&& "CS"!=GameConfig.GAME_ID&&"AP"!=GameConfig.GAME_ID&&"FPC"!=GameConfig.GAME_ID&&"UP"!=GameConfig.GAME_ID&&"BBVP"!=GameConfig.GAME_ID&&"RSVP"!=GameConfig.GAME_ID||RSPlatformSDKManager.getInstance().logPurchase(c.analyticsName,c.analyticsPrice,b.monetization_factor);c.category=c.type;d=RSSaleManager.getInstance().getPurchaseCartSaleStatus();if(void 0==d||null==d)d=!1;b&&(this._purchaseResponseObject.clubMPoints=b.clubMPoints?b.clubMPoints:0,this._purchaseResponseObject.LoyaltyPoint=b.LoyaltyPoint?b.LoyaltyPoint: 0,this._purchaseResponseObject.playerConnectPoints=b.playerConnectPoints?b.playerConnectPoints:0,this._purchaseResponseObject.daubAlertTime=b.daubAlertTime?b.daubAlertTime:0);this._resultObject={successCallBack:this.onPurchaseSuccessCallBack.bind(this),packData:c,responseObject:this._purchaseResponseObject,sale:d};this._onPurchaseSuccessCallBack()}},onBuySuccess:function(){this._hideOverlayLayer();this._delegate.onBuySuccess(this._resultObject);var a=this._purchasePackData.inAppPack,b=RSEngine.gameData.getPackById(this._purchasePackData.inAppPack); b&&(a=b.analyticsName);RSSaleManager.getInstance().trackAppsFlyerEventsAfterPurchase(a);this._resultObject=null},_showOverlayLayer:function(){RSEngine.screenManager.addOverlay()},_hideOverlayLayer:function(){RSEngine.screenManager.removeOverlay()},setUserDataOnPurchaseComplete:function(){var a=RSEngine.dataManager.getMe().getSalePurchaseData(),b=this.getModel().getPurchaseCartVO().saleId,c=this.getModel().getPurchaseCartVO().eventId,d=this._purchasePackData.offerId;null!=a[b+"_"+c]?(a[b+"_"+c].count= null!=a[b+"_"+c].count?0<a[b+"_"+c].count?a[b+"_"+c].count+1:1:1,a[b+"_"+c][d]=null!=a[b+"_"+c][d]?0<a[b+"_"+c][d]?a[b+"_"+c][d]+1:1:1):(a={},a[b+"_"+c]={},a[b+"_"+c].count=1,a[b+"_"+c][d]=1);RSEngine.dataManager.getMe().setSalePurchaseData(a)},loadModelData:function(){},setDelegate:function(a){this._delegate=a;a.implements(IBuyAction)},setButtonTouchStatus:function(a){this._view.setButtonTouchStatus(a)},onControllerRemoved:function(){this._view.unload();this._model.unload()},onBuyClicked:function(a){this._delegate.onBuyClicked(a)}});var PurchaseCartWidgetModel=RSWidgetModel.extend({init:function(a,b){this._saleType=b;this._super.init.call(this,a);this._salePreLoader=this._preloadRes=this._onPurchaseFailCallBack=this._onPurchaseSuccessCallBack=this._purchasePackData=this._purchaseCartVO=null;this._saleEndTime=this._timeRemaining=0;this._bonusTimer=null;this._saleStatus=0;this._resourcesToBeFetched=[];this._saleAnalytics=this._callSaleDetailsTimer=this._assetsLoaded=this._purchaseCartResourceName=this._saleResourceName=null;this._uniqueSaleRequest= [];this._uniqueSaleImpression=[];this._sessionID="";this._purchaseResponseObject=null;this._saleAnalyticsInitialized=!1;this._purchaseCartItemFont=RSGame.getInstance().getAssetPath("purchaseCartItemFont");this._purchaseCartPriceFont=RSGame.getInstance().getAssetPath("purchaseCartPriceFont");this._purchaseCartStatusPointsFont=RSGame.getInstance().getAssetPath("purchaseCartStatusPointsFont");this._purchaseCartRewardPointsFont=RSGame.getInstance().getAssetPath("purchaseCartRewardPointsFont");this._purchaseCartSaleExtraFont= RSGame.getInstance().getAssetPath("purchaseCartSaleExtraFont");this._purchaseCartVipExtraFont=RSGame.getInstance().getAssetPath("purchaseCartVipExtraFont");this._vipStatus=!0},getSaleActiveStatus:function(){return 0!=this._saleStatus?(TimeManager.getInstance().getCurrentServerTime(),!1):!0},getPurchaseCartVO:function(){this._purchaseCartVO=RSSaleManager.getInstance().getPurchaseCartVO(this._saleType);this._purchaseCartVO.packs=this.sortArray(this._purchaseCartVO.packs);return this._purchaseCartVO}, getPurchaseCartResourcesName:function(){return this._purchaseCartResourceName},getVIPStatus:function(){return this._vipStatus},setVIPStatus:function(a){this._vipStatus=a},setPurchaseCartItemFont:function(a){this._purchaseCartItemFont=a},getPurchaseCartItemFont:function(){return this._purchaseCartItemFont},setPurchaseCartPriceFont:function(a){this._purchaseCartPriceFont=a},getPurchaseCartPriceFont:function(){return this._purchaseCartPriceFont},setPurchaseCartStatusPointsFont:function(a){this._purchaseCartStatusPointsFont= a},getPurchaseCartStatusPointsFont:function(){return this._purchaseCartStatusPointsFont},setPurchaseCartRewardPointsFont:function(a){this._purchaseCartRewardPointsFont=a},getPurchaseCartRewardPointsFont:function(){return this._purchaseCartRewardPointsFont},setPurchaseCartVipExtraFont:function(a){this._purchaseCartVipExtraFont=a},getPurchaseCartVipExtraFont:function(){return this._purchaseCartVipExtraFont},setPurchaseCartSaleExtraFont:function(a){this._purchaseCartSaleExtraFont=a},getPurchaseCartSaleExtraFont:function(){return this._purchaseCartSaleExtraFont}, sortArray:function(a){for(var b=a.length,c=0,d=0;d<b;d++)for(var e=1;e<b-d;e++)Number(a[e-1].all.price)<Number(a[e].all.price)&&(c=a[e-1],a[e-1]=a[e],a[e]=c);return a}});var PurchaseCartWidgetView=RSWidgetView.extend({init:function(){this._usBannerBar=this._bannerBar=this._selectedType=this._currentPowerPackData=this._saleDetails=this._assetList=this._callBack=null;this._purchasedTag=[];this._purchaseReward=[];this._purchasePrice=[];this._purchaseRewardData=[];this._purchasePriceData=[];this._popupTimerText=null;this._timeRemaining=0;this._onSaleTriggered=!1;this._buttonList=[];this._pricePosition={};this._amountTxts=[];this._priceAnimation=[];this._coinAnimation= [];this._vipTier=null;this._priceAnimTimer=[];this._coinAnimTimer=[];this._priceAnimations=[];this._coinAnimations=[];this._priceTextAnimations=[];this._coinTextAnimations=[];this._currentPriceAnimation=this._currentCoinAnimation=0;this._itemLabel=[];this._statusPointsLabel=[];this._rewardPointsLabel=[];this._priceLabel=[];this._priceLocalizedLabel=[];this._priceSuperLabel=[];this._frameCount=0;this._incrementCoinValue=[];this._incrementPriceValue=[];this._showSuperScript=!1;this._animationCompleteCoin= [];this._animationCompletePrice=[];this.coinTimerId=this.priceTimerId=null;this.priceLabelPosition=[];this._selectedType="";this._onSaleTriggered=!1;this._super.init.call(this)},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._saleDetails=this._model.getPurchaseCartVO();this._saleDetails.packs=this.sortArray(this._saleDetails.packs);this._super.onLayoutCompleted.call(this);this.initializeSale(!1)},sortArray:function(a){for(var b= a.length,c=0,d=0;d<b;d++)for(var e=1;e<b-d;e++)Number(a[e-1].all.price)<Number(a[e].all.price)&&(c=a[e-1],a[e-1]=a[e],a[e]=c);return a},initializeSale:function(a){var b=RSWidgetsManager.getInstance().getController("purchaseCart");if(!0==a)b.onBuySuccess();("USD"==RSSocialManager.getInstance().currency.user_currency||RSEngine.loginMode!=LOGIN_MODE.FACEBOOK)&&null!=this._priceSuperLabel&&0<this._priceSuperLabel.length&&(this._showSuperScript=!0);this._onSaleTriggered=!1;this._saleDetails=this._model.getPurchaseCartVO(); this._saleDetails.packs=this.sortArray(this._saleDetails.packs);this.handleCartInfoPriceVisibility();this.initializeCommonSaleAndVipValues()},initializeCommonSaleAndVipValues:function(){for(var a="",b=0;b<this._saleDetails.packs.length;b++)if(a=null!=this._saleDetails.packs[b][this._saleDetails.monetizationCategory]?this._saleDetails.packs[b][this._saleDetails.monetizationCategory]:this._saleDetails.packs[b].all,this._model.getVIPStatus()){var c=RSEngine.gameData.getStatusPointsByCoinPack(a.inAppPack), a=RSEngine.gameData.getRewardPointsByCoinPack(a.inAppPack);void 0!=c&&null!=c&&this._statusPointsLabel[b]&&this._statusPointsLabel[b].setString(c);void 0!=a&&null!=a&&0!=a&&this._rewardPointsLabel[b]&&this._rewardPointsLabel[b].setString(a)}},createCustomObject:function(a,b){switch(b.type){case "RSLabel":if(0<=b.name.indexOf("itemLabel_")){var c=this._model.getPurchaseCartItemFont(),c=new RSScaledLabel("",c,b,kTEXT_ALIGNMENT_CENTER);c.setCenter(b.x,b.y);this.addChild(c);var d=b.name.match(/\d+/); this._itemLabel[d[d.length-1]-1]=c}else 0<=b.name.indexOf("statusPoints_")?(c=this._model.getPurchaseCartStatusPointsFont(),c=new RSScaledLabel("",c,b,kTEXT_ALIGNMENT_CENTER),c.setCenter(b.x,b.y),this.addChild(c),d=b.name.match(/\d+/),this._statusPointsLabel[d[d.length-1]-1]=c):0<=b.name.indexOf("priceLabel_")?(c=this._model.getPurchaseCartPriceFont(),c=new RSScaledLabel("",c,b,kTEXT_ALIGNMENT_RIGHT),c.setCenter(b.x,b.y),this.addChild(c),d=b.name.match(/\d+/),this._priceLabel[d[d.length-1]-1]=c,this.priceLabelPosition[d[d.length- 1]-1]={x:b.x,y:b.y,w:b.w,h:b.h}):0<=b.name.indexOf("priceLocalizedLabel_")?(c=this._model.getPurchaseCartPriceFont(),c="daubAlert"==this._model._saleType||"powerup"==this._model._saleType?new RSScaledLabel("",c,b,kTEXT_ALIGNMENT_CENTER):new RSScaledLabel("",c,b,kTEXT_ALIGNMENT_RIGHT),c.setCenter(b.x,b.y),this.addChild(c),d=b.name.match(/\d+/),this._priceLocalizedLabel[d[d.length-1]-1]=c):0<=b.name.indexOf("priceSuperLabel_")?(c=this._model.getPurchaseCartPriceFont(),c=new RSScaledLabel("",c,b,kTEXT_ALIGNMENT_LEFT), c.setCenter(b.x,b.y),this.addChild(c),d=b.name.match(/\d+/),this._priceSuperLabel[d[d.length-1]-1]=c):0<=b.name.indexOf("rewardPoints_")&&(c=this._model.getPurchaseCartRewardPointsFont(),c=new RSScaledLabel("",c,b,kTEXT_ALIGNMENT_CENTER),c.setCenter(b.x,b.y),this.addChild(c),d=b.name.match(/\d+/),this._rewardPointsLabel[d[d.length-1]-1]=c);break;case "Rect":GameConfig.IS_PLAYER_CONNECT_AVAILABLE&&"RewardBanner"==b.name&&(this._imageHolder=new RSImageObject,this._imageHolder.setImageFromUrl(RSGame.getInstance().getAssetFolder("RewardBanner")+ "RewardBanner.png",b.x,b.y,b.w,b.h),this.addChild(this._imageHolder))}this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){var b=RSWidgetsManager.getInstance().getController("purchaseCart");if(0<=a.indexOf("Buy_")&&!1==this._onSaleTriggered){var c=a.match(/\d+/)[0]-1,d="";null!=this._saleDetails.packs[c][this._saleDetails.monetizationCategory]?(String(this._saleDetails.packs[c][this._saleDetails.monetizationCategory].price).replace(".",""),d=this._saleDetails.monetizationCategory): (String(this._saleDetails.packs[c].all.price).replace(".",""),d="all");this._onSaleTriggered=!0;this._packSelected=a.match(/\d+/)[0];b.showFBPurchaseUI(d,c,this.onPurchaseSuccess.bind(this),this.onPurchaseFail.bind(this))}},onPurchaseSuccess:function(){var a=RSWidgetsManager.getInstance().getController("purchaseCart");this._onSaleTriggered=!1;a.callSaleDetails(this.initializeSale.bind(this,!0),null)},onPurchaseFail:function(){this._onSaleTriggered=!1},onObjectCreated:function(a,b,c){switch(c.type){case "Animation":"vipTier"== c.name?(this._vipTier=a,a.stopAnimation()):0<=c.name.indexOf("PriceAnim")?(b=c.name.slice(c.name.indexOf("_")+1),this._priceAnimation[b-1]=a,a.stopAnimation()):0<=c.name.indexOf("CoinAnim")?(b=c.name.slice(c.name.indexOf("_")+1),this._coinAnimation[b-1]=a,a.stopAnimation()):(a.stopAnimation(),a.playAnimation(-1,0.5));break;case "Button":this._buttonArray.push(a)}switch(c.name){case "VIPframe":RSEngine.loginMode==LOGIN_MODE.FACEBOOK&&a.setVisible(!1);break;case "VipInfoBanner":RSEngine.loginMode!= LOGIN_MODE.FACEBOOK&&a.setVisible(!1)}0<=c.name.indexOf("SweepstakeInfo")&&(this._usBannerBar=a,this._usBannerBar.setVisible(!1))},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){},handleCartInfoPriceVisibility:function(){this.setInfoPriceTextVisibility();for(var a=0;a<this._priceAnimation.length;a++){var b=this._saleDetails.packs[a][this._saleDetails.monetizationCategory],c=this._saleDetails.packs[a].all;null!=b&&b.price!=c.price&& (this._priceAnimations.push(a),this._priceTextAnimations.push(this.getTextAnimationDetailsPrice(c.price,b.price,3)),this._incrementPriceValue.push(this._priceTextAnimations[this._priceTextAnimations.length-1].startValue),this.priceTimerId=setTimeout(this.playPriceAnimation.bind(this),500*this._priceAnimations.length),this._priceAnimTimer.push(this.priceTimerId))}for(a=0;a<this._itemLabel.length;a++)b=this._saleDetails.packs[a][this._saleDetails.monetizationCategory],c=this._saleDetails.packs[a].all, null!=b&&b.value!=c.value&&(this._coinAnimations.push(a),this._coinTextAnimations.push(this.getTextAnimationDetails(c.value,b.value,3)),this._incrementCoinValue.push(Number(c.value)),this.coinTimerId=setTimeout(this.playCoinAnimation.bind(this),500*this._coinAnimations.length),this._coinAnimTimer.push(this.coinTimerId))},setInfoPriceTextVisibility:function(){for(var a=0,b=0;b<this._saleDetails.packs.length;b++){var c=RSInAppPurchaseManager.getInstance().getLocalCurrency(this._saleDetails.packs[b].all.price).length; c>a&&(a=c)}for(b=0;b<this._saleDetails.packs.length;b++){a=this._saleDetails.packs[b].all;c=RSInAppPurchaseManager.getInstance().getLocalCurrency(a.price);if(this._showSuperScript){var d=c.split(".");this._priceLabel[b].setString(d[0]);void 0!=d[1]&&(1>=d[1].length&&(d[1]+="0"),this._priceSuperLabel[b].setString(d[1]))}else d=c.split("."),void 0==d[1]?c+=".00":1==d[1].length&&(c+="0"),null!=this._priceLocalizedLabel[b]?this._priceLocalizedLabel[b].setString(c):this._priceLabel[b].setString(c);a.daubAlert? 1<a.daubAlert/24?this._itemLabel[b].setString(RSUtils.formatNumberWithComma(a.value/24)+" DAYS"):this._itemLabel[b].setString(RSUtils.formatNumberWithComma(a.value)+" HOURS"):this._itemLabel[b].setString(RSUtils.formatNumberWithComma(a.value))}},alignPriceFonts:function(){for(var a=0;a<this._priceLabel.length;a++){var b=this._priceLabel[a].getSize(),c=this._priceSuperLabel[a].getSize();this._priceSuperLabel[a].setCenter(this.priceLabelPosition[a].x+this.priceLabelPosition[a].w/2+b._width/2-c._width/ 4,this.priceLabelPosition[a].y+(this.priceLabelPosition[a].h+b._height)/6)}},getTextAnimationDetails:function(a,b,c){for(var d=b-a,e=0,f=d.toString(),g=0,h={},k="",m=0;m<f.length;m++)"-"!=f[m]&&"."!=f[m]&&(0==f[m]?g++:k+=f[m],e+=Number(f[m]));h.startValue=a;h.endValue=b;h.sumOfDigits=e;h.incrementFactor=Math.pow(10,g);h.intervalTime=Math.ceil(1E3*c/e/60);h.incrementCount=Number(k);0>d&&(h.incrementFactor*=-1);return h},getTextAnimationDetailsPrice:function(a,b,c){for(var d="",e=[],f="",g="",f=RSInAppPurchaseManager.getInstance().getLocalCurrency(a), g=RSInAppPurchaseManager.getInstance().getLocalCurrency(b),e=f.match(/\D/g),h=0;h<e.length;h++)"."!=e[h]&&(d+=e[h]);a=null!=f.match(/\d+.\d*/g)?f.match(/\d+.\d*/g)[0]:f.match(/\d+/)[0];b=null!=g.match(/\d+.\d*/g)?g.match(/\d+.\d*/g)[0]:g.match(/\d+/)[0];a=parseFloat(a);b=parseFloat(b);for(var e=parseFloat(a-b).toPrecision(5),e=Number(e),f=0,g=e.toString(),k=0,m={},n="",h=0;h<g.length;h++)"-"!=g[h]&&"."!=g[h]&&(0==g[h]?k++:n+=g[h],f+=Number(g[h]));m.startValue=a;m.endValue=b;m.sumOfDigits=f;m.incrementFactor= Math.pow(10,k);m.intervalTime=Math.ceil(1E3*c/f/60);m.incrementCount=Number(n);m.currencySymbol=d;0>e&&(m.incrementFactor*=-1);return m},update:function(a){this._frameCount++;60<=this._frameCount&&(this._frameCount=1);if(0<this._currentCoinAnimation)for(a=0;a<this._coinTextAnimations.length&&a<this._currentCoinAnimation;a++)if(!(0<=this._animationCompleteCoin.indexOf(a))&&0==this._frameCount%this._coinTextAnimations[a].intervalTime){var b=this._coinTextAnimations[a].incrementCount%10;0<b?this._coinTextAnimations[a].incrementCount--: (this._coinTextAnimations[a].incrementFactor*=10,this._coinTextAnimations[a].incrementCount=Math.floor(this._coinTextAnimations[a].incrementCount/10));this._incrementCoinValue[a]+=this._coinTextAnimations[a].incrementFactor;this._incrementCoinValue[a]>=this._coinTextAnimations[a].endValue&&0<this._coinTextAnimations[a].incrementFactor?(this._animationCompleteCoin.push(a),this._incrementCoinValue[a]=this._coinTextAnimations[a].endValue):this._incrementCoinValue[a]<this._coinTextAnimations[a].endValue&& 0>this._coinTextAnimations[a].incrementFactor&&(this._animationCompleteCoin.push(a),this._incrementCoinValue[a]=this._coinTextAnimations[a].endValue);this.playCoinTweenAnimation(this._incrementCoinValue[a],this._coinAnimations[a])}if(0<this._currentPriceAnimation)for(a=0;a<this._priceTextAnimations.length&&a<this._currentPriceAnimation;a++)0<=this._animationCompletePrice.indexOf(a)||0!=this._frameCount%this._priceTextAnimations[a].intervalTime||(b=this._priceTextAnimations[a].incrementCount%10,0< b?this._priceTextAnimations[a].incrementCount--:(this._priceTextAnimations[a].incrementFactor*=10,this._priceTextAnimations[a].incrementCount=Math.floor(this._priceTextAnimations[a].incrementCount/10)),this._incrementPriceValue[a]=parseFloat(this._incrementPriceValue[a]-this._priceTextAnimations[a].incrementFactor).toPrecision(5),this._incrementPriceValue[a]=Number(this._incrementPriceValue[a]),this._incrementPriceValue[a]<=this._priceTextAnimations[a].endValue&&0<this._priceTextAnimations[a].incrementFactor? (this._animationCompletePrice.push(a),this._incrementPriceValue[a]=this._priceTextAnimations[a].endValue):this._incrementPriceValue[a]>this._priceTextAnimations[a].endValue&&0>this._priceTextAnimations[a].incrementFactor&&(this._animationCompletePrice.push(a),this._incrementPriceValue[a]=this._priceTextAnimations[a].endValue),this.playPriceTweenAnimation(this._incrementPriceValue[a],this._priceAnimations[a],this._priceTextAnimations[a].currencySymbol))},playPriceAnimation:function(){this._priceAnimations.length<= this._currentPriceAnimation||(null!=this._priceAnimTimer[this._currentPriceAnimation]&&clearTimeout(this._priceAnimTimer[this._currentPriceAnimation]),this._priceAnimation[this._priceAnimations[this._currentPriceAnimation]].stopAnimation(),this._priceAnimation[this._priceAnimations[this._currentPriceAnimation]].playAnimation(1,0.5),this._currentPriceAnimation++)},playCoinAnimation:function(){this._coinAnimations.length<=this._currentCoinAnimation||(null!=this._coinAnimTimer[this._currentCoinAnimation]&& clearTimeout(this._coinAnimTimer[this._currentCoinAnimation]),this._coinAnimation[this._coinAnimations[this._currentCoinAnimation]].stopAnimation(),this._coinAnimation[this._coinAnimations[this._currentCoinAnimation]].playAnimation(1,0.5),this._currentCoinAnimation++)},playCoinTweenAnimation:function(a,b){this._itemLabel[b].setString(RSUtils.formatNumberWithComma(a))},playPriceTweenAnimation:function(a,b,c){this._showSuperScript?(a=a.toString().split("."),void 0!=a[1]&&(this._priceSuperLabel[b].setString(a[1]), this._priceLabel[b].setString(c+a[0]))):null!=this._priceLocalizedLabel[b]?this._priceLocalizedLabel[b].setString(c+RSUtils.formatNumberWithComma(a)):this._priceLabel[b].setString(c+RSUtils.formatNumberWithComma(a))},setButtonTouchStatus:function(a){for(var b=0;b<this._buttonArray.length;b++)this._buttonArray[b].setTouchEnabled(a)},getCurrentMachineName:function(){var a="";return a="gameplay_screen"==RSAnalyticsManager.getInstance().getCurrentScreen()?RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName(): RSAnalyticsManager.getInstance().getCurrentScreen()},unload:function(){this._usBannerBar=this._bannerBar=this._selectedType=this._currentPowerPackData=this._saleDetails=this._assetList=this._callBack=null;this._purchasedTag=[];this._purchaseReward=[];this._purchasePrice=[];this._purchaseRewardData=[];this._purchasePriceData=[];this._popupTimerText=null;this._timeRemaining=0;this._onSaleTriggered=!1;this._buttonList=[];this._pricePosition={};this._amountTxts=[];this._priceAnimation=[];this._coinAnimation= [];this._vipTier=null;this._priceAnimTimer=[];this._coinAnimTimer=[];this._priceAnimations=[];this._coinAnimations=[];this._priceTextAnimations=[];this._coinTextAnimations=[];this._currentPriceAnimation=this._currentCoinAnimation=0;this._itemLabel=[];this._statusPointsLabel=[];this._rewardPointsLabel=[];this._priceLabel=[];this._priceSuperLabel=[];this._frameCount=0;this._incrementCoinValue=[];this._incrementPriceValue=[];this._showSuperScript=!0;this._animationCompleteCoin=[];this._animationCompletePrice= [];this.coinTimerId=this.priceTimerId=null;this._selectedType="";this._onSaleTriggered=!1;clearTimeout(this.priceTimerId);clearTimeout(this.coinTimerId);RSEventManager.getInstance().removeListenersForEvent("onTimerTick")}});var RSFeatures={POKER_PREVIEW:"pokerPreview",POKER_FEATURED:"pokerFeatured",MOST_PLAYED:"most_played",MOST_POPULAR:"mostPopularMachine",TOP_ON_LEADERBOARD:"leaderBoardMachine",FEATURED:"featured",PREVIEW:"preview",SLOTS_PREVIEW:"slotsPreview",SLOTS_FEATURED:"slotsFeatured",NEW_MACHINES:"newMachines"},PreviewType={SLOTS:"slots",POKER:"poker"};var IconWidgetController=RSWidgetController.extend({_delegate:null,_machineData:null,onControllerAdded:function(){},onControllerRemoved:function(){this._view.unload();this._model.unload()},onIconClicked:function(){var a=this._model.getMachineData().machine_identifier;this._delegate.onIconClicked(a,this._model.getMachineType(),this._model._previewType)},handler:function(){return this._model.getModelData()},setDelegate:function(a){this._delegate=a}});var IconWidgetView=RSWidgetView.extend({_imageHolder:null,_controllerName:null,init:function(a){this._controllerName=a;this._super.init.call(this)},getControllerName:function(){return this._controllerName},initWithModel:function(a){this._super.initWithModel.call(this,a)},addItemToView:function(a,b,c,d){this.setRect(a.x,a.y,a.w,a.h);this._iconPos=new RSPoint(a.x/2+4.75,a.y/2+3.5);var e=this.convertToNodeSpace(a.x,a.y);this._iconArea=e;this._imageHolder=new RSImageObject;(c=b[c])&&-1==c.indexOf("png")&& (c+=".png");null!=b.iconUrlLarge||void 0!=b.iconUrlLarge?this._imageHolder.setImageFromUrl(this._model._iconPath,e.getX(),e.getY(),a.w,a.h,!0):this._imageHolder.setImageFromUrl(this._model._iconPath+c,e.getX(),e.getY(),a.w,a.h,!0);this.addChild(this._imageHolder);d&&GameConfig.MACHINE_UNDERMAINTENANCE_FEATURE?(d=new RSImageObject,null!=b.iconUrlLarge||void 0!=b.iconUrlLarge?d.setImageFromUrl(this._model._underMaintenancePath+"UnderMaintenance.png",e.getX(),e.getY(),a.w,a.h,!0):d.setImageFromUrl(this._model._iconPath+ "UnderMaintenance.png",e.getX(),e.getY(),a.w,a.h,!0),this.addChild(d)):this._imageHolder.addTouchListenerWithDelegate(this)},addItemsAsList:function(a,b,c){var d=null;return d=new RSCasinoIconHolder("TALL_ICON",a,this._model._iconPath+b.machine_tallIcon,this.onIconClick.bind(this),b,!1,c,!0,null,null,null,1)},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){RSGame.getInstance().getGameManager().setLocationForMachineOpenPopup(b, c);a=this.getControllerName();RSWidgetsManager.getInstance().getController(a).onIconClicked(b,c)},onIconClick:function(a,b){RSGame.getInstance().getGameManager().setLocationForMachineOpenPopup(a,b);var c=this.getControllerName();RSWidgetsManager.getInstance().getController(c).onIconClicked()},getTouchStatus:function(a,b){var c=this.getControllerName();RSWidgetsManager.getInstance().getController(c).getTouchStatus(a,b)}});var IconWidgetModel=RSWidgetModel.extend({_imageHolder:null,_delegate:null,_machineData:null,_machineType:null,_iconArea:null,_iconPos:null,_iconObject:null,_iconPath:null,_underMaintenancePath:null,init:function(a){this._iconPath=a.iconPath;this._underMaintenancePath=a.underMaintenancePath},InitModelData:function(a,b,c){this._iconObject=a;this._machineData=b;this._machineType=c},getModelData:function(){return this._iconObject},getMachineData:function(){return this._machineData},getMachineType:function(){return this._machineType}});var PreviewWidgetManger=function(){var a,b=RSClass.extend({_sheetNames:{},_machines:[],_widgetType:{most_played:"MPL",mostPopularMachine:"MPOP",leaderBoardMachine:"TL"},_defaultMachine:[],_userBlob:{},init:function(){this._super.init.call(this)},getMostPlayedMachine:function(a,b){this._machines=[];this._userBlob={};this._userBlob=b;if(this._sheetNames=a)for(var e in this._sheetNames)switch(e){case "slots":this.getMostPlayedMachineInSlots();break;case "bingo":this.getBingoFavoriteRoom();break;case "poker":this.getPokerFavouriteRoom(); break;case "keno":this.getKenoFavouriteRoom();break;case "blackJack":this.getBlackJackFavouriteRoom();break;case "roulette":this.getRouletteFavouriteRoom();break;case "scratcher":this.getMostPlayedMachineInScratcher()}for(var f,g=e=0;g<this._machines.length;g++){var h=this._machines[g].count;h>e&&(e=h,f=this._machines[g])}return 0==e&&(f=this.getDefaultMachine(this._widgetType[RSFeatures.MOST_PLAYED]),1==f.length)?f[0]:f},getNewMachines:function(a){var b=[];if(a)for(var e in a)b.push(this.getNewMachinesList(e, a));return b},getNewMachinesList:function(a,b){for(var e=[],f=RSEngine.gameData.getSheetData(b[a]),g=0;g<f.length;g++)"1"==f[g].isNew&&e.push(f[g]);null==e[0]&&e.push(f[0]);return{machine_type:a,machineDetails:e}},getMostPlayedMachineInSlots:function(){if(this._sheetNames.slots){var a=RSEngine.gameData.getSheetData(this._sheetNames.slots);if(a){for(var b=RSGame.getInstance().getLevelManager().getCurrentLevel(),e=parseInt(RSVIPManager.getInstance().getVIPUserTier()),f=0,g="",h=0;h<a.length;h++){var k= this._getMachineUseCount(a[h].machine_identifier,"slots");k>f&&(b>=a[h].levelRequired||parseInt(a[h].VIPTier)<=e&&0<parseInt(a[h].VIPTier))&&(f=k,g=a[h].machine_identifier)}if(""!=g)return this._machines.push({machine_identifier:g,machine_type:"slots",count:f}),this._machines}}},getMostPlayedMachineInScratcher:function(){if(this._sheetNames.scratcher){var a=RSEngine.gameData.getSheetData(this._sheetNames.scratcher);if(a){for(var b=0,e="",f=0;f<a.length;f++){var g=this._getMachineUseCount(a[f].machine_identifier, "scratcher");g>b&&(b=g,e=a[f].machine_identifier)}if(""!=e)return this._machines.push({machine_identifier:e,machine_type:"scratcher",count:b}),this._machines}}},getBingoFavoriteRoom:function(){if(this._sheetNames.bingo){var a=RSEngine.gameData.getSheetData(this._sheetNames.bingo);if(a){var b=this._userBlob.Bingo,e,f=0,g="";if(null!=b){for(var h in b)b[h]>f&&(f=b[h],e=h);null!=e?this._machines.push({machine_identifier:e,machine_type:"bingo",count:f}):(g=a[0].machine_identifier,this._machines.push({machine_identifier:g, machine_type:"bingo",count:f}))}else g=a[0].machine_identifier,this._machines.push({machine_identifier:g,machine_type:"bingo",count:f});return this._machines}}},getPokerFavouriteRoom:function(){if(this._sheetNames.poker){var a=RSEngine.gameData.getSheetData(this._sheetNames.poker);if(a){for(var b=0,e="",f=0;f<a.length;f++){var g=this._getMachineUseCount(a[f].machine_identifier,"poker");g>b&&(b=g,e=a[f].machine_identifier)}""!=e?this._machines.push({machine_identifier:e,machine_type:"poker",count:b}): this._machines.push({machine_identifier:a[0].machine_identifier,machine_type:"poker",count:b});return this._machines}}},getKenoFavouriteRoom:function(){if(this._sheetNames.keno){var a=RSEngine.gameData.getSheetData(this._sheetNames.keno);if(a){for(var b=0,e="",f=0;f<a.length;f++){var g=this._getMachineUseCount(a[f].machine_identifier,"keno");g>b&&(b=g,e=a[f].machine_identifier)}""!=e?this._machines.push({machine_identifier:e,machine_type:"keno",count:b}):this._machines.push({machine_identifier:a[0].machine_identifier, machine_type:"keno",count:b});return this._machines}}},getRouletteFavouriteRoom:function(){if(this._sheetNames.roulette){var a=RSEngine.gameData.getSheetData(this._sheetNames.roulette);if(a){for(var b=0,e="",f=0;f<a.length;f++){var g=this._getMachineUseCount(a[f].machine_identifier,"roulette");g>b&&(b=g,e=a[f].machine_identifier)}""!=e?this._machines.push({machine_identifier:e,machine_type:"roulette",count:b}):this._machines.push({machine_identifier:a[0].machine_identifier,machine_type:"roulette", count:b});return this._machines}}},getBlackJackFavouriteRoom:function(){if(this._sheetNames.blackJack){var a=RSEngine.gameData.getSheetData(this._sheetNames.blackJack);if(a){for(var b=0,e="",f=0;f<a.length;f++){var g=this._getMachineUseCount(a[f].machine_identifier,"blackJack");g>b&&(b=g,e=a[f].machine_identifier)}""!=e?this._machines.push({machine_identifier:e,machine_type:"blackJack",count:b}):this._machines.push({machine_identifier:a[0].machine_identifier,machine_type:"blackJack",count:b});return this._machines}}}, getDefaultMachine:function(a,b){b&&(this._sheetNames=b,a=this._widgetType[a]);var e=RSEngine.gameData.getSheetData(this._sheetNames.default);this._defaultMachine=[];for(var f=[],g=0;g<e.length;g++)e[g].widgetType==a&&f.push({machine_identifier:e[g].machine_identifier,machine_type:e[g].gameType});for(g=0;g<f.length;g++)if(RSAnalyticsManager.getInstance().getCurrentScreen()==RSGameScreens.PokerLobby)f[g].machine_type==RSGameTypes.Poker&&this._defaultMachine.push({machine_identifier:f[g].machine_identifier, machine_type:f[g].machine_type});else{this._defaultMachine.push({machine_identifier:f[g].machine_identifier,machine_type:f[g].machine_type});break}return this._defaultMachine},_getMachineUseCount:function(a,b){return null!=this._userBlob[b][a]?this._userBlob[b][a]:0}});return{getInstance:function(){a||(a=new b);return a}}}();var PreviewWidgetView=RSWidgetView.extend({_previewIconHolder:null,_previewIconObject:null,_widgetAddOnAnim:null,_iconSwitchTimer:2E3,_previewHeading:null,_featuredHeading:null,_topFeaturedBase:null,_sneakPreviewBase:null,_mostPlayedBase:null,_previewTimer:0,_timerText:null,_clippingRect:null,_animationSpeed:0.3,_indexForAddingIconHolder:-1,_zOrderForObjects:-1,_newlyAddedBase:null,_newlyAddedHeading:null,createCustomObject:function(a,b){this._zOrderForObjects+=1;switch(b.name){case "ScrollerClipRect":this._clippingRect= b;break;case "WidgetIconHolder":this._previewIconObject=b;this._indexForAddingIconHolder=this._ccObject.getChildrenCount();this._previewIconHolder=new RSPanel(b.x,b.y,b.w,b.h);this._previewIconHolder.setBackgroundColor(0,255,0,100);break;case "TimerText":this._timerText=new RSScaledLabel(" ",this._model._font,b,kTEXT_ALIGNMENT_CENTER),this._timerText.setPosition(b.x,b.y),this.addChild(this._timerText),this._timerText.setZOrder(this._zOrderForObjects)}},onObjectCreated:function(a,b,c){this._zOrderForObjects+= 1;switch(c.name){case "FeaturedHeading":this._featuredHeading=a;this._featuredHeading.stopAnimation();this._featuredHeading.setFrame(0);break;case "PreviewHeading":this._previewHeading=a;this._previewHeading.stopAnimation();this._previewHeading.setFrame(0);break;case "WidgetAddOnAnim":this._widgetAddOnAnim=a;this._widgetAddOnAnim.stopAnimation();this._widgetAddOnAnim.setFrame(0);break;case "MostPlayedHeading":this._mostPlayedHeading=a;this._mostPlayedHeading.stopAnimation();this._mostPlayedHeading.setFrame(0); break;case "Fire":this._fireAnimation=a;this._fireAnimation.setVisible(!1);break;case "LeaderboardHeading":this._leaderboardHeading=a;this._leaderboardHeading.stopAnimation();this._leaderboardHeading.setFrame(0);break;case "MostPopularHeading":this._mostPopularHeading=a;this._mostPopularHeading.stopAnimation();this._mostPopularHeading.setFrame(0);break;case "TopFeaturedWidgetBase":this._topFeaturedBase=a;this._topFeaturedBase.setVisible(!1);break;case "SneakPreviewWidgetBase":this._sneakPreviewBase= a;this._sneakPreviewBase.setVisible(!1);break;case "MostPlayedWidgetBase":this._mostPlayedBase=a;this._mostPlayedBase.setVisible(!1);break;case "NewlyAddedWidgetBase":this._newlyAddedBase=a;this._newlyAddedBase.setVisible(!1);break;case "NewlyAddedHeading":this._newlyAddedHeading=a,this._newlyAddedHeading.stopAnimation(),this._newlyAddedHeading.playAnimation(-1,this._animationSpeed)}a.setZOrder(this._zOrderForObjects)},createPreviewIcons:function(){var a=[],b=[],c=null,d=null;0<this._model.getTimeLeft()&& this._model._sneakPreview&&null!=this._model._previewMachineList?(this._previewHeading&&this._previewHeading.playAnimation(-1,this._animationSpeed),this._setPreviewHeading(!0),a=this._model._previewMachineList,b=this._model._previewMachineType,c=this._model._previewIconPath,d=this._model._previewIconFieldName):(this._featuredHeading&&this._featuredHeading.playAnimation(-1,this._animationSpeed),this._setPreviewHeading(!1),a=this._model._featureMachineList,b=this._model._machineType,c=this._model._iconPath, d=this._model._iconFieldName);this._mostPlayedHeading&&this._mostPlayedHeading.playAnimation(-1,this._animationSpeed);var e=!1,f;for(f in a){var e=a[f],g=new IconWidgetModel({iconPath:c[f],underMaintenancePath:this._model._underMaintenancePath});g.InitModelData(this._previewIconObject,e,b[f]);var h="IconWidget"+this._model._previewType+e.machine_identifier,g=new IconWidgetController(g,new IconWidgetView(h),h);g.setDelegate(this);RSWidgetsManager.getInstance().addController(g,g.getControllerName()); e=parseInt(e.isEnabled)?!1:!0;"machine_tallIcon"==d[f]?(e=null,e=this._model.getIconFonts(),e=g.getView().addItemsAsList(g.getModel().getModelData(),g.getModel().getMachineData(),e),this._scroller.addItemsToScroller(e,!0,this.onMachineIConClicked.bind(this))):(g.getView().addItemToView(g.getModel().getModelData(),g.getModel().getMachineData(),d[f],e),this._scroller.addItemsToScroller(g.getView()))}this.addChild(this._scroller);this._scroller.setZOrder(this._indexForAddingIconHolder);a&&1<a.length&& (this._iconSwitchTimer=setInterval(this.changeIcon.bind(this),4E3));0<this._model.getTimeLeft()&&this._timerText&&this.startPreviewTimer()},onMachineIConClicked:function(a,b,c){c="IconWidget"+this._model._previewType+this._model._featureMachineList[c].machine_identifier;RSWidgetsManager.getInstance().getController(c).getView().onIconClick(a,b)},_setPreviewHeading:function(a){this._featuredHeading&&this._featuredHeading.setVisible(!1);this._previewHeading&&this._previewHeading.setVisible(!1);this._mostPlayedHeading&& (this._fireAnimation&&this._fireAnimation.setVisible(!1),this._mostPlayedHeading.setVisible(!1));this._leaderboardHeading&&this._leaderboardHeading.setVisible(!1);this._mostPopularHeading&&this._mostPopularHeading.setVisible(!1);this._newlyAddedHeading&&this._newlyAddedHeading.setVisible(!1);switch(this._model._previewType){case RSFeatures.MOST_PLAYED:this._mostPlayedHeading&&(this._fireAnimation&&this._fireAnimation.setVisible(!0),this._mostPlayedHeading.setVisible(!0));this._mostPlayedBase&&this._mostPlayedBase.setVisible(!0); break;case RSFeatures.MOST_POPULAR:this._mostPopularHeading&&this._mostPopularHeading.setVisible(!0);break;case RSFeatures.TOP_ON_LEADERBOARD:this._leaderboardHeading&&this._leaderboardHeading.setVisible(!0);break;case RSFeatures.NEW_MACHINES:this._newlyAddedBase&&this._newlyAddedBase.setVisible(!0);this._newlyAddedHeading&&this._newlyAddedHeading.setVisible(!0);break;case PreviewType.POKER:case PreviewType.SLOTS:case RSFeatures.FEATURED:this._featuredHeading&&this._featuredHeading.setVisible(!a), this._previewHeading&&this._previewHeading.setVisible(a),this._topFeaturedBase&&this._topFeaturedBase.setVisible(!a),this._sneakPreviewBase&&this._sneakPreviewBase.setVisible(a)}},changeIcon:function(){this._scroller.jumpToNextElement()},refreshScroller:function(){clearInterval(this._iconSwitchTimer);this.removeChild(this._scroller,!0);this._scroller=new RSPageScroller(new RSRect(this._previewIconObject.x,this._previewIconObject.y,this._previewIconObject.w,this._previewIconObject.h),new RSSize(this._previewIconObject.w, this._previewIconObject.h),0,RSScrollerDirection.RSSCROLLER_HORIZONTAL,1,1);this.createPreviewIcons()},previewTimerTick:function(){this._timerText&&(0<this._model.getTimeLeft()?(this._timerText.setString(this._model.getFormattedTime(this._model.getTimeLeft())),this._model.tickTimeLeft()):(clearInterval(this._previewTimer),this._timerText.setVisible(!1),this._model._sneakPreview=!1,this.refreshScroller(),this.onPreviewComplete()))},startPreviewTimer:function(){this._model.setTimeLeft();0<this._model.getTimeLeft()? (this._previewTimer=setInterval(this.previewTimerTick.bind(this),1E3),this._timerText.setVisible(!0)):(clearInterval(this._previewTimer),this._timerText.setVisible(!1))},onIconClicked:function(a,b){RSWidgetsManager.getInstance().getController("previewWidget").onIconClicked(a,b,this._model._previewType)},onPreviewComplete:function(){RSWidgetsManager.getInstance().getController("previewWidget").onPreviewComplete()},onLayoutCompleted:function(){this._scroller=null!=this._clippingRect?new RSPageScroller(new RSRect(this._clippingRect.x, this._clippingRect.y,this._clippingRect.w,this._clippingRect.h),new RSSize(this._previewIconObject.w,this._previewIconObject.h),0,RSScrollerDirection.RSSCROLLER_HORIZONTAL,1,1):new RSPageScroller(new RSRect(this._previewIconObject.x,this._previewIconObject.y,this._previewIconObject.w,this._previewIconObject.h),new RSSize(this._previewIconObject.w,this._previewIconObject.h),0,RSScrollerDirection.RSSCROLLER_HORIZONTAL,1,1);this.createPreviewIcons();this._widgetAddOnAnim&&this._widgetAddOnAnim.playAnimation(-1, this._animationSpeed);this._super.onLayoutCompleted.call(this)},unload:function(){clearInterval(this._previewTimer);clearInterval(this._iconSwitchTimer);this._super.unload.call(this)}});var IIconClicked=new Interface("IIconClicked",["onIconClicked"]),IPreviewComplete=new Interface("IPreviewComplete",["onPreviewComplete"]),PreviewWidgetController=RSWidgetController.extend({_delegate:null,_previewTimer:null,onControllerAdded:function(){this.loadModelData();this.getView().loadLayoutsInModel(this.getModel())},loadModelData:function(){this.getModel().loadModelData()},setDelegate:function(a){this._delegate=a;a.implements(IPreviewComplete);a.implements(IIconClicked)},isPreviewActive:function(){return this.getModel().isPreviewActive()}, onControllerRemoved:function(){this._view.unload();this._model.unload()},onIconClicked:function(a,b,c){this._delegate.onIconClicked(a,b,c)},onPreviewComplete:function(){this._delegate.onPreviewComplete()}});var PreviewWidgetModel=RSWidgetModel.extend({_previewMachineList:null,_featureMachineList:null,_machineType:null,_timeLeft:null,_data:null,_sheetName:{},_iconFieldName:null,_previewType:null,_iconPath:null,_font:null,_iconFieldObject:null,_iconPathObject:null,_userBlob:{},_sneakPreview:!1,_previewMachineType:null,_previewIconFieldName:null,_previewIconPath:null,_underMaintenancePath:null,init:function(a,b,c,d){"object"==typeof b?(this._sheetName=b.sheetName,this._iconFieldObject=b.iconFieldName,this._previewType= b.previewType,this._iconPathObject=b.iconPath,this._underMaintenancePath=b.underMaintenancePath,this._font=b.fontName,this._isViaDashboard=b.isDashboard?b.isDashboard:!1,this._iconTxtFont=d,b.userBlob&&(this._userBlob=b.userBlob)):(this._sheetName=b,this._iconFieldName=c,this._previewType=PreviewType.SLOTS,this._iconPath="res/SlotResources/Sublobby/featuredicons/",this._font="");this._super.init.call(this,a)},loadModelData:function(){var a=null,b=null,c=null;this._previewType?this._previewType==RSFeatures.MOST_PLAYED? c=PreviewWidgetManger.getInstance().getMostPlayedMachine(this._sheetName,this._userBlob):this._previewType==RSFeatures.MOST_POPULAR?(c=RSMEConfigManager.getInstance().getDataForEvent(RSFeatures.MOST_POPULAR),c=this._checkAndLoadDefaultMachine(c)):this._previewType==RSFeatures.TOP_ON_LEADERBOARD?(c=RSMEConfigManager.getInstance().getDataForEvent(RSFeatures.TOP_ON_LEADERBOARD),c=this._checkAndLoadDefaultMachine(c)):this._previewType==PreviewType.POKER?(this._setGameData(this._previewType),a=RSMEConfigManager.getInstance().getDataForEvent(RSFeatures.POKER_PREVIEW), b=RSMEConfigManager.getInstance().getDataForEvent(RSFeatures.POKER_FEATURED)):this._previewType==RSFeatures.NEW_MACHINES?c=PreviewWidgetManger.getInstance().getNewMachines(this._sheetName):this._previewType==PreviewType.SLOTS?(this._setGameData(this._previewType),a=RSMEConfigManager.getInstance().getDataForEvent(RSFeatures.SLOTS_PREVIEW),b=RSMEConfigManager.getInstance().getDataForEvent(RSFeatures.SLOTS_FEATURED)):this._previewType==RSFeatures.FEATURED&&(b=RSMEConfigManager.getInstance().getDataForEvent(RSFeatures.FEATURED), a=RSMEConfigManager.getInstance().getDataForEvent(RSFeatures.PREVIEW)):(this._data=RSEngine.gameData.getSheetData(this._sheetName[PreviewType.SLOTS]),a=RSMEConfigManager.getInstance().getDataForEvent(RSFeatures.SLOTS_PREVIEW),b=RSMEConfigManager.getInstance().getDataForEvent(RSFeatures.SLOTS_FEATURED));if(b)if(c=b.machines,this._isViaDashboard){if(c)for(var d in this._sheetName)if(c[d]){this._setGameData(d);for(var e in c[d])b=c[d][e],this._featureMachineList||(this._featureMachineList=[],this._machineType= [],this._iconFieldName=[],this._iconPath=[]),this._featureMachineList.push(this.getMachineDataForID(b)),!this._featureMachineList[e]||null==this._featureMachineList[e].iconUrlLarge&&null==this._featureMachineList[e].iconUrl?this._updateModelConfig(d):"BBC"==GameConfig.GAME_ID||"LNC"==GameConfig.GAME_ID?this._updateModelConfig(d,null,this._featureMachineList[e].iconUrl):this._updateModelConfig(d,null,this._featureMachineList[e].iconUrlLarge)}}else for(e in c=b.machines,c)b=c[e].machine_identifier, this._featureMachineList||(this._featureMachineList=[],this._machineType=[],this._iconFieldName=[],this._iconPath=[]),this._updateModelConfig(c[e].machine_type),this._featureMachineList.push(this.getMachineDataForID(b));else if(this._previewType==RSFeatures.MOST_PLAYED||this._previewType==RSFeatures.MOST_POPULAR)b=c.machine_identifier,this._setGameData(c.machine_type),this._featureMachineList||(this._featureMachineList=[],this._machineType=[],this._iconFieldName=[],this._iconPath=[]),this._featureMachineList.push(this.getMachineDataForID(b)), this._updateModelConfig(c.machine_type);else if(this._previewType==RSFeatures.NEW_MACHINES)for(this._featureMachineList||(this._featureMachineList=[],this._machineType=[],this._iconFieldName=[],this._iconPath=[]),e=0;e<c.length;e++)switch(c[e].machine_type){case RSGameTypes.Poker:for(var b=c[e].machineDetails,f=0;f<b.length;f++)this._featureMachineList.push(b[f]),this._updateModelConfig(c[e].machine_type);break;case RSGameTypes.Slots:b=c[e].machineDetails;for(f=0;f<b.length;f++)this._featureMachineList.push(b[f]), this._updateModelConfig(c[e].machine_type);break;case RSGameTypes.Scratcher:for(b=c[e].machineDetails,f=0;f<b.length;f++)this._featureMachineList.push(b[f]),this._updateModelConfig(c[e].machine_type)}else if(this._previewType==RSFeatures.TOP_ON_LEADERBOARD)for(e in c)b=c[e].machine_identifier,this._setGameData(c[e].machine_type),this._featureMachineList||(this._featureMachineList=[],this._machineType=[],this._iconFieldName=[],this._iconPath=[]),this._featureMachineList.push(this.getMachineDataForID(b)), this._updateModelConfig(c[e].machine_type);else for(e in this._data)c=this._data[e],parseInt(c.machine_featured)&&(this._featureMachineList||(this._featureMachineList=[],this._machineType=[],this._iconFieldName=[],this._iconPath=[]),this._featureMachineList.push(c),this._updateModelConfig(this._previewType));if(a)if(0>=a.remainingTime)this._sneakPreview=!1;else if(this._sneakPreview=!0,this._isViaDashboard){if(c=a.machines)for(d in this._sheetName)if(c[d])for(e in this._setGameData(d),c[d])b=c[d][e], this._previewMachineList||(this._previewMachineList=[],this._previewMachineType=[],this._previewIconFieldName=[],this._previewIconPath=[]),this._previewMachineList.push(this.getMachineDataForID(b)),this._updateModelConfig(d,!0)}else for(e in c=a.machines,c)b=c[e].machine_identifier,this._previewMachineList||(this._previewMachineList=[],this._previewMachineType=[],this._previewIconFieldName=[],this._previewIconPath=[]),this._previewMachineList.push(this.getMachineDataForID(b)),this._updateModelConfig(c[e].machine_type, !0)},_checkAndLoadDefaultMachine:function(a){if(null==a)a=PreviewWidgetManger.getInstance().getDefaultMachine(this._previewType,this._sheetName);else return a;return this._previewType==RSFeatures.MOST_POPULAR?a[0]:a},_setGameData:function(a){this._data=RSEngine.gameData.getSheetData(this._sheetName[a])},_updateModelConfig:function(a,b,c){b?(this._previewMachineType.push(a),this._previewIconFieldName.push(this._iconFieldObject[a]),c?this._previewIconPath.push(c):this._previewIconPath.push(this._iconPathObject[a])): (this._machineType.push(a),this._iconFieldName.push(this._iconFieldObject[a]),c?this._iconPath.push(c):this._iconPath.push(this._iconPathObject[a]))},getPreviewMachineList:function(){return this._previewMachineList},getFeaturedMachineList:function(){return this._featureMachineList},getMachineType:function(){return this._machineType},getMachineDataForID:function(a){for(var b in this._data)if(this._data[b].machine_identifier==a)return this._data[b];cc.log("Error Machine not present for id "+a);return 0}, setTimeLeft:function(){this._timeLeft=this._isViaDashboard?RSMEConfigManager.getInstance().getTimeLeft(RSFeatures.PREVIEW):RSMEConfigManager.getInstance().getTimeLeft(RSFeatures.SLOTS_PREVIEW)},getTimeLeft:function(){this.setTimeLeft();return this._timeLeft},tickTimeLeft:function(){this._timeLeft--},getFormattedTime:function(a){function b(a,b){for(var c=a.toString();c.length<b;)c="0"+c;return c}if(86400<a){var c=Math.floor(a/86400)+1;if(1<c)return""+c+" Days"}var c=a%60,d=Math.floor(a/60)%60;return b(Math.floor(a/ 3600),2)+":"+b(d,2)+":"+b(c,2)},isPreviewActive:function(){this.setTimeLeft();return 0<this.getTimeLeft()},getIconFonts:function(){return this._iconTxtFont}});var IHourlyBonus=new Interface("IHourlyBonus",["onHourlyBonusCollected","showLoginPromptPopup","onVideoButtonClicked"]),HourlyBonusManager=function(){var a,b=RSClass.extend({init:function(){this._hourlyBonusData=RSEngine.gameData.getSheetData("hourlyBonusConfig");this._layout=this._delegate=null;this._vipBonus=this._retryCount=this._hourlyBonusCoins=0;this._collectButton=null},updateHourlyBonusStatus:function(a,b){RSEngine.dataManager.getHourlyBonusStatus(!1,0,this._onHourlyBonusStatusCheckCompleted.bind(this, a),b)},_onHourlyBonusStatusCheckCompleted:function(a,b){b.result&&(this._remainingTime=b.result.data.remainingTime,this._collectedTime=b.result.data.collectedTime,this._intervalTime=b.result.data.interval);a&&a(b)},setDefaultValuesForFullGuestUsers:function(){this._collectedTime=0;this._intervalTime=7200},showHourlyBonus:function(a,b,e,f,g,h,k,m,n){this._delegate=a;this._layout=b;this._hourlyBonusCoins=g;this._vipBonus=n;this._vipTier=k;this._delegate.implements(IHourlyBonus);this._bonus=new HourlyBonusScreen(this._layout, this._collectedTime,this._intervalTime,this._hourlyBonusCoins,h,f,k,m,n);e.addChild(this._bonus);this._bonus.setDelegate(this)},getView:function(){return this._bonus},showLoginPromptPopup:function(){this._delegate.showLoginPromptPopup("bihourly_bonus")},onHourlyBonusCollected:function(a){this._collectButton=a;this._showOverlayLayer();RSEngine.dataManager.getHourlyBonusStatus(!0,this._hourlyBonusCoins,this._onHourlyBonusCollectCompleted.bind(this),this._onHourlyBonusCollectFailed.bind(this))},_showOverlayLayer:function(){RSEngine.screenManager.addOverlay()}, _onHourlyBonusCollectCompleted:function(a){this._retryCount=0;RSEventManager.getInstance().dispatchEvent("BihourlyBonusQuestAction",this._hourlyBonusCoins);this._hideOverlayLayer();a.result&&!0==a.result.data.rewardStatus&&(this._bonus&&this._bonus.notifyHourlyBonusUpdate(TimeManager.getInstance().currentServerTime),RSEngine.dataManager.getMe().syncBlobVars(a.result.data),this._collectedTime=TimeManager.getInstance().currentServerTime,a=this._bonus.convertToWorldSpace(this._collectButton.getX(),this._collectButton.getY()), this._delegate.onHourlyBonusCollected(a),a="hourly_bonus",7200==this._intervalTime&&(a="bihourly_bonus"),GameConfig.IS_VIP_ENABLED?(RSCasinoManager.triggerPrimarySourceEvent(RSAnalyticsSource.free,a,(this._hourlyBonusCoins-this._vipBonus).toString(),"metagame"),0<RSVIPManager.getInstance().getVIPUserTier()&&RSCasinoManager.triggerPrimarySourceEvent(RSAnalyticsSource.free,"vip_bonus",this._vipBonus.toString(),"metagame",RSVIPManager.getInstance().getVIPUserTier())):RSCasinoManager.triggerPrimarySourceEvent(RSAnalyticsSource.free, a,this._hourlyBonusCoins,"metagame"));RSEventManager.getInstance().dispatchEvent("onHourlyBonusCollected")},_onHourlyBonusCollectFailed:function(a){3>this._retryCount?(this._retryCount++,this.onHourlyBonusCollected(this._collectButton)):(this._collectButton.setTouchEnabled(!0),this._retryCount=0,RSErrorTracker.getInstance().trackErrorMessage("HOURLY_BONUS","Error collecting hourly bonus","mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"))},_hideOverlayLayer:function(){RSEngine.screenManager.removeOverlay()}, onVideoButtonClicked:function(){this._delegate.onVideoButtonClicked()},removeHourlyBonus:function(){this._delegate&&this._bonus&&this._delegate.removeChild(this._bonus);this._bonus=null}});return{getInstance:function(){a||(a=new b);return a}}}();var HourlyBonusScreen=RSDisplayObject.extend({_hourlyBonusCoinsLabel:null,_hourlyBonusPickedTime:null,_hourlyBonusCoins:0,_bonusRemainingTime:null,_iconSwitchTimer:null,_timeInterval:0,_biHourlyBonusBG:null,_saleAnimation:null,_saleButton:null,_saleBadge:null,_saleBonus:null,_subscriptionRemainingTime:null,_timerBase:null,_delegate:null,_font:null,_touchRect:null,_isAdAvailable:null,_surveyFont:null,_saleBonusFont:null,SUBSCRIPTION:1,WATCH_AD:2,SURVEY:3,HOURLY_BONUS_TIMER:4,SUBSCRIPTION_TIMER:5,HOURLY_BONUS:6, _previousWidget1:null,_currentWidget1:null,_previousWidget2:null,_currentWidget2:null,_subscriptionEnabledStatus:!1,_timeRem:0,init:function(a,b,c,d,e,f,g,h){this._layout=a;this.rect=new RSRect(0,0,0,0);this._super.init.call(this,this.rect);this._hourlyBonusCoins=d;this._source=h;this._hourlyBonusPickedTime=b;this._isAdAvailable=e;this._moveCompleted=!0;"object"===typeof f?(this._font=f.timerFont,this._surveyFont=f.surveyFont,this._saleBonusFont=f.salebonus):this._font=f;this._timeInterval=c;this._vipTier= g;this._badgePanel=null;this._activateVipAnim=!0;!GameConfig.SUBSCRIPTION_ENABLED||GameConfig.SUBSCRIPTION_WIDGET_ENABLED||RSGame.getInstance().getUserDataManager().getMe().getIsSubscriptionInteruptedShownStatus()||(RSSubscrptionSaleManager.getCurrentDate("day")?this._subscriptionEnabledStatus=!0:RSSubscrptionSaleManager.initializeSubscriptionData(null));this.loadContent()},loadContent:function(){this.loadLayout(this._layout)},updateTimer:function(){!1==this._subscriptionEnabledStatus&&!GameConfig.SUBSCRIPTION_WIDGET_ENABLED&& GameConfig.SUBSCRIPTION_ENABLED&&!RSGame.getInstance().getUserDataManager().getMe().getIsSubscriptionInteruptedShownStatus()&&RSSubscrptionSaleManager.getCurrentDate("day")&&(this._subscriptionEnabledStatus=!0,this.updateSubscriptionwidget())},onLayoutCompleted:function(){clearInterval(this._updateTimer);this._updateTimer=setInterval(this.updateTimer.bind(this),1E3);clearInterval(this._bonusRemainingTime);this._bonusRemainingTime=setInterval(this._setTimerValues.bind(this),1E3);this.addChild(this._panel1); this._subscriptionEnabledStatus&&this.updateSubscriptionwidget();this._super.onLayoutCompleted.call(this);this._setVipAnim();this._setTimerValues();null!=this._vipTier&&null!=this._badgePanel&&(0<this._vipTier?this._badgePanel.setVisible(!0):this._badgePanel.setVisible(!1))},updateSubscriptionwidget:function(){clearInterval(this._subscriptionRemainingTime);this._subscriptionRemainingTime=setInterval(this._setSubscriptionTimerValues.bind(this),1E3);this.addChild(this._panel2);this._panel1.setPosition(this._panel1.getX(), this._panel1.getY()-this._widgetHeight);this._widgetYValue1=this._widgetYValue-this._widgetHeight;this._widgetYValue2=this._widgetYValue1+this._widgetHeight+this._widgetHeight/9;!RSSubscrptionSaleManager.getCurrentDayClaimedStatus()&&this._saleAnimation&&(this._saleAnimation.setVisible(!0),this._saleAnimation.stopAnimation(),this._saleAnimation.playAnimation(-1,0.25));RSSubscrptionSaleManager.getCurrentDayClaimedStatus()&&this.scheduleFunctionOnce(function(){this.changeIcon()}.bind(this),5);this._setSubscriptionTimerValues()}, _onMoveCompleted:function(a){a="widget1"==a?this._panel1.actionMoveTo(0.3,this._panel1.getX(),this._widgetYValue1+this._widgetHeight+this._widgetHeight/9,this._onMoveCompleted1.bind(this,"widget1")):this._panel2.actionMoveTo(0.3,this._panel2.getX(),this._widgetYValue1+this._widgetHeight+this._widgetHeight/9,this._onMoveCompleted1.bind(this,"widget2"));RSTweener.easeSineOut(a)},_onMoveCompleted1:function(a){a="widget1"==a?this._panel1.actionMoveTo(0.3,this._panel1.getX(),this._widgetYValue2-this._widgetHeight/ 9):this._panel2.actionMoveTo(0.3,this._panel2.getX(),this._widgetYValue2-this._widgetHeight/9);RSTweener.easeSineIn(a);this._moveCompleted=!0},changeIcon:function(){if(!GameConfig.SUBSCRIPTION_WIDGET_ENABLED&&RSSubscrptionSaleManager.getCurrentDate("day")){if(!0==this._moveCompleted){if(0==this._timeRem){var a=this._panel2.actionMoveTo(0.9,this._panel2.getX(),this._widgetYValue-this._widgetHeight,this._onMoveCompleted.bind(this,"widget1"));this._timeRem=1}else a=this._panel1.actionMoveTo(0.9,this._panel1.getX(), this._widgetYValue-this._widgetHeight,this._onMoveCompleted.bind(this,"widget2")),this._timeRem=0;RSTweener.easeBackIn(a);this._moveCompleted=!1}RSSubscrptionSaleManager.getCurrentDayClaimedStatus()&&this.scheduleFunctionOnce(function(){this.changeIcon()}.bind(this),5)}else this._panel2.removeAllChildren(),this._panel1.setPosition(this._panel1.getX(),this._widgetYValue),clearInterval(this._subscriptionRemainingTime)},removeChildForAddingWidget:function(a){this.removeChild(a)},createCustomObject:function(a, b){switch(b.name){case "CoinAmountLbl":this._hourlyBonusCoinsLabel=new RSScaledLabel(RSUtils.formatNumber(this._hourlyBonusCoins),this._font,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._hourlyBonusCoinsLabel);this.removeChildForAddingWidget(this._hourlyBonusCoinsLabel);this._hourlyBonusCoinsLabel.setVisible(!1);break;case "TimerLbl":this._bonusTimerText=new RSScaledLabel("",this._font,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._bonusTimerText);this.removeChildForAddingWidget(this._bonusTimerText); this._bonusTimerText.setVisible(!1);break;case "VIPMultiplierBadge":null!=this._vipTier&&0<this._vipTier&&(this._vipBadge=new VIPMultiplierBadge(b,this._vipTier,!0),this._vipBadge.setScale(0.45),this._badgePanel=new RSPanel(b.x,b.y-15,b.w,b.h),this._badgePanel.setZOrder(0),this._badgePanel.setBackgroundColor(255,0,0,0),this._badgePanel.setVisible(!0),this._badgePanel.addChild(this._vipBadge),this.addChild(this._badgePanel),this.removeChildForAddingWidget(this._badgePanel));break;case "TouchRect":this._touchRect= new RSDisplayObject(new RSRect(b.x,b.y,b.w,b.h));this._touchRect.setAnchorPoint(0.5,0.5);this._widgetHeight=b.h;this._widgetYValue=b.y;this._widget1=new RSPanel(b.x,b.y,b.w,b.h);this._widget2=new RSPanel(b.x,b.y,b.w,b.h);this._panel1=new RSPanel(b.x,b.y,b.w,b.h);this._panel2=new RSPanel(b.x,b.y,b.w,b.h);this._widget1.setCenter(b.w/2,b.h/2);this._panel1.setCenter(b.w/2,b.h/2);this._widget2.setCenter(b.w/2,b.h/2);this._panel2.setCenter(b.w/2,b.h/2);this._touchRect.setName("TouchRect");this.addChild(this._touchRect); this.removeChildForAddingWidget(this._touchRect);break;case "Badge":this._surveyBadge=RSUtils.createBasicObject(a,b);this.addChild(this._surveyBadge);this.removeChildForAddingWidget(this._surveyBadge);this._surveyBadge.setVisible(!1);break;case "BadgeValue":var c=RSEngine.gameData.getDefaultValues().surveyMultiplier;this._surveyBadgeValue=new RSScaledLabel(0<c?c+"X":"",this._surveyFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._surveyBadgeValue);this.removeChildForAddingWidget(this._surveyBadgeValue); this._surveyBadgeValue.setVisible(!1);break;case "SaleBadge":this._saleBadge=RSUtils.createBasicObject(a,b);this._saleBadge.setVisible(!1);this._saleBadge.setVisible(!1);break;case "SaleBonus":this._saleBonus=new RSScaledLabel("1,000,000",this._saleBonusFont,b,kTEXT_ALIGNMENT_LEFT);this._saleBonus.setScale(0.8);this._saleBonus.setVisible(!1);break;case "SaleTimerBadge":this._saleTimerBadge=RSUtils.createBasicObject(a,b);this._saleTimerBadge.setVisible(!1);break;case "SaleTimer":this._subscriptionTimerText= new RSScaledLabel("",this._font,b,kTEXT_ALIGNMENT_CENTER);this._subscriptionTimerText.setVisible(!1);break;case "SaleTimerBonus":this._subscriptionTimerBonus=new RSScaledLabel("",this._font,b,kTEXT_ALIGNMENT_CENTER),this._subscriptionTimerBonus.setVisible(!1)}},onObjectCreated:function(a,b,c){switch(c.name){case "Coins":this._coins=a;this.removeChildForAddingWidget(this._coins);this._coins.setVisible(!1);break;case "BihourlyBonus":this._biHourlyBonusBG=a;this.removeChildForAddingWidget(this._biHourlyBonusBG); break;case "BihourlyBonusTop":a.setZOrder(11);this._biHourlyBonusBG=a;this.removeChildForAddingWidget(this._biHourlyBonusBG);break;case "BonusAnim":this._biHourlyBonusAnim=a;this.removeChildForAddingWidget(this._biHourlyBonusAnim);break;case "BihourlyCollectedAnim":this._bihourlyCollectedAnim=a;this._bihourlyCollectedAnim.setVisible(!1);this.removeChildForAddingWidget(this._bihourlyCollectedAnim);break;case "CollectButton":this._collectButton=a;this._collectButton.setZOrder(10);this.removeChildForAddingWidget(this._collectButton); break;case "WatchAdButton":this._watchAdButton=a;this._watchAdButton.setVisible(!1);this.removeChildForAddingWidget(this._watchAdButton);break;case "BihourlyBonusIcon":this._biHourlyBonusIconAnim=a;this.removeChildForAddingWidget(this._biHourlyBonusIconAnim);break;case "TimerBase":this._timerBase=a;this._timerBase.setVisible(!1);this.removeChildForAddingWidget(this._timerBase);break;case "VideoButton":this._videoButton=a;this._videoButton.setVisible(!1);this.removeChildForAddingWidget(this._videoButton); break;case "VideoIcon":this._videoIcon=a;this._videoIcon.setVisible(!1);this.removeChildForAddingWidget(this._videoIcon);break;case "BihourlyBonusIconClose":a.setVisible(!1);this._hourlyBonusCollect=a;this.removeChildForAddingWidget(this._hourlyBonusCollect);break;case "TakeSurvey":a.setVisible(!1);this._surveyButton=a;this.removeChildForAddingWidget(this._surveyButton);break;case "SaleButton":a.setVisible(!1);this._saleButton=a;this.removeChild(this._saleButton);break;case "SaleAnimation":a.setVisible(!1); this._saleAnimation=a;this.removeChild(this._saleAnimation);break;case "SaleTimerButton":a.setVisible(!0),this._saleTimerButton=a,this.removeChild(this._saleTimerButton)}},onButtonClicked:function(a){switch(a){case "CollectButton":RSEngine.loginMode==LOGIN_MODE.GUEST?this._delegate.showLoginPromptPopup():(this._collectButton.setTouchEnabled(!1),HourlyBonusManager.getInstance().onHourlyBonusCollected(this._collectButton));break;case "VideoButton":this._videoButton.setTouchEnabled(!1);HourlyBonusManager.getInstance().onVideoButtonClicked(); break;case "WatchAdButton":GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&RSGame.getInstance().getPlatformEventManager()?RSGame.getInstance().getPlatformEventManager().getUserEventStatus()&&RSGame.getInstance().getPlatformEventManager().getUserEventStatus().ClickToWatchAd&&JSON.parse(RSGame.getInstance().getPlatformEventManager().getUserEventStatus().ClickToWatchAd.HourlyBonus)&&RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.EARN_COINS_AD, parameter:RSPlatformPopupNameKeys.HOURLY_BONUS}):"undefined"!==typeof RSPlatformEventManager&&RSPlatformEventManager.getInstance().getUserEventStatus()[RSPlatformEventTypeKeys.EARN_COINS_AD]&&JSON.parse(RSPlatformEventManager.getInstance().getUserEventStatus()[RSPlatformEventTypeKeys.EARN_COINS_AD][RSPlatformPopupNameKeys.HOURLY_BONUS])&&RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.EARN_COINS_AD,parameter:RSPlatformPopupNameKeys.HOURLY_BONUS}); break;case "TakeSurvey":RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.EARN_COINS_SURVEY,parameter:RSPlatformPopupNameKeys.HOURLY_BONUS});break;case "SaleButton":RSAnalyticsManager.getInstance().trackGUIEvent("main_lobby","subscription_collect","click",RSSubscrptionSaleManager.getPackName());RSEngine.popupManager.addPopup(new RSSubscriptionSaleCalendarPopup(this._source));break;case "SaleTimerButton":RSAnalyticsManager.getInstance().trackGUIEvent("main_lobby", "subscription_timer","click",RSSubscrptionSaleManager.getPackName()),RSEngine.popupManager.addPopup(new RSSubscriptionSaleCalendarPopup(this._source))}},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){switch(a.getName()){case "BihourlyBonus":case "BihourlyBonusIcon":case "TouchRect":RSEngine.loginMode==LOGIN_MODE.GUEST?this._delegate.showLoginPromptPopup():(this._collectButton.setTouchEnabled(!1),HourlyBonusManager.getInstance().onHourlyBonusCollected(this._collectButton)); break;case "VideoIcon":RSGame.getInstance().getGameManager().playButtonClickSFX(),this._videoButton.setTouchEnabled(!1),this._videoIcon.removeTouchListener(),HourlyBonusManager.getInstance().onVideoButtonClicked()}},_setVipAnim:function(){!1==this._activateVipAnim?null!=this._badgePanel&&this._vipBadge.stopGlowAnim():null!=this._badgePanel&&this._vipBadge.startGlowAnim()},_setSubscriptionTimerValues:function(){if(RSSubscrptionSaleManager.getCurrentDayClaimedStatus()){var a=RSSubscrptionSaleManager.getNextSubscriptionBonusCollectTime()- TimeManager.getInstance().currentServerTime,a=RSUtils.formattedTime(a);this._subscriptionTimerText.setString(a);this._subscriptionTimerText.setVisible(!0);this._saleButton.setVisible(!1);this._saleButton.setTouchEnabled(!1);this._saleTimerButton.setVisible(!0);this._saleTimerButton.setTouchEnabled(!0);this._saleBadge.setVisible(!1);this._saleTimerBadge.setVisible(!0);this._saleTimerBadge.addTouchListenerWithDelegate(this);this._saleBonus.setVisible(!1);this._saleAnimation.setVisible(!1);this._saleAnimation.stopAnimation()}else this._saleBonus.setString(RSUtils.formatNumberWithComma(RSSubscrptionSaleManager.getItemValue()? RSSubscrptionSaleManager.getItemValue():"")),this._saleButton.setVisible(!0),this._saleButton.setTouchEnabled(!0),this._saleBadge.setVisible(!0),this._saleBonus.setVisible(!0),this._subscriptionTimerText.setVisible(!1),this._saleTimerBadge.setVisible(!1),this._saleTimerBadge.removeTouchListener();this.addChildsToWidget2()},addChildsToWidget2:function(){RSSubscrptionSaleManager.getCurrentDayClaimedStatus()?(this._currentWidget2=this.SUBSCRIPTION_TIMER,this._previousWidget2&&this._previousWidget2!= this._currentWidget2&&(RSSubscrptionSaleManager.getCurrentDayClaimedStatus()&&this.scheduleFunctionOnce(function(){this.changeIcon()}.bind(this),5),this.removeWidgets(2)),this._previousWidget2&&this._previousWidget2==this._currentWidget2||(this._widget2.addChild(this._saleAnimation),this._widget2.addChild(this._saleTimerBadge),this._widget2.addChild(this._subscriptionTimerText),this._widget2.addChild(this._saleTimerButton),this._panel2.addChild(this._widget2))):(this._currentWidget2=this.SUBSCRIPTION, this._previousWidget2&&this._previousWidget2!=this._currentWidget2&&this.removeWidgets(2),this._previousWidget2&&this._previousWidget2==this._currentWidget2||(this._widget2.addChild(this._saleBadge),this._widget2.addChild(this._saleAnimation),this._widget2.addChild(this._saleButton),this._widget2.addChild(this._saleBonus),this._panel2.addChild(this._widget2)));this._previousWidget2=this._currentWidget2},removeWidgets:function(a){1==a?(this._panel1.removeChild(this._widget1),this.removeChildsFromWidgets(this._widget1)): (this._panel2.removeChild(this._widget2),this.removeChildsFromWidgets(this._widget2))},removeChildsFromWidgets:function(a){for(;0<a._children.length;)a.removeChild(a._children[a._children.length-1],!1)},addChildsToWidget1:function(){var a=this._getHourlyBonusRemainingTime(),b=parseInt(this._previousWidget1);if(1>a)clearInterval(this._bonusRemainingTime),this._currentWidget1=this.HOURLY_BONUS,this._widget1&&(b&&b!=this._currentWidget1&&this.removeWidgets(1),b&&b==this._currentWidget1||(this._activateHourlyBonus(), this._widget1.addChild(this._touchRect),this._widget1.addChild(this._biHourlyBonusBG),this._biHourlyBonusAnim&&this._widget1.addChild(this._biHourlyBonusAnim),this._widget1.addChild(this._collectButton),this._timerBase||this._biHourlyBonusBG.setZOrder(5),this._panel1.addChild(this._widget1)));else{if(GameConfig.POLLFISH_ENABLED){var c=RSPollFishManager.getSurveyEnabledStatus(),d=RSGame.getInstance().getPlatformEventManager().getEventDataForParameter(RSPlatformEventTypeKeys.EARN_COINS_SURVEY,RSPlatformPopupNameKeys.HOURLY_BONUS); c&&d?(this._currentWidget1=this.SURVEY,b&&b!=this._currentWidget1&&this.removeWidgets(1),b&&b==this._currentWidget1||(this._deActivateHourlyBonus(),this._watchAdCase(),this._widget1.addChild(this._biHourlyBonusBG),this._widget1.addChild(this._surveyButton),this._widget1.addChild(this._surveyBadge),this._panel1.addChild(this._widget1))):(c=this.watchAd(b))||this._showHourlyBonusTimer(b)}else c=this.watchAd(b),c||(this._isAdAvailable?(b&&b!=this._currentWidget1&&this.removeWidgets(1),b&&b==this._currentWidget1|| (this._deActivateHourlyBonus(),this._showAd(),this._videoButton&&this._widget1.addChild(this._videoButton),this._videoIcon&&this._widget1.addChild(this._videoIcon),this._panel1.addChild(this._widget1))):this._showHourlyBonusTimer(b));a=RSUtils.formattedTime(a);this._bonusTimerText.setString(a)}this._previousWidget1=this._currentWidget1;this._setVipAnim()},watchAd:function(a){if(GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&RSGame.getInstance().getPlatformEventManager()){if(RSGame.getInstance().getPlatformEventManager().getUserEventStatus()&& RSGame.getInstance().getPlatformEventManager().getUserEventStatus().ClickToWatchAd&&RSGame.getInstance().getPlatformEventManager().getUserEventStatus().ClickToWatchAd.HourlyBonus&&JSON.parse(RSGame.getInstance().getPlatformEventManager().getUserEventStatus().ClickToWatchAd.HourlyBonus))return this.showWatchAd(a),!0}else if("undefined"!==typeof RSPlatformEventManager&&RSPlatformEventManager.getInstance().getUserEventStatus()&&RSPlatformEventManager.getInstance().getUserEventStatus()[RSPlatformEventTypeKeys.EARN_COINS_AD]&& JSON.parse(RSPlatformEventManager.getInstance().getUserEventStatus()[RSPlatformEventTypeKeys.EARN_COINS_AD][RSPlatformPopupNameKeys.HOURLY_BONUS]))return this.showWatchAd(a),!0;return!1},showWatchAd:function(a){this._currentWidget1=this.WATCH_AD;a&&a!=this._currentWidget1&&this.removeWidgets(1);a&&a==this._currentWidget1||(this._coins&&this._coins.setVisible(!1),this._deActivateHourlyBonus(),this._watchAdCase(!0),this._widget1.addChild(this._biHourlyBonusBG),this._widget1.addChild(this._watchAdButton), this._panel1.addChild(this._widget1))},_showHourlyBonusTimer:function(a){this._currentWidget1=this.HOURLY_BONUS_TIMER;a&&a!=this._currentWidget1&&this.removeWidgets(1);a&&a==this._currentWidget1||(this._deActivateHourlyBonus(),this._widget1.addChild(this._collectButton),this._widget1.addChild(this._touchRect),null!=this._bihourlyCollectedAnim&&this._widget1.addChild(this._bihourlyCollectedAnim),null!=this._timerBase&&this._widget1.addChild(this._timerBase),this._widget1.addChild(this._bonusTimerText), this._panel1.addChild(this._widget1))},_setTimerValues:function(){this.addChildsToWidget1()},_getHourlyBonusRemainingTime:function(){var a=parseInt(this._hourlyBonusPickedTime)+this._timeInterval-TimeManager.getInstance().currentServerTime;0>a?a=0:a>=this._timeInterval&&(a=this._timeInterval);return a},_activateHourlyBonus:function(){this._activateVipAnim=!0;this._touchRect&&this._touchRect.addTouchListenerWithDelegate(this);null!=this._biHourlyBonusBG&&(this._biHourlyBonusBG.setVisible(!0),this._biHourlyBonusBG.stopAnimation(), this._biHourlyBonusBG.playAnimation(-1,0.25),this._touchRect||this._biHourlyBonusBG.addTouchListenerWithDelegate(this));null!=this._biHourlyBonusAnim&&(this._biHourlyBonusAnim.setVisible(!0),this._biHourlyBonusAnim.stopAnimation(),this._biHourlyBonusAnim.playAnimation(-1,0.25));null!=this._bihourlyCollectedAnim&&(this._bihourlyCollectedAnim.setVisible(!1),this._bihourlyCollectedAnim.stopAnimation());null!=this._biHourlyBonusIconAnim&&(this._biHourlyBonusIconAnim.stopAnimation(),this._biHourlyBonusIconAnim.setVisible(!0), this._biHourlyBonusIconAnim.setFrame(1),this._touchRect||this._biHourlyBonusIconAnim.addTouchListenerWithDelegate(this));null!=this._timerBase&&this._timerBase.setVisible(!1);null!=this._videoButton&&this._videoButton.setVisible(!1);null!=this._videoIcon&&(this._videoIcon.setVisible(!1),this._videoIcon.removeTouchListener());this._collectButton.setVisible(!0);this._collectButton.setTouchEnabled(!0);null!=this._hourlyBonusCoinsLabel&&this._hourlyBonusCoinsLabel.setVisible(!0);this._hourlyBonusCollect&& this._hourlyBonusCollect.setVisible(!1);this._bonusTimerText.setVisible(!1);this._surveyButton&&(this._surveyButton.setVisible(!1),this._surveyButton.setTouchEnabled(!1),this._surveyBadge.setVisible(!1),this._surveyBadgeValue&&this._surveyBadgeValue.setVisible(!1));this._watchAdButton&&(this._watchAdButton.setVisible(!1),this._watchAdButton.setTouchEnabled(!1));RSEventManager.getInstance().dispatchEvent("onHourlyBonusWidgetActive")},_deActivateHourlyBonus:function(){this._activateVipAnim=!1;this._touchRect&& this._touchRect.removeTouchListener();null!=this._biHourlyBonusBG&&(this._biHourlyBonusBG.setVisible(!1),this._biHourlyBonusBG.stopAnimation(),this._touchRect||this._biHourlyBonusBG.removeTouchListener());null!=this._biHourlyBonusAnim&&(this._biHourlyBonusAnim.setVisible(!1),this._biHourlyBonusAnim.stopAnimation());null!=this._bihourlyCollectedAnim&&(this._bihourlyCollectedAnim.setVisible(!0),this._bihourlyCollectedAnim.playAnimation(-1,0.25));null!=this._biHourlyBonusIconAnim&&(this._biHourlyBonusIconAnim.stopAnimation(), this._biHourlyBonusIconAnim.setVisible(!0),this._biHourlyBonusIconAnim.setFrame(0),this._touchRect||this._biHourlyBonusIconAnim.removeTouchListener());null!=this._timerBase&&this._timerBase.setVisible(!0);null!=this._videoButton&&this._videoButton.setVisible(!1);this._collectButton.setVisible(!1);this._collectButton.setTouchEnabled(!1);null!=this._hourlyBonusCoinsLabel&&this._hourlyBonusCoinsLabel.setVisible(!1);this._hourlyBonusCollect&&this._hourlyBonusCollect.setVisible(!0);this._watchAdButton&& (this._watchAdButton.setVisible(!1),this._watchAdButton.setTouchEnabled(!1));this._surveyButton&&(this._surveyButton.setVisible(!1),this._surveyButton.setTouchEnabled(!1),this._surveyBadge.setVisible(!1),this._surveyBadgeValue&&this._surveyBadgeValue.setVisible(!1));this._bonusTimerText.setVisible(!0)},notifyHourlyBonusUpdate:function(a){this._deActivateHourlyBonus();this._hourlyBonusPickedTime=a;if(GameConfig.POLLFISH_ENABLED){a=RSPollFishManager.getSurveyEnabledStatus();var b=RSGame.getInstance().getPlatformEventManager().getEventDataForParameter(RSPlatformEventTypeKeys.EARN_COINS_SURVEY, RSPlatformPopupNameKeys.HOURLY_BONUS);a&&b?(cc.log("event pressent"),this._watchAdCase()):GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&RSGame.getInstance().getPlatformEventManager()&&RSGame.getInstance().getPlatformEventManager().getUserEventStatus()&&RSGame.getInstance().getPlatformEventManager().getUserEventStatus().ClickToWatchAd&&JSON.parse(RSGame.getInstance().getPlatformEventManager().getUserEventStatus().ClickToWatchAd.HourlyBonus)&&this._watchAdCase(!0)}else GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&& RSGame.getInstance().getPlatformEventManager()&&RSGame.getInstance().getPlatformEventManager().getUserEventStatus()&&RSGame.getInstance().getPlatformEventManager().getUserEventStatus().ClickToWatchAd&&RSGame.getInstance().getPlatformEventManager().getUserEventStatus().ClickToWatchAd.HourlyBonus&&JSON.parse(RSGame.getInstance().getPlatformEventManager().getUserEventStatus().ClickToWatchAd.HourlyBonus)?this._watchAdCase(!0):this._isAdAvailable&&this._showAd();this._bonusRemainingTime=setInterval(this._setTimerValues.bind(this), 1E3);this._setTimerValues()},_showAd:function(){null!=this._timerBase&&this._timerBase.setVisible(!1);null!=this._bonusTimerText&&this._bonusTimerText.setVisible(!1);this._videoButton&&(this._videoButton.setVisible(!0),this._videoButton.setTouchEnabled(!0));this._videoIcon&&(this._videoIcon.setVisible(!0),this._videoIcon.setTouchEnabled(!0),this._videoIcon.addTouchListenerWithDelegate(this))},_watchAdCase:function(a){null!=this._timerBase&&this._timerBase.setVisible(!1);null!=this._bonusTimerText&& this._bonusTimerText.setVisible(!1);this._watchAdButton&&a&&(this._watchAdButton.setVisible(!0),this._watchAdButton.setTouchEnabled(!0));if(this._surveyButton){var b=!0;a&&(b=!1);this._surveyButton.setVisible(b);this._surveyButton.setTouchEnabled(b);this._surveyBadge.setVisible(b);this._surveyBadgeValue&&this._surveyBadgeValue.setVisible(b)}this._bihourlyCollectedAnim&&this._bihourlyCollectedAnim.setVisible(!1);this._hourlyBonusCollect&&this._hourlyBonusCollect.setVisible(!1);null!=this._biHourlyBonusBG&& (this._biHourlyBonusBG.setVisible(!0),this._biHourlyBonusBG.stopAnimation(),this._biHourlyBonusBG.playAnimation(-1,0.25))},setDelegate:function(a){this._delegate=a;this._delegate.implements(IHourlyBonus)},unload:function(){clearInterval(this._bonusRemainingTime);this._subscriptionEnabledStatus&&clearInterval(this._subscriptionRemainingTime);this._panel2=this._panel1=this._widget2=this._widget1=this._widgetYValue=this._widgetHeight=this._coins=null;this._super.unload.call(this)}});var RSWebAvatarPopup=RSPopup.extend({init:function(a,b,c){this._super.init.call(this,c);this._scroller=this._profilePicBase=this._frameTick=null;this._avatars=[];this._avatarImages=[];this._mainRect=null;this._avatarDetails=a;this._currentSelectedAvatarIndex=0;this._assetList=b.assetPath;this._avatarPlist=b.avatarPlistName;cc.spriteFrameCache.addSpriteFrames(b.avatarImgAssetPath+b.avatarPlistName+"-hd.plist")},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)}, onLayoutCompleted:function(){var a=!1;this._super.onLayoutCompleted.call(this);if(GameConfig.IS_EDIT_FIELDS_ENABLED&&(RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK||RSEngine.loginMode==LOGIN_MODE.FACEBOOK)){var b=this.createFBProfile();this._avatarImages.push(b);this._scroller.addChild(b);a=!0}for(var c=0;c<this._avatarDetails.avatarImgCount;c++)a?a=!1:(b=this.createAvatar(c+1),this._avatarImages.push(b),this._scroller.addChild(b));a=parseInt(RSGame.getInstance().getUserDataManager().getMe().getAvatar()); if(0<a)this._confirmBtn.setTouchEnabled(!0),this._currentSelectedAvatarIndex=a,this._avatarImages[a-1].addChild(this._frameBgObject),this._avatarImages[a-1].addChild(this._frameTickObject);else if(RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK||RSEngine.loginMode==LOGIN_MODE.FACEBOOK)this._currentSelectedAvatarIndex=0==a?1:a,this._confirmBtn.setTouchEnabled(!0),this._avatarImages[a].addChild(this._frameBgObject),this._avatarImages[a].addChild(this._frameTickObject);this._maskImage1&&this._maskImage2&& (1!=this._currentSelectedAvatarIndex||RSEngine.loginMode!=LOGIN_MODE.WEB_FACEBOOK&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK?(this._maskImage1.setVisible(!0),this._maskImage2.setVisible(!1)):(this._maskImage1.setVisible(!1),this._maskImage2.setVisible(!0)))},setTouchEnabled:function(){},createAvatar:function(a){this._profilePicBase.x=this._profilePicBase.w/2;this._profilePicBase.y=this._profilePicBase.h/2;this._frameTick.x=this._frameTick.w/2;this._frameTick.y=this._frameTick.h/2;this._mainRect.x=this._mainRect.w/ 2;this._mainRect.y=this._mainRect.h/2;var b=new RSDisplayObject(new RSRect(this._mainRect.x,this._mainRect.y,this._mainRect.w,this._mainRect.h));b.setColor(new RSColor(100,0,0,100));b.setName("frame"+a);b.addTouchListenerWithDelegate(this);var c=new RSBasicObject;c.loadFrameWithName(this._avatarPlist+"/"+a+".png");c.setCenter(this._mainRect.x,this._mainRect.y);b.addChild(c);this._avatars.push(c);return b},createFBProfile:function(){this._profilePicBase.x=this._profilePicBase.w/2;this._profilePicBase.y= this._profilePicBase.h/2;this._frameTick.x=this._frameTick.w/2;this._frameTick.y=this._frameTick.h/2;this._mainRect.x=this._mainRect.w/2;this._mainRect.y=this._mainRect.h/2;var a=new RSDisplayObject(new RSRect(this._mainRect.w/2,this._mainRect.h/2,this._mainRect.w,this._mainRect.h));a.setAnchorPoint(0.5,0.5);a.setColor(new RSColor(100,0,0,100));var b=RSGame.getInstance().getUserDataManager().getMe().getImageUrl(!0),c=new RSImageObject;c.setImageFromUrl(b,this._mainRect.x,this._mainRect.y,this._mainRect.w, this._mainRect.h/1.2);c.setCenter(this._mainRect.x,this._mainRect.y);a.setName("frame0");a.addTouchListenerWithDelegate(this);a.addChild(c);this._maskImage1=RSUtils.createBasicObject(this._screenName,this._profilePicBaseFrame2);this._maskImage1.setCenter(this._mainRect.x,this._mainRect.y);this._maskImage2=RSUtils.createBasicObject(this._screenName,this._profilePicBaseFrame);this._maskImage2.setCenter(this._mainRect.x,this._mainRect.y);a.addChild(this._maskImage1);a.addChild(this._maskImage2);this._maskImage1.setVisible(!1); this._maskImage1.setZOrder(2);this._maskImage2.setZOrder(2);if(c&&this._profilePicBase){var d=new RSClippingNode(RSUtils.createBasicObject(this._screenName,this._profilePicBase));d.setAlphaThreshold(80);d.addChild(c)}this._avatars.push(d);return a},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "PopupBgLeft":a.setScale(2);break;case "ScrollBase":this._scroller.setScrollBg(a);break;case "UpArrow":this._scroller.setButtonUp(a);break;case "DownArrow":this._scroller.setButtonDown(a); break;case "MiddleArrow":this._scroller.setButtonScroll(a);break;case "ConfirmBtn":this._confirmBtn=a;this._confirmBtn.setTouchEnabled(!1);break;case "CloseBtn":a.setVisible(!1),this._closeBtn=a}},onButtonClicked:function(a){switch(a){case "ConfirmBtn":RSGame.getInstance().getUserDataManager().getMe().setAvatar(this._currentSelectedAvatarIndex);this.getDisplayObject().setCascadeOpacityEnabled(!0);RSGame.getInstance().getUserDataManager().saveUserData("setAvatarID");this._confirmBtn.setTouchEnabled(!1); RSCasinoManager.getCasinoHUD().refreshAvatar();this.closePopup();break;case "CloseBtn":this._closeBtn&&this.closePopup()}},createCustomObject:function(a,b){switch(b.name){case "PopupBgRightFlip":b=RSUtils.cloneJSON(b);b.name="PopupBgLeft";var c=RSUtils.createBasicObject(a,b);this.addChild(c);c.setScale(2);c.setScaleX(-2);break;case "FrameBg":this._frameBg=b;this._frameBg.x=this._frameBg.w/2;this._frameBg.y=this._frameBg.h/2;this._frameBgObject=RSUtils.createBasicObject(a,b);this._frameBgObject.setZOrder(-2); break;case "ProfilePicBaseFrame":this._profilePicBaseFrame=b;break;case "ProfilePicBaseFrame2":this._profilePicBaseFrame2=b;break;case "ScrollArea":this._scroller.setScrollBase(b);break;case "MainRect":this._mainRect=b;break;case "FrameTick":this._frameTick=b;this._frameTick.x=this._frameTick.w/2;this._frameTick.y=this._frameTick.h/2;this._frameTickObject=RSUtils.createBasicObject(a,b);this._frameTickObject.setZOrder(2);break;case "ProfilePicBase":this._screenName=a;this._profilePicBase=b;break;case "EmojiRect":this._scroller= new RSBarScroller(new RSRect(b.x,b.y,b.w,b.h),new RSSize(this._profilePicBase.w,this._profilePicBase.h),this._avatarDetails.margin?this._avatarDetails.margin:0,RSScrollerDirection.RSSCROLLER_VERTICAL,this._avatarDetails.avatarsPerRow?this._avatarDetails.avatarsPerRow:6,this._avatarDetails.rowPadding?this._avatarDetails.rowPadding:0),this.addChild(this._scroller),c=new RSDisplayObject(new RSRect(b.x,b.y,b.w+50,b.h)),this.addChild(c),c.setAnchorPoint(0.5,0.5),this._scroller.setMouseWheelScrollBase(c, 20,0.2)}},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){a=a.getName();-1!=a.indexOf("frame")&&(this._confirmBtn.setTouchEnabled(!0),0==this._currentSelectedAvatarIndex?(this._avatarImages[this._currentSelectedAvatarIndex].removeChild(this._frameBgObject),this._avatarImages[this._currentSelectedAvatarIndex].removeChild(this._frameTickObject)):(this._avatarImages[this._currentSelectedAvatarIndex-1].removeChild(this._frameBgObject), this._avatarImages[this._currentSelectedAvatarIndex-1].removeChild(this._frameTickObject)),"frame0"==a?(this._maskImage1&&this._maskImage2&&(this._frameTickObject.setZOrder(2),this._maskImage1.setVisible(!1),this._maskImage2.setVisible(!0)),this._currentSelectedAvatarIndex=1,this._avatarImages[0].addChild(this._frameBgObject),this._avatarImages[0].addChild(this._frameTickObject)):(this._maskImage1&&this._maskImage2&&(this._frameTickObject.setZOrder(2),this._maskImage1.setVisible(!0),this._maskImage2.setVisible(!1)), a=a.split("frame"),this._currentSelectedAvatarIndex=1*a[1],this._avatarImages[a[1]-1].addChild(this._frameBgObject),this._avatarImages[a[1]-1].addChild(this._frameTickObject)))}});var RSLosingStreakPopup=RSPopup.extend({_giftBox1:null,_giftBox2:null,_giftBox3:null,_assetFolder:null,_fontDetails:null,_displayPanel:null,_glowAnim1:null,_glowAnim2:null,_glowAnim3:null,_pick1Btn:null,_pick2Btn:null,_pick3Btn:null,_credit1:null,_credit2:null,_credit3:null,_txtInfo:null,_rewardValue:null,init:function(a,b){this._assetFolder=a.assetPath;this._fontDetails=a.fonts;var c=new RSRect(0,0,0,0);this._displayPanel=new RSDisplayObject(c);this._super.init.call(this,b)},loadContent:function(){this.layoutScreen(this._assetFolder); this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.addChild(this._displayPanel);RSAnalyticsManager.getInstance().trackGUIEvent("losing_streak","trigger","","");if(this._txtInfo1){var a=RSGame.getInstance().getLosingStreakManager().getLSBonusSheet().bonusPickTextPre.toString().split("\\n");this._txtInfo.setString(a[0]);this._txtInfo1.setString(a[1]);this.addChild(this._txtInfo1)}},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this, a,b,c);switch(c.name){case "1GiftAnim":this._giftBox1=a;this._giftBox1.stopAnimation();this._giftBox1.setFrame(0);break;case "2GiftAnim":this._giftBox2=a;this._giftBox2.stopAnimation();this._giftBox2.setFrame(0);break;case "3GiftAnim":this._giftBox3=a;this._giftBox3.stopAnimation();this._giftBox3.setFrame(0);break;case "GlowAnim1":this._glowAnim1=a;this._glowAnim1.stopAnimation();this._glowAnim1.setFrame(0);break;case "GlowAnim2":this._glowAnim2=a;this._glowAnim2.stopAnimation();this._glowAnim2.setFrame(0); break;case "GlowAnim3":this._glowAnim3=a;this._glowAnim3.stopAnimation();this._glowAnim3.setFrame(0);break;case "Pick1Btn":this._pick1Btn=a;break;case "Pick2Btn":this._pick2Btn=a;break;case "Pick3Btn":this._pick3Btn=a}},createCustomObject:function(a,b){switch(b.name){case "Credit1":this._credit1=new RSScaledLabel("",this._fontDetails.CREDITS_FONT,b,kTEXT_ALIGNMENT_CENTER);this._credit1.setString(RSUtils.formatNumberWithComma(this._getLSReward()));this._credit1.setOpacity(0);this.addChild(this._credit1); break;case "Credit2":this._credit2=new RSScaledLabel("",this._fontDetails.CREDITS_FONT,b,kTEXT_ALIGNMENT_CENTER);this._credit2.setString(RSUtils.formatNumberWithComma(this._getLSReward()));this._credit2.setOpacity(0);this.addChild(this._credit2);break;case "Credit3":this._credit3=new RSScaledLabel("",this._fontDetails.CREDITS_FONT,b,kTEXT_ALIGNMENT_CENTER);this._credit3.setString(RSUtils.formatNumberWithComma(this._getLSReward()));this._credit3.setOpacity(0);this.addChild(this._credit3);break;case "txtInfo":this._txtInfo= new RSScaledLabel("",this._fontDetails.INFO_FONT,b,kTEXT_ALIGNMENT_CENTER);this._txtInfo.setString(RSGame.getInstance().getLosingStreakManager().getLSBonusSheet().bonusPickTextPre);this.addChild(this._txtInfo);break;case "txtInfo1":this._txtInfo1=new RSScaledLabel("",this._fontDetails.INFO_FONT,b,kTEXT_ALIGNMENT_CENTER)}},_getLSReward:function(){var a=RSGame.getInstance().getLosingStreakManager().getLosingStreakingValues();return this._rewardValue=parseFloat(a.coinsPurchased)*RSGame.getInstance().getLosingStreakManager().getLSBonusSheet().rewardPercent}, onButtonClicked:function(a){switch(a){case "Pick1Btn":this._giftBox1.playAnimation(1,0.2,this._onGiftCollected.bind(this,1));RSEngine.audioManager.playEffect(this._assetFolder[0].name+"_GiftBox.mp3",!1);this._removeButton();break;case "Pick2Btn":this._giftBox2.playAnimation(1,0.2,this._onGiftCollected.bind(this,2));RSEngine.audioManager.playEffect(this._assetFolder[0].name+"_GiftBox.mp3",!1);this._removeButton();break;case "Pick3Btn":this._giftBox3.playAnimation(1,0.2,this._onGiftCollected.bind(this, 3)),RSEngine.audioManager.playEffect(this._assetFolder[0].name+"_GiftBox.mp3",!1),this._removeButton()}},_onGiftCollected:function(a){this["_credit"+a]&&this["_credit"+a].fadeIn(0.1);this["_glowAnim"+a]&&this["_glowAnim"+a].playAnimation(1,1);a=new RSPoint(this["_giftBox"+a].getX(),this["_giftBox"+a].getY());RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(a,this._displayPanel,this._onCoinAnimComplete.bind(this),GameFeatureTypeEnum.PRIMARY_CURRENCY)},_onCoinAnimComplete:function(){RSCasinoManager.addPrimaryCurrency(this._rewardValue, !0);RSEngine.dataManager.saveUserBlobParams();RSEngine.externalGameManager&&RSEngine.externalGameManager.isSpinGameActive()&&RSEngine.externalGameManager.reloadExternalGame();RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"losing_streak",this._rewardValue,this._getCurrentMachineName());this.closePopup()},_getCurrentMachineName:function(){var a="";return a="gameplay_screen"==RSAnalyticsManager.getInstance().getCurrentScreen()?RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName(): RSAnalyticsManager.getInstance().getCurrentScreen()},_removeButton:function(){this._pick1Btn.setTouchEnabled(!1);this._pick2Btn.setTouchEnabled(!1);this._pick3Btn.setTouchEnabled(!1);RSAnalyticsManager.getInstance().trackGUIEvent("losing_streak","click","","")},unloadContent:function(){this._super.unloadContent.call(this)}});var FreeSpinCountdownPopup=RSPopup.extend({init:function(a,b){this._spinCountDown=b;this._assetList=a;this._super.init.call(this,null)},loadContent:function(){this.layoutScreen(this._assetList+"FreeSpinCount");this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._showSpinCountDown()},createCustomObject:function(a,b){switch(b.name){case "FreeSpinCount":this._countTxt=new RSLabelBMFont(this._spinCountDown+" Free Spins Remaining",MachineGiftingConfig.titleFontName, 4*b.w,kTEXT_ALIGNMENT_CENTER),this._countTxt.setCenter(b.x,b.y),this.addChild(this._countTxt)}},_showSpinCountDown:function(){this._countTxt.actionZoomInOut(0.8,2,0,1,this.closePopup.bind(this))},unload:function(){this._super.unload.call(this)}});var MachineGiftingManager=function(){var a,b=RSClass.extend({init:function(){this._freeSpinStatus=this._tempUnlockStatus=!1;this._freeSpinMachine=[];this._giftedMachineList={};this._remainingFreeSpinCount=this._freeSpinCount=this._unlockTime=0;this._popupList=[];this._freeSpinPopups=[];this._setGiftData()},_setGiftData:function(){var a=RSEngine.dataManager.getMe().getUnlockedGifts(),b=Object.keys(a);if(0!=b.length){for(var e=b.length-1;0<=e;e--)a[b[e]].unlock_time<TimeManager.getInstance().getCurrentServerTime()&& b.splice(e,1);if(0!=b.length)for(e=0;e<b.length;e++)if(0!=a[b[e]].duration)for(e=0;e<b.length;e++)this._setTemporaryUnlockValues(b[e],a[b[e]].event_id,a[b[e]].unlock_time)}},setMachineTemporaryUnlockTimer:function(){this._unlockRemainingTime=-1;var a=RSGame.getInstance().getGameManager().getCurrentMachineVO();this._message="Hope you enjoyed the gift. Come back for more.";if(0!=Object.keys(this._giftedMachineList).length){for(var b=RSEngine.dataManager.getMe().getUnlockedGifts(),e=Object.keys(b),f= 0;f<e.length;f++)if(e[f]==a.machine_identifier&&0!=b[e[f]].duration){var g=b[e[f]].event_id;this._unlockRemainingTime=this.getUnlockRemainingTime(g);break}if(-1!=this._unlockRemainingTime&&0==this._unlockRemainingTime&&(RSEventManager.getInstance().dispatchEvent("LOCK_GIFTING_MACHINE"),!this.getFreeSpinStatus())){this._unlockedMachineList=[];b=RSEngine.dataManager.getMe().getUnlockedGifts();e=Object.keys(b);for(f=0;f<e.length;f++)b[e[f]].event_id==g&&this._unlockedMachineList.push(e[f]);this._tempUnlockStatus= !1;RSEngine.popupManager.addPopup(new SpinGiftingPopup(this._title,this._message,0,this._unlockedMachineList,this._onBackButton.bind(this,g),this._isExpired,0))}}this.getFreeSpinStatus()&&a.machine_identifier==this.getFreeSpinMachine()[0]&&!RSCasinoManager.getCasinoInterface().isFreeSpinAvailable()&&(this._remainingFreeSpinCount=this._getFreeSpinRemainingCount(),0!=this._remainingFreeSpinCount&&this._showCountDown(),0==this._remainingFreeSpinCount&&(this._unlockedMachineList=this.getFreeSpinMachine(), this._freeSpinStatus=!1,this._resetFreeSpinValues(),RSEngine.popupManager.addPopup(new SpinGiftingPopup(this._title,this._message,0,this._unlockedMachineList,this._onBackButton.bind(this,0),this._isExpired,0))))},_showCountDown:function(){this._freeSpinPopups.push(function(){RSEngine.popupManager.addPopup(new FreeSpinCountdownPopup(MachineGiftingConfig.assetFolder,this._remainingFreeSpinCount))}.bind(this))},resetTempUnlockvalues:function(a){RSAnalyticsManager.getInstance().getCurrentScreen()==RSGameScreens.Machine&& (this._title="Machine unlock timed out",this._isExpired="invalid",this._removeTemporaryUnlockEvent(a))},_resetFreeSpinValues:function(){this._title="Your free spins are complete";this._isExpired="invalid";this._setFreeSpinMachine([]);this._setFreeSpinCount(0)},setMachineUnlockValues:function(a,b,e){this._isExpired=b;if("valid"==this._isExpired){0<Object.keys(e).length&&RSEngine.dataManager.getMe().setUnlockedGifts(e);this._unlockedMachineList=a.machine_name;if(0==parseInt(a.duration))this._setFreeSpinCount(parseInt(a.free_spin)), this._setFreeSpinMachine(a.machine_name),RSAnalyticsManager.getInstance().trackInHouseEvent("gifting","spin_pack","",parseInt(a.free_spin),a.machine_name[0],"");else{var f=Object.keys(e);for(b=f.length-1;0<=b;b--)e[f[b]].unlock_time<TimeManager.getInstance().getCurrentServerTime()&&f.splice(b,1);if(0!=f.length)for(b=0;b<f.length;b++)this._setTemporaryUnlockValues(f[b],e[f[b]].event_id,e[f[b]].unlock_time);if("all_machines"==a.machine_name[0])RSAnalyticsManager.getInstance().trackInHouseEvent("gifting", "temp_machine_unlock","",parseInt(a.duration),"all_machines","");else{e="";for(b=0;b<a.machine_name.length;b++)e=b==a.machine_name.length-1?e+a.machine_name[b]:e+(a.machine_name[b]+" ,");RSAnalyticsManager.getInstance().trackInHouseEvent("gifting","temp_machine_unlock","",parseInt(a.duration),e,"")}RSEngine.dataManager.saveUserBlobParams();0<parseInt(a.free_spin)&&(RSAnalyticsManager.getInstance().trackInHouseEvent("gifting","spin_pack","",parseInt(a.free_spin),a.machine_name[0],""),this._setFreeSpinCount(parseInt(a.free_spin)), this._setFreeSpinMachine(a.machine_name))}this._tempUnlockStatus=!0;this._remainingFreeSpinCount=this._freeSpinCount;this._unlockMessage=a.message;this._title="Spin more to win more";RSEventManager.getInstance().dispatchEvent("UNLOCK_GIFTING_MACHINE");this._popupList.push(function(){RSEngine.popupManager.addPopup(new SpinGiftingPopup(this._title,this._unlockMessage,this._freeSpinCount,this._unlockedMachineList,this._onPopupClose.bind(this),this._isExpired,parseInt(a.duration),a.event_id))}.bind(this))}}, _onPopupClose:function(){!0==this._freeSpinStatus&&RSAnalyticsManager.getInstance().trackInHouseEvent("gifting","skip_spin_pack","",this._freeSpinCount,this._unlockedMachineList[0],"");this._freeSpinStatus=!1;this._freeSpinMachine=[];this._setFreeSpinMachine(this._freeSpinMachine);this._setFreeSpinCount(0);this._remainingFreeSpinCount=0},_onBackButton:function(a){if(!this.getMachineAvailableStatus()&&(0!=a&&this.resetTempUnlockvalues(a),a=RSGame.getInstance().getGameManager().getCurrentMachineVO(), parseInt(a.levelRequired)>RSGame.getInstance().getLevelManager().getCurrentLevel()))RSCasinoManager.getCasinoHUD().onBackButton()},_setFreeSpinCount:function(a){this._freeSpinCount=a},getFreeSpinCount:function(){return this._freeSpinCount},_setFreeSpinMachine:function(a){this._freeSpinMachine=a},getFreeSpinMachine:function(){null==this._freeSpinMachine&&(this._freeSpinMachine=[]);return this._freeSpinMachine},_removeTemporaryUnlockEvent:function(a){delete this._giftedMachineList[a]},_getTemporaryUnlockMachineList:function(){var a= RSEngine.dataManager.getMe().getUnlockedGifts(),b=Object.keys(a);if(0!=b.length)for(var e=b.length-1;0<=e;e--)a[b[e]].unlock_time<TimeManager.getInstance().getCurrentServerTime()&&b.splice(e,1);return b},_setTemporaryUnlockValues:function(a,b,e){this._giftedMachineList[b]||(this._giftedMachineList[b]={unlockMachineList:[],unlockTime:0});this._giftedMachineList[b].unlockMachineList=a;this._giftedMachineList[b].unlockTime=e},showPopups:function(){for(;0<this._popupList.length;)this._popupList.splice(0, 1)[0]();this._popupList=[]},showFreeSpinPopups:function(){for(;0<this._freeSpinPopups.length;)this._freeSpinPopups.splice(0,1)[0]();this._freeSpinPopups=[]},getMachineAvailableStatus:function(){this._tempUnlockStatus=!1;0<this._getTemporaryUnlockMachineList().length&&(this._tempUnlockStatus=!0);return this._tempUnlockStatus},getFreeSpinStatus:function(){this._freeSpinStatus=!1;0!=this._remainingFreeSpinCount&&(this._freeSpinStatus=!0);return this._freeSpinStatus},_getFreeSpinRemainingCount:function(){this.getFreeSpinStatus()? this._remainingFreeSpinCount--:this._remainingFreeSpinCount=0;return this._remainingFreeSpinCount},getUnlockRemainingTime:function(a){if(!this.getMachineAvailableStatus()||0==a)return 0;for(var b=Object.keys(this._giftedMachineList),e=0;e<b.length;e++)if(b[e]==a)return this._unlockTime=this._giftedMachineList[a].unlockTime,a=this._unlockTime-TimeManager.getInstance().getCurrentServerTime(),0>a&&(a=0),a;return 0},isMachineGifted:function(a){var b=0<this._getTemporaryUnlockMachineList().length?this._getTemporaryUnlockMachineList(): this.getFreeSpinMachine();if("all_machines"==b[0])return!0;for(var e=0;e<b.length;e++)if(b[e]==a)return!0;return!1}});return{getInstance:function(){a||(a=new b);return a}}}();var SpinGiftingPopup=RSGenericPopup.extend({init:function(a,b,c,d,e,f,g,h){this._message=b;this._freeSpinCount=c;this._machineUniqueId=d;this._isExpired=f;this._assetFolder=MachineGiftingConfig.assetFolder;this._assetList=[{name:this._assetFolder+"G2PMachineGiftingPopup",count:1}];this._title=a;this._duration=g;this._eventId=h;this._super.init.call(this,e)},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)}, onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "Icons":this._icons=a;this._icons.setVisible(!1);"all_machines"==this._machineUniqueId[0]&&this._icons.setVisible(!0);break;case "TimerBg":this._timerBg=a,(MachineGiftingManager.getInstance().getFreeSpinStatus()&&!MachineGiftingManager.getInstance().getMachineAvailableStatus()||"invalid"==this._isExpired||0==this._duration)&&this._timerBg.setVisible(!1)}},onButtonClicked:function(a){switch(a){case "CloseBtn":this.closePopup()}}, createCustomObject:function(a,b){switch(b.name){case "Holder1":"all_machines"!=this._machineUniqueId[0]&&this._machineUniqueId[0]&&this._setSlotImage(b,this._machineUniqueId[0]);break;case "Holder2":"all_machines"!=this._machineUniqueId[0]&&1<this._machineUniqueId.length&&this._machineUniqueId[1]&&this._setSlotImage(b,this._machineUniqueId[1]);break;case "Holder3":"all_machines"!=this._machineUniqueId[0]&&!1==MachineGiftingManager.getInstance().getFreeSpinStatus()&&3==this._machineUniqueId.length&& this._machineUniqueId[2]&&this._setSlotImage(b,this._machineUniqueId[2]);break;case "txtTime":if("valid"==this._isExpired&&MachineGiftingManager.getInstance().getFreeSpinStatus()&&MachineGiftingManager.getInstance().getMachineAvailableStatus()&&0!=this._duration||0!=this._duration)this._txtTime=new RSScaledLabel("",MachineGiftingConfig.giftingTimerFont?MachineGiftingConfig.giftingTimerFont:MachineGiftingConfig.fontName,b,kTEXT_ALIGNMENT_CENTER),this._txtTime.setPosition(b.x,b.y),this._remainingTimer|| (this._remainingTimer=setInterval(this._setMachineUnlockTimer.bind(this),1E3)),this.addChild(this._txtTime);break;case "txtMessage1":this._txtMsg1=new RSScaledLabel("",MachineGiftingConfig.fontName,b,kTEXT_ALIGNMENT_CENTER);this._txtMsg1.setPosition(b.x,b.y);this.addChild(this._txtMsg1);0!=this._freeSpinCount?this._txtMsg1.setString(this._message+" "+this._freeSpinCount):this._txtMsg1.setString(this._message);break;case "MainTitle":this._title=this._title.toString().toUpperCase(),this._mainTitle= new RSScaledLabel(this._title,MachineGiftingConfig.titleFontName,b,kTEXT_ALIGNMENT_CENTER),this._mainTitle.setPosition(b.x,b.y),this.addChild(this._mainTitle)}return this._super.createCustomObject.call(this,a,b)},_setMachineUnlockTimer:function(){this._remainingTime=MachineGiftingManager.getInstance().getUnlockRemainingTime(this._eventId);var a=RSUtils.formattedTime(parseInt(this._remainingTime));this._txtTime.setString(a)},_setSlotImage:function(a,b){if(0<this._machineUniqueId.length){var c=new RSImageObject, d=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots,b),d=RSGame.getInstance().getGameManager().getSlotMachineIconRootPath()+d.imageName;c.setImageFromUrl(d,a.x,a.y,a.w,a.h);c.setRect(a.x,a.y,a.w,a.h);c.setAnchorPoint(0.5,0.5);c.setName(a.name);"valid"==this._isExpired&&c.addTouchListenerWithDelegate(this);2==this._machineUniqueId.length&&c.setPosition(a.x+125,a.y);this.addChild(c)}},handleObjectTouchAt:function(a,b,c){"Holder1"==a.getName()?this._onIconClicked(this._machineUniqueId[0]): "Holder2"==a.getName()?this._onIconClicked(this._machineUniqueId[1]):"Holder3"==a.getName()&&this._onIconClicked(this._machineUniqueId[2])},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){},_onIconClicked:function(a){RSEngine.externalGameManager.unLoadExternalGame();RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Slots,a,RSGameScreens.MainLobby);this._callback=null;this.closePopup()},unloadContent:function(){clearInterval(this._remainingTimer);this._super.unloadContent.call(this)}});var DailyBonusWidgetController=RSWidgetController.extend({_delegate:null,init:function(a,b,c){this._super.init.call(this,a,b,c);this._rewardController=null;this._dailyBonusActive=!1;this._dailyBonusStreakCount=0;this._dailyBonusMultiplier=1;this._subWidgetPostionHolder={};this._retryCount=this._totalwin=this._winCurrencyType=0;this._shouldSkipCoinAnimation=null;this._dailyBonusWheelWedgeIndex=-1},getName:function(){return"DailyBonusWidgetController"},getAssetFolder:function(){return RSGame.getInstance().getAssetFolder(this._controllerName)}, onControllerAdded:function(){this.loadModelData();this.getDailyBonusStatus()},setDailyBonusStatus:function(a){(this._dailyBonusActive=a)?RSGame.getInstance().getUserDataManager().getMe().setDailyBonusState(0):RSGame.getInstance().getUserDataManager().getMe().setDailyBonusState(2)},loadModelData:function(){this.getModel().loadModelData()},setDelegate:function(a){this._delegate=a},onControllerRemoved:function(){this._view.unload();this._model.unload()},_calculateMultiplier:function(){var a=this.getModel().getLevelMultiplierValues(); if(a)for(var b=RSGame.getInstance().getLevelManager().getCurrentLevel(),c=a.length-1;0<=c;c--)if(b>=parseInt(a[c].level)){this._dailyBonusMultiplier=parseInt(a[c].multiplier);break}},_getConfigAssetFile:function(){return RSGame.getInstance().getAssetFolder("DailyBonusScreen")+"DailyBonusConfig.json"},getConfigData:function(){return this.getModel().getConfigData()},getFontLabel:function(a){var b=this.getModel().getFontDetailsForKey(a.name);if(b){var c=RSGame.getInstance().getAssetPath(b.fontName), d=kTEXT_ALIGNMENT_LEFT,e=b.isScaledLabel?b.isScaledLabel:!1;if(b.alignment)switch(b.alignment){case "Left":d=kTEXT_ALIGNMENT_LEFT;break;case "Right":d=kTEXT_ALIGNMENT_RIGHT;break;case "Center":d=kTEXT_ALIGNMENT_CENTER}var f=null;e?f=new RSScaledLabel("",c,a,d):(f=new RSLabelBMFont("",c,a.w,d),f.setCenter(a.x,a.y),f.setScale(b.scale?b.scale:1));b.color&&(a=b.color,f.setColor(new RSColor(a.r,a.g,a.b)));return f}cc.log("font details not found:"+a.name);return null},createDailyBonusView:function(a){if(!this._rewardController){this._calculateMultiplier(); var b=[],c={},d=this.getConfigData()[this.getModel().getDailyBonusViewType()];switch(this.getModel().getDailyBonusViewType()){case DailyBonusTypes.Static:c.name="res/PlatformWidgets/DailyBonus/StaticReward/StaticDailyBonusPopup";c.count=1;b=[{name:RSGame.getInstance().getAssetPath("StaticReward"),count:1}];d=new StaticRewardWidgetModel(b,"StaticRewardData");d.InitModelData(this.dailyBonusDayCount(),this.getFontName(),this._dailyBonusMultiplier);this._rewardController=new StaticRewardWidgetController(d, new StaticRewardWidgetView("staticRewardWidget"),"staticRewardWidget");this._rewardController.setDelegate(this);RSWidgetsManager.getInstance().addController(this._rewardController,"staticRewardWidget");break;case DailyBonusTypes.Scratcher:c.name="res/PlatformWidgets/DailyBonus/Scratcher/DailyScratcherPopup";c.count=1;b.push(c);d=new ScratcherRewardWidgetModel(b,["scratcherReward","scratcherCount"]);d.InitModelData(this.dailyBonusDayCount(),this._dailyBonusMultiplier);this._rewardController=new ScratcherRewardWidgetController(d, new ScratcherRewardWidgetView("scratcherRewardWidget"),"scratcherRewardWidget");RSWidgetsManager.getInstance().addController(this._rewardController,"scratcherRewardWidget");this._rewardController.setDelegate(this);break;case DailyBonusTypes.Wheel:d._parentRectWidth=a.w,d._parentRectHeight=a.h,d._spinWheelPayOutData=RSUtils.cloneJSON(RSEngine.gameData.getSpinWheelData()),b=new WheelSpinWidgetModel(null),b.InitModelData(this._dailyBonusMultiplier,d,this._dailyChallengeBonusMultiplier,this._dailyBonusWheelWedgeIndex), this._rewardController=new WheelSpinWidgetController(b,new WheelSpinWidgetView("WheelSpinWidget")),RSWidgetsManager.getInstance().addController(this._rewardController,"WheelSpinWidget"),this._rewardController.setDelegate(this)}this.getView().setDailyBonusView(this._rewardController.getView(),a)}},getDailyBonusStatus:function(){GameConfig.DAILY_BONUS_V3?RSEngine.dataManager.getDailyBonusStatusV3(!1,0,0,0,this._onDailyBonusStatusCheckCompleted.bind(this),this._onDailyBonusStatusCheckFailed.bind(this)): GameConfig.RETENTION_WHEEL||GameConfig.DAILY_BONUS_V2?RSEngine.dataManager.getDailyBonusStatusV2(!1,0,0,0,this._onDailyBonusStatusCheckCompleted.bind(this),this._onDailyBonusStatusCheckFailed.bind(this)):RSEngine.dataManager.getDailyBonusStatus(!1,0,-1,this._onDailyBonusStatusCheckCompleted.bind(this),this._onDailyBonusStatusCheckFailed.bind(this))},_onDailyBonusStatusCheckSuccessCallback:function(){if(this._delegate&&this._delegate.onDailyBonusStatusCheckSuccess)this._delegate.onDailyBonusStatusCheckSuccess()}, _onDailyBonusStatusCheckCompleted:function(a){this._retryCount=0;a.result&&(0===a.result.data.remainingTime?(a.result.data.hasOwnProperty("dailyBonusWedgeIndex")&&(this._dailyBonusWheelWedgeIndex=parseInt(a.result.data.dailyBonusWedgeIndex)),this.setDailyBonusStatus(!0),RSUtils.loadJsonAsyc(this._getConfigAssetFile(),null,function(a){this.getModel().setConfigData(a);this._onDailyBonusStatusCheckSuccessCallback()}.bind(this))):this._onDailyBonusStatusCheckSuccessCallback(),this._retentionDay=a.result.data.dailyBonusPickedCount, "true"==a.result.data.dailyBonusPurchaseStatus&&this.getModel().setReplayMode(!0),this._dailyBonusStreakCount=parseInt(a.result.data.dailyBonusPickedCount),this._dailyChallengeBonusMultiplier=parseInt(a.result.data.dailyBonusMultiplier),this.getModel().setDailyChallengeBonusMultiplier(this._dailyChallengeBonusMultiplier))},_onDailyBonusStatusCheckFailed:function(a){3>this._retryCount?(this._retryCount++,this.getDailyBonusStatus()):(this._retryCount=0,RSErrorTracker.getInstance().trackErrorMessage("DAILY_BONUS_REWARD", "Error collecting daily bonus reward","mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"))},rewardDailyBonus:function(a){this._shouldSkipCoinAnimation=a;this.showOverlayLayer();GameConfig.DAILY_BONUS_V2?(a=RSGame.getInstance().getGameManager().isVipPercentageCalculation(),RSEngine.dataManager.getDailyBonusStatusV2(!0,this._rewardController.getView().getSelectedWedge(),this.getFriendsCount(),a,this._onDailyBonusRewardCompletedV2.bind(this),this._onDailyBonusRewardFailed.bind(this))):GameConfig.DAILY_BONUS_V3? (a=RSGame.getInstance().getGameManager().isVipPercentageCalculation(),RSEngine.dataManager.getDailyBonusStatusV3(!0,this._rewardController.getView().getSelectedWedge(),this.getFriendsCount(),a,this._onDailyBonusRewardCompletedV3.bind(this),this._onDailyBonusRewardFailed.bind(this))):GameConfig.RETENTION_WHEEL?RSEngine.dataManager.getDailyBonusStatusV2(!0,this._rewardController.getView().getSelectedWedge(),null,null,this._onRetentionRewardCompleted.bind(this),this._onDailyBonusRewardFailed.bind(this)): RSEngine.dataManager.getDailyBonusStatus(!0,this.getModel().getTotalWin(),this._winCurrencyType,this._onDailyBonusRewardCompleted.bind(this),this._onDailyBonusRewardFailed.bind(this))},_onDailyBonusRewardCompleted:function(a){this._retryCount=0;a.result&&(!0==a.result.data.rewardStatus&&(this.trackAnalytics(a.result.data),URLConfig.CLEVERTAP_ENABLED?RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.dailyBonusCollect,"",{Day:this._dailyBonusStreakCount}):RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.dailyBonusCollect, this.getModel().getTotalWin()),RSEventManager.getInstance().dispatchEvent("DailyBonusQuestAction",this.getModel().getTotalWin()),RSEngine.dataManager.getMe().syncBlobVars(a.result.data)),RSWidgetsManager.getInstance().removeController(this._rewardController),this._delegate&&this._delegate.removeWidget(this._shouldSkipCoinAnimation),this.hideOverlayLayer(),this.setDailyBonusStatus(!1))},_onDailyBonusRewardCompletedV2:function(a){this._retryCount=0;a.result&&(!0==a.result.data.rewardStatus&&(this.trackAnalyticsV2(a.result.data.bonusArray), URLConfig.CLEVERTAP_ENABLED?RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.dailyBonusCollect,"",{Day:this._dailyBonusStreakCount}):RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.dailyBonusCollect,a.result.data.bonusArray.totalBonus),RSEventManager.getInstance().dispatchEvent("DailyBonusQuestAction",a.result.data.bonusArray.totalBonus),RSEngine.dataManager.getMe().syncBlobVars(a.result.data)),RSWidgetsManager.getInstance().removeController(this._rewardController),this._delegate&& this._delegate.removeWidget(this._shouldSkipCoinAnimation),this.hideOverlayLayer(),this.setDailyBonusStatus(!1))},_onDailyBonusRewardCompletedV3:function(a){this._retryCount=0;a.result&&(!0==a.result.data.rewardStatus&&(this.trackAnalyticsV2(a.result.data.bonusArray,a.result.data.rewardPoints),URLConfig.CLEVERTAP_ENABLED?RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.dailyBonusCollect,"",{Day:this._dailyBonusStreakCount}):RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.dailyBonusCollect, a.result.data.bonusArray.totalBonus),RSEventManager.getInstance().dispatchEvent("DailyBonusQuestAction",a.result.data.bonusArray.totalBonus),RSEngine.dataManager.getMe().syncBlobVars(a.result.data)),0<a.result.data.bonusArray.totalBonus.rewardPoints&&RSEventManager.getInstance().dispatchEvent("updateLMPoints"),RSWidgetsManager.getInstance().removeController(this._rewardController),this._delegate&&this._delegate.removeWidget(this._shouldSkipCoinAnimation),this.hideOverlayLayer(),this.setDailyBonusStatus(!1))}, _onRetentionRewardCompleted:function(a){this._retryCount=0;if(a.result){!0==a.result.data.rewardStatus&&(URLConfig.CLEVERTAP_ENABLED?RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.dailyBonusCollect,"",{Day:this._dailyBonusStreakCount}):RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.dailyBonusCollect,this.getModel().getTotalWin()),RSEventManager.getInstance().dispatchEvent("DailyBonusQuestAction",this.getModel().getTotalWin()),RSEngine.dataManager.getMe().syncBlobVars(a.result.data)); var b=[];b.remainingTime=a.result.data.remainingTime;b.day=a.result.data.dailyBonusPickedCount;b.dailyBonusMultiplier=a.result.data.dailyBonusMultiplier;RSGame.getInstance().getGameManager().retentionBonus=b;RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.ECONOMY,"free_source_coins","daily_retention_"+this.dailyBonusDayCount().toString(),this.getModel().getTotalWin().toString(),"metagame","");RSWidgetsManager.getInstance().removeController(this._rewardController);this._delegate&& this._delegate.removeWidget(this._shouldSkipCoinAnimation);this.hideOverlayLayer();this.setDailyBonusStatus(!1)}},_onDailyBonusRewardFailed:function(){3>this._retryCount?(this._retryCount++,this.rewardDailyBonus(this._shouldSkipCoinAnimation)):(this._retryCount=0,RSErrorTracker.getInstance().trackErrorMessage("DAILY_BONUS_REWARD","Error collecting daily bonus reward","mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"))},trackAnalytics:function(a){if(this.getModel().getReplayMode())2=== this._dailyChallengeBonusMultiplier?RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"daily_bonus",this.getModel().retCalcDB(),"metagame","spin_2x"):RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"daily_bonus",this.getModel().retCalcDB(),"metagame",this.getModel().getDailyBonusViewType()),0<this.getVipMultiplierValue()&&(b=100*Math.ceil(this.getModel().retCalcDB()*this.getVipMultiplierValue()/100),RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.paid, "vip_bonus",b,"metagame",this.getVipMultiplierValue(!0)));else{this.getModel().getDailyBonusViewType()!=DailyBonusTypes.Scratcher&&RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"retention_bonus",this.getRetentionBonusValue(),"metagame",this.dailyBonusDayCount());0<this.getFriendsBonusValue()&&RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"friend_bonus",this.getFriendsBonusValue(),"metagame",this.getFriendsCount());if(1<this.getVipMultiplierValue()){var b= 100*Math.round(this.getModel().retCalcDB()*(this.getVipMultiplierValue()-1)/100);RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"vip_bonus",b,"metagame",this.getVipMultiplierValue(!0))}0<this.getReturnBonusBoxValue()&&RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"retention_bonus",this.getReturnBonusBoxValue(),a.rewardPoints,a.dailyBonusPickedCount);2===this._dailyChallengeBonusMultiplier?RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free, "daily_bonus",this.getModel().retCalcDB(),"metagame","spin_2x"):5==this._winCurrencyType?RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"daily_bonus",a.rewardPointsAdded,a.rewardPoints,this.getModel().getDailyBonusViewType()===DailyBonusTypes.Wheel?"wheel_spin":this.getModel().getDailyBonusViewType()):RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"daily_bonus",this.getModel().retCalcDB(),"metagame",this.getModel().getDailyBonusViewType()=== DailyBonusTypes.Wheel?"wheel_spin":this.getModel().getDailyBonusViewType())}},trackAnalyticsV2:function(a,b){if(this.getModel().getReplayMode())2===this._dailyChallengeBonusMultiplier?RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"daily_bonus",a.dailyBonus,"metagame","spin_2x"):RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"daily_bonus",a.dailyBonus,"metagame",this.getModel().getDailyBonusViewType()),RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.paid, "vip_bonus",a.vipBonus,"metagame",this.getVipMultiplierValue(!0));else{this.getModel().getDailyBonusViewType()!=DailyBonusTypes.Scratcher&&(GameConfig.DAILY_BONUS_V3&&a.retentionBonus?(a.retentionBonus.coins&&RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"retention_bonus",a.retentionBonus.coins,"metagame",this.dailyBonusDayCount()),a.retentionBonus.rewardPoints&&RSAnalyticsManager.getInstance().trackInHouseEvent("economy","free_source_points","retention_bonus",a.retentionBonus.rewardPoints, b,this.dailyBonusDayCount())):RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"retention_bonus",a.retentionBonus,"metagame",this.dailyBonusDayCount()));RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"friend_bonus",a.friendBonus,"metagame",this.getFriendsCount());RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"vip_bonus",a.vipBonus,"metagame",this.getVipMultiplierValue(!0));2<=this._dailyChallengeBonusMultiplier?GameConfig.DAILY_BONUS_V3? (a.dailyBonus.coins&&RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"daily_bonus",a.dailyBonus.coins,"metagame","spin_2x"),a.dailyBonus.rewardPoints&&RSAnalyticsManager.getInstance().trackInHouseEvent("economy","free_source_points","daily_bonus",a.dailyBonus.rewardPoints,b,"wheel_spin")):RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"daily_bonus",a.dailyBonus,"metagame","spin_2x"):GameConfig.DAILY_BONUS_V3?(a.dailyBonus.coins&&RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free, "daily_bonus",a.dailyBonus.coins,"metagame",this.getModel().getDailyBonusViewType()===DailyBonusTypes.Wheel?"wheel_spin":this.getModel().getDailyBonusViewType()),a.dailyBonus.rewardPoints&&RSAnalyticsManager.getInstance().trackInHouseEvent("economy","free_source_points","daily_bonus",a.dailyBonus.rewardPoints,b,"wheel_spin")):RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"daily_bonus",a.dailyBonus,"metagame",this.getModel().getDailyBonusViewType()===DailyBonusTypes.Wheel? "wheel_spin":this.getModel().getDailyBonusViewType());var c=parseInt(a.vipBonus),c=c+a.dailyBonus;c<parseInt(this._vipWidgetController.getView().getDisplayedWinText())&&(this._vipWidgetController.getView().getDisplayedWinText(),this._rewardController.getView().getWinAmount())}},_getRollupAmountWithKey:function(a){var b=0;switch(a){case "VIPBonusReward":b=RSGame.getInstance().getGameManager().getModifiedVIPMultiplier();a=this.getVipMultiplierValue();null!=b?(b=parseInt(this._model.retCalcDB()*(a?a: 1)),a=parseInt(b%100),a==b?b+=100-b:0<a&&(b+=100-a)):b=this._model.retCalcDB()*(a?a:1);break;case "RetentionBonusReward":b=this.getRetentionBonusValue();break;case "FriendBonusReward":b=this.getFriendsBonusValue();break;case "FinalValue":b=this.getModel().getTotalWin();break;case "ReturnBonusBoxReward":b=this.getReturnBonusValue()}return b},getReturnBonusValue:function(){var a=RSGame.getInstance().getGameData().getSheetData("dailyBonusConfig")[0].FoxPlayPoints;return parseInt(a)},startWinRollup:function(a, b,c){"TotalAmount"==b&&"VIPBonusReward"==c&&5==this._winCurrencyType?this.getView().startWinRollup(a,"HeartValue",this._totalwin):(c=this._getRollupAmountWithKey(c),this.getView().startWinRollup(a,b,c))},setFinalTextValue:function(a,b){var c=this._getRollupAmountWithKey(b);this.getView().setFinalTextValue(a,c)},onSequenceComplete:function(){},_onIntroAnimCompleted:function(){if(this.getModel().getDailyBonusViewType()===DailyBonusTypes.Wheel&&1===this._dailyChallengeBonusMultiplier)this._rewardController.onSpinClicked(); else 2===this._dailyChallengeBonusMultiplier&&this._rewardController.handleDoubleBonusTransformation(this._onTransformationCompletion.bind(this));cc.log("intro anim completed")},_onTransformationCompletion:function(){this._rewardController.onSpinClicked()},onSequencerDataLoaded:function(){this.getView().setVisible(!0);if(this.getModel().getDailyBonusViewType()==DailyBonusTypes.Wheel&&this._rewardController.isArtLoaded())if(1==parseInt(RSEngine.gameData.getDefaultValues().IsWheelSkipEnabled)&&1==RSEngine.dataManager.getMe().getDailyBonusState()){2=== this._dailyChallengeBonusMultiplier&&this._rewardController.getView().doublePayOut();this._rewardController.getView().setSelectedWedge();var a=this._rewardController.getView().getWinAmount(),b=this._rewardController.getView().getWinCurrencyType();this.onGameplayComplete(a,b,!1,"skipWheel")}else RSGame.getInstance().getUserDataManager().getMe().setDailyBonusState(1),this._animationSequencerObject.playSequenceWithKey("intro",this._onIntroAnimCompleted.bind(this));else this.getModel().getDailyBonusViewType()== DailyBonusTypes.Wheel&&1==parseInt(RSEngine.gameData.getDefaultValues().IsWheelSkipEnabled)&&1==RSEngine.dataManager.getMe().getDailyBonusState()?(2===this._dailyChallengeBonusMultiplier&&this._rewardController.getView().doublePayOut(),this._rewardController.getView().setSelectedWedge(),a=this._rewardController.getView().getWinAmount(),b=this._rewardController.getView().getWinCurrencyType(),this.onGameplayComplete(a,b,!1,"skipWheel")):this._timer=setInterval(this.isRewardControllerLoaded.bind(this), 500)},isRewardControllerLoaded:function(){this.getModel().getDailyBonusViewType()==DailyBonusTypes.Wheel&&this._rewardController.isArtLoaded()&&(this.onSequencerDataLoaded(),clearInterval(this._timer))},onViewDrawCompleted:function(){RSAnalyticsManager.getInstance().trackGUIEvent("daily_bonus","trigger","","");this._animationSequencerObject=new RSAnimationSequencer(this.getAssetFolder(),"DailyBonusAnimConfig.json",this.getView(),this);this._animationSequencerObject.loadAnimData()},loadLayout:function(){this.getView().loadLayoutsInModel(this.getModel()); RSEventManager.getInstance().addEventListener("RS_CONNECTION_RE_ESTABLISHED",this,this._onConnectionReEstablished.bind(this))},getRetentionBonusValue:function(){if(!this.getModel().getRetensionBonusStatus())return 0;for(var a=RSEngine.gameData.getSheetData("RetentionBonusData"),b=a.length-1;0<=b;b--)if(this.dailyBonusDayCount()>=a[b].day)return parseInt(a[b].coins);return 0},getFriendsCount:function(){if(!this.getModel().getFriendsBonusStatus())return 0;var a=RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK|| RSEngine.loginMode==LOGIN_MODE.FACEBOOK?RSSocialManager.getInstance().myPlayingFriends.length:0,a=0<a?a:1,b=RSEngine.gameData.getSheetData("FriendsRewardData");return a>=parseInt(b[0].friendsCap)?parseInt(b[0].friendsCap):a},getFriendsBonusValue:function(){if(!this.getModel().getFriendsBonusStatus())return 0;var a=this.getFriendsCount(),b=RSEngine.gameData.getSheetData("FriendsRewardData");return parseInt(b[0].perFriendRwrd)*a},getReturnBonusBoxValue:function(){if(this._returnBonusBoxController)return this._returnBonusBoxController.getLoyaltyMallPointsRewarded()}, getVipMultiplierValue:function(a){if(!this.getModel().getVIPMultiplierStatus())return 1;a=RSGame.getInstance().getGameManager().getModifiedVIPMultiplier(a);if(null!=a)return a?1+a:0;if(RSVIPManager.getInstance().getVIPUserStatus())var b=RSVIPManager.getInstance().getVIPUserTier();return b?b:0},disableSubWidgets:function(){this.getModel().setReplayMode(!0);this._friendWidgetController&&this._friendWidgetController.getView()&&this._friendWidgetController.disableFeature();this._retensionWidgetController&& this._retensionWidgetController.getView()&&this._retensionWidgetController.disableFeature();this._returnBonusBoxController&&this._returnBonusBoxController.getView()&&this._returnBonusBoxController.disableFeature()},replayDailyBonus:function(){this.disableSubWidgets();this._rewardController.replayDailyBonus();this.getView().resetTotalWin();this.hideOverlayLayer()},playCoinSplashSound:function(){this._animationSequencerObject.playSequenceWithKey("coin_splash")},onGameplayComplete:function(a,b,c,d){this._totalwin= a=a?a:this._totalwin;b=b?b:this._winCurrencyType;5==b?this.getModel().setDBHeartValue(a):this.getModel().calcDB(a);this.setFinalWin();c?(this.getModel().getVIPMultiplierStatus()&&this._vipWidgetController&&this._vipWidgetController.getView().setDailyBonusWinValue(this.getModel().getDBValue(),b),this._winCurrencyType=b?b:0,this._setCurrencyTypeForWidgets(this._winCurrencyType),GameConfig.DAILY_BONUS_V3?"spinWheel"==d?(this.getView().unscheduleAllFunctions(),this.getView().startWinCelebrationEmitter(), this.getView().scheduleFunctionOnce(function(){this._animationSequencerObject.playSequenceWithKey("wheelEnd",this.wheelRotationEnd.bind(this))}.bind(this),0.5)):"returnBonus"==d&&(this.getView().unscheduleAllFunctions(),this.getView().scheduleFunctionOnce(this.onPointerAnimEnd.bind(this),0.5)):GameConfig.RETENTION_WHEEL?(this.getView().unscheduleAllFunctions(),this.getView().startWinCelebrationEmitter(),this.getView().scheduleFunctionOnce(function(){this.startWinRollup(2,"WheelWinAmount","FinalValue"); this.getView().playWheelWinAmountZoomIn();this._animationSequencerObject.playSequenceWithKey("RetentionWheelEnd",this.retentionWheelRotationEnd.bind(this))}.bind(this),0.5)):(this.getView().startWinCelebrationEmitter(),this._animationSequencerObject.playSequenceWithKey("end",function(){this.getView().stopWinCelebrationEmitter()}.bind(this)))):(this.getModel().getVIPMultiplierStatus()&&this._vipWidgetController&&this._vipWidgetController.getView().setDailyBonusWinValue(this.getModel().getDBValue(), b),this._winCurrencyType=b?b:0,this._setCurrencyTypeForWidgets(this._winCurrencyType),"skipWheel"!=d&&this.getView().startWinCelebrationEmitter(),GameConfig.DAILY_BONUS_V3?"skipWheel"==d?(this.getView().unscheduleAllFunctions(),this.getView().scheduleFunctionOnce(function(){this._animationSequencerObject.playSequenceWithKey("ShowSkippedResult")}.bind(this),0.1)):this.getView().scheduleFunctionOnce(function(){this._animationSequencerObject.playSequenceWithKey("wheelEnd",this.wheelRotationEnd.bind(this))}.bind(this), 0.5):GameConfig.RETENTION_WHEEL?this.getView().scheduleFunctionOnce(function(){this.startWinRollup(2,"WheelWinAmount","FinalValue");this.getView().playWheelWinAmountZoomIn();this._animationSequencerObject.playSequenceWithKey("RetentionWheelEnd",this.retentionWheelRotationEnd.bind(this))}.bind(this),0.5):this.getView().scheduleFunctionOnce(function(){this._animationSequencerObject.playSequenceWithKey("end",function(){this.getView().stopWinCelebrationEmitter()}.bind(this))}.bind(this),2))},wheelRotationEnd:function(){this.getView().stopWinCelebrationEmitter(); this.getView().scheduleFunctionOnce(function(){this._returnBonusController.getView().setPointerPosition(!0,this.onPointerAnimEnd.bind(this))}.bind(this),0.5)},retentionWheelRotationEnd:function(){this.getView().playCoinAnimationEmitter();this._animationSequencerObject.playSequenceWithKey("ShowResult")},onPointerAnimEnd:function(){this._animationSequencerObject.playSequenceWithKey("ShowResult")},addWidgetToScreen:function(a,b){a.setCenter(b.x,b.y);this.getView().addChild(a)},_setCurrencyTypeForWidgets:function(a){this._retensionWidgetController&& (5!=a?this._retensionWidgetController.setWinCurrencyType(a):this._retensionWidgetController.setWinCurrencyType("0"));this._vipWidgetController&&this._vipWidgetController.setWinCurrencyType(a);this._friendWidgetController&&(5!=a?this._friendWidgetController.setWinCurrencyType(a):this._friendWidgetController.setWinCurrencyType("0"));this.getView().setWinCurrencyType(a)},setFinalWin:function(){var a=this.getVipMultiplierValue();if(this.getModel().getReplayMode())this.getModel().setTotalWin(this.getModel().retCalcDB()* (a?a:1));else{a=parseInt(this.getModel().retCalcDB()*(a?a:1))+(this.getRetentionBonusValue()+this.getFriendsBonusValue());if("coins"==GameFeatureTypeEnum.PRIMARY_CURRENCY){var b=parseInt(a%100);b==a?a+=100-a:0<b&&(a+=100-b)}this.getModel().setTotalWin(a)}},setReturnBonus:function(a){if(!this._returnBonusController){var b=[{name:RSGame.getInstance().getAssetPath("ReturnBonusWidget"),count:1}],b=new ReturnBonusWidgetModel(b,this._retentionDay);b.InitModelData();this._returnBonusController=new ReturnBonusWidgetController(b, new ReturnBonusWidgetView("ReturnBonusWidget",a),"ReturnBonusWidget");RSWidgetsManager.getInstance().addController(this._returnBonusController,"ReturnBonusWidget");this._returnBonusController.setDelegate(this);this.addWidgetToScreen(this._returnBonusController.getView(),a)}},setReturnBonusBox:function(a){if(!this._returnBonusBoxController){var b=[{name:RSGame.getInstance().getAssetPath("ReturnBonusBoxWidget"),count:1}],b=new ReturnBonusBoxWidgetModel(b,this._retentionDay);this._returnBonusBoxController= new ReturnBonusBoxWidgetController(b,new ReturnBonusBoxWidgetView("ReturnBonusBoxWidget",a),"ReturnBonusBoxWidget");RSWidgetsManager.getInstance().addController(this._returnBonusBoxController,"ReturnBonusBoxWidget");this._returnBonusBoxController.getView().setZOrder(1);this.addWidgetToScreen(this._returnBonusBoxController.getView(),a)}},setRetentionBonus:function(a){if(!this._retensionWidgetController){var b=[{name:RSGame.getInstance().getAssetPath("RetentionBonusWidget"),count:1}];this.getModel().getDailyBonusViewType()!= DailyBonusTypes.Scratcher&&(this._retensionWidgetController=new RetentionRewardWidgetController(new RetentionRewardWidgetModel(b,this.dailyBonusDayCount(),this.getRetentionBonusValue()),new RetentionRewardWidgetView,a.name),RSWidgetsManager.getInstance().addController(this._retensionWidgetController,a.name),this._retensionWidgetController.getView().setZOrder(1),this.addWidgetToScreen(this._retensionWidgetController.getView(),a),this.getModel().getRetensionBonusStatus()||this._retensionWidgetController.disableFeature())}}, setVipBonus:function(a){if(!this._vipWidgetController){var b=[{name:RSGame.getInstance().getAssetPath("VipBonusWidget"),count:1}],c=this.getVipMultiplierValue();this._vipWidgetController=new VIPMultiplierBonusWidgetController(new VIPMultiplierBonusWidgetModel(b,c?c:1),new VIPMultiplierBonusWidgetView,a.name);RSWidgetsManager.getInstance().addController(this._vipWidgetController,a.name);this._vipWidgetController.getView().setZOrder(1);this.addWidgetToScreen(this._vipWidgetController.getView(),a);this.getModel().getVIPMultiplierStatus()|| this._vipWidgetController.disableFeature()}},setFriendsBonus:function(a){if(!this._friendWidgetController){var b=[{name:RSGame.getInstance().getAssetPath("FriendBonusWidget"),count:1}];this._friendWidgetController=new FriendRewardWidgetController(new FriendRewardWidgetModel(b,this.getFriendsCount(),this.getFriendsBonusValue()),new FriendRewardWidgetView,a.name);RSWidgetsManager.getInstance().addController(this._friendWidgetController,a.name);this._friendWidgetController.getView().setZOrder(1);this.addWidgetToScreen(this._friendWidgetController.getView(), a);this.getModel().getFriendsBonusStatus()||this._friendWidgetController.disableFeature()}},showPurchaseUI:function(a,b,c){var d=RSEngine.gameData.getPackById(this.getModel().getPurchasePackID());d&&(this._currentPackData=d,this._successcallback=a,this._failurecallback=b,this._cancelCallback=c,RSGame.getInstance().getGameManager().showPurchaseUI(d,this._onPurchaseSuccess.bind(this),this._onPurchaseFailure.bind(this),this._onPurchaseCancel.bind(this)))},_onPurchaseSuccess:function(a){this.hideOverlayLayer(); this._purchaseResponseObject=a;void 0!=this._successcallback&&null!=this._successcallback&&(this._successcallback(a),this._successcallback=null)},_onPurchaseCancel:function(a){void 0!=this._cancelCallback&&null!=this._cancelCallback&&(this._cancelCallback(a),this._cancelCallback=null)},_onPurchaseFailure:function(a){void 0!=this._failurecallback&&null!=this._failurecallback&&(this._failurecallback(a),this._failurecallback=null)},removeWidget:function(a){this.hideOverlayLayer();this.rewardDailyBonus(a)}, getFontName:function(){return this.getModel().getFontName()},getMultiplerFontName:function(){return this.getModel().getMultiplierFontName()},getCurrencyFontName:function(){return this.getModel().getCurrencyFontName()},getDailyBonusActive:function(){return RSEngine.loginMode==LOGIN_MODE.GUEST?!1:this._dailyBonusActive},dailyBonusDayCount:function(){return this._dailyBonusStreakCount},showOverlayLayer:function(){RSEngine.screenManager.addOverlay()},hideOverlayLayer:function(){RSEngine.screenManager.removeOverlay()}, getDailyBonusMultiplier:function(){return this._dailyChallengeBonusMultiplier},_onConnectionReEstablished:function(){this.getView().setCollectButtonStateToEnabled()}});var DailyBonusWidgetModel=RSWidgetModel.extend({_data:null,_sheetName:null,dailyBonusInterval:0,init:function(a,b){this._super.init.call(this,a);this._sheetName=b;this._totalWin=this._dailyChallengeBonusMultiplier=this._heartRewardedOnSpin=this._totalDailyBonusReward=0;this._replayMode=!1;this._fontConfig=this._configData=null},loadModelData:function(){this._data=RSEngine.gameData.getSheetData(this._sheetName)[0];this._me=RSEngine.dataManager.getMe();this._levelMultiplierValues=RSEngine.gameData.getSheetData("dailyBonusLevelMultiplier"); this._dailyBonusInterval=parseInt(this._data.dailyBonusInterval);this._purchasePackID=this._data.purchasePackID;this._dailyBonusfeedID=this._data.feedID;this._dailyBonusViewType=this._data.DailyBonusViewType;this._enableFriendsBonus=parseInt(this._data.isFriendsBonusEnabled);this._enableRetensionBonus=parseInt(this._data.isRetentionBonusEnabled);this._enableVIPMultiplier=parseInt(this._data.isVIPMultiplierEnabled)},setConfigData:function(a){this._configData=a;this._fontConfig=a.FontConfig},setDailyChallengeBonusMultiplier:function(a){this._dailyChallengeBonusMultiplier= a},getFontDetailsForKey:function(a){return this._fontConfig.FontTypeInfo[this._fontConfig.FontLabels[a]]},getConfigData:function(){return this._configData},setLayouts:function(a){this._layouts=a},getFeedID:function(){return this._dailyBonusfeedID},getLevelMultiplierValues:function(){return this._levelMultiplierValues},getFriendsBonusStatus:function(){return this._enableFriendsBonus},getRetensionBonusStatus:function(){return this._enableRetensionBonus},getVIPMultiplierStatus:function(){return this._enableVIPMultiplier}, getPurchasePackID:function(){return this._purchasePackID},getDailyBonusInterval:function(){return this._dailyBonusInterval},getDailyBonusViewType:function(){return this._dailyBonusViewType},getTotalWin:function(){return this._totalWin},setTotalWin:function(a){this._totalWin=a},setReplayMode:function(a){this._replayMode=a},getReplayMode:function(){return this._replayMode},retCalcDB:function(){return this._totalDailyBonusReward},calcDB:function(a){this._totalDailyBonusReward=a},setDBHeartValue:function(a){this._heartRewardedOnSpin= a},getDBValue:function(){return 0<this._heartRewardedOnSpin?this._heartRewardedOnSpin:this._totalDailyBonusReward}});var DailyBonusWidgetView=RSWidgetView.extend({init:function(a){this._super.init.call(this);this._controllerName=a;this._dailyBonusView=null;this._rollupDuration=1;this._isShareEnabled=!1;this.ResultPanel=null;this._winDisplay=0;this._currencyPositionHolders=[];this._prevWinForRollup=this._totalWin=this._totalWinTextCurrentValue=0;this._winCelebrationEmitter=null;this.setVisible(!1)},loadLayoutsInModel:function(){this.createOverLay();this._super.loadLayoutsInModel.call(this)},setDailyBonusView:function(a, b){this._dailyBonusView||(this._dailyBonusView=a,a.setCenter(b.x,b.y),this.addChild(this._dailyBonusView))},createOverLay:function(){var a;a=new RSDisplayObject(new RSRect(0,0,RSEngine.screenWidth,RSEngine.screenHeight));this.setSize(RSEngine.screenWidth,RSEngine.screenHeight);this.setPosition(RSEngine.screenWidth/2,RSEngine.screenHeight/2);this.addChild(a)},onMouseMoveOn:function(a){var b=a.getCurrentTarget();a=b.convertToNodeSpace(a.getLocation());b=b.getContentSize();b=cc.rect(0,0,b.width,b.height); if(cc.rectContainsPoint(b,a)&&this.isVisible())return cc.$("#gameCanvas").style.cursor="default",!0},_getEmitterFrames:function(){for(var a=[],b=0;10>b;b++){var c=RSUtils.getTextureData("DailyBonusScreen","confetti"+b+"_0000.png");c&&a.push(c.name)}return a},_initializeWinEmitter:function(){var a=RSEngine.screenWidth,b=RSEngine.screenHeight,c=this._getEmitterFrames();if(0<c.length){var d=new RSEmitterParticleParams;d._spriteFrames=c;d._spriteAnimationSpeed=0.3;d._origin=new RSPoint(0.5*a,1.1*b);d._originVariance= new RSPoint(0.5*a,0.1*b);d._startDelay=1;d._startDelayVariance=1;d._displacement=new RSPoint(0,1.2*-b);d._displacementVariance=new RSPoint(0,0);d._speed=500;d._speedVariance=100;d._360rotationDuration=1;d._fadeInDuration=0.5;d._tweenRate=1;d._startScale=0.25;d._startScaleVariance=0.1;this._winCelebrationEmitter=new RSCustomAnimationEmitter(d,!0,RSCustomEmitterType.CLUSTER_MOVEMENT,80);this._winCelebrationEmitter.loadEmitter();this.addChild(this._winCelebrationEmitter)}},startWinCelebrationEmitter:function(){null!== this._winCelebrationEmitter&&this._winCelebrationEmitter.startEmitter()},stopWinCelebrationEmitter:function(){null!==this._winCelebrationEmitter&&this._winCelebrationEmitter.stopEmitter()},playCoinAnimationEmitter:function(a){var b=RSUtils.getTextureData("DailyBonusScreen","CoinAnimation/CoinAnimation_0000.png");if(b){var c=new RSEmitterParticleParams;c._spriteFrames.push(b.name);c._spriteAnimationSpeed=0.75;c._spriteAnimationSpeedVariance=0.25;c._origin=new RSPoint(0.5*RSEngine.screenWidth,0.5*RSEngine.screenHeight); c._originVariance=new RSPoint(0,0);c._startDelay=0;c._startDelayVariance=0;c._deviation=0.5*RSEngine.screenWidth;c._deviationVariance=0.3*RSEngine.screenWidth;c._displacement=new RSPoint(0,0.5*-RSEngine.screenHeight);c._displacementVariance=new RSPoint(0.5*RSEngine.screenWidth,0);c._speed=1600;c._speedVariance=400;c._startScale=0.15;c._endScale=0.75;c._scalingDuration=0.75;c._startScaleVariance=0.05;c._360rotationDuration=2;c._tweenRate=1;this._coinAnimationEmitter=new RSCustomAnimationEmitter(c, !1,RSCustomEmitterType.FOUNTAIN,100,this._removeWidget.bind(this,a));this._coinAnimationEmitter.loadEmitter();this.addChild(this._coinAnimationEmitter);this._coinAnimationEmitter.startEmitter();this._coinAnimationEmitter.setZOrder(1);this.getController().playCoinSplashSound()}else this._removeWidget(a)},playWheelWinAmountZoomIn:function(){var a=this.WheelWinAmount.actionScale(0.8,1.2,1.2,this.playWheelWinAmountZoomInComplete.bind(this));RSTweener.easeSineIn(a)},playWheelWinAmountZoomInComplete:function(){var a= this.WheelWinAmount.actionScale(0.2,1,1);RSTweener.easeSineIn(a)},onLayoutCompleted:function(){this._currentLayoutIndex==this._layoutList.length&&(this._initializeWinEmitter(),this.getController().onViewDrawCompleted(),this.addTouchListenerWithDelegate(this,!0));if(this._vipLabel&&this._vipBadge){var a=this.getController()._vipWidgetController.getView().getMultiplierString();this.getController()._vipWidgetController.getModel()&&0!=a?this._vipLabel.setString(a):(this.removeChild(this._vipLabel),this.removeChild(this._vipBadge))}this._super.onLayoutCompleted.call(this)}, handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){switch(a._ccObject._name){case "buyButton":this.getController().showPurchaseUI(this._onPurchaseSuccess.bind(this),this._onPurchaseCancel.bind(this),this._onPurchaseFailure.bind(this),this._onBlobUpdate.bind(this))}},getController:function(){return RSWidgetsManager.getInstance().getController(this._controllerName)},onButtonClicked:function(a){switch(a){case "CollectBtn":this._collectButton.setTouchEnabled(!1); RSAnalyticsManager.getInstance().trackGUIEvent("daily_bonus","collect","","");RSEngine.loginMode==LOGIN_MODE.FACEBOOK||RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK?GlobalVars.enableShare&&this._isShareEnabled?(RSActionShareManager.getInstance().initiateShare({ogType:"daily_bonus_collect"},this._exitDailyBonusWidget.bind(this,!1)),RSAnalyticsManager.getInstance().trackFBFeedShare("sent","daily_bonus_collect")):(this._exitDailyBonusWidget(!1),RSAnalyticsManager.getInstance().trackFBFeedShare("reject", "daily_bonus_collect")):this._exitDailyBonusWidget(!1);break;case "ShareButton":this._isShareEnabled=!this._isShareEnabled,this._shareEnableTickObject.setVisible(this._isShareEnabled)}},startWinRollup:function(a,b,c){"HeartValue"==b&&(this[b+"CurrentValue"]=parseInt(this._heartLabel.getString())?parseInt(this._heartLabel.getString()):0);this.startActionTweenForKey(b,a,this[b+"CurrentValue"],this[b+"CurrentValue"]+c)},actionOnUpdate:function(a,b){"HeartValue"==a?(this[a+"CurrentValue"]=Math.floor(b), this._heartLabel.setString(RSUtils.formatNumberWithComma(this[a+"CurrentValue"]))):(this[a+"CurrentValue"]=Math.floor(b),this[a+"TextLabel"].setString(RSUtils.formatNumberWithComma(this[a+"CurrentValue"])))},actionOnComplete:function(a,b){"HeartValue"==a?(this[a+"CurrentValue"]=Math.floor(b),this._heartLabel.setString(RSUtils.formatNumberWithComma(this[a+"CurrentValue"]))):(this[a+"FinalValue"]&&this[a+"FinalValue"]>Math.floor(b)&&(b=this[a+"FinalValue"]),this[a+"CurrentValue"]=Math.floor(b),this[a+ "TextLabel"].setString(RSUtils.formatNumberWithComma(this[a+"CurrentValue"])))},setFinalTextValue:function(a,b){this[a+"CurrentValue"]=Math.floor(b);this[a+"FinalValue"]=Math.floor(b);this[a+"TextLabel"].setString(RSUtils.formatNumberWithComma(this[a+"CurrentValue"]))},_onPurchaseCancel:function(){this._exitDailyBonusWidget()},_onBlobUpdate:function(a){},_exitDailyBonusWidget:function(a){this.playCoinAnimationEmitter(a)},_removeWidget:function(a){this.getController().removeWidget(a)},setWinCurrencyType:function(a){for(var b= 0;b<this._currencyPositionHolders.length;b++){var c=this._currencyPositionHolders[b].objectInfo,d=this._currencyPositionHolders[b].screenName;c.name+="_"+a;var d=RSUtils.createBasicObject(d,c),e=d.getSize();d.setScaleX(c.w/e.getWidth());d.setScaleY(c.h/e.getHeight());this.ResultPanel.addChild(d)}5==a&&(this.removeChild(this._vipLabel),this.removeChild(this._vipBadge));this._currencyPositionHolders.length=0},createCustomObject:function(a,b){switch(b.name){case "Overlay":var c=new RSPanel(b.x,b.y,b.w, b.h);c.setBackgroundColor(0,0,0,200);this.addChild(c);break;case "ResultPanel":c=new RSDisplayObject(new RSRect(0,0,b.w,b.h));c.setCenter(RSEngine.screenWidth/2,1.5*RSEngine.screenHeight);this.addChild(c);this.ResultPanel=c;this.ResultPanel.setZOrder(1);break;case "Currency":this._currencyPositionHolders.push({screenName:a,objectInfo:b});break;case "TotalAmount":this[b.name+"CurrentValue"]=0;this[b.name+"TextLabel"]=RSWidgetsManager.getInstance().getController(this._controllerName).getFontLabel(b, !0);this.ResultPanel.addChild(this[b.name+"TextLabel"]);break;case "DailyBonusWidget":this.getController().createDailyBonusView(b);break;case "ReturnBonusWidget":this.getController().setReturnBonus(b);break;case "RetentionBonusWidget":this.getController().setRetentionBonus(b);break;case "VipBonusWidget":this.getController().setVipBonus(b);break;case "VipBonusMultiplier":this._vipLabel=RSWidgetsManager.getInstance().getController(this._controllerName).getFontLabel(b);this[b.name]=this._vipLabel;this._vipLabel.setZOrder(1); this.addChild(this._vipLabel);break;case "FriendBonusWidget":this.getController().setFriendsBonus(b);break;case "HeartBonusWidget":this.getController().setReturnBonusBox(b);break;case "TotalHeartValue":this._heartLabel=RSWidgetsManager.getInstance().getController(this._controllerName).getFontLabel(b);this.ResultPanel.addChild(this._heartLabel);break;case "WheelWinAmount":this[b.name+"CurrentValue"]=0,this[b.name]=RSWidgetsManager.getInstance().getController(this._controllerName).getFontLabel(b,!0), this[b.name].setPosition(b.x-b.w/2,b.y),this[b.name+"TextLabel"]=this[b.name],this[b.name+"TextLabel"].setZOrder(1),this.addChild(this[b.name+"TextLabel"])}},onObjectCreated:function(a,b,c){"Animation"===c.type&&(a.stopAnimation(),a.setZOrder(1));a.setVisible(!1);this[c.name]=a;switch(c.name){case "CollectBtn":a.setButtonSound(RSGame.getInstance().getAssetPath("ButtonClick_SFX"));this._collectButton=a;this.removeChild(a);this.ResultPanel.addChild(a);this._collectButton.setVisible(!0);break;case "TotalBase":this._totalBase= a;this.removeChild(a);this.ResultPanel.addChild(a);this._totalBase.setVisible(!0);break;case "CollectLabel":this._collectLabel=a;this.removeChild(a);this.ResultPanel.addChild(a);this._collectLabel.setVisible(!0);break;case "ShareButton":a.setButtonSound(RSGame.getInstance().getAssetPath("ButtonClick_SFX"));this._shareButton=a;this.removeChild(a);this.ResultPanel.addChild(a);this._shareButton.setVisible(!1);RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&RSEngine.loginMode!=LOGIN_MODE.WEB_FACEBOOK||!GlobalVars.enableShare|| (this._shareButton.setTouchEnabled(!0),this._shareButton.setVisible(!0),this._isShareEnabled=!1);break;case "ShareEnable":this._shareEnableTickObject=a;this.removeChild(a);this.ResultPanel.addChild(a);a.setVisible(this._isShareEnabled);break;case "VipBadge":a.setZOrder(1),this._vipBadge=a}},setCollectButtonStateToEnabled:function(){this._collectButton.setTouchEnabled(!0)}});var BonusWheel=RSDisplayObject.extend({init:function(a,b){var c=new RSRect(a._x,a._y,a._parentRectWidth,a._parentRectHeight);this._super.init.call(this,c);this._params=a;this._payouts=a._spinWheelPayOutData;this._wheelPanel=null;this._assetPath=a._assetFolder;this._layoutName=a._layout;this._onComplete=b;this._totalWin=0;this._spinDirection=a._spinDirection;this._needleOffsetAngle=a._needleOffsetAngle;this._previousStopIndex=this._currentStopIndex=this._currentWheelAngle=0;this._winPointerIndexArray= a._needleWinIndexes;this._transformCompleteCB=this._wheelFrame=this._title=this._winPointer=null;this._winCurrencyType=0;this._2XCenterCoin=this._coinGlow=this._2xBadge=this._2xCenterAnim=this._2xWedge=null;this._2xcenterCoinAnimSpeed=a._2XCenterCoinAnimSpeed;this._titleOffset=a._titleOffset;this._2xBadgeOffset=a._2xBadgeOffset;this._spinWheelFullAngle=360;this._quickStopAnimation=null;this._spinDuration=a._wheelSpinDuration;this._wheelState="READY_FOR_SPIN";this._preSpinReverseAngle=a._preSpinReverseAngle; this._preSpinReverseDuration=a._preSpinReverseDuration;this._spinReverseAngle=a._spinReverseAngle;this._spinReverseDuration=a._spinReverseDuration;this._needleWinIndexes=a._needleWinIndexes;this._minimumSpinsToStop=a._minimumSpins;this._totalWheelSegments=this._payouts.length;this._anglePerWheelWedge=360/this._totalWheelSegments;this._spinAction=null;this._comWheelWeight=[];this._wheelSpinWidgetName="WheelSpinWidget";this._spinWheelLoaded=!1;this._bonusTextArray=[];this._dailyBonusWheelWedgeIndex= a.dailyBonusWheelWedgeIndex;if(1<a.dailyChallengeBonusMultiplier&&GameConfig.DAILY_BONUS_V3)for(c=0;c<this._totalWheelSegments;c++)this._comWheelWeight[c]=0<c?parseFloat(this._payouts[c].weight2x)+this._comWheelWeight[c-1]:parseFloat(this._payouts[c].weight2x);else for(c=0;c<this._totalWheelSegments;c++)this._comWheelWeight[c]=0<c?parseFloat(this._payouts[c].weight)+this._comWheelWeight[c-1]:parseFloat(this._payouts[c].weight);this._initializeTweeningPanels();this.loadLayout(this._assetPath+this._layoutName)}, onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.setAnchorPoint(0.5,0.5);this._spinWheelLoaded||(this._timer=setInterval(this.isSpinWheelLoadingComplete.bind(this),500))},addSpinWheelListner:function(){this._wheelPanel.addTouchListenerWithDelegate(this)},removeSpinWheelListner:function(){this._wheelPanel.removeTouchListener()},handle2xTransformation:function(a){this._transformCompleteCB=a;RSTweener.easeBackIn(this._title.actionMoveTo(0.5,this._title.getX(),this._title.getY()- this._titleOffset,this._onMoveComplete.bind(this)))},_onAnimCompleted:function(){this._2xCenterAnim.setVisible(!1);this._2xWedge.setVisible(!0);this._centerPoint.setVisible(!1);this._2XCenterCoin&&(this._2xWedge.setVisible(!1),this._2XCenterCoin.setVisible(!0),this._2XCenterCoin.playAnimation(-1,this._2xcenterCoinAnimSpeed));this._wheelPanel.doubleWheelValues()},_onMoveComplete:function(){this._wheelFrame.setFrame(1);this._winPointer.setFrame(1);this._title.setVisible(!1);this._play2xBonusTextTweenAnimation(); RSEngine.audioManager.playEffectWithVolume(RSGame.getInstance().getAssetFolder("DailyBonusWheelWidget")+"2x_Daily_bonus_impact.mp3",1,!1)},createCustomObject:function(a,b){var c=null;switch(b.type){case "SpinWheel":c=new SpinWheel(this._params,this._payouts,b,this);c.setCenter(b.x,b.y);c.setName(b.name);this._wheelPanel=c;this._widgetRect=b;this.addChild(c);break;case "WinPointer":for(c=0;c<this._winPointerIndexArray.length;c++){var d=RSUtils.createBasicObject(a,b);d.setRotation(this._needleOffsetAngle- this._spinDirection*this._winPointerIndexArray[c]*this._anglePerWheelWedge);d.setAnchorPoint(1,0.5);d.setPosition(b.x+0.5*b.w,b.y);this.addChild(d)}break;case "DailyText":c=RSUtils.createAnimation(a,b,1);c.stopAnimation();c.setFrame(0);c.setVisible(!1);c.setScale(3);this._addToFadingPanel(c);this._bonusTextArray.push(c);break;default:c=RSUtils.createBasicObject(a,b),this.addChild(c)}},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.type){case "Animation":a.stopAnimation(); a.playAnimation(-1,0.3);break;case "Button":a.setVisible(!1),this._closeButton=a}switch(c.name){case "Title":this._title=a;this._title.stopAnimation();this._title.setFrame(0);break;case "Spin":this._centerPoint=a;break;case "WheelFrame":this._wheelFrame=a;this._wheelFrame.stopAnimation();this._wheelFrame.setFrame(0);break;case "QuickStopAnim":this._quickStopAnimation=a;this._quickStopAnimation.stopAnimation();this._quickStopAnimation.setFrame(0);break;case "Point":this._winPointer=a;this._winPointer.stopAnimation(); this._winPointer.setFrame(0);break;case "2XBadge":this._2xBadge=a;break;case "2XWedge":this._2xWedge=a;this._2xWedge.setVisible(!1);break;case "2XAnim":this._2xCenterAnim=a;this._2xCenterAnim.stopAnimation();this._2xCenterAnim.setScale(2);this._2xCenterAnim.setFrame(0);this._2xCenterAnim.setVisible(!1);break;case "Ring":this._ring=a;this._ring.setVisible(!0);break;case "2XCenterCoin":this._2XCenterCoin=a;this._2XCenterCoin.setVisible(!1);this._2XCenterCoin.setFrame(0);this._2XCenterCoin.stopAnimation(); break;case "CoinGlow":this._coinGlow=a,this._coinGlow.setVisible(!1)}},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){b=RSWidgetsManager.getInstance().getController(this._wheelSpinWidgetName);switch(a.getName()){case "SpinWheel":b.onSpinClicked()}},onButtonClicked:function(a){"CloseBtn"===a&&(this.playQuickStopAnimation(),GameConfig.DAILY_BONUS_V3?this._closeButton.setVisible(!1):this._closeButton.setTouchEnabled(!1))},removeWheelWidget:function(){null!= this._quickStopAnimation&&this._quickStopAnimation.setVisible(!1);RSEngine.audioManager.stopAllEffects();RSWidgetsManager.getInstance().getController(this._wheelSpinWidgetName).onCloseButtonClicked()},getStopPositionForSpin:function(){if(-1!=this._dailyBonusWheelWedgeIndex)return this._dailyBonusWheelWedgeIndex;for(var a=RSUtils.getRandomFloat()*this._comWheelWeight[this._totalWheelSegments-1],b=0,c=0;c<this._totalWheelSegments;c++)if(this._comWheelWeight[c]>=a){b=c;break}cc.log("stop position index:"+ b);return b},getWheelSpinAngle:function(a){a=this.getSegmentPos(a-this._currentStopIndex);a=this._spinWheelFullAngle*this._minimumSpinsToStop+this._anglePerWheelWedge*a;a+=this._preSpinReverseAngle;a+=this._spinReverseAngle;cc.log("spin Angle:"+a);return a},getWinAmount:function(){var a=0;if(this._needleWinIndexes instanceof Array)for(var b=0;b<this._needleWinIndexes.length;b++)a+=parseInt(this._payouts[this.getSegmentPos(this._needleWinIndexes[b]+this._currentStopIndex)].payout);else a=parseInt(this._payouts[this.getSegmentPos(this._needleWinIndexes+ this._currentStopIndex)].payout);cc.log("winAmount : "+a);return a},getSegmentPos:function(a){return 0>a?this._totalWheelSegments+a:a%this._totalWheelSegments},doublePayOut:function(){for(var a=0;a<this._payouts.length;a++)this._payouts[a].payout*=2},_doPreSpinReverseAction:function(){if(0<this._preSpinReverseDuration){var a=this._wheelPanel.actionRotateBy(this._preSpinReverseDuration,-1*this._spinDirection*this._preSpinReverseAngle,1,this._doSpinAction.bind(this));RSTweener.easeIn(a,0.8)}else this._doSpinAction()}, _doSpinAction:function(){var a=this._wheelPanel.actionRotateBy(this._spinDuration,this._spinDirection*this._spinAngle,1,this._doSpinReverseAction.bind(this));RSTweener.easeSineInOut(a);this._spinAction=a},_doSpinReverseAction:function(){if(0<this._spinReverseDuration){var a=this._wheelPanel.actionRotateBy(this._spinReverseDuration,-1*this._spinDirection*this._spinReverseAngle,1,this.onSpinCompleted.bind(this));RSTweener.easeIn(a,0.8)}else this.onSpinCompleted()},getWinCurrencyType:function(){return this._payouts[this.getSegmentPos((this._needleWinIndexes instanceof Array?this._needleWinIndexes[0]:this._needleWinIndexes)+this._currentStopIndex)].type},spinWheel:function(){if("READY_FOR_SPIN"===this._wheelState){var a=this.getStopPositionForSpin();this._spinAngle=this.getWheelSpinAngle(a);this._currentStopIndex=a;this._totalWin=this.getWinAmount();this._winCurrencyType=this.getWinCurrencyType();this._wheelState="SPINNING";this._closeButton.setVisible(!0);RSEngine.audioManager.playEffectWithVolume(RSGame.getInstance().getAssetFolder("DailyBonusWheelWidget")+"RSDailyBonusWheelSpin.mp3", 1,!1);this._doPreSpinReverseAction()}else this.triggerSpinWheelQuickStop()},setSelectedWedge:function(){this._currentStopIndex=this.getStopPositionForSpin()},getSelectedWedge:function(){return this._currentStopIndex},_getQuickStopAngle:function(){return this._spinDirection*this._currentStopIndex*this._anglePerWheelWedge},playQuickStopAnimation:function(){null!=this._quickStopAnimation?this._quickStopAnimation.playAnimation(1,1,this.removeWheelWidget.bind(this)):this.removeWheelWidget()},triggerSpinWheelQuickStop:function(){}, closeDailyBonusWheel:function(){this.stopAllActions();this._wheelPanel.setRotation(this._getQuickStopAngle());GameConfig.DAILY_BONUS_V3&&this.highlightWins();this._onComplete&&this._onComplete(this._totalWin,this._winCurrencyType)},getNeedleWinIndexes:function(){return this._needleWinIndexes},setNeedleWinIndexes:function(a){this._needleWinIndexes=a},playAnimation:function(){this.setVisible(!0);this.resetWheel();this.spinWheel()},stopAnimation:function(){this.setVisible(!1);this.triggerSpinWheelQuickStop()}, highlightWins:function(){if(this._needleWinIndexes instanceof Array)for(var a=0;a<this._needleWinIndexes.length;a++)this._wheelPanel.getSegmentAtIndex(this.getSegmentPos(this._needleWinIndexes[a]+this._currentStopIndex)).highlight();else this._wheelPanel.getSegmentAtIndex(this.getSegmentPos(this._needleWinIndexes+this._currentStopIndex)).highlight()},onSpinCompleted:function(){this._spinAction=null;this._wheelState="READY_FOR_SPIN";GameConfig.DAILY_BONUS_V3?this._closeButton.setVisible(!1):this._closeButton.setTouchEnabled(!1); this.highlightWins();RSEngine.audioManager.playEffectWithVolume(RSGame.getInstance().getAssetFolder("DailyBonusWheelWidget")+"RSDailyBonusWinAnim.mp3",1,!1);!GameConfig.RETENTION_WHEEL&&RSGame.getInstance().getAssetFolder("DailyBonusWheelWidget")+"Congratulations.mp3"&&this.scheduleFunctionOnce(function(){RSEngine.audioManager.playEffectWithVolume(RSGame.getInstance().getAssetFolder("DailyBonusWheelWidget")+"Congratulations.mp3",1,!1)}.bind(this),2);this._onComplete&&this._onComplete(this._totalWin, this._winCurrencyType)},resetWheel:function(){this._wheelPanel.resetWheel()},setLoadingComplete:function(){this._spinWheelLoaded=!0},isSpinWheelLoadingComplete:function(){this._spinWheelLoaded&&clearInterval(this._timer)},isLoadingComplete:function(){return this._spinWheelLoaded},onWheelValueUpdated:function(){this._transformCompleteCB&&this._transformCompleteCB()},_addToFadingPanel:function(a){this._fadingPanel.addChild(a)},_initializeTweeningPanels:function(){this._fadingPanel=new RSDisplayObject(new RSRect(0, 0,0,0));this._fadingPanel.setAutoOpacityForChild(!0);this._fadingPanel.setAnchorPoint(0,0);this.addChild(this._fadingPanel);this._stackPanel=new RSDisplayObject(new RSRect(0,0,0,0));this._stackPanel.setAnchorPoint(0,0);this._stackPanel.setAutoOpacityForChild(!0);this._addToFadingPanel(this._stackPanel)},_play2xBonusTextTweenAnimation:function(){0!==this._bonusTextArray.length?(this._start2xBonusText(),this._clear1XBonusText()):this._on2xBonusAnimationCompleted()},_start2xBonusText:function(){this._bonusTextArray[0].setVisible(!0); this._bonusTextArray[0].actionZoom(0.04,0.8,this._after2xBonusTextAnimationStarted.bind(this))},_after2xBonusTextAnimationStarted:function(){this._bonusTextArray[0].setFrame(1);this._bonusTextArray[0].actionZoom(0.04,1.2,this._on2xBonusTextAnimationCompleted.bind(this))},_on2xBonusTextAnimationCompleted:function(){this._bonusTextArray[0].setFrame(0);this._bonusTextArray[0].actionZoom(0.04,1);this._bonusTextArray.splice(0,1);this._play2xBonusTextTweenAnimation()},_on2xBonusAnimationCompleted:function(){RSEngine.audioManager.playEffectWithVolume(RSGame.getInstance().getAssetFolder("DailyBonusWheelWidget")+ "2x_the_coins_blast.mp3",1,!1);cc.log("2xBonus anim completed");this._2xCenterAnim.setVisible(!0);this._2xCenterAnim.playAnimation(1,0.5,this._onAnimCompleted.bind(this))},_clear1XBonusText:function(){this._wheelPanel.clearWheelValues()}});var SpinWheel=RSDisplayObject.extend({init:function(a,b,c,d){c=new RSRect(c.x,c.y,c.w,c.h);this._super.init.call(this,c);this._assetPath=a._assetFolder;this._layoutName="SpinWheel";this._params=a;this._needleOffsetAngle=a._needleOffsetAngle;this._spinDirection=a._spinDirection;this._wheelPanel=null;this._spinWheelFullAngle=360;this._segments=[];this._payouts=b;this._anglePerWheelWedge=360/b.length;this._spinWheelWedgeLoaded=!1;this._delegate=d;this._currentIndex=0;this._tweeningSpeeds=[0.5,0.25,0.12]; this.loadLayout(this._assetPath+this._layoutName)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._spinWheelWedgeLoaded?this._delegate.setLoadingComplete():this._timer=setInterval(this.isSpinWheelWedgeLoadingComplete.bind(this),500);this._currentIndex=this._segments.length-1},clearWheelValues:function(){for(var a in this._segments)this._segments[a].fadeOutValue()},doubleWheelValues:function(){if(this._currentIndex==this._segments.length-1)for(var a in this._segments);0<= this._currentIndex&&(a=this.getTweeningSpeeds(),this.scheduleFunctionOnce(this.changeBonusValues.bind(this,a),a));if(0>this._currentIndex)this.onValueUpdated()},getTweeningSpeeds:function(){return this._currentIndex>=this._segments.length-3?this._tweeningSpeeds[0]:this._currentIndex==this._segments.length-4?this._tweeningSpeeds[1]:this._tweeningSpeeds[2]},changeBonusValues:function(a){this._currentIndex==this._segments.length-1&&RSEngine.audioManager.playEffectWithVolume(RSGame.getInstance().getAssetFolder("DailyBonusWheelWidget")+ "Coin_Values.mp3",1,!1);this._segments[this._currentIndex].doubleWedgeValue(a);this._currentIndex--;this.doubleWheelValues()},createCustomObject:function(a,b){var c=null;switch(b.type){case "Segment":for(var d=0;d<this._payouts.length;d++)if(c=new SpinWheelWedge(this._params,this._payouts[d],b,this),null!=c){var e=parseInt(this._payouts[d].index);c.setAnchorPoint(1,0.5);c.setPosition(b.x+0.5*b.w,b.y);c.setRotation(this._needleOffsetAngle-this._spinDirection*e*this._anglePerWheelWedge);this.addChild(c); this._segments[e]=c}}},onObjectCreated:function(a,b,c){switch(c.name){case "SpinWheel":this._wheelPanel=a,this.addChild(this._wheelPanel)}},getSegmentAtIndex:function(a){return this._segments[a]},resetWheel:function(){for(var a=1;a<this._segments.length;a++)this._segments[a].reset()},setLoadingComplete:function(){this._spinWheelWedgeLoaded=!0},isSpinWheelWedgeLoadingComplete:function(){this._spinWheelWedgeLoaded&&(clearInterval(this._timer),this._delegate.setLoadingComplete())},changeBonusValuesByIndex:function(a){this._segments[a].doubleWedgeValue()}, onValueUpdated:function(){this._delegate.onWheelValueUpdated()}});var SpinWheelWedge=RSDisplayObject.extend({init:function(a,b,c,d){c=new RSRect(c.x,c.y,c.w,c.h);this._super.init.call(this,c);this._assetPath=a._assetFolder;this._layoutName="SpinWheelWedge";this._params=a;this._payoutVO=b;this._font=this._params._assetFolder+this._params._labelFont;this._id=this._payoutVO.index;this._wedgeValue=RSUtils.formatNumber(this._payoutVO.payout);this._weight=this._payoutVO.weight;this._currencyType=this._payoutVO.type;this._label=this._glow=null;this._delegate=d;this.loadLayout(this._assetPath+ this._layoutName)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._delegate.setLoadingComplete()},createCustomObject:function(a,b){var c=null;switch(b.type){case "Glow":this._glow=c=RSUtils.createAnimation(a,b,0.3);c.stopAnimation();c.setVisible(!1);c.setRotation(-90);this.addChild(c);break;case "Label":c=RSWidgetsManager.getInstance().getController("DailyBonusScreen").getFontLabel(b);c.setString(this._wedgeValue);this.addChild(c);this._label=c;break;case "Currency":b.name+= "_"+this._currencyType;c=RSUtils.createBasicObject(a,b);this.addChild(c);break;default:this._super.createCustomObject.call(this,a,b)}},setGlowVisible:function(a){this._glow&&(!0==a&&this._glow.playAnimation(-1,0.33),this._glow.setVisible(a))},doubleWedgeValue:function(a){this._playRewardAmountTweening(a)},highlight:function(){this.setGlowVisible(!0)},getGlowVisibility:function(){this._glow.isVisible()},setLabel:function(a){this._wedgeValue=a;this._label.setString(a)},getLabel:function(){return this._wedgeValue}, clearValue:function(){this._label.setString("")},fadeOutValue:function(){this._label.actionFadeOut(1,null)},reset:function(){this.setGlowVisible(!1)},_playRewardAmountTweening:function(a){this._payoutVO.payout*=2;this._label.actionFadeIn(0,null);this.startActionTweenForKey("HUDRollUp",a,this._payoutVO.payout,this._payoutVO.payout)},actionOnUpdate:function(a,b){this._winDisplay=Math.floor(b);this._label.setString(RSUtils.formatNumber(this._winDisplay))},actionOnComplete:function(){this.stopWinRollUp()}, stopWinRollUp:function(){this.stopActionTweenForKey("HUDRollUp");this._label.setString(RSUtils.formatNumber(this._winDisplay))}});var WheelSpinWidgetController=RSWidgetController.extend({_delegate:null,_isCloseButtonClicked:!1,initWheelData:function(){},onControllerAdded:function(){this.getView().initBonusWheel()},onControllerRemoved:function(){this._view.unload();this._model.unload()},onSpinClicked:function(){this.playSpin()},handleDoubleBonusTransformation:function(a){this._view.handleDoubleBonusTransformation(a)},onCloseButtonClicked:function(){this._isCloseButtonClicked=!0;this._view.closeDailyBonusWheel()},handler:function(){return this._model.getModelData()}, setDelegate:function(a){this._delegate=a},getModel:function(){return this._model},playSpin:function(){this._view.spinWheel()},onGameplayComplete:function(a,b){this._delegate.onGameplayComplete(a,b,this._isCloseButtonClicked,"spinWheel")},replayDailyBonus:function(){this.getView().replay()},setSpinAmount:function(){},isArtLoaded:function(){return this.getView().isArtLoaded()}});var WheelSpinWidgetModel=RSWidgetModel.extend({_data:null,_sheetName:null,_wheelConfig:null,_wheelSegmentData:null,_animationConfig:null,_bonusWheelData:null,_bonusMultiplier:1,_WheelObj:null,InitModelData:function(a,b,c,d){this._bonusMultiplier=a;this._wheelConfig=b;this._wheelConfig.dailyChallengeBonusMultiplier=c;this._wheelConfig.dailyBonusWheelWedgeIndex=d;this._initializePayoutData()},_initializePayoutData:function(){for(var a=this._wheelConfig._spinWheelPayOutData,b=0;b<a.length;b++)a[b].payout= parseInt(a[b].payout)*this._bonusMultiplier},getModelData:function(){return this._WheelObj},getConfigData:function(){return this._wheelConfig}});var WheelSpinWidgetView=RSWidgetView.extend({_wheelSpinWidgetControllerName:null,_curObject:null,_spinWheel:null,_isWheelWidgetViewLoaded:!1,init:function(a){this._wheelSpinWidgetControllerName=a;this._super.init.call(this)},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){RSWidgetsManager.getInstance().getController(this._wheelSpinWidgetControllerName).onClicked()},getTouchStatus:function(a,b){RSWidgetsManager.getInstance().getController(this._wheelSpinWidgetControllerName).getTouchStatus(a, b)},initBonusWheel:function(){var a=RSWidgetsManager.getInstance().getController(this._wheelSpinWidgetControllerName);onComplete=function(b,c){a.onGameplayComplete(b,c)};this._spinWheel=new BonusWheel(a.getModel().getConfigData(),onComplete);this.addChild(this._spinWheel)},replay:function(){this._spinWheel.addSpinWheelListner()},spinWheel:function(){this._spinWheel.isLoadingComplete()?(this._spinWheel.playAnimation(),this._spinWheel.removeSpinWheelListner()):this._timer=setInterval(this.isBonusWheelLoadingComplete.bind(this), 500)},handleDoubleBonusTransformation:function(a){this._spinWheel.handle2xTransformation(a)},closeDailyBonusWheel:function(){this._spinWheel.closeDailyBonusWheel()},isBonusWheelLoadingComplete:function(){this._spinWheel.isLoadingComplete()&&(this.spinWheel(),clearInterval(this._timer))},isArtLoaded:function(){return this._spinWheel.isLoadingComplete()},getSelectedWedge:function(){return this._spinWheel.getSelectedWedge()},setSelectedWedge:function(){return this._spinWheel.setSelectedWedge()},doublePayOut:function(){return this._spinWheel.doublePayOut()}, getWinAmount:function(){return this._spinWheel.getWinAmount()},getWinCurrencyType:function(){return this._spinWheel.getWinCurrencyType()}});var FriendRewardWidgetController=RSWidgetController.extend({_delegate:null,onControllerAdded:function(){this.loadModelData();this.getView().loadLayoutsInModel(this.getModel())},loadModelData:function(){},disableFeature:function(){this.getView().disableFeature()},setWinCurrencyType:function(a){this.getView().setWinCurrencyType(a)},onControllerRemoved:function(){this._view.unload();this._model.unload()}});var FriendRewardWidgetModel=RSWidgetModel.extend({_friendReward:null,_rewardFont:null,init:function(a,b,c){this._friendCountValue=b;this._friendReward=c;this._super.init.call(this,a)},getFriendsCount:function(){return this._friendCountValue},getRewardAmountPerFriend:function(){return 0<this._friendCountValue?this._friendReward/this._friendCountValue:0},getFriendReward:function(){return this._friendReward}});var FriendRewardWidgetView=RSWidgetView.extend({_disableFeature:!1,_rewardText:null,_friendCountText:null,_totalAmountText:null,init:function(){this._super.init.call(this);this._currencyPositionHolders=[];this._screenName=null;this._dailBonusMainController=RSWidgetsManager.getInstance().getController("DailyBonusScreen")},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);var a=this._model.getRewardAmountPerFriend();this._rewardText&&this._rewardText.setString(RSUtils.formatNumber(a)); a=this._model.getFriendsCount();this._friendCountText&&this._friendCountText.setString(RSUtils.formatNumber(a));a=this._model.getFriendReward();this._totalAmountText&&this._totalAmountText.setString(RSUtils.formatNumber(a));this.setSize(this._friendBonusWidget.w,this._friendBonusWidget.h);this._disableFeature&&this.disableFeature()},onObjectCreated:function(a,b,c){switch(c.name){case "Bg":this._friendBonusWidget=c}},createCustomObject:function(a,b){null===this._screenName&&(this._screenName=a);switch(b.name){case "FriendsNumber":this._friendCountText= this._dailBonusMainController.getFontLabel(b);this.addChild(this._friendCountText);break;case "FriendBonusAmount":this._rewardText=this._dailBonusMainController.getFontLabel(b);this.addChild(this._rewardText);break;case "FriendBonusTotalAmount":this._totalAmountText=this._dailBonusMainController.getFontLabel(b);this.addChild(this._totalAmountText);break;case "Currency":this._currencyPositionHolders.push(b);break;case "Disabled":var c=RSUtils.createBasicObject(a,b);c.setZOrder(1);c.setVisible(!1); this.addChild(c);this._disabledLayerObject=c}},setWinCurrencyType:function(a){for(var b=0;b<this._currencyPositionHolders.length;b++){var c=this._currencyPositionHolders[b];c.name+="_"+a;var d=RSUtils.createBasicObject(this._screenName,c),e=d.getSize();d.setScaleX(c.w/e.getWidth());d.setScaleY(c.h/e.getHeight());this.addChild(d)}this._currencyPositionHolders.length=0},disableFeature:function(){this._disableFeature=!0;this._rewardText&&this._disabledLayerObject&&this._disabledLayerObject.setVisible(!0)}});var RetentionRewardWidgetController=RSWidgetController.extend({_delegate:null,onControllerAdded:function(){this.loadModelData();this.getView().loadLayoutsInModel(this.getModel())},loadModelData:function(){},setWinCurrencyType:function(a){this.getView().setWinCurrencyType(a)},disableFeature:function(){this.getView().disableFeature()},onControllerRemoved:function(){this._view.unload();this._model.unload()}});var RetentionRewardWidgetModel=RSWidgetModel.extend({_reward:null,_rewardFont:null,init:function(a,b,c){this._streakCount=b;this._reward=c;this._super.init.call(this,a)},getReward:function(){return this._reward},getStreakCount:function(){return this._streakCount}});var RetentionRewardWidgetView=RSWidgetView.extend({_disableFeature:!1,_rewardText:null,_bonusDayText:null,init:function(){this._super.init.call(this);this._currencyPositionHolders=[];this._screenName=null;this._dailBonusMainController=RSWidgetsManager.getInstance().getController("DailyBonusScreen")},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);var a=this._model.getReward();this._rewardText.setString(RSUtils.formatNumber(a));this._bonusDayText.setString(this._model.getStreakCount()); this.setSize(this._retentionBonusWidget.w,this._retentionBonusWidget.h);this._disableFeature&&this.disableFeature()},onObjectCreated:function(a,b,c){switch(c.name){case "Bg":this._retentionBonusWidget=c}},createCustomObject:function(a,b){null===this._screenName&&(this._screenName=a);switch(b.name){case "RetentionBonusAmount":this._rewardText=this._dailBonusMainController.getFontLabel(b,!0);this.addChild(this._rewardText);break;case "RetentionBonusDay":this._bonusDayText=this._dailBonusMainController.getFontLabel(b); this.addChild(this._bonusDayText);break;case "Currency":this._currencyPositionHolders.push(b);break;case "Disabled":var c=RSUtils.createBasicObject(a,b);c.setZOrder(1);c.setVisible(!1);this.addChild(c);this._disabledLayerObject=c}},setWinCurrencyType:function(a){for(var b=0;b<this._currencyPositionHolders.length;b++){var c=this._currencyPositionHolders[b];c.name+="_"+a;var d=RSUtils.createBasicObject(this._screenName,c),e=d.getSize();d.setScaleX(c.w/e.getWidth());d.setScaleY(c.h/e.getHeight());this.addChild(d)}this._currencyPositionHolders.length= 0},disableFeature:function(){this._disableFeature=!0;this._rewardText&&(this._rewardText.setString("0"),this._disabledLayerObject&&this._disabledLayerObject.setVisible(!0))}});var VIPMultiplierBonusWidgetController=RSWidgetController.extend({_delegate:null,onControllerAdded:function(){this.loadModelData();this.getView().loadLayoutsInModel(this.getModel())},loadModelData:function(){},setWinCurrencyType:function(a){this.getView().setWinCurrencyType(a)},disableFeature:function(){this.getView().disableFeature()},onControllerRemoved:function(){this._view.unload();this._model.unload()}});var VIPMultiplierBonusWidgetModel=RSWidgetModel.extend({_vipMultiplier:null,_rewardFont:null,init:function(a,b){this._vipMultiplier=b;this._super.init.call(this,a)},getVipMultiplier:function(){var a=RSGame.getInstance().getGameManager().getModifiedVIPMultiplier();return null!=a?a:this._vipMultiplier}});var VIPMultiplierBonusWidgetView=RSWidgetView.extend({_disableFeature:!1,_rewardText:null,_multiplierText:null,_totalWinText:null,_displayedWinText:0,init:function(){this._super.init.call(this);this._currencyPositionHolders=[];this._vipBadge=this._screenName=null;this._dailBonusMainController=RSWidgetsManager.getInstance().getController("DailyBonusScreen")},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._multiplierText&&this._multiplierText.setString(this.getMultiplierString()); this.setSize(this._vipBonusWidget.w,this._vipBonusWidget.h);this._disableFeature&&this.disableFeature()},setDailyBonusWinValue:function(a,b){this._rewardText&&this._rewardText.setString(RSUtils.formatNumberWithComma(a));if(this._totalWinText)if(5==b)this._totalWinText.setString(RSUtils.formatNumberWithComma(a)),this._displayedWinText=a;else{var c=RSGame.getInstance().getGameManager().getModifiedVIPMultiplier();if(null!=c){var c=a+a*c,d=parseInt(c%100);d==c?c+=100-c:0<d&&(c+=100-d);this._totalWinText.setString(RSUtils.formatNumberWithComma(c)); this._displayedWinText=c}else this._totalWinText.setString(RSUtils.formatNumberWithComma(a*this._model.getVipMultiplier())),this._displayedWinText=a*this._model.getVipMultiplier()}},disableFeature:function(){this._disableFeature=!0;if(this._rewardText){this._rewardText&&this._rewardText.setString("0");var a=new RSDrawNode;a.drawRect(new RSPoint(0,0),new RSPoint(this.getRect().getWidth(),this.getRect().getHeight()),new RSColor(0,0,0,128));this.addChild(a)}},onObjectCreated:function(a,b,c){switch(c.name){case "Bg":this._vipBonusWidget= c;break;case "VipBadge":this._vipBadge=a}},createCustomObject:function(a,b){null===this._screenName&&(this._screenName=a);switch(b.name){case "VipBonusAmount":this._rewardText=this._dailBonusMainController.getFontLabel(b,!0);this.addChild(this._rewardText);break;case "VipBonusMultiplier":this._multiplierText=this._dailBonusMainController.getFontLabel(b);this.addChild(this._multiplierText);break;case "VipBonusTotalAmount":this._totalWinText=this._dailBonusMainController.getFontLabel(b,!0);this.addChild(this._totalWinText); break;case "Currency":this._currencyPositionHolders.push(b)}},setWinCurrencyType:function(a){this._winTypeCurrency=a;for(var b=0;b<this._currencyPositionHolders.length;b++){var c=this._currencyPositionHolders[b];c.name+="_"+a;var d=RSUtils.createBasicObject(this._screenName,c),e=d.getSize();d.setScaleX(c.w/e.getWidth());d.setScaleY(c.h/e.getHeight());this.addChild(d);5==a&&d.setScale(0.8)}this._currencyPositionHolders.length=0},getMultiplierString:function(){if(5==this._winTypeCurrency)return 0;var a= RSGame.getInstance().getGameManager().getModifiedVIPMultiplier();if(null!=a&&0!=a)return"+"+100*a+"%";if(this._model.getVipMultiplier()&&0!=this._model.getVipMultiplier())return this._model.getVipMultiplier()+"X";this._vipBadge&&this._vipBadge.setVisible(!1);this._multiplierText&&this._multiplierText.setVisible(!1);return 0},getDisplayedWinText:function(){return this._displayedWinText}});var RSAnimationSequencer=RSClass.extend({init:function(a,b,c,d){this._resourcePath=a;this._sequencerFile=b;this._screenObject=c;this._sequenceData=null;this._delegate=d;this._currentSequenceCallback=this._currentSequence=null},loadAnimData:function(){RSUtils.loadJsonAsyc(this._resourcePath+this._sequencerFile,null,this.onDataLoaded.bind(this))},onDataLoaded:function(a){this._sequenceData=a;this.initializeScreen();this._delegate.onSequencerDataLoaded()},_getObjectWithKey:function(a){var b=null;return b= /[a-z]*Widget$/.test(a)?RSWidgetsManager.getInstance().getController(a).getView():this._screenObject[a]},applyActionOnObject:function(a,b,c){var d=c.duration?c.duration:0,e=c.delay?c.delay:0,f=function(){};if(a||"playEffect"===b||"RollUp"===b||"SetFinalValue"===b)switch(b){case "scale":f=void 0!==c.xScale?c.xScale:a.getScaleX();b=void 0!==c.yScale?c.yScale:a.getScaleY();f=a.actionScale.bind(a,d,f,b,null);break;case "fade":f=a.actionFadeTo.bind(a,d,c.fadeValue,null);break;case "doBlinkAction":f=a.doBlinkAction.bind(a, d,void 0!==c.blinkPerCycle?c.blinkPerCycle:1,void 0!==c.blinkLoopCount?c.blinkLoopCount:1,null);break;case "move":f=a.actionMoveBy.bind(a,d,(void 0!==c.xOffset?c.xOffset:0)*RSEngine.resolutionFactor,(void 0!==c.yOffset?c.yOffset:0)*RSEngine.resolutionFactor,null);break;case "rotate":f=c.count||1;f=a.actionRotateBy.bind(a,d,c.angle||0,f,null);break;case "anchorPoint":f=a.setAnchorPoint.bind(a,c.xAnchor||0.5,c.yAnchor||0.5);break;case "playAnimation":f=a.playAnimation.bind(a,c.loopCount,c.speed,null); break;case "stopAnimation":f=a.stopAnimation.bind(a,null);break;case "visibility":f=function(){a.setVisible(c)}.bind(this);break;case "playEffect":var g=c.soundFileName,h=c.volume?c.volume:1,k=c.shouldLoop?c.shouldLoop:!1,f=function(){RSEngine.audioManager.playEffectWithVolume(this._resourcePath+g,h,k)}.bind(this);break;case "RollUp":b=c.rollUpLabelKey;var m=c.rollUpAmountKey;this._delegate.startWinRollup(d,b,m);break;case "SetFinalValue":b=c.rollUpLabelKey;m=c.rollUpAmountKey;this._delegate.setFinalTextValue(b, m);break;case "moveToFro":b=c.minX||0;var m=c.maxX||0,n=c.minY||0,p=c.maxY||0,f=c.count||0,f=a.actionMoveToFro.bind(a,d,b,m,n,p,f,null);break;case "rotateToFro":b=c.maxAngle||0;m=c.minAngle||0;f=c.count||0;f=a.actionRotateToFro.bind(a,d,b,m,f,null);break;case "zoomInOut":b=c.minScale||1;m=c.maxScale||1;f=c.count||0;f=a.actionZoomInOut.bind(a,d,b,m,f,null);break;case "touchState":a.setTouchEnabled(c.state);break;case "sequenceComplete":this._delegate.onSequenceComplete()}0<e?this._screenObject.scheduleFunctionOnce(f, e):f();return e+d},applyInitializeState:function(a,b,c){switch(b){case "visibility":a.setVisible(c);break;case "opacity":a.setOpacity(c);break;case "scale":void 0!==c.xScale&&a.setScaleX(c.xScale);void 0!==c.yScale&&a.setScaleY(c.yScale);break;case "position":void 0!==c.xOffset&&a.moveX(c.xOffset*RSEngine.resolutionFactor);void 0!==c.yOffset&&a.moveY(c.yOffset*RSEngine.resolutionFactor);break;case "anchorPoint":var d=a.getAnchorPoint();b=c.x-d.getX();d=c.y-d.getY();a.setAnchorPoint(c.x,c.y);c=a.getPosition(); var e=a.getSize();a.setPosition(c.getX()+e.getWidth()*b,c.getY()+e.getHeight()*d);break;case "touchState":a.setTouchEnabled(c)}},parseAndApplyProperties:function(a,b){var c=this._getObjectWithKey(a);if(void 0!==c){var d=this;Object.keys(b).forEach(function(a){d.applyInitializeState(c,a,b[a])})}},initializeScreen:function(){var a=this._sequenceData.init,b=this;Object.keys(a).forEach(function(c){b.parseAndApplyProperties(c,a[c])})},_parseAndApplyActions:function(a,b){var c=this,d=0;Object.keys(b).forEach(function(e){e= c.applyActionOnObject(a,e,b[e]);e>d&&(d=e)});return d},_initializeCurrentSequence:function(a,b,c){var d=this;Object.keys(c).forEach(function(a){var f=d._getObjectWithKey(a);a=d._parseAndApplyActions(f,c[a]);a>b&&(b=a)});this._screenObject.scheduleFunctionOnce(this._playSubSequenceWithId.bind(this,a+1),b)},_playSubSequenceWithId:function(a){if(a<this._currentSequence.length){var b=this._currentSequence[a],c=b.duration,d=b.animDetails,b=b.delay?b.delay:0;0<b?this._screenObject.scheduleFunctionOnce(this._initializeCurrentSequence.bind(this, a,c,d),b):this._initializeCurrentSequence(a,c,d)}else this._currentSequenceCallback&&this._currentSequenceCallback()},playSequenceWithKey:function(a,b){this._currentSequence=this._sequenceData[a];this._currentSequenceCallback=b;void 0!==this._currentSequence&&this._playSubSequenceWithId(0)}});var a0_0x4cfe36=a0_0x1a45;function a0_0x1a45(a,b){var c=a0_0x3bab();return a0_0x1a45=function(a,b){return c[a-105]},a0_0x1a45(a,b)}(function(a,b){for(var c=a0_0x1a45,d=a();;)try{if(parseInt(c(146))/1*(parseInt(c(141))/2)+-parseInt(c(264))/3*(-parseInt(c(351))/4)+-parseInt(c(366))/5+-parseInt(c(148))/6+-parseInt(c(108))/7*(-parseInt(c(232))/8)+-parseInt(c(167))/9*(-parseInt(c(259))/10)+-parseInt(c(342))/11===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x3bab,346840); var RSLevelUpToaster=RSPopup[a0_0x4cfe36(328)]({init:function(a,b,c,d,e){var f=a0_0x4cfe36;this[f(253)][f(315)].call(this,c);this[f(371)]=null;this[f(196)]=null;this[f(213)]=null;this[f(234)]=null;this[f(334)]=null;this._coinPoint=this[f(314)]=null;this[f(149)]=null;this[f(312)]=null;this._particleEmitter1=this[f(284)]=null;this._displayPanel=this[f(145)]=null;this[f(243)]=null;this._piggyBonusAwarded=this[f(199)]=!1;this[f(178)]={};this._initialAnimStarted=this._rollUpStarted=this._shouldSkipAnim= !1;this[f(241)]=!1;this[f(230)]=c;this[f(251)]=void 0!=d||null!=d?d:!1;this[f(251)]&&(this._userTier=void 0!=e||null!=e?e:RSVIPManager.getInstance()[f(211)]());this[f(154)]=a[f(248)];this[f(355)]=a[f(218)];this[f(348)]=a[f(317)];this._emitterSprites=a[f(318)]?a[f(318)]:[];this[f(161)]=a[f(184)]?a[f(184)]:1;!this[f(355)][f(246)]&&(this[f(355)][f(246)]=kTEXT_ALIGNMENT_CENTER);!this[f(355)][f(330)]&&(this[f(355)][f(330)]=kTEXT_ALIGNMENT_LEFT);this[f(376)]=b;this[f(311)](0.5,0.5);this._starMoveUpDownPanel= new RSPanel(RSEngine[f(322)]/2,RSEngine[f(292)]/2,RSEngine[f(322)],RSEngine[f(292)]);this[f(313)](this[f(191)]);this[f(191)][f(311)](0.5,0.5);this[f(276)]()},_initializeToaster:function(){var a=a0_0x4cfe36,b=new RSRect(0,0,0,0);this._emitterObject=new RSPanel(0,0,0,0);this[a(144)]=new RSDisplayObject(b)},loadContent:function(){var a=a0_0x4cfe36;this[a(182)]([{name:this[a(154)]+"LevelUpPopup",count:this[a(161)]}]);this._super[a(290)].call(this)},onObjectCreated:function(a,b,c){var d=a0_0x4cfe36;this[d(253)].onObjectCreated[d(140)](this, a,b,c);switch(c[d(129)]){case "RayAntiClockwise":this[d(371)]=a;break;case d(337):this[d(331)](a,!1);this[d(191)][d(313)](a);break;case d(273):this[d(196)]=a;break;case d(220):this[d(130)]=a;this[d(130)].stopAnimation();this[d(130)][d(346)](0);this[d(130)][d(223)](!1);break;case d(162):this._piggyShatterAnim=a;this[d(176)].stopAnimation();this[d(176)][d(223)](!1);this[d(295)]=c;break;case d(275):a.setVisible(!1);this[d(201)]=a;break;case d(240):a[d(223)](!1),this[d(358)]=a,this[d(358)][d(163)](), this[d(358)][d(271)](5)}-1!=c[d(129)][d(183)]("CurrencySymbol")&&(b=c[d(129)][d(135)](/\d+/))&&(this[d(118)+b[0]]=a)},createCustomObject:function(a,b){var c=a0_0x4cfe36;switch(b[c(129)]){case "LevelUpText":this[c(243)]=new RSScaledLabel("",this._fontDetails[c(242)],b,this[c(355)][c(246)]);this[c(191)].addChild(this[c(243)]);this[c(178)][c(180)]=this[c(376)][c(225)];break;case c(151):this[c(360)]=new RSScaledLabel("",this[c(355)].FONT_CURRENCY,b,this[c(355)][c(330)]);this[c(178)][GameFeatureTypeEnum.PRIMARY_CURRENCY]= this[c(376)][c(151)];this[c(360)][c(291)](RSUtils[c(172)](this._rewardDetails[GameFeatureTypeEnum[c(297)]],3));this[c(313)](this._primaryReward);break;case c(136):this[c(375)]=new RSScaledLabel("",this[c(355)][c(114)],b,this[c(355)][c(330)]);this.addChild(this[c(375)]);this[c(178)][GameFeatureTypeEnum[c(177)]]=this[c(376)][c(136)];this._secondaryReward[c(291)](RSUtils[c(172)](this._rewardDetails[GameFeatureTypeEnum[c(177)]],3));break;case "PowerUpReward":this[c(364)]=new RSScaledLabel("",this[c(355)][c(114)], b,this[c(355)][c(330)]);this[c(178)][c(187)]=this[c(376)].LevelBonusPowerups;this[c(364)][c(291)](RSUtils[c(172)](this._rewardDetails[c(187)]));this[c(313)](this._powerUpReward);break;case c(119):this[c(314)]=new RSPanel(b.x,b.y,b.w,b.h);break;case c(278):this._primaryRect=new RSPanel(b.x,b.y,b.w,b.h);break;case c(105):this._secondaryRect=new RSPanel(b.x,b.y,b.w,b.h);break;case c(296):this[c(233)]=new RSPanel(b.x,b.y,b.w,b.h);break;case c(305):this[c(203)]=new RSPoint(b.x,b.y);break;case c(356):this[c(149)]= RSUtils[c(206)](a,b,1);this._starMoveUpDownPanel[c(313)](this._glareLeft);this[c(149)].stopAnimation();this._glareRight=RSUtils[c(206)](a,b,1);this[c(312)][c(299)](!0);this._glareRight.stopAnimation();break;case c(227):this._glareRight[c(143)](b.x,b.y);this[c(191)][c(313)](this[c(312)]);break;case c(347):this[c(320)]=b;break;case c(285):this[c(157)]=b;break;case c(286):this[c(131)]=b;break;case c(267):var d=this[c(355)][c(107)]?this[c(355)][c(107)]:RSGame[c(168)]()[c(324)]().getHUDCasinoFont(c(294), c(270));this._highRollerReward=new RSScaledLabel("",d,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this[c(327)]);break;case c(228):d=this[c(355)].FONT_BETTEXT?this[c(355)][c(372)]:RSGame[c(168)]().getGameManager().getDefaultCasinoFont(c(294),c(270)),this[c(153)]=new RSScaledLabel("",d,b,kTEXT_ALIGNMENT_CENTER),this[c(313)](this[c(153)])}},onButtonClicked:function(a,b){var c=a0_0x4cfe36;this[c(253)][c(374)][c(140)](this,a,b)},onLayoutCompleted:function(){var a=a0_0x4cfe36;this[a(253)].onLayoutCompleted[a(140)](this); RSEngine[a(261)].playEffect(this[a(154)]+"sfx/LevelUpMusic.mp3",!1);this[a(313)](this[a(144)]);this[a(191)].setZOrder(2);this[a(144)].setZOrder(4);void 0!=this[a(376)][a(272)]&&(this[a(178)].piggyBonus=parseInt(this[a(376)][a(272)]));if(this._isVIPLevelupBonusEnabled&&GameConfig.IS_VIP_ENABLED&&0<this[a(205)]){var b=RSUtils[a(335)](this[a(178)]),c=this[a(255)](),d=b[GameFeatureTypeEnum[a(297)]],c=d*c,c=100*Math[a(236)](c/100),d=Math[a(197)](d+c);b.coins=d;RSGame[a(168)]()[a(324)]().saveLevelUpReward(b); RSAnalyticsManager[a(168)]()[a(350)](RSAnalyticsSource[a(370)],a(158),c,a(325),RSVIPManager[a(168)]()[a(211)]())}else RSGame[a(168)]().getGameManager()[a(281)](this._rewardDetails);this[a(257)]();this[a(313)](this[a(284)]);this[a(284)].setZOrder(-1);!this._levelUpPanel&&(this._levelUpPanel=new RSPanel(RSEngine[a(322)]/2,RSEngine[a(292)]/2,0,0));if(this[a(357)]){this[a(313)](this._primaryRect);this.removeChild(this[a(213)],!1);this[a(331)](this[a(360)],!1);this[a(357)].setVisible(!1);this[a(357)][a(271)](2); b=this[a(357)][a(309)](this[a(213)][a(216)](),this[a(213)][a(265)]());this[a(213)][a(352)](b._x,b._y);b=this[a(357)][a(309)](this[a(360)][a(216)](),this._primaryReward[a(265)]());if(this[a(355)].REWARD_FONT_ALIGNMENT==kTEXT_ALIGNMENT_CENTER)this._primaryReward[a(352)](b._x,b._y);else this._fontDetails[a(330)]==kTEXT_ALIGNMENT_LEFT&&this._isVIPLevelupBonusEnabled?this[a(360)][a(352)](this._primaryRect[a(260)]()[a(123)]-3.7*b._x,b._y):this[a(360)][a(352)](this[a(357)][a(260)]()[a(123)]-b._x,b._y);this[a(357)][a(313)](this[a(213)]); this[a(357)][a(313)](this._primaryReward)}this._secondaryRect&&(this[a(313)](this[a(138)]),this.removeChild(this[a(234)],!1),this.removeChild(this._secondaryReward,!1),this._secondaryRect[a(223)](!1),this[a(138)][a(271)](2),b=this[a(138)][a(309)](this._currency2.getX(),this[a(234)][a(265)]()),this[a(234)][a(352)](b._x,b._y),b=this[a(138)][a(309)](this[a(375)][a(216)](),this[a(375)].getY()),this[a(375)][a(352)](b._x,b._y),this[a(138)][a(313)](this[a(234)]),this[a(138)][a(313)](this[a(375)]));this._powerUpRect&& (this[a(313)](this[a(233)]),this[a(331)](this[a(334)],!1),this.removeChild(this[a(364)],!1),this._powerUpRect[a(223)](!1),this[a(233)][a(271)](2),b=this[a(233)].convertToNodeSpace(this[a(334)][a(216)](),this[a(334)][a(265)]()),this[a(334)].setCenter(b._x,b._y),b=this[a(233)][a(309)](this[a(364)].getX(),this[a(364)][a(265)]()),this[a(364)][a(352)](b._x,b._y),this[a(233)].addChild(this._currency3),this[a(233)][a(313)](this[a(364)]));this[a(224)]()},_starZoomIn:function(){var a=a0_0x4cfe36,b=RSGame.getInstance()[a(362)](a(306)); b&&RSEngine[a(261)][a(188)](b,!1);this[a(288)]()},playVIPBannerSfx:function(){var a=a0_0x4cfe36;RSEngine[a(261)][a(188)](RSGame[a(168)]()[a(174)](a(365))+"VIP_Banner.mp3",!1)},_setVipTier:function(){var a=a0_0x4cfe36;this[a(155)]();this[a(358)][a(195)](this[a(205)]-1);this[a(358)][a(223)](!0);this[a(358)][a(377)](0);var b=this[a(358)][a(354)](0.6,1.1,1.1,this.VipBanner[a(110)](this));RSTweener[a(207)](b,0.8)},VipBanner:function(){var a=a0_0x4cfe36,b=this[a(358)].actionScale(0.3,1,1);RSTweener[a(207)](b, 0.8);RSUtils[a(239)](1,this,this[a(198)].bind(this))},getVIPLevelupBonus:function(){var a=a0_0x4cfe36;if(RSVIPManager.getInstance()[a(179)]())for(var b=RSEngine.gameData[a(204)](a(111)),c=0;c<b.length;c++)if(b[c].tier==this._userTier)return b[c][a(301)]},addVIPBonus:function(){var a=a0_0x4cfe36,b=this[a(255)](),c=this[a(178)][GameFeatureTypeEnum[a(297)]];this[a(210)]=c*b;this[a(210)]=100*Math[a(236)](this[a(210)]/100);b=Math.round(c+this[a(210)]);this._rewardDetails[GameFeatureTypeEnum[a(297)]]=b; this[a(357)][a(223)](!0);this[a(241)]=!0;this.startWinRollUp(GameFeatureTypeEnum[a(297)])},playRollupSfx:function(){var a=a0_0x4cfe36;RSEngine[a(261)][a(188)](RSGame.getInstance()[a(174)](a(185))+a(113),!1)},_levelZoomOut:function(){var a=a0_0x4cfe36;this[a(243)].setString(this[a(376)][a(225)]);var b=this[a(243)].getDisplayObject()[a(280)]()||1;this._levelNumberTxt[a(377)](b);this[a(251)]?(RSUtils[a(239)](2,this,this[a(319)].bind(this)),this[a(360)].setString(RSUtils.formatNumberWithComma(this._rewardDetails[GameFeatureTypeEnum[a(297)]], 3)),this[a(357)][a(223)](!0),0<this[a(205)]?(this[a(244)]=this[a(178)][GameFeatureTypeEnum[a(297)]],RSUtils[a(239)](3,this,this[a(293)].bind(this))):RSUtils[a(239)](2,this,this._playCoinAnim[a(110)](this))):this._rewardRollUp();this[a(373)](a(339))},playGlareAnims:function(){var a=a0_0x4cfe36;this._glareLeft[a(344)](1,1);this[a(312)][a(344)](1,1)},_rewardRollUp:function(){var a=a0_0x4cfe36;this[a(357)]&&(this[a(357)][a(223)](!0),this.startWinRollUp(GameFeatureTypeEnum[a(297)]));this[a(138)]&&(this._secondaryRect.setVisible(!0), this[a(190)](GameFeatureTypeEnum[a(177)]));this[a(233)]&&(this._powerUpRect[a(223)](!0),this[a(190)](a(187)));this.loadParticleEffect1();GameFeatureTypeEnum[a(262)]?RSUtils[a(239)](3,this,this._onInitialAnimComplete.bind(this)):this[a(109)]();this[a(139)]();this[a(308)]=!0},_scaleOutRewardPanel:function(a){var b=a0_0x4cfe36;a=a.actionZoom(1.5,0.8,this[b(252)].bind(this,a));RSTweener[b(194)](a,0.4)},_scaleInRewardPanel:function(a){var b=a0_0x4cfe36;a=a[b(222)](0.8,1,this[b(326)][b(110)](this,a));RSTweener[b(349)](a, 0.8)},startWinRollUp:function(a){var b=a0_0x4cfe36;this[b(175)]=a;this[b(165)+a]==this._winDisplaycoins&&null!=this[b(165)+a]||(this[b(165)+a]=0);this[b(128)]=!0;this._isVIPLevelupBonusEnabled?this[b(316)]():RSEngine[b(261)][b(188)](this[b(154)]+b(237),!1);switch(this._key){case GameFeatureTypeEnum[b(297)]:this[b(310)]("primaryRollUp",3,this[b(165)+a],this[b(178)][a]);this[b(122)]()&&this[b(199)]&&!this[b(359)]&&(this[b(221)](),this[b(215)](this[b(160)]),RSEngine[b(261)][b(247)](this[b(154)]+b(250), !1));break;case GameFeatureTypeEnum.SECONDARY_CURRENCY:this.startActionTweenForKey("secondaryRollUp",2,this[b(165)+a],this[b(178)][a]);break;case b(187):this[b(310)](b(117),2,this[b(165)+a],this[b(178)][a])}},actionOnUpdate:function(a,b){var c=a0_0x4cfe36;if(this[c(128)])switch(this[c(165)+this._key]=Math.floor(b),a){case c(353):this[c(360)][c(291)](RSUtils.formatNumberWithComma(this[c(165)+this[c(175)]],3));break;case "secondaryRollUp":this[c(375)][c(291)](RSUtils[c(172)](this[c(165)+this[c(175)]], 3));break;case c(117):this[c(364)].setString(RSUtils[c(172)](this[c(165)+this[c(175)]],3));break;case c(329):var d=Math[c(369)](b);this[c(327)][c(291)]("+"+RSUtils[c(172)](d))}},actionOnComplete:function(){this[a0_0x4cfe36(128)]&&this.stopWinRollUp()},stopWinRollUp:function(){var a=a0_0x4cfe36;this[a(128)]=!1;this[a(165)+this[a(175)]]=this[a(178)][this[a(175)]];switch(this[a(175)]){case a(303):this[a(360)][a(291)](RSUtils[a(172)](this[a(165)+this[a(175)]],3));this._isVIPLevelupBonusEnabled&&0<this[a(205)]&& this[a(241)]&&RSCasinoManager[a(323)]()[a(300)](this._coinPoint,this[a(144)],this[a(147)][a(110)](this));break;case a(136):this[a(375)][a(291)](RSUtils[a(172)](this["_winDisplay"+this[a(175)]],3));break;case a(187):this[a(364)][a(291)](RSUtils[a(172)](this[a(165)+this[a(175)]],3))}this[a(235)](a(353));this[a(235)](a(363));this[a(235)](a(117));this.isPiggyBonusAvailable()&&this[a(125)]&&this[a(178)][a(272)]&&(this[a(176)]&&this[a(176)].setVisible(!1),this[a(327)][a(291)]("+"+RSUtils[a(172)](this[a(178)].piggyBonus)), RSCasinoManager[a(323)]().playCoinReceivedAnimation(this[a(203)],this[a(144)],this[a(147)][a(110)](this)))},playBgAnimation:function(){var a=a0_0x4cfe36;this[a(371)]&&this[a(371)][a(164)](0.1,-2,-1);this._rayAnim2&&this[a(196)][a(164)](0.1,2,-1)},_playEmitter:function(a){var b=a0_0x4cfe36;a&&a[b(181)]()},_playIntroAnim:function(){var a=a0_0x4cfe36;RSEngine[a(261)].playEffect(this[a(154)]+a(137),!1);this._playEmitter(this[a(268)]);RSUtils.callFunctionWithDelay(2,this,this[a(217)][a(110)](this));this[a(215)](this[a(145)])}, _changeZOrder:function(){this._emitterObject[a0_0x4cfe36(271)](3)},_onInitialAnimComplete:function(){var a=a0_0x4cfe36;if(!this[a(173)]){this[a(173)]=!0;var b=RSGame.getInstance()[a(362)]("Shine");b&&RSEngine[a(261)][a(188)](b,!1);this[a(359)]?this[a(192)]():(this._glareLeft[a(344)](1,1),this._glareRight[a(344)](1,1,this[a(192)][a(110)](this)))}},handleTouchAt:function(a,b,c){},handleTouchEndAt:function(a,b,c){a=a0_0x4cfe36;this[a(359)]||(this[a(308)]&&(this._shouldSkipAnim=!0,this[a(152)]()),this[a(176)]&& this._piggyShatterAnim.setVisible(!1),this[a(128)]&&this[a(229)](),this[a(307)]&&!this[a(199)]&&this[a(373)](a(269)),this[a(145)]&&(this[a(145)].stopEmitter(),this[a(145)].fadeOut(0.1,this[a(124)].bind(this))))},_onFadeOutCompleted:function(){var a=a0_0x4cfe36;cc[a(166)](a(263))},handleButtonClick:function(a,b){var c=a0_0x4cfe36;switch(b){case ccui.Widget[c(120)]:case ccui[c(274)][c(132)]:case ccui[c(274)][c(321)]:case ccui[c(274)][c(279)]:}},_playCoinAnim:function(){var a=a0_0x4cfe36;this.isPiggyBonusAvailable()? this[a(373)](a(340)):RSCasinoManager[a(323)]()[a(300)](this[a(203)],this._displayPanel,this[a(147)][a(110)](this));this[a(359)]&&this[a(268)][a(346)](50)},_onReadyToClosePopup:function(){var a=a0_0x4cfe36,b=2;this[a(359)]&&(b=0,this._particleEmitter2&&this._particleEmitter2[a(223)](!1));!GameConfig[a(170)]&&RSGame.getInstance()[a(324)]()[a(200)](this[a(178)]);this[a(178)][GameFeatureTypeEnum[a(297)]]&&GameConfig.IS_MULTI_TAB_HANDLED&&RSCasinoManager.addPrimaryCurrencyForDisplay(a(126),this[a(178)][GameFeatureTypeEnum[a(297)]]); RSUtils[a(239)](b,this,this[a(298)][a(110)](this))},isPiggyBonusAvailable:function(){var a=a0_0x4cfe36;return void 0!=this[a(376)][a(272)]},_piggyAnimations:function(a){var b=a0_0x4cfe36;if(this[b(122)]())switch(a){case b(339):this[b(331)](this[b(130)]);this[b(313)](this[b(130)]);this[b(130)][b(143)](this[b(157)].x,this[b(157)].y);this._piggyTrailAnim[b(344)](-1,1,null);this._piggyTrailAnim.setVisible(!0);this._piggyTrailAnim[b(258)](1,null);this[b(130)].setZOrder(1);this[b(176)][b(271)](1);this[b(302)]= new RSPanel(RSEngine[b(322)]/2,RSEngine[b(292)]/2,RSEngine[b(322)],RSEngine[b(292)]);this[b(313)](this[b(302)]);this[b(302)][b(311)](0.5,0.5);this._piggyBannerAnimRect[b(271)](2);this[b(331)](this[b(201)]);this.removeChild(this[b(327)]);this._minBetText&&this[b(331)](this[b(153)]);this[b(302)][b(313)](this[b(201)]);this._piggyBannerAnimRect[b(313)](this[b(327)]);this[b(153)]&&this[b(302)][b(313)](this._minBetText);break;case b(340):this[b(130)][b(163)]();this[b(359)]?this[b(373)](b(269)):(this[b(307)]= !0,this[b(130)][b(344)](1,1,this[b(373)].bind(this,b(269))),RSEngine.audioManager.playMusic(this._assetFolder+b(333),!1));break;case "startShatterTransition":if(this[b(307)])this._piggyTrailAnimPlaying=!1,this[b(130)].stopAnimation();else if(this._piggyAnimActive)break;this[b(199)]=!0;this[b(176)][b(223)](!0);this._piggyTrailAnim.setVisible(!1);if(this._piggyShatterStartSize){a=this[b(295)].w/this._piggyShatterAnim[b(202)][b(171)][b(256)];var c=this[b(295)].h/this[b(176)][b(202)][b(171)].height;this[b(176)][b(377)](a, c)}this[b(131)]&&this[b(176)].setPosition(this._piggyShatterAnimStartPos.x,this[b(131)].y);this[b(359)]?(this[b(331)](this[b(191)]),this._piggyShatterAnim[b(223)](!1),this[b(373)](b(345))):(this[b(191)][b(222)](0.5,0.2,this.removeChild[b(110)](this,this._starMoveUpDownPanel)),this[b(176)][b(332)](1,this[b(320)].x,this[b(320)].y,null),this._piggyShatterAnim[b(222)](1,1,this._piggyAnimations[b(110)](this,b(345))));break;case b(345):this._shouldSkipAnim?this[b(373)](b(214)):this[b(176)][b(344)](1,1, this[b(373)][b(110)](this,b(214)));this._piggyBannerAnimRect.setScale(0.2);break;case b(214):this[b(125)]=!0;this[b(201)][b(223)](!0);this[b(359)]?this[b(302)][b(222)](0.1,0.88,null):this[b(302)][b(222)](2,0.88,null);0===this[b(376)][b(272)]?(this[b(153)]?this[b(153)][b(291)](RSEngine[b(277)][b(156)](b(208))[b(283)]):this._highRollerReward[b(291)](RSEngine[b(277)][b(156)](b(208))[b(283)]),this._shouldSkipAnim?RSUtils[b(239)](1,this,this[b(373)][b(110)](this,"closePopup")):this[b(176)][b(341)](2,this[b(373)][b(110)](this, b(298)))):(this[b(359)]?this[b(327)][b(291)]("+"+RSUtils.formatNumberWithComma(this[b(376)][b(272)])):this[b(310)](b(329),2,0,this[b(376)].piggyBonus),this._rollUpWin=!0,this[b(244)]=this._rewardDetails[GameFeatureTypeEnum[b(297)]],this[b(178)][GameFeatureTypeEnum.PRIMARY_CURRENCY]+=this._levelDetails[b(272)],this[b(190)](GameFeatureTypeEnum[b(297)]));this[b(128)]&&this[b(359)]&&this[b(229)]();!GameConfig[b(170)]&&RSAnalyticsManager[b(168)]()[b(350)](RSAnalyticsSource[b(370)],b(112),this[b(376)][b(272)], "",this._levelDetails[b(225)]);break;case b(298):this[b(147)]()}},loadParticleEffect1:function(){var a=a0_0x4cfe36,b=this[a(154)]+"StarEmitter_00-hd.plist";cc[a(193)][a(361)](b);b=new RSEmitterParticleParams;if(this._emitterSprites[a(238)])for(var c in this[a(219)])b._spriteFrames[a(368)](this[a(219)][c]);else b[a(289)][a(368)](a(249));b._startDelay=0.75;b[a(133)]=0.5;b[a(304)]=600;b[a(106)]=400;b[a(121)]=700;b[a(367)]=0;b[a(127)]=0.5;b[a(254)]=0.4;b[a(134)]=new RSPoint(this[a(314)][a(260)]()[a(216)](), this[a(314)][a(260)]().getY());b[a(226)]=new RSPoint(0,0);b._displacement=new RSPoint(0,0);b._displacementVariance=new RSPoint(RSEngine[a(322)]/2+50,RSEngine.screenHeight/2+50);b[a(169)]=this._emitterColors?this[a(348)]:null;b[a(159)]=0.3;this[a(268)]=new RSCustomAnimationEmitter(b,!1,RSCustomEmitterType[a(116)],150);this[a(284)].addChild(this._particleEmitter1);this._particleEmitter1[a(150)]()},loadParticleEffect2:function(){var a=a0_0x4cfe36,b=this._assetFolder+"ParticleEmitter_00-hd.plist";cc[a(193)].addSpriteFrames(b); b=new RSEmitterParticleParams;b[a(289)][a(368)](a(343));b[a(289)][a(368)]("ParticleEmitter_00/ParticleEmitter1.png");b[a(289)][a(368)]("ParticleEmitter_00/ParticleEmitter2.png");b[a(289)][a(368)](a(189));b[a(289)][a(368)](a(115));b[a(289)][a(368)]("ParticleEmitter_00/ParticleEmitter5.png");b[a(289)].push("ParticleEmitter_00/ParticleEmitter6.png");b[a(289)][a(368)](a(266));b[a(336)]=1;b._startDelayVariance=0.5;b[a(304)]=800;b[a(106)]=150;b[a(121)]=900;b[a(367)]=0.5;b[a(127)]=0.5;b[a(254)]=0.4;b._origin= new RSPoint(this[a(314)][a(260)]()[a(216)](),this[a(314)][a(260)]()[a(265)]());b._originVariance=new RSPoint(0,0);b[a(209)]=new RSPoint(0,0);b[a(142)]=new RSPoint(RSEngine.screenWidth/2,RSEngine[a(292)]/2+100);var c=RSGame[a(168)]()[a(324)]()[a(287)]()?RSGame.getInstance()[a(324)]()[a(287)]():200;this[a(145)]=new RSCustomAnimationEmitter(b,!1,RSCustomEmitterType[a(282)],c,this[a(152)][a(110)](this));this[a(284)].addChild(this[a(145)]);this[a(145)][a(150)]()},loadParticleEffect3:function(){var a=a0_0x4cfe36, b=a(186);cc.spriteFrameCache[a(361)](b);b=new RSEmitterParticleParams;b[a(289)][a(368)](a(231));b[a(245)]=1;b._startScaleVariance=0;b[a(338)]=3;b._endScaleVariance=0.5;b._scalingDuration=1;b[a(336)]=0;b._startDelayVariance=1;b._deviation=0.5;b[a(106)]=400;b[a(121)]=700;b[a(367)]=0;b._tweenRate=0.5;b[a(254)]=0.4;b._origin=new RSPoint(this[a(314)][a(260)]().getX(),this._levelUpPanel[a(260)]()[a(265)]());b[a(226)]=new RSPoint(20,20);b._displacement=new RSPoint(0,0);b._displacementVariance=new RSPoint(RSEngine.screenWidth, RSEngine[a(292)]);this._particleEmitter3=new RSCustomAnimationEmitter(b,!1,RSCustomEmitterType[a(116)],100);this[a(284)][a(313)](this[a(160)]);this[a(160)].loadEmitter()},unloadContent:function(){var a=a0_0x4cfe36;this[a(253)][a(212)].call(this)}}); function a0_0x3bab(){var a="startEmitter;layoutScreen;indexOf;layoutCount;RSRetentionBonusPopupVIPSFX;res/Popups/CoinFallAnimationSmall_00-hd.plist;powerups;playEffect;ParticleEmitter_00/ParticleEmitter3.png;startWinRollUp;_starMoveUpDownPanel;_playCoinAnim;spriteFrameCache;easeIn;setFrame;_rayAnim2;round;addVIPBonus;_piggyAnimActive;updateLevelUpReward;_piggyBanner;_ccObject;_coinPoint;getSheetData;_userTier;createAnimation;easeBackOut;HighRollerRewardLabel;_displacement;_vipBonus;getVIPUserTier;unloadContent;_currency1;awardBonus;_playEmitter;getX;_changeZOrder;fonts;_emitterSprites;PigTrailAnim;loadParticleEffect3;actionZoom;setVisible;_starZoomIn;level;_originVariance;GlareRight;MinBetText;stopWinRollUp;_callBack;CoinFallAnimationSmall_00/CoinFallAnimationSmall_0000.png;520bWaPFZ;_powerUpRect;_currency2;stopActionTweenForKey;ceil;sfx/Rollup.mp3;length;callFunctionWithDelay;TierUpAnim;_VipRollupCompleted;FONT_LEVEL;_levelNumberTxt;_winDisplaycoins;_startScale;LEVEL_FONT_ALIGNMENT;playMusic;assetPath;StarEmitter_00/StarEmitter_0000.png;sfx/CoinShower.mp3;_isVIPLevelupBonusEnabled;_scaleInRewardPanel;_super;_spriteAnimationSpeed;getVIPLevelupBonus;width;playBgAnimation;actionFadeIn;2103910ZlhyZA;getRect;audioManager;HIDE_CONFETTI;ON Comlete;6ZpqrSF;getY;ParticleEmitter_00/ParticleEmitter7.png;HighRollerReward;_particleEmitter1;startShatterTransition;bold;setZOrder;piggyBonus;RayClockwise;Widget;Banner;_initializeToaster;gameData;PrimaryRect;TOUCH_CANCELED;getScale;saveLevelUpReward;FOUNTAIN;messageTitleAvailable;_emitterObject;PigTrailAnimPos;PigStartPos;getCustomizedParticleCount;_levelZoomOut;_spriteFrames;loadContent;setString;screenHeight;_setVipTier;large;_piggyShatterStartSize;PowerUpRect;PRIMARY_CURRENCY;closePopup;flipHorizontally;playCoinReceivedAnimation;additionalBonusForLevelUp;_piggyBannerAnimRect;coins;_deviation;CoinStartPoint;LevelEntry;_piggyTrailAnimPlaying;_rollUpStarted;convertToNodeSpace;startActionTweenForKey;setAnchorPoint;_glareRight;addChild;_levelUpPanel;init;playRollupSfx;emitterColors;emitterSprites;playGlareAnims;_piggyEndPos;TOUCH_ENDED;screenWidth;getCasinoHUD;getGameManager;metagame;_scaleOutRewardPanel;_highRollerReward;extend;PiggyRollUp;REWARD_FONT_ALIGNMENT;removeChild;actionMoveTo;sfx/PiggyFlyIn.mp3;_currency3;cloneJSON;_startDelay;Star;_endScale;start;startTransition;actionFadeOut;7394398pDbDlI;ParticleEmitter_00/ParticleEmitter0.png;playAnimation;startShatterAnim;setOpacity;PigAnimEndLocation;_emitterColors;easeOut;trackPrimarySource;684704ByEyKk;setCenter;primaryRollUp;actionScale;_fontDetails;GlareLeft;_primaryRect;_tierUpAnim;_shouldSkipAnim;_primaryReward;addSpriteFrames;getAssetPath;secondaryRollUp;_powerUpReward;PurchaseSuccessVIPStatusVIPSFX;2868055JJkrzN;_360rotationDuration;push;floor;free;_rayAnim1;FONT_BETTEXT;_piggyAnimations;onButtonClicked;_secondaryReward;_levelDetails;setScale;SecondaryRect;_deviationVariance;FONT_REWARD;62503MZQGRd;loadParticleEffect2;bind;vipData;piggy_bank;Rollup.mp3;FONT_CURRENCY;ParticleEmitter_00/ParticleEmitter4.png;CLUSTER_MOVEMENT;powerupRollUp;_currency;InitialPosition;TOUCH_BEGAN;_speed;isPiggyBonusAvailable;_width;_onFadeOutCompleted;_piggyBonusAwarded;levelUpOrPiggy;_tweenRate;_rollUpWin;name;_piggyTrailAnim;_piggyShatterAnimStartPos;TOUCH_MOVED;_startDelayVariance;_origin;match;SecondaryReward;sfx/Confetti_win.mp3;_secondaryRect;_playIntroAnim;call;105832mrdgQh;_displacementVariance;setPosition;_displayPanel;_particleEmitter2;5qmAhBs;_onReadyToClosePopup;92580ouLswG;_glareLeft;loadEmitter;PrimaryReward;_onInitialAnimComplete;_minBetText;_assetFolder;playVIPBannerSfx;getPopupMessagesWithKey;_piggyTrailAnimPos;vip_bonus;_fadeOutDuration;_particleEmitter3;_layoutCount;PigShatterAnim;stopAnimation;actionRotateBy;_winDisplay;log;18uBmecq;getInstance;_colors;IS_MULTI_TAB_HANDLED;_contentSize;formatNumberWithComma;_initialAnimStarted;getAssetFolder;_key;_piggyShatterAnim;SECONDARY_CURRENCY;_rewardDetails;getVIPUserStatus;Level".split(";");a0_0x3bab= function(){return a};return a0_0x3bab()};var settingsFullScreen="SETTINGS_FULLSCREEN",settingsFullScreenClose="SETTINGS_FULLSCREEN_CLOSE",RSSettingsPopup=RSPopup.extend({_callBack:null,_assetFolder:null,_font:null,_userId:null,_version:null,_fullScreenBtn:null,_musicBtn:null,_soundBtn:null,_termsUrl:null,_privacyUrl:null,_playerSupportactive:!1,_isFullScreenButtonDisabled:!1,init:function(a,b,c,d,e,f,g){this._super.init.call(this,e);this._assetFolder=a;this._font=b;this._fontName=this._font.slice(this._font.lastIndexOf("/")+1,this._font.lastIndexOf(".")); this.ttfFontObjectDetails=f;this._termsUrl=c;this._privacyUrl=d;this._callBack=e;this._userId=RSGame.getInstance().getGameManager().getUpdatedUserForDisplay(RSEngine.dataManager.getMe().getId());this._version=GameConfig.VERSION;this._logOutBtn=null;g?this._isFullScreenButtonDisabled=g:(RSEventManager.getInstance().addEventListener(settingsFullScreen,this,this._onFullScreenchange.bind(this)),RSEventManager.getInstance().addEventListener(settingsFullScreenClose,this,this._closeFullScreen.bind(this))); RSAnalyticsManager.getInstance().trackGUIEvent("hud","settings","click","")},loadContent:function(){this.layoutScreen(this._assetFolder+"RSSettingsPopup");this._super.loadContent.call(this)},getName:function(){return"RSSettingsPopup"},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "btnFullScreen":this._fullScreenBtn=a;this._fullScreenBtn.stopAnimation();this._fullScreenBtn.addTouchListenerWithDelegate(this);this.setButtonStatus(this._fullScreenBtn, GlobalVars.fullscreenStatus);RSCasinoManager.getCasinoHUD().setFullScreenButtonStatus(GlobalVars.fullscreenStatus);break;case "btnMusic":this._musicBtn=a;this._musicBtn.stopAnimation();this._musicBtn.addTouchListenerWithDelegate(this);this.setButtonStatus(this._musicBtn,GlobalVars.musicStatus);break;case "btnSound":this._soundBtn=a;this._soundBtn.stopAnimation();this._soundBtn.addTouchListenerWithDelegate(this);this.setButtonStatus(this._soundBtn,GlobalVars.sfxStatus);break;case "btnLogout":this._logOutBtn= a;this._logOutBtn.setVisible(!1);RSEngine.loginMode!=LOGIN_MODE.EMAIL&&RSEngine.loginMode!=LOGIN_MODE.WEB_FACEBOOK||this._logOutBtn.setVisible(!0);break;case "btnVoiceCallOut":this._voiceCallOutBtn=a;this._voiceCallOutBtn.stopAnimation();this._voiceCallOutBtn.addTouchListenerWithDelegate(this);this.setButtonStatus(this._voiceCallOutBtn,GlobalVars.voiceCalloutsStatus);break;case "btnManageAccount":this._manageAccountBtn=a,RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&GameConfig.SSO_ENABLED||this._manageAccountBtn.setVisible(!1)}}, createCustomObject:function(a,b){switch(b.name){case "UserID":if(RSEngine.loginMode==LOGIN_MODE.GUEST)break;this._userIdLabel=new RSInputBox(b.w,b.h);"UP"==GameConfig.GAME_ID?this._userIdLabel.setPosition(b.x,b.y-b.h/5):this._userIdLabel.setPosition(b.x,b.y);this._userIdLabel.setMaxLength(130);var c=this.ttfFontObjectDetails?this.ttfFontObjectDetails.font:this._fontName,d=this.ttfFontObjectDetails?this.ttfFontObjectDetails.color:new RSColor(255,255,255,255);"UP"==GameConfig.GAME_ID?this._userIdLabel.setPlaceholderFont(c, b.h/1.5):this._userIdLabel.setPlaceholderFont(c,b.h/1.4);this._userIdLabel.setPlaceholderFontColor(d.getR(),d.getG(),d.getB(),d.getA());this._userIdLabel.setPlaceholderText("User ID: "+this._userId);this._userIdLabel.setString("User ID: "+this._userId);"UP"==GameConfig.GAME_ID?this._userIdLabel.setFont(c,b.h/1.5):this._userIdLabel.setFont(c,b.h/1.4);this._userIdLabel.setFontColor(d.getR(),d.getG(),d.getB(),d.getA());this._userIdLabel.setDelegate(this);this.addChild(this._userIdLabel);break;case "Version":this._versionLabel= new RSInputBox(b.w,b.h);"UP"==GameConfig.GAME_ID?this._versionLabel.setPosition(b.x,b.y-b.h/5):this._versionLabel.setPosition(b.x,b.y);this._versionLabel.setMaxLength(18);c=this.ttfFontObjectDetails?this.ttfFontObjectDetails.font:this._fontName;d=this.ttfFontObjectDetails?this.ttfFontObjectDetails.color:new RSColor(255,255,255,255);"UP"==GameConfig.GAME_ID?this._versionLabel.setPlaceholderFont(c,b.h/1.5):this._versionLabel.setPlaceholderFont(c,b.h/1.4);this._versionLabel.setPlaceholderFontColor(d.getR(), d.getG(),d.getB(),d.getA());this._versionLabel.setPlaceholderText("Version: "+this._version);this._versionLabel.setString("Version: "+this._version);"UP"==GameConfig.GAME_ID?this._versionLabel.setFont(c,b.h/1.5):this._versionLabel.setFont(c,b.h/1.4);this._versionLabel.setFontColor(d.getR(),d.getG(),d.getB(),d.getA());this._versionLabel.setDelegate(this);this.addChild(this._versionLabel);break;case "Overlay":this._panel=new RSPanel(0,0,0,0),this._bgPanel=new RSPanel(b.x,b.y,b.w,b.h),this._bgPanel.setBackgroundColor(0, 0,0,200),this._panelText=new RSScaledLabel("Fullscreen feature is not supported for this browser.",this._font,b,kTEXT_ALIGNMENT_CENTER),this._panel.addChild(this._bgPanel),this._panel.addChild(this._panelText)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a,b){this._playerSupportactive&&(RSAnalyticsManager.getInstance().trackGUIEvent("support","close","open_from_settings","",""),this._playerSupportactive=!1);switch(a){case "CloseBtn":this.closePopup();break;case "btnPlayerSupport":this.onPlayerSupportClicked(); break;case "btnTerms":RSAnalyticsManager.getInstance().trackPlayerAction("terms_of_service","click","open_from_settings","","");window.open(this._termsUrl,"_blank");break;case "btnPolicy":case "btnPrivacy":RSAnalyticsManager.getInstance().trackPlayerAction("privacy_policy","click","","","");window.open(this._privacyUrl,"_blank");break;case "btnLogout":if(RSEngine.loginMode==LOGIN_MODE.EMAIL||RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK)RSAnalyticsManager.getInstance().trackPlayerAction("logout","click", "","",""),this._logOutBtn.setTouchEnabled(!1),RSGame.getInstance().getGameManager().initializeLogOut(),this.closePopup();break;case "btnManageAccount":if(this._manageAccountBtn.setTouchEnabled(!1),GameConfig.SSO_ENABLED){if(RSSSOManager.getBlobIdData().blob_id&&RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-blobId"))RSEngine.popupManager.addPopup(new RSAccountManagementPopup("settings"),!0);else{var c=RSEngine.gameData.getDefaultValues().emailReward;c?RSEngine.popupManager.addPopup(new RSSingleSignOnPopup(parseInt(c)), !0):RSEngine.popupManager.addPopup(new RSSingleSignOnPopup(25E3),!0)}this.closePopup()}}this._super.onButtonClicked.call(this,a,b)},onMusicClicked:function(){var a=!GlobalVars.musicStatus;RSUtils.setLocalStorageItem("musicStatus",a);(GlobalVars.musicStatus=a)?(RSEngine.audioManager.unMuteMusic(),RSAnalyticsManager.getInstance().trackGUIEvent("settings","music","on","")):(RSEngine.audioManager.muteMusic(),RSAnalyticsManager.getInstance().trackGUIEvent("settings","music","off",""));this.setButtonStatus(this._musicBtn, a);RSEngine.externalGameManager&&RSEngine.externalGameManager.updateMachineSound();RSEventManager.getInstance().dispatchEvent("onMusicButtonUpdated")},onVoiceCallOutClicked:function(){var a=!GlobalVars.voiceCalloutsStatus;RSUtils.setLocalStorageItem("voiceCallOutStatus",a);(GlobalVars.voiceCalloutsStatus=a)?(RSEngine.audioManager.unMuteVOs(),RSAnalyticsManager.getInstance().trackGUIEvent("settings","voiceCallOut","on","")):(RSEngine.audioManager.muteVOs(),RSAnalyticsManager.getInstance().trackGUIEvent("settings", "voiceCallOut","off",""));this.setButtonStatus(this._voiceCallOutBtn,a);RSEngine.externalGameManager&&RSEngine.externalGameManager.updateMachineSound();RSEventManager.getInstance().dispatchEvent("onMusicButtonUpdated")},onFullScreenClicked:function(){cc.sys.browserType==cc.sys.BROWSER_TYPE_IE||cc.sys.browserType==cc.sys.BROWSER_TYPE_UNKNOWN||-1<window.navigator.userAgent.indexOf("Edge")?this.showBrowserUnsupported("Fullscreen feature is not supported for this browser."):this._toggleFullScreen()}, _toggleFullScreen:function(){if(this._fullScreenBtn){RSEngine.toggleFullscreen();var a=!GlobalVars.fullscreenStatus;GlobalVars.fullscreenStatus=a;this.setButtonStatus(this._fullScreenBtn,a);RSCasinoManager.getCasinoHUD().setFullScreenButtonStatus(a)}},onSoundClicked:function(){var a=!GlobalVars.sfxStatus;RSUtils.setLocalStorageItem("sfxStatus",a);GlobalVars.sfxStatus=a;(GlobalVars.voiceCalloutsStatus=a)?(RSEngine.audioManager.unMuteEffects(),void 0==this._voiceCallOutBtn&&RSEngine.audioManager.unMuteVOs(), RSAnalyticsManager.getInstance().trackGUIEvent("settings","sfx","on","")):(RSEngine.audioManager.muteEffects(),void 0==this._voiceCallOutBtn&&RSEngine.audioManager.muteVOs(),RSAnalyticsManager.getInstance().trackGUIEvent("settings","sfx","off",""));this.setButtonStatus(this._soundBtn,a);RSEngine.externalGameManager&&RSEngine.externalGameManager.updateMachineSound();RSEventManager.getInstance().dispatchEvent("onMusicButtonUpdated")},_onFullScreenchange:function(a){a=a._userData;this._fullScreenBtn&& (this.setButtonStatus(this._fullScreenBtn,a),RSCasinoManager.getCasinoHUD().setFullScreenButtonStatus(a))},_closeFullScreen:function(){this._fullScreenBtn&&(this.setButtonStatus(this._fullScreenBtn,!1),RSCasinoManager.getCasinoHUD().setFullScreenButtonStatus(!1))},setButtonStatus:function(a,b){b?a.setFrame(0):a.setFrame(1)},onPlayerSupportClicked:function(){document.getElementById("Helpshift").style.display="block";document.getElementById("helpshiftoverlay").style.display="block";RSAnalyticsManager.getInstance().trackGUIEvent("support", "open","open_from_settings","","");this._playerSupportactive=!0},showBrowserUnsupported:function(a){a&&this._panelText.setString(a);this._fullScreenBtn&&this._fullScreenBtn.setTouchEnabled(!1);this.addChild(this._panel);this._panel.getDisplayObject().setOpacity(0);this._panel.getDisplayObject().setCascadeOpacityEnabled(!0);this._panel.actionFadeIn(2,this._removePanel.bind(this))},_removePanel:function(){this._panel.actionFadeOut(0.5,this._panelDisabled.bind(this))},_panelDisabled:function(){this.removeChild(this._panel); this._fullScreenBtn&&this._fullScreenBtn.setTouchEnabled(!0)},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){RSGame.getInstance().getAssetPath("ButtonClick_SFX")&&RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"),!1);switch(a._ccObject._name){case "btnMusic":this.onMusicClicked();break;case "btnFullScreen":this.onFullScreenClicked();break;case "btnSound":this.onSoundClicked();break;case "btnVoiceCallOut":this.onVoiceCallOutClicked()}}, handleButtonClick:function(a,b){this._super.handleButtonClick.call(this,a,b)},editBoxEditingDidBegan:function(a){RSEngine.loginMode!=LOGIN_MODE.GUEST&&(this._userIdLabel.setString("User ID: "+this._userId),this._userIdLabel.setPlaceholderText(""),this._versionLabel.setPlaceholderText(""),this._versionLabel.setString("Version: "+this._version))},editBoxEditingDidEnded:function(a){RSEngine.loginMode!=LOGIN_MODE.GUEST&&(this._userIdLabel.setString("User ID: "+this._userId),this._userIdLabel.setPlaceholderText(""), this._versionLabel.setPlaceholderText(""),this._versionLabel.setString("Version: "+this._version))},editBoxTextChanged:function(a,b){RSEngine.loginMode!=LOGIN_MODE.GUEST&&(this._userIdLabel.setString(""),this._userIdLabel.setPlaceholderText("User ID: "+this._userId),this._versionLabel.setPlaceholderText("Version: "+this._version),this._versionLabel.setString(""))},editBoxEditingReturn:function(a){},unloadContent:function(){RSAnalyticsManager.getInstance().trackGUIEvent("hud","settings","close",""); this._isFullScreenButtonDisabled||(RSEventManager.getInstance().removeListenersForEvent(settingsFullScreen),RSEventManager.getInstance().removeListenersForEvent(settingsFullScreenClose));this._super.unloadContent.call(this)}});var PlacementsVO=RSVO.extend({triggerType:null,enabled:null,actionType:null,actionName:null,condition:null,displayCount:null,activated:null,init:function(a){this.actionName=this.actionType=this.enabled=this.triggerType="";this.condition=[];this.displayCount=0;this.activated="";this._super.init.call(this,a)}});var RSPlacementInterface=RSClass.extend({init:function(){this._super.init.call(this)},loadPopup:function(a){},getCurrentPopupTriggered:function(){}});var RSPlacementManager=function(){var a,b=RSClass.extend({_daysSinceJoin:0,_monetizationCount:0,_monetizationFactor:0,_triggerList:null,_checkActiveList:null,_placementsDataArray:null,_cumulativeQueue:null,_dailySessionCount:null,_activateList:null,_currentActionsQueue:null,_cumulativeActions:null,_currentBet:null,_placementInterface:null,initialise:function(){this._triggerList={};this._checkActiveList={};this._placementsDataArray=[];this._cumulativeQueue=[];this._activateList=[];this._currentActionsQueue= [];this._cumulativeActions={};this._daysSinceJoin=this.getNumberOfDays();this.initializeSession();this._monetizationCount=RSEngine.dataManager.getMe().getMonetizationCount();this._monetizationFactor=RSEngine.dataManager.getMe().getMonetizationFactor();for(var a=RSEngine.gameData.getSheetData("placements"),b=0;b<a.length;b++)this.setPlacementsDataArray(a[b])},activateAllPlacementsFor:function(a){for(var b=null,e=0;e<this._placementsDataArray.length;e++)b=this._placementsDataArray[e],"Activate"==b.triggerType&& ("AddToCQ"==b.actionType?b.activated||(b.activated=!0,this._cumulativeQueue.push(b)):this.getPlacementStatus(b,a)&&this.performAction(b,a))},deactivateAllPlacementsFor:function(a){for(var b=!1,e=0;e<this._activateList.length;e++){for(var b=!1,f=this._activateList[e],g=0;g<f.condition.length;g++){var h=f.condition[g];if(h.TA&&h.TA==a){b=!0;break}}b&&(f.activated=!1,this._activateList.splice(e,1))}},getNumberOfDays:function(){var a=RSEngine.dataManager.getMe().getJoiningDate();null==a&&(a=TimeManager.getInstance().getCurrentServerTime()); var b=RSEngine.dataManager.getMe().getLastLogin();null==b&&(b=a);return Math.ceil((b-a)/86400)},initializeSession:function(){var a=RSUtils.getLocalStorageItem("RSDailySessionCountObject");if(a){var b=[];b[0]=JSON.stringify(a);var b=RSUtils.getHashValue(b),e=RSUtils.getLocalStorageItem("RSDailySessionCountHashValue");b==e&&(b=a.day,e=a.session,b<this._daysSinceJoin?(b=this._daysSinceJoin,a.day=b,a.session=1):a.session=e+1,this.saveDailySessionObject(a))}else a={},a.day=this._daysSinceJoin,a.session= 1,this.saveDailySessionObject(a);this._dailySessionCount=a.session},setPlacementsDataArray:function(a){a=new PlacementsVO(a);this._placementsDataArray.push(a);for(var b=0;b<a.condition.length;b++)if(a.condition[b])if(a.condition[b].TA&&"Trigger"==a.triggerType){this.addTriggerPlacement(a.condition[b].TA,a);break}else if(a.condition[b].CA){this.addTriggerCheckActionList(a.condition[b].CA,a);break}},addTriggerPlacement:function(a,b){null==this._triggerList[a]&&(this._triggerList[a]=b,b.activated=!0)}, addTriggerCheckActionList:function(a,b){null==this._checkActiveList[a]&&(this._checkActiveList[a]=b,b.activated=!0)},saveDailySessionObject:function(a){var b=[];a=JSON.stringify(a);b[0]=a;RSUtils.setLocalStorageItem("RSDailySessionCountHashValue",RSUtils.getHashValue(b));RSUtils.setLocalStorageItem("RSDailySessionCountObject",a)},getPlacementStatus:function(a,b,e){if(!a.enabled)return!1;for(var f=!1,g=0;g<a.condition.length&&(!a.condition[g]||!(f=this.checkAllConditions(a.condition[g],b,a,e)));g++); return f},checkAllConditions:function(a,b,e,f){var g=!1,h;for(h in a)if(g={},g.key=h,g.value=a[h],g=this.checkForCondition(g,b,e,f),!g)break;return g},checkForCondition:function(a,b,e,f){var g=!1,h=a.value;if("DE"==a.key)this._daysSinceJoin==h&&(g=!0);else if("DM"==a.key)0==this._daysSinceJoin%h&&0<this._daysSinceJoin&&(g=!0);else if("DO"==a.key)this._daysSinceJoin>=h&&(g=!0);else if("SE"==a.key)this._dailySessionCount==h&&(g=!0);else if("SM"==a.key)0==this._dailySessionCount%h&&(g=!0);else if("SO"== a.key)this._dailySessionCount>=h&&(g=!0);else if("FAC"==a.key)f.winFactor>=h&&(g=!0);else if("FLAG"==a.key)g=h;else if("DISC"==a.key)e.displayCount<h&&(g=!0);else if("TA"==a.key)b==h&&(g=!0);else if("CA"==a.key)b==h&&(g=!0);else if("EA"==a.key)h.CBRemainingForActionLessThanAvgBet&&(b=h.CBRemainingForActionLessThanAvgBet,e=h.AN,a=RSCasinoManager.getPrimaryCurrency(),b*=this.getAverageOfCumulativeAmount(e),a<b&&(g=!0)),h.CBLessThanLastBet&&(h=h.CBLessThanLastBet,a=RSCasinoManager.getPrimaryCurrency(), b=this.getLastBet(),a<=b*h&&a>=b*(h-1)&&(g=!0));else if("CBLessThanLastBet"==a.key)a=RSCasinoManager.getPrimaryCurrency(),b=this.getLastBet(),a<b&&(g=!0);else if("DINA"==a.key)g=this.checkForDependentActions(h);else{if("OPGV"==a.key||"LTT"==a.key)return h?!1:!0;"UDISC"==a.key&&(this._checkActiveList[a.value].displayCount++,g=!0)}return g},performAction:function(a,b){if("AddToAL"==a.actionType)a.activated||(this._activateList.push(a),a.activated=!0);else if("CheckAL"==a.actionType)for(var e=0;e<this._activateList.length;e++)if(a.actionName== this._activateList[e].actionName){this.triggerActionForPlacement(a);break}},triggerActionForPlacement:function(a){var b=this._checkActiveList[a.actionName];b&&this.getPlacementStatus(b,a.actionName)&&this.triggerActionToGame(b)},triggerActionToGame:function(a){"AddToPopup"==a.actionType&&null!=this.getInterface()&&(this._placementInterface.loadPopup(a.actionName),this.updatePlacementTriggerCount(a),this._currentActionsQueue.push(a))},notifyEventTriggerToPlacementManager:function(a){if(a){var b=this._triggerList[a.eventName]; b&&("CheckCQ"==b.actionType?this.updateCumulativeActionFor(b,a):this.getPlacementStatus(b,a.eventName,a)&&this.performAction(b,a.eventName));this.clearCurrentActionsQueue()}},updatePlacementTriggerCount:function(a){a.displayCount++},updateCumulativeActionFor:function(a,b){for(var e=0;e<this._cumulativeQueue.length;e++){var f=this._cumulativeQueue[e];if(f.actionName==a.actionName){this.updaeteCumulativeAction(f,b);break}}},clearCurrentActionsQueue:function(){this._currentActionsQueue=[]},updaeteCumulativeAction:function(a, b){var e=this._cumulativeActions[a.actionName];e||(e=[]);for(var f=0,g=0;g<a.condition.length;g++){var h=a.condition[g];if(h.size){f=h.size;break}}e.length>=f&&e.shift();e.push(b.betAmount);this._cumulativeActions[a.actionName]=e},getAverageOfCumulativeAmount:function(a){var b=0,e=0;a=this._cumulativeActions[a];for(e=0;e<a.length;e++)b+=a[e];return e=b/a.length},notifyBetChangeToPlacementManager:function(a){this._currentBet=a},getLastBet:function(){return this._currentBet},checkForDependentActions:function(a){for(var b= !0,e=0;e<this._currentActionsQueue;e++)if(this._currentActionsQueue[e].actionName==a){b=!1;break}return b},getInterface:function(){return this._placementInterface},setInterface:function(a){this._placementInterface=a}});return{getInstance:function(){a||(a=new b);return a}}}();var RSPlacementObject=RSClass.extend({init:function(){this.winFactor=this.betAmount=this.winAmount=0;this.optVal=this.eventName=null}});var RSNetworkDisconnectPopup=RSGenericPopup.extend({_message:null,_layoutLoaded:null,_messageTextBox:null,_tryAgainBtn:null,_reloadBtn:null,init:function(a){this._layoutLoaded=!1;this._layout=a.layout;this._super.init.call(this,null,a)},loadContent:function(){this._layoutLoaded||(this.layoutScreen(this._layout),this._super.loadContent.call(this))},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);RSGame.getInstance().getGameManager().hideOverlayLayer();this._layoutLoaded=!0},onPopupAnimationComplete:function(){RSGame.getInstance().getGameManager().hideOverlayLayer(); RSAnalyticsManager.getInstance().trackConnectionLost("trigger");RSGame.getInstance().getGameManager().getGameType()==RSGameTypes.Bingo&&RSAnalyticsManager.getInstance().trackBingoConnectionLoss(RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName(),RSGame.getInstance().getGameManager().getCardCount(),RSGame.getInstance().getGameManager().getRoundId());RSEventManager.getInstance().dispatchEvent("RS_CONNECTION_LOST_EVENT");this._super.onPopupAnimationComplete.call(this)},enableButtons:function(a){this._tryAgainBtn.setTouchEnabled(a)}, setPopupData:function(a,b,c){this._message=a;b&&(this._callback=b);this._messageTextBox.setString(a);c&&this._reloadBtn&&(this._reloadBtn.setVisible(!0),this._tryAgainBtn.setVisible(!1))},createCustomObject:function(a,b){switch(b.name){case "TextLabel":var c=new RSScaledLabel(this._message,this._assetConfig.textFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(c);this._messageTextBox=c}return this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){switch(c.name){case "SmallBtn":case "MediumBtn":case "LargeBtn":case "LargeBtnType2":case "MediumBtnType2":case "SmallBtnType2":case "SmallBtnType1":case "MediumBtnType1":case "LargeBtnType1":if("CP_Button_T2"== c.type){this._reloadBtn=a;this._reloadBtn.setVisible(!1);break}this._tryAgainBtn=a}this._super.onObjectCreated.call(this,a,b,c)},onButtonClicked:function(a){switch(a){case "CP_Button_T1":case "CP_Button_T2":this._callback&&this._callback.call(this);break;case "CloseBtn":this._callback&&this._callback.call(this)}RSGame.getInstance().getGameManager().showOverlayLayer()},unload:function(){RSEventManager.getInstance().dispatchEvent("RS_CONNECTION_RETRY")},unloadPopup:function(){this._message=null;this._super.unload.call(this)}, closePopup:function(){RSGame.getInstance().getGameManager().hideOverlayLayer();this._super.closePopup.call(this)}});var RSActionShareManager=function(){var a=null,b=RSClass.extend({init:function(){this._super.init.call(this);this._externalCallback=null;this._retryCount=0},_publishOpenGraph:function(a,b){RSEngine.closeFullScreen();var e=RSGame.getInstance().getGameData().getActionOGById(a.ogType),f={},g="";if(a.extraParams)for(var h in a.extraParams)g+="\x26"+h+"\x3d"+encodeURI(a.extraParams[h]);h=(""+(new Date).getTime()+Math.floor(1E4*Math.random())).substr(0,16);a.machineName&&""!=a.machineName||(a.machineName= e.machineName);var k=a.machineName.split(" ").join("%20"),m=encodeURI(RSGame.getInstance().getUserDataManager().getMe().getUserFirstName());f[e.object]=GameConfig.BASE_URL+"/openGraph.php?id\x3d"+e.id+"\x26roomName\x3d"+k+g+"\x26playerName\x3d"+m+"\x26u\x3d"+h+"\x26platform\x3d"+RSEngine.platform+"\x26link\x3d"+b.shortUrl+"\x26t\x3d"+TimeManager.getInstance().getCurrentServerTime();cc.log("Publishing Action::"+f[e.object],!0);RSSocialManager.getInstance().publishAction(f[e.object],this._shareStatusCallback.bind(this, {giftLinkId:b.giftLinkId,medium:"facebook"}))},initiateShare:function(a,b){this._externalCallback=b;var e=RSGame.getInstance().getGameData().getActionOGById(a.ogType),f={};f.ogType=a.ogType;f.extraParams=a.extraParams;var g={};g.eventID=e.eventID;g.shareLink=e.link;g.type=e.id;g.level=RSGame.getInstance().getLevelManager().getCurrentLevel();RSGame.getInstance().getUserDataManager().createGiftingLink(g,this._onShareLinkCreationSuccess.bind(this,f),this._onShareLinkCreationFailed.bind(this,a))},_onShareLinkCreationSuccess:function(a, b){this._retryCount=0;if(b){var e=b.result;"success"===e.message?this._publishOpenGraph(a,e.data):this._externalCallback&&this._externalCallback(!1)}},_onShareLinkCreationFailed:function(a){3>this._retryCount?(this._retryCount++,this.initiateShare(a,this._externalCallback)):this._retryCount=0},_shareStatusCallback:function(a,b){b?RSGame.getInstance().getUserDataManager().enableGiftingLink(a,this._onShareLinkEnableSuccess.bind(this),this._onShareLinkEnableFailed.bind(this,a,b)):this._externalCallback&& this._externalCallback(!1)},_onShareLinkEnableSuccess:function(a){this._retryCount=0;a&&(cc.log("link activated"),this._externalCallback&&this._externalCallback(!0))},_onShareLinkEnableFailed:function(a,b){3>this._retryCount?(this._retryCount++,this._shareStatusCallback(a,b)):this._retryCount=0}});return{getInstance:function(){null===a&&(a=new b);return a}}}();var RSActionShareWidget=RSDisplayObject.extend({init:function(){this._super.call(this,new RSRect(0,0,0,0));this._isShareEnabled=!0;this._callback=this._shareButton=this._tickObject=null;this.loadLayout(RSGame.getInstance().getAssetPath("RSActionShareWidget"))},onObjectCreated:function(a,b,c){this._super.call(this,a,b,c);switch(c.name){case "Tick":this._tickObject=a;break;case "ShareButton":this._shareButton=a}},onButtonClicked:function(a){"ShareButton"===a&&(this._isShareEnabled=!this._isShareEnabled, this._tickObject.setVisible(this._isShareEnabled))},initiateShare:function(a,b){this._callback=b;this._isShareEnabled?(this._shareButton.setTouchEnabled(!1),RSActionShareManager.getInstance().initiateShare(a,b),RSAnalyticsManager.getInstance().trackFBFeedShare("sent",a)):b()}});var RSCondition=RSVO.extend({id:null,type:null,condition:null,values:null,containsCount:{},isDependant:null,haveGenre:!1,genre:null,init:function(a){this.values=this.condition=this.type=this.id="";this.haveGenre=this.isDependant=!1;this.genre="";this._super.init.call(this,a);if("C"==this.condition){this.containsCount={};for(var b in this.values)this.containsCount[this.values[b]]?this.containsCount[this.values[b]]++:this.containsCount[this.values[b]]=1}else if("E"==this.condition)if("QIDS"==this.type)this.isDependant= !0;else if("GENRE"==this.type)for(b in this.haveGenre=!0,b=null,this.values)this.genre=this.values[b]},checkAction:function(a){if("E"==this.condition){var b=!1,c;for(c in this.values){if(!a.equalValidation(this.type,this.values[c]))return!1;b=!0}return b}if("NE"==this.condition){b=!1;for(c in this.values){if(a.equalValidation(this.type,this.values[c]))return!1;b=!0}return b}if("LV"==this.condition){b=!1;for(c in this.values){if(!a.lessThanValidation(this.type,this.values[c]))return!1;b=!0}return b}if("LE"== this.condition){b=!1;for(c in this.values){if(!a.lessThanValidation(this.type,this.values[c])&&!a.equalValidation())return!1;b=!0}return b}if("GV"==this.condition){b=!1;for(c in this.values){if(!a.greaterThanValidation(this.type,this.values[c]))return!1;b=!0}return b}if("GE"==this.condition){b=!1;for(c in this.values){if(!a.greaterThanValidation(this.type,this.values[c])&&!a.equalValidation(this.type,this.values[c]))return!1;b=!0}return b}if("N"==this.condition){var d=b=-1;for(c in this.values){b= a.findValueIndex(this.type,this.values[c]);if(-1==b)return!1;-1==d&&(d=b)}if(1==Math.abs(d-b))return!0}else{if("C"==this.condition){b=!1;for(c in this.values){b=a.findValueCount(this.type,this.values[c]);if(0==b||b<this.containsCount[this.values[c]])return!1;b=!0}return b}if("S"==this.condition){d=b=-1;for(c in this.values)if(b=a.findValueIndex(this.type,this.values[c]),-1!=b&&b==d+1)d=b;else return!1;if(d==b)return!0}else{if("NC"==this.condition){b=!1;for(c in this.values){b=a.findValueCount(this.type, this.values[c]);if(0!=b)return!1;b=!0}return b}if("CNT"==this.condition){b=!1;for(c in this.values){b=a.calculateCount(this.type,this.values[c]);if(0==b)return!1;b=!0}return b}}}return!1},getActiveState:function(){var a=!0,b;for(b in this.values)if("QIDS"==this.type){var c=this.values[b].replace("qids","q"),c=RSQuestManager.getInstance().getQuest(c);null!=c&&(c.getStatus()||(a=!1))}return a},getGenre:function(){return this.genre}});var DailyChallengeObjectiveStatus={InProgress:0,Completed:1,CompletedAndCollected:2,RewardCollected:3},RSObjective=RSVO.extend({id:null,description:null,count:null,streek:null,conditions:null,updateType:null,conditionObject:[],dependants:null,genre:null,init:function(a){this.conditions=this.description=this.id="";this.streek=this.count=0;this.updateType="";this._super.init.call(this,a);this.status=!1;this.conditionObject=[];this.dependants=[];this.genre="";for(var b in this.conditions)a=RSQuestManager.getInstance().getCondition(this.conditions[b]), null!=a&&(a.isDependant?this.dependants.push(a):a.haveGenre||this.conditionObject.push(a),a.haveGenre&&(this.genre=a.getGenre()));this.countUpdate=RSQuestManager.getInstance().getUserObjectiveCount(this.id);this.count<=this.countUpdate&&(this.status=!0)},triggerAction:function(a){if(""!=this.genre&&!a.checkGenre(this.genre))return!1;if(!this.status){var b=!0,c=!1,d;for(d in this.conditionObject)this.conditionObject[d].checkAction(a)||(b=!1);b?(this.countUpdate+=a.updateCount(this.updateType),c=!0, this.count<=this.countUpdate?(this.countUpdate=this.count,this.status=b=!0):b=!1):parseInt(this.streek)&&0!=this.countUpdate&&(this.countUpdate=0,b=!1,c=!0);c&&(RSQuestManager.getInstance().setUserQuestObjectiveCount(this.id,this.countUpdate),b||RSQuestManager.getInstance().setUserObjectiveCompletionStatus(this.id,DailyChallengeObjectiveStatus.InProgress));b&&(URLConfig.CLEVERTAP_ENABLED&&RSPlatformSDKManager.getInstance().setUserAttributeDQRewardPending(!0),RSQuestManager.getInstance().setUserObjectiveCompletionStatus(this.id, DailyChallengeObjectiveStatus.Completed),RSEventManager.getInstance().dispatchEvent(RSObjectiveCompleted,{objectiveId:this.id}),RSEventManager.getInstance().dispatchEvent("refreshQuestCountText"));(b||c)&&RSEngine.dataManager.saveUserBlobParams();return b}},getStatus:function(){return this.status},getActiveState:function(){var a=!0,b;for(b in this.dependants)this.dependants[b].getActiveState()||(a=!1);return a}});var RSObjectiveList=RSVO.extend({id:null,objectives:null,objective:[],init:function(a){this.objectives=this.id="";this._super.init.call(this,a);this.objectiveCompleted=!0;this.objective=[];for(a=0;a<this.objectives.length;a++){var b=RSQuestManager.getInstance().getObjectives(this.objectives[a]);b&&(this.objective.push(b),b.getStatus()||(this.objectiveCompleted=!1))}this.status=this.objectiveCompleted},triggerAction:function(a){if(!this.status){this.objectiveCompleted=!0;for(var b in this.objective)this.objective[b].triggerAction(a)|| (this.objectiveCompleted=!1);return this.objectiveCompleted}},getStatus:function(){return this.status},getActiveState:function(){var a=!0,b;for(b in this.objectives)this.objective[b].getActiveState()||(a=!1);return a}});var RSQuest=RSVO.extend({id:null,objectiveLists:null,title:null,description:null,reward:null,objectiveList:[],questActionType:null,questAction:null,buttonText:null,skippable:null,_inactive:null,init:function(a){this.skippable=this.buttonText=this.questAction=this.questActionType=this.rewardId=this.description=this.title=this.objectiveLists=this.id="";this._super.init.call(this,a);this.objectiveListCompleted=!0;this._inactive=!1;this.objectiveList=[];for(a=0;a<this.objectiveLists.length;a++){var b= RSQuestManager.getInstance().getObjectiveList(this.objectiveLists[a]);null!=b&&(this.objectiveList.push(b),b.getStatus()||(this.objectiveListCompleted=!1))}this.status=this.objectiveListCompleted},triggerAction:function(a){if(this._inactive)return this.updateActiveStatus(),!1;if(!this.status){this.objectiveListCompleted=!1;for(var b in this.objectiveList)this.objectiveList[b].triggerAction(a)&&(this.objectiveListCompleted=!0);this.objectiveListCompleted&&(this.status=this.objectiveListCompleted,RSQuestManager.getInstance().triggerQuestCompletedEventToCasino(this.id)); return this.objectiveListCompleted}},getStatus:function(){return this.status},updateActiveStatus:function(){var a=!0,b;for(b in this.objectiveList)this.objectiveList[b].getActiveState()||(a=!1);this._inactive=!a}});var RSQuestSet=RSVO.extend({id:null,questList:null,rewardId:null,status:!1,questListCompleted:!1,quest:[],init:function(a){this.rewardId=this.questList=this.id="";this._super.init.call(this,a);this.questListCompleted=!0;this.quest=[];for(a=0;a<this.questList.length;a++){var b=RSQuestManager.getInstance().getQuest(this.questList[a]);null!=b&&(this.quest.push(b),b.getStatus()||(this.questListCompleted=!1))}this.status=this.questListCompleted},setQuestStatus:function(a){this.status=a},triggerAction:function(a){if(!this.status){this.questListCompleted= !0;for(var b in this.quest)this.quest[b].triggerAction(a)||(this.questListCompleted=!1);this.questListCompleted&&(this.status=!0,RSQuestManager.getInstance().setUserQuestSetCompletionStatus());return this.questListCompleted}},getRewardId:function(){return this.rewardId},updateActiveStatus:function(){for(var a in this.quest)this.quest[a].updateActiveStatus()}});var RSQuestReward=RSVO.extend({id:null,coins:null,points:null,init:function(a){this.id="";this.points=this.coins=0;this._super.init.call(this,a)}});var RSBingoAction=RSClass.extend({_result:null,_currentRoom:null,_cardCount:null,_cardBuyInAmount:null,_usedPowerups:null,_daubbedCount:null,_totalWinPrimaryCurrency:null,_totalWinSecondaryCurrency:null,_totalWinPowerups:null,_totalWinXp:null,_bingoCount:null,_ranks:null,_gainedCollectibles:null,_callOutCount:null,_currentLevel:null,init:function(a,b,c,d,e,f,g,h,k,m,n,p,r,s,u){this._result=a;this._currentRoom=b;this._cardCount=c;this._cardBuyInAmount=d;this._usedPowerups=e;this._daubbedCount=f;this._totalWinPrimaryCurrency= g;this._totalWinSecondaryCurrency=h;this._totalWinPowerups=k;this._totalWinXp=m;this._bingoCount=n;this._ranks=p;this._gainedCollectibles=r;this._callOutCount=s;this._currentLevel=u},equalValidation:function(a,b){switch(a){case "QIDS":break;case "BCR":for(var c=!1,d=0;d<this._convertValue(b,"bcr_");d++)if(-1==this._ranks.indexOf(d+1)){c=!1;break}else c=!0;return c?!0:!1;case "BM":if(this._currentRoom==b)return!0;break;case "BCW":if(this._bingoCount==this._convertValue(b,"bcw_"))return!0;break;case "BBA":if(this._cardBuyInAmount== this._convertValue(b,"bba_"))return!0;break;case "BCC":if(this._cardCount==this._convertValue(b,"bcc_"))return!0;break;case "BD":if(this._daubbedCount==this._convertValue(b,"bd_"))return!0;break;case "BWXP":if(this._totalWinXp==this._convertValue(b,"bwxp_"))return!0;break;case "BWP":if(this._totalWinPowerups.length==this._convertValue(b,"bwp_"))return!0;break;case "BWC":if(this._totalWinPrimaryCurrency==this._convertValue(b,"bwc_"))return!0;break;case "GLU":if(this._currentLevel&&this._currentLevel== this._convertValue(b,"glu_"))return!0;break;default:return!1}},lessThanValidation:function(a,b){switch(a){case "BCW":if(this._bingoCount<this._convertValue(b,"bcw_"))return!0;break;case "BBA":if(this._cardBuyInAmount<this._convertValue(b,"bba_"))return!0;break;case "BCC":if(this._cardCount<this._convertValue(b,"bcc_"))return!0;break;case "BD":if(this._daubbedCount<this._convertValue(b,"bd_"))return!0;break;case "BWXP":if(this._totalWinXp<this._convertValue(b,"bwxp_"))return!0;break;case "BWP":if(this._totalWinPowerups.length< this._convertValue(b,"bwp_"))return!0;break;case "BWC":if(this._totalWinPrimaryCurrency<this._convertValue(b,"bwc_"))return!0;break;case "GLU":if(this._currentLevel&&this._currentLevel<this._convertValue(b,"glu_"))return!0;break;default:return!1}},greaterThanValidation:function(a,b){switch(a){case "BCW":if(this._bingoCount>this._convertValue(b,"bcw_"))return!0;break;case "BBA":if(this._cardBuyInAmount>this._convertValue(b,"bba_"))return!0;break;case "BCC":if(this._cardCount>this._convertValue(b,"bcc_"))return!0; break;case "BD":if(this._daubbedCount>this._convertValue(b,"bd_"))return!0;break;case "BWXP":if(this._totalWinXp>this._convertValue(b,"bwxp_"))return!0;break;case "BWP":if(this._totalWinPowerups.length>this._convertValue(b,"bwp_"))return!0;break;case "BWC":if(this._totalWinPrimaryCurrency>this._convertValue(b,"bwc_"))return!0;break;case "GLU":if(this._currentLevel&&this._currentLevel>this._convertValue(b,"glu_"))return!0;break;default:return!1}},findValueIndex:function(a,b){return-1},findValueCount:function(a, b){var c=0;if(this.isEqualToString(a,"BPC"))for(var d=null,e=0;e<this._usedPowerups.length;e++)d=this._usedPowerups[e],this.isEqualToString(d[e],b)&&c++;return c},findValueIndex:function(a,b){},updateCount:function(a){if(!this.isEqualToString(a,"incrementer")){if(this.isEqualToString(a,"bet_amount"))return this._cardBuyInAmount;if(this.isEqualToString(a,"win_amount"))return this._totalWinPrimaryCurrency;if(this.isEqualToString(a,"bingo_win_count"))return this._bingoCount}return 1},isEqualToString:function(a, b){return a===b?!0:!1},_convertValue:function(a,b){return Number(a.replace(b,""))},checkGenre:function(a){return!1}});var BlackjackWinType={NO_WIN:0,NORMAL_WIN:1,BLACKJACK_WIN:2},BlackjackHandState={NORMAL:0,SPLIT:1,DOUBLE_DOWN:2,SURRENDER:3},RSBlackjackGameMode={NORMAL:"Normal",SPLIT:"Split",DOUBLE_DOWN:"DoubleDown",SURRENDER:"Surrender"},RSBlackjackAction=RSClass.extend({_playerStatus:null,init:function(a,b,c,d){this._playerStatus=a;this._isFirstHand=b;this._currentMachineID=c;this._deal=d;this._count=0},findValueIndex:function(a,b){},findValueCount:function(a,b){},calculateCount:function(a,b){return this._count= this.findValueCount(a,b)},equalValidation:function(a,b){var c=this._playerStatus._win;if("BJRO"==a){if(this._isFirstHand)return!0}else if("BJM"==a){if(this._currentMachineID==b)return!0}else if("BJR"==a){var d=parseInt(b.replace("bjr_","")),e=this._playerStatus._blackjack;if(d==BlackjackWinType.NO_WIN&&0==c||d==BlackjackWinType.NORMAL_WIN&&0<c&&!e||d==BlackjackWinType.BLACKJACK_WIN&&0<c&&e)return!0}else if("BJWC"==a){if(c==b.replace("bjwc_",""))return!0}else if("BJHS"==a)if(b=Number(b.replace("bjhs_", "")),b==BlackjackHandState.SPLIT){if(this._playerStatus._mode==RSBlackjackGameMode.SPLIT)return!0}else if(b==BlackjackHandState.DOUBLE_DOWN){if(this._playerStatus._mode==RSBlackjackGameMode.DOUBLE_DOWN)return!0}else{if(b==BlackjackHandState.SURRENDER&&this._playerStatus._mode==RSBlackjackGameMode.SURRENDER)return!0}else if("BJI"==a){if(this._playerStatus._insured==Number(b.replace("bji_","")))return!0}else if("BJBC"==a){if(this._playerStatus._bet==Number(b.replace("bjbc_","")))return!0}else if("BJS"== a){if(this._playerStatus._standValue==Number(b.replace("bjs","")))return!0}else if("BJD"==a&&(b=Number(b.replace("bjd_","")),parseInt(this._deal)==b))return!0;return!1},lessThanValidation:function(a,b){var c=this._playerStatus._win;if("BJR"!=a)if("BJWC"==a){if(c<Number(b.replace("bjwc_","")))return!0}else if("BJHS"!=a&&"BJI"!=a)if("BJBC"==a){if(this._playerStatus._bet<Number(b.replace("bjbc_","")))return!0}else if("BJS"==a&&this._playerStatus._standValue<Number(b.replace("bjs","")))return!0;return!1}, greaterThanValidation:function(a,b){var c=this._playerStatus._win;if("BJR"!=a)if("BJWC"==a){if(c>Number(b.replace("bjwc_","")))return!0}else if("BJHS"!=a&&"BJI"!=a)if("BJBC"==a){if(this._playerStatus._bet>Number(b.replace("bjbc_","")))return!0}else if("BJS"==a&&this._playerStatus._standValue>Number(b.replace("bjs","")))return!0;return!1},updateCount:function(a){if("incrementer"!=a){if("bet_amount"==a)return this._playerStatus._bet;if("win_amount"==a)return this._playerStatus._totalWinAmount;if("count"== a)return this._count}return 1},checkGenre:function(a){return!1}});var RSBlackjackDataParser=function(){};RSBlackjackDataParser.parse=function(a){var b=!0,c;for(c in a._gameResult)a._gameResult[c]._bet&&RSQuestManager.getInstance().triggerAction(new RSBlackjackAction(a._gameResult[c],b,a._machineAnalyticsID,"00")),b=!1;RSQuestManager.getInstance().triggerAction(new RSBlackjackAction(a,b,a._machineAnalyticsID,"01"));2<=a._gameResult.length&&SideMenuController.getInstance().updateToasterMessage()};var GeneralQuestEventTypes={BIHOURLY_BONUS:"Bihourly_Bonus",DAILY_BONUS:"Daily_Bonus",MACHINE_UNLOCK:"Machine_Unlock",PURCHASE:"Purchase",LEVEL_UP:"Level_Up",GIFT:"Gifting",DAILY_LOGIN:"Daily_Login",WATCH_AD:"Watch_Ad"},RSGeneralQuestEvent=RSClass.extend({eventID:"",parameters:null}),MachineUnlockParameters=RSClass.extend({machineName:""}),LevelUpParameters=RSClass.extend({updatedLevel:0}),BonusCollectionParameters=RSClass.extend({bonusCollected:0,collectionStreak:0}),PurchaseParameters=RSClass.extend({purchasePackID:"", purchasePriceDollars:0}),GiftParameters=RSClass.extend({giftType:-1}),DailyLoginParameters=RSClass.extend({loginCount:0}),WatchAdParameters=RSClass.extend({adCount:0}),RSGeneralAction=RSClass.extend({_event:null,init:function(a){this._event=a},findValueIndex:function(a,b){},findValueCount:function(a,b){},calculateCount:function(a,b){return 0},equalValidation:function(a,b){if("GMU"==a&&this._event.eventID==GeneralQuestEventTypes.MACHINE_UNLOCK){if(b.replace("gmu_","")==this._event.parameters.machineName)return!0}else if("GLU"== a&&this._event.eventID==GeneralQuestEventTypes.LEVEL_UP){if(b.replace("glu_","")==this._event.parameters.updatedLevel)return!0}else if("GBC"==a){if(0==parseInt(b.replace("gbc_",""))&&this._event.eventID==GeneralQuestEventTypes.DAILY_BONUS||1==parseInt(b.replace("gbc_",""))&&this._event.eventID==GeneralQuestEventTypes.BIHOURLY_BONUS)return!0}else if("GG"==a&&this._event.eventID==GeneralQuestEventTypes.GIFT){if(b.replace("gg_","")==this._event.parameters.giftType)return!0}else if("GPII"==a&&this._event.eventID== GeneralQuestEventTypes.PURCHASE){if(b.replace("ggii_","")==this._event.parameters.purchasePackID)return!0}else if("GPDP"==a&&this._event.eventID==GeneralQuestEventTypes.PURCHASE){if(b.replace("gpdp_","")==this._event.parameters.purchasePriceDollars)return!0}else if("GET"==a&&this._event.eventID==GeneralQuestEventTypes.DAILY_LOGIN){if(b.replace("get_","")==this._event.parameters.loginCount)return!0}else if("GET"==a&&this._event.eventID==GeneralQuestEventTypes.WATCH_AD&&b.replace("get_2","")==this._event.parameters.adCount)return!0; return!1},lessThanValidation:function(a,b){if("GLU"==a&&this._event.eventID==GeneralQuestEventTypes.LEVEL_UP){if(this._event.parameters.updatedLevel<b.replace("glu_",""))return!0}else if("GDBV"==a&&this._event.eventID==GeneralQuestEventTypes.DAILY_BONUS){if(this._event.parameters.bonusCollected<b.replace("gdbv_",""))return!0}else if("GDBS"==a&&this._event.eventID==GeneralQuestEventTypes.DAILY_BONUS){if(this._event.parameters.collectionStreak<b.replace("gdbs_",""))return!0}else if("GBBV"==a&&this._event.eventID== GeneralQuestEventTypes.BIHOURLY_BONUS){if(this._event.parameters.bonusCollected<b.replace("gbbv_",""))return!0}else if("GBBS"==a&&this._event.eventID==GeneralQuestEventTypes.BIHOURLY_BONUS){if(this._event.parameters.collectionStreak<b.replace("gbbs_",""))return!0}else if("GPDP"==a&&this._event.eventID==GeneralQuestEventTypes.PURCHASE){if(this._event.parameters.purchasePriceDollars<b.replace("gpdp_",""))return!0}else if("GET"==a&&this._event.eventID==GeneralQuestEventTypes.DAILY_LOGIN){if(this._event.parameters.loginCount< b.replace("get_",""))return!0}else if("GET"==a&&this._event.eventID==GeneralQuestEventTypes.WATCH_AD&&this._event.parameters.adCount<b.replace("get_2",""))return!0;return!1},greaterThanValidation:function(a,b){if("GLU"==a&&this._event.eventID==GeneralQuestEventTypes.LEVEL_UP){if(this._event.parameters.updatedLevel>b.replace("glu_",""))return!0}else if("GDBV"==a&&this._event.eventID==GeneralQuestEventTypes.DAILY_BONUS){if(this._event.parameters.bonusCollected>b.replace("gdbv_",""))return!0}else if("GDBS"== a&&this._event.eventID==GeneralQuestEventTypes.DAILY_BONUS){if(this._event.parameters.collectionStreak>b.replace("gdbs_",""))return!0}else if("GBBV"==a&&this._event.eventID==GeneralQuestEventTypes.BIHOURLY_BONUS){if(this._event.parameters.bonusCollected>b.replace("gbbv_",""))return!0}else if("GBBS"==a&&this._event.eventID==GeneralQuestEventTypes.BIHOURLY_BONUS){if(this._event.parameters.collectionStreak>b.replace("gbbs_",""))return!0}else if("GPDP"==a&&this._event.eventID==GeneralQuestEventTypes.PURCHASE){if(this._event.parameters.purchasePriceDollars> b.replace("gpdp_",""))return!0}else if("GET"==a&&this._event.eventID==GeneralQuestEventTypes.DAILY_LOGIN){if(this._event.parameters.loginCount>b.replace("get_",""))return!0}else if("GET"==a&&this._event.eventID==GeneralQuestEventTypes.WATCH_AD&&this._event.parameters.adCount>b.replace("get_2",""))return!0;return!1},updateCount:function(a){return"incrementer"!=a&&"bonus_amount"==a?this._event.parameters.bonusCollected:1},checkGenre:function(a){return!1}});var KENO_RESULT={WIN:1,LOSS:0},RSKenoAction=RSClass.extend({_result:null,init:function(a){this._result=a;this._count=0},findValueIndex:function(a,b){},findValueCount:function(a,b){},calculateCount:function(a,b){return this._count=this.findValueCount(a,b)},equalValidation:function(a,b){if("KR"==a){if(b.replace("kr_","")==KENO_RESULT.WIN&&0<this._result._totalWinAmount||b.replace("kr_","")==KENO_RESULT.LOSS&&0==this._result._totalWinAmount)return!0}else if("KBC"==a){if(b.replace("kbc_","")==this._result._totalBetAmount)return!0}else if("KWC"== a){if(b.replace("kwc_","")==this._result._totalWinAmount)return!0}else if("KM"==a&&b.replace("km_","")==this._result._machineAnalyticsID)return!0;return!1},lessThanValidation:function(a,b){if("KR"!=a)if("KBC"==a){if(this._result._totalBetAmount<b.replace("kbc_",""))return!0}else if("KWC"==a&&this._result._totalWinAmount<b.replace("kwc_",""))return!0;return!1},greaterThanValidation:function(a,b){if("KR"!=a)if("KBC"==a){if(this._result._totalBetAmount>b.replace("kbc_",""))return!0}else if("KWC"==a&& this._result._totalWinAmount>b.replace("kwc_",""))return!0;return!1},updateCount:function(a){if("count"==a)return this._count;if("incrementer"!=a){if("bet_amount"==a)return this._result._totalBetAmount;if("win_amount"==a)return this._result._totalWinAmount}return 1},checkGenre:function(a){return!1}});var RSPokerAction=RSClass.extend({_hand:null,_gameType:null,_state:null,_result:null,_cardHand:null,_highCardSymbol:null,_cards:null,_machineId:null,_cardSymbols:null,_holdedCards:null,_level:null,init:function(a,b,c,d,e,f,g,h,k,m,n,p,r,s){this._gameType=a;this._handWin=c;this._betAmount=b;this._hand=e;this._state=f;this._result=g;this._cardHand=h;this._highCardSymbol=k;this._cards=m;this._machineId=n;this._cardSymbols=p;this._holdedCards=r;this._level=s;this._count=0},getPokercard:function(a){return"pc_"+ a},findValueIndex:function(a,b){if("PC"==a)for(var c in this._cards){if(this.getPokercard(this._cards[c])==b)return c}else if("PHCC"==a)for(c in this._holdedCards)if(this.getPokercard(this._holdedCards[c])==b)return c;return-1},findValueCount:function(a,b){var c=0;if("PC"==a)for(var d in this._cards)this.getPokercard(this._cards[d])==b&&c++;else if("PHCC"==a)for(d in this._holdedCards)this.getPokercard(this._holdedCards[d])==b&&c++;return c},calculateCount:function(a,b){return this._count=this.findValueCount(a, b)},equalValidation:function(a,b){if("PGT"==a&&Number(b.replace("pgt_",""))==this._gameType)return!0;if("PC"==a){if(b.replace("pc_","")==this._cardHand)return!0}else if("PCS"==a){if(b.replace("pcs_","")==this._highCardSymbol)return!0}else if("PH"==a){if(b.replace("ph_","")==this._hand)return!0}else if("PS"==a){if(Number(b.replace("ps_",""))==Number(this._state))return!0}else if("PR"==a){if(Number(b.replace("pr_",""))==Number(this._result))return!0}else if("FR"==a){if(b.replace("fr_","")==Number(this._result))return!0}else if("PL"== a){if(Number(b.replace("pl_",""))==Number(this._level))return!0}else if("PM"==a&&b==this._machineId)return!0;return!1},lessThanValidation:function(a,b){if("PC"==a){if(Number(b.replace("pc_",""))>this._cardHand)return!0}else if("PCS"==a){if(Number(b.replace("pcs_",""))>this._highCardSymbol)return!0}else if("PH"==a){if(Number(b.replace("ph_",""))>this._hand)return!0}else if("PS"==a){if(Number(b.replace("ps_",""))>this._state)return!0}else if("PR"==a){if(Number(b.replace("pr_",""))>this._result)return!0}else if("FR"== a){if(Number(b.replace("fr_",""))>this._result)return!0}else if("PL"==a&&Number(b.replace("pl_",""))>this._level)return!0;return!1},greaterThanValidation:function(a,b){if("PC"==a){if(b.replace("pc_","")<this._cardHand)return!0}else if("PCS"==a){if(Number(b.replace("pcs_",""))<this._highCardSymbol)return!0}else if("PH"==a){if(Number(b.replace("ph_",""))<this._hand)return!0}else if("PS"==a){if(Number(b.replace("ps_",""))<this._state)return!0}else if("PR"==a){if(Number(b.replace("pr_",""))<this._result)return!0}else if("FR"== a){if(Number(b.replace("fr_",""))<this._result)return!0}else if("PL"==a&&Number(b.replace("pl_",""))<this._level)return!0;return!1},updateCount:function(a){if("count"==a)return this._count;if("incrementer"!=a){if("bet_amount"==a)return this._betAmount;if("win_amount"==a)return this._handWin}return 1},checkGenre:function(a){return!1}});var CARD_VALUES={WILD:"14",CLUBS:"00",DIAMONDS:"01",HEARTS:"02",SPADES:"03",JOKER:"13"},WIN_STATUS={WIN:"0",LOOSE:"1",FREE_RIDE:"2"},POKER_STATE={NEW_GAME:"0",DEAL:"1",DRAW:"2"},GAME_TYPE={CLASSIC_POKER:"1",MULTI_STRIKE_POKER:"2",MULTI_STRIKE_POKER_TRIO:"3",MULTI_PLAY_POKER:"4"},RSPokerDataParser=function(){}; RSPokerDataParser.parse=function(a){var b=[],c=a._machineAnalyticsID,d=0,e=0,f=0,g=0,h=a._totalBetAmount?a._totalBetAmount:0,k=RSEngine.gameData.getSheetData("uniformHandTypeDetails");if(-1!=c.indexOf("CP"))d=GAME_TYPE.CLASSIC_POKER,b[0]=a._gameResult,b[0]._handWin=a._totalWinAmount;else if(-1!=c.indexOf("MSPT")){var d=GAME_TYPE.MULTI_STRIKE_POKER_TRIO,m,n;for(n in a._gameResult){m=a._gameResult[n];for(var p in m)m[p]&&b.push(m[p])}}else if(-1!=c.indexOf("MSP"))d=GAME_TYPE.MULTI_STRIKE_POKER,b=a._gameResult; else{if(-1!=c.indexOf("MPP")){d=GAME_TYPE.MULTI_PLAY_POKER;b=a._gameResult;h=a._totalBetAmount;p=a._totalWinAmount;m=!1;var r=0<p?WIN_STATUS.WIN:WIN_STATUS.LOOSE;a=null;a=new RSPokerAction(d,h,p,m,-1,POKER_STATE.DEAL,r,0,0,[],c,[],[],0);RSQuestManager.getInstance().triggerAction(a);if(0<p)for(var s in b)p=b[s]._handWin,a=new RSPokerAction(d,h,p,m,-1,POKER_STATE.DRAW,r,0,0,[],c,[],[],0),RSQuestManager.getInstance().triggerAction(a);1<b.length&&"undefined"!==typeof SideMenuController&&SideMenuController.getInstance().updateToasterMessage()}return}for(s in b){var u= f=0,r=null,t=[],v=[],w=[],x=[],B=[],y=[],z=[];n=null;var C=b[s]._ident,A=C,f=b[s]._dealtHandAnalyticsName,e=b[s]._handAnalyticsName;n=!1;p=0;m=!1;f=RSPokerDataParser._getUniformHandType(c,f,k);u=RSPokerDataParser._getUniformHandType(c,e,k);e=f;f=u;b[s]._freeRide&&(n=!0,r=WIN_STATUS.FREE_RIDE);n||(0<b[s]._handWin?r=WIN_STATUS.WIN:r=WIN_STATUS.LOOSE);if(b[s]._dealtCards.length)for(n=0;5>n;n++)-1!=c.indexOf("DW")?(u=b[parseInt(s)]._dealtCards[parseInt(n)],t[n]=0==u||13==u||26==u||39==u?CARD_VALUES.WILD: b[parseInt(s)]._dealtCards[n]%13):-1!=c.indexOf("JW")?(u=b[parseInt(s)]._dealtCards[parseInt(n)],t[n]=52==u?CARD_VALUES.JOKER:b[parseInt(s)]._dealtCards[n]%13):t[n]=b[parseInt(s)]._dealtCards[n]%13,v[n]=b[parseInt(s)]._dealtCards[n],w[n]=b[parseInt(s)]._holdStatus[n],x[n]=RSPokerDataParser._getSymbolForCard(b[parseInt(s)]._dealtCards[n],c);n=RSPokerDataParser._getHighCard(C,v);t=new RSPokerAction(d,h,p,m,e,POKER_STATE.DEAL,r,A,RSPokerDataParser._getSymbolForCard(n,c),t,c,x,w,g);RSQuestManager.getInstance().triggerAction(t); if(t=b[parseInt(s)]._hand._cardCount){for(v=0;v<t;v++)-1!=c.indexOf("DW")?(u=b[parseInt(s)]._hand._cards[v],B[v]=0==u||13==u||26==u||39==u?CARD_VALUES.WILD:b[parseInt(s)]._hand._cards[v]%13):-1!=c.indexOf("JW")?(u=b[parseInt(s)]._hand._cards[v],B[v]=52==u?CARD_VALUES.JOKER:b[parseInt(s)]._hand._cards[v]%13):B[v]=b[parseInt(s)]._hand._cards[v]%13,y[v]=RSPokerDataParser._getSymbolForCard(b[parseInt(s)]._hand._cards[v],c),z[v]=b[parseInt(s)]._hand._cards[v];n=RSPokerDataParser._getHighCard(C,z);0<b[s]._handWin? r=WIN_STATUS.WIN:r=WIN_STATUS.LOOSE;d==GAME_TYPE.MULTI_STRIKE_POKER?(h=0==g?a._totalBetAmount:0,p=b[s]._handWin,m=a._betStructure[a._betStructure.length-1]==h):d==GAME_TYPE.CLASSIC_POKER&&(p=a._totalWinAmount);h=new RSPokerAction(d,h,p,m,f,POKER_STATE.DRAW,r,n,RSPokerDataParser._getSymbolForCard(n,c),B,c,y,w,g);RSQuestManager.getInstance().triggerAction(h)}g++;h=0}}; RSPokerDataParser._getUniformHandType=function(a,b,c){var d={},e=0,f;for(f in c)if(a==c[f].id){d=c[f];break}d&&(e=null!=d.details[b]?d.details[b]:0);return e};RSPokerDataParser._getSymbolForCard=function(a,b){return-1!=b.indexOf("JW")&&52<=a?CARD_VALUES.JOKER:-1==b.indexOf("DW")||0!=a&&13!=a&&26!=a&&39!=a?0<=a&&13>a?CARD_VALUES.CLUBS:13<=a&&26>a?CARD_VALUES.DIAMONDS:26<=a&&39>a?CARD_VALUES.HEARTS:39<=a&&52>a?CARD_VALUES.SPADES:CARD_VALUES.WILD:CARD_VALUES.WILD}; RSPokerDataParser._getHighCard=function(a,b){for(var c=0,d=0,e=0;5>e;e++)for(var d=a+13*e,f=0;5>f;f++)b[f]==d?c=d:c;return c};var BetTypes={MIN_BET:0,MAX_BET:1,VAR_BET:2},WinTypes={NO_WIN:0,SMALL_WIN:1,BIG_WIN:2,FREESPIN_WIN:3,BONUS_WIN:4},RSSlotMachineAction=RSClass.extend({_result:null,init:function(a){this._result=a;this._count=0},_generateSlotSymbolKey:function(a){return this._result._machineAnalyticsID+"_"+a},findValueIndex:function(a,b){if(void 0==this._result._gameResult&&void 0==this._result._machineAnalyticsID)return-1;if("SS"==a)for(var c in this._result._gameResult._spinGenerated)if(this._generateSlotSymbolKey(this._result._gameResult._spinGenerated[c])== b)return c;return-1},findValueCount:function(a,b){if(void 0==this._result._gameResult&&void 0==this._result._machineAnalyticsID)return 0;var c=0;if("SS"==a)for(var d in this._result._gameResult._spinGenerated)this._generateSlotSymbolKey(this._result._gameResult._spinGenerated[d])==b&&c++;return c},calculateCount:function(a,b){return this._count=this.findValueCount(a,b)},equalValidation:function(a,b){if(void 0==this._result._gameResult&&void 0==this._result._machineAnalyticsID)return"SR"==a&&Number(b.replace("sr_", ""))===WinTypes.BIG_WIN&&this._result._isBigWin?!0:!1;if(void 0==this._result._gameResult){if("SWC"==a){if(this._result._totalWinAmount==Number(b.replace("swc_","")))return!0}else if("SBC"==a&&this._result._totalBetAmount==Number(b.replace("sbc_","")))return!0;return!1}if("SR"!=a)if("SWC"===a){if(this._result._totalWinAmount==Number(b.replace("swc_","")))return!0}else if("SBT"==a){var c=Number(b.replace("sbt_",""));if(c===BetTypes.MIN_BET){if(this._result._totalBetAmount==this._result._betStructure[0])return!0}else if(c=== BetTypes.MAX_BET&&this._result._totalBetAmount==this._result._betStructure[this._result._betStructure.length-1])return!0}else if("SBC"==a){if(this._result._totalBetAmount==Number(b.replace("sbc_","")))return!0}else if("SGT"==a)if(c=Number(b.replace("sgt_","")),0==c){if(0<this._result._totalBetAmount)return!0}else{if(1==c&&0==this._result._totalBetAmount)return!0}else if("SM"==a){if(this._result._machineAnalyticsID==b.replace("sm_",""))return!0}else if("SWT"==a){var c=Number(b.replace("swt_",""))+ 2,d;for(d in this._result._lineWinDetails)if(this._result._gameResult._lineWinDetails[d]._numSymbolRecurrence==c)return!0}return!1},lessThanValidation:function(a,b){if(void 0==this._result._gameResult){if("SWC"==a){if(this._result._totalWinAmount<Number(b.replace("swc_","")))return!0}else if("SBC"==a&&this._result._totalBetAmount<Number(b.replace("sbc_","")))return!0;return!1}if("SR"!=a)if("SWC"===a){if(this._result._totalWinAmount<Number(b.replace("swc_","")))return!0}else if("SBT"!=a)if("SBC"== a){if(this._result._totalBetAmount<Number(b.replace("sbc_","")))return!0}else if("SGT"!=a&&"SM"!=a&&"SWT"==a){var c=Number(b.replace("swt_",""))+2,d;for(d in this._result._lineWinDetails)if(this._result._gameResult._lineWinDetails[d]._numSymbolRecurrence<c)return!0}return!1},greaterThanValidation:function(a,b){if(void 0==this._result._gameResult){if("SWC"==a){if(this._result._totalWinAmount>Number(b.replace("swc_","")))return!0}else if("SBC"==a&&this._result._totalBetAmount>Number(b.replace("sbc_", "")))return!0;return!1}if("SR"!=a)if("SWC"===a){if(this._result._totalWinAmount>Number(b.replace("swc_","")))return!0}else if("SBT"!=a)if("SBC"==a){if(this._result._totalBetAmount>Number(b.replace("sbc_","")))return!0}else if("SGT"!=a&&"SM"!=a&&"SWT"==a){var c=Number(b.replace("swt_",""))+2,d;for(d in this._result._lineWinDetails)if(this._result._gameResult._lineWinDetails[d]._numSymbolRecurrence>c)return!0}return!1},updateCount:function(a){if("incrementer"!=a){if("count"==a)return this._count;if("bet_amount"== a)return this._result._totalBetAmount;if("win_amount"==a)return this._result._totalWinAmount}return 1},checkGenre:function(a){return"SLOTS"==a?!0:!1}});var RSMegaChallengeManager=function(){var a,b=RSClass.extend({_megaChallengePoints:null,_megaChallengeReward:null,_megaChallengeMaxPoints:null,_megaChallengeEndTime:null,_megaChallengeStatus:null,_megaChallengeData:null,_dailyQuestDay:null,_megaChallegeRewardShown:null,init:function(){},initializeWithDataForMegaChallenges:function(a){this._megaChallengeData=a;this._megaChallengeStatus=a.status;this._megaChallengePoints=a.currentPoints;this._megaChallengeReward=a.rewardType;this._megaChallengeMaxPoints= a.points;this._megaChallengeEndTime=a.endTime},addMegaChallengePoints:function(a){a=parseInt(this._megaChallengePoints)+parseInt(a);this._megaChallengePoints=a>this._megaChallengeMaxPoints?this._megaChallengeMaxPoints:a;this._megaChallengePoints>=this._megaChallengeMaxPoints&&0==this._megaChallengeStatus&&(this._megaChallengeStatus=1);URLConfig.CLEVERTAP_ENABLED&&RSPlatformSDKManager.getInstance().setUserAttributeDailyQuestPoints(parseInt(this._megaChallengePoints));this.writeToUserBlob()},getMegaChallengeStatus:function(){return this._megaChallengeStatus}, setMegaChallengeStatus:function(a){this._megaChallengeStatus=a;this.writeToUserBlob()},writeToUserBlob:function(){this._megaChallengeData.status=this._megaChallengeStatus;this._megaChallengeData.currentPoints=this._megaChallengePoints},getProgressPercentage:function(){return this._megaChallengePoints/this._megaChallengeMaxPoints},getTimeRemaining:function(){var a=this._megaChallengeEndTime-TimeManager.getInstance().getCurrentServerTime();return 86400>a?RSUtils.formattedTime(a):~~(a/86400)+1+" Days Left"}, getQuestDay:function(){return 86400<this._megaChallengeEndTime-TimeManager.getInstance().getCurrentServerTime()?(this._dailyQuestDay=~~((this._megaChallengeEndTime-TimeManager.getInstance().getCurrentServerTime())/86400)+1,8-this._dailyQuestDay):7},setRewardScreenShownStatus:function(){this._megaChallegeRewardShown=!0},getRewardScreenShownStatus:function(){return this._megaChallegeRewardShown}});return{getInstance:function(){a||(a=new b);return a}}}();var RSDailyQuestProgressMeter=RSPanel.extend({init:function(a,b,c,d,e){this._super.init.call(this,a.x,a.y,a.w,a.h);this._barAnimation=c;this._barEdgeAnim=d;this._soundID=this._onCompleteCB=null;this.setClippingEnabled(!0);this._barPercent=0;this._barWidth=a.w;e?(this._bar=RSUtils.createBasicObject(b,a),b=e.convertToNodeSpace(a.x,a.y),this._bar.setPosition(b.getX(),b.getY()),e.addChild(this._bar)):(this._bar=RSUtils.createBasicObject(b,a),b=this.convertToNodeSpace(a.x,a.y),this._bar.setPosition(b.getX(), b.getY()),this.addChild(this._bar));a=this._bar.convertToNodeSpace(a.x,a.y);this._barAnimation&&(a=this._bar.convertToNodeSpace(this._barAnimation.getX(),this._barAnimation.getY()),this._barAnimation.setPosition(a.getX(),a.getY()),this._bar.addChild(this._barAnimation));this._barEdgeAnim&&(a=this._bar.convertToNodeSpace(this._barEdgeAnim.getX()-this._barEdgeAnim.getSize().getWidth()/8,this._barEdgeAnim.getY()),this._barEdgeAnim.setPosition(a.getX(),a.getY()),this._bar.addChild(this._barEdgeAnim)); this._initialPos=this._bar.getX()-this._barWidth;this._bar.moveX(-this._barWidth)},playBarProgressAnim:function(){this._barAnimation.stopAnimation();this._barAnimation.setFrame(0);this._barAnimation.playAnimation(1,0.5,this.onProgressFillAnimationComplete.bind(this))},onProgressFillAnimationComplete:function(){this._barAnimation.setFrame(0);this._barAnimation.stopAnimation()},setBarInitialPos:function(a){1<a&&(a=1);this._barPosition=this._initialPos+this._barWidth*a;this._bar.setX(this._barPosition); this._barPercent=a},moveBarTo:function(a,b){if(a!=this._barPercent){1<a&&(a=1);this._onCompleteCB=b;var c=this._barPercent;c>a&&(c=0);this._barEdgeAnim&&(0<a?this._barEdgeAnim.setVisible(!0):this._barEdgeAnim.setVisible(!1));this.stopActionTweenForKey("progressBarMove");this.startActionTweenForKey("progressBarMove",2,c,a);this._soundID=RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyChallengePopup")+"LoadingBar.mp3",!1)}},actionOnUpdate:function(a,b){var c=b*this._barWidth; this._bar.setX(this._initialPos+c);this._barPosition=this._initialPos+c;this._barPercent=b},getDisplayedPercentage:function(){return this._barPercent},actionOnComplete:function(a){this.stopActionTweenForKey("progressBarMove");null!=this._onCompleteCB&&this._onCompleteCB();RSEngine.audioManager.stopEffect(this._soundID)}});var QUEST_POPUP_WIDGETS={QUEST_LIST:0,QUEST_REWARD:1,QUEST_MEGA_REWARD:2,QUEST_COMPLETED:3,SWAPBTN_ENABLE:!1,WATCHAD_LISTENER:!1},QuestScrollBar=RSBarScroller.extend({_jumpToPosition:function(a,b,c){b=this._scrollBaseRect.convertToNodeSpace(a,b);a=b.getX();b=b.getY();this._super._jumpToPosition.call(this,a,b,c)}}),QuestListDisplay=RSDisplayObject.extend({init:function(a,b,c){this._parentInstance=c;this._font=b;this._displayArea=new RSRect(a.x,a.y,a.w,a.h);this._super.init.call(this,this._displayArea); this._questProgressDisplayObjects=[];this._allQuestsCompleted=!1;this._scrollBar=this._scrollBarArea=this._scrollerBG=this._scrollItemSize=this._offset=null;this._isScrollDisabled=!1;this.loadLayout(RSGame.getInstance().getAssetPath("DailyChallengeListWidget"));this._scroller="UP"==GameConfig.GAME_ID?new QuestScrollBar(this._scrollArea,this._scrollItemSize,0,RSScrollerDirection.RSSCROLLER_VERTICAL,1):new QuestScrollBar(this._scrollArea,this._scrollItemSize,5,RSScrollerDirection.RSSCROLLER_VERTICAL, 1);this.addChild(this._scroller);a=new RSDisplayObject(this._scrollArea);a.setAnchorPoint(0.5,0.5);this.addChild(a);this._scroller.setMouseWheelScrollBase(a);this._scroller.setItemMouseScroll(!1);this.setupQuestProgressionObjects();this.setPosition(this.getPosition()._x-this._offset._x,this.getPosition()._y-this._offset._y)},createCustomObject:function(a,b){switch(b.name){case "ScrollItem":this._scrollItemSize=new RSSize(b.w,b.h);break;case "ScrollBarArea":this._scrollBarArea=b;break;case "TouchRect":this._scrollArea= new RSRect(b.x,b.y,b.w,b.h);break;case "ScrollBg":this._scrollerBG=RSUtils.createBasicObject(a,b);break;case "ScrollBar":this._scrollBar=RSUtils.createBasicObject(a,b);break;case "ScrollBarDisable":this._scrollDisable=RSUtils.createBasicObject(a,b)}},onObjectCreated:function(a,b,c){switch(c.name){case "ScrollBase":this._offset=new RSPoint(c.x,c.y)}},setupQuestProgressionObjects:function(){var a=!0,b=RSQuestManager.getInstance().getActiveQuestList().length;this._scroller.removeAllChildren();this._questProgressDisplayObjects= [];for(var c=0;c<b;c++){var d=new QuestProgressionDisplay(c,this._font,this._parentInstance,this._scrollItemSize);this._scroller.addChild(d);this._questProgressDisplayObjects.push(d);d._swapBtn&&"WATCH_AD"==d._questObject.questAction&&!0==QUEST_POPUP_WIDGETS.SWAPBTN_ENABLE&&!RSEngine.dataManager.getMe().getAdsSwapBtnDescriptionVisibility()&&(this.swapBtnVisible(c,b,d._swapBtn._swapBtn),RSEngine.dataManager.getMe().setAdsSwapBtnDescriptionVisibility());a&&d._questStatus!=DailyChallengeObjectiveStatus.CompletedAndCollected&& (a=!1)}RSEngine.dataManager.getMe().getDCinfoPopupShownStatus()||RSEngine.dataManager.getMe().setDCinfoPopupShownStatus();this._allQuestsCompleted=a},swapBtnVisible:function(a,b,c){(b=(b-a)*this._scroller._objectSize._height)&&(b-=c.h);a=this._scroller.getDisplayObject()._calculateItemPositionWithAnchor(this._scroller.getDisplayObject().getItem(a),{x:1.5,y:2});c=this._parentInstance.convertToWorldSpace(a.x-c.w/3,a.y+b);this._parentInstance.showSwapDescription(c,this._parentInstance)},getIsQuestInProgress:function(){return!this._allQuestsCompleted}, reinitializeList:function(){for(var a in this._questProgressDisplayObjects)this.removeChild(this._questProgressDisplayObjects[a],!0);this._questProgressDisplayObjects=[];this.setupQuestProgressionObjects()},update:function(){for(var a in this._questProgressDisplayObjects)this._questProgressDisplayObjects[a].update()}}),QuestProgressionDisplay=RSDisplayObject.extend({init:function(a,b,c,d){this._super.init.call(this,new RSRect(0,0,d.getWidth(),d.getHeight()));this._parentInstance=c;this._target=this._offset= null;this._font=b;this._questCompleteCheckMark=this._progressBarAnimation=this._progressBarScreenName=this._questTotalCount=this._progressCount=this._progressBarData=this._challengeProgressLabel=this._challengeLabel=this._progressBar=null;this._progressPercentage=0;this._actionButtonText=this._swapBtn=this._actionButton=null;this._showingDescription=!0;this._meterOverLay=this._machineAssociatedWithQuest=null;this._questIndex=a;this._questID=RSQuestManager.getInstance().getActiveQuestList()[a];this._questObject= RSQuestManager.getInstance().getQuest(this._questID);a=this._questObject.objectiveList[0].objective[0];this._objectiveID=a.id;this._progressCount=RSQuestManager.getInstance().getUserObjectiveCount(a.id);this._questTotalCount=a.count;this._progressPercentage=this._progressCount/this._questTotalCount;this._questStatus=RSQuestManager.getInstance().getUserObjectiveCompletionStatus(a.id);this._machineAssociatedWithQuest=RSQuestManager.getInstance().getMachineForObjective(a);this.loadLayout(RSGame.getInstance().getAssetPath("DailyChallengeWidget")); "WATCH_AD"==this._questObject.questAction&&(QUEST_POPUP_WIDGETS.WATCHAD_LISTENER=!0,RSEventManager.getInstance().addEventListener("videoNotAvailable",this,this._swapBtnAvailable.bind(this)),RSEventManager.getInstance().addEventListener("WatchAdCompleted",this,this._onWatchAd.bind(this)));this._progressBar=new RSDailyQuestProgressMeter(this._progressBarData,this._progressBarScreenName,this._progressBarAnimation);this.addChild(this._progressBar);this.addChild(this._meterOverLay);this.addChild(this._target); this.addChild(this._challengeProgressLabel);2==this._questStatus?(this.setOpacity(125),this._progressBar.setBarInitialPos(1),this._progressBar.onProgressFillAnimationComplete(),this._progressBar._barAnimation.setOpacity(0),this._progressBar._bar.setOpacity(180),this._challengeProgressLabel.setOpacity(125),this._challengeLabel.setOpacity(125),this._questCompleteCheckMark.setVisible(!0),this._questCompleteCheckMark.setOpacity(255),this._target.setVisible(!0),this._actionButton.setTouchEnabled(!1),this._actionButton.setVisible(!1), this._actionButtonText.setVisible(!1),this._questIndex==this._parentInstance._lastRewardedQuest?(this._questCompleteCheckMark.stopAnimation(),this._questCompleteCheckMark.playAnimation(1,0.3),RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyChallengePopup")+"CheckAnimationSound.mp3",!1),this._parentInstance._lastRewardedQuest=-1):(this._questCompleteCheckMark.stopAnimation(),this._questCompleteCheckMark.setFrame(this._questCompleteCheckMark._animationFrames.length-1)),this._questCompleteCheckMark.setVisible(!0)): (a=this._parentInstance.getLocalStoreKeyForDisplayedProgress(this._questID),this._progressBar.setBarInitialPos(RSUtils.getLocalStorageItem(a,0)),this._progressBar.moveBarTo(this._progressPercentage),1==this._questStatus&&RSUtils.getLocalStorageItem(a,0)==this._progressPercentage&&(this._target.setVisible(!0),this._actionButton.setTouchEnabled(!0)),RSUtils.setLocalStorageItem(a,this._progressPercentage))},_swapBtnAvailable:function(){QUEST_POPUP_WIDGETS.SWAPBTN_ENABLE=!0;SideMenuController.getInstance().setSideMenuVisibility(!1); RSEventManager.getInstance().removeListenersForEvent("videoNotAvailable");RSEventManager.getInstance().removeListenersForEvent("WatchAdCompleted");RSEngine.popupManager.addPopup(new VideoRewardPopup("",!1,this.reOpenDailyQuestPopup.bind(this),"","adnotAvailable"),!1)},_onWatchAd:function(){RSEventManager.getInstance().removeListenersForEvent("videoNotAvailable");RSEventManager.getInstance().removeListenersForEvent("WatchAdCompleted")},reOpenDailyQuestPopup:function(){RSEngine.popupManager.addPopup(new RSDailyQuestPopup(RSGame.getInstance().getAssetPath("DailyChallengePopup"), RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestRewardText()))},switchDescriptionState:function(){this._showingDescription?(this._showingDescription=!1,this._challengeLabel.setString(this._progressCount+"/"+this._questTotalCount)):(this._showingDescription=!0,this._challengeLabel.setString(this._questObject.description));this._challengeLabel.fadeIn(0.5)},handleObjectTouchAt:function(a,b,c,d){},handleObjectTouchMoveAt:function(a,b,c,d){},handleObjectTouchEndAt:function(a,b,c,d){this._challengeLabel.actionFadeOut(0.5, this.switchDescriptionState.bind(this))},onObjectCreated:function(a,b,c){if("Bg"==c.name)this._offset=new RSPoint(c.x,c.y);else if("Boarder"==c.name)this._meterOverLay=a;else if("ChallengeAction"==c.name){this._actionButton=a;this._parentInstance._buttonTxtScalex?(a=this._parentInstance._buttonTxtScaley,c.w*=1-this._parentInstance._buttonTxtScalex/100,c.h*=1-a/100):(c.w*=0.8,c.h*=0.8);a="";switch(this._questStatus){case 0:a=this._questObject.buttonText;break;case 1:a="COLLECT";this._actionButton.setTouchEnabled(!1); break;case 2:a="COLLECT"}this.buttonFontForDC=RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestRewardText();this._actionButtonText=new RSScaledLabel(a,this.buttonFontForDC.BUTTON_FONT?this.buttonFontForDC.BUTTON_FONT:this._font,c,kTEXT_ALIGNMENT_CENTER);this._parentInstance._buttonPosx&&this._parentInstance._buttonPosy&&(this._actionButtonText.setX(c.x*this._parentInstance._buttonPosx/100),this._actionButtonText.setY(c.y*this._parentInstance._buttonPosy/100));this.addChild(this._actionButtonText)}else"SwapBtn"== c.name&&(this._swapBtn=a,this._swapBtn._swapBtn=c,this._swapBtn&&(this._swapBtn.setVisible(!1),"true"!=this._questObject.skippable||this._questObject.objectiveListCompleted||(this._swapBtn.setVisible(!0),"WATCH_AD"==this._questObject.questAction&&!1==QUEST_POPUP_WIDGETS.SWAPBTN_ENABLE&&this._swapBtn.setVisible(!1))))},createCustomObject:function(a,b){switch(b.name){case "ChallengeProgressText":this._challengeProgressLabel=this._progressCount>this._questTotalCount?new RSScaledLabel(RSUtils.formatNumberWithComma(1* this._questTotalCount)+"/"+RSUtils.formatNumberWithComma(1*this._questTotalCount),RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestProgressText(),b,kTEXT_ALIGNMENT_CENTER):new RSScaledLabel(RSUtils.formatNumberWithComma(1*this._progressCount)+"/"+RSUtils.formatNumberWithComma(1*this._questTotalCount),RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestProgressText(),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._challengeProgressLabel);break;case "ChallengeText":var c= this._questObject.description;2<=c.split("\\").length&&(c=c.replace("\\u2122","\u2122"));var d=kTEXT_ALIGNMENT_CENTER,e=RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestRewardText();null!=e.ChallengeTextAlignment&&(d=e.ChallengeTextAlignment);this._challengeLabel=new RSScaledLabel(c,this._font,b,d);this.addChild(this._challengeLabel);this._challengeLabel.setZOrder(2);break;case "DC_MeterBG":this.addChild(RSUtils.createBasicObject(a,b));break;case "DC_Target":this._target=RSUtils.createBasicObject(a, b);this._target.setVisible(!1);break;case "DC_MeterFill":this._progressBarAnimation=new RSUtils.createAnimation(a,b,0.3);break;case "DC_MeterFillBG":this._progressBarData=b;this._progressBarScreenName=a;break;case "CompletedTick":this._questCompleteCheckMark=RSUtils.createAnimation(a,b,0.3),this._questCompleteCheckMark.setVisible(!1),this.addChild(this._questCompleteCheckMark)}},onButtonClicked:function(a){switch(a){case "ChallengeAction":this._actionButton.setTouchEnabled(!1);0==this._questStatus? this.loadNextScreen():1==this._questStatus&&(this._actionButton.setTouchEnabled(!1),this._actionButtonText.setOpacity(~~(this._actionButtonText.getOpacity()/2)),this._parentInstance.switchActiveWidget(QUEST_POPUP_WIDGETS.QUEST_REWARD,this._questObject),this._parentInstance._lastRewardedQuest=this._questIndex,RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge","quest_popup","collect",this._questObject.objectiveList[0].objective[0].id,"day"+RSMegaChallengeManager.getInstance().getQuestDay()), RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge","quest_collect_popup","trigger",this._questObject.objectiveList[0].objective[0].id,"day"+RSMegaChallengeManager.getInstance().getQuestDay()),URLConfig.CLEVERTAP_ENABLED&&(0==RSQuestManager.getInstance().getNumCompletedAndNotCollectedQuests()&&RSPlatformSDKManager.getInstance().setUserAttributeDQRewardPending(!1),RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.dailyQuestEngaged)));break;case "SwapBtn":this._parentInstance._isRefreshingData= !0,RSAnalyticsManager.getInstance().trackInHouseEvent("gui","daily_challenge","swap_button","click","",""),RSEngine.popupManager.addPopup(new RSSkipChallengeConfirmationPopup(RSGame.getInstance().getAssetPath(this._parentInstance._skipConfirmationText),this.swapChallenge.bind(this)),!0)}},swapChallenge:function(a){a&&this._parentInstance.skipDailyQuests(this._questObject.id)},loadNextScreen:function(){var a=null;RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge","quest_popup","play", this._objectiveID,"day"+RSMegaChallengeManager.getInstance().getQuestDay());switch(this._questObject.questActionType){case "1":if(RSGameScreenManager.getInstance().getCurrentScreen()==this._questObject.questAction.toLowerCase())break;a="lobby_navigation";RSGame.getInstance().getGameManager().removeScreensForNavigation();RSGameScreenManager.getInstance().loadScreen(this._questObject.questAction.toLowerCase());break;case "3":var b=RSQuestManager.getInstance().getGameTypeFromValue(this._questObject.questAction), c=!0;if(RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName()==this._machineAssociatedWithQuest&&"gameplay_screen"==RSGameScreenManager.getInstance().getCurrentScreen())break;var d=RSGame.getInstance().getGameData().getMachineDetailsByName(b,this._machineAssociatedWithQuest);if(d&&d.isEnabled&&!parseInt(d.isEnabled))break;RSGame.getInstance().getGameManager().triggerMemoryPopupStatus(b,d.machine_identifier)||(RSGame.getInstance().getGameManager().removeScreensForNavigation(),c=!1);a="load_machine"; RSCasinoManager.getCasinoInterface().loadMachine(b,this._machineAssociatedWithQuest,"RSDailyQuestPopup",!0,null,c);break;case "4":"WATCH_AD"==this._questObject.questAction&&(a="watchAd",RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.EARN_COINS_AD,parameter:RSPlatformPopupNameKeys.QUEST}))}this._parentInstance.closePopup(a)},update:function(){this._questStatus!=DailyChallengeObjectiveStatus.InProgress&&1<=this._progressBar.getDisplayedPercentage()&& !this._target.isVisible()&&(this._target.setScale(1.2),this._target.actionZoom(0.5,1,this.onBarFillComplete.bind(this)),this._target.setVisible(!0),RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyChallengePopup")+"DartHit.mp3",!1))},onBarFillComplete:function(){this._actionButton.setTouchEnabled(!0)}}),AllQuestCompletedDisplay=RSDisplayObject.extend({init:function(a,b,c){this._font=b;this._offset=null;this._parentInstance=c;this._timer=null;this._displayArea=new RSRect(a.x, a.y,a.w,a.h);this._super.init.call(this,this._displayArea);this.loadLayout(RSGame.getInstance().getAssetPath("DailyChallengeCompleteWidget"));this.setPosition(this.getPosition()._x-this._offset._x,this.getPosition()._y-this._offset._y)},createCustomObject:function(a,b){switch(b.name){case "Time":var c=this._font,d=RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestTimerText();d&&(c=d);this._timer=new RSScaledLabel("23:59:59",c,b,kTEXT_ALIGNMENT_CENTER);this._timer.setCenter(b.x,b.y); d||this._timer.setFontColor(244,229,66,255);this.addChild(this._timer)}},onObjectCreated:function(a,b,c){switch(c.name){case "CompleteText":this._offset=new RSPoint(c.x,c.y)}},update:function(a){this._timer&&this._timer.setString(RSUtils.formattedTime(a))}}),QuestRewardScreen=RSDisplayObject.extend({init:function(a,b,c){this._parentInstance=c;this._coinAmount=8E3;this._objID=null;this._megachallengePoints=this._coinAmountCounter=0;this._font=b;this._offset=this._sparkleAnimation=this._confettiAnimation= this._giftAnimation=this._coinAmountLabel=this._megachallengePointsLabel=null;this._displayArea=new RSRect(a.x,a.y,a.w,a.h);this._super.init.call(this,this._displayArea);this.loadLayout(RSGame.getInstance().getAssetPath("DailyChallengePrizeWidget"));this.setPosition(this.getPosition()._x-a.w/2,this.getPosition()._y-a.h/2);this.resetWidget(null)},playConfettiAnimation:function(){this._giftAnimation.playAnimation(1,0.4);this._confettiAnimation.playAnimation(1,0.4);this.scheduleFunctionOnce(this.playParticleAnimations.bind(this), 0.5)},resetWidget:function(a){this._giftAnimation.setFrame(0);this._confettiAnimation.setFrame(0);this._giftAnimation.stopAnimation();this._confettiAnimation.stopAnimation();if(void 0!=a){this.scheduleFunctionOnce(this.dismissWidget.bind(this),5);this.scheduleFunctionOnce(this.playConfettiAnimation.bind(this),1);RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyChallengePopup")+"YouJustWon_GiftBox.mp3",!1);var b=a.rewardId,b=RSQuestManager.getInstance().getRewardForID(b); this._coinAmount=b.coins;this._megachallengePoints=b.points;RSMegaChallengeManager.getInstance().addMegaChallengePoints(this._megachallengePoints);this._coinAmountCounter=0;this._objID=RSQuestManager.getInstance().getObjectiveList(a.objectiveLists[0]).objective[0].id;RSQuestManager.getInstance().setUserObjectiveCompletionStatus(this._objID,DailyChallengeObjectiveStatus.CompletedAndCollected);RSMegaChallengeManager.getInstance().getMegaChallengeStatus()==DailyChallengeObjectiveStatus.Completed&&RSMegaChallengeManager.getInstance().setMegaChallengeStatus(DailyChallengeObjectiveStatus.Completed); RSEngine.dataManager.saveUserData("");this._coinAmountLabel.setString(this._coinAmount+"!");this.startActionTweenForKey("DCRollUp",0.5,0,this._coinAmount);this._megachallengePointsLabel.setString("+ "+this._megachallengePoints+" Mega Quest Points!");RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge","mega_quest_reward",this._megachallengePoints,this._objID,"day"+RSMegaChallengeManager.getInstance().getQuestDay());RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free, "daily_challenge_reward",this._coinAmount,this._objID,"day"+RSMegaChallengeManager.getInstance().getQuestDay());RSCasinoManager.addPrimaryCurrency(parseInt(this._coinAmount),!0);RSEventManager.getInstance().dispatchEvent(UPDATE_SIDEMENU_NOTIFICATION_COUNTER)}},actionOnUpdate:function(a,b){this._winDisplay=Math.floor(b);this._coinAmountLabel.setString(RSUtils.formatNumberWithComma(this._winDisplay))},actionOnComplete:function(){this.stopWinRollUp()},stopWinRollUp:function(){this.stopActionTweenForKey("DCRollUp"); this._coinAmountLabel.setString(RSUtils.formatNumberWithComma(this._winDisplay))},playParticleAnimations:function(){var a=new RSPoint(this._giftAnimation.getPosition().getX()+70,this._giftAnimation.getPosition().getY()+80);RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(a,this._giftAnimation,null);this._sparkleAnimation.playAnimation(1,0.4,this.updateMCMeter.bind(this))},updateMCMeter:function(){this._parentInstance.updateMeter()},dismissWidget:function(){RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge", "quest_collect_popup","close",this._objID,"day"+RSMegaChallengeManager.getInstance().getQuestDay());switch(RSMegaChallengeManager.getInstance().getMegaChallengeStatus()){case DailyChallengeObjectiveStatus.Completed:RSMegaChallengeManager.getInstance().getRewardScreenShownStatus()&&RSQuestManager.getInstance().getNumCompletedAndCollectedQuests()!=RSQuestManager.getInstance().getActiveQuestList().length?this._parentInstance.switchActiveWidget(QUEST_POPUP_WIDGETS.QUEST_LIST):(this._parentInstance.switchActiveWidget(QUEST_POPUP_WIDGETS.QUEST_MEGA_REWARD), RSAnalyticsManager.getInstance().trackPlayerAction("daily_challenge","mega_quest","eligible","","day"+RSMegaChallengeManager.getInstance().getQuestDay()));break;case DailyChallengeObjectiveStatus.InProgress:this._parentInstance.switchActiveWidget(QUEST_POPUP_WIDGETS.QUEST_LIST);break;case DailyChallengeObjectiveStatus.CompletedAndCollected:case DailyChallengeObjectiveStatus.RewardCollected:this._parentInstance.switchActiveWidget(QUEST_POPUP_WIDGETS.QUEST_LIST)}},createCustomObject:function(a,b){switch(b.type){case "Label":"DC_RewardCoins"== b.name?(this.coinFontForDC=RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestRewardText(),this._coinAmountLabel=new RSScaledLabel("8000!",this.coinFontForDC.COIN_FONT?this.coinFontForDC.COIN_FONT:this._font,b,this.coinFontForDC.QuestRewardAlignment?this.coinFontForDC.QuestRewardAlignment:kTEXT_ALIGNMENT_LEFT),this.addChild(this._coinAmountLabel)):"DC_RewardPoints"==b.name&&(this._megachallengePointsLabel=new RSScaledLabel("+ 500 Mega Quest Points!",this._font,b,kTEXT_ALIGNMENT_CENTER), this.addChild(this._megachallengePointsLabel))}},onObjectCreated:function(a,b,c){switch(c.type){case "Animation":a.stopAnimation(),a.playAnimation(1,0.4),"GiftBoxAnim"==c.name?this._giftAnimation=a:"ConfettiAnim"==c.name?this._confettiAnimation=a:"ParticleAnim"==c.name&&(this._sparkleAnimation=a,a.stopAnimation())}},handleCountUp:function(){this._coinAmountCounter+=1/120*this._coinAmount;this._coinAmountCounter=this._coinAmountCounter>this._coinAmount?this._coinAmount:~~this._coinAmountCounter;this._coinAmountLabel.setString(RSUtils.formatNumberWithComma(this._coinAmountCounter))}, update:function(){}}),MegaQuestReward=RSDisplayObject.extend({init:function(a,b,c){this._parentInstance=c;this._font=b;this._displayArea=new RSRect(a.x,a.y,a.w,a.h);this._super.init.call(this,this._displayArea);this._offset=null;this.loadLayout(RSGame.getInstance().getAssetPath("MegaChallengeCompletedWidget"));this.setPosition(this.getPosition()._x-a.w/2,this.getPosition()._y-a.h/2)},createCustomObject:function(a,b){switch(b.type){case "MC_Reward":this.addChild(RSUtils.createBasicObject(a,b));break; case "MC_Reward_Text":this._MCrewardText=RSUtils.createBasicObject(a,b),this.addChild(this._MCrewardText)}},onObjectCreated:function(a,b,c){"Animation"==c.type&&"Sparkle"==c.name&&(a.stopAnimation(),a.playAnimation(-1,0.3),a.setScale(2))},dismissMegaRewardWidget:function(){},update:function(){}}),RSDailyQuestPopup=RSPopup.extend({init:function(a,b,c,d,e){this._screenLayout=a;this._font=b.DESCRIPTON_FONT?b.DESCRIPTON_FONT:b;this._popupData=this._widgetData=this._weeklyBonusMeterBarEdgeAnimation=this._weeklyBonusMeterBarBodyAnimation= this._meterBarData=this._weeklyBonusMeter=this._onMegaQuestComebackText=this._onMegaQuestCompleteText=this._rewards=this._dailyChallengeTimer=this._weeklyChallengeTimer=this._timeLeftText=null;this._isRefreshingData=!1;this._callBack=c;this._super.init.call(this,c);RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge","quest_popup","open","","day"+RSMegaChallengeManager.getInstance().getQuestDay());this._megaChallengeReward=this._dailyQuestReward=this._allQuestsCompletedDisplay=this._questListDisplay= null;this._lastRewardedQuest=-1;this._infoBubble=null;this._triggerRewardScreen=d?d:!1;this._customQuestObject=e;this._tempDailyQuestEndTime=RSGame.getInstance().getUserDataManager().getMe().getDailyChallengeData().activeQuests[0].endTime;this._tempWeeklyQuestEndTime=RSGame.getInstance().getUserDataManager().getMe().getDailyChallengeData().megaChallenge.endTime;RSUtils.loadJsonAsyc("res/PlatformWidgets/DailyChallengesPopup/DailyQuestConfig.json",null,this.onDataLoaded.bind(this));this._activeWidget= null;this._infoPopupTriggered=!1;this._popupCloseFrom=null;this._skip=!1;RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyChallengePopup")+"DailyQuest_PopUpMenu.mp3",!1)},onDataLoaded:function(a){this._buttonTxtScalex=a.init.ScaleforButtonText.xScale;this._buttonTxtScaley=a.init.ScaleforButtonText.yScale;a.init.PositionforButtonText&&(this._buttonPosx=a.init.PositionforButtonText.xPos,this._buttonPosy=a.init.PositionforButtonText.yPos);this._skipConfirmationText=a.init.SkipConfirmationFont; this._swapDescriptionText=a.init.SwapDescriptionFont;a.init.TimerText&&(this._timerText=a.init.TimerText)},onObjectCreated:function(a,b,c){switch(c.name){case "TimerBg":this._timerBg=a;break;case "CloseButton":this._closeBtn=a}},refreshQuests:function(){RSEngine.screenManager.addOverlay();RSEngine.gameData.readLTEMGameDataEvents(this.onDataRefresh.bind(this),this.onDataRefresh.bind(this),"dailyChallengeRefresh")},skipDailyQuests:function(a){var b;b=RSQuestManager.getInstance().getCurrentQuestSetId(); RSEngine.screenManager.addOverlay();RSEngine.gameData.gameDataskipDailyChallengeEvents(this.onSkipQuest.bind(this),this.onSkipQuest.bind(this),a,b)},onDataRefresh:function(a){RSGame.getInstance().getUserDataManager().getMe().setDailyChallengeData(a.result.events[0].dailyChallengeData);RSGame.getInstance().getGameManager().refreshQuestData();RSEngine.dataManager.getCurrentCoinBalance(this.onCallBackOnCoinSuccess.bind(this))},onSkipQuest:function(a){RSGame.getInstance().getUserDataManager().getMe().setDailyChallengeData(a.result.dailyChallengeData); RSGame.getInstance().getGameManager().refreshQuestData();RSEngine.dataManager.getCurrentCoinBalance(this.onCallBackOnCoinSuccess.bind(this))},onCallBackOnCoinSuccess:function(){this.updatePopupElements();this.updateMeter();this._isRefreshingData=!1;RSEngine.screenManager.removeOverlay()},updatePopupElements:function(){this.removeChild(this._dailyChallengeTimer,!0);this.removeChild(this._questListDisplay,!0);this.removeChild(this._dailyQuestReward,!0);this.removeChild(this._megaChallengeReward,!0); this.removeChild(this._allQuestsCompletedDisplay,!0);var a=this._font,b=RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestTimerText();b&&(a=b);this._dailyChallengeTimer=new RSScaledLabel("23:59:59",a,this._popupData,kTEXT_ALIGNMENT_CENTER);this._dailyChallengeTimer.setCenter(this._popupData.x,this._popupData.y);null==b&&this._dailyChallengeTimer.setFontColor(244,229,66,255);this.addChild(this._dailyChallengeTimer);this.addChild(this._timeLeftText);this._activeWidget=this._questListDisplay= new QuestListDisplay(this._widgetData,this._font,this);this._dailyQuestReward=new QuestRewardScreen(this._widgetData,this._font,this);this._megaChallengeReward=new MegaQuestReward(this._widgetData,this._font,this);this._tempDailyQuestEndTime=RSGame.getInstance().getUserDataManager().getMe().getDailyChallengeData().activeQuests[0].endTime;this.addChild(this._activeWidget)},loadContent:function(){this._super.loadContent.call(this);this.layoutScreen(this._screenLayout);var a=new RSClippingNode(RSUtils.createBasicObject(this._loaderScreenName, this._meterBarData));a.setAlphaThreshold(127);this._weeklyBonusMeter=new RSDailyQuestProgressMeter(this._meterBarData,"DailyChallengePopup",this._weeklyBonusMeterBarBodyAnimation,this._weeklyBonusMeterBarEdgeAnimation,a);this.addChild(this._weeklyBonusMeter);this._meterOverLay&&this.addChild(this._meterOverLay);this._weeklyBonusMeter.setBarInitialPos(0);this.addChild(a);this.addChild(this._rewards);this.updateMeter();1==parseInt(RSGame.getInstance().getGameData().getDefaultValues().isDQNewFlowEnabled)&& this._triggerRewardScreen?this.switchActiveWidget(QUEST_POPUP_WIDGETS.QUEST_REWARD,this._customQuestObject):RSQuestManager.getInstance().getNumCompletedAndCollectedQuests()!=RSQuestManager.getInstance().getActiveQuestList().length?cc.log("All quests are completed"):RSMegaChallengeManager.getInstance().getMegaChallengeStatus()==DailyChallengeObjectiveStatus.CompletedAndCollected||RSMegaChallengeManager.getInstance().getMegaChallengeStatus()==DailyChallengeObjectiveStatus.Completed?this.switchActiveWidget(QUEST_POPUP_WIDGETS.QUEST_MEGA_REWARD): RSMegaChallengeManager.getInstance().getMegaChallengeStatus()==DailyChallengeObjectiveStatus.RewardCollected&&this.switchActiveWidget(QUEST_POPUP_WIDGETS.QUEST_COMPLETED)},getLocalStoreKeyForDisplayedProgress:function(a){return"DisplayedMeterValueForQuest"+a},updateMeter:function(){var a=this.getLocalStoreKeyForDisplayedProgress(this._questID),b=RSUtils.getLocalStorageItem(a,0);this._weeklyBonusMeter.setBarInitialPos(b);this._weeklyBonusMeter.moveBarTo(RSMegaChallengeManager.getInstance().getProgressPercentage()); RSUtils.setLocalStorageItem(a,RSMegaChallengeManager.getInstance().getProgressPercentage());this._onMegaQuestCompleteText&&1<=RSMegaChallengeManager.getInstance().getProgressPercentage()&&RSMegaChallengeManager.getInstance().getMegaChallengeStatus()!=DailyChallengeObjectiveStatus.RewardCollected?(this._weeklyChallengeTimer&&this._weeklyChallengeTimer.setVisible(!1),this._onMegaQuestComebackText&&this._onMegaQuestComebackText.setVisible(!1),this._onMegaQuestCompleteText.setVisible(!0)):this._onMegaQuestComebackText&& 1<=RSMegaChallengeManager.getInstance().getProgressPercentage()&&RSMegaChallengeManager.getInstance().getMegaChallengeStatus()==DailyChallengeObjectiveStatus.RewardCollected&&(this._weeklyChallengeTimer&&this._weeklyChallengeTimer.setVisible(!1),this._onMegaQuestCompleteText&&this._onMegaQuestCompleteText.setVisible(!1),this._onMegaQuestComebackText.setVisible(!0))},createCustomObject:function(a,b){switch(b.name){case "MC_DaysLeft":var c=this._font,d=RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestTimerText(); d&&(c=d);this._weeklyChallengeTimer=new RSScaledLabel("N days left",c,b,kTEXT_ALIGNMENT_CENTER);this._weeklyChallengeTimer.setCenter(b.x,b.y);this.addChild(this._weeklyChallengeTimer);break;case "MC_MeterBg":this.addChild(RSUtils.createBasicObject(a,b));break;case "MC_MeterFillBg":this._loaderScreenName=a;this._meterBarData=b;break;case "LoadingGlow":this._weeklyBonusMeterBarEdgeAnimation=RSUtils.createAnimation(a,b,1);this._weeklyBonusMeterBarEdgeAnimation.stopAnimation();this._weeklyBonusMeterBarEdgeAnimation.playAnimation(-1, 0.3);0>=RSMegaChallengeManager.getInstance().getProgressPercentage()&&this._weeklyBonusMeterBarEdgeAnimation.setVisible(!1);break;case "MC_MeterFill":this._weeklyBonusMeterBarBodyAnimation=RSUtils.createAnimation(a,b,1);this._weeklyBonusMeterBarBodyAnimation.stopAnimation();this._weeklyBonusMeterBarBodyAnimation.playAnimation(-1,0.3);break;case "SpinWheel":this._rewards=RSUtils.createBasicObject(a,b);break;case "ComeBack":this._onMegaQuestCompleteText=RSUtils.createBasicObject(a,b);this.addChild(this._onMegaQuestCompleteText); this._onMegaQuestCompleteText.setVisible(!1);break;case "BonusCollected":this._onMegaQuestComebackText=RSUtils.createBasicObject(a,b);this.addChild(this._onMegaQuestComebackText);this._onMegaQuestComebackText.setVisible(!1);break;case "DC_Timer":c=this._font;(d=RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestTimerText())&&(c=d);this._dailyChallengeTimer=new RSScaledLabel("23:59:59",c,b,kTEXT_ALIGNMENT_CENTER);this._dailyChallengeTimer.setCenter(b.x,b.y);null==d&&this._dailyChallengeTimer.setFontColor(244, 229,66,255);this.addChild(this._dailyChallengeTimer);this._popupData=b;break;case "DC_Timeleft":c=this._font;(d=RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestTimerText())&&(c=d);this._timerText&&(c=RSGame.getInstance().getAssetPath(this._timerText));this._timeLeftText=new RSScaledLabel("Time Left:",c,b,kTEXT_ALIGNMENT_CENTER);this._timeLeftText.setCenter(b.x,b.y);this.addChild(this._timeLeftText);break;case "DC_WidgetHolder":this._widgetData=b;this._activeWidget=this._questListDisplay= new QuestListDisplay(b,this._font,this);this._allQuestsCompletedDisplay=new AllQuestCompletedDisplay(b,this._font,this);this._questListDisplay.getIsQuestInProgress()||this.setUpAllQuestCompletedDisplay();this._dailyQuestReward=new QuestRewardScreen(b,this._font,this);this._megaChallengeReward=new MegaQuestReward(b,this._font,this);this.addChild(this._activeWidget);break;case "InfoPopup":this._infoBubble=RSUtils.createBasicObject(a,b),this._infoBubble.setVisible(!1),this.addChild(this._infoBubble)}this._super.createCustomObject.call(this, a,b)},setUpAllQuestCompletedDisplay:function(){this.removeChild(this._dailyChallengeTimer);this.removeChild(this._timeLeftText);this._dailyChallengeTimer.setScale(1.2);this._activeWidget=this._allQuestsCompletedDisplay},onButtonClicked:function(a){switch(a){case "CloseButton":RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge","quest_popup","close","","day"+RSMegaChallengeManager.getInstance().getQuestDay());this.closePopup();break;case "InfoButton":if(this._infoPopupTriggered)break; a=new RSQuestWelcomePopup(RSGame.getInstance().getAssetPath("DailyChallengeWelcomePopup"),!0,this._callBack);this._infoPopupTriggered=!0;a.loadDailyQuestPopupOnExit();this._skip=!0;RSEngine.popupManager.addPopup(a);RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge","info_button","click","");this.closePopup()}},switchActiveWidget:function(a,b){var c=null;this._closeBtn.setTouchEnabled(!0);switch(a){case QUEST_POPUP_WIDGETS.QUEST_LIST:c=this._questListDisplay;RSQuestManager.getInstance().getNumCompletedAndCollectedQuests()!= RSQuestManager.getInstance().getActiveQuestList().length?(this._questListDisplay.reinitializeList(),1==parseInt(RSEngine.gameData.getDefaultValues().IsDCPrizeWidgetTimerDisabled)&&(this._timeLeftText.setVisible(!0),this._dailyChallengeTimer.setVisible(!0))):(c=this._allQuestsCompletedDisplay,this.removeChild(this._timeLeftText),this.removeChild(this._dailyChallengeTimer));break;case QUEST_POPUP_WIDGETS.QUEST_REWARD:this._closeBtn.setTouchEnabled(!1);c=this._dailyQuestReward;this._dailyQuestReward.resetWidget(b); 1==parseInt(RSEngine.gameData.getDefaultValues().IsDCPrizeWidgetTimerDisabled)&&(this._timeLeftText.setVisible(!1),this._dailyChallengeTimer.setVisible(!1));break;case QUEST_POPUP_WIDGETS.QUEST_MEGA_REWARD:RSQuestManager.getInstance().getNumCompletedAndCollectedQuests()!=RSQuestManager.getInstance().getActiveQuestList().length&&this._closeBtn.setTouchEnabled(!1);RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyChallengePopup")+"Congratulations.mp3",!1);c=this._megaChallengeReward; this._timeLeftText.setVisible(!1);this._dailyChallengeTimer.setVisible(!1);this._weeklyChallengeTimer.setVisible(!1);this._timerBg&&this._timerBg.setVisible(!1);RSMegaChallengeManager.getInstance().setRewardScreenShownStatus();RSQuestManager.getInstance().getNumCompletedAndCollectedQuests()!=RSQuestManager.getInstance().getActiveQuestList().length&&this.scheduleFunctionOnce(this.switchActiveWidget.bind(this,QUEST_POPUP_WIDGETS.QUEST_LIST),4);break;case QUEST_POPUP_WIDGETS.QUEST_COMPLETED:c=this._allQuestsCompletedDisplay; this.removeChild(this._dailyChallengeTimer);this.removeChild(this._timeLeftText);this._dailyChallengeTimer.setScale(1.2);break;default:return}this.removeChild(this._activeWidget);this._activeWidget=c;this.addChild(this._activeWidget)},update:function(){if(!this._isRefreshingData){var a=this.updateDailyChallengeTimer();this.updateWeeklyChallengeTimer();this._activeWidget.update(a)}},updateWeeklyChallengeTimer:function(){this._weeklyChallengeTimer.setString(RSMegaChallengeManager.getInstance().getTimeRemaining())}, updateDailyChallengeTimer:function(){var a=this._tempDailyQuestEndTime-TimeManager.getInstance().getCurrentServerTime();this._dailyChallengeTimer.setString(RSUtils.formattedTime(a));0>=a&&!this._isRefreshingData&&(this._isRefreshingData=!0,this.refreshQuests());return a},showSwapDescription:function(a,b){var c=new RSSwapDescription("Arrow_Top_Right",RSGame.getInstance().getAssetPath(b._swapDescriptionText));c.setPosition(a.getX(),a.getY());this._messageBubble=c;this._messageBubble.setZOrder(10);this.addChild(this._messageBubble); this.scheduleFunctionOnce(function(){this._messageBubble&&(this._messageBubble.setVisible(!1),this.removeChild(this._messageBubble),this._messageBubble=null)}.bind(this),5)},handleTouchEndAt:function(a,b,c){},unload:function(){this._messageBubble&&(this.removeChild(this._messageBubble),this._messageBubble=null);this._super.unload.call(this)},closePopup:function(a){this._popupCloseFrom=a;"watchAd"!=a&&QUEST_POPUP_WIDGETS.WATCHAD_LISTENER&&(RSEventManager.getInstance().removeListenersForEvent("videoNotAvailable"), RSEventManager.getInstance().removeListenersForEvent("WatchAdCompleted"));RSEventManager.getInstance().dispatchEvent("refreshQuestCountText");this._super.closePopup.call(this)},unloadContent:function(){if(null!=this._callback||void 0!=this._callback)this._skip||this._callback(this._popupCloseFrom),this._callback=null;this._super._super.unloadContent.call(this)}});var RSQuestWelcomePopup=RSPopup.extend({init:function(a,b,c){this._screenLayout=a;this._shouldLoadDailyQuestPopupOnExit=!1;this._triggeredFromQuestPopup=b;this._callBack=c;this._super.init.call(this);this._triggeredFromQuestPopup||RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge","quest_welcome_popup",b?"click":"trigger","")},loadContent:function(){this._super.loadContent.call(this);this.layoutScreen(this._screenLayout)},loadDailyQuestPopupOnExit:function(){this._shouldLoadDailyQuestPopupOnExit= !0},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CloseButton":this._closeButton=a;break;case "LetsGo":this._letsGoBtn=a;break;case "CoinGlow":a.stopAnimation(),a.playAnimation(-1,0.3)}},onButtonClicked:function(a){switch(a){case "LetsGo":this._letsGoBtn.setTouchEnabled(!1);RSEngine.popupManager.addPopup(new RSDailyQuestPopup(RSGame.getInstance().getAssetPath("DailyChallengePopup"),RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestRewardText(), this._callBack));this.closePopup();break;case "CloseButton":this._closeButton.setTouchEnabled(!1),this._shouldLoadDailyQuestPopupOnExit&&RSEngine.popupManager.addPopup(new RSDailyQuestPopup(RSGame.getInstance().getAssetPath("DailyChallengePopup"),RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestRewardText(),this._callBack)),this._triggeredFromQuestPopup?RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge","info_button","close",""):RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge", "quest_welcome_popup","close",""),this.closePopup()}}});var RSGeneralQuestEventKeys={GIFTING_QUEST_ACTION:"GiftingQuestAction",BIHOURLY_BONUS_COLLECTION_ACTION:"BihourlyBonusQuestAction",DAILY_BONUS_COLLECTION_ACTION:"DailyBonusQuestAction",LEVEL_UP_ACTION:"LevelUpAction",MACHINE_UNLOCK_ACTIONL:"MachineUnlockQuestAction",PURCHASE_ACTION:"PurchaseQuestAction",DAILY_LOGIN_ACTION:"DailyLoginAction",WATCH_AD_ACTION:"WatchAdAction"},RSQuestActionFormatter=function(){var a,b=RSClass.extend({addListeners:function(){RSEventManager.getInstance().addEventListener(RSGeneralQuestEventKeys.GIFTING_QUEST_ACTION, this,this.triggerGiftingAction.bind(this));RSEventManager.getInstance().addEventListener(RSGeneralQuestEventKeys.BIHOURLY_BONUS_COLLECTION_ACTION,this,this.triggerBihourlyBonuscollection.bind(this));RSEventManager.getInstance().addEventListener(RSGeneralQuestEventKeys.DAILY_BONUS_COLLECTION_ACTION,this,this.triggerDailyBonuscollection.bind(this));RSEventManager.getInstance().addEventListener(RSGeneralQuestEventKeys.LEVEL_UP_ACTION,this,this.triggerLevelUpAction.bind(this));RSEventManager.getInstance().addEventListener(RSGeneralQuestEventKeys.MACHINE_UNLOCK_ACTIONL, this,this.triggerMachineUnlockAction.bind(this));RSEventManager.getInstance().addEventListener(RSGeneralQuestEventKeys.PURCHASE_ACTION,this,this.triggerPurchaseAction.bind(this));RSEventManager.getInstance().addEventListener(RSGeneralQuestEventKeys.DAILY_LOGIN_ACTION,this,this.triggerDailyLoginAction.bind(this));RSEventManager.getInstance().addEventListener(RSGeneralQuestEventKeys.WATCH_AD_ACTION,this,this.triggerWatchAdAction.bind(this))},getName:function(){return"RSQuestActionFormatter"},triggerSlotBigWin:function(){RSQuestManager.getInstance().triggerAction(new RSSlotMachineAction({_isBigWin:!0}))}, triggerBihourlyBonuscollection:function(a){var b=new RSGeneralQuestEvent;b.eventID=GeneralQuestEventTypes.DAILY_BONUS;b.parameters=new BonusCollectionParameters;b.parameters.bonusCollected=a._userData;RSQuestManager.getInstance().triggerAction(new RSGeneralAction(b))},triggerDailyBonuscollection:function(a){var b=new RSGeneralQuestEvent;b.eventID=GeneralQuestEventTypes.BIHOURLY_BONUS;b.parameters=new BonusCollectionParameters;b.parameters.bonusCollected=a._userData;RSQuestManager.getInstance().triggerAction(new RSGeneralAction(b))}, triggerGiftingAction:function(a){var b=new RSGeneralQuestEvent;b.eventID=GeneralQuestEventTypes.GIFT;b.parameters=new GiftParameters;b.parameters.giftType=a;RSQuestManager.getInstance().triggerAction(new RSGeneralAction(b))},triggerLevelUpAction:function(a){var b=new RSGeneralQuestEvent;b.eventID=GeneralQuestEventTypes.LEVEL_UP;b.parameters=new LevelUpParameters;b.parameters.updatedLevel=a._userData;RSQuestManager.getInstance().triggerAction(new RSGeneralAction(b))},triggerMachineUnlockAction:function(a){var b= new RSGeneralQuestEvent;b.eventID=GeneralQuestEventTypes.MACHINE_UNLOCK;b.parameters=new MachineUnlockParameters;b.parameters.machineName=a;RSQuestManager.getInstance().triggerAction(new RSGeneralAction(b))},triggerPurchaseAction:function(a,b){var e=new RSGeneralQuestEvent;e.eventID=GeneralQuestEventTypes.PURCHASE;e.parameters=new PurchaseParameters;e.parameters.purchasePackID=a;e.parameters.purchasePriceDollars=b;RSQuestManager.getInstance().triggerAction(new RSGeneralAction(e))},triggerDailyLoginAction:function(a){var b= new RSGeneralQuestEvent;b.eventID=GeneralQuestEventTypes.DAILY_LOGIN;b.parameters=new DailyLoginParameters;b.parameters.loginCount=a._userData;RSQuestManager.getInstance().triggerAction(new RSGeneralAction(b))},triggerWatchAdAction:function(a){var b=new RSGeneralQuestEvent;b.eventID=GeneralQuestEventTypes.WATCH_AD;b.parameters=new WatchAdParameters;b.parameters.loginCount=a._userData;RSQuestManager.getInstance().triggerAction(new RSGeneralAction(b));"undefined"!==typeof SideMenuController&&SideMenuController.getInstance().updateToasterMessage()}, parseGameplayAction:function(a,b){if(RSQuestManager.getInstance().getIsQuestManagerActive())switch(b){case RSGameTypes.Poker:RSPokerDataParser.parse(a);break;case RSGameTypes.Slots:RSQuestManager.getInstance().triggerAction(new RSSlotMachineAction(a));break;case RSGameTypes.Blackjack:RSBlackjackDataParser.parse(a);break;case RSGameTypes.Keno:RSQuestManager.getInstance().triggerAction(new RSKenoAction(a));break;case RSGameTypes.Bingo:RSQuestManager.getInstance().triggerAction(new RSBingoAction(a))}}}); return{getInstance:function(){a||(a=new b);return a}}}();var RSQuestSetCompleted="QuestSetCOmpleted",RSObjectiveCountUpdated="ObjectiveCountUpdated",RSQuestCompleted="QuestCompleted",RSObjectiveCompleted="ObjectiveCompleted",RSQuestManager=function(){var a,b=RSClass.extend({_conditions:[],_objectives:[],_objectiveLists:[],_quests:[],_questSets:[],_questRewards:[],_activeQuestIds:[],_currentQuestSet:null,_activeQuestSets:[],_objectiveDetails:{},_isQuestManagerActive:!1,questConfig:null,_questActive:!1,_listenerAdded:!1,_weeklyChallengeEnabled:!1,init:function(){}, setIsQuestManagerActive:function(a){this._isQuestManagerActive=a},getIsQuestManagerActive:function(){return this._isQuestManagerActive},initializeWithDataForQuest:function(a,b){if(a.conditions){var e=RSEngine.gameData.getSheetData(a.conditions);if(e)for(var f=0;f<e.length;f++)this._conditions[f]=new RSCondition(e[f])}if(a.objectives&&(e=RSEngine.gameData.getSheetData(a.objectives)))for(f=0;f<e.length;f++)this._objectives[f]=new RSObjective(e[f]);if(a.objectiveList&&(e=RSEngine.gameData.getSheetData(a.objectiveList)))for(f= 0;f<e.length;f++)this._objectiveLists[f]=new RSObjectiveList(e[f]);if(a.quests&&(e=RSEngine.gameData.getSheetData(a.quests)))for(f=0;f<e.length;f++)this._quests[f]=new RSQuest(e[f]);if(a.questSet&&(e=RSEngine.gameData.getSheetData(a.questSet)))for(f=0;f<e.length;f++)this._questSets[f]=new RSQuestSet(e[f]);if(a.rewards&&(e=RSEngine.gameData.getSheetData(a.rewards)))for(f=0;f<e.length;f++)this._questRewards[f]=new RSQuestReward(e[f]);this.SetActiveQuest(!0);this.questConfig=b;this._listenerAdded||(this._listenerAdded= !0,RSQuestActionFormatter.getInstance().addListeners())},getGameTypeFromValue:function(a){switch(a){case "0":return RSGameTypes.Slots;case "1":return RSGameTypes.Poker;case "2":return RSGameTypes.Bingo;case "3":return RSGameTypes.Blackjack;case "4":return RSGameTypes.Keno}},setUserQuestData:function(a){this._activeQuestIds=a.activeQuests;this._objectiveDetails=a.objectiveDetails},getIsFreshQuestSet:function(){return this._objectiveDetails=={}},setUserObjectiveStatus:function(){var a,b;for(b in this._objectiveDetails)0< this._objectiveDetails[b].status&&(a=this.getObjectives(b))&&(a.status=!0)},getActiveQuestList:function(){for(var a in this._questSets)if(this._questSets[a].id==this._activeQuestIds[0].id)return this._questSets[a].questList},SetActiveQuest:function(a){a&&(this._currentQuestSet=null);if(this._activeQuestIds)for(var b=0;b<this._activeQuestIds.length;b++){var e=this._activeQuestIds[b],f=this.getQuestSetForId(e.id,e.st,a);e.st&&"false"!=e.st||null!=this._currentQuestSet||"undefined"==typeof f||(this._currentQuestSet= f,this._currentQuestSet.updateActiveStatus())}},getRewardForID:function(a){for(var b=0;b<this._questRewards.length;b++)if(a==this._questRewards[b].id)return this._questRewards[b]},getQuestSetForId:function(a,b,e){for(var f=0;f<this._questSets.length;f++)if(a==this._questSets[f].id)return e&&!b&&(this._activeQuestSets.push(this._questSets[f]),this._questSets[f].setQuestStatus(b)),this._questSets[f]},getQuest:function(a){for(var b=0;b<this._quests.length;b++)if(a==this._quests[b].id)return this._quests[b]}, getObjectiveList:function(a){for(var b=0;b<this._objectiveLists.length;b++)if(a==this._objectiveLists[b].id)return this._objectiveLists[b]},getObjectives:function(a){for(var b in this._objectives)if(a==this._objectives[b].id)return this._objectives[b];return null},getCondition:function(a){for(var b in this._conditions)if(a==this._conditions[b].id)return this._conditions[b]},getUserObjectiveCount:function(a){if(this._objectiveDetails)for(var b in this._objectiveDetails)if(a==b)return this._objectiveDetails[b].ct; return 0},triggerAction:function(a){null!=this._currentQuestSet&&this._isQuestManagerActive&&this.questLevelEnabled()&&this._questActive&&this._currentQuestSet.triggerAction(a)&&(this._currentQuestSet=null,this.SetActiveQuest())},setUserQuestObjectiveCount:function(a,b){if(this._objectiveDetails&&this._objectiveDetails){for(var e in this._objectiveDetails)a==e&&(this._objectiveDetails[e].ct=b);this._objectiveDetails[a]||(this._objectiveDetails[a]={ct:b});RSEventManager.getInstance().dispatchEvent(RSObjectiveCountUpdated, {objectiveId:a})}},setUserObjectiveCompletionStatus:function(a,b){if(this._objectiveDetails&&this._objectiveDetails){for(var e in this._objectiveDetails)a==e&&(this._objectiveDetails[e].status=b);this._objectiveDetails[a]||(this._objectiveDetails[a]={status:b})}},getUserObjectiveCompletionStatus:function(a){if(this._objectiveDetails&&this._objectiveDetails){for(var b in this._objectiveDetails)if(a==b)return this._objectiveDetails[b].status;if(!this._objectiveDetails[a])return 0}},getNumCompletedQuests:function(){var a= 0;if(this._objectiveDetails)for(var b in this._objectiveDetails)1==this._objectiveDetails[b].status&&a++;return a},getNumCompletedAndCollectedQuests:function(){var a=0;if(this._objectiveDetails)for(var b in this._objectiveDetails)2==this._objectiveDetails[b].status&&a++;return a},getNumCompletedAndNotCollectedQuests:function(){var a=0;if(this._objectiveDetails)for(var b in this._objectiveDetails)1==this._objectiveDetails[b].status&&a++;return a},getNumActiveQuests:function(){return this.getActiveQuestList()._quests.length}, setUserQuestSetCompletionStatus:function(){for(var a=0;a<this._activeQuestIds.length;a++)if(this._activeQuestIds[a].id==this._currentQuestSet.id){this._activeQuestIds[a].st=!0;RSEventManager.getInstance().dispatchEvent(RSQuestSetCompleted,{questId:this._currentQuestSet.id});break}},getMachineForObjective:function(a){a=a.conditionObject;for(var b in a)if("SM"==a[b].type||"BJM"==a[b].type||"BM"==a[b].type||"PM"==a[b].type||"KM"==a[b].type)return a[b].values[0];return""},triggerQuestCompletedEventToCasino:function(a){RSEventManager.getInstance().dispatchEvent(RSQuestCompleted, {questId:a})},getCurrentQuestSetId:function(){return null==this._currentQuestSet?null:this._currentQuestSet.id},setWeeklyChallengeStatus:function(a){this._weeklyChallengeEnabled=a},getWeeklyChallengeStatus:function(){return this._weeklyChallengeEnabled},questLevelEnabled:function(){return this.questConfig&&this.questConfig[0].unlockAt<=RSGame.getInstance().getLevelManager().getCurrentLevel()?!0:!1},setQuestEnabledStatus:function(){this._questActive=!0},getQuestEnabledStatus:function(){return this._questActive}}); return{getInstance:function(){a||(a=new b);return a}}}();var UPDATE_SIDEMENU_NOTIFICATION_COUNTER="UpdateSideMenuNotificationCounter",UPDATE_SIDEMENU_METAGAME_NOTIFICATION_COUNTER="UpdateSideMenuMetaGameNotificationCounter",SIDEMENU_ART_ASSETS_LOADED="SideMenuArtAssetsLoaded",ACTIVE_QUESTSET_KEY="LastSavedActiveQuestSet",SideMenuController=function(){var a,b=1,c=1,d=null,e="none",f=null,g=null,h=null,k=null,m=RSClass.extend({init:function(){RSEventManager.getInstance().addEventListener(UPDATE_SIDEMENU_NOTIFICATION_COUNTER,this,this.updateNotificationCounter.bind(this)); RSEventManager.getInstance().addEventListener(RSObjectiveCompleted,this,this.playOnQuestCompleteAnimation.bind(this));RSEventManager.getInstance().addEventListener(RSObjectiveCountUpdated,this,this.showQuestProgressMessage.bind(this));RSEventManager.getInstance().addEventListener(UPDATE_SIDEMENU_METAGAME_NOTIFICATION_COUNTER,this,this.updateMetaGameNofificationCounter.bind(this));this.updateNotificationCounter();this.setClosedStateDivDimensions();d=RSUtils.getLocalStorageItem(ACTIVE_QUESTSET_KEY, "")},initiateSideMenuView:function(a){document.getElementById("SideMenuIFrame")&&document.getElementById("Cocos2dGameContainer").contains(document.getElementById("SideMenuIFrame"))&&document.getElementById("Cocos2dGameContainer").removeChild(document.getElementById("SideMenuIFrame"));var b=document.createElement("iframe");b.setAttribute("id","SideMenuIFrame");b.setAttribute("scrolling","no");b.setAttribute("disabled","true");b.setAttribute("style","position:absolute;right: 0px;top: 107px; border: 0; width: 218px; height: 177px; display: none; z-index: 999;"); b.setAttribute("src",GameConfig.SIDE_MENU_PATH+a+"?v\x3d"+TimeManager.getInstance().getCurrentServerTime());document.getElementById("Cocos2dGameContainer").appendChild(b)},getLocalStoreKeyForDisplayedProgress:function(a){return"LastDisplayedToasterValueForIndex"+a},showQuestProgressMessage:function(a,b){if(d!=RSQuestManager.getInstance().getCurrentQuestSetId()){for(var c in RSQuestManager.getInstance().getActiveQuestList())RSUtils.setLocalStorageItem(this.getLocalStoreKeyForDisplayedProgress(c),""); RSUtils.setLocalStorageItem(ACTIVE_QUESTSET_KEY,RSQuestManager.getInstance().getCurrentQuestSetId());d=RSQuestManager.getInstance().getCurrentQuestSetId()}a=a._userData.objectiveId;var e="",g="";for(c in RSQuestManager.getInstance().getActiveQuestList()){var h=RSQuestManager.getInstance().getActiveQuestList()[c],k=RSQuestManager.getInstance().getQuest(h).objectiveList[0],m;for(m in k.objectives)if(a==k.objectives[m]){e=this.getLocalStoreKeyForDisplayedProgress(c);g=h;break}}c=RSQuestManager.getInstance().getQuest(g); g=c.description;h=g.split("\\");2<=h.length&&(g=h[0]);f=c.objectiveList[0].objective[0];h=RSQuestManager.getInstance().getUserObjectiveCount(f.id);k=f.count;m=RSUtils.getLocalStorageItem(e,0);var x=~~(h/k/0.25);!b&&x>m&&1>h/k&&(API.sendSideMenuMessage("update_SideMenu",{event:"QuestProgress",questDescription:g,questProgress:RSUtils.formatNumber(h)+"/"+RSUtils.formatNumber(k),progressPercentage:h/k}),RSUtils.setLocalStorageItem(e,x),RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge", "quest_progress","trigger",a,x));b&&1==h/k&&(this._currentQuestObject=c,API.sendSideMenuMessage("update_SideMenu",{event:"QuestProgress",questDescription:g,questProgress:RSUtils.formatNumber(h)+"/"+RSUtils.formatNumber(k),progressPercentage:h/k,showCollectBtn:!0}))},updateToasterMessage:function(){if(f){var a=RSQuestManager.getInstance().getUserObjectiveCount(f.id),b=f.count;API.sendSideMenuMessage("update_SideMenu",{event:"UpdateToasterMessage",questProgress:RSUtils.formatNumber(a)+"/"+RSUtils.formatNumber(b), progressPercentage:a/b})}},updateLockButton:function(){API.sendSideMenuMessage("update_SideMenu",{event:"HandleLockButtonVIsibility",flag:RSQuestManager.getInstance().questLevelEnabled(),level:RSQuestManager.getInstance().questConfig[0].unlockAt})},handlePositionAndOffset:function(){this.setPixiContainerScale();this.setMenuDivDimensions()},setMenuDivDimensions:function(){var a=document.getElementById("SideMenuIFrame");if(null!=a){var d=document.getElementById("Cocos2dGameContainer"),e=d.style.height, e=parseInt(e.substring(0,e.length-2))/640;this._sideMenuData=RSGame.getInstance().getGameManager().getSideMenuStyleData();a.style.top=this._sideMenuData.topPosition*e+"px";a.style.right="0px";a.style.width=this._sideMenuData.width*e*b+"px";a.style.height=350*e*c+"px";a.style.paddingRight=null!=RSEngine.externalGameManager?RSEngine.externalGameManager.isSpinGameActive()?0:d.style.paddingRight:d.style.paddingRight}},setPixiContainerScale:function(){var a=document.getElementById("Cocos2dGameContainer").style.height, a=parseInt(a.substring(0,a.length-2))/640;API.sendSideMenuMessage("update_SideMenu",{event:"OnResize",scale:a})},getName:function(){return"SideMenuController"},playTrayMoveSound:function(){if(this._isSideMenuVisible){var a=RSGame.getInstance().getAssetFolder("DailyChallengePopup")+"DailyQuest_SideBar.mp3";RSEngine.audioManager.playEffect(a,!1)}},playDartBoardSound:function(){this._isSideMenuVisible&&RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyChallengePopup")+"OnQuestComplete.mp3", !1)},setClosedStateDivDimensions:function(){b=0.4;c=0.6;this.setMenuDivDimensions()},setOpenStateDivDimensions:function(){c=b=1;this.setMenuDivDimensions()},setToasterDivDimensions:function(){b=1.5;c=1;this.setMenuDivDimensions()},setToolTipDivDimensions:function(){b=1.68;c=1;this.setMenuDivDimensions()},onDailyBonusButtonClicked:function(a){if(RSEngine.dataManager.getMe().getDCinfoPopupShownStatus())if(RSEngine.loginMode==LOGIN_MODE.GUEST)RSGame.getInstance().getGameManager().showLoginPopup("feature", "DailyQuestButton");else if(RSQuestManager.getInstance().getWeeklyChallengeStatus())!0==LTEM_QUEST_DATA.AVAILABLE&&(this._quest=RSQuestManager.getInstance().getCurrentQuestSetId(),QuestPopupManager.getInstance().showQuestObjective(null,this._quest,!0));else if(RSQuestManager.getInstance().questLevelEnabled()){var b=RSGame.getInstance().getUserDataManager().getMe().getDailyChallengeData().activeQuests;if(b&&b.length){var c=0,d=!0;for(c in b)RSQuestManager.getInstance().getQuestSetForId(b[c].id)||(d= !1);d?a&&this._currentQuestObject?(RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge","quest_toaster","collect"),RSEngine.popupManager.addPopup(new RSDailyQuestPopup(RSGame.getInstance().getAssetPath("DailyChallengePopup"),RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestRewardText(),null,!0,this._currentQuestObject)),this._currentQuestObject=null):(RSAnalyticsManager.getInstance().trackGUIEvent("slider","daily_challenge","click"),RSEngine.popupManager.addPopup(new RSDailyQuestPopup(RSGame.getInstance().getAssetPath("DailyChallengePopup"), RSGame.getInstance().getGameManager().getDefaultFontForDailyQuestRewardText()))):API.sendSideMenuMessage("update_SideMenu",{event:"ShowToasterMessage",description:RSQuestManager.getInstance().questConfig[0].questUnavailableText})}else API.sendSideMenuMessage("update_SideMenu",{event:"ShowToasterMessage",description:RSQuestManager.getInstance().questConfig[0].questUnavailableText})}else API.sendSideMenuMessage("update_SideMenu",{event:"ShowToasterMessage",description:RSQuestManager.getInstance().questConfig[0].questLockedText})}, playQuestCompletedReminderAnim:function(){c=b=1;this.setMenuDivDimensions()},playOnQuestCompleteAnimation:function(a){var b=a._userData.objectiveId;b&&RSAnalyticsManager.getInstance().trackPlayerAction("daily_challenge","quest_complete","complete",b,"day"+RSMegaChallengeManager.getInstance().getQuestDay());this.updateNotificationCounter();var c="",d;for(d in RSQuestManager.getInstance().getActiveQuestList()){var e=RSQuestManager.getInstance().getActiveQuestList()[d],f=RSQuestManager.getInstance().getQuest(e).objectiveList[0], g;for(g in f.objectives)if(b==f.objectives[g]){c=e;break}}1==parseInt(RSGame.getInstance().getGameData().getDefaultValues().isDQNewFlowEnabled)&&this._isSideMenuVisible&&c!=RSGame.getInstance().getGameData().getDefaultValues().loginDailyQuestId?this.showQuestProgressMessage(a,!0):API.sendSideMenuMessage("update_SideMenu",{event:"PlayOnQuestCompleteAnimation"})},enableAllButtons:function(){this.updateNotificationCounter();API.sendSideMenuMessage("update_SideMenu",{event:"EnableAllButtons"})},disableAllButtons:function(){API.sendSideMenuMessage("update_SideMenu", {event:"DisableAllButtons"})},updateNotificationCounter:function(){this._dailyChallengeNotificationCount=RSQuestManager.getInstance().getNumCompletedQuests();RSEventManager.getInstance().dispatchEvent("refreshQuestCountText");API.sendSideMenuMessage("update_SideMenu",{event:"UpdateNotificationCount",notificationCount:this._dailyChallengeNotificationCount})},updateMetaGameNofificationCounter:function(a){var b=!1;a&&a._userData&&a._userData.showAnimation&&(b=!0);API.sendSideMenuMessage("update_SideMenu", {event:"UpdateNotificationCountOfMetaGame",metaGameProgressData:RSGame.getInstance().getGameManager().getMetaGameProgressData(),showAnimation:b})},setSideMenuVisibility:function(a){this._isSideMenuVisible=!0;GameConfig.LOADING_MODULE_ENABLED&&RSEngine.loginMode==LOGIN_MODE.GUEST||RSEngine.dataManager.getMe()&&!RSEngine.dataManager.getMe().getDCinfoPopupShownStatus()&&(!GameConfig.TOURNAMENT_ENABLED||RSEngine.gameData&&!parseInt(RSEngine.gameData.getDefaultValues().isTournamentEnabled))?this._isSideMenuVisible= !1:(a?e="unset":(this._isSideMenuVisible=!1,e="none"),a=document.getElementById("SideMenuIFrame"),null!=a&&(a.style.display=e,RSEngine.dataManager.getMe().getDCinfoPopupShownStatus()&&this.updateNotificationCounter()))},initiationComplete:function(){this.handlePositionAndOffset()},getSideMenuItemsList:function(){API.sendSideMenuMessage("update_SideMenu",{event:"listOfSideMenuItems",sideMenuItemsList:RSGame.getInstance().getGameManager().getSideMenuItemsList()});RSEventManager.getInstance().dispatchEvent(SIDEMENU_ART_ASSETS_LOADED, null);RSAnalyticsManager.getInstance().trackInHouseEvent("playerevent","sidemenu","loaded",JSON.stringify(RSGame.getInstance().getGameManager().getSideMenuItemsList()),"","")},resolveMessages:function(a){switch(a.sideMenuEvent){case "OnDailyChallengeButtonPressed":this.onDailyBonusButtonClicked();break;case "OnSideMenuButtonPressed":RSGame.getInstance().getGameManager().onSideMenuButtonCliked(a.from);break;case "OnDartBoardAnimationInit":this.playDartBoardSound();break;case "onTrayCloseComplete":this.playTrayMoveSound(); this.setClosedStateDivDimensions();break;case "OnTrayOpenInitiated":this.playTrayMoveSound();this.setOpenStateDivDimensions();RSGame.getInstance().getGameManager().sideMenuBtnClicked();break;case "OnToasterOpenInitiated":this.setToasterDivDimensions();break;case "OnToasterClosed":this.setClosedStateDivDimensions();break;case "InitializationComplete":this.initiationComplete();break;case "getSideMenuItemsList":this.getSideMenuItemsList();break;case "log_error":RSErrorTracker.getInstance().trackErrorMessage("sidemenu_error", a.error_msg,"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net");console.log("Error logged");break;case "OnCollectButtonPressed":this.onDailyBonusButtonClicked(!0);break;case "onQuestCompletedReminderAnim":this.playQuestCompletedReminderAnim(!0)}},playTournamentAnimation:function(a){API.sendSideMenuMessage("update_SideMenu",{event:"PlayTournamentAnimation",eventData:a});"GO!"==a&&(g=setTimeout(this.dismissMessageBubble.bind(this),1E3),h=setTimeout(this.closeSideMenuTray.bind(this),1E4)); this.setToolTipDivDimensions()},dismissMessageBubble:function(){clearTimeout(g);API.sendSideMenuMessage("update_SideMenu",{event:"PlayTournamentAnimation",eventData:"hideBubble"})},closeSideMenuTray:function(){clearTimeout(h);API.sendSideMenuMessage("update_SideMenu",{event:"PlayTournamentAnimation",eventData:"close"})},playSurfacingAnimation:function(a){"surfacing"==a?API.sendSideMenuMessage("update_SideMenu",{event:"PlayTournamentSurfacingAnimation",eventData:a}):"TournamentEntryinfo"==a?(g=setTimeout(this.dismissMessageBubble.bind(this), 7E3),h=setTimeout(this.closeSideMenuTray.bind(this),7E3),API.sendSideMenuMessage("update_SideMenu",{event:"PlayTournamentSurfacingAnimation",eventData:"surfacing"}),a="Join the live \ntournaments today \nstarting at "+RSTournamentManager.getTournamentTimingData().titleKey3,k=setTimeout(this._showTournamentAccesInfo.bind(this,a),500)):"IntermediateBubbleInfo"==a?(g=setTimeout(this.dismissMessageBubble.bind(this),7E3),h=setTimeout(this.closeSideMenuTray.bind(this),7E3),API.sendSideMenuMessage("update_SideMenu", {event:"PlayTournamentSurfacingAnimation",eventData:"surfacing"}),a="Join the next tournament\n at "+RSTournamentManager.getTournamentTimingData().titleKey3,k=setTimeout(this._showTournamentAccesInfo.bind(this,a),500)):"TournamentWaitingOpen"==a?(g=setTimeout(this.dismissMessageBubble.bind(this),7E3),h=setTimeout(this.closeSideMenuTray.bind(this),7E3),API.sendSideMenuMessage("update_SideMenu",{event:"PlayTournamentSurfacingAnimation",eventData:"surfacing"}),a="Tap here to join the\n Live Slots Tournament!", "MSP"==GameConfig.GAME_ID&&(a="Tap here to join the\nLive Poker Tournament!"),k=setTimeout(this._showTournamentAccesInfo.bind(this,a),500)):(a="Join the live \ntournaments today \nstarting at "+RSTournamentManager.getTournamentTimingData().titleKey3,API.sendSideMenuMessage("update_SideMenu",{event:"PlayTournamentSurfacingAnimation",eventData:a}),h=setTimeout(this.closeSideMenuTray.bind(this),1E4));this.setToolTipDivDimensions()},_showTournamentAccesInfo:function(a){clearTimeout(k);API.sendSideMenuMessage("update_SideMenu", {event:"PlayTournamentSurfacingAnimation",eventData:a});this.setToolTipDivDimensions()}});return{getInstance:function(){a||(a=new m);return a}}}();var RSCurtainRaiserScreen=RSGameScreen.extend({init:function(a,b){this._super.init.call(this);this._typeOfSurfacing=void 0!=b||null!=b?b:"";this._curtainPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this._commonBgForSurfacing=this._customBGforSurfacing=null;this.layoutScreen(a)},onAssetLoaded:function(a){this._super.onAssetLoaded.call(this,a)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._customBGforSurfacing? this._customBGforSurfacing.setVisible(!0):this._commonBgForSurfacing&&this._commonBgForSurfacing.setVisible(!0);this.addChild(this._curtainPanel);RSUtils.callFunctionWithDelay(1,this,this.initiateCurtainRaising.bind(this));RSUtils.callFunctionWithDelay(2,this,this.moveSideAndTopCurtain.bind(this))},onObjectCreated:function(a,b,c){switch(c.name){case "Bg":this._commonBgForSurfacing=a,this._commonBgForSurfacing.setVisible(!1)}this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a, b){var c=null;switch(b.name){case "CurtainRaiserBgLeft":this._curtainBgLeft=RSUtils.createBasicObject(a,b);this.addChild(this._curtainBgLeft);break;case "CurtainRaiserBgRightFlip":this._curtainBgRight=RSUtils.createBasicObject(a,b);this._curtainBgRight.setScaleX(-1);this.addChild(this._curtainBgRight);break;case "CurtainRaiserTopLeft":c=RSUtils.createBasicObject(a,b);this.addToPreIntroLayer(c);break;case "CurtainRaiserTopRightFlip":c=RSUtils.createBasicObject(a,b);c.setScaleX(-1);this.addToPreIntroLayer(c); break;case "CurtainRaiserPartLeft":c=RSUtils.createBasicObject(a,b);this.addToPreIntroLayer(c);break;case "CurtainRaiserPartRightFlip":c=RSUtils.createBasicObject(a,b);c.setScaleX(-1);this.addToPreIntroLayer(c);break;case "CustomBgFor"+this._typeOfSurfacing:this._customBGforSurfacing=RSUtils.createBasicObject(a,b),this.addChild(this._customBGforSurfacing),this._customBGforSurfacing.setVisible(!1)}},addToPreIntroLayer:function(a){var b=this._curtainPanel.convertToNodeSpace(a.getX(),a.getY());a.setCenter(b.getX(), b.getY());this._curtainPanel.addChild(a)},initiateCurtainRaising:function(){this._curtainBgLeft.actionMoveBy(1.8,-(2.8*this._curtainBgLeft.getPosition()._x),0,this.onComplete.bind(this));this._curtainBgRight.actionMoveBy(1.8,2.8*this._curtainBgLeft.getPosition()._x,0,null);switch(this._typeOfSurfacing){case "Tournament":RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("TournamaniaSurfacing")+"CurtainSFX.mp3",!1);break;case "FoxPlayIntroScreen":RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("LogoRevealingScreen")+ "Curtain_to_Full_Animation.mp3",!1);break;default:RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("CurtainRaiser")+"DC_CurtainSFX.mp3",!1)}},onComplete:function(){},moveSideAndTopCurtain:function(){this.firstSectionComplete();this._curtainPanel.actionZoom(1.5,1.5,this._borderMovementComplete.bind(this))},_borderMovementComplete:function(){cc.log("border movement");this.onCurtainRaised()},firstSectionComplete:function(){},onCurtainRaised:function(){},unloadContent:function(){this._super.unloadContent.call(this)}});var RSDailyQuestIntroScreen=RSCurtainRaiserScreen.extend({init:function(a){this._super.init.call(this,RSGame.getInstance().getAssetPath("CurtainRaiser"));this.callBack=a},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},firstSectionComplete:function(){},onCurtainRaised:function(){this._unlockScreen= new RSDailyChallengeUnlockScreen(this.onDCUnlockAnimComplete.bind(this));this.addChild(this._unlockScreen)},onDCUnlockAnimComplete:function(a){this.callBack&&this.callBack.call(this,a)},unloadContent:function(){this._super.unloadContent.call(this)}});var RSDailyChallengeUnlockScreen=RSGameScreen.extend({init:function(a){this._super.init.call(this);this.callBack=a;this._questUnlockPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(this._questUnlockPanel);this._questUnlockPanel.setVisible(!1);this._questInfoPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(this._questInfoPanel);this._questInfoPanel.setVisible(!1); this._dartPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(this._dartPanel);this._dartPanel.setVisible(!1);this._emitterObject=new RSPanel(0,0,0,0);this._particleEmitter=null;this._textInfo=[];this._infoDart=[];this.layoutScreen(RSGame.getInstance().getAssetPath("DailyChallengeIntroPopup"),2);RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge","quest_welcome_popup","trigger","")},loadContent:function(){this._super.loadContent.call(this)}, createCustomObject:function(a,b){switch(b.name){case "DailyQuestUnlockBase":this._dailyQuestUnlockBase=RSUtils.createBasicObject(a,b);this.addIntoPreIntroPanel(this._dailyQuestUnlockBase,1);break;case "IconBase":this._dart=RSUtils.createBasicObject(a,b);this._dartPanel.addChild(this._dart);break;case "Arrow":this._arrow=RSUtils.createBasicObject(a,b);this._dartPanel.addChild(this._arrow);break;case "Bg":this._popupBg=RSUtils.createBasicObject(a,b);this.addIntoPreIntroPanel(this._popupBg);break;case "2xWheel":this._2xWheel= RSUtils.createBasicObject(a,b);this.addIntoPreIntroPanel(this._2xWheel);this._2xWheel.setVisible(!1);break;case "Lock":this._lockAnimation=RSUtils.createAnimation(a,b,0.3);this._lockAnimation.stopAnimation();this.addIntoPreIntroPanel(this._lockAnimation,1);break;case "LetsGo":this._letsGoBtn=RSUtils.createButton(a,b);this.addTouchListenerToButton(this._letsGoBtn);this.addIntoPreIntroPanel(this._letsGoBtn);this._letsGoBtn.setVisible(!1);break;case "CloseButton":this._closeBtn=RSUtils.createButton(a, b);this.addIntoPreIntroPanel(this._closeBtn);break;case "Target":this._dartAnimation=RSUtils.createAnimation(a,b,0.3);this._dartAnimation.stopAnimation();this.addIntoPreIntroPanel(this._dartAnimation);break;case "CoinGlow":this._coinGlowAnimation=RSUtils.createAnimation(a,b,0.3),this._coinGlowAnimation.stopAnimation(),this.addIntoPreIntroPanel(this._coinGlowAnimation),this._coinGlowAnimation.setVisible(!1)}var c=null;switch(b.type){case "Text":c=RSUtils.createBasicObject(a,b);this.addIntoPreIntroPanel(c); c.actionZoom(0,1.05,null);c.setVisible(!1);this._textInfo.push(c);break;case "Rect":b.name="Icon1",c=RSUtils.createBasicObject(a,b),this.addIntoPreIntroPanel(c),c.setVisible(!1),this._infoDart.push(c)}this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._dartPanel.actionZoom(0,0,null);this._questUnlockPanel.actionZoom(0,0,this.onQuestUnlockPanelScaledDownCOmplete.bind(this)); this.addChild(this._emitterObject);this._emitterObject.setZOrder(-1)},onButtonClicked:function(a){switch(a){case "LetsGo":RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge","quest_welcome_popup","click","");this.callBack.call(this,1);break;case "CloseButton":this.callBack.call(this,0),RSAnalyticsManager.getInstance().trackGUIEvent("daily_challenge","quest_welcome_popup","close","")}},addIntoPreIntroPanel:function(a,b){b?this._questUnlockPanel.addChild(a):this._questInfoPanel.addChild(a)}, onQuestUnlockPanelScaledDownCOmplete:function(){this._questUnlockPanel.setVisible(!0);this._dartPanel.setVisible(!0);this._questUnlockPanel.actionZoomInOut(0.3,0.8,0.9,2,this.onQuestUnlockPanelScaleUpCOmplete.bind(this));this._dartPanel.actionZoomInOut(0.3,0.4,0.5,2,null);RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyChallengeIntroPopup")+"DQ_AnimePop.mp3",!1);this.loadParticleEffect();RSUtils.callFunctionWithDelay(1,this,this._changeZOrder.bind(this))},onQuestUnlockPanelScaleUpCOmplete:function(){this._lockAnimation.playAnimation(1, 0.3,this._onLockAnimationCompleted.bind(this));RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyChallengeIntroPopup")+"Lock.mp3",!1)},loadParticleEffect:function(){cc.spriteFrameCache.addSpriteFrames("res/PlatformWidgets/DailyChallengesPopup/ParticleEmitter_00-hd.plist");var a=new RSEmitterParticleParams;a._spriteFrames.push("ParticleEmitter_00/ParticleEmitter0.png");a._spriteFrames.push("ParticleEmitter_00/ParticleEmitter1.png");a._spriteFrames.push("ParticleEmitter_00/ParticleEmitter2.png"); a._spriteFrames.push("ParticleEmitter_00/ParticleEmitter3.png");a._spriteFrames.push("ParticleEmitter_00/ParticleEmitter4.png");a._spriteFrames.push("ParticleEmitter_00/ParticleEmitter5.png");a._spriteFrames.push("ParticleEmitter_00/ParticleEmitter6.png");a._spriteFrames.push("ParticleEmitter_00/ParticleEmitter7.png");a._spriteFrames.push("ParticleEmitter_00/ParticleEmitter8.png");a._startDelay=0.2;a._startDelayVariance=0.5;a._deviation=800;a._deviationVariance=150;a._speed=1E3;a._360rotationDuration= 0.5;a._tweenRate=0.5;a._spriteAnimationSpeed=0.4;a._origin=new RSPoint(RSEngine.screenWidth/2,RSEngine.screenHeight/2);a._originVariance=new RSPoint(0,0);a._displacement=new RSPoint(0,0);a._displacementVariance=new RSPoint(RSEngine.screenWidth-500,RSEngine.screenHeight-100);var b=RSGame.getInstance().getGameManager().getCustomizedParticleCount()?RSGame.getInstance().getGameManager().getCustomizedParticleCount():200;this._particleEmitter=new RSCustomAnimationEmitter(a,!1,RSCustomEmitterType.FOUNTAIN, b,this._onParticleEmitterCompleted.bind(this));this._emitterObject.addChild(this._particleEmitter);this._particleEmitter.loadEmitter();this._particleEmitter.startEmitter()},_onParticleEmitterCompleted:function(){this._playDartAnimation()},_changeZOrder:function(){this._emitterObject.setZOrder(2)},_onLockAnimationCompleted:function(){},_playDartAnimation:function(){this._dartPanel.removeChild(this._arrow);this._dartPanel.actionZoom(0.4,4,this._onDartZoomOutComplete.bind(this));RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyChallengeIntroPopup")+ "TargetZoom.mp3",!1)},_onDartZoomOutComplete:function(){this.removeChild(this._questUnlockPanel);this._questInfoPanel.setVisible(!0);var a=this._dartAnimation.getY()-this._dart.getY(),b=this._dartAnimation.getX()-this._dart.getX();this._dartPanel.actionMoveBy(0.5,b/2,a,this._onDartAnimationComplete.bind(this));this._dartPanel.actionZoom(0.5,0.18)},_onDartAnimationComplete:function(){this.removeChild(this._dartPanel);this._playInfoAnimations()},_playInfoAnimations:function(){this._dartAnimation.playAnimation(1, 0.3,this._onInfoTopDartAnimationCompleted.bind(this));RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyChallengeIntroPopup")+"DartHitIntro.mp3",!1)},_onInfoTopDartAnimationCompleted:function(){this._infoDart.length?this._playInfoDartAnimation():this._play2xWheelAnimation()},_playInfoDartAnimation:function(){this._infoDart[0].setVisible(!0);this._infoDart[0].actionZoomInOut(0.3,0.8,1,1,this._playInfoTextAnimation.bind(this));RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyChallengeIntroPopup")+ "DartPopx4.mp3",!1)},_playInfoTextAnimation:function(){this._infoDart.splice(0,1);this._textInfo[0].setVisible(!0);this._textInfo[0].actionZoom(0.25,1,this._onInfoTextAnimationCompleted.bind(this));RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyChallengeIntroPopup")+"TextPopx4.mp3",!1)},_onInfoTextAnimationCompleted:function(){this._textInfo.splice(0,1);RSUtils.callFunctionWithDelay(0.35,this,this._onInfoTopDartAnimationCompleted.bind(this))},_play2xWheelAnimation:function(){this._2xWheel.setVisible(!0); this._coinGlowAnimation.setVisible(!0);this._coinGlowAnimation.playAnimation(-1,0.3,null);RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyChallengeIntroPopup")+"2xAnime.mp3",!1);this._2xWheel.actionZoomInOut(0.3,0.8,1,1,this._playLetsGoBtnAnimation.bind(this));this._coinGlowAnimation.actionZoomInOut(0.3,0.8,1,1,null)},_playLetsGoBtnAnimation:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyChallengeIntroPopup")+"LetsGo.mp3",!1);this._letsGoBtn.setVisible(!0); this._letsGoBtn.actionZoomInOut(0.3,0.8,1,1,this._onLetsGoBtnAnimationCOmpleted.bind(this))},_onLetsGoBtnAnimationCOmpleted:function(){this.addTouchListenerToButton(this._closeBtn)},unloadContent:function(){this._super.unloadContent.call(this)}});var RSQuestToolTipPopup=RSPopup.extend({_assetFolder:null,_assetList:null,_toolTipCloseTimer:null,_toolTipTimer:null,init:function(a){this._super.init.call(this,a);this._assetList=[{name:RSGame.getInstance().getAssetPath("SideMenuBubblePopup"),count:1}]},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._toolTipCloseTimer=RSUtils.callFunctionWithDelay(10,this,this.closePopup.bind(this));this._toolTipTimer=RSUtils.callFunctionWithDelay(0.5,this,this.startToolTipAnim.bind(this))}, loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this);SideMenuController.getInstance().setSideMenuVisibility(!0)},onObjectCreated:function(a,b,c){switch(c.name){case "CloseBtn":this._closeButton=a;break;case "Bubble":this._bubbleText=a,this._bubbleText.setScaleY(0),this._bubbleText.setScaleX(0)}},startToolTipAnim:function(){this._toolTipTimer=null;this._bubbleText.actionScale(0.3,1,1)},handleTouchEndAt:function(a,b,c){this.closePopup()},closePopup:function(){this._toolTipTimer= this._toolTipCloseTimer=null;this._super.closePopup.call(this)}});var RSSkipChallengeConfirmationPopup=RSGenericPopup.extend({init:function(a,b){RSAnalyticsManager.getInstance().trackInHouseEvent("gui","daily_challenge","swap_popup","trigger","","");this._font=a;this._callback=b;this._assetList=[{name:RSGame.getInstance().getAssetPath("ConfirmationPopup"),count:1}];this._super.init.call(this,b)},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},onObjectCreated:function(a, b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "Swap":this._swap=a}},createCustomObject:function(a,b){switch(b.name){case "Text":var c=RSGame.getInstance().getStringDictionary("SkipChallengeConfirmationText").T1,c=new RSLabelBMFont(c,this._font,2*b.w,kTEXT_ALIGNMENT_CENTER);c.setCenter(b.x,b.y);c.setScale(0.8);this.addChild(c)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "Swap":RSAnalyticsManager.getInstance().trackInHouseEvent("gui", "daily_challenge","swap_popup","click","","");if(null!=this._callback||void 0!=this._callback)this._callback(!0),this._callback=null;this.closePopup();break;case "CloseBtn":RSAnalyticsManager.getInstance().trackInHouseEvent("gui","daily_challenge","swap_popup","close","","");if(null!=this._callback||void 0!=this._callback)this._callback(!1),this._callback=null;this.closePopup()}}});var RSSwapDescription=RSDisplayObject.extend({init:function(a,b){this._arrowPosition=a;this._font=b;this._layout=RSGame.getInstance().getAssetPath("MessageBubble");this.rect=new RSRect(0,0,0,0);this._super.init.call(this,this.rect);this.loadContent()},loadContent:function(){this.loadLayout(this._layout)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},onObjectCreated:function(a,b,c){switch(c.name){case "Bg":this._bg=a,this._bgHeight=c.h,this.addChild(this._bg)}},createCustomObject:function(a, b){switch(b.name){case "Arrow_Bottom_Left":this._arrow=RSUtils.createBasicObject(a,b);b.name!=this._arrowPosition&&this._arrow.setVisible(!1);this._arrowHeight=b.h;this.addChild(this._arrow);break;case "Arrow_Bottom_Center":this._arrow=RSUtils.createBasicObject(a,b);b.name!=this._arrowPosition&&this._arrow.setVisible(!1);this._arrowHeight=b.h;this.addChild(this._arrow);break;case "Arrow_Bottom_Right":this._arrow=RSUtils.createBasicObject(a,b);b.name!=this._arrowPosition&&this._arrow.setVisible(!1); this._arrowHeight=b.h;this.addChild(this._arrow);break;case "Arrow_Top_Left":this._arrow=RSUtils.createBasicObject(a,b);b.name!=this._arrowPosition&&this._arrow.setVisible(!1);this._arrowHeight=b.h;this.addChild(this._arrow);break;case "Arrow_Top_Center":this._arrow=RSUtils.createBasicObject(a,b);b.name!=this._arrowPosition&&this._arrow.setVisible(!1);this._arrowHeight=b.h;this.addChild(this._arrow);break;case "Arrow_Top_Right":this._arrow=RSUtils.createBasicObject(a,b);b.name!=this._arrowPosition&& this._arrow.setVisible(!1);this._arrowHeight=b.h;this.addChild(this._arrow);break;case "Message":var c=RSGame.getInstance().getStringDictionary("SwapDescription").T1,c=new RSLabelBMFont(c,this._font,6*b.w,kTEXT_ALIGNMENT_CENTER);c.setCenter(b.x,b.y);c.setScale(0.3);this.addChild(c)}}});var CustomFontVO=RSVO.extend({id:null,fontName:null,isLocal:null,fontSize:null,fontAlign:null,rotation:null,fontColor:null,textLength:null,placeHolderFontName:null,placeHolderFontColor:null,init:function(a){this.fontName=this.id=0;this.isLocal="";this.placeHolderFontColor=this.placeHolderFontName=this.textLength=this.width=this.fontColor=this.rotation=this.fontAlign=this.fontSize=0;this._super.init.call(this,a)}}),RSPlatformFontAssetManager={createCustomLabel:function(a,b,c){var d=this.getCustomFontVOFromConfig(this.getFontNameForLabelName(b.name)), e=-1;d.width&&(e=b.w*d.width);var f=kTEXT_ALIGNMENT_CENTER;d.fontAlign&&(f=0<d.fontAlign?kTEXT_ALIGNMENT_RIGHT:kTEXT_ALIGNMENT_LEFT);a&&(a=a.toString(),a=a.replace(/\\n/g,"\n"));c=new RSLabelBMFontIncrementerlabel(a,RSGame.getInstance().getAssetPath(d.fontName),e,f,b.name,c);f==kTEXT_ALIGNMENT_LEFT?c.setCenter(b.x-b.w/2,b.y):c.setCenter(b.x,b.y);this.configureLabelWithCustomization(c,a,b.name);return c},loadFontConfigFile:function(a,b){var c=0,d=0,e=this;RSUtils.loadJsonAsyc(a+b,null,function(a){e.fontConfig= {};e._labelConfig=a.labels;c=a.fonts.length;for(d=0;d<c;d++)e.fontConfig[a.fonts[d].id]=new CustomFontVO(a.fonts[d])})},getCustomFontVOFromConfig:function(a){return this.fontConfig[a]},getFontNameForLabelName:function(a){return this._labelConfig[a]},configureLabelWithCustomization:function(a,b,c){b=this.getFontNameForLabelName(c);if(b=this.getCustomFontVOFromConfig(b))b.rotation&&a.setRotation(360-b.rotation),b.fontSize&&a.setScale(b.fontSize)}};var AnimationSequencerTweener={14:RSTweener.easeBackOut},RSPlatformAnimationSequencer=RSClass.extend({init:function(a,b,c,d){this._resourcePath=a;this._sequencerFile=b;this._screenObject=c;this._sequenceData=null;this._delegate=d;this._sequenceArray=this._completeAimdata=this._actionDictionary=this._initdictionary=this._currentSequenceCallback=this._currentSequence=null;this._sequenceCounter=0;this._activeSequence=null;this._currentSequenceCounter=0},loadAnimData:function(){RSUtils.loadJsonAsyc(this._resourcePath+ this._sequencerFile,null,this.onDataLoaded.bind(this))},onDataLoaded:function(a){this._sequenceData=a;this._completeAimdata=RSUtils.cloneJSON(a);this._actionDictionary=this._sequenceData.action;this._initdictionary=this._sequenceData.init;this._delegate.onSequencerDataLoaded()},playAnimationAndInit:function(a,b){null!=this._completeAimdata&&(this._activeSequence=a,this._sequenceArray=Object.entries(this._completeAimdata[this._activeSequence]),this._sequenceCounter=this._sequenceArray.length,this.initObjectStates())}, getCompleteAnimData:function(){return this._completeAimdata},playAnimationWithoutInit:function(a,b,c){this._animEndCallback=null;this._animEndCallback=c;null!=this._completeAimdata&&(this._activeSequence=a,this.playAnimation())},playAnimation:function(){this._sequenceArray=Object.entries(this._completeAimdata[this._activeSequence]);this._sequenceCounter=this._sequenceArray.length;var a=null;0<this._sequenceCounter&&(this._currentSequenceCounter=this._sequenceArray.length-this._sequenceCounter,a=this._sequenceArray[this._currentSequenceCounter], cc.log("Current sequence counter....."+this._currentSequenceCounter));this.startAnimationsForSequenceGroup(a[1])},startAnimationsForSequenceGroup:function(a){var b=this,c=0,d=0,e=null,f=!1;Object.keys(a).forEach(function(g){var h=null;"SoundEffect"==g?(f=!0,e=a[g]):(h=b._getObjectWithKey(g))?(d=b._parseAndApplyActionsForSequence(h,a[g]),d>c&&(c=d),cc.log("Current sequence completed"+g)):console.log("Object not found:::"+g)});cc.log("All sequesnce completed");f&&RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("RSCartPopup")+ e,!1);this._screenObject.scheduleFunctionOnce(this.startAnimationsForNextSequenceGroup.bind(this,this._currentSequenceCounter+1),c/60)},startAnimationsForNextSequenceGroup:function(a){var b=null;a<this._sequenceCounter?(this._currentSequenceCounter=a,b=this._sequenceArray[this._currentSequenceCounter],cc.log("Current sequence counter....."+this._currentSequenceCounter),this.startAnimationsForSequenceGroup(b[1])):this._animEndCallback&&this._animEndCallback()},tiggerNextSequenceGroup:function(){}, initObjectStates:function(){var a=this;Object.keys(a._initdictionary).forEach(function(b){var c=a._getObjectWithKey(b);if(c){b=a._initdictionary[b];for(var d=0,e=b.length,d=0;d<e;d++)a._parseAndApplyActions(c,b[d])}})},_getObjectWithKey:function(a){var b=null;return b=/[a-z]*Widget$/.test(a)?RSWidgetsManager.getInstance().getController(a).getView():this._screenObject[a]},parseAndApplyActionsInit:function(){},applyActionOnObject:function(a,b,c,d){var e=c.delay?c.delay:0,f=function(){};if(a||"playEffect"=== b||"RollUp"===b)switch(b){case "scale":f=void 0!==c.xScale?c.xScale:a.getScaleX();b=void 0!==c.yScale?c.yScale:a.getScaleY();f=a.actionScale.bind(a,d,f,b,null);break;case "s":cc.log("duration::"+d);b=a.getScale();b+=c;a.actionScale(d,b,b,null);0>b&&a.setVisible(!1);break;case "hsfo":cc.log("duration::"+d);b=a.getScaleX();a.actionScale(d,b+c,a.getScaleY(),null);break;case "fade":f=a.actionFadeTo.bind(a,d,c.fadeValue,null);break;case "doBlinkAction":f=a.doBlinkAction.bind(a,d,void 0!==c.blinkPerCycle? c.blinkPerCycle:1,void 0!==c.blinkLoopCount?c.blinkLoopCount:1,null);break;case "move":f=a.actionMoveBy.bind(a,d,(void 0!==c.xOffset?c.xOffset:0)*RSEngine.resolutionFactor,(void 0!==c.yOffset?c.yOffset:0)*RSEngine.resolutionFactor,null);break;case "rotate":f=c.count||1;f=a.actionRotateBy.bind(a,d,c.angle||0,f,null);break;case "anchorPoint":f=a.setAnchorPoint.bind(a,c.xAnchor||0.5,c.yAnchor||0.5);break;case "playAnimation":f=a.playAnimation.bind(a,c.loopCount,c.speed,null);break;case "stopAnimation":f= a.stopAnimation.bind(a,null);break;case "an":c?a.playAnimation(1):a.stopAnimation();break;case "visibility":case "v":f=function(){a.setVisible(c)}.bind(this);break;case "a":a.actionFadeTo(0,0,null);break;case "fl":c&&a.flipHorizontally(!0);break;case "playEffect":var g=c.soundFileName,h=c.volume?c.volume:1,k=c.shouldLoop?c.shouldLoop:!1,f=function(){RSEngine.audioManager.playEffectWithVolume(this._resourcePath+g,h,k)}.bind(this);break;case "RollUp":this._delegate.startWinRollup(d,c.rollUpLabelKey, c.rollUpAmountKey);break;case "moveToFro":b=c.minX||0;var m=c.maxX||0,n=c.minY||0,p=c.maxY||0,f=c.count||0,f=a.actionMoveToFro.bind(a,d,b,m,n,p,f,null);break;case "rotateToFro":b=c.maxAngle||0;m=c.minAngle||0;f=c.count||0;f=a.actionRotateToFro.bind(a,d,b,m,f,null);break;case "zoomInOut":b=c.minScale||1;m=c.maxScale||1;f=c.count||0;f=a.actionZoomInOut.bind(a,d,b,m,f,null);break;case "touchState":a.setTouchEnabled(c.state)}0<e?this._screenObject.scheduleFunctionOnce(f,e):f();return e+d},applyInitializeState:function(a, b,c){switch(b){case "visibility":a.setVisible(c);break;case "opacity":a.setOpacity(c);break;case "scale":void 0!==c.xScale&&a.setScaleX(c.xScale);void 0!==c.yScale&&a.setScaleY(c.yScale);break;case "position":void 0!==c.xOffset&&a.moveX(c.xOffset*RSEngine.resolutionFactor);void 0!==c.yOffset&&a.moveY(c.yOffset*RSEngine.resolutionFactor);break;case "anchorPoint":var d=a.getAnchorPoint();b=c.x-d.getX();d=c.y-d.getY();a.setAnchorPoint(c.x,c.y);c=a.getPosition();var e=a.getSize();a.setPosition(c.getX()+ e.getWidth()*b,c.getY()+e.getHeight()*d);break;case "touchState":a.setTouchEnabled(c)}},parseAndApplyProperties:function(a,b){var c=this._getObjectWithKey(a);if(void 0!==c){var d=this;Object.keys(b).forEach(function(a){d.applyInitializeState(c,a,b[a])})}},initializeScreen:function(){var a=this._sequenceData.init,b=this;Object.keys(a).forEach(function(c){b.parseAndApplyProperties(c,a[c])})},_parseAndApplyActions:function(a,b){var c=this,d=this._actionDictionary[b],e=0;Object.keys(d).forEach(function(b){b= c.applyActionOnObject(a,b,d[b],0);b>e&&(e=b)});return e},_parseAndApplyActionsInit:function(a,b,c){var d=this,e=this._actionDictionary[b],f=0,g=c;Object.keys(e).forEach(function(b){g/=60;b=d.applyActionOnObject(a,b,e[b],g);b>f&&(f=b)})},_parseAndApplyActionsForSequenceObject:function(a,b,c){b=this._actionDictionary[b];var d=c/60,e=null,f=null;b.t&&(e=AnimationSequencerTweener[b.t]);b.v&&a.setVisible(b.v);b.s&&(cc.log("duration::"+c),f=a.getScale(),f+=b.s,e?(f=a.actionScale(d,f,f,null),e(f,d)):a.actionScale(d, f,f,null));b.an&&(f=-1,0==b.aniLoop&&(f=1),a.stopAnimation(),a.playAnimation(f,d,null));b.y&&(a.getY(),e?(f=a.actionMoveBy(d,0,2*b.y,null),e(f,d)):a.actionMoveBy(d,0,2*b.y,null));-1==b.a&&a.setOpacity(0);1==b.a&&(a.setOpacity(1),e?(f=a.actionFadeTo(d,255,null),e(f,d)):a.actionFadeTo(d,255,null));b.hsfo&&(cc.log("duration::"+c),f=a.getScaleX(),f+=b.hsfo,e?(f=a.actionScaleTo(d,f,a.getScaleY(),null),e(f,d)):a.actionScale(d,f,a.getScaleY(),null));b.as&&a.activateAnimation(b.as)},_parseAndApplyActionsForSequence:function(a, b){var c=this,d=0;Object.keys(b).forEach(function(e){d=b[e];c._parseAndApplyActionsForSequenceObject(a,e,d)});return d},_initializeCurrentSequence:function(a,b,c){var d=this;Object.keys(c).forEach(function(a){var f=d._getObjectWithKey(a);a=d._parseAndApplyActions(f,c[a]);a>b&&(b=a)});this._screenObject.scheduleFunctionOnce(this._playSubSequenceWithId.bind(this,a+1),b)},_playSubSequenceWithId:function(a){if(a<this._currentSequence.length){var b=this._currentSequence[a],c=b.duration,d=b.animDetails, b=b.delay?b.delay:0;0<b?this._screenObject.scheduleFunctionOnce(this._initializeCurrentSequence.bind(this,a,c,d),b):this._initializeCurrentSequence(a,c,d)}else this._currentSequenceCallback&&this._currentSequenceCallback()},playSequenceWithKey:function(a,b){this._currentSequence=this._sequenceData[a];this._currentSequenceCallback=b;void 0!==this._currentSequence&&this._playSubSequenceWithId(0)}});var EMITTER_PARTICLE={BACKGROUND:200,PARTICLE_TYPE_COUNT:0,FLY_UP:{PARTICLE_COUNT:10,REPEAT:5}},ROLL_UP_DURATION=1.5,RSWelcomeScreen=RSPopup.extend({_screenLayout:null,_callBack:null,_welcomeTextArray:[],_assetConfig:{},_coinShineArray:[],_primaryCurrencyAnimPos:{},_winRollUpStopped:!1,_isCloseTriggered:!1,_notifyToHud:!1,init:function(a,b,c){this._callBack=b;this._font=a;this._assetPath=RSGame.getInstance().getAssetPath("WelcomeBonus");this._super.init.call(this);this._initializeTweeningPanels(); this._coinShineArray=[];(this._continueMusic=void 0!=c||null!=c?c:!1)||RSEngine.audioManager.stopMusic()},loadContent:function(){this.layoutScreen(this._assetPath);this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){this._screenName=b;switch(c.name){case "CurrencyStack":this.removeChild(a);this._addToStackPanel(a);this._currencyStackPos=c;this._stackPanel.setPosition(0,-c.h);break;case "PRCAnim":this.removeChild(a);this._primaryCurrencyAnim=a;this._primaryCurrencyAnimPos=c;a.stopAnimation(); a.setFrame(0);EMITTER_PARTICLE.PARTICLE_TYPE_COUNT+=1;break;case "SCAnim":this.removeChild(a);this._secondaryCurrencyAnim=a;this._secondaryCurrencyAnimPos=c;a.stopAnimation();a.setFrame(0);EMITTER_PARTICLE.PARTICLE_TYPE_COUNT+=1;break;case "PowerUpAnim":this.removeChild(a);this._powerUpAnim=a;this._powerUpAnimPos=c;a.stopAnimation();a.setFrame(0);EMITTER_PARTICLE.PARTICLE_TYPE_COUNT+=1;break;case "BlueRay":this.removeChild(a);this._addToFadingPanel(a);a.setZOrder(-1);break;case "Bar":this.removeChild(a); this._addToFadingPanel(a);break;case "CreditRight":this.removeChild(a);this._addToFadingPanel(a);break;case "CreditLeft":this.removeChild(a),this._addToFadingPanel(a)}},createCustomObject:function(a,b){this._screenName=a;switch(b.type){case "WelcomeText":var c=RSUtils.createAnimation(a,b,1);c.stopAnimation();c.setFrame(0);c.setVisible(!1);c.setScale(3);this._addToFadingPanel(c);this._welcomeTextArray.push(c);break;case "StackParticle":c=RSUtils.createAnimation(a,b,1);c.stopAnimation();c.setFrame(0); this._addToStackPanel(c);c.originalPos=b;this._coinShineArray.push(c);break;case "BonusText":c=RSUtils.createAnimation(a,b,1),c.stopAnimation(),c.setFrame(0),c.setVisible(!1),this._addToFadingPanel(c),this._bonusText=c}switch(b.name){case "PRC_Text":(c=this._font)||(c=RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"));this._primaryCurrencyText=new RSScaledLabel("0",c,b,kTEXT_ALIGNMENT_LEFT);this._primaryCurrencyText.setOpacity(0);this._primaryCurrencyText.setAutoOpacityForChild(!0); this._primaryCurrencyTextPos=b;break;case "SC_Text":(c=this._font)||(c=RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"));this._secondaryCurrencyText=new RSScaledLabel("0",c,b,kTEXT_ALIGNMENT_LEFT);this._secondaryCurrencyText.setOpacity(0);this._secondaryCurrencyText.setAutoOpacityForChild(!0);this._secondaryCurrencyTextPos=b;break;case "PowerUp_Text":(c=this._font)||(c=RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"));this._powerUpText=new RSScaledLabel("0", c,b,kTEXT_ALIGNMENT_LEFT);this._powerUpText.setOpacity(0);this._powerUpText.setAutoOpacityForChild(!0);this._powerUpTextPos=b;break;case "CurrencyPanelPos":this._currencyTweenPanel=new RSDisplayObject(new RSRect(b.x,b.y,b.w,b.h));this._currencyTweenPanel.setAnchorPoint(0.5,0.5);this._currencyTweenPanel.setAutoOpacityForChild(!0);this._addToFadingPanel(this._currencyTweenPanel);break;case "PRC_AnimPos":this._primaryCurrencyAnimPos.x=b.x;this._primaryCurrencyAnimPos.y=b.y;c=Math.sqrt(b.h*b.w/(this._primaryCurrencyAnimPos.h* this._primaryCurrencyAnimPos.w));this._primaryCurrencyAnim.setScale(c);break;case "SC_AnimPos":this._secondaryCurrencyAnimPos.x=b.x;this._secondaryCurrencyAnimPos.y=b.y;c=Math.sqrt(b.h*b.w/(this._secondaryCurrencyAnimPos.h*this._secondaryCurrencyAnimPos.w));this._secondaryCurrencyAnim.setScale(c);break;case "PowerUp_AnimPos":this._powerUpAnimPos.x=b.x;this._powerUpAnimPos.y=b.y;c=Math.sqrt(b.h*b.w/(this._powerUpAnimPos.h*this._powerUpAnimPos.w));this._powerUpAnim.setScale(c);break;case "PRCFlyRect":this._primaryCurrencyFinalFlyUpPos= b;break;case "SCFlyRect":this._secondaryCurrencyFinalFlyUpPos=b;break;case "PowerUpFlyRect":this._powerUpFinalFlyUpPos=b}},onLayoutCompleted:function(){this._playBackgroundSfx();this.scheduleFunctionOnce(function(){this._callBack()}.bind(this),7.3);this._super.onLayoutCompleted.call(this);this._initWelcomeBonusData();this._createBackGroundPanels();this._setElementsToPosition();this._playWelcomeTextTweenAnimation();this._playWelcomeTextSfx()},_initWelcomeBonusData:function(){this._welcomeBonusRewardData= RSGame.getInstance().getGameData().getWelcomeBonusData();this._rewardData={};if(this._welcomeBonusRewardData.length)for(var a=0;a<this._welcomeBonusRewardData.length;a++)switch(this._welcomeBonusRewardData[a].type){case "PRIMARY_CURRENCY":this._primaryCurrencyText&&this._primaryCurrencyText.setString(this._welcomeBonusRewardData[a].value);this._rewardData[GameFeatureTypeEnum.PRIMARY_CURRENCY]=parseInt(this._welcomeBonusRewardData[a].value);break;case "SECONDARY_CURRENCY":this._secondaryCurrencyText&& this._secondaryCurrencyText.setString(this._welcomeBonusRewardData[a].value);"powerups"!==GameFeatureTypeEnum.SECONDARY_CURRENCY.toLocaleLowerCase()&&(this._rewardData[GameFeatureTypeEnum.SECONDARY_CURRENCY]=parseInt(this._welcomeBonusRewardData[a].value));break;case "powerups":var b=this._welcomeBonusRewardData[a].value,c=0,d;for(d in b)c+=b[d];this._powerUpText&&this._powerUpText.setString(c.toString());this._rewardData.powerUps=this._welcomeBonusRewardData[a].value}else this._welcomeBonusRewardData[GameFeatureTypeEnum.PRIMARY_CURRENCY]&& (this._primaryCurrencyText.setString(this._welcomeBonusRewardData[GameFeatureTypeEnum.PRIMARY_CURRENCY]),this._rewardData[GameFeatureTypeEnum.PRIMARY_CURRENCY]=parseInt(this._welcomeBonusRewardData[GameFeatureTypeEnum.PRIMARY_CURRENCY])),this._welcomeBonusRewardData[GameFeatureTypeEnum.SECONDARY_CURRENCY]&&(this._secondaryCurrencyText.setString(this._welcomeBonusRewardData[GameFeatureTypeEnum.SECONDARY_CURRENCY]),"powerups"!==GameFeatureTypeEnum.SECONDARY_CURRENCY.toLocaleLowerCase()&&(this._rewardData[GameFeatureTypeEnum.SECONDARY_CURRENCY]= parseInt(this._welcomeBonusRewardData[GameFeatureTypeEnum.SECONDARY_CURRENCY]))),this._welcomeBonusRewardData.powerups&&(a=this._getTotalPowerupCount(this._welcomeBonusRewardData.powerups),this._powerUpText&&this._powerUpText.setString(""+a),this._rewardData.powerUps=this._welcomeBonusRewardData.powerups);this._saveWelcomeBonusData()},_saveWelcomeBonusData:function(){RSEngine.loginMode===LOGIN_MODE.GUEST?(this._rewardData.hasOwnProperty(GameFeatureTypeEnum.PRIMARY_CURRENCY)&&RSCasinoManager.addPrimaryCurrency(this._rewardData[GameFeatureTypeEnum.PRIMARY_CURRENCY]), GameFeatureTypeEnum.SECONDARY_CURRENCY&&"powerups"!==GameFeatureTypeEnum.SECONDARY_CURRENCY.toLocaleLowerCase()&&this._rewardData.hasOwnProperty(GameFeatureTypeEnum.SECONDARY_CURRENCY)&&RSCasinoManager.addSecondaryCurrency(this._rewardData[GameFeatureTypeEnum.SECONDARY_CURRENCY]),this._rewardData.hasOwnProperty("powerUps")&&(RSGame.getInstance().getUserDataManager().getMe().setPowerUps(this._rewardData.powerUps),RSGame.getInstance().getUserDataManager().getMe().setGuestUserDataForKey("powerUps",this._rewardData.powerUps)), RSGame.getInstance().getUserDataManager().getMe().setWelcomeBonusAwarded(!0)):RSGame.getInstance().getUserDataManager().updateWelcomeBonus(this._rewardData)},_initializeTweeningPanels:function(){this._fadingPanel=new RSDisplayObject(new RSRect(0,0,0,0));this._fadingPanel.setAutoOpacityForChild(!0);this._fadingPanel.setAnchorPoint(0,0);this.addChild(this._fadingPanel);this._stackPanel=new RSDisplayObject(new RSRect(0,0,0,0));this._stackPanel.setAnchorPoint(0,0);this._stackPanel.setAutoOpacityForChild(!0); this._addToFadingPanel(this._stackPanel)},_createBackGroundPanels:function(){this._backGroundPanel=new RSPanel(0,0,RSEngine.screenWidth,RSEngine.screenHeight);this._backGroundPanel.setBackgroundColor(0,0,0,240);this._backGroundPanel.setAnchorPoint(0,0);this.addChild(this._backGroundPanel);this._backGroundPanel.setZOrder(-2);this._tintAfterScreenTransition=new RSLayerGradient(new RSRect(0,-100,RSEngine.screenWidth,100));this._tintAfterScreenTransition.setStartColor(new RSColor(0,0,0));this._tintAfterScreenTransition.setEndColor(new RSColor(0, 0,0));this._tintAfterScreenTransition.setStartOpacity(240);this._tintAfterScreenTransition.setEndOpacity(0);this.addChild(this._tintAfterScreenTransition);this._backGroundPanel.setZOrder(-2);this._tintAfterScreenTransition.setPosition(0,-100)},_setElementsToPosition:function(){this._primaryCurrencyText&&this._primaryCurrencyTextPos&&this._addToCurrencyTweenPanel(this._primaryCurrencyText,this._primaryCurrencyTextPos);this._primaryCurrencyAnim&&this._primaryCurrencyAnimPos&&this._addToCurrencyTweenPanel(this._primaryCurrencyAnim, this._primaryCurrencyAnimPos);this._secondaryCurrencyAnim&&this._secondaryCurrencyAnimPos&&this._addToCurrencyTweenPanel(this._secondaryCurrencyAnim,this._secondaryCurrencyAnimPos);this._secondaryCurrencyText&&this._secondaryCurrencyTextPos&&this._addToCurrencyTweenPanel(this._secondaryCurrencyText,this._secondaryCurrencyTextPos);this._powerUpAnim&&this._powerUpAnimPos&&this._addToCurrencyTweenPanel(this._powerUpAnim,this._powerUpAnimPos);this._powerUpText&&this._powerUpTextPos&&this._addToCurrencyTweenPanel(this._powerUpText, this._powerUpTextPos);this._currencyTweenPanel.setScale(0.3);this._currencyTweenPanel.setVisible(!1)},_addToCurrencyTweenPanel:function(a,b){var c=this._currencyTweenPanel.convertToNodeSpace(b.x,b.y);this._currencyTweenPanel.addChild(a);a.setPosition(c.getX(),c.getY())},_addToFadingPanel:function(a){this._fadingPanel.addChild(a)},_addToStackPanel:function(a){this._stackPanel.addChild(a)},_playWelcomeTextTweenAnimation:function(){0!==this._welcomeTextArray.length?this._startWelcomeText():this._onWelcomeAnimationCompleted()}, _startWelcomeText:function(){this._welcomeTextArray[0].setVisible(!0);this._welcomeTextArray[0].actionZoom(0.04,0.8,this._afterWelcomeTextAnimationStarted.bind(this))},_afterWelcomeTextAnimationStarted:function(){this._welcomeTextArray[0].setFrame(1);this._welcomeTextArray[0].actionZoom(0.04,1.2,this._onWelcomeTextAnimationCompleted.bind(this))},_onWelcomeTextAnimationCompleted:function(){this._welcomeTextArray[0].setFrame(0);this._welcomeTextArray[0].actionZoom(0.04,1);this._welcomeTextArray.splice(0, 1);this._playWelcomeTextTweenAnimation()},_onWelcomeAnimationCompleted:function(){this.scheduleFunctionOnce(this._playBonusAnimation.bind(this),0.3);this._playBackGroundCurrencyAnimation()},_playBonusAnimation:function(){this._bonusText.setVisible(!0);this._zoomOutBousAnimation();this._playBonusSfx()},_zoomOutBousAnimation:function(){this._bonusText.actionZoom(0.02,0.8,this._zoomInBonusAnimation.bind(this))},_zoomInBonusAnimation:function(){this._bonusText.setFrame(1);this._bonusText.actionZoom(0.02, 1.2,this._zoomToOriginalBonusAnimationSize.bind(this))},_zoomToOriginalBonusAnimationSize:function(){this._bonusText.setFrame(0);this._bonusText.actionZoom(0.02,1);this._playCoinSplashSfx()},_onBackGroundCoinAnimationStarted:function(){this._primaryCurrencyText&&this._primaryCurrencyText.actionFadeIn(0.9);this._secondaryCurrencyText&&this._secondaryCurrencyText.actionFadeIn(0.9);this._powerUpText&&this._powerUpText.actionFadeIn(0.9);this._currencyTweenPanel.setVisible(!0);this.startWinRollUp(ROLL_UP_DURATION); this._tweenZoomCoinAndTextPanel();this.scheduleFunction(this._playCoinStackShineAnimation.bind(this),0.7,-1,0);this._stackPanel.actionMoveBy(1,0,this._currencyStackPos.h)},_tweenZoomCoinAndTextPanel:function(){this._currencyTweenPanel.actionZoom(1,1,this._onTweenCoinAndTextPanelCompleted.bind(this))},_onTweenCoinAndTextPanelCompleted:function(){this.scheduleFunction(this._playCoinRotationAnimation.bind(this),2,-1,0)},startWinRollUp:function(a){this._playCoinRollUpSfx();this._powerUpValue=this._secondaryValue= this._primaryValue=0;this._primaryCurrencyText&&this._winRollUpForPrimary(a);this._secondaryCurrencyText&&this._winRollUpForSecondary(a);this._powerUpText&&this._winRollUpForPowerUp(a)},_winRollUpForPrimary:function(a){this.startActionTweenForKey("PrimaryCurrencyRollUp",a,0,this._rewardData[GameFeatureTypeEnum.PRIMARY_CURRENCY])},_winRollUpForSecondary:function(a){this.startActionTweenForKey("SecondaryCurrencyRollUp",a,0,this._rewardData[GameFeatureTypeEnum.SECONDARY_CURRENCY])},_winRollUpForPowerUp:function(a){this.startActionTweenForKey("PowerUpCurrencyRollUp", a,0,this._getTotalPowerupCount(this._rewardData.powerUps))},_getTotalPowerupCount:function(a){var b=0,c;for(c in a)b+=a[c];return b},actionOnUpdate:function(a,b){switch(a){case "PrimaryCurrencyRollUp":this._primaryValue=Math.floor(b);this._primaryCurrencyText.setString(RSUtils.formatNumberWithComma(this._primaryValue));break;case "SecondaryCurrencyRollUp":this._secondaryValue=Math.floor(b);this._secondaryCurrencyText.setString(RSUtils.formatNumberWithComma(this._secondaryValue));break;case "PowerUpCurrencyRollUp":this._powerUpValue= Math.floor(b),this._powerUpText.setString(RSUtils.formatNumberWithComma(this._powerUpValue))}},actionOnComplete:function(a){switch(a){case "PrimaryCurrencyRollUp":this.stopActionTweenForKey(a);this._primaryCurrencyText.setString(RSUtils.formatNumberWithComma(this._primaryValue));break;case "SecondaryCurrencyRollUp":this.stopActionTweenForKey(a);this._secondaryCurrencyText.setString(RSUtils.formatNumberWithComma(this._secondaryValue));break;case "PowerUpCurrencyRollUp":this.stopActionTweenForKey(a), this._powerUpText.setString(RSUtils.formatNumberWithComma(this._powerUpValue))}this._winRollUpStopped||(this._winRollUpStopped=!0,this.stopWinRollUp())},stopWinRollUp:function(){this._onRollUpAnimationCompleted()},_playCoinRotationAnimation:function(){this._primaryCurrencyAnim.playAnimation(1,0.5)},_onRollUpAnimationCompleted:function(){var a=1.5;this._primaryCurrencyFinalFlyUpPos&&(this.scheduleFunction(this._playCurrencyFlyUpAnimation.bind(this,this._primaryCurrencyAnimPos,this._primaryCurrencyFinalFlyUpPos, EMITTER_PARTICLE.FLY_UP.REPEAT),0.2,EMITTER_PARTICLE.FLY_UP.REPEAT,a),a+=0.3);this._secondaryCurrencyFinalFlyUpPos&&(this.scheduleFunction(this._playCurrencyFlyUpAnimation.bind(this,this._secondaryCurrencyAnimPos,this._secondaryCurrencyFinalFlyUpPos,EMITTER_PARTICLE.FLY_UP.REPEAT),0.2,EMITTER_PARTICLE.FLY_UP.REPEAT,a),a+=0.3);this._powerUpFinalFlyUpPos&&this.scheduleFunction(this._playCurrencyFlyUpAnimation.bind(this,this._powerUpAnimPos,this._powerUpFinalFlyUpPos,EMITTER_PARTICLE.FLY_UP.REPEAT), 0.2,EMITTER_PARTICLE.FLY_UP.REPEAT,a);this.scheduleFunctionOnce(this._playCoinRaiseSfx.bind(this),2);this.scheduleFunctionOnce(this._screenTransitionAnimation.bind(this),2.3)},_playCurrencyFlyUpAnimation:function(a,b,c){for(var d=0;d<=EMITTER_PARTICLE.FLY_UP.PARTICLE_COUNT;d++){var e=RSUtils.getRandomInt(0,1.2*RSEngine.screenWidth),f=RSUtils.getRandomInt(-100,50),g=RSUtils.getRandomInt(30,60),g=RSUtils.createAnimation(this._screenName,a,g/100);this.addChild(g);g.setPosition(e,f);new RSPoint(e,f); e=RSUtils.getRandomInt(-(e+500),e+500);f=RSUtils.getRandomInt(RSEngine.screenHeight/2-300,RSEngine.screenHeight/2+300);new RSPoint(e,f);e=new RSPoint(b.x,b.y);f=RSUtils.getRandomInt(20,40);e=g.actionMoveTo(f/100+1,e.getX(),e.getY(),function(a){a.setVisible(!1);a.unload();this._notifyToHud||(this._notifyToHud=!0,RSEngine.loginMode!==LOGIN_MODE.GUEST&&RSCasinoManager.getCasinoHUD().notifyToHud(this._rewardData))}.bind(this));RSTweener.easeSineIn(e);e=g.actionZoom(1.2,0.5);RSTweener.easeSineIn(e);e= RSUtils.getRandomInt(-360,360);g.actionRotateByXYAxis(3,e,e);c!==EMITTER_PARTICLE.FLY_UP.REPEAT||d!==EMITTER_PARTICLE.FLY_UP.PARTICLE_COUNT||this._isCloseTriggered||(this._isCloseTriggered=!0,this.scheduleFunctionOnce(this.closeWelcomeScreen.bind(this),3))}},_screenTransitionAnimation:function(){this._stackPanel.actionFadeOut(0.4,this._afterCoinStackFade.bind(this))},_afterCoinStackFade:function(){this._backGroundPanel.actionMoveBy(0.6,0,RSEngine.screenHeight+100);this._tintAfterScreenTransition.actionMoveBy(0.6, 0,RSEngine.screenHeight+100);this._fadingPanel.actionFadeOut(0.3)},_playCoinStackShineAnimation:function(){var a=RSUtils.getRandomInt(-1,this._coinShineArray.length);0>a&&(a=0);a>this._coinShineArray.length-1&&(a=this._coinShineArray.length-1);this._coinShineArray[a].playAnimation(1,0.5)},_playBackGroundCurrencyAnimation:function(){0!==this._getPrimaryEmitterFrames().length&&this._playCurrencyEmitter(this._getPrimaryEmitterFrames());0!==this._getSecondaryEmitterFrames().length&&this._playCurrencyEmitter(this._getSecondaryEmitterFrames()); 0!==this._getPowerUpEmitterFrames().length&&this._playCurrencyEmitter(this._getPowerUpEmitterFrames());this.scheduleFunctionOnce(this._onBackGroundCoinAnimationStarted.bind(this),1)},_playCurrencyEmitter:function(a){var b=new RSEmitterParticleParams;b._spriteFrames=a;b._spriteAnimationSpeed=0.25;b._spriteAnimationSpeedVariance=0.15;b._origin=new RSPoint(RSEngine.screenWidth/2,RSEngine.screenHeight/2);b._originVariance=new RSPoint(10,10);b._startDelay=1;b._startDelayVariance=0.75;b._displacement=new RSPoint(0, 0);b._displacementVariance=new RSPoint(RSEngine.screenWidth,RSEngine.screenHeight);b._speed=600;b._endScaleVariance=0;b._tweenRate=0.75;b._startScale=0.4;b._scalingDuration=0.3;b._endScale=1;b._360rotationDuration=2;var c=new RSCustomAnimationEmitter(b,!0,RSCustomEmitterType.CLUSTER_MOVEMENT,EMITTER_PARTICLE.BACKGROUND/EMITTER_PARTICLE.PARTICLE_TYPE_COUNT);this.addChild(c);c.loadEmitter();c.setZOrder(-1);c.startEmitter();this.scheduleFunctionOnce(function(){c.stopEmitter()},2)},_getPrimaryEmitterFrames:function(){for(var a= [],b=0;10>b;b++){var c=RSUtils.getTextureData(this._screenName,"PRCAnim/PRCAnim_000"+b+".png");if(c)a.push(c.name);else break}return a},_getSecondaryEmitterFrames:function(){for(var a=[],b=0;10>b;b++){var c=RSUtils.getTextureData(this._screenName,"SCAnim/SCAnim_000"+b+".png");if(c)a.push(c.name);else break}return a},_getPowerUpEmitterFrames:function(){for(var a=[],b=0;10>b;b++){var c=RSUtils.getTextureData(this._screenName,"PowerUpAnim/PowerUpAnim_000"+b+".png");if(c)a.push(c.name);else break}return a}, _playBonusSfx:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("WelcomeBonusSFX")+"Bonus.mp3",!1)},_playCoinRaiseSfx:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("WelcomeBonusSFX")+"CoinsRaiseFinal.mp3",!1)},_playCoinRollUpSfx:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("WelcomeBonusSFX")+"CoinsRollup.mp3",!1)},_playCoinSplashSfx:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("WelcomeBonusSFX")+ "CoinsSplash.mp3",!1)},_playBackgroundSfx:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("WelcomeBonusSFX")+"WB_BGM.mp3",!1)},_playWelcomeTextSfx:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("WelcomeBonusSFX")+"Welcome.mp3",!1)},closeWelcomeScreen:function(){this.closePopup()},unload:function(){this._welcomeTextArray.length=0;this._coinShineArray.length=0;this._super.unload.call(this)}});var MachineOpenPopup=RSPopup.extend({init:function(a,b,c,d,e,f){this._super.init.call(this);RSGame.getInstance().getGameManager().setMachineOpenPopupStatus(!0);RSCasinoManager.getCasinoHUD().disableAllButtons();this._gameType=RSGame.getInstance().getGameManager().getGameType();this._iconType=RSGame.getInstance().getGameManager().getIconType();this._iconType=null==this._iconType?"":this._iconType;this._x=b;this._y=c;this._iconPath=a;this._emitterObject=new RSPanel(0,0,0,0);this._emitterSprites=[]; this._icon=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);RSEventManager.getInstance().addEventListener("on_content_loaded",this,this._onContentLoaded.bind(this));this._contentLoadedCompleted=!1;this._waitForContentResponse=d||!1;this._frameAnimationSpeed=e||0.1;for(var g in f)this[g]=f[g];this._iconLoaded=!1},loadContent:function(){this._super.loadContent.call(this);this.layoutScreen(RSGame.getInstance().getAssetPath("RSMachineOpenPopup"))}, onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);RSGame.getInstance().getGameManager().showOverlayLayer();this._iconLoadTimer=setInterval(this.isImageLoaded.bind(this),500)},flipToPosition:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("RSMachineOpenPopup")+"DoubleWhip.mp3",!1);this._icon.actionMoveTo(0.6,GameConfig.SCREEN_WIDTH/2,GameConfig.SCREEN_HEIGHT/2);var a=this;this._icon.actionScale(0.25,-0.5,0.5,function(){a._icon.actionScale(0.25,1, 1,function(){a.flowFadeIn()})});this._emitterObject.setZOrder(-1);this.addChild(this._emitterObject)},flowFadeIn:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("RSMachineOpenPopup")+"BGShineFX.mp3",!1);this._ray.actionFadeIn(0.5);this._ray1.actionFadeIn(0.5,this.startParticleAnimation.bind(this))},startParticleAnimation:function(){this._gameType==RSGameTypes.TableGames?this.closePopup():(this._frameLight&&this._frameLight.playAnimation(-1,this._frameAnimationSpeed), this._ray1.actionRotateTo(2,60,0),this._ray.actionRotateTo(2,-60,0),this.starFireworkEmitter())},onReveal:function(){this._super.onReveal.call(this)},onObjectCreated:function(a,b,c){switch(c.name){case "RayAntiClockwise":this._ray1=a;this._ray1.setOpacity(0);break;case "RayClockwise":this._ray=a;this._ray.setOpacity(0);break;case (c.name.match(/IconFrame/)||{}).input:this.removeChild(a);c.name==="IconFrame"+this._iconType&&(this._iconFrame=a);break;case (c.name.match(/FrameLightAnim/)||{}).input:this.removeChild(a), c.name==="FrameLightAnim"+this._iconType&&(this._frameLight=a,this._frameLight.stopAnimation())}this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a,b){switch(b.name){case "ImageHolder"+this._iconType:this._imageHolder=new RSImageObject;this._imageHolder.setDelegate(this);this._imageHolder.setImageFromUrl(this._iconPath,b.x,b.y,b.w,b.h);break;case "IconHolder"+this._iconType:this._icon=new RSPanel(b.x,b.y,b.w,b.h)}},onImageLoaded:function(){null!=this._iconType&&"0"===this._iconType&& (this._imageHolder.setScaleX(1),this._imageHolder.setScaleY(1));this._iconLoaded=!0},isImageLoaded:function(){this._iconLoaded&&(clearInterval(this._iconLoadTimer),this._iconLoaded=!1,RSGame.getInstance().getGameManager().hideOverlayLayer(),this.addToIconLayer(this._iconFrame),this.addToIconLayer(this._imageHolder),this._frameLight&&this.addToIconLayer(this._frameLight),this._icon.setPosition(this._x,this._y),this._icon.setVisible(!0),this._icon.setScale(0.2),this.addChild(this._icon),this.flipToPosition())}, starFireworkEmitter:function(){var a=RSGame.getInstance().getAssetPath("MachineOpenPopupParticle");cc.spriteFrameCache.addSpriteFrames(a);a=new RSEmitterParticleParams;if(0<this._emitterSprites.length)for(var b in this._emitterSprites)a._spriteFrames.push(this._emitterSprites[b]);else a._spriteFrames.push("StarEmitter_00/StarEmitter_0000.png");a._startScale=1;a._startScaleVariance=0;a._endScale=0.7;a._endScaleVariance=0.2;a._scalingDuration=1;a._startDelay=0.5;a._startDelayVariance=0.5;a._deviation= 600;a._deviationVariance=200;a._speed=900;a._360rotationDuration=0;a._tweenRate=0.5;a._spriteAnimationSpeed=0.25;a._origin=new RSPoint(RSEngine.screenWidth/2,RSEngine.screenHeight/2);a._originVariance=new RSPoint(0,0);a._displacement=new RSPoint(0,0);a._displacementVariance=new RSPoint(RSEngine.screenWidth/2,RSEngine.screenHeight/2);a._colors=this._colors?this._colors:null;var c=this;b=RSGame.getInstance().getGameManager().getCustomizedParticleCount()?RSGame.getInstance().getGameManager().getCustomizedParticleCount(): 200;this._particleEmitter1=new RSCustomAnimationEmitter(a,!1,RSCustomEmitterType.FIREWORK,b,function(){c._emitterObject.setZOrder(5);c.startStarScatter();c._icon.actionZoom(2,1.1,function(){c._waitForContentResponse?(c._onAnimationsCompleted=!0,c._contentLoadedCompleted?c.closePopup():c._icon.actionZoomInOut(3,0.9,1,-1)):c.closePopup()})});this._emitterObject.addChild(this._particleEmitter1);this._particleEmitter1.loadEmitter();this._particleEmitter1.startEmitter();RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("RSMachineOpenPopup")+ "StarSparkle_01.mp3",!1)},startStarScatter:function(){var a=RSGame.getInstance().getAssetPath("MachineOpenPopupParticle");cc.spriteFrameCache.addSpriteFrames(a);a=new RSEmitterParticleParams;if(this._emitterSprites.length)for(var b in this._emitterSprites)a._spriteFrames.push(this._emitterSprites[b]);else a._spriteFrames.push("StarEmitter_00/StarEmitter_0000.png");a._startScale=0.25;a._startScaleVariance=0;a._endScale=0.5;a._endScaleVariance=0.5;a._scalingDuration=1;a._startDelay=0;a._startDelayVariance= 0.5;a._deviation=80;a._deviationVariance=150;a._speed=500;a._360rotationDuration=1;a._tweenRate=0.5;a._spriteAnimationSpeed=0.4;a._origin=new RSPoint(RSEngine.screenWidth/2,RSEngine.screenHeight/2);a._originVariance=new RSPoint(50,150);a._displacement=new RSPoint(0,0);a._displacementVariance=new RSPoint(RSEngine.screenWidth,RSEngine.screenHeight);a._colors=this._colors?this._colors:null;this._particleEmitter2=new RSCustomAnimationEmitter(a,!1,RSCustomEmitterType.VERTICAL_SNAKE,30,null);this._emitterObject.addChild(this._particleEmitter2); this._particleEmitter2.loadEmitter();this._particleEmitter2.startEmitter();RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("RSMachineOpenPopup")+"FlipSFX2.mp3",!1)},closePopup:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("MachineOpenPopupClose_SFX"),!1);RSGame.getInstance().getGameManager().setMachineOpenPopupStatus(!1);this._super.closePopup.call(this)},addToIconLayer:function(a){if(a){var b=this._icon.convertToNodeSpace(a.getX(),a.getY());a.setCenter(b.getX(), b.getY());this._icon.addChild(a);this._icon.setVisible(!1)}},_onContentLoaded:function(){this._contentLoadedCompleted=!0;this._onAnimationsCompleted&&this.closePopup()},unload:function(){RSEventManager.getInstance().removeListenersForEvent("on_content_loaded");this._iconLoadTimer&&clearInterval(this._iconLoadTimer);RSEngine.externalGameManager.showExternalGame();this._icon.stopAllActions();this._super.unload.call(this)}});var RSPurchaseCancelledFeedBackPopup=RSPopup.extend({_message:null,_messageTextBox:null,_tryAgainBtn:null,_purchaseCancelledFeedBacks:null,_titleFont:null,_subTitleFont:null,_titleColor:null,_toggleButtonStatus:[],_toggleButtonArray:[],_selectedOptionsIndex:[],_selectedOptionsAnalyticsId:[],_packName:null,_callBack:null,init:function(a,b){this._layout=[{name:RSGame.getInstance().getAssetPath("PurchaseCancelledFeedBack"),count:1}];this._purchaseCancelledFeedBacks=RSGame.getInstance().getGameData().getSheetData("purchaseCancelledFeedback"); this._super.init.call(this);this._toggleButtonStatus=[];this._toggleButtonArray=[];this._packName=a;RSAnalyticsManager.getInstance().trackGUIEvent("tell_us_why_popup","trigger","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName()+"|"+this._packName,"");this._callBack=b;this._configureFeedbackPopup()},_configureFeedbackPopup:function(){var a=RSGame.getInstance().getGameManager().getPurchaseFeedbackConfig();this._isEmptyObj(a)?(this._titleFont=RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium", "normal"),this._subTitleFont=RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","normal"),this._titleColor=new RSColor(255,255,255,255)):(this._titleFont=RSGame.getInstance().getGameManager().getDefaultCasinoFont(a.title.size,a.title.type),this._subTitleFont=RSGame.getInstance().getGameManager().getDefaultCasinoFont(a.subtitle.size,a.subtitle.type),this._titleColor=a.title_color)},loadContent:function(){this.layoutScreen(this._layout);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)}, createCustomObject:function(a,b){switch(b.type){case "Label":var c=b.name.split("SubTitle"),c=c[1]-1,c=new RSScaledLabel(this._purchaseCancelledFeedBacks[c].option,this._subTitleFont,b,kTEXT_ALIGNMENT_LEFT);this.addChild(c);break;case "Title":c=RSGame.getInstance().getStringDictionary("PurchaseCancelledFeedBack"),c=new RSScaledLabel(c.T1,this._titleFont,b,kTEXT_ALIGNMENT_CENTER),this._titleColor&&c.setFontColor(this._titleColor.getR(),this._titleColor.getG(),this._titleColor.getB(),this._titleColor.getA()), this.addChild(c)}switch(b.name){case "SubmitBtn":this._submitBtn=RSUtils.createButton(a,b);this.addTouchListenerToButton(this._submitBtn);this.addChild(this._submitBtn);this._submitBtn.setTouchEnabled(!1);break;case "CloseBtn":this._closeBtn=RSUtils.createButton(a,b),this.addTouchListenerToButton(this._closeBtn),this.addChild(this._closeBtn)}return this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){switch(c.type){case "Animation":a.stopAnimation(),a.setFrame(1),a.addTouchListenerWithDelegate(this), this._toggleButtonStatus.push(1),this._toggleButtonArray.push(a)}this._super.onObjectCreated.call(this,a,b,c)},onButtonClicked:function(a){switch(a){case "SubmitBtn":case "CloseBtn":this.triggerAnalyticsEvents(a)}},handleObjectTouchAt:function(a,b,c){a=a._ccObject._name.split("RadioButton")[1]-1;this._toggleButtonStatus[a]=0<this._toggleButtonStatus[a]?0:1;this._toggleButtonArray[a].setFrame(this._toggleButtonStatus[a]);this.updateselectedOptions()},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a, b,c){},updateselectedOptions:function(){var a=0;this._selectedOptionsIndex=[];this._selectedOptionsAnalyticsId=[];for(a in this._toggleButtonStatus)0==this._toggleButtonStatus[a]&&(this._selectedOptionsIndex.push(parseInt(a)+1),this._selectedOptionsAnalyticsId.push(this._purchaseCancelledFeedBacks[parseInt(a)].analytics_id));this._selectedOptionsIndex.length?this._submitBtn.setTouchEnabled(!0):this._submitBtn.setTouchEnabled(!1)},triggerAnalyticsEvents:function(a){a="SubmitBtn"==a?"submit":"close"; var b="{"+this._selectedOptionsIndex+"}",c=!1;"submit"==a?RSAnalyticsManager.getInstance().trackPlayerAction("tell_us_why_popup",a,"open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName()+"|"+this._packName,b,"{"+this._selectedOptionsAnalyticsId+"}"):(RSAnalyticsManager.getInstance().trackPlayerAction("tell_us_why_popup",a,"open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName()+"|"+this._packName,"",""),c=!0);this._callBack&&this._callBack(c);this.closePopup()},_isEmptyObj:function(a){for(var b in a)if(a.hasOwnProperty(b))return!1; return!0}});var RSToasterPopup=RSPopup.extend({_defaultCasinoFont:null,_toasterCloseTimer:null,_message:null,init:function(a,b){this._layout=a;this._message=b;this._defaultCasinoFont=RSGame.getInstance().getGameManager().getDefaultCasinoFontForHeading()?RSGame.getInstance().getGameManager().getDefaultCasinoFontForHeading():RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","normal");this._super.init.call(this);this._configureFeedbackPopup()},loadContent:function(){this.layoutScreen(this._layout); this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._toasterCloseTimer=RSUtils.callFunctionWithDelay(2,this,this.closePopup.bind(this))},_configureFeedbackPopup:function(){var a=RSGame.getInstance().getGameManager().getPurchaseFeedbackConfig();this._isEmptyObj(a)||(this._defaultCasinoFont=a.toasterTitle?RSGame.getInstance().getGameManager().getDefaultCasinoFont(a.toasterTitle.size,a.toasterTitle.type):RSGame.getInstance().getGameManager().getDefaultCasinoFont(a.subtitle.size, a.subtitle.type))},createCustomObject:function(a,b){switch(b.name){case "Title":var c=new RSLabelBMFont(this._message,this._defaultCasinoFont,b.w,kTEXT_ALIGNMENT_CENTER);c.setCenter(b.x,b.y);this.addChild(c)}return this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){switch(c.name){case "CloseBtn":this._closeBtn=a,this._closeBtn.setVisible(!1)}this._super.onObjectCreated.call(this,a,b,c)},closePopup:function(){this._toasterCloseTimer=null;this._super.closePopup.call(this)}, _isEmptyObj:function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}});var RSSmileyPopup=RSPopup.extend({_defaultCasinoFont:null,_title:null,_callBack:null,init:function(a,b,c){this._layout=a;this._title=b;this._callBack=c;this._packName=RSInAppPurchaseManager.getInstance().getCurrentActivePurchasePack().analyticsName;this._defaultCasinoFont=RSGame.getInstance().getGameManager().getDefaultCasinoFontForHeading()?RSGame.getInstance().getGameManager().getDefaultCasinoFontForHeading():RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","normal");RSAnalyticsManager.getInstance().trackGUIEvent("having_trouble", "trigger","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName()+"|"+this._packName,"");this._super.init.call(this)},loadContent:function(){this.layoutScreen(this._layout);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},createCustomObject:function(a,b){switch(b.name){case "Title":var c=new RSScaledLabel(this._title,this._defaultCasinoFont,b,kTEXT_ALIGNMENT_CENTER);c.setCenter(b.x,b.y);this.addChild(c)}return this._super.createCustomObject.call(this, a,b)},_disableAllButtons:function(){for(var a in this._buttonArray)this._buttonArray[a].setTouchEnabled(!1)},onButtonClicked:function(a){this._disableAllButtons();RSAnalyticsManager.getInstance().trackPlayerAction("having_trouble","NoBtn"==a?"yes":"no","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName()+"|"+this._packName,"","");switch(a){case "YesBtn":case "CloseBtn":this.closePopup("Happy");break;case "NoBtn":this.closePopup("Sad")}},closePopup:function(a){this._callBack&&this._callBack(a); this._super.closePopup.call(this)}});var RSPlatformEventTypeKeys={GAME_LAUNCH:"GameLaunch",GAME_ENTER:"GameEnter",GAME_COMPLETE:"GameComplete",GAME_EXIT:"GameExit",ENTER_SCREEN:"EnterScreen",EXIT_SCREEN:"ExitScreen",RETURN_TO_SCREEN:"ReturnToScreen",POPUP_OPEN:"PopupOpen",POPUP_CLOSE:"PopupClose",BONUS_COLLECT:"BonusCollect",EARN_COINS_AD:"ClickToWatchAd",RSPlatformEvent:"RSPlatformEvent",COLLECT_AD_REWARD:"CollectAdReward",ON_BACK_BUTTON_CLICK:"OnBackButtonClick",EARN_COINS_SURVEY:"ClickToWatchSurvey",TOURNAMENT_REWARD:"TournamaniaReward", SUBSCRIPTION:"Subscription",CAROUSAL:"OOCMoment",SWEEPSTAKES:"MainLobby_Launch"},RSPlatformScreenNameKeys={MAIN_LOBBY:"MainLobby",SLOTS_LOBBY:"SlotsLobby",POKER_LOBBY:"PokerLobby",BINGO_LOBBY:"BingoLobby",KENO_LOBBY:"KenoLobby",BLACKJACK_LOBBY:"BlackjackLobby",TOURNAMENT_LOBBY:"TournamentLobby",VIP_LOBBY:"VIPLobby",JACKPOT_LOUNGE:"JackpotLounge",CARD_SELECTION:"CardSelection"},RSPlatformPopupNameKeys={PURCHASE_CART:"PurchaseCart",OOC:"OOC",OOE:"OOC_energy",OOC_COIN:"OOC_coin",LOC:"LOC",LOE:"LOE", SETTINGS:"Settings",APP_INBOX:"AppInbox",BONUS_POPUP:"BonusPopup",DON_2_CHANCE:"DONSecondChance",PURCHASE_DISABLED:"PurchaseDisabled",HOURLY_BONUS:"HourlyBonus",LEVEL_UP:"LevelUp",SALES:"Sales",NPS:"NPS",QUEST:"DailyQuest",PURCHASE_DISABLED_ENERGY:"PurchaseDisabled_energy",PURCHASE_DISABLED_COIN:"PurchaseDisabled_coin",PURCHASE_DISABLED_POWERUP:"PurchaseDisabled_powerup",OOCFirstFlow:"OOCFirstFlow",OOCSaleSubsequentFlow:"SaleSubsequentFlow",OOC_CAROUSEL:"ooc_carousel",OOC_POPUP:"OOCPopup",SWEEPSTAKES_ENTRY_POPUP:"SweepStakesConnectPopup"}, RSPlatformGameTypeKeys={SLOTS:"Slots",POKER:"Poker",BINGO:"Bingo",KENO:"Keno",BLACKJACK:"Blackjack"},RSPlatformBonusTypeKeys={DAILY:"Daily",HOURLY:"Hourly",SCRATCHER:"Scratcher",WHEEL:"Wheel",FB_CONNECT:"FBConnect",WELCOME:"Welcome"},RSPlatformPokerEventTypes={MSP_HAND_LEVEL:"MSPHandLevel"},RSPlatformPokerWinTypes={EVENT_8X_WIN:"EVENT_8X_WIN",EVENT_8X_LOSE:"EVENT_8X_LOSE"},AD_REWARD_STATUS={COMPLETED:"Completed",CANCELLED:"Cancelled",EXCEPTION:"Exception"},RSPlatformGameActions={SlotSpin:"SlotSpin", PokerHand:"PokerHand",BingoRound:"BingoRound",BlackjackHand:"BlackjackHand",KenoDraw:"KenoDraw"},RSPLATFORM_SURVEY_PLACEMENTS={GIFT_WATCH:"GiftCenter",GIFT_WATCH_MAINLOBBY:"MainlobbyWatchSurvey"},RSPLATFORM_SUBSCRIPTION_PLACEMENTS={SUBSCRIPTION_BEFORE_NPS:"SubscriptionBeforeNps",SUBSCRIPTION_AFTER_NPS:"SubscriptionAfterNps"},RSPLATFORM_SWEEPSTAKES_POPUP_PLACEMENTS={SWEEPSTAKE_ENTRY:"SweepStakesConnectPopup"},RSAdsPopupConfig={TITLE:{size:"large",type:"bold"},SUBTITLE:{size:"large",type:"bold"},REWARDTYPE1:{size:"large", type:"bold"},REWARDTYPE2:{size:"large",type:"bold"},REWARDTYPE1_ALIGN:kTEXT_ALIGNMENT_CENTER,REWARDTYPE2_ALIGN:kTEXT_ALIGNMENT_CENTER,TITLE_COLOR:{r:255,g:255,b:255},TIMER:{size:"large",type:"bold"},TIMER_ALIGN:kTEXT_ALIGNMENT_CENTER},RSPlatformEventManagerV2=RSClass.extend({_eventListFromServer:{},_currentActionObject:{event:"",parameter:""},_currentActionEvent:null,_triggeredEventList:[],_coolDownTimeEndAt:0,_userEventStatus:null,_currentAdType:"",_rewardedAdCapCount:0,_rewardedAdsForTheDay:0,_currentAdWatchCount:0, _onUserEventStatusCompleted:null,_rewardedSurveyCapCount:0,_rewardedSurveyForTheDay:0,_eventPlacementName:null,_userEventsLoaded:!1,_allEventsLoaded:!1,_youtubeLinks:null,init:function(){this._super.init.call(this)},initializePlatformEventsManager:function(a){this._allEventsLoaded=this._userEventsLoaded=!1;this._onUserEventStatusCompleted=a;this._addListeners();this._getUserEventStatus();this._getAllUserEventsFormServer()},_getAllUserEventsFormServer:function(a){RSGame.getInstance().getUserDataManager().getEventStatusFromDashBoard("getAllUserEvents", null,null,this._onAllUserEventResponseFromDashBoard.bind(this),this._onAllUserEventResponseFromDashBoardFailed.bind(this))},_onAllUserEventResponseFromDashBoard:function(a){this._allEventsLoaded=!0;this._eventListFromServer=a;this._allEventsLoaded&&this._userEventsLoaded&&this._onUserEventStatusCompleted&&this._onUserEventStatusCompleted();cc.log("On succes")},_onAllUserEventResponseFromDashBoardFailed:function(){cc.log("Failed")},_addListeners:function(){RSEventManager.getInstance().removeEventListenersIn(this); RSEventManager.getInstance().addEventListener(RSPlatformEventTypeKeys.RSPlatformEvent,this,this.onPlatFormEvent.bind(this));RSEventManager.getInstance().addEventListener(RSPlatformEventTypeKeys.ENTER_SCREEN,this,this.onScreenEnter.bind(this));RSEventManager.getInstance().addEventListener(RSPlatformEventTypeKeys.EXIT_SCREEN,this,this.onScreenExit.bind(this));RSEventManager.getInstance().addEventListener(RSPlatformEventTypeKeys.GAME_ENTER,this,this.onMachineEnter.bind(this));RSEventManager.getInstance().addEventListener(RSPlatformEventTypeKeys.GAME_EXIT, this,this.onMachineExit.bind(this));RSEventManager.getInstance().addEventListener(RSPlatformEventTypeKeys.POPUP_OPEN,this,this.onPopupOpen.bind(this));RSEventManager.getInstance().addEventListener(RSPlatformEventTypeKeys.POPUP_CLOSE,this,this.onPopupClose.bind(this));RSEventManager.getInstance().addEventListener(RSPlatformEventTypeKeys.RETURN_TO_SCREEN,this,this.onReturnToScreen.bind(this));RSEventManager.getInstance().addEventListener(RSPlatformEventTypeKeys.BONUS_COLLECT,this,this.onBonusCollect.bind(this)); RSEventManager.getInstance().addEventListener(RSPlatformEventTypeKeys.COLLECT_AD_REWARD,this,this._collectAdReward.bind(this));RSEventManager.getInstance().addEventListener(RSPlatformEventTypeKeys.ON_BACK_BUTTON_CLICK,this,this._clearUpdatedCountForTriggerCondition.bind(this))},getName:function(){return"RSPlatformEventManager"},_getUserEventStatus:function(){RSGame.getInstance().getUserDataManager().getEventStatusFromDashBoard("getUserEventStatus",null,null,this._onUserEventStatusFromDashBoard.bind(this), this.__onUserEventStatusFromDashBoardFailed.bind(this))},_onUserEventStatusFromDashBoard:function(a){this._userEventsLoaded=!0;if(this._userEventStatus=a)a.rewardedVideoCapInhouseAds&&(this._rewardedAdCapCount=a.rewardedVideoCapInhouseAds),a.rewardedVideoCapSurvey&&(this._rewardedSurveyCapCount=a.rewardedVideoCapSurvey),a.youtubeLinks&&(this._youtubeLinks=a.youtubeLinks);this._setRewardedDayCapForTheDay();this.setDayCapForPlatformEvents();this._allEventsLoaded&&this._userEventsLoaded&&this._onUserEventStatusCompleted&& this._onUserEventStatusCompleted()},__onUserEventStatusFromDashBoardFailed:function(){},getRandomYoutubeLink:function(){return 0<this._youtubeLinks.length?this._youtubeLinks[Math.abs(RSUtils.getRandomInt(0,this._youtubeLinks.length-1))]:!1},getUserEventStatus:function(){return this._userEventStatus},getRewardedSurveyCapCount:function(){return this._rewardedSurveyCapCount},getRewardedSurveyForTheDay:function(){return this._rewardedSurveyForTheDay},getRewardedAdCapCapCount:function(){return this._rewardedAdCapCount}, getRewardedAdsForTheDay:function(){return this._rewardedAdsForTheDay},onPlatFormEvent:function(a){cc.log("ON Platform Event");this.triggerEventToServer(a._userData.event,a._userData.parameter)},onScreenEnter:function(a){cc.log("onScreenEnter:"+a._userData);this.triggerEventToServer(RSPlatformEventTypeKeys.ENTER_SCREEN,a._userData)},onScreenExit:function(a){cc.log("onScreenExit:"+a._userData);this.triggerEventToServer(RSPlatformEventTypeKeys.EXIT_SCREEN,a._userData)},onMachineEnter:function(a){cc.log("onMachineEnter"); this.triggerEventToServer(RSPlatformEventTypeKeys.GAME_ENTER,a._userData)},onMachineExit:function(a){cc.log("onMachineExit");this.triggerEventToServer(RSPlatformEventTypeKeys.GAME_EXIT,a._userData)},onPopupOpen:function(a){cc.log("onPopupOpen:"+a._userData);this.triggerEventToServer(RSPlatformEventTypeKeys.POPUP_OPEN,a._userData)},onPopupClose:function(a){cc.log("onPopupClose");this.triggerEventToServer(RSPlatformEventTypeKeys.POPUP_CLOSE,a._userData)},onReturnToScreen:function(){cc.log("onReturnToScreen")}, onBonusCollect:function(a){cc.log("On Bonus collect");this.triggerEventToServer(RSPlatformEventTypeKeys.BONUS_COLLECT,a._userData)},triggerEventToServer:function(a,b){this._currentActionObject.event=a;this._currentActionObject.parameter=b;this._currentActionEvent=null;this.checkForEventInEventList(a,b)?this._currentActionEvent?(cc.log("Existing event performing action"),this.performAction(this._currentActionEvent)):cc.log("Event Already exist"):(cc.log("Triggering event to server"),this._triggeredEventList.push(RSUtils.cloneJSON(this._currentActionObject)), RSGame.getInstance().getUserDataManager().getEventStatusFromDashBoard("triggerEvent",a,b,this.onEventResponseFromDashBoard.bind(this),this.onEventResponseFromDashBoardFailed.bind(this)))},onEventResponseFromDashBoard:function(a){},onEventResponseFromDashBoardFailed:function(){},checkForEventInEventList:function(a,b){if(a&&b&&this._eventListFromServer.hasOwnProperty(a)){var c=0,d={},d=[],e=0,f=0,g=!1,h=null;for(c in this._eventListFromServer)if(c==a&&(d=this._eventListFromServer[c],d.hasOwnProperty(b)))for(e in d= d[b],d)if(e=parseInt(e),d[e].triggerEvent==b){if(h=d[e].triggerCondition){if(h.conditionSatisfiedCount=h.conditionSatisfiedCount?h.conditionSatisfiedCount:0,0==e||f>h.conditionSatisfiedCount)this._currentActionEvent=d[e],f=h.conditionSatisfiedCount}else this._currentActionEvent=d[e];g=!0}return g}return this._checkForEventInTriggeredEventList()},getEventDataFromEventList:function(a,b){if(a&&b&&this._eventListFromServer.hasOwnProperty(a)){var c=0,d={},d=[],e=0,f=0,g=null,h=null;for(c in this._eventListFromServer)if(c== a&&(d=this._eventListFromServer[c],d.hasOwnProperty(b)))for(e in d=d[b],d)if(e=parseInt(e),d[e].triggerEvent==b)if(h=d[e].triggerCondition){if(h.conditionSatisfiedCount=h.conditionSatisfiedCount?h.conditionSatisfiedCount:0,0==e||f>h.conditionSatisfiedCount)g=d[e],f=h.conditionSatisfiedCount}else g=d[e];return g}return null},_checkForEventInTriggeredEventList:function(){var a=0;if(this._triggeredEventList.length)for(a in this._triggeredEventList)if(this._triggeredEventList[a].event==this._currentActionObject.event&& this._triggeredEventList[a].parameter==this._currentActionObject.parameter)return!0;return!1},performAction:function(a){if("quest_ad"==a.triggerAction.action)cc.log("skipping limit checking in the case of quest ad");else if("survey"==a.triggerAction.action)this._rewardedSurveyCapCount>this._rewardedSurveyForTheDay||cc.log("Limit reached for survey..");else if("House Ad"==a.triggerAction.action){var b=!1;if(this._rewardedAdCapCount<=this._rewardedAdsForTheDay||this._coolDownTimeEndAt>TimeManager.getInstance().currentServerTime){RSEventManager.getInstance().dispatchEvent("onEventDayCapReached", {placementName:a.triggerAction.analyticsName});cc.log("Day cap reached or in cool down time");return}b=this._checkForTriggerCondition(a.triggerCondition)?this._checkForActionValidity(a):!1;if(!b)return;cc.log("Perform action")}switch(a.triggerAction.perform){case "show":cc.log("SHOWING AD OF :"+a.triggerEvent);this._eventPlacementName=a.triggerEvent;this._performShowActions(a.triggerAction);break;case "SALE":cc.log("SHOWING Carousal OF :"+a.triggerEvent);this._performShowActions(a.triggerAction); break;default:cc.log("Untracked action")}},getEventActionName:function(){return this._currentActionEvent.triggerAction.action},_performShowActions:function(a){switch(a.action){case "reward video ad":parseInt(a.pre_info_status)?RSEngine.popupManager.addPopup(new RSAdPopup("prompt",a.rewards,a.analyticsName,this._responseFromAdPromptPopup.bind(this),RSAdsPopupConfig,a.actionLifeTime),!1):this._checkAndTriggerAdPopup("rewarded",a.analyticsName,a.rewards.coin);break;case "interstitial ad":this._checkAndTriggerAdPopup("interstitial", a.analyticsName);break;case "quest_ad":this._checkAndTriggerAdPopup("interstitial",a.analyticsName,0,!0);break;case "survey":RSAnalyticsManager.getInstance().trackVideoBonusEvent("survey","rewarded","click",a.analyticsName,"pollfish");RSPollFishManager.showPollFishSurvey(a);break;case "House Ad":parseInt(a.pre_info_status)?RSEngine.popupManager.addPopup(new RSAdPopup("prompt",a.rewards,a.analyticsName,this._responseFromAdPromptPopup.bind(this),RSAdsPopupConfig,a.actionLifeTime,"house_ads_youtube"), !1):RSEngine.popupManager.addPopup(new RSInHouseVideoPopup(a.analyticsName),!0);break;case "ooc_carousel":case "sale":PurchaseFlowManager.getInstance().setShowPurchaseCart(!1),RSSaleManager.getInstance().showSalePopupWithTag("ooc_carousel",!0)}},_checkAndTriggerAdPopup:function(a,b,c,d){VideoManager.getInstance().getAdBlockerStatus()?(d&&RSEventManager.getInstance().dispatchEvent("videoNotAvailable"),showCrossLinkBlockerMessage()):(this._currentAdType=a,VideoManager.getInstance().showAd(a,b,c,d))}, _checkForActionValidity:function(a){cc.log("Checking action validity");var b=!0,c=parseInt(a.triggerAction.repeatCountPerDay),d=parseInt(a.triggerAction.repeatCountPerSession);if(0<c||0<d){var e=this._currentActionObject.event+"_"+this._currentActionObject.parameter,f=RSGame.getInstance().getUserDataManager().getMe().getVideoWatchCount("HouseAd");this._currentAdWatchCount=0;if(f){f=f.split("_");this._currentAdWatchCount=parseInt(f[1]);var g=new Date(1E3*parseInt(f[0])),f=new Date,g=g.getDay(),f=f.getDay(); g!=f&&(this._currentAdWatchCount=0)}cc.log("Repeat count per day :"+this._currentAdWatchCount);f=a.triggerAction.repeatedCountPerSession?parseInt(a.triggerAction.repeatedCountPerSession):parseInt(a.triggerAction.repeatedCountPerSession=0);c<=this._currentAdWatchCount?(b=!1,cc.log("MAX LIMIT REACHED : Event day cap reached"),RSEventManager.getInstance().dispatchEvent("onEventDayCapReached",{placementName:a.triggerAction.analyticsName})):0<d&&d<f?(b=!1,RSEventManager.getInstance().dispatchEvent("onEventSessionCapReached"), cc.log("MAX LIMIT REACHED : Event session cap reached")):(a.triggerAction.repeatedCountPerSession=f++,this._currentActionObject.event==RSPlatformEventTypeKeys.SUBSCRIPTION&&RSGame.getInstance().getUserDataManager().getMe().setSessionCountOfEvent(e,this._currentAdWatchCount+1))}return b},_checkForTriggerCondition:function(a){cc.log("Checking trigger conditions");var b=!1;if(a)switch(cc.log("updating trigger count"),a.updatedCount=a.updatedCount?parseInt(a.updatedCount)+1:1,cc.log("Current Condition count:"+ a.updatedCount),a.condition){case "isEqualTo":a.updatedCount==parseInt(a.count)&&(b=!0,cc.log("Condition satisfied: Resetting to default value"),a.updatedCount=0);break;case "isGreaterThan":a.updatedCount>parseInt(a.count)&&(b=!0,cc.log("Condition satisfied: Resetting to default value"),a.updatedCount=0)}else cc.log("Condition satisfied"),b=!0;return b},clearEvent:function(){RSUtils.removeLocalStorageItem(this._currentActionObject.event+"_"+this._currentActionObject.parameter)},resetMachinesTriggerConditionCount:function(){}, _setRewardedDayCapForTheDay:function(){var a=RSGame.getInstance().getUserDataManager().getMe().getVideoWatchCount("HouseAd");this._rewardedAdsForTheDay=parseInt(a.split("_")[1]);var b=new Date(1E3*parseInt(a.split("_")[0])),c=new Date,d=b.getDay(),a=c.getDay(),b=(c.getTime()-b.getTime())/1E3;if(d!=a||172800<b)RSGame.getInstance().getUserDataManager().getMe().setVideoWatchCount(0,"","HouseAd"),this._rewardedAdsForTheDay=0;GameConfig.POLLFISH_ENABLED&&(d=RSGame.getInstance().getUserDataManager().getMe().getSurveyCompletedCount(), this._rewardedSurveyForTheDay=parseInt(d.split("_")[1]),d=(new Date(parseInt(d.split("_")[0]))).getUTCDate(),d!=a&&(RSGame.getInstance().getUserDataManager().getMe().setSurveyCompletedCount(0),this._rewardedSurveyForTheDay=0))},setDayCapForPlatformEvents:function(){var a=new Date(1E3*RSGame.getInstance().getUserDataManager().getMe().getEventInitializationTime()),b=new Date,c=a.getDay(),d=b.getDay(),a=(b.getTime()-a.getTime())/1E3;(c!=d||172800<a)&&RSGame.getInstance().getUserDataManager().getMe().resetPlatformEventCounter()}, _responseFromAdPromptPopup:function(a){cc.log("response"+a);switch(a){case "watch":this._checkAndTriggerAdPopup("rewarded",this._currentActionEvent.triggerAction.analyticsName,this._currentActionEvent.triggerAction.rewards.coin);break;case "watch_houseAd":RSEngine.popupManager.addPopup(new RSInHouseVideoPopup(this._currentActionEvent.triggerAction.analyticsName),!0);RSAnalyticsManager.getInstance().trackVideoBonusEvent("ad","rewarded","click",this._currentActionEvent.triggerEvent?this._currentActionEvent.triggerEvent: "","house_ads_youtube");break;case "collect":RSEventManager.getInstance().dispatchEvent("onRewardCollected");break;case "close":RSEventManager.getInstance().dispatchEvent("adPopupClose")}},_collectAdReward:function(a){switch(a._userData){case AD_REWARD_STATUS.COMPLETED:"rewarded"!=this._currentAdType&&"survey"!=this._currentActionEvent.triggerAction.action&&"House Ad"!=this._currentActionEvent.triggerAction.action||RSEngine.popupManager.addPopup(new RSAdPopup("reward",this._currentActionEvent.triggerAction.rewards, this._currentActionEvent.triggerAction.analyticsName,this._responseFromAdPromptPopup.bind(this),RSAdsPopupConfig,null),!0);"survey"==this._currentActionEvent.triggerAction.action?(this._rewardedSurveyForTheDay++,RSGame.getInstance().getUserDataManager().getMe().setSurveyCompletedCount(this._rewardedSurveyForTheDay),a=!1,this._rewardedSurveyForTheDay<this._rewardedSurveyCapCount&&(a=!0),this._currentActionEvent.triggerEvent==RSPLATFORM_SURVEY_PLACEMENTS.GIFT_WATCH&&RSEventManager.getInstance().dispatchEvent(RSGiftingEvents.GIFT_CALIM_REFRESH, a)):(this._currentAdWatchCount++,this._rewardedAdsForTheDay++,this._currentActionEvent.triggerCondition?this._currentActionEvent.triggerCondition.conditionSatisfiedCount++:"",RSGame.getInstance().getUserDataManager().getMe().setVideoWatchCount(this._rewardedAdsForTheDay,this._currentActionObject.parameter,"HouseAd"),this._coolDownTimeEndAt=this._currentActionEvent.triggerAction.cooldownTime?TimeManager.getInstance().currentServerTime+parseInt(this._currentActionEvent.triggerAction.cooldownTime):0); break;case AD_REWARD_STATUS.CANCELLED:cc.log("Ad Cancelled");break;case AD_REWARD_STATUS.EXCEPTION:RSEventManager.getInstance().dispatchEvent("videoNotAvailable"),cc.log("Exception occured")}},_clearUpdatedCountForTriggerCondition:function(){cc.log("On Back Button pressed");if(0<Object.keys(this._eventListFromServer).length){var a=0,b={},b=[],c=0;for(a in this._eventListFromServer)if(b=this._eventListFromServer[a],a==RSPlatformGameActions.SlotSpin||a==RSPlatformGameActions.BingoRound||a==RSPlatformGameActions.BlackjackHand|| a==RSPlatformGameActions.PokerHand||a==RSPlatformGameActions.KenoDraw)for(c in cc.log(" key name : "+Object.keys(b)[0]),b=b[Object.keys(b)[0]],b)b[c].triggerCondition&&b[c].triggerCondition.updatedCount&&(b[c].triggerCondition.updatedCount=0,b[c].triggerCondition.conditionSatisfiedCount=0);cc.log("data")}},getEventDataForParameter:function(a,b){if(this._eventListFromServer.hasOwnProperty(a)){var c=this._eventListFromServer[a],d=0,e=null;for(d in c)if(d==b)return e=c[d]}return null},getEventDataActiveStatus:function(a, b){if(this._eventListFromServer.hasOwnProperty(a)){var c=this._eventListFromServer[a],d=0,e=null;for(d in c)if(d==b){e=c[d];if(e[0].triggerAction){var c=!0,d=e[0].triggerAction.repeatCountPerDay,f=e[0].triggerAction.repeatCountPerSession,g=0;if(0<d||0<f){var g=a+"_"+b,h=RSGame.getInstance().getUserDataManager().getMe().getSessionCountOfEvent(g),g=0;if(h){var h=h.split("_"),g=h[1],h=(new Date(parseInt(h[0]))).getUTCDate(),k=(new Date(1E3*TimeManager.getInstance().currentServerTime)).getUTCDate();h!= k&&(g=0)}e=e[0].triggerAction.repeatedCountPerSession?parseInt(e[0].triggerAction.repeatedCountPerSession):e[0].triggerAction.repeatedCountPerSession=0;d<=g?(c=!1,cc.log("MAX LIMIT REACHED : Event day cap reached")):0<f&&f<e&&(c=!1,cc.log("MAX LIMIT REACHED : Event session cap reached"))}return c}break}}return null},getPlatformEventDispatchAndStatus:function(a,b,c,d,e){a=RSGame.getInstance().getPlatformEventManager().getEventDataActiveStatus(a,b);b=RSGame.getInstance().getPlatformEventManager().getEventDataForParameter(c, d);if(b[0]){b=b[0].triggerAction.repeatCountPerDay;var f=RSGame.getInstance().getUserDataManager().getMe().getPlatformEventCounter(c+"_"+d);if(a&&f<b)return RSEventManager.getInstance().dispatchEvent(e,{event:c,parameter:d}),!0}return!1}});var RSAdPopup=RSGenericPopup.extend({init:function(a,b,c,d,e,f,g){this._countDown=f?parseInt(f):null;this._assetList=[{name:RSGame.getInstance().getAssetPath("RSShowAdConfirmationPopup"),count:1}];f=new RSRect(0,0,0,0);this._displayPanel=new RSDisplayObject(f);"UP"==GameConfig.GAME_ID?(f="prompt"==a?{font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("largeGreen","black")}:{font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("largeOrange","black")},this._super.init.call(this, null,f)):this._super.init.call(this);this._type=a;this._callBack=d;this._rewards=b;this._placementName=c;this._adNetwork=g?g:"lifeStreet";a=RSGame.getInstance().getGameManager().getAdPopupFonts();this._isEmptyObj(a)?this._customizeConfig=e:this._customizeConfig=a},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.addChild(this._displayPanel);this._setPopupElements();"prompt"==this._type&& RSAnalyticsManager.getInstance().trackVideoBonusEvent("popup","rewarded","open",this._placementName,this._adNetwork)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CloseBtn":this._closeButton=a;break;case "RewardIcon1":this._coinIcon=a;this._coinIcon.setVisible(!1);break;case "RewardIcon2":this._xpIcon=a;this._xpIcon.setVisible(!1);break;case "RewardIcon3":this._coinIcon2=a;this._coinIcon2.setVisible(!1);break;case "RewardIcon4":this._xpIcon2=a; this._xpIcon2.setVisible(!1);break;case "CombinationRewardBgBg":this._doubleBox=a;this._doubleBox.setVisible(!1);break;case "SingleRewardBg":this._singleBox=a,this._singleBox.setVisible(!0)}switch(c.type){case "CP_Button_T1":this._watchAdBtn=a;this._watchAdBtn.setVisible(!1);break;case "CP_Button_T2":this._collectBtn=a,this._collectBtnData=c,this._collectBtn.setVisible(!1)}},createCustomObject:function(a,b){switch(b.name){case "Title":var c="prompt"==this._type?RSGame.getInstance().getStringDictionary("RSShowAdConfirmationPopup").H1: RSGame.getInstance().getStringDictionary("RSShowAdConfirmationPopup").H2,d=RSGame.getInstance().getGameManager().getDefaultCasinoFont(this._customizeConfig.TITLE.size,this._customizeConfig.TITLE.type);"UP"==GameConfig.GAME_ID&&(d=RSGame.getInstance().getGameManager().getDefaultCasinoFont("largeRed","black"));c=new RSScaledLabel(c,d,b,kTEXT_ALIGNMENT_CENTER);this.addChild(c);c.setFontColor(this._customizeConfig.TITLE_COLOR.r,this._customizeConfig.TITLE_COLOR.g,this._customizeConfig.TITLE_COLOR.b,this._customizeConfig.TITLE_COLOR.a); break;case "SubTitle":c="prompt"==this._type?RSGame.getInstance().getStringDictionary("RSShowAdConfirmationPopup").H3:RSGame.getInstance().getStringDictionary("RSShowAdConfirmationPopup").H4;c=new RSScaledLabel(c,RSGame.getInstance().getGameManager().getDefaultCasinoFont(this._customizeConfig.SUBTITLE.size,this._customizeConfig.SUBTITLE.type),b,kTEXT_ALIGNMENT_CENTER);this.addChild(c);break;case "RewardType1":null!=RSGame.getInstance().getGameManager().getVideoRewardPopupFont()?this._rewardCoinValueTextFont= RSGame.getInstance().getGameManager().getVideoRewardPopupFont():this._rewardCoinValueTextFont=RSGame.getInstance().getGameManager().getDefaultCasinoFont(this._customizeConfig.REWARDTYPE1.size,this._customizeConfig.REWARDTYPE1.type);this._rewardCoinValueText=new RSScaledLabel("",this._rewardCoinValueTextFont,b,this._customizeConfig.REWARDTYPE1_ALIGN);this.addChild(this._rewardCoinValueText);break;case "RewardType2":null!=RSGame.getInstance().getGameManager().getVideoRewardPopupFont()?this._rewardXpValueTextFont= RSGame.getInstance().getGameManager().getVideoRewardPopupFont():this._rewardXpValueTextFont=RSGame.getInstance().getGameManager().getDefaultCasinoFont(this._customizeConfig.REWARDTYPE2.size,this._customizeConfig.REWARDTYPE2.type);this._rewardXpValueText=new RSScaledLabel("",this._rewardXpValueTextFont,b,this._customizeConfig.REWARDTYPE2_ALIGN);this.addChild(this._rewardXpValueText);break;case "RewardType3":null!=RSGame.getInstance().getGameManager().getVideoRewardPopupFont()?this._rewardCoinValue2Font= RSGame.getInstance().getGameManager().getVideoRewardPopupFont():this._rewardCoinValue2Font=RSGame.getInstance().getGameManager().getDefaultCasinoFont(this._customizeConfig.REWARDTYPE1.size,this._customizeConfig.REWARDTYPE1.type);this._rewardCoinValue2=new RSScaledLabel("",this._rewardCoinValue2Font,b,this._customizeConfig.REWARDTYPE2_ALIGN);this.addChild(this._rewardCoinValue2);break;case "RewardType4":null!=RSGame.getInstance().getGameManager().getVideoRewardPopupFont()?this._rewardXpValue2Font= RSGame.getInstance().getGameManager().getVideoRewardPopupFont():this._rewardXpValue2Font=RSGame.getInstance().getGameManager().getDefaultCasinoFont(this._customizeConfig.REWARDTYPE2.size,this._customizeConfig.REWARDTYPE2.type);this._rewardXpValue2=new RSScaledLabel("",this._rewardXpValue2Font,b,this._customizeConfig.REWARDTYPE2_ALIGN);this.addChild(this._rewardXpValue2);break;case "Timer":this._countDownTxt=new RSScaledLabel("",RSGame.getInstance().getGameManager().getDefaultCasinoFont(this._customizeConfig.TIMER.size, this._customizeConfig.TIMER.type),b,this._customizeConfig.TIMER_ALIGN),this.addChild(this._countDownTxt)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":this._closeButton.setTouchEnabled(!1);"prompt"==this._type?(RSAnalyticsManager.getInstance().trackVideoBonusEvent("popup","rewarded","close",this._placementName,this._adNetwork),this.closePopup("close")):this._collectReward();break;case "CP_Button_T1":a="watch";this._adNetwork.includes("house_ads_youtube")&& (a="watch_houseAd");this.closePopup(a);break;case "CP_Button_T2":this._collectReward()}},_setPopupElements:function(){this._countDownTxt&&this._countDown&&(this._countDownTxt.setString("TIME LEFT : "+RSUtils.formattedTime(--this._countDown,!0,!0)),this._timer=setInterval(this._startCountDown.bind(this),1E3));if(this._doubleBox&&this._coinIcon2&&this._xpIcon2&&this._singleBox&&this._rewardCoinValue2&&this._rewardXpValue2&&this._rewards.coin&&this._rewards.Xp)this._doubleBox.setVisible(!0),this._singleBox.setVisible(!1), this._coinIcon2.setVisible(!0),this._xpIcon2.setVisible(!0),this._rewardCoinValue2.setString(RSUtils.formatNumber(this._rewards.coin)),this._rewardXpValue2.setString(RSUtils.formatNumber(this._rewards.Xp));else if(this._rewards.coin)this._coinIcon.setVisible(!0),this._rewardCoinValueText.setString(RSUtils.formatNumber(this._rewards.coin));else if(this._rewards.energy)this._coinIcon2.setVisible(!0),this._rewardCoinValue2.setString(RSUtils.formatNumber(this._rewards.energy));else if(this._rewards.powerups){var a= 0,b=JSON.parse(this._rewards.powerups),c;for(c in b)a+=parseInt(b[c]);this._xpIcon.setVisible(!0);this._rewardXpValueText.setString(RSUtils.formatNumber(a))}else this._rewards.Xp&&(this._xpIcon.setVisible(!0),this._rewardXpValueText.setString(RSUtils.formatNumber(this._rewards.Xp)));"prompt"==this._type?this._watchAdBtn.setVisible(!0):this._collectBtn.setVisible(!0)},_startCountDown:function(){0<this._countDown?this._countDownTxt.setString("TIME LEFT : "+RSUtils.formattedTime(--this._countDown,!0, !0)):(this._closeButton.setTouchEnabled(!1),RSAnalyticsManager.getInstance().trackVideoBonusEvent("popup","rewarded","timeout",this._placementName,this._adNetwork),this.closePopup("close"))},_collectReward:function(){var a="";GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&RSGame.getInstance().getPlatformEventManager()&&RSGame.getInstance().getPlatformEventManager().getEventActionName&&RSGame.getInstance().getPlatformEventManager().getEventActionName().includes("House Ad")&&(a="HouseAd");RSGame.getInstance().getGameManager().updateRewardsFromAdManager(this._rewards, this._placementName,a);a=new RSPoint(this._collectBtnData.x,this._collectBtnData.y);this._displayPanel.setZOrder(1);RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(a,this._displayPanel,this._onCoinAnimComplete.bind(this));this._closeButton.setTouchEnabled(!1);this._collectBtn.setTouchEnabled(!1)},_onCoinAnimComplete:function(){RSGame.getInstance().getGameManager().getGameType()==RSGameTypes.Bingo&&RSEngine.externalGameManager._updateMachineData({event:"post_message",name:"PURCHASE_SUCESS_DATA", message:"",timeStamp:TimeManager.getInstance().getCurrentServerTime()});this.closePopup("collect")},_isEmptyObj:function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0},closePopup:function(a){this._timer&&clearInterval(this._timer);this._callBack&&this._callBack(a);this._super.closePopup.call(this)}});var RSInHouseVideoPopup=RSGenericPopup.extend({_placementName:null,timer:null,init:function(a){this._placementName=a;this.timer=null;this._assetList=[{name:RSGame.getInstance().getAssetPath("RSInhouseVideoPopup"),count:1}];RSPlatformFontAssetManager.loadFontConfigFile("res/PlatformWidgets/RSInhouseVideoPopup/","InHouseVideoPopupFontConfig.json");this._super.init.call(this)},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){switch(c.name){case "MuteBtn":this._muteBtn= a,this._muteBtn.stopAnimation(),this._muteBtn.addTouchListenerWithDelegate(this)}this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a,b){switch(b.name){case "PlayerRect":this._videoPlayerWidget=b;break;case "Rewards":this._rewardText=RSPlatformFontAssetManager.createCustomLabel("5,000",b);this.addChild(this._rewardText);break;case "Message":this._messageText=RSPlatformFontAssetManager.createCustomLabel("Watch the entire video and earn coins.",b);this.addChild(this._messageText); break;case "StartTimer":this._startTimerText=RSPlatformFontAssetManager.createCustomLabel("00:00",b);this.addChild(this._startTimerText);break;case "EndTimer":this._endTimerText=RSPlatformFontAssetManager.createCustomLabel("00:00",b);this.addChild(this._endTimerText);break;case "ProgressBarFill":this.progressObj=RSUtils.createBasicObject(a,b);this.progressObj.setAnchorPoint(0,0);this.progressObj.setPosition(0,0);this._progressBar=new RSPanel(b.x,b.y,b.w,b.h);this._progressBar.setAnchorPoint(0,0.5); var c=this._progressBar.getPosition();this._progressBar.setPosition(c.getX()-b.w/2,c.getY()-1);this._progressBar.setClippingEnabled(!0);this._progressBar.addChild(this.progressObj);this._progressBar.setVisible(!1);this._progressBar.setSize(0,b.h);this._progressBar.setName("ProgressBar");this.addChild(this._progressBar)}return this._super.createCustomObject.call(this,a,b)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);RSEventManager.getInstance().addEventListener("NETWORK_CONNECTION_LOST", this,this._onConnectionLost.bind(this));this.playYouTubeVideo("SdxrroiZsGs")},onButtonClicked:function(a){switch(a){case "CloseBtn":RSEventManager.getInstance().dispatchEvent("houseAdClose"),RSInHouseAdsManager.removeInHouseAds(),this.closePopup()}},_onConnectionLost:function(){RSInHouseAdsManager.removeInHouseAds();this.closePopup()},playYouTubeVideo:function(a){RSInHouseAdsManager.showInHouseAdsSurvey(a,this._videoPlayerWidget,this._onVideoStarted.bind(this),this.closePopup.bind(this),this._placementName); RSEngine.audioManager.muteMusic()},_onVideoStarted:function(){this.timer&&clearInterval(this.timer);cc.log(":_onVideoStarted");document.getElementById("InHousePlayerIFrame").style.pointerEvents="none";RSAnalyticsManager.getInstance().trackVideoBonusEvent("ad","house_ads","started",this._placementName,"house_ads_youtube");this.timer=setInterval(this.timerUpdate.bind(this),1E3);var a=document.getElementById("InHousePlayerIFrame").contentWindow.player;GlobalVars.musicStatus?(cc.log(":_onVideoStarted : UnMute"), a.unMute(),cc.log(":_onVideoStarted : UnMute : Complete"),this._muteBtn.setFrame(0)):(cc.log(":_onVideoStarted : Mute"),a.mute(),cc.log(":_onVideoStarted : Mute : Complete"),this._muteBtn.setFrame(1))},timerUpdate:function(){if(document.getElementById("InHousePlayerIFrame")&&-1!=document.getElementById("InHousePlayerIFrame").contentWindow.playerState)var a=document.getElementById("InHousePlayerIFrame").contentWindow.player;a&&(a.getCurrentTime()<=a.getDuration()-1&&this._startTimerText&&this._startTimerText.setString(RSUtils.formattedTime(Math.round(a.getCurrentTime()), !0)),this._endTimerText&&this._endTimerText.setString(RSUtils.formattedTime(Math.floor(a.getDuration()-1),!0)),this.progressObj&&(this._progressBarUpdateFactor=this.progressObj.getSize().getWidth()/Math.floor(a.getDuration()-1)),this.progresBarUpdate(a),document.getElementById("InHousePlayerIFrame").contentWindow.done&&clearInterval(this.timer))},progresBarUpdate:function(a){if(this._progressBar){var b=this._progressBar.getSize();a=this._progressBarUpdateFactor*Math.round(a.getCurrentTime());0<a&& null!=b&&(this._progressBar.setVisible(!0),this._progressBar.setSize(a,b._height))}},showRewardPopup:function(){},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){this._player=document.getElementById("InHousePlayerIFrame").contentWindow.player;"MuteBtn"==a.getName()&&this._player&&(this._player.isMuted()?(this._player.unMute(),this._muteBtn.setFrame(0)):(this._player.mute(),this._muteBtn.setFrame(1)))},unloadContent:function(){RSEventManager.getInstance().removeListenersForEvent(RS_CONNECTION_LOST_EVENT); RSAnalyticsManager.getInstance().trackVideoBonusEvent("ad","house_ads","closed",this._placementName,"house_ads_youtube");this.timer&&clearInterval(this.timer);this.timer=null;GlobalVars.musicStatus?RSEngine.audioManager.unMuteMusic():RSEngine.audioManager.muteMusic();this._super.unloadContent.call(this)}});var onInHouseAdsEvent="onInHouseAdsEvent",RSInHouseAdsManager={_placementName:null,_surveyAvailable:!0,_resizeTimer:null,_iFrameSize:null,_videoId:null,_eventListnerAdded:!1,initializeInHouseAdsManager:function(){this._eventListnerAdded||(this._eventListnerAdded=!0,window.document.addEventListener(onInHouseAdsEvent,this.onInHouseAdsEvent.bind(this),!1))},getSurveyAvailableStatus:function(){this._surveyAvailable},getVideoId:function(){return this._videoId},showInHouseAdsSurvey:function(a,b,c,d,e){this._placementName= e;this._callback=c;this._closeCallBack=d;if(a=RSGame.getInstance().getPlatformEventManager().getRandomYoutubeLink())this._videoId=a.split("watch?v\x3d")[1];this.inHouseDiv=document.createElement("div");this.inHouseDiv.className="inHouseDivClass";this.inHouseDiv.id="InHouseDiv";this.inHouseDiv.style.position="absolute";this.inHouseDiv.style.left="0px";this.inHouseDiv.style.width="100%";this.inHouseDiv.style.height="100%";this.inHouseDiv.style.textAlign="center";document.getElementById("Cocos2dGameContainer").appendChild(this.inHouseDiv); d=document.getElementById("Cocos2dGameContainer").style.height;c=document.getElementById("Cocos2dGameContainer").style.width;a=document.getElementById("Cocos2dGameContainer").style.paddingLeft;null!=this.inHouseDiv&&(d=parseInt(d.substring(0,d.length-2)),c=parseInt(c.substring(0,c.length-2)),this.inHouseDiv.style.position="absolute",this.inHouseDiv.style.top="0px",this.inHouseDiv.style.paddingLeft=a,this.inHouseDiv.style.height=d+"px",this.inHouseDiv.style.width=c+"px");this._iFrameSize=b;b=document.createElement("iframe"); b.setAttribute("id","InHousePlayerIFrame");b.setAttribute("scrolling","no");b.setAttribute("disabled","true");b.setAttribute("allow","autoplay");b.setAttribute("style","position:relative; border:0;width: 50%; height: 50%; z-index: 999;");b.setAttribute("src","res/WebAssets/youTubePlayer.html?videoId\x3d"+this._videoId);this.inHouseDiv.appendChild(b);this._resize()},_resize:function(){var a=document.getElementById("Cocos2dGameContainer").style.height,b=document.getElementById("Cocos2dGameContainer").style.paddingLeft, c=document.getElementById("InHousePlayerIFrame");if(null!=this.inHouseDiv){var d=0.145*parseInt(a.substring(0,a.length-2)),e=0.69*parseInt(a.substring(0,a.length-2)),b=0.267*parseInt(a.substring(0,a.length-2))+0.99*parseInt(b.substring(0,b.length-2)),a=1.23*parseInt(a.substring(0,a.length-2));this.inHouseDiv.style.paddingLeft="0px";this.inHouseDiv.style.top=d+"px";this.inHouseDiv.style.height=e+"px";this.inHouseDiv.style.width=a+"px";this.inHouseDiv.style.left=b+"px";c&&(c.style.width=a+"px",c.style.height= e+"px");document.getElementById("InHousePlayerIFrame")&&document.getElementById("InHousePlayerIFrame").contentWindow&&document.getElementById("InHousePlayerIFrame").contentWindow.player&&document.getElementById("InHousePlayerIFrame").contentWindow.player.setSize(a,e)}GlobalVars.relaunchPopupActive&&(clearTimeout(this._resizeTimer),this.removeInHouseAds(),this._closeCallBack())},removeInHouseAds:function(){clearTimeout(this._resizeTimer);document.getElementById("InHousePlayerIFrame")&&document.getElementById("InHousePlayerIFrame").remove(); document.getElementById("InHouseDiv")&&document.getElementById("InHouseDiv").remove()},onInHouseAdsEvent:function(a){resize();if(a&&a.detail)switch(a.detail.status){case 1:cc.log(":onInHouseAdsEvent: Callback");this._callback&&(this._callback(),this._callback=null);break;case 2:this._resizeTimer=setInterval(this._resize.bind(this),1E3);document.getElementById("InHousePlayerIFrame").contentWindow.player&&(a=document.getElementById("InHousePlayerIFrame").contentWindow.player,GlobalVars.musicStatus? (cc.log(":onInHouseAdsEvent: UnMute"),a.unMute(),cc.log(":onInHouseAdsEvent: UnMute Complete")):(cc.log(":onInHouseAdsEvent: Mute"),a.mute(),cc.log(":onInHouseAdsEvent: Mute Complete")));break;case 3:clearTimeout(this._resizeTimer),RSInHouseAdsManager.removeInHouseAds(),RSAnalyticsManager.getInstance().trackVideoBonusEvent("ad","house_ads","completed",this._placementName,"house_ads_youtube"),this._closeCallBack(),RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.COLLECT_AD_REWARD, AD_REWARD_STATUS.COMPLETED)}},postEventToInHouseAdPage:function(){this.InHousePlayerIFrame=document.getElementById("InHousePlayerIFrame").contentWindow;this.InHousePlayerIFrame.postMessage(JSON.stringify({width:200,height:200}),"*")}};RSLeaderboardEvents={ALL_LEADEBOARD_LOADED:"AllLeaderBoardLoaded",USER_LEADERBOARD_LOADED:"UserLeaderboardLoaded",LEADERBOARD_UPDATED:"LeaderboardUpdated",LEADERBOARD_REWARD_UPDATED:"leaderboardRewardUpdated"}; var RSLeaderboardTimeRange={SEASONAL:"seasonal",WEEKLY:"weekly",DAILY:"daily"},RSLeaderboardManager={_leaderboardBgScreen:null,_levelAndRewardDataFetched:!1,_rankUpAnimationtriggered:!1,_leaderboardResetting:!1,_triggerLeaderboardPopup:!1,_showExpiryPopup:!1,_onBackButtonClicked:!1,_onLeaderBoardButtonClicked:!1,_timerCheckCount:0,_currentUserRank:0,initializeLeaderboard:function(a){this._levelAndRewardDataFetched=!1;this._getAndSetLevelBucketsAndRewards();this._getAndSetLeaderboardBucketFromUserBlob(); this.getUserLeaderboardData();this._setTop3Rewards();this.setFireworkColorCode(a);this.getAllLeaderBoardData();RSEventManager.getInstance().addEventListener(RSPlatformEventTypeKeys.RSPlatformEvent,this,this.onPlacementEvent.bind(this))},showLeaderboardScreen:function(a,b,c){this._onLeaderBoardButtonClicked=b?b:!1;if(GameConfig.IS_LB_RESPONSE_FAIL_POPUP_ENABLED&&(3>this._timerCheckCount&&RSLeaderboard.getLeaderBoardEndTime()<TimeManager.getInstance().getCurrentServerTime()&&(this._timerCheckCount++, RSLeaderboardManager.getUserLeaderboardData()),3==this._timerCheckCount)){RSEngine.screenManager.removeOverlay();RSLeaderboardManager.showLeaderboardResponseFailPopup();this._timerCheckCount=0;return}if(RSLeaderboard.getLeaderboardResetStatus())RSLeaderboard.resetRankUpTriggerStatus(),this.updateLeaderboardData(!0),b&&(this._triggerLeaderboardPopup=!0);else if(RSLeaderboard.getRankUpTriggerStatus())this.showRankUpScreen(this._onLeaderBoardButtonClicked);else{RSLeaderboard.resetRankUpTriggerStatus(); this._triggerLeaderboardPopup=!1;this._leaderboardScreen&&this.removeLeaderboardScreen();RSEngine.externalGameManager&&RSEngine.externalGameManager.hideExternalGame();RSGame.getInstance().getGameManager().setSideMenuVisibility(!1);var d=[{name:RSGame.getInstance().getAssetPath("LeaderboardBg"),count:1},{name:RSGame.getInstance().getAssetPath("RSLeaderboardBadgeAnim"),count:1},{name:RSGame.getInstance().getAssetPath("RSLeaderboardScreen"),count:1}];this._leaderboardScreen=new RSLeaderboardScreen(d, a,this.removeLeaderboardScreen.bind(this),b,c);RSEngine.screenManager.addScreen(this._leaderboardScreen);this._getAndSetLevelBucketsAndRewards()}},getAllLeaderBoardData:function(){RSEngine.loginMode!=LOGIN_MODE.GUEST&&RSGame.getInstance().getUserDataManager().getAllLeaderBoardData(this._leaderboardBucket,this.onGetAllLeaderBoardSuccess.bind(this))},onGetAllLeaderBoardSuccess:function(a){RSLeaderboard.setLocalData(a.result);RSEventManager.getInstance().dispatchEvent(RSLeaderboardEvents.ALL_LEADEBOARD_LOADED, null)},getUserLeaderboardData:function(){RSEngine.loginMode!=LOGIN_MODE.GUEST&&RSGame.getInstance().getUserDataManager().getUserLeaderboardData(this._leaderboardBucket,this.onUserLeaderBoardSuccess.bind(this))},onUserLeaderBoardSuccess:function(a){var b=a.result.currentUserData;0<RSLeaderboard.getLeaderBoardEndTime()-TimeManager.getInstance().getCurrentServerTime()&&(this._currentUserRank=a.result.currentUserData.weekly.userRank);RSLeaderboard.setUserData(b);this._checkAndUpdateLevelBucket(b);RSEventManager.getInstance().dispatchEvent(RSLeaderboardEvents.USER_LEADERBOARD_LOADED, null)},isLeaderBoardScreenActive:function(){return Boolean(this._leaderboardScreen)},removeLeaderboardScreen:function(a){this._leaderboardScreen&&(RSEngine.screenManager.removeScreen(this._leaderboardScreen),this._leaderboardScreen=null,RSEngine.externalGameManager&&RSEngine.externalGameManager.showExternalGame(),RSGame.getInstance().getGameManager().setSideMenuVisibility(!0));RSLeaderboard.getLeaderboardResetStatus()||(this._onLeaderBoardButtonClicked=!1);a?this.showLeaderboardScreen():this._onBackButtonClicked= !1;RSGameScreenManager.getInstance().getCurrentScreen()===RSGameScreens.MainLobby&&RSEventManager.getInstance().dispatchEvent("onLeaderboardclosed")},onLeaderBoardClickStatus:function(){return this._onLeaderBoardButtonClicked?!0:!1},showLeaderboardRewardPopups:function(){RSEngine.popupManager.addPopup(new RSLeaderboardCongratulationsPopup({rank:2,type:"Daily",reward:25E3}))},_getAndSetLevelBucketsAndRewards:function(){this._levelAndRewardDataFetched?(this._setCurrentLevelBucket(),cc.log("Already data fetched")): (this._levelAndRewardDataFetched=!0,this._weeklyLeaderboardRewards=RSGame.getInstance().getGameData().getSheetData("weeklyLeaderboardRewards"),this._levelBuckets=RSGame.getInstance().getGameData().getSheetData("levelBucketList"),this._setRewardLimitsOfLeaderboard(),this._setCurrentLevelBucket())},_setRewardLimitsOfLeaderboard:function(){this._rewardLimitsOfLeaderboard={};this._rewardLimitsOfLeaderboard[RSLeaderboardTimeRange.WEEKLY]=parseInt(this._weeklyLeaderboardRewards[this._weeklyLeaderboardRewards.length- 1].id)},getRewardLimitOf:function(a){switch(a){case RSLeaderboardTimeRange.WEEKLY:return this._rewardLimitsOfLeaderboard[RSLeaderboardTimeRange.WEEKLY]}},_setCurrentLevelBucket:function(){this._levelBuckets;var a=RSGame.getInstance().getLevelManager().getCurrentLevel(),b=0;for(b in this._levelBuckets)this._levelBuckets[b].level<=a&&(this._currentLevelBucket=this._levelBuckets[b].levelBucket);cc.log("Current level bucket"+this._currentLevelBucket)},getRewardForLeaderboard:function(a,b,c){var d=null; switch(a){case RSLeaderboardTimeRange.WEEKLY:d=this._weeklyLeaderboardRewards}var e=0,f=null;for(e in d)parseInt(d[e].id)<=c&&(f=d[e]);return a==RSLeaderboardTimeRange.SEASONAL?f.reward:f[b]},_getAndSetLeaderboardBucketFromUserBlob:function(){this._leaderboardBucket=RSGame.getInstance().getUserDataManager().getMe().getLeaderboardLevelBucket();this._leaderboardBucket.weekly=this._leaderboardBucket.weekly?0>=parseInt(this._leaderboardBucket.weekly)?this._currentLevelBucket:this._leaderboardBucket.weekly: this._currentLevelBucket},getLeaderboardBucket:function(){return this._leaderboardBucket},_setTop3Rewards:function(){this._top3Rewards={};this._top3Rewards[RSLeaderboardTimeRange.WEEKLY]=[this._weeklyLeaderboardRewards[0]["levelBucket"+this._leaderboardBucket[RSLeaderboardTimeRange.WEEKLY]],this._weeklyLeaderboardRewards[1]["levelBucket"+this._leaderboardBucket[RSLeaderboardTimeRange.WEEKLY]],this._weeklyLeaderboardRewards[2]["levelBucket"+this._leaderboardBucket[RSLeaderboardTimeRange.WEEKLY]],this._weeklyLeaderboardRewards[3]["levelBucket"+ this._leaderboardBucket[RSLeaderboardTimeRange.WEEKLY]]]},getTopRewards:function(){return this._top3Rewards},_checkAndUpdateLevelBucket:function(a){RSLeaderboard.getLevelBucketUpdateStatus()&&(this._setCurrentLevelBucket(),this._leaderboardBucket.weekly=this._currentLevelBucket,RSLeaderboard.resetLevelBucketUpdateStatus(),this._setTop3Rewards());a&&a.weekly&&0==parseInt(a.weekly.coins)&&(this._leaderboardBucket.weekly=this._currentLevelBucket,this._setTop3Rewards());cc.log("here")},getLevelBucketUpdatedStatus:function(){return this._levelBucketUpdated}, unSetLevelBucketUpdatedStatus:function(){this._levelBucketUpdated=!1},showRankUpdationAnimations:function(){cc.log("Show position update animations here....");this.showLeaderboardScreen(!0)},showLeaderboardRewardScreen:function(a,b){RSEngine.externalGameManager&&RSEngine.externalGameManager.hideExternalGame();RSGame.getInstance().getGameManager().setSideMenuVisibility(!1);var c=[{name:RSGame.getInstance().getAssetPath("LeaderboardBg"),count:1},{name:RSGame.getInstance().getAssetPath("RSLeaderboardBadgeAnim"), count:1},{name:RSGame.getInstance().getAssetPath("RSLeaderboardFireworksAnim"),count:1},{name:RSGame.getInstance().getAssetPath("RSLeaderboardRewardScreenFireworks"),count:1},{name:RSGame.getInstance().getAssetPath("RSLeaderboardRewardScreen"),count:2}];this._leaderboardRewardScreen=new RSLeaderboardRewardScreen(c,a,b,this._removeLeaderboardRewardScreen.bind(this));RSEngine.screenManager.addScreen(this._leaderboardRewardScreen)},_removeLeaderboardRewardScreen:function(){cc.log("Removing leaderboard reward screen"); RSEngine.screenManager.removeScreen(this._leaderboardRewardScreen);RSEngine.externalGameManager.showExternalGame();RSGame.getInstance().getGameManager().setSideMenuVisibility(!0);RSRewardManager.onRewardPopupClosed("Leaderboard");this.getLeaderboardTriggerStatus()&&this.showLeaderboardScreen()},onPlacementEvent:function(a){cc.log("ON Platform Event"+a._userData.event+" :FROM: "+a._userData.parameter);if(RSEngine.loginMode!=LOGIN_MODE.GUEST)switch(a._userData.parameter){case RSPlatformEventTypeKeys.ON_BACK_BUTTON_CLICK:this._checkAndUpdateUserLeaderboard(a._userData.value)}}, getName:function(){return"RSLeaderboardManager"},getBackButtonStatus:function(){return this._onBackButtonClicked},_checkAndUpdateUserLeaderboard:function(a){RSLeaderboard.getLeaderboardResetStatus()?this.updateLeaderboardData():RSLeaderboard.getRankUpTriggerStatus()&&"gameplay_screen"==a&&(this._onBackButtonClicked=!0,this.showRankUpScreen())},showRankUpScreen:function(a){a=a?a:!1;RSLeaderboard.resetRankUpTriggerStatus();if(this._rankUpAnimationtriggered)this.showLeaderboardScreen(!0,a);else{this._rankUpAnimationtriggered= !0;RSEngine.externalGameManager&&RSEngine.externalGameManager.hideExternalGame();RSGame.getInstance().getGameManager().setSideMenuVisibility(!1);var b=[{name:RSGame.getInstance().getAssetPath("LeaderboardBg"),count:1},{name:RSGame.getInstance().getAssetPath("RSLeaderboardFireworksAnim"),count:1},{name:RSGame.getInstance().getAssetPath("RSLeaderboardRankUpScreen"),count:1}];this._rankUpScreen=new RSLeaderboardRankUpScreen(b,this._removeRankUpScreen.bind(this,a));RSEngine.screenManager.addScreen(this._rankUpScreen)}}, _removeRankUpScreen:function(a){RSEngine.screenManager.removeScreen(this._rankUpScreen);this.showLeaderboardScreen(!0,a)},getLeaderboardRewardStatus:function(a){3!=this._timerCheckCount&&(this.showPopup=a,this._leaderboardScreen&&this.removeLeaderboardScreen(),this.showPopup&&RSEngine.screenManager.addOverlay(),RSGame.getInstance().getUserDataManager().getLeaderBoardRewardStatus(this._onLeaderboardRewardStatusResponse.bind(this),this.getLeaderboardRewardStatus.bind(this,a)))},_onLeaderboardRewardStatusResponse:function(a){this.showPopup&& RSEngine.screenManager.removeOverlay();if(parseInt(a.result.rank)<=this._rewardLimitsOfLeaderboard[RSLeaderboardTimeRange.WEEKLY]&&0!=parseInt(a.result.rank)){if(this.showPopup)for(property in a.result.newReward)a.result.newReward[property].placement="forceShow";RSRewardManager.updateLeaderboardReward(a.result.newReward,this._onLeaderboardRewardResponseSucces.bind(this))}else if(this.getExpiryPopupTriggerStatus()){var b={},c=this._currentUserRank;a.result.status&&(c=a.result.rank);b.title=RSGame.getInstance().getGameManager().getDefaultCasinoFont("largePink", "bold")?RSGame.getInstance().getGameManager().getDefaultCasinoFont("largePink","bold"):RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold");b.text=RSGame.getInstance().getGameManager().getDefaultCasinoFont("largePurple","normal")?RSGame.getInstance().getGameManager().getDefaultCasinoFont("largePurple","normal"):RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","normal");b.amount=RSGame.getInstance().getGameManager().getDefaultCasinoFont("largepurpleStroke","bold")? RSGame.getInstance().getGameManager().getDefaultCasinoFont("largepurpleStroke","bold"):RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","normal");RSEngine.popupManager.addPopup(new RSLeaderboardNofificationPopup(c,10,b,this._onLeaderBoardWinNotificationPopupClosed.bind(this)))}else this.getLeaderboardTriggerStatus()&&this.showLeaderboardScreen();RSEventManager.getInstance().dispatchEvent(RSLeaderboardEvents.LEADERBOARD_REWARD_UPDATED)},_onLeaderboardRewardResponseSucces:function(a){this.showPopup&& RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.ENTER_SCREEN,parameter:"forceShow"})},_onLeaderBoardWinNotificationPopupClosed:function(){this.resetExpiryPopupTriggerStatus();this.showLeaderboardScreen()},updateLeaderboardData:function(a,b){this._leaderboardResetting=!0;RSLeaderboard.setLevelBucketUpdateStatus();this._checkAndUpdateLevelBucket();this._setTop3Rewards();RSLeaderboardManager.getUserLeaderboardData();RSLeaderboard.resetRankUpTriggerStatus(); this.getLeaderboardRewardStatus(a);this._triggerLeaderboardPopup=a;this._showExpiryPopup=b},getLeaderboardResettingStatus:function(){return this._leaderboardResetting},resetLeaderboardResettingStatus:function(){this._leaderboardResetting=!1;this._updateCoinsToLeaderboard()},_updateCoinsToLeaderboard:function(){var a=RSLeaderboard.getDataToBeUpdated();a&&RSLeaderboard.setUserLeaderBoardData(a,!0)},getLeaderboardTriggerStatus:function(){return this._triggerLeaderboardPopup},getExpiryPopupTriggerStatus:function(){return this._showExpiryPopup}, resetExpiryPopupTriggerStatus:function(){this._showExpiryPopup=!1},setFireworkColorCode:function(a){this._colourSet=null==a||void 0==a?{rankupColorCode:[new RSColor(255,0,255,255)],rewardScreenColorCodes:[new RSColor(155,57,238),new RSColor(234,12,230),new RSColor(14,221,221),new RSColor(14,84,234)]}:a},getFireworkColorCode:function(){return this._colourSet},showLeaderboardResponseFailPopup:function(){RSEngine.popupManager.addPopup(new RSLeaderboardResponseFailPopup)}};var RSLeaderboardBgScreen=RSGameScreen.extend({init:function(a,b){this._super.init.call(this);this.callBack=b;this.layoutScreen(a)},onAssetLoaded:function(a){this._super.onAssetLoaded.call(this,a)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},onObjectCreated:function(a,b,c){return this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a,b){return this._super.createCustomObject.call(this,a,b)},unloadContent:function(){this._super.unloadContent.call(this)}});var RSLeaderboardScrollBar=RSBarScroller.extend({_jumpToPosition:function(a,b,c){this._super._jumpToPosition.call(this,a,b,!0)}}),RSLeaderboardScreen=RSLeaderboardBgScreen.extend({init:function(a,b,c,d,e){this._super.init.call(this,a);this.callBack=c;this._scrollerPercentToBeMoved=this._eventsCompleted=0;this._showRankUpAnimations=b;this._tournamentEndTime=RSLeaderboard.getLeaderBoardEndTime();this._selectedLeaderboard=RSLeaderboardTimeRange.DAILY;this._rank=RSLeaderboard.getUserRank();this._timerExpired= !1;this._isOpenedOnClick=d?d:!1;this._lobbyName=RSAnalyticsManager.getInstance().getCurrentMachineName();this._playerIndex=0;this._refreshStatus=this._playerAnimPlayed=!1;this._openInfoPopup=e;this._showRankUpAnimations||RSAnalyticsManager.getInstance().trackPlayerAction("leaderboard","click","open_from_"+this._lobbyName,RSLeaderboard.getUserRank(),"");RSEventManager.getInstance().addEventListener(RSLeaderboardEvents.ALL_LEADEBOARD_LOADED,this,this.loadComplete.bind(this));RSEventManager.getInstance().addEventListener(RSLeaderboardEvents.USER_LEADERBOARD_LOADED, this,this.loadComplete.bind(this))},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){var c=0;switch(b.name){case "LeaderboardHolder":this._leaderboardHolder=b;break;case "PlayerItemHolder":this._leaderboarPlayerHolder=b;break;case "LeaderboardScrollArea":this._leaderboardScrollArea=b;break;case "Player1":this._newFontForTopPlayers=RSGame.getInstance().getGameManager().getNewLeaderboardFonts().topPlayers?RSGame.getInstance().getGameManager().getNewLeaderboardFonts().topPlayers: RSGame.getInstance().getGameManager().getDefaultCasinoFont("Semi","Bold");this._nameOfPlayerWithRank1=new RSScaledLabel("",this._newFontForTopPlayers,b,kTEXT_ALIGNMENT_CENTER);this._nameOfPlayerWithRank1.setZOrder(3);this.addChild(this._nameOfPlayerWithRank1);break;case "Player2":this._newFontForTopPlayers=RSGame.getInstance().getGameManager().getNewLeaderboardFonts().topPlayers?RSGame.getInstance().getGameManager().getNewLeaderboardFonts().topPlayers:RSGame.getInstance().getGameManager().getDefaultCasinoFont("Semi", "Bold");this._nameOfPlayerWithRank2=new RSScaledLabel("",this._newFontForTopPlayers,b,kTEXT_ALIGNMENT_CENTER);this._nameOfPlayerWithRank2.setZOrder(3);this.addChild(this._nameOfPlayerWithRank2);break;case "Player3":this._newFontForTopPlayers=RSGame.getInstance().getGameManager().getNewLeaderboardFonts().topPlayers?RSGame.getInstance().getGameManager().getNewLeaderboardFonts().topPlayers:RSGame.getInstance().getGameManager().getDefaultCasinoFont("Semi","Bold");this._nameOfPlayerWithRank3=new RSScaledLabel("", this._newFontForTopPlayers,b,kTEXT_ALIGNMENT_CENTER);this._nameOfPlayerWithRank3.setZOrder(3);this.addChild(this._nameOfPlayerWithRank3);break;case "RewardAmount1":this._rewardOfRank1=new RSScaledLabel("",RSGame.getInstance().getGameManager().getNewLeaderboardFonts().top3RewardFont?RSGame.getInstance().getGameManager().getNewLeaderboardFonts().top3RewardFont:RSGame.getInstance().getGameManager().getDefaultCasinoFont("Semi","Bold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._rewardOfRank1);break; case "RewardAmount2":this._rewardOfRank2=new RSScaledLabel("",RSGame.getInstance().getGameManager().getNewLeaderboardFonts().top3RewardFont?RSGame.getInstance().getGameManager().getNewLeaderboardFonts().top3RewardFont:RSGame.getInstance().getGameManager().getDefaultCasinoFont("Semi","Bold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._rewardOfRank2);break;case "RewardAmount3":this._rewardOfRank3=new RSScaledLabel("",RSGame.getInstance().getGameManager().getNewLeaderboardFonts().top3RewardFont?RSGame.getInstance().getGameManager().getNewLeaderboardFonts().top3RewardFont: RSGame.getInstance().getGameManager().getDefaultCasinoFont("Semi","Bold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._rewardOfRank3);break;case "TournamentEnds":this._timerFont=RSGame.getInstance().getGameManager().getNewLeaderboardFonts().timerFont?RSGame.getInstance().getGameManager().getNewLeaderboardFonts().timerFont:RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold");this._newtimerAlignment=void 0!=RSGame.getInstance().getGameManager().getNewLeaderboardFonts().timerAlignment|| null!=RSGame.getInstance().getGameManager().getNewLeaderboardFonts().timerAlignment?RSGame.getInstance().getGameManager().getNewLeaderboardFonts().timerAlignment:kTEXT_ALIGNMENT_CENTER;this._tournamentEndsText=new RSScaledLabel("",this._timerFont,b,this._newtimerAlignment);this.addChild(this._tournamentEndsText);break;case "RankAnim1Left":c=b.h/this._badgeAnimData.h;b.name="BadgeAnimLeft";this._rankAnim1Left=RSUtils.createAnimation("LeaderboardBadgeAnim",b,0.3);this._rankAnim1Left.setScale(c);this._rankAnim1Left.setZOrder(1); this.addChild(this._rankAnim1Left);this._rankAnim1Left.stopAnimation();break;case "RankAnim1Right":c=b.h/this._badgeAnimData.h;b.name="BadgeAnimRight";this._rankAnim1Right=RSUtils.createAnimation("LeaderboardBadgeAnim",b,0.3);this._rankAnim1Right.setZOrder(1);this.addChild(this._rankAnim1Right);this._rankAnim1Right.setScaleX(-c);this._rankAnim1Right.setScaleY(c);this._rankAnim1Right.stopAnimation();break;case "RankAnim2Left":c=b.h/this._badgeAnimData.h;b.name="BadgeAnimLeft";this._rankAnim2Left=RSUtils.createAnimation("LeaderboardBadgeAnim", b,0.3);this._rankAnim2Left.setScale(c);this._rankAnim2Left.setZOrder(1);this.addChild(this._rankAnim2Left);this._rankAnim2Left.setScaleX(c);this._rankAnim2Left.stopAnimation();break;case "RankAnim2Right":c=b.h/this._badgeAnimData.h;b.name="BadgeAnimRight";this._rankAnim2Right=RSUtils.createAnimation("LeaderboardBadgeAnim",b,0.3);this._rankAnim2Right.setZOrder(1);this.addChild(this._rankAnim2Right);this._rankAnim2Right.setScaleX(-c);this._rankAnim2Right.setScaleY(c);this._rankAnim2Right.stopAnimation(); break;case "RankAnim3Left":c=b.h/this._badgeAnimData.h;b.name="BadgeAnimLeft";this._rankAnim3Left=RSUtils.createAnimation("LeaderboardBadgeAnim",b,0.3);this._rankAnim3Left.setZOrder(1);this._rankAnim3Left.setScale(c);this.addChild(this._rankAnim3Left);this._rankAnim3Left.stopAnimation();break;case "RankAnim3Right":c=b.h/this._badgeAnimData.h;b.name="BadgeAnimRight";this._rankAnim3Right=RSUtils.createAnimation("LeaderboardBadgeAnim",b,0.3);this._rankAnim3Right.setZOrder(1);this.addChild(this._rankAnim3Right); this._rankAnim3Right.setScaleX(-c);this._rankAnim3Right.setScaleY(c);this._rankAnim3Right.stopAnimation();break;case "RankUpAnimHolder1":this._rankUpAnimHolder1=new RSPoint(b.x,b.y);this._rankUpAnimHolder1Panel=new RSPanel(b.x,b.y,b.w,b.h);this.addChild(this._rankUpAnimHolder1Panel);break;case "RankUpAnimHolder2":this._rankUpAnimHolder2=new RSPoint(b.x,b.y);break;case "RankUpAnimHolder3":this._rankUpAnimHolder3=new RSPoint(b.x,b.y);break;case "ScrollBarArea":this._scrollArea=b;break;case "PostitionPrizes":this._screenBase= new RSPanel(b.x,b.y,b.w,b.h);this.addChild(this._screenBase);this._screenBase.addChild(new RSLeaderboardPayTable(b));break;case "PostitionPrizesV2":this._screenBase=new RSPanel(b.x,b.y,b.w,b.h);this.addChild(this._screenBase);this._screenBase.addChild(new RSLeaderboardPayTableV2(b));break;case "PlayerItemBottomRect":this._playerBottomRect=b}},onObjectCreated:function(a,b,c){switch(c.name){case "RankMask1":this._profilePicMaskAreaOfRank1=c;this._rankMask1=a;this._screenName=b;this._imageHolder1=new RSImageObject; this.addChild(this._imageHolder1);break;case "RankMask2":this._profilePicMaskAreaOfRank2=c;this._rankMask2=a;this._imageHolder2=new RSImageObject;this.addChild(this._imageHolder2);break;case "RankMask3":this._profilePicMaskAreaOfRank3=c;this._rankMask3=a;this._imageHolder3=new RSImageObject;this.addChild(this._imageHolder3);break;case "UpArrow":this._scrollerUpBtn=a;this._scrollerUpBtn.setVisible(!1);break;case "DownArrow":this._scrollerDownBtn=a;this._scrollerDownBtn.setVisible(!1);break;case "MiddleButton":this._scrollerBtn= a;this._scrollerBtn.setVisible(!1);break;case "ScrollBase":this._scrollBase=c;break;case "Daily":this._dailyLeaderboardBtn=a;break;case "Weekly":this._weeklyLeaderboardBtn=a;break;case "Season":this._seasonalLeaderboardBtn=a;break;case "PlayerItemGlowAnimLeft":this._playerItemGlowAnimLeft=a;this._playerItemGlowAnimLeft.stopAnimation();this._playerItemGlowAnimLeft.setVisible(!1);this._playerItemGlowAnimLeft.setZOrder(4);break;case "PlayerItemGlowAnimRight":this._playerItemGlowAnimRight=a;this._playerItemGlowAnimRight.stopAnimation(); this._playerItemGlowAnimRight.setVisible(!1);this._playerItemGlowAnimRight.setScaleX(-1);this._playerItemGlowAnimRight.setZOrder(4);break;case "BadgeAnimLeft":case "BadgeAnimRight":a.stopAnimation();a.setVisible(!1);this._badgeAnimData=c;break;case "RankPosition1":this._rankPosition1=a;this._rankPosition1.setZOrder(1);break;case "RankPosition2":this._rankPosition2=a;this._rankPosition2.setZOrder(1);break;case "RankPosition3":this._rankPosition3=a;this._rankPosition3.setZOrder(1);break;case "RankBase1":this._rankBase1= a;this._rankBase1.setZOrder(2);break;case "RankBase2":this._rankBase2=a;this._rankBase2.setZOrder(2);break;case "RankBase3":this._rankBase3=a;this._rankBase3.setZOrder(2);break;case "Shade":a.setZOrder(3);break;case "BottomRectShade":this._bottomRectShade=a;this._bottomRectShade.setVisible(!1);this._bottomRectShade.setZOrder(3);break;case "Bg":this._bg=a;this._bg.setZOrder(4);break;case "LeaderboardBg":this._leaderboardBg=a;this._leaderboardBg.setZOrder(5);break;case "BottomShade":a.setZOrder(2); break;case "RefreshBtn":a.setZOrder(5);break;case "CloseBtn":a.setZOrder(5);break;case "InfoBtn":a.setZOrder(5);break;case "TopShade":this._topShade=a,this._topShadeData=c,this._topShade.setZOrder(3)}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);RSEngine.screenManager.addOverlay();RSLeaderboardManager.getAllLeaderBoardData();RSLeaderboardManager.getUserLeaderboardData()},loadComplete:function(){this._eventsCompleted++;2==this._eventsCompleted&&(RSEngine.screenManager.removeOverlay(), this._changeZOrderOfBg(),this._initializeScroller(),RSLeaderboard.getUserRank()&&3>=RSLeaderboard.getUserRank()&&this._showBadgeAnimations(),this._showRankUpAnimations&&(RSLeaderboard.getUserRank(),RSLeaderboard.resetRankUpdateStatus()),this._checkAndCreatePlayerLeaderboardItem(),this._openInfoPopup&&RSEngine.popupManager.addPopup(new RSLeaderboardInfoPopup(RSGame.getInstance().getGameData().getSheetData("leaderboardInfoText"))),RSAnalyticsManager.getInstance().trackPlayerAction("leaderboard","open", "open_from_"+this._lobbyName,RSLeaderboard.getUserRank(),""))},_changeZOrderOfBg:function(){this._bg.setZOrder(-1);this._leaderboardBg.setZOrder(-1)},onButtonClicked:function(a){switch(a){case "CloseBtn":this.callBack&&(RSAnalyticsManager.getInstance().trackPlayerAction("leaderboard","close","open_from_"+this._lobbyName,RSLeaderboard.getUserRank(),""),this.callBack());break;case "Daily":this._updateScroller(RSLeaderboardTimeRange.DAILY);break;case "Weekly":this._updateScroller(RSLeaderboardTimeRange.WEEKLY); break;case "Season":this._updateScroller(RSLeaderboardTimeRange.SEASONAL);break;case "InfoBtn":RSEngine.popupManager.addPopup(new RSLeaderboardInfoPopup(RSGame.getInstance().getGameData().getSheetData("leaderboardInfoText")));RSAnalyticsManager.getInstance().trackPlayerAction("leaderboard_info","click","open_from_leaderboard",this._rank,"");break;case "RefreshBtn":this._refreshStatus=!0,this.callBack&&this.callBack("refresh")}},_showLeaderBoardScreen:function(){},_initializeScroller:function(){this._scroller= new RSLeaderboardScrollBar(new RSRect(this._leaderboardHolder.x,this._leaderboardHolder.y,this._leaderboardHolder.w,this._leaderboardHolder.h),new RSSize(this._leaderboarPlayerHolder.w,this._leaderboarPlayerHolder.h),0,RSScrollerDirection.RSSCROLLER_VERTICAL,1);this.addChild(this._scroller);this._scroller.setButtonScroll(this._scrollerBtn);this._scroller.setScrollBase(this._scrollArea);this._updateScroller(RSLeaderboardTimeRange.WEEKLY);var a=new RSDisplayObject(new RSRect(this._leaderboardHolder.x, this._leaderboardHolder.y,this._leaderboardHolder.w,this._leaderboardHolder.h));this.addChild(a);a.setAnchorPoint(0.5,0.5);this._scroller.setMouseWheelScrollBase(a)},_updateScroller:function(a){this._selectedLeaderboard=a;var b=RSLeaderboardManager.getRewardLimitOf(a);this._setTop3PlayersOfSelectedLeaderboard();a||(a=1);this._scroller&&this._scroller.removeAllChildren();for(var c=0,d=RSLeaderboard.getLeaderboardDataOf(a),e=RSLeaderboard.getUserRank(),f=d.length,g="levelBucket"+RSLeaderboardManager.getLeaderboardBucket().weekly, c=0;c<f;c++){d[c].reward=0;d[c].rank=c+1;c<b&&(d[c].reward=RSLeaderboardManager.getRewardForLeaderboard(a,g,c+1));var h=new RSLeaderboardItem(this._leaderboarPlayerHolder,d[c]);this._scroller.addChild(h);d[c].user_id==RSEngine.dataManager.getMe().getId()&&(this._playerLeaderboardItem=h,this._playerIndex=c)}a={};a.avatar_id=RSEngine.dataManager.getMe().getAvatar();a.user_id="RS_100";a.first_name="DummyData";a.coins=0;a.rank=0;a.reward=0;h=new RSLeaderboardItem(this._leaderboarPlayerHolder,a,!1,!0); this._scroller.addChild(h);3<e&&e!=f?this._scrollerPercentToBeMoved=Math.floor((e-1)/f*100):3<e&&e==f&&(this._scrollerPercentToBeMoved=100)},getImageURL:function(a){return a.user_id&&a.user_id.includes("RS")?GameConfig.BASE_URL+"/res/AvatarImages/guestplayer.png":"https://graph.facebook.com/"+(GameConfig.SSO_ENABLED?a.fb_id:a.user_id.split("_")[1])+"/picture?typelarge\x26height\x3d500\x26width\x3d500\x26access_token\x3d"+RSGame.getInstance().getGameManager().getFBAccessToken()},_setPlayerProfileImageOf:function(a){a= new RSImageObject;a.setImageFromUrl(RSGame.getInstance().getUserDataManager().getMe().getImageUrlWithSize(500,500),this._profilePicMaskAreaOfRank1.x,this._profilePicMaskAreaOfRank1.y,this._profilePicMaskAreaOfRank1.w,this._profilePicMaskAreaOfRank1.h);a&&(this._mask=new RSClippingNode(RSUtils.createBasicObject(this._screenName,this._profilePicMaskAreaOfRank1)),this._mask.setAlphaThreshold(250),this._mask.addChild(a),this.addChild(this._mask))},_getFormattedName:function(a){var b=a.substr(0,1).toUpperCase(); return a=a.substr(0,0)+b+a.substr(1,a.length)},_setTop3PlayersOfSelectedLeaderboard:function(){var a=null,a=RSLeaderboard.getTop3PlayersOfLeaderboard(this._selectedLeaderboard),b=RSLeaderboardManager.getTopRewards().weekly;if(a.length){var c=0,d=null,d=null,e="";for(c in a){var c=parseInt(c),d=a[c],e=d.first_name?d.first_name:RSGame.getInstance().getGameManager().getUpdatedUserForDisplay(d.user_id),e=this._getFormattedName(e),f=d.avatar_id;"0"==f&&(f="");9<e.length&&(e=e.substring(0,9)+"...");if(d.user_id== RSEngine.dataManager.getMe().getId()){e="You";if(RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK||RSEngine.loginMode==LOGIN_MODE.FACEBOOK)d.fb_id=RSGame.getInstance().getUserDataManager().getMe().getFBId();f=RSEngine.dataManager.getMe().getAvatar()}switch(c){case 0:this._nameOfPlayerWithRank1.setString(e);this._rewardOfRank1&&this._rewardOfRank1.setString(RSUtils.formatNumberWithComma(b[0]));e=new RSImageObject;GameConfig.IS_EDIT_FIELDS_ENABLED&&f?(d=GameConfig.BASE_URL+"/res/AvatarImages/"+f+".png", e.setImageFromUrl(d,this._profilePicMaskAreaOfRank1.x,this._profilePicMaskAreaOfRank1.y,this._profilePicMaskAreaOfRank1.h,this._profilePicMaskAreaOfRank1.h),this._setMaskforRankUps(e,this._profilePicMaskAreaOfRank1),this._rankMask1.setVisible(!1)):RSEngine.loginMode!=LOGIN_MODE.WEB_FACEBOOK&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK||!(d.fb_id||d.user_id&&d.user_id.includes(GameConfig.USER_ID_PREFIX))?f&&(d=GameConfig.BASE_URL+"/res/AvatarImages/"+f+".png",e.setImageFromUrl(d,this._profilePicMaskAreaOfRank1.x, this._profilePicMaskAreaOfRank1.y,this._profilePicMaskAreaOfRank1.h,this._profilePicMaskAreaOfRank1.h),this._setMaskforRankUps(e,this._profilePicMaskAreaOfRank1),this._rankMask1.setVisible(!1)):(d=this.getImageURL(d),e.setImageFromUrl(d,this._profilePicMaskAreaOfRank1.x,this._profilePicMaskAreaOfRank1.y,this._profilePicMaskAreaOfRank1.h,this._profilePicMaskAreaOfRank1.h),this._setMaskforRankUps(e,this._profilePicMaskAreaOfRank1));break;case 1:this._nameOfPlayerWithRank2.setString(e);this._rewardOfRank2&& this._rewardOfRank2.setString(RSUtils.formatNumberWithComma(b[1]));e=new RSImageObject;GameConfig.IS_EDIT_FIELDS_ENABLED&&f?(d=GameConfig.BASE_URL+"/res/AvatarImages/"+f+".png",e.setImageFromUrl(d,this._profilePicMaskAreaOfRank2.x,this._profilePicMaskAreaOfRank2.y,this._profilePicMaskAreaOfRank2.h,this._profilePicMaskAreaOfRank2.h),this._setMaskforRankUps(e,this._profilePicMaskAreaOfRank2),this._rankMask2.setVisible(!1)):RSEngine.loginMode!=LOGIN_MODE.WEB_FACEBOOK&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK|| !(d.fb_id||d.user_id&&d.user_id.includes(GameConfig.USER_ID_PREFIX))?f&&(d=GameConfig.BASE_URL+"/res/AvatarImages/"+f+".png",e.setImageFromUrl(d,this._profilePicMaskAreaOfRank2.x,this._profilePicMaskAreaOfRank2.y,this._profilePicMaskAreaOfRank2.h,this._profilePicMaskAreaOfRank2.h),this._setMaskforRankUps(e,this._profilePicMaskAreaOfRank2),this._rankMask2.setVisible(!1)):(d=this.getImageURL(d),e.setImageFromUrl(d,this._profilePicMaskAreaOfRank2.x,this._profilePicMaskAreaOfRank2.y,this._profilePicMaskAreaOfRank2.h, this._profilePicMaskAreaOfRank2.h),this._setMaskforRankUps(e,this._profilePicMaskAreaOfRank2));break;case 2:(this._nameOfPlayerWithRank3.setString(e),this._rewardOfRank3&&this._rewardOfRank3.setString(RSUtils.formatNumberWithComma(b[2])),e=new RSImageObject,GameConfig.IS_EDIT_FIELDS_ENABLED&&f)?(d=GameConfig.BASE_URL+"/res/AvatarImages/"+f+".png",e.setImageFromUrl(d,this._profilePicMaskAreaOfRank3.x,this._profilePicMaskAreaOfRank3.y,this._profilePicMaskAreaOfRank3.h,this._profilePicMaskAreaOfRank3.h), this._setMaskforRankUps(e,this._profilePicMaskAreaOfRank3),this._rankMask3.setVisible(!1)):RSEngine.loginMode!=LOGIN_MODE.WEB_FACEBOOK&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK||!(d.fb_id||d.user_id&&d.user_id.includes(GameConfig.USER_ID_PREFIX))?f&&(d=GameConfig.BASE_URL+"/res/AvatarImages/"+f+".png",e.setImageFromUrl(d,this._profilePicMaskAreaOfRank3.x,this._profilePicMaskAreaOfRank3.y,this._profilePicMaskAreaOfRank3.h,this._profilePicMaskAreaOfRank3.h),this._setMaskforRankUps(e,this._profilePicMaskAreaOfRank3), this._rankMask3.setVisible(!1)):(d=this.getImageURL(d),e.setImageFromUrl(d,this._profilePicMaskAreaOfRank3.x,this._profilePicMaskAreaOfRank3.y,this._profilePicMaskAreaOfRank3.h,this._profilePicMaskAreaOfRank3.h),this._setMaskforRankUps(e,this._profilePicMaskAreaOfRank3))}}}},_setMaskforRankUps:function(a,b){a&&(this._mask=RSUtils.createBasicObject(this._screenName,b),this._mask.setZOrder(-1),this.mask=new RSClippingNode(this._mask),this.mask.setAlphaThreshold(100),this.mask.addChild(a),this.addChild(this.mask))}, _checkAndCreatePlayerLeaderboardItem:function(){this._createPlayerLeaderboardBar()},update:function(){var a=this._getTimeRemaining();a&&this._tournamentEndsText&&this._tournamentEndsText.setString(a);RSEngine.externalGameManager&&RSEngine.externalGameManager.hideExternalGame();if(this._playerLeaderboardItem&&this._currentPlayerItem){var a=this._scroller.getDisplayObject()._calculateItemPositionWithAnchor(this._scroller.getDisplayObject().getItem(this._playerIndex),{x:0,y:0}),b=this._scroller.getDisplayObject().getItem(this._playerIndex).getWorldPosition(); cc.log("Ypos:"+this._scroller.getDisplayObject().getItem(this._playerIndex)._position.y+"Y:"+a.y+":WorldPOs:"+b.y);cc.log("here");RSLeaderboard.getUserRank()&&(this._bottomRectShade.setVisible(!0),this._currentPlayerItem.setVisible(!0),b.y<=this._playerBottomRect.y?this._currentPlayerItem.setCenter(this._leaderboarPlayerHolder.x,this._playerBottomRect.y):(b.y>=this._leaderboarPlayerHolder.y?this._currentPlayerItem.setCenter(this._leaderboarPlayerHolder.x,this._leaderboarPlayerHolder.y):this._currentPlayerItem.setVisible(!1), this._bottomRectShade.setVisible(!1)))}else this._currentPlayerItem&&(this._currentPlayerItem.setVisible(!0),this._bottomRectShade.setVisible(!0));this._scroller&&(b=this._scroller.getDisplayObject().getItem(0).getWorldPosition(),b.y<this._topShadeData.y-this._topShadeData.h?this._topShade.setVisible(!1):this._topShade.setVisible(!0))},_getTimeRemaining:function(){var a=RSLeaderboard.getLeaderBoardEndTime()-TimeManager.getInstance().getCurrentServerTime();0>a&&!this._timerExpired&&2<=this._eventsCompleted&& (this._timerExpired=!0,RSLeaderboardManager.updateLeaderboardData(!0,!0));return 86400>a?RSUtils.formattedTime(a):~~(a/86400)+1+" Days"},_initializeRankUpAnimations:function(){this._createLeaderboardPlayersDataForScrolling();GlobalVars.musicStatus&&RSEngine.audioManager.muteMusic();RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("RSLeaderboardScreen")+"Scroll.mp3",!1)},_createPlayerLeaderboardBar:function(){var a={},a=RSLeaderboard.getUserCurrentData();null==a&&(a={},a.avatar_id= RSEngine.dataManager.getMe().getAvatar(),a.user_id=RSEngine.dataManager.getMe().getId(),a.first_name=RSEngine.dataManager.getMe().getUserFirstName(),a.coins=RSLeaderboard.getUserWinCoin(),a.rank=parseInt(RSLeaderboard.getUserRank()),a.reward=0);a.fb_id=null;if(RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK||RSEngine.loginMode==LOGIN_MODE.FACEBOOK)a.fb_id=RSGame.getInstance().getUserDataManager().getMe().getFBId();this._currentPlayerItem=new RSLeaderboardItem(this._leaderboarPlayerHolder,a);this.addChild(this._currentPlayerItem); this._currentPlayerItem.setZOrder(3);this._currentPlayerItem.setCenter(this._playerBottomRect.x,this._playerBottomRect.y)},_createLeaderboardPlayersDataForScrolling:function(){var a=0,b=null;this._rankUpScroller=new RSBarScroller(new RSRect(this._leaderboardHolder.x,this._leaderboardHolder.y,this._leaderboardHolder.w,6*this._leaderboardHolder.h),new RSSize(this._leaderboarPlayerHolder.w,this._leaderboarPlayerHolder.h),0,RSScrollerDirection.RSSCROLLER_VERTICAL,1);for(a=0;50>a;a++)b=new RSLeaderboardItem(this._leaderboarPlayerHolder, null,!0),this._rankUpScroller.addChild(b);this._rankUpPanel=new RSPanel(this._leaderboardHolder.x,this._leaderboardHolder.y,this._leaderboardHolder.w,this._leaderboardHolder.h);this._rankUpScrollPanel=new RSPanel(this._leaderboardHolder.x-172,this._leaderboardHolder.y+2.3*this._leaderboardHolder.h,this._leaderboardHolder.w,this._leaderboardHolder.h);this._rankUpScrollPanel.addChild(this._rankUpScroller);this.addChild(this._rankUpPanel);this._rankUpPanel.setZOrder(2);this._rankUpPanel.addChild(this._rankUpScrollPanel); this._rankUpPanel.setClippingEnabled(!0)},_startLeaderboardRankUpdateAnimation:function(){this._playerItemGlowAnimRight.setY(this._leaderboarPlayerHolder.y-33);this._playerItemGlowAnimLeft.setY(this._leaderboarPlayerHolder.y-33);this._playerItemGlowAnimLeft.setVisible(!0);this._playerItemGlowAnimRight.setVisible(!0);this._playerItemGlowAnimLeft.playAnimation(1,0.3,this._onGlowAnimCompleted.bind(this));this._playerItemGlowAnimRight.playAnimation(1,0.3);this._playAnticipationAnim()},_playAnticipationAnim:function(){this._scroller.setVisible(!1); this._rankUpScrollPanel.actionMoveBy(2,0,this._rankUpScrollPanel.getY()-7*this._leaderboardHolder.h,this._onAnticipationAnimCompleted.bind(this));this.scheduleFunctionOnce(this._scrollPlayerDataToSecondPosition.bind(this),1)},_onAnticipationAnimCompleted:function(){this._rankUpScroller.removeAllChildren();this._rankUpPanel.setVisible(!1);GlobalVars.musicStatus&&RSEngine.audioManager.unMuteMusic()},_onGlowAnimCompleted:function(){this._scroller.setVisible(!0);this._playerItemGlowAnimLeft.setVisible(!1); this._playerItemGlowAnimRight.setVisible(!1)},_scrollPlayerDataToSecondPosition:function(){},_startPlayingPlayerRollUpAnimations:function(){this._currentPlayerItem.rollUpPlayerData(RSLeaderboard.getUserCurrentData())},_showBadgeAnimations:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("RSLeaderboardScreen")+"Top.mp3",!1);switch(RSLeaderboard.getUserRank()){case 1:this._rankAnim1Right.playAnimation(1,0.3,this._onBadgeAnimationCompleted.bind(this));this._rankAnim1Left.playAnimation(1, 0.3);break;case 2:this._rankAnim2Left.playAnimation(1,0.3,this._onBadgeAnimationCompleted.bind(this));this._rankAnim2Right.playAnimation(1,0.3);break;case 3:this._rankAnim3Left.playAnimation(1,0.3,this._onBadgeAnimationCompleted.bind(this)),this._rankAnim3Right.playAnimation(1,0.3)}},_onBadgeAnimationCompleted:function(){this._rankAnim1Right.setVisible(!1);this._rankAnim1Left.setVisible(!1);this._rankAnim2Left.setVisible(!1);this._rankAnim2Right.setVisible(!1);this._rankAnim3Left.setVisible(!1);this._rankAnim3Right.setVisible(!1)}, _startPlayingRankUpParticleAnimation:function(){var a=null;switch(RSLeaderboard.getUserRank()){case 1:a=this._rankUpAnimHolder1;break;case 2:a=this._rankUpAnimHolder2;break;case 3:a=this._rankUpAnimHolder3}var b=RSGame.getInstance().getAssetPath("MachineOpenPopupParticle");cc.spriteFrameCache.addSpriteFrames(b);b=new RSEmitterParticleParams;b._spriteFrames.push("StarEmitter_00/StarEmitter_0000.png");b._startDelay=0.2;b._startDelayVariance=0.5;b._deviation=60;b._deviationVariance=50;b._speed=50;b._360rotationDuration= 0.5;b._tweenRate=0.5;b._spriteAnimationSpeed=0.4;b._origin=a;b._originVariance=new RSPoint(100,100);b._displacement=new RSPoint(0,0);b._displacementVariance=new RSPoint(50,50);b._fadeOutDuration=0.1;b._fadeOutDurationVariance=0.8;b._fadeInDuration=0.8;b._startScale=0.8;b._startScaleVariance=0.2;b._endScale=0;b._endScaleVariance=0.2;this._particleEmitter=new RSCustomAnimationEmitter(b,!0,RSCustomEmitterType.CLUSTER_MOVEMENT,20,null);this._rankUpAnimHolder1Panel.addChild(this._particleEmitter);this._particleEmitter.loadEmitter(); this._particleEmitter.startEmitter();this._particleEmitter.setZOrder(1)},unloadContent:function(){this._scroller&&this._scroller.removeAllChildren();RSEventManager.getInstance().removeEventListenersIn(this);this._isOpenedOnClick||!RSLeaderboardManager.getBackButtonStatus()||this._refreshStatus||RSEventManager.getInstance().dispatchEvent("onUserRankUp");this._super.unloadContent.call(this);GlobalVars.musicStatus&&RSEngine.audioManager.unMuteMusic()}});var RSLeaderboardItem=RSDisplayObject.extend({_rank:0,_imageUrl:"",_name:"",_value:0,_gameType:"",_cellType:"",_enableBlurBg:!1,_winAmountValue:0,_rewardAmountValue:0,_rank:0,_disableVisibility:!1,init:function(a,b,c,d){a=new RSRect(0,0,a.w,a.h);this._playerData=b;c&&(this._enableBlurBg=c);d&&(this._disableVisibility=d);this._super.init.call(this,a);this._newLeaderboardCustomisedFont=RSGame.getInstance().getGameManager().getNewLeaderboardFonts();this._newFontForPlayerName=this._newLeaderboardCustomisedFont.playerNameFont? this._newLeaderboardCustomisedFont.playerNameFont:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","normal");this.loadContent()},loadContent:function(){this.loadLayout(RSGame.getInstance().getAssetPath("LeaderboardItem"))},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._enableBlurBg||this._setProfileImage();this._playerData.user_id==RSEngine.dataManager.getMe().getId()||this._playerData.id==RSEngine.dataManager.getMe().getId()?this._playerItemGlowAnim.playAnimation(2, 0.5,this._onGlowAnimationCompleted.bind(this)):this._disableVisibility&&this.setVisible(!1)},createCustomObject:function(a,b){switch(b.name){case "Rank":var c="--";!this._enableBlurBg&&this._playerData&&this._playerData.rank&&(c=this._playerData.rank,-1==c&&(c="--"));this._playerRank=new RSScaledLabel(c,this._newLeaderboardCustomisedFont.playerCellRankFont?this._newLeaderboardCustomisedFont.playerCellRankFont:RSGame.getInstance().getGameManager().getDefaultCasinoFont("Semi","Bold"),b,kTEXT_ALIGNMENT_CENTER); this.addChild(this._playerRank);break;case "PlayerName":c="";!this._enableBlurBg&&this._playerData&&this._playerData.first_name?c=this._getFormattedName(this._playerData.first_name):!this._enableBlurBg&&this._playerData&&this._playerData.user_id&&(c=RSGame.getInstance().getGameManager().getUpdatedUserForDisplay(this._playerData.user_id));!this._enableBlurBg&&this._playerData&&this._playerData.name?c=this._getFormattedName(this._playerData.name):!this._enableBlurBg&&this._playerData&&this._playerData.id&& (c=RSGame.getInstance().getGameManager().getUpdatedUserForDisplay(this._playerData.id));9<c.length&&(c=c.substring(0,9)+"..");this._playerData&&this._playerData.user_id&&this._playerData.user_id==RSEngine.dataManager.getMe().getId()&&(c="You");this._playerData&&this._playerData.id&&this._playerData.id==RSEngine.dataManager.getMe().getId()&&(c="You");this._playerName=new RSScaledLabel(c,this._newFontForPlayerName,b,kTEXT_ALIGNMENT_LEFT);this.addChild(this._playerName);break;case "RewardText":c=" "; !this._enableBlurBg&&this._playerData&&this._playerData.reward&&(c=this._playerData.reward);this._rewardAmount=new RSScaledLabel(RSUtils.formatNumberWithComma(c),RSGame.getInstance().getGameManager().getDefaultCasinoFont("Semi","Bold"),b,kTEXT_ALIGNMENT_LEFT);this.addChild(this._rewardAmount);break;case "WinAmountText":var c=0,d="0";!this._enableBlurBg&&this._playerData&&this._playerData.coins&&(c=this._playerData.coins);!this._enableBlurBg&&this._playerData&&this._playerData.win&&(c=this._playerData.win); d=11<c.toString().length?this._getNumberFormattedAfterLimit(c):RSUtils.formatNumberWithComma(c);this._winAmount=new RSScaledLabel(d,this._newLeaderboardCustomisedFont.playerCellWinAmountFont?this._newLeaderboardCustomisedFont.playerCellWinAmountFont:RSGame.getInstance().getGameManager().getDefaultCasinoFont("Semi","Bold"),b,kTEXT_ALIGNMENT_LEFT);this.addChild(this._winAmount);break;case "ProfilePicMask":this._profilePicMask=b;break;case "PlayerItemGlowAnim":if(this._playerData.user_id==RSEngine.dataManager.getMe().getId()|| this._playerData.id==RSEngine.dataManager.getMe().getId())this._playerItemGlowAnim=RSUtils.createAnimation(a,b,0.5),this._playerItemGlowAnim.stopAnimation(),this._playerItemGlowAnim.setZOrder(4),this.addChild(this._playerItemGlowAnim);break;case "RankUp":"1"!=RSEngine.gameData.getDefaultValues().isPlayerNameFormatEnabled&&0==parseInt(this._playerData.reward)&&(this._playerItemRankUP=RSUtils.createBasicObject(a,b),this.addChild(this._playerItemRankUP));break;case "RankUpAnim":"1"!=RSEngine.gameData.getDefaultValues().isPlayerNameFormatEnabled&& this._playerData.user_id==RSEngine.dataManager.getMe().getId()&&0==parseInt(this._playerData.reward)&&(this._playerItemRankUPAnim=RSUtils.createAnimation(a,b,0.5),this.addChild(this._playerItemRankUPAnim))}},onObjectCreated:function(a,b,c){switch(c.name){case "LeaderboardItemBg":this._leaderboardBgAnimation=a;this._leaderboardBgAnimation.stopAnimation();this._enableBlurBg?(this._leaderboardBgAnimation.setFrame(2),this._leaderboardBgAnimation.setZOrder(2)):this._playerData.user_id!=RSEngine.dataManager.getMe().getId()&& this._playerData.id!=RSEngine.dataManager.getMe().getId()||this._leaderboardBgAnimation.setFrame(1);break;case "ProfileBase":this._profileImageBase=a;this._profilePicMaskArea=c;this._screenName=b;break;case "ProfileMask":this._profileMask=a;this._profileMask.stopAnimation();this._enableBlurBg||this._playerData.user_id==RSEngine.dataManager.getMe().getId()||this._playerData.id==RSEngine.dataManager.getMe().getId()?this._profileMask.setFrame(1):this._profileMask.setFrame(0);break;case "ProfileBorder":this._profileBorder= a;this._profileBorder.setVisible(!0);this._profileBorder.setZOrder(10);break;case "Trophy":this._trophyAnim=a;this._trophyAnim.stopAnimation();this._playerData&&this._playerData.rank&&3>=this._playerData.rank&&-1!=this._playerData.rank?this._trophyAnim.setFrame(this._playerData.rank-1):this._trophyAnim.setVisible(!1);break;case "Tag":this._tagAnim=a,this._tagAnim.stopAnimation(),-1==this._playerData.rank?this._tagAnim.setVisible(!1):this._playerData&&this._playerData.rank&&3>=this._playerData.rank? this._tagAnim.setFrame(this._playerData.rank-1):this._playerData&&this._playerData.rank&&10>=this._playerData.rank?this._tagAnim.setFrame(3):this._tagAnim.setVisible(!1)}},_setProfileImage:function(){if(this._playerData.isTournament&&1==this._playerData.isTournament){var a=new RSImageObject;if(this._playerData.user_id==RSEngine.dataManager.getMe().getId()||this._playerData.id==RSEngine.dataManager.getMe().getId())b=RSGame.getInstance().getUserDataManager().getMe().getImageUrl(),b.includes("guestplayer.png")? this._profileImageBase.setVisible(!0):(this._profileImageBase.setVisible(!1),a.setImageFromUrl(b,this._profilePicMask.x,this._profilePicMask.y,this._profilePicMask.w,this._profilePicMask.h));else if(!GameConfig.IS_EDIT_FIELDS_ENABLED||0==RSEngine.dataManager.getMe().getAvatar()||this._playerData.imageURL.includes("graph.facebook.com")||""==this._playerData.imageURL||"1180"==this._playerData.imageURL||1E3<parseInt(this._playerData.imageURL))if(""==this._playerData.imageURL||"1180"==this._playerData.imageURL)this._profileImageBase.setVisible(!0); else if(-1!=this._playerData.imageURL.indexOf("graph.facebook.com"))RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK||RSEngine.loginMode==LOGIN_MODE.FACEBOOK?a.setImageFromUrl(this._playerData.imageURL+"\x26access_token\x3d"+RSGame.getInstance().getGameManager().getFBAccessToken(),this._profilePicMask.x,this._profilePicMask.y,this._profilePicMask.w,this._profilePicMask.h):this._profileImageBase.setVisible(!0);else if(this._playerData.imageURL.endsWith(".png"))a.setImageFromUrl(this._playerData.imageURL, this._profilePicMask.x,this._profilePicMask.y,this._profilePicMask.w,this._profilePicMask.h);else{if(1E3<parseInt(this._playerData.imageURL))a.setImageFromUrl(GameConfig.BASE_URL+"/res/PlatformWidgets/RSTournament/BotImages/"+this._playerData.imageURL+".png",this._profilePicMask.x,this._profilePicMask.y,this._profilePicMask.w,this._profilePicMask.h),a.setScale(0.32);else{var b=GameConfig.BASE_URL+"/res/AvatarImages/"+this._playerData.imageURL+".png";this._playerData&&this._playerData.id==RSEngine.dataManager.getMe().getId()&& (b=GameConfig.BASE_URL+"/res/AvatarImages/"+RSEngine.dataManager.getMe().getAvatar()+".png");a.setImageFromUrl(b,this._profilePicMask.x,this._profilePicMask.y,this._profilePicMask.w,this._profilePicMask.h)}a.setCenter(this._profilePicMask.x,this._profilePicMask.y);this._profileImageBase.setVisible(!1)}else b=this._playerData&&this._playerData.user_id==RSEngine.dataManager.getMe().getId()?GameConfig.BASE_URL+"/res/AvatarImages/"+RSEngine.dataManager.getMe().getAvatar()+".png":GameConfig.BASE_URL+"/res/AvatarImages/"+ this._playerData.imageURL+".png",a.setImageFromUrl(b,this._profilePicMask.x,this._profilePicMask.y,this._profilePicMask.w,this._profilePicMask.h),this._profileImageBase.setVisible(!1)}else a=new RSImageObject,b=this._playerData.avatar_id,"0"==b&&(b=""),this._playerData.user_id==RSEngine.dataManager.getMe().getId()||this._playerData.id==RSEngine.dataManager.getMe().getId()?(b=RSGame.getInstance().getUserDataManager().getMe().getImageUrl(),b.includes("guestplayer.png")?this._profileImageBase.setVisible(!0): (this._profileImageBase.setVisible(!1),a.setImageFromUrl(b,this._profilePicMask.x,this._profilePicMask.y,this._profilePicMask.w,this._profilePicMask.h))):GameConfig.IS_EDIT_FIELDS_ENABLED&&b?(this._playerData&&this._playerData.user_id==RSEngine.dataManager.getMe().getId()&&(b=RSEngine.dataManager.getMe().getAvatar()),b=GameConfig.BASE_URL+"/res/AvatarImages/"+b+".png",a.setImageFromUrl(b,this._profilePicMask.x,this._profilePicMask.y,this._profilePicMask.w,this._profilePicMask.h),this._profileImageBase.setVisible(!1)): (RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK||RSEngine.loginMode==LOGIN_MODE.FACEBOOK)&&GameConfig.SSO_ENABLED&&this._playerData.fb_id?(b=this.getImageURL(),a.setImageFromUrl(b,this._profilePicMask.x,this._profilePicMask.y,this._profilePicMask.w,this._profilePicMask.h)):b?(this._playerData&&this._playerData.user_id==RSEngine.dataManager.getMe().getId()&&(b=RSEngine.dataManager.getMe().getAvatar()),b=GameConfig.BASE_URL+"/res/AvatarImages/"+b+".png",a.setImageFromUrl(b,this._profilePicMask.x,this._profilePicMask.y, this._profilePicMask.w,this._profilePicMask.h),this._profileImageBase.setVisible(!1)):this._profileImageBase.setVisible(!0);a&&this.addChild(a);this._profileMask.setZOrder(2)},getImageURL:function(){return this._playerData.user_id&&this._playerData.user_id.includes("RS")?GameConfig.BASE_URL+"/res/AvatarImages/guestplayer.png":"https://graph.facebook.com/"+(GameConfig.SSO_ENABLED?this._playerData.fb_id:this._playerData.user_id.split("_")[1])+"/picture?type\x3dsquare\x26access_token\x3d"+RSGame.getInstance().getGameManager().getFBAccessToken()}, rollUpPlayerData:function(a){a&&(this.startActionTweenForKey("CoinRollUp",2,this._playerData.coins,parseInt(a.coins)),this.startActionTweenForKey("RankRollUp",2,this._playerData.rank,parseInt(a.rank)))},actionOnUpdate:function(a,b){switch(a){case "CoinRollUp":this._winAmountValue=isNaN(Math.floor(b))?0:Math.floor(b);this._winAmount.setString(RSUtils.formatNumberWithComma(this._winAmountValue));break;case "RankRollUp":this._rank=isNaN(Math.floor(b))?0:Math.floor(b),this._playerRank.setString(RSUtils.formatNumberWithComma(this._rank))}}, actionOnComplete:function(a){this.stopWinRollUp(a)},stopWinRollUp:function(a){switch(a){case "CoinRollUp":this.stopActionTweenForKey("CoinRollUp");this._winAmount.setString(RSUtils.formatNumberWithComma(this._winAmountValue));break;case "RankRollUp":this.stopActionTweenForKey("RankRollUp"),this._playerRank.setString(RSUtils.formatNumberWithComma(this._rank))}},_onGlowAnimationCompleted:function(){this._playerItemGlowAnim.setVisible(!1)},_getFormattedName:function(a){var b=a.substr(0,1).toUpperCase(); return a=a.substr(0,0)+b+a.substr(1,a.length)},_getNumberFormattedAfterLimit:function(a){a=Math.floor(parseInt(a)/1E6);var b="M";10<a.toString().length&&(a=Math.floor(parseInt(a)/1E9),b="B");return RSUtils.formatNumberWithComma(a)+b}});var RSLeaderboardCongratulationsPopup=RSGenericPopup.extend({init:function(a,b){this._assetList=[{name:RSGame.getInstance().getAssetPath("RSLeaderboardCongratulationsPopup"),count:1}];var c=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(c);this._newLeaderboardFontCustomised=RSGame.getInstance().getGameManager().getNewLeaderboardFonts();this._positionFont=RSGame.getInstance().getGameManager().getDefaultCasinoFont("largePurple","normal")?RSGame.getInstance().getGameManager().getDefaultCasinoFont("largePurple", "normal"):RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","normal");this._newPositionFont=this._newLeaderboardFontCustomised.semiText?this._newLeaderboardFontCustomised.semiText:this._positionFont;this._newFontForRank=this._newLeaderboardFontCustomised.rankFont?this._newLeaderboardFontCustomised.rankFont:this._newPositionFont;this._super.init.call(this);this._leaderboardPosition=a;this._rewardId=b;this._rewardClaimed=!1;this._claimLeaderboardReward();this.scheduleFunctionOnce(this._onRewardClaimed.bind(this), 5)},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.addChild(this._diplayPanel);this._setPopupTexts()},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CloseBtn":this._closeButton=a}switch(c.type){case "CP_Button_T1":this._awesomeBtn=a}},createCustomObject:function(a,b){switch(b.name){case "RSLeaderboardCongratulationsTitle":var c= RSGame.getInstance().getGameData().getPopupTextWithKey(b.name),d=RSGame.getInstance().getGameManager().getDefaultCasinoFont("largePink","bold")?RSGame.getInstance().getGameManager().getDefaultCasinoFont("largePink","bold"):RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),c=new RSLabelBMFont(c,this._newLeaderboardFontCustomised.title?this._newLeaderboardFontCustomised.title:d,b,kTEXT_ALIGNMENT_CENTER);c.setCenter(b.x,b.y);this.addChild(c);break;case "LeaderboardPositionTxt":c= RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);c=c.replace("{}",this._leaderboardPosition.rank);this._leaderboardPositionText=new RSLabelBMFont("",this._newPositionFont,b,kTEXT_ALIGNMENT_CENTER);this._leaderboardPositionText.setCenter(b.x,b.y);this.addChild(this._leaderboardPositionText);this._leaderboardPositionText.setString(c);break;case "LeaderboardWinTxt":c=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);this._leaderboardWinText=new RSLabelBMFont(c,this._newPositionFont, b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._leaderboardWinText);this._leaderboardWinText.setCenter(b.x,b.y);break;case "LeaderboardWinAmount":c=RSGame.getInstance().getGameManager().getDefaultCasinoFont("largePurple","bold")?RSGame.getInstance().getGameManager().getDefaultCasinoFont("largePurple","bold"):RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold");this._leaderboardWinAmt=new RSScaledLabel("",this._newLeaderboardFontCustomised.amount?this._newLeaderboardFontCustomised.amount: c,b,this._newLeaderboardFontCustomised.WinAmountAlignment?this._newLeaderboardFontCustomised.WinAmountAlignment:kTEXT_ALIGNMENT_LEFT);this.addChild(this._leaderboardWinAmt);break;case "RSLeaderboardCongratulationsNewTitle":c=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);d=RSGame.getInstance().getGameManager().getDefaultCasinoFont("largePink","bold")?RSGame.getInstance().getGameManager().getDefaultCasinoFont("largePink","bold"):RSGame.getInstance().getGameManager().getDefaultCasinoFont("large", "bold");c=new RSLabelBMFont(c,this._newLeaderboardFontCustomised.title?this._newLeaderboardFontCustomised.title:d,b,kTEXT_ALIGNMENT_CENTER);"UP"==GameConfig.GAME_ID?c.setScale(0.85):c.setScale(0.75);c.setCenter(b.x,b.y);this.addChild(c);break;case "LeaderboardMainTxt":c=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);this._finishedtxt=new RSLabelBMFont(c,this._newPositionFont,b,kTEXT_ALIGNMENT_CENTER);this._finishedtxt.setScale(0.6);this._finishedtxt.setCenter(b.x,b.y);this.addChild(this._finishedtxt); break;case "LeaderboardWinNumberTxt":c=this._leaderboardPosition.rank;this._wintxt=new RSScaledLabel(c,this._newFontForRank,b,kTEXT_ALIGNMENT_RIGHT);9<this._leaderboardPosition.rank?this._wintxt.setCenter(b.x+0.16*b.w,b.y):this._wintxt.setCenter(b.x,b.y);this.addChild(this._wintxt);break;case "LeaderboardOrdIndTxt":this._thtxt=new RSScaledLabel("TH",this._newFontForRank,b,kTEXT_ALIGNMENT_CENTER),9<this._leaderboardPosition.rank?this._thtxt.setCenter(b.x+0.18*b.w,b.y):this._thtxt.setCenter(b.x,b.y), this.addChild(this._thtxt)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":this._closeButton.setTouchEnabled(!1);this._onRewardClaimed();break;case "CP_Button_T1":case "CollectBtn":this._onRewardClaimed()}},_setPopupTexts:function(){this._leaderboardPosition.energy?this._leaderboardWinAmt.setString(RSUtils.formatNumber(this._leaderboardPosition.energy)):this._leaderboardWinAmt.setString(RSUtils.formatNumberWithComma(this._leaderboardPosition.coins))}, _claimLeaderboardReward:function(){RSGame.getInstance().getUserDataManager().claimRewardFromRewardManager(this._rewardId,this._onClaimRewardResponse.bind(this))},_onClaimRewardResponse:function(a){this._rewardClaimed=!0;var b=parseInt((TimeManager.getInstance().getCurrentServerTime()-this._leaderboardPosition.startTime)/86400)+1;RSAnalyticsManager.getInstance().trackGUIEvent("leaderboard","win","collect",this._leaderboardPosition.rank,"day"+b);var c=this._leaderboardPosition.energy?this._leaderboardPosition.energy: this._leaderboardPosition.coins;a.result&&a.result.status&&200==a.result.status&&(RSCasinoManager.addPrimaryCurrencyForDisplay("Leaderboard_Reward",parseInt(c)),RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"leaderboard_win",c,this._leaderboardPosition.rank,"day"+b))},_onRewardClaimed:function(){this._rewardClaimed&&(RSRewardManager.onRewardPopupClosed("Leaderboard"),this.closePopup("close"))},closePopup:function(a){this._super.closePopup.call(this);RSLeaderboardManager.getLeaderboardTriggerStatus()&& RSLeaderboardManager.showLeaderboardScreen()}});var RSLeaderboard={_seasonal:[],_weekly:[],_daily:[],_user:{},_localCoins:{weekly_Rank:0,daily_Rank:0,seasonal_Rank:0},_topOfLeaderboardPlayers:{daily:[],weekly:[],seasonal:[]},_userDataOld:{},rankUpdateStatus:{rankUpdateStatus:!1,updatedleaderboard:""},_leaderboardResetTime:0,_coinsToBeUpdated:0,_oldDataStored:!1,_updateLevelBucket:!1,_updateUserData:!1,_oldWeeklyData:[],_updatedRank:0,_showRankUpScreen:!1,setLocalData:function(a){this.rankUpdateStatus.rankUpdateStatus||(this._oldWeeklyData=RSUtils.cloneJSON(this._weekly)); this._weekly=a.weekly.data?a.weekly.data:[];this._setTopOfLeaderboardPlayers()},setUserData:function(a){this._updateUserData=!1;this._leaderboardResetTime=a.endTime;this.rankUpdateStatus.rankUpdateStatus||(this._userDataOld=RSUtils.cloneJSON(this._user));this._user=a;this._localCoins[RSLeaderboardTimeRange.WEEKLY]=this._user.weekly.coins;this._localCoins[RSLeaderboardTimeRange.WEEKLY+"_Rank"]=this._user.weekly.userRank;this._checkUserRankUpdationStatus();cc.log("user data setting start from here"); cc.log("user data setting completed")},checkLeaderBoard:function(a){var b;a>this._localCoins[RSLeaderboardTimeRange.WEEKLY]&&(this._localCoins[RSLeaderboardTimeRange.WEEKLY]=a,b=RSLeaderboardTimeRange.WEEKLY);"CUMMULATIVE_WIN"==GameConfig.WIN_TYPE&&(b=RSLeaderboardTimeRange.WEEKLY);return b},setUserLeaderBoardData:function(a,b){if(RSEngine.loginMode!=LOGIN_MODE.GUEST&&0!=a)if(b&&(this._coinsToBeUpdated=0),this.getLeaderboardResetStatus()&&!b)this._coinsToBeUpdated=a,RSLeaderboardManager.updateLeaderboardData(); else{var c=this.checkLeaderBoard(a);if(null!=c){this._updateUserData=!0;var d=RSLeaderboardManager.getLeaderboardBucket()[c];RSGame.getInstance().getUserDataManager().setLeaderBoard(a,c,d,this._onLeaderboardSetResponse.bind(this))}}},_onLeaderboardSetResponse:function(a,b){if(b)RSPlatformSDKManager.getInstance().setUserAttributeLeaderboardRank(parseInt(a));else{(this._updatedRank=parseInt(a))&&RSPlatformSDKManager.getInstance().setUserAttributeLeaderboardRank(this._updatedRank);if(this._updatedRank< this.getUserRank()||0==this.getUserRank())this._showRankUpScreen=!0;RSEventManager.getInstance().dispatchEvent(RSLeaderboardEvents.LEADERBOARD_UPDATED,null)}},_setTopOfLeaderboardPlayers:function(){this._topOfLeaderboardPlayers={daily:[],weekly:[],seasonal:[]};this._weekly.length&&this._addTop3PlayersOf("weekly",this._weekly)},_addTop3PlayersOf:function(a,b){for(var c=0,c=0;3>c;c++)b[c]?this._topOfLeaderboardPlayers[a].push(b[c]):""},getDailyLeaderboardData:function(){return this._daily},getWeeklyLeaderboardData:function(){return this._weekly}, getSeasonalLeaderboardData:function(){return this._seasonal},getUserDailyLeaderboardData:function(){},getUserWeeklyLeaderboardData:function(){},getUserSeasonalLeaderboardData:function(){},getLeaderboardDataOf:function(a){var b=null;switch(a){case RSLeaderboardTimeRange.WEEKLY:b=this._weekly}return b},getTop3PlayersOfLeaderboard:function(a){return this._topOfLeaderboardPlayers[a]},_checkUserRankUpdationStatus:function(){if(Object.keys(this._userDataOld).length){if((this._userDataOld.weekly.userRank> this._localCoins[RSLeaderboardTimeRange.WEEKLY+"_Rank"]||0==this._userDataOld.weekly.userRank&&0<this._localCoins[RSLeaderboardTimeRange.WEEKLY+"_Rank"])&&!this.rankUpdateStatus.rankUpdateStatus){if(RSLeaderboardManager.getLeaderboardResettingStatus()){RSLeaderboardManager.resetLeaderboardResettingStatus();return}this.rankUpdateStatus.rankUpdateStatus=!0;this.rankUpdateStatus.updatedleaderboard=RSLeaderboardTimeRange.WEEKLY}else this.rankUpdateStatus.rankUpdateStatus=!1;cc.log("Rank update check completed")}}, getDataToBeUpdated:function(){return this._coinsToBeUpdated},getRankUpdateStatus:function(){return this.rankUpdateStatus},resetRankUpdateStatus:function(){this.rankUpdateStatus={rankUpdateStatus:!1,updatedleaderboard:"",oldDataUpdated:!1}},getLevelBucketUpdateStatus:function(){return this._updateLevelBucket},setLevelBucketUpdateStatus:function(){this._updateLevelBucket=!0},resetLevelBucketUpdateStatus:function(){this._updateLevelBucket=!1},getLeaderBoardEndTime:function(){return this._leaderboardResetTime}, getUserRank:function(){return this._localCoins[RSLeaderboardTimeRange.WEEKLY+"_Rank"]},getUserWinCoin:function(){return this._localCoins[RSLeaderboardTimeRange.WEEKLY]},getUpdatedRank:function(){return this._updatedRank},getUserDataUpdateStatus:function(){return this._updateUserData},getOldUserData:function(){var a=0,b="levelBucket"+RSLeaderboardManager.getLeaderboardBucket().weekly;for(a in this._oldWeeklyData)if(this._oldWeeklyData[a].user_id==RSEngine.dataManager.getMe().getId()){var c=this._oldWeeklyData[a]; c.rank=parseInt(a)+1;c.reward=RSLeaderboardManager.getRewardForLeaderboard(RSLeaderboardTimeRange.WEEKLY,b,a+1);return c}return null},getUserCurrentData:function(){var a=0,b="levelBucket"+RSLeaderboardManager.getLeaderboardBucket().weekly;for(a in this._weekly)if(this._weekly[a].user_id==RSEngine.dataManager.getMe().getId()){var c=this._weekly[a];c.rank=parseInt(a)+1;c.reward=9>=a?RSLeaderboardManager.getRewardForLeaderboard(RSLeaderboardTimeRange.WEEKLY,b,a+1):0;return c}return null},getOldWeeklyData:function(){return this._oldWeeklyData}, _getUserRank:function(){return this._userDataOld&&this._userDataOld.weekly?this._userDataOld.weekly.userRank:"0"},getLeaderboardResetStatus:function(){var a=TimeManager.getInstance().getCurrentServerTime()+7;return this._leaderboardResetTime<a?!0:!1},getRankUpTriggerStatus:function(){return this._showRankUpScreen},resetRankUpTriggerStatus:function(){this._showRankUpScreen=!1}};var RSLeaderboardInfoPopup=RSGenericPopup.extend({init:function(a){this._assetList=[{name:RSGame.getInstance().getAssetPath("RSLeaderboardInfoPopup"),count:1}];var b=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(b);this._infoText=a;this._super.init.call(this);this._rank=RSLeaderboard.getUserRank()},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.addChild(this._diplayPanel)}, onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CloseBtn":this._closeButton=a}switch(c.type){case "CP_Button_T1":this._awesomeBtn=a}},createCustomObject:function(a,b){switch(b.type){case "Title":var c=RSGame.getInstance().getStringDictionary("RSLeaderboardInfoPopup").H1,c=new RSLabelBMFont(c,RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),2*b.w,kTEXT_ALIGNMENT_CENTER);c.setScale(0.5);this.addChild(c);c.setCenter(b.x,b.y); break;case "Text":c=b.name.split("InfoText")[1],c=new RSLabelBMFont(this._infoText[c-1].infoText,RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),2*b.w,kTEXT_ALIGNMENT_LEFT),c.setScale(0.5),this.addChild(c),c.setCenter(b.x-b.w/2,b.y)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":RSAnalyticsManager.getInstance().trackPlayerAction("leaderboard_info","close","open_from_leaderboard",this._rank,"");this._closeButton.setTouchEnabled(!1); this.closePopup("close");break;case "CP_Button_T1":RSAnalyticsManager.getInstance().trackPlayerAction("leaderboard_info","close","open_from_leaderboard",this._rank,""),this.closePopup()}},closePopup:function(a){this._infoText=[];this._super.closePopup.call(this)}});var RSLeaderboardRewardScreen=RSLeaderboardBgScreen.extend({init:function(a,b,c,d,e){this._callBack=d;this._rewardData=b;this._reward=this._rewardData.energy?this._rewardData.energy:this._rewardData.coins;this._fireWorkArray=[];this._colourSet=RSLeaderboardManager.getFireworkColorCode();this._rewardId=c;this._rewardType=e;this._badgePanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this._coinStackPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/ 4,RSEngine.screenWidth,RSEngine.screenHeight);this._super.init.call(this,a);this._particleEmitter=null;this._count=0;this._claimLeaderboardReward();this._counter=0},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){switch(b.name){case "RewardAmount":var c=RSGame.getInstance().getGameManager().getNewLeaderboardFonts().amount?RSGame.getInstance().getGameManager().getNewLeaderboardFonts().amount:RSGame.getInstance().getGameManager().getHUDCasinoFont("large", "bold");this._rewardAmount=new RSLabelBMFont("",c,2*b.w,kTEXT_ALIGNMENT_CENTER);this._rewardAmount.setScale(0.65);this._rewardAmount.setCenter(b.x,b.y);this.addChild(this._rewardAmount);this._rewardAmount.setVisible(!1);break;case "RewardName":var c=RSGame.getInstance().getGameManager().getNewLeaderboardFonts().rewardWinnerFont?RSGame.getInstance().getGameManager().getNewLeaderboardFonts().rewardWinnerFont:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),d="You";9<=d.length&& (d=d.substring(0,9)+"..");this._playerName=new RSScaledLabel(d,c,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._playerName);this._playerName.setVisible(!1);break;case "Badge":this._rewardBadge=RSUtils.createAnimation(a,b,0.3);this._rewardBadge.stopAnimation();this._rewardBadge.setVisible(!1);this._badgePanel.addChild(this._rewardBadge);break;case "CoinRight":case "CoinLeft":this._coinStackData=b,c=RSUtils.createBasicObject(a,b),this._coinStackPanel.addChild(c)}switch(b.type){case "FireWorks":this._fireWorkArray.push(b)}}, onObjectCreated:function(a,b,c){switch(c.name){case "ExplositionAnimTopLeft":this._explositionAnimTopLeft=a;this._explositionAnimTopLeft.stopAnimation();this._explositionAnimTopLeft.setVisible(!1);break;case "ExplositionAnimBottomLeft":this._explositionAnimBottomLeft=a;this._explositionAnimBottomLeft.stopAnimation();this._explositionAnimBottomLeft.setVisible(!1);this._explositionAnimBottomLeft.setScaleY(-1);break;case "ExplositionAnimTopRight":this._explositionAnimTopRight=a;this._explositionAnimTopRight.stopAnimation(); this._explositionAnimTopRight.setVisible(!1);this._explositionAnimTopRight.setScaleX(-1);break;case "ExplositionAnimBottomRight":this._explositionAnimBottomRight=a;this._explositionAnimBottomRight.stopAnimation();this._explositionAnimBottomRight.setVisible(!1);this._explositionAnimBottomRight.setScaleX(-1);this._explositionAnimBottomRight.setScaleY(-1);break;case "FireworkAnim":this._fireWorkAnim=a;break;case "FireworksAnimLeft":this._fireworksAnimLeft=a;this._fireworksAnimLeft.stopAnimation();this._fireworksAnimLeft.setVisible(!1); this._fireWorkArray[0]=c;break;case "FireworksAnimRight":this._fireworksAnimRight=a;this._fireworksAnimRight.stopAnimation();this._fireworksAnimRight.setVisible(!1);this._fireWorkArray[1]=c;break;case "TitleGlowAnim":this._titleGlowAnim=a;this._titleGlowAnim.stopAnimation();this._titleGlowAnim.setVisible(!1);this._titleGlowAnim.setZOrder(-1);break;case "Title":if("Tournamania"!=this._rewardType){this._title=a;this._title.setVisible(!1);this._title.setScale(0.3);break}a.setVisible(!1);break;case "BadgeAnimLeft":this._badgeAnimLeft= a;this._badgeAnimLeft.stopAnimation();this._badgeAnimLeft.setVisible(!1);this._badgeAnimLeft.setZOrder(2);break;case "BadgeAnimRight":this._badgeAnimRight=a;this._badgeAnimRight.stopAnimation();this._badgeAnimRight.setVisible(!1);this._badgeAnimRight.setScaleX(-1);this._badgeAnimRight.setVisible(!1);this._badgeAnimRight.setZOrder(2);break;case "NameBase":this._nameBase=a;this._nameBase.stopAnimation();this._nameBase.setVisible(!1);break;case "Coin":this._coinIcon=a;this._coinIcon.setVisible(!1);break; case "BadgetAnimTop":this._badgetAnimTop=a;this._badgetAnimTop.stopAnimation();this._badgetAnimTop.setVisible(!1);this._badgetAnimTop.setZOrder(-1);break;case "RankMask":this._profilePicMaskArea=c;this._rankMask=a;this._screenName=b;a=RSGame.getInstance().getUserDataManager().getMe().getImageUrlWithSize(500,500);this._imageHolder=new RSImageObject;this._avatarID=b=RSEngine.dataManager.getMe().getAvatar();GameConfig.IS_EDIT_FIELDS_ENABLED&&this._avatarID?(a=GameConfig.BASE_URL+"/res/AvatarImages/"+ b+".png",this._imageHolder.setImageFromUrl(a,this._profilePicMaskArea.x,this._profilePicMaskArea.y,this._profilePicMaskArea.w,this._profilePicMaskArea.h)):RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK||RSEngine.loginMode==LOGIN_MODE.FACEBOOK?(this._imageHolder.setImageFromUrl(a,this._profilePicMaskArea.x,this._profilePicMaskArea.y,this._profilePicMaskArea.w,this._profilePicMaskArea.h),this.setMask(this._imageHolder,this._profilePicMaskArea)):b&&(a=GameConfig.BASE_URL+"/res/AvatarImages/"+b+".png",this._imageHolder.setImageFromUrl(a, this._profilePicMaskArea.x,this._profilePicMaskArea.y,this._profilePicMaskArea.w,this._profilePicMaskArea.h));break;case "Bg":a.setZOrder(-1);break;case "TournamentTitle":if("Tournamania"!=this._rewardType){a.setVisible(!1);break}this._title=a;this._title.setVisible(!1);this._title.setScale(0.3)}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._badgePanel.addChild(this._rankMask);this.addChild(this._badgePanel);this.addChild(this._coinStackPanel);GlobalVars.musicStatus&& RSEngine.audioManager.muteMusic();RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("RSLeaderboardRewardScreen")+"Winner.mp3",!1);this.scheduleFunctionOnce(this._onRewardAnimationsCompleted.bind(this),10);this._initializeIconScaleAnimations()},setMask:function(a,b){a&&(this._mask=RSUtils.createBasicObject(this._screenName,b),this.mask=new RSClippingNode(this._mask),this.mask.setAlphaThreshold(100),this.mask.addChild(a),this._badgePanel.addChild(this.mask))},onButtonClicked:function(a){switch(a){case "CloseBtn":this._callBack&& this._callBack()}},_initializeIconScaleAnimations:function(){this._nameBase.setFrame(this._rewardData.rank-1);this._rewardBadge.setFrame(this._rewardData.rank-1);this._rewardBadge.setVisible(!0);this._avatarID&&this._rankMask.setVisible(!1);this._imageHolder&&this._badgePanel.addChild(this._imageHolder);this._rewardBadge.setZOrder(2);this._badgePanel.actionZoom(0,0,this._startIconScaleAnimation.bind(this))},_startIconScaleAnimation:function(){this._badgePanel.actionZoom(0.2,1.5,this._onIconScaleUpComplete.bind(this)); this._moveCoinStackFromBottom()},_onIconScaleUpComplete:function(){this._title.setVisible(!0);this._title.actionZoom(0.3,1,this._onTitleScaleUpComplete.bind(this));this._badgePanel.actionZoomInOut(0.2,0.8,1,1,this._playExplodeAnimation.bind(this));this._playParticleAnimation()},_playExplodeAnimation:function(){this._setExplodeAnimationVisibility(!0);this._explositionAnimTopLeft.playAnimation(1,0.33);this._explositionAnimBottomLeft.playAnimation(1,0.33);this._explositionAnimBottomRight.playAnimation(1, 0.33);this._explositionAnimTopRight.playAnimation(1,0.33,this._onExplodeAnimationCompleted.bind(this))},_onExplodeAnimationCompleted:function(){this._setExplodeAnimationVisibility(!1);this._playBadgeAnimations()},_setExplodeAnimationVisibility:function(a){this._explositionAnimTopLeft.setVisible(a);this._explositionAnimBottomLeft.setVisible(a);this._explositionAnimBottomRight.setVisible(a);this._explositionAnimTopRight.setVisible(a)},_onBadgeTopAnimationCompleted:function(){this._badgetAnimTop.setVisible(!1)}, _playBadgeAnimations:function(){this._badgeAnimLeft.setVisible(!0);this._badgeAnimRight.setVisible(!0);this._badgeAnimLeft.playAnimation(1,0.37);this._badgeAnimRight.playAnimation(1,0.37,this._onBadgeAnimationCompleted.bind(this))},_onBadgeAnimationCompleted:function(){this._badgeAnimLeft.setVisible(!1);this._badgeAnimRight.setVisible(!1);this._playBadgeTopAnimations()},_playBadgeTopAnimations:function(){this._badgetAnimTop.setVisible(!0);this._badgetAnimTop.playAnimation(1,0.6,this._onBadgeTopAnimationCompleted.bind(this)); 3>this._fireWorkArray.length?(this._fireworksAnimLeft.setVisible(!0),this._fireworksAnimLeft.playAnimation(-1,0.8),this._fireworksAnimRight.setVisible(!0),this._fireworksAnimRight.playAnimation(-1,0.8)):this._showFireworkAnim();this.scheduleFunctionOnce(this._playRewardAmountTweening.bind(this),0.5)},_showFireworkAnim:function(){0!=this._fireWorkArray.length&&0!=this._colourSet.rewardScreenColorCodes.length&&4>this._count&&(this._fireworksAnimRight.setPosition(this._fireWorkArray[this._count].x,this._fireWorkArray[this._count].y), this._fireworksAnimRight.setColor(this._colourSet.rewardScreenColorCodes[this._count]),this._fireworksAnimRight.setVisible(!0),this._count+=1,this._fireworksAnimRight.playAnimation(1,0.8,this._onFireWorkAnimCompleted.bind(this)))},_onFireWorkAnimCompleted:function(){this._showFireworkAnim()},_moveCoinStackFromBottom:function(){this._coinStackPanel.actionMoveTo(0.5,RSEngine.screenWidth/2,RSEngine.screenHeight/2)},_onTitleScaleUpComplete:function(){},_playParticleAnimation:function(){var a=new RSEmitterParticleParams; a._spriteFrames.push("LeaderboardRewardScreen_00/Particle1.png");a._startDelay=0.2;a._startDelayVariance=0.5;a._deviation=500;a._deviationVariance=150;a._speed=50;a._360rotationDuration=0.5;a._tweenRate=0.5;a._spriteAnimationSpeed=0.4;a._origin=new RSPoint(RSEngine.screenWidth/2,RSEngine.screenHeight/2);a._originVariance=new RSPoint(200,200);a._displacement=new RSPoint(0,0);a._displacementVariance=new RSPoint(100,100);a._fadeOutDuration=0.1;a._fadeOutDurationVariance=0.8;a._fadeInDuration=0.8;a._startScale= 0.8;a._startScaleVariance=0.2;a._endScale=0;a._endScaleVariance=0.2;this._particleEmitter=new RSCustomAnimationEmitter(a,!0,RSCustomEmitterType.CLUSTER_MOVEMENT,100,null);this.addChild(this._particleEmitter);this._particleEmitter.loadEmitter();this._particleEmitter.startEmitter();this._particleEmitter.setZOrder(-1)},_playRewardAmountTweening:function(){this._coinIcon.setVisible(!0);this._nameBase.setVisible(!0);this._rewardAmount.setVisible(!0);this._playerName.setVisible(!0);this.startActionTweenForKey("HUDRollUp", 2,0,this._reward)},actionOnUpdate:function(a,b){this._winDisplay=Math.floor(b);this._rewardAmount.setString(RSUtils.formatNumberWithComma(this._winDisplay))},actionOnComplete:function(){this.stopWinRollUp()},stopWinRollUp:function(){this.stopActionTweenForKey("HUDRollUp");this._rewardAmount.setString(RSUtils.formatNumberWithComma(this._winDisplay))},_onRewardAnimationsCompleted:function(){this._counter++;2==this._counter&&this._callBack&&this._callBack()},_claimLeaderboardReward:function(){RSGame.getInstance().getUserDataManager().claimRewardFromRewardManager(this._rewardId, this._onRewardClaimed.bind(this))},_onRewardClaimed:function(a){if("Tournamania"!=this._rewardType){var b=parseInt((TimeManager.getInstance().getCurrentServerTime()-this._rewardData.startTime)/86400)+1;RSAnalyticsManager.getInstance().trackGUIEvent("leaderboard","win","collect",this._rewardData.rank,"day"+b);a.result&&a.result.status&&200==a.result.status&&(RSCasinoManager.addPrimaryCurrencyForDisplay("Leaderboard_Reward",parseInt(this._reward)),RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free, "leaderboard_win",this._reward,this._rewardData.rank,"day"+b))}else"Tournamania"==this._rewardType&&a.result&&a.result.status&&200==a.result.status&&(RSCasinoManager.addPrimaryCurrencyForDisplay("Tournament_Reward",parseInt(this._reward)),RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"tournamania_win_rank"+this._rewardData.rank,this._reward,this._rewardData.machineId,this._rewardData.tournamentid));this._onRewardAnimationsCompleted()},unloadContent:function(){this._particleEmitter= null;this._super.unloadContent.call(this);GlobalVars.musicStatus&&RSEngine.audioManager.unMuteMusic()}});var RSLeaderboardRankUpScreen=RSLeaderboardBgScreen.extend({init:function(a,b){this._callBack=b;this._rankUpPanel=new RSPanel(RSEngine.screenWidth/2,-RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this._colourSet=RSLeaderboardManager.getFireworkColorCode();this._super.init.call(this,a);this._particleEmitter=null},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){var c=null;switch(b.name){case "RankUpAnim":this._rankUpAnim=RSUtils.createAnimation(a, b,0.3);this._rankUpAnim.stopAnimation();this._rankUpPanel.addChild(this._rankUpAnim);break;case "Badge":c=RSUtils.createBasicObject(a,b);this._rankUpPanel.addChild(c);break;case "RankUp":this._rankUp=RSUtils.createBasicObject(a,b);this._rankUpPanel.addChild(this._rankUp);break;case "Arrow":this._arrowLeftBottom=RSUtils.createBasicObject(a,b);this._rankUpPanel.addChild(this._arrowLeftBottom);break;case "ArrowLeftMiddle":b.name="Arrow";this._arrowLeftMiddle=RSUtils.createBasicObject(a,b);this._rankUpPanel.addChild(this._arrowLeftMiddle); break;case "ArrowLeftTop":b.name="Arrow";this._arrowLeftTop=RSUtils.createBasicObject(a,b);this._rankUpPanel.addChild(this._arrowLeftTop);break;case "ArrowRightBottom":b.name="Arrow";this._arrowRightBottom=RSUtils.createBasicObject(a,b);this._rankUpPanel.addChild(this._arrowRightBottom);break;case "ArrowRightMiddle":b.name="Arrow";this._arrowRightMiddle=RSUtils.createBasicObject(a,b);this._rankUpPanel.addChild(this._arrowRightMiddle);break;case "ArrowRightTop":b.name="Arrow";this._arrowRightTop=RSUtils.createBasicObject(a, b);this._rankUpPanel.addChild(this._arrowRightTop);break;case "RankUpStar":this._rankUpStar=RSUtils.createBasicObject(a,b),this.addChild(this._rankUpStar),this._rankUpStar.setVisible(!1),this._rankUpStar.setZOrder(2),this._rankUpStar.setScale(1.5)}},onObjectCreated:function(a,b,c){switch(c.name){case "Bg":a.setZOrder(-1);break;case "FireworksAnimLeft":this._fireWorkAnim=a,this._fireWorkAnim.setScale(2),this._fireWorkAnim.setColor(this._colourSet.rankupColorCode[0]),this._fireWorkAnim.stopAnimation(), this._fireWorkAnim.setVisible(!1)}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);RSAnalyticsManager.getInstance().trackGUIEvent("leaderboard","rankup_popup","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName(),RSLeaderboard.getUpdatedRank().toString(),RSLeaderboard._getUserRank().toString());this.addChild(this._rankUpPanel);this.scheduleFunctionOnce(this._tweenUpRankUpPanel.bind(this),0.5);this.scheduleFunctionOnce(this._onAllAnimCompletion.bind(this),5); this._startArrowAnimations()},onButtonClicked:function(a){switch(a){case "CloseBtn":this._callBack&&this._callBack()}},_tweenUpRankUpPanel:function(){var a=this._rankUpPanel.actionMoveTo(0.5,RSEngine.screenWidth/2,RSEngine.screenHeight/2,this._onRankUpPanelTweenCompleted.bind(this));RSTweener.easeBounceOut(a);GlobalVars.musicStatus&&RSEngine.audioManager.muteMusic();RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("RSLeaderboardRankUpScreen")+"RankUp.mp3",!1)},_onRankUpPanelTweenCompleted:function(){this._rankUpAnim.playAnimation(1, 0.5,this._onRankUpAnimationCompleted.bind(this));this._rankUp.actionZoomInOut(0.4,0.9,1,4);this._rankUpAnim.actionZoomInOut(0.4,0.9,1,4);this._fireWorkAnim.setVisible(!0);this._fireWorkAnim.playAnimation(1,0.6)},_onRankUpAnimationCompleted:function(){this._rankUpStar.setVisible(!0);this._rankUpStar.actionZoom(0.6,0.8,this._onRankUpStarAnimationCompleted.bind(this));var a=this._rankUpStar.actionRotateBy(0.6,180,1);RSTweener.easeCircleActionOut(a);this._playBottomParticleAnimation();this._playMiddleParticleAnimation(); this._playTopParticleAnimation()},_onRankUpStarAnimationCompleted:function(){this._rankUpStar.setVisible(!1);var a=this._rankUpPanel.actionMoveTo(0.5,RSEngine.screenWidth/2,1.5*RSEngine.screenHeight,this._rankUpPanelRemoved.bind(this));RSTweener.easeBackIn(a);this.scheduleFunctionOnce(this._moveParticleAnimationsUpwards.bind(this),0.25)},_rankUpPanelRemoved:function(){},_playBottomParticleAnimation:function(){var a=new RSEmitterParticleParams;a._spriteFrames.push("LeaderboardRankUpScreen_00/ParticleGlow2.png"); a._startDelay=0.2;a._startDelayVariance=0.5;a._deviation=70;a._deviationVariance=50;a._speed=100;a._360rotationDuration=0.5;a._tweenRate=0.5;a._spriteAnimationSpeed=0.4;a._origin=new RSPoint(RSEngine.screenWidth/2,RSEngine.screenHeight/3-100);a._originVariance=new RSPoint(30,100);a._displacement=new RSPoint(0,0);a._displacementVariance=new RSPoint(40,50);a._fadeOutDuration=0.1;a._fadeOutDurationVariance=0.8;a._fadeInDuration=0.8;a._startScale=0.5;a._startScaleVariance=0.2;a._endScale=0;a._endScaleVariance= 0.2;this._particleEmitter=new RSCustomAnimationEmitter(a,!1,RSCustomEmitterType.FOUNTAIN,150,null);this.addChild(this._particleEmitter);this._particleEmitter.loadEmitter();this._particleEmitter.startEmitter();this._particleEmitter.setZOrder(-1)},_playMiddleParticleAnimation:function(){var a=new RSEmitterParticleParams;a._spriteFrames.push("LeaderboardRankUpScreen_00/ParticleGlow1.png");a._startDelay=0.2;a._startDelayVariance=0.5;a._deviation=30;a._deviationVariance=30;a._speed=100;a._360rotationDuration= 0.5;a._tweenRate=0.5;a._spriteAnimationSpeed=0.4;a._origin=new RSPoint(RSEngine.screenWidth/2,RSEngine.screenHeight/2-100);a._originVariance=new RSPoint(20,100);a._displacement=new RSPoint(0,0);a._displacementVariance=new RSPoint(20,30);a._fadeOutDuration=0.1;a._fadeOutDurationVariance=0.8;a._fadeInDuration=0.8;a._startScale=0.5;a._startScaleVariance=0.2;a._endScale=0;a._endScaleVariance=0.2;this._particleEmitter2=new RSCustomAnimationEmitter(a,!1,RSCustomEmitterType.FOUNTAIN,100,null);this.addChild(this._particleEmitter2); this._particleEmitter2.loadEmitter();this._particleEmitter2.startEmitter();this._particleEmitter2.setZOrder(-1)},_playTopParticleAnimation:function(){var a=new RSEmitterParticleParams;a._spriteFrames.push("LeaderboardRankUpScreen_00/ParticleStar.png");a._spriteFrames.push("LeaderboardRankUpScreen_00/ParticleGlow1.png");a._startDelay=0.2;a._startDelayVariance=0.5;a._deviation=200;a._deviationVariance=30;a._speed=300;a._360rotationDuration=0.1;a._tweenRate=0.5;a._spriteAnimationSpeed=0.4;a._origin= new RSPoint(RSEngine.screenWidth/2,RSEngine.screenHeight/3-100);a._originVariance=new RSPoint(15,150);a._displacement=new RSPoint(0,50);a._displacementVariance=new RSPoint(20,50);a._fadeOutDuration=0.1;a._fadeOutDurationVariance=0.8;a._fadeInDuration=0.8;a._startScale=0.4;a._startScaleVariance=0.1;a._endScale=0;a._endScaleVariance=0.2;this._particleEmitter3=new RSCustomAnimationEmitter(a,!1,RSCustomEmitterType.FOUNTAIN,50,null);this.addChild(this._particleEmitter3);this._particleEmitter3.loadEmitter(); this._particleEmitter3.startEmitter();this._particleEmitter3.setZOrder(-1)},_moveParticleAnimationsUpwards:function(){this._particleEmitter2.actionMoveTo(1,this._particleEmitter2.getX(),RSEngine.screenHeight/2-200,null);this._particleEmitter3.actionMoveTo(0.8,this._particleEmitter3.getX(),RSEngine.screenHeight/2+250,null)},_startArrowAnimations:function(){this._arrowLeftBottom.actionFadeIn(0.3);this._arrowRightBottom.actionFadeIn(0.3,this._onTopArrowFadeInCompleted.bind(this))},_onTopArrowFadeInCompleted:function(){this._arrowLeftBottom.actionFadeOut(0.3, this._onBorromArrowFadeOutCompleted.bind(this));this._arrowRightBottom.actionFadeOut(0.3);this._arrowLeftMiddle.actionFadeIn(0.3);this._arrowRightMiddle.actionFadeIn(0.3,this._onMiddleArrowFadeInComplete.bind(this))},_onBorromArrowFadeOutCompleted:function(){},_onMiddleArrowFadeInComplete:function(){this._arrowLeftMiddle.actionFadeOut(0.3);this._arrowRightMiddle.actionFadeOut(0.3,this._onTOpArrowFadeInCompleted.bind(this));this._arrowLeftTop.actionFadeIn(0.3);this._arrowRightTop.actionFadeIn(0.3)}, _onTOpArrowFadeInCompleted:function(){this._arrowLeftTop.actionFadeOut(0.3);this._arrowRightTop.actionFadeOut(0.3,this._startArrowAnimations.bind(this))},_onAllAnimCompletion:function(){this._particleEmitter&&this._particleEmitter.stopEmitter();this._particleEmitter2&&this._particleEmitter2.stopEmitter();this._particleEmitter3&&this._particleEmitter3.stopEmitter();this._callBack&&this._callBack()},unloadContent:function(){this._particleEmitter=null;this._super.unloadContent.call(this);GlobalVars.musicStatus&& RSEngine.audioManager.unMuteMusic()}});var RSLeaderboardNofificationPopup=RSGenericPopup.extend({init:function(a,b,c,d){this._assetList=[{name:RSGame.getInstance().getAssetPath("RSLeaderboardNotifyPopup"),count:1}];var e=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(e);this._userRank=parseInt(a);this._rankLimit=b;a=RSGame.getInstance().getGameManager().getNewLeaderboardFonts();this._isEmptyObj(a)?this._fontList=c:this._fontList=a;this._super.init.call(this,d);RSAnalyticsManager.getInstance().trackGUIEvent("leaderboard","tournament_end_popup", "open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName(),this._userRank.toString())},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.addChild(this._diplayPanel)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CloseBtn":this._closeButton=a}switch(c.type){case "CP_Button_T1":this._awesomeBtn=a}},createCustomObject:function(a, b){switch(b.name){case "LeaderboardNotifyPopupTitle1":var c=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name),c=new RSLabelBMFont(c,this._fontList.title,2*b.w,kTEXT_ALIGNMENT_CENTER);"MS"==GameConfig.GAME_ID&&c.setScale(0.8);this.addChild(c);c.setCenter(b.x,b.y);(this._userRank>this._rankLimit||0==this._userRank)&&c.setVisible(!1);break;case "LeaderboardNotifyPopupTitle2":c=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);c=new RSLabelBMFont(c,this._fontList.title,2*b.w, kTEXT_ALIGNMENT_CENTER);c.setScale(0.8);"MS"==GameConfig.GAME_ID?c.setScale(0.85):"MSP"==GameConfig.GAME_ID&&c.setScale(0.6);this.addChild(c);c.setCenter(b.x,b.y);this._userRank<=this._rankLimit&&0!=this._userRank&&c.setVisible(!1);break;case "LeaderboardNotifyPopupSubTitle1":c=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);switch(this._userRank){case 1:c=c.replace("{value}",this._userRank.toString()+"st");break;case 2:c=c.replace("{value}",this._userRank.toString()+"nd");break;case 3:c= c.replace("{value}",this._userRank.toString()+"rd");break;default:c=c.replace("{value}",this._userRank.toString()+"th")}var d=new RSLabelBMFont("",this._fontList.text,2*b.w,kTEXT_ALIGNMENT_CENTER);"UP"==GameConfig.GAME_ID||"MS"==GameConfig.GAME_ID||"BBVP"==GameConfig.GAME_ID||"MPVP"==GameConfig.GAME_ID||"MSP"==GameConfig.GAME_ID?d.setScale(0.7):d.setScale(0.5);d.setString(c);this.addChild(d);d.setCenter(b.x,b.y);(this._userRank>this._rankLimit||0==this._userRank)&&d.setVisible(!1);break;case "LeaderboardNotifyPopupSubTitle2":c= RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);c=c.replace(/\\n/g,"\n");c=c.replace(/\\'/g,"'");d=new RSLabelBMFont("",this._fontList.text,2*b.w,kTEXT_ALIGNMENT_CENTER);"BBC"==GameConfig.GAME_ID||"MS"==GameConfig.GAME_ID?d.setScale(0.64):d.setScale(0.7);d.setString(c);this.addChild(d);d.setCenter(b.x,b.y);this._userRank<=this._rankLimit&&0!=this._userRank&&d.setVisible(!1);break;case "LeaderboardRewardValue":c=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name),d=new RSLabelBMFont("", this._fontList.amount,2*b.w,kTEXT_ALIGNMENT_CENTER),d.setScale(1),d.setString(c),this.addChild(d),d.setCenter(b.x,b.y)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":this._closeButton.setTouchEnabled(!1);this.closePopup("close");break;case "CP_Button_T1":this.closePopup()}},closePopup:function(a){this._super.closePopup.call(this)},_isEmptyObj:function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}});var RSLeaderboardResponseFailPopup=RSGenericPopup.extend({init:function(a){this._super.init.call(this,a);this._assetList=[{name:RSGame.getInstance().getAssetPath("LeaderboardResponseFailPopup"),count:1}];RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("LeaderboardResponseFailPopupFontConfig"),"LeaderboardResponseFailPopupFontConfig.json")},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)}, createCustomObject:function(a,b){switch(b.name){case "LeaderboardResponseFailMessage":var c=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name),c=c.replace(/\\n/g,"\n"),c=RSPlatformFontAssetManager.createCustomLabel(c+"\n",b);this.addChild(c);c.setCenter(b.x,b.y)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":this.closePopup()}}});var RSRewardManager={rewardDataList:{},_currentPlacementData:"",_currentPlacementName:"",_currentRewardId:"",initializeRewardManager:function(){this.getUserRewardData();this._parseUserRewardData();RSEventManager.getInstance().removeEventListenersIn(this);RSEventManager.getInstance().addEventListener(RSPlatformEventTypeKeys.RSPlatformEvent,this,this.onPlacementEvent.bind(this))},getName:function(){return"RSRewardManager"},getUserRewardData:function(){this._userRewards=RSGame.getInstance().getUserDataManager().getMe().getRewards()}, _parseUserRewardData:function(){var a,b={},c=TimeManager.getInstance().getCurrentServerTime();this.rewardDataList={};for(a in this._userRewards)b=new RSRewardVO(this._userRewards[a],a),parseInt(b.expiryTime)>=c||0==parseInt(b.expiryTime)?(this.rewardDataList.hasOwnProperty(b.placement)||(this.rewardDataList[b.placement]=[]),this.rewardDataList[b.placement].push(b)):this.deleteExpiredReward(a)},onPlacementEvent:function(a){cc.log("ON Platform Event"+a._userData.event+" :FROM: "+a._userData.parameter); RSEngine.loginMode!=LOGIN_MODE.GUEST&&(this._currentPlacementName=a._userData.parameter,this._checkForRewards())},updateEmailReward:function(a,b,c){var d={};this._callBack=b;this._callBackFail=c;d.type="EmailConnect";d.blobData={};d.blobData.email=a[0];d.blobData.lastName=a[1];d.blobData.firstName=a[2];RSGame.getInstance().getUserDataManager().updateReward(d,this.onEmailRewardSuccess.bind(this,d),this.onEmailRewardFail.bind(this))},onEmailRewardSuccess:function(a,b){this.onUpdateRewardSuccess(a,b.result.data.rewardData.newReward)}, updateLeaderboardReward:function(a,b){this._callBack=b;this.onUpdateRewardSuccess("leaderboard_reward",a)},onUpdateRewardSuccess:function(a,b){var c,d=b;for(c in d)if(d=new RSRewardVO(d[c],c),this.rewardDataList.hasOwnProperty(d.placement))this.rewardDataList[d.placement].push(d);else{var e=!1;if(this.rewardDataList.hasOwnProperty("MainLobby_Launch")){var f=0,g=this.rewardDataList.MainLobby_Launch;for(f in g)g[f].id==d.id&&(e=!0)}e||(this.rewardDataList[d.placement]=[],this.rewardDataList[d.placement].push(d))}this._callBack(a)}, onEmailRewardFail:function(){this._callBackFail()},claimReward:function(){},_checkForRewards:function(){if(this.rewardDataList.hasOwnProperty(this._currentPlacementName)){var a=this.rewardDataList[this._currentPlacementName];if(a.length)switch(this._currentRewardId=a[0].id,a[0].type){case "Popup":RSGame.getInstance().getGameManager().loadPopupWithData(a[0])}}},isRewardActive:function(a){return this.rewardDataList.hasOwnProperty(a)&&this.rewardDataList[a].length?!0:!1},onRewardPopupClosed:function(a){var b= 0,c=0;if(this.rewardDataList.hasOwnProperty(this._currentPlacementName))for(c=this.rewardDataList[this._currentPlacementName].length,b=0;b<c;b++)if(this.rewardDataList[this._currentPlacementName][b].id==this._currentRewardId){cc.log("removing rewarded event");this.rewardDataList[this._currentPlacementName].splice(b,1);break}b=0;this.rewardDataList.hasOwnProperty(this._currentPlacementName)&&(b=this.rewardDataList[this._currentPlacementName].length);b?this._checkForRewards():"Leaderboard"==a&&RSEventManager.getInstance().dispatchEvent("onRankUpRewarded")}, setCurrentPlacementDetails:function(a,b){this._currentPlacementName=a;this._currentRewardId=b},deleteExpiredReward:function(a){RSGame.getInstance().getUserDataManager().deleteRewardFromRewardManager(a,this.onRewardDeleteSucces.bind(this),this.onRewardDeleteFail.bind(this,a))},onRewardDeleteSucces:function(){},onRewardDeleteFail:function(){},updateEmailVerificationReward:function(a,b){var c={};this._callBack=a;this._callBackFail=b;c.type="EmailVerify";RSGame.getInstance().getUserDataManager().updateReward(c, this.onEmailRewardSuccess.bind(this,c),this.onEmailRewardFail.bind(this))}};var RSRewardVO=RSVO.extend({id:null,type:null,placement:null,content:null,custom:null,expiryTime:null,init:function(a,b){this.content=this.placement=this.type=this.id="";this.custom={};this.expiryTime=0;this._super.init.call(this,a);this.id=b}});var RSLeaderboardPayTableV2=RSDisplayObject.extend({init:function(a){a=new RSRect(0,0,a.w,a.h);RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("RSLeaderboardPayTableFontConfig"),"LeaderboardPaytableFontConfigFile.json");this._super.init.call(this,a);this.loadContent()},loadContent:function(){this.loadLayout(RSGame.getInstance().getAssetPath("RSLeaderboardPayTable"))},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._setPrizeValues()},createCustomObject:function(a, b){switch(b.name){case "Prize1":this._prize1=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(this._prize1);break;case "Prize2":this._prize2=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(this._prize2);break;case "Prize3":this._prize3=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(this._prize3);break;case "Prize4":this._prize4=RSPlatformFontAssetManager.createCustomLabel("",b),this.addChild(this._prize4)}},_setPrizeValues:function(){var a=RSLeaderboardManager.getTopRewards().weekly; this._prize1.setString(RSUtils.formatNumberWithComma(a[0]));this._prize2.setString(RSUtils.formatNumberWithComma(a[1]));this._prize3.setString(RSUtils.formatNumberWithComma(a[2]));this._prize4.setString(RSUtils.formatNumberWithComma(a[3]))}});var RSGiftType={collect:0,help:1,invite:2},RSGiftingEvents={GIFTCLAIMED:"GIFTCLAIMED",GIFTSEND:"GIFTSEND",GIFT_CALIM_REFRESH:"GIFT_CLAIM_REFRSH"},RSGiftingUtils={},RSGiftingAppRequest=function(){this.TITLE=this.MESSAGE="";this.TARGETS=[];this.REQUEST_ID=this.ACTION_TYPE="";this.EXCLUDE_IDS=[];this.FILTER=null;this.GIFT_TYPE={type:"",value:0,name:"",extra:""};this._pushNotificationSendFailCount=0},RSGiftingManager=function(){var a,b=RSClass.extend({init:function(){this._currencyType=0;this._super.init.call(this); this._invitableUsers=[];this._retryCount=0;this._multicurrency=!1;RSGiftingUtils.cellInterval=120;RSGiftingUtils.disableClicks=!1;this._shareCount=1;this._fbPermissionPopupTriggered=!1;this._collectArray=[]},onGiftClicked:function(a){this._callback=a;this._gift=new RSGiftCenter(a);RSEngine.popupManager.addPopup(this._gift)},initializeGiftingManager:function(a){this._collectArray=[];this._giftingData=RSEngine.gameData.getSheetData("RSGiftingConfig");this._emailGiftingData=RSEngine.gameData.getSheetData("RSRewardingConfig"); this._requestableUsers=RSUtils.cloneJSON(RSSocialManager.getInstance().myPlayingFriends);this._nonPlayingFriendsList=RSSocialManager.getInstance().myNonPlayingFriends;this._giftSendList=RSGame.getInstance().getUserDataManager().getMe().getGiftSendList();this._giftClaimList=RSGame.getInstance().getUserDataManager().getMe().getGiftClaimList();this.giftType=this._giftingData[0].type;this._giftingData[0].probability&&this.setMultiCurrencySupport();this._resetTime=parseInt(this._giftingData["0"].sCoolDownTime); if(void 0==this._resetTime||null==this._resetTime)this._resetTime=86400;this._giftCellFonts=a?a:null},setMultiCurrencySupport:function(){this._multicurrency=!0},getMultiCurrencySupport:function(){return this._multicurrency},getGIftCellFonts:function(){return this._giftCellFonts},getGiftingGameData:function(){return this._giftingData},getGiftData:function(a){for(var b=0;b<this._emailGiftingData.length;b++)if(this._emailGiftingData[b].id==a)return this._emailGiftingData[b];return null},getAppRequests:function(a){this._onGiftingRequestCompleted= a;this._onGiftingDataReceived=this._onMyAppRequestReceived=!1;RSEngine.loginMode!=LOGIN_MODE.WEB_FACEBOOK&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK||RSSocialManager.getInstance().getMyAppRequests(this._onMyAppRequestCompleted.bind(this))},_onMyAppRequestCompleted:function(a,b){cc.log("On myapp request completed");this._helpArray=[];this._collectArray=[];var e=this._giftingData&&0<this._giftingData.cExpiryTime?this._giftingData.cExpiryTime:0,f=TimeManager.getInstance().getCurrentServerTime(),g=0,h= null,k=!1;if(a)2500===a&&(this._onMyAppRequestReceived=!0,this._callGiftingRequestsCompleted());else{if(b.data)for(var m=0;m<b.data.length;m++){try{var n=JSON.parse(b.data[m].data);if("giftBox"==JSON.parse(n.gift_type).type||"randomCollectibles"==JSON.parse(n.gift_type).type){var p=JSON.parse(n.gift_type);p.type="energy";p.value=2;n.gift_type=JSON.stringify(p);n.message=b.data[m].from.name+" has send you an energy gift!";b.data[m].data=JSON.stringify(n);b.data[m].message=n.message}}catch(r){RSSocialManager.getInstance().deleteRequest(b.data[m].id, this._onDeleteRequestCompleted.bind(this));continue}if("request"==n.action_type){for(g=this._helpArray.length-1;0<=g;g--)b.data[m].from.id==this._helpArray[g].from.id&&(RSSocialManager.getInstance().deleteRequest(this._helpArray[g].id,this._onDeleteRequestCompleted.bind(this)),this._helpArray.splice(g,1));this._helpArray.push(b.data[m])}else if("send"==n.action_type){k=!1;h=JSON.parse(b.data[m].data);g=parseInt(h.request_time);try{"object"==typeof JSON.parse(h.gift_type)&&(k=!0)}catch(s){k=!1}e&& g&&g+e>f?RSSocialManager.getInstance().deleteRequest(b.data[m].id,this._onDeleteRequestCompleted.bind(this)):k?this._collectArray.push(b.data[m]):RSSocialManager.getInstance().deleteRequest(b.data[m].id,this._onDeleteRequestCompleted.bind(this))}}this._onMyAppRequestReceived=!0;this._callGiftingRequestsCompleted()}},_onSendRequestCompleted:function(a,b,e){if(!b){b=RSEngine.dataManager.getMe().getRequestUserList();for(e=0;e<a.length;e++){b.push(a[e]+"_"+TimeManager.getInstance().getCurrentServerTime()); for(var f=0;f<this._requestableUsers.length;f++)if(this._requestableUsers[f].id==a[e]){this._requestableUsers.splice(f,1);break}}RSEngine.dataManager.getMe().setRequestUserList(b);RSEngine.dataManager.saveUserData("");void 0!=this._sendRequestCallback&&null!=this._sendRequestCallback&&(this._sendRequestCallback(),this._sendRequestCallback=null)}},sendFbGift:function(a,b,e){RSEngine.screenManager.addOverlay();b=this._giftSendList.type;var f=RSGiftingManager.getInstance().getRemainigGiftSendCountOfDay(); if(b){Object.keys(b);for(var g=null,h=0;h<a.length;h++)for(g in b)if(a[h]==b[g]){a.splice(h,1);break}}a.length>f&&a.splice(f,a.length-f);0!=a.length&&(this._multicurrency&&this._giftBoxRandomRewarding(),b=new RSGiftingAppRequest,b.TITLE=this._giftingData[0].sTitle,f=RSSocialManager.getInstance().getFBFirstName()?RSSocialManager.getInstance().getFBFirstName():RSEngine.dataManager.getMe().getUserFirstName(),b.MESSAGE=this._giftingData[this._currencyType].cMessage.replace("{name}",f),b.TARGETS=a,b.GIFT_TYPE.value= this._giftingData[this._currencyType].value,b.GIFT_TYPE.name=this._giftingData[this._currencyType].name,b.GIFT_TYPE.extra=this._giftingData[this._currencyType].extra,b.GIFT_TYPE.type=this._giftingData[this._currencyType].type,this._sendGiftCallback=e,RSSocialManager.getInstance().sendFbGift(b.TITLE,b.MESSAGE,b.TARGETS,b.GIFT_TYPE,this._onSendGiftCompleted.bind(this,b.TARGETS,b.GIFT_TYPE.type,b.GIFT_TYPE.value)),1==a.length&&RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter","send_"+this._giftingData[this._currencyType].type, "send",this._giftingData[this._currencyType].value,1))},_giftBoxRandomRewarding:function(){for(var a=Math.floor(100*Math.random()+2),b=0,e=this._giftingData.length-1;0<=e;e--)if(b+=parseInt(this._giftingData[e].probability),b>=a){this._currencyType=e;break}},_onSendGiftCompleted:function(a,b,e,f,g){this._pushNotificationSendFailCount=0;if(f)void 0!=this._sendGiftCallback&&null!=this._sendGiftCallback&&(this._sendGiftCallback(!1),this._sendGiftCallback=null);else{g=this._giftSendList[b]?this._giftSendList[b]: {users:{}};var h=null,k=a.length;if(g)for(var m=0;m<a.length;m++)for(h=a[m],g.users[h]=this.getCurrentDayStartTime(),h=0;h<this._giftableUsers.length&&this._giftableUsers[h].id!=a[m];h++);g.time&&g.time==this.getCurrentDayStartTime()?g.count=g.count?parseInt(g.count)+k:k:(g.time=this.getCurrentDayStartTime(),g.count=k);this._giftSendList[b]=g;RSEngine.dataManager.saveUserData("");void 0!=this._sendGiftCallback&&null!=this._sendGiftCallback&&(this._sendGiftCallback(!0,k,e,b),this._sendGiftCallback= null)}RSEventManager.getInstance().dispatchEvent(RSGiftingEvents.GIFTSEND);RSEngine.screenManager.removeOverlay();a=this.getPrefixAddedUserId(a,f);RSGame.getInstance().getUserDataManager().sendGiftCenterPushNotification("giftingNotifierLp",a,this._onGiftCenterPushNotificationSendingSucces.bind(this),this._onGiftCenterPushNotificationSendingFail.bind(this,a))},_onGiftCenterPushNotificationSendingSucces:function(){cc.log("On GiftCenter Push Notification Sending Succes")},_onGiftCenterPushNotificationSendingFail:function(a, b){3>=this._pushNotificationSendFailCount&&(this._pushNotificationSendFailCount++,RSGame.getInstance().getUserDataManager().sendGiftCenterPushNotification("giftingNotifierLp",a,this._onGiftCenterPushNotificationSendingSucces.bind(this),this._onGiftCenterPushNotificationSendingFail.bind(this,a)))},getPrefixAddedUserId:function(a,b){for(var e=0,f=a.length,e=0;e<f;e++)0==b&&(a[e]=GameConfig.USER_ID_PREFIX+a[e]);return a},calculateCoolDownTime:function(a,b){var e=TimeManager.getInstance().getCurrentServerTime(); if(this._multicurrency)for(var f in this._giftSendList){if(void 0!=this._giftSendList[f]&&void 0!=this._giftSendList[f].users&&void 0!=this._giftSendList[f].users[a]&&this._giftSendList[f].users[a])if(f=parseInt(this._giftSendList[f].users[a])+parseInt(this._giftingData["0"].sCoolDownTime),f<e)break;else return!1}else if(null!=this._giftSendList[b]&&void 0!=this._giftSendList[b]&&this._giftSendList[b].users[a]&&(f=parseInt(this._giftSendList.coins.users[a])+parseInt(this._giftingData["0"].sCoolDownTime), !(f<e)))return!1;return!0},getData:function(){var a=[];RSEngine.dataManager.getMe().getSentUserList().length>=this.getGiftingGameData().giftSendLimit&&(this.sendGiftStatus=!1);RSEngine.dataManager.getMe().getRequestUserList().length>=this.getGiftingGameData().giftRequestLimit&&(this.requestStatus=!1);this._totalInviteCount>=this.getGiftingGameData().giftInviteLimit&&(this.inviteStatus=!1);for(var b=0;b<RSEngine.dataManager.getMe().getSentUserList().length;b++){var e=RSEngine.dataManager.getMe().getSentUserList()[b], f=e.split("_")[0];e.split("_");for(e=this._helpArray.length-1;0<=e;e--)this._helpArray[e].from.id==f&&this._helpArray.splice(e,1)}a.giftableUsers=this._giftableUsers;a.requestableUsers=this._requestableUsers;a.invitableUsers=this._invitableUsers;a.helpUsers=this._helpArray;if(!1==this.sendGiftStatus||0==this._giftableUsers.length)a.helpUsers=[];a.playing=RSSocialManager.getInstance().myPlayingFriends;a.NonPlaying=RSSocialManager.getInstance().myNonPlayingFriends;return a},_onDeleteRequestCompleted:function(a, b){},_callGiftingRequestsCompleted:function(){this._onMyAppRequestReceived&&(this.setGiftUserList(),this._onGiftingRequestCompleted(!0))},setGiftUserList:function(){RSEngine.dataManager.getMe().getSentUserList().length>RSEngine.dataManager.getMe().getRequestUserList().length?RSEngine.dataManager.getMe().getSentUserList():RSEngine.dataManager.getMe().getRequestUserList();this._giftableUsers=RSUtils.cloneJSON(RSSocialManager.getInstance().myPlayingFriends);this._requestableUsers=RSUtils.cloneJSON(RSSocialManager.getInstance().myPlayingFriends); 0==this._invitableUsers.length&&(this._invitableUsers=RSUtils.cloneJSON(RSSocialManager.getInstance().myNonPlayingFriends));for(var a=this._giftSendList[this._giftingData[0].type],b=null,e=null,f=RSSocialManager.getInstance().myPlayingFriends.length-1;0<=f;f--)if(a)for(e in b=a.users,b){var g=b[e];this._giftableUsers[f]&&this._giftableUsers[f].id==e&&(parseInt(g),parseInt(this._giftingData[0].sCoolDownTime),TimeManager.getInstance().getCurrentServerTime())}},collectBotGift:function(a,b){this._botCollectCompleteCallback= a;RSEngine.dataManager.collectBotGift(this._onBotCollectCompleted.bind(this),this._onBotCollectFailed.bind(this,a,b))},collectGift:function(a,b){this._collectCompleteCallback=b;for(var e=0,f=null,g={},h=0;h<this._collectArray.length;h++)if(this._collectArray[h].id==a){f=JSON.parse(JSON.parse(this._collectArray[h].data).gift_type).type;e=JSON.parse(JSON.parse(this._collectArray[h].data).gift_type).value;g[f]=e;RSEngine.dataManager.collectGiftReward(g,this._onCollectCompleted.bind(this,a,e,1,b),this._onCollectFailed.bind(this, a,null));this._collectArray.splice(h,1);break}},collectAllGift:function(a,b){this._collectCompleteCallback=b;var e=[],f=0,g=null,h={},k=0;h.extraEnergy=0;h.extraCoins=0;h.energyCount=0;h.coinCount=0;h.powerupCount=0;this._rewardListGifts.length&&(this.collectRewardFromRewardManager(this._rewardListGifts[0].id,this._rewardListGifts[0].giftType,this._onRewardLIstGIftClaimed.bind(this)),parseInt(this._rewardListGifts[0].energy)&&(parseInt(this._rewardListGifts[0].energy),h.energyCount+=1,h.extraEnergy= parseInt(this._rewardListGifts[0].energy)),parseInt(this._rewardListGifts[0].coins)&&(parseInt(this._rewardListGifts[0].coins),h.coinCount+=1,h.extraCoins=parseInt(this._rewardListGifts[0].coins)));for(var m=0;m<a.length;m++)for(var n=0;n<this._collectArray.length;n++)if(a[m]==this._collectArray[n].id){g={};g.request_id=this._collectArray[n].id;g.data=this._collectArray[n].data;e.push(g);f+=parseInt(JSON.parse(JSON.parse(this._collectArray[n].data).gift_type).value);g=JSON.parse(JSON.parse(this._collectArray[n].data).gift_type).type; k++;break}if(0<e.length)if(this._multicurrency){h.coins=0;h.energy=0;for(var p in e)switch(JSON.parse(JSON.parse(e[p].data).gift_type).type){case "powerup":void 0==h[JSON.parse(JSON.parse(e[p].data).gift_type).type]&&(h[JSON.parse(JSON.parse(e[p].data).gift_type).type]=0);h[JSON.parse(JSON.parse(e[p].data).gift_type).type]+=parseInt(JSON.parse(JSON.parse(e[p].data).gift_type).value);h.powerupCount+=1;break;case "energy":void 0==h[JSON.parse(JSON.parse(e[p].data).gift_type).type]&&(h[JSON.parse(JSON.parse(e[p].data).gift_type).type]= 0);h[JSON.parse(JSON.parse(e[p].data).gift_type).type]+=parseInt(JSON.parse(JSON.parse(e[p].data).gift_type).value);h.energyCount+=1;break;case "coins":void 0==h[JSON.parse(JSON.parse(e[p].data).gift_type).type]&&(h[JSON.parse(JSON.parse(e[p].data).gift_type).type]=0),h[JSON.parse(JSON.parse(e[p].data).gift_type).type]+=parseInt(JSON.parse(JSON.parse(e[p].data).gift_type).value),h.coinCount+=1}h&&RSEngine.dataManager.collectGiftReward(h,this._onCollectCompleted.bind(this,this._collectArray,h,k,b), this._onCollectFailed.bind(this,a))}else h[g]=f,RSEngine.dataManager.collectGiftReward(h,this._onCollectCompleted.bind(this,this._collectArray,h,k,b),this._onCollectFailed.bind(this,a))},_onCollectFailed:function(a,b){3>this._retryCount?(this._retryCount++,null==b?this.collectGift(a,this._collectCompleteCallback):this.collectAllGift(a,this._collectCompleteCallback,b)):this._retryCount=0},_onRewardLIstGIftClaimed:function(){RSEventManager.getInstance().dispatchEvent(RSGiftingEvents.GIFTCLAIMED)},deleteData:function(a, b){switch(b){case GiftType.invite:for(var e=0;e<this._invitableUsers.length;e++)if(this._invitableUsers[e].id==a){this._invitableUsers.splice(e,1);break}break;case GiftType.collect:for(e=0;e<this._collectArray.length;e++){var f=this._collectArray[e].from.id;if(f==a){this._collectArray.splice(e,1);break}}break;case GiftType.help:for(e=0;e<this._helpArray.length;e++)if(f=this._helpArray[e].from.id,f==a){this._helpArray.splice(e,1);break}}},getGiftcenterDataToBeListed:function(){var a=RSRewardManager.rewardDataList; return a.hasOwnProperty("GiftingCenter")?a.GiftingCenter:[]},_onCollectCompleted:function(a,b,e,f,g){this._newClaimArray=[];this._retryCount=0;var h=b.coins+b.extraCoins,k=RSGiftingManager.getInstance().getRemainingGiftClaimCountForToDay();if(g){if(Array.isArray(a))if(a.length>k){for(var m=e=h=0;m<k;m++)h+=parseInt(JSON.parse(JSON.parse(a[m].data).gift_type).value),e=m+1,this._newClaimArray[m]=a[m],RSSocialManager.getInstance().deleteRequest(a[m].id,this._onDeleteRequestCompleted.bind(this));e+=b.coinCount; h+=b.extraCoins}else{for(m=0;m<a.length;m++)this._newClaimArray[m]=a[m],RSSocialManager.getInstance().deleteRequest(a[m].id,this._onDeleteRequestCompleted.bind(this));this._collectArray=[]}else RSSocialManager.getInstance().deleteRequest(a,this._onDeleteRequestCompleted.bind(this));!1==this._multicurrency&&RSEngine.dataManager.getMe().syncBlobVars(g.result.UserBlob);this._giftClaimList[this.giftType]&&this._giftClaimList[this.giftType].time&&this._giftClaimList[this.giftType].time==this.getCurrentDayStartTime()? this._giftClaimList[this.giftType].count=this._giftClaimList[this.giftType].count?parseInt(this._giftClaimList[this.giftType].count)+e:e:(this._giftClaimList[this.giftType]=this._giftClaimList[this.giftType]?this._giftClaimList[this.giftType]:{time:0,count:0},this._giftClaimList[this.giftType].time=this.getCurrentDayStartTime(),this._giftClaimList[this.giftType].count=e);f&&void 0!=f&&null!=f&&f(g,h,e,!0,this._newClaimArray)}RSEventManager.getInstance().dispatchEvent(RSGiftingEvents.GIFTCLAIMED)}, getPowerupAnalytics:function(a){var b={},e="",f;for(f in a){e&&(e+=",");var g=RSGame.getInstance().getGameManager().getPowerupAnalyticsIDFromName(f);b[g]=a[f];e=e+g+":"+b[g]}return e},triggerPowerupAnalytics:function(a){var b={},e="",f;for(f in a){e&&(e+=",");var g=RSGame.getInstance().getGameManager().getPowerupAnalyticsIDFromName(f);b[g]=a[f];e=e+g+":"+b[g]}RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.ECONOMY,"free_source_powerups","gift_collect_reward",e,"","")},_onCollectFailed:function(a, b){},collectRewardFromRewardManager:function(a,b,e){this._claimRewardCallBack=e;RSRewardManager.setCurrentPlacementDetails(b,a);RSGame.getInstance().getUserDataManager().claimRewardFromRewardManager(a,this._onRewardClaimed.bind(this))},_onRewardClaimed:function(){RSRewardManager.onRewardPopupClosed("Gifting");this._claimRewardCallBack&&this._claimRewardCallBack()},sendInvitation:function(a){RSEngine.screenManager.addOverlay();var b=new RSGiftingAppRequest;b.TITLE="Add your friends";b.MESSAGE="Come join me in "+ RSGame.getInstance().getGameManager().getGameName();b.TARGETS=a;b.FILTER=["app_non_users"];RSSocialManager.getInstance().showInviteWindow(b.TITLE,b.MESSAGE,b.TARGETS,null,this._onInviteCompleted.bind(this))},_onInviteCompleted:function(){cc.log("on invite completd");RSEngine.screenManager.removeOverlay()},connectToEmailReward:function(a){this._gift.closePopup();a=RSGame.getInstance().getGameManager().getEmailConnectFontColor()?RSGame.getInstance().getGameManager().getEmailConnectFontColor():new RSColor(199, 114,242,200);var b="Source Sans Pro";this.getGIftCellFonts()&&(b=this._giftCellFonts.emailConnectFont);RSEngine.popupManager.addPopup(new RSEmailConnectPopup(b,a,this._callback,"giftcenter"),!0)},connectToClubM:function(a){this._gift.closePopup();RSGame.getInstance().getGameManager().connectPlayerIdWithCasino(a,this._callback,null,"gift_center")},isEmailRewardClaimed:function(){this._emailGiftList=RSGame.getInstance().getUserDataManager().getMe().getEmailConnectData();for(var a in this._emailGiftList)if(this._emailGiftList.hasOwnProperty(a))return!0; return!1},getRemainingGiftClaimCountForToDay:function(){var a=this.getGiftingGameData()[0].cLimit,b=this._giftingData[0].type;return this._giftClaimList[b]&&this._giftClaimList[b].time&&this._giftClaimList[b].time>=this.getCurrentDayStartTime()&&(a=parseInt(a)-parseInt(this._giftClaimList[b].count),0>a)?0:a},getRemainigGiftSendCountOfDay:function(){for(var a=this.getGiftingGameData()[0].sLimit,b=0;b<this._giftingData.length;b++){var e=this._giftingData[b].type;if(this._giftSendList[e]&&this._giftSendList[e].time&& this._giftSendList[e].time>=this.getCurrentDayStartTime()&&(a=parseInt(a)-parseInt(this._giftSendList[e].count),0>a))return 0}return a},getGiftClaimList:function(){var a=null;this._claimList=[];this.claimAll=[];this._playerIdList=[];this._rewardListGifts=[];var b=RSGiftingManager.getInstance().getGiftData("EmailConnect"),e=RSGiftingManager.getInstance().getGiftData("EmailVerify"),f=RSGiftingManager.getInstance().getGiftData("MClubConnect");this.emailVerificationEnabledStatus=RSGiftingManager.getInstance().isEmailRewardClaimed(); this.emailClaim=RSGiftingManager.getInstance().isEmailRewardClaimed();this.mclubClaim=RSGame.getInstance().getGameManager().getClubMUpdateStatus();var g={},h=RSGiftingManager.getInstance().getGiftcenterDataToBeListed(),k=h.length,m={};RSEngine.loginMode==LOGIN_MODE.EMAIL&&(a=RSGiftingManager.getInstance().getGiftData("FBConnect"));if(GameConfig.POLLFISH_ENABLED){var g=RSPollFishManager.getSurveyEnabledStatus(),n=RSGame.getInstance().getPlatformEventManager().getEventDataForParameter(RSPlatformEventTypeKeys.EARN_COINS_SURVEY, RSPLATFORM_SURVEY_PLACEMENTS.GIFT_WATCH);if(g&&n){var p=(g==RSGame.getInstance().getPlatformEventManager().getRewardedSurveyCapCount()?RSGiftingManager.getInstance().getGiftData("SurveyReward"):RSGiftingManager.getInstance().getGiftData("RecursiveSurveyReward")).message,g={};g.message=p;g.coins=n["0"].triggerAction.rewards.coin;this._multicurrency&&(g.energy=b.energy);g.id=n["0"].triggerAction.action;g.analyticsId=n["0"].triggerAction.analyticsName;g.giftType=n["0"].triggerAction.action;g.claim=this.emailClaim; g.enableButton=!0;g.redirect=!1;this._claimList.push(g)}}null!=e&&GameConfig.SSO_ENABLED&&RSSSOManager.getEmailVerificationStatusInGifting()&&(g={},n=e.message,n=n.replace(/\\n/g,"\n"),g.message=n,g.coins=e.coins,this._multicurrency&&(g.energy=e.energy),g.id=e.id,g.analyticsId=e.analyticsId,g.giftType=e.placement,g.claim=!1,g.enableButton=!0,g.redirect=!0,this._claimList.push(g));a&&(g={},n=a.message,n=n.replace(/\\n/g,"\n"),g.message=n,g.coins=a.coins,this._multicurrency&&(g.energy=a.energy),g.id= a.id,g.analyticsId=a.analyticsId,g.giftType=a.placement,g.claim=!1,g.enableButton=!0,g.redirect=!0,this._claimList.push(g));for(a=0;a<k;a++)g={},g.message=h[a].custom.message.replace(/\\n/g,"\n"),g.message=h[a].custom.message.replace(/<br>/g,"\n"),g.coins=h[a].custom.coins,this._multicurrency&&(g.energy=h[a].custom.energy),g.id=h[a].id,g.giftType=h[a].placement,g.analyticsId=h[a].custom.analyticsId,g.enableButton=!0,g.redirect=!1,"email_gift_reward"==h[a].custom.analyticsId&&(g.claim=!0),"email_verification_gift_reward"== h[a].custom.analyticsId&&(g.claim=!0),this._claimList.push(g),"host_gift_reward"==g.analyticsId&&this._rewardListGifts.push(g);!1==this.emailClaim&&null!=b&&(g={},n=b.message,n=n.replace(/\\n/g,"\n"),g.message=n,g.coins=b.coins,this._multicurrency&&(g.energy=b.energy),g.id=b.id,g.analyticsId=b.analyticsId,g.giftType=b.placement,g.claim=this.emailClaim,g.enableButton=!0,g.redirect=!0,this._claimList.push(g));f&&!this.mclubClaim&&GameConfig.IS_PLAYER_CONNECT_AVAILABLE&&(g={},g.message=f.message,g.coins= f.coins,g.id=f.id,g.giftType=f.placement,g.analyticsId=f.analyticsId,g.claim=this.mclubClaim,g.enableButton=!0,g.redirect=!0,this._claimList.push(g));b=RSGiftingManager.getInstance()._collectArray;for(f=0;f<b.length;f++)g={},g.name=b[f].from.name,g.message=b[f].message,g.id=b[f].id,g.type=JSON.parse(b[f].data).gift_type,g.coins=JSON.parse(g.type).value,g.imageUrl="https://graph.facebook.com/"+b[f].from.id+"/picture?type\x3dsquare\x26access_token\x3d"+RSGame.getInstance().getGameManager().getFBAccessToken(), g.giftType="fbGift",g.enableButton=!0,this._claimList.push(g),this._playerIdList.push(g.id);m.claimList=this._claimList;m.playerIdList=this._playerIdList;return m},getGiftsFromRewardList:function(){return this._rewardListGifts},getGiftSendList:function(){this._sendList=[];this._giftableUsersIdList=[];for(var a={},b=RSGiftingManager.getInstance().getData().giftableUsers,e=0;e<b.length;e++)a={},a.id=b[e].id,a.coins=this._giftData["0"].value,a.type=this._giftData[0].type,this._sendList.push(a)},getCurrentDayStartTime:function(){var a= TimeManager.getInstance().getCurrentServerTime();return Math.floor(a/this._resetTime)*this._resetTime},getDayStartTime:function(a){return Math.floor(parseInt(a)/this._resetTime)*this._resetTime},getShareEnableStatus:function(){return this._giftSendList.share&&this._giftSendList.share.time&&this.getDayStartTime(this._giftSendList.share.time)>=this.getCurrentDayStartTime()?!1:!0},updateGiftShareCount:function(){this._giftSendList.share&&this._giftSendList.share.time?(this._giftSendList.share.time=TimeManager.getInstance().getCurrentServerTime(), this._giftSendList.share.count=1):this._giftSendList.share={time:TimeManager.getInstance().getCurrentServerTime(),count:1}},getGiftClaimCount:function(){this._claimList=RSGiftingManager.getInstance().getGiftClaimList().claimList;for(var a=this._claimList.length,b=!1,e=0;e<this._claimList.length;e++){if("EmailConnect"==this._claimList[e].id||"MClubConnect"==this._claimList[e].id)a=parseInt(a)-1;"G2PReward"==this._claimList[e].id&&RSGiftingManager.getInstance().getMultiCurrencySupport()&&(b=!0)}return RSGiftingManager.getInstance().getMultiCurrencySupport()&& (e=RSGiftingManager.getInstance().getRemainingGiftClaimCountForToDay(),0==e)?(b&&(e=1),e):a},getFbPermissionTriggerStatus:function(){return this._fbPermissionPopupTriggered},setFbPermissionTriggerStatus:function(){this._fbPermissionPopupTriggered=!0},verifyEmailAndCollectReward:function(){this._gift.closePopup();RSSSOManager.showEmailVerificationPromtPopup(RSSSOManager.getBlobIdData().emailId,this.onEmailVerificationCallBack.bind(this),"giftcenter")},onEmailVerificationCallBack:function(){RSSSOManager.getCookieEmailVerificationStatus()|| RSRewardManager.updateEmailVerificationReward(this.onEmailVerificationSucces.bind(this),this.onEmailVerificationRewardFailed.bind(this))},onEmailVerificationSucces:function(){this.onGiftClicked(this._callback)},onEmailVerificationRewardFailed:function(){this.onEmailVerificationCallBack()},connectToFb:function(){this._gift.closePopup();RSSSOManager.saveCurrentServerTimeForGettingLinkingTime();RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter","link_fb","initiate","","");RSLoginManager.getInstance().loginWithFacebook("gifting")}}); return{getInstance:function(){a||(a=new b);return a}}}();var RSGiftCell=RSDisplayObject.extend({init:function(a,b,c,d,e){b=new RSRect(b.x,b.y,b.w,b.h);this._super.init.call(this,b);this._message=a;this._imagePath="res/PlatformWidgets/RSGiftingPopup/GiftingCell/Coin.png";this._layout=[{name:RSGame.getInstance().getAssetPath("RSGiftTileWidget"),count:1}];this._data=c;this._rewardValueVisibility=!0;this._tickEnabled=d;"Claim"==a&&void 0!=e&&(this._imagePath=e);"Send"==a&&(RSGiftingManager.getInstance().getMultiCurrencySupport()&&(this._rewardValueVisibility= !1),a=this._data.id,this.coolDownResponse=RSGiftingManager.getInstance().calculateCoolDownTime(a,this._data.type));this._fonts=RSGiftingManager.getInstance().getGIftCellFonts();this.loadContent()},loadContent:function(){this.loadLayout(RSGame.getInstance().getAssetPath("RSGiftTileWidget"))},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.setImage();if("Send"==this._message&&!1==this.coolDownResponse||this._tickEnabled)this._sendbtn.setVisible(!1),this._sendTag.setVisible(!0), this._sendTag.setTouchEnabled(!1);"EmailConnect"!=this._data.id&&"MClubConnect"!=this._data.id&&"EmailVerify"!=this._data.id||!1!=this._data.claim||("EmailVerify"==this._data.id?this._verifyBtn.setVisible(!0):this._enterbtn.setVisible(!0),this._emailConnect.setVisible(!0));if(this._data.analyticsId&&("email_gift_reward"==this._data.analyticsId||"email_verification_gift_reward"==this._data.analyticsId)&&!0==this._data.claim)this.onButtonClicked("ClaimBtn");"FBConnect"==this._data.id&&(this._conctbtn.setVisible(!0), this._claimbtn.setVisible(!1))},onObjectCreated:function(a,b,c){switch(c.name){case "ConnectBtn":this._conctbtn=a;this._conctbtn.setVisible(!1);break;case "EnterBtn":this._enterbtn=a;this._enterbtn.setVisible(!1);break;case "ClaimBtn":this._claimbtn=a;"Claim"===this._message?(this._data.enableButton||this._claimbtn.setTouchEnabled(!1),this._claimbtn.setVisible(!0)):this._claimbtn.setVisible(!1);break;case "SendBtn":this._sendbtn=a;"Send"===this._message?(this._data.enableButton||this._sendbtn.setTouchEnabled(!1), this._sendbtn.setVisible(!0)):this._sendbtn.setVisible(!1);break;case "VerifyBtn":this._verifyBtn=a;this._verifyBtn.setVisible(!1);break;case "RewardBorder":this._rewardBorder=a}this._super.onObjectCreated.call(this,a,b,c)},setButtonState:function(a){this._sendbtn&&this._sendbtn.setTouchEnabled(a);this._claimbtn&&this._claimbtn.setTouchEnabled(a)},createCustomObject:function(a,b){switch(b.name){case "Rect":this._rect=b;this.addChild(this._rect);break;case "BG":this._bg=b;this.addChild(this._bg);break; case "Message":this._fonts?(this._msg=new RSLabelBMFont(this._data.message,this._fonts.textFont,1.5*b.w,kTEXT_ALIGNMENT_CENTER),this._msg.setScale(this._fonts.scaleFactor)):(this._msg=new RSLabelBMFont(this._data.message,RSGame.getInstance().getGameManager().getDefaultCasinoFont("small","bold"),1.5*b.w,kTEXT_ALIGNMENT_CENTER),this._msg.setScale(0.55));this._msg.setPosition(b.x,b.y);this.addChild(this._msg);break;case "Reward":var c=RSGame.getInstance().getGameManager().getDefaultCasinoFont("largePurple", "bold")?RSGame.getInstance().getGameManager().getDefaultCasinoFont("largePurple","bold"):RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),d=kTEXT_ALIGNMENT_LEFT;this._fonts&&(c=this._fonts.rewardFont,d=this._fonts.rewardFontAlignment);this._reward=new RSScaledLabel(RSUtils.formatNumberWithComma(parseInt(this._data.coins)),c,b,d);("GiftingCenter"==this._data.giftType||"GiftCenter"==this._data.giftType)&&this._data.energy>this._data.coins&&(this._reward=new RSScaledLabel(RSUtils.formatNumberWithComma(parseInt(this._data.energy)), c,b,kTEXT_ALIGNMENT_LEFT));this.addChild(this._reward);this._reward.setVisible(this._rewardValueVisibility);break;case "RewardIcon":this._imageHolder=new RSImageObject;this._imageHolder.setImageFromUrl(this._imagePath,b.x,b.y,b.w,b.h);this.addChild(this._imageHolder);break;case "HostIcon":this._hostIcon=RSUtils.createBasicObject(a,b);this.addChild(this._hostIcon);this._hostIcon.setVisible(!1);break;case "FBConnect":this._fbConnect=RSUtils.createBasicObject(a,b);this.addChild(this._fbConnect);this._fbConnect.setVisible(!1); break;case "DefaultProfile":this._profileobj=b;this._screenName=a;this._profile=RSUtils.createBasicObject(a,b);this.addChild(this._profile);this._profile.setVisible(!1);break;case "EmailConnect":this._emailConnect=RSUtils.createBasicObject(a,b);this.addChild(this._emailConnect);this._emailConnect.setVisible(!1);break;case "InviteFriend":this._inviteFriend=RSUtils.createBasicObject(a,b);this.addChild(this._inviteFriend);this._inviteFriend.setVisible(!1);break;case "ProfileBoader":this._borderHolder= RSUtils.createBasicObject(a,b);this.addChild(this._borderHolder);this._borderHolder.setZOrder(1);this._borderHolder.setVisible(!0);break;case "WatchAd":this._watchAd=RSUtils.createBasicObject(a,b);this.addChild(this._watchAd);this._watchAd.setVisible(!1);break;case "SentTag":this._sendTag=RSUtils.createBasicObject(a,b);this.addChild(this._sendTag);this._sendTag.setVisible(!1);break;case "ClaimedTag":this._claimTag=RSUtils.createBasicObject(a,b);this.addChild(this._claimTag);this._claimTag.setVisible(!1); break;case "MClub":this._mClub=RSUtils.createBasicObject(a,b);this.addChild(this._mClub);this._mClub.setVisible(!1);this._mClub.setZOrder(1);break;case "TakeSurvey":this._surveyIcon=RSUtils.createBasicObject(a,b),this.addChild(this._surveyIcon),this._surveyIcon.setVisible(!1)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "ClaimBtn":this._claimbtn.setTouchEnabled(!1);"fbGift"==this._data.giftType?("powerup"!=JSON.parse(this._data.type).type&&RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter", "collect_"+JSON.parse(this._data.type).type,"collect",this._data.coins,"1"),RSGiftingManager.getInstance().collectGift(this._data.id,this._onGiftCollected.bind(this))):("G2PReward"==this._data.id?RSGiftingManager.getInstance().getMultiCurrencySupport()?this._data.energy>this._data.coins?RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter","collect_energy","collect",this._data.energy,"1"):RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter","collect_coins","collect",this._data.coins, "1"):RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter","collect_coins","collect",this._data.coins,"1"):"email_gift_reward"==this._data.analyticsId?RSAnalyticsManager.getInstance().trackPlayerAction("email_connect","collect","open_from_giftcenter","",""):"survey"==this._data.id&&RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.EARN_COINS_SURVEY,parameter:RSPLATFORM_SURVEY_PLACEMENTS.GIFT_WATCH}),"survey"!=this._data.id&& RSGiftingManager.getInstance().collectRewardFromRewardManager(this._data.id,this._data.giftType,this._onGiftCollected.bind(this)));break;case "SendBtn":if("InviteShare"==this._data.id){RSEngine.screenManager.addOverlay();RSActionShareManager.getInstance().initiateShare({ogType:"gift_center"},this.onSharingToFBSuccess.bind(this));break}RSGiftingManager.getInstance().sendFbGift([this._data.id],this._data.type,this._onGiftSendCompleted.bind(this));break;case "EnterBtn":this._enterbtn.setTouchEnabled(!1); "MClubConnect"==this._data.id?RSGiftingManager.getInstance().connectToClubM(this._data.coins):"EmailVerify"==this._data.id?RSGiftingManager.getInstance().verifyEmailAndCollectReward():(RSAnalyticsManager.getInstance().trackPlayerAction("email_connect","click","open_from_giftcenter","",""),RSGiftingManager.getInstance().connectToEmailReward(this._onEmailConnectCompleted.bind(this)));break;case "VerifyBtn":"EmailVerify"==this._data.id&&RSGiftingManager.getInstance().verifyEmailAndCollectReward();break; case "ConnectBtn":RSGiftingManager.getInstance().connectToFb()}},_onGiftCollected:function(a){if(this._data.coins||this._data.energy){RSGiftingManager.getInstance().getMultiCurrencySupport()||RSCasinoManager.addPrimaryCurrencyForDisplay("gift_reward",parseInt(this._data.coins));this._claimbtn.setTouchEnabled(!1);if("email_gift_reward"==this._data.analyticsId)RSGiftingManager.getInstance().getMultiCurrencySupport()?(RSCasinoManager.addPrimaryCurrencyForDisplay("gift_reward",parseInt(this._data.energy)), RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,this._data.analyticsId,this._data.energy,"")):RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,this._data.analyticsId,this._data.coins,"");else if(RSGiftingManager.getInstance().getMultiCurrencySupport()){var b="";void 0==this._data.type?this._data.energy>this._data.coins?(b="energy",this._data.coins=this._data.energy):b="coins":b=JSON.parse(this._data.type).type;switch(b){case "coins":RSCasinoManager.addSecondaryCurrencyForDisplay("gift_reward", parseInt(this._data.coins));RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.ECONOMY,"free_source_coins","gift_collect_reward",this._data.coins,"","");break;case "energy":RSCasinoManager.addPrimaryCurrencyForDisplay("gift_reward",parseInt(this._data.coins));RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"gift_collect_reward",this._data.coins,"");break;case "powerup":if(a.result.UserBlob&&a.result.UserBlob.powerUps_&&a.result.userOffset&&a.result.userOffset.powerUpsOffset)for(var c in a.result.userOffset.powerUpsOffset){RSEngine.dataManager.getMe().setPowerUps(a.result.UserBlob.powerUps_); RSCasinoManager._HUD.updatePowerUps(RSEngine.dataManager.getMe().getTotalPowerUpCount());a=RSGiftingManager.getInstance().getPowerupAnalytics(a.result.userOffset.powerUpsOffset);RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter","collect_powerups","collect",a,"1");RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.ECONOMY,"free_source_powerups","gift_collect_reward",a,"","");break}}}else RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"gift_collect_reward", this._data.coins,"");RSEventManager.getInstance().dispatchEvent(RSGiftingEvents.GIFTCLAIMED);this.onClaimClicked(b)}},onClaimClicked:function(a){var b=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(b);this.addChild(this._diplayPanel);b=this.convertToWorldSpace(this._claimbtn.getX(),this._claimbtn.getY());RSGiftingUtils.coinLayer.setZOrder(2);RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(b,RSGiftingUtils.coinLayer,this._onClaimBonusCollectCompleted.bind(this),a)},onClaimAllClicked:function(){this._claimbtn.setTouchEnabled(!1)}, _onClaimBonusCollectCompleted:function(){this._claimbtn.setVisible(!1);this._claimTag.setTouchEnabled(!1);this._claimTag.setVisible(!0)},_onEmailConnectCompleted:function(){},_onGiftSendCompleted:function(a,b){a&&(this._sendbtn.setVisible(!1),this._sendTag.setTouchEnabled(!1),this._sendTag.setVisible(!0))},setImage:function(){if(void 0!=this._data.imageUrl){var a=new RSImageObject;this._profile.setVisible(!0);a.setImageFromUrl(this._data.imageUrl,this._profileobj.x,this._profileobj.y,this._profileobj.w, this._profileobj.h);a&&(this._mask=RSUtils.createBasicObject(this._screenName,this._profileobj),this._mask.setZOrder(-1),this.mask=new RSClippingNode(this._mask),this.mask.setAlphaThreshold(250),this.mask.addChild(a),this.addChild(this.mask))}else"email_gift_reward"==this._data.analyticsId?this._emailConnect&&this._emailConnect.setVisible(!0):"mclub_gift_reward"==this._data.analyticsId?this._mClub&&this._mClub.setVisible(!0):"survey"==this._data.id?this._surveyIcon&&(this._surveyIcon.setVisible(!0), this._surveyIcon.setZOrder(1)):"EmailVerify"==this._data.id||"email_verification_gift_reward"==this._data.analyticsId?this._emailConnect&&this._emailConnect.setVisible(!0):"FBConnect"==this._data.id?(this._fbConnect&&this._fbConnect.setVisible(!0),this._rewardBorder&&(this._rewardBorder.setVisible(!1),this._reward.setVisible(!1),this._imageHolder.setVisible(!1))):this._hostIcon.setVisible(!0)},onSharingToFBSuccess:function(a){RSEngine.screenManager.removeOverlay();a&&(this._onGiftSendCompleted(!0), RSGiftingManager.getInstance().updateGiftShareCount(),RSEventManager.getInstance().dispatchEvent(RSGiftingEvents.GIFTSEND))}});var RSGiftCenter=RSGenericPopup.extend({init:function(a){this._rectpanel=null;this._count=0;this._layout=[{name:RSGame.getInstance().getAssetPath("RSGiftingCenterPopup"),count:1}];this._super.init.call(this,a)},loadContent:function(){this.layoutScreen(this._layout);this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){switch(c.type){case "bo":this._mainBg=a;break;case "Button":this._closebtn=a}this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a,b){switch(b.type){case "Rect":this._customrect= b;break;case "Loading":var c=RSUtils.createAnimation(a,b,1);this._loading=c;this.addChild(c);this._loading.setVisible(!1);break;case "CustomWidget":this._rectpanel=new RSPanel(b.x,b.y,b.w,b.h);this.addChild(this._rectpanel);break;case "STypeA":this._tile=b;break;case "ScrollBar":switch(b.name){case "ScrollBarArea":this._scrollarea=b}}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter", "close","","",""),this.closePopup()}},onReveal:function(){},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._loading&&(this._loading.setVisible(!0),this._loading.actionRotateBy(0,2,-1));RSEngine.loginMode==LOGIN_MODE.FACEBOOK||RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK?RSGame.getInstance().getGameManager().giftingFbPermissionPromptPopupEnabledStatus()?RSGiftingManager.getInstance().getAppRequests(this._onGiftDataLoaded.bind(this)):RSSocialManager.getInstance().hasPermission("user_friends")? RSGiftingManager.getInstance().getAppRequests(this._onGiftDataLoaded.bind(this)):RSGiftingManager.getInstance().getFbPermissionTriggerStatus()?this._addGiftClaimScreen(!0):RSSocialManager.getInstance().showPermissionDialog("user_friends",this._onRequestComplete.bind(this)):this._addGiftClaimScreen(!0);RSGiftingUtils.coinLayer=new RSDisplayObject(new RSRect(0,0,0,0));this.addChild(RSGiftingUtils.coinLayer)},_onRequestComplete:function(a,b,c){RSGiftingManager.getInstance().setFbPermissionTriggerStatus(); if(b)this._onGiftDataLoaded(!0);else for(b=b=0;b<c.length;b++)"user_friends"==c[b]?a?RSSocialManager.getInstance().reRequestFriendsData(this.removeCurrentScreenAndAddSendScreen.bind(this)):RSSocialManager.getInstance().reRequestFriendsData(this._onFriendsDataloaded.bind(this)):a?this.removeCurrentScreenAndAddSendScreen():this._onGiftDataLoaded(!0)},_onFriendsDataloaded:function(){RSGiftingManager.getInstance().getAppRequests(this._onGiftDataLoaded.bind(this))},_onGiftDataLoaded:function(a){a&&(this._count= parseInt(this._count)+1);1==this._count&&this._addGiftClaimScreen(a)},showLoadingAnim:function(){null==this._loadScreen&&(this._loadScreen=new GiftLoadingScreen(this._assetFolder+"/"),this._loadScreen.loadContent(),this.addChild(this._loadScreen))},hideLoadingAnim:function(){this._loadScreen&&(this.removeChild(this._loadScreen),this._loadScreen.unload(),this._loadScreen=null)},_addGiftClaimScreen:function(a){this._loading&&this.removeChild(this._loading);this._rectpanel.removeChild(this._panel);this._panel= new RSGiftClaim(this._tile,this.removeClaimScreen.bind(this));this._rectpanel.addChild(this._panel)},removeClaimScreen:function(){this.checkForFriendsPermissionAndTriggerpromptPopup()},checkForFriendsPermissionAndTriggerpromptPopup:function(){RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&RSEngine.loginMode!=LOGIN_MODE.WEB_FACEBOOK||!RSGame.getInstance().getGameManager().giftingFbPermissionPromptPopupEnabledStatus()?this.removeCurrentScreenAndAddSendScreen():RSSocialManager.getInstance().hasPermission("user_friends")|| RSGiftingManager.getInstance().getFbPermissionTriggerStatus()?this.removeCurrentScreenAndAddSendScreen():RSGiftingManager.getInstance().getFbPermissionTriggerStatus()||RSSocialManager.getInstance().hasPermission("user_friends")||RSSocialManager.getInstance().hasDeclinedPermission("user_friends")?RSEngine.popupManager.addPopup(new RSFBPermissionPromptPopup(this.onFBPermissionPopupClosed.bind(this)),!0):RSSocialManager.getInstance().showPermissionDialog("user_friends",this._onRequestComplete.bind(this, !0))},removeCurrentScreenAndAddSendScreen:function(){RSGiftingManager.getInstance().setGiftUserList();this._rectpanel.removeChild(this._panel);this._panel=new RSGiftSend(this._tile,this._addGiftClaimScreen.bind(this));this._rectpanel.addChild(this._panel)},onFBPermissionPopupClosed:function(a){a?RSSocialManager.getInstance().showPermissionDialog("user_friends",this._onRequestComplete.bind(this,!0)):this.removeCurrentScreenAndAddSendScreen()}});var RSGiftClaim=RSDisplayObject.extend({init:function(a,b){var c=new RSRect(0,0,0,0);this._super.init.call(this,c);this._tile=a;this.callBack=b;this._layout=[{name:RSGame.getInstance().getAssetPath("RSGiftClaimTabWidget"),count:1}];this._claimList=[];this.claimAll=[];this._playerIdList=[];this.giftData=RSGiftingManager.getInstance().getGiftingGameData();this.emailClaim=RSGiftingManager.getInstance().isEmailRewardClaimed();this.claimtext=this.giftData["0"].rTitle;c=RSGiftingManager.getInstance().getGiftClaimList(); this._claimList=c.claimList;this._playerIdList=c.playerIdList;this.claimCount=RSGiftingManager.getInstance().getRemainingGiftClaimCountForToDay();this.totalClaimCount();RSGiftingManager.getInstance().getGIftCellFonts()?this._textFont=RSGiftingManager.getInstance().getGIftCellFonts().subTitleFont:this._textFont=RSGame.getInstance().getGameManager().getDefaultCasinoFont("small","bold");this.loadContent();RSEventManager.getInstance().addEventListener(RSGiftingEvents.GIFTCLAIMED,this,this._onGiftClaimed.bind(this)); RSEventManager.getInstance().addEventListener(RSGiftingEvents.GIFT_CALIM_REFRESH,this,this.refreshClaimTab.bind(this))},loadContent:function(){this.loadLayout(RSGame.getInstance().getAssetPath("RSGiftClaimTabWidget"))},onObjectCreated:function(a,b,c){switch(c.name){case "ScrollBar":this._scrollBar=a;this._scrollBar.setVisible(!1);break;case "ScrollBg":this._scrollBase=a;break;case "InviteFriendsBtn":this._invite=a;this._invite.setVisible(!1);break;case "ClaimAllBtn":this._claimAllBtn=a;break;case "ScrollBarDisable":this._scrollDisable= a;this._scrollDisable.setVisible(!1);break;case "SendBtn":this._sendBtn=a,RSEngine.loginMode!=LOGIN_MODE.WEB_FACEBOOK&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&this._sendBtn.setTouchEnabled(!1)}this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a,b){switch(b.type){case "VScroller":this._tileArea=b;this._scroller=new RSBarScroller(new RSRect(b.x,b.y,b.w,b.h),new RSSize(this._tile.w,this._tile.h),0,RSScrollerDirection.RSSCROLLER_VERTICAL,1);this.addChild(this._scroller);break; case "SendBtn":this._sendBtn=b;break;case "Label":switch(b.name){case "GiftingCenterClaimText":this.GiftCenterClaimText=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);this.claimtext=this.GiftCenterClaimText.replace(/{value}/,this.claimCount);RSEngine.loginMode!=LOGIN_MODE.WEB_FACEBOOK&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&(this.claimtext="Connect to Facebook to send and receive gifts!");this.giftingCenterClaimText=new RSScaledLabel(this.claimtext,this._textFont,b,kTEXT_ALIGNMENT_CENTER); this.addChild(this.giftingCenterClaimText);break;case "GiftingCenterNoMoreToClaimText":this.claimtext=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);this.noMoreClaimtext=new RSScaledLabel(this.claimtext,this._textFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this.noMoreClaimtext);break;case "EmptyText":this.EmptyClaimListText=new RSScaledLabel("Invite more friends to receive more gifts!",this._textFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this.EmptyClaimListText);this._claimList.length&& this.EmptyClaimListText.setVisible(!1);break}case "ScrollBar":switch(b.name){case "GitfScrollbarWidget":this._scrollArea=b}}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "SendBtn":this.callBack&&this.callBack();break;case "ClaimAllBtn":this._claimAllBtn.setTouchEnabled(!1);this._playerIdList.length?RSGiftingManager.getInstance().collectAllGift(this._playerIdList,this._onGiftCollected.bind(this)):(a=[],a=RSGiftingManager.getInstance().getGiftsFromRewardList(), 0<a.length&&RSGiftingManager.getInstance().collectRewardFromRewardManager(a[0].id,a[0].giftType,this._onRewardLIstGIftClaimed.bind(this,a[0])));break;case "InviteFriendsBtn":RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter","invite","click","",""),RSGiftingManager.getInstance().sendInvitation([])}},displayCells:function(){var a,b=this._claimList.length,c=RSGiftingManager.getInstance().getRemainingGiftClaimCountForToDay();b?3>=b&&this._scrollDisable.setVisible(!0):(this._scrollDisable.setVisible(!1), this._scrollBase.setVisible(!1),this._invite.setVisible(!0),this._claimAllBtn.setTouchEnabled(!1));for(a=0;a<b;a++)RSGiftingManager.getInstance().getMultiCurrencySupport()&&this._currencyIcon(a),RSGiftingManager.getInstance().getMultiCurrencySupport()&&0==RSGiftingManager.getInstance().getRemainingGiftClaimCountForToDay()&&(this._claimList[a].enableButton="GiftingCenter"==this._claimList[a].giftType||"GiftCenter"==this._claimList[a].giftType?!0:!1),this._claimList[a].enableButton=c?!0:0,"GiftingCenter"== this._claimList[a].giftType&&"host_gift_reward"==this._claimList[a].analyticsId&&(this._claimList[a].enableButton=!0),this.cell=new RSGiftCell("Claim",this._tile,this._claimList[a],null,this._imagePath),this.claimAll[a]=this.cell,this._scroller.addChild(this.cell)},_currencyIcon:function(a){if("GiftingCenter"==this._claimList[a].giftType||"GiftCenter"==this._claimList[a].giftType)this._imagePath=this._claimList[a].energy>this._claimList[a].coins?this.giftData[1].iconAsset:this.giftData[0].iconAsset; else switch(JSON.parse(this._claimList[a].type).type){case "coins":this._imagePath=this.giftData[0].iconAsset;break;case "energy":this._imagePath=this.giftData[1].iconAsset;break;case "powerup":this._imagePath=this.giftData[2].iconAsset}},_onGiftCollected:function(a,b,c,d,e){this._playerIdList=RSGiftingManager.getInstance().getGiftClaimList().playerIdList;var f=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(f);this.addChild(this._diplayPanel);f=this.convertToWorldSpace(this._claimAllBtn.getX(), this._claimAllBtn.getY());RSGiftingUtils.coinLayer.setZOrder(2);RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(f,RSGiftingUtils.coinLayer,this._onCoinFlyAnimCompleted.bind(this,e));if(RSGiftingManager.getInstance().getMultiCurrencySupport())for(g in b)switch(g){case "coins":if(b.extraCoins||b.coins)RSCasinoManager.addSecondaryCurrencyForDisplay("gift_reward",parseInt(b.extraCoins+b.coins)),RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter","collect_coins","collect_all",parseInt(b.extraCoins+ b.coins),b.coinCount),RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.ECONOMY,"free_source_coins","gift_collect_all_reward",parseInt(b.extraCoins+b.coins),"",""),RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(f,RSGiftingUtils.coinLayer,this._onCoinFlyAnimCompleted.bind(this),"coins");break;case "energy":if(b.extraEnergy||b.energy)RSCasinoManager.addPrimaryCurrencyForDisplay("gift_reward",parseInt(b.extraEnergy+parseInt(b.energy))),RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter", "collect_energy","collect_all",parseInt(b.extraEnergy+b.energy),b.energyCount),RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"gift_collect_all_reward",parseInt(b.extraEnergy+b.energy),""),RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(f,RSGiftingUtils.coinLayer,this._onCoinFlyAnimCompleted.bind(this),"energy");break;case "powerup":if(RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(f,RSGiftingUtils.coinLayer,this._onCoinFlyAnimCompleted.bind(this),"powerup"), a.result.UserBlob&&a.result.UserBlob.powerUps_&&a.result.userOffset&&a.result.userOffset.powerUpsOffset)for(var g in a.result.userOffset.powerUpsOffset){RSEngine.dataManager.getMe().setPowerUps(a.result.UserBlob.powerUps_);RSCasinoManager._HUD.updatePowerUps(RSEngine.dataManager.getMe().getTotalPowerUpCount());c=RSGiftingManager.getInstance().getPowerupAnalytics(a.result.userOffset.powerUpsOffset);RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter","collect_powerups","collect_all",c,b.powerupCount); RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.ECONOMY,"free_source_powerups","gift_collect_all_reward",c,"","");break}}else RSCasinoManager.addPrimaryCurrencyForDisplay("gift_reward",parseInt(b)),RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter","collect_coins","collect_all",b,c),RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"gift_collect_all_reward",b,""),d&&(this._scroller&&this._scroller.removeAllChildren(),this.displayCells(),this.handleClaimAllBtnVisibility())}, _onCoinFlyAnimCompleted:function(a){if(a)for(var b=0;b<a.length;b++)for(var c=0;c<this.claimAll.length;c++)a[b].id==this.claimAll[c]._data.id&&this.claimAll[c]._onClaimBonusCollectCompleted(),this.claimAll[c]._data.analyticsId&&"host_gift_reward"==this.claimAll[c]._data.analyticsId&&this.claimAll[c]._onClaimBonusCollectCompleted();else for(c=0;c<this.claimAll.length;c++)"fbGift"==this.claimAll[c]._data.giftType&&this.claimAll[c]._onClaimBonusCollectCompleted(),this.claimAll[c]._data.analyticsId&& "host_gift_reward"==this.claimAll[c]._data.analyticsId&&this.claimAll[c]._onClaimBonusCollectCompleted();this.handleClaimAllBtnVisibility()},_onGiftClaimed:function(){this.totalClaimCount();this.calculateClaimCountCheck();RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK&&RSEngine.loginMode==LOGIN_MODE.FACEBOOK&&(this.claimtext=this.GiftCenterClaimText.replace(/{value}/,this.claimCount),this.giftingCenterClaimText.setString(this.claimtext));this.handleClaimAllBtnVisibility();if(RSGiftingManager.getInstance().getMultiCurrencySupport()){if(0== this.claimCount)for(var a=0;a<this.claimAll.length;a++)"GiftingCenter"!=this.claimAll[a]._data.giftType&&this.claimAll[a].setButtonState(!1)}else 1==this.claimCount&&(this._scroller&&this._scroller.removeAllChildren(),this.displayCells())},calculateClaimCountCheck:function(){0==this.claimCount?(this.noMoreClaimtext.setVisible(!0),this.giftingCenterClaimText.setVisible(!1)):(this.giftingCenterClaimText.setVisible(!0),this.noMoreClaimtext.setVisible(!1))},totalClaimCount:function(){this.claimCount= RSGiftingManager.getInstance().getRemainingGiftClaimCountForToDay();this.giftClaimList=RSGiftingManager.getInstance().getGiftClaimList();for(var a=0;a<this.giftClaimList.claimList.length;a++)"GiftingCenter"!=this.giftClaimList.claimList[a].giftType||"email_gift_reward"==this.giftClaimList.claimList[a].analyticsId||RSGiftingManager.getInstance().getMultiCurrencySupport()||(this.claimCount=parseInt(this.claimCount)+1)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._scroller.setButtonScroll(this._scrollBar); this._scroller.setScrollBase(this._scrollArea);var a=new RSDisplayObject(new RSRect(this._tileArea.x,this._tileArea.y,this._tileArea.w+50,this._tileArea.h));this.addChild(a);a.setAnchorPoint(0.5,0.5);this._scroller.setMouseWheelScrollBase(a);this.displayCells();this.calculateClaimCountCheck();this.handleClaimAllBtnVisibility()},handleClaimAllBtnVisibility:function(){var a=RSGiftingManager.getInstance().getRemainingGiftClaimCountForToDay(),b=0;this._claimList=RSGiftingManager.getInstance().getGiftClaimList().claimList; var c=this._claimList.length,d;for(d in this._claimList)!0==this._claimList[d].redirect&&(b+=1);0>=a?this._claimAllBtn.setTouchEnabled(!1):c==b?this._claimAllBtn.setTouchEnabled(!1):0==c&&this._claimAllBtn.setTouchEnabled(!1)},_onRewardLIstGIftClaimed:function(a){RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter","collect","collect_all",a.coins,1);"coins"==GameFeatureTypeEnum.PRIMARY_CURRENCY?a.coins&&(RSCasinoManager.addPrimaryCurrencyForDisplay("gift_reward",parseInt(a.coins)),RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free, "gift_collect_all_reward",a.coins,"")):"energy"==GameFeatureTypeEnum.PRIMARY_CURRENCY&&(a.coins&&(RSCasinoManager.addSecondaryCurrencyForDisplay("gift_reward",parseInt(a.coins)),RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.ECONOMY,"free_source_coins","gift_collect_all_reward",a.coins,"","")),a.energy&&(RSCasinoManager.addPrimaryCurrencyForDisplay("gift_reward",parseInt(a.energy)),RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"gift_collect_all_reward", a.energy,"")));var b=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(b);this.addChild(this._diplayPanel);b=this.convertToWorldSpace(this._claimAllBtn.getX(),this._claimAllBtn.getY());RSGiftingUtils.coinLayer.setZOrder(2);var c="";a.coins&&(c="coins");a.energy&&(c="energy");RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(b,RSGiftingUtils.coinLayer,this._onCoinFlyAnimCompleted.bind(this),c)},refreshClaimTab:function(a){if(a._userData)console.log("refresh claim tab"),this.claimAll= [],this._scroller&&this._scroller.removeAllChildren(),this.giftData=RSGiftingManager.getInstance().getGiftingGameData(),this.claimtext=this.giftData["0"].rTitle,a=RSGiftingManager.getInstance().getGiftClaimList(),this._claimList=a.claimList,this._playerIdList=a.playerIdList,this.claimCount=RSGiftingManager.getInstance().getRemainingGiftClaimCountForToDay(),this.totalClaimCount(),this.displayCells(),this.calculateClaimCountCheck(),this.handleClaimAllBtnVisibility(),this.totalClaimCount(),this.calculateClaimCountCheck(), this.claimtext=this.GiftCenterClaimText.replace(/{value}/,this.claimCount),this.giftingCenterClaimText.setString(this.claimtext),this.handleClaimAllBtnVisibility();else{a=0;var b=null;for(a in this.claimAll)b=this.claimAll[a],"survey"==b._data.id&&this.claimAll[a]._onClaimBonusCollectCompleted()}},unload:function(){RSEventManager.getInstance().removeEventListenersIn(this);this._super.unload.call(this)}});var RSGiftSend=RSDisplayObject.extend({init:function(a,b){var c=new RSRect(0,0,0,0);this._super.init.call(this,c);this.callBack=b;this._layout=[{name:RSGame.getInstance().getAssetPath("RSGiftSendTabWidget"),count:1}];this._tile=a;this._sendList=[];this._giftableUsersIdList=[];this._giftType=null;this._giftData=RSGiftingManager.getInstance().getGiftingGameData();this.sendtext=this._giftData["0"].sTitle;this._claimList=RSGiftingManager.getInstance().getGiftClaimList().claimList;this.sendCount=RSGiftingManager.getInstance().getRemainigGiftSendCountOfDay(); this._setPlayerDataForSendList();this.totalSendCount();RSGiftingManager.getInstance().getGIftCellFonts()?this._textFont=RSGiftingManager.getInstance().getGIftCellFonts().subTitleFont:this._textFont=RSGame.getInstance().getGameManager().getDefaultCasinoFont("small","bold");this.loadContent();RSEventManager.getInstance().addEventListener(RSGiftingEvents.GIFTSEND,this,this._onGiftSend.bind(this))},loadContent:function(){this.loadLayout(RSGame.getInstance().getAssetPath("RSGiftSendTabWidget"))},onObjectCreated:function(a, b,c){switch(c.name){case "SendBtnBo":this._sendBtn=a;this._sendBtn.setTouchEnabled(!1);break;case "ScrollBar":this._scrollBar=a;this._scrollBar.setVisible(!1);break;case "ScrollBg":this._scrollBase=a;break;case "SendAllBtn":this._sendAllBtn=a;break;case "ScrollBarDisable":this._scrollDisable=a,this._scrollDisable.setVisible(!1)}this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a,b){switch(b.type){case "VScroller":this._tileArea=b;this._scroller=new RSBarScroller(new RSRect(b.x, b.y,b.w,b.h),new RSSize(this._tile.w,this._tile.h),0,RSScrollerDirection.RSSCROLLER_VERTICAL,1);this.addChild(this._scroller);break;case "Badge":this._claimNotificationBase=RSUtils.createBasicObject(a,b);this.addChild(this._claimNotificationBase);this._claimNotificationBase.setVisible(!0);break;case "Label":switch(b.name){case "GiftingCenterSendText":this.giftCenterSendtext=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);this.sendtext=this.giftCenterSendtext.replace(/{value}/,this.sendCount); this.giftingCenterSendText=new RSScaledLabel(this.sendtext,this._textFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this.giftingCenterSendText);break;case "GiftingCenterNoMoreToSendText":this.sendtext=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);this.noMoreToSendText=new RSScaledLabel(this.sendtext,this._textFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this.noMoreToSendText);break;case "ClaimCountValue":this._claimNotificationCount=new RSScaledLabel("",RSGame.getInstance().getGameManager().getHUDCasinoFont("largeBlue", "bold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._claimNotificationCount);break;case "EmptyText":this.EmptySendListText=new RSScaledLabel("Please check back in some time to send more gifts!",this._textFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this.EmptySendListText);this._sendList.length&&this.EmptySendListText.setVisible(!1);break}case "ScrollBar":switch(b.name){case "GitfScrollbarWidget":this._scrollArea=b}}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "ClaimBtn":this.callBack&& this.callBack();break;case "InviteBtn":RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter","invite","click","","");RSGiftingManager.getInstance().sendInvitation([]);break;case "SendAllBtn":this._sendAllBtn.setTouchEnabled(!1),this._sendGiftToAll()}},_setPlayerDataForSendList:function(){this._scroller&&this._scroller.removeAllChildren();this._sendList=[];this._giftableUsersIdList=[];var a={},b=RSGiftingManager.getInstance().getRemainigGiftSendCountOfDay();if(RSGiftingManager.getInstance().getShareEnableStatus()){var c= RSGiftingManager.getInstance().getGiftData("InviteShare");c&&(a={},a.message=c.message,a.coins=c.coins,a.id=c.id,a.giftType=c.placement,a.enableButton=!0,this._sendList.push(a))}for(var c=RSGiftingManager.getInstance().getData().giftableUsers,d=0;d<c.length;d++)a={},a.name=c[d].name,a.message=this._giftData["0"].rMessage.replace("{name}",a.name),a.id=c[d].id,a.coins=this._giftData["0"].value,a.imageUrl=c[d].picture.data.url,a.type=this._giftData[0].type,a.enableButton=b?!0:0,this._giftType=this._giftData[0].type, RSGiftingManager.getInstance().calculateCoolDownTime(a.id,a.type)&&(this._giftableUsersIdList.push(c[d].id),this._sendList.push(a))},displayCells:function(a){var b,c,d=this._sendList.length,e=!1,f=RSGiftingManager.getInstance().getRemainigGiftSendCountOfDay();for(b=0;b<d;b++){if(a){c=0;var e=!1,g=this._giftableUsersIdList.length;for(c=0;c<g;c++)if(this._sendList[b].id==this._giftableUsersIdList[c].id){e=!0;break}this._sendList[b].enableButton=f?!0:0;RSGiftingManager.getInstance().getShareEnableStatus()&& "InviteShare"==this._sendList[b].id?this._sendList[b].enableButton=!0:RSGiftingManager.getInstance().getShareEnableStatus()||"InviteShare"!=this._sendList[b].id||(e=!0)}c=new RSGiftCell("Send",this._tile,this._sendList[b],e);this._scroller.addChild(c)}d?3>=d&&this._scrollDisable.setVisible(!0):(this._scrollDisable.setVisible(!1),this._scrollBase.setVisible(!1))},_sendGiftToAll:function(){RSGiftingManager.getInstance().sendFbGift(this._giftableUsersIdList,this._giftType,this._onGiftSendCompleted.bind(this))}, totalSendCount:function(){this.sendCount=RSGiftingManager.getInstance().getRemainigGiftSendCountOfDay();RSGiftingManager.getInstance().getShareEnableStatus()&&(this.sendCount=parseInt(this.sendCount)+1)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._scroller.setButtonScroll(this._scrollBar);this._scroller.setScrollBase(this._scrollArea);var a=new RSDisplayObject(new RSRect(this._tileArea.x,this._tileArea.y,this._tileArea.w+50,this._tileArea.h));this.addChild(a);a.setAnchorPoint(0.5, 0.5);this._scroller.setMouseWheelScrollBase(a);this.notificationSendCount=RSGiftingManager.getInstance().getGiftClaimCount();this._claimNotificationCount.setString(this.notificationSendCount);0>=this.notificationSendCount&&(this._claimNotificationBase.setVisible(!1),this._claimNotificationCount.setVisible(!1));this.displayCells();this.calculateSendCountCheck();this.handleSendAllBtnVisibility()},_onGiftSend:function(){this.totalSendCount();this.calculateSendCountCheck();this.sendtext=this.giftCenterSendtext.replace(/{value}/, this.sendCount);this.giftingCenterSendText.setString(this.sendtext);1==this.sendCount&&(this._scroller&&this._scroller.removeAllChildren(),this.displayCells(!0),this.handleSendAllBtnVisibility())},calculateSendCountCheck:function(){0==this.sendCount?(this.noMoreToSendText.setVisible(!0),this.giftingCenterSendText.setVisible(!1)):(this.giftingCenterSendText.setVisible(!0),this.noMoreToSendText.setVisible(!1))},_onGiftSendCompleted:function(a,b,c,d){c*=b;a?(RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter", "send_"+d,"send_all",c,b),this._scroller&&this._scroller.removeAllChildren(),this.displayCells(!0),this.handleSendAllBtnVisibility()):this._sendAllBtn.setTouchEnabled(!0)},handleSendAllBtnVisibility:function(){var a=RSGiftingManager.getInstance().getRemainigGiftSendCountOfDay(),b=this._sendList.length;if(0>=a)this._sendAllBtn.setTouchEnabled(!1);else if(1==b)for(a=0;a<b;a++)"InviteShare"==this._sendList[a].id&&this._sendAllBtn.setTouchEnabled(!1);else 0==b&&this._sendAllBtn.setTouchEnabled(!1)},unload:function(){RSEventManager.getInstance().removeEventListenersIn(this); this._super.unload.call(this)}});var RSGiftingDataVO=RSVO.extend({giftCoins:null,giftCollected:null,isBotGiftCollectable:null,botGiftCoins:null,init:function(a){this.giftCollected=this.giftCoins=0;this.isBotGiftCollectable="";this.botGiftCoins=0;this._super.init.call(this,a)}});var RSFBPermissionPromptPopup=RSGenericPopup.extend({_screenLayout:null,_okBtn:null,_msg:"",init:function(a){this._super.init.call(this);RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("FBPermissionPromptPopup"),"FBPermissionPromptPopupFontConfig.json");this._assetList=[{name:RSGame.getInstance().getAssetPath("FBPermissionPromptPopup"),count:1}];this._promptPopupCallBack=a},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)}, onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},onObjectCreated:function(a,b,c){switch(c.name){case "Ok":this._okBtn=a}this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a,b){switch(b.name){case "PermissionText":var c=RSGame.getInstance().getGameData().getPopupTextWithKey("PermissionText");this._msg=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(this._msg)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":this._promptPopupCallBack(!1); this.closePopup();break;case "CP_Button_T1":this._promptPopupCallBack(!0),this.closePopup()}},unloadContent:function(){this._super.unloadContent.call(this);this._screenLayout=null}});var RSEmailConnectPopup=RSGenericPopup.extend({init:function(a,b,c,d){this._assetList=[{name:RSGame.getInstance().getAssetPath("RSEmailConnectPopup"),count:1}];this._super.init.call(this);this._fontName=a;this._firstNameText=this._lastNameText=this._emailText="";this._fontColor=b;this._callback=c;this._openFrom=d},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "InvalidEmail":this._icon1= a;this._icon1.setVisible(!1);break;case "InvalidEmail1":this._icon2=a;this._icon2.setVisible(!1);break;case "LargeBtn":this._connectBtn=a}},createCustomObject:function(a,b){switch(b.name){case "FirstNameTextBar":this._firstName=new RSInputBox(b.w,b.h);this._firstName.setPosition(b.x,b.y-b.h/5);this._firstName.setFont(this._fontName,b.h/1.5);this._firstName.setFontColor(255,255,255,25);this._firstName.setName("FirstName");this._firstName.setString("");this._firstName.setPlaceholderFont(this._fontName, b.h/1.5);this._firstName.setPlaceholderFontColor(this._fontColor.getR(),this._fontColor.getG(),this._fontColor.getB(),this._fontColor.getA());this._firstName.setPlaceholderText("First Name");this._firstName.setDelegate(this);this.addChild(this._firstName);break;case "LastNameTextBar":this._lastName=new RSInputBox(b.w,b.h);this._lastName.setPosition(b.x,b.y-b.h/5);this._lastName.setFont(this._fontName,b.h/1.5);this._lastName.setFontColor(255,255,255,0);this._lastName.setName("LastName");this._lastName.setString(""); this._lastName.setPlaceholderFont(this._fontName,b.h/1.5);this._lastName.setPlaceholderFontColor(this._fontColor.getR(),this._fontColor.getG(),this._fontColor.getB(),this._fontColor.getA());this._lastName.setPlaceholderText("Last Name");this._lastName.setDelegate(this);this.addChild(this._lastName);break;case "EmailTextBar":this._emailEntered=new RSInputBox(b.w,b.h);this._emailEntered.setPosition(b.x,b.y-b.h/5);this._emailEntered.setFont(this._fontName,b.h/1.5);this._emailEntered.setFontColor(255, 255,255,0);this._emailEntered.setName("Email");this._emailEntered.setPlaceholderFont(this._fontName,b.h/1.5);this._emailEntered.setPlaceholderFontColor(this._fontColor.getR(),this._fontColor.getG(),this._fontColor.getB(),this._fontColor.getA());this._emailEntered.setPlaceholderText("Email Address *");this._emailEntered.setDelegate(this);this.addChild(this._emailEntered);break;case "EmailConfirmTextBar":this._reEnterdEmail=new RSInputBox(b.w,b.h),this._reEnterdEmail.setPosition(b.x,b.y-b.h/5),this._reEnterdEmail.setFont(this._fontName, b.h/1.5),this._reEnterdEmail.setFontColor(255,255,255,0),this._reEnterdEmail.setName("MailConfirm"),this._reEnterdEmail.setPlaceholderFont(this._fontName,b.h/1.5),this._reEnterdEmail.setPlaceholderFontColor(this._fontColor.getR(),this._fontColor.getG(),this._fontColor.getB(),this._fontColor.getA()),this._reEnterdEmail.setPlaceholderText("Confirm Email Address *"),this._reEnterdEmail.setDelegate(this),this.addChild(this._reEnterdEmail)}return this._super.createCustomObject.call(this,a,b)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)}, onButtonClicked:function(a){switch(a){case "CP_Button_T1":this.checkDetail();break;case "CloseBtn":this.closePopup(),RSAnalyticsManager.getInstance().trackPlayerAction("email_connect","close","open_from_"+this._openFrom,"",""),RSGiftingManager.getInstance().onGiftClicked(this._callback)}},editBoxEditingDidBegan:function(a){},editBoxEditingDidEnded:function(a){switch(a.getName()){case "Email":this._emailEntered=a._ccObject._text;this._isEmailValid=this._emailEntered.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/); this.setEmailValid(!1);null!=this._isEmailValid?(this.setEmailValid(!0),this._reEnterdEmail&&this._isReEnterdEmailValid&&this._emailEntered!==this._reEnterdEmail&&this.setReEnteredEmailMatched(!1)):this.setEmailValid(!1);break;case "MailConfirm":if(this._reEnterdEmail=a._ccObject._text,this.setReEnteredEmailMatched(!1),null===this._isEmailValid){this._reEnterdEmail=a._ccObject._text="";var b=this;this._icon1.actionZoom(0.2,1.3,function(){b._icon1.actionZoom(0.3,1,null)});this._icon2.setVisible(!1)}else this._reEnterdEmail&& this._isEmailValid&&this._reEnterdEmail===this._emailEntered&&this.setReEnteredEmailMatched(!0)}},setEmailValid:function(a){this._icon1.setVisible(!a);this._emailVerified=a},setReEnteredEmailMatched:function(a){this._icon2.setVisible(!a);this._isReEnterdEmailValid=a},editBoxTextChanged:function(a,b){switch(a.getName()){case "Email":this._emailText=b;break;case "MailConfirm":this._emailConfirmText=b;break;case "LastName":this._lastNameText=b;break;case "FirstName":this._firstNameText=b}},editBoxEditingReturn:function(a){}, checkDetail:function(){if(this._emailVerified&&this._isReEnterdEmailValid){this._connectBtn.setTouchEnabled(!1);var a=[];a[0]=this._emailText;a[1]=this._lastNameText;a[2]=this._firstNameText;RSRewardManager.updateEmailReward(a,this.onUpdateSuccess.bind(this),this.onUpdateFail.bind(this))}},onUpdateSuccess:function(a){RSEngine.screenManager.removeOverlay();RSGame.getInstance().getUserDataManager().getMe().setEmailConnectData(a);this.closePopup();RSGiftingManager.getInstance().onGiftClicked(this._callback)}, onUpdateFail:function(){3>this._retryCount?(this._retryCount++,this.checkDetail()):(this._retryCount=0,RSEngine.screenManager.removeOverlay(),RSErrorTracker.getInstance().trackErrorMessage("ERROR_EMAIL_CONNECT","Error connecting email ","mahesh.jose@rubyseven.net"),this.closePopup())}});var RSLOCOOCAnimationScreen=RSGameScreen.extend({init:function(a,b){this._super.init.call(this);this.callBack=b;this._bagAnimationPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this.layoutScreen(a,2)},onAssetLoaded:function(a){this._super.onAssetLoaded.call(this,a)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.addChild(this._bagAnimationPanel);this._title=RSUtils.createBasicObject(this._screenName,this._titleData); this._bagAnimationPanel.addChild(this._title);this._title.setVisible(!1);RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("OutOfCreditsCarouselPopupAnimation")+"OutOfCreditsCarouselAnim.mp3",!1);this.scheduleFunctionOnce(this.initiateBagAnimation.bind(this),0.2)},createCustomObject:function(a,b){switch(b.name){case "BagAnimation":this._bagAnimationData=b;this._screenName=a;break;case "TitleGlow":this._titleGlowAnimData=b;break;case "ParticleAnimation":this._particleAnimationData= b;break;case "Title":this._titleData=b}},addToPreIntroLayer:function(a){var b=this._curtainPanel.convertToNodeSpace(a.getX(),a.getY());a.setCenter(b.getX(),b.getY());this._curtainPanel.addChild(a)},initiateBagAnimation:function(){this._bagAnimation=RSUtils.createAnimation(this._screenName,this._bagAnimationData,0.3);this._bagAnimation.stopAnimation();this._bagAnimationPanel.addChild(this._bagAnimation);this._bagAnimation.playAnimation(1,0.3,this._onBagAnimationCompleted.bind(this));this.scheduleFunctionOnce(this._playTitleAnimation.bind(this), 1.5)},_onBagAnimationCompleted:function(){this._particleAnimation=RSUtils.createAnimation(this._screenName,this._particleAnimationData,0.3);this._particleAnimation.stopAnimation();this.addChild(this._particleAnimation);this._particleAnimation.playAnimation(2,0.3,this._onParticleAnimationCompleted.bind(this))},_playTitleAnimation:function(){this._tweenTitle()},_tweenTitle:function(){this._title.setVisible(!0);this._title.setY(this._bagAnimationData.y);this._title.setScale(0.3);var a=this._title.actionScale(1, 1,1);RSTweener.easeBounceOut(a);a=this._title.actionMoveTo(1,this._titleData.x,this._titleData.y);RSTweener.easeBounceOut(a)},_onParticleAnimationCompleted:function(){this._particleAnimation.playAnimation(-1,0.3);this._playTitleGlowAnimation();this._particleAnimation.fadeOut(3)},_playTitleGlowAnimation:function(){this._titleGlowAnim=RSUtils.createAnimation(this._screenName,this._titleGlowAnimData,0.3);this._titleGlowAnim.stopAnimation();this.addChild(this._titleGlowAnim);this._titleGlowAnim.playAnimation(1, 0.3,this._onTitleGlowAnimCompleted.bind(this))},_onTitleGlowAnimCompleted:function(){this.scheduleFunctionOnce(this._scaleBagAndTitle.bind(this),1)},_scaleBagAndTitle:function(){this.removeChild(this._titleGlowAnim);this._titleGlowAnim.stopAnimation();this.removeChild(this._titleGlowAnim);this._particleAnimation.stopAnimation();this.removeChild(this._particleAnimation);this._bagAnimationPanel.actionZoom(0.27,7,this._onAnimationsCompleted.bind(this));this._bagAnimationPanel.actionMoveTo(0.2,RSEngine.screenWidth/ 3,RSEngine.screenHeight)},_onAnimationsCompleted:function(){RSEngine.audioManager.stopAllEffects();this.callBack&&this.callBack()},handleTouchAt:function(a,b,c){},handleTouchMoveAt:function(a,b,c){},handleTouchEndAt:function(a,b,c){this._onAnimationsCompleted()},unloadContent:function(){this._super.unloadContent.call(this)}});var VIPTierWidget=RSDisplayObject.extend({init:function(a,b,c,d){this._animCallback=c;this._baseRect=a;this._widgetPanel=new RSPanel(0,0,0,0);this._super.init.call(this,this._baseRect);this._VipStatus=this._VipStage=null;this._initialAnim=!0;this._bg=null;this._currentVipStatus=RSVIPManager.getInstance().getVIPUserTier();this._disableScaling=d;null==b?this.loadLayout(RSGame.getInstance().getAssetPath("VIPStatusTier")):this.loadLayout(b)},createCustomObject:function(a,b){switch(b.name){case "Bg":this._bg= RSUtils.createBasicObject(a,b);this._widgetPanel.addChild(this._bg);break;case "YourStatus":var c=RSUtils.createBasicObject(a,b);this._widgetPanel.addChild(c);0==this._currentVipStatus&&c.setVisible(!1);break;case "ExtraCoin":c=RSGame.getInstance().getGameManager().getPurchaseCartVipExtraCoinFont()?RSGame.getInstance().getGameManager().getPurchaseCartVipExtraCoinFont():RSGame.getInstance().getGameManager().getDefaultCasinoFontForHeading("normal");c=new RSScaledLabel("0",c,b,kTEXT_ALIGNMENT_RIGHT); if(0!=this._currentVipStatus){var d=RSEngine.gameData.getCurrentVIPStatus(this._currentVipStatus),d=String(100*d.additionalCoinsOnPurchase);c.setString("0"==d?"-":d+"%");this._widgetPanel.addChild(c)}break;case "BenefitsBtn":this._benefitsBtn=RSUtils.createButton(a,b);this.addTouchListenerToButton(this._benefitsBtn);this._widgetPanel.addChild(this._benefitsBtn);break;case "VipStage":this._VipStage=RSUtils.createAnimation(a,b,1);this._VipStage.stopAnimation();0==this._currentVipStatus?this._VipStage.setFrame(0): this._VipStage.setFrame(1);this._widgetPanel.addChild(this._VipStage);break;case "VipStatus":this._VipStatus=RSUtils.createAnimation(a,b,1);this._VipStatus.stopAnimation();0==this._currentVipStatus?this._VipStatus.setVisible(!1):this._VipStatus.setFrame(this._currentVipStatus-1);this._widgetPanel.addChild(this._VipStatus);break;case "BlueStar":1==this._currentVipStatus&&(c=null,c=RSUtils.createAnimation(a,b,1),c.setVisible(!1),c.stopAnimation(),this.StarAnim=c,this._widgetPanel.addChild(c));break; case "BlueStarLoop":1==this._currentVipStatus&&(c=RSUtils.createAnimation(a,b,1),c.setVisible(!1),c.stopAnimation(),this.StarLoop=c,this._widgetPanel.addChild(c));break;case "BronzeStar":2==this._currentVipStatus&&(c=RSUtils.createAnimation(a,b,1),c.setVisible(!1),c.stopAnimation(),this.StarAnim=c,this._widgetPanel.addChild(c));break;case "BronzeStarLoop":2==this._currentVipStatus&&(c=RSUtils.createAnimation(a,b,1),c.setVisible(!1),c.stopAnimation(),this.StarLoop=c,this._widgetPanel.addChild(c)); break;case "SilverStar":3==this._currentVipStatus&&(c=RSUtils.createAnimation(a,b,1),c.setVisible(!1),c.stopAnimation(),this.StarAnim=c,this.addChild(c));break;case "SilverStarLoop":3==this._currentVipStatus&&(c=RSUtils.createAnimation(a,b,1),c.setVisible(!1),c.stopAnimation(),this.StarLoop=c,this._widgetPanel.addChild(c));break;case "GoldenStar":4==this._currentVipStatus&&(c=RSUtils.createAnimation(a,b,1),c.setVisible(!1),c.stopAnimation(),this.StarAnim=c,this._widgetPanel.addChild(c));break;case "GoldenStarLoop":4== this._currentVipStatus&&(c=RSUtils.createAnimation(a,b,1),c.setVisible(!1),c.stopAnimation(),this.StarLoop=c,this._widgetPanel.addChild(c));break;case "BlackStar":5==this._currentVipStatus&&(c=RSUtils.createAnimation(a,b,1),c.setVisible(!1),c.stopAnimation(),this.StarAnim=c,this._widgetPanel.addChild(c));break;case "BlackStarLoop":5==this._currentVipStatus&&(c=RSUtils.createAnimation(a,b,1),c.setVisible(!1),c.stopAnimation(),this.StarLoop=c,this._widgetPanel.addChild(c));break;default:switch(b.type){case "Custombo":c= RSUtils.createBasicObject(a,b),this._widgetPanel.addChild(c)}}},onLayoutCompleted:function(){this.addChild(this._widgetPanel);0<this._currentVipStatus&&this.StarAnim&&this.StarLoop&&(this.StarAnim.setZOrder(2),this.StarLoop.setZOrder(2));this.scheduleFunctionOnce(function(){this.StarAnim&&(this.StarAnim.setVisible(!0),this.StarAnim.playAnimation(1,1,this.startLoopAnim.bind(this)))}.bind(this),0.5);this._disableScaling||this._widgetPanel.setScale(this._baseRect.getWidth()/this._bg.getRect().getWidth())}, startLoopAnim:function(){this._initialAnim?(this._initialAnim=!1,this.scheduleFunctionOnce(this.startLoopAnim.bind(this),3)):(this.StarLoop.setVisible(!0),this.StarAnim.setVisible(!1),this.StarLoop.playAnimation(1,0.5,this.startCartItemAnim.bind(this)))},startCartItemAnim:function(){this._animCallback&&this._animCallback()},onButtonClicked:function(a){switch(a){case "BenefitsBtn":this.setBenefitBtnState(!1),RSGame.getInstance().getGameManager().addVIPBenefits(this.setBenefitBtnState.bind(this,!0))}}, setBenefitBtnState:function(a){this._benefitsBtn&&this._benefitsBtn.setTouchEnabled(a)}});var RSBetUnlockPopup=RSGenericPopup.extend({_message:null,_layoutLoaded:null,_messageTextBox:null,_tryAgainBtn:null,init:function(a,b,c,d,e){this._layoutLoaded=!1;this._layout=a.layout;this._betAmount=b;this._machineName=c;this._param3=d;this._param4=e;this._assetList=[{name:RSGame.getInstance().getAssetPath("RSBetUnlockPopup"),count:1}];RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI,"max_bet_unlocked","trigger","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName(), "","");this._super.init.call(this,null,a)},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._layoutLoaded=!0},createCustomObject:function(a,b){switch(b.name){case "Title":var c=RSGame.getInstance().getStringDictionary("RSBetUnlockPopup").T1,c=new RSScaledLabel(c,this._assetConfig.titleFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(c);this._title=c;break;case "Message":c=RSGame.getInstance().getStringDictionary("RSBetUnlockPopup").T2; c=new RSScaledLabel(c,this._assetConfig.textFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(c);this._messageTextBox=c;break;case "BetValue":c=kTEXT_ALIGNMENT_CENTER;void 0!=this._assetConfig.coinAlign&&(c=this._assetConfig.coinAlign);c=new RSScaledLabel(this._message,this._assetConfig.betValueFont,b,c);this.addChild(c);this._betValue=c;this._betAmountToShow=this._param3&&"betLineCount"==this._param4?this._betAmount*this._param3:this._betAmount;"MSP"==this._machineName&&(this._betAmountToShow=4*this._betAmount); "MSPT"==this._machineName&&(this._betAmountToShow=12*this._betAmount);"MPP"==this._machineName&&this._param3&&(this._betAmountToShow=this._betAmount*this._param3);this._betValue.setString(RSUtils.formatNumberWithComma(this._betAmountToShow));break;case "Coin":c=RSUtils.createBasicObject(a,b),this.addChild(c),this._coin=c}return this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){switch(c.name){case "PlayBtn":this._tryAgainBtn=a;break;case "CoinStack":this._coinStack=a}this._super.onObjectCreated.call(this, a,b,c)},onButtonClicked:function(a){switch(a){case "CloseBtn":this._callback&&this._callback.call(this);"maxChipUnlocked"==this._param4?RSEngine.externalGameManager.updateMachineBetInGame(this._betAmount,this._machineName,!1,this._param3):RSEngine.externalGameManager.updateMachineBetInGame(this._betAmount,this._machineName,!1);RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI,"max_bet_unlocked","close","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName(), "","");this.closePopup();break;case "PlayBtn":"maxChipUnlocked"==this._param4?RSEngine.externalGameManager.updateMachineBetInGame(this._betAmount,this._machineName,!0,this._param3):RSEngine.externalGameManager.updateMachineBetInGame(this._betAmount,this._machineName,!0);RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI,"max_bet_unlocked","click","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName(),"","");var b;switch(RSGame.getInstance().getGameManager().getGameType()){case "slots":b= RSEventCategory.SLOT_GAME_ACTION;break;case "blackjack":b=RSEventCategory.BLACKJACK_GAME_ACTION;break;case "keno":b=RSEventCategory.KENO_GAME_ACTION;break;case "poker":b=RSEventCategory.POKER_GAME_ACTION;break;case "Roulette":b=RSEventCategory.ROULETTE_GAME_ACTION}RSAnalyticsManager.getInstance().trackInHouseEvent(b,"max_bet","",this._betAmountToShow,RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName(),"");this.closePopup();this._callback&&this._callback.call(this)}},updateBetAmount:function(){}, unload:function(){},unloadPopup:function(){this._message=null;this._super.unload.call(this)}});var RSMuteButtonManager={showMuteButton:function(a,b,c){this._delegate=a;this._layout=b;this._muteBtn=new RSMuteButton(this._layout);c.addChild(this._muteBtn)}};var RSMuteButton=RSDisplayObject.extend({init:function(a){this._layout=a;this.rect=new RSRect(0,0,0,0);this._buttonStatus=!1;this._super.init.call(this,this.rect);this.loadContent()},loadContent:function(){this.loadLayout(this._layout)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);RSEventManager.getInstance().addEventListener("onMusicButtonUpdated",this,this._onMusicButtonUpdated.bind(this));this._onMusicButtonUpdated()},onObjectCreated:function(a,b,c){switch(c.name){case "MuteBtn":this._muteButton= a,this._muteButton.stopAnimation()}},createCustomObject:function(a,b){switch(b.name){case "TouchRect":this._touchRect=new RSDisplayObject(new RSRect(b.x,b.y,b.w,b.h)),this._touchRect.setAnchorPoint(0.5,0.5),this._touchRect.setName("TouchRect"),this.addChild(this._touchRect),this._touchRect.addTouchListenerWithDelegate(this)}},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){switch(a.getName()){case "TouchRect":this.onMuteButtonClicked()}}, onMuteButtonClicked:function(){var a=!1;this._buttonStatus?(this.setButtonStatus(!1),RSEngine.audioManager.muteMusic(),RSEngine.audioManager.muteEffects()):(a=!0,RSEngine.audioManager.unMuteMusic(),RSEngine.audioManager.unMuteEffects(),this.setButtonStatus(!0));RSUtils.setLocalStorageItem("musicStatus",a);RSUtils.setLocalStorageItem("sfxStatus",a);RSUtils.setLocalStorageItem("voiceCallOutStatus",a);GlobalVars.musicStatus=a;GlobalVars.sfxStatus=a;GlobalVars.voiceCalloutsStatus=a},setButtonStatus:function(a){a? this._muteButton.setFrame(0):this._muteButton.setFrame(1);this._buttonStatus=a},_onMusicButtonUpdated:function(){GlobalVars.sfxStatus||(GlobalVars.voiceCalloutsStatus=!1);GlobalVars.musicStatus||GlobalVars.sfxStatus||GlobalVars.voiceCalloutsStatus?this.setButtonStatus(!0):this.setButtonStatus(!1)},unload:function(){RSEventManager.getInstance().removeEventListenersIn(this);this._super.unload.call(this)}});var defaultMachineSheet={slots:"SlotsStatsDefaults",poker:"PokerStatsDefaults",scratcher:"ScratchersStatsDefaults",bingo:"BingoStatsDefaults",blackjack:"BlackjackStatsDefaults",keno:"KenoStatsDefaults",Roulette:"RouletteStatsDefault"},RSPlayerStatsPopup=RSGenericPopup.extend({customText1:{slots:"Games Unlocked:",poker:"Games Played:",bingo:"Total Bingos Won:",blackjack:"Blackjacks Hit:",keno:"Games Played:",Roulette:"Biggest Roulette Win:",scratcher:"Games Played:"},customText2:{slots:"Biggest Win:", poker:"Biggest Win:",bingo:"",blackjack:"Blackjacks Hit:",keno:"Biggest Keno Win:",Roulette:"",scratcher:"Biggest Win:"},init:function(a,b,c,d,e,f,g,h){this._isAllTextInCaps=f?f:!1;this._defaultButton=e?e:"SlotsBtn";this._combinedMachineDetails=this._gameType=null;this._defaultGameType=RSGame.getInstance().getGameManager().getGameType();this._layout=[{name:RSGame.getInstance().getAssetPath("RSPlayerStatsPopup"),count:1}];this._super.init.call(this,a);this._iconPathArray=b;this._iconNameArray=c;this._playerStatsFonts= d?d:null;this._levelPrefixText=null;g&&(this.customText2=g);this._favouriteGameFont=this._playerStatsFonts?this._playerStatsFonts.PlayerName:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold");this._customLabelFonts=this._playerStatsFonts?this._playerStatsFonts.CustomLabelFonts:RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","normal");this._fontColor=this._playerStatsFonts?this._playerStatsFonts.LevelTextColor:new RSColor(255,255,255,255);this._playerNameLabel= this._playerStatsFonts?this._playerStatsFonts.PlayerName:RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","bold");h&&(this._levelPrefixText=h);RSAnalyticsManager.getInstance().trackGUIEvent("player_stats","click","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName(),"")},loadContent:function(){this.layoutScreen(this._layout);this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){switch(c.name){case "FBProfile":this._objectData=c;this._fbProfileObject= a;break;case "FBInviteBtn":this._btnFbInvite=a;this._btnFbInvite.setVisible(!1);RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&RSEngine.loginMode!=LOGIN_MODE.WEB_FACEBOOK||this._btnFbInvite.setVisible(!0);break;case "FacebookButton":this._btnFb=a;this._btnFb.setVisible(!0);RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&RSEngine.loginMode!=LOGIN_MODE.WEB_FACEBOOK||this._btnFb.setVisible(!1);break;case "Frame":this._profileFrame=a;this._profileFrame.setZOrder(2);break;case "ComingSoon":case "ComingSoonTag":GameConfig.SCRATCHER_STATS_ENABLED&& a.setVisible(!1);break;case "IconAnimation":this._iconAnim=a;this._iconAnim.stopAnimation();break;case "VipStatus":this._vipStatusAnim=a;this._vipStatusAnim.stopAnimation();var d=parseInt(RSVIPManager.getInstance().getVIPUserTier());this._vipStatusAnim.setFrame(d);0==d&&this._vipStatusAnim.setVisible(!1);break;case "NoTierBenefitsBtn":d=parseInt(RSVIPManager.getInstance().getVIPUserTier());0<d&&a.setVisible(!1);break;case "SlotsBtn":this._slotsBtn=a;break;case "VideopokerBtn":this._videoPokerBtn= a;break;case "BingoBtn":this._bingoBtn=a;break;case "ScratchersBtn":this._scratchersBtn=a;this._scratchersBtn.setTouchEnabled(!1);break;case "KenoBtn":this._kenoBtn=a;break;case "BlackjackBtn":this._blackJackBtn=a;break;case "KenoBingoBtn":this._KenoBingoBtn=a;break;case "TableGamesBtn":this._tableGamesBtn=a;break;case "RouletteBtn":this._rouletteBtn=a;0==RSGame.getInstance().getGameData().getDefaultValues().rouletteEnabled&&(this._rouletteBtn.removeTouchListener(),this._rouletteBtn._ccObject._touchListener= null,this._rouletteBtn.setOpacity(100));break;case "NameEditBtn":a.setZOrder(3);this._nameEditBtn=a;RSEngine.loginMode===LOGIN_MODE.GUEST&&this._nameEditBtn.setTouchEnabled(!1);break;case "ConfirmNameBTn":a.setZOrder(3);this._confirmNameBtn=a;this._confirmNameBtn.setVisible(!1);break;case "AvatarEditBtn":a.setZOrder(3);RSEngine.loginMode===LOGIN_MODE.GUEST&&a.setTouchEnabled(!1);break;case "VIPBaseBtn":this._vipButton=a;break;case "BaseBtn":this._baseButton=a}this._super.onObjectCreated.call(this, a,b,c)},createCustomObject:function(a,b){switch(b.type){case "IconHolder":switch(b.name){case "Icon0_Set3":this._iconLeft_set3=b;break;case "Icon1_Set3":this._iconMiddle_set3=b;break;case "Icon2_Set3":this._iconRight_set3=b;break;case "Icon0_Set2":this._iconLeft_set2=b;break;case "Icon1_Set2":this._iconRight_set2=b}break;case "label":switch(b.name){case "FavoriteTitle":this._favTitle=new RSScaledLabel("FAVORITE GAME",this._favouriteGameFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._favTitle); break;case "CustomLabel2":this._customLabel2=new RSScaledLabel("",this._customLabelFonts,b,kTEXT_ALIGNMENT_RIGHT);this.addChild(this._customLabel2);break;case "CustomText2":this._customText2=new RSScaledLabel("",this._customLabelFonts,b,kTEXT_ALIGNMENT_LEFT);this.addChild(this._customText2);break;case "CustomLabel1":this._customLabel1=new RSScaledLabel("",this._customLabelFonts,b,kTEXT_ALIGNMENT_RIGHT);this.addChild(this._customLabel1);break;case "CustomText1":this._customText1=new RSScaledLabel("", this._customLabelFonts,b,kTEXT_ALIGNMENT_LEFT);this.addChild(this._customText1);break;case "FirstPlayedLabel":this._firstPlayedLabel=new RSScaledLabel("",this._customLabelFonts,b,kTEXT_ALIGNMENT_RIGHT);this.addChild(this._firstPlayedLabel);break;case "FirstPlayedText":this._firstPlayedText=new RSScaledLabel(this._isAllTextInCaps?"FIRST PLAYED ON:":"First Played on:",this._customLabelFonts,b,kTEXT_ALIGNMENT_LEFT);this.addChild(this._firstPlayedText);break;case "NameErrorTxt":var c=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name); c&&(this._nameErrorTxt=new RSScaledLabel(c,this._customLabelFonts,b,kTEXT_ALIGNMENT_CENTER),this.addChild(this._nameErrorTxt),this._nameErrorTxt.setFontColor(255,0,0,255),this._nameErrorTxt.setVisible(!1))}}switch(b.name){case "MeterBg":this.statsMeter=RSUtils.createBasicObject(a,b);this.addChild(this.statsMeter);break;case "ProgressMeter":this._progressMeter=RSUtils.createBasicObject(a,b);c=RSGame.getInstance().getLevelManager().getLevelBarProgress();1<c&&(c%=1);this._progressMeter.setAnchorPoint(0.5, 0.5);this._progressMeter.setScaleX(c);this._progressMeter.setPosition(b.x-(b.w-b.w*c)/2,b.y);this.addChild(this._progressMeter);break;case "Star":this._star=RSUtils.createBasicObject(a,b);this.addChild(this._star);break;case "LevelsLabel":c=RSGame.getInstance().getLevelManager().getCurrentLevel();null!=this._levelPrefixText&&(c=this._levelPrefixText+c);this._levelTextFont=this._playerStatsFonts?this._playerStatsFonts.LevelTextAlignment:kTEXT_ALIGNMENT_LEFT;this._level=this._playerStatsFonts?this._playerStatsFonts.LevelFont? new RSScaledLabel(c,this._playerStatsFonts.LevelFont,b,this._levelTextFont):new RSScaledLabel(c,this._playerStatsFonts.CoinRewardFont,b,this._levelTextFont):new RSScaledLabel(c,RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),b,this._levelTextFont);this._level.setFontColor(this._fontColor.getR(),this._fontColor.getG(),this._fontColor.getB(),this._fontColor.getA());this.addChild(this._level);break;case "CoinIcon":this._coinIcon=RSUtils.createBasicObject(a,b);this.addChild(this._coinIcon); break;case "CoinsLabel":c=this.convertToNewFormat(RSEngine.dataManager.getMe().getCoins());this._coinLabel=this._playerStatsFonts?new RSScaledLabel(c,this._playerStatsFonts.CoinRewardFont,b,this._playerStatsFonts.CoinRewardAlignment):new RSScaledLabel(c,RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","normal"),b,kTEXT_ALIGNMENT_LEFT);this.addChild(this._coinLabel);break;case "nameLabel":c=RSGame.getInstance().getUserDataManager().getMe().getUserFirstName();RSEngine.loginMode==LOGIN_MODE.GUEST&& (c="GUEST");this._nameLabel=new RSScaledLabel(this._isAllTextInCaps?c.toString().toUpperCase():c,this._playerNameLabel,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._nameLabel);break;case "UserName":c=RSGame.getInstance().getUserDataManager().getMe().getUserFirstName();RSEngine.loginMode==LOGIN_MODE.GUEST&&(c="GUEST");this._originalName=this._currentValue=c;c=this.getFormattedName(c);this._nameLabel=new RSScaledLabel(this._isAllTextInCaps?c.toString().toUpperCase():c,this._playerNameLabel,b,kTEXT_ALIGNMENT_CENTER); this.addChild(this._nameLabel);break;case "EditTxtArea":this._editLabelData=b;this.addEditLabel();break;case "ConsecutiveDaysTxt":c="Consecutive days played: "+(parseInt(RSEngine.dataManager.getMe().getRetentionCount())+1),this._consecutiveDaysTxt=this._playerStatsFonts?new RSScaledLabel(c,this._playerStatsFonts.ConsecutiveDaysFont,b,kTEXT_ALIGNMENT_CENTER):new RSScaledLabel(c,RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","normal"),b,kTEXT_ALIGNMENT_LEFT),this.addChild(this._consecutiveDaysTxt)}return this._super.createCustomObject.call(this, a,b)},addEditLabel:function(){this._editableNameLabel&&this.removeChild(this._editableNameLabel);this._editableNameLabel=null;var a=RSGame.getInstance().getUserDataManager().getMe().getUserFirstName();RSEngine.loginMode==LOGIN_MODE.GUEST&&(a="GUEST");this._editableNameLabel=new RSInputBox(this._editLabelData.w,this._editLabelData.h);this._editableNameLabel.setCenter(this._editLabelData.x,this._editLabelData.y);this._editableNameLabel.setPosition(this._editLabelData.x,this._editLabelData.y);this._editableNameLabel.setFont(this._playerStatsFonts.EditablePlayerName, this._editLabelData.h/1.5);this._editableNameLabel.setMaxLength(this._playerStatsFonts.EditablePlayerNameTxtLimit);this._editableNameLabel.setName("EditTxtArea");this._editableNameLabel.setString(a);this._editableNameLabel.setFontColor(255,255,255,255);this._editableNameLabel.setInputMode(6);this._editableNameLabel.setInputFlag(6);this._editableNameLabel.setDelegate(this);this._editableNameLabel.setZOrder(3);this.addChild(this._editableNameLabel);this._editableNameLabel.setVisible(!1)},editBoxEditingReturn:function(a){}, editBoxEditingDidEnded:function(a){switch(a.getName()){case "EditTxtArea":this._nameEntered=a._ccObject._text.trim(),this._nameLabel.setString(this.getFormattedName(this._nameEntered)),this.saveNameData(!0)}},editBoxEditingDidBegan:function(a){""==a._ccObject._text?this._confirmNameBtn.setTouchEnabled(!1):this._confirmNameBtn.setTouchEnabled(!0);this._editableNameLabel&&a._ccObject._text.includes("...")&&this._editableNameLabel.setString(this._originalName);this._currentValue==this._originalName&& (/^[a-z\d\s]+$/i.test(this._currentValue)||this._editableNameLabel.setString(""))},editBoxTextChanged:function(a,b){a.getName();var c=a._ccObject._text,d=/^[a-z\d\s]+$/i.test(c);""==c||d?(this._currentValue=c,""!=c&&c.replace(/\s/g,"").length?this._confirmNameBtn.setTouchEnabled(!0):this._confirmNameBtn.setTouchEnabled(!1)):(this._editableNameLabel.setString(this._currentValue),this._editableNameLabel.startTouch())},getFormattedName:function(a){11<a.length&&(a=a.substring(0,11),a+="...");return a}, onButtonClicked:function(a){switch(a){case "FBInviteBtn":RSGame.getInstance().getGameManager().showInviteWindow();RSAnalyticsManager.getInstance().trackFBInvite();break;case "FacebookButton":RSAnalyticsManager.getInstance().trackPlayerAction("player_stats","link_fb","initiate","","");this.closePopup();RSSSOManager.saveCurrentServerTimeForGettingLinkingTime();RSLoginManager.getInstance().loginWithFacebook();break;case "CloseBtn":this.closePopup();RSAnalyticsManager.getInstance().trackGUIEvent("player_stats", "close","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName(),"");break;case "SlotsBtn":case "VideopokerBtn":case "BingoBtn":case "KenoBtn":case "BlackjackBtn":case "RouletteBtn":case "KenoBingoBtn":case "ScratchersBtn":case "TableGamesBtn":this.onTabSwitch(a);break;case "VIPBaseBtn":case "BaseBtn":this._vipButton&&this._baseButton&&(this._vipButton.setTouchEnabled(!1),this._baseButton.setTouchEnabled(!1));RSGame.getInstance().getGameManager().showVIPBenefitsPopup(function(){this._vipButton&& this._baseButton&&(this._vipButton.setTouchEnabled(!0),this._baseButton.setTouchEnabled(!0))}.bind(this));break;case "AvatarEditBtn":RSGame.getInstance().getGameManager().showWebAvatarPopup(this.setNewAvatar.bind(this));break;case "NameEditBtn":this.addEditLabel();this.saveNameData(!1);this._editableNameLabel.startTouch();break;case "ConfirmNameBTn":this.saveNameData(!0)}},setNewAvatar:function(){RSAnalyticsManager.getInstance().trackGUIEvent("player_stats","edit_pfp","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName(), "");this.setProfilePic(this._fbProfileObject,"RSPlayerStatsPopup")},saveNameData:function(a){this._nameEditBtn.setVisible(a);this._nameLabel.setVisible(a);this._editableNameLabel.setVisible(!a);this._confirmNameBtn.setVisible(!a);a?""==this._nameEntered||this._nameEntered==this._originalName?(this._nameErrorTxt&&this._nameErrorTxt.setVisible(!1),this._editableNameLabel.setString(this._originalName),this._nameLabel.setString(this.getFormattedName(this._originalName))):this._nameEntered&&this.checkForBadWordAndSaveName(): (""==this._editableNameLabel.getString()&&this._confirmNameBtn.setTouchEnabled(!1),this._editableNameLabel&&this._editableNameLabel.setString(this._originalName))},onLayoutCompleted:function(){this.setProfilePic(this._fbProfileObject,"RSPlayerStatsPopup");this._super.onLayoutCompleted.call(this);this.onTabSwitch(this._defaultButton)},setTouchEnabled:function(){},setProfilePic:function(a,b){b&&(this._screenName=b);var c=new RSImageObject,d=RSGame.getInstance().getUserDataManager().getMe().getAvatar(); GameConfig.IS_EDIT_FIELDS_ENABLED&&d?(d=GameConfig.BASE_URL+"/res/AvatarImages/"+d+".png",c.setImageFromUrl(d,this._objectData.x,this._objectData.y,this._objectData.w,this._objectData.h),a.setVisible(!1)):RSEngine.loginMode==LOGIN_MODE.EMAIL&&d?(d=GameConfig.BASE_URL+"/res/AvatarImages/"+d+".png",c.setImageFromUrl(d,this._objectData.x,this._objectData.y,this._objectData.w,this._objectData.h),a.setVisible(!1)):c.setImageFromUrl(RSGame.getInstance().getUserDataManager().getMe().getImageUrl(),this._objectData.x, this._objectData.y,this._objectData.w,this._objectData.h);this._profileImage=c;this.createProfilePicObject()},createProfilePicObject:function(){this.mask&&this.removeChild(this.mask);this._profileImage&&this._objectData&&(this.mask=new RSClippingNode(RSUtils.createBasicObject(this._screenName,this._objectData)),this.mask.setAlphaThreshold(80),this.mask.addChild(this._profileImage),this.addChild(this.mask))},doActionWithNullCheck:function(a,b,c){if(a)switch(b){case "setTouchEnabled":a.setTouchEnabled(c); break;case "removeChild":this.removeChild(a);break;case "setString":a.setString(this._isAllTextInCaps?c.toString().toUpperCase():c);break;case "setFrame":a.setFrame(c)}},onTabSwitch:function(a){this._imageName=this._path=null;var b="",c="",d=!1,e=[],f=!1;this.doActionWithNullCheck(this._slotsBtn,"setTouchEnabled",!0);this.doActionWithNullCheck(this._videoPokerBtn,"setTouchEnabled",!0);this.doActionWithNullCheck(this._bingoBtn,"setTouchEnabled",!0);this.doActionWithNullCheck(this._kenoBtn,"setTouchEnabled", !0);this.doActionWithNullCheck(this._blackJackBtn,"setTouchEnabled",!0);this.doActionWithNullCheck(this._KenoBingoBtn,"setTouchEnabled",!0);this.doActionWithNullCheck(this._tableGamesBtn,"setTouchEnabled",!0);GameConfig.SCRATCHER_STATS_ENABLED&&(this._scratchersBtn.setTouchEnabled(!0),this.doActionWithNullCheck(this._scratchersBtn,"setTouchEnabled",!0));f=RSGame.getInstance().getGameData().getDefaultValues().rouletteEnabled;1==f&&this.doActionWithNullCheck(this._rouletteBtn,"setTouchEnabled",!0); switch(a){case "SlotsBtn":this.updateGameType(RSGameTypes.Slots);this.doActionWithNullCheck(this._slotsBtn,"setTouchEnabled",!1);this.doActionWithNullCheck(this._iconAnim,"setFrame",0);c=0;a=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots);for(var f=RSGame.getInstance().getLevelManager().getCurrentLevel(),g=parseInt(RSVIPManager.getInstance().getVIPUserTier()),h=0;h<a.length;h++)parseInt(a[h].levelRequired)<=f&&c++;for(var b=c,c=RSUtils.formatNumberWithComma(RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("getSlotWin")), k=RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("getSpins"),h=0;h<a.length;h++)for(var m=0;m<Object.keys(k).length;m++)a[h].machine_identifier==Object.keys(k)[m]&&(parseInt(a[h].levelRequired)<=f&&void 0!=a[h].levelRequired&&""!=a[h].levelRequired||parseInt(a[h].VIPTier)<=g&&0<parseInt(a[h].VIPTier)||RSGame.getInstance().getUserDataManager().getMe().isMachineFeatured(a[h].machine_identifier)||UrlNotificationManager.getInstance().getAllMachineUnlockStatus()||RSGame.getInstance().getUserDataManager().getMe().isMachineFeaturedInNewMachines(a[h].machine_identifier))&& (e[Object.keys(k)[m]]=Object.values(k)[m]);break;case "VideopokerBtn":this.updateGameType(RSGameTypes.Poker);this.doActionWithNullCheck(this._videoPokerBtn,"setTouchEnabled",!1);this.doActionWithNullCheck(this._iconAnim,"setFrame",1);b=RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("getMachinesPlayed");c=RSUtils.formatNumberWithComma(RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("pokerStatsGetHighestWin"));e=RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("getPokerDealCount"); break;case "ScratchersBtn":this.updateGameType(RSGameTypes.Scratcher);this.doActionWithNullCheck(this._scratchersBtn,"setTouchEnabled",!1);this.doActionWithNullCheck(this._iconAnim,"setFrame",3);c=RSUtils.formatNumberWithComma(RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("ScratcherStatsGetHighestWin"));e=RSGame.getInstance().getUserDataManager().getMe().getScratcherRounds();b=Object.keys(e).length;e=RSEngine.dataManager.getMe().getScratcherRounds();break;case "RouletteBtn":this.updateGameType(RSGameTypes.Roulette); this.doActionWithNullCheck(this._rouletteBtn,"setTouchEnabled",!1);this.doActionWithNullCheck(this._iconAnim,"setFrame",5);b=RSUtils.formatNumberWithComma(RSGame.getInstance().getUserDataManager().getMe().RouletteStatsGetHighestWin());e=RSEngine.dataManager.getMe().getRouletteRounds();break;case "BingoBtn":this.updateGameType(RSGameTypes.Bingo);this.doActionWithNullCheck(this._bingoBtn,"setTouchEnabled",!1);this.doActionWithNullCheck(this._iconAnim,"setFrame",2);b=RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("getBingoCardsWon"); e=RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("getBingoRoomCardCount");break;case "KenoBtn":this.updateGameType(RSGameTypes.Keno);this.doActionWithNullCheck(this._kenoBtn,"setTouchEnabled",!1);this.doActionWithNullCheck(this._iconAnim,"setFrame",3);c=RSUtils.formatNumberWithComma(RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("kenoStatsGetHighestWin"));e=RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("getKenoDealCount"); b=""+Object.keys(e).length;break;case "BlackjackBtn":this.updateGameType(RSGameTypes.Blackjack);this.doActionWithNullCheck(this._blackJackBtn,"setTouchEnabled",!1);this.doActionWithNullCheck(this._iconAnim,"setFrame",4);b=RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("getBlackajackWonStats");c=RSUtils.formatNumberWithComma(RSGame.getInstance().getUserDataManager().getMe().getBlackjackHighestWin());e=RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("getBlackjackDealCount"); break;case "KenoBingoBtn":this.updateGameType(RSGameTypes.Bingo);this.doActionWithNullCheck(this._KenoBingoBtn,"setTouchEnabled",!1);this.doActionWithNullCheck(this._iconAnim,"setFrame",2);b=RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("getBingoCardsWon");e=RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("getBingoRoomCardCount");this.setFavMachinesInfo("MachineOne",b,e);this.updateGameType(RSGameTypes.Keno);c=RSUtils.formatNumberWithComma(RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("kenoStatsGetHighestWin")); e=RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("getKenoDealCount");this.setFavMachinesInfo("MachineTwo",c,e);d=!0;this._firstPlayedLabel.setString(this._isAllTextInCaps?RSEngine.dataManager.getMe().getFirstPlayed("kenoBingo").toString().toUpperCase():RSEngine.dataManager.getMe().getFirstPlayed("kenoBingo"));break;case "TableGamesBtn":this.updateGameType(RSGameTypes.Roulette),this.doActionWithNullCheck(this._tableGamesBtn,"setTouchEnabled",!1),this.doActionWithNullCheck(this._iconAnim, "setFrame",4),b=RSUtils.formatNumberWithComma(RSGame.getInstance().getUserDataManager().getMe().RouletteStatsGetHighestWin()),e=RSEngine.dataManager.getMe().getRouletteRounds(),this.setFavMachinesInfo("MachineOne",b,e),this.updateGameType(RSGameTypes.Blackjack),b=RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("getBlackajackWonStats"),e=RSGame.getInstance().getUserDataManager().getMe().getProfileStatusValue("getBlackjackDealCount"),this.setFavMachinesInfo("MachineTwo",b,e), d=!0,this._firstPlayedLabel.setString(this._isAllTextInCaps?RSEngine.dataManager.getMe().getFirstPlayed("TableGames").toString().toUpperCase():RSEngine.dataManager.getMe().getFirstPlayed("TableGames"))}d||(this._firstPlayedLabel.setString(this._isAllTextInCaps?RSEngine.dataManager.getMe().getFirstPlayed(this._gameType).toString().toUpperCase():RSEngine.dataManager.getMe().getFirstPlayed(this._gameType)),this._customText1.setString(this._isAllTextInCaps?this.customText1[this._gameType].toString().toUpperCase(): this.customText1[this._gameType]),this._customLabel1.setString(this._isAllTextInCaps?b.toString().toUpperCase():b),this.customText1[this._gameType]==this.customText2[this._gameType]?(this._customText2.setString(" "),this._customLabel2.setString("")):(this._customText2.setString(this._isAllTextInCaps?this.customText2[this._gameType].toString().toUpperCase():this.customText2[this._gameType]),this._customLabel2.setString(this._isAllTextInCaps?c.toString().toUpperCase():c)),d=RSGame.getInstance().getGameData().getMachineDetails(this._gameType), e&&0!==Object.keys(e).length?this.getTopPlayedMachines(d,e,this._path,this._imageName):this.getDefaultMachines(d))},setFavMachinesInfo:function(a,b,c){switch(a){case "MachineOne":this._customText2.setString(this._isAllTextInCaps?this.customText1[this._gameType].toString().toUpperCase():this.customText1[this._gameType]);this._customLabel2.setString(this._isAllTextInCaps?b.toString().toUpperCase():b);this._firstMachine=c;this._machineDetails1=RSGame.getInstance().getGameData().getMachineDetails(this._gameType); this._machineDetails1.gameType=this._gameType;this._machineDetails1._path=this._path;break;case "MachineTwo":this._customText1.setString(this._isAllTextInCaps?this.customText2[this._gameType].toString().toUpperCase():this.customText2[this._gameType]);this._customLabel1.setString(this._isAllTextInCaps?b.toString().toUpperCase():b);this._secondMachine=c;this._machineDetails2=RSGame.getInstance().getGameData().getMachineDetails(this._gameType);this._machineDetails2.gameType=this._gameType;this._machineDetails2._path= this._path;var d=Object.assign({},c,this._firstMachine,this._secondMachine);a=Object.keys(d).sort(function(a,b){return d[a]-d[b]}).reverse();3<a.length&&(a=a.slice(0,3));0==a.length&&(b=RSGame.getInstance().getGameData().getSheetData(defaultMachineSheet[this._machineDetails1.gameType]),c=RSGame.getInstance().getGameData().getSheetData(defaultMachineSheet[this._machineDetails2.gameType]),a.push(b[0].id,c[0].id));this.setcombinedFavMachineDetails(a,this._machineDetails1,this._machineDetails2)}},setcombinedFavMachineDetails:function(a, b,c){for(var d=[],e=0;e<a.length;e++){var f=this.searchInM1(a[e],b);0==f?(f=this.searchInM2(a[e],c),0!=f&&d.push(f)):d.push(f)}this.setCombinedFavMachines(d,this._imageName)},searchInM1:function(a,b){for(var c=0;c<b.length;c++)if(b[c].machine_identifier==a)return b[c]._gameType=b.gameType,b[c]._path=b._path,b[c];return 0},searchInM2:function(a,b){for(var c=0;c<b.length;c++)if(b[c].machine_identifier==a)return b[c]._gameType=b.gameType,b[c]._path=b._path,b[c];return 0},setCombinedFavMachines:function(a, b){this.doActionWithNullCheck(this._iconHolder1,"removeChild");this.doActionWithNullCheck(this._iconHolder2,"removeChild");this.doActionWithNullCheck(this._iconHolder3,"removeChild");this.doActionWithNullCheck(this._favTitle,"setString",1===a.length?"FAVORITE GAME":"FAVORITE GAMES");if(a&&b)switch(a.length){case 1:this._iconHolder1=new RSIconHolder("CUSTOM_ICON",this._iconMiddle_set3,a[0]._path+a[0][b],this.onFavoriteMachineClicked.bind(this),a[0],!0,this._font,!1);this._iconHolder1.setPosition(this._iconMiddle_set3.x/ 2,this._iconMiddle_set3.y/2);this.addChild(this._iconHolder1);break;case 2:this._iconHolder1=new RSIconHolder("CUSTOM_ICON",this._iconLeft_set2,a[0]._path+a[0][b],this.onFavoriteMachineClicked.bind(this),a[0],!0,this._font,!1);this._iconHolder1.setPosition(this._iconLeft_set2.x/2,this._iconLeft_set2.y/2);this.addChild(this._iconHolder1);this._iconHolder2=new RSIconHolder("CUSTOM_ICON",this._iconRight_set2,a[1]._path+a[1][b],this.onFavoriteMachineClicked.bind(this),a[1],!0,this._font,!1);this._iconHolder2.setPosition(this._iconRight_set2.x/ 2,this._iconRight_set2.y/2);this.addChild(this._iconHolder2);break;case 3:this._iconHolder1=new RSIconHolder("CUSTOM_ICON",this._iconMiddle_set3,a[1]._path+a[1][b],this.onFavoriteMachineClicked.bind(this),a[1],!0,this._font,!1),this._iconHolder1.setPosition(this._iconMiddle_set3.x/2,this._iconMiddle_set3.y/2),this.addChild(this._iconHolder1),this._iconHolder2=new RSIconHolder("CUSTOM_ICON",this._iconLeft_set3,a[0]._path+a[0][b],this.onFavoriteMachineClicked.bind(this),a[0],!0,this._font,!1),this._iconHolder2.setPosition(this._iconLeft_set3.x/ 2,this._iconLeft_set3.y/2),this.addChild(this._iconHolder2),this._iconHolder3=new RSIconHolder("CUSTOM_ICON",this._iconRight_set3,a[2]._path+a[2][b],this.onFavoriteMachineClicked.bind(this),a[2],!0,this._font,!1),this._iconHolder3.setPosition(this._iconRight_set3.x/2,this._iconRight_set3.y/2),this.addChild(this._iconHolder3)}},updateGameType:function(a){this._gameType=a;RSGame.getInstance().getGameManager().setGameType(a);this._path=this._iconPathArray[a];this._imageName=this._iconNameArray[a]},getTopPlayedMachines:function(a, b,c,d){this._topMachineDetails=[];var e=Object.entries(b).sort(function(a,b){return b[1]-a[1]}).map(function(a){return a[0]});b=e;3<e.length&&(b=e.slice(0,3));for(e=0;e<b.length;e++)for(var f in a)if(a[f].machine_identifier==b[e]){this._topMachineDetails.push(a[f]);break}this.setFavoriteMachine(this._topMachineDetails,c,d)},setFavoriteMachine:function(a,b,c){this.doActionWithNullCheck(this._iconHolder1,"removeChild");this.doActionWithNullCheck(this._iconHolder2,"removeChild");this.doActionWithNullCheck(this._iconHolder3, "removeChild");this.doActionWithNullCheck(this._favTitle,"setString",1===a.length?"FAVORITE GAME":"FAVORITE GAMES");if(a&&c)switch(a.length){case 1:this._iconHolder1=a[0].iconUrl?new RSIconHolder("CUSTOM_ICON",this._iconMiddle_set3,a[0].iconUrl,this.onFavoriteMachineClicked.bind(this),a[0],!0,this._font,!1):new RSIconHolder("CUSTOM_ICON",this._iconMiddle_set3,b+a[0][c],this.onFavoriteMachineClicked.bind(this),a[0],!0,this._font,!1);this._iconHolder1.setPosition(this._iconMiddle_set3.x/2,this._iconMiddle_set3.y/ 2);this.addChild(this._iconHolder1);break;case 2:this._iconHolder1=a[0].iconUrl?new RSIconHolder("CUSTOM_ICON",this._iconLeft_set2,a[0].iconUrl,this.onFavoriteMachineClicked.bind(this),a[0],!0,this._font,!1):new RSIconHolder("CUSTOM_ICON",this._iconLeft_set2,b+a[0][c],this.onFavoriteMachineClicked.bind(this),a[0],!0,this._font,!1);this._iconHolder1.setPosition(this._iconLeft_set2.x/2,this._iconLeft_set2.y/2);this.addChild(this._iconHolder1);this._iconHolder2=a[1].iconUrl?new RSIconHolder("CUSTOM_ICON", this._iconRight_set2,a[1].iconUrl,this.onFavoriteMachineClicked.bind(this),a[1],!0,this._font,!1):new RSIconHolder("CUSTOM_ICON",this._iconRight_set2,b+a[1][c],this.onFavoriteMachineClicked.bind(this),a[1],!0,this._font,!1);this._iconHolder2.setPosition(this._iconRight_set2.x/2,this._iconRight_set2.y/2);this.addChild(this._iconHolder2);break;case 3:this._iconHolder1=a[1].iconUrl?new RSIconHolder("CUSTOM_ICON",this._iconMiddle_set3,a[1].iconUrl,this.onFavoriteMachineClicked.bind(this),a[1],!0,this._font, !1):new RSIconHolder("CUSTOM_ICON",this._iconMiddle_set3,b+a[1][c],this.onFavoriteMachineClicked.bind(this),a[1],!0,this._font,!1),this._iconHolder1.setPosition(this._iconMiddle_set3.x/2,this._iconMiddle_set3.y/2),this.addChild(this._iconHolder1),this._iconHolder2=a[0].iconUrl?new RSIconHolder("CUSTOM_ICON",this._iconLeft_set3,a[0].iconUrl,this.onFavoriteMachineClicked.bind(this),a[0],!0,this._font,!1):new RSIconHolder("CUSTOM_ICON",this._iconLeft_set3,b+a[0][c],this.onFavoriteMachineClicked.bind(this), a[0],!0,this._font,!1),this._iconHolder2.setPosition(this._iconLeft_set3.x/2,this._iconLeft_set3.y/2),this.addChild(this._iconHolder2),this._iconHolder3=a[2].iconUrl?new RSIconHolder("CUSTOM_ICON",this._iconRight_set3,a[2].iconUrl,this.onFavoriteMachineClicked.bind(this),a[2],!0,this._font,!1):new RSIconHolder("CUSTOM_ICON",this._iconRight_set3,b+a[2][c],this.onFavoriteMachineClicked.bind(this),a[2],!0,this._font,!1),this._iconHolder3.setPosition(this._iconRight_set3.x/2,this._iconRight_set3.y/2), this.addChild(this._iconHolder3)}},getDefaultMachines:function(a){this._defaultMachine=RSGame.getInstance().getGameData().getSheetData(defaultMachineSheet[this._gameType]);for(var b=[],c=0;c<this._defaultMachine.length;c++)for(var d in a)if(this._defaultMachine[c].id==a[d].machine_identifier){b.push(a[d]);break}this.setFavoriteMachine(b,this._path,this._imageName)},onFavoriteMachineClicked:function(a){this.closePopup();var b=!0;RSAnalyticsManager.getInstance().trackGUIEvent("player_stats","close", "open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName(),"");a.machine_identifier!=RSAnalyticsManager.getInstance().getCurrentMachineName()&&(RSGame.getInstance().getGameManager().triggerMemoryPopupStatus(this._gameType,a.machine_identifier)||(RSEngine.externalGameManager.unLoadExternalGame(),b=!1),RSGame.getInstance().getGameManager().setLocationForMachineOpenPopup(null,null),RSEngine.loginMode==LOGIN_MODE.GUEST||RSGame.getInstance().getGameManager().triggerMemoryPopupStatus(this._gameType, a.machine_identifier)||(RSGameScreenManager.getInstance().removeAllScreensExceptMainLobby(),b=GlobalVars.isjackpotLoaded=!1),a._gameType&&(this._gameType=a._gameType),RSCasinoManager.getCasinoInterface().loadMachine(this._gameType,a.machine_identifier,"ProfileStats",null,null,b))},convertToNewFormat:function(a){a=a.toString();return a=12>=a.length?RSUtils.formatNumberWithComma(a):14>=a.length?RSUtils.formatNumberWithComma(a.substr(0,a.length-6))+"M":RSUtils.formatNumberWithComma(a.substr(0,a.length- 9))+"B"},checkForBadWordAndSaveName:function(){RSEngine.screenManager.addOverlay();RSEngine.dataManager.checkNameIsValideOrNot(this._nameEntered,this._successCallBack.bind(this),this._failedCallBack.bind(this))},_successCallBack:function(a){200==a.result.status&&(a.result.data?(cc.log("bad word"),this._nameLabel.setString(this.getFormattedName(this._originalName)),this._editableNameLabel.setString(this.getFormattedName(this._originalName)),this._nameErrorTxt&&this._nameErrorTxt.setVisible(!0)):(this._nameErrorTxt&& this._nameErrorTxt.setVisible(!1),this._originalName=this._nameEntered,RSGame.getInstance().getUserDataManager().getMe().setUserFirstName(this._nameEntered),RSGame.getInstance().getUserDataManager().saveUserData("setUserFirstName"),RSAnalyticsManager.getInstance().trackGUIEvent("player_stats","edit_name","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName(),this._nameEntered)));RSEngine.screenManager.removeOverlay()},_failedCallBack:function(){RSEngine.screenManager.removeOverlay(); cc.log("failed")},closePopup:function(){RSGame.getInstance().getGameManager().setGameType(this._defaultGameType);this._super.closePopup.call(this)}});var RSSweepstakesManager={_fonts:null,_sweepstakesData:{},_getStatusSuccesCallBack:null,_getStatusFailCallBack:null,_currentPopup:null,_curtainraiserCallBack:null,_rewardAnnouncementCallBack:null,_rewardHistory:null,initializeCataboomManager:function(a,b){this._fonts=a;this._sweepstakesRewardValue=RSGame.getInstance().getGameData().getDefaultValues().sweepStakesRewadValue;this._termsAndConditionsUrl=b;this.getJackpotSweepstakesStatus(!1);this.getRewardHistoryFromServer();RSEventManager.getInstance().addEventListener("onSweepstakesPopupClose", this,this._onSweepstakesPopupClose.bind(this));cc.log("Cataboom initialized")},getName:function(){return"RSSweepstakesManager"},getJackpotSweepstakesStatus:function(a,b,c,d,e){c={};a&&(c=b,this._getStatusSuccesCallBack=d,this._getStatusFailCallBack=e);RSGame.getInstance().getUserDataManager().getSweeptakesStatus(c,a,this.onGetSweepstakesSuccess.bind(this),this.onGetSweepstakesFailed.bind(this))},onGetSweepstakesSuccess:function(a){a.result.data&&(this._sweepstakesData=a.result.data,cc.log("Sweepstakes data:"+ JSON.stringify(a.result.data)));if(null!=this._getStatusSuccesCallBack){var b=!0;"duplicateId"==a.result.message&&(b=!1);this._getStatusSuccesCallBack(b);this._getStatusSuccesCallBack=this._getStatusFailCallBack=null}if(this._currentPopup)switch(RSEngine.screenManager.removeOverlay(),this._currentPopup){case "CurtainRaiser":this.showJackpotSweepstakesEntryPopup(!0);break;case "winnerAnnouncement":this.getSweepstakesRewardAnnouncementPopupTriggerStatus()&&this.showSweepstakesRewardAnnouncementPopup(); break;default:this.triggerPopupAfterRefreshingData()}this._currentPopup=null},getRewardHistoryFromServer:function(){RSGame.getInstance().getUserDataManager().getSweeptakesRewardHistory(this.onGetSweepstakesRewardHistory.bind(this),this.onGetSweepstakesRewardHistoryFailed.bind(this))},onGetSweepstakesFailed:function(){},onGetSweepstakesRewardHistory:function(a){this._rewardHistory=a.result.data;a.result.data[0]&&(this._sweepstakesRewardPreviousValue=a.result.data[0].win)},getRewardHistory:function(){return this._rewardHistory}, onGetSweepstakesRewardHistoryFailed:function(){},getSweepstakesData:function(){return this._sweepstakesData},getSweepstakesRewardValue:function(){return this._sweepstakesRewardValue},getSweepstakesPreviousRewardValue:function(){return this._sweepstakesRewardPreviousValue},getSweepstakesRewardAnnouncementPopupTriggerStatus:function(){return this._sweepstakesData&&"true"==this._sweepstakesData.isPopupShown?!0:!1},getCoolDownTimeEnableStatus:function(){return this._sweepstakesData&&"true"==this._sweepstakesData.cooldownTimeEnabled? !0:!1},getNextWeeksSweepstakesEnabledStatus:function(){return this._sweepstakesData&&this._sweepstakesData.isSweepstakesNextWeekEnabled?!0:!1},showSweepstakesRewardAnnouncementPopup:function(a,b){a&&(this._rewardAnnouncementCallBack=a);"true"==this._sweepstakesData.isWinner?this.showJackpotSweepstakesWinnerPopup(b):"true"==this._sweepstakesData.isPopupShown&&this.showJackpotSweepstakesBetterLuckPopup(b);this._sweepstakesData.isWinner="false";this._sweepstakesData.isPopupShown="false";this.deleteSweepstakesInfo()}, showJackpotSweepstakesEntryPopup:function(a,b,c,d){b&&(this._curtainraiserCallBack=b);this.checkForRemainingTimeValidity()?a?(SideMenuController.getInstance().setSideMenuVisibility(!1),this.curtainScreen=new RSJackpotSweepstakesCurtainRaiserScreen(this.onCurtainAnimComplete.bind(this)),RSEngine.screenManager.addScreen(this.curtainScreen)):this.getCoolDownTimeEnableStatus()?this.showJackpotSweepstakesCooldownPopup():("mainLobbyAutoTrigger"==d&&(RSGame.getInstance().getUserDataManager().getMe().setPlatformEventCounter(RSPlatformEventTypeKeys.SWEEPSTAKES+ "_"+RSPlatformPopupNameKeys.SWEEPSTAKES_ENTRY_POPUP),d=null),a=[{name:RSGame.getInstance().getAssetPath("JackpotSweepstakesEntryPopup"),count:1}],b=RSGame.getInstance().getGameManager().getSweepstakesEntryFontColor()?RSGame.getInstance().getGameManager().getSweepstakesEntryFontColor():new RSColor(255,255,255,200),RSEngine.popupManager.addPopup(new RSJackpotSweepstakesEntryPopup(a,this._fonts,this.getSweepstakesData().remainingTime,b,this._termsAndConditionsUrl,c,this.getSweepstakesData().isRewardHistoryEnabled, d),!0,!0,!0)):a?this.fetchSweepstakesStatus("CurtainRaiser"):this.fetchSweepstakesStatus("EntryPopup")},showJackpotSweepstakesEntrySuccesPopup:function(a,b){if(this.checkForRemainingTimeValidity())if(this.getCoolDownTimeEnableStatus(!1,b))this.showJackpotSweepstakesCooldownPopup();else{var c=[{name:RSGame.getInstance().getAssetPath("JackpotSweepstakesentrySuccesPopup"),count:1}];RSEngine.popupManager.addPopup(new RSJackpotSweepstakesEntrySuccesPopup(c,this._fonts,this.getSweepstakesData().remainingTime, this.getSweepstakesData().rewardTime,this._termsAndConditionsUrl,a,b))}else this.fetchSweepstakesStatus()},showJackpotSweepstakesCooldownPopup:function(a,b){var c=!1;this._SSCooldownPopupcallback=b;if(this.checkForRemainingTimeValidity()){a&&(c=a);var d=[{name:RSGame.getInstance().getAssetPath("JackpotSweepstakesentrySuccesPopup"),count:1}];RSEngine.popupManager.addPopup(new RSJackpotSweepstakesCooldownPopup(d,this._fonts,this.getSweepstakesData().rewardTime,c,this._termsAndConditionsUrl,this.sweepstakesCooldownPopupCallback.bind(this), this.getSweepstakesData().isRewardHistoryEnabled))}else this.fetchSweepstakesStatus()},sweepstakesCooldownPopupCallback:function(){this._SSCooldownPopupcallback&&(this._SSCooldownPopupcallback(),this._SSCooldownPopupcallback=null)},showJackpotSweepstakesWinnerPopup:function(a){var b=[{name:RSGame.getInstance().getAssetPath("JackpotSweepstakesWinnerPopup"),count:1}];RSEngine.popupManager.addPopup(new RSJackpotSweepstakesWinnerPopup(b,this._fonts,a))},showJackpotSweepstakesBetterLuckPopup:function(a){var b= [{name:RSGame.getInstance().getAssetPath("JackpotSweepstakesBetterLuckPopup"),count:1}];RSEngine.popupManager.addPopup(new RSJackpotSweepstakesBetterLuckPopup(b,this._fonts,this.getSweepstakesData().remainingTime,this.getSweepstakesData().winnerInfo,this._termsAndConditionsUrl,a))},showJackpotSweepstakesWinnersList:function(a){this._SSWinnerScreenPopupCallback=a;a=[{name:RSGame.getInstance().getAssetPath("JLSweepstakesBgScreen"),count:1},{name:RSGame.getInstance().getAssetPath("JLSweepstakesBadgeAnim"), count:1},{name:RSGame.getInstance().getAssetPath("JackpotSweepstakesWinnersScreen"),count:1}];this._sweepstakesWinnerScreen=new RSJackpotSweepstakesPreviousWinnersScreen(a,this.removeLeaderboardScreen.bind(this),this._fonts.HISTORY_FONT,this._termsAndConditionsUrl);RSEngine.screenManager.addScreen(this._sweepstakesWinnerScreen)},removeLeaderboardScreen:function(){this._sweepstakesWinnerScreen&&(RSEngine.screenManager.removeScreen(this._sweepstakesWinnerScreen),this._leaderboardScreen=null,RSEngine.externalGameManager&& RSEngine.externalGameManager.showExternalGame(),RSGame.getInstance().getGameManager().setSideMenuVisibility(!0));RSSweepstakesManager.getNextWeeksSweepstakesEnabledStatus()?this._SSWinnerScreenPopupCallback?this.showJackpotSweepstakesEntryPopup(!0,this._SSWinnerScreenPopupCallback):this.showJackpotSweepstakesEntryPopup():(RSEventManager.getInstance().dispatchEvent("onSweepstakesPopupClose"),this._SSWinnerScreenPopupCallback&&this._SSWinnerScreenPopupCallback())},onCurtainAnimComplete:function(){this.curtainScreen&& RSEngine.screenManager.removeScreen(this.curtainScreen)},deleteSweepstakesInfo:function(){RSGame.getInstance().getUserDataManager().deleteSweepstakesData(this.onSweepStakesInfoDataDeletion.bind(this),this.deleteSweepstakesInfo.bind(this))},onSweepStakesInfoDataDeletion:function(){cc.log("data deleted")},checkForRemainingTimeValidity:function(){return this._sweepstakesData.remainingTime>TimeManager.getInstance().getCurrentServerTime()?!0:!1},fetchSweepstakesStatus:function(a,b,c){b&&(this._rewardAnnouncementCallBack= b);this._currentPopup=a?a:"trigger";c?this._currentPopup=null:RSEngine.screenManager.addOverlay();this.getJackpotSweepstakesStatus(!1)},triggerPopupAfterRefreshingData:function(){this.getSweepstakesRewardAnnouncementPopupTriggerStatus()?this.showSweepstakesRewardAnnouncementPopup("",!0):this.getCoolDownTimeEnableStatus()?this.showJackpotSweepstakesCooldownPopup(!0):RSSweepstakesManager.getNextWeeksSweepstakesEnabledStatus()&&this.showJackpotSweepstakesEntryPopup("","",!0)},getSweepstakesEntryPopupTriggerStatusForEvent:function(a){return!GlobalVars.isSurfacingActive&& GameConfig.SWEEPSTAKES_ENABLED&&RSGame.getInstance().getUserDataManager().getMe().getSweepstakesSurfaceShownStatus()&&RSGame.getInstance().getGameVariable().getSweepstakeEnabledStatus()&&!RSSweepstakesManager.getCoolDownTimeEnableStatus()&&GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&RSGame.getInstance().getPlatformEventManager()&&RSGame.getInstance().getPlatformEventManager().getPlatformEventDispatchAndStatus(RSPlatformEventTypeKeys.SWEEPSTAKES,a,RSPlatformEventTypeKeys.SWEEPSTAKES,RSPlatformPopupNameKeys.SWEEPSTAKES_ENTRY_POPUP)? !0:!1},_onSweepstakesPopupClose:function(){this._curtainraiserCallBack?(this._curtainraiserCallBack(),this._curtainraiserCallBack=null):this._rewardAnnouncementCallBack&&(this._rewardAnnouncementCallBack(),this._rewardAnnouncementCallBack=null)}};var RSJackpotSweepstakesCurtainRaiserScreen=RSCurtainRaiserScreen.extend({init:function(a){this._super.init.call(this,RSGame.getInstance().getAssetPath("CurtainRaiser"));this.callBack=a},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._emitterObject=new RSPanel(0, 0,0,0);this.addChild(this._emitterObject);this._emitterObject.setZOrder(1);RSUtils.callFunctionWithDelay(1.4,this,this._playEmitter.bind(this))},_playEmitter:function(){this.loadParticleEffect();this._particleEmitter.startEmitter();RSUtils.callFunctionWithDelay(0.3,this,this._startScreenShow.bind(this))},_startScreenShow:function(){this._emitterObject.setZOrder(0)},onJLUnlockAnimComplete:function(){},firstSectionComplete:function(){RSSweepstakesManager.showJackpotSweepstakesEntryPopup(null,null,!0)}, onCurtainRaised:function(){this.callBack&&this.callBack()},onDCUnlockAnimComplete:function(a){},loadParticleEffect:function(){cc.spriteFrameCache.addSpriteFrames("res/PlatformWidgets/CurtainRaiser/SweepstakesParticle_00-hd.plist");var a=new RSEmitterParticleParams;a._spriteFrames.push("SweepstakesParticle_00/PurpleStar1.png");a._spriteFrames.push("SweepstakesParticle_00/PurpleStar2.png");a._spriteFrames.push("SweepstakesParticle_00/PinkStar2.png");a._spriteFrames.push("SweepstakesParticle_00/PinkStar2.png"); a._spriteFrames.push("SweepstakesParticle_00/Money1.png");a._spriteFrames.push("SweepstakesParticle_00/Money1.png");a._startScale=0.6;a._startScaleVariance=0;a._endScale=4;a._endScaleVariance=0.2;a._scalingDuration=1;a._startDelay=0.5;a._startDelayVariance=1.5;a._deviation=600;a._deviationVariance=100;a._speed=900;a._360rotationDuration=0.5;a._tweenRate=0.5;a._spriteAnimationSpeed=0.25;a._origin=new RSPoint(RSEngine.screenWidth/2,RSEngine.screenHeight/2);a._originVariance=new RSPoint(20,20);a._displacement= new RSPoint(0,0);a._displacementVariance=new RSPoint(RSEngine.screenWidth/2,RSEngine.screenHeight/2);var b=RSGame.getInstance().getGameManager().getCustomizedParticleCount()?RSGame.getInstance().getGameManager().getCustomizedParticleCount():170;this._particleEmitter=new RSCustomAnimationEmitter(a,!1,RSCustomEmitterType.FIREWORK,b,this._onEmittingCompleted.bind(this));this._emitterObject.addChild(this._particleEmitter);this._particleEmitter.loadEmitter()},_onEmittingCompleted:function(){},unloadContent:function(){this._super.unloadContent.call(this)}});var RSJackpotSweepstakesPopup=RSPopup.extend({init:function(a){this._assetFolder=a;a=new RSRect(0,0,0,0);this._displayPanel=new RSDisplayObject(a);this._super.init.call(this)},loadContent:function(){this.layoutScreen(this._assetFolder);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.addChild(this._displayPanel)},createCustomObject:function(a,b){return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":this.closePopup(); break;case "SupportBtn":this.onPlayerSupportClicked()}},onPlayerSupportClicked:function(){document.getElementById("Helpshift").style.display="block";document.getElementById("helpshiftoverlay").style.display="block";this._playerSupportactive=!0},unloadContent:function(){this._super.unloadContent.call(this)}});var RSJackpotSweepstakesEntryPopup=RSGenericPopup.extend({init:function(a,b,c,d,e,f,g,h){this._assetFolder=a;this._fonts=b;this._tickStatus=!1;this._remainingTime=c;this._radioButtonStatus={RadioButton1:0,RadioButton2:0};this._fontColor=d;this._retryCount=0;this._lastNameText=this._firstNameText="";this._timeExpired=!1;this._termsAndConditionsUrl=e;this._cheatTime=RSSweepstakesManager._sweepstakesData.rewardTime;this._popupTriggered=f;this._rewardHistoryEnabledStatus=g;this._checkMail2=!1;this._openFrom= h?h:RSAnalyticsManager.getInstance().getCurrentMachineName();this._super.init.call(this);f?RSAnalyticsManager.getInstance().trackGUIEvent("sweepstakes","sweepstakes_popup","trigger",""):RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes","click","open_from_"+this._openFrom,"","")},loadContent:function(){this.layoutScreen(this._assetFolder);this._super.loadContent.call(this)},onLayoutCompleted:function(){this.playWinAnimation();this._super.onLayoutCompleted.call(this);this.checkAndUpdateSubmitButton()}, onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "Sweepstakes":a.stopAnimation();break;case "RadioButton1":this._termsAndConditionTickButton=a;this._termsAndConditionTickButton.stopAnimation();this._termsAndConditionTickButton.addTouchListenerWithDelegate(this);break;case "RadioButton2":this._confirmAgeTickButton=a;this._confirmAgeTickButton.stopAnimation();this._confirmAgeTickButton.addTouchListenerWithDelegate(this);break;case "InvalidEmail":this._icon1= a;this._icon1.setVisible(!1);break;case "InvalidEmail1":this._icon2=a;this._icon2.setVisible(!1);break;case "Required":this._mandatoryIcon=a;this._mandatoryIcon.setVisible(!1);break;case "StarAnimationSmallRight":this._starAnimationSmallRight=a;this._starAnimationSmallRight.flipHorizontally(!0);this._starAnimationSmallRight.stopAnimation();break;case "StarAnimationRight":this._starAnimationRight=a;this._starAnimationRight.flipHorizontally(!0);this._starAnimationRight.stopAnimation();break;case "StarAnimationSmallLeft":this._starAnimationSmallLeft= a;this._starAnimationSmallLeft.stopAnimation();break;case "StarAnimationLeft":this._starAnimationLeft=a;this._starAnimationLeft.stopAnimation();break;case "WinBigAnimationRight":this._winBigAnimationRight=a;this._winBigAnimationRight.stopAnimation();break;case "WinBigAnimationLeft":this._winBigAnimationLeft=a;this._winBigAnimationLeft.stopAnimation();break;case "AlreadyRegistered":this._alreadyRegisteredIcon=a;this._alreadyRegisteredIcon.setVisible(!1);break;case "PreviousWinnersBtn":"0"==this._rewardHistoryEnabledStatus&& a.setVisible(!1),this._previousWinnersBtn=a}},createCustomObject:function(a,b){switch(b.name){case "WinBarText":var c="WIN $"+RSSweepstakesManager.getSweepstakesRewardValue()+"!",c=new RSLabelBMFont(c,this._fonts.REWARD_TEXT,2*b.w,kTEXT_ALIGNMENT_CENTER);c.setCenter(b.x,b.y);this.addChild(c);this._fonts.ENTRY_REWARD_TEXT_SCALE&&c.setScale(this._fonts.ENTRY_REWARD_TEXT_SCALE);break;case "FirstNameTextBar":this._firstName=new RSInputBox(b.w,b.h);this._firstName.setPosition(b.x,b.y-b.h/5);this._firstName.setFont(this._fonts.INPUTBOX_TEXT, b.h/1.5);this._firstName.setFontColor(255,255,255,25);this._firstName.setName("FirstName");this._firstName.setString("");this._firstName.setInputMode(6);this._firstName.setInputFlag(1);this._firstName.setPlaceholderFont(this._fonts.INPUTBOX_TEXT,b.h/1.5);this._firstName.setPlaceholderFontColor(this._fontColor.getR(),this._fontColor.getG(),this._fontColor.getB(),this._fontColor.getA());this._firstName.setPlaceholderText("First Name *");this._firstName.setDelegate(this);this.addChild(this._firstName); break;case "LastNameTextBar":this._lastName=new RSInputBox(b.w,b.h);this._lastName.setPosition(b.x,b.y-b.h/5);this._lastName.setFont(this._fonts.INPUTBOX_TEXT,b.h/1.5);this._lastName.setFontColor(255,255,255,0);this._lastName.setName("LastName");this._lastName.setString("");this._lastName.setInputMode(6);this._lastName.setInputFlag(1);this._lastName.setPlaceholderFont(this._fonts.INPUTBOX_TEXT,b.h/1.5);this._lastName.setPlaceholderFontColor(this._fontColor.getR(),this._fontColor.getG(),this._fontColor.getB(), this._fontColor.getA());this._lastName.setPlaceholderText("Last Name");this._lastName.setDelegate(this);this.addChild(this._lastName);break;case "EmailTextBar":this._emailInputBox=new RSInputBox(b.w,b.h);this._emailInputBox.setPosition(b.x,b.y-b.h/5);this._emailInputBox.setFont(this._fonts.INPUTBOX_TEXT,b.h/1.5);this._emailInputBox.setFontColor(255,255,255,0);this._emailInputBox.setName("Email");this._emailInputBox.setInputMode(1);this._emailInputBox.setInputFlag(1);this._emailInputBox.setPlaceholderFont(this._fonts.INPUTBOX_TEXT, b.h/1.5);this._emailInputBox.setPlaceholderFontColor(this._fontColor.getR(),this._fontColor.getG(),this._fontColor.getB(),this._fontColor.getA());this._emailInputBox.setPlaceholderText("Email Address *");this._emailInputBox.setDelegate(this);this.addChild(this._emailInputBox);break;case "EmailConfirmTextBar":this._emailConfirmInputBox=new RSInputBox(b.w,b.h);this._emailConfirmInputBox.setPosition(b.x,b.y-b.h/5);this._emailConfirmInputBox.setFont(this._fonts.INPUTBOX_TEXT,b.h/1.5);this._emailConfirmInputBox.setFontColor(255, 255,255,0);this._emailConfirmInputBox.setName("MailConfirm");this._emailConfirmInputBox.setInputMode(1);this._emailConfirmInputBox.setInputFlag(1);this._emailConfirmInputBox.setPlaceholderFont(this._fonts.INPUTBOX_TEXT,b.h/1.5);this._emailConfirmInputBox.setPlaceholderFontColor(this._fontColor.getR(),this._fontColor.getG(),this._fontColor.getB(),this._fontColor.getA());this._emailConfirmInputBox.setPlaceholderText("Confirm Email Address *");this._emailConfirmInputBox.setDelegate(this);this.addChild(this._emailConfirmInputBox); break;case "TimerLbl":this._timeRemainingText=new RSLabelBMFont(c,this._fonts.SMALL_TIMER?this._fonts.SMALL_TIMER:this._fonts.BIG_TIMER,2*b.w,kTEXT_ALIGNMENT_CENTER);this._timeRemainingText.setCenter(b.x,b.y);this.addChild(this._timeRemainingText);this._timeRemainingText.setScale(this._fonts.BIG_TIMER_WITHOUT_CLOCK_SCALE?this._fonts.BIG_TIMER_WITHOUT_CLOCK_SCALE:".4");break;case "CheatLbl":this._cheatTimerText=new RSLabelBMFont(c,this._fonts.NORMAL_TIMER,2*b.w,kTEXT_ALIGNMENT_CENTER);this._cheatTimerText.setCenter(b.x, b.y);this.addChild(this._cheatTimerText);this._cheatTimerText.setScale(0.4);break;case "ProfilePicMask":this._profilePicMaskArea=b;break;case "EnterText":c=RSGame.getInstance().getStringDictionary("JackpotSweepstakesPopup").H6;c=c.replace("{value}",RSSweepstakesManager.getSweepstakesRewardValue());c=new RSLabelBMFont(c,this._fonts.ENTRY_TEXT?this._fonts.ENTRY_TEXT:this._fonts.WIN_TEXT,2*b.w,kTEXT_ALIGNMENT_CENTER);c.setCenter(b.x,b.y);this.addChild(c);c.setScale(this._fonts.WIN_TEXT_SCALE?this._fonts.WIN_TEXT_SCALE: ".45");break;case "Yesbtn":this._submitButton=RSUtils.createButton(a,b),this.addTouchListenerToButton(this._submitButton),this.addChild(this._submitButton),this._submitButton.setTouchEnabled(!1)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "Yesbtn":this.checkDetail();break;case "Terms\x26Conditions":RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes_ official_rules","click","open_from_signup_popup","","");window.open(this._termsAndConditionsUrl, "_blank");break;case "LeagelAgeBtn":RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes_legal_age_info","click","","","");window.open(RSEngine.gameData.getDefaultValues().sweepStakesAgePolicyLink,"_blank");break;case "SupportBtn":this.onPlayerSupportClicked();break;case "CloseBtn":this._popupTriggered?RSAnalyticsManager.getInstance().trackGUIEvent("sweepstakes","sweepstakes_popup","close",""):RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes","close","open_from_"+this._openFrom, "","");RSEventManager.getInstance().dispatchEvent("onSweepstakesPopupClose");this.closePopup();break;case "PreviousWinnersBtn":this._previousWinnersBtn.setTouchEnabled(!1),this.closePopup(),RSSweepstakesManager.showJackpotSweepstakesWinnersList()}return this._super.onButtonClicked.call(this,a)},handleObjectTouchAt:function(a,b,c){a=a._ccObject._name;if(this._radioButtonStatus[a]){switch(a){case "RadioButton1":this._termsAndConditionTickButton.setFrame(0);break;case "RadioButton2":this._confirmAgeTickButton.setFrame(0)}this._radioButtonStatus[a]= 0}else{switch(a){case "RadioButton1":this._termsAndConditionTickButton.setFrame(1);break;case "RadioButton2":this._confirmAgeTickButton.setFrame(1)}this._radioButtonStatus[a]=1}this.checkAndUpdateSubmitButton()},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){},_getTimeRemaining:function(){var a=this._remainingTime-TimeManager.getInstance().getCurrentServerTime();0==a&&this._timeRemainingText&&!this._timeExpired&&(this._timeExpired=!0,cc.log("Time reached"),RSSweepstakesManager.showJackpotSweepstakesEntryPopup(), RSEventManager.getInstance().dispatchEvent("onSweepstakesPopupClose"),this.closePopup());return 86400>a?RSUtils.formattedTime(a):~~(a/86400)+1+" Days"},_getCheatTime:function(){var a=this._cheatTime-TimeManager.getInstance().getCurrentServerTime();return 0==a&&this._timeRemainingText?0:86400>a?RSUtils.formattedTime(a):~~(a/86400)+1+" Days"},_checkRadioButtonTickStatus:function(){return this._radioButtonStatus.RadioButton1&&this._radioButtonStatus.RadioButton2?!0:!1},editBoxEditingDidBegan:function(a){switch(a.getName()){case "Email":this._alreadyRegisteredIcon.setVisible(!1), this._icon2.setVisible(!1)}},editBoxEditingDidEnded:function(a){switch(a.getName()){case "Email":this._email=a._ccObject._text;this._res=this._email.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/);null==this._res?(this._icon1.setVisible(!0),this._checkMail1=!1):(this._icon1.setVisible(!1),this._checkMail1=!0);this._emailConfirm&&this._res&&(null==this._emailConfirm.match(this._email)?(this._icon2.setVisible(!0),this._checkMail2=!1):null==this._email.match(this._emailConfirm)?(this._icon2.setVisible(!0),this._checkMail2= !1):this._checkMail2=!0);break;case "MailConfirm":(this._emailConfirm=a._ccObject._text)&&this._res?null==this._emailConfirm.match(this._email)?(this._icon2.setVisible(!0),this._checkMail2=!1):null==this._email.match(this._emailConfirm)?(this._icon2.setVisible(!0),this._checkMail2=!1):(this._icon2.setVisible(!1),this._checkMail2=!0):(this._icon2.setVisible(!0),this._checkMail2=!1);break;case "FirstName":(this._firstNameText=a._ccObject._text)?(this._mandatoryIcon.setVisible(!1),this._checkName=!0): (this._mandatoryIcon.setVisible(!0),this._checkName=!1)}this.checkAndUpdateSubmitButton()},editBoxTextChanged:function(a,b){switch(a.getName()){case "Email":this._emailText=b;break;case "MailConfirm":this._emailConfirmText=b;break;case "LastName":var c=this.checkForSpecialCharacters(b);if(""!=b&&!c){this._lastName.setString(this._lastNameText);this._lastName.startTouch();break}this._lastNameText=b;break;case "FirstName":c=this.checkForSpecialCharacters(b);if(""!=b&&!c){this._firstName.setString(this._firstNameText); this._firstName.startTouch();break}this._firstNameText=b}},editBoxEditingReturn:function(a){},checkAndUpdateSubmitButton:function(){this._checkRadioButtonTickStatus()&&this._checkMail1&&this._checkMail2&&this._checkName?this._submitButton.setTouchEnabled(!0):this._submitButton.setTouchEnabled(!1)},checkForSpecialCharacters:function(a){return/^[a-z]+$/i.test(a)},checkDetail:function(){if(this._checkMail1&&this._checkMail2&&this._checkName)if(null==this._email.match(this._emailConfirm))this._icon2.setVisible(!0), this._checkMail2=!1,this._submitButton.setTouchEnabled(!1);else{RSEngine.screenManager.addOverlay();this._submitButton.setTouchEnabled(!1);this._previousWinnersBtn.setTouchEnabled(!1);var a={};a.email=this._emailText;a.lastName=this._lastNameText;a.firstName=this._firstNameText;a.fb_id="";if(RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK||RSEngine.loginMode==LOGIN_MODE.FACEBOOK)a.fb_id=RSGame.getInstance().getUserDataManager().getMe().getFBId();RSSweepstakesManager.getJackpotSweepstakesStatus(!0,a,!1, this.onUpdateSuccess.bind(this),this.onUpdateFail.bind(this))}},onUpdateSuccess:function(a){a?(RSEventManager.getInstance().dispatchEvent("SWEEPSTAKES_DATA_UPDATED",!1),RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.sweepstakesEnrolled),RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes","enter","open_from_"+this._openFrom,"",""),RSSweepstakesManager.getCoolDownTimeEnableStatus()?RSSweepstakesManager.showJackpotSweepstakesCooldownPopup(!0):(RSAnalyticsManager.getInstance().trackGUIEvent("sweepstakes", "enrolled","",""),RSSweepstakesManager.showJackpotSweepstakesEntrySuccesPopup(!0)),this.closePopup()):(this._alreadyRegisteredIcon.setVisible(!0),this._previousWinnersBtn.setTouchEnabled(!0));RSEngine.screenManager.removeOverlay()},onUpdateFail:function(){3>this._retryCount?(this._retryCount++,this.checkDetail()):(this._retryCount=0,RSEngine.screenManager.removeOverlay(),RSErrorTracker.getInstance().trackErrorMessage("ERROR_EMAIL_CONNECT","Error connecting email ","mahesh.jose@rubyseven.net"),RSEventManager.getInstance().dispatchEvent("onSweepstakesPopupClose"), this.closePopup())},onPlayerSupportClicked:function(){document.getElementById("Helpshift").style.display="block";document.getElementById("helpshiftoverlay").style.display="block";RSAnalyticsManager.getInstance().trackGUIEvent("support","open","open_from_sweepstakes","","");this._playerSupportactive=!0},playWinAnimation:function(){this._starAnimationSmallRight.stopAnimation();this._starAnimationLeft.stopAnimation();this._starAnimationSmallLeft.stopAnimation();this._starAnimationRight.stopAnimation(); this._winBigAnimationRight.setVisible(!0);this._winBigAnimationLeft.setVisible(!0);this._winBigAnimationLeft.playAnimation(1,0.3);this._winBigAnimationRight.playAnimation(1,0.3,this.playStarAnimation.bind(this))},playStarAnimation:function(){this._winBigAnimationLeft.stopAnimation();this._winBigAnimationRight.stopAnimation();this._winBigAnimationRight.setVisible(!1);this._winBigAnimationLeft.setVisible(!1);this._starAnimationSmallRight.playAnimation(1,1);this._starAnimationLeft.playAnimation(1,1); this._starAnimationSmallLeft.playAnimation(1,1);this._starAnimationRight.playAnimation(1,1,this.playWinAnimation.bind(this))},update:function(){var a=this._getTimeRemaining();a&&this._timeRemainingText&&this._timeRemainingText.setString(a);(a=this._getCheatTime())&&this._cheatTimerText&&this._cheatTimerText.setString("Cheat complete in:"+a)},unloadContent:function(){this._super.unloadContent.call(this)}});var RSJackpotSweepstakesEntrySuccesPopup=RSGenericPopup.extend({init:function(a,b,c,d,e,f,g,h){this._assetFolder=a;this._fonts=b;this._remainingTime=c;this._rewardTime=new Date(d);this._timeExpired=!1;this._termsAndConditionsUrl=e;this._popupTriggered=f;this._callback=g;this._openFrom=h?h:RSAnalyticsManager.getInstance().getCurrentMachineName();this._super.init.call(this);f?RSAnalyticsManager.getInstance().trackGUIEvent("sweepstakes","sweepstakes_popup","trigger",""):RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes", "click","open_from_"+this._openFrom,"","")},loadContent:function(){this.layoutScreen(this._assetFolder);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "Sweepstakes":a.stopAnimation();break;case "FireworksLeft":this._fireWorkLeft=c}},createCustomObject:function(a,b){switch(b.name){case "SuccessText":var c=RSGame.getInstance().getStringDictionary("JackpotSweepstakesPopup").H2, c=c.replace("{day}",RSUtils.getDateInStringFormat(this._rewardTime,!0)),c=new RSLabelBMFont(c,this._fonts.NORMAL_TEXT,2*b.w,kTEXT_ALIGNMENT_CENTER);c.setCenter(b.x,b.y);c.setScale(this._fonts.DOLLAR_VALUE_TEXT_SCALE?this._fonts.DOLLAR_VALUE_TEXT_SCALE:".55");this.addChild(c);break;case "TimerLbl":this._remainingTimeText=new RSLabelBMFont("".toString(),this._fonts.BIG_TIMER,2*b.w,kTEXT_ALIGNMENT_CENTER);this._remainingTimeText.setCenter(b.x,b.y);this.addChild(this._remainingTimeText);this._remainingTimeText.setScale(this._fonts.BIG_TIMER_WITH_CLOCK_SCALE? this._fonts.BIG_TIMER_WITH_CLOCK_SCALE:".65");break;case "FireworksRight":b.name=this._fireWorkLeft.name;this._fireWorkRight=RSUtils.createBasicObject(a,b);this._fireWorkRight.setScaleX(-1);this.addChild(this._fireWorkRight);break;case "WinBarText":c="WIN $"+RSSweepstakesManager.getSweepstakesRewardValue()+"!",c=new RSLabelBMFont(c,this._fonts.REWARD_TEXT,2*b.w,kTEXT_ALIGNMENT_CENTER),c.setCenter(b.x,b.y),this.addChild(c),this._fonts.ENTRY_REWARD_TEXT_SCALE&&c.setScale(this._fonts.ENTRY_REWARD_TEXT_SCALE)}return this._super.createCustomObject.call(this, a,b)},onButtonClicked:function(a){switch(a){case "InfoBtn":RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes_ official_rules","click","open_from_enrolled_popup","","");window.open(this._termsAndConditionsUrl,"_blank");break;case "SupportBtn":this.onPlayerSupportClicked();break;case "CloseBtn":this._popupTriggered?RSAnalyticsManager.getInstance().trackGUIEvent("sweepstakes","sweepstakes_popup","close",""):RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes","close","open_from_"+ this._openFrom,"",""),RSEventManager.getInstance().dispatchEvent("onSweepstakesPopupClose"),this.closePopup()}return this._super.onButtonClicked.call(this,a)},_getTimeRemaining:function(){var a=this._remainingTime-TimeManager.getInstance().getCurrentServerTime();0==a&&this._remainingTimeText&&!this._timeExpired&&(this._timeExpired=!0,cc.log("Time reached"),RSSweepstakesManager.showJackpotSweepstakesEntryPopup(),this.closePopup());return 86400>a?RSUtils.formattedTime(a):~~(a/86400)+1+" Days"},update:function(){var a= this._getTimeRemaining();a&&this._remainingTimeText&&this._remainingTimeText.setString(a)},onPlayerSupportClicked:function(){document.getElementById("Helpshift").style.display="block";document.getElementById("helpshiftoverlay").style.display="block";RSAnalyticsManager.getInstance().trackGUIEvent("support","open","open_from_sweepstakes","","");this._playerSupportactive=!0},closePopup:function(){this._callback&&this._callback();this._super.closePopup.call(this)},unloadContent:function(){this._super.unloadContent.call(this)}});var RSJackpotSweepstakesWinnerPopup=RSGenericPopup.extend({init:function(a,b,c,d){this._assetFolder=a;this._fonts=b;this._super.init.call(this);this._popupTriggered=c;this._openFrom=d?d:RSAnalyticsManager.getInstance().getCurrentMachineName();c?RSAnalyticsManager.getInstance().trackGUIEvent("sweepstakes","sweepstakes_popup","trigger",""):RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes","click","open_from_"+this._openFrom,"","")},loadContent:function(){this.layoutScreen(this._assetFolder); this._super.loadContent.call(this)},onLayoutCompleted:function(){this.playWinAnimation();this._super.onLayoutCompleted.call(this);RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes_results","winner",RSSweepstakesManager.getSweepstakesData().winnerInfo.Name,"","")},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "Sweepstakes":a.stopAnimation();break;case "FireworksLeft":this._fireWorkLeft=c;break;case "StarAnimationSmallRight":this._starAnimationSmallRight= a;this._starAnimationSmallRight.flipHorizontally(!0);this._starAnimationSmallRight.stopAnimation();break;case "StarAnimationRight":this._starAnimationRight=a;this._starAnimationRight.flipHorizontally(!0);this._starAnimationRight.stopAnimation();break;case "StarAnimationSmallLeft":this._starAnimationSmallLeft=a;this._starAnimationSmallLeft.stopAnimation();break;case "StarAnimationLeft":this._starAnimationLeft=a;this._starAnimationLeft.stopAnimation();break;case "WinBigAnimationRight":this._winBigAnimationRight= a;this._winBigAnimationRight.stopAnimation();break;case "WinBigAnimationLeft":this._winBigAnimationLeft=a,this._winBigAnimationLeft.stopAnimation()}},createCustomObject:function(a,b){switch(b.name){case "Dollorvalue":var c=RSGame.getInstance().getStringDictionary("JackpotSweepstakesPopup").H1,c=c.replace("{value}",RSSweepstakesManager.getSweepstakesRewardValue()),c=new RSLabelBMFont(c,this._fonts.WINNER_TEXT?this._fonts.WINNER_TEXT:this._fonts.REWARD_TEXT,2*b.w,kTEXT_ALIGNMENT_CENTER);c.setCenter(b.x, b.y);this.addChild(c);(this._fonts.WINNER_TEXT_SCALE||this._fonts.ENTRY_REWARD_TEXT_SCALE)&&c.setScale(this._fonts.WINNER_TEXT_SCALE?this._fonts.WINNER_TEXT_SCALE:this._fonts.ENTRY_REWARD_TEXT_SCALE);break;case "FireworksRight":b.name=this._fireWorkLeft.name;this._fireWorkRight=RSUtils.createBasicObject(a,b);this._fireWorkRight.setScaleX(-1);this.addChild(this._fireWorkRight);break;case "WinBarText":c="WIN $"+RSSweepstakesManager.getSweepstakesRewardValue()+"!",c=new RSLabelBMFont(c,this._fonts.REWARD_TEXT, 2*b.w,kTEXT_ALIGNMENT_CENTER),c.setCenter(b.x,b.y),this.addChild(c),this._fonts.ENTRY_REWARD_TEXT_SCALE&&c.setScale(this._fonts.ENTRY_REWARD_TEXT_SCALE)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":this.closePopup();this._popupTriggered?RSAnalyticsManager.getInstance().trackGUIEvent("sweepstakes","sweepstakes_popup","close",""):RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes","close","open_from_"+this._openFrom,"",""); RSSweepstakesManager.getNextWeeksSweepstakesEnabledStatus()?RSSweepstakesManager.showJackpotSweepstakesEntryPopup(null,null,!0):RSEventManager.getInstance().dispatchEvent("onSweepstakesPopupClose");break;case "SupportBtn":this.onPlayerSupportClicked()}},onPlayerSupportClicked:function(){document.getElementById("Helpshift").style.display="block";document.getElementById("helpshiftoverlay").style.display="block";RSAnalyticsManager.getInstance().trackGUIEvent("support","open","open_from_sweepstakes", "","")},playWinAnimation:function(){this._starAnimationSmallRight.stopAnimation();this._starAnimationLeft.stopAnimation();this._starAnimationSmallLeft.stopAnimation();this._starAnimationRight.stopAnimation();this._winBigAnimationRight.setVisible(!0);this._winBigAnimationLeft.setVisible(!0);this._winBigAnimationLeft.playAnimation(1,0.3);this._winBigAnimationRight.playAnimation(1,0.3,this.playStarAnimation.bind(this))},playStarAnimation:function(){this._winBigAnimationLeft.stopAnimation();this._winBigAnimationRight.stopAnimation(); this._winBigAnimationRight.setVisible(!1);this._winBigAnimationLeft.setVisible(!1);this._starAnimationSmallRight.playAnimation(1,1);this._starAnimationLeft.playAnimation(1,1);this._starAnimationSmallLeft.playAnimation(1,1);this._starAnimationRight.playAnimation(1,1,this.playWinAnimation.bind(this))},unloadContent:function(){this._super.unloadContent.call(this)}});var RSJackpotSweepstakesBetterLuckPopup=RSGenericPopup.extend({init:function(a,b,c,d,e,f,g){this._assetFolder=a;this._fonts=b;this._tickStatus=!1;this._remainingTime=c;this._winnerInfo=d;this._super.init.call(this);this._popupTriggered=f;this._termsAndConditionsUrl=e;this._openFrom=g?g:RSAnalyticsManager.getInstance().getCurrentMachineName();f?RSAnalyticsManager.getInstance().trackGUIEvent("sweepstakes","sweepstakes_popup","trigger",""):RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes", "click","open_from_"+this._openFrom,"","")},loadContent:function(){this.layoutScreen(this._assetFolder);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._setProfileImage();RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes_results","better_luck_next_time","","","")},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "Sweepstakes":a.stopAnimation();a.setFrame(1);break;case "RadioButton1":this._termsAndConditionTickButton= a;this._termsAndConditionTickButton.stopAnimation();this._termsAndConditionTickButton.addTouchListenerWithDelegate(this);break;case "EnterAgainbtn":this._enterAgainButton=a;RSSweepstakesManager.getNextWeeksSweepstakesEnabledStatus()||this._enterAgainButton.setVisible(!1);break;case "ProfileBorder":this._profilePicMask=a;this._popUpScreenName=b;break;case "TimeRemaining":RSSweepstakesManager.getNextWeeksSweepstakesEnabledStatus()||a.setVisible(!1)}},createCustomObject:function(a,b){switch(b.name){case "Dollorvalue":var c= RSSweepstakesManager.getNextWeeksSweepstakesEnabledStatus()?RSGame.getInstance().getStringDictionary("JackpotSweepstakesPopup").H3:RSGame.getInstance().getStringDictionary("JackpotSweepstakesPopup").H7;RSSweepstakesManager.getNextWeeksSweepstakesEnabledStatus()&&(c=c.replace("{value}",RSSweepstakesManager.getSweepstakesRewardValue()));c=new RSLabelBMFont(c,this._fonts.NORMAL_TEXT,2*b.w,kTEXT_ALIGNMENT_CENTER);c.setCenter(b.x,b.y);this.addChild(c);this._fonts.DOLLAR_VALUE_TEXT_SCALE?c.setScale(this._fonts.DOLLAR_VALUE_TEXT_SCALE): this._fonts.DOLLAR_TEXT_SCALE?c.setScale(this._fonts.DOLLAR_TEXT_SCALE):c.setScale(0.65);break;case "PrifileText":c=this._winnerInfo.Name;11<c.length&&(c=c.substring(0,11)+"...");c=new RSLabelBMFont(c,this._fonts.WIN_TEXT,2*b.w,kTEXT_ALIGNMENT_LEFT);c.setScale(this._fonts.WIN_SCALE?this._fonts.WIN_SCALE:".65");c.setCenter(b.x-b.w/2,b.y);this.addChild(c);break;case "WinMessageText":c=RSGame.getInstance().getStringDictionary("JackpotSweepstakesPopup").H4;c=new RSLabelBMFont(c,this._fonts.WIN_TEXT,2* b.w,kTEXT_ALIGNMENT_CENTER);c.setCenter(b.x,b.y);this.addChild(c);c.setScale(this._fonts.WIN_SCALE?this._fonts.WIN_SCALE:".65");break;case "TimerLbl":this._remainingTimeText=new RSLabelBMFont(c,this._fonts.SMALL_TIMER?this._fonts.SMALL_TIMER:this._fonts.BIG_TIMER,2*b.w,kTEXT_ALIGNMENT_CENTER);this._remainingTimeText.setCenter(b.x,b.y);this.addChild(this._remainingTimeText);this._remainingTimeText.setScale(this._fonts.BIG_TIMER_WITHOUT_CLOCK_SCALE?this._fonts.BIG_TIMER_WITHOUT_CLOCK_SCALE:".4");RSSweepstakesManager.getNextWeeksSweepstakesEnabledStatus()|| this._remainingTimeText.setVisible(!1);break;case "ProfilePicMask":this._profilePicMaskArea=b;c=RSUtils.createBasicObject(a,b);this.addChild(c);break;case "WinBarText":c="WIN $"+RSSweepstakesManager.getSweepstakesPreviousRewardValue()+"!",c=new RSLabelBMFont(c,this._fonts.REWARD_TEXT,2*b.w,kTEXT_ALIGNMENT_CENTER),c.setCenter(b.x,b.y),this.addChild(c),this._fonts.ENTRY_REWARD_TEXT_SCALE&&c.setScale(this._fonts.ENTRY_REWARD_TEXT_SCALE)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "EnterAgainbtn":this.closePopup(); RSSweepstakesManager.showJackpotSweepstakesEntryPopup(null,null,!0);break;case "Terms\x26Conditions":RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes_ official_rules","click","open_from_","","");window.open(this._termsAndConditionsUrl,"_blank");break;case "SupportBtn":this.onPlayerSupportClicked();break;case "CloseBtn":RSEventManager.getInstance().dispatchEvent("onSweepstakesPopupClose"),this._popupTriggered?RSAnalyticsManager.getInstance().trackGUIEvent("sweepstakes","sweepstakes_popup", "close",""):RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes","close","open_from_"+this._openFrom,"",""),this.closePopup()}return this._super.onButtonClicked.call(this,a)},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){},_getTimeRemaining:function(){var a=this._remainingTime-TimeManager.getInstance().getCurrentServerTime();0==a&&this._remainingTimeText&&(cc.log("Time reached"),RSSweepstakesManager.showJackpotSweepstakesEntryPopup(null, null,!0),this.closePopup());return 86400>a?RSUtils.formattedTime(a):~~(a/86400)+1+" Days"},_setProfileImage:function(){var a=new RSImageObject,b=null;!this._winnerInfo.fb_id||RSEngine.loginMode!=LOGIN_MODE.WEB_FACEBOOK&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK||(b=this.getImageURL());b&&(a.setImageFromUrl(b,this._profilePicMaskArea.x,this._profilePicMaskArea.y,this._profilePicMaskArea.w,this._profilePicMaskArea.h),this.mask=new RSClippingNode(RSUtils.createBasicObject(this._popUpScreenName,this._profilePicMaskArea)), this.mask.setAlphaThreshold(80),this.mask.addChild(a),this.addChild(this.mask),this._profilePicMask.setZOrder(2))},getImageURL:function(){return"https://graph.facebook.com/"+this._winnerInfo.fb_id+"/picture?type\x3dsquare\x26access_token\x3d"+RSGame.getInstance().getGameManager().getFBAccessToken()},update:function(){var a=this._getTimeRemaining();a&&this._remainingTimeText&&this._remainingTimeText.setString(a)},onPlayerSupportClicked:function(){document.getElementById("Helpshift").style.display= "block";document.getElementById("helpshiftoverlay").style.display="block";RSAnalyticsManager.getInstance().trackGUIEvent("support","open","open_from_sweepstakes","","");this._playerSupportactive=!0},unloadContent:function(){this._super.unloadContent.call(this)}});var RSJackpotSweepstakesCooldownPopup=RSGenericPopup.extend({init:function(a,b,c,d,e,f,g,h){this._assetFolder=a;this._fonts=b;this._rewardTime=c;this._super.init.call(this,f);this._popupTriggered=d;this._termsAndConditionsUrl=e;this._rewardHistoryEnabledStatus=g;this._openFrom=h?h:RSAnalyticsManager.getInstance().getCurrentMachineName();d?RSAnalyticsManager.getInstance().trackGUIEvent("sweepstakes","sweepstakes_popup","trigger",""):RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes", "click","open_from_"+this._openFrom,"","")},loadContent:function(){this.layoutScreen(this._assetFolder);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._popupTriggered||RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes_cooldown","click","","","")},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "Sweepstakes":a.stopAnimation();break;case "FireworksLeft":this._fireWorkLeft=c; break;case "PreviousWinnersBtn":"0"==this._rewardHistoryEnabledStatus&&a.setVisible(!1),this._previousWinnersBtn=a}},createCustomObject:function(a,b){switch(b.name){case "SuccessText":var c=RSGame.getInstance().getGameData().getPopupTextWithKey("SweepstakesCoolDownSuccessText")?RSGame.getInstance().getGameData().getPopupTextWithKey("SweepstakesCoolDownSuccessText"):RSGame.getInstance().getStringDictionary("JackpotSweepstakesPopup").H5,c=c.replace(/\\n/g,"\n"),c=new RSLabelBMFont(c,this._fonts.NORMAL_TEXT, 2*b.w,kTEXT_ALIGNMENT_CENTER);c.setCenter(b.x,b.y);c.setScale(this._fonts.DOLLAR_VALUE_TEXT_SCALE?this._fonts.DOLLAR_VALUE_TEXT_SCALE:".55");this.addChild(c);break;case "TimerLbl":this._remainingTimeText=new RSLabelBMFont("".toString(),this._fonts.BIG_TIMER,2*b.w,kTEXT_ALIGNMENT_CENTER);this._remainingTimeText.setCenter(b.x,b.y);this.addChild(this._remainingTimeText);this._remainingTimeText.setScale(this._fonts.BIG_TIMER_WITH_CLOCK_SCALE?this._fonts.BIG_TIMER_WITH_CLOCK_SCALE:".65");break;case "FireworksRight":b.name= this._fireWorkLeft.name;this._fireWorkRight=RSUtils.createBasicObject(a,b);this._fireWorkRight.setScaleX(-1);this.addChild(this._fireWorkRight);break;case "WinBarText":c="WIN $"+RSSweepstakesManager.getSweepstakesRewardValue()+"!",c=new RSLabelBMFont(c,this._fonts.REWARD_TEXT,2*b.w,kTEXT_ALIGNMENT_CENTER),c.setCenter(b.x,b.y),this.addChild(c),this._fonts.ENTRY_REWARD_TEXT_SCALE&&c.setScale(this._fonts.ENTRY_REWARD_TEXT_SCALE)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "InfoBtn":RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes_ official_rules", "click","open_from_cooldown_popup","","");window.open(this._termsAndConditionsUrl,"_blank");break;case "SupportBtn":this.onPlayerSupportClicked();break;case "CloseBtn":RSEventManager.getInstance().dispatchEvent("onSweepstakesPopupClose");this._popupTriggered?RSAnalyticsManager.getInstance().trackGUIEvent("sweepstakes","sweepstakes_popup","close",""):(RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes_cooldown","close","","",""),RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes", "close","open_from_"+this._openFrom,"",""));this.closePopup();break;case "PreviousWinnersBtn":this._previousWinnersBtn.setTouchEnabled(!1),this.closePopup(),RSSweepstakesManager.showJackpotSweepstakesWinnersList()}return this._super.onButtonClicked.call(this,a)},_getTimeRemaining:function(){var a=this._rewardTime-TimeManager.getInstance().getCurrentServerTime();0==a&&this._remainingTimeText&&(cc.log("Time reached"),RSSweepstakesManager.fetchSweepstakesStatus(),this.closePopup());return 86400>a?RSUtils.formattedTime(a): ~~(a/86400)+1+" Days"},update:function(){var a=this._getTimeRemaining();a&&this._remainingTimeText&&this._remainingTimeText.setString(a)},onPlayerSupportClicked:function(){document.getElementById("Helpshift").style.display="block";document.getElementById("helpshiftoverlay").style.display="block";RSAnalyticsManager.getInstance().trackGUIEvent("support","open","open_from_sweepstakes","","");this._playerSupportactive=!0},unloadContent:function(){this._super.unloadContent.call(this)}});var RSJackpotSweepstakesPreviousWinnersScreen=RSGameScreen.extend({init:function(a,b,c,d){this._super.init.call(this);this.callBack=b;this._font=c;this._rayVisibilityFlag=!1;this._termsAndConditionsUrl=d;this.layoutScreen(a)},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){var c=0;switch(b.name){case "PreviousWinnersHolder":this._previousWinnerHolder=b;break;case "WinnerItem":this._winnerItemHolder=b;break;case "LeaderboardScrollArea":this._leaderboardScrollArea= b;break;case "Player":this._nameOfLatestWinner=new RSScaledLabel("",this._font?this._font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("Semi","Bold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._nameOfLatestWinner);this._nameOfLatestWinner.setZOrder(2);break;case "RewardAmount1":this._rewardOfRank1=new RSScaledLabel("",RSGame.getInstance().getGameManager().getDefaultCasinoFont("Semi","Bold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._rewardOfRank1);break;case "BadgeAnimLeft":c=b.h/ this._badgeAnimData.h;this._rankAnim1Left=RSUtils.createAnimation("LeaderboardBadgeAnim",b,0.3);this._rankAnim1Left.setScale(c);this._rankAnim1Left.setZOrder(1);this.addChild(this._rankAnim1Left);this._rankAnim1Left.stopAnimation();break;case "BadgeAnimRight":c=b.h/this._badgeAnimData.h;this._rankAnim1Right=RSUtils.createAnimation("LeaderboardBadgeAnim",b,0.3);this._rankAnim1Right.setZOrder(1);this.addChild(this._rankAnim1Right);this._rankAnim1Right.setScaleX(-c);this._rankAnim1Right.setScaleY(c); this._rankAnim1Right.stopAnimation();break;case "RankUpAnimHolder1":this._rankUpAnimHolder1=new RSPoint(b.x,b.y);this._rankUpAnimHolder1Panel=new RSPanel(b.x,b.y,b.w,b.h);this.addChild(this._rankUpAnimHolder1Panel);break;case "ScrollBarArea":this._scrollArea=b;break;case "PlayerItemBottomRect":this._playerBottomRect=b}},onObjectCreated:function(a,b,c){switch(c.name){case "RankMask":this._profilePicMaskArea=c;this._profileMask=a;this._screenName=b;this._imageHolder=new RSImageObject;this.addChild(this._imageHolder); break;case "UpArrow":this._scrollerUpBtn=a;this._scrollerUpBtn.setVisible(!1);break;case "DownArrow":this._scrollerDownBtn=a;this._scrollerDownBtn.setVisible(!1);break;case "MiddleButton":this._scrollerBtn=a;this._scrollerBtn.setVisible(!1);break;case "ScrollBase":this._scrollBase=a;break;case "PlayerItemGlowAnimLeft":this._playerItemGlowAnimLeft=a;this._playerItemGlowAnimLeft.stopAnimation();this._playerItemGlowAnimLeft.setVisible(!1);break;case "PlayerItemGlowAnimRight":this._playerItemGlowAnimRight= a;this._playerItemGlowAnimRight.stopAnimation();this._playerItemGlowAnimRight.setVisible(!1);this._playerItemGlowAnimRight.setScaleX(-1);break;case "BadgeAnimLeft":case "BadgeAnimRight":a.stopAnimation();a.setVisible(!1);this._badgeAnimData=c;break;case "RankPosition":this._rankPosition1=a;this._rankPosition1.setZOrder(1);break;case "RankBase":this._rankBase=a;this._rankBase.setZOrder(1);break;case "BottomRectShade":this._bottomRectShade=a;this._bottomRectShade.setVisible(!1);break;case "TopShade":this._topShade= a;this._topShadeData=c;break;case "RaysGlow":this._raysGlow=a,this._raysGlow.actionRotateBy(-1,365,-1,null)}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);RSGame.getInstance().getGameManager().setSideMenuVisibility(!1);this.populateHistoryData();this._showBadgeAnimations();RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes_previous_winners","click","","","")},populateHistoryData:function(){this._rewardHistory=RSSweepstakesManager.getRewardHistory();this._initializeScroller(); this._setLatestWinner()},loadComplete:function(){},_changeZOrderOfBg:function(){this._bg.setZOrder(-1);this._leaderboardBg.setZOrder(-1)},onButtonClicked:function(a){switch(a){case "CloseBtn":RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes_previous_winners","close","","","");this.callBack&&this.callBack();break;case "InfoBtn":RSAnalyticsManager.getInstance().trackPlayerAction("sweepstakes_ official_rules","click","open_from_previous_winners_popup","",""),window.open(this._termsAndConditionsUrl, "_blank")}},_showLeaderBoardScreen:function(){},_initializeScroller:function(){this._scroller=new RSBarScroller(new RSRect(this._previousWinnerHolder.x,this._previousWinnerHolder.y,this._previousWinnerHolder.w,this._previousWinnerHolder.h),new RSSize(this._winnerItemHolder.w,this._winnerItemHolder.h),0,RSScrollerDirection.RSSCROLLER_VERTICAL,1);this.addChild(this._scroller);this._scroller.setButtonScroll(this._scrollerBtn);this._scroller.setScrollBase(this._scrollArea);this._updateScroller();var a= new RSDisplayObject(new RSRect(this._previousWinnerHolder.x,this._previousWinnerHolder.y,this._previousWinnerHolder.w,this._previousWinnerHolder.h));this.addChild(a);a.setAnchorPoint(0.5,0.5);this._scroller.setMouseWheelScrollBase(a)},_updateScroller:function(){var a=this._rewardHistory.length;for(index=0;index<a;index++){var b=new RSJackpotSweepstakesWinnerItem(this._winnerItemHolder,this._rewardHistory[index],this._font);this._scroller.addChild(b)}10>=a&&this._scrollBase.setVisible(!1)},_setLatestWinner:function(){this._nameOfLatestWinner.setString(this._getFormattedName(this._rewardHistory[0].name)); this.setprofileImage()},_getFormattedName:function(a){var b=a.substr(0,1).toUpperCase();return a=a.substr(0,0)+b+a.substr(1,a.length)},getImageURL:function(){return"https://graph.facebook.com/"+this._rewardHistory[0].fb_id+"/picture?typelarge\x26height\x3d300\x26width\x3d300\x26access_token\x3d"+RSGame.getInstance().getGameManager().getFBAccessToken()},setprofileImage:function(){var a=new RSImageObject,b=this._rewardHistory[0].userId,c=this._rewardHistory[0].fb_id;if(RSEngine.loginMode!=LOGIN_MODE.WEB_FACEBOOK&& RSEngine.loginMode!=LOGIN_MODE.FACEBOOK||!c)if(b.includes("RS")||b.includes("blob")){if("0"==this._rewardHistory[0].avatarId)return;a.loadFrameWithName("AvatarImages_00/"+this._rewardHistory[0].avatarId+".png");a.setCenter(this._profilePicMaskArea.x,this._profilePicMaskArea.y);this._profileMask.setVisible(!1)}else a.setImageFromUrl(this.getImageURL(),this._profilePicMaskArea.x,this._profilePicMaskArea.y,this._profilePicMaskArea.h,this._profilePicMaskArea.h);else a.setImageFromUrl(this.getImageURL(), this._profilePicMaskArea.x,this._profilePicMaskArea.y,this._profilePicMaskArea.h,this._profilePicMaskArea.h);this._mask=RSUtils.createBasicObject(this._screenName,this._profilePicMaskArea);this._mask.setZOrder(-1);this.mask=new RSClippingNode(this._mask);this.mask.setAlphaThreshold(100);this.mask.addChild(a);this.addChild(this.mask)},update:function(){RSGame.getInstance().getGameManager().setSideMenuVisibility(!1)},_showBadgeAnimations:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("RSLeaderboardScreen")+ "Top.mp3",!1);this._rankAnim1Right.playAnimation(1,0.3,this._onBadgeAnimationCompleted.bind(this));this._rankAnim1Left.playAnimation(1,0.3)},_onBadgeAnimationCompleted:function(){this._rankAnim1Right.setVisible(!1);this._rankAnim1Left.setVisible(!1)},unloadContent:function(){this._scroller&&this._scroller.removeAllChildren();RSEventManager.getInstance().removeEventListenersIn(this);this._super.unloadContent.call(this);GlobalVars.musicStatus&&RSEngine.audioManager.unMuteMusic()}});var RSJackpotSweepstakesWinnerItem=RSDisplayObject.extend({_rank:0,_imageUrl:"",_name:"",_value:0,_gameType:"",_cellType:"",_enableBlurBg:!1,_winAmountValue:0,_rewardAmountValue:0,_rank:0,_disableVisibility:!1,_rewardClaimed:!1,init:function(a,b,c){a=new RSRect(0,0,a.w,a.h);this._playerData=b;this._super.init.call(this,a);this._font=c;this.loadContent()},loadContent:function(){this.loadLayout(RSGame.getInstance().getAssetPath("JackpotSweepstakesWinnerItem"))},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this); this._rewardClaimed&&this._pendingImage.setVisible(!1)},createCustomObject:function(a,b){switch(b.name){case "ClaimedDate":this._playerData.claimed.includes("/")&&(this._playerRank=new RSScaledLabel(this._playerData.claimed,this._font,b,kTEXT_ALIGNMENT_LEFT),this.addChild(this._playerRank),this._rewardClaimed=!0);break;case "Name":var c="",c=this._getFormattedName(this._playerData.name);this._playerName=new RSScaledLabel(c,this._font,b,kTEXT_ALIGNMENT_LEFT);this.addChild(this._playerName);break;case "WinAmout":this._rewardAmount= new RSScaledLabel("$"+this._playerData.win,this._font,b,kTEXT_ALIGNMENT_LEFT);this.addChild(this._rewardAmount);break;case "DrawDate":this._winAmount=new RSScaledLabel(this._playerData.draw,this._font,b,kTEXT_ALIGNMENT_LEFT),this.addChild(this._winAmount)}},onObjectCreated:function(a,b,c){switch(c.name){case "Pending":this._pendingImage=a;break;case "LeaderboardItemBg":this._leaderboardBgAnimation=a,this._leaderboardBgAnimation.stopAnimation(),this._enableBlurBg?(this._leaderboardBgAnimation.setFrame(2), this._leaderboardBgAnimation.setZOrder(2)):this._playerData.user_id==RSEngine.dataManager.getMe().getId()&&this._leaderboardBgAnimation.setFrame(1)}},_getFormattedName:function(a){var b=a.substr(0,1).toUpperCase();return a=a.substr(0,0)+b+a.substr(1,a.length)}});var RSRelaunchPopup=RSGenericPopup.extend({init:function(a){GlobalVars.relaunchPopupActive=!0;var b={layout:RSGame.getInstance().getAssetPath("RSRelaunchPopup"),assetPath:RSGame.getInstance().getAssetPath("RSRelaunchPopup"),font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","bold","stroke")?RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","bold","stroke"):RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),wordList:RSGame.getInstance().getStringDictionary("RSRelaunchPopup")}; this._assetList=[{name:RSGame.getInstance().getAssetPath("RSRelaunchPopup"),count:1}];this._super.init.call(this,a,b);this._callback=a},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "LargeBtn":this._connectBtn=a}},createCustomObject:function(a,b){switch(b.name){case "TextLabel":this.text=new RSScaledLabel(RSGame.getInstance().getStringDictionary("RSRelaunchPopup").text1, RSGame.getInstance().getGameManager().getConnectionLostPopupTextFont()?RSGame.getInstance().getGameManager().getConnectionLostPopupTextFont():RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this.text);break;case "Heading":this.text=new RSScaledLabel(RSGame.getInstance().getStringDictionary("RSRelaunchPopup").H1,RSGame.getInstance().getGameManager().getDefaultCasinoFontForHeading("bold")?RSGame.getInstance().getGameManager().getDefaultCasinoFontForHeading("bold"): RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),b,kTEXT_ALIGNMENT_CENTER),this.addChild(this.text)}return this._super.createCustomObject.call(this,a,b)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},onButtonClicked:function(a){switch(a){case "CP_Button_T1":case "ReconnectBtn":case "CloseBtn":RSEngine.reloadPage()}}});var RSPlayerClubRedirectionPopup=RSPopup.extend({init:function(a,b){this._openFrom=a?"open_from_"+a:"";this._returnBtn=this._takeMeBtn=null;RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("RSPlayerConnectPopup"),"PlayerConnectPopupFontConfig.json");this._super.init.call(this,b)},loadContent:function(){this.layoutScreen(RSGame.getInstance().getAssetPath("RSPlayerConnectRedirectionPopup"));this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){switch(c.name){case "TakeMeBtn":this._takeMeBtn= a;break;case "ReturnBtn":this._returnBtn=a;break;case "LMRewardText":RSEngine.loginMode==LOGIN_MODE.FACEBOOK&&a.setVisible(!1);break;case "TakeMeBtn_FB":this._takeMeBtn_fb=a;break;case "ReturnBtn_FB":this._returnBtn_fb=a}this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a,b){switch(b.name){case "RewardText":this._rewardTxt=RSPlatformFontAssetManager.createCustomLabel(RSGame.getInstance().getGameData().getPopupTextWithKey("ClubMPointsText"),b);this.addChild(this._rewardTxt); break;case "RewardText_FB":var c=RSGame.getInstance().getGameData().getPopupTextWithKey("ClubMPointsText_fb");this._rewardTxt_fb=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(this._rewardTxt_fb);break;case "AccountNumber":c="Linked to Choctaw Rewards account "+RSGame.getInstance().getUserDataManager().getMe().getPlayerConnectID(),this._playerIDTxt=RSPlatformFontAssetManager.createCustomLabel(c,b),this.addChild(this._playerIDTxt)}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this); this.handleTextAndButtonVisibilityForFBPlayers()},onButtonClicked:function(a){switch(a){case "TakeMeBtn":case "TakeMeBtn_FB":RSAnalyticsManager.getInstance().trackPlayerAction(RSGame.getInstance().getGameManager().getPropertyLinkType()+"_linking_popup","take_me",this._openFrom,"","");window.open(GameConfig.PLAYER_CONNECT_REDIRECTION_URL,"_blank");this._takeMeBtn.setTouchEnabled(!1);this._returnBtn.setTouchEnabled(!1);this.closePopup();break;case "CloseBtn":case "ReturnBtn":case "ReturnBtn_FB":RSAnalyticsManager.getInstance().trackPlayerAction(RSGame.getInstance().getGameManager().getPropertyLinkType()+ "_linking_popup","return_game",this._openFrom,"",""),this._takeMeBtn&&this._takeMeBtn.setTouchEnabled(!1),this._returnBtn.setTouchEnabled(!1),this.closePopup()}},handleTextAndButtonVisibilityForFBPlayers:function(){RSEngine.loginMode==LOGIN_MODE.FACEBOOK?(this._rewardTxt_fb&&this._rewardTxt&&this._rewardTxt.setVisible(!1),this._takeMeBtn&&this._takeMeBtn_fb&&this._takeMeBtn.setVisible(!1),this._returnBtn&&this._returnBtn_fb&&this._returnBtn.setVisible(!1)):(this._rewardTxt_fb&&this._rewardTxt&&this._rewardTxt_fb.setVisible(!1), this._takeMeBtn&&this._takeMeBtn_fb&&this._takeMeBtn_fb.setVisible(!1),this._returnBtn&&this._returnBtn_fb&&this._returnBtn_fb.setVisible(!1))},unload:function(){this._super.unload.call(this)}});var RSPlayerConnectScrollBar=RSBarScroller.extend({_jumpToPosition:function(a,b,c){this._super._jumpToPosition.call(this,a,b,!0)},setScrollBase:function(a){this._scrollBase=a=new RSRect(a.x,a.y,a.w,a.h);this._scrollBaseRect=new RSDisplayObject(a);this._scrollBaseRect.setAnchorPoint(0.5,0.5);this._scrollBaseRect.setName("scrollBaseRect");this._scrollBaseRect.setZOrder(3);this._scrollBaseRect.addTouchListenerWithDelegate(this);this._scrollBaseRect.removeMoveListener();this.getDisplayObject().getParent().addChild(this._scrollBaseRect.getDisplayObject())}}), RSPlayerConnectPopup=RSPopup.extend({init:function(a,b,c,d){this._btnSupport=this._tryAgainText=this._lastName=this._mClubNumber=this._btnTryAgain=this._btnConnect=null;this._parameter2=this._parameter1="";this._playerSupportactive=!1;this._mClubNumberTextObject=this._lastNameTextObject=null;this._customData=c;this._learnMoreBtn=null;this._openFrom=d?"open_from_"+d:"";this._font=RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","normal");this._fontName="Source Sans Pro";RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("RSPlayerConnectPopup"), "PlayerConnectPopupFontConfig.json");this._super.init.call(this);this._coinForConnectingToClubM=a;this._callback=b;this._selectedPropertyCount=-1;this._selectedPropertyID=0;this._scroller=null},loadContent:function(){this.layoutScreen(RSGame.getInstance().getAssetPath("RSPlayerConnectPopup"));this._super.loadContent.call(this);RSAnalyticsManager.getInstance().trackPlayerAction(RSGame.getInstance().getGameManager().getPropertyLinkType()+"_linking","click",this._openFrom,"","")},onObjectCreated:function(a, b,c){switch(c.name){case "ConnectNow":this._btnConnect=a;this._btnConnect.setTouchEnabled(!1);break;case "TryAgain":this._btnTryAgain=a;this._btnTryAgain.setVisible(!1);break;case "ContactSupport":this._btnSupport=a;break;case "LearnMoreButton":this._learnMoreBtn=a;this._learnMoreBtn.setVisible(!1);break;case "PropertyIDFrame":this._propertyIDFrame=a;this._propertyIDFrame.setZOrder(2);break;case "ListShowBtn":this._listShowBtn=a;this._listShowBtn.setZOrder(3);break;case "ListHideBtn":this._listHideBtn= a;this._listHideBtn.setVisible(!1);this._listHideBtn.setZOrder(3);break;case "ScrollBase":this._scrollBaseBO=a;this._scrollBaseBO.setVisible(!1);this._scrollBaseBO.setZOrder(1);break;case "GrayScrollBar":this._grayScrollBar=a;this._grayScrollBar.setVisible(!1);this._grayScrollBar.setZOrder(1);break;case "ScrollBg":this._scrollBarBg=a;this._scrollBarBg.setVisible(!1);this._scrollBarBg.setZOrder(3);break;case "ScrollBar":this._scrollBarButton=a;this._scrollBarButton.setVisible(!1);this._scrollBarButton.setZOrder(3); break;case "ContactSupportRedirectionButton":this._supportBtn=a}this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a,b){var c=RSPlatformFontAssetManager.getCustomFontVOFromConfig(RSPlatformFontAssetManager.getFontNameForLabelName(b.name));c&&(RSGame.getInstance().getAssetPath(c.fontName),c.textLength&&(this._textLength=c.textLength),c.placeHolderFontName||(c.placeHolderFontName=c.fontName),c.placeHolderFontColor||(c.placeHolderFontColor=c.fontColor));switch(b.name){case "PropertyID":this._propertyIDDefaultText= RSPlatformFontAssetManager.createCustomLabel(this._customData.placeholder0,b);this._propertyIDDefaultText.setZOrder(3);this._propertyIDDefaultText.setFontColor(c.fontColor.r,c.fontColor.g,c.fontColor.b,c.fontColor.a);this.addChild(this._propertyIDDefaultText);b.name="PropertyIDSelected";this._propertyIDText=RSPlatformFontAssetManager.createCustomLabel("",b);this._propertyIDText.setAnchorPoint(0,0.5);this._propertyIDText.setPosition(b.x-b.w/2,b.y);this._propertyIDText.setZOrder(3);this.addChild(this._propertyIDText); this._propertyIDText.setVisible(!1);break;case "PropertyIDItem":this._propertyIDItemRect=b;break;case "MClubNumber":this._mClubNumber=new RSInputBox(b.w,b.h);this._mClubNumber.setMaxLength(this._textLength);"UP"==GameConfig.GAME_ID?this._mClubNumber.setPlaceholderFont(c.placeHolderFontName,b.h/c.fontSize):this._mClubNumber.setPlaceholderFont(c.placeHolderFontName,b.h);this._mClubNumber.setPlaceholderFontColor(c.placeHolderFontColor);this._mClubNumber.setPlaceholderText(this._customData.placeholder1); this._mClubNumber.setString("");this._mClubNumber.setName(this._customData.placeholder1);"UP"==GameConfig.GAME_ID?this._mClubNumber.setFont(c.fontName,b.h/c.fontSize):this._mClubNumber.setFont(c.fontName,b.h);this._mClubNumber.setFontColor(c.fontColor);this._mClubNumber.setDelegate(this);this._mClubNumber.setInputMode(6);this._mClubNumber.setInputFlag(1);this._mClubNumberTextObject=b;this.addChild(this._mClubNumber);this._mClubNumber.setCenter(b.x,b.y);this._mClubNumber.setPosition(b.x,b.y);this._customData.defaultValue&& (this._parameter1=this._customData.defaultValue,this._mClubNumber.getPlaceholderText(this._customData.defaultValue),this._mClubNumber.setString(this._customData.defaultValue));break;case "LastName":this._lastName=new RSInputBox(b.w,b.h);this._lastName.setPosition(b.x,b.y);this._lastName.setMaxLength(this._textLength);"UP"==GameConfig.GAME_ID?this._lastName.setPlaceholderFont(c.placeHolderFontName,b.h/c.fontSize):this._lastName.setPlaceholderFont(c.placeHolderFontName,b.h);this._lastName.setPlaceholderFontColor(c.placeHolderFontColor); this._lastName.setPlaceholderText(this._customData.placeholder2);this._lastName.setString("");this._lastName.setName(this._customData.placeholder2);"UP"==GameConfig.GAME_ID?this._lastName.setFont(c.fontName,b.h/c.fontSize):this._lastName.setFont(c.fontName,b.h);this._lastName.setFontColor(c.fontColor);this._lastName.setDelegate(this);this._lastName.setInputMode(6);this._lastName.setInputFlag(1);this._lastNameTextObject=b;this.addChild(this._lastName);break;case "TryAgainText":c=RSGame.getInstance().getStringDictionary("MClubConnectPopup").H3; this._tryAgainText=RSPlatformFontAssetManager.createCustomLabel(c,b);this._tryAgainText.setVisible(!1);this.addChild(this._tryAgainText);break;case "PlayerBanText":c=RSGame.getInstance().getStringDictionary("MClubConnectPopup").H3;this._tryAgainTextForBannedUser=RSPlatformFontAssetManager.createCustomLabel(c,b);this._tryAgainTextForBannedUser.setVisible(!1);this.addChild(this._tryAgainTextForBannedUser);break;case "ScrollBaseArea":this._scrollBaseArea=b;break;case "ScrollBarArea":this._scrollArea= b;break;case "PlayerConnectSubText":c=RSGame.getInstance().getGameData().getPopupTextWithKey("PlayerConnectSubText"),this._subTitleTxt=RSPlatformFontAssetManager.createCustomLabel(c,b),this.addChild(this._subTitleTxt)}},editBoxEditingDidBegan:function(a){a.getName()==this._customData.placeholder1?this._mClubNumber.getPlaceholderText()==this._customData.placeholder1&&this._mClubNumber.setPlaceholderText(""):this._lastName.getPlaceholderText()==this._customData.placeholder2&&this._lastName.setPlaceholderText("")}, editBoxEditingDidEnded:function(a){a.getName()==this._customData.placeholder1?""==this._mClubNumber.getPlaceholderText()&&this._mClubNumber.setPlaceholderText(this._customData.placeholder1):""==this._lastName.getPlaceholderText()&&this._lastName.setPlaceholderText(this._customData.placeholder2)},editBoxTextChanged:function(a,b){this.checkBtnTouchEnableStatus(!1);a.getName()==this._customData.placeholder1?this._parameter1=b:this._parameter2=b},editBoxEditingReturn:function(a){},onLayoutCompleted:function(){this._scrollBaseBO? this._initializeScroller():this._selectedPropertyID=1;this._super.onLayoutCompleted.call(this)},_initializeScroller:function(){this._scroller=new RSPlayerConnectScrollBar(new RSRect(this._scrollBaseArea.x,this._scrollBaseArea.y,this._scrollBaseArea.w,this._scrollBaseArea.h),new RSSize(this._propertyIDItemRect.w,this._propertyIDItemRect.h),0,RSScrollerDirection.RSSCROLLER_VERTICAL,1);this.addChild(this._scroller);this._scroller.setZOrder(2);this._updatePropertyScroller();this._scroller.setButtonScroll(this._scrollBarButton); this._scroller.setScrollBase(this._scrollArea);var a=new RSDisplayObject(new RSRect(this._scrollBaseArea.x,this._scrollBaseArea.y,this._scrollBaseArea.w,this._scrollBaseArea.h));this.addChild(a);a.setAnchorPoint(0.5,0.5);this._scroller.setMouseWheelScrollBase(a,20,0.2);this._scroller.setVisible(!1)},_updatePropertyScroller:function(){this.propertyItem={};this.propertyIdList=RSEngine.gameData.getSheetData("PlayerConnectPropertyDetails");for(var a=!1,b=0;b<this.propertyIdList.length;b++)b+1==this.propertyIdList.length&& (a=!0),this.propertyItem[b]=new RSPlayerConnectDropDownCell(this._propertyIDItemRect,this.propertyIdList[b],b,a,!1,this._onPropertyIdSelect.bind(this)),this.propertyItem[b].setPosition(this._scrollBaseArea.x,this._scrollBaseArea.y),this.propertyItem[b].setZOrder(4),this._scroller.addChild(this.propertyItem[b]);7>this.propertyIdList.length&&this._scroller.setItemMouseScroll(!1)},_onPropertyIdSelect:function(a){-1!=this._selectedPropertyCount&&this.propertyItem[this._selectedPropertyCount].highLightSelectedProperty(!1); this._selectedPropertyCount=a;this._selectedPropertyID=this.propertyIdList[parseInt(a)];this._listHideBtn.setVisible(!1);this._listShowBtn.setVisible(!0);this._propertyIDDefaultText.setVisible(!1);this._propertyIDText.setVisible(!0);this._propertyIDText.setString(this.propertyIdList[a].PropertyName);this.setScrollerVisibility(!1)},onButtonClicked:function(a){this._playerSupportactive&&(document.getElementById("helpshift").src=GameConfig.HELPSHIFT_URL,RSAnalyticsManager.getInstance().trackGUIEvent("support", "close","open_from_property_link","",""),this._playerSupportactive=!1);switch(a){case "CloseBtn":RSAnalyticsManager.getInstance().trackPlayerAction(RSGame.getInstance().getGameManager().getPropertyLinkType()+"_linking","close",this._openFrom,"","");if(this._callback&&this._coinForConnectingToClubM)RSGiftingManager.getInstance().onGiftClicked(this._callback);this.closePopup();break;case "TryAgain":this._btnConnect.setVisible(!0);this._btnTryAgain.setVisible(!1);this._tryAgainText.setVisible(!1);this._tryAgainTextForBannedUser&& this._tryAgainTextForBannedUser.setVisible(!1);this._learnMoreBtn&&this._learnMoreBtn.setVisible(!1);this.validateClubNumber(this._parameter1,this._parameter2);break;case "ConnectNow":this.validateClubNumber(this._parameter1,this._parameter2);break;case "ContactSupport":this.onPlayerSupportClicked();break;case "LearnMoreButton":RSAnalyticsManager.getInstance().trackPlayerAction("loyalty_mall_contact_us","click","","banned","");window.open(RSEngine.gameData.getDefaultValues().playerConnectContactLink, "_blank");break;case "FWSupport":RSAnalyticsManager.getInstance().trackPlayerAction("property_number","sign_up",this._openFrom,"","");window.open(RSEngine.gameData.getDefaultValues().PlayerConnectSignup,"_blank");break;case "ForgotPinButton":RSAnalyticsManager.getInstance().trackPlayerAction("property_number","forgot_number",this._openFrom,"","");window.open(RSEngine.gameData.getDefaultValues().PlayerConnectForgotPin,"_blank");break;case "ListShowBtn":this._listShowBtn.setVisible(!1);this._listHideBtn.setVisible(!0); this.setScrollerVisibility(!0);break;case "ListHideBtn":this._listHideBtn.setVisible(!1);this._listShowBtn.setVisible(!0);this.setScrollerVisibility(!1);break;case "ContactSupportRedirectionButton":this._supportBtn.setTouchEnabled(!1),this.closePopup(),RSAnalyticsManager.getInstance().trackPlayerAction(RSGame.getInstance().getGameManager().getPropertyLinkType()+"_linking","request_support",this._openFrom,"",""),RSEngine.popupManager.addPopup(new RSPlayerConnectWithoutAccountNumberPopup)}},onPlayerSupportClicked:function(){RSEngine.gameData.getDefaultValues().helpShiftUrlForPlayerConnect&& (document.getElementById("helpshift").src=RSEngine.gameData.getDefaultValues().helpShiftUrlForPlayerConnect);document.getElementById("Helpshift").style.display="block";document.getElementById("helpshiftoverlay").style.display="block";RSAnalyticsManager.getInstance().trackGUIEvent("support","open","open_from_property_link","","");this._playerSupportactive=!0},validateClubNumber:function(a,b){RSEngine.screenManager.addOverlay();-1<this._selectedPropertyCount?RSGame.getInstance().getUserDataManager().validatePlayerConnectUser(a, b,this._selectedPropertyID.PropertyId,this.onValidationSuccess.bind(this),this.onValidationFailed.bind(this)):RSGame.getInstance().getUserDataManager().validatePlayerConnectUser(a,b,null,this.onValidationSuccess.bind(this),this.onValidationFailed.bind(this))},onValidationSuccess:function(a){RSEngine.screenManager.removeOverlay();"success"==a.result.message?(this._callback&&this._coinForConnectingToClubM&&RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter","collect","collect",this._coinForConnectingToClubM, "1"),RSAnalyticsManager.getInstance().trackPlayerAction(RSGame.getInstance().getGameManager().getPropertyLinkType()+"_linking","login",this._openFrom,"",""),RSGame.getInstance().getUserDataManager().getMe().setPlayerConnectUpdateStatus(1),RSGame.getInstance().getUserDataManager().getMe().setPlayerConnectParam1(this._parameter1),this._callback&&this._callback(!0,this._parameter1),this.closePopup(),RSEngine.popupManager.addPopup(new RSPlayerConnectRewardPopup,!0)):"failed"==a.result.message?this.setValidationFailStates(): "Player Id exists"==a.result.message?this.setValidationFailStates(a.result.message):a.result.data.responseData.isBannedUser&&(RSAnalyticsManager.getInstance().trackGUIEvent("loyalty_mall_banned","trigger","connect",this._parameter1,""),this.setUserBannedStates())},onValidationFailed:function(a){RSEngine.screenManager.removeOverlay();this.setValidationFailStates()},setUserBannedStates:function(){this._btnConnect.setVisible(!1);this._btnTryAgain.setVisible(!0);this._tryAgainText.setVisible(!1);this._tryAgainTextForBannedUser&& this._tryAgainTextForBannedUser.setVisible(!0);this._learnMoreBtn&&this._learnMoreBtn.setVisible(!0)},setValidationFailStates:function(a){var b=RSGame.getInstance().getStringDictionary("MClubConnectPopup").H3;"Player Id exists"==a&&(b=RSGame.getInstance().getStringDictionary("MClubConnectPopup").H4);this._tryAgainText.setString(b);this._btnConnect.setVisible(!1);this._btnTryAgain.setVisible(!0);this._tryAgainText.setVisible(!0);this._tryAgainTextForBannedUser&&this._tryAgainTextForBannedUser.setVisible(!1)}, setScrollerVisibility:function(a){this._scroller.setVisible(a);this._scrollBaseBO.setVisible(a);a?(this.removeChild(this._lastName),this.removeChild(this._mClubNumber)):(this.addChild(this._lastName),this.addChild(this._mClubNumber));this._btnSupport&&this._btnSupport.setTouchEnabled(!a);this.checkBtnTouchEnableStatus(a);-1<this._selectedPropertyCount&&this.propertyItem[this._selectedPropertyCount].highLightSelectedProperty(a);7>this.propertyIdList.length?this._grayScrollBar.setVisible(a):(this._scrollBarBg.setVisible(a), this._scrollBarButton.setVisible(a))},checkBtnTouchEnableStatus:function(a){a?(this._btnConnect.setTouchEnabled(!1),this._btnTryAgain.setTouchEnabled(!1)):""!=this._mClubNumber.getString()&&""!=this._lastName.getString()&&this._selectedPropertyID?(this._btnConnect.setTouchEnabled(!0),this._btnTryAgain.setTouchEnabled(!0)):(this._btnConnect.setTouchEnabled(!1),this._btnTryAgain.setTouchEnabled(!1))},unload:function(){this._super.unload.call(this)}});var RSPlayerConnectRewardPopup=RSPopup.extend({init:function(a){this._rewardCallback=a;this._btnClose=this._btnCollect=null;this._clubMReward=parseInt(RSEngine.gameData.getDefaultValues().playerConnectReward);RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("RSPlayerConnectPopup"),"PlayerConnectPopupFontConfig.json");URLConfig.CLEVERTAP_ENABLED&&(RSPlatformSDKManager.getInstance().setUserAttributePlayerConnect(!0),RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.isPlayerConnected)); this._super.init.call(this)},loadContent:function(){this.layoutScreen(RSGame.getInstance().getAssetPath("RSPlayerConnectRewardPopup"));this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){switch(c.name){case "Collect":this._btnCollect=a;break;case "CloseBtn":this._btnClose=a}this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a,b){switch(b.name){case "MClubSuccessLabel":var c=RSGame.getInstance().getStringDictionary("MClubConnectPopup").H2;RSGame.getInstance().getGameManager().getPlayerConnectCustomLabelStatus()? c=RSPlatformFontAssetManager.createCustomLabel(c,b):(c=new RSLabelBMFont(c,RSGame.getInstance().getGameManager().getDefaultCasinoFont("largePurple","normal"),2*b.w,kTEXT_ALIGNMENT_CENTER),c.setScale(0.8),c.setCenter(b.x,b.y));this.addChild(c);break;case "RewardLabel":c=RSPlatformFontAssetManager.createCustomLabel(RSUtils.formatNumber(this._clubMReward),b),this.addChild(c)}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},onButtonClicked:function(a){switch(a){case "CloseBtn":RSGame.getInstance().getUserDataManager().getMe().setPlayerConnectUpdateStatus(3); this.startCollectAnim();break;case "Collect":RSGame.getInstance().getUserDataManager().getMe().setPlayerConnectUpdateStatus(3),this.startCollectAnim()}},startCollectAnim:function(){this._btnCollect.setTouchEnabled(!1);this._btnClose.setTouchEnabled(!1);RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,RSGame.getInstance().getGameManager().getPropertyLinkType()+"_linking_bonus",this._clubMReward,"","");RSCasinoManager.addPrimaryCurrencyForDisplay("PlayerConnect_Reward",this._clubMReward, !0);RSEngine.dataManager.saveUserBlobParams();RSEngine.externalGameManager&&RSEngine.externalGameManager.isSpinGameActive()&&RSEngine.externalGameManager.updateCoin(RSGame.getInstance().getUserDataManager().getMe().getCoins());var a=new RSRect(0,0,0,0);this._displayPanel=new RSDisplayObject(a);this.addChild(this._displayPanel);this._displayPanel.setZOrder(1);a=new RSPoint(this._btnCollect.getX(),this._btnCollect.getY());RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(a,this._displayPanel, this._onBonusCollectAnimCompleted.bind(this))},_onBonusCollectAnimCompleted:function(){this._rewardCallback&&this._rewardCallback();this.closePopup()},unload:function(){this._super.unload.call(this)}});var JackpotDataMeter=RSBasicObject.extend({init:function(a,b,c,d){this._font=b;this._meterName=c;this._jackpotTxt=a;this._super.init.call(this);switch(this._meterName){case "minor":a.setColor(new RSColor(45,175,250));break;case "major":a.setColor(new RSColor(45,250,55));break;case "mega":d?a.setColor(new RSColor(d.r,d.g,d.b)):a.setColor(new RSColor(250,35,35))}},updateText:function(a,b){this._jackpotRollupFinalValue=a;this._loungeName=b;var c=BetSelectRollupValues.getValue(this._meterName,b);c||(c= 0.95*a);this._jackpotDisplayValue=c;this._jackpotTxt&&this._jackpotDisplayValue&&this._jackpotTxt.setString(RSUtils.formatNumber(Math.floor(this._jackpotDisplayValue),2));this.stopActionTweenForKey(this._meterName);this.startActionTweenForKey(this._meterName,30,this._jackpotDisplayValue,this._jackpotRollupFinalValue)},actionOnUpdate:function(a,b){a==this._meterName&&this._jackpotTxt&&(BetSelectRollupValues.setValue(Math.floor(b),a,this._loungeName),this._jackpotTxt.setString(RSUtils.formatNumber(Math.floor(b), 2)))},actionOnComplete:function(a){},unload:function(){this.unscheduleAllFunctions();this.stopActionTweenForKey(this._meterName);this._super.unload.call(this)}}),BetSelectRollupValues={setValue:function(a,b,c){"mega"==b?BetSelectRollupValues[b]=a:BetSelectRollupValues[c][b]=a},getValue:function(a,b){if("mega"==a)return BetSelectRollupValues[a]="undefined"==typeof BetSelectRollupValues[a]?0:BetSelectRollupValues[a],BetSelectRollupValues[a];BetSelectRollupValues[b]="undefined"==typeof BetSelectRollupValues[b]? {}:BetSelectRollupValues[b];BetSelectRollupValues[b][a]="undefined"==typeof BetSelectRollupValues[b][a]?0:BetSelectRollupValues[b][a];return BetSelectRollupValues[b][a]}};var JackpotLoungeDataHandler=function(){var a,b=RSClass.extend({_jackpotLoungeUpdateVO:null,_jackpotTimerId:null,init:function(){},initialize:function(){this.getJackpotUpdateValues();this._jackpotTimerId&&clearInterval(this._jackpotTimerId);var a=this;this._jackpotTimerId=setInterval(function(){a.getJackpotUpdateValues()},3E4)},clearJackpotTimer:function(){this._jackpotTimerId&&clearInterval(this._jackpotTimerId)},getJackpotUpdateValues:function(){var a=this;RSEngine.dataManager.getJackpotData(function(b){a._jackpotLoungeUpdateVO? a._jackpotLoungeUpdateVO.updateObject(JSON.parse(b.result.data.data.S)):a._jackpotLoungeUpdateVO=new JackpotLoungeUpdaterVO(JSON.parse(b.result.data.data.S));RSEventManager.getInstance().dispatchEvent("onJackpotGetData",{data:"triggerInterrupts"})},function(a){})},getJackpotValue:function(a,b){return this._jackpotLoungeUpdateVO?this._jackpotLoungeUpdateVO.getJackpotValue(a,b):null}});return{getInstance:function(){a||(a=new b);return a}}}();var RSLoyaltyPreviewWidget=RSDisplayObject.extend({_baseRect:null,_saleButtonBg:null,_loyaltyMallBg:null,_loyaltyParticleAnim:null,_saleParticleAnim:null,_loyaltyMallPointsLabel:null,_saleButtonPanel:null,_loyaltyMallPanel:null,_vipBenefitPanel:null,_playerConnectPanel:null,_crossPromoAdsPanelData:null,_contentMachinePanelData:null,_propertyPromoAdsPanelData:null,_saleButton:null,_callBack:null,_fontData:null,_timer:null,_cartPanel:null,_cartBg:null,_vipBenefitBg:null,_playerConnectBg:null,_cartParticleAnim:null, _vipBenefitParticleAnim:null,_playerConnectParticleAnim:null,_crossPromoAdsAnimData:null,_contentMachineAnimData:null,_propertyPromoAdsAnimData:null,_cartButton:null,_rightArrow:null,_leftArrow:null,_radioBtnRect:null,_radioBtn:null,_activeRadioBtnCount:0,_previousArrayindex:0,_crossPromoGameData:{},_machineGameData:{},_propertyGameData:{},_comingSoonArray:[],_widgetCountList:{LoyaltyMallToggleWidget:0,SaleButtonToggleWidget:0,VIPBenefitsToggleWidget:0,CrosspromoToggleWidget:0,MachineToggleWidget:0, PropertyToggleWidget:0,PlayerConnectToggleWidget:0},_playBtn:{},_crossPromoPlayBtn:{},_subscriptionWidgetActive:!1,_sweepstakesWidgetActive:!1,_pauseWidgetAnim:!1,init:function(a,b,c,d,e,f,g,h){this._fontData=b;this._callBack=c;this._iconAssetPath=f;this._radioBtnEnabled=d?d:!1;this._animationType=g?g:"rotate";this._stopScroll=h?h:!1;this._widgetTouchEnabledList=e?e:{LoyaltyMall:!0,SaleOrCart:!0,VIPBenefit:!0,CrossPromoAds:!0,ContentMachine:!0,PropertyPromoAds:!0,PlayerConnect:!0,Subscription:!0, Sweepstakes:!0};this._super.init.call(this,a);RSSaleManager.getInstance().getSaleTagActiveForPlayer()&&RSSaleManager.getInstance().initializeSaleDataWithTag(RSSaleManager.getInstance().getSaleTagActiveForPlayer());a=RSGame.getInstance().getAssetPath("LoyaltyPreviewWidget");RSSaleManager.getInstance().getSaleActiveStatus()&&RSSaleManager.getInstance().getSaleVO()&&(b=RSSaleManager.getInstance().getSaleResourceByName("LoyaltyPreviewWidget"))&&(a=b);this.loadLayout(a)},createCustomObject:function(a, b){switch(b.name){case "BaseRect":this._baseRect=new RSRect(b.x,b.y,b.w,b.h);this._screenName=a;break;case "LoyaltyMallEarnpoints":var c=RSEngine.gameData.getDefaultValues().LoyaltyPointsPerDollar;this._loyaltyMallPointsLabel=new RSLabelBMFont(RSUtils.formatNumberWithComma(c),this._fontData.font,-1,kTEXT_ALIGNMENT_CENTER);this._loyaltyMallPointsLabel.setScale(this._fontData.scale);this._loyaltyMallPointsLabel.setCenter(b.x,b.y);break;case "SaleButtonPanel":this._saleButtonPanel=new RSDisplayObject(new RSRect(b.x, b.y,b.w,b.h));this._saleButtonPanel.setAutoOpacityForChild(!0);this.addChild(this._saleButtonPanel);this._saleButtonPanel.addChild(this._saleButtonBg);this._saleButtonPanel.addChild(this._saleParticleAnim);this._saleParticleAnim.playAnimation(-1,1);this._saleButtonPanel.addChild(this._saleButton);this._saleButtonPanel.setAnchorPoint(0.5,0.5);this._saleButtonPanel.setOpacity(0);this._saleButtonPanel.setName("SalesPanel");break;case "GetMoreCoinsPanel":this._cartPanel=new RSDisplayObject(new RSRect(b.x, b.y,b.w,b.h));this._cartPanel.setAutoOpacityForChild(!0);this.addChild(this._cartPanel);this._cartPanel.addChild(this._cartBg);this._cartPanel.addChild(this._cartParticleAnim);this._cartParticleAnim.playAnimation(-1,1);this._cartPanel.addChild(this._cartButton);this._cartPanel.setAnchorPoint(0.5,0.5);this._cartPanel.setOpacity(0);this._cartPanel.setName("CartPanel");break;case "LoyaltyMallLobbyPanel":this._loyaltyMallPanel=new RSDisplayObject(new RSRect(b.x,b.y,b.w,b.h));this._loyaltyMallPanel.setAutoOpacityForChild(!0); this._loyaltyMallPanel.addChild(this._loyaltyMallBg);this._loyaltyMallPanel.addChild(this._loyaltyParticleAnim);this._loyaltyParticleAnim.playAnimation(-1,1);this._loyaltyMallPointsLabel&&this._loyaltyMallPanel.addChild(this._loyaltyMallPointsLabel);this._loyaltyMallPanel.setAnchorPoint(0.5,0.5);this._loyaltyMallPanel.setOpacity(255);this._loyaltyMallPanel.setScale(1);this._loyaltyMallPanel.setName("LoyaltymallPanel");break;case "VIPBenefitPanel":this._vipBenefitPanel=new RSDisplayObject(new RSRect(b.x, b.y,b.w,b.h));this._vipBenefitPanel.setAutoOpacityForChild(!0);this.addChild(this._vipBenefitPanel);this._vipBenefitPanel.addChild(this._vipBenefitBg);this._vipBenefitPanel.addChild(this._benefitButton);this._vipBenefitPanel.addChild(this._vipBenefitParticleAnim);this._vipBenefitParticleAnim.playAnimation(-1,1);this._vipBenefitPanel.setAnchorPoint(0.5,0.5);this._vipBenefitPanel.setOpacity(0);break;case "PlayerConnectPanel":this._playerConnectPanel=new RSDisplayObject(new RSRect(b.x,b.y,b.w,b.h)); this._playerConnectPanel.setAutoOpacityForChild(!0);this.addChild(this._playerConnectPanel);this._playerConnectPanel.addChild(this._playerConnectBg);this._playerConnectPanel.addChild(this._playerConnectParticleAnim);this._playerConnectPanel.addChild(this._goBtn);this._playerConnectPanel.addChild(this._connectBtn);this._playerConnectParticleAnim.playAnimation(-1,1);this._playerConnectPanel.setAnchorPoint(0.5,0.5);this._playerConnectPanel.setOpacity(0);break;case "SubscriptionPanel":this._SubscriptionPanel= new RSDisplayObject(new RSRect(b.x,b.y,b.w,b.h));this._SubscriptionPanel.setAutoOpacityForChild(!0);this.addChild(this._SubscriptionPanel);this._SubscriptionPanel.addChild(this._subscriptionParticleAnim);this._subscriptionParticleAnim.playAnimation(-1,1);this._SubscriptionPanel.setAnchorPoint(0.5,0.5);this._SubscriptionPanel.setOpacity(0);this._SubscriptionPanelData=b;break;case "SweepstakesPanel":this._sweepstakesPanel=new RSDisplayObject(new RSRect(b.x,b.y,b.w,b.h));this._sweepstakesPanel.setAutoOpacityForChild(!0); this.addChild(this._sweepstakesPanel);this._sweepstakesPanel.addChild(this._sweepstakesBg);this._sweepstakesPanel.addChild(this._enterNowbutton);this._sweepstakesPanel.addChild(this._sweepstakesParticleAnim);this._sweepstakesParticleAnim.playAnimation(-1,1);this._sweepstakesPanel.setAnchorPoint(0.5,0.5);this._sweepstakesPanel.setOpacity(0);break;case "CrossPromoAdsPanel":this._crossPromoAdsPanelData=b;break;case "ContentMachinePanel":this._contentMachinePanelData=b;break;case "ContentMachineImgRect":this._contentMachineImgRectData= b;break;case "PropertyPromoAdsPanel":this._propertyPromoAdsPanelData=b;break;case "CrossPromoAdsAnim":this._crossPromoAdsAnimData=b;break;case "ContentMachineAnim":this._contentMachineAnimData=b;break;case "MachineBg":this._machineBgData=b;break;case "MachineGlow":this._machineGlowData=b;break;case "PropertyPromoAdsAnim":this._propertyPromoAdsAnimData=b;break;case "PlayNowBtn":this._PlayNowBtnData=b;break;case "CrossPromoBtn":this._crossPromoBtnData=b;break;case "RadioBtnBg":this._radioBtnRect=b; break;case "RadioBtn":this._radioBtn=b;break;case "TouchRect":this._tochRectData=b}this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){switch(c.name){case "SaleButtonBg":this._saleButtonBg=a;this.removeChild(a);break;case "LoyaltyMallLobbyBg":this._loyaltyMallBg=a;this.removeChild(a);break;case "GetMoreCoinsBg":this._cartBg=a;this.removeChild(a);break;case "VIPBenefitBg":this._vipBenefitBg=a;this.removeChild(a);break;case "PlayerConnectBg":this._playerConnectBg=a;this.removeChild(a); break;case "SweepstakesBg":this._sweepstakesBg=a;this.removeChild(a);break;case "LoyaltyParticalAnim":a.stopAnimation();this._loyaltyParticleAnim=a;this.removeChild(a);break;case "SaleParticalAnim":a.stopAnimation();this._saleParticleAnim=a;this.removeChild(a);break;case "GetMoreCoinsParticalAnim":a.stopAnimation();this._cartParticleAnim=a;this.removeChild(a);break;case "VIPBenefitParticalAnim":a.stopAnimation();this._vipBenefitParticleAnim=a;this.removeChild(a);break;case "PlayerConnectParticalAnim":a.stopAnimation(); this._playerConnectParticleAnim=a;this.removeChild(a);break;case "SubscriptionParticleAnim":a.stopAnimation();this._subscriptionParticleAnim=a;this.removeChild(a);break;case "SweepstakesParticleAnim":a.stopAnimation();this._sweepstakesParticleAnim=a;this.removeChild(a);break;case "SaleDealbutton":this._saleButton=a;this._saleButton.setTouchEnabled(!1);this.removeChild(a);break;case "Cartbutton":this._cartButton=a;this._cartButton.setTouchEnabled(!1);this.removeChild(a);break;case "Benefitbutton":this._benefitButton= a;this._benefitButton.setTouchEnabled(!1);this.removeChild(a);break;case "ConnectBtn":this._connectBtn=a;this._connectBtn.setTouchEnabled(!1);this.removeChild(a);break;case "GoBtn":this._goBtn=a;this._goBtn.setTouchEnabled(!1);this.removeChild(a);break;case "EnterNowbutton":this._enterNowbutton=a;this._enterNowbutton.setTouchEnabled(!1);this.removeChild(a);break;case "RightArrow":a.setZOrder(5);a.setVisible(!1);this._rightArrow=a;break;case "LeftArrow":a.setZOrder(5),a.setVisible(!1),this._leftArrow= a}this._super.onObjectCreated.call(this,a,b,c)},refreshWidgetLayout:function(){RSEventManager.getInstance().removeListenersForEvent("refreshSalePreviewWidget");var a=RSGame.getInstance().getAssetPath("LoyaltyPreviewWidget");if(RSSaleManager.getInstance().getSaleVO()&&RSSaleManager.getInstance().getSaleActiveStatus()){var b=RSSaleManager.getInstance().getSaleResourceByName("LoyaltyPreviewWidget");b&&(a=b)}this.stopAllActions();this.unscheduleAllFunctions();this.removeAllChildren();this.loadLayout(a)}, onLayoutCompleted:function(){this.setAnchorPoint(0.5,0.5);(RSSaleManager.getInstance().getSaleActiveStatus()||RSSaleManager.getInstance().getSubscriptionSaleStatus())&&RSEventManager.getInstance().addEventListener("refreshSalePreviewWidget",this,this.refreshWidgetLayout.bind(this));parseInt(RSEngine.gameData.getDefaultValues().enableLobbyWidgetToggler)||parseInt(RSEngine.gameData.getDefaultValues().enableloyaltyMallToggleWidget)?(this.setActiveWidgets(),this.setRadioBtnPos(),this._currentArrayIndex= GlobalVars.lobbyWidgetCount,GlobalVars.lobbyWidgetCount=0,this._stopScroll||(this._subscriptionWidgetActive||this._sweepstakesWidgetActive?(RSEventManager.getInstance().removeListenersForEvent("resumeWidgetAnimation"),RSEventManager.getInstance().addEventListener("resumeWidgetAnimation",this,this.resumeWidgetAnimation.bind(this)),this.setWidgetAsPerPrioritise()):this._startWidgetAnimation())):parseInt(RSEngine.gameData.getDefaultValues().enableloyaltyMallToggleWidget)?this.removeAllChildren():(this._loyaltyMallPanel.setOpacity(0), RSSaleManager.getInstance().getSaleActiveStatus()?(this._saleButtonPanel.setScaleX(1),this._saleButtonPanel.setOpacity(255),this._saleButton.setTouchEnabled(!0)):(this._cartPanel.setScaleX(1),this._cartPanel.setOpacity(255),this._cartButton.setTouchEnabled(!0)));this._super.onLayoutCompleted.call(this)},widgetStatusInGameData:function(a){for(var b=!1,c=0,d=!0,e=RSGame.getInstance().getGameData().getSheetData("LobbyWidgetToggler"),f=0;f<e.length;f++)if(e[f].type==a){b=!0;switch(a){case "CrosspromoToggleWidget":this._crossPromoGameData["CrossPromoAds"+ c]=e[f];break;case "MachineToggleWidget":0==c&&(d=this.setNewMachinesList());break;case "PropertyToggleWidget":this._propertyGameData["PropertyPromoAds"+c]=e[f]}c++}this._widgetCountList[a]=d?c:0;return b},setNewMachinesList:function(){var a=RSMEConfigManager.getInstance().getDataForEvent(RSFeatures.NEW_MACHINES),b=[];if(a){var a=a.machines,c=0,d;for(d in a)for(var e=0;e<a[d].length;e++){var f={},g=RSGame.getInstance().getGameData().getMachineDetails(d,a[d][e]);f.type=d;f.id=a[d][e];f.asset=this._iconAssetPath[d]+ g.machine_largeIcon;this._machineGameData["ContentMachine"+c]=f;c++;b.push(f.id)}}else return!1;0<b.length&&RSGame.getInstance().getGameManager().setNewMachineData(b);return!0},setActiveWidgets:function(){this._activeWidgetPanelArray=[];this._touchRectArray=[];for(var a=this.widgetStatusInGameData("LoyaltyMallToggleWidget"),b=this.widgetStatusInGameData("SaleButtonToggleWidget"),c=this.widgetStatusInGameData("VIPBenefitsToggleWidget"),d=this.widgetStatusInGameData("CrosspromoToggleWidget"),e=this.widgetStatusInGameData("MachineToggleWidget"), f=this.widgetStatusInGameData("PropertyToggleWidget"),g=this.widgetStatusInGameData("PlayerConnectToggleWidget"),h=this.widgetStatusInGameData("SubscriptionToggleWidget"),k=this.widgetStatusInGameData("SweepstakesToggleWidget"),m=0,n=0,p=0,r=0,s=RSGame.getInstance().getGameData().getSheetData("LobbyWidgetToggler"),u="",t=0;t<s.length;t++){switch(s[t].type){case "LoyaltyMallToggleWidget":u="LoyaltyMall";a&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&(this._widgetTouchEnabledList.LoyaltyMall&&(this._touchRectArray[r]= new RSDisplayObject(new RSRect(this._tochRectData.x,this._tochRectData.y,this._tochRectData.w,this._tochRectData.h)),this._touchRectArray[r].addTouchListenerWithDelegate(this),this._touchRectArray[r].setTouchEnabled(!1),this._touchRectArray[r].setName(u),this._touchRectArray[r].setZOrder(6),this._touchRectArray[r].setAnchorPoint(0.5,0.5),this._loyaltyMallPanel.addChild(this._touchRectArray[r])),r++,this.addChild(this._loyaltyMallPanel),this._activeWidgetPanelArray.push(this._loyaltyMallPanel));break; case "SaleButtonToggleWidget":b&&(this._widgetTouchEnabledList.SaleOrCart&&(this._touchRectArray[r]=new RSDisplayObject(new RSRect(this._tochRectData.x,this._tochRectData.y,this._tochRectData.w,this._tochRectData.h)),this._touchRectArray[r].addTouchListenerWithDelegate(this),this._touchRectArray[r].setTouchEnabled(!1),this._touchRectArray[r].setZOrder(6),this._touchRectArray[r].setAnchorPoint(0.5,0.5)),RSSaleManager.getInstance().getSaleActiveStatus()?(u="Sale",this._touchRectArray[r]&&(this._touchRectArray[r].setName(u), this._saleButtonPanel.addChild(this._touchRectArray[r])),this._activeWidgetPanelArray.push(this._saleButtonPanel),this.removeChild(this._cartPanel)):(u="Cart",this._touchRectArray[r]&&(this._touchRectArray[r].setName(u),this._cartPanel.addChild(this._touchRectArray[r])),this._activeWidgetPanelArray.push(this._cartPanel),this.removeChild(this._saleButtonPanel)),r++);break;case "VIPBenefitsToggleWidget":u="VIPBenefit";GameConfig.VIP_SURFACING&&c?(this._widgetTouchEnabledList.VIPBenefit&&(this._touchRectArray[r]= new RSDisplayObject(new RSRect(this._tochRectData.x,this._tochRectData.y,this._tochRectData.w,this._tochRectData.h)),this._touchRectArray[r].addTouchListenerWithDelegate(this),this._touchRectArray[r].setTouchEnabled(!1),this._touchRectArray[r].setName(u),this._touchRectArray[r].setAnchorPoint(0.5,0.5),this._touchRectArray[r].setZOrder(6),this._vipBenefitPanel.addChild(this._touchRectArray[r])),r++,this._activeWidgetPanelArray.push(this._vipBenefitPanel)):this.removeChild(this._vipBenefitPanel);break; case "CrosspromoToggleWidget":u="CrossPromoAds"+n;if(d){r++;var v=this._crossPromoGameData["CrossPromoAds"+n].asset;this.setMultiplePanels(this._crossPromoAdsPanelData,this._crossPromoAdsAnimData,"CrossPromoAds",v,n);n++}break;case "MachineToggleWidget":u="ContentMachine"+m;e&&m<this._widgetCountList.MachineToggleWidget&&(r++,v=this._machineGameData["ContentMachine"+m].asset,this.setMultiplePanels(this._contentMachinePanelData,this._contentMachineAnimData,"ContentMachine",v,m,this._contentMachineImgRectData), m++);break;case "PropertyToggleWidget":u="PropertyPromoAds"+p;f&&(r++,v=this._propertyGameData["PropertyPromoAds"+p].asset,this.setMultiplePanels(this._propertyPromoAdsPanelData,this._propertyPromoAdsAnimData,"PropertyPromoAds",v,p),p++);break;case "PlayerConnectToggleWidget":u="PlayerConnect";g&&GameConfig.IS_PLAYER_CONNECT_AVAILABLE&&(this._widgetTouchEnabledList.PlayerConnect&&(this._touchRectArray[r]=new RSDisplayObject(new RSRect(this._tochRectData.x,this._tochRectData.y,this._tochRectData.w, this._tochRectData.h)),this._touchRectArray[r].addTouchListenerWithDelegate(this),this._touchRectArray[r].setTouchEnabled(!1),this._touchRectArray[r].setName(u),this._touchRectArray[r].setAnchorPoint(0.5,0.5),this._touchRectArray[r].setZOrder(6),this._playerConnectPanel.addChild(this._touchRectArray[r]),RSGame.getInstance().getUserDataManager().getMe().getPlayerConnectUpdateStatus()?this._connectBtn.setVisible(!1):this._goBtn.setVisible(!1)),r++,this._activeWidgetPanelArray.push(this._playerConnectPanel)); break;case "SubscriptionToggleWidget":u="Subscription";h&&GameConfig.SUBSCRIPTION_ENABLED&&RSEngine.loginMode!=LOGIN_MODE.GUEST&&("1"==RSEngine.gameData.getDefaultValues().isNMISubscriptionActive&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&"US"==RSGame.getInstance().getUserDataManager().getMe().getCountryCode()&&RSSaleManager.getInstance().getSubscriptionSaleStatus()&&!(GameConfig.SKIP_SUBSCRIPTION_SALE_POPUP||null==RSSaleManager.getInstance()._allSalesData.subscription.assets[0]||RSSubscrptionSaleManager._isTempDictionarySet&& 7<RSSubscrptionSaleManager.getCurrentDate("day")&&!RSGame.getInstance().getUserDataManager().getMe().getIsSubscriptionInteruptedShownStatus())||RSSubscrptionSaleManager.getCurrentDate("day"))&&(this._subscriptionWidgetActive=!0,this._widgetTouchEnabledList.Subscription&&(this._touchRectArray[r]=new RSDisplayObject(new RSRect(this._tochRectData.x,this._tochRectData.y,this._tochRectData.w,this._tochRectData.h)),this._touchRectArray[r].addTouchListenerWithDelegate(this),this._touchRectArray[r].setTouchEnabled(!1), this._touchRectArray[r].setName(u),this._touchRectArray[r].setAnchorPoint(0.5,0.5),this._touchRectArray[r].setZOrder(6),this._SubscriptionPanel.addChild(this._touchRectArray[r])),v=RSGame.getInstance().getAssetPath("SubscriptionPreviewWidget"),this._subscriptionPreviewWidget=new RSSubscriptionCollectWidget(this._SubscriptionPanelData,v,"promo_widget"),this._SubscriptionPanel.addChild(this._subscriptionPreviewWidget),r++,this._activeWidgetPanelArray.push(this._SubscriptionPanel),this._subscriptionWidgetIndex= r);break;case "SweepstakesToggleWidget":u="Sweepstakes",k&&GameConfig.SWEEPSTAKES_ENABLED&&RSGame.getInstance().getGameVariable().getSweepstakeEnabledStatus()?(this._sweepstakesWidgetActive=!0,this._widgetTouchEnabledList.Sweepstakes&&(this._touchRectArray[r]=new RSDisplayObject(new RSRect(this._tochRectData.x,this._tochRectData.y,this._tochRectData.w,this._tochRectData.h)),this._touchRectArray[r].addTouchListenerWithDelegate(this),this._touchRectArray[r].setTouchEnabled(!1),this._touchRectArray[r].setName(u), this._touchRectArray[r].setAnchorPoint(0.5,0.5),this._touchRectArray[r].setZOrder(6),this._sweepstakesPanel.addChild(this._touchRectArray[r])),r++,this._activeWidgetPanelArray.push(this._sweepstakesPanel),this._sweepstakesIndex=r):this.removeChild(this._sweepstakesPanel)}"1"==s[t].comingSoonTag&&this._comingSoonArray.push(u);this.addComingSoonTag(u,r)}this._activeRadioBtnCount=this._activeWidgetPanelArray.length;1<this._activeRadioBtnCount&&this._radioBtnEnabled&&(this._rightArrow.setVisible(!0), this._leftArrow.setVisible(!0))},setMultiplePanels:function(a,b,c,d,e,f){var g=this._activeWidgetPanelArray.length;f=f?f:a;this._activeWidgetPanelArray[g]=new RSDisplayObject(new RSRect(a.x,a.y,a.w,a.h));this._activeWidgetPanelArray[g].setAutoOpacityForChild(!0);this.addChild(this._activeWidgetPanelArray[g]);b=RSUtils.createAnimation(this._screenName,b,1);b.playAnimation(-1,1);this._activeWidgetPanelArray[g].addChild(b);"ContentMachine"==c?(this._PlayNowBtnData&&(this._playBtn[c+e]=RSUtils.createButton(this._screenName, this._PlayNowBtnData),this.addTouchListenerToButton(this._playBtn[c+e]),this._playBtn[c+e].setName(c+e),this._playBtn[c+e].setZOrder(4),this._activeWidgetPanelArray[g].addChild(this._playBtn[c+e])),this._activeWidgetPanelArray[g].setPosition(a.x,a.y),a=RSUtils.createBasicObject(this._screenName,this._machineBgData),b=RSUtils.createBasicObject(this._screenName,this._machineGlowData),b.setZOrder(3),this._activeWidgetPanelArray[g].addChild(a),this._activeWidgetPanelArray[g].addChild(b)):"CrossPromoAds"== c&&this._crossPromoBtnData&&(this._crossPromoPlayBtn[c+e]=RSUtils.createButton(this._screenName,this._crossPromoBtnData),this.addTouchListenerToButton(this._crossPromoPlayBtn[c+e]),this._crossPromoPlayBtn[c+e].setName(c+e),this._crossPromoPlayBtn[c+e].setZOrder(4),this._activeWidgetPanelArray[g].addChild(this._crossPromoPlayBtn[c+e]));a=new RSImageObject;a.setImageFromUrl(d,f.x,f.y,f.w,f.h);this._activeWidgetPanelArray[g].addChild(a);this._activeWidgetPanelArray[g].setAnchorPoint(0.5,0.5);this._activeWidgetPanelArray[g].setOpacity(0); this._widgetTouchEnabledList[c]&&(this._touchRectArray[g]=new RSDisplayObject(new RSRect(this._tochRectData.x,this._tochRectData.y,this._tochRectData.w,this._tochRectData.h)),this._touchRectArray[g].addTouchListenerWithDelegate(this),this._touchRectArray[g].setTouchEnabled(!1),this._touchRectArray[g].setName(c+e),this._touchRectArray[g].setZOrder(6),this._touchRectArray[g].setAnchorPoint(0.5,0.5),this._activeWidgetPanelArray[g].addChild(this._touchRectArray[g]))},addComingSoonTag:function(a,b){this._comingSoonArray.includes(a)&& (this._playBtn&&this._playBtn[a]?this._playBtn[a].setVisible(!1):this._crossPromoPlayBtn&&this._crossPromoPlayBtn[a]&&this._crossPromoPlayBtn[a].setVisible(!1))},setRadioBtnPos:function(){if(this._radioBtnEnabled&&0!=this._activeRadioBtnCount){this._radioBtnArray=[];var a;a=6<this._activeRadioBtnCount?10:12;var b=(this._activeRadioBtnCount-1)*a,c=this._activeRadioBtnCount-1;if(0!=this._activeRadioBtnCount%2)var d=Math.floor(this._activeRadioBtnCount/2);for(var e=0;e<this._activeRadioBtnCount;e++)this._radioBtnArray[e]= RSUtils.createAnimation(this._screenName,this._radioBtn,1),this._radioBtnArray[e].setZOrder(5),this._radioBtnArray[e].stopAnimation(),this._radioBtnArray[e].setFrame(1),this.addChild(this._radioBtnArray[e]),6<this._activeRadioBtnCount?this._radioBtnArray[e].setScale(0.8):this._radioBtnArray[e].setScale(1);1==this._radioBtnArray.length&&this._radioBtnArray[0].setVisible(!1);for(e=0;e<this._activeRadioBtnCount;e++)if(e==d){this._radioBtnArray[e].setPosition(this._radioBtnRect.x,this._radioBtnRect.y+ this._radioBtnRect.h/4);break}else this._radioBtnArray[e].setPosition(this._radioBtnRect.x-b,this._radioBtnRect.y+this._radioBtnRect.h/4),this._radioBtnArray[c].setPosition(this._radioBtnRect.x+b,this._radioBtnRect.y+this._radioBtnRect.h/4),c--,b-=2*a}},setWidgetAsPerPrioritise:function(){RSEngine.loginMode==LOGIN_MODE.GUEST?this._startWidgetAnimation():this._subscriptionWidgetActive&&!this._sweepstakesWidgetActive?null!=this._subscriptionPreviewWidget.getName&&"SaleTimerButton"!=this._subscriptionPreviewWidget.getWidgetCurrentState()? this._setSubscriptionOnPause():this._startWidgetAnimation():!this._subscriptionWidgetActive&&this._sweepstakesWidgetActive?RSSweepstakesManager.getNextWeeksSweepstakesEnabledStatus()&&RSSweepstakesManager.getSweepstakesData().isEnabled&&!RSSweepstakesManager.getCoolDownTimeEnableStatus()?this.setSweepstakesOnPause():this._startWidgetAnimation():this._subscriptionWidgetActive&&this._sweepstakesWidgetActive?null!=this._subscriptionPreviewWidget.getName&&"SaleTimerButton"!=this._subscriptionPreviewWidget.getWidgetCurrentState()? this._setSubscriptionOnPause():RSSweepstakesManager.getNextWeeksSweepstakesEnabledStatus()&&RSSweepstakesManager.getSweepstakesData().isEnabled&&!RSSweepstakesManager.getCoolDownTimeEnableStatus()?this.setSweepstakesOnPause():this._startWidgetAnimation():this._startWidgetAnimation()},_startWidgetAnimation:function(){this.unscheduleAllFunctions();if(0!=this._activeRadioBtnCount){if(this._currentArrayIndex>=this._activeRadioBtnCount||0>this._currentArrayIndex)this._currentArrayIndex=0;GlobalVars.lobbyWidgetCount= this._currentArrayIndex;for(var a=0;a<this._activeRadioBtnCount;a++){if(this._touchRectArray[a])var b=this._touchRectArray[a].getName();var c=!1;a!=this._currentArrayIndex||this._comingSoonArray.includes(b)?a!=this._previousArrayindex&&this._activeWidgetPanelArray[a].setOpacity(0):c=!0;if(this._touchRectArray[a]){this._touchRectArray[a].setTouchEnabled(c);switch(b){case "Cart":this._setCartBtn(c);break;case "Sale":this._setSaleBtn(c);break;case "VIPBenefit":this._setBenefitBtn(c);break;case "PlayerConnect":this._goBtn.setTouchEnabled(c); this._connectBtn.setTouchEnabled(c);break;case "LoyaltyMall":this._widgetTouchEnabledList.LoyaltyMall&&this._activeWidgetPanelArray[a].setTouchEnabled(c);break;case "Sweepstakes":this._enterNowbutton.setTouchEnabled(c);break;case "Subscription":this._subscriptionPreviewWidget.setVisible(c)}this._playBtn[b]?this._playBtn[b].setTouchEnabled(c):this._crossPromoPlayBtn[b]&&this._crossPromoPlayBtn[b].setTouchEnabled(c)}else switch(b=this._activeWidgetPanelArray[a].getName(),b){case "SalesPanel":this._setSaleBtn(c); break;case "CartPanel":this._setCartBtn(c)}}this.setRadioBtn(this._currentArrayIndex);"rotate"==this._animationType?this._currentArrayIndex==this._previousArrayindex?(a=this._activeWidgetPanelArray[this._currentArrayIndex].actionFadeIn(0.5,this.showNextwidgetBG.bind(this)),RSTweener.easeSineOut(a)):(this._activeWidgetPanelArray[this._currentArrayIndex].setOpacity(255),this._activeWidgetPanelArray[this._currentArrayIndex].setScaleX(0),a=this._activeWidgetPanelArray[this._currentArrayIndex].actionScale(0.35, 1,1,this.showNextwidgetBG.bind(this)),RSTweener.easeSineIn(a)):"fadeOut"==this._animationType&&(this._currentArrayIndex!=this._previousArrayindex&&(this._activeWidgetPanelArray[this._currentArrayIndex].setZOrder(1),this._activeWidgetPanelArray[this._previousArrayindex].setZOrder(0),a=this._activeWidgetPanelArray[this._previousArrayindex].actionFadeOut(1),RSTweener.easeSineOut(a)),a=this._activeWidgetPanelArray[this._currentArrayIndex].actionFadeIn(1,this.showNextwidgetBG.bind(this)),RSTweener.easeSineOut(a))}}, _setSubscriptionOnPause:function(){null!=this._subscriptionPreviewWidget.getName&&"SaleTimerButton"!=this._subscriptionPreviewWidget.getWidgetCurrentState()&&(RSEngine.loginMode==LOGIN_MODE.FACEBOOK&&null==RSSubscrptionSaleManager.getCurrentDate("day")||RSSubscrptionSaleManager.getCurrentDate("day")&&!RSSubscrptionSaleManager.getCurrentDayClaimedStatus())&&(this._currentArrayIndex=this._subscriptionWidgetIndex-1,this._pauseWidgetAnim=!0);this._startWidgetAnimation()},setSweepstakesOnPause:function(){GameConfig.SWEEPSTAKES_ENABLED&& RSGame.getInstance().getGameVariable().getSweepstakeEnabledStatus()&&this._sweepstakesWidgetActive&&(this._currentArrayIndex=this._sweepstakesIndex-1,this._pauseWidgetAnim=!0);this._startWidgetAnimation()},resumeWidgetAnimation:function(){this._pauseWidgetAnim=!1;this._subscriptionPreviewWidget&&(this._subscriptionPreviewWidget.setWidget(),this._subscriptionPreviewWidget.updateTimer());this._startWidgetAnimation()},_setCartBtn:function(a){null==this._cartButton||RSSaleManager.getInstance().getSaleActiveStatus(!0)|| this._cartButton.setTouchEnabled(a)},_setSaleBtn:function(a){null!=this._saleButton&&RSSaleManager.getInstance().getSaleActiveStatus(!0)&&this._saleButton.setTouchEnabled(a)},_setBenefitBtn:function(a){this._benefitButton&&this._benefitButton.setTouchEnabled(a)},showNextwidgetBG:function(){this._pauseWidgetAnim||(this._previousArrayindex=this._currentArrayIndex,"rotate"==this._animationType?this.scheduleFunctionOnce(function(){var a=this._activeWidgetPanelArray[this._previousArrayindex].actionScale(0.35, 0,1,this.updateWidgetCount.bind(this));RSTweener.easeSineIn(a)}.bind(this),5):"fadeOut"==this._animationType&&this.scheduleFunctionOnce(function(){this.updateWidgetCount()}.bind(this),5))},updateWidgetCount:function(){this._currentArrayIndex++;this._startWidgetAnimation()},setRadioBtn:function(a){if(this._radioBtnEnabled){for(var b=0;b<this._activeRadioBtnCount;b++)b==a?this._radioBtnArray[b].setFrame(0):this._radioBtnArray[b].setFrame(1);0==a?this._leftArrow.setTouchEnabled(!1):this._leftArrow.setTouchEnabled(!0); a==this._activeRadioBtnCount-1?this._rightArrow.setTouchEnabled(!1):this._rightArrow.setTouchEnabled(!0)}},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){if(RSEngine.loginMode===LOGIN_MODE.GUEST)RSGame.getInstance().getGameManager().showLoginPopup("feature","PreviewWidget");else switch(a.getName()){case "Cart":case "Sale":this._callBack&&(this.unscheduleAllFunctions(),this._callBack(!1,this._startWidgetAnimation.bind(this),"promo_widget")); break;case "LoyaltyMall":this.unscheduleAllFunctions();if(!GlobalVars.isPurchaseEnabled){VideoManager.getInstance().showVideoPopup("ReplacePurchase",!1,"purchase_cart",this._startWidgetAnimation.bind(this));break}RSSaleManager.getInstance().showPurchaseCart(!1,this._startWidgetAnimation.bind(this),"promo_widget");break;case "VIPBenefit":this.unscheduleAllFunctions();RSGame.getInstance().getGameManager().showVIPBenefitsPopup(this._startWidgetAnimation.bind(this),"promo_widget");break;case "PlayerConnect":this.unscheduleAllFunctions(); RSGame.getInstance().getUserDataManager().getMe().getPlayerConnectUpdateStatus()?RSEngine.popupManager.addPopup(new RSPlayerClubRedirectionPopup("promo_widget",this._startWidgetAnimation.bind(this))):RSGame.getInstance().getGameManager().connectPlayerIdWithCasino(null,this._onPlayerConnectPopupClosed.bind(this),null,"promo_widget");break;case "Subscription":this.unscheduleAllFunctions();this._subscriptionPreviewWidget.onWidgetTouch();break;case "Sweepstakes":this.unscheduleAllFunctions();this.onSweepStakesBtnClicked(); break;default:this.onCustomPanelClick(a.getName())}},_onPlayerConnectPopupClosed:function(){RSGame.getInstance().getUserDataManager().getMe().getPlayerConnectUpdateStatus()&&(this._goBtn.setVisible(!0),this._connectBtn.setVisible(!1));this._startWidgetAnimation()},onCustomPanelClick:function(a){var b=/ContentMachine/,c=/PropertyPromoAds/;if(/CrossPromoAds/.test(a))this.onCrossPromoclicked(a);else c.test(a)?(RSAnalyticsManager.getInstance().trackPlayerAction("property_promo_ad","click","open_from_promo_widget", "",""),window.open(this._propertyGameData[a].data,"_blank")):b.test(a)&&this._loadMachine(this._machineGameData[a].id,this._machineGameData[a].type)},_loadMachine:function(a,b){this.unscheduleAllFunctions();GlobalVars.lobbyWidgetCount=this._currentArrayIndex;RSEngine.externalGameManager.unLoadExternalGame();RSCasinoManager.getCasinoInterface().loadMachine(b,a,RSGameScreens.MainLobby,"newMachines")},onCrossPromoclicked:function(a){this.unscheduleAllFunctions();var b=this._crossPromoGameData[a].data; RSAnalyticsManager.getInstance().trackGUIEvent("cross_promo","promo_widget","click",this._crossPromoGameData[a].data.analyticsId);RSEngine.popupManager.addPopup(new RSCrossPromoAdsPopup(b,this._startWidgetAnimation.bind(this),this._crossPromoGameData[a].data.analyticsId))},onButtonClicked:function(a){if(RSEngine.loginMode===LOGIN_MODE.GUEST&&"RightArrow"!=a&&"LeftArrow"!=a)RSGame.getInstance().getGameManager().showLoginPopup("feature","PreviewWidget");else switch(a){case "SaleDealbutton":case "Cartbutton":this._callBack&& (this.unscheduleAllFunctions(),this._callBack(!1,this._startWidgetAnimation.bind(this),"promo_widget"));break;case "Benefitbutton":this.unscheduleAllFunctions();RSGame.getInstance().getGameManager().showVIPBenefitsPopup(this._startWidgetAnimation.bind(this),"promo_widget");break;case "EnterNowbutton":this.unscheduleAllFunctions();this.onSweepStakesBtnClicked();break;case "RightArrow":case "LeftArrow":this._pauseWidgetAnim=!1;this.unscheduleAllFunctions();this.onRadioBtnClick(a);break;default:this.onCustomPanelClick(a)}}, onSweepStakesBtnClicked:function(){!RSGame.getInstance().getUserDataManager().getMe().getSweepstakesSurfaceShownStatus()&&RSSweepstakesManager.getNextWeeksSweepstakesEnabledStatus()?(RSSweepstakesManager.showJackpotSweepstakesEntryPopup(!0,this.setSweepstakesOnPause.bind(this),!1,"promo_widget"),RSGame.getInstance().getUserDataManager().getMe().setSweepstakesSurfaceShownStatus(),GlobalVars.isSurfacingActive=!0):RSSweepstakesManager.getSweepstakesRewardAnnouncementPopupTriggerStatus()?RSSweepstakesManager.showSweepstakesRewardAnnouncementPopup(this.onSweepstakesClose.bind(this)): RSSweepstakesManager.getNextWeeksSweepstakesEnabledStatus()?RSSweepstakesManager.getCoolDownTimeEnableStatus()?RSSweepstakesManager.showJackpotSweepstakesCooldownPopup(!1,this.onSweepstakesClose.bind(this)):RSSweepstakesManager.getSweepstakesData().isEnabled?RSSweepstakesManager.showJackpotSweepstakesEntryPopup(!1,this.onSweepstakesClose.bind(this),!1,"promo_widget"):RSSweepstakesManager.showJackpotSweepstakesEntrySuccesPopup(!1,this.onSweepstakesClose.bind(this)):RSSweepstakesManager.showJackpotSweepstakesWinnersList(this.onSweepstakesClose.bind(this))}, onSweepstakesClose:function(){this._pauseWidgetAnim=!1;this._startWidgetAnimation()},onRadioBtnClick:function(a){"LeftArrow"==a?this._currentArrayIndex--:this._currentArrayIndex++;this._startWidgetAnimation()},unload:function(){RSEventManager.getInstance().removeListenersForEvent("refreshSalePreviewWidget");this.stopAllActions();this.unscheduleAllFunctions();this._super.unload.call(this);this._radioBtn=this._radioBtnRect=this._leftArrow=this._rightArrow=this._cartButton=this._propertyPromoAdsAnimData= this._contentMachineAnimData=this._crossPromoAdsAnimData=this._vipBenefitParticleAnim=this._cartParticleAnim=this._vipBenefitBg=this._cartBg=this._cartPanel=this._timer=this._fontData=this._callBack=this._saleButton=this._propertyPromoAdsPanelData=this._contentMachinePanelData=this._crossPromoAdsPanelData=this._vipBenefitPanel=this._loyaltyMallPanel=this._saleButtonPanel=this._loyaltyMallPointsLabel=this._saleParticleAnim=this._loyaltyParticleAnim=this._loyaltyMallBg=this._saleButtonBg=this._baseRect= null;this._crossPromoGameData={};this._machineGameData={};this._propertyGameData={};this._widgetCountList={}}});var RSCrossPromoAdsPopup=RSGenericPopup.extend({init:function(a,b,c){this._gameName=c;this._url=a;this._callBackFunc=b;this._layout=RSGame.getInstance().getAssetPath("RSCrossPromoAdsPopup");RSAnalyticsManager.getInstance().trackGUIEvent("cross_promo","popup","trigger",this._gameName);this._super.init.call(this)},loadContent:function(){this.layoutScreen(this._layout);this._super.loadContent.call(this)},createCustomObject:function(a,b){return this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a, b,c){this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},onButtonClicked:function(a){switch(a){case "LetsGoBtn":window.open(this._url,"_blank");this.closePopup();break;case "CloseBtn":this.closePopup()}},getName:function(){return"RSCrossPromoAdsPopup"},closePopup:function(){RSAnalyticsManager.getInstance().trackGUIEvent("cross_promo","popup","close",this._gameName);this._callBackFunc&&this._callBackFunc();this._super.closePopup.call(this)}, unload:function(){this._super.unload.call(this)}});var VIP_BADGE_TYPE={PURCHASE:"PURCHASE",LEVEL_UP:"LEVEL_UP",BONUS:"BONUS"},VIPMultiplierBadge=RSBasicObject.extend({_badgeShown:!1,_badgeLoaded:!1,init:function(a,b,c){this._super.init.call(this);this._badgeY=this._badgeX=this._badgeH=this._badgeW=null;this._baseObject=c;this._value=this._badgeValue=this._badgeHolder=null;this._badgeType=b;this._assetPath=RSGame.getInstance().getAssetPath("VIPMultiplierBadge");switch(b){case VIP_BADGE_TYPE.PURCHASE:this._value="+"+a+"%";break;case VIP_BADGE_TYPE.LEVEL_UP:this._value= "+"+a+"%";break;case VIP_BADGE_TYPE.BONUS:this._value="X"+a}this.loadContent()},loadContent:function(){this.loadLayout(this._assetPath)},createCustomObject:function(a,b){var c=null;"BadgeRect"==b.name&&(this._badgeW=b.w,this._badgeH=b.h);b.x=(b.x-this._badgeW)/2;b.y=(b.y-this._badgeH)/2;switch(b.name){case "Base":c=RSUtils.createBasicObject(a,b);break;case "BlastAnim":c=RSUtils.createAnimation(a,b,1);c.stopAnimation();c.playAnimation(-1,0.2);c.moveY(22);break;case "VIP_BaseAnim":c=RSUtils.createAnimation(a, b,1);c.moveY(30);c.stopAnimation();c.playAnimation(-1,0.2);break;case "Text":c=new RSLabelBMFont("MULTIPLIER",RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),-1,kTEXT_ALIGNMENT_CENTER);c.setScale(0.3);c.setCenter(b.x,b.y);c.moveY(8);break;case "MultiplerText":c=new RSLabelBMFont(this._value,RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),-1,kTEXT_ALIGNMENT_CENTER);c.setScale(0.48);c.setCenter(b.x,b.y);c.moveY(1);this._badgeValue=c;break;case "Message":c= new RSLabelBMFont("MORE",RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),-1,kTEXT_ALIGNMENT_CENTER),c.setScale(0.3),c.setCenter(b.x,b.y),c.moveY(-5)}null!=c&&this.addChild(c)},onLayoutCompleted:function(){this.setVisible(!1);this.setScale(0.1);this._baseObject.addChild(this);RSEngine.screenManager.onLayerLoaded();this._badgeLoaded=!0;cc.log("Badge Loaded!");this._badgeShown&&this.showBadge()},updateBadgeText:function(a){this._value="";switch(this._badgeType){case VIP_BADGE_TYPE.PURCHASE:this._value= "+"+a+"%";break;case VIP_BADGE_TYPE.LEVEL_UP:this._value="+"+a+"%";break;case VIP_BADGE_TYPE.BONUS:this._value="X"+a}this._badgeValue.setString(this._value)},showBadge:function(){this._badgeShown=!0;this._badgeLoaded&&(cc.log("Badge Shown!"),this.setVisible(!0),this.actionZoom(1,1))},unload:function(){this.stopAllActions();this._super.unload.call(this);this._assetPath=this._badgeType=this._value=this._badgeValue=this._baseObject=this._badgeH=this._badgeW=null}});var RSCasinoIconHolder=RSDisplayObject.extend({TALL_ICON_VIP:"TALL_ICON_VIP",LONG_ICON_VIP:"LONG_ICON_VIP",LONG_ICON:"LONG_ICON",LONG_ICON_ALLSLOTS:"LONG_ICON_ALLSLOTS",LONG_ICON_WITHOUT_BET:"LONG_ICON_WITHOUT_BET",SMALL_ICON:"SMALL_ICON",TINY_ICON:"TINY_ICON",TALL_ICON:"TALL_ICON",CUSTOM_ICON:"CUSTOM_ICON",VIP_ICON:"VIP_ICON",MACHINE_UNLOCK_ICON:"MACHINE_UNLOCK_LAYOUT",LARGE_LAYOUT:"res/PlatformWidgets/RSCasinoIconHolder/IconBig",SMALL_LAYOUT:"res/PlatformWidgets/RSCasinoIconHolder/IconSmall",TINY_LAYOUT:"res/PlatformWidgets/RSCasinoIconHolder/IconTiny", TALL_LAYOUT:"res/PlatformWidgets/RSCasinoIconHolder/IconTall",LONG_WITHOUT_BET_LAYOUT:"res/PlatformWidgets/RSCasinoIconHolder/IconBigWithNoBet",MACHINE_UNLOCK_LAYOUT:"res/PlatformWidgets/RSIconHolder/MachineUnlockIcon",OFFSETCHANGE_Y:0,zoomed:!1,init:function(a,b,c,d,e,f,g,h,k,m,n,p,r,s,u,t){this._underMaintenance=null;var v=c.split("/");v.pop();this._iconFolder=v.join("/");this._iconFont=g.FONT_ICON;g.JL_FONT_ICON&&(this._JLFont=g.JL_FONT_ICON);g.JL_FONT_COLOR&&(this._JLFontColor=g.JL_FONT_COLOR); this._iconRect=RSUtils.cloneJSON(b);b=new RSRect(this._iconRect.x,this._iconRect.y,this._iconRect.w,this._iconRect.h);this._super.init.call(this,b);this._machineDetails=e;this._iconUrl=c;this._onPlayClicked=d;this._enabled=!1;this._unlockedTier=RSGame.getInstance().getGameManager().isVipEnabled()?RSVIPManager.getInstance().getVIPUserTier():0;this._minBetTxt="";this._layoutType=a;s&&(this._gameType=s.gameType,this._isFavEnabled=s.isFavEnabled);this._onUnFavoriteMachine=u;this._isFavDummyIcon=t?t:!1; this._angleToRotate="TALL_ICON"==a?1.5:2;this._iconAnimationCounter=1;this._maxAnimationCounter=7;this._currIndex=n;this._jackPotName=m?m:null;this.OFFSETCHANGE_Y=void 0==k||null==k?0:k;this._unlockMachine=f;this._isFeatured=p;this._isTopFeatured=0;this._usePreloader=null==h?!0:h;this._lockAnimStarted=!1;e&&(this._showJackpotLoungeHeader=void 0!==e.showJackpotLoungeHeader?e.showJackpotLoungeHeader:!0);this._skipIconLoading=r;this._isUnFavoriteConfirmToolTipVisible=this._lockStatus=!1;this._imageObj= new RSImageObject;this.loadLayout()},loadLayout:function(){var a=null;switch(this._layoutType){case this.TINY_ICON:a=this.TINY_LAYOUT;break;case this.SMALL_ICON:a=this.SMALL_LAYOUT;break;case this.TALL_ICON_VIP:a=this.TALL_LAYOUT;break;case this.LONG_ICON:case this.LONG_ICON_VIP:case this.LONG_ICON_ALLSLOTS:a=this.LARGE_LAYOUT;break;case this.LONG_ICON_WITHOUT_BET:a=this.LONG_WITHOUT_BET_LAYOUT;break;case this.CUSTOM_ICON:a=this.CUSTOM_LAYOUT;break;case this.VIP_ICON:a=this.LARGE_LAYOUT;break;case this.MACHINE_UNLOCK_ICON:a= this.MACHINE_UNLOCK_LAYOUT;break;case this.TALL_ICON:a=this.TALL_LAYOUT}this._super.loadLayout.call(this,a)},setUnlock:function(){var a=RSGame.getInstance().getGameManager().getGameType();this._machineDetails&&(this._machineDetails.machine_identifier.includes("R_")?a=RSGameTypes.Roulette:this._machineDetails.machine_identifier.includes("B_")?a=RSGameTypes.Bingo:this._machineDetails.machine_identifier.includes("BJ_")?a=RSGameTypes.Blackjack:this._machineDetails.machine_identifier.includes("K_")?a= RSGameTypes.Keno:this._machineDetails.machine_identifier.includes("BR_")?a=RSGameTypes.TableGames:this._machineDetails.machine_identifier.includes("CP_")||this._machineDetails.machine_identifier.includes("MPP_")||this._machineDetails.machine_identifier.includes("MSP_")||this._machineDetails.machine_identifier.includes("MSPT_")||this._machineDetails.machine_identifier.includes("PKR_")?a=RSGameTypes.Poker:this._machineDetails.machine_identifier.includes("S_")?a=RSGameTypes.Slots:this._machineDetails.machine_identifier.includes("L_")? a=RSGameTypes.Scratcher:this._machineDetails.machine_identifier.includes("X_")&&(a=RSGameTypes.Scorebox));a==RSGameTypes.Scratcher?(this._enabled=!0,this._setMinBet(a),this._setMinBetCoinAndUnlockVisibility(),this._unlocksAtLabel&&this._unlocksAtLabel.setVisible(!1),this._unLockLevelText&&this._unLockLevelText.setVisible(!1),this._unLockLevelTextLabel&&this._unLockLevelTextLabel.setVisible(!1),this._minBet&&this._minBet.setVisible(!1)):a==RSGameTypes.Slots?(this._setMinBet(a),this._checkMachineUnlockStatus(), this._setMinBetCoinAndUnlockVisibility()):(this._enabled=!0,RSGame.getInstance().getGameManager().getGameType()==RSGameTypes.Poker&&this._machineDetails.comingSoon&&parseInt(this._machineDetails.comingSoon)&&(this._enabled=!1),this._setMinBetCoinAndUnlockVisibility(),this._minBetTxt&&this._minBetTxt.setVisible(!1),this._minBet&&this._minBet.setVisible(!1),this._labelrightText&&this._labelrightText.setVisible(!1),this._unLockLevelText&&this._unLockLevelText.setVisible(!1),this._unlocksAtLabel&&this._unlocksAtLabel.setVisible(!1), this._unLockLevelTextLabel&&this._unLockLevelTextLabel.setVisible(!1))},_createTouchArea:function(a){var b=null,b=new RSRect(a.x-a.w/2,a.y-a.h/2,a.w,a.h);this._touchArea=new RSDisplayObject(b);this._touchArea.getDisplayObject()._name="touchAreaTemp";this.addChild(this._touchArea)},setYPositionAdjust:function(a){this._layoutType==this.LONG_ICON_ALLSLOTS&&(a.y-=this.OFFSETCHANGE_Y)},enableEvent:function(){this._isFavDummyIcon||(this.addMoveListener(),this._animation1&&(this._animation1.stopAnimation(), this._animation1.playAnimation(-1,0.25)),this._animation2&&(this._animation2.stopAnimation(),this._animation2.playAnimation(-1,0.25)),this._newBadge&&(this._newBadge.stopAnimation(),this._newBadge.playAnimation(-1,0.3)),this._vipOverlay&&this._vipOverlay.hideToolTip(),this._JLInfoToolTip&&this.hideJLToolTip())},tableCellTouched:function(a){if(this.containsPoint(a.x,a.y)&&!this._isFavDummyIcon&&!this._isUnFavoriteConfirmToolTipVisible)if(this._enabled)RSGame.getInstance().getGameManager().setLocationForMachineOpenPopup(a.x, a.y),this._onPlayClicked(this._machineDetails,this._enabled,this._jackPotName,this._layoutType,this._currIndex);else{a=this._machineDetails.machine_identifier;var b=this._machineDetails.levelRequired,c="";this._vipOverlay&&(b="VIP",this._vipOverlay.showToolTip());null==this._jackPotName||this._layoutType!=this.LONG_ICON_ALLSLOTS&&this._layoutType!=this.TALL_ICON&&this._layoutType!=this.LONG_ICON_WITHOUT_BET||!GameConfig.JACKPOT_LOUNGE_ENABLE?this.showLockAnimation():(b=GameConfig.JACKPOT_LOUNGE_LEVEL, a=this._machineDetails.machine_identifier+"_JL",c=this._jackPotName,this.showLockAnimation(),this.showJLToolTip());for(var d=!1,e=0;e<GlobalVars.clickedLockedMachineList.length;e++)if(GlobalVars.clickedLockedMachineList[e]===a){d=!0;break}!d&&this._machineDetails.isEnabled&&parseInt(this._machineDetails.isEnabled)&&(GlobalVars.clickedLockedMachineList.push(a),"FPC"==GameConfig.GAME_ID&&RSAnalyticsManager.getInstance().trackPlayerAction("locked_machine","click",this._machineDetails.machine_identifier, b,c))}},showJLToolTip:function(){this._JLInfoToolTip&&this._machineDetails.isEnabled&&parseInt(this._machineDetails.isEnabled)&&!this._JLInfoToolTip.isVisible()&&(this._JLInfoToolTip.setVisible(!0),this.scheduleFunctionOnce(this.hideJLToolTip.bind(this),3))},hideJLToolTip:function(){this._JLInfoToolTip&&this._JLInfoToolTip.setVisible(!1)},onLayoutCompleted:function(){if(this._isFavDummyIcon){this.removeAllChildren();this._favoriteDummyIcon=RSUtils.createBasicObject(this._screenName,this._favoriteDummyIconData); this.addChild(this._favoriteDummyIcon);this._favoriteDummyIcon.setVisible(!0);var a="tier"+RSVIPManager.getInstance().getVIPUserTier(),b=RSEngine.gameData.getSheetData("favoritesTierCapping")[0][a],a=RSEngine.gameData.getSheetData("favoritesTierCapping")[0].tier5,c=RSGame.getInstance().getGameData().getPopupTextWithKey("favoriteDummyIconTxt1"),c=c.replace(/\\n/g,"\n"),c=c.replace("{value}",b),b=new RSScaledLabel(c,this._iconFont,this._favDummyTxt1Data,kTEXT_ALIGNMENT_CENTER);this.addChild(b);b=RSGame.getInstance().getGameData().getPopupTextWithKey("favoriteDummyIconTxt2"); b=b.replace(/\\n/g,"\n");b=b.replace("{value}",a);a=new RSScaledLabel(b,this._iconFont,this._favDummyTxt2Data,kTEXT_ALIGNMENT_CENTER);this.addChild(a)}else{this.setUnlock();if(this._layoutType==this.LONG_ICON_VIP||this._layoutType==this.TALL_ICON_VIP)this.checkMachineUnlockShown(),!this._lockStatus||"AP"!=GameConfig.GAME_ID&&"UP"!=GameConfig.GAME_ID||this._isTopFeatured||this._imageObj.setColor(new RSColor(64,64,64,255));this.handleJackpotVisibility();this._isFavEnabled&&this._enabled&&!this._skipIconLoading&& this.setFavoriteMachineIcon()}this._super.onLayoutCompleted.call(this)},setJackPotValuesToIconHolder:function(a,b){this._megaJackpot&&this._megaJackpot.updateText(b)},handleJackpotVisibility:function(){if(null==this._jackPotName||null!=this._jackPotName&&!this._showJackpotLoungeHeader)this._megaJackpot&&this._megaJackpot.setVisible(!1),this._JLBase&&this._JLBase.setVisible(!1),this._animation1&&(this._animation1.stopAnimation(),this._animation1.setVisible(!1)),this._animation2&&(this._animation2.stopAnimation(), this._animation2.setVisible(!1))},hideVIPOverlay:function(){},showVIPOverlay:function(){this._unlocksAtLabel&&(this._unlocksAtLabel.setVisible(!1),this._unLockLevelText.setVisible(!1));this._unLockLevelTextLabel&&this._unLockLevelTextLabel.setVisible(!1);this._vipOverlay&&this.removeChild(this._vipOverlay);if(this._layoutType==this.LONG_ICON_VIP||this._layoutType==this.TALL_ICON_VIP)this._vipOverlay=new VIPIconLargeOverlay(this._machineDetails,this._iconRect,this._enabled);else if(this._layoutType== this.SMALL_ICON||this._layoutType==this.TINY_ICON||this._layoutType==this.TALL_ICON)this._vipOverlay=new VIPIconMiniOverlay(this._machineDetails,this._iconRect,this._enabled);this._vipOverlay&&(this.setYPositionAdjust(this._vipOverlay),this.addChild(this._vipOverlay))},showLockAnimation:function(){!1==this._lockAnimStarted&&(this._lockAnimStarted=!0,this._unLockLevelText&&(this._currentScaleOfTextbox=this._unLockLevelText.getScale(),this._unLockLevelText.actionScaleInOut(0.3,this._currentScaleOfTextbox+ 0.1,this._currentScaleOfTextbox,this._currentScaleOfTextbox+0.1,this._currentScaleOfTextbox,2,this.onLockAnimCompleted.bind(this)),this._unlocksAtLabel.actionScaleInOut(0.3,1.1,1,1.1,1,2)),this._unLockLevelTextLabel&&(this._currentScaleOfTextbox=this._unLockLevelTextLabel.getScale(),this._unLockLevelTextLabel.actionScaleInOut(0.3,this._currentScaleOfTextbox+0.1,this._currentScaleOfTextbox,this._currentScaleOfTextbox+0.1,this._currentScaleOfTextbox,2,this.onLockAnimCompleted.bind(this))))},onLockAnimCompleted:function(){this._unLockLevelText&& (this._unLockLevelText.setScale(this._currentScaleOfTextbox),this._unlocksAtLabel.setScale(1));this._unLockLevelTextLabel&&this._unLockLevelTextLabel.setScale(this._currentScaleOfTextbox);this._lockAnimStarted=!1},playIconAnimations:function(){this._imageObj.actionRotateBy(this._layoutType==this.TALL_ICON?0.15:0.1,this._angleToRotate,1,this.onAnimComplete.bind(this))},onAnimComplete:function(){this._iconAnimationCounter++;var a=this._layoutType==this.TALL_ICON?0.15:0.1;this._iconAnimationCounter== this._maxAnimationCounter?this._imageObj.actionRotateBy(a,this._angleToRotate,1,null):0==this._iconAnimationCounter%2?this._imageObj.actionRotateBy(a,-(2*this._angleToRotate),1,this.onAnimComplete.bind(this)):this._imageObj.actionRotateBy(a,2*this._angleToRotate,1,this.onAnimComplete.bind(this))},getUnlockLevelText:function(){return null==this._jackPotName||this._layoutType!=this.LONG_ICON_ALLSLOTS&&this._layoutType!=this.TALL_ICON||!GameConfig.JACKPOT_LOUNGE_ENABLE?this._machineDetails?this._machineDetails.levelRequired: 0:RSGame.getInstance().getLevelManager().getCurrentLevel()<GameConfig.JACKPOT_LOUNGE_LEVEL?GameConfig.JACKPOT_LOUNGE_LEVEL:0},createCustomObject:function(a,b){this.setYPositionAdjust(b);this._super.createCustomObject.call(this,a,b);switch(b.name){case "ImageHolder":this._setIcon(b);this._isFavEnabled&&this._createTouchArea(b);break;case "IconHolder":this._isFavEnabled||this._createTouchArea(b);this._iconHolder=RSUtils.createBasicObject(a,b);if(this._machineDetails&&void 0!==this._machineDetails.hideHolderBo&& !0===this._machineDetails.hideHolderBo)break;this._layoutType==this.LONG_ICON_WITHOUT_BET?this._setIcon(b):this._iconHolder&&this.addChild(this._iconHolder);break;case "UnlockAt":this._unlocksAtLabel=RSUtils.createBasicObject(a,b);this.addChild(this._unlocksAtLabel);break;case "UnlockText":this._unLockLevelText=new RSScaledLabel(this.getUnlockLevelText(),this._iconFont,b,kTEXT_ALIGNMENT_LEFT);this.addChild(this._unLockLevelText);break;case "UnlockLevelText":this._unLockLevelTextLabel=new RSScaledLabel("UNLOCK AT LVL "+ this.getUnlockLevelText(),this._iconFont,b,kTEXT_ALIGNMENT_CENTER);this._unLockLevelTextLabel.setScale(0.3);this.addChild(this._unLockLevelTextLabel);break;case "MinBet":this._minBet=RSUtils.createBasicObject(a,b);this._minBet.setVisible(!1);this.addChild(this._minBet);break;case "MinBetText":this._rightText=b;this._labelrightText=new RSScaledLabel(this._minBetTxt,this._iconFont,this._rightText,kTEXT_ALIGNMENT_CENTER);this.addChild(this._labelrightText);this._labelrightText.setVisible(!1);break;case "CardCost":this._cardCost= new RSScaledLabel("CARD COST: ",this._iconFont,b,kTEXT_ALIGNMENT_RIGHT);this.addChild(this._cardCost);this._cardCost.setVisible(!1);break;case "TimerBg":this._timerBG=RSUtils.createBasicObject(a,b);this._timerBG.setVisible(!1);this.addChild(this._timerBG);break;case "TimerText":this._timerText=new RSScaledLabel("12:12:12",this._iconFont,b,kTEXT_ALIGNMENT_CENTER);this._timerText.setVisible(!1);this.addChild(this._timerText);break;case "JackpotCoinText":var c=new RSScaledLabel("",this._JLFont,b,kTEXT_ALIGNMENT_CENTER); this.addChild(c);this._megaJackpot=new JackpotDataMeter(c,this._JLFont,"mega",this._JLFontColor);this.addChild(this._megaJackpot);break;case "JLBase":this._JLBase=RSUtils.createBasicObject(a,b);this.addChild(this._JLBase);break;case "JLInfo":this._JLInfoToolTip=RSUtils.createBasicObject(a,b);this.addChild(this._JLInfoToolTip);this._JLInfoToolTip.setVisible(!1);break;case "UnderMaintenance":this._underMaintenance=RSUtils.createBasicObject(a,b);this.addChild(this._underMaintenance);this._underMaintenance.setVisible(!1); break;case "TTFavLimitMsg":c=RSGame.getInstance().getGameData().getPopupTextWithKey("FavoriteLimitReachedTxt"),c=c.replace(/\\n/g,"\n"),this._TTFavLimitTxt=new RSScaledLabel(c,this._iconFont,b,kTEXT_ALIGNMENT_CENTER),this._TTFavLimitTxt.setVisible(!1),this.addChild(this._TTFavLimitTxt);case "TTUnFavMsg":c=RSGame.getInstance().getGameData().getPopupTextWithKey("UnfavoriteMachineTxt"),c=c.replace(/\\n/g,"\n"),this._TTUnFavTxt=new RSScaledLabel(c,this._iconFont,b,kTEXT_ALIGNMENT_CENTER),this._TTUnFavTxt.setVisible(!1), this.addChild(this._TTUnFavTxt);case "FavDummyTxt1":this._favDummyTxt1Data=b;break;case "FavDummyTxt2":this._favDummyTxt2Data=b;break;case "FavoritesAnimation":this._favoriteAnim=RSUtils.createAnimation(a,b,1),this.addChild(this._favoriteAnim),this._favoriteAnim.setVisible(!1),this._favoriteAnim.stopAnimation()}},_setIcon:function(a){this._skipIconLoading||(this._usePreloader?this._imageObj.setImageFromUrlWithPreloader(this._iconUrl,a.x,a.y,a.w,a.h):this._imageObj.setImageFromUrl(this._iconUrl,a.x, a.y,a.w,a.h));this.addChild(this._imageObj)},onObjectCreated:function(a,b,c){if(this._layoutType==this.LONG_ICON_ALLSLOTS){var d=a.getPosition();a.setPosition(d.getX(),d.getY()-this.OFFSETCHANGE_Y)}this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "NewBadge":case "NewBadgeBig":this._machineDetails&&"1"!=this._machineDetails.isNew?this.removeChild(a):"Animation"==c.type&&(this._newBadge=a,this._newBadge.stopAnimation(),this._newBadge.playAnimation(-1,0.3));break;case "JLBaseAnimation1":this._animation1= a;this._animation1.stopAnimation();this._animation1.playAnimation(-1,0.25);break;case "JLBaseAnimation2":this._animation2=a;this._animation2.stopAnimation();this._animation2.playAnimation(-1,0.25);break;case "FavouriteIcon":this._favorite=a;this._favorite.setTouchEnabled(!1);this._favorite.getDisplayObject()._name="favouriteIcon";this._favorite.setVisible(!1);this._favoriteObjectData=c;break;case "UnFavouriteIcon":this._unfavorite=a;this._unfavorite.setTouchEnabled(!1);this._unfavorite.getDisplayObject()._name= "unFavouriteIcon";this._unfavorite.setVisible(!1);break;case "TooltipBg":this._tooltipBg=a;this._tooltipBg.setVisible(!1);break;case "TTYesBtn":this._TTYesBtn=a;this._TTYesBtn.setVisible(!1);break;case "TTNoBtn":this._TTNoBtn=a;this._TTNoBtn.setVisible(!1);break;case "FavoritesDummyIcon":this._screenName=b,this._favoriteDummyIconData=c,a.setVisible(!1)}},onMouseMoveOn:function(a){if(1==parseInt(RSGame.getInstance().getGameData().getDefaultValues().isFavoritesEnabled)&&this._favoriteObjectData){var b= a.getCurrentTarget(),c=b.convertToNodeSpace(a.getLocation()),d=cc.rect(this._favoriteObjectData.x-this._favoriteObjectData.w/2,this._favoriteObjectData.y-this._favoriteObjectData.h/2,this._favoriteObjectData.w,this._favoriteObjectData.h);if(cc.rectContainsPoint(d,c)&&this.isVisible()&&!this.zoomed)return this.zoomed=!0,cc.$("#gameCanvas").style.cursor="pointer",a=a._currentTarget.getChildByName("favouriteIcon").visible?this._favorite.actionScale(0.1,1.1,1.1):this._unfavorite.actionScale(0.1,1.1,1.1), RSTweener.easeSineIn(a),this.addMoveOutListener(),!0;b=a.getCurrentTarget();c=b.convertToNodeSpace(a.getLocation());d=b.getContentSize();d=cc.rect(0,0,d.width,d.height)}else b=a.getCurrentTarget(),c=b.convertToNodeSpace(a.getLocation()),d=b.getContentSize(),b=b.getPosition(),d=cc.rect(b.x,b.y,d.width,d.height);if(cc.rectContainsPoint(d,c)&&this.isVisible())return cc.$("#gameCanvas").style.cursor="pointer",this.addMoveOutListener(),a.stopPropagation(),!0},onMouseMoveOut:function(a){if(1==parseInt(RSGame.getInstance().getGameData().getDefaultValues().isFavoritesEnabled)&& this._favoriteObjectData){var b=a.getCurrentTarget(),c=b.convertToNodeSpace(a.getLocation()),d=cc.rect(this._favoriteObjectData.x-this._favoriteObjectData.w/2,this._favoriteObjectData.y-this._favoriteObjectData.h/2,this._favoriteObjectData.w,this._favoriteObjectData.h);if(!cc.rectContainsPoint(d,c)&&this.zoomed)return cc.$("#gameCanvas").style.cursor="default",cc.eventManager.removeListener(this._moveOutEventListener),this._moveOutEventListener=null,a.stopPropagation(),this.zoomed=!1,a=a._currentTarget.getChildByName("favouriteIcon").visible? this._favorite.actionScale(0.1,1,1):this._unfavorite.actionScale(0.1,1,1),RSTweener.easeSineIn(a),!0;b=a.getCurrentTarget();c=b.convertToNodeSpace(a.getLocation());d=b.getContentSize();b=b.getPosition();d=cc.rect(b.x,b.y,d.width,d.height)}else b=a.getCurrentTarget(),c=b.convertToNodeSpace(a.getLocation()),d=b.getContentSize(),d=cc.rect(0,0,d.width,d.height);if(!cc.rectContainsPoint(d,c))return cc.$("#gameCanvas").style.cursor="default",cc.eventManager.removeListener(this._moveOutEventListener),this._moveOutEventListener= null,a.stopPropagation(),!0},setFavoriteMachineIcon:function(){this._favoriteMachineList=RSEngine.dataManager.getMe().getFavoriteMachines(this._gameType);null==this._jackPotName?this._favoriteMachineList.includes(this._machineDetails.machine_identifier)?this.setFavoriteIconVisibility(!0):this.setFavoriteIconVisibility(!1):this._favoriteMachineList.includes(this._machineDetails.machine_identifier+"_JL")?this.setFavoriteIconVisibility(!0):this.setFavoriteIconVisibility(!1)},setFavoriteIconVisibility:function(a){this._favorite&& this._unfavorite&&(this._favorite.setVisible(a),this._favorite.setTouchEnabled(a),this._unfavorite.setVisible(!a),this._unfavorite.setTouchEnabled(!a))},unSetFavoritesInAllSlots:function(){this.setUnlock();this.setUnFavoriteConfirmationToolTip(!1);this._enabled?this.setFavoriteIconVisibility(!1):(this._favorite.setVisible(!1),this._favorite.setTouchEnabled(!1),this._unfavorite.setVisible(!1),this._unfavorite.setTouchEnabled(!1))},onButtonClicked:function(a){switch(a){case "TTYesBtn":a=this._machineDetails.machine_identifier; null!=this._jackPotName&&(a=this._machineDetails.machine_identifier+"_JL");RSEngine.dataManager.getMe().removeFromFavoriteMachines(this._gameType,a);a=RSEngine.dataManager.getMe().getFavoritedMachineCount(this._gameType);RSAnalyticsManager.getInstance().trackPlayerAction("my_favorites","remove",a,this._machineDetails.machine_identifier,"");this.setUnlock();this.setUnFavoriteConfirmationToolTip(!1);this._enabled?this.setFavoriteIconVisibility(!1):(this._favorite.setVisible(!1),this._favorite.setTouchEnabled(!1), this._unfavorite.setVisible(!1),this._unfavorite.setTouchEnabled(!1));this._isFavEnabled&&this._onUnFavoriteMachine&&this._onUnFavoriteMachine();RSEventManager.getInstance().dispatchEvent("onMachineRemovedFromFavorites",{machineID:this._machineDetails.machine_identifier,jackPotName:this._jackPotName});break;case "TTNoBtn":this.setUnFavoriteConfirmationToolTip(!1);break;case "unFavouriteIcon":a="tier"+RSVIPManager.getInstance().getVIPUserTier();a=RSEngine.gameData.getSheetData("favoritesTierCapping")[0][a]; var b=RSEngine.dataManager.getMe().getFavoritedMachineCount(this._gameType),c=!1;b==a?(RSAnalyticsManager.getInstance().trackPlayerAction("my_favorites","limit_reached",b,this._machineDetails.machine_identifier,""),this.setUnFavoriteConfirmationToolTip(!1),this.setFavLimitReachedToolTip(!0)):(null!=this._jackPotName&&(c=!0),RSAnalyticsManager.getInstance().trackPlayerAction("my_favorites","add",b+1,this._machineDetails.machine_identifier,""),RSEngine.dataManager.getMe().addToFavoriteMachines(this._gameType, this._machineDetails.machine_identifier,c),this.setFavoriteIconVisibility(!0),this._favorite.setVisible(!1),this._favoriteAnim.setVisible(!0),this._favoriteAnim.playAnimation(1,0.5,function(){this._favoriteAnim.setVisible(!1);this._favorite.setVisible(!0);this._favorite.setScale(1)}.bind(this)));break;case "favouriteIcon":this.setFavLimitReachedToolTip(!1),this.setUnFavoriteConfirmationToolTip(!0)}},setFavLimitReachedToolTip:function(a){this._isFavLimitReachedToolTipVisible=a;this._isUnFavoriteConfirmToolTipVisible|| this._tooltipBg.setVisible(a);this._TTFavLimitTxt.setVisible(a);a&&this.scheduleFunctionOnce(this.setFavLimitReachedToolTip.bind(this,!1),4)},setUnFavoriteConfirmationToolTip:function(a){this._isUnFavoriteConfirmToolTipVisible=a;this._isFavLimitReachedToolTipVisible||this._tooltipBg.setVisible(a);this._TTUnFavTxt.setVisible(a);this._TTYesBtn.setVisible(a);this._TTNoBtn.setVisible(a);a&&this.scheduleFunctionOnce(this.setUnFavoriteConfirmationToolTip.bind(this,!1),4)},onReload:function(){this._checkMachineUnlockStatus()}, _checkMachineUnlockStatus:function(){var a=!1;this._isFavEnabled&&(a=RSGame.getInstance().getGameManager().isFavoritedMachine(this._gameType,this._machineDetails.machine_identifier));var b=SlotsLobbyWidgetManager.getInstance().getFeaturedMachineData(),c=0;if(1==this._isFeatured)this._isTopFeatured=c=1;else for(var d=0;d<b.length;d++)if(b[d].machine_identifier==this._machineDetails.machine_identifier){this._isTopFeatured=c=1;break}this._enabled=!1;var b=0<this._machineDetails.VIPTier,d=this._machineDetails.levelRequired<= RSGame.getInstance().getLevelManager().getCurrentLevel(),e=UrlNotificationManager.getInstance().getMachineUnlockStatus(this._machineDetails.machine_type),f=RSGame.getInstance().getUserDataManager().getMe().isMachineFeaturedInNewMachines(this._machineDetails.machine_identifier);if(null!=this._jackPotName&&this._layoutType!=this.SMALL_ICON&&this._layoutType!=this.TINY_ICON)GameConfig.JACKPOT_LOUNGE_ENABLE&&(RSGame.getInstance().getLevelManager().getCurrentLevel()>=GameConfig.JACKPOT_LOUNGE_LEVEL||d&& !this._showJackpotLoungeHeader?this._enabled=!0:c||f?"1"==RSEngine.gameData.getSheetData("platformDataConfig")[0].isJLSelectPopupDisabled?this._enabled=!1:this._enabled=!0:this._enabled=!1);else if(b||c||d||e||this._unlockMachine||f)if(0<this._machineDetails.VIPTier){if(this._unlockedTier=RSVIPManager.getInstance().getVIPUserTier(),this._unlockedTier>=this._machineDetails.VIPTier||c||f)this._enabled=!0}else this._enabled=!0;else GameFeatureTypeEnum.MACHINE_GIFT?MachineGiftingManager.getInstance().isMachineGifted(this._machineDetails.machine_identifier)&& (this._enabled=!0,this._timerBG&&(this._timerBG.setVisible(!0),this._timerText.setVisible(!0))):a&&!this._skipIconLoading&&(this._enabled=!0);this._machineDetails.isEnabled&&!parseInt(this._machineDetails.isEnabled)&&(this._enabled=!1);b&&(this.showVIPOverlay(),!this._enabled||"AP"!=GameConfig.GAME_ID&&"UP"!=GameConfig.GAME_ID||this._imageObj.setColor(new RSColor(255,255,255,255)))},getMachineIdentifier:function(){return this._machineDetails.machine_identifier},getJackpotName:function(){return this._jackPotName}, _setMinBet:function(a){this._minBetTxt=RSUtils.formatNumberWithComma(RSGame.getInstance().getGameData().getMinimumBetByGameTypeAndName(a?a:RSGame.getInstance().getGameManager().getGameType(),this._machineDetails));this._labelrightText&&this._labelrightText.setString(this._minBetTxt)},checkMachineUnlockShown:function(){var a=RSGame.getInstance().getUserDataManager().getMe().getVipMachineUnlocked();this._iconTier=this._machineDetails.VIPTier;this._unlockedTier=RSVIPManager.getInstance().getVIPUserTier(); this._lockStatus=a>=this._iconTier?!1:!0;this._unlockedTier>a&&this._unlockedTier>=this._iconTier&&this._lockStatus&&(this._lockStatus=!1,RSGame.getInstance().getUserDataManager().getMe().setVipMachineUnlocked(this._iconTier))},_checkAndEnableMachineLock:function(){this._checkMachineUnlockStatus();this._setMinBetCoinAndUnlockVisibility()},_setMinBetCoinAndUnlockVisibility:function(){var a=GameConfig.MACHINE_UNDERMAINTENANCE_FEATURE&&!parseInt(this._machineDetails.isEnabled);RSGame.getInstance().getGameManager().getGameType()== RSGameTypes.Poker&&this._machineDetails.comingSoon&&parseInt(this._machineDetails.comingSoon)&&(this._enabled=a=!1);(a=a&&null!==this._underMaintenance)&&this._underMaintenance&&(this._underMaintenance.setVisible(!0),this._enabled=!1);this._minBet&&!this._isFavEnabled&&this._minBet.setVisible(a?!1:this._enabled);this._cardCost&&RSGame.getInstance().getGameManager().getGameType()==RSGameTypes.Scratcher&&this._cardCost.setVisible(a?!1:this._enabled);this._labelrightText&&!this._isFavEnabled&&this._labelrightText.setVisible(a? !1:this._enabled);this._unlocksAtLabel&&(this._unlocksAtLabel.setVisible(a?!1:!this._enabled),this._unLockLevelText.setVisible(a?!1:!this._enabled),this._machineDetails.isEnabled&&!parseInt(this._machineDetails.isEnabled)&&(this._unlocksAtLabel.setVisible(!1),this._unLockLevelText.setVisible(!1)));this._unLockLevelTextLabel&&this._unLockLevelTextLabel.setVisible(a?!1:!this._enabled);this._vipOverlay&&a&&this.removeChild(this._vipOverlay);0<this._machineDetails.VIPTier&&(this._unlocksAtLabel&&(this._unlocksAtLabel.setVisible(!1), this._unLockLevelText.setVisible(!1)),this._unLockLevelTextLabel&&this._unLockLevelTextLabel.setVisible(!1))},unload:function(){this._super.unload.call(this)}});var RSTournamentCrownWidget=RSDisplayObject.extend({init:function(a,b){var c=new RSRect(0,0,a.w,a.h);this._super.init.call(this,c);RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("TournamentWinnerScreen"),"TournamentWinnerScreenFontConfig.json");this._top3PlayersData=RSTournamentManager.getTop3PlayersData();this._playerNameLimit=9;this._crownAnimationEnabled=b;this.loadContent()},loadContent:function(){var a=RSGame.getInstance().getAssetPath("LeaderboardCrownWidget"); this.loadLayout(a)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.setProfileImages();this._crownAnimationEnabled&&this._showBadgeAnimations();this.scheduleFunctionOnce(this._showPlayerCrownAnimation.bind(this),1)},createCustomObject:function(a,b){switch(b.name){case "RankReward1":var c=RSUtils.formatNumberWithComma(this._top3PlayersData[0].reward),c=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(c);break;case "RankReward2":c=RSUtils.formatNumberWithComma(this._top3PlayersData[1].reward); c=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(c);break;case "RankReward3":c=RSUtils.formatNumberWithComma(this._top3PlayersData[2].reward);c=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(c);break;case "PlayerName1":c=this.getUpdatedName(RSGame.getInstance().getGameManager().getUpdatedUserForDisplay(this._top3PlayersData[0].name));RSEngine.dataManager.getMe().getId()==this._top3PlayersData[0].id&&(c="You");c&&(c=c.charAt(0).toUpperCase()+c.slice(1));c=RSPlatformFontAssetManager.createCustomLabel(c, b);this.addChild(c);c.setZOrder(3);break;case "PlayerName2":c=this.getUpdatedName(RSGame.getInstance().getGameManager().getUpdatedUserForDisplay(this._top3PlayersData[1].name));RSEngine.dataManager.getMe().getId()==this._top3PlayersData[1].id&&(c="You");c&&(c=c.charAt(0).toUpperCase()+c.slice(1));c=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(c);c.setZOrder(3);break;case "PlayerName3":c=this.getUpdatedName(RSGame.getInstance().getGameManager().getUpdatedUserForDisplay(this._top3PlayersData[2].name)); RSEngine.dataManager.getMe().getId()==this._top3PlayersData[2].id&&(c="You");c&&(c=c.charAt(0).toUpperCase()+c.slice(1));c=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(c);c.setZOrder(3);break;case "BadgeAnimLeft":case "BadgeAnimRight":this._badgeAnimData=b;break;case "RankAnim1Left":this._badgeAnimData=b;scaleRatio=b.h/this._badgeAnimData.h;b.name="BadgeAnimLeft";this._rankAnim1Left=RSUtils.createAnimation("LeaderboardBadgeAnim",b,0.3);this._rankAnim1Left.setScale(scaleRatio);this._rankAnim1Left.setZOrder(1); this.addChild(this._rankAnim1Left);this._rankAnim1Left.stopAnimation();break;case "RankAnim1Right":scaleRatio=b.h/this._badgeAnimData.h;b.name="BadgeAnimRight";this._rankAnim1Right=RSUtils.createAnimation("LeaderboardBadgeAnim",b,0.3);this._rankAnim1Right.setZOrder(1);this.addChild(this._rankAnim1Right);this._rankAnim1Right.setScaleX(-scaleRatio);this._rankAnim1Right.setScaleY(scaleRatio);this._rankAnim1Right.stopAnimation();break;case "RankAnim2Left":scaleRatio=b.h/this._badgeAnimData.h;b.name="BadgeAnimLeft"; this._rankAnim2Left=RSUtils.createAnimation("LeaderboardBadgeAnim",b,0.3);this._rankAnim2Left.setScale(scaleRatio);this._rankAnim2Left.setZOrder(1);this.addChild(this._rankAnim2Left);this._rankAnim2Left.setScaleX(scaleRatio);this._rankAnim2Left.stopAnimation();break;case "RankAnim2Right":scaleRatio=b.h/this._badgeAnimData.h;b.name="BadgeAnimRight";this._rankAnim2Right=RSUtils.createAnimation("LeaderboardBadgeAnim",b,0.3);this._rankAnim2Right.setZOrder(1);this.addChild(this._rankAnim2Right);this._rankAnim2Right.setScaleX(-scaleRatio); this._rankAnim2Right.setScaleY(scaleRatio);this._rankAnim2Right.stopAnimation();break;case "RankAnim3Left":scaleRatio=b.h/this._badgeAnimData.h;b.name="BadgeAnimLeft";this._rankAnim3Left=RSUtils.createAnimation("LeaderboardBadgeAnim",b,0.3);this._rankAnim3Left.setZOrder(1);this._rankAnim3Left.setScale(scaleRatio);this.addChild(this._rankAnim3Left);this._rankAnim3Left.stopAnimation();break;case "RankAnim3Right":scaleRatio=b.h/this._badgeAnimData.h,b.name="BadgeAnimRight",this._rankAnim3Right=RSUtils.createAnimation("LeaderboardBadgeAnim", b,0.3),this._rankAnim3Right.setZOrder(1),this.addChild(this._rankAnim3Right),this._rankAnim3Right.setScaleX(-scaleRatio),this._rankAnim3Right.setScaleY(scaleRatio),this._rankAnim3Right.stopAnimation()}this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){switch(c.name){case "RankMask1":this._profilePicMaskAreaOfRank1=c;this._rankMask1=a;this._screenName=b;this._imageHolder1=new RSImageObject;this.addChild(this._imageHolder1);break;case "RankMask2":this._profilePicMaskAreaOfRank2= c;this._rankMask2=a;this._imageHolder2=new RSImageObject;this.addChild(this._imageHolder2);break;case "RankMask3":this._profilePicMaskAreaOfRank3=c;this._rankMask3=a;this._imageHolder3=new RSImageObject;this.addChild(this._imageHolder3);break;case "RankBase1":case "RankBase2":case "RankBase3":a.setZOrder(2)}this._super.onObjectCreated.call(this,a,b,c)},getUpdatedName:function(a){a.length>=this._playerNameLimit&&(a=a.substring(0,this._playerNameLimit)+"..");return a},setProfileImages:function(){for(var a= 0,b=this._top3PlayersData.length,a=0;a<b;a++){var c=null,d=new RSImageObject,c=null,c=this._top3PlayersData[a].id==RSEngine.dataManager.getMe().getId()?GameConfig.BASE_URL+"/res/AvatarImages/"+RSEngine.dataManager.getMe().getAvatar()+".png":GameConfig.BASE_URL+"/res/AvatarImages/"+this._top3PlayersData[a].imageURL+".png";switch(a){case 0:if(this._top3PlayersData[a].id==RSEngine.dataManager.getMe().getId()){c=RSGame.getInstance().getUserDataManager().getMe().getImageUrl();d.setImageFromUrl(c,this._profilePicMaskAreaOfRank1.x, this._profilePicMaskAreaOfRank1.y,this._profilePicMaskAreaOfRank1.h,this._profilePicMaskAreaOfRank1.h);this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank1);this._rankMask1.setVisible(!1);break}else if(GameConfig.IS_EDIT_FIELDS_ENABLED&&this._top3PlayersData[a].avatar_id){d.setImageFromUrl(c,this._profilePicMaskAreaOfRank1.x,this._profilePicMaskAreaOfRank1.y,this._profilePicMaskAreaOfRank1.h,this._profilePicMaskAreaOfRank1.h);this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank1);this._rankMask1.setVisible(!1); break}else if(this._top3PlayersData[a].fbid)c=this.getFbImageUrl(this._top3PlayersData[a].fbid),d.setImageFromUrl(c,this._profilePicMaskAreaOfRank1.x,this._profilePicMaskAreaOfRank1.y,this._profilePicMaskAreaOfRank1.h,this._profilePicMaskAreaOfRank1.h),this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank1);else{if(this._top3PlayersData[a].imageURL||""==this._top3PlayersData[a].imageURL){if("1180"==this._top3PlayersData[a].imageURL||""==this._top3PlayersData[a].imageURL)break;else if(this._top3PlayersData[a].imageURL&& this._top3PlayersData[a].imageURL.includes("graph.facebook.com")){if(RSEngine.loginMode==LOGIN_MODE.EMAIL)break;c=this._top3PlayersData[a].imageURL+"\x26height\x3d250\x26width\x3d250\x26access_token\x3d"+RSGame.getInstance().getGameManager().getFBAccessToken();d.setImageFromUrl(c,this._profilePicMaskAreaOfRank1.x,this._profilePicMaskAreaOfRank1.y,this._profilePicMaskAreaOfRank1.h,this._profilePicMaskAreaOfRank1.h);this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank1);break}else 1E3<parseInt(this._top3PlayersData[a].imageURL)? d.setImageFromUrl(GameConfig.BASE_URL+"/res/PlatformWidgets/RSTournament/BotImages/"+this._top3PlayersData[a].imageURL+".png",this._profilePicMaskAreaOfRank1.x,this._profilePicMaskAreaOfRank1.y,this._profilePicMaskAreaOfRank1.h,this._profilePicMaskAreaOfRank1.h):d.setImageFromUrl(c,this._profilePicMaskAreaOfRank1.x,this._profilePicMaskAreaOfRank1.y,this._profilePicMaskAreaOfRank1.h,this._profilePicMaskAreaOfRank1.h),this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank1),this._rankMask1.setVisible(!1); d.setCenter(this._profilePicMaskAreaOfRank1.x,this._profilePicMaskAreaOfRank1.y)}else d.setImageFromUrl(GameConfig.BASE_URL+"/res/AvatarImages/"+this._top3PlayersData[a].imageURL+".png",this._profilePicMaskAreaOfRank1.x,this._profilePicMaskAreaOfRank1.y,this._profilePicMaskAreaOfRank1.h,this._profilePicMaskAreaOfRank1.h);this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank1);this._rankMask1.setVisible(!1)}break;case 1:if(this._top3PlayersData[a].id==RSEngine.dataManager.getMe().getId()){c=RSGame.getInstance().getUserDataManager().getMe().getImageUrl(); d.setImageFromUrl(c,this._profilePicMaskAreaOfRank2.x,this._profilePicMaskAreaOfRank2.y,this._profilePicMaskAreaOfRank2.h,this._profilePicMaskAreaOfRank2.h);this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank2);this._rankMask1.setVisible(!1);break}else if(GameConfig.IS_EDIT_FIELDS_ENABLED&&this._top3PlayersData[a].avatar_id){d.setImageFromUrl(c,this._profilePicMaskAreaOfRank2.x,this._profilePicMaskAreaOfRank2.y,this._profilePicMaskAreaOfRank2.h,this._profilePicMaskAreaOfRank2.h);this._setMaskforRankUps(d, this._profilePicMaskAreaOfRank2);this._rankMask1.setVisible(!1);break}else if(this._top3PlayersData[a].fbid)c=this.getFbImageUrl(this._top3PlayersData[a].fbid),d.setImageFromUrl(c,this._profilePicMaskAreaOfRank2.x,this._profilePicMaskAreaOfRank2.y,this._profilePicMaskAreaOfRank2.h,this._profilePicMaskAreaOfRank2.h),this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank2);else{if(this._top3PlayersData[a].imageURL||""==this._top3PlayersData[a].imageURL){if(1180==this._top3PlayersData[a].imageURL|| ""==this._top3PlayersData[a].imageURL)break;else if(this._top3PlayersData[a].imageURL&&this._top3PlayersData[a].imageURL.includes("graph.facebook.com")){if(RSEngine.loginMode==LOGIN_MODE.EMAIL)break;c=this._top3PlayersData[a].imageURL+"\x26height\x3d250\x26width\x3d250\x26access_token\x3d"+RSGame.getInstance().getGameManager().getFBAccessToken();d.setImageFromUrl(c,this._profilePicMaskAreaOfRank2.x,this._profilePicMaskAreaOfRank2.y,this._profilePicMaskAreaOfRank2.h,this._profilePicMaskAreaOfRank2.h); this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank2);break}else 1E3<parseInt(this._top3PlayersData[a].imageURL)?d.setImageFromUrl(GameConfig.BASE_URL+"/res/PlatformWidgets/RSTournament/BotImages/"+this._top3PlayersData[a].imageURL+".png",this._profilePicMaskAreaOfRank2.x,this._profilePicMaskAreaOfRank2.y,this._profilePicMaskAreaOfRank2.h,this._profilePicMaskAreaOfRank2.h):d.setImageFromUrl(c,this._profilePicMaskAreaOfRank2.x,this._profilePicMaskAreaOfRank2.y,this._profilePicMaskAreaOfRank2.h, this._profilePicMaskAreaOfRank2.h),this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank2),this._rankMask2.setVisible(!1);d.setCenter(this._profilePicMaskAreaOfRank2.x,this._profilePicMaskAreaOfRank2.y)}else d.setImageFromUrl(GameConfig.BASE_URL+"/res/AvatarImages/"+this._top3PlayersData[a].imageURL+".png",this._profilePicMaskAreaOfRank2.x,this._profilePicMaskAreaOfRank2.y,this._profilePicMaskAreaOfRank2.h,this._profilePicMaskAreaOfRank2.h);this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank2); this._rankMask2.setVisible(!1)}break;case 2:if(this._top3PlayersData[a].id==RSEngine.dataManager.getMe().getId())c=RSGame.getInstance().getUserDataManager().getMe().getImageUrl(),d.setImageFromUrl(c,this._profilePicMaskAreaOfRank3.x,this._profilePicMaskAreaOfRank3.y,this._profilePicMaskAreaOfRank3.h,this._profilePicMaskAreaOfRank3.h),this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank3),this._rankMask1.setVisible(!1);else if(GameConfig.IS_EDIT_FIELDS_ENABLED&&this._top3PlayersData[a].avatar_id)d.setImageFromUrl(c, this._profilePicMaskAreaOfRank3.x,this._profilePicMaskAreaOfRank3.y,this._profilePicMaskAreaOfRank3.h,this._profilePicMaskAreaOfRank3.h),this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank3),this._rankMask1.setVisible(!1);else if(this._top3PlayersData[a].fbid)c=this.getFbImageUrl(this._top3PlayersData[a].fbid),d.setImageFromUrl(c,this._profilePicMaskAreaOfRank3.x,this._profilePicMaskAreaOfRank3.y,this._profilePicMaskAreaOfRank3.h,this._profilePicMaskAreaOfRank3.h),this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank3); else{if(this._top3PlayersData[a].imageURL||""==this._top3PlayersData[a].imageURL){if(1180==this._top3PlayersData[a].imageURL||""==this._top3PlayersData[a].imageURL)break;else if(this._top3PlayersData[a].imageURL&&this._top3PlayersData[a].imageURL.includes("graph.facebook.com")){if(RSEngine.loginMode==LOGIN_MODE.EMAIL)break;c=this._top3PlayersData[a].imageURL+"\x26height\x3d250\x26width\x3d250\x26access_token\x3d"+RSGame.getInstance().getGameManager().getFBAccessToken();d.setImageFromUrl(c,this._profilePicMaskAreaOfRank3.x, this._profilePicMaskAreaOfRank3.y,this._profilePicMaskAreaOfRank3.h,this._profilePicMaskAreaOfRank3.h);this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank3);break}else 1E3<parseInt(this._top3PlayersData[a].imageURL)?d.setImageFromUrl(GameConfig.BASE_URL+"/res/PlatformWidgets/RSTournament/BotImages/"+this._top3PlayersData[a].imageURL+".png",this._profilePicMaskAreaOfRank3.x,this._profilePicMaskAreaOfRank3.y,this._profilePicMaskAreaOfRank3.h,this._profilePicMaskAreaOfRank3.h):d.setImageFromUrl(c, this._profilePicMaskAreaOfRank3.x,this._profilePicMaskAreaOfRank3.y,this._profilePicMaskAreaOfRank3.h,this._profilePicMaskAreaOfRank3.h),this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank3),this._rankMask3.setVisible(!1);d.setCenter(this._profilePicMaskAreaOfRank3.x,this._profilePicMaskAreaOfRank3.y)}else d.setImageFromUrl(GameConfig.BASE_URL+"/res/AvatarImages/"+this._top3PlayersData[a].imageURL+".png",this._profilePicMaskAreaOfRank3.x,this._profilePicMaskAreaOfRank3.y,this._profilePicMaskAreaOfRank3.h, this._profilePicMaskAreaOfRank3.h);this._setMaskforRankUps(d,this._profilePicMaskAreaOfRank3);this._rankMask3.setVisible(!1)}}}},getFbImageUrl:function(a){return"https://graph.facebook.com/"+a+"/picture?type\x3dlarge\x26height\x3d250\x26width\x3d250\x26access_token\x3d"+RSGame.getInstance().getGameManager().getFBAccessToken()},_setMaskforRankUps:function(a,b){if(a){a.setCenter(b.x,b.y);var c=new RSClippingNode(RSUtils.createBasicObject(this._screenName,b));c.setAlphaThreshold(80);c.addChild(a);this.addChild(c)}}, _showBadgeAnimations:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("RSLeaderboardScreen")+"Top.mp3",!1);this._rankAnim2Left.playAnimation(1,0.6,this._onBadgeAnimationCompleted.bind(this));this._rankAnim2Right.playAnimation(1,0.6);this._rankAnim3Left.playAnimation(1,0.6);this._rankAnim3Right.playAnimation(1,0.6)},_onBadgeAnimationCompleted:function(){this._rankAnim2Left.setVisible(!1);this._rankAnim2Right.setVisible(!1);this._rankAnim3Left.setVisible(!1);this._rankAnim3Right.setVisible(!1); this._showTopPlayerCrownAnimation()},_showTopPlayerCrownAnimation:function(){this._rankAnim1Right.playAnimation(1,0.6,this._onTopPlayerCrownAnimationComleted.bind(this));this._rankAnim1Left.playAnimation(1,0.6)},_onTopPlayerCrownAnimationComleted:function(){this._rankAnim1Right.setVisible(!1);this._rankAnim1Left.setVisible(!1)},_showPlayerCrownAnimation:function(){var a=RSTournamentManager.getUserRank();1==a&&(this._rankAnim1Left.playAnimation(1,0.6),this._rankAnim1Right.playAnimation(1,0.6));2== a&&(this._rankAnim2Left.playAnimation(1,0.6),this._rankAnim2Right.playAnimation(1,0.6));3==a&&(this._rankAnim3Left.playAnimation(1,0.6),this._rankAnim3Right.playAnimation(1,0.6))},unload:function(){this._super.unload.call(this)}}),RSTournamentTimingWidget=RSDisplayObject.extend({_remainingTimer:null,_remainingTimerText:null,init:function(a){a=new RSRect(0,0,a.w,a.h);this._super.init.call(this,a);RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("TournamentWinnerScreen"), "TournamentWinnerScreenFontConfig.json");this._timingData=RSTournamentManager.getTournamentTimingData();this.loadContent()},loadContent:function(){var a=RSGame.getInstance().getAssetPath("TournamentTimingWidget");this.loadLayout(a)},onLayoutCompleted:function(){this._remainingTimer=setInterval(this._updateRemainingTime.bind(this),1E3);this._super.onLayoutCompleted.call(this)},createCustomObject:function(a,b){switch(b.name){case "PlayLiveOnText":var c=RSPlatformFontAssetManager.createCustomLabel(this._timingData? this._timingData.titleKey1:"",b);this.addChild(c);break;case "LiveDatesText":c=RSPlatformFontAssetManager.createCustomLabel(this._timingData?this._timingData.titleKey2:"",b);this.addChild(c);break;case "LiveTimeText":c=RSPlatformFontAssetManager.createCustomLabel(this._timingData?this._timingData.titleKey3:"",b);this.addChild(c);break;case "RemainingTime":c=RSPlatformFontAssetManager.createCustomLabel("STARTS IN:",b);this.addChild(c);break;case "RemainingTimeTimer":this._remainingTimerText=RSPlatformFontAssetManager.createCustomLabel("", b),this.addChild(this._remainingTimerText),this._updateRemainingTime()}this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){switch(c.name){case "InviteFriendsBtn":RSEngine.loginMode==LOGIN_MODE.EMAIL&&a.setVisible(!1);break;case "FBConnectBtn":RSEngine.loginMode!=LOGIN_MODE.EMAIL&&a.setVisible(!1)}this._super.onObjectCreated.call(this,a,b,c)},_updateRemainingTime:function(){var a=RSTournamentManager.tournamentStartsIn(),b="";0>a&&(b+="00:00:00",this._remainingTimerText.setVisible(!0)); 86400>a?(b+=RSUtils.formattedTime(a),this._remainingTimerText.setVisible(!0)):a?(b=~~(a/86400)+1+" Days",this._remainingTimerText.setString(b),this._remainingTimerText.setVisible(!0)):this._remainingTimerText.setVisible(!1);this._remainingTimerText.setString(b)},onButtonClicked:function(a){switch(a){case "InviteFriendsBtn":RSTournamentManager.sendInvitation([]);break;case "FBConnectBtn":RSAnalyticsManager.getInstance().trackPlayerAction("fb_connect","click","open_from_tournamania","",""),RSAnalyticsManager.getInstance().trackPlayerAction("tournamania", "link_fb","initiate","",""),RSLoginManager.getInstance().loginWithFacebook("tournamania")}},unload:function(){clearInterval(this._remainingTimer);this._super.unload.call(this)}});var RSTournamentHudTimerWidget=RSDisplayObject.extend({_bubbleTriggeredTime:null,_timerLost:!1,init:function(a,b,c){a=new RSRect(0,0,a.w,a.h);this._super.init.call(this,a);this._fonts=b;this._tournamentTimer=null;this._callBack=c;this.loadContent();this.updateTimerDataFromSmartFox();this.setName("HudTimerWidget")},loadContent:function(){var a=RSGame.getInstance().getAssetPath("TournamentHudTimer");this.loadLayout(a)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._tournamentTimerData|| this.updateTimerDataFromSmartFox();this._updateTournamentTexts();this._tournamentTimer=setInterval(this._updateTournamentTexts.bind(this),1E3)},createCustomObject:function(a,b){switch(b.name){case "Timer":this._tournamentTimerText=new RSScaledLabel("",this._fonts.inGameCountDownFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._tournamentTimerText);this._tournamentLastCountDownText=new RSScaledLabel("00:00:00",this._fonts.inGameCountDownFont,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._tournamentLastCountDownText); this._tournamentLastCountDownText.setVisible(!1);break;case "TorunamentTimer":this._tournamentInGameCountDownText=new RSScaledLabel("00:00:00",this._fonts.inGameCountDownFont,b,kTEXT_ALIGNMENT_CENTER),this.addChild(this._tournamentInGameCountDownText),this._tournamentInGameCountDownText.setVisible(!1)}this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){switch(c.name){case "FlagRight":case "FlagLeft":a.stopAnimation();a.playAnimation(-1,0.3);break;case "Title":this._title= a;break;case "LiveSlotsTournamentText":this._liveSlotsTournamentText=a;this._liveSlotsTournamentText.setVisible(!1);break;case "InProgressText":this._inProgressText=a;this._inProgressText.setVisible(!1);break;case "StartsInText":this._startsInText=a;this._startsInText.setVisible(!1);break;case "TimerBlueGlow":this._timerBlueGlow=a;break;case "TimerRedGlow":this._timerRedGlow=a;break;case "TorunamentTimerBlueGlow":this._tournamentBlueGlow=a;break;case "TorunamentTimerRedGlow":this._tournamentRedGlow= a}this._super.onObjectCreated.call(this,a,b,c)},updateTimerDataFromSmartFox:function(){this._tournamentTimerData=RSTournamentManager.getUpdatedTournamentTimerData()},_updateTournamentTexts:function(){var a=this._tournamentTimerData.tournamentStartTime-TimeManager.getInstance().getCurrentServerTime();RSTournamentManager.isTournamentFirst()&&null==this._bubbleTriggeredTime&&a<=RSTournamentManager.getHudTimerStartsIn()&&RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-bubbleShown")< this._tournamentTimerData.tournamentStartTime&&(this._bubbleTriggeredTime=a-5);this._playingState=null;if(!GlobalVars.isTournamentLoaded&&null!=this._bubbleTriggeredTime&&a>=this._bubbleTriggeredTime&&a<=RSTournamentManager.getHudTimerStartsIn()&&RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-bubbleShown")<=this._tournamentTimerData.tournamentStartTime){var b={};b[GameConfig.COOKIE_PREFIX+"-bubbleShown"]=this._tournamentTimerData.tournamentStartTime;RSLoginManager.getInstance().setCookie(GameConfig.SSO_COOKIE_DOMAIN, null,b);this._playingState="";this._title.setVisible(!0);this._tournamentTimerText.setVisible(!1);this._liveSlotsTournamentText.setVisible(!0);this._inProgressText.setVisible(!1);this._tournamentLastCountDownText.setVisible(!1);this._tournamentInGameCountDownText.setVisible(!1);this._startsInText.setVisible(!1);this._timerBlueGlow.setVisible(!1);this._timerRedGlow.setVisible(!1);this._tournamentBlueGlow.setVisible(!1);this._tournamentRedGlow.setVisible(!1);this._callBack&&0<=a&&this._callBack(a,!0)}else 0< a&&10<a?(this._playingState="AllowTournamentEntry",this._title.setVisible(!0),this._tournamentTimerText.setString(this._getTimeRemaining()),this._tournamentTimerText.setVisible(!0),this._inProgressText.setVisible(!1),this._liveSlotsTournamentText.setVisible(!1),this._tournamentLastCountDownText.setVisible(!1),this._tournamentInGameCountDownText.setVisible(!1),this._startsInText.setVisible(!0),this._timerBlueGlow.setVisible(!0),this._timerRedGlow.setVisible(!1),this._tournamentBlueGlow.setVisible(!1), this._tournamentRedGlow.setVisible(!1),this._callBack&&this._callBack(a,!1)):0<=a&&10>=a&&!GlobalVars.isTournamentLoaded?(this._inProgressText.setVisible(!1),this._liveSlotsTournamentText.setVisible(!1),this._tournamentTimerText.setVisible(!1),this._tournamentInGameCountDownText.setVisible(!1),this._tournamentLastCountDownText.setVisible(!0),this._tournamentLastCountDownText.setString(this._getTimeRemaining()),this._startsInText.setVisible(!0),this._timerBlueGlow.setVisible(!1),this._timerRedGlow.setVisible(!0), this._tournamentBlueGlow.setVisible(!1),this._tournamentRedGlow.setVisible(!1),5!=a||GlobalVars.isTournamentLoaded||"gameplay_screen"!=RSGameScreenManager.getInstance().getCurrentScreen()&&!GlobalVars.isjackpotLoaded||(SideMenuController.getInstance().playTournamentAnimation(a),this.scheduleFunctionOnce(function(){SideMenuController.getInstance().playTournamentAnimation(4)},0.5))):GlobalVars.isTournamentLoaded?(this._inProgressText.setVisible(!1),this._liveSlotsTournamentText.setVisible(!1),this._tournamentTimerText.setVisible(!1), this._title.setVisible(!1),this._tournamentLastCountDownText.setVisible(!1),this._tournamentInGameCountDownText.setVisible(!0),a=this._tournamentTimerData.tournamentEndTime-TimeManager.getInstance().getCurrentServerTime(),this._tournamentInGameCountDownText.setString(this._getTimeRemaining()),this._startsInText.setVisible(!1),this._timerBlueGlow.setVisible(!1),this._timerRedGlow.setVisible(!1),10<a?(this._tournamentBlueGlow.setVisible(!0),this._tournamentRedGlow.setVisible(!1)):(this._tournamentRedGlow.setVisible(!0), this._tournamentBlueGlow.setVisible(!1))):(this._playingState="InProgress",this._inProgressText.setVisible(!0),this._liveSlotsTournamentText.setVisible(!1),this._tournamentTimerText.setVisible(!1),this._tournamentLastCountDownText.setVisible(!1),this._tournamentInGameCountDownText.setVisible(!1),this._startsInText.setVisible(!1),this._timerBlueGlow.setVisible(!1),this._timerRedGlow.setVisible(!1),this._tournamentBlueGlow.setVisible(!1),this._tournamentRedGlow.setVisible(!1))},_getTimeRemaining:function(){document.hasFocus()|| (this._timerLost=!0);document.hasFocus()&&this._timerLost&&(this._timerLost=!1,RSGame.getInstance().getUserDataManager().getServerTime(function(a){RSGame.getInstance().getTimeManager().currentServerTime=a.result.data.time}.bind(this),function(){}.bind(this)));var a=0,a=this._tournamentTimerData.tournamentStartTime-TimeManager.getInstance().getCurrentServerTime();0<=a?7>a&&this._callBack&&this._callBack(a):a=this._tournamentTimerData.tournamentEndTime-TimeManager.getInstance().getCurrentServerTime(); if(0>a)return"00:00:00";if(86400>a)return RSUtils.formattedTime(a)},unload:function(){clearInterval(this._tournamentTimer);this._super.unload.call(this)}});var TOURNAMENT_SURFACING_TYPES={BEFORE_FEATURE_LAUNCH:"Before_Feature_Launch",TOURNAMENT_OVER:"Tournament_Over",FEATURE_ANNOUNCEMENT:"Feature_Announcement",TOURNAMENT_IN_PROGRESS:"In_Progress"},RSTournamentManager={_tournamentPlaying:null,_tournamentTimingdata:null,_fetchLBDataFetchingInProgress:null,_playerLBData:null,_playerRank:null,_top3PlayersData:null,_touramentPrizeList:null,_tournamentTimerTimeOut:null,_currentPSTTime:null,_tournamentEndTime:null,_tournamentTimingInfo:null,_tournamentSurfacingAnimationTimer:null, _touramentMachineId:null,_tournamentId:null,_tournamentStatusMsg:null,_lastClaimedTournamentRewardId:null,_tournamentDayTime:null,_tournamentDuration:180,_previouseWinnerPopupShowedOnce:!1,_hudTimerStartsIn:3600,_hudTimerFreezesIn:90,_fromAnnouncementPopup:!1,_fromSlider:!1,_cheatEnabled:!1,_tournamentLeaderboardScreen:null,_machineRedirectionTime:300,_intermediateMessageTime:1800,_isTodaysFirst:!1,_messageBubbleShown:!1,_tournamentAnnouncementPopupCallBack:null,_tournamentOverText:null,_customMessage:"", _tournamentDataFetchRetryCount:0,_errorPopupEnabled:!1,initializeTournamentManager:function(){this._hudTimerStartsIn=parseInt(RSEngine.gameData.getDefaultValues().TournamentHudTimerStartsIn);this._hudTimerFreezesIn=parseInt(RSEngine.gameData.getDefaultValues().TournamentHudTimerFreezesIn);this._intermediateMessageTime=parseInt(RSEngine.gameData.getDefaultValues().TournamentMessageBubbleIn);this._tournamentTimingdata={};this._cheatEnabled=GameConfig.TOURNAMENT_CHEAT_ENABLED;this._tournamentLeaderboardScreen&& (RSEngine.screenManager.removeScreen(this._tournamentLeaderboardScreen),this._tournamentLeaderboardScreen=null);this.getTournamentData();this.getTournamentLBData();this._cheatEnabled&&this.getTournamentTimerdata()},showTournamentWinnersScreeen:function(){cc.log("Showing top 3 LB");RSGame.getInstance().getGameManager().setSideMenuVisibility(!1);var a=[{name:RSGame.getInstance().getAssetPath("LeaderboardBg"),count:1},{name:RSGame.getInstance().getAssetPath("TournamentWinnerScreen"),count:1},{name:RSGame.getInstance().getAssetPath("RSLeaderboardBadgeAnim"), count:1}];this._tournamentWinnerScreen=new RSTournamentLeaderboardScreen(a,!0,this.onTournamentWinnerScreenClosed.bind(this));RSEngine.screenManager.addScreen(this._tournamentWinnerScreen)},onTournamentWinnerScreenClosed:function(){cc.log("Winner screen closed");RSEngine.screenManager.removeScreen(this._tournamentWinnerScreen);this.showTournamentLeaderboardScreen()},showTournamentLeaderboardScreen:function(a){if(this._tournamentLeaderboardScreen)cc.log("LB running");else{cc.log("Showing LB");RSEngine.externalGameManager&& RSEngine.externalGameManager.hideExternalGame();RSGame.getInstance().getGameManager().setSideMenuVisibility(!1);var b=[{name:RSGame.getInstance().getAssetPath("LeaderboardBg"),count:1},{name:RSGame.getInstance().getAssetPath("TournamentLeaderboardScreenScreen"),count:1},{name:RSGame.getInstance().getAssetPath("RSLeaderboardBadgeAnim"),count:1}];this._tournamentLeaderboardScreen=new RSTournamentLeaderboardScreen(b,!1,this.removeTournamentLeaderboarScreen.bind(this,a));RSEngine.screenManager.addScreen(this._tournamentLeaderboardScreen)}}, removeTournamentLeaderboarScreen:function(a){cc.log("Tournament LB screen removed");this._tournamentLeaderboardScreen&&(RSEngine.screenManager.removeScreen(this._tournamentLeaderboardScreen),this._tournamentLeaderboardScreen=null);(GlobalVars.isTournamentLoaded||"gameplay_screen"==RSGameScreenManager.getInstance().getCurrentScreen()||"jackpot_Sublobby"==RSGameScreenManager.getInstance().getCurrentScreen()||"Jackpot_Mainlobby"==RSGameScreenManager.getInstance().getCurrentScreen())&&RSEngine.externalGameManager.showExternalGame(); if(!a)RSCasinoManager.getCasinoHUD().onBackButton();RSGame.getInstance().getGameManager().setSideMenuVisibility(!0);this._tournamentAnnouncementPopupCallBack&&(this._tournamentAnnouncementPopupCallBack(),this._tournamentAnnouncementPopupCallBack=null)},getTournamentLeaderboardData:function(){for(var a=0;20>a;a++)7==a&&RSEngine.dataManager.getMe().getId(),RSEngine.dataManager.getMe().getUserFirstName();return this._tournamentLBData},getUserCurrentData:function(){var a={};a.imageURL=RSEngine.dataManager.getMe().getImageUrl(); a.id=RSEngine.dataManager.getMe().getId();a.name=RSEngine.dataManager.getMe().getUserFirstName();a.win=0;a.rank=0;a.reward=700;return this._playerLBData?this._playerLBData:this._playerLBData=a},getUserRank:function(){return this._playerRank},getTop3PlayersData:function(){for(var a=[],b=0;3>b;b++){var c={};c.avatar_id=10+b;c.user_id=0==b?RSEngine.dataManager.getMe().getId():"RS_100";c.first_name=RSEngine.dataManager.getMe().getUserFirstName()+b;c.coins=100*b+100;c.rank=b+1;c.reward=1E5*(3-b);c.fbid= 0==b?RSEngine.dataManager.getMe().getFBId():null;a.push(c)}return this._top3PlayersData},sendInvitation:function(a){RSEngine.screenManager.addOverlay();var b=new RSGiftingAppRequest;b.TITLE="Add your friends";b.MESSAGE="Come join me in "+RSGame.getInstance().getGameManager().getGameName();b.TARGETS=a;b.FILTER=["app_non_users"];RSSocialManager.getInstance().showInviteWindow(b.TITLE,b.MESSAGE,b.TARGETS,null,this._onInviteCompleted.bind(this))},_onInviteCompleted:function(){cc.log("on invite completd"); RSEngine.screenManager.removeOverlay()},setTournamentTimerData:function(a){cc.log("Remaing sec :"+a);this._tournamentTimingdata.tournamentEndTime=TimeManager.getInstance().getCurrentServerTime()+a;this._tournamentTimingdata.tournamentStartTime=TimeManager.getInstance().getCurrentServerTime()-10},getUpdatedTournamentTimerData:function(){return this._tournamentTimingdata},startHudTimerToggleAnimation:function(){RSCasinoManager.getCasinoHUD().startTournamentTimerToggleAnimation()},tournamentStartsIn:function(){var a= this._tournamentTimingdata.tournamentStartTime-TimeManager.getInstance().getCurrentServerTime();return 0<a?a:0},tournamentEndsIn:function(){var a=this._tournamentTimingdata.tournamentEndTime-TimeManager.getInstance().getCurrentServerTime();return 0<a?a:0},hideTournamentAndShowWinnerScreen:function(a,b,c,d,e){this._fromAnnouncementPopup=!1;0<a&&(this._lastClaimedTournamentRewardId=b,RSTournamentManager.claimTournamentReward(b,a,c,d));RSEngine.externalGameManager.unLoadExternalGame();RSEngine.externalGameManager&& RSEngine.externalGameManager.hideExternalGame();this.getTournamentLBData(!0);e&RSEngine.loginMode!=LOGIN_MODE.EMAIL&&(cc.log("Share enabled"),this.shareActionSheet())},getTournamentData:function(){RSGame.getInstance().getUserDataManager().getTournamentData(this.onTournamentDataFethSucces.bind(this),this.onTournamentDataFethFailed.bind(this))},onTournamentDataFethSucces:function(a){cc.log("Tournament data fetched");if(a.result&&(this._tournamentData=a,this._tournamentTimingInfo=a.result.tournamentTitle? JSON.parse(a.result.tournamentTitle):null,this._touramentMachineId=a.result.internal.machineId,!this._cheatEnabled)){this._tournamentTimingdata.tournamentEndTime=a.result.internal.nextEndtime;this._tournamentTimingdata.tournamentStartTime=a.result.internal.nextAvailableTime;this._tournamentDuration=parseInt(a.result.internal.tournamentTime);this._tournamentTimingdata.tournamentDay=!1;this._tournamentTimingdata.tournamentStartTime&&(this._tournamentDayTime=parseInt(a.result.surfacingPopupFlag));cc.log("Tournament starts in sec:"+ (this._tournamentTimingdata.tournamentStartTime-TimeManager.getInstance().getCurrentServerTime()));cc.log("Tournament ends in :"+(this._tournamentTimingdata.tournamentEndTime-TimeManager.getInstance().getCurrentServerTime()));var b=1E3*Math.abs(this._tournamentTimingdata.tournamentEndTime-TimeManager.getInstance().getCurrentServerTime()+5);this._tournamentTimerTimeOut&&clearTimeout(this._tournamentTimerTimeOut);this._tournamentTimerTimeOut=setTimeout(this.getTournamentData.bind(this),b);this._tournamentRewardFetchingTimeOut= setTimeout(this.getTournamentReward.bind(this),2E4);this._isTodaysFirst=a.result.internal.isTodaysFirst;a.result.customMessage&&a.result.customMessage.customMessageAvailable&&(this._customMessage=a.result.customMessage.tournamentOverText)}},getCustomMessage:function(){return this._customMessage},onTournamentDataFethFailed:function(){cc.log("tournament data fetch failed")},getTournamentLBData:function(a,b){a&&(this._fetchLBDataFetchingInProgress||RSGame.getInstance().getGameManager().showOverlayLayer()); this._fetchLBDataFetchingInProgress||this.getTournamentData();this._errorPopupEnabled=a||b?!0:!1;this._fetchLBDataFetchingInProgress=!0;RSGame.getInstance().getUserDataManager().getTournamentLBData(this.onTournamentLBDataFethSucces.bind(this,a,b),this.onTournamentLBDataFethFailed.bind(this,a,b))},onTournamentLBDataFethSucces:function(a,b,c){this._fetchLBDataFetchingInProgress=!1;if("success"==c.result.data.status&&c.result.data.rankList_internal.rank_list){this._tournamentLBData=c.result.data.rankList_internal.rank_list; this._top3PlayersData=this._tournamentLBData.slice(0,3);this._top3PlayersData[0].reward=1E5;this._top3PlayersData[1].reward=5E4;this._top3PlayersData[2].reward=2E4;var d=0;this._playerRank=0;this._playerLBData=null;for(d in this._tournamentLBData)this._tournamentLBData[d].id==RSEngine.dataManager.getMe().getId()&&(this._playerLBData=this._tournamentLBData[d],-1!=this._playerLBData.rank&&(this._playerRank=d+1));this._touramentPrizeList=c.result.data.rankList_internal.prizeList;this.updateTournamentPrizeList(); this._tournamentEndTime=parseInt(c.result.data.rankList_internal.endTime);this._currentPSTTime=parseInt(c.result.data.currentPSTTime);this._tournamentId=c.result.data.rankList_internal.config.tournamentId;this._tournamentStatusMsg=c.result.data.TournamentStatusMsg;cc.log("Tournament LB Updated"+this._tournamentId)}else cc.log("LB fetch failed"+this._tournamentId);b&&b();a&&(RSGame.getInstance().getGameManager().hideOverlayLayer(),RSTournamentManager.showTournamentWinnersScreeen())},onTournamentLBDataFethFailed:function(a, b){cc.log("LB data fetching failed");this._errorPopupEnabled&&(3<this._tournamentDataFetchRetryCount?(this._tournamentDataFetchRetryCount=0,RSErrorTracker.getInstance().trackErrorMessage("TOURNAMENT_LB","Error on LB data call","mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"),RSLeaderboardManager.showLeaderboardResponseFailPopup(),b()):(this._tournamentDataFetchRetryCount++,this.getTournamentLBData(a,b)))},updateTournamentPrizeList:function(){this._top3PlayersData&&this._touramentPrizeList&& (this._top3PlayersData[0].reward=this._touramentPrizeList.prize1,this._top3PlayersData[1].reward=this._touramentPrizeList.prize2,this._top3PlayersData[2].reward=this._touramentPrizeList.prize3)},getTournamentTimerdata:function(){cc.log("Calling for next tournamet time");RSGame.getInstance().getUserDataManager().getTournamentTimerData(this.OnTournamentTimerFetchSucces.bind(this),this.OnTournamentTimerFetchFailed.bind(this))},OnTournamentTimerFetchSucces:function(a){this._tournamentTimingdata.tournamentEndTime= a.result.data.nextAvailableTimeinternal.nextAvailableTime+180;this._tournamentTimingdata.tournamentStartTime=a.result.data.nextAvailableTimeinternal.nextAvailableTime;this._tournamentDuration=a.result.data.nextAvailableTimeinternal.duration;this._tournamentTimingdata.tournamentStartTime&&(this._tournamentDayTime=parseInt(a.result.surfacingPopupFlag));cc.log("Tournament starts in sec:"+(this._tournamentTimingdata.tournamentStartTime-TimeManager.getInstance().getCurrentServerTime()));cc.log("Tournament ends in :"+ (this._tournamentTimingdata.tournamentEndTime-TimeManager.getInstance().getCurrentServerTime()));cc.log("Tournament duration:"+a.result.data.nextAvailableTimeinternal.duration);a=1E3*Math.abs(this._tournamentTimingdata.tournamentEndTime-TimeManager.getInstance().getCurrentServerTime()+5);this._tournamentTimerTimeOut&&clearTimeout(this._tournamentTimerTimeOut);this._tournamentTimerTimeOut=setTimeout(this.getTournamentTimerdata.bind(this),a);this._tournamentRewardFetchingTimeOut=setTimeout(this.getTournamentReward.bind(this), 2E4)},OnTournamentTimerFetchFailed:function(){cc.log("Timer data fetch failed")},onTournamentBtnClicked:function(a,b,c){c&&RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI,c,"tournamania","click","","");RSGame.getInstance().getGameManager().setSideMenuVisibility(!1);if(RSRewardManager.isRewardActive(RSPlatformEventTypeKeys.TOURNAMENT_REWARD))RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.ENTER_SCREEN,parameter:RSPlatformEventTypeKeys.TOURNAMENT_REWARD}); else{var d=this._tournamentTimingdata.tournamentStartTime-TimeManager.getInstance().getCurrentServerTime();0<d&&d<this.getMachineRedirectionTime()?RSTournamentManager.getTournamentSurfacingEnabledStatus()==TOURNAMENT_SURFACING_TYPES.BEFORE_FEATURE_LAUNCH?RSTournamentManager.showTournamentSurfacing(null):(c||(this._fromSlider=!0,RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI,"slider","tournamania","click","","")),RSGame.getInstance().getGameManager().loadTournament()):0>=d&& this._tournamentTimingdata.tournamentEndTime>TimeManager.getInstance().getCurrentServerTime()?RSTournamentManager.getTournamentSurfacingEnabledStatus()==TOURNAMENT_SURFACING_TYPES.TOURNAMENT_IN_PROGRESS?RSTournamentManager.showTournamentSurfacing(null):(c||(this._fromSlider=!0,RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI,"slider","tournamania","click","","")),RSGame.getInstance().getGameManager().loadTournament()):b?(RSGame.getInstance().getGameManager().showOverlayLayer(), this.getTournamentLBData(!1,this.onLBDataUpdated.bind(this,a))):RSTournamentManager.getTournamentSurfacingEnabledStatus()==TOURNAMENT_SURFACING_TYPES.TOURNAMENT_OVER||RSTournamentManager.getTournamentSurfacingEnabledStatus()==TOURNAMENT_SURFACING_TYPES.FEATURE_ANNOUNCEMENT?RSEngine.popupManager.addPopup(new RSTournamentInfoPopup(this.onTournamentSurfacingCompleted.bind(this,null,!1),RSTournamentManager.getTournamentSurfacingEnabledStatus(),!0),!0,!0,!0,!1):RSTournamentManager.getTournamentSurfacingEnabledStatus()!= TOURNAMENT_SURFACING_TYPES.BEFORE_FEATURE_LAUNCH&&RSTournamentManager.getTournamentSurfacingEnabledStatus()!=TOURNAMENT_SURFACING_TYPES.TOURNAMENT_IN_PROGRESS||RSTournamentManager.showTournamentSurfacing(null)}},showTournamentLeaderboardOnButtonClick:function(){RSGame.getInstance().getGameManager().showOverlayLayer();this.getTournamentLBData(!1,this.onLBDataUpdated.bind(this,!0))},onLBDataUpdated:function(a){RSGame.getInstance().getGameManager().hideOverlayLayer();this.showTournamentLeaderboardScreen(a)}, getTournamentLBEndTime:function(){return this._tournamentEndTime},getCurrentPSTTime:function(){return this._currentPSTTime},getTournamentTimingData:function(){return this._tournamentTimingInfo},showTournamentSurfacing:function(a){switch(RSTournamentManager.getTournamentSurfacingEnabledStatus()){case TOURNAMENT_SURFACING_TYPES.TOURNAMENT_OVER:a();break;case TOURNAMENT_SURFACING_TYPES.FEATURE_ANNOUNCEMENT:this._tournamentAnnouncementPopupCallBack=a;this.setTournamentFeatureAnnouncementData();RSEngine.popupManager.addPopup(new RSTournamentInfoPopup(this.onTournamentSurfacingCompleted.bind(this, a,!1),RSTournamentManager.getTournamentSurfacingEnabledStatus(),!0,!0),!0,!0,!0,!1);break;case TOURNAMENT_SURFACING_TYPES.TOURNAMENT_IN_PROGRESS:case TOURNAMENT_SURFACING_TYPES.BEFORE_FEATURE_LAUNCH:this._tournamentAnnouncementPopupCallBack=a,this.setTournamentFeatureAnnouncementData(),RSEngine.externalGameManager&&RSEngine.externalGameManager.hideExternalGame(),RSGame.getInstance().getGameManager().setSideMenuVisibility(!1),RSEngine.audioManager.setMusicVolume(0.2),GlobalVars.isSurfacingActive=!0, this.tournamentSurfacingScreen=new RSTournamentSurfacingScreen(this.onTournamentSurfacingCompleted.bind(this,a,!0)),RSEngine.screenManager.addScreen(this.tournamentSurfacingScreen),RSGame.getInstance().getUserDataManager().getMe().setTournamaniaSurfacingShownStatus()}},onTournamentSurfacingCompleted:function(a,b,c,d){RSEngine.screenManager.removeScreen(this.tournamentSurfacingScreen);RSEngine.audioManager.setMusicVolume(1);switch(c){case TOURNAMENT_SURFACING_TYPES.TOURNAMENT_IN_PROGRESS:"CloseBtn"== d?(SideMenuController.getInstance().playSurfacingAnimation("surfacing"),this._tournamentSurfacingAnimationTimer=setTimeout(this.playSurfacingAnimation.bind(this),1E3)):"Lets'GoBtn"==d&&(this._fromAnnouncementPopup=!0,RSGame.getInstance().getGameManager().loadTournament("tournamania_announcement"),a&&(a(!0),a=null));break;case TOURNAMENT_SURFACING_TYPES.BEFORE_FEATURE_LAUNCH:"Lets'GoBtn"==d?(this._fromAnnouncementPopup=!0,RSGame.getInstance().getGameManager().loadTournament("tournamania_announcement"), a&&(a(!0),a=null)):"PreviousWinnersBtn"==d?(this._fromAnnouncementPopup=!0,RSTournamentManager.onTournamentBtnClicked(!0,!0)):(SideMenuController.getInstance().playSurfacingAnimation("surfacing"),this._tournamentSurfacingAnimationTimer=setTimeout(this.playSurfacingAnimation.bind(this),1E3));break;case TOURNAMENT_SURFACING_TYPES.TOURNAMENT_OVER:"PreviousWinnersBtn"==d&&(this._fromAnnouncementPopup=!0,RSTournamentManager.onTournamentBtnClicked(!0,!0));"Lets'GoBtn"==d&&(this._fromAnnouncementPopup=!0, RSGame.getInstance().getGameManager().loadTournament("tournamania_announcement"),a&&(a(!0),a=null));b&&"CloseBtn"==d&&(SideMenuController.getInstance().playSurfacingAnimation("surfacing"),this._tournamentSurfacingAnimationTimer=setTimeout(this.playSurfacingAnimation.bind(this),1E3));break;case TOURNAMENT_SURFACING_TYPES.FEATURE_ANNOUNCEMENT:"Lets'GoBtn"==d&&(this._fromAnnouncementPopup=!0,RSGame.getInstance().getGameManager().loadTournament("tournamania_announcement"),a&&(a(!0),a=null)),"PreviousWinnersBtn"== d&&(this._fromAnnouncementPopup=!0,RSTournamentManager.onTournamentBtnClicked(!0,!0)),!b||"CloseBtn"!=d&&"OKBtn"!=d||(SideMenuController.getInstance().playSurfacingAnimation("surfacing"),this._tournamentSurfacingAnimationTimer=setTimeout(this.playSurfacingAnimation.bind(this),1E3))}this._tournamentAnnouncementPopupCallBack&&"PreviousWinnersBtn"==d?cc.log("W8ting for LB response"):a&&a()},playSurfacingAnimation:function(){SideMenuController.getInstance().playSurfacingAnimation()},triggerAnalyticsEvents:function(a, b,c,d){switch(a){case "TournamentRoomState":this._fromAnnouncementPopup?RSAnalyticsManager.getInstance().trackLobbyEntry(b,"","open_from_tournamania_announcement",""):this._fromSlider?RSAnalyticsManager.getInstance().trackLobbyEntry(b,"","open_from_slider",""):RSAnalyticsManager.getInstance().trackLobbyEntry(b,"","open_from_"+RSGameScreenManager.getInstance().getPreviousScreen(),"");break;case "analytics_tournament_sink":RSAnalyticsManager.getInstance().trackInHouseEvent("tournamania_game_action", "tournamania_sink",d?d:"",b.value,b.param,c);break;case "tournamania_game_action":RSAnalyticsManager.getInstance().trackInHouseEvent(a,b[0],"",b[1].toString(),b[2],b[3]);this._lastPlayedTournamentID=b[3];break;case "analytics_tournament_source":RSAnalyticsManager.getInstance().trackInHouseEvent("tournamania_game_action","tournamania_source",d?d:"",b.value,b.param,c);break;case "tournamania_player_action":"tournamania_info"==b&&RSAnalyticsManager.getInstance().trackPlayerAction(b,c,"open_from_tournamania_lobby", "",""),"tournamania_rules"==b&&(RSAnalyticsManager.getInstance().trackPlayerAction(b,c,"tournamania_lobby","",""),RSGame.getInstance().getGameManager().showRulesPopup()),"tournamania_quitpopup"==b&&("click"==c&&RSCasinoManager.getCasinoHUD().disableAllButtons(),"close"==c&&RSCasinoManager.getCasinoHUD().enableAllButtons())}this._fromSlider=this._fromAnnouncementPopup=!1},getTournamentMachineId:function(){return this._touramentMachineId},getTournamentId:function(){return this._tournamentId},showTournamentRewardScreen:function(a, b){RSEngine.externalGameManager&&RSEngine.externalGameManager.hideExternalGame();RSGame.getInstance().getGameManager().setSideMenuVisibility(!1);var c=[{name:RSGame.getInstance().getAssetPath("LeaderboardBg"),count:1},{name:RSGame.getInstance().getAssetPath("RSLeaderboardBadgeAnim"),count:1},{name:RSGame.getInstance().getAssetPath("RSLeaderboardFireworksAnim"),count:1},{name:RSGame.getInstance().getAssetPath("RSLeaderboardRewardScreenFireworks"),count:1},{name:RSGame.getInstance().getAssetPath("RSLeaderboardRewardScreen"), count:2}];this._tournamentRewardScreen=new RSLeaderboardRewardScreen(c,a,b,this._removeTournamentRewardScreen.bind(this),"Tournamania");RSEngine.screenManager.addScreen(this._tournamentRewardScreen)},_removeTournamentRewardScreen:function(){cc.log("Removing Tournament reward screen");RSEngine.screenManager.removeScreen(this._tournamentRewardScreen);RSEngine.externalGameManager.showExternalGame();RSGame.getInstance().getGameManager().setSideMenuVisibility(!0);RSRewardManager.onRewardPopupClosed("Leaderboard")}, claimTournamentReward:function(a,b,c,d){RSGame.getInstance().getUserDataManager().claimRewardFromRewardManager(a,this._onRewardClaimed.bind(this,a,b,c,d))},_onRewardClaimed:function(a,b,c,d,e){e.result&&e.result.status&&200==e.result.status&&(RSCasinoManager.addPrimaryCurrencyForDisplay("Tournament_Reward",parseInt(b)),RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"tournamania_win_rank"+c,b,d,a))},getTournamentInfoPopupTexts:function(){var a={};a.text1=RSGame.getInstance().getGameData().getPopupTextWithKey("TournamaniaInfo1").replace(/\\n/g, "\n");a.text2=RSGame.getInstance().getGameData().getPopupTextWithKey("TournamaniaInfo2").replace(/\\n/g,"\n");a.text3=RSGame.getInstance().getGameData().getPopupTextWithKey("TournamaniaInfo3").replace(/\\n/g,"\n");a.text4=RSGame.getInstance().getGameData().getPopupTextWithKey("TournamaniaInfo4").replace(/\\n/g,"\n");return a},getTournamentOverText:function(){return this._tournamentOverText},getTournamentLBStatusMsg:function(){return this._tournamentStatusMsg},getTournamentReward:function(){cc.log("Started Fetching pending tournament rewards........ "); clearTimeout(this._tournamentRewardFetchingTimeOut);RSGame.getInstance().getUserDataManager().getUserDataObjets(this.onTournamentRewarddataFetched.bind(this),this.getTournamentReward.bind(this))},onTournamentRewarddataFetched:function(a){cc.log("Fetching pending tournament rewards completed");var b=DynamoDBParser.decode(a.result.data);a=b.rewardList;b=b.lastPlayedTournamentID;if(a&&b&&a.hasOwnProperty(b)&&this._lastClaimedTournamentRewardId!=b){cc.log("pending rewards available.......");var c={}; c[b]=a[b];c[b].placement=RSPlatformEventTypeKeys.TOURNAMENT_REWARD;RSRewardManager.updateLeaderboardReward(c,this._onTournamentRewardUpdated.bind(this))}else cc.log("No pending rewards.......")},_onTournamentRewardUpdated:function(){cc.log("On tournament reward updated.......")},getTournamentSurfacingEnabledStatus:function(){if(GameConfig.TOURNAMENT_ENABLED&&parseInt(RSEngine.gameData.getDefaultValues().isTournamentEnabled)){if(!RSGame.getInstance().getUserDataManager().getMe().getTournamaniaSurfacingShownStatus()&& (this._tournamentDayTime||0<this._tournamentTimingdata.tournamentStartTime&&this._tournamentTimingdata.tournamentStartTime-TimeManager.getInstance().getCurrentServerTime()<=this._tournamentDuration)){if(this._tournamentTimingdata.tournamentStartTime&&0<this._tournamentTimingdata.tournamentStartTime-TimeManager.getInstance().getCurrentServerTime())return cc.log("Current popup:"+TOURNAMENT_SURFACING_TYPES.BEFORE_FEATURE_LAUNCH),TOURNAMENT_SURFACING_TYPES.BEFORE_FEATURE_LAUNCH;if(this._tournamentTimingdata.tournamentEndTime&& 0<this._tournamentTimingdata.tournamentEndTime-TimeManager.getInstance().getCurrentServerTime())return cc.log("Current popup:"+TOURNAMENT_SURFACING_TYPES.TOURNAMENT_IN_PROGRESS),TOURNAMENT_SURFACING_TYPES.TOURNAMENT_IN_PROGRESS;cc.log("Tournament day:MatchOver ")}if(GameConfig.TOURNAMENT_LIVE_DAY<TimeManager.getInstance().getCurrentServerTime()){if(this.checkForAnnouncementPopupTriggerStatus(TOURNAMENT_SURFACING_TYPES.TOURNAMENT_OVER))return cc.log("Tournament day:Annoucement"),TOURNAMENT_SURFACING_TYPES.FEATURE_ANNOUNCEMENT; cc.log("Tournament day:Over");return TOURNAMENT_SURFACING_TYPES.TOURNAMENT_OVER}cc.log("Tournament day:Annoucement");return TOURNAMENT_SURFACING_TYPES.FEATURE_ANNOUNCEMENT}return!1},shareActionSheet:function(){RSActionShareManager.getInstance().initiateShare({ogType:"tournamania"},null)},getHudTimerStartsIn:function(){return this._hudTimerStartsIn},getHudTimerFreezesIn:function(){return this._hudTimerFreezesIn},getMachineRedirectionTime:function(){return this._machineRedirectionTime},getAnnouncementPopupStatus:function(){return this._fromAnnouncementPopup}, unSetAnnouncementPopupStatus:function(){this._fromAnnouncementPopup=!1},checkForAnnouncementPopupTriggerStatus:function(a){if(GameConfig.TOURNAMENT_ENABLED&&parseInt(RSEngine.gameData.getDefaultValues().isTournamentEnabled)&&(a==TOURNAMENT_SURFACING_TYPES.FEATURE_ANNOUNCEMENT||a==TOURNAMENT_SURFACING_TYPES.TOURNAMENT_OVER)){a=GameConfig.TOURNAMENT_DAY;var b=RSGame.getInstance().getUserDataManager().getMe().getLocalSessionData("TMAnnouncement"),c=Math.floor(Math.floor((new Date).getTime()/1E3)/a)* a;if(0===Object.keys(b).length)return cc.log("object empty"),!0;if(c-b.date>=a)return!0}return!1},setTournamentFeatureAnnouncementData:function(){var a=GameConfig.TOURNAMENT_DAY,b=RSGame.getInstance().getUserDataManager().getMe().getLocalSessionData("TMAnnouncement"),b={date:Math.floor(Math.floor((new Date).getTime()/1E3)/a)*a,sessionCount:0};RSGame.getInstance().getUserDataManager().getMe().setLocalSessionData("TMAnnouncement",b)},isTournamentFirst:function(){return this._isTodaysFirst},getIntermediateMessageTime:function(){return this._intermediateMessageTime}, getIntermediateBubbleStatus:function(){var a=TimeManager.getInstance().getCurrentServerTime(),b=this._tournamentEndTime+this._intermediateMessageTime;GlobalVars.isTournamentLoaded||a!=b||"gameplay_screen"!=RSGameScreenManager.getInstance().getCurrentScreen()&&!GlobalVars.isjackpotLoaded||SideMenuController.getInstance().playSurfacingAnimation("IntermediateBubbleInfo");return a>=b&&a<=b+10}};var RSTournamentMessageBubbleWidget=RSDisplayObject.extend({init:function(a,b,c){a=new RSRect(0,0,a.w,a.h);this._super.init.call(this,a);this._fonts=b;this._tournamentTimer=null;this._callBack=c;RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("HudMessageBubble"),"MessageBubbleFontConfig.json");this._assetFolder=RSGame.getInstance().getAssetFolder("HudMessageBubble");this.loadContent()},loadContent:function(){var a=RSGame.getInstance().getAssetPath("HudMessageBubble"); this.loadLayout(a)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},createCustomObject:function(a,b){switch(b.name){case "TournamentNotificationText":var c="Live Slots Tournament\nis about to start!";"MSP"==GameConfig.GAME_ID&&(c="Live Poker Tournament\nis about to start!");this._tournamentNotificationText=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(this._tournamentNotificationText);this._tournamentNotificationText.setCenter(b.x,b.y);c="Join the live \ntournaments today \nstarting at "+ (RSTournamentManager.getTournamentTimingData()?RSTournamentManager.getTournamentTimingData().titleKey3:"");this._tournamentEntryText=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(this._tournamentEntryText);this._tournamentEntryText.setCenter(b.x,b.y);this._tournamentEntryText.setVisible(!1);break;case "CountDownText":this._tournamentLastCountDownText=RSPlatformFontAssetManager.createCustomLabel("3",b),this.addChild(this._tournamentLastCountDownText),this._tournamentLastCountDownText.setVisible(!1)}this._super.createCustomObject.call(this, a,b)},onObjectCreated:function(a,b,c){switch(c.name){case "GoButton":this._goBtn=a;this._goBtn.setVisible(!1);break;case "GoButtonAnim":this._goBtnAnim=a;this._goBtnAnim.stopAnimation();this._goBtnAnim.setVisible(!1);break;case "MessageBubble":this._messageBubbleBg=a}this._super.onObjectCreated.call(this,a,b,c)},reset:function(){this._goBtn.setVisible(!1);this._goBtnAnim.setVisible(!1);this._goBtnAnim.stopAnimation()},updateCountDownText:function(a){0<a&&3>=a?("gameplay_screen"==RSGameScreenManager.getInstance().getCurrentScreen()|| GlobalVars.isjackpotLoaded?(cc.log("skip hud tooltips"),this._tournamentNotificationText.setVisible(!1),this._messageBubbleBg.setVisible(!1)):(this._tournamentLastCountDownText.setVisible(!0),this._tournamentLastCountDownText.setString(a),this._tournamentNotificationText.setVisible(!1),this._messageBubbleBg.setVisible(!0)),RSEngine.audioManager.playEffect(this._assetFolder+"Countdown.mp3",!1),GlobalVars.isTournamentLoaded||"gameplay_screen"!=RSGameScreenManager.getInstance().getCurrentScreen()&&!GlobalVars.isjackpotLoaded|| SideMenuController.getInstance().playTournamentAnimation(a)):0>=a?("gameplay_screen"==RSGameScreenManager.getInstance().getCurrentScreen()||GlobalVars.isjackpotLoaded?(cc.log("skip hud tooltips"),this._tournamentNotificationText.setVisible(!1),this._messageBubbleBg.setVisible(!1)):(this._tournamentLastCountDownText.setVisible(!1),this._tournamentNotificationText.setVisible(!1),this._messageBubbleBg.setVisible(!0),this._goBtn.setVisible(!0),this._goBtnAnim.setVisible(!0),this._goBtnAnim.playAnimation(-1, 0.3)),0==a&&RSEngine.audioManager.playEffect(this._assetFolder+"Go.mp3",!1),GlobalVars.isTournamentLoaded||0!=a||"gameplay_screen"!=RSGameScreenManager.getInstance().getCurrentScreen()&&!GlobalVars.isjackpotLoaded||SideMenuController.getInstance().playTournamentAnimation("GO!"),this.scheduleFunctionOnce(this.dismissWidget.bind(this),3)):0<a&&(this._tournamentLastCountDownText.setVisible(!1),this._tournamentNotificationText.setVisible(!0),this._messageBubbleBg.setVisible(!0))},onButtonClicked:function(a){switch(a){case "GoButton":this._callBack&& this._callBack(!0)}},dismissWidget:function(){this._callBack&&this._callBack(!1)},showTournamentEntryInfoText:function(){this._tournamentEntryText.setVisible(!0);this._tournamentNotificationText.setVisible(!1)},dismissTournamentEntryInfoText:function(){this._tournamentEntryText.setVisible(!1);this._tournamentNotificationText.setVisible(!0)},showIntermediateBubbleMessage:function(){var a="Join the next tournament\n at "+RSTournamentManager.getTournamentTimingData().titleKey3;this._tournamentEntryText.setString(a)}, showWaitingRoomOpenBubble:function(){var a="Tap here to join the\n Live Slots Tournament!";"MSP"==GameConfig.GAME_ID&&(a="Tap here to join the\nLive Poker Tournament!");this._tournamentEntryText.setString(a)}});var RSTournamentLeaderboardScreen=RSLeaderboardBgScreen.extend({init:function(a,b,c){this._callBack=c;this._top3PlayersScreen=b;cc.spriteFrameCache.addSpriteFrames(RSGame.getInstance().getAssetFolder("TournamentLeaderboardScreenScreen")+"BotImages_00-hd.plist");RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("TournamentWinnerScreen"),"TournamentWinnerScreenFontConfig.json");this._super.init.call(this,a);this._particleEmitter=null},loadContent:function(){this._super.loadContent.call(this)}, createCustomObject:function(a,b){switch(b.name){case "LeaderboardCrownWidget":this._crownWidgetData=b;break;case "LeaderboardCrownWidgetOriginal":this._crownWidgetRect=b;break;case "TournamentEnds":this._tournamentEndsAtText=RSPlatformFontAssetManager.createCustomLabel("06:03 PM",b);this.addChild(this._tournamentEndsAtText);break;case "TournamentEndsText":this._tournamentEndsDescription=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(this._tournamentEndsDescription);break;case "TournamentTimingWidget":this._tournamentTimingWidget= new RSTournamentTimingWidget(b);this.addChild(this._tournamentTimingWidget);this._tournamentTimingWidget.setCenter(b.x,b.y);break;case "ScrollBarArea":this._scrollArea=b;break;case "LeaderboardHolder":this._leaderboardHolder=b;break;case "PlayerItemHolder":this._leaderboarPlayerHolder=b;break;case "PlayerItemBottomRect":this._playerBottomRect=b}this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){switch(c.name){case "MiddleButton":this._scrollerBtn=a;this._scrollerBtn.setVisible(!1); break;case "BottomRectShade":this._bottomRectShade=a;this._bottomRectShade.setVisible(!1);this._bottomRectShade.setZOrder(3);break;case "TopShade":this._topShade=a;this._topShadeData=c;this._topShade.setZOrder(3);break;case "BadgeAnimLeft":case "BadgeAnimRight":a.stopAnimation(),a.setVisible(!1)}this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._top3PlayersScreen?(this._infoPara="tournamania_summary",this._createCrownWidget(!0), RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI,"tournamania_summary","trigger","",RSTournamentManager.getTournamentMachineId(),RSTournamentManager.getTournamentId())):(this._infoPara="tournamania_leaderboard",GlobalVars.isTournamentLoaded?RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI,"leaderboard_tournamania","trigger","",RSTournamentManager.getTournamentMachineId(),RSTournamentManager.getTournamentId()):RSTournamentManager.getAnnouncementPopupStatus()? RSAnalyticsManager.getInstance().trackPlayerAction("leaderboard_tournamania","click","open_from_tournamania_announcement",RSTournamentManager.getTournamentMachineId(),RSTournamentManager.getTournamentId()):RSAnalyticsManager.getInstance().trackPlayerAction("leaderboard_tournamania","click","open_from_slider",RSTournamentManager.getTournamentMachineId(),RSTournamentManager.getTournamentId()),this._createCrownWidget(),this._initializeScroller(),this._createPlayerLeaderboardBar());this.setUpdatedTournamentEndTimeDescription()}, onButtonClicked:function(a){switch(a){case "CloseBtn":this._callBack&&(this._top3PlayersScreen&&RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI,"tournamania_summary","close","",RSTournamentManager.getTournamentMachineId(),RSTournamentManager.getTournamentId()),this._callBack());break;case "InfoBtn":RSEngine.popupManager.addPopup(new RSTournamentLeaderboardInfoPopup(this._infoPara),!0,!0,!0,!1)}},_createCrownWidget:function(a){this._crownWidget=new RSTournamentCrownWidget(this._crownWidgetData, a);this.addChild(this._crownWidget);this._crownWidget.setCenter(this._crownWidgetData.x,this._crownWidgetData.y);this._top3PlayersScreen||(this._crownWidget.setScale(this._crownWidgetData.h/this._crownWidgetRect.h),this._crownWidget.setPosition(this._crownWidgetData.x-this._crownWidgetData.w/4.5,this._crownWidgetData.y-this._crownWidgetData.h/4));this.convertToNodeSpace(this._crownWidget.getX(),this._crownWidget.getY())},_initializeScroller:function(){this._scroller=new RSLeaderboardScrollBar(new RSRect(this._leaderboardHolder.x, this._leaderboardHolder.y,this._leaderboardHolder.w,this._leaderboardHolder.h),new RSSize(this._leaderboarPlayerHolder.w,this._leaderboarPlayerHolder.h),0,RSScrollerDirection.RSSCROLLER_VERTICAL,1);this.addChild(this._scroller);this._scroller.setButtonScroll(this._scrollerBtn);this._scroller.setScrollBase(this._scrollArea);var a=new RSDisplayObject(new RSRect(this._leaderboardHolder.x,this._leaderboardHolder.y,this._leaderboardHolder.w,this._leaderboardHolder.h));this.addChild(a);a.setAnchorPoint(0.5, 0.5);this._scroller.setMouseWheelScrollBase(a);this._updateScroller();this._scrollerBtn.setVisible(!0)},_updateScroller:function(){var a=RSTournamentManager.getTournamentLeaderboardData(),b=a.length,c=0;for(index=0;index<b;index++){a[index].isTournament=1;var d=new RSLeaderboardItem(this._leaderboarPlayerHolder,a[index]);(a[index].id==RSEngine.dataManager.getMe().getId()||0<a[index].win)&&this._scroller.addChild(d);-1==a[index].rank&&c++;a[index].id==RSEngine.dataManager.getMe().getId()&&(this._playerLeaderboardItem= d,this._playerIndex=1<c?index-c:index)}d=new RSLeaderboardItem(this._leaderboarPlayerHolder,{imageURL:"1",id:"RS_100",name:"DummyData",win:0,rank:0,reward:0,isTournament:1},!1,!0);this._scroller.addChild(d)},_createPlayerLeaderboardBar:function(){var a={},a=RSTournamentManager.getUserCurrentData();null==a&&(a={},a.avatar_id=RSEngine.dataManager.getMe().getAvatar(),a.imageURL=RSEngine.dataManager.getMe().getImageUrl(),a.id=RSEngine.dataManager.getMe().getId(),a.name=RSEngine.dataManager.getMe().getUserFirstName(), a.win=0,a.rank=0,a.reward=0);a.isTournament=1;this._currentPlayerItem=new RSLeaderboardItem(this._leaderboarPlayerHolder,a);this.addChild(this._currentPlayerItem);this._currentPlayerItem.setZOrder(3);this._currentPlayerItem.setCenter(this._playerBottomRect.x,this._playerBottomRect.y)},update:function(){if(this._playerLeaderboardItem&&this._currentPlayerItem){var a=null;this._scroller.getDisplayObject().getItem(this._playerIndex)&&(a=this._scroller.getDisplayObject().getItem(this._playerIndex).getWorldPosition()); cc.log("here");if(RSTournamentManager.getUserRank()||0==RSTournamentManager.getUserRank()&&this._currentPlayerItem)this._bottomRectShade.setVisible(!0),this._currentPlayerItem.setVisible(!0),a.y<=this._playerBottomRect.y?this._currentPlayerItem.setCenter(this._leaderboarPlayerHolder.x,this._playerBottomRect.y):(a.y>=this._leaderboarPlayerHolder.y?this._currentPlayerItem.setCenter(this._leaderboarPlayerHolder.x,this._leaderboarPlayerHolder.y):this._currentPlayerItem.setVisible(!1),this._bottomRectShade.setVisible(!1))}else this._currentPlayerItem&& (this._currentPlayerItem.setVisible(!0),this._bottomRectShade.setVisible(!0));this._scroller&&(a=this._scroller.getDisplayObject().getItem(0).getWorldPosition(),a.y<this._topShadeData.y-this._topShadeData.h?this._topShade.setVisible(!1):this._topShade.setVisible(!0));RSGame.getInstance().getGameManager().setSideMenuVisibility(!1);RSEngine.externalGameManager&&RSEngine.externalGameManager.hideExternalGame()},setUpdatedTournamentEndTimeDescription:function(){this._tournamentEndsDescription.setString(RSTournamentManager.getTournamentLBStatusMsg())}, removeWinnerScreen:function(){this._callBack&&(this._crownWidget&&(this.removeChild(this._crownWidget,!0),this._crownWidget=null),this._callBack())},unloadContent:function(){GlobalVars.isTournamentLoaded&&!this._top3PlayersScreen?RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI,"leaderboard_tournamania","close","",RSTournamentManager.getTournamentMachineId(),RSTournamentManager.getTournamentId()):GlobalVars.isTournamentLoaded||this._top3PlayersScreen||(RSTournamentManager.getAnnouncementPopupStatus()? (RSAnalyticsManager.getInstance().trackPlayerAction("leaderboard_tournamania","close","open_from_tournamania_announcement",RSTournamentManager.getTournamentMachineId(),RSTournamentManager.getTournamentId()),RSTournamentManager.unSetAnnouncementPopupStatus()):RSAnalyticsManager.getInstance().trackPlayerAction("leaderboard_tournamania","close","open_from_slider",RSTournamentManager.getTournamentMachineId(),RSTournamentManager.getTournamentId()));this._crownWidget&&this.removeChild(this._crownWidget, !0);this._tournamentTimingWidget&&this.removeChild(this._tournamentTimingWidget,!0);this._super.unloadContent.call(this);GlobalVars.musicStatus&&RSEngine.audioManager.unMuteMusic()}});var RSHudPurchaseWidget=RSDisplayObject.extend({init:function(a,b,c){a=new RSRect(0,0,a.w,a.h);this._super.init.call(this,a);this._tournamentTimer=null;this._isSaleDisabled=c;this._callBack=b;this.loadContent()},loadContent:function(){var a=RSGame.getInstance().getAssetPath("HudPurchaseWidget");this.loadLayout(a)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},createCustomObject:function(a,b){this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){switch(c.name){case "BuyBtn":this._buyButton= a;break;case "SaleBtn":this._saleButton=a;break;case "PurchaseCart":this._purchaseButton=a}this._super.onObjectCreated.call(this,a,b,c)},onButtonClicked:function(a){switch(a){case "BuyBtn":this._delegate.onPurchaseCartClicked();break;case "SaleBtn":this._delegate.onSaleButtonClicked();break;case "PurchaseCart":this._delegate.onPurchaseCartClicked()}},setDelegate:function(a){this._delegate=a},disablePurchaseButton:function(){null!=this._saleButton&&this._saleButton.setTouchEnabled(!1);null!=this._buyButton&& this._buyButton.setTouchEnabled(!1);null!=this._purchaseButton&&this._purchaseButton.setTouchEnabled(!1)},enablePurchaseButton:function(){null!=this._saleButton&&this._saleButton.setTouchEnabled(!0);null!=this._buyButton&&this._buyButton.setTouchEnabled(!0);null!=this._purchaseButton&&this._purchaseButton.setTouchEnabled(!0)},checkSaleStatusAndStartBuyButtonAnimation:function(){(RSSaleManager.getInstance().getSaleActiveStatus()||RSSaleManager.getInstance().getPurchaseCartSaleStatus())&&GlobalVars.isPurchaseEnabled&& !this._isSaleDisabled?(null!=this._buyButton&&this._buyButton.setVisible(!0),null!=this._saleButton&&this._saleButton.setVisible(!0),null!=this._purchaseButton&&this._purchaseButton.setVisible(!1)):(null!=this._buyButton&&this._buyButton.setVisible(!1),null!=this._saleButton&&this._saleButton.setVisible(!1),null!=this._purchaseButton&&this._purchaseButton.setVisible(!0))}});var RSTournamentSurfacingScreen=RSCurtainRaiserScreen.extend({init:function(a,b){this._super.init.call(this,RSGame.getInstance().getAssetPath("CurtainRaiser"),b);this.callBack=a},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},firstSectionComplete:function(){}, onCurtainRaised:function(){this._unlockScreen=new RSTournamentUnlockScreen(this.onTournamentUnlockAnimComplete.bind(this));this.addChild(this._unlockScreen)},onTournamentUnlockAnimComplete:function(a){console.log("Surfacing type::::::"+RSTournamentManager.getTournamentSurfacingEnabledStatus());this.removeChild(this._unlockScreen,!0);a=RSTournamentManager.getTournamentSurfacingEnabledStatus()?RSTournamentManager.getTournamentSurfacingEnabledStatus():TOURNAMENT_SURFACING_TYPES.BEFORE_FEATURE_LAUNCH; RSEngine.popupManager.addPopup(new RSTournamentInfoPopup(this.onTournamentInfoPopupClosed.bind(this),a,!1),!0,!0,!1,!1)},onTournamentInfoPopupClosed:function(a,b){this.callBack&&this.callBack.call(this,a,b)},unloadContent:function(){this._super.unloadContent.call(this)}}),RSTournamentUnlockScreen=RSGameScreen.extend({init:function(a){this._super.init.call(this);this.callBack=a;this._tournamentUnlockPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight); this.addChild(this._tournamentUnlockPanel);this._tournamentUnlockPanel.setVisible(!1);this._questInfoPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(this._questInfoPanel);this._questInfoPanel.setVisible(!1);this._dartPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(this._dartPanel);this._dartPanel.setVisible(!1);this._emitterObject=new RSPanel(0,0,0, 0);this._particleEmitter=null;this._textInfo=[];this._infoDart=[];this._tournamentTitlePanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(this._tournamentTitlePanel);this.layoutScreen(RSGame.getInstance().getAssetPath("TournamaniaSurfacing"),1)},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){switch(b.name){case "RayAntiClockwise":var c=RSUtils.createBasicObject(a,b);c.actionRotateBy(0.1, -4,-1);this.addIntoPreIntroPanel(c,!0);break;case "RayClockwise":c=RSUtils.createBasicObject(a,b);c.actionRotateBy(0.1,4,-1);this.addIntoPreIntroPanel(c,!0);break;case "Trophy":case "WinnerBanner":case "Boarder":case "Glow":c=RSUtils.createBasicObject(a,b);this.addIntoPreIntroPanel(c,!0);break;case "FlagAnimLeft":this._flagAnimLeft=RSUtils.createAnimation(a,b,0.3);this._flagAnimLeft.stopAnimation();this._flagAnimLeft.setScale(2);this.addIntoPreIntroPanel(this._flagAnimLeft,!0);break;case "FlagAnimLeftFlip":b.name= "FlagAnimLeft";this._flagAnimRight=RSUtils.createAnimation(a,b,0.3);this._flagAnimRight.stopAnimation();this._flagAnimRight.setScaleX(-2);this._flagAnimRight.setScaleY(2);this.addIntoPreIntroPanel(this._flagAnimRight,!0);break;case "StarRed9":case "StarRed5":case "StarRed7":c=RSUtils.createBasicObject(a,b);c.actionZoomInOut(0.7,0.15,0.3,-1);this.addIntoPreIntroPanel(c,!0);break;case "StarRed4":case "StarRed6":case "StarPurple3":case "StarRed2":case "StarPurple1":c=RSUtils.createBasicObject(a,b);c.actionZoomInOut(0.3, 0.45,0.55,-1);this.addIntoPreIntroPanel(c,!0);break;case "StarRed3":case "StarPurple4":c=RSUtils.createBasicObject(a,b);c.actionZoomInOut(0.3,0.1,0.2,-1);this.addIntoPreIntroPanel(c,!0);break;case "StarRed1":case "StarRed8":case "StarPurple2":case "StarPurple5":c=RSUtils.createBasicObject(a,b),c.actionZoomInOut(0.3,0.9,1.1,-1),this.addIntoPreIntroPanel(c,!0)}this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){switch(c.name){case "FlagAnimLeft":this.addIntoPreIntroPanel(a, !0);a.setVisible(!1);break;case "TitleAnim":this._titleAnim=a;this._titleAnim.stopAnimation();this._titleAnim.setVisible(!1);a.setScale(2);break;case "Title":this._title=a;this._title.setVisible(!1);break;case "SubTitle":this._subTitle=a,this._subTitle.setVisible(!1),this._subTitle.actionZoom(0,0)}this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.addChild(this._emitterObject);this._emitterObject.setZOrder(-1);this._tournamentUnlockPanel.actionZoom(0, 0);this._title.actionZoom(0,0,this.startAnimations.bind(this));RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("TournamaniaSurfacing")+"Tournamania_reveal.mp3",!1)},onButtonClicked:function(a){switch(a){case "closee":this.callBack.call(this,1)}RSGame.getInstance().getGameManager().playButtonClickSFX()},addIntoPreIntroPanel:function(a,b){this._tournamentUnlockPanel.addChild(a)},startAnimations:function(){this._title.setVisible(!0);this._title.actionZoomInOut(0.3,0.9,1,1,this.onTitleAnimationCompleted.bind(this))}, onTitleAnimationCompleted:function(){this._titleAnim.setVisible(!0);this._titleAnim.playAnimation(-1,1);this._subTitle.setVisible(!0);this._subTitle.actionZoomInOut(0.3,0.9,1,1,this.startTrophyAnimation.bind(this))},startTrophyAnimation:function(){this._tournamentUnlockPanel.setVisible(!0);this._flagAnimLeft.playAnimation(-1,0.3);this._flagAnimRight.playAnimation(-1,0.3);this._tournamentUnlockPanel.actionZoomInOut(0.3,0.9,1,1,this.onTournamentUnlockPanelAnimComplete.bind(this))},onTournamentUnlockPanelAnimComplete:function(){this.loadParticleEffect()}, loadParticleEffect:function(){cc.spriteFrameCache.addSpriteFrames("res/PlatformWidgets/DailyChallengesPopup/ParticleEmitter_00-hd.plist");var a=new RSEmitterParticleParams;a._spriteFrames.push("ParticleEmitter_00/ParticleEmitter2.png");a._spriteFrames.push("ParticleEmitter_00/ParticleEmitter3.png");a._spriteFrames.push("ParticleEmitter_00/ParticleEmitter4.png");a._spriteFrames.push("ParticleEmitter_00/ParticleEmitter5.png");a._spriteFrames.push("ParticleEmitter_00/ParticleEmitter6.png");a._spriteFrames.push("ParticleEmitter_00/ParticleEmitter8.png"); a._startDelay=0.2;a._startDelayVariance=0.5;a._deviation=800;a._deviationVariance=150;a._speed=1E3;a._360rotationDuration=0.5;a._tweenRate=0.5;a._spriteAnimationSpeed=0.4;a._origin=new RSPoint(RSEngine.screenWidth/2,RSEngine.screenHeight/2);a._originVariance=new RSPoint(0,0);a._displacement=new RSPoint(0,0);a._displacementVariance=new RSPoint(RSEngine.screenWidth-500,RSEngine.screenHeight-200);var b=RSGame.getInstance().getGameManager().getCustomizedParticleCount()?RSGame.getInstance().getGameManager().getCustomizedParticleCount(): 200;this._particleEmitter=new RSCustomAnimationEmitter(a,!1,RSCustomEmitterType.FOUNTAIN,b,this._onParticleEmitterCompleted.bind(this));this._emitterObject.addChild(this._particleEmitter);this._particleEmitter.loadEmitter();this._particleEmitter.startEmitter();RSUtils.callFunctionWithDelay(1,this,this._changeZOrder.bind(this))},_onParticleEmitterCompleted:function(){this.onButtonClicked("closee")},_changeZOrder:function(){this._emitterObject.setZOrder(2)},_onLockAnimationCompleted:function(){},unloadContent:function(){this._super.unloadContent.call(this)}}), RSTournamentInfoPopup=RSPopup.extend({init:function(a,b,c,d){this._assetList=[{name:RSGame.getInstance().getAssetPath("TournamaniaIntroPopup"),count:1}];RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("TournamaniaIntroPopup"),"TournamentInfoPopupFontConfig.json");this._callBack=a;this._flagArray=[];this._textArray=[];this._typeOfInfoPopup=b;this._animationsPlayed=!1;this._standAlonePopup=c;this._announcementPopup=d;this._super.init.call(this)},loadContent:function(){this.layoutScreen(this._assetList); this._super.loadContent.call(this);this._standAlonePopup&&!this._announcementPopup?RSAnalyticsManager.getInstance().trackPlayerAction("tournamania_announcement","click","open_from_slider","",""):RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI,"tournamania_announcement","trigger","open_from_"+RSGameScreenManager.getInstance().getCurrentScreen(),"","")},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._typeOfInfoPopup!=TOURNAMENT_SURFACING_TYPES.BEFORE_FEATURE_LAUNCH&& this._typeOfInfoPopup!=TOURNAMENT_SURFACING_TYPES.TOURNAMENT_IN_PROGRESS&&this._standAlonePopup?this._standAlonePopup&&(this._animationsPlayed=!0,this._setFeatureAnnouncementTexts()):this.scheduleFunctionOnce(this.startAnimationSequence.bind(this),0.5)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "Flag1":case "Flag2":case "Flag3":case "Flag4":case "Flag5":if(this._standAlonePopup)break;a.actionZoom(0,1.05,null);a.setVisible(!1);this._flagArray.push(a); break;case "Lets'GoBtn":this._letsGoBtn=a;this._letsGoBtn.setVisible(!1);break;case "CloseBtn":this._closeBtn=a;if(this._standAlonePopup)break;this._closeBtn.setTouchEnabled(!1);break;case "TitleAnim":a.setScale(2);break;case "FlagAnimLeft":a.stopAnimation();a.playAnimation(-1,0.3);break;case "TitleAnim":a.stopAnimation();a.playAnimation(-1,0.03);break;case "TimerBGPurple":this._timerBgPurple=a;if(this._standAlonePopup)break;this._timerBgPurple.setVisible(!1);this._timerBgPurple.actionZoom(0,1.05, null);break;case "TimerBGRed":this._timerBgPurpleRed=a;this._timerBgPurpleRed.setVisible(!1);this._timerBgPurpleRed.actionZoom(0,1.05,null);break;case "Live":this._live=a;this._live.setVisible(!1);break;case "StartsIn":this._startsIn=a;if(this._standAlonePopup)break;this._startsIn.setVisible(!1);this._startsIn.actionZoom(0,1.05,null);break;case "LiveSignal":this._liveSignalAnimation=a;this._liveSignalAnimation.stopAnimation();this._liveSignalAnimation.playAnimation(-1,0.3);this._liveSignalAnimation.setVisible(!1); break;case "PreviousWinnersBtn":this._previousWinnersBtn=a;if(this._typeOfInfoPopup==TOURNAMENT_SURFACING_TYPES.TOURNAMENT_OVER&&this._standAlonePopup)break;this._previousWinnersBtn.setVisible(!1);break;case "OKBtn":this._okBtn=a;if(this._typeOfInfoPopup==TOURNAMENT_SURFACING_TYPES.FEATURE_ANNOUNCEMENT&&this._standAlonePopup)break;this._okBtn.setVisible(!1);break;case "TimerBase":this._timerBase=a;if(this._standAlonePopup)break;this._timerBase.setVisible(!1)}},createCustomObject:function(a,b){var c= RSPlatformFontAssetManager.getCustomFontVOFromConfig(RSPlatformFontAssetManager.getFontNameForLabelName(b.name));switch(b.name){case "TournamaniaRule1":var d=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);this.TournamaniaRule1=RSPlatformFontAssetManager.createCustomLabel(d,b);this.addChild(this.TournamaniaRule1);this._textArray.push(this.TournamaniaRule1);if(this._standAlonePopup)break;this.TournamaniaRule1.actionZoom(0,c.fontSize+0.05);this.TournamaniaRule1.setVisible(!1);this._finalFontSize= c.fontSize;break;case "TournamaniaRule2":d=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);this.TournamaniaRule2=RSPlatformFontAssetManager.createCustomLabel(d,b);this.addChild(this.TournamaniaRule2);this._textArray.push(this.TournamaniaRule2);if(this._standAlonePopup)break;this.TournamaniaRule2.actionZoom(0,c.fontSize+0.05);this.TournamaniaRule2.setVisible(!1);break;case "TournamaniaRule3":d=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);this.TournamaniaRule3=RSPlatformFontAssetManager.createCustomLabel(d, b);this.addChild(this.TournamaniaRule3);this._textArray.push(this.TournamaniaRule3);if(this._standAlonePopup)break;this.TournamaniaRule3.actionZoom(0,c.fontSize+0.05);this.TournamaniaRule3.setVisible(!1);break;case "TournamaniaRule4":d=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);this.TournamaniaRule4=RSPlatformFontAssetManager.createCustomLabel(d,b);this.addChild(this.TournamaniaRule4);this._textArray.push(this.TournamaniaRule4);if(this._standAlonePopup)break;this.TournamaniaRule4.actionZoom(0, c.fontSize+0.05);this.TournamaniaRule4.setVisible(!1);break;case "TournamaniaRule5":d=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);this.TournamaniaRule5=RSPlatformFontAssetManager.createCustomLabel(d,b);this.addChild(this.TournamaniaRule5);this._textArray.push(this.TournamaniaRule5);if(this._standAlonePopup)break;this.TournamaniaRule5.actionZoom(0,c.fontSize+0.05);this.TournamaniaRule5.setVisible(!1);break;case "TimerText":this.TimerText=RSPlatformFontAssetManager.createCustomLabel("JOIN THE FUN AT TOURN-A-MANIA!", b);this.addChild(this.TimerText);if(this._standAlonePopup)break;this.TimerText.actionZoom(0,c.fontSize+0.05);this.TimerText.setVisible(!1);break;case "Timer":this.Timer=RSPlatformFontAssetManager.createCustomLabel("12:12:12",b);this.addChild(this.Timer);if(this._standAlonePopup)break;this.Timer.actionZoom(0,c.fontSize+0.05);this.Timer.setVisible(!1);this._timerFontSize=c.fontSize;break;case "FlagAnimLeftFlip":b.name="FlagAnimLeft",this._flagAnimRight=RSUtils.createAnimation(a,b,0.3),this._flagAnimRight.setScaleX(-1), this.addChild(this._flagAnimRight)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":case "Lets'GoBtn":case "OKBtn":case "PreviousWinnersBtn":this.closePopup(),this._standAlonePopup&&!this._announcementPopup?RSAnalyticsManager.getInstance().trackPlayerAction("tournamania_announcement","close","open_from_slider","",""):RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI,"tournamania_announcement","close","open_from_"+RSGameScreenManager.getInstance().getCurrentScreen(), "",""),this._callBack&&this._callBack(this._typeOfInfoPopup,a)}},startAnimationSequence:function(){this._flagArray.length?this._playFlagAnimation():this.scheduleFunctionOnce(this._playTournamentStartsInTextAnimation.bind(this),1)},_playFlagAnimation:function(){this._flagArray[0].setVisible(!0);this._flagArray[0].actionZoomInOut(0.2,0.8,1,1,this._playInfoTextAnimation.bind(this))},_playInfoTextAnimation:function(){this._flagArray.splice(0,1);this._textArray[0].setVisible(!0);this._textArray[0].actionZoom(0.2, this._finalFontSize,this._onInfoTextAnimationCompleted.bind(this))},_onInfoTextAnimationCompleted:function(){this._textArray.splice(0,1);this.startAnimationSequence()},_playTournamentStartsInTextAnimation:function(){this.TimerText.setVisible(!0);this.TimerText.actionZoom(0.2,this._finalFontSize);this.scheduleFunctionOnce(this._tournamentStartsInTextAnimationCompleted.bind(this),1)},_tournamentStartsInTextAnimationCompleted:function(){this._timerBase.setVisible(!0);this._startsIn.setVisible(!0);this.Timer.setVisible(!0); this.Timer.actionZoom(0.2,this._timerFontSize,this.onTimerAnimationCompleted.bind(this));this._typeOfInfoPopup==TOURNAMENT_SURFACING_TYPES.BEFORE_FEATURE_LAUNCH?(this._timerBgPurple.setVisible(!0),this._timerBgPurple.actionZoomInOut(0.2,0.8,1,1)):this._typeOfInfoPopup==TOURNAMENT_SURFACING_TYPES.TOURNAMENT_IN_PROGRESS&&(this._timerBgPurpleRed.setVisible(!0),this._timerBgPurpleRed.actionZoomInOut(0.2,0.8,1,1),this._live.setVisible(!0),this._live.actionZoomInOut(0.2,0.8,1,1),this._liveSignalAnimation.setVisible(!0), this._liveSignalAnimation.actionZoomInOut(0.2,0.8,1,1),this._startsIn.setVisible(!1));this._timerBase.actionZoomInOut(0.2,0.8,1,1);this._startsIn.actionZoomInOut(0.2,0.8,1,1)},onTimerAnimationCompleted:function(){this.scheduleFunctionOnce(this._playBtnAnimation.bind(this),1)},_playBtnAnimation:function(){this._typeOfInfoPopup==TOURNAMENT_SURFACING_TYPES.TOURNAMENT_IN_PROGRESS||RSTournamentManager.getMachineRedirectionTime()>=RSTournamentManager.tournamentStartsIn()?(this._letsGoBtn.setVisible(!0), this._letsGoBtn.actionZoomInOut(0.2,0.8,1,1,this._onBtnAnimationCompleted.bind(this))):GameConfig.TOURNAMENT_LIVE_DAY<TimeManager.getInstance().getCurrentServerTime()?(this._previousWinnersBtn.setVisible(!0),this._previousWinnersBtn.actionZoomInOut(0.2,0.8,1,1,this._onBtnAnimationCompleted.bind(this))):(this._okBtn.setVisible(!0),this._okBtn.actionZoomInOut(0.2,0.8,1,1,this._onBtnAnimationCompleted.bind(this)))},_onBtnAnimationCompleted:function(){this._closeBtn.setTouchEnabled(!0);this._animationsPlayed= !0},_setFeatureAnnouncementTexts:function(){},update:function(){var a=RSTournamentManager.tournamentStartsIn(),b=RSTournamentManager.tournamentEndsIn();0<a?(86400>a?(this._animationsPlayed&&this.Timer.setVisible(!0),this.Timer.setString(RSUtils.formattedTime(a))):(this.Timer.setString(~~(a/86400)+1+" Days"),this._animationsPlayed&&this.Timer.setVisible(!0)),this.TimerText.setString("JOIN THE FUN AT TOURN-A-MANIA!"),this._animationsPlayed&&(this._startsIn.setVisible(!0),this._liveSignalAnimation.setVisible(!1), this._live.setVisible(!1),this._timerBase.setVisible(!0),10>=a?(this._timerBgPurpleRed.setVisible(!0),this._timerBgPurple.setVisible(!1)):(this._timerBgPurpleRed.setVisible(!1),this._timerBgPurple.setVisible(!0)),RSTournamentManager.getMachineRedirectionTime()>=a?(this._previousWinnersBtn.setVisible(!1),this._okBtn.setVisible(!1),this._letsGoBtn.setVisible(!0)):GameConfig.TOURNAMENT_LIVE_DAY<TimeManager.getInstance().getCurrentServerTime()?(this._previousWinnersBtn.setVisible(!0),this._okBtn.setVisible(!1), this._letsGoBtn.setVisible(!1)):(this._letsGoBtn.setVisible(!1),this._okBtn.setVisible(!0),this._previousWinnersBtn.setVisible(!1)))):0<b?(86400>b&&(this._animationsPlayed&&this.Timer.setVisible(!0),this.Timer.setString(RSUtils.formattedTime(b)),this.TimerText.setString("JOIN TOURN-A-MANIA NOW!")),this._animationsPlayed&&(this._startsIn.setVisible(!1),this._liveSignalAnimation.setVisible(!0),this._live.setVisible(!0),this._letsGoBtn.setVisible(!0),this._okBtn.setVisible(!1),this._timerBase.setVisible(!0), this._previousWinnersBtn.setVisible(!1),10>=b?(this._timerBgPurpleRed.setVisible(!0),this._timerBgPurple.setVisible(!1)):(this._timerBgPurpleRed.setVisible(!1),this._timerBgPurple.setVisible(!0)))):this._animationsPlayed&&(this._startsIn.setVisible(!1),this._timerBgPurple.setVisible(!1),this._timerBgPurpleRed.setVisible(!1),this._liveSignalAnimation.setVisible(!1),this._live.setVisible(!1),this._letsGoBtn.setVisible(!1),this._okBtn.setVisible(!1),this._timerBase.setVisible(!1),this._previousWinnersBtn.setVisible(!0), this.TimerText.setString("JOIN THE FUN AT TOURN-A-MANIA!"),this.Timer.setVisible(!1))}});var RSTournamentLeaderboardInfoPopup=RSGenericPopup.extend({init:function(a){this._assetList=[{name:RSGame.getInstance().getAssetPath("TournamaniaInfoPopup"),count:1}];RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("TournamaniaInfoPopup"),"TournamentLeaderboardInfoPopupFontConfig.json");this._super.init.call(this);this._src=a},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){RSAnalyticsManager.getInstance().trackPlayerAction("tournamania_info", "click","open_from_"+this._src,"","");this._super.onLayoutCompleted.call(this)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a,b){switch(b.name){case "TournamaniaInfo1":var c=RSGame.getInstance().getGameData().getPopupTextWithKey("TournamaniaInfo1"),c=c.replace(/\\n/g,"\n"),c=RSPlatformFontAssetManager.createCustomLabel(c+"\n",b);this.addChild(c);break;case "TournamaniaInfo2":c=RSGame.getInstance().getGameData().getPopupTextWithKey("TournamaniaInfo2"); c=c.replace(/\\n/g,"\n");c=RSPlatformFontAssetManager.createCustomLabel(c+"\n",b);this.addChild(c);break;case "TournamaniaInfo3":c=RSGame.getInstance().getGameData().getPopupTextWithKey("TournamaniaInfo3");c=c.replace(/\\n/g,"\n");c=RSPlatformFontAssetManager.createCustomLabel(c+"\n",b);this.addChild(c);break;case "TournamaniaInfo4":c=RSGame.getInstance().getGameData().getPopupTextWithKey("TournamaniaInfo4"),c=c.replace(/\\n/g,"\n"),c=RSPlatformFontAssetManager.createCustomLabel(c+"\n",b),this.addChild(c)}return this._super.createCustomObject.call(this, a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":case "CP_Button_T1":RSAnalyticsManager.getInstance().trackPlayerAction("tournamania_info","close","open_from_"+this._src,"",""),this.closePopup()}}});var RSPlayerConnectWidget=RSDisplayObject.extend({init:function(a,b){this.font=b;var c=new RSRect(0,0,a.w,a.h);this._super.init.call(this,c);this.loadContent()},loadContent:function(){var a=RSGame.getInstance().getAssetPath("LoyaltyMallWidget");null==a?(a=RSGame.getInstance().getAssetPath("RSPlayerConnectWidget"),this.font||(this.font=RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold"))):this.font||(this.font=RSGame.getInstance().getAssetPath("UbuntuMonoBold_large_Goldbold")); this.loadLayout(a)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._LMText&&RSEventManager.getInstance().addEventListener("updateLMPoints",this,this.updateLMPoints.bind(this));this._updateTimer=setInterval(this._onTimerComplete.bind(this),5E3)},updateLMPoints:function(){RSEngine.dataManager.getLoyaltyMallPoints(this.setLMPoints.bind(this))},setLMPoints:function(a){200==a.result.status&&this._LMText.setString(RSUtils.formatNumber(a.result.data,4,2))},onButtonClicked:function(a){switch(a){case "LoyaltyMallBtn":this._onLMButtomClicked()}}, createCustomObject:function(a,b){switch(b.name){case "LMText":this._LMText=new RSScaledLabel("0",this.font,b,kTEXT_ALIGNMENT_CENTER),RSEngine.dataManager.getLoyaltyMallPoints(this.setLMPoints.bind(this)),this._LMText.setZOrder(5),this.addChild(this._LMText)}this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){switch(c.name){case "LMAnimation":this._lmAnimation=a;this._lmAnimation.stopAnimation();break;case "HeartAnimation":this._heartAnimation=a;this._heartAnimation.setZOrder(3); this._heartAnimation.stopAnimation();this._heartAnimation.setVisible(!1);break;case "HeartSymbol":this._heartSymbol=a}this._super.onObjectCreated.call(this,a,b,c)},_onLMButtomClicked:function(){RSAnalyticsManager.getInstance().trackGUIEvent("loyalty_mall_icon","open","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName());RSEngine.loginMode==LOGIN_MODE.GUEST?RSGame.getInstance().getGameManager().showLoginPopup("feature","LoyaltyMall"):!RSEngine.dataManager.getMe().getLoyaltyMallEligiblePopupShownStatus()&& GameConfig.LM_AND_VIP_SURFACING?(GlobalVars.isLMToolTipActive=!0,RSGame.getInstance().getGameManager().showIntroScreenForLMAndVIP(!1,!0),RSGame.getInstance().getGameManager().getCurtainRaiserScreen()&&RSGame.getInstance().getGameManager().playIntroScreen(this._onLoyaltyEligiblePopupClosed.bind(this))):RSGame.getInstance().getGameManager().loadLoyaltyMall()},_onLoyaltyEligiblePopupClosed:function(){GlobalVars.isLMToolTipActive&&(RSEngine.popupManager.addPopup(new RSLoyaltyToolKitPopup(this._onToolTipClosed.bind(this)), !1,!0,!1),GlobalVars.isLMToolTipActive=!1,RSEventManager.getInstance().removeListenersForEvent("showToolTip"))},_onToolTipClosed:function(){cc.log("on Tool tip closed")},getName:function(){return"PlayerConnectWidget"},_onTimerComplete:function(){this._lmAnimation.playAnimation(1,0.3)},unload:function(){clearInterval(this._updateTimer);RSEventManager.getInstance().removeListenersForEvent("updateLMPoints");this._super.unload.call(this)}});var RSFavoritesLobby=RSCasinoScreen.extend({init:function(){RSGame.getInstance().getGameManager().setGameType(RSGameTypes.Slots);RSFavoritesLobbyWidgetManager.getInstance().setFavoriteMachineData(RSGameTypes.Slots);this.outerGlow=this.sliderRect=this._scrollerRect=this._scrollerRightBtn=this._scrollerLeftBtn=this._iconGap=this._favIconHolder=null;this._bottomBGItems=[];this._JLMachineHolderList=[];this._machineLoaded=!1;this._super.init.call(this)},loadContent:function(){this.layoutScreen(RSGame.getInstance().getAssetPath("FavoritesSubLobby"), 1);this.netUserBalance=null;this.netUserBalance=JSON.parse(JSON.stringify({coins:RSCasinoManager.getPrimaryCurrency()}));this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "ArrowLeft":this._scrollerLeftBtn=a;this._scrollerLeftBtn.setVisible(!1);break;case "ArrowRight":this._scrollerRightBtn=a;this._scrollerRightBtn.setVisible(!1);break;case "BgRect":this.removeChild(a);a=new RSImageObject;a.setAnchorPoint(0,0);a.setImageFromUrl(RSGame.getInstance().getAssetPath("LobbyBg"), 0,0,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(a);break;case "OuterGlow":this.outerGlow=a;this.removeChild(a);break;case "BtnLeft":case "VideoPokerNavigation":case "BtnRight":case "BingoKenoNavigation":case "BottomBg":this.removeChild(a),this._bottomBGItems.push(a)}},createCustomObject:function(a,b){switch(b.name){case "FavoritesSubLobbyWidget":this._favoritesScrollerRect=b;break;case "Slider":this.sliderRect=b}},onLayoutCompleted:function(){var a=this.convertToNodeSpace(this.sliderRect.x, this.sliderRect.y);this.slider=new RSControlSlider(RSGame.getInstance().getAssetPath("ScrollBar"),cc.size(485,34),RSGame.getInstance().getAssetPath("ScrollRound"),cc.size(52,52));this.slider.setPosition(a.getX(),a.getY());this.slider.setZOrder(2);this.addChild(this.slider);this._favoritesScrollerWidget=new RSFavoritesScrollerWidget(this._favoritesScrollerRect,this.addBottomItems.bind(this));this.addChild(this._favoritesScrollerWidget);this._favoritesScrollerWidget.setAnchorPoint(0.5,0.5);this._favoritesScrollerWidget.setPosition(this._favoritesScrollerRect.x, this._favoritesScrollerRect.y);this._favoritesScrollerWidget.setCustomSlider(this.slider);this.outerGlow&&this.addChild(this.outerGlow);this._super.onLayoutCompleted.call(this)},addBottomItems:function(a){if(a)this.removeChild(this.slider),this.slider=null,a=this.convertToNodeSpace(this.sliderRect.x,this.sliderRect.y),this.slider=new RSControlSlider(RSGame.getInstance().getAssetPath("ScrollBar"),cc.size(485,34),RSGame.getInstance().getAssetPath("ScrollRound"),cc.size(52,52)),this.slider.setPosition(a.getX(), a.getY()),this.slider.setZOrder(2),this.addChild(this.slider),this._favoritesScrollerWidget.setCustomSlider(this.slider);else for(var b in this._bottomBGItems)this.addChild(this._bottomBGItems[b]),this._bottomBGItems[b].setZOrder(1)},_popupClosed:function(){this._machineLoaded=GlobalVars.isjackpotLoaded=!1},onButtonClicked:function(a){switch(a){case "BtnLeft":case "BingoKenoNavigation":RSGame.getInstance().getGameManager().platformSDKScreenNavigation("BINGO_LOBBY");break;case "BtnRight":case "VideoPokerNavigation":RSGame.getInstance().getGameManager().platformSDKScreenNavigation("POKER_LOBBY")}}, unload:function(){this.assetLoadedArray=[];RSFavoritesLobbyWidgetManager.getInstance().unloadSlotsLobby();JackpotLoungeDataHandler.getInstance().clearJackpotTimer();RSEventManager.getInstance().removeEventListenersIn(this);this._super.unload.call(this)}});var RSFavoritesScrollerWidget=RSDisplayObject.extend({init:function(a,b){this._onAddingElementsCompleted=b;var c=new RSRect(0,0,a.w,a.h);this._super.init.call(this,c);this._machineConfig=[];this.loadContent()},loadContent:function(){this.loadLayout(RSGame.getInstance().getAssetPath("FavoritesSubLobbyWidget"))},onLayoutCompleted:function(){this.addScroller(!0);this._super.onLayoutCompleted.call(this)},createCustomObject:function(a,b){switch(b.name){case "IconHolder":this._favIconHolder=b;break;case "ScrollerArea":this._scrollerRect= new RSRect(b.x,b.y,b.w,b.h)}},onObjectCreated:function(a,b,c){},addScroller:function(a){this._JLMachinesHolder=[];this._machinesIconHolder=[];this._scroller=new RSScrollHolderLayer(cc.size(this._scrollerRect.getWidth(),this._scrollerRect.getHeight()));this._scroller.initializeScroller(cc.size(this._scrollerRect.getWidth(),this._scrollerRect.getHeight()),0,1,!1,0,45,{left:0,top:0,right:0,bottom:0});this._scroller.setPosition(this._scrollerRect.getX(),this._scrollerRect.getY());this.addChild(this._scroller); this.playBackgroundMusic();a&&(RSCasinoManager.setCasinoHUD(this._getCasinoHUD()),RSCasinoManager.getCasinoHUD().setPrimaryCurrency(RSCasinoManager.getPrimaryCurrency()),RSEngine.loginMode!=LOGIN_MODE.GUEST&&RSGame.getInstance().getUserDataManager().getCurrentCoinBalance(this._coinBalanceCallBack.bind(this)));for(var b="tier"+RSVIPManager.getInstance().getVIPUserTier(),b=parseInt(RSEngine.gameData.getSheetData("favoritesTierCapping")[0][b]),c=RSEngine.dataManager.getMe().getFavoriteMachines(RSGameTypes.Slots), d=c.length,e=b-d,f=0;f<c.length;f++){var g=null;c[f].includes("_JL")?(g=c[f].split("_JL"),g=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots,g[0])):(g=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots,c[f]),null!=g&&(g.jackpotLoungeName=null));null!=g&&this._machineConfig.push(g)}var f=0,h=c="",g=null,k=[],m={FONT_ICON:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold"),FONT_COLOR:{r:255,g:255,b:255,a:255},JL_FONT_ICON:RSGame.getInstance().getGameManager().getHUDCasinoFont("large", "bold"),JL_FONT_COLOR:{r:255,g:255,b:255,a:255}};if(0<d)for(f=0;f<this._machineConfig.length;f++)c=this._machineConfig[f].machine_largeIcon,g=null,this._machineConfig[f].jackpotLoungeName&&(g=this._machineConfig[f].jackpotLoungeName),d={isFavEnabled:!0,gameType:RSGameTypes.Slots},h=new RSCasinoIconHolder("LONG_ICON",this._favIconHolder,"res/SlotResources/CasinoSubLobby/LargeIcons/"+c,this.onIconClicked.bind(this),this._machineConfig[f],!0,m,!0,null,g,f,!1,!1,d,this.removeFavMachine.bind(this)),null!= g&&this._JLMachinesHolder.push(h),this._machinesIconHolder.push(h),k.push(h);if(0<e)for(;f<b;f++)h=new RSCasinoIconHolder("LONG_ICON",this._favIconHolder,"res/SlotResources/CasinoSubLobby/LargeIcons/"+c,null,null,!0,m,!0,null,g,f,!1,!0,null,null,!0),k.push(h);0<k.length&&this._scroller.addElements(k);a?(this._scroller.setAutoScrollConfig(RSFavoritesLobbyWidgetManager.getInstance().getAutoScrollParams().duration,RSFavoritesLobbyWidgetManager.getInstance().getSlotsLobbyFromIndex(),RSFavoritesLobbyWidgetManager.getInstance().getSlotsLobbyTargetIndex()), this._scroller.startAutoScroll(this.onAutoScrollCompleted.bind(this)),this._onAddingElementsCompleted(!1)):this._onAddingElementsCompleted(!0);0<this._JLMachinesHolder.length&&(this.onJackpotData(),RSEventManager.getInstance().addEventListener("onJackpotGetData",this,this.onJackpotData.bind(this)))},onAutoScrollCompleted:function(){if(0<this._machinesIconHolder.length&&RSFavoritesLobbyWidgetManager.getInstance().checkIsFavMachineLoaded()&&-1!=RSFavoritesLobbyWidgetManager.getInstance().getSelectedMachineIndex())for(var a in this._machinesIconHolder)if(a== RSFavoritesLobbyWidgetManager.getInstance().getSelectedMachineIndex()){this._machinesIconHolder[a].playIconAnimations();RSFavoritesLobbyWidgetManager.getInstance().setSelectedMachineIndex(-1);break}},onJackpotData:function(){var a=JackpotLoungeDataHandler.getInstance().getJackpotValue("mega");a&&(this._JLBaseValue=a.baseValue,this._JLValue=a.value,this.setJackpotValuesToIcons())},setJackpotValuesToIcons:function(){if(0<this._JLMachinesHolder.length)for(var a in this._JLMachinesHolder)this._JLMachinesHolder[a].setJackPotValuesToIconHolder(this._JLBaseValue, this._JLValue)},setCustomSlider:function(a){a instanceof RSControlSlider&&this._scroller.setCustomSlider(a)},playBackgroundMusic:function(){RSEngine.audioManager.isMusicPlaying()||RSGame.getInstance().getGameManager().playMusicWithFadeIn(RSGame.getInstance().getAssetPath("MainLobbyBGM"),!0,this.getDisplayObject())},_coinBalanceCallBack:function(a){RSEngine.screenManager.removeOverlay();RSGame.getInstance().getLosingStreakManager().calculateLosingStreak(RSCasinoManager.getPrimaryCurrency()-parseInt(this.netUserBalance.coins)); this.netUserBalance=null;this.netUserBalance=JSON.parse(JSON.stringify({coins:RSCasinoManager.getPrimaryCurrency()}));"failed"==a&&RSNetworkManager.getInstance().showNetworkError("Sorry there seems to be something\n wrong with the net connection")},_getCasinoHUD:function(){return new TopHUD(RSGame.getInstance().getAssetPath("TopHud"))},onIconClicked:function(a,b,c,d,e){this._machineData=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots,a.machine_identifier);RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"), !1);(c||this._machineData.jackpotLoungeName)&&GameConfig.JACKPOT_LOUNGE_ENABLE?c&&"1"==RSEngine.gameData.getSheetData("platformDataConfig")[0].isJLSelectPopupDisabled?(RSCasinoManager.triggerMachineEvent("gui_jackpot_lounge","jackpot_popup","lounge_play"),RSFavoritesLobbyWidgetManager.getInstance().jackpotLoungeMachineSelectPopupCallBack("jackpot",a)):RSGame.getInstance().getGameManager().callJLMachineSelectPopup(a):RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Slots,a.machine_identifier, RSGameScreens.SlotsLobby);GlobalVars.slotsLobbySelectedTab=TabType.FAVOURITES;RSFavoritesLobbyWidgetManager.getInstance().setFavMachineLoaded(!0);this._selectedIndex=e;RSFavoritesLobbyWidgetManager.getInstance().setFavLobbySelectedIndex(e,RSFavoritesLobbyWidgetManager.getInstance().getAutoScrollParams())},removeFavMachine:function(){this.removeChild(this._scroller);this._machineConfig=[];this.addScroller()},unload:function(){RSEventManager.getInstance().removeEventListenersIn(this);this._scroller&& this._scroller.unload();this._super.unload.call(this)}});var RSFavoritesLobbyWidgetManager=function(){var a,b=RSClass.extend({_scrollerInitialValue:0,_scrollerTargetValue:0,_selectedMachineIndex:0,_favoriteMachineDetails:[],_loadFromMainLobby:!0,init:function(){this._super.init.call(this)},setFavoriteMachineData:function(a){0==this._favoriteMachineDetails.length&&(this._favoriteMachineDetails=RSEngine.dataManager.getMe().getFavoriteMachines(a));this._machineLoaded=!1},getFavoriteMachineData:function(a){return this._favoriteMachineDetails},setFavMachineLoaded:function(a){this._isFavMachineLoaded= a},checkIsFavMachineLoaded:function(){return this._isFavMachineLoaded},InitializeDefaultScrollerParams:function(a){this._scrollerTargetValue=a.targetPosition;this._scrollerInitialValue=a.noOfCellsToMove;this.setAutoScrollParams(a)},setFavLobbySelectedIndex:function(a,b){this._scrollerTargetValue=this._selectedMachineIndex=a;this.calculateScrollerInitialIndex(b)},setAutoScrollParams:function(a){this._autoScrollParams=a},getAutoScrollParams:function(){return this._autoScrollParams},setSelectedMachineIndex:function(a){this._selectedMachineIndex= a},getSelectedMachineIndex:function(){return this._selectedMachineIndex},getSlotsLobbyTargetIndex:function(){return this._scrollerTargetValue},getSlotsLobbyFromIndex:function(){return this._scrollerInitialValue},calculateScrollerInitialIndex:function(a){a=a.noOfCellsToMove;var b=this.getFavoriteMachineData().length;this._scrollerInitialValue=0;50<this._scrollerTargetValue/b*100?(this._scrollerInitialValue=this._scrollerTargetValue-a,0>this._scrollerInitialValue&&(this._scrollerInitialValue=0),this._scrollerTargetValue> b&&(this._scrollerTargetValue=b)):(this._scrollerInitialValue=this._scrollerTargetValue+a,this._scrollerInitialValue>b&&(this._scrollerInitialValue=b),0>this._scrollerTargetValue&&(this._scrollerTargetValue=0))},getMachineDataForID:function(a){for(var b in this._favoriteMachineDetails)if(this._favoriteMachineDetails[b].machine_identifier==a)return this._favoriteMachineDetails[b];return 0},unloadSlotsLobby:function(){this._favoriteMachineDetails=[]},jackpotLoungeMachineSelectPopupCallBack:function(a, b){this._machineLoaded||("regular"==a?(this._machineLoaded=b.gameType!==CasinoExternalGameType.INTERNAL?RSEngine.loginMode!==LOGIN_MODE.GUEST:!0,RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Slots,b instanceof Object?b.machine_identifier:b,RSGameScreens.SlotsLobby)):"jackpot"==a&&(RSEngine.loginMode!=LOGIN_MODE.GUEST?(this._machineLoaded=!0,RSEngine.audioManager.stopMusic(),RSCasinoManager.triggerMachineEvent("player_action_session_start","jackpot_popup",b.jackpotLoungeName.split("Lounge")[0].toLowerCase()), RSGame.getInstance().getGameManager().loadJackpotLounge(b.machine_identifier,b.screenName,b.jackpotLoungeName,!0,RSGame.getInstance().getGameManager().getJLBetSelectIconPath()+b.imageName,"lounge",this._popupClosed.bind(this))):(this._machineLoaded=!1,RSEngine.dataManager.getMe().setGuestUserDataForKey("PopupName","FbConnectPopup"),RSGame.getInstance().getGameManager().showLoginPopup("feature","VIPPopup"))))},_popupClosed:function(){this._machineLoaded=GlobalVars.isjackpotLoaded=!1}});return{getInstance:function(){a|| (a=new b);return a}}}();var UrlNotificationRewardPopupForGuestPLayers=RSGenericPopup.extend({init:function(a,b){var c=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(c);this._titleTextEnergy=this._titleText=this._powerupIcon=null;this._messages=a;this._energyAwared=this._coinAwarded=0;this._coinIcon=this._heading=this._subHeading=null;RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("NotificationRewardPopUpForGuestPlayers"),"UrlNotifcationRewardPopupForGuestPlayersFontConfig.json"); this._assetList=[{name:RSGame.getInstance().getAssetPath("NotificationRewardPopUpForGuestPlayers"),count:1}];c={font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold")};this._super.init.call(this,b,c);this.setRewardValues()},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},setRewardValues:function(){this._coinAwarded=parseInt(UrlNotificationManager.getInstance()._rewardVO.coins);this._energyAwared=parseInt(UrlNotificationManager.getInstance()._rewardVO.powerup)}, onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.addChild(this._diplayPanel);console.log("Added GIfting reward popup for guest players");this._coinAwarded&&this._energyAwared?(this._doubleBox.setVisible(!0),this._singleBox.setVisible(!1),this._coinIcon.setVisible(!0),this._powerupIcon.setVisible(!0),this._titleText.setString(RSUtils.formatNumber(Number(this._coinAwarded),3)),this._titleTextEnergy.setString(RSUtils.formatNumber(Number(this._energyAwared)))):this._coinAwarded? (this._coinIcon2.setVisible(!0),this._titleText2.setString(RSUtils.formatNumber(Number(this._coinAwarded),3))):this._energyAwared&&(this._powerupIcon2.setVisible(!0),this._titleTextEnergy2.setString(RSUtils.formatNumber(Number(this._energyAwared))))},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CombinationsRewardBg":this._doubleBox=a;this._doubleBox.setVisible(!1);break;case "SingleRewardBg":this._singleBox=a;this._singleBox.setVisible(!0);break; case "CombinationsCoin":this._coinIcon=a;this._coinIcon.setVisible(!1);break;case "CombinationsEnergy":this._powerupIcon=a;this._powerupIcon.setVisible(!1);break;case "SingleCoin":this._coinIcon2=a;this._coinIcon2.setVisible(!1);break;case "SingleEnergy":this._powerupIcon2=a;this._powerupIcon2.setVisible(!1);break;case "MediumBtn":case "LargeBtn":case "CollectBtn":this._continueButton=a;this._coinPoint=new RSPoint(c.x,c.y);break;case "CloseBtn":this._closeButton=a;break;case "Coin":this._coinIcon= a;0<!this._coinAwarded&&this._coinIcon.setVisible(!1);break;case "Energy":this._powerupIcon=a;0<!this._energyAwared&&this._powerupIcon.setVisible(!1);break;case "RewardText":this._rewardText=a,"xp_blast"==UrlNotificationManager.getInstance()._rewardVO.opt_value2&&(this._rewardText.setVisible(!1),this._titleText1=new RSLabelBMFont("You've activated Double XP!",RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","bold"),-1,kTEXT_ALIGNMENT_LEFT),this.addChild(this._titleText1))}},createCustomObject:function(a, b){switch(b.name){case "CombinationsCoinValue":if(isNaN(this._coinAwarded)||0>=this._coinAwarded)return;this._titleText=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(this._titleText);break;case "Value":case "SingleCoinValue":if(isNaN(this._coinAwarded)||0>=this._coinAwarded)return;this._titleText2=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(this._titleText2);break;case "Value1":case "SingleEnergyValue":if(isNaN(this._energyAwared)||0>=this._energyAwared)return; this._titleTextEnergy2=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(this._titleTextEnergy2);break;case "CombinationsEnergyValue":if(isNaN(this._energyAwared))return;this._titleTextEnergy=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(this._titleTextEnergy);break;case "Heading":this._heading=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(this._heading);this._heading.setString("SPECIAL REWARD");break;case "SubHeading":this._subHeading=RSPlatformFontAssetManager.createCustomLabel("", b),this.addChild(this._subHeading),this._subHeading.setString(this._messages.messageBodyAvailable)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":case "CP_Button_T1":case "CollectBtn":this._continueButton&&this._continueButton.setTouchEnabled(!1),this._closeButton&&this._closeButton.setTouchEnabled(!1),RSEngine.screenManager.addOverlay(),isNaN(this._energyAwared),this.onCoinUpdate()}},onCoinUpdate:function(){RSEngine.screenManager.removeOverlay(); 0<this._coinAwarded?RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(this._coinPoint,this._diplayPanel,this._onCoinAnimComplete.bind(this)):this._onCoinAnimComplete()},_onCoinAnimComplete:function(){RSCasinoManager.addPrimaryCurrencyForDisplay("gift_reward",this._coinAwarded,!0);this.closePopup()}});var RSAnimButton=RSButton.extend({init:function(a,b,c){this._buttonAlphaDraw=this._labelColor=this._ccChildArray=this._labelLayoutObj=this._labelFont=this._labelString=this._label=this._animation=this._animProps=this._spriteName=this._textureId=this._ccObject=this._buttonAlphaClipping=this._scale9Rect=this._scale9Sprite=null;this._layerBrightColor=new RSColor(255,255,255,50);this._layerDarkColor=new RSColor(0,0,0,75);this._baseRect=this._buttonState=this._currentBrightness=null;this._super.init.call(this); this._ccChildArray=[];this._animation={};this._animProps={hover:{scale:1,animSpd:1,animLoop:-1},click:{scale:1,animSpd:1,animLoop:-1},enable:{scale:1,animSpd:1,animLoop:-1},disable:{scale:1,animSpd:1,animLoop:-1}};this._objectData=a;c?this.loadButtonFromLayout(c):b&&this.applyTexture(b,a);RSUtils.setObjectDefaults(this,a);this.setTouchEnabled(!0)},setButtonLabel:function(a,b,c){b=b||this._labelFont;c=c||this._labelColor;null==a&&(a=this._labelString);b==this._labelFont&&this._label?(a!=this._labelString&& this._label.setString(a),c!=this._labelColor&&(this._label.setFontColor(c.getR(),c.getG(),c.getB(),c.getA()),this._labelColor=c)):(this._disposeBMLabel(),this._labelString=a,this._labelFont=b,this._labelColor=c,this._initLabel());this._labelString=a;this._labelFont=b;this._labelColor=c},_initLabel:function(){null!=this._labelString&&null!=this._labelFont&&this._labelLayoutObj&&(this._label=new RSScaledLabel(this._labelString,this._labelFont,this._labelLayoutObj,kTEXT_ALIGNMENT_CENTER),this._label.setPosition(0, 0),this._labelColor&&this._label.setFontColor(this._labelColor.getR(),this._labelColor.getG(),this._labelColor.getB(),this._labelColor.getA()),this.addChild(this._label),this._compensateLabelWarping())},_disposeBMLabel:function(){this._label&&(this.removeChild(this._label,!0),this._label=null)},applyTexture:function(a,b){var c=b.name,d=RSUtils.getTextureData(a,c+"/"+c+"_00.png");d&&(this.setTexture(a,c),this._textureId=d.id,this._spriteName=d.name);this._baseRect=b},setButtonAnim:function(a,b,c,d, e){b&&(this._animation[a]=b,b.removeTouchListener(),b.setVisible(!1),b.stopAnimation());a=this._animProps[a];null!=d&&(a.animLoop=d);null!=e&&(a.animSpd=e);null!=c&&(a.scale=c)},getButtonAnim:function(a){return this._animation[a]},loadButtonFromLayout:function(a){this._loadedFromLayout=!0;this.loadLayout(a)},onObjectCreated:function(a,b,c){switch(c.type){case "Animation":switch(c.name){case RSAnimButton.STATE.CLICK:case RSAnimButton.STATE.ENABLE:case RSAnimButton.STATE.DISABLE:case RSAnimButton.STATE.HOVER:this.setButtonAnim(c.name, a,1)}break;case "Button":switch(c.name){case "Base":this.removeChild(a,!0),this.applyTexture(b,c)}}this._super.onObjectCreated.apply(this,arguments)},createCustomObject:function(a,b){switch(b.type){case "Label":"BtnLabel"==b.name&&(this._labelLayoutObj=b,this._initLabel());break;case "Rect":"Scale9Rect"==b.name&&this.setScale9Rect(b.x,b.y,b.w,b.h);break;case "Base":var c=RSUtils.getTextureData(a,b.name+".png");this._ccObject.loadTextureNormal(c.name,ccui.Widget.PLIST_TEXTURE);this._ccObject.setZoomScale(0); this._baseRect=b;this._spriteName=c.name;break;default:this._super.createCustomObject.apply(this,arguments)}},setScale9Rect:function(a,b,c,d){4==arguments.length?(this._ccObject.setScale9Enabled(!0),this._scale9Rect=new cc.Rect(a/2,b/2,c/2,d/2),this._ccObject.setCapInsets(this._scale9Rect)):this._ccObject.setScale9Enabled(!1)},onLayoutCompleted:function(){this._super.onLayoutCompleted.apply(this,arguments);this._touchEnabled?this.playOnEnabledAnim():this.playOnDisabledAnim();this._adjustPositionOffsets(); this._initScale9Mask()},_adjustPositionOffsets:function(){if(this._baseRect){var a=this._baseRect.w/2-this._baseRect.x,b=this._baseRect.h/2-this._baseRect.y;if(this._children)for(var c=this._children.length-1;0<=c;c--){var d=this._children[c],e=d.getPosition();d.setPosition(e.getX()+a,e.getY()+b)}for(c=this._ccChildArray.length-1;0<=c;c--)d=this._ccChildArray[c],e=d.getPosition(),d.setPosition(e.x+a,e.y+b);this._labelLayoutObj.x+=a;this._labelLayoutObj.y+=b;this._baseRect.x+=a;this._baseRect.y+=b; this._scale9Rect&&this.setScale9Rect(2*this._scale9Rect.x+a,2*this._scale9Rect.y+b,2*this._scale9Rect.width,2*this._scale9Rect.height)}},addCCObjChild:function(a){this._ccChildArray.push(a);this._ccObject.addChild(a)},_initScale9Mask:function(){this._scale9Rect&&this._spriteName&&(this._scale9Sprite=new cc.Scale9Sprite(this._spriteName,this._scale9Rect),this._scale9Sprite.setPosition(this._baseRect.x,this._baseRect.y),this._buttonAlphaDraw=new RSDrawNode,this._buttonAlphaClipping=new cc.ClippingNode(this._scale9Sprite), this._buttonAlphaClipping.setAlphaThreshold(0.1),this.addCCObjChild(this._buttonAlphaClipping),this._buttonAlphaClipping.addChild(this._buttonAlphaDraw.getDisplayObject()))},_renderAlphaMask:function(a){var b=this._ccObject.getContentSize();this._scale9Sprite.setContentSize(b);this._scale9Sprite.setPosition(b.width/2,b.height/2);this._buttonAlphaClipping.setStencil(this._scale9Sprite);this._buttonAlphaDraw.drawRect(new RSPoint(0,0),new RSPoint(b.width+this._baseRect.x,b.height+this._baseRect.y),a)}, setBrightness:function(a){this._currentBrightness!=a&&(this._buttonAlphaDraw?(this._buttonAlphaDraw.clearNode(),a!=RSAnimButton.BRIGHT.NORM&&(a==RSAnimButton.BRIGHT.LIGHT?this._renderAlphaMask(this._layerBrightColor):this._renderAlphaMask(this._layerDarkColor)),this._ccObject.setBright(!0),this._ccObject.setHighlighted(!1)):(this._ccObject.setBright(a!=RSAnimButton.BRIGHT.DARK),this._ccObject.setHighlighted(a==RSAnimButton.BRIGHT.LIGHT)),this._currentBrightness=a)},_setBaseVisibility:function(a){this._buttonAlphaDraw&& this._buttonAlphaDraw.setVisible(a);a?this.setOpacity(255):this.setOpacity(0)},_checkAndPlayAnim:function(a,b){this.stopAllButtonAnims();b?(this._setBaseVisibility(!1),b.playAnimation(a.animLoop,a.animSpd),b.setVisible(!0),b.setScale(a.scale)):this._setBaseScale(a.scale)},_setBaseScale:function(a){this.setScale(a)},_compensateLabelWarping:function(){if(this._label){var a=this._ccObject.getContentSize(),b=a.width/this._baseRect.w,a=a.height/this._baseRect.h,c=this._labelLayoutObj;this._label.rescaleToRect({x:c.x* b,y:c.y*a,w:c.w*b,h:c.h*a})}},setButtonSize:function(a,b){this._ccObject.setContentSize(a,b);this._compensateLabelWarping()},setSelected:function(a){this.setTouchEnabled(!a);a?this.setBrightness(RSAnimButton.BRIGHT.DARK):this.setBrightness(RSAnimButton.BRIGHT.NORM)},playOnRollInAnim:function(){var a=RSAnimButton.STATE.HOVER;this._checkAndPlayAnim(this._animProps[a],this._animation[a]);this.setBrightness(RSAnimButton.BRIGHT.LIGHT);this.setClickPointer()},playOnRollOutAnim:function(){this.setDefaultPointer(); this.playOnEnabledAnim()},playOnEnabledAnim:function(){var a=RSAnimButton.STATE.ENABLE;this._checkAndPlayAnim(this._animProps[a],this._animation[a]);this.setBrightness(RSAnimButton.BRIGHT.NORM)},playOnClickAnim:function(){var a=RSAnimButton.STATE.CLICK;this._checkAndPlayAnim(this._animProps[a],this._animation[a]);this.setClickPointer();this.setBrightness(RSAnimButton.BRIGHT.LIGHT)},playOnDisabledAnim:function(){var a=RSAnimButton.STATE.DISABLE;this._checkAndPlayAnim(this._animProps[a],this._animation[a]); this.setBrightness(RSAnimButton.BRIGHT.DARK)},setDefaultPointer:function(){cc.$("#gameCanvas").style.cursor="default"},setClickPointer:function(){cc.$("#gameCanvas").style.cursor="pointer"},addMoveListener:function(){var a=this;null!=this._moveOnEventListener&&(cc.eventManager.removeListener(this._moveOnEventListener),this._moveOnEventListener=null);null!=this._moveOutEventListener&&(cc.eventManager.removeListener(this._moveOutEventListener),this._moveOutEventListener=null,cc.$("#gameCanvas").style.cursor= "default");this._moveOnEventListener=cc.eventManager.addListener({event:cc.EventListener.MOUSE,onMouseMove:function(b){if(a.isVisible()&&a.isTouchEnabled()){var c=b.getCurrentTarget();b=c.convertToNodeSpace(b.getLocation());c=c.getContentSize();c=cc.rect(0,0,c.width,c.height);if(cc.rectContainsPoint(c,b))return a._buttonState==RSAnimButton.STATE.CLICK?a._touchBegan():a._buttonState!=RSAnimButton.STATE.HOVER&&(a._buttonState=RSAnimButton.STATE.HOVER,a.playOnRollInAnim()),a.addMoveOutListener(),!0}}}, this._ccObject)},addMoveOutListener:function(){var a=this;null==this._moveOutEventListener&&(this._moveOutEventListener=cc.eventManager.addListener({event:cc.EventListener.MOUSE,onMouseMove:function(b){var c=b.getCurrentTarget();b=c.convertToNodeSpace(b.getLocation());c=c.getContentSize();c=cc.rect(0,0,c.width,c.height);if(!cc.rectContainsPoint(c,b))return a._touchEndOrHover(),cc.eventManager.removeListener(a._moveOutEventListener),a._moveOutEventListener=null,!0}},this._ccObject))},setTouchEnabled:function(a){this._super.setTouchEnabled.apply(this, arguments);this._currentBrightness=null;a?this.playOnEnabledAnim():this.playOnDisabledAnim()},handleObjectTouchEndAt:function(a,b,c){this.handleButtonClick(this.getDisplayObject(),ccui.Widget.TOUCH_ENDED)},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchAt:function(a,b,c){this.handleButtonClick(this.getDisplayObject(),ccui.Widget.TOUCH_BEGAN)},handleButtonClick:function(a,b){switch(b){case ccui.Widget.TOUCH_BEGAN:this._touchBegan();break;case ccui.Widget.TOUCH_CANCELED:case ccui.Widget.TOUCH_ENDED:this._touchEndOrHover()}this._super.handleButtonClick.apply(this, arguments)},_touchBegan:function(){this._buttonState!=RSAnimButton.STATE.CLICK&&(this._buttonState=RSAnimButton.STATE.CLICK,this.playOnClickAnim())},_touchEndOrHover:function(){this._buttonState!=RSAnimButton.STATE.ENABLE&&(this._buttonState=RSAnimButton.STATE.ENABLE,this.playOnRollOutAnim())},stopAllButtonAnims:function(){this._setBaseVisibility(!0);for(var a in this._animation)if(this._animation.hasOwnProperty(a)){var b=this._animation[a];b.stopAnimation();b.setVisible(!1)}},unload:function(){this._super.unload.apply(this, arguments);this._animation=null;this._scale9Sprite&&this._scale9Sprite.cleanup()}});RSAnimButton.STATE={HOVER:"hover",CLICK:"click",ENABLE:"enable",DISABLE:"disable"};RSAnimButton.BRIGHT={NORM:0,LIGHT:1,DARK:2};var CasinoScreenFactory=ScreenFactory.extend({init:function(){this._super.init.call(this)},getSubLobby:function(a){if(null!=a&&void 0!=a&&NaN!=a)switch(a){case RSGameScreens.SlotsLobby:return this.getSlotsSubLobby();case RSGameScreens.PokerLobby:return this.getPokerSubLobby();case RSGameScreens.BlackJackLobby:return this.getTableGamesSubLobby();case RSGameScreens.KenoLobby:return this.getKenoSubLobby();case RSGameScreens.KenoBingoLobby:return this.getKenoBingoSubLobby();case RSGameScreens.ScratcherLobby:return this.getScratcherSubLobby(); case RSGameScreens.TableGamesLobby:return this.getTableGamesSubLobby();case RSGameScreens.FavoritesLobby:return this.getFavoritesSubLobby()}},getLoadingScreen:function(){return new CasinoLoadingScreen(RSGame.getInstance().getAssetPath("LoadingScreen"))},getMainLobbyScreen:function(){return new MainLobby},getSlotsSubLobby:function(){return new CasinoSlotsLobby},getPokerSubLobby:function(){return new CasinoPokerLobby},getKenoSubLobby:function(){return new KenoSubLobby},getKenoBingoSubLobby:function(){return new KenoSubLobby}, getScratcherSubLobby:function(){return new ScratcherSubLobby},getFavoritesSubLobby:function(){return new RSFavoritesLobby},getTableGamesSubLobby:function(){return new TableGamesSubLobby}});CasinoOpenGraphID={MachineUnlock:"machine_unlock",Millionaire:"be_a_millionaire",BingoWin:"bingo_round_over",PokerWin:"top_3_hands_in_videopoker",BlackjackHit:"blackjack_win",BigWin:"get_bigwin"}; var MachineGiftingConfig={},CasinoGameManager=RSGameManager.extend({init:function(){this._super.init.call(this);this._levelupReward=0;RSNetworkManager.getInstance().setDelegate(this);RSNetworkManager.getInstance().enableNetworkCheck(!1,4E4);this._LSBonusSheet=null;RSEventManager.getInstance().addEventListener(RSEvents.closeFullScreen,this,this.closeFullScreen.bind(this));RSEventManager.getInstance().addEventListener(RSEvents.onFullScreenChange,this,this.onFullScreenchange.bind(this));MachineGiftingConfig.fontName= this.getDefaultCasinoFont("large","Semibold");MachineGiftingConfig.titleFontName=this.getDefaultCasinoFont("extralargeDrkBlue","black");MachineGiftingConfig.assetFolder="res/PlatformWidgets/G2PGifting/";MachineGiftingConfig.giftingTimerFont=this.getNumberFontWithoutGlow("large","bold");RSEngine.setPopupBackgroundOpacity(GameConfig.customBGOpacity?GameConfig.customBGOpacity:180);this._jackpotLoungeSurfacingCompleteCallBack=this._curtainRaiserCompleteCallBack=this._curtainRaiserScreenPlayCallBack=this._curtainRaiserScreen= this._rewardDetails=this._previewList=null;this.forceTriggerDailyQuestPopup=!1;this._lastAwardedLevelBonus=this._lastAwardedPiggyBonus=0;this._automaticTrayOpenStatus=this._tournamentSurfacingActiveStatus=!1;this._mainLobbyMusicTimer=null;this._VIPStarRotationStartStatus=!1;this._vipStarRotateTimer=null;this.isJLLoadFromSlots=this._onboardingFirstSession=!1;RSEventManager.getInstance().addEventListener(RSVIPTierUpEvent,this,this.setVIPStatus.bind(this,!0));RSEventManager.getInstance().addEventListener(RSQuestCompleted, this,this.triggerDailyQuestPopup.bind(this));RSEventManager.getInstance().addEventListener("onEventDayCapReached",this,this._onEventDayCapReached.bind(this));RSEventManager.getInstance().addEventListener("onEventSessionCapReached",this,this._onEventSessionCapReached.bind(this))},triggerDailyQuestPopup:function(a){var b=RSGame.getInstance().getGameData().getDefaultValues().loginDailyQuestId;this._automaticTrayOpenStatus=!0;a._userData.questId==b&&(this.forceTriggerDailyQuestPopup=!0)},onFullScreenchange:function(a){a= a.getUserData().isFullScreen;GlobalVars.fullscreenStatus=a;RSEventManager.getInstance().dispatchEvent(settingsFullScreen,a);RSCasinoManager.getCasinoHUD().setFullScreenButtonStatus(a);if(GlobalVars.isjackpotLoaded){a=document.getElementById("Cocos2dGameContainer");var b=0.102*parseInt(a.style.height.substring(0,a.style.height.length-2))+"px",c=parseInt(a.style.width.substring(0,a.style.width.length-2))+parseInt(a.style.paddingLeft.substring(0,a.style.paddingLeft.length-2))+"px";RSEngine.externalGameManager.addClippingToExternalGame("0px", b,c,a.style.height);a=null;setTimeout(function(){RSEngine.externalGameManager.postMessageToJackpot({type:"modeChanged"})},500)}},closeFullScreen:function(){GlobalVars.fullscreenStatus=!1;RSEventManager.getInstance().dispatchEvent(settingsFullScreenClose);RSCasinoManager.getCasinoHUD().setFullScreenButtonStatus(!1)},onNoNetwork:function(){RSEventManager.getInstance().dispatchEvent("NETWORK_CONNECTION_LOST");RSEngine.screenManager.onConnectionLost()},networkConnectionActive:function(){RSEngine.screenManager.onConnectionResume(); RSGame.getInstance().getUserDataManager().saveUserBlobParams();RSEngine.popupManager.removeAllPopups();RSEngine.screenManager.removeOverlay()},getCountryTier:function(){var a=RSEngine.gameData.getSheetData("tier1Countries"),b=RSGame.getInstance().getUserDataManager().getMe().getCountryCode(),c=2,d;for(d in a)if(a[d].countryCode==b){c=1;break}return c},showBetUnlock:function(a){a||null==RSCasinoManager._customCasinoInterface._betUnlockPopup||(RSEngine.popupManager.addPopup(RSCasinoManager._customCasinoInterface._betUnlockPopup), RSCasinoManager._customCasinoInterface._betUnlockPopup=null);RSCasinoManager._customCasinoInterface._betUnlockPopup=null;this.setIsMachineUnlockActive(!1)},getUnlockedMachinesDetails:function(){for(var a=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots),b=parseInt(RSCasinoManager.getCasinoInterface().getCurrentLevelForMachineUnlock()),c=RSGame.getInstance().getLevelManager().getCurrentLevel(),d=[],e=0,f=0;f<a.length;f++)if(a[f].levelRequired>b){e=f;break}for(f=e;f<a.length;f++)parseInt(a[f].levelRequired)<= c&&d.push(a[f]);return d},callMachineUnlockedPopup:function(a){var b=this.getUnlockedMachinesDetails(),c=RSUtils.cloneJSON(b),d=this.getNextToUnlockMachines(),e=RSGame.getInstance().getGameManager().getGameType();if(0<b.length&&!GlobalVars.isjackpotLoaded&&e===RSGameTypes.Slots){this.setIsMachineUnlockActive(!0);a=new MachineUnlockPopup(b,d,this.showBetUnlock.bind(this));b=a.getScale();a.setScale(0);b=cc.scaleTo(b,b);a.setCustomAddPopupActions(b.easing(cc.easeExponentialOut()));b="[";for(d=0;d<c.length;d++)0< d&&(b+=","),b+=c[d].machine_identifier;b+="]";RSAnalyticsManager.getInstance().trackMachineUnlock("","trigger",RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName(),b);RSEngine.popupManager.addPopup(a,!1,!0)}else a&&a.call();for(d=0;d<c.length;d++)RSPlatformSDKManager.getInstance().setUserAttributeLastSlotUnlocked(c[d].machineDisplayName);c.length&&this.setUserAttributeNextSlotToBeUnlocked()},showLevelUpPopups:function(a){a=null==a?!0:a;var b=RSGame.getInstance().getLevelManager().getLevelUpList(), c=RSGame.getInstance().getLevelManager().getCurrentLevelVO();this._levelupReward=0;for(var d=!0,e=0;e<b.length;e++){if(0===b[e].level%5||2===b[e].level)d=!1;b[e].level>RSGame.getInstance().getUserDataManager().getMe().getRewardedLevel()&&(this._levelupReward+=b[e].levelBonus,this.dispatchEventForQuestOnLevelup(b[e].level))}this._triggerAdjustEventStatus=!d;GlobalVars.isjackpotLoaded&&(d=!0);c.level>RSGame.getInstance().getUserDataManager().getMe().getRewardedLevel()&&RSGame.getInstance().getUserDataManager().getMe().setRewardedLevel(c.level); var e=RSVIPManager.getInstance().getVIPUserTier(),f=RSVIPManager.getInstance().getBonusDataForLevelUp(c.level,this._levelupReward,b.length),b=RSVIPManager.getInstance().getVIPUserTier();this._levelupReward=100*Math.ceil(f._valueAwarded/100);0<this._levelupReward&&(RSGame.getInstance().getLevelManager().clearLevelUpList(),RSGame.getInstance().getLevelManager().setLevelUpTriggered(),RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.levelUp,"",{level:c.level}),this._toasterOnly=!1,d?(this._toasterOnly= !0,d={},d.Level=c.level,d.piggyBonus=RSGame.getInstance().getLevelManager().getPiggyBankBonus(),this.setLastAwardedPiggyBonus(d.piggyBonus),d[GameFeatureTypeEnum.PRIMARY_CURRENCY]=this._levelupReward,this.setLastAwardedLevelBonus(this._levelupReward),d[GameFeatureTypeEnum.SECONDARY_CURRENCY]=c.levelBonusPowerups,RSCasinoManager.addPrimaryCurrencyForDisplay("levelUp",this._levelupReward),RSGame.getInstance().getGameManager().saveLevelUpReward(d),RSCasinoManager.getCasinoHUD().showLevelupInitiated()): (d={},f={assetPath:"res/PlatformWidgets/RSLevelUpToaster/",layoutCount:2},f.fonts={FONT_CURRENCY:RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),FONT_LEVEL:RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold"),FONT_REWARD:RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),FONT_BETTEXT:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold"),FONT_COLOR:{r:255,g:255,b:255,a:255},REWARD_FONT_ALIGNMENT:kTEXT_ALIGNMENT_CENTER}, f.emitterSprites=this.getEmitterFrames(),d.level=c.level,d.piggyBonus=RSGame.getInstance().getLevelManager().getPiggyBankBonus(),this.setLastAwardedPiggyBonus(d.piggyBonus),d.PrimaryReward=this._levelupReward,this.setLastAwardedLevelBonus(this._levelupReward),GlobalVars.showLevelUpPopup=!1,RSEngine.popupManager.addPopup(new RSLevelUpToaster(f,d,this.onLevelupClose.bind(this,d.PrimaryReward)),!1),f=(f=RSEngine.gameData.getAppsFlyerValues())&&f.withinDaysConditionForEvent2_4_6?parseInt(f.withinDaysConditionForEvent2_4_6): 3,RSPlacementManager.getInstance().getNumberOfDays()<=f&&GameConfig.IS_APPSFLYER_ENABLED&&RSEngine.loginMode!=LOGIN_MODE.GUEST&&10<=d.level&&15>d.level&&!RSGame.getInstance().getUserDataManager().getMe().getAppsFlayerEventStatus("event3")&&(RSAppsFlyerManager.getInstance().trackEvent("event3"),RSGame.getInstance().getUserDataManager().getMe().setAppsFlayerEvents("event3"))),GameConfig.IS_ADJUST_ENABLED&&RSEngine.loginMode!=LOGIN_MODE.GUEST&&this._triggerAdjustEventStatus&&(10<=c.level&&15>c.level? RSAdjustManager.getInstance().trackEvent(RSAdjustEventToken.Levelup10):20<=c.level&&25>c.level?RSAdjustManager.getInstance().trackEvent(RSAdjustEventToken.Levelup20):25<=c.level&&30>c.level?RSAdjustManager.getInstance().trackEvent(RSAdjustEventToken.Levelup25):30<=c.level&&35>c.level?RSAdjustManager.getInstance().trackEvent(RSAdjustEventToken.Levelup30):35<=c.level&&40>c.level?RSAdjustManager.getInstance().trackEvent(RSAdjustEventToken.Levelup35):40<=c.level&&45>c.level&&RSAdjustManager.getInstance().trackEvent(RSAdjustEventToken.Levelup40)), RSGame.getInstance().getUserDataManager().getMe().setGuestUserDataForKey("level",c.level));a&&b>e&&(0==e&&GameConfig.LM_AND_VIP_SURFACING?this.showIntroScreenForLMAndVIP(!0,!1):GlobalVars.isjackpotLoaded||RSEngine.popupManager.addPopup(new VIPWelcomePopup(b,!1,!0)))},onLevelupClose:function(a){},updateLevelUpReward:function(a){"guest"!=RSEngine.loginMode&&(RSCasinoManager.addPrimaryCurrencyForDisplay("level_up",a[GameFeatureTypeEnum.PRIMARY_CURRENCY]),"undefined"!==typeof a[GameFeatureTypeEnum.SECONDARY_CURRENCY]&& RSCasinoManager.addSecondaryCurrencyForDisplay(a[GameFeatureTypeEnum.SECONDARY_CURRENCY]))},saveLevelUpReward:function(a){this._rewardDetails=a;"guest"!=RSEngine.loginMode?RSGame.getInstance().getUserDataManager().saveLevelBonusDetails(this._rewardDetails,this.levelBonusUpdated.bind(this),this.levelBonusUpdateFailed.bind(this)):RSCasinoManager.addPrimaryCurrency(this._rewardDetails[GameFeatureTypeEnum.PRIMARY_CURRENCY]+this._rewardDetails.piggyBonus)},levelBonusUpdated:function(a){if("success"==a.result.status){RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free, "level_up",a.result.rewards.coins,"",a.result.rewards.Level);var b=0,b=this._toasterOnly?RSGame.getInstance().getUserDataManager().getMe().getCoins()+a.result.rewards.piggyBonus:RSGame.getInstance().getUserDataManager().getMe().getCoins()+a.result.rewards.coins+a.result.rewards.piggyBonus;RSEngine.externalGameManager.updateCoin(b);RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"piggy_bank",a.result.rewards.piggyBonus,"",a.result.rewards.Level)}},levelBonusUpdateFailed:function(a){this.saveLevelUpReward(this._rewardDetails)}, dispatchEventForQuestOnLevelup:function(a){RSEventManager.getInstance().dispatchEvent(RSGeneralQuestEventKeys.LEVEL_UP_ACTION,a)},showLoginPopup:function(a,b){null!=b&&RSGame.getInstance().getUserDataManager().getMe().setGuestUserDataForKey("PopupName",b);var c=parseInt(RSEngine.gameData.getDefaultValues().emailReward);RSEngine.popupManager.addPopup(new RSSingleSignOnPopup(c),!0)},onPlatformSDKManagerCallback:function(a,b){if(RSEngine.loginMode==LOGIN_MODE.GUEST)return!0;switch(a){case "popup":switch(b){case "PURCHASE_CART":RSSaleManager.getInstance().getPurchaseCartSaleStatus()&& PurchaseFlowManager.getInstance().setShowPurchaseCart(!1);RSSaleManager.getInstance().showPurchaseCart();break;case "LTEM_SALE":RSSaleManager.getInstance().getPurchaseCartSaleStatus()?(PurchaseFlowManager.getInstance().setShowPurchaseCart(!1),RSSaleManager.getInstance().showPurchaseCart()):RSSaleManager.getInstance().showSalePopup(!1);break;case "SHOW_SUB_SALE":RSSubscrptionSaleManager.showSubscriptionSalePopup();break;case "TRAnnouncementPopup":RSTournamentManager.onTournamentBtnClicked(!0)}break; case "url_reward":case "xp_blast":UrlNotificationManager.getInstance().trackUrlRewardNotification(b,!0);break;case "navigate":this._navigateToLobby=b,this.getApprovalForNavigation()}},showPurchaseCartAfterSalePopupClose:function(a){!1==PurchaseFlowManager.getInstance().getShowPurchaseCart()&&PurchaseFlowManager.getInstance().setShowPurchaseCart(!0)},onPurchaseCartClosed:function(){RSEventManager.getInstance().dispatchEvent("onPurchaseCartClosed",{})},showSalesPopup:function(){GlobalVars.isPurchaseEnabled? RSSaleManager.getInstance().getSaleActiveStatus()&&RSSaleManager.getInstance().showSalePopup(!1):VideoManager.getInstance().showVideoPopup("ReplacePurchase",!1,"purchase_cart")},getApprovalForNavigation:function(){RSGame.getInstance().getGameManager().getGameType()==RSGameTypes.Bingo&&RSEngine.externalGameManager.isInGameBackButtonActive()?(GlobalVars.isLeanplumNavigation=!0,RSEngine.externalGameManager.triggerEventOnBackButtonClick()):this.platformSDKScreenNavigation(this._navigateToLobby)},callScreenNavigation:function(){this._navigateToLobby&& this.platformSDKScreenNavigation(this._navigateToLobby)},platformSDKScreenNavigation:function(a){var b="",c="",d=!1;switch(a){case "X_VS":if(RSEngine.dataManager.getMe().getJLSurfacingShown())b=RSGameScreens.Machine,d=!0;else return;break;case "SLOTS_LOBBY":b=RSGameScreens.SlotsLobby;c=RSGameTypes.Slots;break;case "kenobingo_lobby":case "BINGO_LOBBY":case "KENO_LOBBY":b=RSGameScreens.KenoBingoLobby;c=RSGameTypes.Bingo;break;case "BLACKJACK_LOBBY":b=RSGameScreens.BlackJackLobby;c=RSGameTypes.Blackjack; break;case "POKER_LOBBY":b=RSGameScreens.PokerLobby;c=RSGameTypes.Poker;break;case "MAIN_LOBBY":b=RSGameScreens.MainLobby;break;case "BIHOURLY_BONUS":b=RSGameScreens.MainLobby;break;case "SCRATCHER_LOBBY":b=RSGameScreens.ScratcherLobby;c=RSGameTypes.Scratcher;break;case "FAVORITES_LOBBY":b=RSGameScreens.FavoritesLobby;c=RSGameTypes.Slots;break;case "TABLEGAMES_LOBBY":b=RSGameScreens.TableGamesLobby,c=RSGameTypes.Blackjack}if(d){if(RSGameScreenManager.getInstance().getCurrentScreen()!=b||"X_VS"!=RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName())this._machineData= RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Scorebox),GlobalVars.scoreboxRedirection=!0,RSGame.getInstance().getGameManager().loadJackpotLounge(this._machineData[0].machine_identifier,this._machineData[0].machineDisplayName,this._machineData[0].jackpotLoungeName,!1,null,"play",null)}else RSGameScreenManager.getInstance().getCurrentScreen()!=b&&(RSGameScreenManager.getInstance().setCurrentLobbyName(RSGameScreenManager.getInstance().getCurrentScreen()),""!=b&&(this.removeScreensForNavigation(), RSGameScreenManager.getInstance().loadScreen(b)),""!=c&&RSGame.getInstance().getGameManager().setGameType(c))},removeScreensForNavigation:function(){GlobalVars.isjackpotLoaded&&(GlobalVars.isjackpotLoaded=!1,RSEngine.externalGameManager.postMessageToJackpot("jackpotCustomInterfaceCalls",{type:"disconnectJackpot"}));GlobalVars.isTournamentLoaded&&(GlobalVars.isInsideTournament=!1,GlobalVars.isTournamentLoaded=!1);RSCasinoManager.getCasinoHUD().checkSessionStopEvent();for(RSEngine.externalGameManager.unLoadExternalGame();1< RSGameScreenManager.getInstance()._screens.length;)RSGameScreenManager.getInstance()._screens.pop()},getOgUnlockAssetPath:function(){return GameConfig.BASE_URL},isPreview:function(a,b){if(b)for(var c in b){if(b[c].machine_identifier==a)return this._previewList=b,!0}else for(c in this._previewList)if(this._previewList[c].machine_identifier==a)return!0;if(GlobalVars.featuredMachines)for(c in GlobalVars.featuredMachines)if(GlobalVars.featuredMachines[c].machine_identifier==a)return!0;return!1},loadTournament:function(a){a= a?a:RSAnalyticsManager.getInstance().getCurrentMachineName();GlobalVars.isjackpotLoaded&&(GlobalVars.isjackpotLoaded=!1,RSGameScreenManager.getInstance().setPreviousScreen(RSGameScreens.MainLobby),RSGameScreenManager.getInstance().removeAllScreensExceptMainLobby());RSTournamentManager.getAnnouncementPopupStatus()?RSAnalyticsManager.getInstance().trackPlayerAction("tournamania_enter","click","open_from_tournamania_announcement",RSTournamentManager.getTournamentMachineId(),""):RSAnalyticsManager.getInstance().trackPlayerAction("tournamania_enter", "click","open_from_"+a,RSTournamentManager.getTournamentMachineId(),"");GlobalVars.isTournamentLoaded=!0;GlobalVars.isFirstSpinOnMachine=!0;SideMenuController.getInstance().setSideMenuVisibility(!1);RSGame.getInstance().getGameManager().disableMachineOpenPopup();RSEngine.audioManager.stopMusic();RSEngine.audioManager.stopAllEffects();RSEngine.externalGameManager.unLoadExternalGame();RSCasinoManager._HUD=null;RSCasinoManager.setCasinoHUD(this.getCasinoHUD());RSGame.getInstance().getGameManager().setGameType(RSGameTypes.Slots); RSGame.getInstance().getGameManager().showOverlayLayer();a={vo:GlobalVars.voiceCalloutsStatus,music:GlobalVars.musicStatus,effect:GlobalVars.sfxStatus};a=JSON.stringify(a);var b={_gameType:"slots"};b.machine_identifier=" "!=RSTournamentManager.getTournamentMachineId()?RSTournamentManager.getTournamentMachineId():"S_DLN";var c=RSGame.getInstance().getGameData().getMachineDetails(b._gameType,b.machine_identifier);b._screenName=c.screenName.split("Machine")[0];c=this._getHashValue(b._screenName,String(TimeManager.getInstance().getCurrentServerTime()), RSEngine.dataManager.getMe().getCoins(),RSEngine.dataManager.getMe().getId());RSAnalyticsManager.getInstance().setCurrentMachineAnalyticsName(b.machine_identifier);b._gameURL=GameConfig.TOURNAMENT_URL+b._screenName+"\x26machineType\x3dSLOTS\x26layout\x3diPhone5\x26orientation\x3dLandscape\x26dualOrientation\x3dfalse\x26casino\x3dFoxPlayCasino\x26userID\x3d"+RSEngine.dataManager.getMe().getId()+"\x26timeStamp\x3d"+String(TimeManager.getInstance().getCurrentServerTime())+"\x26coins\x3d"+RSEngine.dataManager.getMe().getCoins()+ "\x26hashValue\x3d"+c+"\x26volume\x3d"+a+"\x26platform\x3dcanvas";RSGameScreenManager.getInstance().loadExternalGame(b)},setFeaturedAndPreviewMachinesInSlots:function(){GlobalVars.featuredMachines=[];GlobalVars.featuredMachines=this.getFeaturedMachinesList()},loadPreviousScreen:function(){GlobalVars.backFromGamePlayScreen=!0;RSGameScreenManager.getInstance().loadPreviousScreen();RSGame.getInstance().getGameManager().setSideMenuVisibility(!0)},triggerCurtainRaiserScreen:function(a){this.getDCUnlockStatus()&& (this.introScreenComplete=a,this.showDCUnlockScreen())},showDCUnlockScreen:function(){URLConfig.CLEVERTAP_ENABLED&&0==RSQuestManager.getInstance().getNumCompletedQuests()&&RSPlatformSDKManager.getInstance().setUserAttributeDQRewardPending(!1);GlobalVars.isSurfacingActive=!0;RSEngine.audioManager.setMusicVolume(0.2);this.curtainScreen=new RSDailyQuestIntroScreen(this.onCurtainAnimCompleteDQ.bind(this));RSEngine.screenManager.addScreen(this.curtainScreen);RSGame.getInstance().getGameManager().setSideMenuVisibility(!1)}, onCurtainAnimCompleteDQ:function(a){RSEngine.screenManager.removeScreen(this.curtainScreen);RSEngine.audioManager.setMusicVolume(1);RSQuestManager.getInstance().setQuestEnabledStatus();RSEventManager.getInstance().dispatchEvent(RSGeneralQuestEventKeys.DAILY_LOGIN_ACTION,1);this.introScreenComplete&&0==a&&(GlobalVars.isDCTooltipActive=!0,RSEngine.dataManager.getMe().setDCinfoPopupShownStatus(),SideMenuController.getInstance().setSideMenuVisibility(!0),this.introScreenComplete(a));a&&RSEngine.popupManager.addPopup(new RSDailyQuestPopup(RSGame.getInstance().getAssetPath("DailyChallengePopup"), RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","bold"),this._onDCPopupClosed.bind(this)))},_onDCPopupClosed:function(a){"load_machine"!=a&&"gameplay_screen"!=RSGameScreenManager.getInstance().getCurrentScreen()&&(GlobalVars.isDCTooltipActive=!0);this.introScreenComplete&&"load_machine"==a?(GlobalVars.isDCTooltipActive=!0,this.introScreenComplete(!0)):this.introScreenComplete&&this.introScreenComplete()},showDCToolTipPopup:function(a){this._callbacktoMainlobby=a;GlobalVars.isDCTooltipActive= !0;this._toolTipPopup=new RSQuestToolTipPopup(this.onDCToolTipClose.bind(this))},onDCToolTipClose:function(){GlobalVars.isDCTooltipActive=!1;this._toolTipPopup=null;this._callbacktoMainlobby&&this._callbacktoMainlobby()},getDCUnlockStatus:function(){if(RSEngine.loginMode==LOGIN_MODE.GUEST||RSGame.getInstance().getUserDataManager().getMe().getDCinfoPopupShownStatus()||!GameConfig.QUEST_ENABLED||!RSQuestManager.getInstance().getIsQuestManagerActive()||!RSGame.getInstance().getLevelManager().getCurrentLevel()>= RSQuestManager.getInstance().questConfig[0].unlockAt||0<!RSGame.getInstance().getUserDataManager().getMe().getCurrentDay())return!1;var a=RSGame.getInstance().getUserDataManager().getMe().getDailyChallengeData().activeQuests;if(!a||!a.length)return!1;var b=0;for(b in a)if(!RSQuestManager.getInstance().getQuestSetForId(a[b].id))return!1;return!0},playButtonClickSFX:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"),!1)},setSideMenuVisibility:function(a, b){if(!b&&(RSGameScreenManager.getInstance().getCurrentScreen()==RSGameScreens.Machine&&GlobalVars.isInsideExternalGame||RSLeaderboardManager.isLeaderBoardScreenActive())||GlobalVars.isTournamentLoaded)a=!1;RSGame.getInstance().getGameManager().getGameType()==RSGameTypes.Bingo&&"gameplay_screen"==RSGameScreenManager.getInstance().getCurrentScreen()&&(a=!1);RSGame.getInstance().getGameManager().getGameType()==RSGameTypes.Roulette&&"gameplay_screen"==RSGameScreenManager.getInstance().getCurrentScreen()&& (a=!1);RSEngine.loginMode==LOGIN_MODE.GUEST&&(a=!1);GlobalVars.isLoyaltyMallLoaded&&(a=!1);GlobalVars.isMachineLoadingInProgress&&(a=!1);"undefined"!==typeof SideMenuController&&SideMenuController.getInstance().setSideMenuVisibility(a)},getDefaultCasinoFont:function(a,b){var c=RSGame.getInstance().getAssetPath("SourceSans_"+a+"_"+b);return c?c:RSGame.getInstance().getAssetPath("SourceSans_large_bold")},getDefaultCasinoFontForHeading:function(a){return(a=RSGame.getInstance().getAssetPath("SourceSans_extralargeDrkBlue_black"))? a:RSGame.getInstance().getAssetPath("SourceSans_large_black")},getPurchaseCartVipExtraCoinFont:function(){return this.getDefaultCasinoFont("mediumPCDrkBlue","Semibold")},getHUDCasinoFont:function(a,b){var c=RSGame.getInstance().getAssetPath("UbuntuMonoBold_"+a+"_"+b);return c?c:RSGame.getInstance().getAssetPath("UbuntuMonoBold_large_bold")},getNumberFontWithoutGlow:function(a,b){var c=RSGame.getInstance().getAssetPath("UbuntuMono_"+a+"_"+b);return c?c:RSGame.getInstance().getAssetPath("UbuntuMono_large_bold")}, getGenericButtonFont:function(a,b){return RSGame.getInstance().getAssetPath("SourceSans_large_bold")},getDefaultFontForDailyQuestTimerText:function(){var a=RSGame.getInstance().getAssetPath("UbuntuMono_large_bold");return a?a:this.getDefaultCasinoFont("medium","bold")},getAristocratHUD:function(){},showVIPBenefitsPopup:function(a,b){RSEngine.popupManager.addPopup(new VIPBenefitsPopup(a,null,b),!0)},getMachineUnlockOGRootFolder:function(){return"res/SlotResources/CasinoSubLobby/icons/"},getSlotMachineIconRootPath:function(){return"res/SlotResources/CasinoSubLobby/icons/"}, loadJackpotLounge:function(a,b,c,d,e,f,g){if(RSEngine.loginMode==LOGIN_MODE.GUEST)this.showLoginPopup("feature","JackpotLounge");else if(GameConfig.JACKPOT_LOUNGE_ENABLE&&GameConfig.JL_SURFACING&&!RSEngine.dataManager.getMe().getJLSurfacingShown())this.loadAfterJackpotLounge(a,b,c,d,e,f,g);else if(RSAnalyticsManager.getInstance().getCurrentScreen()!=RSGameScreens.MainLobby){var h=RSGame.getInstance().getGameManager().getGameType();this.triggerMemoryPopupStatus(h,a)&&!RSGame.getInstance().getGameManager().getIsMachineUnlockActive()? (a={machineIdentifier:a,machineName:b,loungeName:c,isSpinGame:d,imagePath:e,triggeredFromJL:f,closeCallback:g},this.setSkipForJL(!0),RSEngine.popupManager.addPopup(new MemoryWarningPopup(null,a),!0)):this.loadAfterJackpotLounge(a,b,c,d,e,f,g)}else this.loadAfterJackpotLounge(a,b,c,d,e,f,g)},loadAfterJackpotLounge:function(a,b,c,d,e,f,g){RSEngine.loginMode==LOGIN_MODE.GUEST?this.showLoginPopup("feature","JackpotLounge"):GameConfig.JACKPOT_LOUNGE_ENABLE&&GameConfig.JL_SURFACING&&!RSEngine.dataManager.getMe().getJLSurfacingShown()? RSGame.getInstance().getGameManager().showIntroScreenForJL(this.loadAfterJackpotLounge.bind(this,a,b,c,d,e,f,g),!1):!GlobalVars.isjackpotLoaded&&GameConfig.JACKPOT_LOUNGE_ENABLE&&(GlobalVars.isjackpotLoaded=!0,a&&RSGame.getInstance().getUserDataManager().getMe().getJackpotWelcomeBonusAwarded(),this._loadJackpotMachine(a,b,c,d,null,f))},_loadJackpotMachine:function(a,b,c,d,e,f){RSGame.getInstance().getGameManager().disableMachineOpenPopup();RSEngine.audioManager.stopMusic();RSEngine.externalGameManager.unLoadExternalGame(); SideMenuController.getInstance().disableAllButtons();SideMenuController.getInstance().setClosedStateDivDimensions();RSGameScreenManager.getInstance().setPreviousScreen("Jackpot_lobby");RSEngine.externalGameManager.getCustomExternalGameInterface().showExternalGame();var g={machineData:{}};g.machineData.font="JackpotFonts/FuturaCnBd_60-hd.fnt";g.machineData.profile={};g.machineData.profile.name=RSGame.getInstance().getUserDataManager().getMe().getUserFirstName();g.machineData.profile.imageURL=RSGame.getInstance().getUserDataManager().getMe().getImageUrl(); g.machineData.profile.coins=RSGame.getInstance().getUserDataManager().getMe().getCoins();g.machineData.profile.level=RSGame.getInstance().getUserDataManager().getMe().getUserLevel();g.machineData.profile.userId=RSGame.getInstance().getUserDataManager().getMe().getId();g.machineData.profile.loginMode=RSEngine.loginMode;g.machineData.gamePrefix="FPC_";g.machineData.gameName="FPC";GameConfig.VIKING_LOUNGE_ENABLED&&(g.machineData.loungeType="vikings");e&&(g.machineData.jackpotDefaultBet=e,RSCasinoManager.getCasinoInterface().setJackpotDefaultBet(e)); a&&RSGame.getInstance().getUserDataManager().getMe().getJackpotWelcomeBonusAwarded()&&("VIPLounge"!=a?RSCasinoManager.triggerMachineEvent("player_action_session_start","jackpot_popup",a):RSCasinoManager.triggerMachineEvent("player_action_session_start","hud","vip"),g.machineData.directLoadMachineId=a,g.machineData.directLoadMachineName=b,g.machineData.loungeName=c,g.machineData.isSpinGame=d);RSSaleManager.getInstance().getSaleActiveStatus()?g.machineData.isSaleActive=!0:g.machineData.isSaleActive= !1;g.machineData.machineFolder="FoxPlayJackpotLounge";g.machineData.loadingAssetFolder="LoaderAssets";g.machineData.loaderType="JACKPOT_LOUNGE";g.machineData.cheat=GameConfig.CHEAT_MODE;f&&(g.machineData.triggeredFrom=f+"_button");a?(b=RSGameTypes.Slots,-1!=a.indexOf("K_")&&(b=RSGameTypes.Keno),-1!=a.indexOf("L_")&&(b=RSGameTypes.Scratcher),RSGame.getInstance().getGameManager().setGameType(b)):RSGame.getInstance().getGameManager().setGameType(RSGameTypes.Slots);RSGame.getInstance().getGameManager().showOverlayLayer(); a={vo:GlobalVars.voiceCalloutsStatus,music:GlobalVars.musicStatus,effect:GlobalVars.sfxStatus};a=JSON.stringify(a);b=this._getHashValue("JACKPOT_LOUNGE",String(TimeManager.getInstance().getCurrentServerTime()),RSGame.getInstance().getUserDataManager().getMe().getCoins(),RSGame.getInstance().getUserDataManager().getMe().getId());c={};c._gameURL=GameConfig.JACKPOT_LOUNGE_URL+"index.html?machineName\x3dJACKPOT_LOUNGE\x26platform\x3dhtml5\x26userID\x3d"+RSGame.getInstance().getUserDataManager().getMe().getId()+ "\x26layout\x3diPhone5\x26hudHeight\x3d0\x26coins\x3d"+RSGame.getInstance().getUserDataManager().getMe().getCoins()+"\x26hashValue\x3d"+b+"\x26timeStamp\x3d"+String(TimeManager.getInstance().getCurrentServerTime())+"\x26volume\x3d"+a+"\x26machineData\x3d"+btoa(encodeURIComponent(JSON.stringify(g.machineData)));c._screenName="JACKPOT_LOUNGE";c._thirdPartyOwnerType=-1;c._ignoreResizeForHud=!0;RSGameScreenManager.getInstance().loadExternalGame(c);RSEngine.dataManager.getMe().getJackpotWelcomeBonusAwarded()|| RSAnalyticsManager.getInstance().setCurrentMachineAnalyticsName("S_MAN")},_getHashValue:function(a,b,c,d){return a=calcMD5(a+"|"+b+"|"+c+"|"+d+"_z2uy39283ye2n8mz92phdfp2")},getCasinoHUD:function(){return new TopHUD(RSGame.getInstance().getAssetPath("TopHud"))},showJackpotLoungeWelcomePopup:function(){RSEngine.loginMode!=LOGIN_MODE.GUEST&&GameConfig.JACKPOT_LOUNGE_ENABLE&&RSGame.getInstance().getLevelManager().getCurrentLevel()>=GameConfig.JACKPOT_LOUNGE_LEVEL&&!RSGame.getInstance().getUserDataManager().getMe().getJLTriggerStatus()&& (this.getOnboardFirstSession()||RSGame.getInstance().getUserDataManager().getMe().setJLTriggerStatus(!0))},setOnboardFirstSession:function(a){this._onboardingFirstSession=a},getOnboardFirstSession:function(){return this._onboardingFirstSession},getHourlyBonusValue:function(){for(var a=RSGame.getInstance().getGameData().getHourlyBonusData(),b=RSGame.getInstance().getLevelManager().getCurrentLevel(),c=0;c<a.length;c++)if(a[c].level_id===b)return parseInt(a[c].bihourly_bonus);return parseInt(a[a.length- 1].bihourly_bonus)},getEmitterColors:function(){return[new RSColor(200,29,238),new RSColor(54,189,255),new RSColor(248,224,50),new RSColor(249,36,143),new RSColor(254,156,71),new RSColor(37,212,53)]},getEmitterFrames:function(){return["StarEmitter_00/StarEmitter_0000.png","StarEmitter_00/StarEmitter_0001.png","StarEmitter_00/StarEmitter_0002.png","StarEmitter_00/StarEmitter_0003.png","StarEmitter_00/StarEmitter_0004.png"]},showAdsNotAvailablePopup:function(a,b){RSEngine.popupManager.addPopup(new AdsDisabledPopup(a, b),!1)},showPowerUpCart:function(){RSEngine.popupManager.addPopup(new BingoPurchaseCartPopup("PowerUpCart",this.onPurchaseCartClosed.bind(this)),!1)},showDaubAlertCart:function(a){RSEngine.popupManager.addPopup(new BingoPurchaseCartPopup("DaubAlertCart",this.onPurchaseCartClosed.bind(this)),!1)},updateLeaderboardWithBingoWin:function(a){GameConfig.LEADERBOARD_ENABLED&&RSLeaderboard.setUserLeaderBoardData(a)},getNewLeaderboardFonts:function(){return{title:RSGame.getInstance().getGameManager().getDefaultCasinoFont("65largeDrkBlue", "black"),text:RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","Semibold"),amount:RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold"),WinAmountAlignment:kTEXT_ALIGNMENT_CENTER,rankFont:RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("superlarge","bold"),semiText:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold"),playerNameFont:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold"),timerFont:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large", "Reg"),playerCellRankFont:RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold"),playerCellWinAmountFont:RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold"),payTableFont:RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold"),top3RewardFont:RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold"),rewardWinnerFont:RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","Semibold"),topPlayers:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large", "Semibold"),timerAlignment:kTEXT_ALIGNMENT_LEFT}},getModifiedVIPMultiplier:function(a){if(a)return null;a=RSGame.getInstance().getGameData().getVIPGameData();var b=RSVIPManager.getInstance().getVIPUserTier();return parseInt(a[b].dailyBonusPercent)/100},isVipPercentageCalculation:function(){return!0},showIntroScreenForLMAndVIP:function(a,b,c){b&&RSEngine.dataManager.getMe().setLMTriggerStatus(!0);a&&RSEngine.dataManager.getMe().setVIPTriggerStatus(!0);this._curtainRaiserScreen=new RSIntroScreenForLMAndVIP(this.onCurtainAnimComplete.bind(this, a,b),a,b);this._LMandVIPCurtainRaiserCompleteCallBack=c},onSurfacingCurtainAnimComplete:function(a){RSEngine.screenManager.removeScreen(this._curtainRaiserScreen);this._curtainRaiserScreen=null;this._curtainRaiserScreenPlayCallBack&&(this._curtainRaiserScreenPlayCallBack.call(this),this._curtainRaiserScreenPlayCallBack=null);this._curtainRaiserCompleteCallBack&&(this._curtainRaiserCompleteCallBack.call(this),this._curtainRaiserCompleteCallBack=null);this._jackpotLoungeSurfacingCompleteCallBack&&(this._skipRestOfThePopups? a?(RSGame.getInstance().getGameManager().setSideMenuVisibility(!1),this._jackpotLoungeSurfacingCompleteCallBack.call(this,!0)):(RSGame.getInstance().getGameManager().setSideMenuVisibility(!0),this._jackpotLoungeSurfacingCompleteCallBack.call(this,!1)):(RSGame.getInstance().getGameManager().setSideMenuVisibility(!1),this._jackpotLoungeSurfacingCompleteCallBack.call(this)),this._jackpotLoungeSurfacingCompleteCallBack=null);RSEngine.externalGameManager.showExternalGame();RSGame.getInstance().getUserDataManager().saveUserBlobParams()}, getCurtainRaiserScreen:function(){return this._curtainRaiserScreen},showIntroScreenForJL:function(a,b){this._curtainRaiserScreen=new IntroScreenForJL(this.onSurfacingCurtainAnimComplete.bind(this));this._jackpotLoungeSurfacingCompleteCallBack=a;this._skipRestOfThePopups=b;RSGame.getInstance().getUserDataManager().getMe().setJLTriggerStatus(!0);this._curtainRaiserScreen&&(GlobalVars.isSurfacingActive=!0,RSEngine.screenManager.addScreen(this._curtainRaiserScreen),RSEngine.externalGameManager.hideExternalGame(), RSGame.getInstance().getGameManager().setSideMenuVisibility(!1))},updatePiggyBank:function(a){RSGame.getInstance().getLevelManager().updatePiggyBank(a)},getConnectionLostPopupTextFont:function(){return RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","Semibold")},sideMenuBtnClicked:function(){RSEngine.externalGameManager.hideToaster();GlobalVars.isDCTooltipActive&&this._toolTipPopup&&!this._automaticTrayOpenStatus&&RSEngine.popupManager.removePopup(this._toolTipPopup);this._automaticTrayOpenStatus&& (this._automaticTrayOpenStatus=!1)},getDefaultFontForDailyQuestProgressText:function(){return RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold")},getPurchaseFeedbackConfig:function(){return{title:{size:"extralargeDrkBlue",type:"black"},subtitle:{size:"medium",type:"Semibold"},title_color:null}},callJLMachineSelectPopup:function(a,b,c){GlobalVars.isMachineLoadingInProgress||(a.iconPath=b?b:"res/SlotResources/CasinoSubLobby/icons/"+a.imageName,a.levelEnabled=a.levelRequired<= RSGame.getInstance().getLevelManager().getCurrentLevel(),RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Slots,a.machine_identifier,RSGameScreens.SlotsLobby))},getAdPopupFonts:function(){return{TITLE:{size:"extralargeDrkBlue",type:"black"},SUBTITLE:{size:"medium",type:"Semibold"},REWARDTYPE1:{size:"extralarge",type:"bold"},REWARDTYPE2:{size:"large",type:"bold"},REWARDTYPE1_ALIGN:kTEXT_ALIGNMENT_CENTER,REWARDTYPE2_ALIGN:kTEXT_ALIGNMENT_CENTER,TITLE_COLOR:{r:255,g:255,b:255},TIMER:{size:"large", type:"bold"},TIMER_ALIGN:kTEXT_ALIGNMENT_CENTER,BUTTON_TEXT:{size:"large",type:"bold"}}},getVideoRewardPopupFont:function(){return RSGame.getInstance().getAssetPath("UbuntuMonoBold_large_bold")},connectPlayerIdWithCasino:function(a,b,c,d){var e={placeholder1:"Rewards Card Number",placeholder2:"PIN"};e.defaultValue=c;RSGame.getInstance().getUserDataManager().getMe().getPlayerConnectUpdateStatus()?RSEngine.popupManager.addPopup(new RSPlayerClubRedirectionPopup):RSEngine.popupManager.addPopup(new RSPlayerConnectPopup(a, b,e,d))},addVIPBenefits:function(a){RSEngine.popupManager.addPopup(new VIPBenefitsPopup(a),!0)},getSweepstakesEntryFontColor:function(){return new RSColor(46,192,242,0.8)},getBingoKenoLobbyName:function(){return RSGameScreens.KenoBingoLobby},getDefaultFontForDailyQuestRewardText:function(){return{DESCRIPTON_FONT:RSGame.getInstance().getGameManager().getDefaultCasinoFont("extralarge","Semibold"),BUTTON_FONT:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),COIN_FONT:RSGame.getInstance().getAssetPath("UbuntuMonoBold_large_bold"), QuestRewardAlignment:kTEXT_ALIGNMENT_RIGHT}},reInitializeGenericEvents:function(){RSPlacementManager.getInstance().initialise();RSPlacementManager.getInstance().activateAllPlacementsFor("LoadingComplete");GameConfig.QUEST_ENABLED&&(RSEngine.dataManager.getMe().getDCinfoPopupShownStatus()&&RSQuestManager.getInstance().setQuestEnabledStatus(),RSEventManager.getInstance().dispatchEvent(RSGeneralQuestEventKeys.DAILY_LOGIN_ACTION,1));var a=RSGame.getInstance().getGameManager().getWebRSID();a&&RSGame.getInstance().getUserDataManager().getMe().setwebRSId(a); RSGame.getInstance().getGameManager().initializePlatformSDKManager({},GameConfig.GAME_ID)},setTournamentSurfacingStatus:function(a){this._tournamentSurfacingActiveStatus=a},getSideMenuItemsList:function(){if(GameConfig.TOURNAMENT_ENABLED&&parseInt(RSEngine.gameData.getDefaultValues().isTournamentEnabled))return GameConfig.QUEST_ENABLED&&(RSGame.getInstance().getGameManager().getDCUnlockStatus()||RSEngine.dataManager.getMe().getDCinfoPopupShownStatus())?this._tournamentSurfacingActiveStatus&&!RSEngine.dataManager.getMe().getDCinfoPopupShownStatus()? ["Tournament"]:["DailyQuest","Tournament"]:["Tournament"];if(GameConfig.QUEST_ENABLED&&(RSGame.getInstance().getGameManager().getDCUnlockStatus()||RSEngine.dataManager.getMe().getDCinfoPopupShownStatus()))return["DailyQuest"]},getSideMenuStyleData:function(){return{topPosition:55,width:219}},feedbackSubmitCallback:function(a){a||(a=RSGame.getInstance().getStringDictionary("PurchaseCancelledFeedBack").T2?RSGame.getInstance().getStringDictionary("PurchaseCancelledFeedBack").T2:"THANKS FOR THE \n FEEDBACK!", RSEngine.popupManager.addPopup(new RSToasterPopup([{name:RSGame.getInstance().getAssetPath("FeedBackThanksPopup"),count:1}],a),!0));this._purchaseCancelledCallBack&&this._purchaseCancelledCallBack()},getEmailConnectFontColor:function(){return new RSColor(255,255,255,255)},getVipTierWidgetAssetPath:function(){return RSGame.getInstance().getAssetPath("VIPStatusTierWidget")},getClubMUpdateStatus:function(){return RSGame.getInstance().getUserDataManager().getMe().getPlayerConnectUpdateStatus()},getCustomizedParticleCount:function(){return 100}, setMachinePlayedForAnim:function(a){SlotsLobbyWidgetManager.getInstance().setSlotMachineData();var b=SlotsLobbyWidgetManager.getInstance().getMergedSlotMachinesData(),c;for(c in b)if(b[c].id===a&&1==parseInt(b[c].type))break;SlotsLobbyWidgetManager.getInstance().setSlotsMachineLoaded(!0);SlotsLobbyWidgetManager.getInstance().setSlotsLobbySelectedIndex(c,{})},updateRewardsFromAdManager:function(a,b,c){a.coin&&(this._reward=parseInt(a.coin),this._placementName=b,RSGame.getInstance().getUserDataManager().rewardVideoBonus(this._placementName, this.onVideoBonusUpdated.bind(this),this.onVideoBonusUpdateFailed.bind(this,a,b),c));a.Xp&&(a=parseInt(a.Xp),RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.ECONOMY,"source_xp","video_bonus",a,this._placementName,"lifeStreet"))},onVideoBonusUpdated:function(a){RSCasinoManager.addPrimaryCurrencyForDisplay("Ad reward",parseInt(this._reward));this._retryCount=0;RSEngine.screenManager.removeOverlay();if(a.result.data){RSEngine.externalGameManager&&RSEngine.externalGameManager.updateCoin(RSGame.getInstance().getUserDataManager().getMe().getCoins()); a="video_bonus";var b="lifeStreet";if(this._placementName.includes("Ad_CRHB_S")||this._placementName.includes("Ad_CRGC_S"))a="video_bonus_survey",b="pollfish";GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&RSGame.getInstance().getPlatformEventManager()&&RSGame.getInstance().getPlatformEventManager().getEventActionName&&RSGame.getInstance().getPlatformEventManager().getEventActionName().includes("House Ad")?RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSink.free,"video_bonus",this._reward, this._placementName,"house_ads_youtube"):(RSGame.getInstance().getUserDataManager().addPaidCoins(parseInt(this._reward)),RSCasinoManager.triggerPrimarySourceEvent(RSAnalyticsSource.paid,a,this._reward,this._placementName,b))}},onVideoBonusUpdateFailed:function(a,b,c){3>this._retryCount?(this._retryCount++,this.updateRewardsFromAdManager(a,b)):(this._retryCount=0,RSErrorTracker.getInstance().trackErrorMessage("REWARD_VIDEO_BONUS","Error collecting video reward bonus","mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"))}, _onEventDayCapReached:function(a){a=a._userData.placementName;RSAnalyticsManager.getInstance().trackGUIEvent("max_ad_limit","trigger","",a);RSEngine.popupManager.addPopup(new VideoRewardPopup("",!1,null,a),!1)},_onEventSessionCapReached:function(){RSEngine.popupManager.addPopup(new VideoRewardPopup("",!1,null),!1)},startMainLobbyMusicTimer:function(a){this._mainLobbyMusicTimer=setTimeout(this.startLoopingMusic.bind(this),a)},startLoopingMusic:function(){RSEngine.audioManager.stopMusic();var a=!1; if(GlobalVars.isInsideMachine||GlobalVars.isjackpotLoaded||GlobalVars.isLoyaltyMallLoaded||GlobalVars.isTournamentLoaded)a=!0;RSEngine.audioManager.isMusicPlaying()||a?a&&clearTimeout(this._mainLobbyMusicTimer):(clearTimeout(this._mainLobbyMusicTimer),RSEngine.audioManager.playMusic(RSGame.getInstance().getAssetPath("MainLobbyBGM"),!0))},loadLoyaltyMall:function(a){RSEngine.dataManager.getLoyaltyMallPoints(this.onTrackMachineLoadEvent.bind(this));GlobalVars.isLoyaltyMallLoaded=!0;SideMenuController.getInstance().setSideMenuVisibility(!1); RSGame.getInstance().getGameManager().disableMachineOpenPopup();RSEngine.audioManager.stopMusic();RSEngine.audioManager.stopAllEffects();RSEngine.externalGameManager.unLoadExternalGame();RSGame.getInstance().getGameManager().setGameType(RSGame.getInstance().getGameManager().getGameType());a={vo:GlobalVars.voiceCalloutsStatus,music:GlobalVars.musicStatus,effect:GlobalVars.sfxStatus};a=JSON.stringify(a);var b=this._getHashValue("LoyaltyMall",String(TimeManager.getInstance().getCurrentServerTime()), RSEngine.dataManager.getMe().getCoins(),RSEngine.dataManager.getMe().getId()),c={_screenName:"LoyaltyMall",_gameType:"LoyaltyMall",machine_identifier:"LoyaltyMall"};c._gameURL=GameConfig.LOYALTYMALL_URL+GameConfig.CASINO_NAME+"\x26userID\x3d"+RSEngine.dataManager.getMe().getId()+"\x26timeStamp\x3d"+String(TimeManager.getInstance().getCurrentServerTime())+"\x26coins\x3d"+RSEngine.dataManager.getMe().getCoins()+"\x26hashValue\x3d"+b+"\x26volume\x3d"+a+"\x26platform\x3dcanvas";RSGameScreenManager.getInstance().loadExternalGame(c)}, onTrackMachineLoadEvent:function(a){a=a.result.data;RSAnalyticsManager.getInstance().trackGUIEvent("loyalty_mall_popup","click",a.toString(),"")},setVIPStatus:function(a){this._currentVIPTier=RSVIPManager.getInstance().getVIPUserTier();RSCasinoManager.getCasinoHUD()&&RSCasinoManager.getCasinoHUD()._vipStatus&&RSCasinoManager.getCasinoHUD()._vipStatus.setFrame(this._currentVIPTier);!this._VIPStarRotationStartStatus&&1<=this._currentVIPTier&&a?this.rotateVIPStar():!this._vipStarRotateTimer&&this._VIPStarRotationStartStatus&& 1<=this._currentVIPTier&&this.scaleUpFromZero()},rotateVIPStar:function(){this._vipStarRotateTimer&&(clearTimeout(this._vipStarRotateTimer),this._vipStarRotateTimer=null);this._VIPStarRotationStartStatus=!0;if(1>RSVIPManager.getInstance().getVIPUserTier())this._VIPStarRotationStartStatus=!1;else if(RSCasinoManager.getCasinoHUD()&&RSCasinoManager.getCasinoHUD()._vipStatus){RSCasinoManager.getCasinoHUD()._vipStatus.setScaleX(1);var a=RSCasinoManager.getCasinoHUD()._vipStatus.actionScale(0.5,0,1,this.scaleUpFromZero.bind(this)); RSTweener.easeSineIn(a)}},scaleUpFromZero:function(){if(RSCasinoManager.getCasinoHUD()&&RSCasinoManager.getCasinoHUD()._vipStatus){RSCasinoManager.getCasinoHUD()._vipStatus.setScaleX(0);var a=RSCasinoManager.getCasinoHUD()._vipStatus.actionScale(0.5,1,1,this.addDelay.bind(this));RSTweener.easeSineIn(a)}},addDelay:function(){this._vipStarRotateTimer=setTimeout(this.rotateVIPStar.bind(this),15E3)},reinitializeVIPStarRotationStatus:function(){this._VIPStarRotationStartStatus=!1},loadNewCCPAPopup:function(){return!0}, loadNewGDPRPopup:function(){return!0},loadCCPAPopup:function(a,b){RSEngine.popupManager.addPopup(new RSCCPAPopup(a,{TOSUrl:"https://foxplay.foxwoods.com/terms-of-service/",privacyPolicyUrl:"https://foxplay.foxwoods.com/privacy-policy/"},b),!0,!1,!0)},loadGDPRPopup:function(a,b){RSEngine.popupManager.addPopup(new RSGDPRPopup(a,{TOSUrl:"https://foxplay.foxwoods.com/terms-of-service/",privacyPolicyUrl:"https://foxplay.foxwoods.com/privacy-policy/"},b),!0,!1,!0)},getPlayerConnectCustomLabelStatus:function(){return!0}, getGameName:function(){var a=GameConfig.CASINO_DISPLAY_NAME?GameConfig.CASINO_DISPLAY_NAME:GameConfig.CASINO_NAME;return a=a.trim()},showRewardPopup:function(a){a&&(a=[{name:RSGame.getInstance().getAssetPath("LoginSuccessPopup"),count:1}],1!=RSSSOManager.getFoxwoodsPlayerStatus()&&RSEngine.popupManager.addPopup(new RSSocialLoginRewardPopup(null,RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),a)))},getVipStatusPointUpdateEnabledStatus:function(){return RSSSOManager.getBlobIdData()&& 1==RSSSOManager.getBlobIdData().isFoxwoodUser?!1:!0},onBuyCoinsBtnClicked:function(){RSEngine.loginMode==LOGIN_MODE.GUEST?this.showLoginPopup("feature",""):GameConfig.SUBSCRIPTION_ENABLED&&(PurchaseFlowManager.getInstance().setShowPurchaseCart(!1),GlobalVars.isPurchaseEnabled?(RSSaleManager.getInstance().showPurchaseCart(),RSEngine.externalGameManager.postMessageToJackpot("jackpotCustomInterfaceCalls",{type:"resetKickOut"})):VideoManager.getInstance().showVideoPopup("ReplacePurchase",!1,"purchase_cart"))}, showRulesPopup:function(){window.open("https://foxplay.foxwoods.com/terms-of-service/","_blank")},giftingFbPermissionPromptPopupEnabledStatus:function(){return!0},getToasterStyleData:function(){return{topPosition:48}},isSkipSubscriptionTooltip:function(){return!0},isSubscriptionInsidePurchaseCartIsEnabled:function(){return!0},isSaleRefreshEnabled:function(){return!0},triggerMemoryPopupStatus:function(a,b){var c=performance.memory,d=RSGame.getInstance().getGameData().getMachineDetails(a,b)&&RSGame.getInstance().getGameData().getMachineDetails(a, b).machine_assetSize?RSGame.getInstance().getGameData().getMachineDetails(a,b).machine_assetSize:0;return c&&1E6*d>c.totalJSHeapSize-c.usedJSHeapSize?!0:!1},setSkipForJL:function(a){this.isJLLoadFromSlots=a},getSkipForJL:function(){return this.isJLLoadFromSlots}});var RSTopHudProgressBar=RSPanel.extend({init:function(a,b,c,d,e,f){this._super.init.call(this,a.x,a.y,a.w,a.h);this._barAnimation=d;this._xpBlastAnim=f;this._barEdgeAnim=e;this.setClippingEnabled(!0);this._barPercent=0;this._barWidth=a.w;this._bar=RSUtils.createBasicObject(b,a);b=this.convertToNodeSpace(a.x,a.y);this._bar.setPosition(b.getX(),b.getY());this.addChild(this._bar);this._initialPos=this._bar.getX()-this._barWidth;this._bar.moveX(-this._barWidth);a=this._bar.convertToNodeSpace(a.x,a.y); this._barAnimation&&(a=this._bar.convertToNodeSpace(this._barAnimation.getX(),this._barAnimation.getY()),this._barAnimation.setPosition(a.getX(),a.getY()),this._bar.addChild(this._barAnimation));this._xpBlastAnim&&(a=this._bar.convertToNodeSpace(this._xpBlastAnim.getX(),this._xpBlastAnim.getY()),this._bar.addChild(this._xpBlastAnim),this._xpBlastAnim.setPosition(a.getX(),a.getY()));this._barEdgeAnim&&(this._edgeColor=this._barEdgeAnim.getColor(),a=this._bar.convertToNodeSpace(this._barEdgeAnim.getX(), this._barEdgeAnim.getY()),this._barEdgeAnim.setPosition(a.getX(),a.getY()),this._barEdgeAnim.stopAnimation(),this._bar.addChild(this._barEdgeAnim))},playBarProgressAnim:function(){this._barAnimation.stopAnimation();this._barAnimation.setFrame(0);this._barAnimation.playAnimation(1,0.5,this.onProgressFillAnimationComplete.bind(this))},onProgressFillAnimationComplete:function(){this._barAnimation.setFrame(0);this._barAnimation.stopAnimation()},playXPBlastAnim:function(){this._xpBlastAnim&&(this._xpBlastAnim.stopAnimation(), this._xpBlastAnim.setVisible(!0),this._xpBlastAnim.playAnimation(-1,0.3));this._barEdgeAnim&&this._barEdgeAnim.setColor(new RSColor(0,214,221,255))},stopXPBlastAnim:function(){this._xpBlastAnim&&(this._xpBlastAnim.setVisible(!1),this._xpBlastAnim.setFrame(1),this._xpBlastAnim.stopAnimation());this._barEdgeAnim&&this._barEdgeAnim.setColor(this._edgeColor)},setBarInitialPos:function(a){this._barPosition=this._initialPos+this._barWidth*a%this._barWidth;this._bar.setX(this._barPosition);this._barPercent= a},moveBarTo:function(a,b){var c=this._barPercent;c>a&&(a+=1);1<=a&&void 0!=b&&b();this.stopActionTweenForKey("progressBarMove");this.startActionTweenForKey("progressBarMove",1,c,a)},actionOnUpdate:function(a,b){var c=b*this._barWidth%this._barWidth;this._bar.setX(this._initialPos+c);this._barPosition=this._initialPos+c;this._barPercent=b%1},actionOnComplete:function(a){this.stopActionTweenForKey("progressBarMove")}});var TopHUD=RSCasinoHUD.extend({mask:null,finalScale:null,levelId:null,_progressBar:null,_progressBarStartingX:0,_progressBarEndingX:0,_progressObj:null,_alreadyMoving:!1,_moveActionProgressBar:null,_piggyAnims:[],_piggyWinAnimActive:!1,_animInProgress:!1,init:function(a){this._super.init.call(this,a);this._gameManager=RSGame.getInstance().getGameManager();this._userDataManager=RSGame.getInstance().getUserDataManager();this.coinField=null;this._levelDataManager=RSGame.getInstance().getLevelManager(); this._guestBtn=this._toaster=this._backButton=this._msgButton=this._profileStats=this._settingsButton=null;this._fadeTimer=1;this._newsFeedCount="";this._objectData=this._profileImage=this._leaderboard=this._newsFeedBg=null;this._winDisplay=this._userDataManager.getMe().getCoins();this._iconPathArrayForPlayerStats={};this._iconNameArrayForPlayerStats={};this._interuptTriggered=!1;this._purchaseWidget=null;this._tournamentWidgetHided=!0;this._tournamentTimer=null;this._showIntermediateBubble=!1},loadContent:function(){cc.spriteFrameCache.addSpriteFrames(RSGame.getInstance().getAssetFolder("AvatarPopup")+ "AvatarImages_00-hd.plist");this.layoutScreen(this._layout,2);this._super._super.loadContent.call(this);this._iconPathArrayForPlayerStats[RSGameTypes.Poker]="res/PokerResources/CasinoSubLobby/MainLobbyPreviewIcons/";this._iconPathArrayForPlayerStats[RSGameTypes.Bingo]="res/BingoResources/res/featuredIcons/";this._iconPathArrayForPlayerStats[RSGameTypes.Slots]="res/SlotResources/CasinoSubLobby/icons/";this._iconPathArrayForPlayerStats[RSGameTypes.Keno]="res/KenoResources/SubLobby/featuredIcons/";this._iconPathArrayForPlayerStats[RSGameTypes.Blackjack]= "res/TableResources/SubLobby/Icons/";this._iconPathArrayForPlayerStats[RSGameTypes.Roulette]="res/TableResources/SubLobby/Icons/";this._iconPathArrayForPlayerStats[RSGameTypes.TableGames]="res/TableResources/SubLobby/Icons/";this._iconNameArrayForPlayerStats[RSGameTypes.Poker]="machine_largeIcon";this._iconNameArrayForPlayerStats[RSGameTypes.Bingo]="machine_largeIcon";this._iconNameArrayForPlayerStats[RSGameTypes.Slots]="imageName";this._iconNameArrayForPlayerStats[RSGameTypes.Keno]="machine_largeIcon"; this._iconNameArrayForPlayerStats[RSGameTypes.Blackjack]="machine_largeIcon";this._iconNameArrayForPlayerStats[RSGameTypes.Roulette]="machine_largeIcon";this._iconNameArrayForPlayerStats[RSGameTypes.TableGames]="machine_identifier"},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);if(RSEngine.loginMode!=LOGIN_MODE.GUEST&&GameConfig.TOURNAMENT_ENABLED&&parseInt(RSEngine.gameData.getDefaultValues().isTournamentEnabled)&&86400>RSTournamentManager.tournamentStartsIn()){clearInterval(this._tournamentTimer); var a=RSTournamentManager.tournamentStartsIn(),b=RSTournamentManager.tournamentEndsIn();a<RSTournamentManager.getHudTimerFreezesIn()&&0!=a&&0!=b&&!GlobalVars.isTournamentLoaded&&(this._purchaseWidget.setVisible(!1),this._tournamentTimerWidget.setVisible(!0),this._tournamentWidgetHided=!1);this._tournamentTimer=setInterval(this.updateTournamentTimer.bind(this),1E3)}this.levelId&&this.levelId.setString(RSUtils.formatNumberWithComma(this._levelDataManager.getCurrentLevel()));this.checkSaleStatusAndStartBuyButtonAnimation(); GlobalVars.newsFeedShownStatus||this.setNewsFeedCount(GlobalVars.newsFeedCount);this._progressFillAnim&&(this._setProgressBar(),this.playXPBlastAnimation());this._gameManager.setVIPStatus(!1);GlobalVars.isTournamentLoaded&&this._disableTouchOfButtons();RSEventManager.getInstance().addEventListener("onUserRankUp",this,this.initiateSurfacing.bind(this))},_disableTouchOfButtons:function(){this._leaderboard.setTouchEnabled(!1);this._settingsButton.setTouchEnabled(!1);this._profileStats.setTouchEnabled(!1); this._msgButton.setTouchEnabled(!1);this._logOutBtn.setTouchEnabled(!1);this._tournamentTimerWidget.setTouchEnabled(!1);this._fullScreenFalse.setTouchEnabled(!1);this._fullScreenTrue.setTouchEnabled(!1);this.disablePurchaseButton()},_setProgressBar:function(){this._progressBar.setVisible(!0);this._progressBar.setBarInitialPos(RSGame.getInstance().getLevelManager().getLevelBarProgress())},checkSaleStatusAndStartBuyButtonAnimation:function(){null!=this._purchaseWidget&&this._purchaseWidget.checkSaleStatusAndStartBuyButtonAnimation()}, onObjectCreated:function(a,b,c){switch(c.name){case "CoinPos":this._coinPos=a;break;case "StatsStar":this._starObject=a;this._starOrigin=new RSPoint(c.x,c.y);break;case "BackButton":this._backButton=a;RSGameScreenManager.getInstance().getCurrentScreen()==RSGameScreens.MainLobby&&this._backButton.setTouchEnabled(!1);RSEngine.externalGameManager.postMessageToJackpot("jackpotCustomInterfaceCalls",{type:"disconnectJackpot"});break;case "Leaderboard":this._leaderboard=a;RSEngine.loginMode==LOGIN_MODE.GUEST? this._leaderboard.setVisible(!1):GameConfig.LEADERBOARD_ENABLED||this._leaderboard.setTouchEnabled(!1);break;case "SettingsButton":this._settingsButton=a;break;case "ProfileStats":this._profileStats=a;break;case "MsgButton":this._msgButton=a;RSEngine.loginMode==LOGIN_MODE.FACEBOOK&&this._msgButton.setX(this._msgButton.getX()-14);0==parseInt(RSGame.getInstance().getGameData().getDefaultValues().ClevertapInAppMsgStatus)&&this._msgButton.setTouchEnabled(!1);break;case "ProfileFrame":a.setZOrder(1);break; case "ProfilePicMaskArea":this._objectData=c;this.setProfilePic(a,b);break;case "GuestBtn":this._guestBtn=a;this._guestBtn.setVisible(!1);RSEngine.loginMode==LOGIN_MODE.GUEST&&this._guestBtn.setVisible(!0);break;case "XpBoost":this._xpBoost=a;this._xpBoost.setVisible(!1);break;case "XpBlastAnim":this._xpBoostAnim=a;this._xpBoostAnim.stopAnimation();this.removeChild(this._xpBoostAnim);break;case "ProgressFillAnim":this._progressFillAnim=a;this._progressFillAnim.stopAnimation();this.removeChild(this._progressFillAnim); break;case "ProgressFillEdgeAnim":this._progressFillEdgeAnim=a;this._progressFillEdgeAnim.stopAnimation();this.removeChild(this._progressFillEdgeAnim);break;case "LevelFrame":this._levelframe=a;break;case "LevelupAnim":this._levelupAnimation=a;this._levelupAnimation.setVisible(!1);this._levelupAnimation.stopAnimation();break;case "PiggyWinAnim":this._piggyWinAnim=a;this._piggyWinAnim.stopAnimation();this._piggyWinAnim.setVisible(!1);break;case "PiggyCollectedAnim":this._piggyCollectedAnim=a;this._piggyCollectedAnim.stopAnimation(); this._piggyCollectedAnim.setVisible(!1);break;case "PiggySmallBetsAnim":this._piggySmallBetAnim=a;this._piggySmallBetAnim.stopAnimation();this._piggySmallBetAnim.setVisible(!1);break;case "PiggyMaxBetAnim":this._piggyMaxBetAnim=a;this._piggyMaxBetAnim.stopAnimation();this._piggyMaxBetAnim.setVisible(!1);break;case "Piggy":this._piggy=a;break;case "LogOutBtn":this._logOutBtn=a;RSEngine.loginMode!==LOGIN_MODE.FACEBOOK&&RSEngine.loginMode!==LOGIN_MODE.GUEST||this._logOutBtn.setVisible(!1);break;case "FullScreenBtnFalse":this._fullScreenFalse= a;RSEngine.loginMode==LOGIN_MODE.FACEBOOK&&this._fullScreenFalse.setX(this._fullScreenFalse.getX()+16);GlobalVars.fullscreenStatus?(this._fullScreenFalse.setVisible(!1),this._fullScreenFalse.setTouchEnabled(!1)):(this._fullScreenFalse.setVisible(!0),this._fullScreenFalse.setTouchEnabled(!0));break;case "FullScreenBtnTrue":this._fullScreenTrue=a;RSEngine.loginMode==LOGIN_MODE.FACEBOOK&&this._fullScreenTrue.setX(this._fullScreenTrue.getX()+16);GlobalVars.fullscreenStatus?(this._fullScreenTrue.setVisible(!0), this._fullScreenTrue.setTouchEnabled(!0)):(this._fullScreenTrue.setVisible(!1),this._fullScreenTrue.setTouchEnabled(!1));break;case "FlipAnimRight":this._flipAnimRight=a;this._flipAnimRight.stopAnimation();this._flipAnimRight.setVisible(!1);break;case "FlipAnimLeft":this._flipAnimLeft=a;this._flipAnimLeft.stopAnimation();this._flipAnimLeft.setVisible(!1);break;case "VipStatus":this._vipStatus=a;this._vipStatus.stopAnimation();break;case "VipStatusBg":this._vipStatusBg=a,this._vipStatusBg.addTouchListenerWithDelegate(this)}this._super.onObjectCreated.call(this, a,b,c)},enablePurchaseButton:function(){null==this._purchaseWidget||GlobalVars.isTournamentLoaded||this._purchaseWidget.enablePurchaseButton()},disablePurchaseButton:function(){null!=this._purchaseWidget&&this._purchaseWidget.disablePurchaseButton()},setXpBar:function(a){this._progressBar&&this._progressBar.moveBarTo(a,this.playLevelupAnimation.bind(this));a=this._levelDataManager.getCurrentLevel();this.levelId&&!RSGame.getInstance().getLevelManager().isLevelUpTriggered()?this.levelId.setString(RSUtils.formatNumberWithComma(a)): !this.levelId||0!==a%5&&2!==a||this.levelId.setString(RSUtils.formatNumberWithComma(a));this.playXpAnim()},playXpAnim:function(){this._progressBar&&this._progressBar.playBarProgressAnim()},reInitButtonHoverCursor:function(){this.checkSaleStatusAndStartBuyButtonAnimation();this.playXPBlastAnimation();this._super.reInitButtonHoverCursor.call(this)},playXPBlastAnimation:function(){this._xpBoost&&this._xpBoost.setVisible(!1);this._xpBoostAnim&&(this._progressBar.stopXPBlastAnim(),this._xpBoostAnim.setVisible(!1)); this._progressFillAnim&&this._progressFillAnim.setVisible(!0)},onBackButton:function(a){GlobalVars.isLeanplumNavigation&&(GlobalVars.isLeanplumNavigation=!1);if(RSEngine.externalGameManager.isInGameBackButtonActive()&&null==a)RSEngine.externalGameManager.triggerEventOnBackButtonClick();else{GlobalVars.isInsideMachine=!1;!0==RSFavoritesLobbyWidgetManager.getInstance()._machineLoaded&&(RSFavoritesLobbyWidgetManager.getInstance()._machineLoaded=!1);!0==SlotsLobbyWidgetManager.getInstance()._machineLoaded&& (SlotsLobbyWidgetManager.getInstance()._machineLoaded=!1);this.checkSessionStopEvent();this.disableAllButtons();SideMenuController.getInstance().setClosedStateDivDimensions();var b=RSUtils.cloneJSON(RSGameScreenManager.getInstance().getCurrentScreen());GlobalVars.isjackpotLoaded||RSEngine.externalGameManager.unLoadExternalGame();RSEngine.audioManager.stopAllEffects();GlobalVars.isInsideExternalGame=!1;GameConfig.TOURNAMENT_ENABLED&&parseInt(RSEngine.gameData.getDefaultValues().isTournamentEnabled)&& 0<RSTournamentManager.tournamentEndsIn()&&0<RSTournamentManager.tournamentStartsIn()&&RSTournamentManager.tournamentStartsIn()<RSTournamentManager.getHudTimerStartsIn()&&RSTournamentManager.tournamentStartsIn()>RSTournamentManager.getHudTimerFreezesIn()&&this.startTournamentTimerToggleAnimation();GlobalVars.isInsideTournament=!1;GlobalVars.isTournamentLoaded=!1;GlobalVars.isFirstSpinOnMachine=!1;if(a)if(GlobalVars.isjackpotLoaded)RSCasinoManager._HUD=null,GlobalVars.isjackpotLoaded=!1,RSGameScreenManager.getInstance().setPreviousScreen(RSGameScreens.MainLobby), "Jackpot_Mainlobby"==RSGameScreenManager.getInstance().getPreviousScreen()&&RSGameScreenManager.getInstance().setCurrentLobbyName(RSGameScreens.JackpotMainLobby),RSGameScreenManager.getInstance().loadScreen(RSGameScreens.MainLobby),RSGameScreenManager.getInstance().removeAllScreensExceptMainLobby(),RSEngine.externalGameManager.unLoadExternalGame();else if(this._gameManager.getCurtainRaiserScreen()&&RSGameScreenManager.getInstance().getPreviousScreen()!=RSGameScreens.MainLobby)if(!GlobalVars.isSurfacingActive&& !RSLeaderboard.getRankUpTriggerStatus())this._gameManager.playIntroScreen(this.onCurtainRaiserCompleted.bind(this));else{if(!RSLeaderboard.getRankUpTriggerStatus()||RSLeaderboard.getLeaderboardResetStatus()||b!=RSGameScreens.Machine)this._gameManager.loadPreviousScreen(),this.showDailyChallengeTooltip()}else{if(!RSLeaderboard.getRankUpTriggerStatus()||RSLeaderboard.getLeaderboardResetStatus()||b!=RSGameScreens.Machine)this._gameManager.loadPreviousScreen(),this.showDailyChallengeTooltip()}else if(GlobalVars.isjackpotLoaded)RSCasinoManager.getCasinoInterface()._popupList= [],RSAnalyticsManager.getInstance().popCurrentScreen(),RSEngine.externalGameManager.postMessageToJackpot({type:"loadPreviousScreen"});else if(this._gameManager.getCurtainRaiserScreen()&&RSGameScreenManager.getInstance().getPreviousScreen()!==RSGameScreens.MainLobby)if(!GlobalVars.isSurfacingActive&&!RSLeaderboard.getRankUpTriggerStatus())this._gameManager.playIntroScreen(this.onCurtainRaiserCompleted.bind(this));else{if(!RSLeaderboard.getRankUpTriggerStatus()||RSLeaderboard.getLeaderboardResetStatus()|| b!=RSGameScreens.Machine)this._gameManager.loadPreviousScreen(),this.showDailyChallengeTooltip()}else if(!RSLeaderboard.getRankUpTriggerStatus()||RSLeaderboard.getLeaderboardResetStatus()||b!=RSGameScreens.Machine)this._gameManager.loadPreviousScreen(),this.showDailyChallengeTooltip();this._gameManager.getCurtainRaiserScreen()||RSGame.getInstance().getGameManager().setSideMenuVisibility(!0);RSAnalyticsManager.getInstance().getCurrentScreen()==RSGameScreens.MainLobby&&this.isDailyBonusActive()||GlobalVars.isjackpotLoaded|| RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.RSPlatformEvent,parameter:RSPlatformEventTypeKeys.ON_BACK_BUTTON_CLICK,value:b})}},initiateSurfacing:function(){!GlobalVars.isSurfacingActive&&GameConfig.LM_AND_VIP_SURFACING&&RSGame.getInstance().getGameManager().getCurtainRaiserScreen()?this._gameManager.playIntroScreen(this.onCurtainRaiserCompleted.bind(this)):!GlobalVars.isSurfacingActive&&GameConfig.JL_SURFACING&&RSEngine.dataManager.getMe().getJLTriggerStatus()&& !RSEngine.dataManager.getMe().getJLSurfacingShown()?GameConfig.JACKPOT_LOUNGE_ENABLE&&RSGame.getInstance().getLevelManager().getCurrentLevel()>=GameConfig.JACKPOT_LOUNGE_LEVEL&&RSAnalyticsManager.getInstance().getCurrentScreen()==RSGameScreens.SlotsLobby?RSGame.getInstance().getGameManager().showIntroScreenForJL(this.onCurtainRaiserCompleted.bind(this)):GlobalVars.isjackpotLoaded||this._gameManager.loadPreviousScreen():GlobalVars.isjackpotLoaded||(this._gameManager.loadPreviousScreen(),this.showDailyChallengeTooltip()); RSEventManager.getInstance().removeListenersForEvent("onUserRankUp")},showDailyChallengeTooltip:function(){GlobalVars.isDCTooltipActive&&this._gameManager.getMachinePlayed()&&(this._timeSet=null,RSGame.getInstance().getGameManager().showDCToolTipPopup(null),this._timeSet=setTimeout(this.showTooltipAfterTimeOut.bind(this),1E3))},showTooltipAfterTimeOut:function(){RSEngine.popupManager.addPopup(RSGame.getInstance().getGameManager()._toolTipPopup,null,null,!1);RSGame.getInstance().getGameManager().setSideMenuVisibility(!0); clearTimeout(this._timeSet)},isDailyBonusActive:function(){return RSEngine.loginMode!=LOGIN_MODE.GUEST&&RSWidgetsManager.getInstance().getController("DailyBonusScreen").getDailyBonusActive()&&(0==RSGame.getInstance().getUserDataManager().getMe().getCurrentDay()&&RSGame.getInstance().getGameManager().getMachinePlayed()||0<RSGame.getInstance().getUserDataManager().getMe().getCurrentDay())&&!GlobalVars.dailyBonusShownStatus?!0:!1},onCurtainRaiserCompleted:function(){GlobalVars.isjackpotLoaded||this._gameManager.loadPreviousScreen()}, onPurchaseCartClicked:function(){RSEngine.loginMode==LOGIN_MODE.GUEST?(this._userDataManager.getMe().setGuestUserDataForKey("PopupName","PurchaseCart"),this._gameManager.showLoginPopup("feature","PurchaseCart")):(RSEngine.externalGameManager.hideToaster(),PurchaseFlowManager.getInstance().setShowPurchaseCart(!1),GlobalVars.isPurchaseEnabled?(RSSaleManager.getInstance().showPurchaseCart(),RSEngine.externalGameManager.postMessageToJackpot("jackpotCustomInterfaceCalls",{type:"resetKickOut"})):VideoManager.getInstance().showVideoPopup("ReplacePurchase", !1,"purchase_cart"))},onSaleButtonClicked:function(){RSEngine.externalGameManager.hideToaster();if(RSEngine.loginMode==LOGIN_MODE.GUEST)this._userDataManager.getMe().setGuestUserDataForKey("PopupName","PurchaseCart"),this._gameManager.showLoginPopup("feature","PurchaseCart");else{PurchaseFlowManager.getInstance().setShowPurchaseCart(!1);if(RSSaleManager.getInstance().getSaleActiveStatus()){if(!GlobalVars.isPurchaseEnabled){VideoManager.getInstance().showVideoPopup("ReplacePurchase",!1,"sale");return}"1"== RSEngine.gameData.getDefaultValues().isNMISubscriptionActive&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&"US"==RSGame.getInstance().getUserDataManager().getMe().getCountryCode()&&GameConfig.SUBSCRIPTION_ENABLED&&null==RSSubscrptionSaleManager.getCurrentDate("day")&&!1===RSSubscrptionSaleManager.getPaymentStatus()&&RSSaleManager.getInstance().getSubscriptionSaleStatus()&&!GameConfig.SKIP_SUBSCRIPTION_SALE_POPUP&&null!=RSSaleManager.getInstance()._allSalesData.subscription.assets[0]?RSSubscrptionSaleManager.showSubscriptionSalePopup("", this.onSubSalePopupClose.bind(this),"Sub_sale"):RSSaleManager.getInstance().showSalePopup(!1)}else{if(!GlobalVars.isPurchaseEnabled){VideoManager.getInstance().showVideoPopup("ReplacePurchase",!1,"purchase_cart");return}RSSaleManager.getInstance().showPurchaseCart()}RSEngine.externalGameManager.postMessageToJackpot("jackpotCustomInterfaceCalls",{type:"resetKickOut"})}},onSubSalePopupClose:function(a){a||RSSaleManager.getInstance().showSalePopup(!1)},onMessageInboxClicked:function(){RSEngine.loginMode== LOGIN_MODE.GUEST?this._gameManager.showLoginPopup("feature","SDKMessagePopup"):(this.resetNewsFeedCount(),RSPlatformSDKManager.getInstance().showNewsFeed(),this.scheduleFunctionOnce(function(){this._msgButton.setTouchEnabled(!0)}.bind(this),2))},onProfileStatsClicked:function(){var a={};a.CustomLabelFonts=RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold");a.CoinRewardFont=RSGame.getInstance().getAssetPath("UbuntuMonoBold_large_Goldbold");a.LevelFont=RSGame.getInstance().getAssetPath("UbuntuMonoBold_large_Bluebold"); a.ConsecutiveDaysFont=RSGame.getInstance().getAssetPath("SourceSans_large_Semibold");a.PlayerName=RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","black");a.EditablePlayerName="SourceSansPro-Black";a.EditablePlayerNameTxtLimit=15;a.CoinRewardAlignment=kTEXT_ALIGNMENT_CENTER;a.LevelTextAlignment=kTEXT_ALIGNMENT_LEFT;a.LevelTextColor=new RSColor(255,255,255,255);RSEngine.popupManager.addPopup(new RSPlayerStatsPopup(this.onProfileStatsPopupClosed.bind(this),this._iconPathArrayForPlayerStats, this._iconNameArrayForPlayerStats,a,"SlotsBtn",!1))},onProfileStatsPopupClosed:function(){},onSettingsClicked:function(){var a=RSGame.getInstance().getAssetFolder("RSSettingsPopup"),b={font:"SourceSansPro-SemiBold",color:new RSColor(255,255,255,255)};RSEngine.popupManager.addPopup(new RSSettingsPopup(a,this._gameManager.getDefaultCasinoFont("large","normal"),"https://foxplay.foxwoods.com/terms-of-service/","https://foxplay.foxwoods.com/privacy-policy/",this.onSettingsPopupClosed.bind(this),b),!1)}, onPurchaseCartClosed:function(){RSEngine.externalGameManager.postMessageToJackpot({type:"restartKickOut"});RSEventManager.getInstance().dispatchEvent("onPurchaseCartClosed",{})},onSettingsPopupClosed:function(){},createCustomObject:function(a,b){switch(b.name){case "LeveLbl":this.levelLabel=new RSScaledLabel("LEVEL",this._gameManager.getNumberFontWithoutGlow("large","bold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this.levelLabel);break;case "PrimaryCurrency":this.coinField=new RSScaledLabel(RSUtils.formatNumber(this._userDataManager.getMe().getCoins(), 3),this._gameManager.getHUDCasinoFont("large","Goldbold"),b,kTEXT_ALIGNMENT_CENTER);this.coinField.setColor(new RSColor(255,255,255,255));this.addChild(this.coinField);this.tournamentInPlayText=new RSScaledLabel("TOURNAMENT IN PLAY",RSGame.getInstance().getGameManager().getDefaultCasinoFont("largeGold","Semibold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this.tournamentInPlayText);GlobalVars.isTournamentLoaded?this.coinField.setVisible(!1):this.tournamentInPlayText.setVisible(!1);break;case "Level":this.levelId= new RSScaledLabel("1",this._gameManager.getHUDCasinoFont("large","Bluebold"),b,kTEXT_ALIGNMENT_LEFT);this.addChild(this.levelId);break;case "NewsFeedBubble":this._newsFeedBg=RSUtils.createBasicObject(a,b);this.addChild(this._newsFeedBg);this._newsFeedBg.setVisible(!1);RSEngine.loginMode==LOGIN_MODE.FACEBOOK&&this._newsFeedBg.setX(this._newsFeedBg.getX()-14);break;case "NewsFeedCount":this._newsFeedCount=new RSScaledLabel("",this._gameManager.getNumberFontWithoutGlow("large","bold"),b,kTEXT_ALIGNMENT_CENTER); this._newsFeedCount.setColor(new RSColor(255,255,255,255));this.addChild(this._newsFeedCount);RSEngine.loginMode==LOGIN_MODE.FACEBOOK&&this._newsFeedCount.setX(this._newsFeedCount.getX()-14);break;case "LevelMeterBase":this._levelMeterBase=b;this._progressBar=new RSTopHudProgressBar(this._levelMeterBase,"Hud",0.2,this._progressFillAnim,this._progressFillEdgeAnim,this._xpBoostAnim);this.addChild(this._progressBar);break;case "Tournamania":if(RSEngine.loginMode!=LOGIN_MODE.GUEST&&GameConfig.TOURNAMENT_ENABLED&& parseInt(RSEngine.gameData.getDefaultValues().isTournamentEnabled)){var c={};c.inGameCountDownFont=RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold");this._tournamentTimerWidget=new RSTournamentHudTimerWidget(b,c,this.tournamentTimerCallback.bind(this));this._tournamentTimerWidget.addTouchListenerWithDelegate(this);this.addChild(this._tournamentTimerWidget);this._tournamentTimerWidget.setCenter(b.x,b.y);this._tournamentTimerWidget.setVisible(!1);this._tournamentTimerWidgetPosition= b}break;case "MessageBubble":RSEngine.loginMode!=LOGIN_MODE.GUEST&&parseInt(RSEngine.gameData.getDefaultValues().isTournamentEnabled)&&(this._tournamentBubbleWidget=new RSTournamentMessageBubbleWidget(b,null,this._onTournamentBubbleButtonClicked.bind(this)),this.addChild(this._tournamentBubbleWidget),this._tournamentBubbleWidget.setCenter(b.x,b.y),this._tournamentBubbleWidget.setVisible(!1));break;case "HudPurchaseWidgetRect":this._purchaseWidget=new RSHudPurchaseWidget(b,null,!1);this.addChild(this._purchaseWidget); this._purchaseWidget.setCenter(b.x,b.y);this._purchaseWidget.setDelegate(this);this._purchaseWidgetPosition=b;break;case "Overlay":this._panel=new RSPanel(0,0,0,0),this._bgPanel=new RSPanel(b.x,b.y,b.w,b.h),this._font=RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold"),this._bgPanel.setBackgroundColor(0,0,0,200),this._panelText=new RSScaledLabel("Fullscreen feature is not supported for this browser.",this._font,b,kTEXT_ALIGNMENT_CENTER),this._panel.addChild(this._bgPanel), this._panel.addChild(this._panelText)}},setNewsFeedCount:function(a){0<a&&(this._newsFeedBg&&this._newsFeedBg.setVisible(!0),this._newsFeedCount&&this._newsFeedCount.setString(""+a),GlobalVars.newsFeedCount=a)},resetNewsFeedCount:function(){this._newsFeedBg&&this._newsFeedBg.setVisible(!1);this._newsFeedCount&&this._newsFeedCount.setString("");GlobalVars.newsFeedShownStatus=!0},setCurrencyValue:function(a){a>this._winDisplay?(this.stopWinRollUp(),this.startActionTweenForKey("HUDRollUp",3,this._winDisplay, a)):(this.stopWinRollUp(),this.coinField.setString(RSUtils.formatNumberWithComma(a)),this._winDisplay=Math.floor(a));GlobalVars.isjackpotLoaded&&RSEngine.externalGameManager.postMessageToJackpot({type:"updateCoinBalance",level:this._userDataManager.getMe().getUserLevel(),coinBalance:this._userDataManager.getMe().getCoins()})},actionOnUpdate:function(a,b){this._winDisplay=Math.floor(b);this.coinField.setString(RSUtils.formatNumberWithComma(this._winDisplay))},actionOnComplete:function(){this.stopWinRollUp()}, stopWinRollUp:function(){this.stopActionTweenForKey("HUDRollUp");this.coinField.setString(RSUtils.formatNumberWithComma(this._winDisplay))},onButtonClicked:function(a){if(!GlobalVars.isMachineLoadingInProgress)switch(RSEngine.externalGameManager.hideToaster(),a){case "SettingsButton":this.onSettingsClicked();break;case "Leaderboard":this.onLeaderboardClicked();break;case "ProfileStats":this.onProfileStatsClicked();break;case "MsgButton":this._msgButton.setTouchEnabled(!1);this.onMessageInboxClicked(); break;case "BackButton":this.onBackButton();break;case "GuestBtn":RSEngine.loginMode==LOGIN_MODE.GUEST&&this._gameManager.showLoginPopup("feature","FbConnectPopup");break;case "Gift":RSSocialManager.getInstance().showInviteWindow("Invite friends to FoxPlay Casino","Come play FoxPlay Casino!",null,null,null);break;case "LogOutBtn":GameConfig.SSO_ENABLED&&(RSSSOManager.getBlobIdData().blob_id?RSEngine.popupManager.addPopup(new RSAccountManagementPopup("logout"),!0):RSEngine.popupManager.addPopup(new RSSingleSignOnPopup(parseInt(RSEngine.gameData.getDefaultValues().emailReward)), !0));break;case "FullScreenBtnFalse":case "FullScreenBtnTrue":this.onFullScreenClicked()}},onLeaderboardClicked:function(){var a=!1;RSLeaderboard.getRankUpTriggerStatus()&&(a=!0);RSLeaderboardManager.showLeaderboardScreen(a,!0)},setXP:function(a){this._super.setXP.call(this,a);this.setXpBar(RSGame.getInstance().getLevelManager().getLevelBarProgress())},playStarReceivedAnimation:function(a,b,c){null==a&&(a=new RSPoint(0,0));var d=b.convertToNodeSpace(this._starObject.getX()-a.getX(),this._starObject.getY()- a.getY());cc.spriteFrameCache.addSpriteFrames("res/PlatformWidgets/CurtainRaiser/StartAnim_00-hd.plist");var e=new RSEmitterParticleParams;e._spriteFrames.push("StartAnim_00/Star1.png");e._spriteAnimationSpeed=0.5;e._origin=a;e._startDelay=0.3;e._startDelayVariance=0.3;e._deviation=60;e._deviationVariance=20;e._displacement=d;e._speed=800;e._360rotationDuration=0.5;this._coinEmitter=new RSCustomAnimationEmitter(e,!1,RSCustomEmitterType.VERTICAL_SNAKE,30,c);this._coinEmitter.loadEmitter();b.addChild(this._coinEmitter); this._coinEmitter.setZOrder(1);this._coinEmitter.startEmitter();RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("coinFly_SFX"),!1)},playCoinReceivedAnimation:function(a,b,c){null==a&&(a=new RSPoint(0,0));var d=b.convertToNodeSpace(this._coinPos.getX()-a.getX(),this._coinPos.getY()-a.getY());cc.spriteFrameCache.addSpriteFrames("res/Popups/CoinFallAnimationSmall_00-hd.plist");var e=new RSEmitterParticleParams;e._spriteFrames.push("CoinFallAnimationSmall_00/CoinFallAnimationSmall_0000.png"); e._spriteAnimationSpeed=0.5;e._origin=a;e._startDelay=0.3;e._startDelayVariance=0.3;e._deviation=60;e._deviationVariance=20;e._displacement=d;e._speed=800;e._360rotationDuration=0.5;this._coinEmitter=new RSCustomAnimationEmitter(e,!1,RSCustomEmitterType.VERTICAL_SNAKE,30,c);this._coinEmitter.loadEmitter();b.addChild(this._coinEmitter);this._coinEmitter.setZOrder(1);this._coinEmitter.startEmitter();RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("coinFly_SFX"),!1)},checkSessionStopEvent:function(){var a= "";if(RSGameScreenManager.getInstance().getCurrentScreen()==RSGameScreens.Machine){this._gameManager.getGameType()!=RSGameTypes.Bingo?this._userDataManager.saveUserBlobParams():a=RSGame.getInstance().getGameManager().getCardCount();var b=RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName();RSAnalyticsManager.getInstance().trackGameStop(b,a);RSGameScreenManager.getInstance().getPreviousScreen()!==RSGameScreens.Machine&&RSAnalyticsManager.getInstance().trackLobbyEntry(RSGameScreenManager.getInstance().getPreviousScreen(), "","open_from_"+b)}},enableAllButtons:function(){SideMenuController.getInstance().enableAllButtons();GlobalVars.isTournamentLoaded||(null!=this._settingsButton&&this._settingsButton.setTouchEnabled(!0),null!=this._leaderboard&&GameConfig.LEADERBOARD_ENABLED&&this._leaderboard.setTouchEnabled(!0),null!=this._profileStats&&this._profileStats.setTouchEnabled(!0),null!=this._msgButton&&1==parseInt(RSGame.getInstance().getGameData().getDefaultValues().ClevertapInAppMsgStatus)&&this._msgButton.setTouchEnabled(!0), null!=this._logOutBtn&&this._logOutBtn.setTouchEnabled(!0),null!=this._purchaseWidget&&(this._purchaseWidget.enablePurchaseButton(),this.checkSaleStatusAndStartBuyButtonAnimation()),null!=this._tournamentTimerWidget&&this._tournamentTimerWidget.setTouchEnabled(!0),null!=this._vipStatusBg&&this._vipStatusBg.setTouchEnabled(!0),null!=this._fullScreenFalse&&this._fullScreenFalse.setTouchEnabled(!0),null!=this._fullScreenTrue&&this._fullScreenTrue.setTouchEnabled(!0),null!=this._guestBtn&&this._guestBtn.setTouchEnabled(!0)); null!=this._backButton&&RSGameScreenManager.getInstance().getCurrentScreen()!=RSGameScreens.MainLobby&&this._backButton.setTouchEnabled(!0)},enableBackButtonForDirectLoading:function(){null!=this._backButton&&this._backButton.setTouchEnabled(!0)},disableAllButtons:function(){SideMenuController.getInstance().disableAllButtons();null!=this._settingsButton&&this._settingsButton.setTouchEnabled(!1);null!=this._leaderboard&&this._leaderboard.setTouchEnabled(!1);null!=this._profileStats&&this._profileStats.setTouchEnabled(!1); null!=this._msgButton&&this._msgButton.setTouchEnabled(!1);null!=this._backButton&&this._backButton.setTouchEnabled(!1);null!=this._fullScreenFalse&&this._fullScreenFalse.setTouchEnabled(!1);null!=this._fullScreenTrue&&this._fullScreenTrue.setTouchEnabled(!1);null!=this._logOutBtn&&this._logOutBtn.setTouchEnabled(!1);null!=this._purchaseWidget&&this._purchaseWidget.disablePurchaseButton();null!=this._tournamentTimerWidget&&this._tournamentTimerWidget.setTouchEnabled(!1);null!=this._vipStatusBg&&this._vipStatusBg.setTouchEnabled(!1); null!=this._guestBtn&&this._guestBtn.setTouchEnabled(!1)},refreshAvatar:function(){this.setProfilePic("","")},setProfilePic:function(a,b){b&&(this._screenName=b);var c=new RSImageObject,d=RSEngine.dataManager.getMe().getAvatar();GameConfig.IS_EDIT_FIELDS_ENABLED&&d?(d=GameConfig.BASE_URL+"/res/AvatarImages/"+d+".png",c.setImageFromUrl(d,this._objectData.x,this._objectData.y,this._objectData.w,this._objectData.h)):RSEngine.loginMode==LOGIN_MODE.EMAIL&&d?(d=GameConfig.BASE_URL+"/res/AvatarImages/"+ d+".png",c.setImageFromUrl(d,this._objectData.x,this._objectData.y,this._objectData.w,this._objectData.h)):c.setImageFromUrl(this._userDataManager.getMe().getImageUrl(),this._objectData.x,this._objectData.y,this._objectData.w,this._objectData.h);this._profileImage=c;this.createProfilePicObject()},createProfilePicObject:function(){null!=this.mask&&(this.removeChild(this.mask),this.mask.unload(),this.mask=null);this._profileImage&&this._objectData&&!this.mask&&(this.mask=new RSClippingNode(RSUtils.createBasicObject(this._screenName, this._objectData)),this.mask.setAlphaThreshold(80),this.mask.addChild(this._profileImage),this.addChild(this.mask))},notifyToHud:function(a){var b=this._userDataManager.getMe().getCoins()+a[GameFeatureTypeEnum.PRIMARY_CURRENCY];this.setCurrencyValue(b);1==RSGame.getInstance().getGameVariable().getFPVPUserMigratedStatus()&&RSEngine.loginMode==LOGIN_MODE.FACEBOOK?(RSEngine.dataManager.getMe().setCoins(b),this._userDataManager.getMe().syncBlobVars(b)):this._userDataManager.getMe().syncBlobVars(a)},addToaster:function(a){this._toaster= a;this.addChild(this._toaster)},removeToaster:function(){null!=this._toaster&&this.removeChild(this._toaster,!0);this._toaster=null},setDelegate:function(a){this._delegate=a},unSetDelegate:function(){this._delegate=null},playLevelupAnimation:function(){var a=this._levelDataManager.getCurrentLevel();if(GlobalVars.isjackpotLoaded||0!==a%5&&2!==a)this._levelupAnimation.setFrame(0),this._levelupAnimation.setVisible(!0),!0===this._interuptTriggered?(this.levelId.setVisible(!1),a=new RSPoint(this._levelupAnimation.getX(), this._levelupAnimation.getY()),self=this,this._levelupAnimation.playAnimation(1,1,this.playCoinReceivedAnimation(a,this,function(){self._levelupAnimation.setVisible(!1);self.levelId.setVisible(!0);self.levelId.setString(RSUtils.formatNumberWithComma(self._levelDataManager.getCurrentLevel()));self._piggyWinAnimActive?(RSGame.getInstance().getGameManager().getIsMachineUnlockActive()&&(this._speedUpAnimations=!0),self.showPiggyBankAnim("PiggyWin")):(self._interuptTriggered=!1,RSGame.getInstance().getGameManager().hideOverlayLayer())})), clearInterval(this._levelUpCheck)):(null!=this._levelUpCheck&&clearInterval(this._levelUpCheck),this._levelUpCheck=setInterval(this.playLevelupAnimation.bind(this),1E3))},animatePiggyBank:function(a){var b=this._levelDataManager.getCurrentLevel();if(a&&!this._piggyWinAnimActive){if("PiggyWin"===a)if(GlobalVars.isjackpotLoaded||0!==b%5&&2!==b)if(this._piggyWinAnimActive=!0,!0===this._interuptTriggered)this._piggyAnims=[];else return;else{this._piggyAnims=[];return}this._piggyAnims.push(a)}else this._animInProgress= !1;!this._animInProgress&&!this._piggyWinAnimActive&&0<this._piggyAnims.length&&(this._animInProgress=!0,this.showPiggyBankAnim(this._piggyAnims.shift()))},showPiggyBankAnim:function(a){switch(a){case "minBet":this.animatePiggyBank();break;case "bet":this._piggy.setVisible(!1);this._piggySmallBetAnim.setVisible(!0);this._piggySmallBetAnim.playAnimation(1,1,this.showPiggyBankAnim.bind(this,"hideSmallBetAnim"));RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("normalBet_SFX"),!1); break;case "maxBet":this._piggy.setVisible(!1);this._piggyMaxBetAnim.setVisible(!0);this._piggyMaxBetAnim.playAnimation(1,1,this.showPiggyBankAnim.bind(this,"hideMaxBetAnim"));RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("maxBet_SFX"),!1);break;case "hideSmallBetAnim":this._piggySmallBetAnim.setVisible(!1);this._piggySmallBetAnim.stopAnimation();this._piggy.setVisible(!0);this.showPiggyBankAnim();break;case "hideMaxBetAnim":this._piggyMaxBetAnim.setVisible(!1);this._piggyMaxBetAnim.stopAnimation(); this._piggy.setVisible(!0);this.showPiggyBankAnim();break;case "PiggyWin":this._piggy.setVisible(!1);this._piggyWinAnim.setVisible(!0);this._piggyWinAnim.playAnimation(1,1,this.showPiggyBankAnim.bind(this,"playPiggyCoinWinAnim"));RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("piggyWin_SFX"),!1);break;case "playPiggyCoinWinAnim":this._piggyWinAnim.stopAnimation();this._piggyWinAnim.setVisible(!1);this._piggyCollectedAnim.setVisible(!0);this._piggyCollectedAnim.setFrame(0);this.playCoinReceivedAnimation(new RSPoint(this._levelupAnimation.getX(), this._levelupAnimation.getY()),this,this.showPiggyBankAnim.bind(this,"showPiggyBonusWinCollectedAnim"));break;case "showPiggyBonusWinCollectedAnim":this._piggyCollectedAnim.playAnimation(1,1,this.showPiggyBankAnim.bind(this,"hidePiggyCollectedAnim"));RSCasinoManager.addPrimaryCurrencyForDisplay("PiggyBankValue",RSGame.getInstance().getGameManager().getLastAwardedPiggyBonus());RSGame.getInstance().getGameManager().hideOverlayLayer();this._interuptTriggered=!1;break;case "hidePiggyCollectedAnim":this._piggyCollectedAnim.setVisible(!1); this._piggyCollectedAnim.stopAnimation();this._piggy.setVisible(!0);this._piggyWinAnimActive=!1;this.showPiggyBankAnim();break;default:this.animatePiggyBank()}},onFullScreenClicked:function(){cc.sys.browserType==cc.sys.BROWSER_TYPE_IE||cc.sys.browserType==cc.sys.BROWSER_TYPE_UNKNOWN||-1<window.navigator.userAgent.indexOf("Edge")?this.showBrowserUnsupported("Fullscreen feature is not supported for this browser."):this._toggleFullScreen()},_toggleFullScreen:function(){if(this._fullScreenTrue&&this._fullScreenFalse){RSEngine.toggleFullscreen(); var a=!GlobalVars.fullscreenStatus;GlobalVars.fullscreenStatus=a;this.setFullScreenButtonStatus(a)}},setFullScreenButtonStatus:function(a){a?(this._fullScreenTrue.setVisible(!0),GlobalVars.isTournamentLoaded||this._fullScreenTrue.setTouchEnabled(!0),this._fullScreenFalse.setVisible(!1),this._fullScreenFalse.setTouchEnabled(!1)):(this._fullScreenFalse.setVisible(!0),GlobalVars.isTournamentLoaded||this._fullScreenFalse.setTouchEnabled(!0),this._fullScreenTrue.setVisible(!1),this._fullScreenTrue.setTouchEnabled(!1))}, showBrowserUnsupported:function(a){GlobalVars.isInsideMachine&&(RSCasinoManager.getCasinoHUD().disableAllButtons(),RSEngine.externalGameManager.hideExternalGame());a&&this._panelText.setString(a);GlobalVars.isInsideMachine||(this._fullScreenFalse&&this._fullScreenFalse.setTouchEnabled(!1),this._fullScreenTrue&&this._fullScreenTrue.setTouchEnabled(!1));this.addChild(this._panel);this._panel.getDisplayObject().setOpacity(0);this._panel.getDisplayObject().setCascadeOpacityEnabled(!0);this._panel.actionFadeIn(2, this._removePanel.bind(this))},_removePanel:function(){this._panel.actionFadeOut(0.5,this._panelDisabled.bind(this))},_panelDisabled:function(){this.removeChild(this._panel);GlobalVars.isInsideMachine||GlobalVars.isTournamentLoaded||(this._fullScreenFalse&&this._fullScreenFalse.setTouchEnabled(!0),this._fullScreenTrue&&this._fullScreenTrue.setTouchEnabled(!0));GlobalVars.isInsideMachine&&(RSEngine.externalGameManager.showExternalGame(),RSCasinoManager.getCasinoHUD().enableAllButtons())},showLevelupInitiated:function(){this._interuptTriggered= !0},isLevelUpInitiated:function(){return this._interuptTriggered},tournamentTimerCallback:function(a,b){if(!GlobalVars.isTournamentLoaded&&this._tournamentBubbleWidget)if(RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-bubbleShown")<RSTournamentManager.getTournamentLBEndTime()&&!RSTournamentManager.isTournamentFirst()&&(this._showIntermediateBubble=!0),8>=a)0<=a&&this._tournamentBubbleWidget.setVisible(!0),this._tournamentBubbleWidget.updateCountDownText(a);else if(b)this._tournamentBubbleWidget.setVisible(!0), this._tournamentBubbleWidget.showTournamentEntryInfoText();else if(!RSTournamentManager.isTournamentFirst()&&RSTournamentManager.getIntermediateBubbleStatus())this._triggerIntermediateMessageBubble();else if(this._showIntermediateBubble&&TimeManager.getInstance().getCurrentServerTime()>RSTournamentManager.getTournamentLBEndTime()+RSTournamentManager.getIntermediateMessageTime()){var c=TimeManager.getInstance().getCurrentServerTime()-RSGame.getInstance().getGameManager().getMainLobbyLoadedTime();5<= c&&10>=c?this._triggerIntermediateMessageBubble(c):this._tournamentBubbleWidget.setVisible(!1)}else a<=RSTournamentManager.getMachineRedirectionTime()&&a>RSTournamentManager.getMachineRedirectionTime()-5?(this._tournamentBubbleWidget.showTournamentEntryInfoText(),this._tournamentBubbleWidget.showWaitingRoomOpenBubble(),this._tournamentBubbleWidget.setVisible(!0),a!=RSTournamentManager.getMachineRedirectionTime()||"gameplay_screen"!=RSGameScreenManager.getInstance().getCurrentScreen()&&!GlobalVars.isjackpotLoaded|| SideMenuController.getInstance().playSurfacingAnimation("TournamentWaitingOpen")):(this._tournamentBubbleWidget.setVisible(!1),this._tournamentBubbleWidget.dismissTournamentEntryInfoText())},_triggerIntermediateMessageBubble:function(a){!GlobalVars.isTournamentLoaded&&RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-bubbleShown")<RSTournamentManager.getTournamentLBEndTime()&&(this._tournamentBubbleWidget.showTournamentEntryInfoText(),this._tournamentBubbleWidget.showIntermediateBubbleMessage(), this._tournamentBubbleWidget.setVisible(!0),5!=a||"gameplay_screen"!=RSGameScreenManager.getInstance().getCurrentScreen()&&!GlobalVars.isjackpotLoaded||SideMenuController.getInstance().playSurfacingAnimation("IntermediateBubbleInfo"));a={};a[GameConfig.COOKIE_PREFIX+"-bubbleShown"]=RSTournamentManager.getUpdatedTournamentTimerData().tournamentStartTime;RSLoginManager.getInstance().setCookie(GameConfig.SSO_COOKIE_DOMAIN,null,a)},_onTournamentBubbleButtonClicked:function(a){!GlobalVars.isTournamentLoaded&& a?(this._purchaseWidget.setVisible(!0),this.removeChild(this._tournamentBubbleWidget,!0),this._tournamentTimerWidget&&(this.removeChild(this._tournamentTimerWidget,!0),this._tournamentTimerWidget=null),RSGame.getInstance().getGameManager().loadTournament()):(this._tournamentBubbleWidget.setVisible(!1),this._tournamentBubbleWidget.reset())},startTournamentTimerToggleAnimation:function(){if(RSEngine.loginMode!=LOGIN_MODE.GUEST){if(this._tournamentWidgetHided){if(null!=this._purchaseWidget){this._purchaseWidget.setVisible(!0); var a=this._purchaseWidget.actionScale(0.15,1,0.5,this._onScaleDownCompleted.bind(this));RSTweener.easeSineIn(a)}}else null!=this._tournamentTimerWidget&&(this._tournamentTimerWidget.setVisible(!0),a=this._tournamentTimerWidget.actionScale(0.15,1,0.5,this._onTournamentTimerWidgetAnimationCompleted.bind(this)),RSTweener.easeSineIn(a));this._tournamentWidgetHided=!this._tournamentWidgetHided}},_onPurchaseWidgetUpAnimationCompleted:function(){var a=this._purchaseWidget.actionMoveBy(1,0,-(1.5*this._purchaseWidget.getSize()._height), this._onPurchaseWidgetDownAnimationCompleted.bind(this));RSTweener.easeSineIn(a)},_onPurchaseWidgetDownAnimationCompleted:function(){this._purchaseWidget.setVisible(!1)},_onTournamentTimerWidgetAnimationCompleted:function(){this._tournamentTimerWidget.setVisible(!1);if(null!=this._purchaseWidget){this._purchaseWidget.setVisible(!0);this._purchaseWidget.setScaleY(0.5);var a=this._purchaseWidget.actionScale(0.25,1,1,this._onPurchaseWidgetScaleUpCompleted.bind(this));RSTweener.easeSineIn(a)}},_onTournamentBtnScaleUpCompleted:function(){cc.log("timer scale up completed")}, _onPurchaseWidgetScaleUpCompleted:function(){cc.log("on purchase cart scale up completed")},_onScaleDownCompleted:function(){this._purchaseWidget.setVisible(!1);if(null!=this._tournamentTimerWidget){this._tournamentTimerWidget.setVisible(!0);this._tournamentTimerWidget.setScaleY(0.5);this._tournamentTimerWidget.setVisible(!0);var a=this._tournamentTimerWidget.actionScale(0.25,1,1,this._onTournamentBtnScaleUpCompleted.bind(this));RSTweener.easeSineIn(a)}},updateTournamentTimer:function(){var a=RSTournamentManager.tournamentStartsIn(), b=RSTournamentManager.tournamentEndsIn();86400<a?(this._tournamentTimerWidget&&this._tournamentTimerWidget.setVisible(!1),this._purchaseWidget&&(this._purchaseWidget.setScaleY(1),this._purchaseWidget.setVisible(!0))):(a&&a==RSTournamentManager.getHudTimerStartsIn()+6&&(this._flipAnimLeft.setVisible(!0),this._flipAnimRight.setVisible(!0),this._flipAnimLeft.playAnimation(1,0.33),RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("HudMessageBubble")+"Hud_sparkle.mp3",!1),this._flipAnimRight.playAnimation(1, 0.33,this._onFlipAnimationCompleted.bind(this)),"gameplay_screen"==RSGameScreenManager.getInstance().getCurrentScreen()||GlobalVars.isjackpotLoaded)&&(RSTournamentManager.isTournamentFirst()?SideMenuController.getInstance().playSurfacingAnimation("TournamentEntryinfo"):SideMenuController.getInstance().playSurfacingAnimation("IntermediateBubbleInfo")),a&&!GlobalVars.isTournamentLoaded&&a>RSTournamentManager.getHudTimerStartsIn()+6&&(this._tournamentTimerWidget&&this._tournamentTimerWidget.setVisible(!1), this._purchaseWidget&&(this._purchaseWidget.setScaleY(1),this._purchaseWidget.setVisible(!0)),this._tournamentWidgetHided=!0),0!=a%5||0!=b%5||a<=RSTournamentManager.getHudTimerStartsIn()&&a>RSTournamentManager.getHudTimerStartsIn()-5||(a?a>RSTournamentManager.getHudTimerFreezesIn()?GlobalVars.isTournamentLoaded?(this._tournamentTimerWidget&&this._tournamentTimerWidget.setVisible(!1),this._purchaseWidget&&(this._purchaseWidget.setScaleY(1),this._purchaseWidget.setVisible(!0)),this._tournamentWidgetHided= !0):0<a&&a<RSTournamentManager.getHudTimerStartsIn()+6&&this.startTournamentTimerToggleAnimation():a<RSTournamentManager.getHudTimerFreezesIn()?GlobalVars.isTournamentLoaded?(this._tournamentTimerWidget&&this._tournamentTimerWidget.setVisible(!1),this._purchaseWidget&&(this._purchaseWidget.setScaleY(1),this._purchaseWidget.setVisible(!0)),this._tournamentWidgetHided=!0):(this._tournamentTimerWidget&&(this._tournamentTimerWidget.setVisible(!0),this._tournamentTimerWidget.setScaleY(1)),this._purchaseWidget&& this._purchaseWidget.setVisible(!1),this._tournamentWidgetHided=!1):(this._tournamentTimerWidget&&this._tournamentTimerWidget.setVisible(!1),this._purchaseWidget&&(this._purchaseWidget.setScaleY(1),this._purchaseWidget.setVisible(!0)),this._tournamentWidgetHided=!0):GlobalVars.isTournamentLoaded?b&&!a?(this._tournamentTimerWidget&&(this._tournamentTimerWidget.setVisible(!0),this._tournamentTimerWidget.setScaleY(1)),this._purchaseWidget&&this._purchaseWidget.setVisible(!1),this._tournamentWidgetHided= !1):(this._tournamentTimerWidget&&this._tournamentTimerWidget.setVisible(!1),this._purchaseWidget&&(this._purchaseWidget.setScaleY(1),this._purchaseWidget.setVisible(!0)),this._tournamentWidgetHided=!0):b&&0==a&&this.startTournamentTimerToggleAnimation()))},_onFlipAnimationCompleted:function(){this._flipAnimLeft.setVisible(!1);this._flipAnimRight.setVisible(!1)},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){RSEngine.externalGameManager.hideToaster(); "HudTimerWidget"==a._ccObject._name?this._tournamentTimerWidget&&!GlobalVars.isTournamentLoaded&&(a=RSTournamentManager.getUpdatedTournamentTimerData().tournamentStartTime-TimeManager.getInstance().getCurrentServerTime(),RSTournamentManager.getTournamentSurfacingEnabledStatus()==TOURNAMENT_SURFACING_TYPES.BEFORE_FEATURE_LAUNCH||RSTournamentManager.getTournamentSurfacingEnabledStatus()==TOURNAMENT_SURFACING_TYPES.TOURNAMENT_IN_PROGRESS?RSTournamentManager.showTournamentSurfacing(null):a<RSTournamentManager.getMachineRedirectionTime()&& RSGame.getInstance().getGameManager().loadTournament()):"VipStatusBg"!==a._ccObject._name||GlobalVars.isTournamentLoaded||(RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"),!1),RSGame.getInstance().getGameManager().showVIPBenefitsPopup())},showNoStarTooltip:function(a){var b=RSGame.getInstance().getAssetPath("NoStarTooltip");this._tierZeroTooltip=new GenericTooltip(b,5,a);RSEngine.popupManager.addPopup(this._tierZeroTooltip,!1,!1,!1)},showUpgradeVIPTooltip:function(a){var b= RSGame.getInstance().getAssetPath("UpgradeVIPStatusTooltip");this._VIPTooltip=new GenericTooltip(b,5,a);RSEngine.popupManager.addPopup(this._VIPTooltip,!1,!1,!1)},unload:function(){clearInterval(this._tournamentTimer);this._tournamentTimerWidget&&this.removeChild(this._tournamentTimerWidget,!0);this._tournamentBubbleWidget&&this.removeChild(this._tournamentBubbleWidget,!0);this._purchaseWidget&&this.removeChild(this._purchaseWidget,!0);clearInterval(this._bonusTimer);clearInterval(this._levelUpCheck); clearTimeout(this._fadeTimer);this._super.unload.call(this)}});var a0_0x5a6e60=a0_0x3990; function a0_0x5033(){var a="_loader enablePurchaseButton 14762jltvDR _me onSpinStarted _wager callMachineOpenPopup call classList 12472497aMLLpA getElementById _gameType init onSpinGameLoaded 3533894csSKOa JACKPOT_LOUNGE_ENABLE 545MAWRNF postMessageToJackpot 1679112KMjOXg getGameManager 10jClmNi loadNewScreen loaderWithoutSpin MACHINE_OPEN_POPUP remove getCurrentMachineIsInternal getEmitterFrames 2525992Axsmmz _gameName setLoaderVisible getInstance _emitterSprites getCasinoHUD getMachineOpenPopupStatus 6489090fnHdXZ loaderSpin getCurrentMachineAnalyticsName externalGameManager getUserDataManager add _result _totalBetAmount 14180wXLJrt screenManager notifyResultToCasino extend _machineAnalyticsID setSideMenuVisibility gameOverLaySpinToPause 81XsiugA".split(" ");a0_0x5033= function(){return a};return a0_0x5033()}(function(a,b){for(var c=a0_0x3990,d=a();;)try{if(parseInt(c(399))/1*(-parseInt(c(402))/2)+-parseInt(c(368))/3+parseInt(c(392))/4*(-parseInt(c(366))/5)+parseInt(c(384))/6+-parseInt(c(364))/7+parseInt(c(377))/8+parseInt(c(409))/9*(parseInt(c(370))/10)===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x5033,734285);function a0_0x3990(a,b){var c=a0_0x5033();return a0_0x3990=function(a,b){return c[a-361]},a0_0x3990(a,b)} var CustomExternalGameInterface=RSExternalGameInterface[a0_0x5a6e60(395)]({_wager:0,_result:0,_gameType:null,_gameName:null,_loader:null,init:function(){var a=a0_0x5a6e60;this._super[a(362)][a(407)](this)},notifyRoundStart:function(){var a=a0_0x5a6e60;this[a(361)]==RSGameTypes.Slots&&(RSGame.getInstance()[a(388)]()[a(403)].setSpins(RSAnalyticsManager[a(380)]()[a(386)]()),GameConfig[a(365)]&&RSEngine[a(387)].postMessageToJackpot({type:a(404)}))},notifyLoadStart:function(){var a=a0_0x5a6e60;if(GameConfig[a(373)]){var b= [];b[a(381)]=RSGame[a(380)]()[a(369)]()[a(376)]();RSGame.getInstance()[a(369)]()[a(375)]()?RSGame[a(380)]()[a(369)]()[a(406)](!0,null,b):RSGame.getInstance()[a(369)]()[a(406)](null,null,b)}else this[a(400)]=new CasinoExternalGameLoader,RSEngine[a(393)][a(371)](this._loader);b=document[a(410)](a(398));b.classList[a(389)](a(372));b[a(408)].remove(a(385))},notifyGameLoaded:function(a,b){var c=a0_0x5a6e60;RSGame[c(380)]().getGameManager()[c(397)](!1);this[c(378)]=a;this[c(361)]=b;!GlobalVars.isjackpotLoaded&& RSGame[c(380)]()[c(369)]().calculateLoadingTime(RSAnalyticsManager[c(380)]()[c(386)]());RSCasinoManager[c(382)]()&&RSCasinoManager[c(382)]()[c(401)]();RSEngine.externalGameManager[c(367)]({type:c(363)});this[c(400)][c(379)](!1)},notifyRoundResult:function(a,b){var c=a0_0x5a6e60;!isNaN(a)&&(this[c(405)]=a);isNaN(b)?this._result=0:this[c(390)]=b},notifyRoundComplete:function(){var a=a0_0x5a6e60,b=new RSCasinoResult;b[a(391)]=this[a(405)];b._totalWinAmount=this[a(390)];b[a(396)]=RSAnalyticsManager[a(380)]()[a(386)](); RSCasinoManager[a(394)](b)},showExternalGame:function(){var a=a0_0x5a6e60;this[a(400)]?this[a(400)].setBackgroundVisible(!1):!RSGame[a(380)]().getGameManager()[a(383)]()&&(this[a(400)]=new CasinoExternalGameLoader,RSEngine[a(393)].loadNewScreen(this._loader))},hideExternalGame:function(){var a=a0_0x5a6e60;this[a(400)]&&this._loader.setBackgroundVisible(!0);var b=document[a(410)](a(398));b[a(408)][a(389)]("loaderSpin");b[a(408)][a(374)]("loaderWithoutSpin")}});var a0_0x3b1bb4=a0_0x12dd; function a0_0x7406(){var a="getCurrentServerTime;jlAvatarPopupOpen;gift_line_win;Blackjack;redeemCoins;trackEvent;loginMode;isLoyaltyMallLoaded;MSPT;buyInAppPack;onBackButton;RouletteStatsSetHighestWin;loyaltymall_economy_event;FACEBOOK;failed;show_tournament_leaderboard;trackErrorMessage;includes;setPreviousScreen;machine_entry;hideGameOverlay;roulette_game_action;isDealInProgress;avatar_popup;GenericPopup;updatePiggyBank;onSharingToFBSuccess;rewardJackpotWelcomeBonus;Lounge;trackPrimarySource;push;WEB_FACEBOOK;onSubscriptionSuccess;triggerMemoryPopupStatus;getDefaultBetForCasino;1232952FwGlGD;getSkipForJL;RS_CASINO_BUTTON_BINGO;trackFBOGShare;fue_disabled;_totalBetAmount;_ignoreResizeForHud;isStringContains;isInsideExternalGame;setGuestUserDataForKey;jackpot_win_popup;loadJackpotLounge;loadMachine;betAmountChange;isSpinGameActive;apply;getAssetPath;addClippingToExternalGame;resizeSpinGameDiv;_currentLevel;sent;getCoins;machine_identifier;Bingo;_handWin;onPurchaseSuccess;RS_POKER_DON_INITIATE_PURCHASE;init;130zQTcll;start;setJackpotTier;notifyBetAmountChangeToCasino;isSurfacingActive;isMachineGifted;enablePurchaseButton;_pack;setVIPMachineUnlockShown;_lastEventUpdatedTime;_rank;getMe;26TkCAmi;free_spins;kenoStatsSetHighestWin;resetKickOut;getMachineDetailsByName;_cancelCallback;getGameManager;paddingLeft;object;getMaxBetValueForSlot;getExternalBonusSpinActive;getCasinoHUD;payLines;parse;spin;isPurchaseEnabled;isEnabled;machineBetValues;LM_AND_VIP_SURFACING;call;hideOverlayLayer;player_action_jackpot_lounge;_isFreeSpin;getUserDataManager;RS_CASINO_BUTTON_BET_CHANGE;setLoadingStartTime;disableAllButtons;getVIPData;dataManager;setUserLeaderBoardData;cancelled;post_message;count_down_time;RS_SLOTS_TUTORIAL;currentHandNumber;CLEVERTAP_ENABLED;setRouletteRounds;jackpot_lounge;MSPT_;powerup_with_coins;showLevelUpPopups;eventName;calculateLosingStreak;height;TOP_HUD_BACK;_blackjackBet;jackpotLoungeLoadingStarted;trackFBFeedShare;vip_status_icon;enableAllButtons;ACTIVE_POKER_HANDS;jackpot_buy_all;trackGameStop;natural;TournamentRoomState;split;trackMultiSharing;getInterface;style;jackpot_welcome_bonus;callSaleDetails;_updateMachineData;disconnectJackpot;getCurrentMachineVO;enableBackButtonForDirectLoading;getElementById;publishShareSheet;indexOf;6844pdIycm;onInitializeSubscriptionSuccess;gui_jackpot_lounge;_me;initiateShare;click;SessionTimeOutReached;enableBackButtonInTutorial;addPopup;_jackPotLoungeName;VIPStatus;loyaltymall_game_action;getHUDCasinoFont;FbConnectPopup;analytics_tournament_sink;BET_UPDATED;getLosingStreakManager;getGameType;tournament_play_stats;trackDONLose;RSBetUnlockPopup;onSettingsClicked;moveUp;getLoyaltyMallEligiblePopupShownStatus;machineDisplayName;getFUEBonusStatus;loyaltymall_player_action;setUserAttributeGameWithLastBigWin;getLevelManager;fue_triggered;isArray;coins;Roulette;getUserID;postMessageToJackpot;showHud;130263tOnANP;Cancel;gift_free_spins;trackLobbyEntry;_freeRide;setKenoDealCount;getCurrentLevel;_failurecallback;RS_BLACKJACK_BET_PER_HAND;onDONPurchaseFailure;195094RfUQfs;paid;showGameReloadPopup;_gameResult;skip;onDONPurchaseSuccess;getMachineDetails;jackpot_tutorial_gameplay;_jackpotDefaultBet;forced;getSavedPaidCoins;disableHudForJackpotTutorial;currentServerTime;setUserAttributePlaysTournament;getFreeSpinStatus;jackpotLoungeName;_purchaseResponseObject;pow;0px;pokerPlayed;calculateAverageBet;trackCommonSysOpsEvent;checkOOCCondition;gamble;trackGameEnter;setMachineFUEBonusTriggered;onSpinStarted;jackpot_pick_bonus;getVIPSurfacingShown;doubleornothing;getBlackjackBet;jackpot_buy_one;tournament_details;tournamania_game_action;showGameOverlay;exit_loyaltymall;player_action_session_out;currentScreenName;primaryCurrencyOffset;onRetrieveDONPurchase;showExternalGame;triggerDONPurchaseSuccesEvent;popupManager;Cocos2dGameContainer;extend;isTournamentLoaded;4132296EWOjfa;pokerStatsSetHighestWin;DON_LOST;bold;RS_SLOTS_FUE_WIN;getDefaultCasinoFont;_slotResult;trackPrimarySink;_currentPackData;RS_CASINO_BUTTON_PAY_TABLE;_win;toLowerCase;getVipMachineUnlocked;Poker;onPurchaseCancel;checkAndShowPurchaseFailurePopups;_betUnlockPopup;Scratcher;OOCMoment;screenManager;facebook;RS_CASINO_BUTTON_BET_UP;jackpotHud;dispatchEvent;jackpot_win;checkAndUpdateMachineBetV2;notifyEventTriggerToPlacementManager;triggerPokerEvents;gift_gamble;packAnalyticsName;showNetworkError;myPlayingFriends;saveUserBlobParams;onSpinGameLoaded;jackpot_;showJackpotLoungeWelcomePopup;powerups;levelUpdate;stopSession;_machineAnalyticsID;ValidationFailed;triggerAnalyticsEvents;machineLockStatus;PLAYER_ACTION;_betAmount;gameData;trackBonusGameStart;getVIPLoungeShown;addCoins;getLastBet;sub;contentWindow;setVipMachineUnlocked;analyticsName;splice;setTournamentTimerData;trackPlayerAction;kenoPlayed;removeOverlay;setSpins;addXP;getCurrentMachineAnalyticsName;updateVIPData;setJackPotTier;ScratcherStatsSetHighestWin;_totalWinAmount;updateCoin;getXP;stopAutoSpin;value;large;JACKPOT_LOUNGE_ENABLE;getJackpotProbabilityBoosted;gameplay_screen;_successcallback;getInstance;trackFreeRide;isFirstSpinOnMachine;setBlackjackWonStats;trackHandWin;GUEST;getCurrentPopupTriggered;_gameType;hideToaster;setJackpotProbabilityBoosted;setSideMenuVisibility;length;notifySalePurchaseResponseToCasino;SettingsButton;currency;type;initializeSubscriptionData;Sorry there seems to be something\n wrong with the net connection;reject;showPowerUpCart;trackSecondarySource;don;Slots;insurance_action;_machineParams;addOverlay;gift_send;player_action_session_start;getMonetizationBalance;showPurchaseUI;getFBAccessToken;RainmakerLounge;screenName;externalGameManager;timeset;7373124bNCzLh;getIsMachineUnlockActive;_iFrameSpin;_blackjack;setJackpotWelcomeBonusAwarded;player_action_session_stop;success;free;substring;category;RS_SLOTS_FUE_DISABLED;bonus_game;SinkEvent;analytics_tournament_source;enableInterrupt;trackSessionOut;betAmount;RS_CASINO_BUTTON_SPIN;double_down;getJackpotInitData;RS_CASINO_BUTTON_BET_MAX;_handAnalyticsName;rejectFeed;getBackgroundSessionTimeout;LEADERBOARD_ENABLED;showOOCCarousel;analyticsPrice;Failure;5689184frfUjf;getGuestUserDataForKey;packAnalyticsPrice;getGameVariable;addPaidCoins;RS_SLOTS_FUE_TRIGGERED;_previewMachine;setFUEBonusStatus;_saleStatus;showOverlayLayer;player_action_lobby_entry;isjackpotLoaded;RS_KENO_BONUS_GAME_INITIATED;getJackpotWelcomeBonusAwarded;setFirstPlayed;width;hideOverlay;extralargeDrkBlue;purchaseDONPack;bind;fue_win;_popupList;getMonetizationCount;handleMachineEvents;onPurchaseFailure;close;jackpotLoungeEngaged;setVIPLoungeShown;getMachineParams;tournamaniaEngaged;_screenName;callMachineUnlockedPopup;hideHud;Keno;setMachineTemporaryUnlockTimer;setBlackjackDealCount;trackGUIEvent;getGameData;handleResultComplete".split(";");a0_0x7406= function(){return a};return a0_0x7406()}(function(a,b){for(var c=a0_0x12dd,d=a();;)try{if(parseInt(c(544))/1+-parseInt(c(430))/2*(parseInt(c(534))/3)+parseInt(c(498))/4*(parseInt(c(418))/5)+-parseInt(c(390))/6+-parseInt(c(590))/7+parseInt(c(728))/8+parseInt(c(700))/9===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x7406,409671);function a0_0x12dd(a,b){var c=a0_0x7406();return a0_0x12dd=function(a,b){return c[a-339]},a0_0x12dd(a,b)} var CustomCasinoInterface=RSCasinoInterface[a0_0x3b1bb4(588)]({init:function(){var a=a0_0x3b1bb4;this._super[a(417)][a(449)](this);this[a(634)]=0;this._popupList=[];this[a(475)]=[];this[a(452)]=!1;this[a(734)]=null;this[a(464)]=5;this[a(409)]=0;this[a(427)]=TimeManager[a(665)]()[a(355)]()},getPrimaryCurrency:function(){var a=a0_0x3b1bb4;return RSGame.getInstance()[a(453)]()[a(429)]()[a(411)]()},notifyOutOfCurrencyToCasino:function(a){var b=a0_0x3b1bb4;RSGame.getInstance()[b(436)]()[b(515)]()==RSGameTypes[b(413)]&& ("object"==typeof a&&a[b(659)]?a=a[b(659)]:typeof a==b(438)&&a[b(679)]==b(626)&&RSGame.getInstance().getGameManager()[b(684)]());GlobalVars.isjackpotLoaded&&RSEngine.externalGameManager[b(532)]({type:"resetKickOut"});this[b(421)](a);var c=new RSPlacementObject;c[b(716)]=a;c[b(471)]=b(608);RSPlacementManager.getInstance().notifyEventTriggerToPlacementManager(c)},addPrimaryCurrency:function(a,b){var c=a0_0x3b1bb4;0>a?(RSGame[c(665)]().getUserDataManager()[c(732)](a),RSGame[c(665)]()[c(453)]()[c(638)](a, b)):RSGame[c(665)]().getUserDataManager().addCoins(a,b);RSGame[c(665)]()[c(514)]()[c(472)](a);var d=parseInt(RSGame[c(665)]().getUserDataManager()[c(429)]()[c(729)](c(529))),d=d+parseInt(a);RSGame[c(665)]()[c(453)]().getMe()[c(399)](c(529),d);RSEngine[c(698)]&&RSGame[c(665)]()[c(436)]()[c(515)]()!=RSGameTypes[c(413)]&&RSEngine[c(698)][c(656)](RSGame[c(665)]()[c(453)]()[c(429)]()[c(411)]())},addPrimaryCurrencyForDisplay:function(a,b,c){a=a0_0x3b1bb4;var d=parseInt(RSGame[a(665)]()[a(453)]()[a(429)]()._dataHolder[a(529)]), d=d+b;RSGame.getInstance().getUserDataManager()[a(429)]()._dataHolder[a(529)]=d;0>b&&!c&&RSGame[a(665)]()[a(453)]()[a(732)](b);RSGame[a(665)]()[a(436)]()[a(515)]()!=RSGameTypes[a(413)]&&RSGame[a(665)]()[a(514)]()[a(472)](b)},addXP:function(a){var b=a0_0x3b1bb4;a=RSGame.getInstance()[b(526)]().updateXP(a);RSGame[b(665)]()[b(453)]()[b(650)](a);if(RSEngine[b(361)]===LOGIN_MODE[b(670)]){var c=parseInt(RSGame.getInstance().getUserDataManager()[b(429)]()[b(729)]("xp")),c=c+parseInt(a);RSGame[b(665)]()[b(453)]()[b(429)]()[b(399)]("xp", c)}},getXP:function(){var a=a0_0x3b1bb4;return RSGame.getInstance()[a(453)]()[a(429)]()[a(657)]()},triggerButtonClickEvent:function(a,b){var c=a0_0x3b1bb4;switch(b){case RS_CASINO_BUTTON[c(717)]:break;case RS_CASINO_BUTTON[c(454)]:break;case RS_CASINO_BUTTON[c(611)]:break;case RS_CASINO_BUTTON[c(720)]:break;case RS_CASINO_BUTTON[c(599)]:break;case RS_CASINO_BUTTON.RS_CASINO_BUTTON_DEAL:GlobalVars[c(377)]=!0;case RS_CASINO_BUTTON.RS_CASINO_BUTTON_DRAW:case RS_CASINO_BUTTON.RS_CASINO_BUTTON_DON:case RS_CASINO_BUTTON[c(392)]:}}, notifyBetAmountChangeToCasino:function(a){var b=a0_0x3b1bb4;this[b(634)]=a;RSPlacementManager.getInstance().notifyBetChangeToPlacementManager(a);GlobalVars.isjackpotLoaded&&RSEngine[b(698)][b(532)]({type:b(403),amount:a})},triggerInterrupts:function(){var a=a0_0x3b1bb4;1!=RSEngine.dataManager[a(429)]()[a(750)]()||!GameConfig[a(448)]||GlobalVars[a(422)]||RSEngine.dataManager[a(429)]()[a(521)]()&&RSEngine[a(458)][a(429)]()[a(572)]()||RSGame[a(665)]().getGameManager().playIntroScreen()},notifyResultToCasino:function(a){var b= a0_0x3b1bb4;GlobalVars[b(377)]=!1;var c=RSGame[b(665)]().getGameManager()[b(515)](),d=RSAnalyticsManager[b(665)]()[b(651)]();this[b(427)]=TimeManager[b(665)]()[b(355)]();switch(c){case RSGameTypes[b(603)]:if(URLConfig[b(465)]&&GlobalVars[b(667)]){if(GlobalVars[b(739)])RSPlatformSDKManager.getInstance()[b(360)](SDK_EVENT_TYPE[b(342)]);else GlobalVars[b(589)]?(RSPlatformSDKManager[b(665)]()[b(360)](SDK_EVENT_TYPE[b(345)]),RSPlatformSDKManager[b(665)]()[b(557)](!0)):RSPlatformSDKManager.getInstance()[b(360)](SDK_EVENT_TYPE[b(563)]); GlobalVars.isFirstSpinOnMachine=!1}RSGame.getInstance()[b(453)]()[b(429)]().setPokerDealCount(d);RSGame[b(665)]()[b(453)]()[b(429)]()[b(742)](RSGameTypes[b(603)]);RSGame.getInstance()[b(453)]()[b(429)]()[b(591)](RSGameTypes[b(603)],a[b(655)]);var e=0;if(Array[b(528)](a[b(547)])&&0<a[b(655)])if(RSUtils[b(397)](d,b(468)))for(var f=0;f<a[b(547)][b(676)];f++)for(var g=a[b(547)][f],h=0;h<g[b(676)];h++){var k=g[h];if(null==k)break;k._rank>e&&(e=k[b(428)])}else for(f=0;f<a[b(547)][b(676)];f++)a[b(547)][f][b(428)]> e&&(e=a[b(547)][f][b(428)]);this[b(617)](a);break;case RSGameTypes.Bingo:RSGame.getInstance().getUserDataManager()[b(429)]().setFirstPlayed(RSGameTypes[b(413)]);GameConfig[b(724)]&&a[b(547)][b(582)]&&RSLeaderboard[b(459)](a[b(547)][b(582)]);break;case RSGameTypes[b(358)]:g=e=0;if(a[b(547)]instanceof Array)for(f=0;f<a[b(547)][b(676)];f++)a[b(547)][f][b(703)]&&e++,a[b(547)][f][b(600)]&&(g+=parseInt(a[b(547)][f][b(600)]));if(URLConfig[b(465)]&&GlobalVars[b(667)]){if(GlobalVars[b(739)])RSPlatformSDKManager.getInstance()[b(360)](SDK_EVENT_TYPE.jackpotLoungeEngaged); else GlobalVars.isTournamentLoaded?(RSPlatformSDKManager[b(665)]().trackEvent(SDK_EVENT_TYPE[b(345)]),RSPlatformSDKManager.getInstance()[b(557)](!0)):RSPlatformSDKManager.getInstance()[b(360)](SDK_EVENT_TYPE.blackjackPlayed);GlobalVars[b(667)]=!1}RSGame[b(665)]()[b(453)]()[b(429)]()[b(742)](RSGameTypes[b(358)]);RSGame[b(665)]()[b(453)]()[b(429)]()[b(668)](e);RSGame[b(665)]().getUserDataManager()[b(429)]()[b(351)](d);break;case RSGameTypes[b(687)]:MachineGiftingManager[b(665)]()[b(350)]();if(!RSEngine.externalGameManager[b(404)]())RSEngine[b(698)][b(532)]({type:b(433)}); if(URLConfig[b(465)]&&GlobalVars.isFirstSpinOnMachine){if(GlobalVars[b(739)])RSPlatformSDKManager.getInstance()[b(360)](SDK_EVENT_TYPE[b(342)]);else GlobalVars[b(589)]?(RSPlatformSDKManager.getInstance()[b(360)](SDK_EVENT_TYPE.tournamaniaEngaged),RSPlatformSDKManager[b(665)]()[b(557)](!0)):RSPlatformSDKManager.getInstance()[b(360)](SDK_EVENT_TYPE.slotPlayed);GlobalVars[b(667)]=!1}!GlobalVars.isTournamentLoaded&&RSGame[b(665)]().getUserDataManager()[b(429)]().setFirstPlayed(RSGameTypes[b(687)]);!RSGame.getInstance().getGameManager().getCurrentMachineIsInternal()&& (RSGame[b(665)]().getUserDataManager()[b(429)]().setSlotWin(a[b(655)]),GameConfig[b(724)]&&!GlobalVars.isTournamentLoaded&&RSLeaderboard[b(459)](a._totalWinAmount));0<a[b(395)]&&20*a[b(395)]<=a[b(655)]&&RSPlatformSDKManager[b(665)]()[b(525)](RSGame.getInstance()[b(436)]()[b(493)]()[b(522)]);break;case RSGameTypes[b(349)]:URLConfig.CLEVERTAP_ENABLED&&GlobalVars[b(667)]&&(GlobalVars.isjackpotLoaded?RSPlatformSDKManager[b(665)]().trackEvent(SDK_EVENT_TYPE[b(342)]):GlobalVars[b(589)]?(RSPlatformSDKManager[b(665)]()[b(360)](SDK_EVENT_TYPE[b(345)]), RSPlatformSDKManager.getInstance()[b(557)](!0)):RSPlatformSDKManager[b(665)]()[b(360)](SDK_EVENT_TYPE[b(647)]),GlobalVars[b(667)]=!1);RSGame[b(665)]()[b(453)]().getMe()[b(742)](RSGameTypes[b(349)]);RSGame.getInstance().getUserDataManager()[b(429)]()[b(432)](a[b(655)]);RSGame[b(665)]()[b(453)]().getMe()[b(539)](d);break;case RSGameTypes[b(530)]:if(URLConfig[b(465)]&&GlobalVars[b(667)]){if(GlobalVars[b(739)])RSPlatformSDKManager[b(665)]()[b(360)](SDK_EVENT_TYPE.jackpotLoungeEngaged);else GlobalVars[b(589)]? (RSPlatformSDKManager[b(665)]().trackEvent(SDK_EVENT_TYPE[b(345)]),RSPlatformSDKManager[b(665)]()[b(557)](!0)):RSPlatformSDKManager[b(665)]()[b(360)](SDK_EVENT_TYPE.roulettePlayed);GlobalVars.isFirstSpinOnMachine=!1}RSGame[b(665)]()[b(453)]()[b(429)]()[b(742)](RSGameTypes[b(530)]);RSGame[b(665)]()[b(453)]().getMe()[b(366)](a[b(655)]);RSGame[b(665)]().getUserDataManager().getMe()[b(466)](d);break;case RSGameTypes[b(607)]:RSGame[b(665)]().getUserDataManager()[b(429)]()[b(742)](RSGameTypes[b(607)]), RSGame[b(665)]()[b(453)]()[b(429)]()[b(654)](a[b(655)]),RSGame[b(665)]()[b(453)]().getMe().setScratcherRounds(d)}0<a[b(395)]&&RSGame[b(665)]()[b(436)]()[b(564)](a[b(395)],null);GlobalVars[b(398)]&&this[b(354)](a,c,d)},checkOOCCondition:function(a){var b=a0_0x3b1bb4;if(a[b(395)]){this[b(421)](a[b(395)]);var c=new RSPlacementObject;c[b(716)]=a[b(395)];c[b(471)]=b(712);RSPlacementManager[b(665)]()[b(616)](c);c[b(471)]="GameResult";RSPlacementManager.getInstance()[b(616)](c);c[b(471)]="LOCMoment";RSPlacementManager[b(665)]()[b(616)](c); c[b(471)]=b(608);RSPlacementManager.getInstance()[b(616)](c)}},handleResultComplete:function(a,b,c){var d=a0_0x3b1bb4;if(RSGame[d(665)]()[d(526)]().isLevelUpTriggered()&&!GlobalVars[d(589)]){if(b!=RSGameTypes.Slots||RSEngine[d(698)][d(404)]())this._popupList[d(385)](function(){RSGame[d(665)]()[d(436)]()[d(470)]();RSGame[d(665)]().getGameManager()[d(347)](this[d(725)][d(747)](this));RSGame[d(665)]()[d(436)]().showJackpotLoungeWelcomePopup()}[d(747)](this));else if(0<a._totalBetAmount)this[d(749)][d(385)](function(){RSGame.getInstance()[d(436)]()[d(470)](); RSGame[d(665)]()[d(436)]()[d(347)](this[d(725)][d(747)](this));RSGame.getInstance().getGameManager()[d(625)]()}.bind(this));GameConfig[d(661)]&&RSEngine[d(698)][d(532)]({type:d(627),level:RSGame.getInstance().getLevelManager()[d(540)]()})}!GlobalVars.isTournamentLoaded&&this.checkOOCCondition(a);0<this[d(749)].length&&RSEngine.externalGameManager[d(404)]()&&(RSCasinoManager[d(441)]()[d(479)](),!GlobalVars[d(739)]&&RSEngine[d(698)][d(658)]())},showOOCCarousel:function(){var a=a0_0x3b1bb4;if(RSPlacementManager.getInstance().getInterface()){var b= RSPlacementManager.getInstance()[a(487)]()[a(671)]();b&&RSPlacementManager[a(665)]()[a(487)]().loadPopup(b)}},showRoundCompletePopups:function(){var a=a0_0x3b1bb4;MachineGiftingManager[a(665)]().getFreeSpinStatus()&&MachineGiftingManager[a(665)]().showFreeSpinPopups();if(RSPlacementManager[a(665)]()[a(639)]()&&RSGame.getInstance()[a(436)]().getGameType()==RSGameTypes[a(413)]){var b={};b[a(395)]=RSPlacementManager[a(665)]()[a(639)]();this[a(566)](b)}for(RSEngine[a(698)][a(404)]()&&this[a(749)][a(385)](function(){RSEngine[a(698)][a(615)]()});0< this._popupList[a(676)];)this[a(749)][a(644)](0,1)[0]();this._popupList=[]},isRoundCompletePopupsActive:function(){return 0<this._popupList[a0_0x3b1bb4(676)]?!0:!1},notifyLoadingCompleteToCasino:function(a){var b=a0_0x3b1bb4;RSEngine.dataManager[b(429)]().getJackpotWelcomeBonusAwarded()&&RSEngine[b(698)][b(532)]({type:b(623)});!GlobalVars[b(739)]&&RSGame.getInstance()[b(436)]().calculateLoadingTime(a);RSCasinoManager.getCasinoHUD()&&RSCasinoManager[b(441)]()[b(424)]();RSGame[b(665)]()[b(436)]()[b(515)]()== RSGameTypes[b(603)]&&RSGame.getInstance().getUserDataManager()[b(429)]().setMachinesPlayed(RSAnalyticsManager[b(665)]().getCurrentMachineAnalyticsName())},notifyMachineExitToCasino:function(a){a=a0_0x3b1bb4;RSGame.getInstance()[a(436)]().getGameType()==RSGameTypes.Bingo&&RSCasinoManager[a(441)]()[a(365)]()},notifySpinStartToCasino:function(a){var b=a0_0x3b1bb4;typeof a!=b(438)&&(RSGame[b(665)]().getUserDataManager()[b(501)][b(649)](RSAnalyticsManager[b(665)]()[b(651)]()),a&&(this._isFreeSpin=!0)); GameConfig[b(661)]&&RSEngine[b(698)].postMessageToJackpot({type:b(570)})},notifyRoundStart:function(){var a=a0_0x3b1bb4;this[a(672)]==RSGameTypes.Slots&&RSEngine[a(458)][a(501)][a(649)](RSAnalyticsManager[a(665)]()[a(651)]())},triggerPrimarySourceEvent:function(a,b,c,d,e,f){var g=a0_0x3b1bb4;b!=g(431)&&b!=g(711)||(this[g(452)]=!1,MachineGiftingManager[g(665)]().setMachineTemporaryUnlockTimer());"line_win"==b&&MachineGiftingManager[g(665)]()[g(423)](d)&&!1==MachineGiftingManager[g(665)]()[g(558)]()&& (b=g(357));b==g(431)&&MachineGiftingManager.getInstance().isMachineGifted(d)?b=g(536):"line_win"==b&&MachineGiftingManager[g(665)]().isMachineGifted(d)&&!0==MachineGiftingManager[g(665)]()[g(558)]()?b=g(536):b==g(711)&&MachineGiftingManager[g(665)]().isMachineGifted(d)?b="gift_bonus_game":b==g(567)&&MachineGiftingManager[g(665)]()[g(423)](d)&&(b=g(618));GlobalVars[g(739)]?RSAnalyticsManager[g(665)]().trackPrimarySource(a,b,c,d,b==g(489)?"":g(624)+this[g(507)],f):RSAnalyticsManager.getInstance()[g(384)](a, b,c,d,e,f)},triggerSecondarySourceEvent:function(a,b,c,d){a=a0_0x3b1bb4;RSAnalyticsManager.getInstance()[a(685)](c,b,d)},setJackpotDefaultBet:function(a){this[a0_0x3b1bb4(552)]=a},maxbetUnlockPopup:function(a,b,c,d){var e=a0_0x3b1bb4;if(!GlobalVars.isInsideExternalGame&&!GlobalVars.isTournamentLoaded){var f={layout:RSGame[e(665)]()[e(406)](e(518)),assetPath:RSGame.getInstance()[e(406)](e(379)),textFont:RSGame.getInstance()[e(436)]()[e(595)](e(660),"Semibold"),titleFont:RSGame.getInstance().getGameManager()[e(595)](e(745), "black"),betValueFont:RSGame[e(665)]()[e(436)]()[e(510)](e(660),e(593))};this[e(606)]=new RSBetUnlockPopup(f,a,b,c,d);!RSGame[e(665)]()[e(436)]()[e(701)]()&&(RSEngine[e(698)][e(673)](),RSEngine[e(586)][e(506)](this[e(606)]),this[e(606)]=null)}},triggerMachineEvent:function(a,b,c,d,e,f){var g=a0_0x3b1bb4;switch(a){case g(513):this.maxbetUnlockPopup(b,c,d,e);break;case g(542):this[g(475)]=b;break;case g(416):GlobalVars[g(445)]&&(b=JSON[g(443)](decodeURIComponent(atob(b))),this[g(746)](b));break;case "DAILY_BONUS_PURCHASE_INITIATE":this[g(694)](b); break;case g(504):b=this[g(427)]+parseInt(RSGame[g(665)]()[g(731)]()[g(723)]())>TimeManager[g(665)]().getCurrentServerTime()?!1:!0;this._isFreeSpin||GlobalVars[g(362)]||RSGame[g(665)]()[g(436)]().getLoyaltyMallStatus()||!b||RSGame[g(665)]()[g(436)]()[g(440)]()||(RSAnalyticsManager[g(665)]()[g(628)](),RSNetworkManager[g(665)]()[g(546)](" You have been idle for too long.\n Please reload the game to continue playing."),RSGame[g(665)]().getUserDataManager().stopAllServiceCalls());break;case g(463):b== g(474)&&RSCasinoManager[g(441)]()[g(494)]();break;case "RS_SLOTS_BONUS_GAME_INITIATED":RSAnalyticsManager[g(665)]()[g(636)](b);break;case g(740):RSAnalyticsManager[g(665)]()[g(636)](b);break;case g(480):this[g(464)]=c;break;case g(592):RSAnalyticsManager.getInstance()[g(517)](RSAnalyticsManager[g(665)]()[g(651)](),b);break;case g(376):break;case g(733):!RSGame.getInstance()[g(453)]()[g(429)]()[g(523)]()&&RSGame.getInstance()[g(453)]().getMe()[g(735)](!0);RSGame.getInstance().getUserDataManager().getMe()[g(569)](b); RSAnalyticsManager[g(665)]()[g(565)](g(527),"","",b,"");break;case g(710):!RSGame.getInstance()[g(453)]().getMe()[g(523)]()&&RSGame[g(665)]()[g(453)]()[g(429)]().setFUEBonusStatus(!0);RSGame[g(665)]()[g(453)]()[g(429)]().setMachineFUEBonusTriggered(c);RSAnalyticsManager.getInstance()[g(565)](g(394),b?g(553):g(483),"",c,"");break;case g(594):RSAnalyticsManager.getInstance().trackCommonSysOpsEvent(g(748),b,c,e,d);break;case "log_error":RSErrorTracker.getInstance()[g(371)](b,c,"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"); break;case g(581):b==g(663)?(RSGameScreenManager[g(665)]()[g(373)](b),RSEngine.screenManager.removeOverlay(),d=document.getElementById(g(587)),b=0.102*parseInt(d.style[g(473)][g(708)](0,d.style[g(473)][g(676)]-2))+"px",c=parseInt(d.style[g(743)].substring(0,d[g(488)][g(743)][g(676)]-2))+parseInt(d[g(488)][g(437)][g(708)](0,d[g(488)].paddingLeft[g(676)]-2))+"px",d=d.style[g(473)],RSEngine.externalGameManager[g(407)](g(562),b,c,d)):(RSGameScreenManager[g(665)]()[g(373)](b),RSEngine.externalGameManager[g(689)]._ignoreResizeForHud= !0,RSEngine[g(698)][g(408)](),RSEngine.externalGameManager[g(407)](0));break;case g(738):RSAnalyticsManager[g(665)]().pushCurrentScreen(c);RSAnalyticsManager[g(665)]()[g(537)](c);break;case g(692):RSAnalyticsManager.getInstance()[g(568)]("",b,c,"");break;case g(705):RSAnalyticsManager[g(665)]()[g(482)](c,"");break;case g(580):RSAnalyticsManager[g(665)]()[g(715)](b,"");break;case "jlMachineLoaded":GlobalVars[g(739)]&&(""!=b?RSEngine[g(698)][g(689)][g(346)]=b:RSEngine.externalGameManager[g(689)][g(346)]= RSGame[g(665)]()[g(436)]()[g(493)]()[g(697)]);break;case g(500):RSAnalyticsManager[g(665)]()[g(352)](g(467),b,c,d,e);b==g(551)&&(a=RSCasinoManager.getCasinoHUD())&&(c==g(548)&&(a[g(555)]=!1),c==g(419)&&(a[g(555)]=!0),c==g(503)&&d==g(374)&&RSGame[g(665)]()[g(436)]()[g(455)]());if(b==g(400))SideMenuController[g(665)]()[g(479)]();else b==g(571)&&SideMenuController[g(665)]().disableAllButtons();break;case g(451):b[1]==g(691)&&RSEngine[g(458)][g(622)]();RSAnalyticsManager[g(665)]()[g(646)][g(405)](RSAnalyticsManager[g(665)](), b);break;case g(356):RSGame[g(665)]().getGameManager().setSideMenuVisibility(!1);break;case g(378):RSGame[g(665)]()[g(436)]()[g(675)](!0);RSAnalyticsManager[g(665)]()[g(352)](g(467),g(378),b,c,d);break;case g(505):(a=RSCasinoManager[g(441)]())&&(a[g(555)]=!1,a.disableAllButtons(),a[g(494)]());break;case g(355):RSEngine[g(698)][g(532)]({type:g(556),value:TimeManager[g(665)]()[g(355)]()});break;case "getJackpotInitData":RSEngine[g(698)].postMessageToJackpot({type:g(719),accessToken:RSEngine[g(361)]== LOGIN_MODE[g(386)]||RSEngine[g(361)]==LOGIN_MODE[g(368)]?RSGame[g(665)]()[g(436)]()[g(695)]():"",facebookID:RSEngine[g(361)]==LOGIN_MODE[g(386)]||RSEngine[g(361)]==LOGIN_MODE[g(368)]?RSFBManager[g(665)]()[g(531)]():"",newUser:!RSEngine[g(458)][g(429)]()[g(741)](),vipLoungeShown:RSEngine[g(458)][g(429)]()[g(637)](),jackpotProbabilityBoosted:RSEngine.dataManager[g(429)]()[g(662)]()});break;case g(457):RSEngine.externalGameManager[g(532)]({type:g(652),vipTier:parseInt(RSVIPManager[g(665)]().getVIPUserTier()), vipUnlockShown:RSEngine[g(458)][g(429)]()[g(602)]()});break;case g(550):a={};for(c=0;c<b[g(676)];c++)d=RSEngine[g(635)][g(434)](RSGameTypes[g(687)],b[c]),a[d[g(412)]]={},parseInt(d.isEnabled)?a[d[g(412)]][g(446)]=!0:a[d[g(412)]][g(446)]=!1;RSEngine.externalGameManager[g(532)]({type:g(632),machineDetails:a});break;case "getFriendsList":RSEngine[g(698)][g(532)]({type:"friendsList",list:RSSocialManager[g(665)]()[g(621)]});break;case g(344):a=RSGameTypes[g(687)];-1!=b[g(497)]("K_")&&(a=RSGameTypes[g(349)]); -1!=b[g(497)]("L_")&&(a=RSGameTypes[g(607)]);c=RSGame[g(665)]()[g(353)]()[g(550)](a,b);this[g(507)]=c[g(559)][g(485)](g(383))[0][g(601)]();this[g(402)](a,b,"",null,this[g(552)]);break;case g(476):this[g(596)]=null;RSGame[g(665)]()[g(436)]()[g(450)]();break;case g(744):RSGame[g(665)]()[g(436)]()[g(450)]();break;case g(722):RSAnalyticsManager[g(665)]()[g(393)](g(683),b);break;case "publishFeed":case g(496):GlobalVars.enableShare?(RSAnalyticsManager[g(665)]()[g(486)](g(503),"jackpot_lounge",""),RSActionShareManager[g(665)]()[g(502)]({ogType:g(614)}, this[g(381)][g(747)](this)),RSAnalyticsManager[g(665)]()[g(477)](g(410),g(614))):RSAnalyticsManager[g(665)]()[g(477)](g(683),g(614));break;case g(420):RSEngine[g(458)][g(429)]()[g(653)](b);break;case g(343):RSEngine[g(458)][g(429)]()[g(343)]();break;case g(426):RSEngine[g(458)][g(429)]()[g(642)](b);break;case g(674):RSEngine.dataManager[g(429)]()[g(674)](b);break;case g(401):RSGame.getInstance()[g(436)]()[g(401)](b,c);break;case g(382):this[g(507)]=g(696);RSEngine[g(458)][g(429)]()[g(704)](!0);break; case g(612):if(a=RSCasinoManager.getCasinoHUD())switch(b){case g(456):a.disableAllButtons();break;case "enableAllButtons":RSEngine[g(458)][g(429)]().getJackpotWelcomeBonusAwarded()&&a[g(479)]();RSGame[g(665)]().getGameManager()[g(675)](!0);break;case g(348):a[g(520)]();RSEngine[g(698)][g(689)][g(396)]=!0;RSEngine[g(698)].resizeSpinGameDiv();RSEngine[g(698)][g(407)](0);break;case g(533):d=document[g(495)](g(587));b=0.102*parseInt(d[g(488)][g(473)].substring(0,d.style[g(473)].length-2))+"px";c=parseInt(d.style[g(743)][g(708)](0, d[g(488)].width[g(676)]-2))+parseInt(d[g(488)][g(437)][g(708)](0,d[g(488)][g(437)].length-2))+"px";d=d[g(488)][g(473)];RSEngine[g(698)][g(407)]("0px",b,c,d);a.moveDown();break;case g(492):null!=a&&a.onBackButton(!0);break;case "PurchaseCart":a.onPurchaseCartClicked();break;case g(678):a[g(519)]();break;case g(508):RSEngine[g(586)][g(506)](new VIPWelcomePopup(RSVIPManager[g(665)]().getVIPUserTier(),!1,!1)),RSAnalyticsManager[g(665)]().trackInHouseEvent(RSEventCategory[g(633)],g(478),g(503),"","","")}break; case g(516):RSAnalyticsManager[g(665)]()[g(646)](g(576),"",b,c,"");break;case "TournamentLoaded":RSGame[g(665)]()[g(436)]()[g(450)]();d=document[g(495)]("Cocos2dGameContainer");b=0.102*parseInt(d[g(488)][g(473)].substring(0,d.style[g(473)][g(676)]-2))+"px";c=parseInt(d[g(488)][g(743)][g(708)](0,d[g(488)][g(743)][g(676)]-2))+parseInt(d[g(488)][g(437)].substring(0,d[g(488)][g(437)].length-2))+"px";d=d[g(488)][g(473)];RSEngine[g(698)][g(407)](g(562),b,c,d);RSCasinoManager[g(441)]()[g(479)]();RSEngine.externalGameManager.hideExternalGame(); RSEngine[g(698)][g(584)]();break;case g(462):RSTournamentManager[g(645)](b);break;case g(370):RSTournamentManager.hideTournamentAndShowWinnerScreen(b,c,d,e,f);break;case "tournamania_player_action":case g(484):case g(512):case g(577):case g(713):RSTournamentManager[g(631)](a,b,c,d);break;case "connectClubM":RSPlayerConnectManager[g(339)](a,b);break;case g(524):RSPlayerConnectManager[g(339)](a,b,c,d,e);break;case g(509):RSPlayerConnectManager[g(339)](a,b);break;case g(367):RSPlayerConnectManager[g(339)](a, b,c,d,e,f);break;case g(579):this[g(699)]=null;RSAnalyticsManager[g(665)]()[g(352)]("btg_loyalty_icon",g(503),"");GlobalVars[g(362)]=!1;RSCasinoManager[g(441)]()[g(365)](!0);RSAnalyticsManager[g(665)]().trackGUIEvent("loyalty_mall_popup",g(341),"");break;case g(359):RSPlayerConnectManager[g(339)](a,b,c,d,e)}},onSharingToFBSuccess:function(){var a=a0_0x3b1bb4;RSAnalyticsManager.getInstance()[a(486)](a(706),a(467),a(610))},showPurchaseUI:function(a,b,c,d){var e=a0_0x3b1bb4;this[e(664)]=b;this[e(541)]= d;this[e(435)]=c;b=a.category;this[e(598)]=a;this._currentPackData[e(619)]=a[e(643)];this[e(598)][e(730)]=a[e(726)];this[e(598)][e(680)]=a[e(709)];RSEngine[e(609)].addOverlay();RSInAppPurchaseManager[e(665)]()[e(364)](this[e(598)],b,!1,this[e(415)].bind(this),this[e(604)][e(747)](this),this[e(340)][e(747)](this))},onPurchaseSuccess:function(a){var b=a0_0x3b1bb4,c=this;RSGame[b(665)]()[b(453)]()[b(693)](function(){RSSaleManager[b(665)]()[b(490)](function(){RSEngine[b(609)][b(648)]();c[b(560)]=a;RSEngine[b(586)][b(506)](new PurchaseSuccessPopup(null, c[b(598)],c[b(560)],c[b(736)]),!0);void 0!=c[b(664)]&&null!=c._successcallback&&(c[b(664)](a),c[b(664)]=null)},null,GlobalVars[b(445)])})},onPurchaseCancel:function(a){var b=a0_0x3b1bb4;RSEngine[b(609)][b(648)]();this[b(677)](a,this[b(598)],b(460),this._cancelCallback)},onPurchaseFailure:function(a){var b=a0_0x3b1bb4;RSEngine[b(609)][b(648)]();this[b(677)](a,this[b(598)],b(369),this[b(541)])},notifySalePurchaseResponseToCasino:function(a,b,c,d){var e=a0_0x3b1bb4;if(c==e(706))b.id[e(372)](e(640))? (this[e(737)](),RSSubscrptionSaleManager[e(681)](this[e(499)][e(747)](this))):RSEngine.popupManager.addPopup(new PurchaseSuccessPopup(d,b,a,c),!0),RSUtils[e(397)](b.analyticsName,"NPS")&&RSPlatformSDKManager[e(665)]().setUserAttributeNPSBought(!0),RSCasinoManager[e(714)]();else if(c==e(369))RSGame[e(665)]().getGameManager()[e(605)](d,e(727));else"ValidationFailed"==c?RSGame[e(665)]()[e(436)]().checkAndShowPurchaseFailurePopups(d,e(630)):c==e(460)&&RSGame[e(665)]().getGameManager().checkAndShowPurchaseFailurePopups(d, e(535))},triggerPrimarySinkEvent:function(a,b,c,d,e){var f=a0_0x3b1bb4,g="";GlobalVars[f(739)]&&(g=f(624)+this[f(507)]);d&&(g=d);a==f(444)&&MachineGiftingManager[f(665)]()[f(423)](c)?a="gift_spin":a==f(567)&&MachineGiftingManager[f(665)]()[f(423)](c)&&(a=f(618));d=[];d=!1;switch(RSGame[f(665)]()[f(436)]()[f(515)]()){case RSGameTypes.Keno:case RSGameTypes.Poker:case RSGameTypes[f(687)]:case RSGameTypes[f(530)]:case RSGameTypes[f(607)]:d=["collectibles",f(469),f(686),f(575),f(481)];(d=!d[f(372)](a))&& (this[f(409)]=parseInt(RSGame.getInstance()[f(526)]()[f(540)]()),this[f(650)](b),RSGame[f(665)]()[f(526)]()[f(380)](b,a));break;case RSGameTypes[f(413)]:break;case RSGameTypes[f(358)]:if("split_hands"===a){this.addXP(b);RSGame[f(665)]()[f(526)]()[f(380)](b,a);break}d=[f(718),f(688)];if(d=!d[f(372)](a)){var h=RSCasinoManager.getCasinoInterface()[f(574)]();if(h instanceof Array)for(var k in h)this.addXP(h[k]),RSGame.getInstance()[f(526)]()[f(380)](h[k],a)}}(d||"split_hands"===a)&&RSCasinoManager.getCasinoHUD().setXP(this[f(657)]()); k=RSGame[f(665)]()[f(453)]()[f(429)]()[f(554)]();b=Number(b);b>=k?0<k?(RSAnalyticsManager[f(665)]().trackPrimarySink(RSAnalyticsSink[f(545)],a,k,c,g,e),k!=b&&RSAnalyticsManager.getInstance()[f(597)](RSAnalyticsSink[f(707)],a,b-k,c,g,e)):RSAnalyticsManager[f(665)]().trackPrimarySink(RSAnalyticsSink[f(707)],a,b,c,g,e):RSAnalyticsManager.getInstance()[f(597)](RSAnalyticsSink[f(545)],a,b,c,g,e)},getCurrentLevelForMachineUnlock:function(){return this[a0_0x3b1bb4(409)]},triggerSecondarySinkEvent:function(a, b,c){RSAnalyticsManager[a0_0x3b1bb4(665)]().trackSecondarySink(a,b,c)},purchaseDONPack:function(a){var b=a0_0x3b1bb4;GlobalVars[b(445)]&&(this[b(425)]=a,this[b(425)][b(680)]=b(573),this[b(425)][b(659)]="0",this[b(425)].packAnalyticsName=this[b(425)][b(643)],this[b(425)].packAnalyticsPrice=this[b(425)].analyticsPrice,a=this[b(425)][b(709)],RSGame[b(665)]()[b(436)]()[b(578)](),RSInAppPurchaseManager[b(665)]().buyInAppPack(this[b(425)],a,!1,this[b(549)][b(747)](this),this[b(543)][b(747)](this),this.onDONPurchaseCancel[b(747)](this)))}, onDONPurchaseSuccess:function(a){var b=a0_0x3b1bb4;RSGame.getInstance()[b(453)]()[b(693)](this[b(583)][b(747)](this,a));RSEngine[b(698)][b(585)]()},onRetrieveDONPurchase:function(a){var b=a0_0x3b1bb4;a?(RSGame.getInstance().getGameManager()[b(375)](),RSEngine[b(586)][b(506)](new PurchaseSuccessPopup(null,this[b(425)],a,!1),!0)):(a=b(682),RSNetworkManager[b(665)]().showNetworkError(a,null))},onDONPurchaseCancel:function(a){a=a0_0x3b1bb4;RSGame[a(665)]().getGameManager()[a(375)]()},onDONPurchaseFailure:function(a){a= a0_0x3b1bb4;RSGame.getInstance()[a(436)]().hideGameOverlay()},isFreeSpinAvailable:function(){return this[a0_0x3b1bb4(452)]},loadMachine:function(a,b,c,d,e,f){var g=a0_0x3b1bb4;if(!GlobalVars.isMachineLoadingInProgress)if(RSEngine[g(361)]==LOGIN_MODE[g(670)])RSGame[g(665)]().getGameManager().showLoginPopup("feature",g(511));else{var h=!0;RSGame[g(665)]()[g(436)]()[g(391)]()&&(RSGame.getInstance()[g(436)]().setSkipForJL(!1),h=!1);if(h&&RSGame[g(665)]()[g(436)]()[g(388)](a,b)&&!RSGame[g(665)]()[g(436)]()[g(701)]())a= {machineType:a,machineAnalyticsName:b,triggeredFrom:c,previewType:d,defaultBet:e,memoryPopupTrigger:f},RSEngine[g(586)].addPopup(new MemoryWarningPopup(a),!0);else RSGame.getInstance()[g(436)]()[g(402)](a,b,c,d,e)}},triggerPokerEvents:function(a){var b=a0_0x3b1bb4,c=a[b(655)],d=a[b(629)],e=d.split("_")[0];if(("CP"==e||e==b(363))&&0<c)if(c=[],e==b(363))for(var f in a[b(547)]){if(Array[b(528)](a._gameResult[f])){var e=Math.pow(2,1*f),g;for(g in a[b(547)][f])a[b(547)][f][g]&&(0<a[b(547)][f][g][b(414)]&& RSAnalyticsManager[b(665)]().trackHandWin(a._machineAnalyticsID,a[b(547)][f][g][b(721)],e,""),a[b(547)][f][g]._freeRide&&RSAnalyticsManager.getInstance()[b(666)](d,e,a[b(395)]))}}else"CP"==e&&RSAnalyticsManager[b(665)]()[b(669)](d,a._gameResult._handAnalyticsName,"","");else if("MSP"==e)for(g in a[b(547)])e=Math[b(561)](2,1*g),a._gameResult[g]&&(0<a[b(547)][g][b(414)]&&RSAnalyticsManager[b(665)]().trackHandWin(d,a[b(547)][g][b(721)],e,""),a._gameResult[g][b(538)]&&RSAnalyticsManager[b(665)]().trackFreeRide(d, e,a._totalBetAmount));else if("MPP"==e&&0<c){c=[];for(f=0;f<a[b(547)][b(676)];f++)c[b(385)](a._gameResult[f]);RSAnalyticsManager[b(665)]()[b(669)](d,c[b(676)],"",this[b(464)])}},postMessageToBingo:function(a,b){var c=a0_0x3b1bb4;null==this[c(702)]&&document[c(495)](c(444))&&(this._iFrameSpin=document[c(495)]("spin")[c(641)]);RSEngine.externalGameManager[c(491)]({event:c(461),name:a,message:b})},getSlotMachineparams:function(a){var b=a0_0x3b1bb4;a=RSGame.getInstance().getGameData()[b(550)](RSGameTypes[b(687)], a);var c=RSEngine.gameData.getSlotBetStructureByName(a[b(412)]),d=RSGame[b(665)]().getGameData()[b(439)](a[b(412)],RSGame.getInstance()[b(526)]()[b(540)]()),b=parseInt(RSGame[b(665)]().getGameData()[b(389)](b(447),a.machine_identifier,parseInt(a[b(442)])));return{machineData:a,betStructure:c,maxBetAmount:d,defaultBet:b}},getBetAmount:function(){return this[a0_0x3b1bb4(634)]},getBlackjackBet:function(){return this[a0_0x3b1bb4(475)]},showConnectionLostPopup:function(a){a=a0_0x3b1bb4;RSNetworkManager[a(665)]()[a(620)](null, null)},onInitializeSubscriptionSuccess:function(){var a=a0_0x3b1bb4;this[a(450)]();RSEventManager[a(665)]()[a(613)](a(387));RSSubscrptionSaleManager.showSubscriptionSuccesPopup()},showOverlayLayer:function(){var a=a0_0x3b1bb4;RSEngine[a(609)][a(690)]()},hideOverlayLayer:function(){var a=a0_0x3b1bb4;RSEngine[a(609)][a(648)]()}});var DailyBonusTypes={Static:"Static",Scratcher:"Scratcher",Wheel:"Wheel",Slot:"Slot"},CasinoLoadingScreen=RSLoadingScreenV2.extend({init:function(a,b){this._super.init.call(this,a,b);this._loadingStripPostition=[];this._time=0;this._userCatagory="A";this._dailyBonusUpdated=!0;this._hourlyBonusUpdated=this._isVipInitilized=!1},loadContent:function(){var a=RSGame.getInstance().getGameManager().getGenericButtonFont(),a=a?a:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),a= {layout:RSGame.getInstance().getAssetPath("ConnectionLostPopup"),assetPath:RSGame.getInstance().getAssetPath("GenericPopup"),textFont:RSGame.getInstance().getGameManager().getConnectionLostPopupTextFont(),font:a,wordList:RSGame.getInstance().getStringDictionary("ConnectionLostPopup")};RSNetworkManager.getInstance().initializeConnectionLostPopup(a);RSGame.getInstance()._resourceConfigData?(RSEngine.setLoadingAnimation(RSGame.getInstance().getAssetPath("LoadingAnimation")),this.setBackgroundImage(RSGame.getInstance().getAssetPath("LoadingBG"))): (RSEngine.setLoadingAnimation(RSGame.getInstance().getResourceFolderFor("res/LoadingScreen")+"LoadingAnimation.png"),this.setBackgroundImage(RSGame.getInstance().getResourceFolderFor("res/LoadingScreen")+"LoadingScreenBg.jpg"));this._assetCount=1;GlobalVars.customLobbyStatus&&(this._assetCount=RSGame.getInstance().getAssetCount("LoadingScreen"));this._assetList=[{name:RSGame.getInstance().getAssetPath("LoadingScreen"),count:this._assetCount}];this.layoutScreen(this._assetList);this._super._super.loadContent.call(this)}, onSequencerDataLoaded:function(){this._animationSequencerObject.playSequenceWithKey("init")},createCustomObject:function(a,b){switch(b.name){case "LoadingBar":b.w-=3;b.x-=1.5;b.y+=0.5;this.progressObj=RSUtils.createBasicObject(a,b);this.progressObj.setAnchorPoint(0,0);this.progressObj.setPosition(0,0);this._progressBar=new RSPanel(b.x,b.y,b.w,b.h);this._progressBar.setAnchorPoint(0,0.5);var c=this._progressBar.getPosition();this._progressBar.setPosition(c.getX()-b.w/2,c.getY());this._progressBar.setClippingEnabled(!0); this._progressBar.addChild(this.progressObj);this._progressBar.setVisible(!1);this._progressBar.setName("LoadingBar");this.addChild(this._progressBar);this._progressBarUpdateFactor=b.w/100;break;case "StreakAnim":this._streakAnim=RSUtils.createAnimation(a,b,0.4);this._streakAnim.setX(this._progressBar.getX()-this._streakAnim.getSize().getWidth());this.addChild(this._streakAnim);break;default:this._super.createCustomObject.call(this,a,b)}},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this, a,b,c);this[c.name]=a;switch(c.name){case "Ray01":a.setAnchorPoint(1,0);break;case "Ray02":a.setAnchorPoint(0,0)}},onLayoutCompleted:function(){RSErrorTracker.getInstance().trackErrorMessage("HARDWARE",RSGame.getInstance().getHardwareInfo(),"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net");this._super.onLayoutCompleted.call(this);this._animationSequencerObject=new RSAnimationSequencer("res/LoadingScreen/LoadingAnimationConfig/","LoadingAnimationConfig.json",this,this);this._animationSequencerObject.loadAnimData()}, onReveal:function(){document.getElementsByClassName("gameCanvas")[0].style.visibility="visible";var a=document.getElementById("loader");null!=a&&(a.innerHTML="");this.startPreload();this.bypassSplashScreen()},onHourlyBonusTimeUpdated:function(a){this._hourlyBonusUpdated=!0;this.loadingComplete()},onHourlyBonusTimeFetchFailed:function(){RSErrorTracker.getInstance().trackErrorMessage("SERVER_RESPONSE","Failed to fetch hourly bonus time","mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"); RSEngine.dataManager.updateHourlyBonusTime(this.onHourlyBonusTimeUpdated.bind(this),this.onHourlyBonusTimeFetchFailed.bind(this))},_initializeDailyBonusWidget:function(){var a=[{name:RSGame.getInstance().getAssetPath("DailyBonusScreen"),count:1},{name:RSGame.getInstance().getAssetPath("DailyBonusBaseWidget"),count:1}],a=new DailyBonusWidgetModel(a,"dailyBonusConfig"),b=new DailyBonusWidgetView("DailyBonusScreen");this._dailyBonusWidgetController=new DailyBonusWidgetController(a,b,"DailyBonusScreen"); RSWidgetsManager.getInstance().addController(this._dailyBonusWidgetController,"DailyBonusScreen");this._dailyBonusWidgetController.setDelegate(this)},onDataFetchingSuccess:function(a){this._dataFetchingSuccess=!0;this.loadingComplete()},onDefaultDataLoadCompleted:function(){RSEngine.initializeExternalGameManager();RSGame.getInstance().getGameManager().getApiTokenValues();var a={};a.assetPath=[{name:RSGame.getInstance().getAssetPath("LosingStreakPopup"),count:2}];a.fonts={CREDITS_FONT:RSGame.getInstance().getGameManager().getHUDCasinoFont("large", "bold"),INFO_FONT:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold")};RSGame.getInstance().getLosingStreakManager().initializeLosingStreakManager(a);RSEngine.loginMode!=LOGIN_MODE.GUEST&&(PurchaseFlowManager.getInstance().getActiveSubscriptionSale(),this._dailyBonusUpdated=!0,this._initializeDailyBonusWidget(),this.initializeGifting(),GameConfig.HOUSE_ADS_ENABLED&&RSInHouseAdsManager.initializeInHouseAdsManager());VideoManager.getInstance().initialiseManager();RSEngine.loginMode!= LOGIN_MODE.GUEST?HourlyBonusManager.getInstance().updateHourlyBonusStatus(this.onHourlyBonusTimeUpdated.bind(this),this.onHourlyBonusTimeFetchFailed.bind(this)):(HourlyBonusManager.getInstance().setDefaultValuesForFullGuestUsers(),this.onHourlyBonusTimeUpdated(null));RSEventManager.getInstance().addEventListener(RSVIPSyncEvent,this,this._vipInitialized.bind(this));RSVIPManager.getInstance().initializeVIPManager(RSEngine.gameData.getVIPGameData(),RSEngine.gameData.getVIPPurchaseData());GlobalVars.isPurchaseEnabled= RSGame.getInstance().getGameVariable().isPurchaseEnabled();GameConfig.LEADERBOARD_ENABLED&&(RSLeaderboardManager.initializeLeaderboard(),RSRewardManager.initializeRewardManager());RSGame.getInstance().getPlatformEventManager().initializePlatformEventsManager();RSGame.getInstance().getGameManager().initializeQuest();RSGame.getInstance().getGameVariable().getSweepstakeEnabledStatus()&&(a={NORMAL_TEXT:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold"),WIN_TEXT:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large", "Semibold"),REWARD_TEXT:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"),NORMAL_TIMER:RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),BIG_TIMER:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold"),INPUTBOX_TEXT:"Source Sans Pro",HISTORY_FONT:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold"),WIN_TEXT_SCALE:0.47,ENTRY_REWARD_TEXT_SCALE:0.88,DOLLAR_TEXT_SCALE:0.57},RSSweepstakesManager.initializeCataboomManager(a, RSEngine.gameData.getDefaultValues().sweepstakesRulesUrl));GameConfig.SUBSCRIPTION_ENABLED&&(RSSubscrptionSaleManager.initializeSubscriptionData(this.onDataFetchingSuccess.bind(this)),RSSaleManager.getInstance().setSaleFont(RSGame.getInstance().getAssetPath("SourceSans_largeBlue_Semibold"),SaleFontType.SUBSCRIPTION));RSTournamentManager.initializeTournamentManager();this.loadingComplete()},initializeGifting:function(){if(GameConfig.GIFTING_ENABLED&&RSEngine.loginMode!=LOGIN_MODE.GUEST){var a={};a.textFont= RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","Semibold");a.rewardFont=RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold");a.subTitleFont=RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold");a.emailConnectFont="SourceSansPro-SemiBold";a.scaleFactor=0.58;a.rewardFontAlignment=kTEXT_ALIGNMENT_LEFT;RSGiftingManager.getInstance().initializeGiftingManager(a)}},onPreloadProgress:function(){if(!1!=this._isSplashShown){if(null!=this._progressBar){try{var a= this._progressBar.getSize()}catch(b){RSErrorTracker.getInstance().trackErrorMessage("LOADING_ERROR","on fetching progress bar getSize call "+b,"mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net")}var c=this._progressBarUpdateFactor*(0.5*this._artProgress+this._dataProgress);0<c&&null!=a&&(this._progressBar.setVisible(!0),this._progressBar.setSize(c,a._height),this._streakAnim&&(this._streakAnim.setX(this._progressBar.getX()+this._progressBar.getSize().getWidth()),this._streakAnim.setVisible(!0)), this._onRevealStarted||(this._onRevealStarted=!0,this._animationSequencerObject.playSequenceWithKey("onReveal")))}RSEngine.loginMode==LOGIN_MODE.INSTANT_GAME&&FBInstant.setLoadingProgress(0.5*this._artProgress+this._dataProgress);100<=0.5*this._artProgress+this._dataProgress&&(cc.log("\x3c\x3e\x3c\x3e\x3c\x3e Loading Next Screen!!!"),this.loadNextScreen())}},getName:function(){return"CasinoLoadingScreen"},_vipInitialized:function(a){cc.log("VIP Initialized !");RSEventManager.getInstance().removeListenersForEvent(RSVIPSyncEvent); this._isVipInitilized=!0;this.loadingComplete();this.initiateSSO()},update:function(a){this._super.update.call(this,a)},loadingComplete:function(){if(this._hourlyBonusUpdated&&this._dailyBonusUpdated&&this._isVipInitilized&&this._dataFetchingSuccess)RSGame.getInstance().getLoadingManger().onCustomLoadUpdate(100)},setBackgroundImage:function(a){},initiateSSO:function(){GameConfig.SSO_ENABLED&&(RSGame.getInstance().getLoadingManger().getGameReLoadingScreenStatus()?(RSGame.getInstance().getGameManager().setSSOMainLobbyReloadStatus(!0), RSGameScreenManager.getInstance().removeAllScreensExceptMainLobby(),RSEngine.screenManager.removeOverlay(),RSEngine.externalGameManager.unLoadExternalGame(),RSGame.getInstance().getGameManager().resetMachinePlayed(),GlobalVars.isLoginFromLoadingScreen?RSLoginManager.getInstance().trackLinkingTime():(RSGameScreenManager.getInstance().loadScreen(RSGameScreens.MainLobby),RSGame.getInstance().getLoadingManger().resetGameReLoadingScreenStatus())):GameConfig.LOADING_MODULE_SSO_ENABLED&&GlobalVars.isLoginFromLoadingScreen&& RSLoginManager.getInstance().trackLinkingTime(),RSEngine.screenManager.removeOverlay())},unload:function(){this._super.unload.call(this)}});var a0_0x59c0e5=a0_0x4a2c; function a0_0x44ef(){var a="giftData;4574241IfFvlP;levelFactor;activity_count;levelUnlocks;Country Code not Set!;getMe;saleData;isSubscriptionInteruptedShown;isCommonWelcomeBonusAwarded;6579608ajfzGq;409640XKPxcX;isJlSurfacingShown;upgradeVIPTooltipShownTime;_dataHolder;PopupName;lastMachineUnlockedLevel;daubAlertTime;getCurrentServerTime;gameData;isMigratedUserPopupShown;avatar;loginMode;GUEST;getGameManager;_guestLastLobbyName;splice;slotsStats;getSpins;DCInfoPopupShown;getSlotWin;unlockedGifts;externalGameManager;retaining the fpvp migrated coin balance here for a fresh user;joiningDate;Scratcher;lastPlayedTournamentID;getBlobIdData;exitCount;bingoroom_cards_count;RestorePointsPopupShown;userBanned;indexOf;scratcherStats;length;countryCode;getMachinesPlayed;99454WUrOqs;kenoroom_draws;getBingoRoomCardCount;quests;vipTierUnlockedShown;coins;lastPurchasedPack;lastPlayedMachineDetails;dataManager;cumulativeSpinsForFUE;number_of_blackjacks;kenoStatsGetHighestWin;_guestGameType;isSubscriptionAfterFirstPurchaseShown;_foxWoodUser;isVipSurfacingShown;_monetisation_count;rewardedLevel;isLMAnnouncementShown;init;isTournamentLoaded;_monetisation_factor;triggerVipSurfacing;previousTier;machines_played;last_played;level;session;pokerroom_deals;platformVersions;getCurrentLevelVO;isLoyaltyEligiblePopupShown;customLoungePopupShown;getGuestUserData;tournamaniaSurfacingShown;getBingoCardsWon;_initialXP;_initialCoins;push;day;enableShare;blackjackTutorialsShown;levelXPOffset;customInstallShownDate;_super;tapBlastCollectedCount;getScratcherRounds;call;virality_factor;getGameData;paidCoins;activity_factor;localSessionData;lastTapBlastClaimedTime;3uNhKkm;getCoins;bingoStats;getPokerDealCount;FACEBOOK;warn;null;getUserLevel;WEB_FACEBOOK;kenoStats;retentionCount;4094600IJWZQO;_isFreshUser;_firstSignIn;getLevelManager;getLoadingManger;highest_win;_paidCoins;completedFUEBonus;getPokerMachineTypeByName;_xpOffset;1205867WHYKew;EMAIL;monetization_factor;favoriteMachines;analyticsPlatformName;fpvpMigratedRewardPopupShown;slotmachine_spins;getDefaultValues;isVikingLoungePopupShown;getGameVariable;currentPlatform;propertyLinkState;_guestMachineAnalyticsName;hourlyBonusPickedTime;xpFraction;dailyBonusPickedTime;_guestSyncPopupName;total_bingos_won;canvas;gameType;vipMachineUnlocked;IsCountryCodeCheatEnabled;piggyBankCoin;isRewardRestoredAnimShown;pokerStatsGetHighestWin;triggerLmSurfacing;_guestMachineType;blackjackroom_deals;web;machinesPlayedDetails;sessionDetail;getInstance;setSlotsLastPlayedMachines;getBlackajackWonStats;isSweepstakesSurfacingShown;extend;round;isMachineUnlocked;lastLogin;applicationPlatforms;getBlobVersion;2604265rdNPPv;blackjackStats;setBlobForGuest;ScratcherStatsGetHighestWin;getGuestUserDataForKey;pokerStats;powerUps;6hSnDtr;getBlackjackDealCount;getKenoDealCount".split(";");a0_0x44ef= function(){return a};return a0_0x44ef()}(function(a,b){for(var c=a0_0x4a2c,d=a();;)try{if(parseInt(c(161))/1+parseInt(c(259))/2*(-parseInt(c(140))/3)+-parseInt(c(223))/4+parseInt(c(202))/5*(parseInt(c(209))/6)+-parseInt(c(222))/7+-parseInt(c(151))/8+parseInt(c(213))/9===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x44ef,631063);function a0_0x4a2c(a,b){var c=a0_0x44ef();return a0_0x4a2c=function(a,b){return c[a-140]},a0_0x4a2c(a,b)} var LATEST_BLOB_VERSION=6,CasinoUser=RSUser[a0_0x59c0e5(196)]({init:function(a,b){var c=a0_0x59c0e5;this[c(152)]=!1;this[c(275)]=0;this[c(280)]=0;this[c(173)]="";this[c(271)]="";this[c(237)]="";this[c(296)]=0;this._paidCoins=this[c(295)]=0;this[c(273)]=!1;this[c(303)][c(278)][c(306)](this,a,b)},loadDefaults:function(){var a=a0_0x59c0e5;switch(this[a(201)]()+1){case 1:this[a(226)][a(246)]=TimeManager[a(192)]().getCurrentServerTime(),this[a(152)]=!0,this[a(160)]=0,this[a(296)]=0}switch(this.getBlobVersion()+ 1){case 0:case 1:RSEngine[a(234)]!==LOGIN_MODE[a(235)]&&RSSSOManager.getBlobIdData()&&1==RSSSOManager[a(249)]().isFoxwoodUser&&(this._foxWoodUser=!0),!this[a(273)]&&(1==RSGame[a(192)]()[a(170)]().getFPVPUserMigratedStatus()&&RSEngine[a(234)]!=LOGIN_MODE.GUEST?cc.log(a(245)):this._dataHolder[a(264)]=this[a(296)],this[a(226)][a(285)]=1,this[a(226)][a(163)]=this[a(280)],this[a(226)].monetization_count=this[a(275)]),this._dataHolder.paidCoins=this[a(157)],this[a(226)].xp=this[a(295)],this[a(226)][a(233)]= 0,this[a(226)][a(307)]=0,this._dataHolder.virality_count=0,this[a(226)][a(310)]=0,this[a(226)][a(215)]=0,this[a(226)][a(208)]={},this[a(226)][a(221)]=!1,this._dataHolder.isFBLoginBonusAwarded=!1,this[a(226)][a(174)]=0,this._dataHolder[a(176)]=0,this[a(226)][a(190)]={},this[a(226)][a(216)]=0,this[a(226)][a(199)]=TimeManager[a(192)]()[a(230)](),RSEngine[a(234)]==LOGIN_MODE[a(144)]?this[a(226)][a(171)]=a(179):this[a(226)].currentPlatform=a(189),this._dataHolder[a(228)]=0,this[a(226)].rewardedLevel=this._dataHolder[a(285)], this[a(226)][a(265)]=a(146),this[a(226)][a(250)]=0,this._dataHolder[a(181)]=1,this._dataHolder[a(243)]={},this[a(226)][a(219)]={},this[a(226)].lastPurchaseTime=0,this[a(226)].previousPurchaseDate=0,this._dataHolder[a(212)]={},this[a(226)][a(191)]={day:0,session:0},this[a(226)][a(263)]=0,this[a(226)][a(262)]={},this[a(226)][a(300)]=[],this[a(226)][a(190)]={},this[a(226)][a(241)]=!1,this[a(226)][a(301)]=0,this._dataHolder[a(214)]=0,this._dataHolder[a(274)]=!1,this._dataHolder[a(281)]=!1,this[a(226)][a(183)]= 0,this[a(226)][a(175)]=0,this[a(226)][a(229)]=0,this[a(226)].playerCardStatus=!1,this._dataHolder[a(224)]=!1,this[a(226)].triggerJlSurfacing=!1,this[a(226)][a(239)]={first_played:0,machine_spins:{},highest_win:0,tournaments_won:0,slotmachine_spins:{},last_played:[]},this[a(226)][a(142)]={first_played:0,highest_rank:0,total_bingos_won:0,first_place_bingos:0,bingoroom_cards_count:{}},this[a(226)].pokerStats={first_played:0,room_deals:{},highest_win:0,machines_played:[],pokerroom_deals:{}},this[a(226)][a(203)]= {first_played:0,room_deals:{},number_of_blackjacks:0,blackjackroom_deals:{}},this[a(226)][a(149)]={first_played:0,room_deals:{},highest_win:0,kenoroom_draws:{}},this._dataHolder[a(266)]={},this[a(226)][a(158)]=!0,this[a(226)].completedMachineFUE=!0,this[a(226)][a(268)]=0,this._dataHolder.machineFUEBonusShown=[],this[a(226)].rouletteStats={first_played:0,highest_win:0,machine_rounds:{}},this._dataHolder.isSSOLoginBonusAwarded=!1,this[a(226)][a(232)]=!1,this[a(226)][a(255)]={first_played:0,highest_win:0, machine_rounds:{}},this[a(226)][a(169)]=!1,this[a(226)][a(291)]=[],this[a(226)].lastPlayedTournamentID="",this._dataHolder[a(293)]=!1,this[a(226)].localSessionData={},this[a(226)][a(172)]=0,this[a(226)].onBoardingSurfacingShown=!1,void 0==this[a(226)].RestorePointsPopupShown&&(this[a(226)][a(252)]=!1),this[a(226)][a(290)]=!1,this._dataHolder[a(186)]=!1,this[a(226)][a(277)]=!1,this[a(226)][a(225)]=0;case 2:this._dataHolder[a(248)]="",this[a(226)][a(293)]=!1,this._dataHolder[a(311)]={};case 3:this[a(226)][a(164)]= {};case 4:this[a(226)].fpvpMigratedRewardPopupShown=!1;case 5:this[a(226)][a(220)]=0,this[a(226)][a(272)]=!1;case 6:this[a(226)][a(195)]=!1}return this[a(201)]()>LATEST_BLOB_VERSION?this[a(201)]():LATEST_BLOB_VERSION},addGuestItems:function(){var a=a0_0x59c0e5,b=this[a(292)]();b&&(b[a(264)]=0,b.xp=0,b[a(208)]={},b[a(221)]=!1,b[a(262)]={},b[a(180)]="")},setBlobForGuest:function(){var a=a0_0x59c0e5;this[a(303)][a(204)][a(306)](this);RSEngine[a(234)]==LOGIN_MODE[a(235)]?(this[a(226)][a(262)]=this.getGuestUserDataForKey(a(262)), this[a(226)][a(221)]=this.getGuestUserDataForKey(a(221)),this[a(226)][a(183)]=this[a(206)](a(183)),this[a(226)][a(285)]=this.getGuestUserDataForKey(a(285)),this[a(226)].levelXPOffset=this[a(206)]("levelXPOffset")):this[a(206)]("firstLogin")&&this[a(153)]&&(this[a(226)].quests=this[a(206)]("quests"),this[a(226)].isCommonWelcomeBonusAwarded=this[a(206)](a(221)),this[a(226)][a(183)]=this[a(206)](a(183))?this.getGuestUserDataForKey(a(183)):0,this[a(226)][a(285)]=this.getGuestUserDataForKey(a(285))?this[a(206)]("level"): 1,this._dataHolder[a(301)]=this[a(206)](a(301))?this[a(206)](a(301)):0,this[a(187)]=this[a(206)](a(180)),this[a(237)]=this[a(206)]("LobbyName"),this[a(173)]=this[a(206)]("AnalyticsMachineName"),this[a(177)]=this[a(206)](a(227)),this[a(226)].xp=0>this._dataHolder.xp?0:this[a(226)].xp)},getRewardedLevel:function(){var a=a0_0x59c0e5;return null==this[a(226)][a(276)]&&(this[a(226)].rewardedLevel=1),parseInt(this[a(226)][a(276)])},setRewardedLevel:function(a){var b=a0_0x59c0e5;a&&(this[b(226)].rewardedLevel= parseInt(a))},setUserLevel:function(a){this[a0_0x59c0e5(226)].level=parseInt(a)},getCountryCode:function(){var a=a0_0x59c0e5;return 1==parseInt(RSGame.getInstance()[a(308)]()[a(168)]()[a(182)])?"US":this._dataHolder[a(257)]?this[a(226)][a(257)]:(cc[a(145)](a(217)),"")},getGuestMachineAnalyticsName:function(){return this[a0_0x59c0e5(173)]},getGuestSyncPopupName:function(){var a=a0_0x59c0e5;return this[a(177)]?this[a(177)]:""},getGuestGameType:function(){return this[a0_0x59c0e5(271)]},getGuestLastLobbyName:function(){return this[a0_0x59c0e5(237)]}, getVIPTierUnlockPopupShown:function(){var a=a0_0x59c0e5;return null==this[a(226)][a(263)]&&(this[a(226)][a(263)]=0),parseInt(this[a(226)][a(263)])},setVIPTierUnlockPopupShown:function(a){var b=a0_0x59c0e5;this[b(226)][b(263)]=parseInt(a)},getCurrentDay:function(){var a=a0_0x59c0e5;return null==this._dataHolder[a(191)]&&(this[a(226)][a(191)]={day:0,session:0}),parseInt(this[a(226)].sessionDetail[a(298)])},setCurrentDay:function(a){var b=a0_0x59c0e5;null==this[b(226)][b(191)]&&(this[b(226)][b(191)]= {day:0,session:0});this._dataHolder[b(191)][b(298)]=parseInt(a)},getCurrentSession:function(){var a=a0_0x59c0e5;return null==this[a(226)][a(191)]&&(this[a(226)][a(191)]={day:0,session:0}),parseInt(this._dataHolder[a(191)][a(286)])},setCurrentSession:function(a){var b=a0_0x59c0e5;null==this._dataHolder[b(191)]&&(this[b(226)].sessionDetail={day:0,session:0});this[b(226)][b(191)][b(286)]=parseInt(a)},isUserBanned:function(){var a=a0_0x59c0e5,b=!1;return this[a(226)][a(253)]&&parseInt(this[a(226)][a(253)])&& (b=!0),b},setPlatformAndVersion:function(a){var b=a0_0x59c0e5,c=this[b(226)].applicationPlatforms,d,e=this[b(226)].platformVersions;null==c&&(this[b(226)][b(200)]=[],c=this[b(226)][b(200)]);null==this[b(226)][b(288)]&&(this[b(226)][b(288)]={},e=this[b(226)][b(288)]);RSEngine[b(234)]==LOGIN_MODE[b(144)]?d=b(179):d=GlobalVars[b(165)];RSEngine.loginMode!=LOGIN_MODE[b(162)]&&RSEngine[b(234)]!=LOGIN_MODE[b(235)]||(GlobalVars[b(299)]=!1);-1==c[b(254)](d)&&c[b(297)](d);e[d]=a;this[b(226)].platformVersions= e;this[b(226)][b(171)]=d},lastTapBlastClaimedTime:function(){var a=a0_0x59c0e5;return null==this._dataHolder.lastTapBlastClaimedTime&&(this._dataHolder[a(312)]=0),this._dataHolder.lastTapBlastClaimedTime},tapBlastCollectedCount:function(){var a=a0_0x59c0e5;return null==this[a(226)][a(304)]&&(this._dataHolder[a(304)]=0),this[a(226)].tapBlastCollectedCount},getRetentionCount:function(){var a=a0_0x59c0e5;return null==this[a(226)][a(150)]&&(this._dataHolder[a(150)]=0),this[a(226)][a(150)]},getSavedPaidCoins:function(){var a= a0_0x59c0e5;return null==this[a(226)][a(309)]&&(this[a(226)][a(309)]=0),this._dataHolder.paidCoins},addPowerUps:function(a,b){var c=a0_0x59c0e5;null==this[c(226)].powerUps&&(this[c(226)][c(208)]={});var d=this[c(226)][c(208)];null==d[a]&&(d[a]=0);d[a]+=b;this[c(226)][c(208)]=d;0>=this._dataHolder[c(208)][a]&&(this[c(226)][c(208)][a]=0)},setMachinesPlayed:function(a){var b=a0_0x59c0e5;a=RSEngine[b(231)][b(159)](a);-1==this[b(226)].pokerStats[b(283)][b(254)](a)&&this[b(226)][b(207)][b(283)][b(297)](a)}, getMachinesPlayed:function(){var a=a0_0x59c0e5;return 0==this._dataHolder[a(207)][a(283)][a(256)]?0:this[a(226)].pokerStats[a(283)][a(256)]},setPokerDealCount:function(a){var b=a0_0x59c0e5;null!=this[b(226)][b(207)][b(287)][a]&&void 0!=this[b(226)].pokerStats[b(287)][a]||(this[b(226)].pokerStats[b(287)][a]=0);this[b(226)][b(207)][b(287)][a]=parseInt(this[b(226)].pokerStats.pokerroom_deals[a])+1},getPokerDealCount:function(){var a=a0_0x59c0e5;return(null==this[a(226)].pokerStats[a(287)]||void 0==this[a(226)][a(207)].pokerroom_deals)&& (this[a(226)][a(207)][a(287)]={}),this._dataHolder[a(207)][a(287)]},getBingoRoomCardCount:function(){var a=a0_0x59c0e5;return(null==this[a(226)][a(142)][a(251)]||void 0==this._dataHolder[a(142)].bingoroom_cards_count)&&(this[a(226)][a(142)][a(251)]={}),this[a(226)][a(142)][a(251)]},setBingoRoomCardCount:function(a,b){var c=a0_0x59c0e5;null!=this._dataHolder.bingoStats[c(251)][a]&&void 0!=this._dataHolder[c(142)][c(251)][a]||(this._dataHolder[c(142)].bingoroom_cards_count[a]=0);this._dataHolder.bingoStats[c(251)][a]= parseInt(this[c(226)][c(142)].bingoroom_cards_count[a])+b},setBlackjackDealCount:function(a){var b=a0_0x59c0e5;null!=this[b(226)][b(203)][b(188)][a]&&void 0!=this[b(226)][b(203)][b(188)][a]||(this[b(226)][b(203)][b(188)][a]=0);this[b(226)][b(203)][b(188)][a]=parseInt(this[b(226)][b(203)][b(188)][a])+1},getBlackjackDealCount:function(){var a=a0_0x59c0e5;return(null==this[a(226)][a(203)].blackjackroom_deals||void 0==this[a(226)][a(203)][a(188)])&&(this._dataHolder[a(203)].blackjackroom_deals={}),this._dataHolder[a(203)].blackjackroom_deals}, setKenoDealCount:function(a){var b=a0_0x59c0e5;null!=this._dataHolder[b(149)].kenoroom_draws[a]&&void 0!=this[b(226)][b(149)][b(260)][a]||(this[b(226)].kenoStats[b(260)][a]=0);this._dataHolder[b(149)].kenoroom_draws[a]=parseInt(this[b(226)][b(149)].kenoroom_draws[a])+1},getKenoDealCount:function(){var a=a0_0x59c0e5;return this._dataHolder[a(149)]?((null==this._dataHolder[a(149)][a(260)]||void 0==this[a(226)].kenoStats[a(260)])&&(this[a(226)][a(149)][a(260)]={}),this[a(226)][a(149)][a(260)]):(this._dataHolder[a(149)]= {first_played:0,room_deals:{},highest_win:0,kenoroom_draws:{}},this[a(226)][a(149)][a(260)])},kenoStatsSetHighestWin:function(a){var b=a0_0x59c0e5;this[b(226)][b(149)][b(156)]<a&&(this[b(226)][b(149)].highest_win=a)},kenoStatsGetHighestWin:function(){var a=a0_0x59c0e5;return null==this[a(226)][a(149)][a(156)]?0:this[a(226)].kenoStats[a(156)]},getBingoCardsWon:function(){var a=a0_0x59c0e5;return null==this[a(226)][a(142)].total_bingos_won?0:this._dataHolder[a(142)][a(178)]},getBlackajackWonStats:function(){var a= a0_0x59c0e5;return null==this[a(226)][a(203)][a(269)]?0:this[a(226)][a(203)][a(269)]},setBlackjackWonStats:function(a){var b=a0_0x59c0e5;null!=this[b(226)][b(203)][b(269)]?this[b(226)][b(203)][b(269)]+=a:this[b(226)][b(203)][b(269)]=a},getBingoFavoriteRoom:function(){var a=a0_0x59c0e5,a=this[a(226)][a(142)].bingoroom_cards_count,b,c,d=0;if(null!=a){for(var e in a)a[e]>d&&(d=a[e],c=e);return b=RSEngine.gameData.getBingoMachineDetailsbyName(c),null!=b?b.machineDisplayName:"NA"}return"NA"},getUserLevel:function(){var a= a0_0x59c0e5;return RSGame[a(192)]()[a(154)]()&&RSGame[a(192)]()[a(154)]()[a(289)]()&&!RSGame[a(192)]()[a(155)]().getGameReLoadingScreenStatus()?RSGame.getInstance()[a(154)]().getCurrentLevel():this[a(226)]&&this._dataHolder[a(285)]?this[a(226)][a(285)]:this._super[a(147)](this)},setSlotWin:function(a){var b=a0_0x59c0e5;null!=this[b(226)][b(239)][b(156)]&&void 0!=this[b(226)][b(239)][b(156)]||(this[b(226)][b(239)].highest_win=0);a>this[b(226)][b(239)][b(156)]&&!GlobalVars.isTournamentLoaded&&(this[b(226)][b(239)][b(156)]= a)},getSpins:function(){var a=a0_0x59c0e5;return(null==this._dataHolder[a(239)][a(167)]||void 0==this[a(226)].slotsStats[a(167)])&&(this._dataHolder.slotsStats[a(167)]={}),this[a(226)].slotsStats[a(167)]},setSpins:function(a){var b=a0_0x59c0e5;null!=this[b(226)][b(239)].slotmachine_spins&&void 0!=this._dataHolder[b(239)][b(167)]||(this[b(226)].slotsStats[b(167)]={});this[b(198)](a)&&!GlobalVars[b(279)]&&((null==this[b(226)][b(239)][b(167)][a]||void 0==this[b(226)][b(239)][b(167)][a])&&(this[b(226)].slotsStats[b(167)][a]= 0),this[b(226)][b(239)].slotmachine_spins[a]+=1,this[b(193)](a))},setDailyBonusPickedTime:function(a){this[a0_0x59c0e5(226)].dailyBonusPickedTime=Math.round(a)},setHourlyBonusPickedTime:function(a){this._dataHolder.hourlyBonusPickedTime=Math[a0_0x59c0e5(197)](a)},setVIPTooltipShownTime:function(a){this[a0_0x59c0e5(226)].upgradeVIPTooltipShownTime=a},getVIPTooltipShownTime:function(){var a=a0_0x59c0e5;return this[a(226)][a(225)]},getLastPurchasedPack:function(){var a=a0_0x59c0e5;return void 0==this[a(226)][a(265)]&& (this[a(226)][a(265)]=a(146)),this[a(226)][a(265)]},setLastPurchasePack:function(a){this._dataHolder[a0_0x59c0e5(265)]=a},getPuchaseCartExitCount:function(){var a=a0_0x59c0e5;return(void 0==this[a(226)].exitCount||isNaN(this[a(226)].exitCount))&&(this[a(226)].exitCount=0),this._dataHolder[a(250)]},setPuchaseCartExitCount:function(a){var b=a0_0x59c0e5;this[b(226)][b(250)]=a},getVipMachineUnlocked:function(){var a=a0_0x59c0e5;return null==this[a(226)][a(181)]&&(this[a(226)].vipMachineUnlocked=1),this[a(226)][a(181)]}, getSalePurchaseData:function(){var a=a0_0x59c0e5;return null==this[a(226)][a(219)]&&(this[a(226)].saleData={}),this[a(226)][a(219)]},setSalePurchaseData:function(a){this[a0_0x59c0e5(226)].saleData=a},getDaubAlertTime:function(){return this[a0_0x59c0e5(226)].daubAlertTime},setDaubAlertTime:function(a){this[a0_0x59c0e5(226)].daubAlertTime=a},getLevelXPOffset:function(){return this[a0_0x59c0e5(226)].levelXPOffset||0},setLevelXPOffset:function(a){var b=a0_0x59c0e5;RSEngine.loginMode===LOGIN_MODE[b(235)]&& RSGame[b(192)]().getUserDataManager()[b(218)]().setGuestUserDataForKey("levelXPOffset",a);this[b(226)][b(301)]=a},setLevelFactor:function(a){var b=a0_0x59c0e5;this[b(226)][b(214)]=a},getLevelFactor:function(){var a=a0_0x59c0e5;return this[a(226)][a(214)]||0},getSlotsLastPlayedMachines:function(){var a=a0_0x59c0e5;return(null==this[a(226)][a(239)][a(284)]||void 0==this[a(226)][a(239)][a(284)])&&(this._dataHolder[a(239)][a(284)]=[]),this[a(226)].slotsStats.last_played},setSlotsLastPlayedMachines:function(a){var b= a0_0x59c0e5;null!=this[b(226)].slotsStats[b(284)]&&void 0!=this[b(226)][b(239)][b(284)]||(this[b(226)][b(239)][b(284)]=[]);var c=this[b(226)][b(239)][b(284)];0==c[b(256)]?c[b(297)](a):c[c[b(256)]-1]!=a&&(2==c[b(256)]?(c[b(297)](a),c[b(238)](0,1)):c[b(297)](a));this[b(226)].slotsStats[b(284)]=c},syncBlobVars:function(a){var b=a0_0x59c0e5;this[b(303)].syncBlobVars[b(306)](this,a);RSEngine[b(244)].postMessageToJackpot({type:"updateCoinBalance",level:RSEngine[b(267)][b(218)]()[b(147)](),coinBalance:RSEngine[b(267)].getMe()[b(141)]()})}, setPiggyBankValue:function(a){var b=a0_0x59c0e5;this._dataHolder[b(183)]=a;RSEngine.loginMode==LOGIN_MODE[b(235)]&&this.setGuestUserDataForKey("piggyBankCoin",a)},setAvatar:function(a){var b=a0_0x59c0e5;this[b(226)][b(233)]=a},getAvatar:function(){var a=a0_0x59c0e5;return this[a(226)][a(233)]&&(1!=this[a(226)].avatar||RSEngine[a(234)]!=LOGIN_MODE[a(148)]&&RSEngine.loginMode!=LOGIN_MODE[a(144)])?this._dataHolder[a(233)]:0},getProfileStatusValue:function(a){var b=a0_0x59c0e5;switch(a){case b(242):return this[b(242)](); case b(240):return this[b(240)]();case b(258):return RSGame[b(192)]()[b(236)]().getMachinesPlayed(RSGameTypes.Poker);case b(185):return this[b(185)]();case b(143):return this.getPokerDealCount();case b(294):return this.getBingoCardsWon();case b(261):return this[b(261)]();case b(270):return this[b(270)]();case b(211):return this[b(211)]();case b(194):return this[b(194)]();case "getBlackjackDealCount":return this[b(210)]();case "ScratcherStatsGetHighestWin":return this[b(205)]();case b(305):return RSGame[b(192)]().getGameManager()[b(305)](RSGameTypes[b(247)]); default:return 0}},setPreviousTierData:function(a){var b=a0_0x59c0e5;this[b(226)][b(282)]=a},getPreviousTierData:function(){var a=a0_0x59c0e5;return this[a(226)][a(282)]},setRestorePointsPopupShownStatus:function(){var a=a0_0x59c0e5;this[a(226)][a(252)]=!0},getRestorePointsPopupShownStatus:function(){return this[a0_0x59c0e5(226)].RestorePointsPopupShown},setRewardRestoredAnimShownStatus:function(a){var b=a0_0x59c0e5;this[b(226)][b(184)]=a},getRewardRestoredAnimShownStatus:function(){var a=a0_0x59c0e5; return null==this[a(226)][a(184)]&&(this._dataHolder[a(184)]=!1),this[a(226)].isRewardRestoredAnimShown},getFpvpMigratedRewardPopupShownStatus:function(){var a=a0_0x59c0e5;return(null==this[a(226)][a(166)]||void 0==this[a(226)].fpvpMigratedRewardPopupShown)&&(this._dataHolder[a(166)]=!1),this[a(226)].fpvpMigratedRewardPopupShown},setFpvpMigratedRewardPopupShownStatus:function(){var a=a0_0x59c0e5;this[a(226)][a(166)]=!0},setCustomInstallShownDate:function(){var a=a0_0x59c0e5;null==this[a(226)].customInstallShownDate|| a(226);this[a(226)].customInstallShownDate=parseInt(this[a(226)][a(191)][a(298)])},getCustomInstallShownDate:function(){var a=a0_0x59c0e5;return null==this[a(226)][a(302)]||void 0==this[a(226)][a(302)]?null:parseInt(this[a(226)][a(302)])}});var a0_0x46d88f=a0_0x40a8;function a0_0x40a8(a,b){var c=a0_0x3222();return a0_0x40a8=function(a,b){return c[a-199]},a0_0x40a8(a,b)}function a0_0x3222(){var a="networkManager getId 10pCTjlA MOBILE 2125848YPgshl 3RscqgQ 314912cvkOYx _super User.rewardVideoBonus sendJSONRPCRequest 7201539UwCeIH extend platform mobile init 4295450OXDeOr dataManager 2478724FBrvHT 21YQozcn 11jcwqmo 41651LQmBpX 42fKUrcB html5 26110092cWybFr call".split(" ");a0_0x3222=function(){return a};return a0_0x3222()} (function(a,b){for(var c=a0_0x40a8,d=a();;)try{if(-parseInt(c(212))/1*(parseInt(c(213))/2)+parseInt(c(222))/3*(-parseInt(c(209))/4)+parseInt(c(207))/5+-parseInt(c(221))/6+parseInt(c(210))/7*(parseInt(c(223))/8)+parseInt(c(202))/9*(-parseInt(c(219))/10)+parseInt(c(211))/11*(parseInt(c(215))/12)===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x3222,504192); var CasinoUserDataManager=RSUserDataManagerV2[a0_0x46d88f(203)]({init:function(a,b){var c=a0_0x46d88f;this[c(199)][c(206)][c(216)](this,a,b)},createUser:function(a,b){return new CasinoUser(a,b)},rewardVideoBonus:function(a,b,c,d){var e=a0_0x46d88f,f=[];f[0]=RSEngine[e(208)].getMe()[e(218)]();f[1]=a;f[2]=RSEngine[e(204)]==PLATFORM[e(220)]?e(205):e(214);f[3]=d?d:"";RSEngine[e(217)][e(201)](e(200),f,b,c)}});function a0_0x4af9(a,b){var c=a0_0x4fd0();return a0_0x4af9=function(a,b){return c[a-279]},a0_0x4af9(a,b)} function a0_0x4fd0(){var a="bingoMachineAssets;getBingoMinimumBetRoomValue;vipData;machineType;tier;getCountryTier;8CRQLXD;call;getSheetData;2474755lJZevb;additionalRewardPointsOnPurchase;RSP;CartConfig;machine_identifier;blazingBetsBetValues;getSlotBetStructure;Slots;inAppPurchase;extend;gameCategory;BJ_3H6D;Poker;_super;getSlotBetStructureByName;Blackjack;isjackpotLoaded;additionalCoinsOnPurchase;getMe;1770330ghJLyB;1165722yyXQPt;getGameManager;betStructure;length;Invalid Pack ID: ;16WVYyVv;sortObjectWithIntKey;pokermachines;blackjackBetValues;55VmRSFc;getSpinBetStructureByName;_vipBenefits;nonMonetizerPacks;push;14BZNsfH;card1;MSP;137616pqxQRS;_coinPack;warn;levels;payLines;1763724vdaBLN;getMonetizationFactor;3212028Twxqfw;2895534lBcpum;levelData;monetizerPacks;value".split(";");a0_0x4fd0= function(){return a};return a0_0x4fd0()}var a0_0x5ad2db=a0_0x4af9;(function(a,b){for(var c=a0_0x4af9,d=a();;)try{if(-parseInt(c(280))/1+-parseInt(c(285))/2+parseInt(c(321))/3*(parseInt(c(298))/4)+parseInt(c(301))/5+parseInt(c(287))/6*(-parseInt(c(335))/7)+-parseInt(c(326))/8*(-parseInt(c(288))/9)+-parseInt(c(320))/10*(-parseInt(c(330))/11)===b)break;else d.push(d.shift())}catch(e){d.push(d.shift())}})(a0_0x4fd0,710562); var CasinoGameData=RSGameData[a0_0x5ad2db(310)]({_coinPack:null,_powerupPack:null,getPokerMachineTypeByName:function(a){for(var b=a0_0x5ad2db,c=this[b(300)](b(328)),d=0;d<c[b(324)];d++)if(c[d].machine_identifier==a)return c[d][b(295)];return null},getCoinPack:function(){var a=a0_0x5ad2db;this._coinPack=[];var b=this[a(300)](a(309)),c=RSGame.getInstance()[a(322)]()[a(297)](),c=this[a(300)]("tier"+c+a(304));RSUtils[a(327)](c,"id");for(var d=0;d<c[a(324)];d++)for(var e=0;e<b[a(324)];e++){var f="";0< RSEngine.dataManager[a(319)]()[a(286)]()?f=c[d][a(290)]:f=c[d][a(333)];if(f==b[e].id){this._coinPack[a(334)](new CoinPackVO(b[e]));break}}return this[a(281)]},getBingoMachineDetailsbyName:function(a){for(var b=a0_0x5ad2db,c=this.getSheetData(b(292)),d,e=0;e<c[b(324)];e++)if(a==c[e].machine_identifier){d=c[e];break}return d},getLevelSheetData:function(){var a=a0_0x5ad2db,a=this[a(300)](a(289));return RSUtils.sortObjectWithIntKey(a,"level")},additionalRewardPointsOnPurchase:function(a){var b=a0_0x5ad2db; this[b(332)]=this.getSheetData("vipData");for(var c=0;c<this[b(332)].length;c++)if(this._vipBenefits[c][b(296)]==a)return this[b(332)][c][b(302)];return 1},getVIPadditionalCoinsOnPurchase:function(a){var b=a0_0x5ad2db;this[b(332)]=this[b(300)](b(294));for(var c=0;c<this[b(332)][b(324)];c++)if(this[b(332)][c][b(296)]==a)return 100*this[b(332)][c][b(318)];return 1},getPackById:function(a){for(var b=a0_0x5ad2db,c=this[b(300)](b(309)),d=0;d<c.length;d++)if(a==c[d].id)return new CoinPackVO(c[d]);return cc[b(282)](b(325)+ a),null},getVIPGameData:function(){var a=a0_0x5ad2db;return this[a(300)](a(294))},getVIPPurchaseData:function(){return this[a0_0x5ad2db(300)]("vipPurchaseBenefits")},getBlackJackBetStructureByName:function(a){var b=a0_0x5ad2db;switch(a){case b(312):return this[b(300)](b(329))}return this[b(300)](b(306))},getMaxBetValueForSlot:function(a,b){var c=a0_0x5ad2db,d=this[c(307)](),e=0;if(GlobalVars[c(317)])e=parseInt(d[d[c(324)]-1][a]);else for(var f=0;f<d[c(324)]&&!(parseInt(d[f][c(283)])>b);f++)e=parseInt(d[f][a]); return e},getKenoBetStructureByName:function(a,b){var c=a0_0x5ad2db,d=this[c(300)]("machineBets"),e=[];if(GlobalVars[c(317)])e[c(334)](parseInt(d[d[c(324)]-1][a]));else for(var f in d)b>=d[f][c(283)]&&e.push(parseInt(d[f][a]));return e},getSpinBetStructureByName:function(a,b){var c=a0_0x5ad2db;return GlobalVars[c(317)]&&(b=9999999),this[c(314)][c(331)][c(299)](this,a,b)},getMinimumBetByGameTypeAndName:function(a,b){var c=a0_0x5ad2db,d=0;switch(a){case RSGameTypes[c(308)]:d=this[c(315)](b.machine_identifier)[0]* b[c(284)];break;case RSGameTypes.Bingo:var d=this.getSheetData("bingoMachinesDetails"),e;for(e in d)d[e].machine_identifier===b[c(305)]&&c(336);return this[c(293)]();case RSGameTypes[c(316)]:d=this.getMinBetValueForBlackJack(b[c(305)]);break;case RSGameTypes.Keno:d=this.getSheetData("machineBets")[0][b[c(305)]];break;case RSGameTypes[c(313)]:switch(b[c(311)]){case c(303):d=this[c(300)](b[c(323)])[0][c(291)];break;case c(279):d=4*this[c(300)](b[c(323)])[0][c(291)];break;case "MPP":d=5*this.getSheetData(b.betStructure)[0].value}}return parseInt(d)}, getPokerMachineDetailsByCategory:function(a){for(var b=a0_0x5ad2db,c=this[b(300)](b(328)),d=[],e=0;e<c.length;e++)c[e][b(311)]==a&&d[b(334)](c[e]);return d}});var MAINLOBBY_STATE={USER_BAN:0,WELCOME_BONUS:1,URL_NOTIFICATION:2,DAILY_BONUS:3,GENERAL_MAINLOBBY_INITIALIZATION:4,ANIMATE_MAINLOBBY:5,SWEEPSTAKES_SURFACING:6,EMAIL_VERIFICATION_SUCCESS_PROMPT_SOCIAL_LOGIN_SUCCESS:7,TOURNAMANIA_CURTAINRAISER:8,CURTAIN_RAISER:9,VIP_LM_SURFACING:10,JL_SURFACING:11,LEADERBOARD_REWARD:12,TOURNAMENT_REWARD:13,SWEEPSTAKES_ANNOUNCEMENT_POPUP:14,AVATAR_POPUP:15,LOGIN_SUCCESS:16,SHOW_MAINLOBBY:17,SHOW_DQ_POPUP:18,SUBSCRIPTION_SALE_POPUP:19,SALE_POPUP:20,SUBSCRIPTION_SALE_POPUP_AFTER_NPS:21, SWEEPSTAKES_ENTRY_POPUP:22,VIP_POPUP:23,REWARD_REMINDER:24,SUBSCRIPTION_INTERRUPT_POPUP:25,LM_TOOLTIP:26,VIP_TOOLTIP:27,DAILY_CHALLENGE_TOOLTIP:28,TOURNAMENT_ANNOUNCEMENT:29,LOADING_COMPLETE:30},MainLobby=RSCasinoScreen.extend({init:function(){this._topHud=this.bottomHud=this._blackjackNewTag=this._rouletteNewTag=this._rouletteButton=this._kenobingoNewTag=this._kenoBingoButtonAnimation=this._kenoBingoButton=this._pokerNewTag=this._pokerButtonAnimation=this._pokerButton=this._slotNewTag=this._slotButtonAnimation= this._slotButton=null;this._isSSOReInitSession=this.isEmailVerifiedCheckForSkippingTransition=GlobalVars.mainLobbyInitialized=!1;this._initialLoading=!0;this._currentState=0;this.skipSweepstakeEntryPopup=!1;RSGame.getInstance().getLoadingManger()&&(50==RSGame.getInstance().getLoadingManger().getProgressPercentage()&&(this._initialLoading=!1),RSGame.getInstance().getLoadingManger().getGameReLoadingScreenStatus()&&(this._initialLoading=this._isSSOReInitSession=!0));this._dailyBonusWidgetController= null;this._didCollectDailyBonus=!1;this._mainBg=null;this._buttonAnimArray=[];this._allObjectsArray=[];this._leaderboardRewardActive=this._isBottomHudLoadingComplete=this._curtainRaiserTriggered=!1;this._lobbyButtonArray=[];this._gameManager=RSGame.getInstance().getGameManager();this._ssoMainlobyReloadwithLoadingScreen=!1;this._super.init.call(this)},loadContent:function(){RSEngine.loginMode===LOGIN_MODE.FACEBOOK&&(RSGame.getInstance().getGameData().getDefaultValues().isLoyaltyMallEnabled=0);RSGame.getInstance().getGameManager().getSSOMainLobbyReloadStatus()&& (this._gameManager.setOnboardFirstSession(!1),RSGame.getInstance().getGameManager().reinitializeVIPStarRotationStatus(),RSGame.getInstance().getGameManager().getSSOReloadStatusWithLoadingScreen()&&(this._ssoMainlobyReloadwithLoadingScreen=!0));GlobalVars.isLoginFromLoadingScreen=!1;RSCasinoManager.setCasinoHUD(this.getCasinoHUD());null==RSCasinoManager.getCasinoInterface()&&RSCasinoManager.setCasinoInterface(this.getCasinoInterface());RSCasinoManager.getCasinoHUD().setPrimaryCurrency(RSCasinoManager.getPrimaryCurrency()); if(this._initialLoading&&(this._gameManager.initializePlatformSDKManager({},GameConfig.GAME_ID),GameConfig.MACHINE_OPEN_POPUP)){var a={};a[RSGameTypes.Poker]="res/PokerResources/CasinoSubLobby/Icons/";a[RSGameTypes.Bingo]="res/BingoResources/res/icons/";a[RSGameTypes.Slots]="res/SlotResources/CasinoSubLobby/LargeIcons/";a[RSGameTypes.Keno]="res/KenoResources/SubLobby/icons/";a[RSGameTypes.TableGames]="res/TableResources/SubLobby/LargeIcons/";a[RSGameTypes.Roulette]="res/TableResources/SubLobby/LargeIcons/"; a[RSGameTypes.Blackjack]="res/TableResources/SubLobby/LargeIcons/";RSGame.getInstance().getGameManager().initializeMachineOpenPopup(a)}RSEventManager.getInstance().addEventListener("onHourlyBonusCollected",this,this._onHourlyBonusCollect.bind(this));RSEventManager.getInstance().addEventListener("onHourlyBonusWidgetActive",this,this._onHourlyBonuswidgetActive.bind(this));this.bottomHud=new LobbyBottomHUD(this.onBottomHudLoadComplete.bind(this));this.bottomHud.setVisible(!1);this._super.loadContent.call(this); this._assetCount=4;GlobalVars.customLobbyStatus&&(this._assetCount=RSGame.getInstance().getAssetCount("MainLobby"));this._assetList=[{name:RSGame.getInstance().getAssetPath("MainLobby"),count:this._assetCount}];this.layoutScreen(this._assetList)},getCasinoHUD:function(){this._topHud=new TopHUD(RSGame.getInstance().getAssetPath("TopHud"));this._initialLoading&&this._topHud.setVisible(!1);return this._topHud},onObjectCreated:function(a,b,c){switch(c.type){case "Animation":switch(c.name){case "Slots":this._slotButtonAnimation= a;this.addAnimationToArray(a,1);this.removeChild(a);break;case "Poker":this._pokerButtonAnimation=a;this.addAnimationToArray(a,1);this.removeChild(a);break;case "Favorites":this._favoritesButtonAnimation=a;this.addAnimationToArray(a,1);this.removeChild(a);break;case "TableGames":this._tableGamesButtonAnimation=a;this.addAnimationToArray(a,1);this.removeChild(a);break;case "Keno":this._kenoBingoButtonAnimation=a;this.addAnimationToArray(a,1);this.removeChild(a);break;case "PumpkinAnim":case "Spider":case "Spider1":case "BatEye2":case "BatEye3":case "BatEye4":case "BatEye5":case "BatEye6":case "BatAnim":case "BatAnim2":case "Snow1":case "Snow2":case "Snow3":case "Snow4":case "Snow5":case "Snow6":case "Snow7":case "Snow8":case "Snow9":case "Snow10":case "Snow11":a.stopAnimation(); a.playAnimation(-1,0.3);this.setDefaultProperites(a);break;case "SlotsTag":this._slotNewTag=a;this._slotNewTag.setVisible(!1);break;case "VideoPokerTag":this._pokerNewTag=a;this._pokerNewTag.setVisible(!1);break;case "KenoTag":this._kenobingoNewTag=a;this._kenobingoNewTag.setVisible(!1);break;case "FavoritesTag":this._favoritesNewTag=a;this._favoritesNewTag.setVisible(!1);break;case "TableGamesTag":this._tableGamesTag=a;this._tableGamesTag.setVisible(!1);break;default:this.setDefaultProperites(a)}break; case "AnimButton":switch(c.name){case "SlotsButton":this._slotButton=a;this._lobbyButtonArray.push(a);this.setDefaultProperites(a);break;case "VideoPokerButton":this._pokerButton=a;this._lobbyButtonArray.push(a);this.setDefaultProperites(a);break;case "KenoButton":this._kenoBingoButton=a;this._lobbyButtonArray.push(a);this.setDefaultProperites(a);break;case "FavoritesButton":this._favoritesButton=a;this._lobbyButtonArray.push(a);this.setDefaultProperites(a);break;case "TableGamesButton":this._tableGamesButton= a,this.setDefaultProperites(a,2)}break;case "bo":switch(c.name){case "AllUnlocked":this._allUnlockedTag=a;this._allUnlockedTag.setVisible(!1);break;case "Bg":this._mainBg=a;this.setDefaultProperites(a);break;default:this.setDefaultProperites(a)}}this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a,b){switch(b.name){case "MuteButtonWidget":this._muteBtnWidget=new RSPanel(b.x,b.y,b.w,b.h),RSMuteButtonManager.showMuteButton(this,RSGame.getInstance().getAssetPath("MuteButtonWidget"), this._muteBtnWidget)}switch(b.type){case "Bat":var c=RSUtils.createBasicObject(a,b);this.addChild(c);this.setDefaultProperites(c);break;case "SpiderWeb":case "SpiderWeb1":c=RSUtils.createBasicObject(a,b),this.addChild(c),this.setDefaultProperites(c)}},onAssetLoaded:function(a){this._super.onAssetLoaded.call(this,a)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);GlobalVars.scoreboxRedirection=!1;GlobalVars.slotsLobbySelectedTab=TabType.ALLSLOTS;this.setName(RSGameScreens.MainLobby); RSGame.getInstance().getGameManager().setGameType("");RSGame.getInstance().getGameManager().setFeaturedAndPreviewMachinesInSlots();RSEventManager.getInstance().addEventListener("onRankUpRewarded",this,this.onRewardScreenComplete.bind(this));GameConfig.HOUSE_ADS_ENABLED&&RSGame.getInstance().getPlatformEventManager().getRewardedAdCapCapCount()>=RSGame.getInstance().getPlatformEventManager().getRewardedAdsForTheDay()&&(RSEventManager.getInstance().addEventListener("onRewardCollected",this,this._onRewardCollect.bind(this)), RSEventManager.getInstance().addEventListener("houseAdClose",this,this._onHouseAdsClose.bind(this)),RSEventManager.getInstance().addEventListener("adPopupClose",this,this._onAdPopupClose.bind(this)))},onSaleButtonClicked:function(a,b){RSGame.getInstance().getGameManager().showSaleOrPurchaseCart(a,b)},_onRewardCollect:function(){this._didCollectDailyBonus&&this.startTransition(!0)},_onHouseAdsClose:function(){this._didCollectDailyBonus&&this.startTransition(!0)},_onAdPopupClose:function(){this._didCollectDailyBonus&& this.startTransition(!0)},onReveal:function(){document.getElementById("helpshift_dummy")&&document.getElementById("helpshift_dummy").remove();this._super.onReveal.call(this);this.startTransition()},startTransition:function(a){a&&this._currentState++;switch(this._currentState){case MAINLOBBY_STATE.USER_BAN:if(RSGame.getInstance().getUserDataManager().getMe().isUserBanned()){RSEngine.popupManager.addPopup(new UserBanPopup,!1);break}this.startTransition(!0);break;case MAINLOBBY_STATE.WELCOME_BONUS:if(!RSGame.getInstance().getUserDataManager().getMe().getWelcomeBonusAwarded()){a= RSGame.getInstance().getGameManager().getDefaultCasinoFont("extralarge","bold");RSEngine.popupManager.addPopup(new RSWelcomeScreen(a,this.startTransition.bind(this,!0),!0),!1,!1,!1,!1);break}this.startTransition(!0);break;case MAINLOBBY_STATE.URL_NOTIFICATION:if(this._skipFurtherPopups){this.startTransition(!0);break}this.checkAndShowURLNotificationPopups();break;case MAINLOBBY_STATE.DAILY_BONUS:this._dailyBonusWidgetController=RSWidgetsManager.getInstance().getController("DailyBonusScreen");RSGame.getInstance().getUserDataManager().getMe().getWelcomeBonusAwarded()&& RSEngine.loginMode!=LOGIN_MODE.GUEST&&this._dailyBonusWidgetController.getDailyBonusActive()&&(0<RSGame.getInstance().getUserDataManager().getMe().getCurrentDay()||0==RSGame.getInstance().getUserDataManager().getMe().getCurrentDay()&&(RSGame.getInstance().getGameManager().getMachinePlayed()||1<RSGame.getInstance().getUserDataManager().getMe().getCurrentSession()))?(this._dailyBonusWidgetController.loadLayout(),this._dailyBonusWidgetController.setDelegate(this),this.addChild(this._dailyBonusWidgetController.getView()), this._initialLoading||SideMenuController.getInstance().setSideMenuVisibility(!1)):this.startTransition(!0);break;case MAINLOBBY_STATE.GENERAL_MAINLOBBY_INITIALIZATION:this._initialLoading&&RSEngine.loginMode!==LOGIN_MODE.GUEST&&(GameConfig.QUEST_ENABLED&&RSQuestManager.getInstance().getIsQuestManagerActive()||GameConfig.TOURNAMENT_ENABLED)&&SideMenuController.getInstance().initiateSideMenuView("FPCT");SideMenuController.getInstance().handlePositionAndOffset();RSEngine.loginMode!=LOGIN_MODE.GUEST&& GameConfig.QUEST_ENABLED&&RSQuestManager.getInstance().getIsQuestManagerActive()&&(RSQuestManager.getInstance().questLevelEnabled()&&RSGame.getInstance().getUserDataManager().getMe().getDailyChallengeData().activeQuests&&RSGame.getInstance().getUserDataManager().getMe().getDailyChallengeData().activeQuests.length||SideMenuController.getInstance().updateLockButton());RSGame.getInstance().getUserDataManager().getMe().getFirstSignIn()&&RSEngine.loginMode!=LOGIN_MODE.GUEST&&(RSAnalyticsManager.getInstance().trackInstall(), RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&FBPixelManager.getInstance().trackInstall(),GameConfig.IS_ADJUST_ENABLED&&RSAdjustManager.getInstance().trackEvent(RSAdjustEventToken.Install),GameConfig.IS_APPSFLYER_ENABLED&&!RSGame.getInstance().getUserDataManager().getMe().getAppsFlayerEventStatus("event1")&&(RSAppsFlyerManager.getInstance().trackEvent("event1"),RSGame.getInstance().getUserDataManager().getMe().setAppsFlayerEvents("event1")));this._initialLoading?(RSEngine.loginMode!=LOGIN_MODE.GUEST&& RSGame.getInstance().getUserDataManager().getMe().getFirstSignIn()&&parent.postMessage({type:"gtm",data:{event:"sign_up",blob_id:RSGame.getInstance().getUserDataManager().getMe().getId()}},"*"),JackpotLoungeDataHandler.getInstance().initialize(),RSEngine.dataManager.getMe().getJackpotUnlockStatus()&&RSEngine.dataManager.getMe().setJLSurfacingShown(),this._gameManager.showJackpotLoungeWelcomePopup(),RSGame.getInstance().getUserDataManager().getMe().getFirstSignIn()&&(parseInt(RSEngine.gameData.getDefaultValues().enableTimedFUE)&& RSGame.getInstance().getUserDataManager().getMe().setFUEBonusStatus(!1),parseInt(RSEngine.gameData.getDefaultValues().enableMachineFUE)&&RSGame.getInstance().getUserDataManager().getMe().setMachineFUEBonusStatus(!1)),PurchaseFlowManager.getInstance().initializeLocalCurrency(),this._isSSOReInitSession||this._gameManager.initializeGameSpecificCallbacks(),RSPlacementManager.getInstance().setInterface(new CustomPlacementInterface),RSPlacementManager.getInstance().initialise(),RSPlacementManager.getInstance().activateAllPlacementsFor("LoadingComplete"), RSEngine.loginMode!=LOGIN_MODE.GUEST?PurchaseFlowManager.getInstance().initialize(this.startTransition.bind(this,!0)):this.startTransition(!0)):this.startTransition(!0);break;case MAINLOBBY_STATE.ANIMATE_MAINLOBBY:this.startLobbyAnimations();this.onScreenFadeInComplete();break;case MAINLOBBY_STATE.SWEEPSTAKES_SURFACING:GameConfig.SWEEPSTAKES_ENABLED&&RSEngine.loginMode!=LOGIN_MODE.GUEST&&RSSweepstakesManager.getNextWeeksSweepstakesEnabledStatus()&&!GlobalVars.isSurfacingActive&&!RSGame.getInstance().getUserDataManager().getMe().getSweepstakesSurfaceShownStatus()&& RSGame.getInstance().getGameVariable().getSweepstakeEnabledStatus()&&!RSSweepstakesManager.getCoolDownTimeEnableStatus()?0<RSGame.getInstance().getUserDataManager().getMe().getCurrentDay()||0==RSGame.getInstance().getUserDataManager().getMe().getCurrentDay()&&1<RSGame.getInstance().getUserDataManager().getMe().getCurrentSession()||0==RSGame.getInstance().getUserDataManager().getMe().getCurrentDay()&&this._gameManager.getMachinePlayed()?(RSSweepstakesManager.showJackpotSweepstakesEntryPopup(!0,this.onSweepstakeSurfacingCompleted.bind(this)), GlobalVars.isSurfacingActive=!0):this.startTransition(!0):this.startTransition(!0);break;case MAINLOBBY_STATE.EMAIL_VERIFICATION_SUCCESS_PROMPT_SOCIAL_LOGIN_SUCCESS:RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&RSEngine.loginMode!=LOGIN_MODE.GUEST?(a=RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-emailValue"),GameConfig.SSO_ENABLED&&RSSSOManager.checkForMigratedUserOrNOt()&&a?RSEngine.dataManager.getMe().getMigratedUserPopupTriggerStatus()||!RSSSOManager.getBlobIdData()||!RSSSOManager.getBlobIdData().emailVerificationDetails|| "0"!=RSSSOManager.getBlobIdData().emailVerificationDetails.verified&&0!=RSSSOManager.getBlobIdData().emailVerificationDetails.verified?this.startTransition(!0):(RSEngine.dataManager.getMe().setMigratedUserPopupTriggeredStatus(),RSEngine.dataManager.saveUserBlobParams(),RSLoginManager.getInstance().updateSocialLogin("email",RSEngine.userConfig.email,null),RSSSOManager.showEmailVerificationPopup(RSSSOManager.getBlobIdData().emailId,300,this.isEmailVerified.bind(this))):GameConfig.SSO_ENABLED&&RSSSOManager.getEmailVerifiedStatus()? (a=RSSSOManager.getBlobIdData().emailId,RSSSOManager.showEmailVerificationPromtPopup(a,this.isEmailVerified.bind(this))):GameConfig.SSO_ENABLED&&a&&RSSSOManager.getCookieEmailVerificationStatus()?RSSSOManager.showEmailVerificationPromtPopup(a,this.isEmailVerified.bind(this)):RSSSOManager.checkAndUpdateSocialLogin(this.isEmailVerified.bind(this))):this.startTransition(!0);break;case MAINLOBBY_STATE.TOURNAMANIA_CURTAINRAISER:this._tournamentStatus=RSTournamentManager.getTournamentSurfacingEnabledStatus(); GlobalVars.isSurfacingActive||this._tournamentStatus!==TOURNAMENT_SURFACING_TYPES.BEFORE_FEATURE_LAUNCH&&this._tournamentStatus!==TOURNAMENT_SURFACING_TYPES.TOURNAMENT_IN_PROGRESS||!RSGame.getInstance().getUserDataManager().getMe().getWelcomeBonusAwarded()||RSEngine.loginMode===LOGIN_MODE.GUEST||this._curtainRaiserTriggered||!(0<RSGame.getInstance().getUserDataManager().getMe().getCurrentDay()||0===RSGame.getInstance().getUserDataManager().getMe().getCurrentDay()&&(RSGame.getInstance().getGameManager().getMachinePlayed()|| 1<RSGame.getInstance().getUserDataManager().getMe().getCurrentSession()))?this.startTransition(!0):(this._curtainRaiserTriggered=!0,RSGame.getInstance().getGameManager().setTournamentSurfacingStatus(!0),RSTournamentManager.showTournamentSurfacing(this.tournamentSurfacingCompleteCallback.bind(this)));break;case MAINLOBBY_STATE.CURTAIN_RAISER:RSEngine.loginMode!=LOGIN_MODE.GUEST&&!GlobalVars.isSurfacingActive&&RSGame.getInstance().getGameManager().getDCUnlockStatus()?(this._curtainRaiserTriggered=!0, RSGame.getInstance().getGameManager().triggerCurtainRaiserScreen(this._onCurtainRaiserScreenAnimComplete.bind(this))):this.startTransition(!0);break;case MAINLOBBY_STATE.VIP_LM_SURFACING:RSEngine.loginMode!=LOGIN_MODE.GUEST&&!RSEngine.dataManager.getMe().getVIPTriggerStatus()&&0<RSVIPManager.getInstance().getVIPUserTier()&&!RSEngine.dataManager.getMe().getVIPSurfacingShown()&&(RSEngine.dataManager.getMe().setVIPTriggerStatus(!0),GameConfig.LM_AND_VIP_SURFACING&&parseInt(RSGame.getInstance().getGameData().getDefaultValues().isLoyaltyMallEnabled)&& !RSEngine.dataManager.getMe().getLoyaltyMallEligiblePopupShownStatus()&&RSEngine.dataManager.getMe().setLMTriggerStatus(!0));this.initiateLMandVIPSurfacingScreens();break;case MAINLOBBY_STATE.JL_SURFACING:RSEngine.loginMode!=LOGIN_MODE.GUEST&&this._initialLoading&&!GlobalVars.isSurfacingActive&&RSEngine.dataManager.getMe().getJLTriggerStatus()&&!RSEngine.dataManager.getMe().getJLSurfacingShown()?GameConfig.JL_SURFACING&&GameConfig.JACKPOT_LOUNGE_ENABLE&&RSGame.getInstance().getLevelManager().getCurrentLevel()>= GameConfig.JACKPOT_LOUNGE_LEVEL&&(1<RSGame.getInstance().getUserDataManager().getMe().getCurrentSession()?this._gameManager.showIntroScreenForJL(this._onJLCurtainRaiserComplete.bind(this),!0):this.startTransition(!0)):this.startTransition(!0);break;case MAINLOBBY_STATE.LEADERBOARD_REWARD:if(this._skipFurtherPopups){this.startTransition(!0);break}(this._leaderboardRewardActive=RSRewardManager.isRewardActive("MainLobby_Launch"))&&RSEngine.loginMode!==LOGIN_MODE.GUEST?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent, {event:RSPlatformEventTypeKeys.ENTER_SCREEN,parameter:"MainLobby_Launch"}):this.startTransition(!0);break;case MAINLOBBY_STATE.TOURNAMENT_REWARD:if(this._skipFurtherPopups){this.startTransition(!0);break}RSRewardManager.isRewardActive(RSPlatformEventTypeKeys.TOURNAMENT_REWARD)&&RSEngine.loginMode!==LOGIN_MODE.GUEST?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.ENTER_SCREEN,parameter:RSPlatformEventTypeKeys.TOURNAMENT_REWARD}):this.startTransition(!0); break;case MAINLOBBY_STATE.SWEEPSTAKES_ANNOUNCEMENT_POPUP:if(this._skipFurtherPopups){this.startTransition(!0);break}GameConfig.SWEEPSTAKES_ENABLED&&RSEngine.loginMode!=LOGIN_MODE.GUEST&&RSSweepstakesManager.getSweepstakesRewardAnnouncementPopupTriggerStatus()&&RSGame.getInstance().getUserDataManager().getMe().getSweepstakesSurfaceShownStatus()?(this.skipSweepstakeEntryPopup=!0,RSSweepstakesManager.showSweepstakesRewardAnnouncementPopup(this.startTransition.bind(this,!0),!0)):this.startTransition(!0); break;case MAINLOBBY_STATE.AVATAR_POPUP:if(this._skipFurtherPopups){this.startTransition(!0);break}if(RSEngine.loginMode===LOGIN_MODE.EMAIL&&0===RSGame.getInstance().getUserDataManager().getMe().getAvatar()){a={};var b={};b.assetPath=[{name:RSGame.getInstance().getAssetPath("WebAvatarPopup"),count:1}];b.avatarImgAssetPath=RSGame.getInstance().getAssetFolder("AvatarPopup");b.avatarPlistName="AvatarImages_00";a.avatarImgCount=77;a.avatarsPerRow=5;a.rowPadding=8;RSEngine.popupManager.addPopup(new RSWebAvatarPopup(a, b,this.startTransition.bind(this,!0)),!0)}else this.startTransition(!0);break;case MAINLOBBY_STATE.LOGIN_SUCCESS:if(this._skipFurtherPopups){this.startTransition(!0);break}this.checkAndShowLoginSuccessPopup();break;case MAINLOBBY_STATE.SHOW_MAINLOBBY:if(this._skipFurtherPopups){this.startTransition(!0);break}RSLeaderboard.getRankUpTriggerStatus()&&RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.RSPlatformEvent,parameter:RSPlatformEventTypeKeys.ON_BACK_BUTTON_CLICK}); this.startTransition(!0);break;case MAINLOBBY_STATE.SHOW_DQ_POPUP:if(this._skipFurtherPopups){this.startTransition(!0);break}RSEngine.loginMode!=LOGIN_MODE.GUEST&&!this._curtainRaiserTriggered&&RSGame.getInstance().getGameManager().forceTriggerDailyQuestPopup&&this._initialLoading&&RSEngine.dataManager.getMe().getDCinfoPopupShownStatus()?RSEngine.popupManager.addPopup(new RSDailyQuestPopup(RSGame.getInstance().getAssetPath("DailyChallengePopup"),RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium", "bold"),this.onForcedDQPopupClosed.bind(this))):this.startTransition(!0);break;case MAINLOBBY_STATE.SUBSCRIPTION_SALE_POPUP:if(this._skipFurtherPopups){this.startTransition(!0);break}GameConfig.SUBSCRIPTION_ENABLED&&"sale"==RSSaleManager.getInstance().getSaleTagActiveForPlayer()?this.checkAndShowSubscriptionSalePopup(RSPLATFORM_SUBSCRIPTION_PLACEMENTS.SUBSCRIPTION_BEFORE_NPS,"Sub_BSale"):this.startTransition(!0);break;case MAINLOBBY_STATE.SALE_POPUP:if(this._skipFurtherPopups){this.startTransition(!0); break}this.checkAndShowSalesPopup();break;case MAINLOBBY_STATE.SUBSCRIPTION_SALE_POPUP_AFTER_NPS:if(this._skipFurtherPopups){this.startTransition(!0);break}GameConfig.SUBSCRIPTION_ENABLED&&"nps"==RSSaleManager.getInstance().getSaleTagActiveForPlayer()?this.checkAndShowSubscriptionSalePopup(RSPLATFORM_SUBSCRIPTION_PLACEMENTS.SUBSCRIPTION_AFTER_NPS,"Sub_ANPS"):this.startTransition(!0);break;case MAINLOBBY_STATE.SWEEPSTAKES_ENTRY_POPUP:if(this._skipFurtherPopups){this.startTransition(!0);break}GameConfig.SWEEPSTAKES_ENABLED? this.checkAndShowSweepstakeEntryPopup(RSPLATFORM_SWEEPSTAKES_POPUP_PLACEMENTS.SWEEPSTAKE_ENTRY):this.startTransition(!0);break;case MAINLOBBY_STATE.VIP_POPUP:if(this._skipFurtherPopups){this.startTransition(!0);break}this.checkAndShowVIPWelcomePopup();break;case MAINLOBBY_STATE.REWARD_REMINDER:if(this._skipFurtherPopups){this.startTransition(!0);break}this.checkAndShowRewardReminderPopup();break;case MAINLOBBY_STATE.SUBSCRIPTION_INTERRUPT_POPUP:if(this._skipFurtherPopups){this.startTransition(!0); break}RSSubscrptionSaleManager.checkAndSetSubscriptionInteruptedShownStatus(this.startTransition.bind(this,!0));break;case MAINLOBBY_STATE.LM_TOOLTIP:!this._skipFurtherPopups&&this.bottomHud&&GlobalVars.isLMToolTipActive&&RSEngine.loginMode!==LOGIN_MODE.GUEST?(RSEngine.popupManager.addPopup(new RSLoyaltyToolKitPopup(this.startTransition.bind(this,!0)),!1,!0,!1),GlobalVars.isLMToolTipActive=!1):this.startTransition(!0);break;case MAINLOBBY_STATE.VIP_TOOLTIP:a=TimeManager.getInstance().getCurrentServerTime(); RSEngine.loginMode!==LOGIN_MODE.GUEST&&!this._skipFurtherPopups&&0<RSVIPManager.getInstance().getVIPUserTier()&&2>=RSVIPManager.getInstance().getVIPUserTier()&&172800<=a-RSGame.getInstance().getUserDataManager().getMe().getVIPTooltipShownTime()?(RSGame.getInstance().getUserDataManager().getMe().setVIPTooltipShownTime(TimeManager.getInstance().getCurrentServerTime()),RSCasinoManager.getCasinoHUD().showUpgradeVIPTooltip(this.startTransition.bind(this,!0))):RSEngine.loginMode!==LOGIN_MODE.GUEST&&!this._skipFurtherPopups&& 0==RSVIPManager.getInstance().getVIPUserTier()&&86400<=a-RSGame.getInstance().getUserDataManager().getMe().getVIPTooltipShownTime()?(RSGame.getInstance().getUserDataManager().getMe().setVIPTooltipShownTime(TimeManager.getInstance().getCurrentServerTime()),RSCasinoManager.getCasinoHUD().showNoStarTooltip(this.startTransition.bind(this,!0))):this.startTransition(!0);break;case MAINLOBBY_STATE.DAILY_CHALLENGE_TOOLTIP:RSEngine.loginMode!==LOGIN_MODE.GUEST&&!this._skipFurtherPopups&&GlobalVars.isDCTooltipActive&& this._initialLoading?(RSGame.getInstance().getGameManager().showDCToolTipPopup(this.startTransition.bind(this,!0)),RSEngine.popupManager.addPopup(RSGame.getInstance().getGameManager()._toolTipPopup,null,null,!1),RSGame.getInstance().getGameManager().setSideMenuVisibility(!0)):this.startTransition(!0);break;case MAINLOBBY_STATE.TOURNAMENT_ANNOUNCEMENT:if(this._skipFurtherPopups){this.startTransition(!0);break}(this._announcementStatus=RSTournamentManager.checkForAnnouncementPopupTriggerStatus(RSTournamentManager.getTournamentSurfacingEnabledStatus()))&& this._initialLoading&&RSEngine.loginMode!=LOGIN_MODE.GUEST&&!this._curtainRaiserTriggered&&(0<RSGame.getInstance().getUserDataManager().getMe().getCurrentDay()||0===RSGame.getInstance().getUserDataManager().getMe().getCurrentDay()&&(RSGame.getInstance().getGameManager().getMachinePlayed()||1<RSGame.getInstance().getUserDataManager().getMe().getCurrentSession()))?RSTournamentManager.showTournamentSurfacing(this.tournamentSurfacingCompleteCallback.bind(this)):this.startTransition(!0);break;case MAINLOBBY_STATE.LOADING_COMPLETE:if(this._initialLoading&& RSGame.getInstance().getGameManager().setMainLobbyLoadedTime(TimeManager.getInstance().getCurrentServerTime()),1<=RSVIPManager.getInstance().getVIPUserTier()&&(RSGame.getInstance().getGameManager()._VIPStarRotationStartStatus||RSGame.getInstance().getGameManager().rotateVIPStar(!0)),RSGame.getInstance().getGameManager().getSSOMainLobbyReloadStatus()&&(RSGame.getInstance().getGameManager().setSSOMainLobbyReloadStatus(!1),RSGame.getInstance().getGameManager().getSSOReloadStatusWithLoadingScreen()&& RSGame.getInstance().getGameManager().setSSOReloadStatusWithLoadingScreen(!1)),"undefined"===typeof SideMenuController||GlobalVars.isjackpotLoaded||RSGame.getInstance().getGameManager().setSideMenuVisibility(!0),null==RSGame.getInstance().getUserDataManager().getMe().getCustomInstallShownDate()&&0==RSGame.getInstance().getUserDataManager().getMe().getCurrentDay()&&("web_mobile"==GlobalVars.analyticsPlatformName||"web_pwa"==GlobalVars.analyticsPlatformName)&&1<RSGame.getInstance().getUserDataManager().getMe().getCurrentSession()|| RSGame.getInstance().getUserDataManager().getMe().getCustomInstallShownDate()!=RSGame.getInstance().getUserDataManager().getMe().getCurrentDay()&&this._gameManager.getMachinePlayed())RSGame.getInstance().getUserDataManager().getMe().setCustomInstallShownDate(),RSGame.getInstance().getRSPWAManager().showCustomInstall()}},tournamentSurfacingCompleteCallback:function(a){this._skipFurtherPopups=a;this.startTransition(!0)},onSweepstakeSurfacingCompleted:function(){this._skipFurtherPopups=!0;RSGame.getInstance().getUserDataManager().getMe().setSweepstakesSurfaceShownStatus(); this.bottomHud._loyaltyPreviewWidget.setSweepstakesOnPause();this.startTransition(!0)},onForcedDQPopupClosed:function(a){"load_machine"==a&&(this._skipFurtherPopups=!0);this.startTransition(!0)},initiateLMandVIPSurfacingScreens:function(){var a=!1;!RSEngine.dataManager.getMe().getVIPSurfacingShown()&&RSEngine.dataManager.getMe().getVIPTriggerStatus()&&(a=!0);RSEngine.loginMode!==LOGIN_MODE.GUEST&&!GlobalVars.isSurfacingActive&&!RSEngine.dataManager.getMe().getLoyaltyMallEligiblePopupShownStatus()&& 2<=RSEngine.dataManager.getMe().getCurrentDay()&&GameConfig.LM_AND_VIP_SURFACING&&parseInt(RSGame.getInstance().getGameData().getDefaultValues().isLoyaltyMallEnabled)?(GlobalVars.isLMToolTipActive=!0,RSGame.getInstance().getGameManager().showIntroScreenForLMAndVIP(a,!0),RSGame.getInstance().getGameManager().getCurtainRaiserScreen()&&RSGame.getInstance().getGameManager().playIntroScreen(this._onLoyaltyEligiblePopupClosed.bind(this))):RSEngine.loginMode!==LOGIN_MODE.GUEST&&!GlobalVars.isSurfacingActive&& GameConfig.LM_AND_VIP_SURFACING&&parseInt(RSGame.getInstance().getGameData().getDefaultValues().isLoyaltyMallEnabled)&&!RSEngine.dataManager.getMe().getLoyaltyMallEligiblePopupShownStatus()&&RSEngine.dataManager.getMe().getLMTriggerStatus()?(GlobalVars.isLMToolTipActive=!0,RSGame.getInstance().getGameManager().showIntroScreenForLMAndVIP(a,!RSEngine.dataManager.getMe().getLoyaltyMallEligiblePopupShownStatus()),RSGame.getInstance().getGameManager().getCurtainRaiserScreen()&&RSGame.getInstance().getGameManager().playIntroScreen(this._onLoyaltyEligiblePopupClosed.bind(this))): RSEngine.loginMode!==LOGIN_MODE.GUEST&&!GlobalVars.isSurfacingActive&&GameConfig.LM_AND_VIP_SURFACING&&!RSEngine.dataManager.getMe().getVIPSurfacingShown()&&RSEngine.dataManager.getMe().getVIPTriggerStatus()?(RSGame.getInstance().getGameManager().showIntroScreenForLMAndVIP(!0,!1),RSGame.getInstance().getGameManager().getCurtainRaiserScreen()&&RSGame.getInstance().getGameManager().playIntroScreen(this._onVIPButtonClicked.bind(this,!0))):this.startTransition(!0)},_onLoyaltyEligiblePopupClosed:function(){this.bottomHud&& GlobalVars.isLMToolTipActive?(RSEngine.popupManager.addPopup(new RSLoyaltyToolKitPopup(this._onToolTipClosed.bind(this)),!1,!0,!1),GlobalVars.isLMToolTipActive=!1):this.startTransition(!0)},_onToolTipClosed:function(){this.startTransition(!0)},isEmailVerified:function(a){a?(this.isEmailVerifiedCheckForSkippingTransition=!0,a=[{name:RSGame.getInstance().getAssetPath("LoginSuccessPopup"),count:1}],RSEngine.popupManager.addPopup(new RSSocialLoginRewardPopup(this.socialLoginRewardPopupCallback.bind(this), RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),a))):this.isEmailVerifiedCheckForSkippingTransition||this.startTransition(!0)},socialLoginRewardPopupCallback:function(){this.bottomHud.setFBRewardBanner();this.startTransition(!0)},checkAndShowLoginSuccessPopup:function(){if(RSGame.getInstance().getUserDataManager().getMe().getFirstSignIn()&&!RSGame.getInstance().getUserDataManager().getMe().getLoginRewardStatus())if(RSEngine.loginMode===LOGIN_MODE.EMAIL)if(RSSSOManager.getLoginRewardPopupStatus()){var a= [{name:RSGame.getInstance().getAssetPath("LoginSuccessPopup"),count:1}];RSEngine.popupManager.addPopup(new LoginSuccessPopup(this.startTransition.bind(this,!0),RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),a))}else RSEngine.dataManager._me.setWelcomeBonusAwarded(!0),RSAnalyticsManager.getInstance().trackGuestSync(),this.startTransition(!0);else RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK?(a=[{name:RSGame.getInstance().getAssetPath("LoginSuccessPopup"),count:1}],RSEngine.popupManager.addPopup(new LoginSuccessPopup(this.startTransition.bind(this, !0),RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),a))):this.startTransition(!0);else this.startTransition(!0)},checkAndShowSalesPopup:function(){(this._initialLoading||RSSaleManager.getInstance().getSaleDataUpdatedStatus())&&RSEngine.loginMode!=LOGIN_MODE.GUEST&&RSSaleManager.getInstance().getSaleActiveStatus()&&RSGame.getInstance().getUserDataManager().getMe().getWelcomeBonusAwarded()&&!RSGame.getInstance().getUserDataManager().getMe().getFirstSignIn()&&GlobalVars.isPurchaseEnabled&& !this._curtainRaiserTriggered?(PurchaseFlowManager.getInstance().setShowPurchaseCart(!1),RSSaleManager.getInstance().getSaleDataUpdatedStatus()&&RSSaleManager.getInstance().resetSaleDataUpdateStatus(),RSSaleManager.getInstance().showSalePopup(!0,this.startTransition.bind(this,!0))):this.startTransition(!0)},checkAndShowURLNotificationPopups:function(){this._initialLoading?UrlNotificationManager.getInstance().showPopups(this.startTransition.bind(this,!0)):this.startTransition(!0)},checkAndShowVIPWelcomePopup:function(){RSEngine.loginMode!= LOGIN_MODE.GUEST&&parseInt(RSGame.getInstance().getUserDataManager().getMe().getVIPTierUnlockPopupShown())<parseInt(RSVIPManager.getInstance().getVIPUserTier())&&RSEngine.dataManager.getMe().getVIPSurfacingShown()&&!RSEngine.dataManager.getMe().getVIPTriggerStatus()?RSEngine.popupManager.addPopup(new VIPWelcomePopup(parseInt(RSVIPManager.getInstance().getVIPUserTier()),!1,!0,this.startTransition.bind(this,!0))):this.startTransition(!0)},checkAndShowRewardReminderPopup:function(){RSEngine.loginMode== LOGIN_MODE.GUEST&&!this._isSSOReInitSession&&RSGame.getInstance().getGameManager().getGiftAvailableForGuestUsers()?(RSGame.getInstance().getGameManager().setGiftAvailableForGuestUsers(!1),RSEngine.popupManager.addPopup(new RewardReminderPopup(this.startTransition.bind(this,!0)))):this.startTransition(!0)},onBottomHudLoadComplete:function(){this._isBottomHudLoadingComplete=!0},addBottomHUDToScreen:function(){this._isBottomHudLoadingComplete?(this.addChild(this.bottomHud),this.bottomHud.disableAllButtons()): setTimeout(this.addBottomHUDToScreen.bind(this),1E3)},addAnimationToArray:function(a,b){a.stopAnimation();a.setFrame(0);this._buttonAnimArray.push(a)},setDefaultProperites:function(a,b){this._allObjectsArray.push(a);this._initialLoading&&(a.setVisible(!1),a.setOpacity(b?b:0))},startLobbyAnimations:function(){this._curtainRaiserTriggered?this._gameManager.setSideMenuVisibility(!1):this._gameManager.setSideMenuVisibility(!0);for(var a=0;a<this._buttonAnimArray.length;a++)this.startButtonAnim(this._buttonAnimArray[a]); for(a in this._allObjectsArray)this._allObjectsArray[a].setVisible(!0),this._allObjectsArray[a].setOpacity(255);this.bottomHud._loyaltyPreviewWidget.setVisible(!0);this._mainBg.setVisible(!0);this._mainBg.setOpacity(255);this.addAnimationsToButton(this._slotButton,this._slotButtonAnimation,0.33);this.addAnimationsToButton(this._pokerButton,this._pokerButtonAnimation,0.33);this.addAnimationsToButton(this._kenoBingoButton,this._kenoBingoButtonAnimation,0.33);this.addAnimationsToButton(this._favoritesButton, this._favoritesButtonAnimation,0.33);this.addAnimationsToButton(this._tableGamesButton,this._tableGamesButtonAnimation,0.33);GlobalVars.mainLobbyInitialized=!0},startButtonAnim:function(a){var b=3+Math.round(15*Math.random());a.scheduleFunctionOnce(this.PlayButtonAnimation.bind(this,a),b)},PlayButtonAnimation:function(a){a.playAnimation(1,0.33,this.startButtonAnim.bind(this,a))},addAnimationsToButton:function(a,b,c){a instanceof Object&&b instanceof Object&&a.addAnimation(b,c);b.stopAnimation()}, onButtonClicked:function(a){if(!1!=GlobalVars.mainLobbyInitialized&&!GlobalVars.isMachineLoadingInProgress)switch(a){case "SlotsButton":this.startLobbyTransition();RSGameScreenManager.getInstance().loadScreen(RSGameScreens.SlotsLobby);SlotsLobbyWidgetManager.getInstance().setSlotsMachineLoaded(!1);this._gameManager.setGameType(RSGameTypes.Slots);break;case "KenoButton":this.startLobbyTransition();this._gameManager.setGameType(RSGameTypes.Keno);RSGameScreenManager.getInstance().loadScreen(RSGameScreens.KenoBingoLobby); break;case "BlackJackButton":RSGameScreenManager.getInstance().loadScreen(RSGameScreens.BlackJackLobby);this._gameManager.setGameType(RSGameTypes.Blackjack);this.startLobbyTransition();break;case "VideoPokerButton":RSGameScreenManager.getInstance().loadScreen(RSGameScreens.PokerLobby);this._gameManager.setGameType(RSGameTypes.Poker);this.startLobbyTransition();break;case "RouletteButton":this._gameManager.setLocationForMachineOpenPopup(this._rouletteButton.getX(),this._rouletteButton.getY());this._gameManager.setGameType(RSGameTypes.Roulette); 1==RSGame.getInstance().getGameData().getDefaultValues().rouletteEnabled&&RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Roulette,"R_LR","MachineUnlockPopup");break;case "TableGamesButton":RSGameScreenManager.getInstance().loadScreen(RSGameScreens.TableGamesLobby);RSGame.getInstance().getGameManager().setGameType(RSGameTypes.Blackjack);this.startLobbyTransition();break;case "FavoritesButton":RSFavoritesLobbyWidgetManager.getInstance().InitializeDefaultScrollerParams({duration:2,targetPosition:0, noOfCellsToMove:4}),RSFavoritesLobbyWidgetManager.getInstance().setFavMachineLoaded(!1),RSGameScreenManager.getInstance().loadScreen(RSGameScreens.FavoritesLobby),RSGame.getInstance().getGameManager().setGameType(RSGameTypes.Slots),this.startLobbyTransition()}},getCasinoInterface:function(){return new CustomCasinoInterface},getExternalGameInterface:function(){return new CustomExternalGameInterface},onScreenFadeInComplete:function(){RSGame.getInstance().getGameManager().setSideMenuVisibility(!0);this._topHud.setVisible(!0); this._setAllTags();this.startMusic();this.addBottomHUDToScreen();this.bottomHud.setZOrder(RSCasinoManager.getCasinoHUD().getZOrder()+1);this.bottomHud.setVisible(!0);this.bottomHud.enableAllButtons();GameConfig.JACKPOT_LOUNGE_ENABLE&&this.bottomHud._btnJackpot&&(this.bottomHud._btnJackpot.showButton(),this.bottomHud._btnJackpot.enableButton(!0));RSCasinoManager.getCasinoHUD()&&RSCasinoManager.getCasinoHUD().enableAllButtons();RSPlatformSDKManager.getInstance().setUserAttributeMostPlayedGame(this._gameManager.getMostPlayedMachine().machineDisplayName); RSPlatformSDKManager.getInstance().setUserAttributeJoiningDate(RSEngine.dataManager.getMe().getJoiningDate());RSPlatformSDKManager.getInstance().setUserAttributePowerUp(RSGame.getInstance().getGameManager().getPowerUpTotalCount());RSPlatformSDKManager.getInstance().setUserAttributeLastLogin(parseInt(RSGame.getInstance().getUserDataManager().getMe().getLastLogin()));this._initialLoading?(RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.loadingCompleteIdle),GameConfig.QUEST_ENABLED&&(RSEngine.dataManager.getMe().getDCinfoPopupShownStatus()&& RSQuestManager.getInstance().setQuestEnabledStatus(),RSEventManager.getInstance().dispatchEvent(RSGeneralQuestEventKeys.DAILY_LOGIN_ACTION,1))):GameConfig.SWEEPSTAKES_ENABLED&&RSGame.getInstance().getUserDataManager().getMe().getSweepstakesSurfaceShownStatus()&&!RSSweepstakesManager.checkForRemainingTimeValidity()&&RSSweepstakesManager.getSweepstakesData().rewardTime<TimeManager.getInstance().getCurrentServerTime()&&RSSweepstakesManager.fetchSweepstakesStatus("winnerAnnouncement",null,!0);!this._curtainRaiserTriggered&& this._gameManager.forceTriggerDailyQuestPopup&&this._initialLoading&&GlobalVars.isJLLoadingInProgress&&(GlobalVars.isJLLoadingInProgress=!1);this.addChild(this._muteBtnWidget);this.startTransition(!0)},startMusic:function(){RSEngine.audioManager.areEffectsActive()||RSEngine.audioManager.stopAllEffects();if(!RSEngine.audioManager.isMusicPlaying())RSGame.getInstance().getGameManager().playMusicWithFadeIn(RSGame.getInstance().getAssetPath("MainLobbyBGM"),!0,this.getDisplayObject());else if(this._initialLoading&& (this._ssoMainlobyReloadwithLoadingScreen||!RSGame.getInstance().getGameManager().getSSOMainLobbyReloadStatus())){RSEngine.audioManager.stopMusic();RSEngine.audioManager.playMusic(RSGame.getInstance().getAssetPath("MainLobbyInitialBGM"),!1);var a=Math.round(1E3*RSEngine.audioManager.getDurationOfCurrentMusic());RSGame.getInstance().getGameManager().startMainLobbyMusicTimer(a)}},onRewardScreenComplete:function(){this._leaderboardRewardActive=!1;RSGameScreenManager.getInstance().getCurrentScreen()!= RSGameScreens.MainLobby||RSLeaderboardManager.onLeaderBoardClickStatus()||this.startTransition(!0);RSEventManager.getInstance().removeListenersForEvent("onRankUpRewarded")},_onCurtainRaiserScreenAnimComplete:function(a){SideMenuController.getInstance().enableAllButtons();this._skipFurtherPopups=a;this.startTransition(!0)},_onJLCurtainRaiserComplete:function(a){this._skipFurtherPopups=a;this.startTransition(!0)},_onVIPButtonClicked:function(){RSGame.getInstance().getGameManager().getIsVIPTakeMeButtonClicked()&& (this._skipFurtherPopups=!0,RSGame.getInstance().getGameManager().setIsVIPTakeMeButtonClicked(!1));this.startTransition(!0)},removeWidget:function(a){this._didCollectDailyBonus=!0;this.removeChild(this._dailyBonusWidgetController.getView());RSEngine.audioManager.stopAllEffects();GameConfig.QUEST_ENABLED&&RSQuestManager.getInstance()instanceof Object&&RSQuestManager.getInstance().getIsQuestManagerActive()&&RSQuestManager.getInstance().questLevelEnabled()&&RSQuestManager.getInstance().getQuestEnabledStatus()&& 2==this._dailyBonusWidgetController.getDailyBonusMultiplier()&&(RSAnalyticsManager.getInstance().trackPlayerAction("daily_challenge","mega_quest","collect","","day"+RSMegaChallengeManager.getInstance().getQuestDay()),RSMegaChallengeManager.getInstance().getMegaChallengeStatus()&&RSMegaChallengeManager.getInstance().setMegaChallengeStatus(DailyChallengeObjectiveStatus.RewardCollected));GameConfig.HOUSE_ADS_ENABLED&&RSGame.getInstance().getPlatformEventManager().getEventDataForParameter(RSPlatformEventTypeKeys.BONUS_COLLECT, RSPlatformBonusTypeKeys.DAILY)&&RSGame.getInstance().getPlatformEventManager().getRewardedAdCapCapCount()>=RSGame.getInstance().getPlatformEventManager().getRewardedAdsForTheDay()?RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.BONUS_COLLECT,RSPlatformBonusTypeKeys.DAILY):this.startTransition(!0)},_setAllTags:function(){this._slotNewTag&&this._slotNewTag.setVisible(this._isThereNewMachine(RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Slots)));this._pokerNewTag&& this._pokerNewTag.setVisible(this._isThereNewMachine(RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Poker)));this._rouletteNewTag&&this._rouletteNewTag.setVisible(this._isThereNewMachine(RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Roulette)));this._blackjackNewTag&&this._blackjackNewTag.setVisible(this._isThereNewMachine(RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Blackjack)));if(this._kenobingoNewTag){var a=this._isThereNewMachine(RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Keno)); (this._isThereNewMachine(RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Bingo))||a)&&this._kenobingoNewTag.setVisible(!0)}this._allUnlockedTag&&this._allUnlockedTag.setVisible(UrlNotificationManager.getInstance().getAllMachineUnlockStatus());this._favoritesNewTag&&1==parseInt(RSGame.getInstance().getGameData().getDefaultValues().showFavoriteNewTag)&&this._favoritesNewTag.setVisible(!0)},_onHourlyBonuswidgetActive:function(){RSPlatformSDKManager.getInstance().setUserAttributeHourlyBonusReady(!0)}, _onHourlyBonusCollect:function(a){RSPlatformSDKManager.getInstance().setUserAttributeHourlyBonusReady(!1)},_isThereNewMachine:function(a){for(var b in a)if(parseInt(a[b].isNew))return!0;return!1},checkAndShowSubscriptionSalePopup:function(a,b){this._initialLoading&&GlobalVars.isPurchaseEnabled&&RSSaleManager.getInstance().getSubscriptionSaleStatus()&&RSSubscrptionSaleManager.getSubscriptionSalePopupTriggerStatusForEvent(a)&&!GameConfig.SKIP_SUBSCRIPTION_SALE_POPUP&&null!=RSSaleManager.getInstance()._allSalesData.subscription.assets[0]? RSSubscrptionSaleManager.showSubscriptionSalePopup("MainLobby",this.startTransition.bind(this,!0),b):this.startTransition(!0)},startLobbyTransition:function(){for(var a in this._lobbyButtonArray){var b=this._lobbyButtonArray[a];b.setTouchEnabled(!1);b.getButtonAnimationForIdleState().setVisible(!0)}},animationCompleted:function(a){cc.log("bingo animation completed")},onConnection:function(a){},onConnectionLost:function(a){},onLogin:function(a){},onLoginError:function(a){},actionOnComplete:function(a){}, actionOnUpdate:function(a,b){},checkAndShowSweepstakeEntryPopup:function(a){this._initialLoading&&RSEngine.loginMode!=LOGIN_MODE.GUEST&&!this.skipSweepstakeEntryPopup&&RSSweepstakesManager.getSweepstakesEntryPopupTriggerStatusForEvent(a)?RSSweepstakesManager.showJackpotSweepstakesEntryPopup(!1,this.startTransition.bind(this,!0),!0,"mainLobbyAutoTrigger"):this.startTransition(!0)},unload:function(){this._super.unload.call(this)}});var TabType={FEATURED:0,ALLSLOTS:1,FAVOURITES:2,VIP:3},FeaturedGamesParams={iconPath:"res/SlotResources/CasinoSubLobby/LargeIcons/",horizontalPadding:0,verticalPadding:20,scrollDirection:0,scrollLevel:1,scrollerMargin:{left:10,top:0,right:0,bottom:0}},AllSlotsParams={iconPath:"res/SlotResources/CasinoSubLobby/icons/",horizontalPadding:0,verticalPadding:16,scrollDirection:0,scrollLevel:2,Y_offSetForBigIcon:0,autoScrollParams:{duration:2,targetPosition:1,noOfCellsToMove:20},scrollerMargin:{left:10, top:0,right:0,bottom:0}},FavouritesGameParams={iconPath:"res/SlotResources/CasinoSubLobby/LargeIcons/",horizontalPadding:0,verticalPadding:20,scrollDirection:0,scrollLevel:1,TotalCount:"8",scrollerMargin:{left:10,top:0,right:0,bottom:0}},VIPGamesParams={iconPath:"res/SlotResources/CasinoSubLobby/LargeIcons/",horizontalPadding:0,verticalPadding:0,scrollDirection:0,scrollLevel:1,scrollerMargin:{left:30,top:0,right:30,bottom:0}},LobbyScrollerParams={scrollBarPath:"res/SlotResources/CasinoSubLobby/"}, CasinoSlotsLobbyWidget=RSDisplayObject.extend({init:function(a,b){this._assetList=a;this._favSlider=b;var c=new RSRect(0,0,a.widget.w,a.widget.h);this._super.init.call(this,c);RSGame.getInstance().getGameManager().setGameType(RSGameTypes.Slots);SlotsLobbyWidgetManager.getInstance().setSlotMachineData();this._vipWidget=this._favouriteWidget=this._allSlotsWidget=this._featuredWidget=this._vipButton=this._featuredButton=this._lobbyButton=this._favButton=null;this._isFavouriteMachineEnabled=!1;this._gameAnalyticsId= RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName();this.slotsLobbyTabArray=[];this.slotsLobbyWidgetArray=[];this.assetLoadedArray=[];this.loadContent()},loadContent:function(){this.loadLayout(RSGame.getInstance().getAssetPath("CasinoSlotsLobbyWidget"),1)},onVIPTierUp:function(a){this._vipSlotsWidget&&this._vipSlotsWidget.reInitializeVIPMachinesOnTierUpdate();this._allSlotsWidget&&this._allSlotsWidget.reInitializeVIPMachinesOnTierUpdate()},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this, a,b,c);switch(c.name){case "Featured":this._featuredTab=a;break;case "AllSlots":this._allSlotsTab=a;break;case "Favorites":this._favouritesTab=a;break;case "Vip":this._VIPTab=a}},createCustomObject:function(a,b){switch(b.name){case "FeaturedWidgetScroller":var c={};c.widget=b;c.iconPath=FeaturedGamesParams.iconPath;c.verticalScrollPadding=FeaturedGamesParams.verticalPadding;c.horizontalScrollPadding=FeaturedGamesParams.horizontalPadding;c.scrollDirection=FeaturedGamesParams.scrollDirection;c.scrollLevelCount= FeaturedGamesParams.scrollLevel;c.scrollerMargin=FeaturedGamesParams.scrollerMargin;c.scrollBarPath=LobbyScrollerParams.scrollBarPath;c.sliderRect=this._assetList.sliderRect;c.fonts={FONT_ICON:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold"),FONT_COLOR:{r:255,g:255,b:255,a:255}};this._slotsFeaturedWidget=new RSSlotsLobbyFeatured(c,this);this.addChild(this._slotsFeaturedWidget);this._slotsFeaturedWidget.setVisible(!1);this._slotsFeaturedWidget.setTouchEnabled(!1);break; case "SlotsWidgetScroller":c={};c.widget=b;c.smallIconPath=AllSlotsParams.iconPath;c.largeIconPath=FeaturedGamesParams.iconPath;c.verticalScrollPadding=AllSlotsParams.verticalPadding;c.horizontalScrollPadding=AllSlotsParams.horizontalPadding;c.scrollDirection=AllSlotsParams.scrollDirection;c.scrollLevelCount=AllSlotsParams.scrollLevel;c.scrollerMargin=AllSlotsParams.scrollerMargin;c.autoScrollParams=AllSlotsParams.autoScrollParams;c.Y_offSetForBigIcon=AllSlotsParams.Y_offSetForBigIcon;c.scrollBarPath= LobbyScrollerParams.scrollBarPath;c.sliderRect=this._assetList.sliderRect;c.fonts={FONT_ICON:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold"),FONT_COLOR:{r:255,g:255,b:255,a:255},JL_FONT_ICON:RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),JL_FONT_COLOR:{r:255,g:255,b:255,a:255}};this._allSlotsWidget=new RSSlotsLobbyAllSlots(c,this,!0);this.addChild(this._allSlotsWidget);this._allSlotsWidget.setVisible(!0);this._allSlotsWidget.setTouchEnabled(!1); break;case "FavoritesWidgetScroller":c={};c.widget=b;c.iconPath=FavouritesGameParams.iconPath;c.verticalScrollPadding=FavouritesGameParams.verticalPadding;c.horizontalScrollPadding=FavouritesGameParams.horizontalPadding;c.scrollDirection=FavouritesGameParams.scrollDirection;c.scrollLevelCount=FavouritesGameParams.scrollLevel;c.scrollerMargin=FavouritesGameParams.scrollerMargin;c.scrollBarPath=LobbyScrollerParams.scrollBarPath;c.sliderRect=this._assetList.sliderRect;c.fonts={FONT_ICON:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large", "Semibold"),FONT_COLOR:{r:255,g:255,b:255,a:255}};RSFavoritesLobbyWidgetManager.getInstance().checkIsFavMachineLoaded()||RSFavoritesLobbyWidgetManager.getInstance().InitializeDefaultScrollerParams({duration:2,targetPosition:0,noOfCellsToMove:4});this._slotsFavouriteWidget=new RSSlotsLobbyFavourites(c,this,FavouritesGameParams.TotalCount,this._favSlider);this._slotsFavouriteWidget.setPosition(b.x,b.y);this.addChild(this._slotsFavouriteWidget);this._slotsFavouriteWidget.setVisible(!1);this._slotsFavouriteWidget.setTouchEnabled(!1); break;case "VIPWidgetScroller":c={},c.widget=b,c.iconPath=VIPGamesParams.iconPath,c.verticalScrollPadding=VIPGamesParams.verticalPadding,c.horizontalScrollPadding=VIPGamesParams.horizontalPadding,c.scrollDirection=VIPGamesParams.scrollDirection,c.scrollLevelCount=VIPGamesParams.scrollLevel,c.scrollerMargin=VIPGamesParams.scrollerMargin,c.scrollBarPath=LobbyScrollerParams.scrollBarPath,c.sliderRect=this._assetList.sliderRect,c.fonts={FONT_ICON:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large", "Semibold"),FONT_COLOR:{r:255,g:255,b:255,a:255}},this._vipSlotsWidget=new RSSlotsLobbyVIP(c,this),this.addChild(this._vipSlotsWidget),this._vipSlotsWidget.setVisible(!1),this._vipSlotsWidget.setTouchEnabled(!1)}this._super.createCustomObject(a,b)},onAssetLoadCompleted:function(a){this.assetLoadedArray.push(a);5==this.assetLoadedArray.length&&this._allSlotsWidget&&this._allSlotsWidget.startAutoScroll()},onFeaturedIconClicked:function(a,b,c){},onAllSlotsIconClicked:function(a,b,c){},onFavouritesIconClicked:function(a, b,c){},onVIPIconClicked:function(a,b,c){},getName:function(){return"SlotsLobbyWidget"},setCustomScrollerForLobbyWidget:function(a,b){switch(a){case "featured":return this._slotsFeaturedWidget.setCustomSlider(b);case "slots":return this._allSlotsWidget.setCustomSlider(b);case "favourites":return this._slotsFavouriteWidget.setCustomSlider(b);case "vip":return this._vipSlotsWidget.setCustomSlider(b)}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.slotsLobbyTabArray.push(this._featuredTab); this.slotsLobbyTabArray.push(this._allSlotsTab);this.slotsLobbyTabArray.push(this._favouritesTab);this.slotsLobbyTabArray.push(this._VIPTab);this.slotsLobbyWidgetArray.push(this._slotsFeaturedWidget);this.slotsLobbyWidgetArray.push(this._allSlotsWidget);this.slotsLobbyWidgetArray.push(this._slotsFavouriteWidget);this.slotsLobbyWidgetArray.push(this._vipSlotsWidget);this.slotsLobbyTabSelected(GlobalVars.slotsLobbySelectedTab);this.onAssetLoadCompleted("SLOTSLOBBYWIDGET");RSEventManager.getInstance().addEventListener(RSVIPTierUpEvent, this,this.onVIPTierUp.bind(this));!GlobalVars.isSurfacingActive&&GameConfig.JL_SURFACING&&RSEngine.dataManager.getMe().getJLTriggerStatus()&&!RSEngine.dataManager.getMe().getJLSurfacingShown()&&GameConfig.JACKPOT_LOUNGE_ENABLE&&!RSLeaderboard.getRankUpTriggerStatus()&&RSGame.getInstance().getLevelManager().getCurrentLevel()>=GameConfig.JACKPOT_LOUNGE_LEVEL&&(GameConfig.SWEEPSTAKES_ENABLED&&!RSGame.getInstance().getUserDataManager().getMe().getSweepstakesSurfaceShownStatus()&&RSGame.getInstance().getGameVariable().getSweepstakeEnabledStatus()&& !RSSweepstakesManager.getCoolDownTimeEnableStatus()||RSGame.getInstance().getGameManager().showIntroScreenForJL())},slotsLobbyTabSelected:function(a){for(var b=0;b<this.slotsLobbyTabArray.length;b++)b==a?(this.slotsLobbyTabArray[b].setTouchEnabled(!1),this.slotsLobbyWidgetArray[b].setVisible(!0),this.slotsLobbyWidgetArray[b].setTouchEnabled(!0)):(this.slotsLobbyTabArray[b].setTouchEnabled(!0),this.slotsLobbyWidgetArray[b].setVisible(!1),this.slotsLobbyWidgetArray[b].setTouchEnabled(!1))},onButtonClicked:function(a){switch(a){case "Featured":this.slotsLobbyTabSelected(TabType.FEATURED); break;case "AllSlots":this.slotsLobbyTabSelected(TabType.ALLSLOTS);break;case "Favorites":this._slotsFavouriteWidget.removeFavMachine();RSAnalyticsManager.getInstance().trackLobbyEntry("slots_favorites","","open_from_slots_lobby","");this.slotsLobbyTabSelected(TabType.FAVOURITES);break;case "Vip":this.slotsLobbyTabSelected(TabType.VIP)}},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){},handleButtonClick:function(a,b){this._super.handleButtonClick.call(this, a,b)},unload:function(){this.assetLoadedArray=[];SlotsLobbyWidgetManager.getInstance().unloadSlotsLobby();RSEventManager.getInstance().removeEventListenersIn(this);this._super.unload.call(this)}});var CasinoSlotsLobby=RSCasinoScreen.extend({init:function(){this._addOnsArray=[];this.sliderRect=null;this._super.init.call(this)},loadContent:function(){JackpotLoungeDataHandler.getInstance().initialize();this.layoutScreen(RSGame.getInstance().getAssetPath("CasinoSlotsLobby"),1);this._super.loadContent.call(this)},playBackgroundMusic:function(){RSEngine.audioManager.isMusicPlaying()||RSGame.getInstance().getGameManager().playMusicWithFadeIn(RSGame.getInstance().getAssetPath("MainLobbyBGM"),!0,this.getDisplayObject())}, onObjectCreated:function(a,b,c){switch(c.name){case "BingoKenoNavigation":case "TableGamesNavigation":case "BtnLeft":case "BtnRight":case "BottomBg":this.removeChild(a),this._addOnsArray.push(a)}this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a,b){switch(b.name){case "Slider":this.sliderRect=b;break;case "SlotsLobbyWidget":this.slotsLobbyWidget=b}this._super.createCustomObject(a,b)},onLayoutCompleted:function(){var a={};a.widget=this.slotsLobbyWidget;a.sliderRect=this.sliderRect; this._casinoSlotsLobbyWidget=new CasinoSlotsLobbyWidget(a,this._addFavSlider.bind(this));this.addChild(this._casinoSlotsLobbyWidget);for(var b in this._addOnsArray)this.addChild(this._addOnsArray[b]);this.playBackgroundMusic();RSCasinoManager.setCasinoHUD(this._getCasinoHUD());RSCasinoManager.getCasinoHUD().setPrimaryCurrency(RSCasinoManager.getPrimaryCurrency());a=this.convertToNodeSpace(this.sliderRect.x,this.sliderRect.y);this._sliderFeatured=new RSControlSlider("res/SlotResources/CasinoSubLobby/ScrollBar.png", cc.size(485,34),"res/SlotResources/CasinoSubLobby/ScrollRound.png",cc.size(52,52));this.addSliders(a,this._sliderFeatured,"featured");this._sliderSlots=new RSControlSlider("res/SlotResources/CasinoSubLobby/ScrollBar.png",cc.size(485,34),"res/SlotResources/CasinoSubLobby/ScrollRound.png",cc.size(52,52));this.addSliders(a,this._sliderSlots,"slots");this._sliderFavourites=new RSControlSlider("res/SlotResources/CasinoSubLobby/ScrollBar.png",cc.size(485,34),"res/SlotResources/CasinoSubLobby/ScrollRound.png", cc.size(52,52));this.addSliders(a,this._sliderFavourites,"favourites");this._sliderVIP=new RSControlSlider("res/SlotResources/CasinoSubLobby/ScrollBar.png",cc.size(485,34),"res/SlotResources/CasinoSubLobby/ScrollRound.png",cc.size(52,52));this.addSliders(a,this._sliderVIP,"vip");RSGame.getInstance().getGameManager().showJackpotLoungeWelcomePopup();this._super.onLayoutCompleted.call(this)},_addFavSlider:function(){this.removeChild(this._sliderFavourites);var a=this.convertToNodeSpace(this.sliderRect.x, this.sliderRect.y);this._sliderFavourites=new RSControlSlider("res/SlotResources/CasinoSubLobby/ScrollBar.png",cc.size(485,34),"res/SlotResources/CasinoSubLobby/ScrollRound.png",cc.size(52,52));this.addSliders(a,this._sliderFavourites,"favourites")},addSliders:function(a,b,c){b.setPosition(a.getX(),a.getY());this.addChild(b);this._casinoSlotsLobbyWidget&&this._casinoSlotsLobbyWidget.setCustomScrollerForLobbyWidget(c,b)},onButtonClicked:function(a){switch(a){case "BtnLeft":case "TableGamesNavigation":RSGame.getInstance().getGameManager().platformSDKScreenNavigation("BLACKJACK_LOBBY"); break;case "BtnRight":case "BingoKenoNavigation":RSGame.getInstance().getGameManager().platformSDKScreenNavigation("KENO_LOBBY")}},_getCasinoHUD:function(){return new TopHUD(RSGame.getInstance().getAssetPath("TopHud"))},unload:function(){JackpotLoungeDataHandler.getInstance().clearJackpotTimer();this._casinoSlotsLobbyWidget.unload();this._super.unload.call(this)}});var KenoSubLobby=RSCasinoScreen.extend({init:function(){RSGame.getInstance().getGameManager().getGameType()!=RSGameTypes.Keno&&RSGame.getInstance().getGameManager().getGameType()!=RSGameTypes.Bingo&&RSGame.getInstance().getGameManager().setGameType(RSGameTypes.Keno);this.outerGlow=this.sliderRect=this._machineConfig=this._scrollerRect=this._scrollerRightBtn=this._scrollerLeftBtn=this._iconGap=this._iconHolder=null;this._bottomBGItems=[];this._JLMachineHolderList=[];this._machineLoaded=!1;this._super.init.call(this)}, loadContent:function(){this.layoutScreen(RSGame.getInstance().getAssetPath("KenoSubLobby"),1);this.netUserBalance=null;this.netUserBalance=JSON.parse(JSON.stringify({coins:RSCasinoManager.getPrimaryCurrency()}));this._super.loadContent.call(this)},playBackgroundMusic:function(){RSEngine.audioManager.isMusicPlaying()||RSGame.getInstance().getGameManager().playMusicWithFadeIn(RSGame.getInstance().getAssetPath("MainLobbyBGM"),!0,this.getDisplayObject())},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this, a,b,c);switch(c.name){case "ArrowLeft":this._scrollerLeftBtn=a;this._scrollerLeftBtn.setVisible(!1);break;case "ArrowRight":this._scrollerRightBtn=a;this._scrollerRightBtn.setVisible(!1);break;case "BgRect":this.removeChild(a);a=new RSImageObject;a.setAnchorPoint(0,0);a.setImageFromUrl(RSGame.getInstance().getAssetPath("LobbyBg"),0,0,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(a);break;case "OuterGlow":this.outerGlow=a;this.removeChild(a);break;case "BtnLeft":case "SlotsNavigation":case "BtnRight":case "FavoritesNavigation":case "KenoBottomBg":this.removeChild(a), this._bottomBGItems.push(a)}},createCustomObject:function(a,b){switch(b.name){case "IconGap":this._iconGap=b;break;case "IconHolder":this._iconHolder=b;break;case "ClippingRect":this._scrollerRect=new RSRect(b.x,b.y,b.w,b.h);break;case "Slider":this.sliderRect=b}},_coinBalanceCallBack:function(a){RSEngine.screenManager.removeOverlay();RSGame.getInstance().getLosingStreakManager().calculateLosingStreak(RSCasinoManager.getPrimaryCurrency()-parseInt(this.netUserBalance.coins));this.netUserBalance=null; this.netUserBalance=JSON.parse(JSON.stringify({coins:RSCasinoManager.getPrimaryCurrency()}));"failed"==a&&RSNetworkManager.getInstance().showNetworkError("Sorry there seems to be something\n wrong with the net connection")},onLayoutCompleted:function(){this._scroller=new RSScrollHolderLayer(cc.size(this._scrollerRect.getWidth(),this._scrollerRect.getHeight()));this._scroller.initializeScroller(cc.size(this._scrollerRect.getWidth(),this._scrollerRect.getHeight()),0,1,!1,0,0,{left:0,top:0,right:0,bottom:0}); this._scroller.setPosition(this._scrollerRect.getX(),this._scrollerRect.getY());this.addChild(this._scroller);this.playBackgroundMusic();RSCasinoManager.setCasinoHUD(this._getCasinoHUD());RSCasinoManager.getCasinoHUD().setPrimaryCurrency(RSCasinoManager.getPrimaryCurrency());RSEngine.loginMode!=LOGIN_MODE.GUEST&&RSGame.getInstance().getUserDataManager().getCurrentCoinBalance(this._coinBalanceCallBack.bind(this));this._machineConfig=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Bingo); for(var a=0,b="",b="",c=[],d={FONT_ICON:RSGame.getInstance().getAssetPath("SourceSans_SemiBold_40"),FONT_COLOR:{r:255,g:255,b:255,a:255},JL_FONT_ICON:RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),JL_FONT_COLOR:{r:255,g:255,b:255,a:255}},a=0;a<this._machineConfig.length;a++)b=this._machineConfig[a].machine_identifier+".png",b=new RSCasinoIconHolder("LONG_ICON_WITHOUT_BET",this._iconHolder,"res/BingoResources/res/icons/"+b,this.onIconClicked.bind(this),this._machineConfig[a], !0,d,!0,null,null),c.push(b);for(var e=RSGame.getInstance().getGameData().getMachineDetails(RSGameTypes.Keno),a=0;a<e.length;a++){var f=null;e[a].jackpotLoungeName&&(f=e[a].jackpotLoungeName);b=e[a].machine_identifier+".png";b=new RSCasinoIconHolder("LONG_ICON_WITHOUT_BET",this._iconHolder,"res/KenoResources/SubLobby/icons/"+b,this.onIconClicked.bind(this),e[a],!0,d,!0,null,f);c.push(b);null!=f&&this._JLMachineHolderList.push(b)}for(var g in this._bottomBGItems)this.addChild(this._bottomBGItems[g]); 0<c.length&&(this._scroller.addElements(c),a=this.convertToNodeSpace(this.sliderRect.x,this.sliderRect.y),d=new RSControlSlider(RSGame.getInstance().getAssetPath("ScrollBar"),cc.size(485,34),RSGame.getInstance().getAssetPath("ScrollRound"),cc.size(52,52)),d.setPosition(a.getX(),a.getY()),this.addChild(d),this._scroller.setCustomSlider(d));this._scroller.setAutoScrollConfig(0.5,c.length-1,0);this.outerGlow&&this.addChild(this.outerGlow);0<this._JLMachineHolderList.length&&(this.onJackpotData(),RSEventManager.getInstance().addEventListener("onJackpotGetData", this,this.onJackpotData.bind(this)));this._super.onLayoutCompleted.call(this)},onJackpotData:function(){var a=JackpotLoungeDataHandler.getInstance().getJackpotValue("mega");a&&(this._JLBaseValue=a.baseValue,this._JLValue=a.value,this.setJackpotValuesToIcons())},setJackpotValuesToIcons:function(){if(0<this._JLMachineHolderList.length)for(var a in this._JLMachineHolderList)this._JLMachineHolderList[a].setJackPotValuesToIconHolder(this._JLBaseValue,this._JLValue)},jackpotLoungeMachineSelectPopupCallBack:function(a, b){if(!this._machineLoaded)if("regular"==a)this._machineLoaded=RSEngine.loginMode!==LOGIN_MODE.GUEST,RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Keno,b instanceof Object?b.machine_identifier:b,RSGameScreens.KenoBingoLobby);else if("jackpot"==a)if(RSEngine.loginMode!=LOGIN_MODE.GUEST){this._machineLoaded=!0;var c="res/KenoResources/SubLobby/featuredIcons/"+b.machine_identifier+".png";RSEngine.audioManager.stopMusic();RSCasinoManager.triggerMachineEvent("player_action_session_start", "jackpot_popup",b.jackpotLoungeName.split("Lounge")[0].toLowerCase());RSGame.getInstance().getGameManager().loadJackpotLounge(b.machine_identifier,b.machineDisplayName,b.jackpotLoungeName,!1,c,"lounge",this._popupClosed.bind(this))}else this._machineLoaded=!1,RSEngine.dataManager.getMe().setGuestUserDataForKey("PopupName","FbConnectPopup"),RSGame.getInstance().getGameManager().showLoginPopup("feature","VIPPopup")},_popupClosed:function(){this._machineLoaded=GlobalVars.isjackpotLoaded=!1},onReveal:function(){this._scroller.startAutoScroll(); this._super.onReveal.call(this)},onButtonClicked:function(a){switch(a){case "BtnLeft":case "SlotsNavigation":RSGame.getInstance().getGameManager().platformSDKScreenNavigation("SLOTS_LOBBY");break;case "BtnRight":case "FavoritesNavigation":RSGame.getInstance().getGameManager().platformSDKScreenNavigation("FAVORITES_LOBBY")}},_getCasinoHUD:function(){return new TopHUD(RSGame.getInstance().getAssetPath("TopHud"))},onIconClicked:function(a,b,c){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"), !1);b="res/KenoResources/SubLobby/featuredIcons/"+a.machine_identifier+".png";a.machine_identifier.includes("B_")?RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Bingo,a.machine_identifier,RSGameScreens.KenoBingoLobby):c&&GameConfig.JACKPOT_LOUNGE_ENABLE?RSGame.getInstance().getGameManager().callJLMachineSelectPopup(a,b,this.jackpotLoungeMachineSelectPopupCallBack.bind(this)):RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Keno,a.machine_identifier,RSGameScreens.KenoBingoLobby)}});var PokerType={RSP:"RSP",MSP:"MSP",MPP:"MPP",DOD:"DOD"},CasinoPokerLobby=RSCasinoScreen.extend({_gameType:PokerType.RSP,init:function(){this._super.init.call(this);RSGame.getInstance().getGameManager().setGameType(RSGameTypes.Poker);this._previewHolder2=this._previewHolder1=this._mppText=this._mspText=this._cpText=this._scrollerRect=this._scrollerDetails=this._scroller=this._iconHolder=this._mask=this._mppButton=this._mspButton=this._cpButton=null;if(this._gameAnalyticsId=RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName())RSUtils.isStringContains(this._gameAnalyticsId, "PKR")?this._gameType=PokerType.DOD:RSUtils.isStringContains(this._gameAnalyticsId,"MPP")?this._gameType=PokerType.MPP:RSUtils.isStringContains(this._gameAnalyticsId,"MSP")?this._gameType=PokerType.MSP:this._gameType=PokerType.RSP},loadContent:function(){this.layoutScreen(RSGame.getInstance().getAssetPath("CasinoPokerLobby"),1);this._super.loadContent.call(this)},playBackgroundMusic:function(){RSEngine.audioManager.isMusicPlaying()||RSGame.getInstance().getGameManager().playMusicWithFadeIn(RSGame.getInstance().getAssetPath("MainLobbyBGM"), !0,this.getDisplayObject())},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "ClassicBtn":this._cpButton=a;this._cpButton.setTouchEnabled(!0);break;case "MSPBtn":this._mspButton=a;this._mspButton.setTouchEnabled(!0);break;case "MPPBtn":this._mppButton=a,this._mppButton.setTouchEnabled(!0)}},createCustomObject:function(a,b){switch(b.type){case "IconHolder":this._iconHolder=b;break;case "Rect":if("ClippingRect"===b.name)this._scrollerDetails=b,this._scrollerRect= new RSRect(this._scrollerDetails.x,this._scrollerDetails.y,this._scrollerDetails.w,this._scrollerDetails.h);else if("BgRect"===b.name){var c=new RSImageObject;c.setAnchorPoint(0,0);c.setImageFromUrl(RSGame.getInstance().getAssetPath("PokerLobbyBg"),0,0,RSEngine.screenWidth,RSEngine.screenHeight,!0);this.addChild(c)}else"Slider"===b.name&&(this.sliderRect=b)}switch(b.name){case "BgFrame":c=RSUtils.createBasicObject(a,b);this.addChild(c);this._mask=new RSClippingNode(RSUtils.createBasicObject(a,b)); this.addChild(this._mask);break;case "PreviewHolder1":this._previewHolder1=new RSPanel(b.x,b.y,b.w,b.h);this.addChild(this._previewHolder1);var c=[],d={};d.name=RSGame.getInstance().getAssetPath("PokerPreviewWidget");d.count=1;c.push(d);c=new PreviewWidgetController(new PreviewWidgetModel(c,{sheetName:{poker:"pokermachines"},previewType:RSFeatures.FEATURED,iconPath:{poker:"res/PokerResources/CasinoSubLobby/MainLobbyPreviewIcons/"},iconFieldName:{poker:"machine_identifier"},isDashboard:GameConfig.FEATURING_DASHBOARD? GameConfig.FEATURING_DASHBOARD:!1,fontName:RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","normal")}),new PreviewWidgetView,"previewWidget");RSWidgetsManager.getInstance().addController(c,"previewWidget");this._previewHolder1.addChild(c.getView());c.setDelegate(this);break;case "PreviewHolder2":this._previewHolder2=new RSPanel(b.x,b.y,b.w,b.h);this.addChild(this._previewHolder2);c=[];d={};d.name=RSGame.getInstance().getAssetPath("PokerPreviewWidget");d.count=1;c.push(d);c=new PreviewWidgetController(new PreviewWidgetModel(c, {sheetName:{poker:"pokermachines","default":"LobbyWidgets"},previewType:RSFeatures.MOST_PLAYED,iconPath:{poker:"res/PokerResources/CasinoSubLobby/MainLobbyPreviewIcons/"},iconFieldName:{poker:"machine_identifier"},isDashboard:GameConfig.FEATURING_DASHBOARD?GameConfig.FEATURING_DASHBOARD:!1,fontName:RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","normal"),userBlob:{poker:RSEngine.dataManager.getMe().getPokerDealCount()}},"imageName"),new PreviewWidgetView,"mostPlayedWidget");RSWidgetsManager.getInstance().addController(c, "mostPlayedWidget");this._previewHolder2.addChild(c.getView());c.setDelegate(this);break;case "RSP":this._cpText=RSUtils.createBasicObject(a,b);this.addChild(this._cpText);this._cpText.setVisible(!1);break;case "MSP":this._mspText=RSUtils.createBasicObject(a,b);this.addChild(this._mspText);this._mspText.setVisible(!1);break;case "MPP":this._mppText=RSUtils.createBasicObject(a,b);this.addChild(this._mppText);this._mppText.setVisible(!1);break;case "NewBadge":this._tabButtonNewTag=b}this._super.createCustomObject(a, b)},onLayoutCompleted:function(){this.playBackgroundMusic();RSCasinoManager.setCasinoHUD(this._getCasinoHUD());RSCasinoManager.getCasinoHUD().setPrimaryCurrency(RSCasinoManager.getPrimaryCurrency());this._setButton(this._gameType);this.setPanelByCategory(this._gameType);this.checkAndSetNewTag();this._super.onLayoutCompleted.call(this)},onButtonClicked:function(a){switch(a){case "ClassicBtn":this._gameType=PokerType.RSP;this._scroller.unload();this._setButton(this._gameType);this.setPanelByCategory(this._gameType); break;case "MSPBtn":this._gameType=PokerType.MSP;this._scroller.unload();this._setButton(this._gameType);this.setPanelByCategory(this._gameType);break;case "MPPBtn":this._gameType=PokerType.MPP;this._scroller.unload();this._setButton(this._gameType);this.setPanelByCategory(this._gameType);break;case "BtnRight":case "TableGamesNavigation":RSGame.getInstance().getGameManager().platformSDKScreenNavigation("BLACKJACK_LOBBY");break;case "BtnLeft":case "FavoritesNavigation":RSGame.getInstance().getGameManager().platformSDKScreenNavigation("FAVORITES_LOBBY")}}, setPanelByCategory:function(a){var b=RSGame.getInstance().getGameData().getPokerMachineDetailsByCategory(a);this._setButton(a);this._scroller=new RSScrollHolderLayer(cc.size(this._scrollerRect.getWidth(),this._scrollerRect.getHeight()));this._scroller.initializeScroller(cc.size(this._scrollerRect.getWidth(),this._scrollerRect.getHeight()),0,2,!1,0,0,{left:0,top:0,right:0,bottom:0});this._scroller.setPosition(this._scrollerRect.getX(),this._scrollerRect.getY());this.addChild(this._scroller);a=[];for(var c= "",c="",d={FONT_ICON:RSGame.getInstance().getAssetPath("SourceSans_medium_Semibold"),FONT_COLOR:{r:255,g:255,b:255,a:255},JL_FONT_ICON:RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),JL_FONT_COLOR:{r:255,g:255,b:255,a:255}},e=0;e<b.length;e++)c=b[e].machine_identifier+".png",c=new RSCasinoIconHolder("TINY_ICON",this._iconHolder,"res/PokerResources/CasinoSubLobby/MainLobbyPreviewIcons/"+c,this.onLobbyMachineIconClicked.bind(this),b[e],!0,d,!0,null,null),a.push(c);0<a.length&& (this._scroller.addElements(a),b=this.convertToNodeSpace(this.sliderRect.x,this.sliderRect.y),a=new RSControlSlider(RSGame.getInstance().getAssetPath("ScrollBarPoker"),cc.size(607,19),RSGame.getInstance().getAssetPath("ScrollRoundPoker"),cc.size(35,35)),a.setPosition(b.getX(),b.getY()),this.addChild(a),this._scroller.setCustomSlider(a))},onIconClicked:function(a,b,c){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"),!1);RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Poker, a,RSGameScreens.PokerLobby,c)},onLobbyMachineIconClicked:function(a){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"),!1);RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Poker,a.machine_identifier,RSGameScreens.PokerLobby)},_setButton:function(a){switch(a){case "RSP":this._cpButton.setTouchEnabled(!1);this._mspButton.setTouchEnabled(!0);this._mppButton.setTouchEnabled(!0);this._cpText.setVisible(!0);this._mspText.setVisible(!1);this._mppText.setVisible(!1); break;case "MSP":this._cpButton.setTouchEnabled(!0);this._mspButton.setTouchEnabled(!1);this._mppButton.setTouchEnabled(!0);this._cpText.setVisible(!1);this._mspText.setVisible(!0);this._mppText.setVisible(!1);break;case "MPP":this._cpButton.setTouchEnabled(!0),this._mspButton.setTouchEnabled(!0),this._mppButton.setTouchEnabled(!1),this._cpText.setVisible(!1),this._mspText.setVisible(!1),this._mppText.setVisible(!0)}},checkAndSetNewTag:function(){var a,b,c;for(c in PokerType){switch(c){case "RSP":a= this._cpButton;break;case "MSP":a=this._mspButton;break;case "MPP":a=this._mppButton}b=RSGame.getInstance().getGameData().getPokerMachineDetailsByCategory(c);for(var d in b)if(!0==parseInt(b[d].isNew)&&this._tabButtonNewTag){b=RSUtils.createAnimation("VideoPokerSubLobby",this._tabButtonNewTag,0.3);b.setPosition(a.getX()-this._tabButtonNewTag.x+this._tabButtonNewTag.w,this._tabButtonNewTag.y);this.addChild(b);break}}},_getCasinoHUD:function(){return new TopHUD(RSGame.getInstance().getAssetPath("TopHud"))}, unload:function(){this._super.unload.call(this)}});var TableGamesSubLobby=RSCasinoScreen.extend({init:function(){this.sliderRect=this.outerGlow=this._scrollerRect=this._scrollerRightBtn=this._scrollerLeftBtn=this._iconHolder=null;this._bottomBGItems=[];this._super.init.call(this);this._rouletteTouchEnabledStatus=RSGame.getInstance().getGameData().getDefaultValues().rouletteEnabled;RSGame.getInstance().getGameManager().getGameType()!=RSGameTypes.Blackjack&&RSGame.getInstance().getGameManager().getGameType()!=RSGameTypes.Roulette&&RSGame.getInstance().getGameManager().getGameType()!= RSGameTypes.TableGames&&RSGame.getInstance().getGameManager().setGameType(RSGameTypes.Blackjack)},loadContent:function(){this.layoutScreen(RSGame.getInstance().getAssetPath("CasinoSubLobby"),1);this._super.loadContent.call(this)},playBackgroundMusic:function(){RSEngine.audioManager.isMusicPlaying()||RSGame.getInstance().getGameManager().playMusicWithFadeIn(RSGame.getInstance().getAssetPath("MainLobbyBGM"),!0,this.getDisplayObject())},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this, a,b,c);switch(c.name){case "ArrowLeft":this._scrollerLeftBtn=a;this._scrollerLeftBtn.setVisible(!1);break;case "ArrowRight":this._scrollerRightBtn=a;this._scrollerRightBtn.setVisible(!1);break;case "BgRect":this.removeChild(a);a=new RSImageObject;a.setAnchorPoint(0,0);a.setImageFromUrl(RSGame.getInstance().getAssetPath("LobbyBg"),0,0,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(a);break;case "OuterGlow":this.outerGlow=a;this.removeChild(a);break;case "SlotsNavigation":case "VideoPokerNavigation":case "BtnLeft":case "BtnRight":case "BottomBg":this.removeChild(a), this._bottomBGItems.push(a)}},createCustomObject:function(a,b){switch(b.name){case "IconGap":this._iconGap=b;break;case "IconHolder":this._iconHolder=b;break;case "ClippingRect":this._scrollerRect=new RSRect(b.x,b.y,b.w,b.h);break;case "Slider":this.sliderRect=b}},onLayoutCompleted:function(){this._scroller=new RSScrollHolderLayer(cc.size(this._scrollerRect.getWidth(),this._scrollerRect.getHeight()));this._scroller.initializeScroller(cc.size(this._scrollerRect.getWidth(),this._scrollerRect.getHeight()), 0,1,!0,0,0,{left:0,top:0,right:0,bottom:0});this._scroller.setPosition(this._scrollerRect.getX(),this._scrollerRect.getY());this.addChild(this._scroller);this.playBackgroundMusic();RSCasinoManager.setCasinoHUD(this._getCasinoHUD());RSCasinoManager.getCasinoHUD().setPrimaryCurrency(RSCasinoManager.getPrimaryCurrency());this._super.onLayoutCompleted.call(this);for(var a="",a="",b=[],c={FONT_ICON:RSGame.getInstance().getAssetPath("SourceSans_medium_Semibold"),FONT_COLOR:{r:255,g:255,b:255,a:255}},d= RSGame.getInstance().getGameData().getSheetData("blackjackmachines"),e=0;e<d.length;e++)a=d[e].machine_identifier,a=new RSCasinoIconHolder("LONG_ICON_WITHOUT_BET",this._iconHolder,"res/TableResources/SubLobby/LargeIcons/"+a+".png",this.onIconClicked.bind(this),d[e],!0,c,!0,null,null),b.push(a);if(d=RSGame.getInstance().getGameData().getSheetData("roulettemachines"))for(e=0;e<d.length;e++)a=d[e].machine_identifier,a=new RSCasinoIconHolder("LONG_ICON_WITHOUT_BET",this._iconHolder,"res/TableResources/SubLobby/LargeIcons/"+ a+".png",this.onIconClicked.bind(this),d[e],!0,c,!0,null,null),b.push(a);if(d=RSGame.getInstance().getGameData().getSheetData("tableMachines"))for(e=0;e<d.length;e++)a=d[e].machine_identifier,a=new RSCasinoIconHolder("LONG_ICON_WITHOUT_BET",this._iconHolder,"res/TableResources/SubLobby/LargeIcons/"+a+".png",this.onIconClicked.bind(this),d[e],!0,c,!0,null,null),b.push(a);c=[];e=[];if((a=RSGame.getInstance().getGameData().getSheetData("TableMachineOrder"))&&0<a.length)for(var f in a)e.push(a[f].machine_identifier); for(var g in e)for(var h in b)b[h]._machineDetails.machine_identifier==e[g]&&c.push(b[h]);for(var k in this._bottomBGItems)this.addChild(this._bottomBGItems[k]);0<c.length&&(this._scroller.addElements(c),b=this.convertToNodeSpace(this.sliderRect.x,this.sliderRect.y),f=new RSControlSlider(RSGame.getInstance().getAssetPath("ScrollBar"),cc.size(485,34),RSGame.getInstance().getAssetPath("ScrollRound"),cc.size(52,52)),f.setPosition(b.getX(),b.getY()),this.addChild(f),this._scroller.setCustomSlider(f)); this.outerGlow&&this.addChild(this.outerGlow);RSGame.getInstance().getGameManager().setSideMenuVisibility(!0)},onReveal:function(){this._scroller.startAutoScroll();this._super.onReveal.call(this)},onButtonClicked:function(a){switch(a){case "BtnLeft":case "VideoPokerNavigation":RSGame.getInstance().getGameManager().platformSDKScreenNavigation("POKER_LOBBY");break;case "BtnRight":case "SlotsNavigation":RSGame.getInstance().getGameManager().platformSDKScreenNavigation("SLOTS_LOBBY")}},_getCasinoHUD:function(){return new TopHUD(RSGame.getInstance().getAssetPath("TopHud"))}, onIconClicked:function(a){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"),!1);a.machine_identifier.includes("BJ_")?RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Blackjack,a.machine_identifier,RSGameScreens.TableGamesLobby):a.machine_identifier.includes("BR_")?RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.TableGames,a.machine_identifier,RSGameScreens.TableGamesLobby):1==this._rouletteTouchEnabledStatus&&RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Roulette, a.machine_identifier,RSGameScreens.TableGamesLobby)}});var LobbyBottomHUD=RSDisplayObject.extend({init:function(a){var b=new RSRect(0,0,0,0);this._super.init.call(this,b);this._jackpotLoungeComingSoon=this._hourlyBonusHolder=this._giftText=this._giftingButton=null;this._callBack=a;this._btnJackpot=this._giftCenterAnimPosition=this._giftCenterAnimation=null;this._gameManager=RSGame.getInstance().getGameManager();this.loadLayout(RSGame.getInstance().getAssetPath("MainLobbyHud"))},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b, c);switch(c.name){case "ComingSoon":this._jackpotLoungeComingSoon=a;GameConfig.JACKPOT_LOUNGE_ENABLE&&this._jackpotLoungeComingSoon.setVisible(!1);break;case "GiftCenter":this._giftingButton=a;this._giftingButton.setVisible(!1);break;case "GiftText":this._giftText=a;this._giftText.setVisible(!1);break;case "GiftNotificationBase":this._giftNotificationBase=a;this._giftNotificationBase.setVisible(!1);break;case "GiftCenterAnimation":this._giftCenterAnimation=a;this._giftCenterAnimPosition=new RSPoint(a.getX(), a.getY());this._giftCenterAnimation.stopAnimation();break;case "FBIcon":this._fbRewardBoOnGifting=a}},createCustomObject:function(a,b){switch(b.name){case "JackpotLoungeButton":this._btnJackpot=new JackpotLoungeButtons(this._gameManager.getHUDCasinoFont("large","bold"),this.onJackpotButtonClicked.bind(this));this._btnJackpot.setRect(b.x,b.y,b.w,b.h);this.addChild(this._btnJackpot);break;case "HourlyBonusHolder":this._hourlyBonusHolder=new RSPanel(b.x,b.y,b.w,b.h);RSEngine.loginMode==LOGIN_MODE.EMAIL&& (this._hourlyBonusHolder=new RSPanel(b.x-2.5,b.y,b.w,b.h));this.addChild(this._hourlyBonusHolder);break;case "GiftNotificationCount":this._giftNotificationCount=new RSScaledLabel("",this._gameManager.getHUDCasinoFont("large","Bluebold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._giftNotificationCount);break;case "IconHolderLoyaltyPoints":var c={font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","bold"),scale:0.7};this._loyaltyPreviewWidget=new RSLoyaltyPreviewWidget(new RSRect(b.x, b.y,b.w,b.h),c,this.onSaleButtonClicked.bind(this),!0,null,{bingo:"res/BingoResources/res/icons/",keno:"res/KenoResources/SubLobby/icons/",poker:"res/PokerResources/CasinoSubLobby/Icons/",slots:"res/SlotResources/CasinoSubLobby/LargeIcons/",blackjack:"res/TableResources/SubLobby/LargeIcons/",Roulette:"res/TableResources/SubLobby/LargeIcons/",tablegames:"res/TableResources/SubLobby/LargeIcons/"},"fadeOut");this.addChild(this._loyaltyPreviewWidget);this._loyaltyPreviewWidget.setZOrder(0);this._loyaltyPreviewWidget.setVisible(!1); break;case "LoyaltyMallWidget":this._loyaltyMallWidget=new RSPlayerConnectWidget(b);this._loyaltyMallWidget.setCenter(b.x,b.y);this._loyaltyMallWidget.setZOrder(1);this.addChild(this._loyaltyMallWidget);RSEngine.loginMode===LOGIN_MODE.FACEBOOK&&this._loyaltyMallWidget.setVisible(!1);break;case "Reward":this._fbRewardText=new RSScaledLabel("",this._gameManager.getHUDCasinoFont("large","Goldbold"),b,kTEXT_ALIGNMENT_CENTER),this.addChild(this._fbRewardText)}},onLayoutCompleted:function(){this._fbRewardBoOnGifting.setVisible(!1); this._fbRewardText.setVisible(!1);GameConfig.GIFTING_ENABLED&&RSEngine.loginMode!=LOGIN_MODE.GUEST?this._setGifting():(this._giftingButton.setVisible(!0),this._giftText.setVisible(!0),this._giftCenterAnimation.setVisible(!0),this._giftingButton.setTouchEnabled(!0),this.setFBRewardBanner());this._showHourlyBonusScreen();this._callBack(this)},onJackpotButtonClicked:function(){GlobalVars.isMachineLoadingInProgress||(this._btnJackpot.setTouchEnabled(!1),GameConfig.JL_SURFACING&&!RSEngine.dataManager.getMe().getJLSurfacingShown()? RSGame.getInstance().getGameManager().showIntroScreenForJL(this.openJackpotLounge.bind(this)):this.openJackpotLounge())},openJackpotLounge:function(){this._gameManager.loadJackpotLounge(null,null,null,null,null,"lounge",null)},onSaleButtonClicked:function(a,b,c){RSGame.getInstance().getGameManager().showSaleOrPurchaseCart(a,b,c)},_showHourlyBonusScreen:function(){this._currentVIPStatus=RSGame.getInstance().getGameData().getCurrentVIPStatus(RSVIPManager.getInstance().getVIPUserTier());var a=parseInt(this._currentVIPStatus.biHourlyBonusPercent); this._hourlyBonusCoins=parseInt(RSGame.getInstance().getGameManager().getHourlyBonusValue());this._hourlyBonusCoins+=a/100*this._hourlyBonusCoins;0<a&&(a=parseInt(this._hourlyBonusCoins%100),a==this._hourlyBonusCoins?this._hourlyBonusCoins+=100-this._hourlyBonusCoins:0<a&&(this._hourlyBonusCoins+=100-a));a=this._gameManager.getHUDCasinoFont("large","bold");HourlyBonusManager.getInstance().showHourlyBonus(this,RSGame.getInstance().getAssetPath("HourlyBonusWidget"),this._hourlyBonusHolder,a,this._hourlyBonusCoins, !1,RSVIPManager.getInstance().getVIPUserTier(),"subscription_lobby_button")},onHourlyBonusCollected:function(a){RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.bihourlyBonusCollect);var b=new RSRect(0,0,0,0);this._displayPanel=new RSDisplayObject(b);this.addChild(this._displayPanel);this._displayPanel.setZOrder(1);RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(a,this._displayPanel,this._onHourlyBonusCollectAnimCompleted.bind(this))},_onHourlyBonusCollectAnimCompleted:function(){}, onVideoButtonClicked:function(){},showLoginPromptPopup:function(){this._gameManager.showLoginPopup("feature","HourlyBonus")},onButtonClicked:function(a){if(!GlobalVars.isMachineLoadingInProgress)switch(a){case "JackpotLounge":case "VIPCasinoBtn":this.onJackpotLoungeClicked();break;case "GiftCenter":this.onGiftingClicked()}},onIntroScreenComplete:function(){cc.log("onComplete")},enableAllButtons:function(){null!=this._giftingButton&&this._giftingButton.setTouchEnabled(!0)},disableAllButtons:function(){null!= this._giftingButton&&this._giftingButton.setTouchEnabled(!1)},onJackpotLoungeClicked:function(){RSEngine.loginMode===LOGIN_MODE.GUEST&&this._gameManager.showLoginPopup("feature","VIPPopup")},onTournamentPopupClosed:function(){},onGiftingClicked:function(){RSEngine.loginMode!=LOGIN_MODE.GUEST?GameConfig.GIFTING_ENABLED?(RSAnalyticsManager.getInstance().trackPlayerAction("giftcenter","click","","",""),RSGiftingManager.getInstance().onGiftClicked(this._setGifting.bind(this))):RSEngine.popupManager.addPopup(new CustomMessagePopup("This feature is not available.", null)):RSGame.getInstance().getGameManager().showLoginPopup("feature","GiftCenterPopup")},_setGifting:function(){GameConfig.GIFTING_ENABLED&&RSEngine.loginMode!=LOGIN_MODE.GUEST&&RSGiftingManager.getInstance().getAppRequests(this._setGiftNotificationCount.bind(this));this._giftCenterAnimation.setVisible(!0);this._giftingButton.setVisible(!0);this._giftText.setVisible(!0);this.setFBRewardBanner()},_setGiftNotificationCount:function(){var a="!";GameConfig.GIFTING_ENABLED&&(a=RSGiftingManager.getInstance().getGiftClaimCount()); 0==a?(this._giftNotificationCount.setVisible(!1),this._giftNotificationBase.setVisible(!1),this._giftCenterAnimation.stopAnimation(),this._giftCenterAnimation.setFrame(0)):(this._giftNotificationCount.setVisible(!0),this._giftNotificationCount.setString(a),this._giftNotificationBase.setVisible(!0),this._giftCenterAnimation.playAnimation(-1,0.3))},setFBRewardBanner:function(){if(RSEngine.loginMode==LOGIN_MODE.EMAIL&&!RSGame.getInstance().getUserDataManager().getMe().getLoginRewardStatus()||RSEngine.loginMode== LOGIN_MODE.GUEST){var a=RSEngine.gameData.getDefaultValues(),a=parseInt(a.emailReward);this._fbRewardText.setVisible(!0);this._fbRewardText.setString(RSUtils.formatNumberWithComma(a));this._fbRewardBoOnGifting.setVisible(!0)}else this._fbRewardText.setVisible(!1),this._fbRewardBoOnGifting.setVisible(!1)},unload:function(){this._super.unload.call(this)}});var UserBanPopup=RSGenericPopup.extend({init:function(){this._assetList=[{name:RSGame.getInstance().getAssetPath("UserBanPopup"),count:1}];var a={font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold")};this._super.init.call(this,null,a)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CloseBtn":a.setVisible(!1),a.setTouchEnabled(!1)}},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)}, createCustomObject:function(a,b){var c=null;switch(b.name){case "UserId":c=RSGame.getInstance().getGameManager().getUpdatedUserForDisplay(RSEngine.dataManager.getMe().getId()),c=new RSScaledLabel("User ID :- "+c,RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","normal"),b,kTEXT_ALIGNMENT_CENTER)}null!=c&&this.addChild(c);return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){"CP_Button_T1"==a&&(document.getElementById("Helpshift").style.display="block", document.getElementById("helpshiftoverlay").style.display="block")},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);RSAnalyticsManager.getInstance().trackBannedUser()},closePopup:function(){this._super.closePopup.call(this)},unload:function(){this._super.unload.call(this)}});var RewardsVO=RSVO.extend({id:null,name:null,coins:null,energy:null,xp_duration:null,xp_multiplier:null,init:function(a){this.energy=this.coins=this.name=this.id="";this.xp_multiplier=this.xp_duration=0;this._super.init.call(this,a);this.xp_duration=parseFloat(this.xp_duration);this.xp_multiplier=parseInt(this.xp_multiplier)}});var VIPUtils=function(){};VIPUtils.MAX_TIER=5;VIPUtils.TOTAL_MACHINES=4;VIPUtils.EVENT_PLAY_MACHINE_UNLOCK="PLAY_MACHINE_UNLOCK";VIPUtils.EVENT_UPDATE_PROGRESS="EVENT_UPDATE_PROGRESS";VIPUtils.getNextTier=function(a){var b=parseInt(a)+1;return b<=VIPUtils.MAX_TIER?b:a};VIPUtils.isMaxTier=function(a){return a==VIPUtils.MAX_TIER};var VIPWelcomePopup=RSPopup.extend({_vipNextStatusSymbol:null,_vipStatusSymbol:null,_currentVIPTier:0,_isFirstTime:!1,_isTierUp:!1,_infoBubble:null,_VIPTiers:[null,"BlueStar","BronzeStar","SilverStar","GoldStar","PlatinumStar"],init:function(a,b,c,d){this._assetList=[{name:RSGame.getInstance().getAssetPath("VIPTierUpPopup"),count:1}];this._currentVIPTier=a;this._isFirstTime=b;if(this._isTierUp=c)RSGame.getInstance().getUserDataManager().getMe().setVIPTierUnlockPopupShown(a),RSGame.getInstance().getUserDataManager().saveUserData("VIPWelcomeSet"); RSAnalyticsManager.getInstance().trackGUIEvent("vip_status_popup","trigger","");this._super.init.call(this,d)},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},onReveal:function(){this._super.onReveal.call(this);0<this._currentVIPTier&&this._playStartAnim()},_playStartAnim:function(){this._startAnim.setVisible(!0);this._startAnim.playAnimation(1,0.8,this._onStartAnimCompleted.bind(this))}, onObjectCreated:function(a,b,c){switch(c.name){case "Tick1":case "Tick2":case "Tick3":case "Tick4":case "Tick5":b=String(c.name).split("");Number(b[4])==this._currentVIPTier?a.setVisible(!0):a.setVisible(!1);break;case "UnlockText":this._isFirstTime?a.setVisible(!1):a.setVisible(!0);break;case "StartAnim":this._startAnim=a;this._startAnim.stopAnimation();this._startAnim.setVisible(!1);break;case "StarGlow":this._starGlow=a;this._starGlow.stopAnimation();this._starGlow.setVisible(!1);break;case "ParticleAnim":this._particleAnim= a;this._particleAnim.stopAnimation();this._particleAnim.setVisible(!1);break;case "Title":this._isTierUp||(a.setVisible(!1),this.removeChild(a));break;case "WelcomeTitle":this._isTierUp&&(a.setVisible(!1),this.removeChild(a));break;case "NextStarBg":0==this._currentVIPTier?a.setVisible(!0):a.setVisible(!1);break;case "WelcomeText":this._isFirstTime?a.setVisible(!0):a.setVisible(!1);break;case (c.name.match(/Star$/)||{}).input:a.stopAnimation();switch(this._currentVIPTier){case 1:c.name==this._VIPTiers[1]&& a.playAnimation(-1,1,null);break;case 2:c.name==this._VIPTiers[2]&&a.playAnimation(-1,1,null);break;case 3:c.name==this._VIPTiers[3]&&a.playAnimation(-1,1,null);break;case 4:c.name==this._VIPTiers[4]&&a.playAnimation(-1,1,null);break;case 5:c.name==this._VIPTiers[5]&&a.playAnimation(-1,1,null)}break;case (c.name.match(/Big$/)||{}).input:switch(a.setVisible(!1),this._currentVIPTier){case 0:"NoStarBig"==c.name&&a.setVisible(!0);break;case 1:"BlueStarBig"==c.name&&a.setVisible(!0);break;case 2:"BronzeStarBig"== c.name&&a.setVisible(!0);break;case 3:"SilverStarBig"==c.name&&a.setVisible(!0);break;case 4:"GoldStarBig"==c.name&&a.setVisible(!0);break;case 5:"PlatinumStarBig"==c.name&&a.setVisible(!0)}}},_onStartAnimCompleted:function(){this._startAnim.setVisible(!1);this.removeChild(this._startAnim);this._starGlow.setVisible(!0);this._particleAnim.setVisible(!0);this._starGlow.playAnimation(-1,0.425);this._particleAnim.playAnimation(-1,1)},onButtonClicked:function(a){switch(a){case "CloseBtn":this.closePopup(); RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.PLAYER_ACTION,"vip_status_icon","close","","","");break;case "BenefitsBtn":this._openVIPBenefitsPopup();break;case "IButton":this._toggleInfoBubble()}},_openVIPBenefitsPopup:function(){RSEngine.popupManager.addPopup(new VIPBenefitsPopup(this.onVIPBenefitsClosed.bind(this)),!0)},_toggleInfoBubble:function(){this._infoBubble.isVisible()?this._infoBubble.setVisible(!1):this._infoBubble.setVisible(!0)},onVIPBenefitsClosed:function(){}, closePopup:function(){this._isTierUp&&RSEventManager.getInstance().dispatchEvent(VIPUtils.EVENT_PLAY_MACHINE_UNLOCK);this._super.closePopup.call(this)},unload:function(){this._super.unload.call(this)}});var VIPBenefitsPopup=RSGenericPopup.extend({_gemAnimationArray:[],_vipDataSheet:[],_currentTier:0,_currentanim:null,init:function(a,b,c){this._openFrom=c?"open_from_"+c:"";this._assetList=[{name:RSGame.getInstance().getAssetPath("VIPBenefitsPopup"),count:1}];this._vipDataSheet=RSGame.getInstance().getGameData().getVIPGameData();this._currentTier=RSVIPManager.getInstance().getVIPUserTier();this._callBack=a;this.popupType=b;this._vipMedal=null;b={font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large", "deluxe")};RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.PLAYER_ACTION,"vip_benefit_button","click",this._openFrom,"","");this._super.init.call(this,a,b)},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},onObjectCreated:function(a,b,c){switch(c.name){case "Status":this._status=a;1<=this._currentTier?this._status.setVisible(!0):this._status.setVisible(!1);break;case "BlueStar":this._currentanim= a;this._currentanim.stopAnimation();1===this._currentTier&&this._currentanim.playAnimation(-1,0.66);break;case "BronzeStar":this._currentanim=a;this._currentanim.stopAnimation();2===this._currentTier&&this._currentanim.playAnimation(-1,0.66);break;case "SilverStar":this._currentanim=a;this._currentanim.stopAnimation();3===this._currentTier&&this._currentanim.playAnimation(-1,0.66);break;case "GoldStar":this._currentanim=a;this._currentanim.stopAnimation();4===this._currentTier&&this._currentanim.playAnimation(-1, 0.66);break;case "PlatinumStar":this._currentanim=a;this._currentanim.stopAnimation();5===this._currentTier&&this._currentanim.playAnimation(-1,0.66);break;case "VipInfoText1":this._noVIPInfo=a;this._noVIPInfo.setVisible(!1);0===this._currentTier&&this._noVIPInfo.setVisible(!0);break;case "VipMedal":this._vipMedal=a,this._vipMedal.stopAnimation(),0===this._currentTier?this._vipMedal.setVisible(!1):this._vipMedal.setFrame(this._currentTier-1)}},createCustomObject:function(a,b){switch(b.type){case "Label":switch(b.name){case "MainLine1":this._addTextBoxHere(a, b,"Daily Bonus Coins",kTEXT_ALIGNMENT_LEFT);break;case "MainLine2":this._addTextBoxHere(a,b,"Hourly Bonus Coins",kTEXT_ALIGNMENT_LEFT);break;case "MainLine3":this._addTextBoxHere(a,b,"Extra Coins on Purchases",kTEXT_ALIGNMENT_LEFT);break;case "MainLine4":this._addTextBoxHere(a,b,"Extra Coins on Level-Up",kTEXT_ALIGNMENT_LEFT);break;case "MainLineSub":this._addTextBoxHere(a,b,"(for every $0.99 spent)",kTEXT_ALIGNMENT_LEFT);break;case "MainLine5":this._addTextBoxHere(a,b,"Concierge",kTEXT_ALIGNMENT_LEFT); break;case "MainLine6":this._addTextBoxHere(a,b,"VIP Lounge Access",kTEXT_ALIGNMENT_LEFT);break;case "BlueLine1":case "BlueLine2":case "BlueLine3":case "BlueLine4":case "BlueLine5":case "BlueLine6":var c=b.name.split(""),c=c[c.length-1]-1;this._addVIPDataofCurrentIndex(a,b,c,1);break;case "BronzeLine1":case "BronzeLine2":case "BronzeLine3":case "BronzeLine4":case "BronzeLine5":case "BronzeLine6":c=b.name.split("");c=c[c.length-1]-1;this._addVIPDataofCurrentIndex(a,b,c,2);break;case "GoldLine1":case "GoldLine2":case "GoldLine3":case "GoldLine4":case "GoldLine5":case "GoldLine6":c= b.name.split("");c=c[c.length-1]-1;this._addVIPDataofCurrentIndex(a,b,c,3);break;case "Platinum1":case "Platinum2":case "Platinum3":case "Platinum4":case "Platinum5":case "Platinum6":c=b.name.split("");c=c[c.length-1]-1;this._addVIPDataofCurrentIndex(a,b,c,4);break;case "Black1":case "Black2":case "Black3":case "Black4":case "Black5":case "Black6":c=b.name.split(""),c=c[c.length-1]-1,this._addVIPDataofCurrentIndex(a,b,c,5)}}},_addTextBoxForNumbers:function(a,b,c,d){this._mainLine=new RSLabelBMFont(c, RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold"),2*b.w,d);d===kTEXT_ALIGNMENT_LEFT?this._mainLine.setCenter(b.x-b.w/2,b.y):this._mainLine.setCenter(b.x,b.y);this._mainLine.setScale(0.43);this.addChild(this._mainLine)},_addTextBoxHere:function(a,b,c,d){this._mainLine=new RSLabelBMFont(c,RSGame.getInstance().getGameManager().getDefaultCasinoFont("largeBlue","Semibold"),2*b.w,d);d===kTEXT_ALIGNMENT_LEFT?this._mainLine.setCenter(b.x-b.w/2,b.y):this._mainLine.setCenter(b.x, b.y);this._mainLine.setScale(0.55);this.addChild(this._mainLine)},_addVIPDataofCurrentIndex:function(a,b,c,d){var e="";switch(c){case 0:e=String(this._vipDataSheet[d].dailyBonusPercent);e="0"==e?"-":"+"+e.toString()+"%";break;case 1:e=String(this._vipDataSheet[d].biHourlyBonusPercent);e="0"==e?"-":"+"+e+"%";break;case 2:e=String(100*this._vipDataSheet[d].additionalCoinsOnPurchase);e="0"==e?"-":"+"+e+"%";break;case 3:e=String(100*this._vipDataSheet[d].additionalBonusForLevelUp);e="0"==e?"-":"+"+e+ "%";break;case 4:e=String(this._vipDataSheet[d].concierge);e="0"==e?"-":"Yes";break;case 5:e=String(this._vipDataSheet[d].exclusiveGames),e="0"==e?"-":"Yes"}this._addTextBoxForNumbers(a,b,e,kTEXT_ALIGNMENT_CENTER)},onButtonClicked:function(a){"CloseButton"===a&&(RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.PLAYER_ACTION,"vip_benefit_button","close",this._openFrom,"",""),this.closePopup())},closePopup:function(){this._super.closePopup.call(this)},unload:function(){this._super.unload.call(this)}});var SUB_SALE_CONFIG={NOT_ELIGIBLE:"NOT_ELIGIBLE",ELIGIBLE:"ELIGIBLE",PURCHASED:"PURCHASED",COLLECTABLE:"COLLECTABLE"},PurchaseFlowManager=function(){var a,b=RSClass.extend({_sessionStart:null,_joiningTime:null,_exitCartCount:null,_currentPlayer:null,_npsActive:!1,_npsMaxTime:null,_npsTimeRemaining:null,_purchaseResponseObject:null,_isPurchaseCartSaleEnabled:!1,_currencyCodesData:null,init:function(){this._subSaleStatus=SUB_SALE_CONFIG.NOT_ELIGIBLE;this._sessionStart=TimeManager.getInstance().getCurrentServerTime(); this._joiningTime=RSGame.getInstance().getUserDataManager().getMe().getJoiningDate();this._currentPlayer=RSGame.getInstance().getUserDataManager().getMe();this._exitCartCount=parseInt(RSGame.getInstance().getGameData().getDefaultValues().exitCartCount);this._currentPackData=null;this._npsActive=!1;this._npsTimeRemaining=0;this._saleStatus=!1;this._subSaleArray=[];this._showPurchaseCart=!0;this._isPurchaseCartSaleEnabled=!1;this._retryCount=0;this._packDay=this._packName=null;this._continueMainlobbyTransition= !1},initialize:function(a){this.initializeLocalCurrency();this.showSubSalePopups(a);this._setNewPlayerSaleValues();this._continueMainlobbyTransition&&a()},initializeLocalCurrency:function(){if(null!=RSGame.getInstance().getGameData().getSheetData("currencyCodes")){this._currencyCodesData=RSGame.getInstance().getGameData().getSheetData("currencyCodes");for(var a=RSSocialManager.getInstance().currency.user_currency,b=0;b<this._currencyCodesData.length;b++)a===this._currencyCodesData[b].code&&("DYNAMIC"!== this._currencyCodesData[b].type&&"STATIC"!==this._currencyCodesData[b].type||RSInAppPurchaseManager.getInstance().setUserCountryLocalCurrencyUnicode(this._currencyCodesData[b].symbol,this._currencyCodesData[b].type))}},getPurchaseCartSaleStatus:function(){return this._isPurchaseCartSaleEnabled},getActiveSubscriptionSale:function(){RSGame.getInstance().getUserDataManager().getActiveSubscriptionSale(this.onSubscriptionStatusCallback.bind(this),this.onSubscriptionStatusCallFailed.bind(this))},disableSubSale:function(){RSEventManager.getInstance().dispatchEvent("subSalePurchaseSuccess", {})},getSubSaleStatus:function(){return this._subSaleStatus},showSubSalePopups:function(a){this._subSaleStatus===SUB_SALE_CONFIG.COLLECTABLE?RSEngine.popupManager.addPopup(new DailyMillionaireInfoPopup(a,this._subSaleArray),!1):this._continueMainlobbyTransition=!0},showInfoPopup:function(){RSEngine.popupManager.addPopup(new DailyMillionaireInfoPopup(null,this._subSaleArray),!1)},collectSubscriptionSale:function(a,b,e,f){this._packName=a;this._packDay=b;RSGame.getInstance().getUserDataManager().collectSubscriptionSale(this._packName, this._packDay,this.collectSubscriptionSaleSuccess.bind(this),this.collectSubscriptionSaleFailed.bind(this,e))},collectSubscriptionSaleSuccess:function(a){this._retryCount=0;this.onSubscriptionStatusCallback(a);RSEventManager.getInstance().dispatchEvent("collectSubscriptionSaleSuccess",a)},collectSubscriptionSaleFailed:function(a,b){3>this._retryCount?(this._retryCount++,this.collectSubscriptionSale(this._packName,this._packDay,a)):(this._retryCount=0,RSErrorTracker.getInstance().trackErrorMessage("ERROR_SUBSCRIPTION_SALE", "Error collecting subscription sale","mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"))},onSubscriptionStatusCallback:function(a){this._retryCount=0;a.result.subscriptionArray?(this._subSaleStatus=SUB_SALE_CONFIG.PURCHASED,this._subSaleArray=a.result.subscriptionArray,this._subSaleStatus="available"===a.result.subscriptionArray.status?SUB_SALE_CONFIG.COLLECTABLE:SUB_SALE_CONFIG.PURCHASED):this._subSaleStatus=SUB_SALE_CONFIG.NOT_ELIGIBLE},onSubscriptionStatusCallFailed:function(a){3>this._retryCount? (this._retryCount++,this.getActiveSubscriptionSale()):(this._retryCount=0,RSErrorTracker.getInstance().trackErrorMessage("SUBSCRIPTION_STATUS","Error fetching active subscription sale","mahesh.jose@rubyseven.net,lijith.puthiyoottil@rubyseven.net"))},getName:function(){return"PurchaseFlowManager"},_setNewPlayerSaleValues:function(){if(0<parseFloat(this._currentPlayer.getMonetizationFactor()))RSPlatformSDKManager.getInstance().setUserAttributeNPSActive(!1);else{for(var a=RSGame.getInstance().getGameData().getSheetData("offerPacks"), b=0,e=0;e<a.length;e++)for(var f=a[e].offerDay.split(","),g=0;g<f.length;g++)parseInt(f[g])>=b&&(b=parseInt(f[g]));this._npsMaxTime=86400*b;this._sessionStart-this._joiningTime<=this._npsMaxTime&&(this._npsActive=!0,this._npsTimeRemaining=this._npsMaxTime-(this._sessionStart-this._joiningTime),RSCasinoManager.getCasinoHUD().checkSaleStatusAndStartBuyButtonAnimation(),0<RSGame.getInstance().getUserDataManager().getMe().getCurrentDay()&&(this._showPurchaseCart=!1));RSPlatformSDKManager.getInstance().setUserAttributeNPSActive(this._npsActive)}}, setShowPurchaseCart:function(a){this._showPurchaseCart=a},getShowPurchaseCart:function(){return this._showPurchaseCart},_onConnectionLostPopupClosed:function(){this._currentPackData=null;cc.log("Connection Lost")}});return{getInstance:function(){a||(a=new b);return a}}}();var PurchaseFailurePopup=RSGenericPopup.extend({_callBack:null,_assetList:null,_popupType:null,init:function(a,b){var c={font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold")};this._super.init.call(this,null,c);this._popupType=b;this._assetList=[{name:RSGame.getInstance().getAssetPath("PurchaseFailurePopup"),count:1}];this._callBack=a;this._cancelBo=this._errorBo=this._closeButton=this._tryAgainButton=null;this._purchaseSupportactive=!1;this._failedMessageBo=this._messageBo= this._validationFailedMessage=null},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);"Cancel"==this._popupType?(RSPlatformSDKManager.getInstance().trackEvent(SDK_EVENT_TYPE.purchaseCancelled,"",""),this._cancelBo.setVisible(!0),this._failedMessageBo.setVisible(!1)):("ValidationFailed"==this._popupType?this._validationFailedMessage?(this._validationFailedMessage.setVisible(!0),this._messageBo.setVisible(!1),this._failedMessageBo.setVisible(!1)):this._messageBo.setVisible(!0):(this._failedMessageBo.setVisible(!0), this._tryAgainButton.setVisible(!1),this._messageBo.setVisible(!1)),this._errorBo.setVisible(!0))},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "TryAgainBtn":case "MediumBtn":this._tryAgainButton=a;break;case "CloseBtn":this._closeButton=a;break;case "ErrorTitle":this._errorBo=a;this._errorBo.setVisible(!1);break;case "CancelledTitle":this._cancelBo=a;this._cancelBo.setVisible(!1); break;case "Message":this._messageBo=a;break;case "FailedMessage":this._failedMessageBo=a;this._failedMessageBo.setVisible(!1);break;case "ValidationFailedMessage":this._validationFailedMessage=a,this._validationFailedMessage.setVisible(!1)}},onButtonClicked:function(a){this._purchaseSupportactive&&("Cancel"==this._popupType?RSAnalyticsManager.getInstance().trackGUIEvent("support","close","open_from_purchase_cancel","",""):RSAnalyticsManager.getInstance().trackGUIEvent("support","close","open_from_purchase_fail", "",""),this._purchaseSupportactive=!1);switch(a){case "CP_Button_T1":case "TryAgainBtn":case "CloseBtn":this._tryAgainButton.setTouchEnabled(!1);this._closeButton.setTouchEnabled(!1);this.closePopup();this._callBack&&this._callBack(a,this._popupType);break;case "ContactSupport":document.getElementById("Helpshift").style.display="block",document.getElementById("helpshiftoverlay").style.display="block","Cancel"==this._popupType?RSAnalyticsManager.getInstance().trackGUIEvent("support","open","open_from_purchase_cancel", "",""):RSAnalyticsManager.getInstance().trackGUIEvent("support","open","open_from_purchase_fail","",""),this._purchaseSupportactive=!0}}});var PurchaseCartScreenView=RSDisplayObject.extend({_isSelected:null,_parentView:null,init:function(a,b,c){this._parentView=c;this._isSelected=b;this._super.init.call(this,a)},setSelection:function(a){this._isSelected=a},onAssetLoaded:function(a){null==this._buttonArray&&(cc.log("Button Array is NULL"),this._buttonArray=[]);for(var b=RSUtils.cloneJSON(a.objects),c=a.screenName,d=0;d<b.length;d++){var e=null,f=b[d];f.x*=2;f.y*=2;switch(f.type){case "bo":e=RSUtils.createBasicObject(c,f);break;case "Button":e= RSUtils.createButton(c,f);this.addTouchListenerToButton(e);this._buttonArray.push(e);break;case "Animation":e=RSUtils.createAnimation(c,f,1);break;default:e=this.createCustomObject(c,f)}null!=e&&(this.addChild(e),this.onObjectCreated(e,a.screenName,f))}this.setSelection(this._isSelected)},createCustomObject:function(a,b){},addTouchListenerToButton:function(a){null==a?cc.log("OBJECT IS NULL"):a.addTouchEventListener(this,this.handleButtonClick)},handleButtonClick:function(a,b){switch(b){case ccui.Widget.TOUCH_ENDED:this.onButtonClicked(a.name)}}, onButtonClicked:function(a){cc.log(a)}});var PurchaseSuccessPopup=RSGenericPopup.extend({_callBack:null,_objectData:null,_coinOrigin:null,_firstPurchase:null,_tierUpEventFired:!1,vipObject:{_pointsRequired:0,_upgradePoint:0,_upgradableTier:0,_currentTier:void 0,_valueAwarded:0,_statusPointsAwarded:0,_rewardPointsAwarded:0,_bonusFactor:0,_bonusValue:0,_remainingTime:0,_clubMPoints:0,_vipPoints:{_statusPoints:0,_rewardPoints:0}},init:function(a,b,c,d){this._remainingTime=RSGame.getInstance().getUserDataManager().getMe().getDaubAlertTime()- TimeManager.getInstance().getCurrentServerTime();this._totalCoinsAfterVipCal=c.totalCoinsAwarded;this._clubMPoints=c.playerConnectPoints;PurchaseFlowManager.getInstance().getActiveSubscriptionSale();PurchaseFlowManager.getInstance().getSubSaleStatus()==SUB_SALE_CONFIG.ELIGIBLE&&(this._isSubSalePurchased=!0);"powerup"==b.category&&RSAnalyticsManager.getInstance().trackInHouseEvent("user_info","powerup_balance","purchase_success",RSGame.getInstance().getGameManager().getPowerUpList(),"","");b.category&& (this._isSpecialPurchase="unlock"==b.category||"don"==b.category||0==parseInt(b.value));c=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(c);c={font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","black")};this._super.init.call(this,a,c);this._callBack=a;this._closeButton=this._continueButton=null;this._objectData=b;this.setName("PurchaseSuccessPopup");this._currentVIPTier=RSVIPManager.getInstance().getVIPUserTier();this._previousTier=RSVIPManager.getInstance().getVIPUserStatus()._currentTier; this._additionalCoinsOnPurchase=RSGame.getInstance().getGameData().getVIPadditionalCoinsOnPurchase(this._previousTier);RSGame.getInstance().getUserDataManager().getMe().setPreviousTierData(this._previousTier);this._setPreviousTierData(RSVIPManager.getInstance().getVIPUserStatus());this._firstPurchase=1==parseInt(RSGame.getInstance().getUserDataManager().getMe().getMonetizationCount());RSGame.getInstance().getGameManager().updateCoinXpLevel();RSEventManager.getInstance().addEventListener(RSVIPTierUpEvent, this,this.onVIPTierUp.bind(this));RSGame.getInstance().getGameManager().getGameType()===RSGameTypes.Bingo&&RSEngine.externalGameManager._updateMachineData({event:"post_message",name:"PURCHASE_SUCESS_DATA",message:"",timeStamp:TimeManager.getInstance().getCurrentServerTime()});RSEngine.externalGameManager&&RSEngine.externalGameManager.isSpinGameActive()&&RSEngine.externalGameManager.updateCoin(RSGame.getInstance().getUserDataManager().getMe().getCoins());b.isCredit&&("powerup"==b.type?RSVIPManager.getInstance().getVIPUserDataFromServer(b.inAppID): RSVIPManager.getInstance().getVIPUserDataFromServer(b.id));GameConfig.LM_AND_VIP_SURFACING&&(RSEngine.dataManager.getMe().getVIPSurfacingShown()||RSEngine.dataManager.getMe().setVIPTriggerStatus(!0),RSEngine.dataManager.getMe().getLoyaltyMallEligiblePopupShownStatus()||RSEngine.dataManager.getMe().setLMTriggerStatus(!0));if(GameConfig.IS_PLAYER_CONNECT_AVAILABLE||RSEngine.loginMode!==LOGIN_MODE.FACEBOOK)this.singleBoxView=!1;GameConfig.IS_PLAYER_CONNECT_AVAILABLE&&RSEngine.loginMode!==LOGIN_MODE.FACEBOOK|| (this.singleBoxView=!0);this._vipWelcomePopupAvailableStatus=!1;RSEventManager.getInstance().addEventListener("onInfoPopupClose",this,this.onClosePopup.bind(this));RSEventManager.getInstance().dispatchEvent("onPurchaseSuccessClosed");RSEventManager.getInstance().dispatchEvent("updateLMPoints");RSPlatformSDKManager.getInstance().setUserAttributeLastPurchaseAmount(this._objectData.price)},_setPreviousTierData:function(a){this.vipObject._currentTier=a._currentTier;this.vipObject._vipPoints._statusPoints= a._vipPoints._statusPoints;this.vipObject._vipPoints._rewardPoints=a._vipPoints._rewardPoints;this.vipObject._pointsRequired=a._pointsRequired;this.vipObject._upgradePoint=a._upgradePoint;this.vipObject._statusPointsAwarded=a._statusPointsAwarded;this.vipObject._rewardPointsAwarded=a._rewardPointsAwarded},_setBonusData:function(a){this.vipObject._valueAwarded=a._valueAwarded;this.vipObject._bonusFactor=a._bonusFactor;this.vipObject._bonusValue=a._bonusValue},onVIPTierUp:function(a){this._tierUpEventFired= !0;this._currentVIPTier=this._newVIPTier=a._userData;this._additionalCoinsOnPurchase=RSGame.getInstance().getGameData().getVIPadditionalCoinsOnPurchase(RSGame.getInstance().getUserDataManager().getMe().getPreviousTierData())},onLayoutCompleted:function(){this.addChild(this._diplayPanel);this.checkIfVIPUser();this.setVisibility();this.setRollForPurchaseSuccess();this._super.onLayoutCompleted.call(this)},loadContent:function(){this.layoutScreen(RSGame.getInstance().getAssetPath("PurchaseSuccess")); this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "Rewards3":case "RewardsAdded3":this.singleBoxView&&a.setVisible(!1);break;case "ItemBase1":this.singleBoxView||a.setVisible(!1);break;case "ItemBase2":case "ItemBase3":this.singleBoxView&&a.setVisible(!1);break;case "PowerupsAdded":this._powerUpsAdded=a;this._powerUpsAdded.setVisible(!1);"powerup"==this._objectData.type&&this._powerUpsAdded.setVisible(!0);break;case "CoinsAdded":this._coinsAdded= a;this._coinsAdded.setVisible(!1);"coins"==this._objectData.type&&this._coinsAdded.setVisible(!0);break;case "Continue":this._continueButton=a;this._coinOrigin=new RSPoint(c.x,c.y);break;case "CloseBtn":this._closeButton=a;break;case "NoVIP":this._noVIPBanner=a;this._noVIPBanner.setVisible(!1);break;case "YourStatus":this._yourStatus=a;this._yourStatus.setVisible(!1);break;case "VIPBg":this._vipBg=a;this._vipBg.setVisible(!1);break;case "VipStage":this._vipStage=a;this._vipStage.setVisible(!1);break; case "VipStatus":this._vipStatusAnim=a,this._vipStatusAnim.stopAnimation(),a=RSGame.getInstance().getUserDataManager().getMe().getPreviousTierData(),1<=a?this._vipStatusAnim.setFrame(a-1):this._vipStatusAnim.setVisible(!1)}},checkIfVIPUser:function(){0<RSGame.getInstance().getUserDataManager().getMe().getPreviousTierData()?(this._yourStatus.setVisible(!0),this._vipBg.setVisible(!0)):this._noVIPBanner.setVisible(!0)},createCustomObject:function(a,b){switch(b.name){case "Coin":if(!this.singleBoxView)return; this._coinIcon=RSUtils.createBasicObject(a,b);this.addChild(this._coinIcon);break;case "Coin2":if(this.singleBoxView)return;this._coinIcon=RSUtils.createBasicObject(a,b);this.addChild(this._coinIcon);break;case "Value":if(!this.singleBoxView)return;if("powerup"==this._objectData.type&&this._objectData.isCredit||"daubAlert"==this._objectData.type)break;this._isSpecialPurchase||("EC"==this._objectData.analyticsName.substring(0,2)?this._coins=this._objectData.value:this._coins=this._totalCoinsAfterVipCal, RSGame.getInstance().getLosingStreakManager().setLSBonusValues(this._totalCoinsAfterVipCal));this._valueLabel=new RSScaledLabel(parseInt(this._coins),RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._valueLabel);break;case "Value2":if(this.singleBoxView)return;if("powerup"==this._objectData.type&&this._objectData.isCredit||"daubAlert"==this._objectData.type)break;this._isSpecialPurchase||("EC"==this._objectData.analyticsName.substring(0, 2)?this._coins=this._objectData.value:this._coins=this._totalCoinsAfterVipCal,RSGame.getInstance().getLosingStreakManager().setLSBonusValues(this._totalCoinsAfterVipCal));this._valueLabel=new RSScaledLabel(parseInt(this._coins),RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._valueLabel);break;case "PowerupsIcon":if(!this.singleBoxView)return;this._powerUpsIcon=RSUtils.createBasicObject(a,b);this.addChild(this._powerUpsIcon);break; case "PowerupsIcon2":if(this.singleBoxView)return;this._powerUpsIcon=RSUtils.createBasicObject(a,b);this.addChild(this._powerUpsIcon);break;case "DaubAlert":if(!this.singleBoxView)return;this._daubAlertIcon=RSUtils.createBasicObject(a,b);this.addChild(this._daubAlertIcon);break;case "DaubAlert2":if(this.singleBoxView)return;this._daubAlertIcon=RSUtils.createBasicObject(a,b);this.addChild(this._daubAlertIcon);break;case "RewardsValue":if(!this.singleBoxView)return;if("powerup"==this._objectData.type&& !this._objectData.isCredit)break;RSAnalyticsManager.getInstance().trackMClubRewards(parseInt(this._clubMPoints),"loyalty_rewards");this._rewardsValueLabel=new RSScaledLabel(RSUtils.formatNumber(parseInt(this._clubMPoints)),RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),b,kTEXT_ALIGNMENT_CENTER);this._rewardsValueLabel.setFontColor(255,255,255,255);this._rewardsValueLabel.setScale(0.85);this.addChild(this._rewardsValueLabel);break;case "RewardsValue3":if(this.singleBoxView)return; if("powerup"==this._objectData.type&&!this._objectData.isCredit)break;RSAnalyticsManager.getInstance().trackMClubRewards(parseInt(this._clubMPoints),"loyalty_rewards");this._rewardsValueLabel=new RSScaledLabel(RSUtils.formatNumber(parseInt(this._clubMPoints)),RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),b,kTEXT_ALIGNMENT_CENTER);this._rewardsValueLabel.setFontColor(255,255,255,255);this._rewardsValueLabel.setScale(0.995);this.addChild(this._rewardsValueLabel);break;case "ExtraCoin":this._extraCoinLabel= new RSScaledLabel("",RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold"),b,kTEXT_ALIGNMENT_RIGHT);this.addChild(this._extraCoinLabel);0<this._additionalCoinsOnPurchase&&this._extraCoinLabel.setString(String(this._additionalCoinsOnPurchase)+"%");break;case "PowerupValue":if(!this.singleBoxView)return;if("powerup"!=this._objectData.type||!this._objectData.isCredit)break;var c=Number(this._objectData.value);this._powerUpvalueLabel=new RSScaledLabel(RSUtils.formatNumber(c), RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._powerUpvalueLabel);break;case "PowerupValue2":if(this.singleBoxView)return;if("powerup"!=this._objectData.type||!this._objectData.isCredit)break;c=Number(this._objectData.value);this._powerUpvalueLabel=new RSScaledLabel(RSUtils.formatNumber(c),RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._powerUpvalueLabel);break; case "DaubAlertTime":if(!this.singleBoxView)return;if("daubAlert"!=this._objectData.type)break;this._daubTimer=new RSScaledLabel(RSUtils.formattedTime(this._remainingTime),RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._daubTimer);this._interval=setInterval(this.startDaubTimer.bind(this),1E3);break;case "DaubAlertTime2":if(this.singleBoxView)return;if("daubAlert"!=this._objectData.type)break;this._daubTimer=new RSScaledLabel(RSUtils.formattedTime(this._remainingTime), RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._daubTimer);this._interval=setInterval(this.startDaubTimer.bind(this),1E3)}return this._super.createCustomObject.call(this,a,b)},startDaubTimer:function(){0<this._remainingTime?(this._daubTimer&&this._daubTimer.setString(RSUtils.formattedTime(this._remainingTime)),this._remainingTime--):(clearInterval(this._interval),this._daubTimer&&this._daubTimer.setVisible(!1))},onButtonClicked:function(a){switch(a){case "Continue":case "CloseBtn":RSEventManager.getInstance().dispatchEvent(VIPUtils.EVENT_UPDATE_PROGRESS), "powerup"!=this._objectData.type&&"daubAlert"!=this._objectData.type?(this._continueButton.setTouchEnabled(!1),this._closeButton.setTouchEnabled(!1),this._diplayPanel.setZOrder(1),this._isSpecialPurchase?this.closePopup():RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(this._coinOrigin,this._diplayPanel,this.closePopup.bind(this))):this.closePopup()}},closePopup:function(){this._super.closePopup.call(this);if(this._isSubSalePurchased)PurchaseFlowManager.getInstance().showInfoPopup();else this.onClosePopup()}, onClosePopup:function(){RSEventManager.getInstance().removeListenersForEvent("onInfoPopupClose");this._tierUpEventFired?this.playVIPUnlock(this.showSubscriptionPopup.bind(this)):1==RSEngine.dataManager.getMe().getMonetizationCount()&&GameConfig.LM_AND_VIP_SURFACING&&RSGame.getInstance().getGameManager().showIntroScreenForLMAndVIP(!0);this._vipWelcomePopupAvailableStatus||this.showSubscriptionPopup()},showSubscriptionPopup:function(){var a=!0;!GameConfig.VIP_SURFACING||GlobalVars.isSurfacingActive|| RSEngine.dataManager.getMe().getLoyaltyMallEligiblePopupShownStatus()&&RSEngine.dataManager.getMe().getVIPSurfacingShown()||!RSGame.getInstance().getGameManager().getCurtainRaiserScreen()||(a=!1);a&&!RSGame.getInstance().getUserDataManager().getMe().getSubscriptionAfterFirstPurchaseShown()&&GameConfig.SUBSCRIPTION_ENABLED&&"1"==RSEngine.gameData.getDefaultValues().isNMISubscriptionActive&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&"US"==RSGame.getInstance().getUserDataManager().getMe().getCountryCode()&& null==RSSubscrptionSaleManager.getCurrentDate("day")&&!1===RSSubscrptionSaleManager.getPaymentStatus()&&RSSaleManager.getInstance().getSubscriptionSaleStatus()&&!GameConfig.SKIP_SUBSCRIPTION_SALE_POPUP&&null!=RSSaleManager.getInstance()._allSalesData.subscription.assets[0]&&(RSSubscrptionSaleManager.showSubscriptionSalePopup("","","Sub_FP"),RSGame.getInstance().getUserDataManager().getMe().setSubscriptionAfterFirstPurchaseShown(!0))},playVIPUnlock:function(a){!GlobalVars.isjackpotLoaded&&RSGame.getInstance().getUserDataManager().getMe().getVIPSurfacingShown()|| !1==GameConfig.VIP_SURFACING?(this._vipWelcomePopupAvailableStatus=!0,RSEngine.popupManager.addPopup(new VIPWelcomePopup(this._newVIPTier,!1,!0,a),!0)):GameConfig.VIP_SURFACING&&!RSGame.getInstance().getUserDataManager().getMe().getVIPSurfacingShown()&&RSGame.getInstance().getGameManager().showIntroScreenForLMAndVIP(!0)},showVIPAndLMSurfacing:function(){parseInt(RSGame.getInstance().getGameData().getDefaultValues().isLoyaltyMallEnabled)?(RSEngine.dataManager.getMe().getLoyaltyMallEligiblePopupShownStatus()|| GlobalVars.isSurfacingActive||(GlobalVars.isLMToolTipActive=!0),RSEngine.dataManager.getMe().getLoyaltyMallEligiblePopupShownStatus()&&RSEngine.dataManager.getMe().getVIPSurfacingShown()||RSGame.getInstance().getGameManager().showIntroScreenForLMAndVIP(!RSEngine.dataManager.getMe().getVIPSurfacingShown(),!RSEngine.dataManager.getMe().getLoyaltyMallEligiblePopupShownStatus(),this._onLoyaltyEligiblePopupClosed.bind(this))):RSEngine.dataManager.getMe().getVIPSurfacingShown()||RSGame.getInstance().getGameManager().showIntroScreenForLMAndVIP(!RSEngine.dataManager.getMe().getVIPSurfacingShown(), !1,null)},playVIPUnlock:function(){!GlobalVars.isjackpotLoaded&&RSGame.getInstance().getUserDataManager().getMe().getVIPSurfacingShown()&&RSEngine.dataManager.getMe().getLoyaltyMallEligiblePopupShownStatus()||!1==GameConfig.LM_AND_VIP_SURFACING?RSEngine.popupManager.addPopup(new VIPWelcomePopup(this._newVIPTier,!1,!0),!0):GameConfig.LM_AND_VIP_SURFACING&&this.showVIPAndLMSurfacing()},_onLoyaltyEligiblePopupClosed:function(){GlobalVars.isLMToolTipActive&&RSGameScreenManager.getInstance().getCurrentScreen()=== RSGameScreens.MainLobby&&(RSEngine.popupManager.addPopup(new RSLoyaltyToolKitPopup,!1,!0,!1),GlobalVars.isLMToolTipActive=!1)},setVisibility:function(){"powerup"==this._objectData.type||this._isSpecialPurchase?(this._coinIcon.setVisible(!1),this._daubAlertIcon.setVisible(!1)):"coins"==this._objectData.type?(this._powerUpsIcon.setVisible(!1),this._daubAlertIcon.setVisible(!1)):(this._coinIcon.setVisible(!1),this._powerUpsIcon.setVisible(!1))},setRollForPurchaseSuccess:function(){Number(this._coins)&& (this.stopWinRollUp(),this.startActionTweenForKey("HUDRollUp",3,0,this._coins))},actionOnUpdate:function(a,b){this._winDisplay=Math.floor(b);this._valueLabel.setString(RSUtils.formatNumberWithComma(this._winDisplay))},actionOnComplete:function(){this.stopWinRollUp()},stopWinRollUp:function(){this.stopActionTweenForKey("HUDRollUp");this._valueLabel.setString(RSUtils.formatNumberWithComma(this._coins))},unloadContent:function(){RSEventManager.getInstance().removeEventListenersIn(this);RSEngine.externalGameManager.reloadExternalGame(); this._super.unloadContent.call(this)}});var CasinoExternalGameLoader=RSCasinoScreen.extend({_backgroundObject:null,_layoutObjects:[],loadContent:function(){this._super.loadContent.call(this);this.layoutScreen(RSGame.getInstance().getAssetPath("ConnectingToServer"))},onLayoutCompleted:function(){this.loadBackGround();AristocratManager.getInstance().setAristocratHud();this._super.onLayoutCompleted.call(this)},onReveal:function(){this._super.onReveal.call(this)},loadBackGround:function(){this._backgroundObject=new RSBasicObject;var a=new RSImageObject; a.setImageFromUrl(RSGame.getInstance().getAssetPath("LobbyBg"),0,0,RSEngine.screenWidth,RSEngine.screenHeight);this._backgroundObject.setPosition(RSEngine.screenWidth/2,RSEngine.screenHeight/2);this._backgroundObject.addChild(a);this.addChild(this._backgroundObject);this._backgroundObject.setVisible(!1)},onObjectCreated:function(a,b,c){this._layoutObjects.push(a);a.setVisible(!1)},setBackgroundVisible:function(a){this._backgroundObject&&this._backgroundObject.setVisible(a)},setLoaderVisible:function(a){}, unload:function(){this._layoutObjects.length=0;this._layoutObjects=null;this._super.unload.call(this)}});var UrlNotificationRewardPopup=RSGenericPopup.extend({init:function(a,b){this._callback=b;var c=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(c);this._titleTextEnergy=this._titleText=this._powerupIcon=null;this._messages=a;this._energyAwared=this._coinAwarded=0;this._coinIcon=this._heading=this._subHeading=null;this._assetList=[{name:RSGame.getInstance().getAssetPath("NotificationRewardPopUp"),count:1}];c={font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold")}; this._super.init.call(this,this._callback,c);this.setRewardValues()},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},setRewardValues:function(){this._coinAwarded=parseInt(UrlNotificationManager.getInstance()._rewardVO.coins);this._energyAwared=parseInt(UrlNotificationManager.getInstance()._rewardVO.powerup)},onLayoutCompleted:function(){0<this._coinAwarded&&0<!this._energyAwared?(this._coinIcon.setY(this._coinIcon.getPosition().getY()-40),this._titleText.setY(this._titleText.getPosition().getY()- 40)):0<this._energyAwared&&0<!this._coinAwarded&&(this._powerupIcon.setY(this._powerupIcon.getPosition().getY()+40),this._titleTextEnergy.setY(this._titleTextEnergy.getPosition().getY()+40));this._super.onLayoutCompleted.call(this);this.addChild(this._diplayPanel)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "MediumBtn":this._continueButton=a;this._coinPoint=new RSPoint(c.x,c.y);break;case "CloseBtn":this._closeButton=a;break;case "Coin":this._coinIcon= a;0<!this._coinAwarded&&this._coinIcon.setVisible(!1);break;case "Energy":this._powerupIcon=a;0<!this._energyAwared&&this._powerupIcon.setVisible(!1);break;case "RewardText":this._rewardText=a,"xp_blast"==UrlNotificationManager.getInstance()._rewardVO.opt_value2&&(this._rewardText.setVisible(!1),this._titleText1=new RSLabelBMFont("You've activated Double XP!",RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","bold"),-1,kTEXT_ALIGNMENT_LEFT),this.addChild(this._titleText1))}},createCustomObject:function(a, b){switch(b.name){case "Value":if(isNaN(this._coinAwarded)||0>=this._coinAwarded)return;this._titleText=new RSLabelBMFont("",RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),b.w,kTEXT_ALIGNMENT_CENTER);this._titleText.setScale(1.3);this._titleText.setPosition(b.x,b.y);this._titleText.setTextAlignment(kTEXT_ALIGNMENT_CENTER);this.addChild(this._titleText);this._titleText.setString(RSUtils.formatNumber(Number(this._coinAwarded),3));break;case "Value1":if(isNaN(this._energyAwared)|| 0>=this._energyAwared)return;this._titleTextEnergy=new RSScaledLabel("",RSGame.getInstance().getGameManager().getHUDCasinoFont("large","bold"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._titleTextEnergy);this._titleTextEnergy.setString(RSUtils.formatNumber(Number(this._energyAwared)));break;case "Heading":this._heading=new RSScaledLabel("",RSGame.getInstance().getGameManager().getDefaultCasinoFont("extralargeDrkBlue","black"),b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._heading);this._heading.setString(this._messages.messageTitleAvailable); break;case "SubHeading":this._subHeading=new RSScaledLabel("",RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","Semibold"),b,kTEXT_ALIGNMENT_CENTER),this.addChild(this._subHeading),this._subHeading.setString(this._messages.messageBodyAvailable)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":case "CP_Button_T1":this._continueButton&&this._continueButton.setTouchEnabled(!1),this._closeButton&&this._closeButton.setTouchEnabled(!1), RSEngine.screenManager.addOverlay(),0<this._coinAwarded&&RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,"url_scheme",this._coinAwarded,"metagame"),isNaN(this._energyAwared)||RSAnalyticsManager.getInstance().trackSecondarySource(this._energyAwared,"url_scheme","metagame"),RSGame.getInstance().getUserDataManager().getCoinBalance(this.onCoinUpdate.bind(this))}},onCoinUpdate:function(){RSEngine.screenManager.removeOverlay();0<this._coinAwarded?RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(this._coinPoint, this._diplayPanel,this._onCoinAnimComplete.bind(this)):this._onCoinAnimComplete()},_onCoinAnimComplete:function(){RSCasinoManager.addPrimaryCurrency(0);this.closePopup()}});var UrlNotificationRewardFailedPopup=RSGenericPopup.extend({init:function(a,b){this._callback=b;this._messages=a;this._messageHeading=null;this._assetList=[{name:RSGame.getInstance().getAssetPath("NotificationRewardFailedPopUp"),count:1}];var c={font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold")};this._super.init.call(this,this._callback,c);2==UrlNotificationManager.getInstance().linkRewardsStatus?(this._messageHeading=this._messages.messageTitleExpired,this._messageBoby= this._messages.messageBodyExpired):(this._messageHeading=this._messages.messageTitleClaimed,this._messageBoby=this._messages.messageBodyClaimed)},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "MediumBtn":this._continueButton=a;this._coinPoint=new RSPoint(c.x,c.y);break;case "CloseBtn":this._closeButton= a}},createCustomObject:function(a,b){switch(b.name){case "Heading":var c=new RSLabelBMFont(this._messageHeading,RSGame.getInstance().getGameManager().getDefaultCasinoFont("extralargeDrkBlue","black"),1.25*b.w,kTEXT_ALIGNMENT_CENTER);c.setCenter(b.x,b.y);c.setScale(0.94);this.addChild(c);break;case "Value":c=new RSLabelBMFont(this._messageBoby,RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","Semibold"),2*b.w,kTEXT_ALIGNMENT_CENTER),c.setCenter(b.x,b.y),this.addChild(c)}return this._super.createCustomObject.call(this, a,b)},onButtonClicked:function(a){switch(a){case "CP_Button_T1":case "CloseBtn":this.closePopup()}}});var DailyMillionaireInfoPopup=RSPopup.extend({init:function(a,b){this._super.init.call(this,a);this._callback=a;this._assetList=[{name:RSGame.getInstance().getAssetPath("DailyMillionaireInfoPopup"),count:1}];this._shadeLeft=this._shadeRight=this._panel=this._collectButton=this._closeButton=null;this._availText="";this.collectSuccess=this._tickLeft=null;this._isCollectable=!0;this._subScriptionData=b},onButtonClicked:function(a){switch(a){case "Close":case "CloseBtn":case "CollectBtn":this._isCollectable? (RSEngine.screenManager.addOverlay(),PurchaseFlowManager.getInstance().collectSubscriptionSale(this._subScriptionData.packName,this._subScriptionData.nextDay,this.onCollectSuccess.bind(this))):(this.closePopup(),RSEventManager.getInstance().dispatchEvent("onInfoPopupClose"))}},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CloseBtn":case "Close":this._closeButton=a;break;case "CollectBtn":this._collectButton=a}},onCollectSuccess:function(a){this._subScriptionData= a._userData.result.subscriptionArray;this._subScriptionData.coinsRewarded=a._userData.result.coinsRewarded;RSEngine.dataManager.getCoinBalance(this._onRetrieveCoinsPurchase.bind(this));this.collectSuccess=!0;this._setValues()},_disableSale:function(){this.closePopup();PurchaseFlowManager.getInstance().disableSubSale();RSEngine.screenManager.removeOverlay()},_onRetrieveCoinsPurchase:function(a,b){RSEngine.screenManager.removeOverlay();var c=RSGame.getInstance().getGameData().getPackById(this._subScriptionData.packName); RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.paid,"purchase_bonus_day"+(parseInt(this._subScriptionData.nextDay)-1),this._subScriptionData.coinsRewarded,c.analyticsName);this._subScriptionData.nextDay>this._subScriptionData.subscriptionPeriod?this._disableSale():(RSSaleManager.getInstance().callSaleDetails(null,null,GlobalVars.isPurchaseEnabled),c=new RSRect(0,0,0,0),this._diplayPanel=new RSDisplayObject(c),this.addChild(this._diplayPanel),this._diplayPanel.setZOrder(1),c= this._diplayPanel.convertToNodeSpace(this._collectButton.getX(),this._collectButton.getY()),RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(c,this._diplayPanel,this.closePopup.bind(this)))},_setValues:function(){TimeManager.getInstance().getCurrentServerTime();if("available"===this._subScriptionData.status)this._collectButton.setVisible(!0);else{if("claimed"===this._subScriptionData.status){this._disableSale();return}this._collectButton.setVisible(!1);this._isCollectable=!1;this._availText= RSUtils.createBasicObject("DailyMillionaireInfoPopup",this._availableTxt);this.addChild(this._availText);clearInterval(this._bonusTimer);this._bonusTimer=setInterval(this._setTimerValues.bind(this),1E3)}var a=parseInt(this._subScriptionData.nextDay)-2,b=parseInt(this._subScriptionData.nextDay)-1;if(this.collectSuccess){var c=RSUtils.createBasicObject("DailyMillionaireInfoPopup",this._shadeRight);c.setPosition(this._shadeRight.x+a*this._shadeRight.w,this._shadeRight.y);c=RSUtils.createBasicObject("DailyMillionaireInfoPopup", this._tickLeft);c.setPosition(this._tickLeft.x+a*this._tickLeft.w,this._tickLeft.y);this.addChild(c)}else if(0<this._subScriptionData.collectedDays.length){for(a=0;a<this._subScriptionData.subscriptionPeriod;a++)a!==b&&(c=RSUtils.createBasicObject("DailyMillionaireInfoPopup",this._shadeRight),c.setPosition(this._shadeRight.x+a*this._shadeRight.w,this._shadeRight.y));for(a=0;a<this._subScriptionData.collectedDays.length;a++)0<this._subScriptionData.collectedDays[a]&&(c=RSUtils.createBasicObject("DailyMillionaireInfoPopup", this._tickLeft),c.setPosition(this._tickLeft.x+(this._subScriptionData.collectedDays[a]-1)*this._tickLeft.w,this._tickLeft.y),this.addChild(c));for(a=0;a<=b;a++){for(var c=!1,d=0;d<this._subScriptionData.collectedDays.length;d++)a+1===this._subScriptionData.collectedDays[d]&&(c=!0);c||a===b||(c=RSUtils.createBasicObject("DailyMillionaireInfoPopup",this._unTickLeft),c.setPosition(this._unTickLeft.x+(a-1)*this._shadeRight.w,this._unTickLeft.y),this.addChild(c))}}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this); this._subScriptionData.nextDay>this._subScriptionData.subscriptionPeriod?this._disableSale():(this.collectSuccess=!1,this._setValues())},_setTimerValues:function(){var a=this._subScriptionData.nextAvailableTime-TimeManager.getInstance().getCurrentServerTime();0>=a?(this._isCollectable=!0,clearInterval(this._bonusTimer),PurchaseFlowManager.getInstance().getActiveSubscriptionSale(),this._collectButton.setVisible(!0),this.removeChild(this._availText),this._timerTxt.setVisible(!1)):(this._timerTxt.setVisible(!0), a=RSUtils.formattedTime(a),this._timerTxt.setString(a))},createCustomObject:function(a,b){switch(b.name){case "Panel":this._panel=RSUtils.createBasicObject(a,b);this.addChild(this._panel);break;case "ShadeRight":this._shadeRight=b;break;case "ShadeLeft":this._shadeLeft=b;break;case "TickLeft":this._tickLeft=b;break;case "UnTickLeft":this._unTickLeft=b;break;case "TimerTxt":this._timerTxt=new RSScaledLabel("",RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold"),b,kTEXT_ALIGNMENT_LEFT); this.addChild(this._timerTxt);this._timerTxt.setVisible(!1);break;case "AvailableTxt":this._availableTxt=b}},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this);RSEventManager.getInstance().addEventListener("collectSubscriptionSaleSuccess",this,this.onCollectSuccess.bind(this))},unload:function(){clearInterval(this._bonusTimer);this._subScriptionData.length=0;RSEventManager.getInstance().removeEventListenersIn(this);this._subScriptionData=null;this._super.unload.call(this)}});var CustomPlacementInterface=RSPlacementInterface.extend({init:function(){this._super.init.call(this);this.isPopupTriggered=!1;this._currentPopup=this._oocPopupAnim=null;this.isOOC=!1;this._oocMinBetStatus=RSGame.getInstance().getGameData().getDefaultValues().oocMinBetFeatureStatus?parseInt(RSGame.getInstance().getGameData().getDefaultValues().oocMinBetFeatureStatus):0},loadPopup:function(a){if(null==this._currentPopup||this._oocMinBetStatus)this._currentPopup=a;if("RateUsPopup"!=a&&"LikeUsPopup"!= a)if("LOCPopup0"!=a&&"LOCPopup1"!=a||RSCasinoManager.getCasinoInterface().isRoundCompletePopupsActive()||RSEngine.popupManager.isPopupActive()||GlobalVars.isTournamentLoaded)if("OOCPopup"!=a||RSCasinoManager.getCasinoInterface().isRoundCompletePopupsActive()||RSEngine.popupManager.isPopupActive()||GlobalVars.isTournamentLoaded)null!=this._currentPopup&&(this._currentPopup=null);else{if("LOCPopup0"!=this._currentPopup||"LOCPopup1"!=this._currentPopup)this.isOOC=!0;RSEngine.externalGameManager.postMessageToJackpot("jackpotCustomInterfaceCalls", {type:"resetKickOut"});RSGame.getInstance().getUserDataManager().saveUserBlobParams();RSEngine.loginMode==LOGIN_MODE.GUEST?(RSGame.getInstance().getGameManager().showLoginPopup("ooc","PurchaseCart"),this._currentPopup=null):GlobalVars.isPurchaseEnabled?"OOCPopup"==this._currentPopup&&RSSaleManager.getInstance().getLocOocSaleData("ooc")?(RSEngine.externalGameManager.hideToaster(),!GlobalVars.isOOCAnimShown&&GameConfig.OOC_CAROUSEL?(this._oocPopupAnim=new RSLOCOOCAnimationScreen(RSGame.getInstance().getAssetPath("OutOfCreditsCarouselPopupAnimation"), this.checkForSubscriptionSale.bind(this,"ooc",!0)),RSEngine.screenManager.addScreen(this._oocPopupAnim),RSCasinoManager.getCasinoHUD().enableAllButtons(),RSEngine.externalGameManager.stopAutoSpin(),RSEngine.externalGameManager.hideExternalGame(),RSGame.getInstance().getGameManager().setSideMenuVisibility(!1),GlobalVars.isOOCAnimShown=!0):this.showSalePopup("ooc",!1)):this._currentPopup=null:(VideoManager.getInstance().showVideoPopup("ReplacePurchase",!1,"ooc",this.videoManagerPopupCloseCallback.bind(this)), this._currentPopup=null)}else RSGame.getInstance().getUserDataManager().saveUserBlobParams(),RSEngine.loginMode==LOGIN_MODE.GUEST?(RSGame.getInstance().getGameManager().showLoginPopup("ooc","PurchaseCart"),this._currentPopup=null):GlobalVars.isPurchaseEnabled?"LOCPopup0"!=this._currentPopup&&"LOCPopup1"!=this._currentPopup||!RSSaleManager.getInstance().getLocOocSaleData("loc")?this._currentPopup=null:(RSCasinoManager.getCasinoHUD().enableAllButtons(),RSEngine.externalGameManager.stopAutoSpin(),this._oocMinBetStatus? RSGame.getInstance().getGameManager().loadLocNotificationToaster():(RSEngine.externalGameManager.hideExternalGame(),RSGame.getInstance().getGameManager().setSideMenuVisibility(!1),this.showSalePopup("loc",!1))):(VideoManager.getInstance().showVideoPopup("ReplacePurchase",!1,"loc",this.videoManagerCallback.bind(this)),this._currentPopup=null)},checkForSubscriptionSale:function(a,b){null!=this._oocPopupAnim&&(RSEngine.screenManager.removeScreen(this._oocPopupAnim),this._oocPopupAnim=null);"1"==RSEngine.gameData.getDefaultValues().isNMISubscriptionActive&& RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&"US"==RSGame.getInstance().getUserDataManager().getMe().getCountryCode()&&GameConfig.SUBSCRIPTION_ENABLED&&null==RSSubscrptionSaleManager.getCurrentDate("day")&&!1===RSSubscrptionSaleManager.getPaymentStatus()&&RSSaleManager.getInstance().getSubscriptionSaleStatus()&&!GameConfig.SKIP_SUBSCRIPTION_SALE_POPUP&&null!=RSSaleManager.getInstance()._allSalesData.subscription.assets[0]?RSSubscrptionSaleManager.showSubscriptionSalePopup(a,this.onSubscriptionSalePopupClosed.bind(this, a,b),"Sub_LOC/OOC"):this.showSalePopup(a,b)},onSubscriptionSalePopupClosed:function(a,b,c){c||this.showSalePopup(a,b)},showSalePopup:function(a,b){null!=this._oocPopupAnim&&(RSEngine.screenManager.removeScreen(this._oocPopupAnim),this._oocPopupAnim=null);RSAnalyticsManager.getInstance().trackPlayerActionLOC(a,RSAnalyticsManager.getInstance().getCurrentMachineName(),"coins","");this.isPopupTriggered||"ooc"==a&&RSPlatformSDKManager.getInstance().setAttribute(SDK_ATTRIBUTE_TYPE.isLowOnCoins,!0);RSSaleManager.getInstance().getSaleActiveStatus()? this.isPopupTriggered||(PurchaseFlowManager.getInstance().setShowPurchaseCart(!1),RSSaleManager.getInstance().showSalePopup(!0,this.onSalePopupCloseCallback.bind(this),b),this.isPopupTriggered=!0):this.isPopupTriggered||("ooc"==a&&(this.isOOC=!0),PurchaseFlowManager.getInstance().setShowPurchaseCart(!1),RSSaleManager.getInstance().getPurchaseCartSaleStatus()?(RSSaleManager.getInstance().showPurchaseCart(),this.isPopupTriggered=!1,this._currentPopup=null):(RSSaleManager.getInstance().showSalePopupWithTag(a, !0,this.onSalePopupCloseCallback.bind(this),b),this.isPopupTriggered=!0))},onSalePopupCloseCallback:function(){RSEngine.externalGameManager.postMessageToJackpot({type:"restartKickOut"});this.isPopupTriggered=!1;this._currentPopup=null;this.saleDetails=RSSaleManager.getInstance().getSaleVO()},videoManagerPopupCloseCallback:function(){},videoManagerCallback:function(){},getCurrentPopupTriggered:function(){RSSaleManager.getInstance().getSubscriptionPurchasedStatus()&&(this._currentPopup=null);return this._currentPopup}, clearCurrentPopupTriggered:function(){this._currentPopup=null;this.isPopupTriggered=!1}});var MachineUnlockPopup=RSPopup.extend({init:function(a,b,c){this._assetList=[{name:RSGame.getInstance().getAssetPath("MachineUnlockPopup"),count:1}];this._unlockedMachineList=[];this._nextToUnlockMachines=[];for(var d=0;3>this._unlockedMachineList.length&&0<a.length;d++)this._unlockedMachineList[d]=a.pop();this._unlockedMachineList.reverse();this._nextToUnlockMachines=b;this._totalCount=this._unlockedMachineList.length+this._nextToUnlockMachines.length;this._title=1<this._unlockedMachineList.length? "NEW SLOTS UNLOCKED!":"NEW SLOT UNLOCKED!";this._4Icons=[];this._3Icons=[];this._2Icons=[];this._1Icons=[];this._array=[];this._machineDetails=null;this._i=0;this._font=RSGame.getInstance().getGameManager().getDefaultCasinoFont("small","Semibold");this._machineSelected=!1;this._callback=c;this._super.init.call(this,this._callback)},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b, c)},createCustomObject:function(a,b){switch(b.name){case "Panel":this._iconHolder=b;break;case (b.name.match(/Panel_4/)||{}).input:this._4Icons.push(b);break;case (b.name.match(/Panel_3/)||{}).input:this._3Icons.push(b);break;case (b.name.match(/Panel_2/)||{}).input:this._2Icons.push(b);break;case "Title":var c=new RSScaledLabel(this._title,RSGame.getInstance().getGameManager().getDefaultCasinoFontForHeading(),b,kTEXT_ALIGNMENT_CENTER);this.addChild(c)}return this._super.createCustomObject.call(this, a,b)},onButtonClicked:function(a){switch(a){case "KeepSpinning":case "Close":RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("MachineUnlockOut_SFX"),!1),RSAnalyticsManager.getInstance().trackMachineUnlock(RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName(),"resume_play"),this.closePopup()}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);switch(this._totalCount){case 4:this._iconArray=this._4Icons;break;case 3:this._iconArray=this._3Icons;break; case 2:this._iconArray=this._2Icons;break;case 1:this._iconArray=this._1Icons}for(var a=0;a<this._totalCount;a++){var b=!0;a<this._unlockedMachineList.length?this._machineDetails=this._unlockedMachineList[a]:(this._machineDetails=this._nextToUnlockMachines[0],b=!1);b=new RSIconHolder("MACHINE_UNLOCK_LAYOUT",this._iconHolder,"res/SlotResources/CasinoSubLobby/icons/"+this._machineDetails.imageName,this._onPlayNow.bind(this),this._machineDetails,b,this._font,!1);b.setAnchorPoint(0.5,0.5);this._array[a]= b}for(a=this._totalCount-1;0<=a;a--)this.addChild(this._array[a]);RSEngine.audioManager.stopEffect();RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("MachineUnlockIn_SFX"),!1);this._playIconAnimations()},_playIconAnimations:function(){if(this._i<this._array.length){var a=this._array[this._i],b=0;1!=this._array.length&&(b=this._iconArray[this._i].x-a.getX());a.setScale(0.5);a.actionZoom(0.2,1.3,function(){a.actionZoom(0.3,1,null);a.actionMoveBy(0.5,b,0,a.playUnlockAnimations(parseInt(a._machineDetails.isEnabled)))}); this._iterate()}},_iterate:function(){this._i+=1;this._playIconAnimations()},_onPlayNow:function(a,b,c){this._machineSelected=!0;this.closePopup();RSPlacementManager.getInstance().getInterface().clearCurrentPopupTriggered();RSGame.getInstance().getGameManager().setLocationForMachineOpenPopup(null,null);parseInt(a.gameType)!=CasinoExternalGameType.INTERNAL&&RSEngine.loginMode===LOGIN_MODE.GUEST?RSGame.getInstance().getGameManager().showLoginPopup("feature","FbConnectPopup"):(RSEngine.externalGameManager&& RSEngine.externalGameManager.unLoadExternalGame(),RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"),!1),RSAnalyticsManager.getInstance().trackGameStop(RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName(),""),a instanceof Object?(RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Slots,a.machine_identifier,"MachineUnlockPopup"),RSAnalyticsManager.getInstance().trackMachineUnlock(a.machine_identifier,"next_play")):(RSCasinoManager.getCasinoInterface().loadMachine(RSGameTypes.Slots, a,"MachineUnlockPopup",c),RSAnalyticsManager.getInstance().trackMachineUnlock(a,"next_play")),SlotsLobbyWidgetManager.getInstance().setSlotMachineData(),RSGame.getInstance().getGameManager().setMachinePlayedForAnim(a.machine_identifier))},closePopup:function(){this._super.closePopup.call(this)},unload:function(){this._super.unload.call(this)},unloadContent:function(){if(null!=this._callback||void 0!=this._callback)this._callback(this._machineSelected),this._callback=null;this._super._super.unloadContent.call(this)}});var CustomMessagePopup=RSGenericPopup.extend({_screenLayout:null,_okBtn:null,_msg:"",init:function(a,b){this._msg=a;var c={font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold")};this._super.init.call(this,b,c);this._assetList=[{name:RSGame.getInstance().getAssetPath("CustomMessagePopup"),count:1}]},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);null==this._customText&& this._subTitle.setVisible(!0)},onObjectCreated:function(a,b,c){switch(c.name){case "Ok":this._okBtn=a;break;case "SubTitle":this._subTitle=a,this._subTitle.setVisible(!1)}this._super.onObjectCreated.call(this,a,b,c)},onButtonClicked:function(a){switch(a){case "OkBtn":case "CloseBtn":this.closePopup()}},createCustomObject:function(a,b){switch(b.name){case "CustomText":this._customText=new RSScaledLabel(this._msg,RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","Semibold"),b,kTEXT_ALIGNMENT_CENTER), this.addChild(this._customText)}return this._super.createCustomObject.call(this,a,b)},unload:function(){this._screenLayout=null;this._super.unload.call(this)}});var AdsDisabledPopup=RSGenericPopup.extend({init:function(a,b){this._assetList=[{name:RSGame.getInstance().getAssetPath("PurchaseDisabledPopup"),count:1}];var c={font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold")},d=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(d);this._super.init.call(this,b,c);this._playButton=this._closeButton=null;this._source=a;this._noAdIcon=this._adIcon=this._loadingCircle=null;RSAnalyticsManager.getInstance().trackGUIEvent("purchase_disable_popup", "trigger",this._source,"")},getName:function(){return"AdsDisabledPopup"},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.addChild(this._diplayPanel)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CloseBtn":this._closeButton=a;break;case "MediumBtn":this._playButton=a;break;case "LoadingCircle":this._loadingCircle=a,this._loadingCircle.stopAnimation(), this._loadingCircle.setVisible(!1)}},createCustomObject:function(a,b){var c=RSGame.getInstance().getGameData().getPopupMessagesWithKey("purchaseDisabled");switch(b.name){case "Title":c=new RSLabelBMFont(c.messageTitleClaimed,RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","italic"),2*b.w,kTEXT_ALIGNMENT_CENTER);c.setScale(0.7);this.addChild(c);c.setCenter(b.x,b.y);break;case "Heading":this._txtHeading=new RSLabelBMFont(c.messageBodyClaimed,RSGame.getInstance().getGameManager().getDefaultCasinoFont("large", "normal"),2*b.w,kTEXT_ALIGNMENT_CENTER);this._txtHeading.setScale(0.5);this.addChild(this._txtHeading);this._txtHeading.setCenter(b.x,b.y);break;case "AdIcon":this._adIcon=RSUtils.createBasicObject(a,b);this.addChild(this._adIcon);break;case "NoAds":this._noAdIcon=RSUtils.createBasicObject(a,b),this.addChild(this._noAdIcon),this._noAdIcon.setVisible(!1)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":case "CP_Button_T1":this._playButton.setTouchEnabled(!1), this._closeButton.setTouchEnabled(!1),RSAnalyticsManager.getInstance().trackGUIEvent("purchase_disable_popup","close",this._source,""),this.closePopup()}}});var RewardReminderPopup=RSGenericPopup.extend({init:function(a){this._btnCollect=null;var b={font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold")};this._super.init.call(this,a,b)},loadContent:function(){this.layoutScreen(RSGame.getInstance().getAssetPath("RewardReminderPopup"));this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){switch(c.name){case "LargeBtn":this._btnSignUp=a}this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a,b){switch(b.name){case "MClubSuccessLabel":var c= RSGame.getInstance().getStringDictionary("MClubConnectPopup").H2,c=new RSLabelBMFont(c,RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","normal"),2*b.w,kTEXT_ALIGNMENT_CENTER);c.setScale(0.8);c.setCenter(b.x,b.y);this.addChild(c)}return this._super.createCustomObject.call(this,a,b)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},onButtonClicked:function(a){switch(a){case "CP_Button_T1":RSGame.getInstance().getGameManager().showLoginPopup("feature");this._onLoginClicked(); break;case "CloseBtn":this.closePopup()}},_onLoginClicked:function(){if("ooc"==this._titleValue&&RSEngine.loginMode==LOGIN_MODE.GUEST&&RSGameScreenManager.getInstance().getCurrentScreen()==RSGameScreens.Machine){var a=RSGame.getInstance().getGameManager().getGameType();RSGame.getInstance().getUserDataManager().getMe().setGuestUserDataForKey("gameType",a);a=RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName();RSGame.getInstance().getUserDataManager().getMe().setGuestUserDataForKey("AnalyticsMachineName", a)}RSGame.getInstance().getUserDataManager().getMe().setGuestUserDataForKey("LobbyName",RSGameScreenManager.getInstance().getCurrentScreen());RSGame.getInstance().getUserDataManager().getMe().setGuestUserDataForKey("firstLogin",!0);this.closePopup()},unload:function(){this._super.unload.call(this)}});PURCHASECARTVIEW={POWERUP:"PowerUpCart",DAUBALERT:"DaubAlertCart"}; var BingoPurchaseCartPopup=RSPopup.extend({_screenLayout:[],_currentView:null,_rect:null,_daubAlertViewCart:null,_powerUpViewCart:null,init:function(a,b,c,d){this._currentView=a;this._isForced=d||!1;this._super.init.call(this,b);a={};a.name=RSGame.getInstance().getAssetPath("BingoPurchaseCartPopup");a.count=1;this._screenLayout.push(a);RSEventManager.getInstance().addEventListener("onPurchaseSuccessClosed",this,this.closePopup.bind(this))},loadContent:function(){this.layoutScreen(this._screenLayout); this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){switch(c.name){case "Bg":this._rect=new RSRect(0,0,c.w,c.h);break;case "PowerupsBtn":a.setZOrder(a.getZOrder()+1);this._powerupBtn=a;break;case "BoostsBtn":a.setZOrder(a.getZOrder()+1);this._boostspBtn=a;break;case "PowerupBase":this._powerUpBase=a;this.removeChild(this._powerUpBase);break;case "BoostsBtnBO":this._boostsBase=a,this.removeChild(this._boostsBase)}},onButtonClicked:function(a){switch(a){case "CloseBtn":RSAnalyticsManager.getInstance().trackGUIEvent("purchase_cart", "close","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName(),"",this._analyticsEventId);this.closePopup();break;default:this.setCurrentView(a)}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._powerUpViewCart=new PowerUpPurchaseCartView(this._rect,!0,this);this._powerUpViewCart.loadLayout(RSGame.getInstance().getAssetPath("PowerUpViewCart"));this.addChild(this._powerUpViewCart);this._powerUpViewCart.setZOrder(this._powerUpViewCart.getZOrder()+2);this._daubAlertViewCart= new DaubAlertCartView(this._rect,!0,this);this._daubAlertViewCart.loadLayout(RSGame.getInstance().getAssetPath("DaubAlertViewCart"));this.addChild(this._daubAlertViewCart);this._daubAlertViewCart.setZOrder(this._daubAlertViewCart.getZOrder()+2);this.setCurrentView(this._currentView);this._analyticsEventId="";switch(this._currentView){case PURCHASECARTVIEW.POWERUP:this._analyticsEventId=this.getEventId(this._powerUpViewCart);break;case PURCHASECARTVIEW.DAUBALERT:this._analyticsEventId=this.getEventId(this._daubAlertViewCart)}this._isForced? RSAnalyticsManager.getInstance().trackGUIEvent("purchase_cart","trigger","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName(),"",this._analyticsEventId):RSAnalyticsManager.getInstance().trackGUIEvent("purchase_cart","open","open_from_"+RSAnalyticsManager.getInstance().getCurrentMachineName(),"",this._analyticsEventId)},setCurrentView:function(a){this._powerUpViewCart.setVisible(!1);this._daubAlertViewCart.setVisible(!1);switch(a){case PURCHASECARTVIEW.POWERUP:case "PowerupsBtn":this._boostsBase&& this.removeChild(this._boostsBase);this.addChild(this._powerUpBase);this._powerUpViewCart.setVisible(!0);this._daubAlertViewCart.removeCartWidget();this._powerUpViewCart.createCartWidget();this._powerUpViewCart.createMyPowerUpWidget();this._analyticsEventId=this.getEventId(this._powerUpViewCart);this._powerupBtn.setButtonSound(null);this._boostspBtn.setButtonSound(RSGame.getInstance().getAssetPath("ButtonClick_SFX"));break;case PURCHASECARTVIEW.DAUBALERT:case "BoostsBtn":this._powerUpBase&&this.removeChild(this._powerUpBase), this.addChild(this._boostsBase),this._daubAlertViewCart.setVisible(!0),this._powerUpViewCart.removeCartWidget(),this._powerUpViewCart.removeMyPowerUpWidget(),this._daubAlertViewCart.createCartWidget(),this._daubAlertViewCart&&this._daubAlertViewCart._purchaseCartWidgetController&&this._daubAlertViewCart._purchaseCartWidgetController.getModel().getPurchaseCartVO()&&(this._analyticsEventId=this.getEventId(this._daubAlertViewCart)),this._boostspBtn.setButtonSound(null),this._powerupBtn.setButtonSound(RSGame.getInstance().getAssetPath("ButtonClick_SFX"))}}, getEventId:function(a){return a&&a._purchaseCartWidgetController&&a._purchaseCartWidgetController.getModel().getPurchaseCartVO()&&a._purchaseCartWidgetController.getModel().getPurchaseCartVO().eventId?a._purchaseCartWidgetController.getModel().getPurchaseCartVO().eventId:null},closePopup:function(){RSEventManager.getInstance().removeListenersForEvent("onPurchaseSuccessClosed");this._super.closePopup.call(this)},unloadContent:function(){this._screenLayout.length=0;this._super.unloadContent.call(this)}});var DaubAlertCartView=PurchaseCartScreenView.extend({init:function(a,b,c){this._super.init.call(this,a,b,c);this._remainingTime=RSGame.getInstance().getUserDataManager().getMe().getDaubAlertTime()-TimeManager.getInstance().getCurrentServerTime()},onAssetLoaded:function(a,b){this._callBack=b;this._purchaseHolder={};this._super.onAssetLoaded.call(this,a)},createCustomObject:function(a,b){switch(b.name){case "DaubAlertCart":this._purchaseHolder=new RSPanel(b.x,b.y,b.w,b.h);this.addChild(this._purchaseHolder); this.createCartWidget();break;case "TimerTime":this._timer=new RSScaledLabel(RSUtils.formattedTime(0),RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold"),b,kTEXT_ALIGNMENT_LEFT);this._timer.setZOrder(this._timer.getZOrder()+1);this.addChild(this._timer);this._timer.setVisible(!1);break;case "TimerText":this._timerText=new RSScaledLabel("ALERT ACTIVE - TIME REMAINING : ",RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold"),b,kTEXT_ALIGNMENT_RIGHT), this.addChild(this._timerText),this._timerText.setVisible(!1)}},onBuySuccess:function(a){a&&(a.packData.type="daubAlert",RSEngine.dataManager.getMe().setLastPurchasePack(a.packData.id),RSGame.getInstance().getUserDataManager().getMe().setDaubAlertTime(a.responseObject.daubAlertTime?a.responseObject.daubAlertTime:0),RSEngine.popupManager.addPopup(new PurchaseSuccessPopup(null,a.packData,a.responseObject),!0),RSEngine.externalGameManager._updateMachineData({event:"post_message",name:"PURCHASE_SUCESS_DATA", message:"",timeStamp:TimeManager.getInstance().getCurrentServerTime()}));RSEngine.dataManager.getCurrentCoinBalance(this.coinBalanceResponse.bind(this))},coinBalanceResponse:function(a,b){"success"===a?parseInt(b.result.data.daubAlertTime)&&(this._remainingTime=b.result.data.daubAlertTime-TimeManager.getInstance().getCurrentServerTime()):this._remainingTime=this._remainingTime||0;0<this._remainingTime?(this._interval&&clearInterval(this._interval),this.startDaubTimer(),this._interval=setInterval(this.startDaubTimer.bind(this), 1E3),RSEngine.externalGameManager.setBingoData()):(this._timerText&&this._timerText.setVisible(!1),this._timer&&this._timer.setVisible(!1))},startDaubTimer:function(){0<this._remainingTime?(this._timerText&&!this._timerText.isVisible()&&this._timerText.setVisible(!0),this._timer&&!this._timer.isVisible()&&this._timer.setVisible(!0),this._timer&&this._timer.setString(RSUtils.formattedTime(this._remainingTime)),this._remainingTime--):(clearInterval(this._interval),this._timerText&&this._timerText.setVisible(!1), this._timer&&this._timer.setVisible(!1))},createCartWidget:function(){if(null!=this._purchaseHolder&&null==this._purchaseCartWidgetController){var a=[],b={},c=RSSaleManager.getInstance().getDaubAlertResourcesName();b.name=c;b.count=1;a.push(b);this._purchaseCartWidgetController=new PurchaseCartWidgetController(new PurchaseCartWidgetModel(a,"daubAlert"),new PurchaseCartWidgetView,"purchaseCart");this._purchaseCartWidgetController.getModel().setPurchaseCartItemFont(RSGame.getInstance().getGameManager().getDefaultCasinoFont("large", "bold"));this._purchaseCartWidgetController.getModel().setPurchaseCartRewardPointsFont(RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"));this._purchaseCartWidgetController.getModel().setPurchaseCartStatusPointsFont(RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"));this._purchaseCartWidgetController.getModel().setPurchaseCartPriceFont(RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold"));this._purchaseCartWidgetController.getModel().setVIPStatus(!1); RSWidgetsManager.getInstance().addController(this._purchaseCartWidgetController,"purchaseCart");this._purchaseHolder.addChild(this._purchaseCartWidgetController.getView());this._purchaseCartWidgetController.setDelegate(this)}this.onBuySuccess(null);this.coinBalanceResponse({})},removeCartWidget:function(){null!=this._purchaseCartWidgetController&&(RSWidgetsManager.getInstance().removeController(this._purchaseCartWidgetController),this._purchaseHolder.removeChild(this._purchaseCartWidgetController.getView(), !0),this._purchaseCartWidgetController=null)},onBuyClicked:function(){},onBuyFailed:function(){RSGame.getInstance().getGameManager().checkAndShowPurchaseFailurePopups(null,"Failure")},onBuyCancelled:function(){RSGame.getInstance().getGameManager().checkAndShowPurchaseFailurePopups(null,"Cancel")},initialize:function(){}});var PowerUpItem=RSDisplayObject.extend({_powerUpStripRect:null,_infoButton:null,_stripVisible:!1,_stripObj:null,_enabled:!1,init:function(a,b,c){this._super.init.call(this,a);this._powerUp=b;this._delegate=c;this.loadLayout(RSGame.getInstance().getAssetPath("MyPowerUpIcon"))},createCustomObject:function(a,b){switch(b.name){case this._powerUp:this._powerUpItem=RSUtils.createBasicObject(a,b);this._powerUpItem.addTouchListenerWithDelegate(this._delegate);this.addChild(this._powerUpItem);break;case "ItemTitleText":this._itemTitleLabel= new RSLabelBMFont("",RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","Semibold"),2*b.w,kTEXT_ALIGNMENT_CENTER);this._itemTitleLabel.setScale(0.5);this._itemTitleLabel.setCenter(b.x,b.y);this._itemTitleLabel.setString("");break;case "ItemDetailText":this._itemDetailLabel=new RSLabelBMFont("",RSGame.getInstance().getGameManager().getDefaultCasinoFont("medium","Semibold"),2*b.w,kTEXT_ALIGNMENT_CENTER);this._itemDetailLabel.setScale(0.4);this._itemDetailLabel.setCenter(b.x,b.y);this._itemDetailLabel.setString(""); break;case "RedDotLabel":this._countLabel=new RSScaledLabel("",RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold"),b,kTEXT_ALIGNMENT_CENTER),this.addChild(this._countLabel)}},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "DisablingShade":this._powerUpShade=a;this.removeChild(this._powerUpShade);this._powerUpShade.setZOrder(this._powerUpItem.getZOrder()+1);break;case "ItemBubbleBG":this._bubbleBg=a;this.removeChild(this._bubbleBg); break;case "Badge":this._badge=a,this._badge.setVisible(!1)}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.updateCount()},hideBubble:function(){this._enabled&&(this.removeChild(this._bubbleBg),this.removeChild(this._powerUpShade),this.removeChild(this._itemTitleLabel),this.removeChild(this._itemDetailLabel),this._enabled=!1,this.updateCount(),clearInterval(this._bubbleTimer))},showBubble:function(){if(this._enabled)this.hideBubble(),clearInterval(this._bubbleTimer);else{this.addChild(this._bubbleBg); this._bubbleBg.addTouchListenerWithDelegate(this._delegate);this._bubbleBg.setName(this._powerUp);this.addChild(this._itemTitleLabel);this.addChild(this._itemDetailLabel);var a=RSGame.getInstance().getGameData().getPowerupDetails(this._powerUp);this._itemTitleLabel.setString(a.name);this._itemDetailLabel.setString(a.description);this._bubbleTimer=setInterval(this.hideBubbleTimeOut.bind(this),7E3);this._enabled=!0;this._badge.setVisible(!1);this._countLabel.setVisible(!1);this.addChild(this._powerUpShade)}}, hideBubbleTimeOut:function(){this._delegate.setButtonTouch(!0);this.hideBubble()},updateCount:function(){var a=RSEngine.dataManager.getMe().getPowerUps()[this._powerUp];0<parseInt(a)&&(this._badge.setVisible(!0),this._countLabel.setVisible(!0),this._countLabel.setString(a))},unload:function(){clearInterval(this._bubbleTimer);this.unscheduleAllFunctions();this._super.unload.call(this)}});var PowerUpItemsStripView=RSDisplayObject.extend({_powerUpStripRect:null,_infoButton:null,_stripVisible:!1,_stripObj:null,_powerUpItemArray:[],_previousBubbleIndex:null,init:function(a,b){this._super.init.call(this,a);this._powerUpItemArray=[];this._delegate=b},createCustomObject:function(a,b){switch(b.type){case "PowerUpItem":var c=new RSRect(b.x,b.y,b.w,b.h),c=new PowerUpItem(c,b.name,this);c.setAnchorPoint(0.5,0.5);this.addChild(c);this._powerUpItemArray.push(c)}},onObjectCreated:function(a,b, c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "MyPowerupView":this._infoButton=a}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){b=!1;for(var d in this._powerUpItemArray)a.getName()===this._powerUpItemArray[d]._powerUp?(this._powerUpItemArray[d].showBubble(),this.setButtonTouch(!1)):this._powerUpItemArray[d].hideBubble(),!0===this._powerUpItemArray[d]._enabled&& (b=!0);b||this.setButtonTouch(!0)},setButtonTouch:function(a){this._delegate._setTouchEnabled(a)},updatePowerUpItemCount:function(a){for(var b in this._powerUpItemArray)this._powerUpItemArray[b].updateCount(a[this._powerUpItemArray[b]._powerUp])},unload:function(){this.unscheduleAllFunctions();this._super.unload.call(this)}});var PowerUpPurchaseCartView=PurchaseCartScreenView.extend({_powerUpPurchaseHolder:null,_myPowerUpsHolder:null,_powerUpPurchaseCartWidgetController:null,_maskAdded:!1,onAssetLoaded:function(a){this._super.onAssetLoaded.call(this,a)},createCustomObject:function(a,b){switch(b.type){case "Holder":switch(b.name){case "PowerUpHolder":this._powerUpPurchaseHolder=new RSPanel(b.x,b.y,b.w,b.h);this.addChild(this._powerUpPurchaseHolder);break;case "MyPowerUpWidgetHolder":this._myPowerUpsHolder=new RSPanel(b.x, b.y,b.w,b.h),this._itemStripRect=new RSRect(b.x,b.y,b.w,b.h)}}this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){PurchaseCartPopupGlobal.onButtonClicked(a)},_setTouchEnabled:function(a){null!=this._powerUpPurchaseCartWidgetController&&this._powerUpPurchaseCartWidgetController.getView().setButtonTouchStatus(a)},createCartWidget:function(){if(null!=this._powerUpPurchaseHolder&&null==this._powerUpPurchaseCartWidgetController){var a=[],b={},c=RSSaleManager.getInstance().getPurchaseCartPowerupResourcesName(); b.name=c;b.count=1;a.push(b);this._powerUpPurchaseCartWidgetController=new PurchaseCartWidgetController(new PurchaseCartWidgetModel(a,"powerup"),new PurchaseCartWidgetView(c,null),"purchaseCart");this._powerUpPurchaseCartWidgetController.getModel().setPurchaseCartItemFont(RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold"));this._powerUpPurchaseCartWidgetController.getModel().setPurchaseCartRewardPointsFont(RSGame.getInstance().getGameManager().getDefaultCasinoFont("large", "bold"));this._powerUpPurchaseCartWidgetController.getModel().setPurchaseCartStatusPointsFont(RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold"));this._powerUpPurchaseCartWidgetController.getModel().setPurchaseCartPriceFont(RSGame.getInstance().getGameManager().getNumberFontWithoutGlow("large","bold"));this._powerUpPurchaseCartWidgetController.getModel().setVIPStatus(!1);RSWidgetsManager.getInstance().addController(this._powerUpPurchaseCartWidgetController,"purchaseCart"); this._powerUpPurchaseHolder.addChild(this._powerUpPurchaseCartWidgetController.getView());this._powerUpPurchaseCartWidgetController.setDelegate(this)}},removeCartWidget:function(){null!=this._powerUpPurchaseCartWidgetController&&(RSWidgetsManager.getInstance().removeController(this._powerUpPurchaseCartWidgetController),this._powerUpPurchaseHolder.removeChild(this._powerUpPurchaseCartWidgetController.getView(),!0),this._powerUpPurchaseCartWidgetController=null)},createMyPowerUpWidget:function(){this._powerupItemStrip= new PowerUpItemsStripView(this._itemStripRect,this);this._powerupItemStrip.loadLayout(RSGame.getInstance().getAssetPath("MyPowerUpWidget"));this._powerupItemStrip.setAnchorPoint(0.5,0.5);this.addChild(this._powerupItemStrip)},removeMyPowerUpWidget:function(){this._powerupItemStrip&&this.removeChild(this._powerupItemStrip)},onBuyClicked:function(){RSAnalyticsManager.getInstance().trackInHouseEvent("user_info","powerup_balance","purchase_initiate",RSGame.getInstance().getGameManager().getPowerUpList(), "","")},onBuySuccess:function(a){RSCasinoManager.getCasinoHUD().checkSaleStatusAndStartBuyButtonAnimation();RSEngine.dataManager.getMe().setLastPurchasePack(a.packData.id);var b=a.packData.powerupPacks,c;for(c in b)b.hasOwnProperty(c)&&RSEngine.dataManager.getMe().addPowerUps(c,Number(a.packData.powerupPacks[c]));this.showMyPowerUps(a.packData.powerupPacks);RSEngine.popupManager.addPopup(new PurchaseSuccessPopup(this.closePopup.bind(this),a.packData,a.responseObject,a.sale),!0);this._powerupItemStrip&& (this.removeChild(this._powerupItemStrip),this.createMyPowerUpWidget());RSEngine.externalGameManager.setBingoData();RSEngine.externalGameManager._updateMachineData({event:"post_message",name:"PURCHASE_SUCESS_DATA",message:"",timeStamp:TimeManager.getInstance().getCurrentServerTime()});RSPlatformSDKManager.getInstance().setUserAttributePowerUp(RSGame.getInstance().getGameManager().getPowerUpTotalCount())},onBuyFailed:function(){RSGame.getInstance().getGameManager().checkAndShowPurchaseFailurePopups(null, "Failure")},onBuyCancelled:function(){RSGame.getInstance().getGameManager().checkAndShowPurchaseFailurePopups(null,"Cancel")},closePopup:function(){RSEventManager.getInstance().dispatchEvent("onPurchaseSuccessClosed")},showMyPowerUps:function(a){this._powerupItemStrip.updatePowerUpItemCount(a)}});var JackpotLoungeUpdaterVO=RSVO.extend({_mega:null,_megaBaseValue:null,_loungeDetails:null,_realPlayerCount:null,_megaIncPerSec:null,init:function(a){this._loungeDetails={};this._megaBaseValue=0;this.updateObject(a)},updateObject:function(a){this._realPlayerCount=a.realPlayerCount;this._megaIncPerSec=a.megaIncPerSec;null==this._mega?this._mega=a.megaPotAmount:0===this._realPlayerCount?(this._megaBaseValue=this._mega,this._mega+=10*this._megaIncPerSec):(this._megaBaseValue=this._mega,this._mega+=a.megaIncPerSec* a.updateInterval);for(var b=0;b<a.lounges.length;b++){var c=a.lounges[b].name;null==this._loungeDetails[c]?(this._loungeDetails[c]={},this._loungeDetails[c].majorBaseValue=0,this._loungeDetails[c].miniBaseValue=0,this._loungeDetails[c].major=a.lounges[b].majorPotAmount,this._loungeDetails[c].mini=a.lounges[b].miniPotAmount):0===this._realPlayerCount?(this._loungeDetails[c].majorBaseValue=this._loungeDetails[c].major,this._loungeDetails[c].miniBaseValue=this._loungeDetails[c].mini,this._loungeDetails[c].major+= 10*a.lounges[b].majorIncPerSec,this._loungeDetails[c].mini+=10*a.lounges[b].miniPotAmount):(this._loungeDetails[c].majorBaseValue=this._loungeDetails[c].major,this._loungeDetails[c].miniBaseValue=this._loungeDetails[c].mini,this._loungeDetails[c].major=a.lounges[b].majorPotAmount,this._loungeDetails[c].mini=a.lounges[b].miniPotAmount);this._loungeDetails[c].majorIncPerSec=a.lounges[b].majorIncPerSec;this._loungeDetails[c].minIncPerSec=a.lounges[b].minIncPerSec}},getJackpotValue:function(a,b){var c= {};if("mega"===a)return c.value=this._mega,0===this._megaBaseValue&&(this._megaBaseValue=this._mega-0.5*this._mega),c.baseValue=this._megaBaseValue,c;for(var d in this._loungeDetails)if(d===b)return d=this._loungeDetails[d],"major"===a?(c.value=d.major,c.baseValue=d.majorBaseValue):(c.value=d.mini,c.baseValue=d.miniBaseValue),c;return null},getRealPlayerCount:function(){return this._realPlayerCount},getIncrementCount:function(a,b){if("mega"===a)return this._megaIncPerSec}});var JackpotLoungeButtons=RSBasicObject.extend({_cardAnim:null,_cardShuffleAnim:null,_megaBase:null,_font:null,_base:null,_callBack:null,_lock:null,_panel:null,_timerId:null,_introAnimComplete:null,_enable:null,_particleAnim:null,_openCard:null,_initiated:null,_loopCount:0,init:function(a,b){this._super.init.call(this);this._timerId=0;this._enable=this._introAnimComplete=!1;this._font=a;this._callBack=b;this._openCard=!0;this._megaBase=this._jlBase=null;this._initiated=!1;this.loadLayout(RSGame.getInstance().getAssetPath("JackpotButton"))}, handleObjectTouchAt:function(a,b,c){},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){if("ClickObject"===a._ccObject._name&&!this._clicked&&this._enable)if(RSEngine.loginMode===LOGIN_MODE.GUEST)RSGame.getInstance().getGameManager().showLoginPopup("feature","JackpotLounge");else if(this._locked){var d=this._lock.getX(),e=this;this._clicked=!0;a=this._lock.actionMoveToFro(0.2,this._lock.getX()-5,this._lock.getX()+5,this._lock.getY(),this._lock.getY(),5,function(){e._clicked= !1;e._lock.setX(d)});RSTweener.easeSineIn(a);var f=this._lock1.getX(),e=this;this._clicked=!0;a=this._lock1.actionMoveToFro(0.2,this._lock1.getX()-5,this._lock1.getX()+5,this._lock1.getY(),this._lock1.getY(),5,function(){e._clicked=!1;e._lock1.setX(f)});RSTweener.easeSineIn(a);this._JLtoolTip=new JackpotLoungeMessageBubble;RSEngine.popupManager.addPopup(this._JLtoolTip,!1,!1,!1)}else this._clicked=!0,RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"),!1),this._callBack&& !this._locked&&this._callBack.call(this)},onObjectCreated:function(a,b,c){switch(c.name){case "JLIconBase":this._jlIconBase=a;this._jlIconBase.setVisible(!1);break;case "ClickObject":a.addTouchListenerWithDelegate(this);break;case "JLIcon":this._jlBase=a;this._jlBase.setVisible(!1);break;case "Mega":this._megaBase=a;this._megaBase.setVisible(!1);break;case "JLIconBaseAnim":this._jlBaseAnim=a;this._jlBaseAnim.setVisible(!1);break;case "ParticleAnim":this._particleAnim=a;this._particleAnim.stopAnimation(); this._particleAnim.setVisible(!1);break;case "JLCardIntroAnim":this._cardAnim=a;this._cardAnim.stopAnimation();this._cardAnim.setVisible(!1);break;case "JLCardShuffleAnim":this._cardShuffleAnim=a,this._cardShuffleAnim.stopAnimation(),this._cardShuffleAnim.setVisible(!1)}},handleButtonClick:function(a,b){switch(b){case ccui.Widget.TOUCH_BEGAN:this._particleAnim.setVisible(!0);this._particleAnim.playAnimation(1,0.33);break;case ccui.Widget.TOUCH_ENDED:switch(a._name){case "btnJackpotLounge":if(!this._enable)break; if(RSEngine.loginMode===LOGIN_MODE.GUEST){RSGame.getInstance().getGameManager().showLoginPopup("feature","JackpotLounge");break}if(this._locked){var c=this._lock.getX(),d=this;a.setTouchEnabled(!1);var e=this._lock.actionMoveToFro(0.2,this._lock.getX()-5,this._lock.getX()+5,this._lock.getY(),this._lock.getY(),5,function(){a.setTouchEnabled(!0);d._lock.setX(c)});RSTweener.easeSineIn(e);break}clearTimeout(this._timerId);a.setTouchEnabled(!1);this._callBack&&!this._locked&&this._callBack.call(this)}}}, createCustomObject:function(a,b){switch(b.name){case "MegaText":this._txtMegaJackpot=new RSScaledLabel("0",this._font,b,kTEXT_ALIGNMENT_CENTER);this._txtMegaJackpot.setColor(new RSColor(250,35,35));this.addChild(this._txtMegaJackpot);this._txtMegaJackpot.setVisible(!1);break;case "Lock":this._lock=RSUtils.createBasicObject(a,b);this._lock.setVisible(!1);this._lock1=RSUtils.createBasicObject(a,b);this._lock1.setVisible(!1);break;case "JLPanel":this._jlPanel=new RSPanel(b.x,b.y,b.w,b.h),this._jlPanel.addChild(this._jlIconBase), this._jlPanel.addChild(this._particleAnim),this._jlPanel.addChild(this._jlBaseAnim),this._jlPanel.addChild(this._cardShuffleAnim),this._jlPanel.addChild(this._jlBase),this._jlPanel.addChild(this._lock),this.addChild(this._jlPanel)}},enableButton:function(a){this._enable=a},showButton:function(){this._jlAnimVisibility(!0);this.playIntroAnimation()},startToggleAnimation:function(){this._cardShuffleAnim.stopAnimation();this._jlPanel.setScaleX(1);var a=this._jlPanel.actionScale(0.35,0,1,this.jlScaleDownCompleted.bind(this)); RSTweener.easeSineIn(a)},jlScaleDownCompleted:function(){this._jlAnimVisibility(!1);this._jlIconBase.setVisible(!0);this._vikingAnimVisibility(!0)},_vikingAnimVisibility:function(a){this._locked?this._lock1.setVisible(!0):this._lock1.setVisible(!1)},_jlAnimVisibility:function(a){this._particleAnim.setVisible(a);this._jlBaseAnim.setVisible(a);this._jlIconBase.setVisible(a);this._cardShuffleAnim.setVisible(a);this._jlBase.setVisible(a);this._locked?this._lock.setVisible(!0):this._lock.setVisible(!1)}, playIntroAnimation:function(){this._cardAnim.setVisible(!0);this._cardAnim.playAnimation(1,0.33);this.onIntroAnimationComplete()},onIntroAnimationComplete:function(){this._introAnimComplete=!0;this._lock.setVisible(this._locked);this._locked||this._playCardOpenCloseAnimation()},_playCardOpenCloseAnimation:function(){this._cardAnim&&this._cardAnim.setVisible(!1);null!=this._particleAnim&&null!=this._cardShuffleAnim&&(this._openCard?(this._openCard=!1,this._particleAnim.setVisible(!0),this._particleAnim.playAnimation(1, 0.33),this._cardShuffleAnim.setVisible(!0),this._cardShuffleAnim.playAnimation(1,0.33),this._timerId=setTimeout(this._playCardOpenCloseAnimation.bind(this),1E3)):(this._loopCount+=1,this._openCard=!0,this._particleAnim.setVisible(!0),this._particleAnim.playAnimation(1,0.33),this._cardShuffleAnim.setVisible(!0),this._cardShuffleAnim.playReverseAnimation(1,0.33),this._timerId=setTimeout(this._playCardOpenCloseAnimation.bind(this),3E3)))},onLayoutCompleted:function(){this._locked=RSGame.getInstance().getLevelManager().getCurrentLevel()< GameConfig.JACKPOT_LOUNGE_LEVEL;this._txtMegaJackpot.setVisible(!1)},onJackpotData:function(){},setTouchEnabled:function(a){this._cardAnim.setTouchEnabled(a)},unload:function(){this.removeChild(this._jlPanel);RSEventManager.getInstance().removeEventListenersIn(this);clearInterval(this._timerId);this._super.unload.call(this)}});var JackpotLoungeScreen=RSGameScreen.extend({init:function(a){this._super.init.call(this);this.callBack=a;this._JLOpenPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(this._JLOpenPanel);this._JLOpenPanel.setVisible(!1);this.layoutScreen(RSGame.getInstance().getAssetPath("JackpotLoungeScreen"),1)},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){switch(b.name){case "Bg":var c=RSUtils.createBasicObject(a, b);this._JLOpenPanel.addChild(c);break;case "CoinLeft":c=RSUtils.createBasicObject(a,b);this._JLOpenPanel.addChild(c);break;case "CoinRight":c=RSUtils.createBasicObject(a,b);this._JLOpenPanel.addChild(c);break;case "BgPart":c=RSUtils.createBasicObject(a,b);GameConfig.VIKING_LOUNGE_ENABLED&&this._JLOpenPanel.addChild(c);break;case "TakeMeBtn":this._takeMeBtn=RSUtils.createButton(a,b);if(GameConfig.VIKING_LOUNGE_ENABLED)break;else this.addTouchListenerToButton(this._takeMeBtn),this._JLOpenPanel.addChild(this._takeMeBtn); break;case "CloseBtn":this._closeBtn=RSUtils.createButton(a,b),GameConfig.VIKING_LOUNGE_ENABLED||(this.addTouchListenerToButton(this._closeBtn),this._JLOpenPanel.addChild(this._closeBtn))}this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._JLOpenPanel.actionZoom(0,0,this.onJLOpenPanelScaledDownComplete.bind(this));this._super.onLayoutCompleted.call(this)},onJLOpenPanelScaledDownComplete:function(){this._JLOpenPanel.setVisible(!0); this._JLOpenPanel.actionScaleTo(0.4,0.9,this._onZoomCompleted.bind(this));GameConfig.VIKING_LOUNGE_ENABLED&&RSUtils.callFunctionWithDelay(3.5,this,this.onJLOpenPanelScaleUpComplete.bind(this))},_onZoomCompleted:function(){GameConfig.VIKING_LOUNGE_ENABLED?this._JLOpenPanel.actionScaleTo(0.3,0.85,null):(RSGame.getInstance().getUserDataManager().getMe().setJLTriggerStatus(!1),this._JLOpenPanel.actionScaleTo(0.3,0.85,this.onJLOpenPanelScaleUpComplete.bind(this)))},onJLOpenPanelScaleUpComplete:function(){GameConfig.VIKING_LOUNGE_ENABLED? this._JLOpenPanel.actionZoom(0.3,0,this.onJLOpenComplete.bind(this)):RSEngine.audioManager.fadeInMusic(2,this.getDisplayObject())},onJLOpenComplete:function(a){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("SurfacingScreenExit_SFX"),!1);this.callBack&&this.callBack.call(this,a?a:null)},onButtonClicked:function(a){var b="open_from_"+RSGameScreenManager.getInstance().getCurrentScreen();switch(a){case "TakeMeBtn":GlobalVars.isJLLoadingInProgress=!0;this._takeMeBtn.setTouchEnabled(!1); RSAnalyticsManager.getInstance().trackGUIEvent("jackpot_lounge_surfacing","click",b,"","");RSGame.getInstance().getGameManager().loadJackpotLounge(null,null,null,null,null,"play",null);this._JLOpenPanel.actionZoom(0.1,0,this.onJLOpenComplete.bind(this,!0));break;case "CloseBtn":this._closeBtn.setTouchEnabled(!1),RSAnalyticsManager.getInstance().trackGUIEvent("jackpot_lounge_surfacing","close",b,"",""),this._JLOpenPanel.actionZoom(0.3,0,this.onJLOpenComplete.bind(this,!1))}},unloadContent:function(){this._super.unloadContent.call(this)}});var JLPickBonusScreen=RSGameScreen.extend({init:function(a){this._super.init.call(this);this.callBack=a;this._JLInfoPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(this._JLInfoPanel);this._JLInfoPanel.setVisible(!1);this.layoutScreen(RSGame.getInstance().getAssetPath("JLPickBonusScreen"),1)},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){switch(b.name){case "Bg":this._bg=RSUtils.createBasicObject(a, b);this._JLInfoPanel.addChild(this._bg);break;case "CoinLeft":var c=RSUtils.createBasicObject(a,b);this._JLInfoPanel.addChild(c);break;case "CoinRight":c=RSUtils.createBasicObject(a,b),this._JLInfoPanel.addChild(c)}this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._JLInfoPanel.actionZoom(0,0,this.onJLInfoPanelScaledDownComplete.bind(this));this._super.onLayoutCompleted.call(this)},onJLInfoPanelScaledDownComplete:function(){this._JLInfoPanel.setVisible(!0); this._JLInfoPanel.actionScaleTo(0.4,0.9,this._onZoomCompleted.bind(this));RSUtils.callFunctionWithDelay(3.5,this,this.onJLInfoPanelScaleUpComplete.bind(this))},_onZoomCompleted:function(){this._JLInfoPanel.actionScaleTo(0.3,0.85,null)},onJLInfoPanelScaleUpComplete:function(){this._JLInfoPanel.actionZoom(0.3,0,this.onJLInfoComplete.bind(this))},onJLInfoComplete:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("SurfacingScreenExit_SFX"),!1);this.callBack&&this.callBack.call()}, unloadContent:function(){this._super.unloadContent.call(this)}});var UnlockedJLScreen=RSGameScreen.extend({init:function(a){this._super.init.call(this);this.callBack=a;this._rayAnim2=this._rayAnim1=null;this._unlockedJLPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(this._unlockedJLPanel);this._unlockedJLPanel.setVisible(!1);this.layoutScreen(RSGame.getInstance().getAssetPath("UnlockedJL"),2);a="open_from_"+RSGameScreenManager.getInstance().getCurrentScreen();RSAnalyticsManager.getInstance().trackGUIEvent("jackpot_lounge_surfacing", "trigger",a,"","")},loadContent:function(){this._super.loadContent.call(this)},onSequencerDataLoaded:function(){this._animationSequencerObject.playSequenceWithKey("init")},createCustomObject:function(a,b){switch(b.name){case "Bg":this._bg=RSUtils.createBasicObject(a,b);this._unlockedJLPanel.addChild(this._bg);break;case "GlowClockwise":this._rayAnim1=RSUtils.createBasicObject(a,b);this._unlockedJLPanel.addChild(this._rayAnim1);break;case "GlowAntiClockwise":this._rayAnim2=RSUtils.createBasicObject(a, b);this._unlockedJLPanel.addChild(this._rayAnim2);break;case "CoinLeft":var c=RSUtils.createBasicObject(a,b);this._unlockedJLPanel.addChild(c);break;case "CoinRight":c=RSUtils.createBasicObject(a,b);this._unlockedJLPanel.addChild(c);break;case "Icon":this._icon=RSUtils.createAnimation(a,b,1);this._icon.stopAnimation();this._unlockedJLPanel.addChild(this._icon);break;case "Unlocked":this._unlockAnim=RSUtils.createAnimation(a,b,1),this._unlockAnim.stopAnimation(),this._unlockedJLPanel.addChild(this._unlockAnim)}-1!= b.name.indexOf("PurpleStar")&&(this._Purplestar=RSUtils.createBasicObject(a,b),this._starPos=new RSPanel(b.x,b.y,b.w,b.h),this._Purplestar.setPosition(this._starPos.getRect().getWidth()/2,this._starPos.getRect().getHeight()/2),this._starPos.addChild(this._Purplestar),this._unlockedJLPanel.addChild(this._starPos),this[b.name]=this._Purplestar);-1!=b.name.indexOf("PinkStar")&&(this._Pinkstar=RSUtils.createBasicObject(a,b),this._starPos=new RSPanel(b.x,b.y,b.w,b.h),this._Pinkstar.setPosition(this._starPos.getRect().getWidth()/ 2,this._starPos.getRect().getHeight()/2),this._starPos.addChild(this._Pinkstar),this._unlockedJLPanel.addChild(this._starPos),this[b.name]=this._Pinkstar);-1!=b.name.indexOf("WhiteStar")&&(this._Whitestar=RSUtils.createBasicObject(a,b),this._starPos=new RSPanel(b.x,b.y,b.w,b.h),this._Whitestar.setPosition(this._starPos.getRect().getWidth()/2,this._starPos.getRect().getHeight()/2),this._starPos.addChild(this._Whitestar),this._unlockedJLPanel.addChild(this._starPos),this[b.name]=this._Whitestar);-1!= b.name.indexOf("GreenStar")&&(this._Greenstar=RSUtils.createBasicObject(a,b),this._starPos=new RSPanel(b.x,b.y,b.w,b.h),this._Greenstar.setPosition(this._starPos.getRect().getWidth()/2,this._starPos.getRect().getHeight()/2),this._starPos.addChild(this._Greenstar),this._unlockedJLPanel.addChild(this._starPos),this[b.name]=this._Greenstar);this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("JLCurtainAnimation_SFX"), !1);this._unlockedJLPanel.actionZoom(0,0,this.onJLUnlockPanelScaledDownComplete.bind(this));this.playGlowAnimation();this._super.onLayoutCompleted.call(this);this._animationSequencerObject=new RSAnimationSequencer(RSGame.getInstance().getAssetFolder("UnlockedJL"),"UnlockedJLScreenConfig.json",this,this);this._animationSequencerObject.loadAnimData()},onJLUnlockPanelScaledDownComplete:function(){this._unlockedJLPanel.setVisible(!0);this._unlockedJLPanel.actionScaleTo(0.4,0.9,this._onZoomCompleted.bind(this))}, _onZoomCompleted:function(){this._unlockedJLPanel.actionScaleTo(0.3,0.85,this.onJLUnlockPanelScaleUpComplete.bind(this))},onJLUnlockPanelScaleUpComplete:function(){this._unlockAnim.playAnimation(1,0.5,null);RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("LockAnim_SFX"),!1);RSUtils.callFunctionWithDelay(2.8,this,this.onAnimComplete.bind(this))},onAnimComplete:function(){this._unlockedJLPanel.actionZoom(0.3,0,this.onJLUnlockComplete.bind(this))},onJLUnlockComplete:function(){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("SurfacingScreenExit_SFX"), !1);RSEngine.dataManager.getMe().setJLSurfacingShown();this.callBack&&this.callBack.call()},playGlowAnimation:function(){this._rayAnim1.actionRotateBy(0.1,-2,-1);this._rayAnim2.actionRotateBy(0.1,2,-1);this._icon.playAnimation(1,0.5,null)},unloadContent:function(){this._super.unloadContent.call(this)}});var IntroScreenForJL=RSCurtainRaiserScreen.extend({init:function(a){this._super.init.call(this,RSGame.getInstance().getAssetPath("CurtainRaiser"));this.callBack=a;this._particleEmitter=null;RSEngine.audioManager.fadeMusicVolumeTo(2,0.2,this.getDisplayObject())},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._emitterObject= new RSPanel(0,0,0,0);this.addChild(this._emitterObject);this._emitterObject.setZOrder(1);this._super.onLayoutCompleted.call(this);RSUtils.callFunctionWithDelay(1.4,this,this._playEmitter.bind(this))},_playEmitter:function(){this.loadParticleEffect();this._particleEmitter.startEmitter();RSUtils.callFunctionWithDelay(0.3,this,this._startScreenShow.bind(this))},_startScreenShow:function(){this._emitterObject.setZOrder(0);this._JLunlockSCreen=new UnlockedJLScreen(this.onJLUnlockAnimComplete.bind(this), this._isShowVIPActive);this.addChild(this._JLunlockSCreen);RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("SurfacingScreenEntry_SFX"),!1)},firstSectionComplete:function(){},onJLUnlockAnimComplete:function(){this.removeChild(this._JLunlockSCreen);this._JLInfoScreen=new JLPickBonusScreen(this.onJLInfoAnimComplete.bind(this));this.addChild(this._JLInfoScreen);RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("SurfacingScreenEntry_SFX"),!1)},onJLInfoAnimComplete:function(){this.removeChild(this._JLInfoScreen); this._JLOpenScreen=new JackpotLoungeScreen(this.onJLOpenAnimComplete.bind(this));this.addChild(this._JLOpenScreen);RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("SurfacingScreenEntry_SFX"),!1)},onJLOpenAnimComplete:function(a){this.removeChild(this._JLOpenScreen);this.callBack&&this.callBack.call(this,a)},loadParticleEffect:function(){cc.spriteFrameCache.addSpriteFrames("res/PlatformWidgets/CurtainRaiser/StartAnim_00-hd.plist");var a=new RSEmitterParticleParams;a._spriteFrames.push("StartAnim_00/Star1.png"); a._spriteFrames.push("StartAnim_00/Star2.png");a._spriteFrames.push("StartAnim_00/Star3.png");a._spriteFrames.push("StartAnim_00/Star4.png");a._spriteFrames.push("StartAnim_00/Star5.png");a._startScale=0.6;a._startScaleVariance=0;a._endScale=4;a._endScaleVariance=0.2;a._scalingDuration=1;a._startDelay=0.5;a._startDelayVariance=1.5;a._deviation=600;a._deviationVariance=100;a._speed=900;a._360rotationDuration=0.5;a._tweenRate=0.5;a._spriteAnimationSpeed=0.25;a._origin=new RSPoint(RSEngine.screenWidth/ 2,RSEngine.screenHeight/2);a._originVariance=new RSPoint(20,20);a._displacement=new RSPoint(0,0);a._displacementVariance=new RSPoint(RSEngine.screenWidth/2,RSEngine.screenHeight/2);var b=RSGame.getInstance().getGameManager().getCustomizedParticleCount()?RSGame.getInstance().getGameManager().getCustomizedParticleCount():200;this._particleEmitter=new RSCustomAnimationEmitter(a,!1,RSCustomEmitterType.FIREWORK,b);this._emitterObject.addChild(this._particleEmitter);this._particleEmitter.loadEmitter()}, unloadContent:function(){this._super.unloadContent.call(this)}});var LoginSuccessPopup=RSGenericPopup.extend({init:function(a,b,c){this._super.init.call(this,a);this._callback=a;this._collectButton=this._emailReward=this._txtMessage=null;this._textFont=b;a=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(a);this._assetList=c?c:[{name:RSGame.getInstance().getAssetPath("LoginSuccessPopup"),count:1}]},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},createCustomObject:function(a,b){switch(b.name){case "TextLabel":var c= RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","normal");this._textFont&&(c=this._textFont);this._txtMessage=new RSScaledLabel(this._msg,c,b,kTEXT_ALIGNMENT_CENTER);this.addChild(this._txtMessage)}return this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "Collect":this._collectButton=a;break;case "CloseBtn":this._closeButton=a}},onButtonClicked:function(a){switch(a){case "Collect":case "CloseBtn":this._collectButton.setTouchEnabled(!1), this._closeButton.setTouchEnabled(!1),RSGame.getInstance().getGameManager().showOverlayLayer(),RSEngine.dataManager.updateSyncBonus(this.onWelcomeBonusUpdated.bind(this),this.onWelcomeBonusUpdateFailed.bind(this),this._emailReward)}},onCallBackOnCoinSuccess:function(){this.playAnimation()},playAnimation:function(){RSGame.getInstance().getGameManager().hideOverlayLayer();var a=new RSPoint(this._collectButton.getX(),this._collectButton.getY());RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(a, this._diplayPanel,this.onCoinAnimComplete.bind(this))},onCoinAnimComplete:function(){this.closePopup()},onWelcomeBonusUpdateFailed:function(){RSEngine.dataManager.updateSyncBonus(this.onWelcomeBonusUpdated.bind(this),this.onWelcomeBonusUpdateFailed.bind(this),this._emailReward)},onWelcomeBonusUpdated:function(a){this.onCallBackOnCoinSuccess();RSGame.getInstance().getUserDataManager().getMe().setWelcomeBonusAwarded(!0);RSGame.getInstance().getUserDataManager().getMe().setLoginRewardStatus(!0);RSCasinoManager.addPrimaryCurrencyForDisplay("guest_sync", parseInt(a.result.data.data.coins),!0);if(RSEngine.loginMode==LOGIN_MODE.EMAIL){var b="google"==RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-loginType")?"google":RSLoginManager.getInstance().getCookie(GameConfig.COOKIE_PREFIX+"-loginType"),c="_login";b.includes("email")&&(c="_bonus");RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free,b+c,a.result.data.data.coins,"onetime_bonus")}else RSAnalyticsManager.getInstance().trackPrimarySource(RSAnalyticsSource.free, "fb_login",a.result.data.data.coins,"onetime_bonus");RSAnalyticsManager.getInstance().trackGuestSync();b=a=b="";b=RSEngine.dataManager.getMe().getGuestLastLobbyName();a=RSEngine.dataManager.getMe().getGuestSyncPopupName();b==RSGameScreens.Machine?(b=RSEngine.dataManager.getMe().getGuestMachineAnalyticsName(),RSEngine.loginMode==LOGIN_MODE.FACEBOOK||RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK?RSAnalyticsManager.getInstance().trackFacebookSync(b,"",RSEngine.loginMode,a):RSAnalyticsManager.getInstance().trackFacebookSync(b, "",LOGIN_MODE.EMAIL,a)):RSEngine.loginMode==LOGIN_MODE.FACEBOOK||RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK?RSAnalyticsManager.getInstance().trackFacebookSync(b,"",RSEngine.loginMode,a,""):RSAnalyticsManager.getInstance().trackFacebookSync(b,"",LOGIN_MODE.EMAIL,a,"")},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.addChild(this._diplayPanel);var a=RSEngine.gameData.getDefaultValues();this._emailReward=parseInt(a.emailReward);this._txtMessage.setString(RSUtils.formatNumberWithComma(this._emailReward))}});var MemoryWarningPopup=RSGenericPopup.extend({init:function(a,b){this._super.init.call(this);this._gameManager=RSGame.getInstance().getGameManager();this._machineData=a;(this._JLData=b)?this.machineIdentifier=b.machineIdentifier:a&&(this.machineIdentifier=a.machineAnalyticsName);RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI,"low_memory_popup","trigger","","open_from_"+this.machineIdentifier,"","")},loadContent:function(){this.layoutScreen(RSGame.getInstance().getAssetPath("MemoryWarningPopup")); this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "ContinueBtn":this._continueBtn=a}},createCustomObject:function(a,b){switch(b.name){case "SubTitle":var c=RSGame.getInstance().getStringDictionary("MemoryWarningPopup").H2,c=new RSScaledLabel(c,RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","Semibold"),b,kTEXT_ALIGNMENT_CENTER);c.setCenter(b.x,b.y);c.setScale(0.53);this.addChild(c);break;case "Title":c= RSGame.getInstance().getStringDictionary("MemoryWarningPopup").H1,c=new RSScaledLabel(c,RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","black"),b,kTEXT_ALIGNMENT_CENTER),c.setCenter(b.x,b.y),c.setScale(0.75),c.setPosition(b.x,b.y+10),this.addChild(c)}return this._super.createCustomObject.call(this,a,b)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},onButtonClicked:function(a){switch(a){case "ContinueBtn":this._machineData&&this._machineData.memoryPopupTrigger&& (RSEngine.externalGameManager.unLoadExternalGame(),RSGameScreenManager.getInstance().removeAllScreensExceptMainLobby(),GlobalVars.isjackpotLoaded=!1);this._JLData&&this._JLData.loungeName?RSGame.getInstance().getGameManager().loadAfterJackpotLounge(this._JLData.machineIdentifier,this._JLData.machineName,this._JLData.loungeName,this._JLData.isSpinGame,this._JLData.imagePath,this._JLData.triggeredFromJL,this._JLData.closeCallback):RSGame.getInstance().getGameManager().loadMachine(this._machineData.machineType, this._machineData.machineAnalyticsName,this._machineData.triggeredFrom,this._machineData.previewType,this._machineData.defaultBet);RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI,"low_memory_popup","continue","","open_from_"+this.machineIdentifier,"","");this.closePopup();break;case "CloseBtn":this._JLData&&this._JLData.closeCallback&&this._JLData.closeCallback(),this.closePopup(),RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.GUI,"low_memory_popup","close", "","open_from_"+this.machineIdentifier,"","")}},unload:function(){this._super.unload.call(this)}});var JackpotLoungeMessageBubble=RSPopup.extend({_assetList:null,_toolTipCloseTimer:null,init:function(){this._super.init.call(this);this._assetList=[{name:RSGame.getInstance().getAssetPath("JackpotLoungeMessageBubble"),count:1}]},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._toolTipCloseTimer=RSUtils.callFunctionWithDelay(3,this,this.closePopup.bind(this))},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},createCustomObject:function(a, b){b.name&&(this._bubbleText=new RSUtils.createBasicObject(a,b),this.addChild(this._bubbleText),this._bubbleText.setVisible(!0))},handleTouchEndAt:function(a,b,c){this.closePopup()},closePopup:function(){this._toolTipCloseTimer=null;this._super.closePopup.call(this)}});var GenericTooltip=RSPopup.extend({_assetList:null,_toolTipCloseTimer:null,init:function(a,b,c){this._super.init.call(this,c);this._assetList=a;this._closeTime=void 0!=b||null!=b?b:5},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._toolTipCloseTimer=RSUtils.callFunctionWithDelay(this._closeTime,this,this.closePopup.bind(this))},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){},createCustomObject:function(a, b){},handleTouchEndAt:function(a,b,c){this.closePopup()},closePopup:function(){this._toolTipCloseTimer=null;this._super.closePopup.call(this)}});var RSPlayerConnectManager={handleMachineEvents:function(a,b,c,d,e,f){switch(a){case "redeemCoins":this._redeemItem(b,c,d,e);break;case "connectClubM":a=null;b&&(a=b);RSGame.getInstance().getGameManager().connectPlayerIdWithCasino(null,this.mClubConnectUpdate.bind(this),a,"loyalty_mall");break;case "loyaltymall_player_action":"loyalty_mall_contact_us"==b&&("banned"==e?window.open(RSEngine.gameData.getDefaultValues().playerConnectContactLink,"_blank"):showHelpShift(),RSAnalyticsManager.getInstance().trackPlayerAction(b, c,d,e,"",""));"loyalty_mall_privacy_policy"==b&&(RSAnalyticsManager.getInstance().trackPlayerAction(b,c,"","","",""),window.open(RSGame.getInstance().getGameData().getDefaultValues().playerConnectPrivacyPolicy,"_blank"));"loyalty_mall_terms"==b&&(RSAnalyticsManager.getInstance().trackPlayerAction(b,c,"","","",""),window.open(RSGame.getInstance().getGameData().getDefaultValues().playerConnectTos,"_blank"));"loyalty_mall_social"==b&&(RSAnalyticsManager.getInstance().trackPlayerAction(b,c,"","","",""), "click_fb"==c&&window.open(RSGame.getInstance().getGameData().getDefaultValues().playerConnectFbUrl,"_blank"),"click_ig"==c&&window.open(RSGame.getInstance().getGameData().getDefaultValues().playerConnectInstagramUrl,"_blank"),"click_twt"==c&&window.open(RSGame.getInstance().getGameData().getDefaultValues().playerConnectTwitterUrl,"_blank"));"loyalty_mall_item_desc"==b&&RSAnalyticsManager.getInstance().trackPlayerAction(b,c,"",e,"","");"loyalty_mall_confirmpopup"==b&&RSAnalyticsManager.getInstance().trackPlayerAction(b, c,d,e,"","");"show_disclaimer"==b&&window.open(c);"loyalty_mall_info_popup"==b&&RSAnalyticsManager.getInstance().trackPlayerAction(b,c,"","","","");break;case "loyaltymall_game_action":"loyalty_mall_orders"==b[0]&&RSAnalyticsManager.getInstance().trackInHouseEvent("gui",b[0],b[1],"","","");"loyalty_mall_user_info"==b[0]&&RSAnalyticsManager.getInstance().trackInHouseEvent("gui",b[0],b[1],b[2],b[3],"");"loyalty_mall_success"==b[0]&&RSAnalyticsManager.getInstance().trackInHouseEvent("gui",b[0],b[1], b[2],b[3],b[4]);"support"==b[0]&&"open"==b[1]&&(document.getElementById("helpshift").src=GameConfig.HELPSHIFT_URL+"?contact\x3d1",showHelpShift(b[2]));"loyalty_mall_maxlimit"!=b[0]&&"loyalty_mall_banned"!=b[0]&&"loyalty_mall_block"!=b[0]||RSAnalyticsManager.getInstance().trackInHouseEvent("gui",b[0],b[1],b[2],b[3],b[4]);break;case "loyaltymall_economy_event":RSAnalyticsManager.getInstance().trackInHouseEvent("economy",b,c,d,e,f);break;case "loyaltymall_analytics":RSAnalyticsManager.getInstance().trackInHouseEvent(b[0], b[1],b[2],b[3],b[4],b[5])}},sendLMJSONRPCRequest:function(a,b,c,d,e,f){RSEngine.networkManager.sendJSONRPCRequest(b+"."+c,d,this.onLmRequestResponse.bind(this,c),this.onLmRequestResponse.bind(this,c))},onLmRequestResponse:function(a,b){var c={type:"genericResponse",method:a,response:btoa(encodeURIComponent(JSON.stringify(b)))};RSEngine.externalGameManager.updateLoyaltyMallData(c)},_redeemItem:function(a,b,c,d){RSEngine.externalGameManager&&RSEngine.externalGameManager.hideExternalGame();RSEngine.screenManager.addOverlay(); var e=TimeManager.getInstance().getCurrentServerTime(),f={userId:RSEngine.dataManager.getMe().getId(),productId:a,price:b,sessionId:GlobalVars.sessionId};d&&(f.categoryId=d);d=[];d[0]=JSON.stringify(f);d[1]=e;c=calcMD5(d.join("|")+"|"+c);RSEngine.dataManager.redeemItem(f,e,c,this._onRedeemItemSucces.bind(this,b),this._onRedeemItemFailed.bind(this,a))},_onRedeemItemSucces:function(a,b){RSEngine.screenManager.removeOverlay();cc.log("on succes");200==b.result.status&&(RSEngine.externalGameManager.updateLoyaltyMallData({status:!0, rewardpoints:b.result.data.rewardPoints,type:"redeem"}),RSAnalyticsManager.getInstance().trackInHouseEvent("economy","free_source_coins","loyalty_mall_coin_redemption",b.result.data.coinRewarded,b.result.data.name,b.result.data.OrderId),b.result.data.free_claimed_points&&0<parseInt(b.result.data.free_claimed_points)?(RSAnalyticsManager.getInstance().trackInHouseEvent("economy","free_sink_points","loyalty_reward_redemption",b.result.data.free_claimed_points,b.result.data.name,b.result.data.OrderId), RSAnalyticsManager.getInstance().trackInHouseEvent("economy","paid_sink_points","loyalty_reward_redemption",b.result.data.paid_claimed_points,b.result.data.name,b.result.data.OrderId)):RSAnalyticsManager.getInstance().trackInHouseEvent("economy","paid_sink_points","loyalty_reward_redemption",a,b.result.data.name,b.result.data.OrderId),RSAnalyticsManager.getInstance().trackGUIEvent("loyalty_mall_success","trigger","",b.result.data.name,b.result.data.OrderId,""),RSEngine.popupManager.addPopup(new RSPlayerConnectRedeemRewardPopup(b.result.data.coinRewarded, b.result.data.name,b.result.data.OrderId),!0))},_onRedeemItemFailed:function(a){console.log("On reddem failed")},mClubConnectUpdate:function(a,b){if(null!=a){var c={connected:a,clubMNumber:b,type:"clubM"};RSEngine.externalGameManager._updateMachineData({event:"post_message",name:"loyaltymall",message:c,timeStamp:TimeManager.getInstance().getCurrentServerTime()});console.log(JSON.stringify(c))}}};var RSPlayerConnectRedeemRewardPopup=RSGenericPopup.extend({init:function(a,b,c){var d=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(d);this._titleTextEnergy=this._titleText=this._powerupIcon=null;this._energyAwared=this._coinAwarded=0;this._coinIcon=this._heading=this._subHeading=null;this._coinsAwarded=a;this._itemName=b;this._orderId=c;RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("RSPlayerConnectRedeemPopup"),"PlayerConnectPopupFontConfig.json"); this._assetList=[{name:RSGame.getInstance().getAssetPath("RSPlayerConnectRedeemPopup"),count:1}];a=null;a="MSP"==GameConfig.GAME_ID?{font:RSGame.getInstance().getGameManager().getGenericButtonFont()}:"UP"==GameConfig.GAME_ID?{font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("largeOrange","black")}:{font:RSGame.getInstance().getGameManager().getDefaultCasinoFont("large","bold")};this._super.init.call(this,null,a)},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)}, onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.addChild(this._diplayPanel)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "MediumBtn":case "MediumBtnType1":a.setVisible(!1);break;case "LargeBtn":case "LargeBtnType1":this._continueButton=a;this._coinPoint=new RSPoint(c.x,c.y);break;case "CloseBtn":this._closeButton=a;break;case "Coin":this._coinIcon=a;break;case "Energy":case "Energy1":a.setVisible(!1);break;case "CoinsBgLarge":a.setVisible(!1)}}, createCustomObject:function(a,b){switch(b.name){case "Value2":this._titleText=RSPlatformFontAssetManager.createCustomLabel(RSUtils.formatNumberWithComma(this._coinsAwarded),b);this.addChild(this._titleText);break;case "Heading":this._heading=RSPlatformFontAssetManager.createCustomLabel("CONGRATULATIONS",b);this.addChild(this._heading);break;case "SubHeading":this._subHeading="UP"==GameConfig.GAME_ID?RSPlatformFontAssetManager.createCustomLabel("Enjoy Your Free Rewards",b):RSPlatformFontAssetManager.createCustomLabel("Enjoy Your Free Rewards!", b),this.addChild(this._subHeading)}return this._super.createCustomObject.call(this,a,b)},onButtonClicked:function(a){switch(a){case "CloseBtn":case "CP_Button_T1":case "CP_Button_T2":RSAnalyticsManager.getInstance().trackGUIEvent("loyalty_mall_success","close","",this._itemName,this._orderId,""),this._continueButton&&this._continueButton.setTouchEnabled(!1),this._closeButton&&this._closeButton.setTouchEnabled(!1),RSCasinoManager.addPrimaryCurrencyForDisplay("redeemCoins",parseInt(this._coinsAwarded)), RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(this._coinPoint,this._diplayPanel,this._onCoinAnimComplete.bind(this))}},_onCoinAnimComplete:function(){this.closePopup()}});var RSLoyaltyToolKitPopup=RSPopup.extend({_assetFolder:null,_assetList:null,_toolTipCloseTimer:null,init:function(a){this._super.init.call(this,a);this._assetList=[{name:RSGame.getInstance().getAssetPath("LoyaltyToolKitPopup"),count:1}]},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._toolTipCloseTimer=RSUtils.callFunctionWithDelay(5,this,this.closePopup.bind(this))},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onObjectCreated:function(a, b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "MediumBg":a.setVisible(!1);break;case "ContinueBtn":this._continueButton=a;break;case "CloseBtn":this._closeButton=a}},handleTouchEndAt:function(a,b,c){this.closePopup()},closePopup:function(){this._toolTipCloseTimer=null;this._super.closePopup.call(this)}});var RSVIPUnlockScreen=RSGameScreen.extend({init:function(a,b){this._super.init.call(this);this.callBack=a;this._vipTier=null;this._vipUnlockPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(this._vipUnlockPanel);this._vipUnlockPanel.setVisible(!1);this._userCurrentTier=RSVIPManager.getInstance().getVIPUserTier()-1;this._tier="Tire"+this._userCurrentTier;this.layoutScreen(RSGame.getInstance().getAssetPath("UnlockedVIPBenefits"), 2);b?RSAnalyticsManager.getInstance().trackGUIEvent("vip_surfacing","trigger",""):RSAnalyticsManager.getInstance().trackGUIEvent("vip_slots_popup","trigger","");RSEngine.dataManager.getMe().setVIPTierUnlockPopupShown(this._userCurrentTier+1)},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){switch(b.name){case "Bg":this._bg=RSUtils.createBasicObject(a,b);this._vipUnlockPanel.addChild(this._bg);break;case "CoinLeft":var c=RSUtils.createBasicObject(a,b);this._vipUnlockPanel.addChild(c); break;case "CoinRight":c=RSUtils.createBasicObject(a,b);this._vipUnlockPanel.addChild(c);break;case "Unlocked":this._unlockAnim=RSUtils.createAnimation(a,b,1);this._unlockAnim.stopAnimation();this._vipUnlockPanel.addChild(this._unlockAnim);break;case "Gem":this._vipTier=RSUtils.createAnimation(a,b,1);this._vipTier.stopAnimation();0<=this._userCurrentTier&&this._vipTier.setFrame(this._userCurrentTier);this._vipUnlockPanel.addChild(this._vipTier);break;case this._tier:this._tick=RSUtils.createBasicObject(a, b),this._vipUnlockPanel.addChild(this._tick)}this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._vipUnlockPanel.actionZoom(0,0,this.onVIPUnlockPanelScaledDownCOmplete.bind(this));this._super.onLayoutCompleted.call(this)},onVIPUnlockPanelScaledDownCOmplete:function(){this._vipUnlockPanel.setVisible(!0);this._vipUnlockPanel.actionScaleTo(0.5,0.9,this._onZoomCompleted.bind(this))},_onZoomCompleted:function(){this._vipUnlockPanel.actionScaleTo(0.25, 0.85,this.onVIPUnlockPanelScaleUpCOmplete.bind(this))},onVIPUnlockPanelScaleUpCOmplete:function(){RSEngine.dataManager.getMe().setVIPSurfacingShown();this._unlockAnim.playAnimation(1,0.5,null);RSEngine.audioManager.playEffect("res/LMandVIPSurfacing/Sfx/LockAnim.mp3",!1);RSUtils.callFunctionWithDelay(2.7,this,this.onUnlockAnimCompleted.bind(this))},onUnlockAnimCompleted:function(){this._vipUnlockPanel.actionZoom(0.3,0,this.onVIPUnlockCOmplete.bind(this))},onVIPUnlockCOmplete:function(){this.callBack&& this.callBack.call()},unloadContent:function(){this._super.unloadContent.call(this)}});var RSVIPBenefitsScreen=RSGameScreen.extend({init:function(a,b){this._super.init.call(this);this.callBack=a;this._isShowLMActive=b?b:!1;this._VIPBenefitsPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(this._VIPBenefitsPanel);this._VIPBenefitsPanel.setVisible(!1);this._okBtn=this._closeBtn=this._takeMeBtn=null;this._userCurrentTier=RSVIPManager.getInstance().getVIPUserTier()-1;this._tier="Tire"+this._userCurrentTier;this.layoutScreen(RSGame.getInstance().getAssetPath("VIPBenefits"), 1)},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){switch(b.name){case "Bg":var c=RSUtils.createBasicObject(a,b);this._VIPBenefitsPanel.addChild(c);break;case "CoinLeft":c=RSUtils.createBasicObject(a,b);this._VIPBenefitsPanel.addChild(c);break;case "CoinRight":c=RSUtils.createBasicObject(a,b);this._VIPBenefitsPanel.addChild(c);break;case this._tier:this._tick=RSUtils.createBasicObject(a,b);this._VIPBenefitsPanel.addChild(this._tick);break;case "TakeMeBtn":this._takeMeBtn= RSUtils.createButton(a,b);this.addTouchListenerToButton(this._takeMeBtn);this._takeMeBtn.setVisible(!1);this._VIPBenefitsPanel.addChild(this._takeMeBtn);break;case "CloseBtn":this._closeBtn=RSUtils.createButton(a,b);this.addTouchListenerToButton(this._closeBtn);this._closeBtn.setVisible(!1);this._VIPBenefitsPanel.addChild(this._closeBtn);break;case "Glare":this._glareAnim=RSUtils.createAnimation(a,b,1);this._glareAnim.stopAnimation();this._glareAnim.setVisible(!1);this._VIPBenefitsPanel.addChild(this._glareAnim); break;case "BgPart":this._bgPart=RSUtils.createBasicObject(a,b);this._isShowLMActive&&this._VIPBenefitsPanel.addChild(this._bgPart);break;case "OkBtn":this._okBtn=RSUtils.createButton(a,b),this.addTouchListenerToButton(this._okBtn),this._VIPBenefitsPanel.addChild(this._okBtn)}this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){1<=this._userCurrentTier&&!this._isShowLMActive&&null!=this._takeMeBtn? (this._closeBtn.setVisible(!0),this._takeMeBtn.setVisible(!0)):0!=this._userCurrentTier||this._isShowLMActive||null==this._closeBtn||this._closeBtn.setVisible(!0);this._VIPBenefitsPanel.actionZoom(0,0,this.onVIPBenefitsPanelScaledDownCOmplete.bind(this));RSEngine.dataManager.getMe().setVIPTriggerStatus(!1);this._super.onLayoutCompleted.call(this)},onVIPBenefitsPanelScaledDownCOmplete:function(){this._VIPBenefitsPanel.setVisible(!0);this._VIPBenefitsPanel.actionScaleTo(0.4,0.9,this._onZoomCompleted.bind(this))}, _onZoomCompleted:function(){this._VIPBenefitsPanel.actionScaleTo(0.3,0.85,this.onVIPBenefitsPanelScaleUpCOmplete.bind(this))},onVIPBenefitsPanelScaleUpCOmplete:function(){null==this._okBtn&&(1<=this._userCurrentTier&&!this._isShowLMActive&&null!=this._takeMeBtn?this._glareAnim?(this._glareAnim.setVisible(!0),this._glareAnim.playAnimation(1,0.5,this.onGlareAnimCompleted.bind(this)),RSEngine.audioManager.playEffect("res/LMandVIPSurfacing/Sfx/GlareAnim.mp3",!1)):RSUtils.callFunctionWithDelay(0.5,this, this.onGlareAnimCompleted.bind(this)):RSUtils.callFunctionWithDelay(2.5,this,this._closePanel.bind(this)))},onGlareAnimCompleted:function(){RSEngine.audioManager.fadeInMusic(2,this.getDisplayObject())},_closePanel:function(){this._VIPBenefitsPanel.actionZoom(0.3,0,this.onVIPBenefitsCOmplete.bind(this))},onVIPBenefitsCOmplete:function(){this.callBack&&(this.callBack.call(),this.callBack=null)},onButtonClicked:function(a){switch(a){case "TakeMeBtn":this._takeMeBtn.setTouchEnabled(!1);RSGame.getInstance().getGameManager().setIsVIPTakeMeButtonClicked(!0); this._VIPBenefitsPanel.actionZoom(0.3,0,this.onVIPBenefitsCOmplete.bind(this));GlobalVars.slotsLobbySelectedTab=TabType.VIP;if(RSGame.getInstance().getGameManager().isSubLobbyEnabled())RSGameScreenManager.getInstance().setPreviousScreen(RSGameScreens.MainLobby),RSGameScreenManager.getInstance().removeAllScreensExceptMainLobby(),RSEngine.externalGameManager.unLoadExternalGame(),RSGameScreenManager.getInstance().loadScreen(RSGameScreens.SlotsLobby);else{RSGame.getInstance().getGameManager().setGameType(RSGameTypes.Slots); a=!1;if("gameplay_screen"==RSAnalyticsManager.getInstance().getCurrentScreen()||GlobalVars.isjackpotLoaded)a=!0,RSGameScreenManager.getInstance().removeAllScreensExceptMainLobby(),RSEngine.externalGameManager.unLoadExternalGame();a?RSGameScreenManager.getInstance().loadScreen(RSGameScreens.MainLobby):RSEventManager.getInstance().dispatchEvent("SelectVIPTab")}GlobalVars.isjackpotLoaded&&(GlobalVars.isjackpotLoaded=!1);RSAnalyticsManager.getInstance().trackGUIEvent("vip_slots_popup","click","");break; case "CloseBtn":this._VIPBenefitsPanel.actionZoom(0.3,0,this.onVIPBenefitsCOmplete.bind(this));RSAnalyticsManager.getInstance().trackGUIEvent("vip_slots_popup","close","");break;case "OkBtn":this._VIPBenefitsPanel.actionZoom(0.3,0,this.onVIPBenefitsCOmplete.bind(this)),RSAnalyticsManager.getInstance().trackGUIEvent("vip_surfacing","click","")}},unloadContent:function(){this._super.unloadContent.call(this)}});var RSIntroScreenForLMAndVIP=RSCurtainRaiserScreen.extend({init:function(a,b,c,d){this._super.init.call(this,RSGame.getInstance().getAssetPath("CurtainRaiser"));this.callBack=a;this._isVipSlotsDisabled=d?d:!1;this._isShowVIPActive=b?b:!1;this._isShowLMActive=c?c:!1;this._particleEmitter=null;RSEngine.audioManager.fadeMusicVolumeTo(2,0.2,this.getDisplayObject())},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){this._super.createCustomObject.call(this,a,b)}, onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._emitterObject=new RSPanel(0,0,0,0);this.addChild(this._emitterObject);this._emitterObject.setZOrder(1);this._super.onLayoutCompleted.call(this);RSUtils.callFunctionWithDelay(1.4,this,this._playEmitter.bind(this))},_playEmitter:function(){this.loadParticleEffect();this._particleEmitter.startEmitter();RSUtils.callFunctionWithDelay(0.3,this,this._startScreenShow.bind(this))},_startScreenShow:function(){this._emitterObject.setZOrder(0); this._isShowVIPActive?(this._unlockScreen=new RSVIPUnlockScreen(this.onVIPUnlockAnimComplete.bind(this),this._isVipSlotsDisabled),this.addChild(this._unlockScreen)):(this._LMunlockScreen=new RSLMUnlockScreen(this.onLMUnlockAnimComplete.bind(this),this._isShowVIPActive),this.addChild(this._LMunlockScreen));RSEngine.audioManager.playEffect("res/LMandVIPSurfacing/Sfx/PopUpAnim.mp3",!1)},firstSectionComplete:function(){},onVIPUnlockAnimComplete:function(){this.removeChild(this._unlockScreen);this._VIPBenefitsScreen= new RSVIPBenefitsScreen(this.onVIPBenefitsAnimCompleted.bind(this),this._isShowLMActive);this.addChild(this._VIPBenefitsScreen);RSEngine.audioManager.playEffect("res/LMandVIPSurfacing/Sfx/PopUpAnim.mp3",!1)},onVIPBenefitsAnimCompleted:function(){this.removeChild(this._VIPBenefitsScreen);this._isShowLMActive?(this._LMunlockScreen=new RSLMUnlockScreen(this.onLMUnlockAnimComplete.bind(this),this._isShowVIPActive),this.addChild(this._LMunlockScreen),RSEngine.audioManager.playEffect("res/LMandVIPSurfacing/Sfx/PopUpAnim.mp3", !1)):this.callBack&&this.callBack.call(this)},onLMUnlockAnimComplete:function(){this.removeChild(this._LMunlockScreen);this._LMInfoScreen=new RSLMInfoScreen(this.onLMInfoAnimComplete.bind(this));this.addChild(this._LMInfoScreen);RSEngine.audioManager.playEffect("res/LMandVIPSurfacing/Sfx/PopUpAnim.mp3",!1)},onLMInfoAnimComplete:function(){this.removeChild(this._LMInfoScreen);this._LMOpenScreen=new RSLMOpenScreen(this.onLMOpenAnimComplete.bind(this));this.addChild(this._LMOpenScreen);RSEngine.audioManager.playEffect("res/LMandVIPSurfacing/Sfx/PopUpAnim.mp3", !1)},onLMOpenAnimComplete:function(a){this.removeChild(this._LMOpenScreen);this.callBack&&this.callBack.call(this,a)},loadParticleEffect:function(){cc.spriteFrameCache.addSpriteFrames("res/PlatformWidgets/CurtainRaiser/StartAnim_00-hd.plist");var a=new RSEmitterParticleParams;a._spriteFrames.push("StartAnim_00/Star1.png");a._spriteFrames.push("StartAnim_00/Star2.png");a._spriteFrames.push("StartAnim_00/Star3.png");a._spriteFrames.push("StartAnim_00/Star4.png");a._spriteFrames.push("StartAnim_00/Star5.png"); a._startScale=0.6;a._startScaleVariance=0;a._endScale=4;a._endScaleVariance=0.2;a._scalingDuration=1;a._startDelay=0.5;a._startDelayVariance=1.5;a._deviation=600;a._deviationVariance=100;a._speed=900;a._360rotationDuration=0.5;a._tweenRate=0.5;a._spriteAnimationSpeed=0.25;a._origin=new RSPoint(RSEngine.screenWidth/2,RSEngine.screenHeight/2);a._originVariance=new RSPoint(20,20);a._displacement=new RSPoint(0,0);a._displacementVariance=new RSPoint(RSEngine.screenWidth/2,RSEngine.screenHeight/2);var b= RSGame.getInstance().getGameManager().getCustomizedParticleCount()?RSGame.getInstance().getGameManager().getCustomizedParticleCount():200;this._particleEmitter=new RSCustomAnimationEmitter(a,!1,RSCustomEmitterType.FIREWORK,b);this._emitterObject.addChild(this._particleEmitter);this._particleEmitter.loadEmitter()},unloadContent:function(){this._super.unloadContent.call(this)}});var RSLMUnlockScreen=RSGameScreen.extend({init:function(a,b){this._super.init.call(this);this.callBack=a;this._shadow=this._rayAnim2=this._rayAnim1=null;this._isVIPActive=b?b:!1;this._LMUnlockPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(this._LMUnlockPanel);this._LMUnlockPanel.setVisible(!1);this.layoutScreen(RSGame.getInstance().getAssetPath("UnLockedLoyaltyMall"),2);RSAnalyticsManager.getInstance().trackGUIEvent("loyalty_mall_welcome_popup", "trigger","")},loadContent:function(){this._super.loadContent.call(this)},onSequencerDataLoaded:function(){this._animationSequencerObject.playSequenceWithKey("init")},createCustomObject:function(a,b){switch(b.name){case "Bg":this._bg=RSUtils.createBasicObject(a,b);this._LMUnlockPanel.addChild(this._bg);break;case "GoldStar":this._goldStar=b;break;case "WhiteStar":this._whiteStar=b;break;case "GlowClockwise":this._rayAnim1=RSUtils.createBasicObject(a,b);this._LMUnlockPanel.addChild(this._rayAnim1); break;case "GlowAntiClockwise":this._rayAnim2=RSUtils.createBasicObject(a,b);this._LMUnlockPanel.addChild(this._rayAnim2);break;case "Shadow":this._shadow=RSUtils.createBasicObject(a,b);this._LMUnlockPanel.addChild(this._shadow);break;case "Logo":var c=RSUtils.createBasicObject(a,b);this._LMUnlockPanel.addChild(c);break;case "Glare":this._glareAnim=RSUtils.createAnimation(a,b,1);this._glareAnim.stopAnimation();this._LMUnlockPanel.addChild(this._glareAnim);break;case "Unlocked":this._unlockAnim=RSUtils.createAnimation(a, b,1);this._unlockAnim.stopAnimation();this._LMUnlockPanel.addChild(this._unlockAnim);break;case "Title":this._unlockTitle=RSUtils.createAnimation(a,b,1),this._unlockTitle.stopAnimation(),this._unlockTitle.setFrame(0),this._LMUnlockPanel.addChild(this._unlockTitle)}-1!=b.name.indexOf("GStar")&&(this._Gstar=RSUtils.createBasicObject(a,this._goldStar),this._starPos=new RSPanel(b.x,b.y,b.w,b.h),this._starPos.addChild(this._Gstar),this._LMUnlockPanel.addChild(this._starPos),this[b.name]=this._Gstar);-1!= b.name.indexOf("WStar")&&(this._Wstar=RSUtils.createBasicObject(a,this._whiteStar),this._WstarPos=new RSPanel(b.x,b.y,b.w,b.h),this._Wstar.setPosition(this._WstarPos.getRect().getWidth()/2,this._WstarPos.getRect().getHeight()/2),this._WstarPos.addChild(this._Wstar),this._LMUnlockPanel.addChild(this._WstarPos),this[b.name]=this._Wstar);this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._LMUnlockPanel.actionZoom(0, 0,this.onLMUnlockPanelScaledDownCOmplete.bind(this));this.playGlowAnimation();this._isVIPActive&&this._unlockTitle.setFrame(1);this._super.onLayoutCompleted.call(this);this._animationSequencerObject=new RSAnimationSequencer("res/LMandVIPSurfacing/UnLockedLoyaltyMall/","UnlockedLoyaltyMallConfig.json",this,this);this._animationSequencerObject.loadAnimData()},onLMUnlockPanelScaledDownCOmplete:function(){this._LMUnlockPanel.setVisible(!0);this._LMUnlockPanel.actionScaleTo(0.4,0.9,this._onZoomCompleted.bind(this))}, _onZoomCompleted:function(){this._LMUnlockPanel.actionScaleTo(0.3,0.85,this.onLMUnlockPanelScaleUpCOmplete.bind(this))},onLMUnlockPanelScaleUpCOmplete:function(){RSEngine.dataManager.getMe().setLoyaltyMallEligiblePopupShownStatus();this._unlockAnim.playAnimation(1,0.5,null);RSEngine.audioManager.playEffect("res/LMandVIPSurfacing/Sfx/LockAnim.mp3",!1);this._glareAnim.playAnimation(1,0.5,null);RSUtils.callFunctionWithDelay(2.8,this,this.onAnimComplete.bind(this))},onAnimComplete:function(){this._LMUnlockPanel.actionZoom(0.3, 0,this.onLMUnlockCOmplete.bind(this))},onLMUnlockCOmplete:function(){this.callBack&&this.callBack.call()},playGlowAnimation:function(){this._rayAnim1.actionRotateBy(0.1,-2,-1);this._rayAnim2.actionRotateBy(0.1,2,-1)},unloadContent:function(){this._super.unloadContent.call(this)}});var RSLMInfoScreen=RSGameScreen.extend({init:function(a){this._super.init.call(this);this.callBack=a;this._LMInfoPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(this._LMInfoPanel);this._LMInfoPanel.setVisible(!1);this.layoutScreen(RSGame.getInstance().getAssetPath("BuyCoinsToEarn"),1)},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){switch(b.name){case "Bg":this._bg=RSUtils.createBasicObject(a, b),this._LMInfoPanel.addChild(this._bg)}this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._LMInfoPanel.actionZoom(0,0,this.onLMInfoPanelScaledDownCOmplete.bind(this));this._super.onLayoutCompleted.call(this)},onLMInfoPanelScaledDownCOmplete:function(){this._LMInfoPanel.setVisible(!0);this._LMInfoPanel.actionScaleTo(0.4,0.9,this._onZoomCompleted.bind(this));RSUtils.callFunctionWithDelay(3.5, this,this.onLMInfoPanelScaleUpCOmplete.bind(this))},_onZoomCompleted:function(){this._LMInfoPanel.actionScaleTo(0.3,0.85,null)},onLMInfoPanelScaleUpCOmplete:function(){this._LMInfoPanel.actionZoom(0.3,0,this.onLMInfoCOmplete.bind(this))},onLMInfoCOmplete:function(){this.callBack&&this.callBack.call()},unloadContent:function(){this._super.unloadContent.call(this)}});var RSLMOpenScreen=RSGameScreen.extend({init:function(a){this._super.init.call(this);this.callBack=a;this._LMOpenPanel=new RSPanel(RSEngine.screenWidth/2,RSEngine.screenHeight/2,RSEngine.screenWidth,RSEngine.screenHeight);this.addChild(this._LMOpenPanel);this._LMOpenPanel.setVisible(!1);this._imageFinalPosition=null;this.layoutScreen(RSGame.getInstance().getAssetPath("TakeMeToTheMall"),1)},loadContent:function(){this._super.loadContent.call(this)},createCustomObject:function(a,b){switch(b.name){case "Bg":var c= RSUtils.createBasicObject(a,b);this._LMOpenPanel.addChild(c);break;case "Particle":this._particleAnim=RSUtils.createAnimation(a,b,0.3);this._particleAnim.stopAnimation();this._LMOpenPanel.addChild(this._particleAnim);break;case "Particle1":this._particle1Anim=RSUtils.createAnimation(a,b,0.3);this._particle1Anim.stopAnimation();this._LMOpenPanel.addChild(this._particle1Anim);break;case "Particle2":this._particle2Anim=RSUtils.createAnimation(a,b,0.3);this._particle2Anim.stopAnimation();this._LMOpenPanel.addChild(this._particle2Anim); break;case "Particle3":this._particle3Anim=RSUtils.createAnimation(a,b,0.3);this._particle3Anim.stopAnimation();this._LMOpenPanel.addChild(this._particle3Anim);break;case "Particle4":this._particle4Anim=RSUtils.createAnimation(a,b,0.3);this._particle4Anim.stopAnimation();this._LMOpenPanel.addChild(this._particle4Anim);break;case "Particle5":this._particle5Anim=RSUtils.createAnimation(a,b,0.3);this._particle5Anim.stopAnimation();this._LMOpenPanel.addChild(this._particle5Anim);break;case "BagAnimation":this._bagAnim= RSUtils.createAnimation(a,b,0.3);this._bagAnim.stopAnimation();this._LMOpenPanel.addChild(this._bagAnim);break;case "Shadow":c=RSUtils.createBasicObject(a,b);this._LMOpenPanel.addChild(c);break;case "Ginny":c=RSUtils.createBasicObject(a,b);this._LMOpenPanel.addChild(c);break;case "TakeMeBtn":this._takeMeBtn=RSUtils.createButton(a,b);this.addTouchListenerToButton(this._takeMeBtn);this._LMOpenPanel.addChild(this._takeMeBtn);this._takeMeBtn.setTouchEnabled(!1);break;case "CloseBtn":RSEngine.dataManager.getMe().getHistoricMonetizerStatus()|| (this._closeBtn=RSUtils.createButton(a,b),this.addTouchListenerToButton(this._closeBtn),this._closeBtn.setTouchEnabled(!1),this._LMOpenPanel.addChild(this._closeBtn));break;case "Glare":this._glareAnim=RSUtils.createAnimation(a,b,1);this._glareAnim.stopAnimation();this._LMOpenPanel.addChild(this._glareAnim);break;case "Image":this._clippingRect=new RSPanel(b.x,b.y,b.w,b.h);this._clippingRect.setClippingEnabled(!0);this._LMOpenPanel.addChild(this._clippingRect);break;case "MobileImage":this._mobImage= RSUtils.createBasicObject(a,b);c=this._clippingRect.convertToNodeSpace(b.x,b.y);this._mobImage.setScale(this._clippingRect.getRect().getWidth()/b.w);var d=this._mobImage.getRect().getHeight()*(this._clippingRect.getRect().getWidth()/b.w);this._mobImage.setPosition(c.getX()+35,c.getY()-(d/2-this._clippingRect.getRect().getHeight()/2));this._imageFinalPosition=c.getX()-35;this._clippingRect.addChild(this._mobImage)}this._super.createCustomObject.call(this,a,b)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this, a,b,c)},onLayoutCompleted:function(){this._LMOpenPanel.actionZoom(0,0,this.onLMOpenPanelScaledDownCOmplete.bind(this));this._super.onLayoutCompleted.call(this)},_scrollImageRight:function(){this._mobImage.actionMoveBy(3,this._imageFinalPosition-this._mobImage.getX(),0,this.playGlareAnim.bind(this))},onScrollImageCOmplete:function(){this._mobImage.actionMoveBy(0.5,-20,0,this.playGlareAnim.bind(this))},onLMOpenPanelScaledDownCOmplete:function(){this._LMOpenPanel.setVisible(!0);this._LMOpenPanel.actionScaleTo(0.4, 0.9,this._onZoomCompleted.bind(this))},_onZoomCompleted:function(){this._LMOpenPanel.actionScaleTo(0.3,0.85,this.onLMOpenPanelScaleUpCOmplete.bind(this))},playGlareAnim:function(){this._closeBtn&&this._closeBtn.setTouchEnabled(!0);this._takeMeBtn.setTouchEnabled(!0);this._glareAnim.playAnimation(1,0.5,this.onGlareAnimCompleted.bind(this));RSEngine.audioManager.playEffect("res/LMandVIPSurfacing/Sfx/GlareAnim.mp3",!1)},onGlareAnimCompleted:function(){this._onBagTimerComplete();RSEngine.audioManager.fadeInMusic(2, this.getDisplayObject())},onLMOpenPanelScaleUpCOmplete:function(){this._scrollImageRight()},onLMOpenCOmplete:function(){this.callBack&&this.callBack.call()},onButtonClicked:function(a){switch(a){case "TakeMeBtn":RSGame.getInstance().getGameManager().loadLoyaltyMall();this._LMOpenPanel.actionZoom(0.1,0);RSAnalyticsManager.getInstance().trackGUIEvent("loyalty_mall_welcome_popup","click","");break;case "CloseBtn":this._LMOpenPanel.actionZoom(0.3,0,this.onLMOpenCOmplete.bind(this)),RSAnalyticsManager.getInstance().trackGUIEvent("loyalty_mall_welcome_popup", "close","")}},unloadContent:function(){this._super.unloadContent.call(this)},_onBagTimerComplete:function(){this._bagAnim?this._bagAnim.playAnimation(1,0.3,this._onParticleTimerComplete.bind(this)):this._onParticleTimerComplete()},_onParticleTimerComplete:function(){this._particleAnim&&this._particleAnim.playAnimation(1,0.3);this._particle1Anim&&this._particle1Anim.playAnimation(1,0.3);this._particle2Anim&&this._particle2Anim.playAnimation(1,0.3);this._particle3Anim&&this._particle3Anim.playAnimation(1, 0.3);this._particle4Anim&&this._particle4Anim.playAnimation(1,0.3);this._particle5Anim&&this._particle5Anim.playAnimation(1,0.3);this.scheduleForAnimation()},scheduleForAnimation:function(){this.scheduleFunctionOnce(this._onBagTimerComplete.bind(this),5)},unload:function(){this._super.unload.call(this)}});var RSCCPAPopup=RSPopup.extend({init:function(a,b,c){this._toggleButtonStatus=[];this._toggleButtonArray=[];this._super.init.call(this);this._callBack=c;this._data=b;this._userId=a},loadContent:function(){this.layoutScreen(RSGame.getInstance().getAssetPath("RSCCPAPopup"));this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){switch(c.name){case "AcceptBtn":this._acceptBtn=a;this._acceptBtn.setTouchEnabled(!1);break;case "TOSBtn":this._tosBtn=a;break;case "PrivacyBtn":this._privacyBtn= a}switch(c.type){case "Animation":a.stopAnimation(),a.setFrame(1),this._toggleButtonStatus.push(1),a.addTouchListenerWithDelegate(this),this._toggleButtonArray.push(a)}this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);RSUtils.getLocalStorageItem("sfxStatus",!0)&&(this._privacyBtn.setButtonSound(void 0),this._tosBtn.setButtonSound(void 0),this._acceptBtn.setButtonSound(void 0));1>=this._toggleButtonArray.length||this._setOptOutButtonStatus()}, _setOptOutButtonStatus:function(){this._toggleButtonStatus[this._toggleButtonStatus.length-1]=0;this._toggleButtonArray[this._toggleButtonArray.length-1].setFrame(0)},onButtonClicked:function(a){RSUtils.getLocalStorageItem("sfxStatus",!0)&&RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"),!1,!0);switch(a){case "TOSBtn":window.open(this._data.TOSUrl,"_blank");break;case "PrivacyBtn":window.open(this._data.privacyPolicyUrl,"_blank");break;case "AcceptBtn":this._acceptBtn.setTouchEnabled(!1), RSEngine.screenManager.addOverlay(),this._setCCPA()}},handleObjectTouchAt:function(a,b,c){RSUtils.getLocalStorageItem("sfxStatus",!0)&&RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"),!1,!0);a=a._ccObject._name.split("RadioButton")[1]-1;this._toggleButtonStatus[a]=0<this._toggleButtonStatus[a]?0:1;this._toggleButtonArray[a].setFrame(this._toggleButtonStatus[a]);this.checkAndHandleAcceptBtnStatus()},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a, b,c){},checkAndHandleAcceptBtnStatus:function(){var a=0,b=!1;for(a in this._toggleButtonStatus)(1>=this._toggleButtonStatus.length||a!=this._toggleButtonStatus.length-1)&&1==this._toggleButtonStatus[a]&&(b=!0);b?this._acceptBtn.setTouchEnabled(!1):this._acceptBtn.setTouchEnabled(!0)},_setCCPA:function(){var a=null;1<this._toggleButtonStatus.length&&(a=this._toggleButtonStatus[this._toggleButtonStatus.length-1]);URLConfig.CLEVERTAP_ENABLED?(GlobalVars.CallCCPA=!0,RSGame.getInstance().getGameManager().setOptOutStatusFromCCPA(a), this._callBack&&this._callBack(),this.closePopup()):RSEngine.dataManager.setCCPA(this._userId,this._successCallBack.bind(this),this._failedCallBack.bind(this));RSEngine.dataManager.setCCPA(this._userId,a,this._successCallBack.bind(this),this._failedCallBack.bind(this))},_successCallBack:function(a){"Success"==a.result.status&&(this._callBack&&this._callBack(),this.closePopup(),RSGame.getInstance().getGameManager().setSideMenuVisibility(!1))},_failedCallBack:function(){this._setCCPA()},unload:function(){RSEngine.screenManager.removeOverlay(); this._super.unload.call(this)}});var RSGDPRPopup=RSPopup.extend({init:function(a,b,c){this._toggleButtonStatus=[];this._toggleButtonArray=[];this._super.init.call(this);this._callBack=c;this._data=b;this._userId=a},loadContent:function(){this.layoutScreen(RSGame.getInstance().getAssetPath("RSGDPRPopup"),2);this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){switch(c.name){case "AcceptBtn":this._acceptBtn=a}switch(c.type){case "Animation":a.stopAnimation(),a.setFrame(1),this._toggleButtonStatus.push(1),a.addTouchListenerWithDelegate(this), this._toggleButtonArray.push(a)}this._super.onObjectCreated.call(this,a,b,c)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);GameConfig.GDPR_CHECKBOX_ENABLED?this._acceptBtn.setTouchEnabled(!1):this._toggleButtonArray.length&&this._setOptOutButtonStatus()},_setOptOutButtonStatus:function(){this._toggleButtonStatus[this._toggleButtonStatus.length-1]=0;this._toggleButtonArray[this._toggleButtonArray.length-1].setFrame(0)},onButtonClicked:function(a){RSEngine.audioManager.isEffectsMuted()&& RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"),!1,!0);switch(a){case "TOSBtn":window.open(this._data.TOSUrl,"_blank");break;case "PrivacyBtn":window.open(this._data.privacyPolicyUrl,"_blank");break;case "AcceptBtn":this._acceptBtn.setTouchEnabled(!1),RSEngine.screenManager.addOverlay(),this._setCCPA()}},handleObjectTouchAt:function(a,b,c){RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetPath("ButtonClick_SFX"),!1,!0);a=a._ccObject._name.split("RadioButton")[1]- 1;this._toggleButtonStatus[a]=0<this._toggleButtonStatus[a]?0:1;this._toggleButtonArray[a].setFrame(this._toggleButtonStatus[a]);GameConfig.GDPR_CHECKBOX_ENABLED&&this.checkAndHandleAcceptBtnStatus()},handleObjectTouchMoveAt:function(a,b,c){},handleObjectTouchEndAt:function(a,b,c){},checkAndHandleAcceptBtnStatus:function(){var a=0,b=!1;for(a in this._toggleButtonStatus)(1>=this._toggleButtonStatus.length||a!=this._toggleButtonStatus.length-1)&&1==this._toggleButtonStatus[a]&&(b=!0);b?this._acceptBtn.setTouchEnabled(!1): this._acceptBtn.setTouchEnabled(!0)},_setCCPA:function(){var a=null;this._toggleButtonStatus.length&&(a=this._toggleButtonStatus[this._toggleButtonStatus.length-1]);RSEngine.dataManager.setGDPR(this._userId,a,this._successCallBack.bind(this),this._failedCallBack.bind(this))},_successCallBack:function(a){"Success"==a.result.status&&(this._callBack&&this._callBack(),this.closePopup(),RSGame.getInstance().getGameManager().setSideMenuVisibility(!1))},_failedCallBack:function(){this._setCCPA()},unload:function(){RSEngine.screenManager.removeOverlay(); this._super.unload.call(this)}});var ReturnBonusWidgetController=RSWidgetController.extend({_delegate:null,_isCloseButtonClicked:!1,onControllerAdded:function(){this.loadModelData();this.getView().loadLayoutsInModel(this.getModel())},loadModelData:function(){},onControllerRemoved:function(){this._view.unload();this._model.unload()},onCloseButtonClicked:function(){this._isCloseButtonClicked=!0},handler:function(){return this._model.getModelData()},setDelegate:function(a){this._delegate=a},getModel:function(){return this._model},onGameplayComplete:function(a, b){this._delegate.onGameplayComplete(a,b,this._isCloseButtonClicked,"returnBonus")},isArtLoaded:function(){}});var ReturnBonusWidgetModel=RSWidgetModel.extend({_currentDay:null,_returnBonusData:null,_loyaltymallPoints:null,init:function(a,b){this._currentDay=b;this._super.init.call(this,a)},InitModelData:function(){this._returnBonusData=RSGame.getInstance().getGameData().getSheetData("RetentionDailyBonus")},getCurrentDay:function(){return this._currentDay},getCurrentDayReward:function(){return 8>this._currentDay?this._returnBonusData[this._currentDay-1].value:this._returnBonusData[6].value},getCurrentDayLMPoints:function(){return 8> this._currentDay?this._returnBonusData[this._currentDay-1].value1:this._returnBonusData[6].value1},getBonusGameData:function(a){if(1>a)return 0;7<a&&(a=7);return RSGame.getInstance().getGameData().getSheetData("RetentionDailyBonus")[a-1].value},getLoyaltyMallPointsRewarded:function(a){7<a&&(a=7);return RSGame.getInstance().getGameData().getSheetData("RetentionDailyBonus")[a-1].value1}});var ReturnBonusWidgetView=RSWidgetView.extend({init:function(a){this._controllerName=a;this._dailybonusMainControl=RSWidgetsManager.getInstance().getController("DailyBonusScreen");this._super.init.call(this)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.setSize(this._bg.w,this._bg.h);8>parseInt(this._model.getCurrentDay())?this.setPointerPosition(!1):this._pointer.setPosition(this._pointerInfo.x,this._pointerInfo.y+6*this._pointerInfo.h)},createCustomObject:function(a, b){switch(b.type){case "Label":if(/RewardValueDay/.test(b.name)){var c=b.name.charAt(14),c=this._model.getBonusGameData(c);this[b.name]=this._dailybonusMainControl.getFontLabel(b);this.addChild(this[b.name]);this[b.name].setString(RSUtils.formatNumber(c))}/HeartValueDay/.test(b.name)&&(c=b.name.charAt(13),this[b.name]=this._dailybonusMainControl.getFontLabel(b),this.addChild(this[b.name]),c=this._model.getLoyaltyMallPointsRewarded(c),this[b.name].setString(RSUtils.formatNumber(c)));"RewardCoinValue"== b.name?(c=this._model.getCurrentDay(),c=8>c?this._model.getBonusGameData(c-1):this._model.getBonusGameData(c),this[b.name]=this._dailybonusMainControl.getFontLabel(b),this.addChild(this[b.name]),this[b.name].setString(RSUtils.formatNumber(c))):"RewardHeartValue"==b.name&&(c=this._model.getCurrentDay(),c=8>c?0:this._model.getCurrentDayLMPoints(),this[b.name]=this._dailybonusMainControl.getFontLabel(b),this.addChild(this[b.name]),this[b.name].setString(RSUtils.formatNumber(c)));break;case "CoinHeartAnim":this.heartAnim= RSUtils.createAnimation(a,b,1);this.heartAnim.stopAnimation();this.addChild(this.heartAnim);this.heartAnim.setVisible(!1);break;case "ValueAnim":c=8>parseInt(this._model.getCurrentDay())?parseInt(this._model.getCurrentDay()):7,this.valueAnim=RSUtils.createAnimation(a,b,1),this.valueAnim.stopAnimation(),this.valueAnim.setPosition(b.x,b.y+b.h*(c-1)),this.addChild(this.valueAnim),this.valueAnim.setVisible(!1)}},onObjectCreated:function(a,b,c){switch(c.name){case "Pointer":this._pointer=a;this._pointerInfo= c;break;case "Bg":this._bg=c;break;case "CloseBtn":this._closeBtn=a}switch(c.type){case "Animation":a.stopAnimation(),a.playAnimation(-1,0.3)}},setPointerPosition:function(a,b){this._pointerCallBack=b;var c=parseInt(this._model.getCurrentDay());if(8>c){var d=c-1;a?(c=0>c?0:c,c=7<c?7:c,0!=d&&7!=d?(RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyBonusScreen")+"Pointer.mp3",!1),this._pointer.actionMoveTo(1,this._pointerInfo.x,this._pointerInfo.y+this._pointerInfo.h*(c-1),this.setTxtZoomInAnim.bind(this))): this.setTxtZoomInAnim()):(c-=2,c=0>c?0:c,this._pointer.setPosition(this._pointerInfo.x,this._pointerInfo.y+this._pointerInfo.h*(7<c?7:c)))}else this.heartAnim.playAnimation(-1,0.8),this.heartAnim.setVisible(!0),this.valueAnim.setVisible(!0),this.valueAnim.playAnimation(-1,0.3),this.triggerCallBack()},setTxtZoomInAnim:function(){this.heartAnim.playAnimation(-1,0.8);this.heartAnim.setVisible(!0);this.valueAnim.setVisible(!0);this.valueAnim.playAnimation(-1,0.3);var a=this.RewardCoinValue.actionScale(0.5, 0.6,0.6),b=this.RewardHeartValue.actionScale(0.5,0.7,0.7,this.txtZoomInAnim1.bind(this));RSTweener.easeSineIn(a);RSTweener.easeSineIn(b)},txtZoomInAnim1:function(){var a=this.RewardCoinValue.actionScale(0.3,0.55,0.55),b=this.RewardHeartValue.actionScale(0.3,0.65,0.65,this.startRollUps.bind(this));RSTweener.easeSineIn(a);RSTweener.easeSineIn(b)},startRollUps:function(){this._rollUpEnd=!1;var a=parseInt(this._model.getBonusGameData(this._model.getCurrentDay()-1)),b=parseInt(this._model.getCurrentDayReward()), c=parseInt(this.RewardHeartValue.getString()),d=parseInt(this._model.getCurrentDayLMPoints());RSEngine.audioManager.playEffect(RSGame.getInstance().getAssetFolder("DailyBonusScreen")+"Coin_rollup.mp3",!1);this.startActionTweenForKey("RewardCoinValue",2,a,b);this.startActionTweenForKey("RewardHeartValue",2,c,d)},actionOnUpdate:function(a,b){this[a].setString(RSUtils.formatNumberWithComma(Math.floor(b)));"RewardCoinValue"==a?this[a].setScale(0.55):this[a].setScale(0.65)},actionOnComplete:function(){this._rollUpEnd? this.setTxtZoomOutAnim():this._rollUpEnd=!0},setTxtZoomOutAnim:function(){var a=this.RewardCoinValue.actionScale(0.5,0.4,0.4),b=this.RewardHeartValue.actionScale(0.5,0.5,0.5,this.txtZoomOutAnim1.bind(this));RSTweener.easeSineOut(a);RSTweener.easeSineOut(b)},txtZoomOutAnim1:function(){var a=this.RewardCoinValue.actionScale(0.3,0.45,0.45),b=this.RewardHeartValue.actionScale(0.3,0.55,0.55,this.triggerCallBack.bind(this));RSTweener.easeSineIn(a);RSTweener.easeSineIn(b)},triggerCallBack:function(){this._closeBtn.setTouchEnabled(!1); RSWidgetsManager.getInstance().getController("ReturnBonusWidget").getView().scheduleFunctionOnce(this._pointerCallBack.bind(),1)},onButtonClicked:function(a){switch(a){case "CloseBtn":this.stopAllActions(),this.unscheduleAllFunctions(),this._closeBtn.setTouchEnabled(!1),this.RewardCoinValue.setString(this._model.getCurrentDayReward()),this.RewardHeartValue.setString(this._model.getCurrentDayLMPoints()),a=parseInt(this._model.getCurrentDay())-1,this._pointer.setPosition(this._pointerInfo.x,this._pointerInfo.y+ this._pointerInfo.h*a),a=RSWidgetsManager.getInstance().getController(this._controllerName),a.onCloseButtonClicked(),a.onGameplayComplete()}}});var ReturnBonusBoxWidgetController=RSWidgetController.extend({_delegate:null,onControllerAdded:function(){this.loadModelData();this.getView().loadLayoutsInModel(this.getModel())},loadModelData:function(){},onControllerRemoved:function(){this._view.unload();this._model.unload()}});var ReturnBonusBoxWidgetModel=RSWidgetModel.extend({_friendReward:null,_rewardFont:null,init:function(a,b){this._retentionBonusDay=7<b?7:b;this._loyaltymallPoints=RSGame.getInstance().getGameData().getSheetData("dailyBonusConfig")[0].FoxPlayPoints;this._super.init.call(this,a)},getLoyaltyMallPointsRewarded:function(){return RSGame.getInstance().getGameData().getSheetData("RetentionDailyBonus")[this._retentionBonusDay-1].value1}});var ReturnBonusBoxWidgetView=RSWidgetView.extend({_disableFeature:!1,_rewardText:null,_friendCountText:null,_totalAmountText:null,init:function(){this._super.init.call(this);this._currencyPositionHolders=[];this._screenName=null;this._dailBonusMainController=RSWidgetsManager.getInstance().getController("DailyBonusScreen")},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this.setSize(this._returnBonusWidget.w,this._returnBonusWidget.h);this._disableFeature&&this.disableFeature()}, onObjectCreated:function(a,b,c){switch(c.name){case "Bg":this._returnBonusWidget=c}},createCustomObject:function(a,b){null===this._screenName&&(this._screenName=a);switch(b.name){case "Heart":this._heartSymbol=RSUtils.createBasicObject(a,b);this.addChild(this._heartSymbol);break;case "HeartValue":var c=this._model.getLoyaltyMallPointsRewarded();this._rewardText=this._dailBonusMainController.getFontLabel(b);this._rewardText.setString(c);this.addChild(this._rewardText)}},disableFeature:function(){this._disableFeature= !0;this._rewardText&&this._disabledLayerObject&&this._disabledLayerObject.setVisible(!0)}});var RSSubscriptionSaleSuccess=RSDisplayObject.extend({init:function(a,b,c){this._parentInstance=b;this._callBack=c;this._displayArea=new RSRect(0,0,a.w,a.h);this._super.init.call(this,this._displayArea);RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("SubscriptionSaleFontConfigJson"),"SubscriptionSaleFontConfig.json");this.loadLayout(RSGame.getInstance().getAssetPath("SubscriptionSaleSuccessWidget"))},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this, a,b,c);switch(c.name){case "SuccessBg":this._successBG=a;break;case "CollectButton":this._collectButton=a;break;case "Banner":this._banner=a;break;case "GreenAnim":this._greenAnim=a,this._greenAnim.stopAnimation(),this._greenAnim.playAnimation(-1,0.1)}},createCustomObject:function(a,b){switch(b.name){case "StripLabel":var c=RSGame.getInstance().getGameData().getPopupTextWithKey("SubscriptionSaleSuccessStripLabel"),c=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(c);break;case "TopCoinLabel":c= RSGame.getInstance().getGameData().getPopupTextWithKey("SubscriptionSaleSuccessTopCoinLabel"),c=c.replace("\\n","\n"),c=RSPlatformFontAssetManager.createCustomLabel(c,b),c.setCenter(b.x,b.y),this.addChild(c)}},onButtonClicked:function(a){switch(a){case "CollectButton":RSEngine.popupManager.addPopup(new RSSubscriptionSaleCalendarPopup("subscription_sale",this._callBack),!0),RSAnalyticsManager.getInstance().trackGUIEvent("subscription_success","click","open_from_"+RSGameScreenManager.getInstance().getCurrentScreen(), RSSubscrptionSaleManager.getPackName(),RSSaleManager.getInstance().getEventId()),this._parentInstance.closePopup()}this._super.onButtonClicked.call(this,a)}});var RSSubscriptionFailedPopup=RSGenericPopup.extend({init:function(a,b,c){this._super.init.call(this,c);this._paymentstatus=a;this._buttonSound=null;this._source=b;this._loadFontAsset=!1;this._assetList=[{name:RSGame.getInstance().getAssetPath("SubscriptionSaleSuccessPopup"),count:1},{name:RSGame.getInstance().getAssetPath("SubscriptionSaleFailureWidget"),count:1}];RSGame.getInstance().getAssetPath("SubscriptionFailedFontConfig")&&(this._loadFontAsset=!0,RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("SubscriptionFailedFontConfig"), "SubscriptionFailedFontConfig.json"));RSEventManager.getInstance().dispatchEvent("onSubscriptionSuccess")},loadContent:function(){this._buttonSound=RSGame.getInstance().getAssetPath("ButtonClick_SFX");this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "PurchaseButton":this._purchaseButton=a;this._purchaseButton.setButtonSound(this._buttonSound);"renew"==this._paymentstatus&&RSEngine.loginMode== LOGIN_MODE.FACEBOOK||this._purchaseButton.setVisible(!1);break;case "OkButton":this._okButton=a;this._okButton.setButtonSound(this._buttonSound);"renew"==this._paymentstatus&&RSEngine.loginMode==LOGIN_MODE.FACEBOOK&&this._okButton.setVisible(!1);break;case "CloseBtnBigBg":this._closeButton=a,this._closeButton.setButtonSound(this._buttonSound)}},createCustomObject:function(a,b){switch(b.name){case "MessageLabel":this._message=this._loadFontAsset?RSPlatformFontAssetManager.createCustomLabel("",b):new RSScaledLabel("", RSGame.getInstance().getAssetPath(GameFonts.Normal_Small),b,kTEXT_ALIGNMENT_CENTER);if("failed"==this._paymentstatus){var c=RSGame.getInstance().getGameData().getPopupTextWithKey("SubscriptionSaleFailureText"),c=c.replace(/\\n/g,"\n");this._loadFontAsset?this._message.setString(c+"\n"):(this._message.setString(c),this._message.setScale(0.42))}if("SubscriptionInterrupted"==this._paymentstatus||"renew"==this._paymentstatus)c=RSGame.getInstance().getGameData().getPopupTextWithKey("SubscriptionSaleInterruptedText"), c=c.replace(/\\n/g,"\n"),this._loadFontAsset?this._message.setString(c+"\n"):(this._message.setString(c),this._message.setScale(0.42));this.addChild(this._message);break;case "BigBg":this._bigBg=RSUtils.createBasicObject(a,b),this.addChild(this._bigBg)}return this._super.createCustomObject.call(this,a,b)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);var a=this._source;"interruptShown"==this._source&&(a=RSGameScreenManager.getInstance().getCurrentScreen());"SubscriptionInterrupted"== this._paymentstatus?"interruptShown"==this._source?RSAnalyticsManager.getInstance().trackGUIEvent("subscription_interrupt","trigger","open_from_"+a,"",""):RSAnalyticsManager.getInstance().trackGUIEvent("subscription_interrupt","open","open_from_"+a,"",""):RSAnalyticsManager.getInstance().trackPlayerAction("subscription_fail","open","open_from_"+a,"","");this._source=a},getCurrentMachineName:function(){var a="";return a="gameplay_screen"==RSAnalyticsManager.getInstance().getCurrentScreen()?RSAnalyticsManager.getInstance().getCurrentMachineAnalyticsName(): RSAnalyticsManager.getInstance().getCurrentScreen()},onButtonClicked:function(a){switch(a){case "PurchaseButton":RSSaleManager.getInstance().showSubscriptionSalePopup();this.closePopup();break;case "OkButton":"SubscriptionInterrupted"==this._paymentstatus?RSAnalyticsManager.getInstance().trackGUIEvent("subscription_interrupt","click","open_from_"+this._source,"",""):RSAnalyticsManager.getInstance().trackPlayerAction("subscription _fail","click","open_from_"+this._source,"","");this.closePopup();break; case "CloseBtnBigBg":"SubscriptionInterrupted"==this._paymentstatus?RSAnalyticsManager.getInstance().trackGUIEvent("subscription_interrupt","close","open_from_"+this._source,"",""):RSAnalyticsManager.getInstance().trackPlayerAction("subscription _fail","close","open_from_"+this._source,"","");this.closePopup();break;case "ContactSupportButton":this.onPlayerSupportClicked()}this._super.onButtonClicked.call(this,a)},onPlayerSupportClicked:function(){document.getElementById("Helpshift").style.display= "block";document.getElementById("helpshiftoverlay").style.display="block";RSAnalyticsManager.getInstance().trackGUIEvent("support","open","open_from_subscription_interrupt","","");this._playerSupportactive=!0}});var RSSubscriptionSaleSuccessPopup=RSGenericPopup.extend({init:function(a,b){this._super.init.call(this);this._callBack=b;this._assetFolder=a;var c=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(c);this._buttonSound=null;this._assetList=[{name:RSGame.getInstance().getAssetPath("SubscriptionSaleSuccessPopup"),count:1}]},loadContent:function(){this._buttonSound=RSGame.getInstance().getAssetPath("ButtonSFX");this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onObjectCreated:function(a, b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CloseBtnBigBg":this._closeButton=a,this._closeButton.setButtonSound(this._buttonSound)}},createCustomObject:function(a,b){switch(b.name){case "BigBg":this._bigBg=RSUtils.createBasicObject(a,b);this.addChild(this._bigBg);break;case "SubscriptionSaleSuccessWidget":this._widgetData=b,this._subscriptionSaleSuccessPopup=new RSSubscriptionSaleSuccess(b,this,this._callBack),this.addChild(this._subscriptionSaleSuccessPopup),this._subscriptionSaleSuccessPopup.setCenter(b.x, b.y)}return this._super.createCustomObject.call(this,a,b)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);var a=RSSaleManager.getInstance().getOptValForSubscriptionPlacement();null!=a&&RSAnalyticsManager.getInstance().trackGUIEvent("subscription_placement","success",a,RSSubscrptionSaleManager.getPackName());RSAnalyticsManager.getInstance().trackGUIEvent("subscription_success","trigger","open_from_"+RSGameScreenManager.getInstance().getCurrentScreen(),RSSubscrptionSaleManager.getPackName(), RSSaleManager.getInstance().getEventId())},onButtonClicked:function(a){switch(a){case "CloseBtnBigBg":this._callBack&&this._callBack(),this.closePopup(),RSAnalyticsManager.getInstance().trackGUIEvent("subscription_success","close","open_from_"+RSGameScreenManager.getInstance().getCurrentScreen(),RSSubscrptionSaleManager.getPackName(),RSSaleManager.getInstance().getEventId())}this._super.onButtonClicked.call(this,a)}});var RSSubscriptionSaleCalendarWidget=RSDisplayObject.extend({_termsUrl:null,init:function(a,b,c){this._source=c;RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("SubscriptionSaleFontConfigJson"),"SubscriptionSaleFontConfig.json");this._displayArea=new RSRect(0,0,a.w,a.h);this._super.init.call(this,this._displayArea);this.loadLayout(RSGame.getInstance().getAssetPath("SubscriptionSaleCalendarWidget"));a=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(a);this._widgetRenewal= !0;this._callBack=b;this._termsUrl=GameConfig.TERMS_OF_SERVICE_URL+"#subscription"},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CalenderBg":this._calendarBg=a;break;case "InfoButton":this._infoBtn=a,this._infoBtn.setVisible(!0)}},createCustomObject:function(a,b){switch(b.name){case "TileItem":this._ItemRect=b;break;case "CalendarRect":this._touchRect=b;break;case "Timerlabel":this._timerLabel=RSPlatformFontAssetManager.createCustomLabel("",b); this.addChild(this._timerLabel);break;case "StripLabel":var c=RSGame.getInstance().getGameData().getPopupTextWithKey("SubscriptionSaleCalendarStripLabel");this._stripLabel=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(this._stripLabel);break;case "SubscriptionActive":this._subscriptionActive=RSUtils.createBasicObject(a,b);this._subscriptionActive.setVisible(!1);this.addChild(this._subscriptionActive);break;case "TrialPeriodActive":this._trialPeriodActive=RSUtils.createBasicObject(a, b),this._trialPeriodActive.setVisible(!1),this.addChild(this._trialPeriodActive)}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._scroller=new RSBarScroller(new RSRect(this._touchRect.x,this._touchRect.y,this._touchRect.w,this._touchRect.h),new RSSize(this._ItemRect.w,this._ItemRect.h),0,RSScrollerDirection.RSSCROLLER_VERTICAL,8);this.addChild(this._scroller);RSSubscrptionSaleManager.getisTrial()?(this._trialPeriodActive.setVisible(!0),this._subscriptionActive.setVisible(!1)): (this._trialPeriodActive.setVisible(!1),this._subscriptionActive.setVisible(!0));this.setupCalendarObjects()},onButtonClicked:function(a){switch(a){case "TOSSubscriptionButton":RSAnalyticsManager.getInstance().trackPlayerAction("terms_of_service","click","","","");window.open(this._termsUrl,"_blank");break;case "InfoButton":RSEngine.popupManager.addPopup(new RSSubscriptionSaleInfoPopup(this._source),!0,!1,!1)}this._super.onButtonClicked.call(this,a)},setupCalendarObjects:function(){this._calendarObjects= [];this._currentDay=RSSubscrptionSaleManager.getCurrentDate("day");for(var a=RSSubscrptionSaleManager.getCalendarData().length,b=0;b<a;b++){var c=new RSSubscriptionSaleCalendarObjects(b,this._ItemRect,this._currentDay);this._calendarObjects.push(c);this._scroller.addChild(c)}this._widgetRenewal||RSEngine.screenManager.removeOverlay();this.scheduleFunctionOnce(function(){this._calendarObjects[this._currentDay-1].playAnimation(this._scroller,this)}.bind(this),1)},updateTimer:function(){var a=RSSubscrptionSaleManager.getNextSubscriptionBonusCollectTime()- TimeManager.getInstance().getCurrentServerTime();RSSubscrptionSaleManager.getCurrentDayClaimedStatus()&&0<a&&this._timerLabel.setString(RSUtils.formattedTime(a));0>a&&this._widgetRenewal&&(this._widgetRenewal=!1,RSEngine.screenManager.addOverlay(),RSSubscrptionSaleManager.getCollectedDates("",this.onDataFetchingSuccess.bind(this)))},onDataFetchingSuccess:function(a){RSSubscrptionSaleManager.getNextSubscriptionBonusCollectTime()?(RSEngine.screenManager.removeOverlay(),this._callBack()):this.scheduleFunctionOnce(function(){this._scroller.removeAllChildren(); this.setupCalendarObjects()}.bind(this),1)}}),RSSubscriptionSaleCalendarObjects=RSDisplayObject.extend({init:function(a,b,c){this._super.init.call(this,new RSRect(0,0,b.w,b.h));this._dayStatus=RSSubscrptionSaleManager.getCalendarArray(a);this._currentDay=c;this.loadLayout(RSGame.getInstance().getAssetPath("SubscriptionSaleCalendarTileWidget"))},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "NeonBg":this._neonBg=a;break;case "TickAnim":this._tickAnim= a,this._tickAnim.setVisible(!1),this._tickAnim.stopAnimation()}},createCustomObject:function(a,b){switch(b.name){case "OneMillion":this._oneMillion=RSUtils.createBasicObject(a,b);this.addChild(this._oneMillion);this._oneMillion.setVisible(!1);break;case "Overlay":this._overlay=RSUtils.createBasicObject(a,b);this._overlay.setVisible(!1);this.addChild(this._overlay);break;case "FilledTick":this._filledTick=RSUtils.createBasicObject(a,b);this._filledTick.setVisible(!1);this.addChild(this._filledTick); break;case "Tick":this._Tick=RSUtils.createBasicObject(a,b);this._Tick.setVisible(!1);this.addChild(this._Tick);break;case "Days":this._days=RSPlatformFontAssetManager.createCustomLabel(this._dayStatus.day,b);this.addChild(this._days);break;case "Amount":var c=RSUtils.formatNumber(this._dayStatus.amount);this._amount=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(this._amount);this._amount.setVisible(!0)}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._dayStatus.collected? (this._amount.setVisible(!1),this._filledTick.setVisible(!0)):this._dayStatus.day<this._currentDay&&(this._Tick.setVisible(!0),this._amount.setVisible(!1));RSSubscrptionSaleManager.getisTrial()&&this._dayStatus.day>RSSubscrptionSaleManager.getTrialDays()&&this._overlay.setVisible(!0)},playAnimation:function(a,b){this._dayStatus.collected||(this._tickAnim.playAnimation(1,0.8,this.setAnimation.bind(this,a,b)),this._tickAnim.setVisible(!0),this._amount.setVisible(!1))},setAnimation:function(a,b){this._tickAnim.stopAnimation(); this._tickAnim.setVisible(!1);this._Tick.setVisible(!1);this._filledTick.setVisible(!0);RSSubscrptionSaleManager.getCollectedDates(RSSubscrptionSaleManager.getCurrentDate("date"),"");var c=a.getDisplayObject()._calculateItemPositionWithAnchor(a.getDisplayObject().getItem(this._currentDay-1),{x:1,y:1}),d=this._currentDay%8;0==d&&(d=8);var e=this._neonBg.getSize()._width,f=this._neonBg.getSize()._height;c.x+=d*e;1!=d&&(f*=2);c.y+=f;d=new RSPanel(this._neonBg.getX(),this._neonBg.getY(),70,70);d.setPosition(c.x, c.y);d.setZOrder(10);b.addChild(d);c=new RSPoint(this._neonBg.getX(),this._neonBg.getY());RSCasinoManager.getCasinoHUD().playCoinReceivedAnimation(c,d);RSEngine.externalGameManager&&RSEngine.externalGameManager.isSpinGameActive()&&RSEngine.externalGameManager.updateCoin(RSGame.getInstance().getUserDataManager().getMe().getCoins());RSSubscrptionSaleManager.getisTrial()?RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.ECONOMY,"free_source_coins","purchase_bonus_day"+this._currentDay, RSSubscrptionSaleManager.getItemValue(),RSSubscrptionSaleManager.getPackName(),""):(c=parseInt(RSSubscrptionSaleManager.getItemValue()),c=RSGame.getInstance().getUserDataManager().getMe().getPaidCoins()+c,0<c&&RSGame.getInstance().getUserDataManager().getMe().setPaidCoins(c),RSAnalyticsManager.getInstance().trackInHouseEvent(RSEventCategory.ECONOMY,"paid_source_coins","purchase_bonus_day"+this._currentDay,RSSubscrptionSaleManager.getItemValue(),RSSubscrptionSaleManager.getPackName(),""))}});var RSSubscriptionSaleCalendarPopup=RSGenericPopup.extend({init:function(a,b){this._super.init.call(this);this._source=a;this._callBack=b;this._buttonSound=null;this._assetList=[{name:RSGame.getInstance().getAssetPath("SubscriptionSaleCalendarPopup"),count:1}]},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CloseBtnBigBg":this._closeButton=a,this._closeButton.setButtonSound(this._buttonSound)}}, createCustomObject:function(a,b){switch(b.name){case "BigBg":this._bigBg=RSUtils.createBasicObject(a,b);this.addChild(this._bigBg);break;case "SubscriptionSaleCalendarWidget":this._widgetData=b,this._subscriptionSaleInfoWidget=new RSSubscriptionSaleCalendarWidget(b,this.closePopup.bind(this),this._source),this.addChild(this._subscriptionSaleInfoWidget),this._subscriptionSaleInfoWidget.setCenter(b.x,b.y)}this._super.createCustomObject(a,b)},onLayoutCompleted:function(){RSAnalyticsManager.getInstance().trackGUIEvent("subscription_info", "trigger","open_from_"+this._source,RSSubscrptionSaleManager.getPackName(),"");this._super.onLayoutCompleted.call(this)},onButtonClicked:function(a){switch(a){case "CloseBtnBigBg":this.closePopup();RSAnalyticsManager.getInstance().trackGUIEvent("subscription_info","close","open_from_"+this._source,RSSubscrptionSaleManager.getPackName(),"");break;case "InfoBtn":RSAnalyticsManager.getInstance().trackGUIEvent("subscription_sale_calender","open","open_from_subscription_sale_calender","",""),RSEngine.popupManager.addPopup(new RSSubscriptionSaleInfoPopup(this._source))}this._super.onButtonClicked.call(this, a)},update:function(){this._subscriptionSaleInfoWidget.updateTimer()},closePopup:function(){this._callBack&&this._callBack();RSSubscrptionSaleManager.showSubscriptionToolKit();this._super.closePopup.call(this)}});var RSSubscrptionSaleManager={_isTempDictionarySet:!1,_callBack:null,showSubscriptionSuccesPopup:function(){RSEngine.popupManager.addPopup(new RSSubscriptionSaleSuccessPopup(null,this.onSubscriptionSaleSuccesPopupClosed.bind(this)),!0)},getCalendarArray:function(a){return this._subscriptionData.data[a]},getCalendarData:function(){return this._subscriptionData.data},getPackName:function(){return this._subscriptionData.analyticsName},getItemValue:function(){return this._subscriptionData.itemValue}, showSubscriptionSalePopup:function(a,b,c){this._source=a;b&&(this._callBack=b);"1"==RSEngine.gameData.getDefaultValues().isNMISubscriptionActive&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&(this.getCurrentDate("day")&&!RSGame.getInstance().getUserDataManager().getMe().getIsSubscriptionInteruptedShownStatus()?RSEngine.popupManager.addPopup(new RSSubscriptionSaleCalendarPopup(a)):"failed"==this.getPaymentStatus()||"SubscriptionInterrupted"==this.getPaymentStatus()?RSEngine.popupManager.addPopup(new RSSubscriptionFailedPopup(this.getPaymentStatus(), this._source),!0):"renew"==this.getPaymentStatus()?RSEngine.popupManager.addPopup(new RSSubscriptionFailedPopup(this.getPaymentStatus(),this._source),!0):RSSaleManager.getInstance().showSubscriptionSalePopup(this._source,this.onSubscriptionSalePopupClose.bind(this),c))},onSubscriptionSalePopupClose:function(){RSSaleManager.getInstance().getSubscriptionPurchasedStatus()?console.log("Subscription purchased. Delaying call back"):null!=this._callBack&&(this._callBack(RSSaleManager.getInstance().getSubscriptionPurchasedStatus()), this._callBack=null)},onSubscriptionSaleSuccesPopupClosed:function(){null!=this._callBack&&(this._callBack(RSSaleManager.getInstance().getSubscriptionPurchasedStatus()),this._callBack=null)},showSubscriptionToolKit:function(){RSGame.getInstance().getGameManager().isSkipSubscriptionTooltip()||RSGame.getInstance().getUserDataManager().getMe().getSubscriptionToolTipShown()||RSGameScreenManager.getInstance().getCurrentScreen()!==RSGameScreens.MainLobby||!RSSubscrptionSaleManager.getCurrentDate("day")|| (RSGame.getInstance().getUserDataManager().getMe().setSubscriptionToolTipShown(!0),RSEngine.popupManager.addPopup(new RSSubscriptionToolKitPopup,!1,!1,!1))},getCurrentDate:function(a){if(this._subscriptionData.status){if("date"==a)return this._subscriptionData.CurrentDate;if("day"==a)return this._subscriptionData.CurrentDayNo}return null},getisTrial:function(){return this._subscriptionData.isTrial},getTrialDays:function(){return this._subscriptionData.trialDays},getNextSubscriptionBonusCollectTime:function(){return this._subscriptionData.subscriptionEndTime}, getCurrentDayClaimedStatus:function(){return this._subscriptionData?this._subscriptionData.currentDayClaimedStatus:!1},getCurrentDayNo:function(){return this._subscriptionData?parseInt(this._subscriptionData.CurrentDayNo):0},getIsCancelled:function(){return this._subscriptionData?this._subscriptionData.isCancelled:!1},getSubscriptionStatus:function(){return this._subscriptionData&&this._subscriptionData.currentStatus?this._subscriptionData.currentStatus:!1},getPaymentStatus:function(){return this._subscriptionData&& this._subscriptionData.paymentstatus?this._subscriptionData.paymentstatus:!1},getSubscriptionData:function(){RSGame.getInstance().getUserDataManager().getSubscriptionData(this.onSubscriptionDataFetchingSucces.bind(this),this.onSubscriptionDataFetchingFailed.bind(this))},initializeSubscriptionData:function(a){this.getCollectedDates("",a)},getCollectedDates:function(a,b){a?RSGame.getInstance().getUserDataManager().getCollectedDates(a,this.onSubscriptionDataFetchingSucces.bind(this,b),this.onSubscriptionDataFetchingFailed.bind(this)): RSGame.getInstance().getUserDataManager().getCollectedDates("",this.onSubscriptionDataFetchingSucces.bind(this,b),this.onSubscriptionDataFetchingFailed.bind(this))},setCollectedDates:function(){RSGame.getInstance().getUserDataManager().setCollectedDates(transactionId,this.getCurrentDate("date"),this.onSubscriptionDataFetchingSucces.bind(this),this.onSubscriptionDataFetchingFailed.bind(this))},onSubscriptionDataFetchingSucces:function(a,b){cc.log("On succes");b.result&&(this._subscriptionData=b.result, this._isTempDictionarySet=!1,"true"==this._subscriptionData.isTempDictionarySet&&(this._isTempDictionarySet=!0));b.result.eligibility&&(RSCasinoManager.addPrimaryCurrencyForDisplay("Subscription_Reward",parseInt(b.result.itemValue)),RSEngine.externalGameManager&&RSEngine.externalGameManager.isSpinGameActive()&&(RSEngine.externalGameManager.updateCoin(RSGame.getInstance().getUserDataManager().getMe().getCoins()),RSEngine.externalGameManager.reloadExternalGame()),RSEventManager.getInstance().dispatchEvent("onSubscriptionSuccess")); a&&a()},onSubscriptionDataFetchingFailed:function(){RSEngine.screenManager.removeOverlay();this.getSubscriptionData()},onCollectedDateFetchingSucces:function(a){cc.log("On succes")},onCollectedDateFetchingFailed:function(){this.getCollectedDates()},onCollectedDateSettingSucces:function(a){cc.log("On succes")},onCollectedDateSettingFailed:function(){this.setCollectedDates()},checkAndSetSubscriptionInteruptedShownStatus:function(a){this._isTempDictionarySet&&7<this.getCurrentDate("day")&&!RSGame.getInstance().getUserDataManager().getMe().getIsSubscriptionInteruptedShownStatus()? (RSGame.getInstance().getUserDataManager().setSubscriptionInteruptedShownStatus(),RSGame.getInstance().getUserDataManager().getMe().setIsSubscriptionInteruptedShownStatus(),RSEngine.popupManager.addPopup(new RSSubscriptionFailedPopup("SubscriptionInterrupted","interruptShown",a))):a&&a()},getSubscriptionSalePopupTriggerStatusForEvent:function(a){return"1"==RSEngine.gameData.getDefaultValues().isNMISubscriptionActive&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&"US"==RSGame.getInstance().getUserDataManager().getMe().getCountryCode()&& null==RSSubscrptionSaleManager.getCurrentDate("day")&&!RSSubscrptionSaleManager.getPaymentStatus()&&GameConfig.PLATFORM_EVENT_MANAGER_ENABLED&&RSGame.getInstance().getPlatformEventManager()&&RSGame.getInstance().getPlatformEventManager().getEventDataActiveStatus(RSPlatformEventTypeKeys.SUBSCRIPTION,a)?(RSEventManager.getInstance().dispatchEvent(RSPlatformEventTypeKeys.RSPlatformEvent,{event:RSPlatformEventTypeKeys.SUBSCRIPTION,parameter:a}),!0):!1}};var RSSubscriptionWidget=RSDisplayObject.extend({_subAnimation:null,_buyAnimation:null,_subButton:null,_buyButton:null,_showscriptionwidget:!1,init:function(a,b){this._layout=a;this._source=b;this.rect=new RSRect(0,0,0,0);this._super.init.call(this,this.rect);this.loadContent();RSEventManager.getInstance().addEventListener("onSubscriptionSuccess",this,this._setWidget.bind(this))},loadContent:function(){this.loadLayout(this._layout)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this); this._setWidget()},onObjectCreated:function(a,b,c){switch(c.name){case "ShowSaleButton":this._subButton=a;this.addChild(this._subButton);this._subButton.setVisible(!1);this._subButton.setTouchEnabled(!1);break;case "BuyCoinsBtn":this._buyButton=a;this.addChild(this._buyButton);this._buyButton.setVisible(!1);this._buyButton.setTouchEnabled(!1);break;case "SubAnimation":this._subAnimation=a;this._subAnimation.stopAnimation();break;case "BuyCoinAnimation":this._buyAnimation=a;this._buyAnimation.stopAnimation(); break;case "SubscriptionBox":this._subbox=a;this._subbox.setVisible(!1);this.removeChild(this._subbox);break;case "BuyCoins":this._buybox=a,this._buybox.setVisible(!1),this.removeChild(this._buybox)}},_setWidget:function(){GameConfig.SUBSCRIPTION_ENABLED&&RSGame.getInstance().getGameVariable().isSubscriptionEnabled()&&RSEngine.loginMode==LOGIN_MODE.FACEBOOK?RSSaleManager.getInstance().getSubscriptionSaleStatus()?RSSubscrptionSaleManager.getCurrentDate("day")?this._showscriptionwidget=!1:this._showscriptionwidget= !0:this._showscriptionwidget=!1:"waiting for renewel"==RSSubscrptionSaleManager.getSubscriptionStatus()?this._showscriptionwidget=!0:"renew"==RSSubscrptionSaleManager.getPaymentStatus()?this._showscriptionwidget=!0:this._showscriptionwidget=!1;RSEngine.loginMode==LOGIN_MODE.GUEST?(null!=this._buybox&&(this.addChild(this._buybox),this._buybox.setVisible(!0)),null!=this._buyButton&&(this._buyButton.setVisible(!0),this._buyButton.setTouchEnabled(!0),this._buyButton.setZOrder(3)),null!=this._buyAnimation&& (this._buyAnimation.setZOrder(2),this._buyAnimation.playAnimation(-1,0.4,null))):this._showscriptionwidget?(null!=this._subbox&&(this.addChild(this._subbox),this._subbox.setVisible(!0)),null!=this._subButton&&(this._subButton.setVisible(!0),this._subButton.setTouchEnabled(!0),this._subButton.setZOrder(3)),null!=this._subAnimation&&(this._subAnimation.setZOrder(2),this._subAnimation.playAnimation(-1,1,null))):(null!=this._buybox&&(this.addChild(this._buybox),this._buybox.setVisible(!0)),null!=this._buyButton&& (this._buyButton.setVisible(!0),this._buyButton.setTouchEnabled(!0),this._buyButton.setZOrder(3)),null!=this._buyAnimation&&(this._buyAnimation.setZOrder(2),this._buyAnimation.playAnimation(-1,0.4,null)))},onButtonClicked:function(a){switch(a){case "ShowSaleButton":if(RSEngine.loginMode==LOGIN_MODE.GUEST){this.showLoginPromptPopup("PurchaseCart");break}else"waiting for renewel"==RSSubscrptionSaleManager.getSubscriptionStatus()?RSEngine.popupManager.addPopup(new RSSubscriptionFailedPopup(RSSubscrptionSaleManager.getPaymentStatus(), this._source)):"renew"==RSSubscrptionSaleManager.getPaymentStatus()?RSEngine.popupManager.addPopup(new RSSubscriptionFailedPopup(RSSubscrptionSaleManager.getPaymentStatus(),this._source)):RSSubscrptionSaleManager.showSubscriptionSalePopup(this._source);break;case "BuyCoinsBtn":RSGame.getInstance().getGameManager().onBuyCoinsBtnClicked()}},showLoginPromptPopup:function(a){RSGame.getInstance().getGameManager().showLoginPopup("feature",a)},unload:function(){this._super.unload.call(this)}});var RSSubscriptionToolKitPopup=RSPopup.extend({_assetFolder:null,_assetList:null,_toolTipCloseTimer:null,init:function(a){this._super.init.call(this,a);RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("SubscriptionToolKitFontconfig"),"SubscriptionToolKitFontconfig.json");this._assetList=[{name:RSGame.getInstance().getAssetPath("RSSubscriptionToolKitPopup"),count:1}]},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);this._toolTipCloseTimer=RSUtils.callFunctionWithDelay(5, this,this.closePopup.bind(this))},loadContent:function(){this.layoutScreen(this._assetList);this._super.loadContent.call(this)},createCustomObject:function(a,b){switch(b.name){case "MessageLabel":var c=RSGame.getInstance().getGameData().getPopupTextWithKey("SubscriptionToolTipText"),c=c.replace(/\\n/g,"\n");this._msglabel=RSPlatformFontAssetManager.createCustomLabel(c+"\n",b);this.addChild(this._msglabel)}},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "MediumBg":a.setVisible(!1); break;case "ContinueBtn":this._continueButton=a;break;case "CloseBtn":this._closeButton=a}},handleTouchEndAt:function(a,b,c){this.closePopup()},closePopup:function(){this._toolTipCloseTimer=null;this._super.closePopup.call(this)}});var RSSubscriptionSaleInfoPopup=RSGenericPopup.extend({init:function(a,b,c){this._super.init.call(this);this._callback=c;this._source=a?a:RSGameScreenManager.getInstance().getCurrentScreen();this._assetFolder=b;a=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(a);this._buttonSound=null;this._assetList=[{name:RSGame.getInstance().getAssetPath("SubscriptionSaleInfoPopup"),count:1}]},loadContent:function(){this._buttonSound=RSGame.getInstance().getAssetPath("ButtonSFX");this.layoutScreen(this._assetList); this._super.loadContent.call(this)},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CloseBtnBigBg":this._closeButton=a,this._closeButton.setButtonSound(this._buttonSound)}},createCustomObject:function(a,b){switch(b.name){case "BigBg":this._bigBg=RSUtils.createBasicObject(a,b);this.addChild(this._bigBg);break;case "SubscriptionSaleInfoWidget":this._subscriptionSaleInfoWidget=new RSSubscriptionSaleInfoWidget(b,this.closePopup.bind(this),this._source), this.addChild(this._subscriptionSaleInfoWidget),this._subscriptionSaleInfoWidget.setCenter(b.x,b.y)}return this._super.createCustomObject.call(this,a,b)},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this);RSAnalyticsManager.getInstance().trackPlayerAction("subscription_details","click","open_from_"+this._source,"","")},onButtonClicked:function(a){switch(a){case "CloseBtnBigBg":RSAnalyticsManager.getInstance().trackPlayerAction("subscription_details","close","open_from_"+this._source, "","");this.closePopup();break;case "GotItButton":this.closePopup()}this._super.onButtonClicked.call(this,a)}}),RSSubscriptionSaleInfoWidget=RSDisplayObject.extend({_termsUrl:null,init:function(a,b,c){RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetFolder("SubscriptionSaleInfoWidget"),"SubscriptionSaleInfoWidgetFontConfig.json");this._displayArea=new RSRect(0,0,a.w,a.h);this._super.init.call(this,this._displayArea);this._source=c?c:RSGameScreenManager.getInstance().getCurrentScreen(); this.loadLayout(RSGame.getInstance().getAssetPath("SubscriptionSaleInfoWidget"));a=new RSRect(0,0,0,0);this._diplayPanel=new RSDisplayObject(a);this._callBack=b},onObjectCreated:function(a,b,c){this._super.onObjectCreated.call(this,a,b,c);switch(c.name){case "CalenderBg":this._calendarBg=a;break;case "InfoButton":this._infoBtn=a;this._infoBtn.setVisible(!1);break;case "Bullet5":this._bullet5=a;break;case "Bullet4":this._bullet4=a;break;case "Bullet3":this._bullet3=a;break;case "Bullet2":this._bullet2= a;break;case "Bullet1":this._bullet1=a}},createCustomObject:function(a,b){switch(b.name){case "SubscriptionSaleInfoText1":var c=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name),d=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(d);c||this._bullet1.setVisible(!1);break;case "SubscriptionSaleInfoText2":c=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);d=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(d);c||this._bullet2.setVisible(!1);break; case "SubscriptionSaleInfoText3":c=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);d=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(d);c||this._bullet3.setVisible(!1);break;case "SubscriptionSaleInfoText4":c=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name);d=RSPlatformFontAssetManager.createCustomLabel(c,b);this.addChild(d);c||this._bullet4.setVisible(!1);break;case "SubscriptionSaleInfoText5":c=RSGame.getInstance().getGameData().getPopupTextWithKey(b.name), d=RSPlatformFontAssetManager.createCustomLabel(c,b),this.addChild(d),c||this._bullet5.setVisible(!1)}},onLayoutCompleted:function(){this._super.onLayoutCompleted.call(this)},onButtonClicked:function(a){switch(a){case "GotItButton":RSAnalyticsManager.getInstance().trackPlayerAction("subscription_details","close","open_from_"+this._source,"","");this._callBack&&this._callBack();break;case "ContactUs":document.getElementById("Helpshift").style.display="block",document.getElementById("helpshiftoverlay").style.display= "block",RSAnalyticsManager.getInstance().trackGUIEvent("support","open","open_from_"+this._source,"","")}this._super.onButtonClicked.call(this,a)}});var RSSubscriptionVipStatusTierWidget=RSDisplayObject.extend({init:function(a,b){this._animCallback=b;this._baseRect=a;this._widgetPanel=new RSPanel(0,0,0,0);this._super.init.call(this,this._baseRect);this.loadLayout(RSGame.getInstance().getAssetPath("SubscriptionVIPStatusTierWidget"))},createCustomObject:function(a,b){switch(b.name){case "SubscribtionVIPStatusTier":var c=new RSRect(b.x,b.y,b.w,b.h);this.currentStatusTier=new VIPTierWidget(c,RSGame.getInstance().getAssetPath("SubscriptionVIPStatusTier"), this.cartItemWidgetStarAnim.bind(this),!0);this.currentStatusTier.setCenter(b.x,b.y);this.addChild(this.currentStatusTier);this._screenBase=new RSPanel(b.x,b.y,b.w,b.h);this._screenBase.setBackgroundColor(255,0,0,100);break;case "SubscriptionCollectionWidget":this._subscriptionCollectWidget=new RSSubscriptionCollectWidget(b,RSGame.getInstance().getAssetPath("SubscriptionCollectionWidget"),"purchase_cart"),this._subscriptionCollectWidget.setCenter(b.x,b.y),this.addChild(this._subscriptionCollectWidget), this._screenBase1=new RSPanel(b.x,b.y,b.w,b.h),this._screenBase1.setBackgroundColor(0,255,0,100)}},onLayoutCompleted:function(){this.addChild(this._widgetPanel)},cartItemWidgetStarAnim:function(){this._animCallback()}});var SubscriptionWidgetState={BuyBtn:"Buy",SubscriptionBtn:"SubscribeButton",CollectBtn:"CollectButton",Timer:"SaleTimerButton"},RSSubscriptionCollectWidget=RSDisplayObject.extend({init:function(a,b,c){this._source=c?c:"main_lobby";this._nameChangeForEvent="SubscriptionCollectWidget_"+this._source;this._currentWidgetState="";a=new RSRect(0,0,a.w,a.h);this._toggleAnimEnabled=this._timerRunning=!1;this._widgetRenewal=!0;this._asset=b?b:RSGame.getInstance().getAssetPath("SubscriptionCollectWidget");this._super.init.call(this, a);RSEventManager.getInstance().addEventListener("onSubscriptionSuccess",this,this.onSubscriptionCompletes.bind(this));RSEventManager.getInstance().addEventListener("updateSubscriptionWidget",this,this.setWidget.bind(this));RSPlatformFontAssetManager.loadFontConfigFile(RSGame.getInstance().getAssetPath("SubscriptionCollectWidgetFontConfig"),"SubscriptionCollectionWidgetFontConfig.json");this.loadContent()},loadContent:function(){this.loadLayout(this._asset)},getName:function(){return this._nameChangeForEvent}, onObjectCreated:function(a,b,c){switch(c.name){case "SubscribeBg":case "SubscriptionBuyBg":this._subscribeBg=a;this._subscribeBg.setVisible(!1);break;case "SubscribeBgAnimation":this._subscribeBgAnimation=a;this._subscribeBgAnimation.setVisible(!1);this._subscribeBgAnimation.stopAnimation();break;case "SubscribeButton":case "SubscriptionButton":this._subscribeButton=a;this._subscribeButton.setVisible(!1);this._subscribeButton.setTouchEnabled(!1);break;case "CollectBg":this._collectBg=a;this._collectBg.setVisible(!1); break;case "CollectBgAnimation":this._collectBgAnimation=a;this._collectBgAnimation.setVisible(!1);this._collectBgAnimation.stopAnimation();break;case "CollectBtn":case "CollectButton":case "SubscriptionCollectBtn":this._collectButton=a;this._collectButton.setVisible(!1);this._collectButton.setTouchEnabled(!1);break;case "NextBonusBg":this._nextBonusBg=a;this._nextBonusBg.setVisible(!1);break;case "SaleTimerButton":case "SubscriptionTimerBg":this._saleTimerButton=a;this._saleTimerButton.setVisible(!1); this._saleTimerButton.setTouchEnabled(!1);break;case "Buy":this._buyButton=a;this._buyButton.setVisible(!1);this._buyButton.setTouchEnabled(!1);break;case "BuyCoinsBg":this._buyCoinsBg=a;this._buyCoinsBg.setVisible(!1);break;case "BuyCoinsAnimation":this._buyCoinsAnimation=a;this._buyCoinsAnimation.setVisible(!1);this._buyCoinsAnimation.stopAnimation();break;case "CoinStack":this._coinStack=a,this._coinStack.setVisible(!1)}this._super.onObjectCreated.call(this,a,b,c)},createCustomObject:function(a, b){switch(b.name){case "BonusValue":this._bonusValue=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(this._bonusValue);this._bonusValue.setVisible(!1);break;case "Timer":case "SubscriptionTimerText":this._timerValue=RSPlatformFontAssetManager.createCustomLabel("",b);this.addChild(this._timerValue);this._timerValue.setVisible(!1);break;case "SubscriptionText1":this._subscriptionText1=RSPlatformFontAssetManager.createCustomLabel("7 DAY FREE TRIAL!",b);this.addChild(this._subscriptionText1); this._subscriptionText1.setVisible(!1);break;case "SubscriptionText2":this._subscriptionText2=RSPlatformFontAssetManager.createCustomLabel("GET 1M COINS EVERYDAY",b);this.addChild(this._subscriptionText2);this._subscriptionText2.setVisible(!1);break;case "TimerText":this._timerText=RSPlatformFontAssetManager.createCustomLabel("NEXT 1M COINS READY IN",b);this.addChild(this._timerText);this._timerText.setVisible(!1);break;case "CollectText":this._collectText=RSPlatformFontAssetManager.createCustomLabel("GRAB YOUR 1M COINS HERE", b),this.addChild(this._collectText),this._collectText.setVisible(!1)}this._super.createCustomObject.call(this,a,b)},onLayoutCompleted:function(){this.setWidget();this.updateTimer();this._super.onLayoutCompleted.call(this)},setWidget:function(){this.setsubscriptionWidget(!1);this.setBuyCoinsWidget(!1);if(GameConfig.SUBSCRIPTION_ENABLED&&!RSGame.getInstance().getUserDataManager().getMe().getIsSubscriptionInteruptedShownStatus()&&RSEngine.loginMode!=LOGIN_MODE.GUEST)if(RSSubscrptionSaleManager.getCurrentDate("day"))if(RSSubscrptionSaleManager.getCurrentDayClaimedStatus())30== RSSubscrptionSaleManager.getCurrentDayNo()&&"true"==RSSubscrptionSaleManager.getIsCancelled()?RSSaleManager.getInstance().getSubscriptionSaleStatus()&&"US"==RSGame.getInstance().getUserDataManager().getMe().getCountryCode()?this.setsubscriptionWidget(!0):this.setBuyCoinsWidget(!0):this.setNextBonusWidget(!0);else this.onCollectButtonActive(!0);else"1"==RSEngine.gameData.getDefaultValues().isNMISubscriptionActive&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&RSSaleManager.getInstance().getSubscriptionSaleStatus()&& "US"==RSGame.getInstance().getUserDataManager().getMe().getCountryCode()?this.setsubscriptionWidget(!0):this.setBuyCoinsWidget(!0);else GameConfig.SUBSCRIPTION_ENABLED&&RSGame.getInstance().getUserDataManager().getMe().getIsSubscriptionInteruptedShownStatus()&&"1"==RSEngine.gameData.getDefaultValues().isNMISubscriptionActive&&RSEngine.loginMode!=LOGIN_MODE.FACEBOOK&&"US"==RSGame.getInstance().getUserDataManager().getMe().getCountryCode()?this.setsubscriptionWidget(!0):this.setBuyCoinsWidget(!0)}, setsubscriptionWidget:function(a){this._subscribeButton.setVisible(a);this._subscribeButton.setTouchEnabled(a);this._coinStack&&this._coinStack.setVisible(a);this._subscribeBg.setVisible(a);this._subscribeBgAnimation&&this._subscribeBgAnimation.setVisible(a);this._subscriptionText1&&a?(this._subscriptionText1.setVisible(!0),this._toggleAnimEnabled=!0,this.startTextToggling()):(this._toggleAnimEnabled=!1,this._subscriptionText1&&(this._subscriptionText1.setVisible(!1),this._subscriptionText2.setVisible(!1))); a?(this._currentWidgetState=SubscriptionWidgetState.SubscriptionBtn,this._subscribeBgAnimation&&this._subscribeBgAnimation.playAnimation(-1,0.4)):this._subscribeBgAnimation&&this._subscribeBgAnimation.stopAnimation()},setBuyCoinsWidget:function(a){this._coinStack&&this._coinStack.setVisible(a);this._buyCoinsBg&&this._buyCoinsBg.setVisible(a);this._buyButton&&(this._buyButton.setVisible(a),this._buyButton.setTouchEnabled(a));a&&(this._currentWidgetState=SubscriptionWidgetState.BuyBtn);this._buyCoinsAnimation&& (this._buyCoinsAnimation.setVisible(a),a?this._buyCoinsAnimation.playAnimation(-1,0.4):this._buyCoinsAnimation.stopAnimation())},setNextBonusWidget:function(a){this._coinStack&&this._coinStack.setVisible(!a);this._timerRunning||(this._timerRunning=!0);this._nextBonusBg?this._nextBonusBg.setVisible(a):this._subscribeBg.setVisible(a);this._saleTimerButton&&(this._saleTimerButton.setVisible(a),this._saleTimerButton.setTouchEnabled(a));this._timerValue.setVisible(a);a&&(this._currentWidgetState=SubscriptionWidgetState.Timer); this._timerText&&this._timerText.setVisible(a)},getWidgetCurrentState:function(){return this._currentWidgetState},onCollectButtonActive:function(a){if(this._bonusValue){var b=RSSubscrptionSaleManager.getCalendarArray(0);this._bonusValue.setString(RSUtils.formatNumberWithComma(b.amount));this._bonusValue.setVisible(a)}this._collectBg?this._collectBg.setVisible(a):this._subscribeBg.setVisible(a);this._collectButton.setVisible(a);this._collectButton.setTouchEnabled(a);this._collectBgAnimation&&(this._collectBgAnimation.setVisible(a), a?this._collectBgAnimation.playAnimation(-1,0.4):this._collectBgAnimation.stopAnimation());a&&(this._currentWidgetState=SubscriptionWidgetState.CollectBtn);this._collectText&&this._collectText.setVisible(a)},updateTimer:function(){GameConfig.SUBSCRIPTION_ENABLED&&RSSubscrptionSaleManager.getCurrentDayClaimedStatus()&&!RSGame.getInstance().getUserDataManager().getMe().getIsSubscriptionInteruptedShownStatus()&&(clearInterval(this._subscriptionRemainingTime),this._subscriptionRemainingTime=setInterval(this.setTimer.bind(this), 1E3))},setTimer:function(){var a=RSSubscrptionSaleManager.getNextSubscriptionBonusCollectTime()-TimeManager.getInstance().getCurrentServerTime();RSSubscrptionSaleManager.getCurrentDayClaimedStatus()&&0<a&&(30!=RSSubscrptionSaleManager.getCurrentDayNo()||"true"!=RSSubscrptionSaleManager.getIsCancelled())&&(this._timerValue.setString(RSUtils.formattedTime(a)),this._timerRunning||(this.onCollectButtonActive(!1),this.setNextBonusWidget(!0)));0>=a&&(this.setCalendar(),this.setNextBonusWidget(!1),this._timerRunning= !1,this.onCollectButtonActive(!0))},setCalendar:function(){0>=RSSubscrptionSaleManager.getNextSubscriptionBonusCollectTime()-TimeManager.getInstance().getCurrentServerTime()&&this._widgetRenewal&&(this._widgetRenewal=!1,RSEngine.screenManager.addOverlay(),RSSubscrptionSaleManager.getCollectedDates("",this.onDataFetchingSuccess.bind(this)))},onDataFetchingSuccess:function(){this._widgetRenewal||RSEngine.screenManager.removeOverlay();this._widgetRenewal=!0},onWidgetTouch:function(){if(""!=this._currentWidgetState)this.onButtonClicked(this._currentWidgetState)}, onButtonClicked:function(a){switch(a){case "SubscribeButton":case "SubscriptionButton":RSSubscrptionSaleManager.showSubscriptionSalePopup(this._source,this.subscriptionPopupCallback.bind(this));break;case "CollectButton":case "SubscriptionCollectBtn":this._collectButton.setTouchEnabled(!1);RSAnalyticsManager.getInstance().trackGUIEvent(this._source,"subscription_collect","click",RSSubscrptionSaleManager.getPackName());RSEngine.popupManager.addPopup(new RSSubscriptionSaleCalendarPopup(this._source, this.subscriptionPopupCallback.bind(this,!0)),!0);break;case "SaleTimerButton":this._saleTimerButton.setTouchEnabled(!1);RSAnalyticsManager.getInstance().trackGUIEvent(this._source,"subscription_timer","click",RSSubscrptionSaleManager.getPackName());RSEngine.popupManager.addPopup(new RSSubscriptionSaleCalendarPopup(this._source,this.saleTimerButtonEnable.bind(this,!0)),!0);break;case "Buy":RSGame.getInstance().getGameManager().onBuyCoinsBtnClicked()}},saleTimerButtonEnable:function(a){this._saleTimerButton.setTouchEnabled(a)}, subscriptionPopupCallback:function(a){this._collectButton&&this._collectButton.setTouchEnabled(a);RSEventManager.getInstance().dispatchEvent("resumeWidgetAnimation",null);this._ccObject&&this.updateTimer()},onSubscriptionCompletes:function(){if(RSSubscrptionSaleManager.getCalendarData())if(this.setsubscriptionWidget(!1),RSSubscrptionSaleManager.getCurrentDayClaimedStatus()){if(30==RSSubscrptionSaleManager.getCurrentDayNo()&&"true"==RSSubscrptionSaleManager.getIsCancelled()){this.onCollectButtonActive(!1); RSSaleManager.getInstance().getSubscriptionSaleStatus()&&"US"==RSGame.getInstance().getUserDataManager().getMe().getCountryCode()?this.setsubscriptionWidget(!0):this.setBuyCoinsWidget(!0);return}this.updateTimer()}else this.onCollectButtonActive(!0);if(GameConfig.SUBSCRIPTION_ENABLED&&RSGame.getInstance().getUserDataManager().getMe().getIsSubscriptionInteruptedShownStatus()&&(RSEngine.loginMode==LOGIN_MODE.FACEBOOK||RSEngine.loginMode==LOGIN_MODE.WEB_FACEBOOK)){if(RSSubscrptionSaleManager.getCalendarData())this.onCollectButtonActive(!1); this.setWidget()}console.log("On subscription success#"+this._source)},startTextToggling:function(){if(this._toggleAnimEnabled){this._subscriptionText2.setVisible(!1);this._subscriptionText1.setVisible(!0);this._subscriptionText1.setScaleY(0.48);var a=this._subscriptionText1.actionScale(0.25,0.48,0.26,this._onScaleDownCompletedForText1.bind(this));RSTweener.easeSineIn(a)}},_onScaleDownCompletedForText1:function(){if(this._toggleAnimEnabled){this._subscriptionText1.setVisible(!1);this._subscriptionText2.setScaleY(0.26); this._subscriptionText2.setVisible(!0);var a=this._subscriptionText2.actionScale(0.25,0.48,0.48,this.onScaleUpCompletedText2.bind(this));RSTweener.easeSineIn(a)}},onScaleUpCompletedText2:function(){RSUtils.callFunctionWithDelay(2,this,this.startTogglingSection2.bind(this))},startTogglingSection2:function(){if(this._toggleAnimEnabled){var a=this._subscriptionText2.actionScale(0.25,0.48,0.26,this.onScaleDownCompletedText2.bind(this));RSTweener.easeSineIn(a)}},onScaleDownCompletedText2:function(){if(this._toggleAnimEnabled){this._subscriptionText2.setVisible(!1); this._subscriptionText1.setVisible(!0);this._subscriptionText1.setScaleY(0.26);var a=this._subscriptionText1.actionScale(0.25,0.48,0.48,this.onScaleUpCompletedText1.bind(this));RSTweener.easeSineIn(a)}},onScaleUpCompletedText1:function(){RSUtils.callFunctionWithDelay(2,this,this.startTextToggling.bind(this))},stopTextToggling:function(){},unload:function(){RSEventManager.getInstance().removeEventListenersIn(this);clearInterval(this._subscriptionRemainingTime);this._super.unload.call(this)}});cc.game.onStart=function(){configureCocosEngine();resize();null!=document.getElementById("loader")&&(document.getElementsByClassName("gameCanvas")[0].style.visibility="hidden");loadResourceConfig(function(a){a&&(RSGame.getInstance()._resourceConfigData=a[0],RSGame.getInstance()._resourceGroupConfigData=a[1],RSGame.getInstance()._languageConfigData=a[2]);initializeGameConfiguration()});var a=document.getElementById("apppagebox");if(null!=a){var b=document.createElement("div");b.id="fbPageDiv";b.innerHTML= "\x3cdiv class\x3d'fb-page fb_iframe_widget' data-href\x3d'"+GameConfig.FAN_PAGE_URL+"' data-width\x3d'760' data-height\x3d'590' data-hide-cover\x3d'false' data-show-facepile\x3d'true' data-show-posts\x3d'true' fb-xfbml-state\x3d'rendered' fb-iframe-plugin-query\x3d'app_id\x3d"+GameConfig.APP_ID+"\x26amp;container_width\x3d760\x26amp;height\x3d590\x26amp;hide_cover\x3dfalse\x26amp;href\x3d"+GameConfig.FAN_PAGE_URL+"\x26amp;locale\x3den_US\x26amp;sdk\x3djoey\x26amp;show_facepile\x3dtrue\x26amp;show_posts\x3dtrue\x26amp;width\x3d760'\x3e\x3cspan style\x3d'vertical-align: bottom; width: 500px; height: 590px;'\x3e\x3ciframe name\x3d'fe0a3a71196f74' width\x3d'760px' height\x3d'590px' frameborder\x3d'0' allowtransparency\x3d'true' allowfullscreen\x3d'true' scrolling\x3d'no' title\x3d'fb:page Facebook Social Plugin' src\x3d'https://www.facebook.com/"+ facebook.version+"/plugins/page.php?app_id\x3d"+GameConfig.APP_ID+"\x26amp;channel\x3dhttps%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D42%23cb%3Df1a71549dcd527%26domain%3Dfb-lb.houseoffuns.com%26origin%3Dhttps%253A%252F%252Ffb-lb.houseoffuns.com%252Ff399ef648d7042%26relation%3Dparent.parent\x26amp;container_width\x3d760\x26amp;height\x3d590\x26amp;hide_cover\x3dfalse\x26amp;href\x3dhttps%3A%2F%2Fwww.facebook.com%2Fhouseoffungames\x26amp;locale\x3den_US\x26amp;sdk\x3djoey\x26amp;show_facepile\x3dtrue\x26amp;show_posts\x3dtrue\x26amp;width\x3d760' style\x3d'border: none; visibility: visible; width: 500px; height: 590px;' class\x3d''\x3e\x3c/iframe\x3e\x3c/span\x3e\x3c/div\x3e"; a.appendChild(b);window.dataLayer=window.dataLayer||[];a=function(){dataLayer.push(arguments)};a("js",new Date);a("config",GameConfig.GOOGLE_ANALYTICS_KEY_CANVAS)}document.getElementById("helpshift").src=GameConfig.HELPSHIFT_URL;document.getElementById("helpshift_dummy").src=GameConfig.HELPSHIFT_URL_FAQ;document.getElementById("Helpshift").style.display="none";document.getElementById("helpshift_dummy").style.display="none"}; var initializeGameConfiguration=function(){var a=new RSGameConfiguration;a.setCustomScreenFactory(new CasinoScreenFactory);a.setCustomGameData(new CasinoGameData);a.setCustomUserDataManager(new CasinoUserDataManager);a.setCustomLevelManager(RSLevelManagerV2.getInstance());a.setCustomGameManager(new CasinoGameManager);a.setCustomPlatformEventManager(new RSPlatformEventManagerV2);RSGame.getInstance().initialize(_settings,a,"res/loading_list.json")},loadResourceConfig=function(a){RESOURCE_CONFIG_PATH&& LANGUAGE_CONFIG_PATH||a();cc.loader.load([RESOURCE_CONFIG_PATH,RESOURCE_GROUP_CONFIG_PATH,LANGUAGE_CONFIG_PATH],function(b,c){null!==b?(a(),cc.log(b)):a(c)})},configureCocosEngine=function(){!cc.sys.isNative&&document.getElementById("cocosLoading")&&document.body.removeChild(document.getElementById("cocosLoading"))};cc.game.run();var timeout;window.onbeforeunload=confirmExit; function confirmExit(){if(RSEngine.loginMode!=LOGIN_MODE.GUEST){RSSaleManager.getInstance().forceProcessSaleQueue();null!=RSEngine.dataManager.getMe()&&(GlobalVars.isUserDataLoaded&&RSEngine.dataManager.saveUserBlobParams(),RSEngine.dataManager.updatePlatformSDKOnQuit());if(null!=RSEngine.dataManager.getMe()&&RSEngine.dataManager.isSavePending()&&!GlobalVars.relaunchPopupActive)return"You have attempted to leave this page. Are you sure?";RSEngine.loginMode!=LOGIN_MODE.GUEST&&GameConfig.IS_ADJUST_ENABLED&& RSAdjustManager.getInstance().trackSessionStop();RSAnalyticsManager.getInstance().stopSession()}}function noTimeout(){RSAnalyticsManager.getInstance().stopSession();clearTimeout(timeout)}window.onunload=noTimeout;var rtime;timeout=!1;var delta=200;window.onresize=function(){rtime=new Date;!1===timeout&&(timeout=!0,setTimeout(resizeend,delta))};function resizeend(){new Date-rtime<delta?setTimeout(resizeend,delta):(timeout=!1,resize())} function resize(){var a=document.getElementById("Cocos2dGameContainer");if(null!=a){var b=a.style.height,c=document.getElementById("SpinGame");try{if(RSGame.getInstance().isFBGameRoom()){var d=(window.outerHeight-70)/window.devicePixelRatio;FB.Canvas.setSize({width:1.778*d,height:d})}if(GameConfig.JACKPOT_LOUNGE_ENABLE&&GlobalVars.isjackpotLoaded)RSGame.getInstance().getGameManager().resizeJackpot();else if(GameConfig.TOURNAMENT_ENABLED&&GlobalVars.isTournamentLoaded){var e=document.getElementById("Cocos2dGameContainer"), f=0.102*parseInt(e.style.height.substring(0,e.style.height.length-2))+"px",g=parseInt(e.style.width.substring(0,e.style.width.length-2))+parseInt(e.style.paddingLeft.substring(0,e.style.paddingLeft.length-2))+"px";RSEngine.externalGameManager.addClippingToExternalGame("0px",f,g,e.style.height);RSEngine.externalGameManager.resizeSpinGameDiv()}else if(RSExternalGameManager instanceof Object&&RSEngine.externalGameManager)RSEngine.externalGameManager.resizeSpinGameDiv();else if(null!=c){var h=0.102*parseInt(b.substring(0, b.length-2)),k=0.892*parseInt(b.substring(0,b.length-2));c.style.top=h+"px";c.style.height=k+"px"}}catch(m){cc.log("Resized window before initializing RSGame")}c=document.getElementById("ProgressBG");null!=c&&(d=0.9*parseInt(b.substring(0,b.length-2)),c.style.marginTop=d+"px");document.getElementById("version-number")&&(c=parseInt(b.substring(0,b.length-2)),a.style.marginTop="0px",document.getElementById("version-number").style.paddingTop=c+"px");document.getElementById("Helpshift")&&(a=parseInt(b.substring(0, b.length-2)),a-=14,document.getElementById("Helpshift").style.height=a+"px");try{SideMenuController&&SideMenuController.getInstance().handlePositionAndOffset()}catch(n){cc.log("SideMenuController not yet ready")}}}document.body.onclick=function(a){"undefined"!=typeof GlobalVars&&GlobalVars&&GlobalVars instanceof Object&&!GlobalVars.isAudioContextInitialized&&RSEngine.audioManager&&(GlobalVars.isAudioContextInitialized=!0,RSEngine.audioManager.stopEffect(),RSEngine.audioManager.stopAllEffects(),RSEngine.audioManager.reInitializeAudioContext())}; (function(a,b,c,d,e,f,g){a.GoogleAnalyticsObject=e;a[e]=a[e]||function(){(a[e].q=a[e].q||[]).push(arguments)};a[e].l=1*new Date;f=b.createElement(c);g=b.getElementsByTagName(c)[0];f.async=1;f.src=d;g.parentNode.insertBefore(f,g)})(window,document,"script","https://www.google-analytics.com/analytics.js","ga"); function showHelpShift(a){a&&(this._openFrom=a,RSAnalyticsManager.getInstance().trackGUIEvent("support","open","open_from_"+this._openFrom,"",""));document.getElementById("Helpshift").style.display="block";document.getElementById("helpshiftoverlay").style.display="block";resize()} function closeHelpShift(){this._openFrom&&(RSAnalyticsManager.getInstance().trackGUIEvent("support","close","open_from_"+this._openFrom,"",""),this._openFrom=null);document.getElementById("helpshift").src=GameConfig.HELPSHIFT_URL;document.getElementById("Helpshift").style.display="none";document.getElementById("helpshiftoverlay").style.display="none"}function checkBrowserCompatibility(){return-1<window.navigator.userAgent.toLowerCase().indexOf("edge")||"ie"==cc.sys.browserType?!1:!0} document.addEventListener("AppleIDSignInOnSuccess",function(a){a=getAppleUserNameFromToken(a.detail.authorization.id_token);RSEngine.screenManager.addOverlay();RSLoginManager.getInstance().updateSocialLogin("apple",a.sub,a.email)});document.addEventListener("AppleIDSignInOnFailure",function(a){RSAnalyticsManager.getInstance().trackPlayerAction("manage_account","link_apple","fail","","popup_closed")}); function getAppleUserNameFromToken(a){a=a.split(".")[1].replace(/-/g,"+").replace(/_/g,"/");a=decodeURIComponent(atob(a).split("").map(function(a){return"%"+("00"+a.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)};