From f6fa3a44a01166c45832d59af45dbe63a6bc3e98 Mon Sep 17 00:00:00 2001 From: Psycast Date: Tue, 10 Sep 2024 03:20:20 -0230 Subject: [PATCH] Add Engine Reload/Switch Account to Settings --- src/GlobalVariables.as | 26 ++++++++++++++++++++++++++ src/popups/PopupContextMenu.as | 16 ++-------------- src/popups/settings/SettingsTabMisc.as | 22 ++++++++++++++++++++++ 3 files changed, 50 insertions(+), 14 deletions(-) diff --git a/src/GlobalVariables.as b/src/GlobalVariables.as index 6ff8760a..17592f9e 100644 --- a/src/GlobalVariables.as +++ b/src/GlobalVariables.as @@ -11,6 +11,7 @@ package import classes.User; import classes.chart.Song; import classes.filter.EngineLevelFilter; + import classes.mp.Multiplayer; import classes.user.UserSongNotes; import com.flashfla.loader.DataEvent; import com.flashfla.net.DynamicURLLoader; @@ -30,6 +31,7 @@ package import flash.net.URLVariables; import flash.system.Capabilities; import flash.utils.ByteArray; + import game.GameMenu; import game.GameOptions; import game.GameScoreResult; @@ -712,6 +714,30 @@ package } } + public function reloadEngineData():void + { + if (gameMain.loadComplete && !(gameMain.activePanel is GameMenu)) + { + gameMain.removePopup(); + Flags.VALUES = {}; + Playlist.clearCanon(); + gameMain.loadComplete = false; + gameMain.switchTo("none"); + } + } + + public function switchUserAccount():void + { + if (gameMain.loadComplete && !(gameMain.activePanel is GameMenu)) + { + gameMain.removePopup(); + Flags.VALUES = {}; + Multiplayer.instance.disconnect(); + playerUser.refreshUser(); + gameMain.switchTo(Main.GAME_LOGIN_PANEL); + } + } + public static function get instance():GlobalVariables { if (_instance == null) diff --git a/src/popups/PopupContextMenu.as b/src/popups/PopupContextMenu.as index 36c7b8a2..8b4295ec 100644 --- a/src/popups/PopupContextMenu.as +++ b/src/popups/PopupContextMenu.as @@ -94,23 +94,11 @@ package popups } else if (e.target.action == "reload_engine") { - if (_gvars.gameMain.loadComplete && !(_gvars.gameMain.activePanel is GameMenu)) - { - Flags.VALUES = {}; - Playlist.clearCanon(); - _gvars.gameMain.loadComplete = false; - _gvars.gameMain.switchTo("none"); - } + _gvars.reloadEngineData(); } else if (e.target.action == "switch_profile") { - if (_gvars.gameMain.loadComplete && !(_gvars.gameMain.activePanel is GameMenu)) - { - Flags.VALUES = {}; - Multiplayer.instance.disconnect(); - _gvars.playerUser.refreshUser(); - _gvars.gameMain.switchTo(Main.GAME_LOGIN_PANEL); - } + _gvars.switchUserAccount(); } } } diff --git a/src/popups/settings/SettingsTabMisc.as b/src/popups/settings/SettingsTabMisc.as index 908fcdb2..819618e1 100644 --- a/src/popups/settings/SettingsTabMisc.as +++ b/src/popups/settings/SettingsTabMisc.as @@ -37,6 +37,9 @@ package popups.settings private var useWebsocketCheckbox:BoxCheck; private var openWebsocketOverlay:BoxButton; + private var reloadEngineData:BoxButton; + private var switchUserAccount:BoxButton; + private var engineCombo:ComboBox; private var engineDefaultCombo:ComboBox; private var engineComboIgnore:Boolean; @@ -123,6 +126,14 @@ package popups.settings openWebsocketOverlay = new BoxButton(container, xOff, yOff, 245, 27, _lang.string("options_overlay_instructions"), 12, clickHandler); yOff += 30; + yOff += drawSeperator(container, xOff, 266, yOff, 0, 2); + + reloadEngineData = new BoxButton(container, xOff, yOff, 245, 27, _lang.string("popup_cm_reload_engine_user"), 12, clickHandler); + yOff += 37; + + switchUserAccount = new BoxButton(container, xOff, yOff, 245, 27, _lang.string("popup_cm_switch_profile"), 12, clickHandler); + yOff += 37; + /// Col 2 xOff = 310; yOff = 15; @@ -296,6 +307,17 @@ package popups.settings navigateToURL(new URLRequest(Constant.WEBSOCKET_OVERLAY_URL), "_blank"); } + //- Engine Reload + else if (e.target == reloadEngineData) + { + _gvars.reloadEngineData(); + } + + else if (e.target == switchUserAccount) + { + _gvars.switchUserAccount(); + } + // Window Position else if (e.target == windowSavePositionCheck) {