6
2025-11-05 11:11:22 +03:00

42 lines
1.4 KiB
C#

using Content.Shared._Horizon.FlavorText;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;
namespace Content.Client.FlavorText
{
[GenerateTypedNameReferences]
public sealed partial class FlavorText : Control
{
public Action<string>? OnFlavorTextChanged;
// Horizon start
public Action<int>? OnErpStatChanged;
public Action<string>? OnOOCFlavorTextChanged;
// Horizon end
public FlavorText()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
var loc = IoCManager.Resolve<ILocalizationManager>();
CFlavorTextInput.Placeholder = new Rope.Leaf(loc.GetString("flavor-text-placeholder"));
CFlavorTextInput.OnTextChanged += _ => FlavorTextChanged();
// Horizon start
ERPStatusButton.OnItemSelected += args => OnErpStatChanged?.Invoke(args.Id);
OOCFlavorTextInput.Placeholder = new Rope.Leaf(loc.GetString("ooc-flavor-text-placeholder"));
OOCFlavorTextInput.OnTextChanged += args => OnOOCFlavorTextChanged?.Invoke(Rope.Collapse(OOCFlavorTextInput.TextRope).Trim());
// Horizon end
}
public void FlavorTextChanged()
{
OnFlavorTextChanged?.Invoke(Rope.Collapse(CFlavorTextInput.TextRope).Trim());
}
}
}