var game;window.addEventListener("load",(function(){(game=new Phaser.Game({title:"BaseSlotGame",dom:{createContainer:!0},width:960,height:540,type:Phaser.AUTO,backgroundColor:"#000",physics:{default:"arcade"},autoFocus:!0,scale:{autoRound:!0,parent:"game-container",mode:Phaser.Scale.FIT,autoCenter:Phaser.Scale.CENTER_BOTH},plugins:{global:[NineSlice.Plugin.DefaultCfg],scene:[{key:"SpinePlugin",plugin:window.SpinePlugin,sceneKey:"spine"}]},input:{activePointers:1},fps:{target:60,forceSetTimeOut:!0}})).sound.pauseOnBlur=!1,game.scene.add("Boot",Boot,!0)}));class Boot extends Phaser.Scene{constructor(){super("Boot"),this.isLoadSoundComplete=!1}preload(){this.rootPath="assets",this.load.plugin("rexbbcodetextplugin","lib/plugins/rexbbcodetextplugin.min.js",!0),this.load.plugin("rexinputtextplugin","lib/plugins/rexinputtextplugin.min.js",!0),this.load.plugin("rexwebfontloaderplugin","lib/plugins/rexwebfontloaderplugin.min.js",!0)}create(){console.log("create"),this.load.once("complete",this.startLoading,this),this.load.pack("boost-script-pack","assets/boost-script-pack.json"),this.load.start()}_createDebugText(a,t){if(this.debugText)this.debugText.text=a;else{let e;e={fontFamily:"Arial",fontSize:t,fontStyle:"bold",stroke:"#000000",strokeThickness:4},this.debugText=this.add.text(0,0,a,e)}}onLoadComplete(){this.test=!0}async startLoading(){await this._loadBoostAsset(),this.LoadingUI=new LoadingUI,await this._loadStudioLogo(),console.log("startLoading");let a=1;if(await this._loadMainScripts(t=>{let e=(a+t-1)/4;this.LoadingUI.updateProgress(e)}),a++,this._loadSounds(a=>{},()=>{this.isLoadSoundComplete=!0,a+=1}),gameConfig.ENVIRONMENT!=EnvironmentType.PRODUCTION){let a=Object.assign({},console);console.log=(...t)=>{t.push(new Date),a.log(t)}}for(await this._loadOutGameAssets(t=>{let e=(a+t-1)/4;this.LoadingUI.updateProgress(e)}),a++,await this._loadInGameAssets(t=>{let e=(a+t-1)/4;this.LoadingUI.updateProgress(e)}),a++,await this._loadSpineAssets(t=>{let e=(a+t-1)/4;this.LoadingUI.updateProgress(e)});0==this.isLoadSoundComplete;)await Helper.delayAsync(100);ServerManager.instance.setupUrlVariables(),game.events.on("hidden",()=>{console.log("hidden"),SoundManager.instance.pauseAllSFX(),SoundManager.instance.pauseAllBGM()},this),game.events.on("visible",()=>{console.log("visible"),SoundManager.instance.soundEnable&&(SoundManager.instance.resumeAllSFX(),SoundManager.instance.resumeAllBGM())},this),this.LoadingUI.waitForAnimationComplete(()=>{this.scene.start(gameConfig.LOBBY_SCENE),this.LoadingUI.clearLogoCache()})}_loadFont(){this.plugins.get("rexwebfontloaderplugin").addToScene(this),this.load.rexWebFont({google:{families:["Kanit"]}})}async _loadBoostAsset(){let a=new Loader(this);a.loadPack("boost-asset-pack","assets/boost-asset-pack.json"),a.loadPack("based-script-pack","assets/based-script-pack.json"),a.setOnProgress(null),await a.startLoadAsync(),a.deinit()}async _loadStudioLogo(){return new Promise(async(a,t)=>{let e=new Loader(this);e.setPath(this.rootPath+"/spines/studio_logo/"),e.loadSpine("logo-animate","logo-animate.json","logo-animate.atlas"),await e.startLoadAsync(),e.deinit(),this.LoadingUI.init(this,a)})}async _loadMainScripts(a=null){let t=new Loader(this);t.loadPack("main-script-pack","assets/main-script-pack.json"),t.setOnProgress(null),await t.startLoadAsync(),t.deinit()}async _loadSpineAssets(a=null){let t=new Loader(this);t.setPath(this.rootPath+"/spines/characters/"),t.loadSpine("p1","p1.json","p1.atlas"),t.loadSpine("p2","p2.json","p2.atlas"),t.loadSpine("p3","p3.json","p3.atlas"),t.loadSpine("p4","p4.json","p4.atlas"),t.loadSpine("p5","p5.json","p5.atlas"),t.loadSpine("p6","p6.json","p6.atlas"),t.loadSpine("p7","p7.json","p7.atlas"),t.setPath(this.rootPath+"/spines/items/"),t.loadSpine("item_0001","item_0001.json","item_0001.atlas"),t.loadSpine("item_0002","item_0002.json","item_0002.atlas"),t.loadSpine("item_0003","item_0003.json","item_0003.atlas"),t.loadSpine("item_0004","item_0004.json","item_0004.atlas"),t.loadSpine("item_0005","item_0005.json","item_0005.atlas"),t.loadSpine("item_0006","item_0006.json","item_0006.atlas"),t.loadSpine("item_0007","item_0007.json","item_0007.atlas"),t.loadSpine("item_0008","item_0008.json","item_0008.atlas"),t.setPath(this.rootPath+"/spines/card_shuffle/atlas/"),t.loadSpine("card_shuffle","card_shuffle.json","card_shuffle.atlas"),t.setPath(this.rootPath+"/spines/arrow/atlas/"),t.loadSpine("arrow","arrow.json","arrow.atlas"),t.setPath(this.rootPath+"/spines/mini_loading/atlas/"),t.loadSpine("miniloading_icon","miniloading_icon.json","miniloading_icon.atlas"),t.setPath(this.rootPath+"/spines/cardpeek_msg_rewards/"),t.loadSpine("cardpeek_msg_rewards","cardpeek_msg_rewards.json","cardpeek_msg_rewards.atlas"),t.setPath(this.rootPath+"/spines/crown/atlas/"),t.loadSpine("crown","crown.json","crown.atlas"),t.setPath(this.rootPath+"/spines/room_menu/atlas/"),t.loadSpine("room_menu","room_menu.json","room_menu.atlas"),t.setPath(this.rootPath+"/spines/spotlight/atlas/"),t.loadSpine("spotlight","spotlight.json","spotlight.atlas"),t.setPath(this.rootPath+"/spines/summary_flare/atlas/"),t.loadSpine("summary_flare","summary_flare.json","summary_flare.atlas"),t.setPath(this.rootPath+"/spines/timer/atlas/"),t.loadSpine("timer","timer.json","timer.atlas"),t.setPath(this.rootPath+"/spines/game_start/"),t.loadSpine("prep_game_animate","prep_game_animate.json","prep_game_animate.atlas"),t.setPath(this.rootPath+"/spines/summary_player_box/atlas/"),t.loadSpine("player_summarybox","player_summarybox.json","player_summarybox.atlas"),t.setOnProgress(null),await t.startLoadAsync(),t.deinit()}async _loadOutGameAssets(a=null){let t=new Loader(this);t.loadPack("scene-pack",this.rootPath+"/scene-pack.json"),t.loadPack("outgame-pack",this.rootPath+"/outgame-pack.json"),t.setOnProgress(a),await t.startLoadAsync(),t.deinit()}async _loadInGameAssets(a=null){let t=new Loader(this),e=ServerManager.getLanguage();t.loadPack("ingame-pack",`${this.rootPath}/ingame-pack_${e}.json`),t.loadPack("cards-pack",this.rootPath+"/cards-pack.json"),t.setOnProgress(a),await t.startLoadAsync(),t.deinit()}async _loadSounds(a,t){let e=new Loader(this),s=ServerManager.getLanguage();e.loadPack("sounds-ingame-pack",`${this.rootPath}/sounds-ingame-pack_${s}.json`),e.loadPack("sounds-pack",this.rootPath+"/sounds-pack.json"),e.setOnProgress(a),e.setOnComplete(t),await e.startLoadAsync(),e.deinit()}async cooldown(a){return new Promise((t,e)=>{try{this.time.addEvent({delay:a,callback:t,args:[],callbackScope:this,loop:!1,repeat:0,startAt:0,timeScale:1,paused:!1})}catch(a){e(a)}})}}