Confirmation button (#12671)
Closes https://github.com/space-wizards/space-station-14/issues/12579
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Client.Humanoid;
|
|||||||
using Content.Client.Info;
|
using Content.Client.Info;
|
||||||
using Content.Client.Lobby.UI;
|
using Content.Client.Lobby.UI;
|
||||||
using Content.Client.Resources;
|
using Content.Client.Resources;
|
||||||
|
using Content.Client.Stylesheets;
|
||||||
using Content.Shared.Humanoid;
|
using Content.Shared.Humanoid;
|
||||||
using Content.Shared.Humanoid.Prototypes;
|
using Content.Shared.Humanoid.Prototypes;
|
||||||
using Content.Shared.Preferences;
|
using Content.Shared.Preferences;
|
||||||
@@ -130,7 +131,7 @@ namespace Content.Client.Preferences.UI
|
|||||||
var characterIndexCopy = slot;
|
var characterIndexCopy = slot;
|
||||||
characterPickerButton.OnPressed += args =>
|
characterPickerButton.OnPressed += args =>
|
||||||
{
|
{
|
||||||
_humanoidProfileEditor.Profile = (HumanoidCharacterProfile) character;
|
_humanoidProfileEditor.Profile = (HumanoidCharacterProfile)character;
|
||||||
_humanoidProfileEditor.CharacterSlot = characterIndexCopy;
|
_humanoidProfileEditor.CharacterSlot = characterIndexCopy;
|
||||||
_humanoidProfileEditor.UpdateControls();
|
_humanoidProfileEditor.UpdateControls();
|
||||||
_preferencesManager.SelectCharacter(character);
|
_preferencesManager.SelectCharacter(character);
|
||||||
@@ -170,7 +171,7 @@ namespace Content.Client.Preferences.UI
|
|||||||
_previewDummy = entityManager.SpawnEntity(prototypeManager.Index<SpeciesPrototype>(SharedHumanoidSystem.DefaultSpecies).DollPrototype, MapCoordinates.Nullspace);
|
_previewDummy = entityManager.SpawnEntity(prototypeManager.Index<SpeciesPrototype>(SharedHumanoidSystem.DefaultSpecies).DollPrototype, MapCoordinates.Nullspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntitySystem.Get<HumanoidSystem>().LoadProfile(_previewDummy, (HumanoidCharacterProfile) profile);
|
EntitySystem.Get<HumanoidSystem>().LoadProfile(_previewDummy, (HumanoidCharacterProfile)profile);
|
||||||
|
|
||||||
if (humanoid != null)
|
if (humanoid != null)
|
||||||
{
|
{
|
||||||
@@ -209,11 +210,25 @@ namespace Content.Client.Preferences.UI
|
|||||||
Text = Loc.GetString("character-setup-gui-character-picker-button-delete-button"),
|
Text = Loc.GetString("character-setup-gui-character-picker-button-delete-button"),
|
||||||
Visible = !isSelectedCharacter,
|
Visible = !isSelectedCharacter,
|
||||||
};
|
};
|
||||||
deleteButton.OnPressed += _ =>
|
var confirmDeleteButton = new Button
|
||||||
|
{
|
||||||
|
Text = Loc.GetString("character-setup-gui-character-picker-button-confirm-delete-button"),
|
||||||
|
Visible = false,
|
||||||
|
};
|
||||||
|
confirmDeleteButton.ModulateSelfOverride = StyleNano.ButtonColorCautionDefault;
|
||||||
|
confirmDeleteButton.OnPressed += _ =>
|
||||||
{
|
{
|
||||||
Parent?.RemoveChild(this);
|
Parent?.RemoveChild(this);
|
||||||
|
Parent?.RemoveChild(confirmDeleteButton);
|
||||||
preferencesManager.DeleteCharacter(profile);
|
preferencesManager.DeleteCharacter(profile);
|
||||||
};
|
};
|
||||||
|
deleteButton.OnPressed += _ =>
|
||||||
|
{
|
||||||
|
|
||||||
|
deleteButton.Visible = false;
|
||||||
|
confirmDeleteButton.Visible = true;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
var internalHBox = new BoxContainer
|
var internalHBox = new BoxContainer
|
||||||
{
|
{
|
||||||
@@ -224,7 +239,8 @@ namespace Content.Client.Preferences.UI
|
|||||||
{
|
{
|
||||||
view,
|
view,
|
||||||
descriptionLabel,
|
descriptionLabel,
|
||||||
deleteButton
|
deleteButton,
|
||||||
|
confirmDeleteButton
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -5,3 +5,4 @@ character-setup-gui-character-setup-close-button = Close
|
|||||||
character-setup-gui-create-new-character-button = Create new slot...
|
character-setup-gui-create-new-character-button = Create new slot...
|
||||||
character-setup-gui-create-new-character-button-tooltip = A maximum of {$maxCharacters} characters are allowed.
|
character-setup-gui-create-new-character-button-tooltip = A maximum of {$maxCharacters} characters are allowed.
|
||||||
character-setup-gui-character-picker-button-delete-button = Delete
|
character-setup-gui-character-picker-button-delete-button = Delete
|
||||||
|
character-setup-gui-character-picker-button-confirm-delete-button = Confirm
|
||||||
|
|||||||
Reference in New Issue
Block a user