Improve flavor UI (#19600)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Morb
2023-08-28 13:01:45 +03:00
committed by GitHub
parent b88c2cbb49
commit 627a282e1a
4 changed files with 9 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
<Control Name="CFlavorText" xmlns="https://spacestation14.io"> <Control Name="CFlavorText" xmlns="https://spacestation14.io">
<BoxContainer Orientation="Vertical" HorizontalExpand="True"> <BoxContainer Orientation="Vertical" HorizontalExpand="True">
<LineEdit Name="CFlavorTextInput" Access="Public" MinSize="220 0" HorizontalExpand="True" /> <TextEdit Name="CFlavorTextInput" Access="Public" MinSize="220 100" Margin="10" HorizontalExpand="True" VerticalExpand="True" />
</BoxContainer> </BoxContainer>
</Control> </Control>

View File

@@ -1,6 +1,7 @@
using Robust.Client.AutoGenerated; using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML; using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;
namespace Content.Client.FlavorText namespace Content.Client.FlavorText
{ {
@@ -14,12 +15,14 @@ namespace Content.Client.FlavorText
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
CFlavorTextInput.OnTextChanged += _ => FlavorTextChanged(); var loc = IoCManager.Resolve<ILocalizationManager>();
CFlavorTextInput.Placeholder = new Rope.Leaf(loc.GetString("flavor-text-placeholder"));
CFlavorTextInput.OnKeyBindDown += _ => FlavorTextChanged();
} }
public void FlavorTextChanged() public void FlavorTextChanged()
{ {
OnFlavorTextChanged?.Invoke(CFlavorTextInput.Text); OnFlavorTextChanged?.Invoke(Rope.Collapse(CFlavorTextInput.TextRope).Trim());
} }
} }
} }

View File

@@ -60,7 +60,7 @@ namespace Content.Client.Preferences.UI
private LineEdit _ageEdit => CAgeEdit; private LineEdit _ageEdit => CAgeEdit;
private LineEdit _nameEdit => CNameEdit; private LineEdit _nameEdit => CNameEdit;
private LineEdit _flavorTextEdit = null!; private TextEdit _flavorTextEdit = null!;
private Button _nameRandomButton => CNameRandomize; private Button _nameRandomButton => CNameRandomize;
private Button _randomizeEverythingButton => CRandomizeEverything; private Button _randomizeEverythingButton => CRandomizeEverything;
private RichTextLabel _warningLabel => CWarningLabel; private RichTextLabel _warningLabel => CWarningLabel;
@@ -858,7 +858,7 @@ namespace Content.Client.Preferences.UI
{ {
if(_flavorTextEdit != null) if(_flavorTextEdit != null)
{ {
_flavorTextEdit.Text = Profile?.FlavorText ?? ""; _flavorTextEdit.TextRope = new Rope.Leaf(Profile?.FlavorText ?? "");
} }
} }

View File

@@ -0,0 +1 @@
flavor-text-placeholder = An outer description of your character that others can get by looking at them...