var touch,__extends=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){function a(){this.constructor=t}if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n),t.prototype=null===n?Object.create(n):(a.prototype=n.prototype,new a)}}();!function(e){var t=laya.maths.Point,n=function(n){function a(a){var i=n.call(this)||this;i._main=null,i._userInfoButton=null,i._onlineRemainingTime=0,i._main=a,i.btnStart.clickHandler=Laya.Handler.create(i,i.onSingleMode,null,!1),i.btnStart.label=e.Lang.getLangText(e.Lang.play_single),i.btnLevel.clickHandler=Laya.Handler.create(i,i.onMultiplePlayerMode,null,!1),i.btnLevel.label=e.Lang.getLangText(e.Lang.play_multi),i.btnSkin.clickHandler=Laya.Handler.create(i,i.onSkin,null,!1),i.btnSetting.clickHandler=Laya.Handler.create(i,i.onSetting,null,!1),i.btnShare.clickHandler=Laya.Handler.create(i,i.onShare,null,!1);var o=e.GameData.instance.dailyVaild,l=e.GameData.instance.dailyCount;l=o?l:l-1,i.updateOnlineReward(),Laya.timer.loop(100,i,i.time2Loop),GameBaseData.isNative&&(i.btnSkin.pos(i.btnSkin.parent.width/2-200+i.btnSkin.width/2,i.btnSkin.y),i.btnSetting.pos(i.btnSetting.parent.width/2+200-i.btnSetting.width/2,i.btnSetting.y)),i.showPlayButtons(!1),SdkHelper.SdkUtils.changeAdflyPos(i.btnStart.localToGlobal(new t).y),SdkHelper.SdkUtils.setAdflyState(1),console.info("===============logSuccessLanding1=================="),SdkHelper.EventLogger.logSuccessLanding(),console.info("===============logSuccessLanding2=================="),Laya.stage.on(Laya.Event.RESIZE,i,i.onResize),i.intitUIAdapter(),console.info("=====> version.json test 112");var r=window.minigame;return null===r||void 0===r||r.setLoadingProgress(100),null===r||void 0===r,i}return __extends(a,n),a.prototype.dealIG=function(){GameBaseData.isPlatformIG()&&(GameBaseData.isShowShortcut||this.createShortcut(),GameBaseData.isDealIG=!0,this.dealEntryPointData(),this.dealTournamentPayload())},a.prototype.createShortcut=function(){var e=window.minigame;e.canCreateShortcutAsync().then(function(t){GameBaseData.isShowShortcut=!0,t&&e.createShortcutAsync().then(function(){console.info("call createShortcutAsync done")}).catch(function(e){console.info("call createShortcutAsync fail: ",e)})}).catch(function(e){console.info("canCreateShortcut fail: ",e)})},a.prototype.dealEntryPointData=function(){var e=window.minigame.getEntryPointData();e&&(e.mode===MODE.SINGLE?this.onSingleMode():e.mode===MODE.MULTIPLE&&this.onMultiplePlayerMode())},a.prototype.dealTournamentPayload=function(){var e=this;window.minigame.getTournamentAsync().then(function(t){var n=t.getPayload(),a=JSON.parse(n);a&&(a.mode===MODE.SINGLE?e.onSingleMode():a.mode===MODE.MULTIPLE&&e.onMultiplePlayerMode())})},a.prototype.onResize=function(){this.intitUIAdapter()},a.prototype.intitUIAdapter=function(){var e=GameBaseData.getAdapterRatio();this.imgLogo.scale(e,e),this.boxGroup.scale(e,e),this.btnLevel.scale(e,e),this.btnStart.scale(e,e);var t=Laya.stage.designHeight,n=Laya.stage.height/t;this.boxGroup.bottom=200*n},a.prototype.checkPaymentOrder=function(){var e=window.minigame;e.payments.onReady(function(){e.payments.getCatalogAsync().then(function(e){console.info("====> getCatalogAsync products: ",e)}).catch(function(e){console.error("====> getCatalogAsync error: ".concat(e))}),e.payments.getPurchasesAsync().then(function(e){console.info("====> getPurchasesAsync products: ",e)}).catch(function(e){console.error("getPurchases error: ".concat(e))})})},a.prototype.destroy=function(){null!=this.btnStart.clickHandler&&(this.btnStart.clickHandler.recover(),this.btnStart.clickHandler=null),null!=this.btnLevel.clickHandler&&(this.btnLevel.clickHandler.recover(),this.btnLevel.clickHandler=null),null!=this.btnSkin.clickHandler&&(this.btnSkin.clickHandler.recover(),this.btnSkin.clickHandler=null),null!=this.btnShare.clickHandler&&(this.btnShare.clickHandler.recover(),this.btnShare.clickHandler=null),null!=this._userInfoButton&&(this._userInfoButton.hide(),this._userInfoButton.destroy(),this._userInfoButton=null),Laya.timer.clear(this,this.timeLoop),Laya.timer.clear(this,this.time2Loop),this._main=null,n.prototype.destroy.call(this),Laya.stage.off(Laya.Event.RESIZE,this,this.onResize)},a.prototype.showPlayButtons=function(e){this.boxActions.visible=e},a.prototype.showLoading=function(e){var t=this;if(this.imgLoading.visible=e,e){var n=this.imgLoading;this.imgLoading.timerLoop(50,this.imgLoading,function(){n.rotation+=30})}else{if(GameBaseData.isDealIG)return;setTimeout(function(){t.dealIG()},1e3)}},a.prototype.onSingleMode=function(){GameBaseData.isNative?(this.onSingleModeNative(),SdkHelper.EventLogger.logPlaySingle(),SdkHelper.EventLogger.logPlaySingleWithTimes()):this.onSingleModeH5()},a.prototype._onSingleModeFB=function(){this._main.event(e.GameEvent.ENTER_SINGLE_GAME),GameBaseData.newMatch(GAME_MODE.SINGLE_PLAYER),GameBaseData.getFriendList_model1(0,null,null)},a.prototype.onSingleModeNative=function(){SdkHelper.EventLogger.logStartGameButtonClick(GAME_MODE.SINGLE_PLAYER),console.info("--------------SdkHelper.SdkUtils.setAdflyState(0)1----------------"),SdkHelper.SdkUtils.setAdflyState(0),console.info("--------------SdkHelper.SdkUtils.setAdflyState(0)2----------------"),this._onSingleModeFB()},a.prototype.onSingleModeH5=function(){var e=this;SdkHelper.MiniGameSDKHelper.isInterstitialReady()?SdkHelper.MiniGameSDKHelper.showInterstitial(function(t){e._onSingleModeFB()}):this._onSingleModeFB()},a.prototype.onMultiplePlayerMode=function(){GameBaseData.isNative?(this.onMultiplePlayerModeNative(),SdkHelper.EventLogger.logPlayMulti(),SdkHelper.EventLogger.logPlayMultiWithTimes()):this.onMultiplePlayerModeH5()},a.prototype._onMultiplePlayerModeFB=function(){GameBaseData.newMatch(GAME_MODE.MULTIPLE_PLAYER),this._main.event(e.GameEvent.ENTER_MULTIPLE_PLAYER_GAME),GameBaseData.getFriendList(0,null,null)},a.prototype.onMultiplePlayerModeH5=function(){var e=this;SdkHelper.MiniGameSDKHelper.isInterstitialReady()?SdkHelper.MiniGameSDKHelper.showInterstitial(function(t){e._onMultiplePlayerModeFB()}):this._onMultiplePlayerModeFB()},a.prototype.onMultiplePlayerModeNative=function(){SdkHelper.EventLogger.logStartGameButtonClick(GAME_MODE.MULTIPLE_PLAYER),this._onMultiplePlayerModeFB(),SdkHelper.SdkUtils.setAdflyState(0)},a.prototype.onSkin=function(){SdkHelper.EventLogger.logSkinPageButtonClick(a.PAGE),this._main.event(e.GameEvent.OPEN_SKIN),SdkHelper.SdkUtils.setAdflyState(0)},a.prototype.onSetting=function(){this._main.event(e.GameEvent.OPEN_SETTING),SdkHelper.SdkUtils.setAdflyState(0)},a.prototype.onShare=function(){SdkHelper.EventLogger.logDailyGiftPage(a.PAGE),SdkHelper.SdkUtils.setAdflyState(0),this._main.event(e.GameEvent.OPEN_GIFT)},a.prototype.updateOnlineReward=function(){this.imgAward.visible=!1;for(var t=e.GameData.instance.onlineIndex,n=0;n0,this.updateOnlineReward(),e.TipDialog.canCreateShortcut&&0==e.TipDialog.homeScreenState&&this._main.event(e.GameEvent.OPEN_TIP,3)},a.PAGE="Home",a}(ui.IndexViewUI);e.IndexView=n}(touch||(touch={}));