var touch,__extends=this&&this.__extends||function(){var e=function(t,a){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])})(t,a)};return function(t,a){function n(){this.constructor=t}if("function"!=typeof a&&null!==a)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");e(t,a),t.prototype=null===a?Object.create(a):(n.prototype=a.prototype,new n)}}();!function(e){var t=function(t){function a(){var a=t.call(this)||this;a._diamond=0,a._record=0,a._record2=0,a._homescreen=0,a._skinUnlocks=[0],a._videoNums=null,a._skinIndex=0,a._showSkinIndex=0,a._isMusicOn=!1,a._isSoundOn=!1,a._isVibrateOn=!1,a._dailyVaild=!1,a._dailyCount=0,a._weekCount=0,a._bgSkinIndex=0,a._onlineTime=0,a._onlineIndex=0,a._storeTime=0,a._rank=0,a._isGame1On=!0,a._isGame2On=!0,a._isGame3On=!0,a._isGame4On=!0,a._isGame5On=!0,a._isGame6On=!0,a._isNewUser=!1,a._config={tasks:{skins:[{id:100,type:e.TASK_VALUE_TYPE.TOTAL_DISTANCE,value:0,rewardType:e.REWARD_TYPE.SKIN,rewardValue:0,price:0},{id:101,type:e.TASK_VALUE_TYPE.TOTAL_DISTANCE,value:1e3,rewardType:e.REWARD_TYPE.SKIN,rewardValue:1,price:500},{id:102,type:e.TASK_VALUE_TYPE.TOTAL_DISTANCE,value:2e3,rewardType:e.REWARD_TYPE.SKIN,rewardValue:2,price:500},{id:103,type:e.TASK_VALUE_TYPE.TOTAL_DISTANCE,value:3e3,rewardType:e.REWARD_TYPE.SKIN,rewardValue:3,price:500},{id:104,type:e.TASK_VALUE_TYPE.TOTAL_DISTANCE,value:4e3,rewardType:e.REWARD_TYPE.SKIN,rewardValue:4,price:500},{id:105,type:e.TASK_VALUE_TYPE.TOTAL_DISTANCE,value:5e3,rewardType:e.REWARD_TYPE.SKIN,rewardValue:5,price:500},{id:106,type:e.TASK_VALUE_TYPE.TOTAL_DISTANCE,value:6e3,rewardType:e.REWARD_TYPE.SKIN,rewardValue:6,price:500},{id:107,type:e.TASK_VALUE_TYPE.TOTAL_DISTANCE,value:7e3,rewardType:e.REWARD_TYPE.SKIN,rewardValue:7,price:500},{id:108,type:e.TASK_VALUE_TYPE.TOTAL_DISTANCE,value:8e3,rewardType:e.REWARD_TYPE.SKIN,rewardValue:8,price:500},{id:109,type:e.TASK_VALUE_TYPE.TOTAL_DISTANCE,value:9e3,rewardType:e.REWARD_TYPE.SKIN,rewardValue:9,price:500},{id:200,type:e.TASK_VALUE_TYPE.TOTAL_SURPASS,value:10,rewardType:e.REWARD_TYPE.SKIN,rewardValue:11,price:500},{id:201,type:e.TASK_VALUE_TYPE.TOTAL_SURPASS,value:20,rewardType:e.REWARD_TYPE.SKIN,rewardValue:12,price:500},{id:202,type:e.TASK_VALUE_TYPE.TOTAL_SURPASS,value:30,rewardType:e.REWARD_TYPE.SKIN,rewardValue:13,price:500},{id:203,type:e.TASK_VALUE_TYPE.TOTAL_SURPASS,value:40,rewardType:e.REWARD_TYPE.SKIN,rewardValue:14,price:500},{id:204,type:e.TASK_VALUE_TYPE.TOTAL_SURPASS,value:150,rewardType:e.REWARD_TYPE.SKIN,rewardValue:15,price:500},{id:205,type:e.TASK_VALUE_TYPE.TOTAL_SURPASS,value:260,rewardType:e.REWARD_TYPE.SKIN,rewardValue:16,price:500},{id:206,type:e.TASK_VALUE_TYPE.TOTAL_SURPASS,value:370,rewardType:e.REWARD_TYPE.SKIN,rewardValue:17,price:500},{id:207,type:e.TASK_VALUE_TYPE.TOTAL_SURPASS,value:480,rewardType:e.REWARD_TYPE.SKIN,rewardValue:18,price:500},{id:208,type:e.TASK_VALUE_TYPE.TOTAL_SURPASS,value:590,rewardType:e.REWARD_TYPE.SKIN,rewardValue:19,price:500},{id:209,type:e.TASK_VALUE_TYPE.TOTAL_SURPASS,value:1e3,rewardType:e.REWARD_TYPE.SKIN,rewardValue:20,price:500},{id:300,type:e.TASK_VALUE_TYPE.NONE,value:0,rewardType:e.REWARD_TYPE.SKIN,rewardValue:20,price:100},{id:301,type:e.TASK_VALUE_TYPE.NONE,value:0,rewardType:e.REWARD_TYPE.SKIN,rewardValue:21,price:200},{id:302,type:e.TASK_VALUE_TYPE.NONE,value:0,rewardType:e.REWARD_TYPE.SKIN,rewardValue:22,price:200},{id:303,type:e.TASK_VALUE_TYPE.NONE,value:0,rewardType:e.REWARD_TYPE.SKIN,rewardValue:23,price:300},{id:304,type:e.TASK_VALUE_TYPE.NONE,value:0,rewardType:e.REWARD_TYPE.SKIN,rewardValue:24,price:400},{id:305,type:e.TASK_VALUE_TYPE.NONE,value:0,rewardType:e.REWARD_TYPE.SKIN,rewardValue:25,price:500},{id:306,type:e.TASK_VALUE_TYPE.NONE,value:0,rewardType:e.REWARD_TYPE.SKIN,rewardValue:26,price:600},{id:307,type:e.TASK_VALUE_TYPE.NONE,value:0,rewardType:e.REWARD_TYPE.SKIN,rewardValue:27,price:700},{id:308,type:e.TASK_VALUE_TYPE.NONE,value:0,rewardType:e.REWARD_TYPE.SKIN,rewardValue:28,price:800},{id:309,type:e.TASK_VALUE_TYPE.NONE,value:0,rewardType:e.REWARD_TYPE.SKIN,rewardValue:29,price:900}]},diamondGroup:{distance:500,space:2.5,min:15,max:20,enabled:!1},powerupGroup:{start:100,distance:500,space:2.5,min:15,max:20,enabled:!0},speed:{init:15,ai_init:18,ai_init_min:20,ai_init_max:32,normal_max:42,sprint_max:47,increase:10.8,auto_decrease:3.24,sprint_time:10,sprint_increase:25,sprint_decrease:0}},a._adjustConfig=[];var n=Laya.LocalStorage.getItem("skin_unlock");if(n){n.split(",").forEach(function(e){var t=parseInt(e);-1==a._skinUnlocks.indexOf(t)&&a._skinUnlocks.push(t)})}var i=Laya.LocalStorage.getItem("videoNums");if(i){a._videoNums=new Array;i.split(",").forEach(function(e){a._videoNums.push(parseInt(e))})}else{a._videoNums=new Array;for(var r=0;r=7&&(a._dailyCount=0)):a._dailyCount=0;var g=Laya.LocalStorage.getItem("weekCount");a._weekCount=g?parseInt(g):0,7==a._dailyCount&&a._dailyVaild&&(a._weekCount++,Laya.LocalStorage.setItem("weekCount",a._weekCount.toString()),a._dailyCount=0);var T=Laya.LocalStorage.getItem("bgSkinIndex");T&&(a._bgSkinIndex=parseInt(T));var f=Laya.LocalStorage.getItem("onlineDate"),I=!1,E=new Date;f&&(I=f!=E.toDateString()),Laya.LocalStorage.setItem("onlineDate",E.toDateString());var L=Laya.LocalStorage.getItem("onlineTime");L&&(a._onlineTime=I?0:parseInt(L));var h=Laya.LocalStorage.getItem("onlineIndex");h&&(a._onlineIndex=I?0:parseInt(h));var A=Laya.LocalStorage.getItem("isGame1On");A&&(a.isGame1On="false"!=A,a.isGame1On=!!I);var O=Laya.LocalStorage.getItem("isGame2On");O&&(a.isGame2On="false"!=O,a.isGame2On=!!I);var v=Laya.LocalStorage.getItem("isGame3On");v&&(a.isGame3On="false"!=v,a.isGame3On=!!I);var w=Laya.LocalStorage.getItem("isGame4On");w&&(a.isGame4On="false"!=w,a.isGame4On=!!I);var P=Laya.LocalStorage.getItem("isGame5On");P&&(a.isGame5On="false"!=P,a.isGame5On=!!I);var N=Laya.LocalStorage.getItem("isGame6On");return N&&(a.isGame2On="false"!=N,a.isGame6On=!!I),a}return __extends(a,t),Object.defineProperty(a.prototype,"isNewUser",{get:function(){return this._isNewUser},enumerable:!1,configurable:!0}),a.prototype.newMatch=function(){},a.prototype.getObj=function(){return{uid:"",skin_unlock:this._skinUnlocks.toString(),videoNums:this._videoNums.toString(),skin_index:this._skinIndex.toString(),record:this._record.toString(),record2:this._record2.toString(),diamond:this._diamond.toString(),dailyDate:Laya.LocalStorage.getItem("dailyDate"),pkDate:Laya.LocalStorage.getItem("pkDate"),dailyCount:this._dailyCount.toString(),onlineDate:Laya.LocalStorage.getItem("onlineDate"),onlineTime:this._onlineTime.toString(),onlineIndex:this._onlineIndex.toString(),weekCount:this._weekCount.toString(),bgSkinIndex:this._bgSkinIndex.toString()}},a.prototype.setFbObj=function(t){var a=this,n=t.skin_unlock;if(this._skinUnlocks=[],n){this._skinUnlocks=[];n.split(",").forEach(function(e){var t=parseInt(e);-1==a._skinUnlocks.indexOf(t)&&a._skinUnlocks.push(t)})}var i=t.videoNums;if(this._videoNums=[],i){this._videoNums=new Array;i.split(",").forEach(function(e){a._videoNums.push(parseInt(e))})}else{this._videoNums=new Array;for(var r=0;r=7&&(this._dailyCount=0)):this._dailyCount=0;var p=t.weekCount;this._weekCount=p?parseInt(p):0,7==this._dailyCount&&this._dailyVaild&&(this._weekCount++,Laya.LocalStorage.setItem("weekCount",this._weekCount.toString()),this._dailyCount=0);var S=t.bgSkinIndex;S&&(this._bgSkinIndex=parseInt(S));var y=t.onlineDate,m=!1,g=new Date;y&&(m=y!=g.toDateString()),Laya.LocalStorage.setItem("onlineDate",g.toDateString());var T=t.onlineTime;T&&(this._onlineTime=m?0:parseInt(T));var f=t.onlineIndex;f&&(this._onlineIndex=m?0:parseInt(f))},Object.defineProperty(a,"instance",{get:function(){return null==a._instance&&(GameBaseData.isDebug&&console.log("1 GameData instance()"),a._instance=new a),a._instance},enumerable:!1,configurable:!0}),a.prototype.destroy=function(){},a.prototype.init=function(e){var t=this,a="config/game.json";Laya.loader.load(a,Laya.Handler.create(this,function(n){n?(console.info("resource load success: "+a,n),t._config=n,e(!0)):(console.info("resource NOT loaded: "+a),e(!1))}),void 0,Laya.Loader.JSON)},a.prototype.loadAdjust=function(e){var t=this,a="config/crazy_ball_adjust.json";Laya.loader.load(a,Laya.Handler.create(this,function(n){n?(console.info("crazy_ball_adjust resource load success: "+a,n),t._adjustConfig=t._adjustConfig.concat(n),e(!0)):(console.info("crazy_ball_adjust resource NOT loaded: "+a),e(!1))}),void 0,Laya.Loader.JSON)},a.prototype.getAdjustToken=function(e){if(!this._adjustConfig||void 0===this._adjustConfig)return console.warn("adjust config not loaded"),"";for(var t=0;tt)return a;return 0},a.prototype.getNewTipFlag=function(){for(var t=0;t=e.GameConfig.SKIN_VIDEO.length)return!1;var a=0;return t<6?a=this.videoNums[1]:t<9?a=this.videoNums[6]:t<14?a=this.videoNums[9]:t<17?a=this.videoNums[14]:t<20?a=this.videoNums[17]:t<23?a=this.videoNums[20]:t<26?a=this.videoNums[23]:t<30&&(a=this.videoNums[26]),a>=e.GameConfig.SKIN_VIDEO[t]},Object.defineProperty(a.prototype,"videoNums",{get:function(){return this._videoNums},enumerable:!1,configurable:!0}),a.getProgressIdByType=function(t){var n=a.PROGRESS_NONE;switch(t){case e.TASK_VALUE_TYPE.TOTAL_DISTANCE:n=a.PROGRESS_DISTANCE;break;case e.TASK_VALUE_TYPE.TOTAL_SURPASS:n=a.PROGRESS_SURPASS}return n},a.prototype.getProgress=function(e){return this._videoNums[e]},Object.defineProperty(a.prototype,"isMusicOn",{get:function(){return this._isMusicOn},set:function(t){this._isMusicOn=t,Laya.LocalStorage.setItem("isMusicOn",t?"true":"false"),e.SoundManager.setMusicVolume(t?1:0)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isSoundOn",{get:function(){return this._isSoundOn},set:function(t){this._isSoundOn=t,Laya.LocalStorage.setItem("isSoundOn",t?"true":"false"),e.SoundManager.setSoundVolume(t?1:0)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isVibrateOn",{get:function(){return this._isVibrateOn},set:function(e){this._isVibrateOn=e,Laya.LocalStorage.setItem("isVibrateOn",e?"true":"false")},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isGame1On",{get:function(){return this._isGame1On},set:function(e){this._isGame1On=e,Laya.LocalStorage.setItem("isGame1On",e?"true":"false")},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isGame2On",{get:function(){return this._isGame2On},set:function(e){this._isGame2On=e,Laya.LocalStorage.setItem("isGame2On",e?"true":"false")},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isGame3On",{get:function(){return this._isGame3On},set:function(e){this._isGame3On=e,Laya.LocalStorage.setItem("isGame3On",e?"true":"false")},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isGame4On",{get:function(){return this._isGame4On},set:function(e){this._isGame4On=e,Laya.LocalStorage.setItem("isGame4On",e?"true":"false")},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isGame5On",{get:function(){return this._isGame5On},set:function(e){this._isGame5On=e,Laya.LocalStorage.setItem("isGame5On",e?"true":"false")},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isGame6On",{get:function(){return this._isGame6On},set:function(e){this._isGame6On=e,Laya.LocalStorage.setItem("isGame6On",e?"true":"false")},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"dailyVaild",{get:function(){return this._dailyVaild},set:function(e){this._dailyVaild=e;var t=new Date;Laya.LocalStorage.setItem("dailyDate",t.toDateString()),this._dailyCount++,Laya.LocalStorage.setItem("dailyCount",this._dailyCount.toString())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"dailyCount",{get:function(){return this._dailyCount},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"weekCount",{get:function(){return this._weekCount},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"bgSkinIndex",{get:function(){return this._bgSkinIndex},set:function(e){this._bgSkinIndex=e,Laya.LocalStorage.setItem("bgSkinIndex",this._bgSkinIndex.toString())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onlineTime",{get:function(){return this._onlineTime},set:function(e){this._onlineTime=e,this._storeTime++,this._storeTime>=10&&(this._storeTime=0,Laya.LocalStorage.setItem("onlineTime",this._onlineTime.toString()))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onlineIndex",{get:function(){return this._onlineIndex},set:function(e){this._onlineIndex=e,Laya.LocalStorage.setItem("onlineIndex",this._onlineIndex.toString())},enumerable:!1,configurable:!0}),a._instance=null,a.PROGRESS_NONE=0,a.PROGRESS_DISTANCE=9,a.PROGRESS_SURPASS=1,a}(Laya.EventDispatcher);e.GameData=t}(touch||(touch={}));