Make the client validate character information (#3563)
Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -136,7 +136,7 @@ namespace Content.Client.UserInterface
|
||||
MinSize = (2, 0)
|
||||
});
|
||||
_humanoidProfileEditor = new HumanoidProfileEditor(preferencesManager, prototypeManager, entityManager);
|
||||
_humanoidProfileEditor.OnProfileChanged += newProfile => { UpdateUI(); };
|
||||
_humanoidProfileEditor.OnProfileChanged += ProfileChanged;
|
||||
hBox.AddChild(_humanoidProfileEditor);
|
||||
|
||||
UpdateUI();
|
||||
@@ -155,6 +155,12 @@ namespace Content.Client.UserInterface
|
||||
|
||||
public void Save() => _humanoidProfileEditor.Save();
|
||||
|
||||
private void ProfileChanged(ICharacterProfile profile, int profileSlot)
|
||||
{
|
||||
_humanoidProfileEditor.UpdateControls();
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
private void UpdateUI()
|
||||
{
|
||||
var numberOfFullSlots = 0;
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Content.Client.UserInterface
|
||||
private bool _isDirty;
|
||||
public int CharacterSlot;
|
||||
public HumanoidCharacterProfile Profile;
|
||||
public event Action<HumanoidCharacterProfile> OnProfileChanged;
|
||||
public event Action<HumanoidCharacterProfile, int> OnProfileChanged;
|
||||
|
||||
public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IPrototypeManager prototypeManager,
|
||||
IEntityManager entityManager)
|
||||
@@ -709,7 +709,7 @@ namespace Content.Client.UserInterface
|
||||
{
|
||||
IsDirty = false;
|
||||
_preferencesManager.UpdateCharacter(Profile, CharacterSlot);
|
||||
OnProfileChanged?.Invoke(Profile);
|
||||
OnProfileChanged?.Invoke(Profile, CharacterSlot);
|
||||
}
|
||||
|
||||
private bool IsDirty
|
||||
|
||||
Reference in New Issue
Block a user