var webGame;!function(e){e.BasePlatform=class extends core.BasePlatform{constructor(){super()}getStorageSync(e){return Laya.LocalStorage.getJSON(e+core.Manager.baseInfo.game_id)}setStorageSync(e,t){Laya.LocalStorage.setJSON(e+core.Manager.baseInfo.game_id,t)}initEvent(){Laya.stage.on(Laya.Event.VISIBILITY_CHANGE,this,this.stageVisibleChange),core.Manager.wtsdk.isReady?this.login():core.Manager.eDispatcher.on(core.Event.WTSDK_INIT_COMPLETE,this,this.login)}stageVisibleChange(){Laya.stage.isVisibility?this.onShow():this.onHide()}onShow(e){core.SoundManager.muted=this._muted,core.Manager.wtsdk.dotEvent(core.WtsdkEvent.ID_GAME_START),core.Manager.eDispatcher.event(core.Event.ON_SHOW,e)}onHide(e){this._muted=core.SoundManager.muted,core.SoundManager.muted=!1,core.Manager.wtsdk.dotEvent(core.WtsdkEvent.ID_GAME_EXIT),core.Manager.eDispatcher.event(core.Event.ON_HIDE,e)}init(){this.systemInfo=new e.SystemInfo,core.Manager.baseInfo.app_name=this.systemInfo.appName,core.Manager.baseInfo.device=this.systemInfo.device,core.Manager.baseInfo.platform_id=core.PlatformType.ID_WEBGAME,this.moneyActivity=new e.MoneyActivity,this.initEvent()}login(){if(this.gameStarted(),core.Manager.wtsdk.isReady){let t=decodeURIComponent(window.location.search);if(t){let e=this.jsGetHttpParam("code",t);this.loginComplete(e)}else this.loginComplete("bcd182bffa0af49c4fe90b69affca5e4");this.ad=new e.BaseADManager}}jsGetHttpParam(e,t){let a=new RegExp("(^|&)"+e+"=([^&]*)(&|$)","i"),i=t.substr(1).match(a),s="";return null!=i&&(s=i[2]),a=null,i=null,null==s||""==s||"undefined"==s?"":s}loginComplete(e){let t={};t.code=e,t.app_name=core.Manager.baseInfo.app_name,t.game_id=core.Manager.baseInfo.game_id,t.platform_id=core.Manager.baseInfo.platform_id,t.device=this.systemInfo.device,t.scene="0",t.version=BaseConfig.version,core.Manager.wtsdk.getUserInfo(t,Laya.Handler.create(this,this.httpUserInfoCallback))}httpUserInfoCallback(e){e&&200==e.code?(core.Manager.baseInfo.token=e.result.token,core.Manager.selfInfo.updateAll(e.result),core.Manager.isLogined=!0):log(e)}vibrate(e){core.Manager.wtsdk.isReady&&wtsdk.onVibrator(e)}addToDeskIcon(t,a=0,i=0,s){if(t){if(core.Manager.config.isOpen(core.FunctionKey.ADD_TO_DESK))return e.AddToDeskIcon.show(a,i,s)}else e.AddToDeskIcon.hide()}saveScore(e){core.Manager.wtsdk.saveScore({score:e},Laya.Handler.create(this,e=>{e&&200==e.code&&(core.Manager.selfInfo.score=e.result.score)}))}gameStarted(){core.Manager.wtsdk.isReady?wtsdk.gameStarted({gameId:core.Manager.baseInfo.game_id,version:BaseConfig.version}):log("wtsdk is not ready, gameStarted fail")}adBanner(e,t){if(core.Manager.wtsdk.isReady)try{e?this.ad.showBanner(t):this.ad.hideBanner(t)}catch(e){log("adBanner error:",e)}else log("wtsdk is not ready, adBanner fail")}adRewardedVideo(t){if(new e.LoadADTipsView,core.Manager.wtsdk.isReady)try{this.ad.showRewardedVideoAd(t)}catch(e){log("adBanner error:",e)}else log("wtsdk is not ready, adRewardedVideo fail")}adInterstitial(e){if(core.Manager.wtsdk.isReady)try{this.ad.showInterstitialAd(e)}catch(e){log("adBanner error:",e)}else log("wtsdk is not ready, adInterstitial fail")}adFullVideo(e){if(core.Manager.wtsdk.isReady)try{this.ad.showFullVideoAd(e)}catch(e){log("adBanner error:",e)}else log("wtsdk is not ready, fullVideo fail")}adFeed(e,t,a){if(core.Manager.wtsdk.isReady)if(e)try{e?this.ad.showFreeAd(t):this.ad.hideFreeAd(t)}catch(e){log("adBanner error:",e)}else wtsdk.closeFeed();else log("wtsdk is not ready, adInterstitial fail")}moreGameBtn(e){}get moreGameParams(){return{x:0,y:0,w:60,h:60,appLaunchOptions:[]}}openMoneyActiviyView(e,t){core.Manager.wtsdk.isReady?this.moneyActivity.ActivityView(e,t):log("wtsdk is not ready, openMoneyActiviyView fail")}operateCoin(e){core.Manager.wtsdk.isReady?this.moneyActivity.operateCoin(e):log("wtsdk is not ready, operateCoin fail")}getUserCoinInfo(e,t){core.Manager.wtsdk.isReady?this.moneyActivity.getUserCoinInfo(e,t):log("wtsdk is not ready, getUserCoinInfo fail")}wzFinishReward(e,t,a=2){core.Manager.wtsdk.isReady&&wtsdk.wzFinishReward({params:{type:a,scene:e,level:t},onSuccess:function(t){core.Manager.eDispatcher.event(core.Event.GET_ACTIVITY_REWARD,{type:e,value:t.data.coin_add})},onFail:function(e){}})}loadRewardVideo(e){core.Manager.wtsdk.isReady&&this.ad.LoadRewardedVideoAd(e)}loginSignInit(e){core.Manager.wtsdk.isReady&&wtsdk.loginSignInit({onSuccess:function(t){e&&e.runWith(t.data)},onFail:function(e){}})}loginSignLog(e){core.Manager.wtsdk.isReady&&wtsdk.loginSignLog({onSuccess:function(t){t&&1==t.code&&e.run()},onFail:function(e){}})}loginSignWithdraw(e,t,a,i){core.Manager.wtsdk.isReady&&wtsdk.loginSignWithdraw({params:{days:e,amount:t,rank:a},onSuccess:function(e){i&&i.runWith(1)},onFail:function(e){i&&i.runWith(0)}})}progress(e){if(core.Manager.wtsdk.isReady)return wtsdk.progress(e)}}}(webGame||(webGame={})),function(e){e.Platform=class extends e.BasePlatform{constructor(){super()}showTitle(e){throw new Error("Method not implemented.")}sendLoginCheck(){throw new Error("Method not implemented.")}get moreGameParams(){return{x:0,y:0,w:60,h:60,appLaunchOptions:[{appId:"ttXXXXXX",query:"",extraData:{}}]}}}}(webGame||(webGame={})),window.webGame=webGame,window.platform=new webGame.Platform,function(e){e.BaseADManager=class{constructor(){this.createAD()}createAD(){this.createBannerAd(),this.createInterstitialAd(),this.createRewardedVideoAd(),this.createFreeAd(),this.createFullVideoAd()}createBannerAd(){if(!core.Manager.wtsdk.isReady||this._bannerAd)return;let e=wtsdk.createBannerAd();e&&(e.onError(this.onBannerError.bind(this)),this._bannerAd=e)}onBannerError(e){}showBanner(e){this._bannerAd&&this._bannerAd.show(e)}hideBanner(e){this._bannerAd&&this._bannerAd.close(e)}createInterstitialAd(){core.Manager.wtsdk.isReady&&!this._interstitialAd&&(this._interstitialAd=wtsdk.createInterstitialAd(),this._interstitialAd&&(this._interstitialAd.onError(this.onInterstitialAdError.bind(this)),this._interstitialAd.onClose(this.onInterstitialAdClosed.bind(this)),this._interstitialAd.onLoad(this.onInterstitialAdLoaded.bind(this)),this.LoadInterstitialAd(4e4)))}onInterstitialAdError(e){core.Manager.eDispatcher.event(core.Event.INTERSTITIAL_AD_ERROR,e)}onInterstitialAdClosed(e){core.Manager.eDispatcher.event(core.Event.INTERSTITIAL_AD_CLOSE,e)}onInterstitialAdLoaded(e){this._interstitialAd&&core.Manager.eDispatcher.event(core.Event.INTERSTITIAL_AD_ONLOAD,e)}LoadInterstitialAd(e){this._interstitialAd&&this._interstitialAd.load(e)}showInterstitialAd(e){this._interstitialAd&&this._interstitialAd.show(e)}createRewardedVideoAd(){core.Manager.wtsdk.isReady&&!this._rewardedVideoAd&&(this._rewardedVideoAd=wtsdk.createRewardVideoAd(),this._rewardedVideoAd&&(this._rewardedVideoAd.onError(this.onRewardedVideoAdError.bind(this)),this._rewardedVideoAd.onClose(this.onRewardedVideoAdClosed.bind(this)),this._rewardedVideoAd.onLoad(this.onRewardedVideoAdLoaded.bind(this)),this.LoadRewardedVideoAd(3e4)))}onRewardedVideoAdError(e){core.Manager.eDispatcher.event(core.Event.REWARDED_AD_ERROR,!1)}onRewardedVideoAdClosed(e){let t=!(!e||!e.data)&&e.data.isReward;core.Manager.eDispatcher.event(core.Event.REWARDED_AD_CLOSE,t)}onRewardedVideoAdLoaded(e){core.Manager.eDispatcher.event(core.Event.REWARDED_AD_ONLOAD,e)}LoadRewardedVideoAd(e){this._rewardedVideoAd&&this._rewardedVideoAd.load(e)}showRewardedVideoAd(e){this._rewardedVideoAd&&this._rewardedVideoAd.show(e)}createFreeAd(){if(!core.Manager.wtsdk.isReady||this._FreeAD)return;let e=wtsdk.createFeedAd();e&&(e.onError(this.onFreeAdError.bind(this)),this._FreeAD=e)}onFreeAdError(e){}showFreeAd(e){this._FreeAD&&this._FreeAD.show(e)}hideFreeAd(e){this._FreeAD&&this._FreeAD.close(e)}createFullVideoAd(){core.Manager.wtsdk.isReady&&!this._FullVideoAd&&(this._FullVideoAd=wtsdk.createFullVideoAd(),this._FullVideoAd&&(this._FullVideoAd.onError(this.onFullVideoAdError.bind(this)),this._FullVideoAd.onClose(this.onFullVideoAdClosed.bind(this)),this._FullVideoAd.onLoad(this.onFullVideoAdLoaded.bind(this))))}onFullVideoAdError(e){core.Manager.eDispatcher.event(core.Event.FULL_AD_ERROR,!1)}onFullVideoAdClosed(e){core.Manager.eDispatcher.event(core.Event.FULL_AD_CLOSE,e)}onFullVideoAdLoaded(e){core.Manager.eDispatcher.event(core.Event.FULL_AD_ONLOAD,e)}LoadFullVideoAd(e){this._FullVideoAd&&this._FullVideoAd.load(e)}showFullVideoAd(e){this._FullVideoAd&&this._FullVideoAd.show(e)}}}(webGame||(webGame={})),function(e){e.MoneyActivity=class{constructor(){}operateCoin(e){core.Manager.wtsdk.isReady&&wtsdk.operateCoin({userState:function(t){log(t),e&&e.runWith(t.data)}})}getUserCoinInfo(e,t){core.Manager.wtsdk.isReady?wtsdk.getUserCoinInfo({params:{type:e},success:function(e){log("getUserCoinInfo success..."),t&&t.runWith(e.data)},error:function(e){log("getUserCoinInfo error",e),t&&t.runWith({})}}):log("wtsdk is not ready")}ActivityView(e,t){if(core.Manager.wtsdk.isReady)switch(e){case core.MoneyActivityType.withdraw:log("提现");break;case core.MoneyActivityType.wheel:wtsdk.wheel(t);break;case core.MoneyActivityType.fruitMachine:wtsdk.fruitMachine(t);break;case core.MoneyActivityType.idiom:wtsdk.idiom(t);break;case core.MoneyActivityType.newIdiom:wtsdk.newIdiom(t);break;case core.MoneyActivityType.scratchCard:wtsdk.scratchCard(t);break;case core.MoneyActivityType.userFeedBack:wtsdk.userFeedBack(t);break;case core.MoneyActivityType.policyPage:wtsdk.policyPage(t);break;case core.MoneyActivityType.agreementPage:wtsdk.agreementPage(t);break;case core.MoneyActivityType.withdrawIntegral:wtsdk.withdrawIntegral(t);break;case core.MoneyActivityType.loginOut:wtsdk.logout(t);break;case core.MoneyActivityType.debugPage:wtsdk.debugPage(t);break;case core.MoneyActivityType.loadWZRewardAd:wtsdk.loadWZRewardAd({type:"level_pass"});break;case core.MoneyActivityType.SevenLogin:wtsdk.showSevenLogin(this.WeiTeSdkParame(e,t));break;case core.MoneyActivityType.LoginSign:wtsdk.showLoginSign(this.WeiTeSdkParame(e,t));break;case core.MoneyActivityType.Achievement:wtsdk.showAchievement(this.WeiTeSdkParame(e,t));break;case core.MoneyActivityType.AchievementBig:wtsdk.showAchievementBig(this.WeiTeSdkParame(e,t));break;case core.MoneyActivityType.Bubbles:wtsdk.showBubbles(this.WeiTeSdkParame(e,t));break;case core.MoneyActivityType.LevelPass:wtsdk.showLevelPass(this.WeiTeSdkParame(e,t));break;case core.MoneyActivityType.NewPlayer:wtsdk.showNewUser(this.WeiTeSdkParame(e,t));break;case core.MoneyActivityType.AchievementNewC:wtsdk.showAchievementNewC(this.WeiTeSdkParame(e,t))}}WeiTeSdkParame(e,t){let a={params:{xx:t||"guide=0"},open:function(e){log("开启通知")},close:function(e){log("关闭通知",e)}};return log("请求网赚:",e," 参数:",t,a),a}}}(webGame||(webGame={})),function(e){e.SystemInfo=class{constructor(){this.info={appName:"wtyx",platform:""},this.info.platform=Laya.Browser.onIOS?"ios":Laya.Browser.onAndroid?"android":"computer"}get device(){return this.info.platform}get appName(){return this.info.appName}}}(webGame||(webGame={})),function(e){class t extends Laya.Image{constructor(){super(core.Manager.commonResPath+"atTodesk/icon.png")}static show(e=0,a=0,i){return this._instance||(this._instance=new t),this._instance.pos(e,a),i||(i=Laya.stage),i.addChild(this._instance),this._instance}static hide(){this._instance&&(this._instance.destroy(),this._instance=null)}onEnable(){super.onEnable(),this.on(Laya.Event.CLICK,this,this.onClick)}onDisable(){super.onDisable(),this.off(Laya.Event.CLICK,this,this.onClick)}onClick(e){core.Manager.wtsdk.isReady&&wtsdk.onShortcut()}destroy(){Laya.timer.clearAll(this),super.destroy()}}e.AddToDeskIcon=t}(webGame||(webGame={})),function(e){e.LoadADTipsView=class extends Laya.Box{constructor(){super(),this.zOrder=1e3,this.mouseEnabled=!0,this.blackBg=new Laya.Sprite,this.blackBg.alpha=.5,this.addChild(this.blackBg),Laya.stage.addChild(this)}onAwake(){this.timeNum=3,this.str="等待广告中...";let e=Laya.stage.width>600?38:Laya.stage.width<=400?24:30;this.lable=core.FloatTips.createLable(`${this.str}`,0,(78-e)/2,e,Laya.stage.width,"#ffffff","center"),this.lable.text=this.str+"\n"+this.timeNum,this.lable.leading=10,this.lable.centerX=0,this.lable.centerY=0,this.addChild(this.lable)}onEnable(){super.onEnable(),core.Manager.eDispatcher.on(core.Event.REWARDED_AD_CLOSE,this,this.destroy),core.Manager.eDispatcher.on(core.Event.REWARDED_AD_ERROR,this,this.destroy),Laya.stage.on(Laya.Event.RESIZE,this,this.onResize),this.onResize(),Laya.timer.loop(1e3,this,this.timeCount,null,!1)}onResize(e){this.blackBg.graphics.clear(),this.blackBg.graphics.drawRect(0,0,Laya.stage.width,Laya.stage.height,"#000000"),this.blackBg.size(Laya.stage.width,Laya.stage.height)}timeCount(){this.timeNum--,this.lable.text=this.str+"\n"+this.timeNum,this.timeNum<=0&&(Laya.timer.clearAll(this),this.destroy())}onDisable(){core.Manager.eDispatcher.off(core.Event.REWARDED_AD_CLOSE,this,this.destroy),core.Manager.eDispatcher.off(core.Event.REWARDED_AD_ERROR,this,this.destroy),Laya.stage.off(Laya.Event.RESIZE,this,this.onResize)}destroy(){Laya.timer.clearAll(this),super.destroy()}}}(webGame||(webGame={})),function(e){e.MoreGameIcon=class extends Laya.Box{constructor(e){super(),this.ICON_SIZE=120,this.zOrder=core.ZOrder.POPUP,this._appLaunchOptions=e.appLaunchOptions,this.pos(e.x,e.y),this.scale(e.w/this.ICON_SIZE,e.h/this.ICON_SIZE),Laya.stage.addChild(this)}onAwake(){this._index=0,this._icon=new Laya.Image,this._icon.anchorX=.5,this._icon.anchorY=.5,this.addChild(this._icon),this._label=new Laya.Image(this.getRes("gdhw")),this._label.anchorX=.5,this._label.anchorY=.5,this._label.y=86,this.addChild(this._label),this._iconUrls=[];let e=core.Manager.gameList;for(let t=e.length-1;t>=0;t--)1==e[t].rec_degree&&this._iconUrls.push(e[t].icon);0==this._iconUrls.length&&this._iconUrls.push(e[0].icon),this._tweentimeLite=new core.TweenTimeLine(0),this._tweentimeLite.addToTween(this,{scaleX:.8*this.scaleX,scaleY:.8*this.scaleX},600,Laya.Ease.backOut),this._tweentimeLite.addToTween(this,{scaleX:this.scaleX,scaleY:this.scaleX},600,Laya.Ease.backIn)}getRes(e){return core.Manager.commonResPath+"gameIcon/"+e+".png"}onEnable(){super.onEnable(),this.timerLoop(5e3,this,this.changeSkin),this.changeSkin(),this._tweentimeLite.start(),this.on(Laya.Event.CLICK,this,this.onClick),this._icon.on(Laya.Event.LOADED,this,this.iconLoaded)}changeSkin(){this._index>=this._iconUrls.length&&(this._index=0),this._icon.skin=this._iconUrls[this._index],this._index++}iconLoaded(){this._icon.size(this.ICON_SIZE,this.ICON_SIZE)}onClick(e){}onDisable(){super.onDisable(),this.clearTimer(this,this.changeSkin),this._tweentimeLite.pause(),this.off(Laya.Event.CLICK,this,this.onClick),this._icon.off(Laya.Event.LOADED,this,this.iconLoaded)}destroy(){super.destroy(),this._tweentimeLite.destroy(),this._tweentimeLite=null,this._appLaunchOptions=null,this._iconUrls=null}}}(webGame||(webGame={}));