diff --git a/Content.Client/GameTicking/ClientGameTicker.cs b/Content.Client/GameTicking/ClientGameTicker.cs index abb6195cb5..086fc00510 100644 --- a/Content.Client/GameTicking/ClientGameTicker.cs +++ b/Content.Client/GameTicking/ClientGameTicker.cs @@ -198,6 +198,7 @@ namespace Content.Client.GameTicking LayoutContainer.SetAnchorPreset(_characterSetup, LayoutContainer.LayoutPreset.Wide); _characterSetup.CloseButton.OnPressed += args => { + _characterSetup.Save(); _lobby.CharacterPreview.UpdateUI(); _userInterfaceManager.StateRoot.AddChild(_lobby); _userInterfaceManager.StateRoot.RemoveChild(_characterSetup); diff --git a/Content.Client/UserInterface/CharacterSetupGui.cs b/Content.Client/UserInterface/CharacterSetupGui.cs index dd6076c0e5..e9f92893e9 100644 --- a/Content.Client/UserInterface/CharacterSetupGui.cs +++ b/Content.Client/UserInterface/CharacterSetupGui.cs @@ -153,6 +153,11 @@ namespace Content.Client.UserInterface UpdateUI(); } + public void Save() + { + _humanoidProfileEditor.Save(); + } + private void UpdateUI() { var numberOfFullSlots = 0; diff --git a/Content.Client/UserInterface/HumanoidProfileEditor.cs b/Content.Client/UserInterface/HumanoidProfileEditor.cs index f989d5d896..2101a0f157 100644 --- a/Content.Client/UserInterface/HumanoidProfileEditor.cs +++ b/Content.Client/UserInterface/HumanoidProfileEditor.cs @@ -354,12 +354,7 @@ namespace Content.Client.UserInterface Text = localization.GetString("Save"), SizeFlagsHorizontal = SizeFlags.ShrinkCenter }; - _saveButton.OnPressed += args => - { - IsDirty = false; - _preferencesManager.UpdateCharacter(Profile, CharacterSlot); - OnProfileChanged?.Invoke(Profile); - }; + _saveButton.OnPressed += args => { Save(); }; panel.AddChild(_saveButton); rightColumn.AddChild(panel); } @@ -371,6 +366,13 @@ namespace Content.Client.UserInterface IsDirty = false; } + public void Save() + { + IsDirty = false; + _preferencesManager.UpdateCharacter(Profile, CharacterSlot); + OnProfileChanged?.Invoke(Profile); + } + private bool IsDirty { get => _isDirty;