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">
<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>

View File

@@ -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());
}
}
}