mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-02-14 19:29:57 +01:00
* Add Dynamic Text * add UI for entering a dynamic description * work UI * work DynamicText * fixed client * final bugfix * mini change * Okay... Again mini change * fix request DynamicText * add limit Dynamic text
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using Content.Client.UserInterface.Controls;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Utility;
|
|
using Robust.Client.UserInterface.Controls;
|
|
|
|
namespace Content.Client._WL.DynamicText.UI;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class DynamicTextWindow : FancyWindow
|
|
{
|
|
public Action<string>? OnDynamicTextSaveButtonPressed;
|
|
public DynamicTextWindow()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
IoCManager.InjectDependencies(this);
|
|
|
|
var loc = IoCManager.Resolve<ILocalizationManager>();
|
|
|
|
CDynamicTextInput.Placeholder = new Rope.Leaf(loc.GetString("dynamic-text-placeholder"));
|
|
DynamicTextSaveButton.OnPressed += OnDynamicTextSave;
|
|
DynamicTextCloseButton.OnPressed += OnClose;
|
|
}
|
|
public void SetDynamicText(string text)
|
|
{
|
|
CDynamicTextInput.TextRope = new Rope.Leaf(text);
|
|
}
|
|
|
|
private void OnDynamicTextSave(BaseButton.ButtonEventArgs obj)
|
|
{
|
|
OnDynamicTextSaveButtonPressed?.Invoke(Rope.Collapse(CDynamicTextInput.TextRope).Trim());
|
|
}
|
|
|
|
private void OnClose(BaseButton.ButtonEventArgs obj)
|
|
{
|
|
Close();
|
|
}
|
|
}
|