Improve flavor UI (#19600)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -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