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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user