Actually save when pressing "save and close" (#523)

This commit is contained in:
DamianX
2020-01-19 14:54:11 +01:00
committed by Pieter-Jan Briers
parent 511741d11a
commit 1bd17f73b1
3 changed files with 14 additions and 6 deletions

View File

@@ -198,6 +198,7 @@ namespace Content.Client.GameTicking
LayoutContainer.SetAnchorPreset(_characterSetup, LayoutContainer.LayoutPreset.Wide); LayoutContainer.SetAnchorPreset(_characterSetup, LayoutContainer.LayoutPreset.Wide);
_characterSetup.CloseButton.OnPressed += args => _characterSetup.CloseButton.OnPressed += args =>
{ {
_characterSetup.Save();
_lobby.CharacterPreview.UpdateUI(); _lobby.CharacterPreview.UpdateUI();
_userInterfaceManager.StateRoot.AddChild(_lobby); _userInterfaceManager.StateRoot.AddChild(_lobby);
_userInterfaceManager.StateRoot.RemoveChild(_characterSetup); _userInterfaceManager.StateRoot.RemoveChild(_characterSetup);

View File

@@ -153,6 +153,11 @@ namespace Content.Client.UserInterface
UpdateUI(); UpdateUI();
} }
public void Save()
{
_humanoidProfileEditor.Save();
}
private void UpdateUI() private void UpdateUI()
{ {
var numberOfFullSlots = 0; var numberOfFullSlots = 0;

View File

@@ -354,12 +354,7 @@ namespace Content.Client.UserInterface
Text = localization.GetString("Save"), Text = localization.GetString("Save"),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter SizeFlagsHorizontal = SizeFlags.ShrinkCenter
}; };
_saveButton.OnPressed += args => _saveButton.OnPressed += args => { Save(); };
{
IsDirty = false;
_preferencesManager.UpdateCharacter(Profile, CharacterSlot);
OnProfileChanged?.Invoke(Profile);
};
panel.AddChild(_saveButton); panel.AddChild(_saveButton);
rightColumn.AddChild(panel); rightColumn.AddChild(panel);
} }
@@ -371,6 +366,13 @@ namespace Content.Client.UserInterface
IsDirty = false; IsDirty = false;
} }
public void Save()
{
IsDirty = false;
_preferencesManager.UpdateCharacter(Profile, CharacterSlot);
OnProfileChanged?.Invoke(Profile);
}
private bool IsDirty private bool IsDirty
{ {
get => _isDirty; get => _isDirty;