2020-12-08 11:56:10 +01:00
|
|
|
using JetBrains.Annotations;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Client.GameObjects;
|
2020-02-11 20:01:05 -03:00
|
|
|
using Robust.Client.UserInterface.Controls;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-03-10 14:48:29 +01:00
|
|
|
using static Content.Shared.GameObjects.Components.SharedPaperComponent;
|
2020-02-11 20:01:05 -03:00
|
|
|
|
2020-08-13 14:40:27 +02:00
|
|
|
namespace Content.Client.GameObjects.Components.Paper
|
2020-02-11 20:01:05 -03:00
|
|
|
{
|
2020-12-08 11:56:10 +01:00
|
|
|
[UsedImplicitly]
|
2020-02-11 20:01:05 -03:00
|
|
|
public class PaperBoundUserInterface : BoundUserInterface
|
|
|
|
|
{
|
2021-03-10 14:48:29 +01:00
|
|
|
private PaperWindow? _window;
|
2020-02-11 20:01:05 -03:00
|
|
|
|
|
|
|
|
public PaperBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Open()
|
|
|
|
|
{
|
|
|
|
|
base.Open();
|
|
|
|
|
_window = new PaperWindow
|
|
|
|
|
{
|
|
|
|
|
Title = Owner.Owner.Name,
|
|
|
|
|
};
|
|
|
|
|
_window.OnClose += Close;
|
|
|
|
|
_window.Input.OnTextEntered += Input_OnTextEntered;
|
|
|
|
|
_window.OpenCentered();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
|
|
|
{
|
|
|
|
|
base.UpdateState(state);
|
2021-03-10 14:48:29 +01:00
|
|
|
_window?.Populate((PaperBoundUserInterfaceState) state);
|
2020-02-11 20:01:05 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Input_OnTextEntered(LineEdit.LineEditEventArgs obj)
|
|
|
|
|
{
|
2021-03-10 14:48:29 +01:00
|
|
|
if (!string.IsNullOrEmpty(obj.Text))
|
2020-02-11 20:01:05 -03:00
|
|
|
{
|
2021-03-10 14:48:29 +01:00
|
|
|
SendMessage(new PaperInputText(obj.Text));
|
|
|
|
|
|
|
|
|
|
if (_window != null)
|
|
|
|
|
{
|
|
|
|
|
_window.Input.Text = string.Empty;
|
|
|
|
|
}
|
2020-02-11 20:01:05 -03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|