Improve flavor UI (#19600)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<Control Name="CFlavorText" xmlns="https://spacestation14.io">
|
||||
<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>
|
||||
</Control>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.FlavorText
|
||||
{
|
||||
@@ -14,12 +15,14 @@ namespace Content.Client.FlavorText
|
||||
RobustXamlLoader.Load(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()
|
||||
{
|
||||
OnFlavorTextChanged?.Invoke(CFlavorTextInput.Text);
|
||||
OnFlavorTextChanged?.Invoke(Rope.Collapse(CFlavorTextInput.TextRope).Trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Content.Client.Preferences.UI
|
||||
|
||||
private LineEdit _ageEdit => CAgeEdit;
|
||||
private LineEdit _nameEdit => CNameEdit;
|
||||
private LineEdit _flavorTextEdit = null!;
|
||||
private TextEdit _flavorTextEdit = null!;
|
||||
private Button _nameRandomButton => CNameRandomize;
|
||||
private Button _randomizeEverythingButton => CRandomizeEverything;
|
||||
private RichTextLabel _warningLabel => CWarningLabel;
|
||||
@@ -858,7 +858,7 @@ namespace Content.Client.Preferences.UI
|
||||
{
|
||||
if(_flavorTextEdit != null)
|
||||
{
|
||||
_flavorTextEdit.Text = Profile?.FlavorText ?? "";
|
||||
_flavorTextEdit.TextRope = new Rope.Leaf(Profile?.FlavorText ?? "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
Resources/Locale/en-US/preferences/ui/flavor-text.ftl
Normal file
1
Resources/Locale/en-US/preferences/ui/flavor-text.ftl
Normal file
@@ -0,0 +1 @@
|
||||
flavor-text-placeholder = An outer description of your character that others can get by looking at them...
|
||||
Reference in New Issue
Block a user