diff --git a/Content.Client/Lobby/LobbyUIController.cs b/Content.Client/Lobby/LobbyUIController.cs index e4a13ed8c6..824a842d56 100644 --- a/Content.Client/Lobby/LobbyUIController.cs +++ b/Content.Client/Lobby/LobbyUIController.cs @@ -46,6 +46,7 @@ public sealed class LobbyUIController : UIController, IOnStateEntered /// This is the characher preview panel in the chat. This should only update if their character updates. @@ -214,6 +215,46 @@ public sealed class LobbyUIController : UIController, IOnStateEntered + { + SaveProfile(); + + _savePanel.Close(); + + CloseProfileEditor(); + }; + + _savePanel.NoSaveButton.OnPressed += _ => + { + _savePanel.Close(); + + CloseProfileEditor(); + }; + + _savePanel.OpenCentered(); + } + private (CharacterSetupGui, HumanoidProfileEditor) EnsureGui() { if (_characterSetup != null && _profileEditor != null) @@ -240,14 +281,16 @@ public sealed class LobbyUIController : UIController, IOnStateEntered { - // Reset sliders etc. - _profileEditor.SetProfile(null, null); - _profileEditor.Visible = false; - - if (_stateManager.CurrentState is LobbyState lobbyGui) + // Open the save panel if we have unsaved changes. + if (_profileEditor.Profile != null && _profileEditor.IsDirty) { - lobbyGui.SwitchState(LobbyGui.LobbyGuiState.Default); + OpenSavePanel(); + + return; } + + // Reset sliders etc. + CloseProfileEditor(); }; _profileEditor.Save += SaveProfile; diff --git a/Content.Client/Lobby/UI/CharacterSetupGuiSavePanel.xaml b/Content.Client/Lobby/UI/CharacterSetupGuiSavePanel.xaml new file mode 100644 index 0000000000..2dcf914353 --- /dev/null +++ b/Content.Client/Lobby/UI/CharacterSetupGuiSavePanel.xaml @@ -0,0 +1,10 @@ + + + +