Skip to content

Commit f6fa3a4

Browse files
committed
Add Engine Reload/Switch Account to Settings
1 parent 9c8dfa7 commit f6fa3a4

File tree

3 files changed

+50
-14
lines changed

3 files changed

+50
-14
lines changed

src/GlobalVariables.as

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ package
1111
import classes.User;
1212
import classes.chart.Song;
1313
import classes.filter.EngineLevelFilter;
14+
import classes.mp.Multiplayer;
1415
import classes.user.UserSongNotes;
1516
import com.flashfla.loader.DataEvent;
1617
import com.flashfla.net.DynamicURLLoader;
@@ -30,6 +31,7 @@ package
3031
import flash.net.URLVariables;
3132
import flash.system.Capabilities;
3233
import flash.utils.ByteArray;
34+
import game.GameMenu;
3335
import game.GameOptions;
3436
import game.GameScoreResult;
3537

@@ -712,6 +714,30 @@ package
712714
}
713715
}
714716

717+
public function reloadEngineData():void
718+
{
719+
if (gameMain.loadComplete && !(gameMain.activePanel is GameMenu))
720+
{
721+
gameMain.removePopup();
722+
Flags.VALUES = {};
723+
Playlist.clearCanon();
724+
gameMain.loadComplete = false;
725+
gameMain.switchTo("none");
726+
}
727+
}
728+
729+
public function switchUserAccount():void
730+
{
731+
if (gameMain.loadComplete && !(gameMain.activePanel is GameMenu))
732+
{
733+
gameMain.removePopup();
734+
Flags.VALUES = {};
735+
Multiplayer.instance.disconnect();
736+
playerUser.refreshUser();
737+
gameMain.switchTo(Main.GAME_LOGIN_PANEL);
738+
}
739+
}
740+
715741
public static function get instance():GlobalVariables
716742
{
717743
if (_instance == null)

src/popups/PopupContextMenu.as

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,11 @@ package popups
9494
}
9595
else if (e.target.action == "reload_engine")
9696
{
97-
if (_gvars.gameMain.loadComplete && !(_gvars.gameMain.activePanel is GameMenu))
98-
{
99-
Flags.VALUES = {};
100-
Playlist.clearCanon();
101-
_gvars.gameMain.loadComplete = false;
102-
_gvars.gameMain.switchTo("none");
103-
}
97+
_gvars.reloadEngineData();
10498
}
10599
else if (e.target.action == "switch_profile")
106100
{
107-
if (_gvars.gameMain.loadComplete && !(_gvars.gameMain.activePanel is GameMenu))
108-
{
109-
Flags.VALUES = {};
110-
Multiplayer.instance.disconnect();
111-
_gvars.playerUser.refreshUser();
112-
_gvars.gameMain.switchTo(Main.GAME_LOGIN_PANEL);
113-
}
101+
_gvars.switchUserAccount();
114102
}
115103
}
116104
}

src/popups/settings/SettingsTabMisc.as

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ package popups.settings
3737
private var useWebsocketCheckbox:BoxCheck;
3838
private var openWebsocketOverlay:BoxButton;
3939

40+
private var reloadEngineData:BoxButton;
41+
private var switchUserAccount:BoxButton;
42+
4043
private var engineCombo:ComboBox;
4144
private var engineDefaultCombo:ComboBox;
4245
private var engineComboIgnore:Boolean;
@@ -123,6 +126,14 @@ package popups.settings
123126
openWebsocketOverlay = new BoxButton(container, xOff, yOff, 245, 27, _lang.string("options_overlay_instructions"), 12, clickHandler);
124127
yOff += 30;
125128

129+
yOff += drawSeperator(container, xOff, 266, yOff, 0, 2);
130+
131+
reloadEngineData = new BoxButton(container, xOff, yOff, 245, 27, _lang.string("popup_cm_reload_engine_user"), 12, clickHandler);
132+
yOff += 37;
133+
134+
switchUserAccount = new BoxButton(container, xOff, yOff, 245, 27, _lang.string("popup_cm_switch_profile"), 12, clickHandler);
135+
yOff += 37;
136+
126137
/// Col 2
127138
xOff = 310;
128139
yOff = 15;
@@ -296,6 +307,17 @@ package popups.settings
296307
navigateToURL(new URLRequest(Constant.WEBSOCKET_OVERLAY_URL), "_blank");
297308
}
298309

310+
//- Engine Reload
311+
else if (e.target == reloadEngineData)
312+
{
313+
_gvars.reloadEngineData();
314+
}
315+
316+
else if (e.target == switchUserAccount)
317+
{
318+
_gvars.switchUserAccount();
319+
}
320+
299321
// Window Position
300322
else if (e.target == windowSavePositionCheck)
301323
{

0 commit comments

Comments
 (0)