Re-organize all projects (#4166)

This commit is contained in:
DrSmugleaf
2021-06-09 22:19:39 +02:00
committed by GitHub
parent 9f50e4061b
commit ff1a2d97ea
1773 changed files with 5258 additions and 5508 deletions

View File

@@ -0,0 +1,50 @@
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects;
using static Content.Shared.Paper.SharedPaperComponent;
namespace Content.Client.Paper.UI
{
[UsedImplicitly]
public class PaperBoundUserInterface : BoundUserInterface
{
private PaperWindow? _window;
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);
_window?.Populate((PaperBoundUserInterfaceState) state);
}
private void Input_OnTextEntered(LineEdit.LineEditEventArgs obj)
{
if (!string.IsNullOrEmpty(obj.Text))
{
SendMessage(new PaperInputText(obj.Text));
if (_window != null)
{
_window.Input.Text = string.Empty;
}
}
}
}
}

View File

@@ -0,0 +1,35 @@
using Content.Shared.Paper;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Utility;
namespace Content.Client.Paper.UI
{
public class PaperWindow : SS14Window
{
private readonly RichTextLabel _label;
public readonly LineEdit Input;
public PaperWindow()
{
MinSize = SetSize = (300, 300);
var container = new VBoxContainer();
_label = new RichTextLabel();
Input = new LineEdit {Visible = false};
container.AddChild(_label);
container.AddChild(Input);
Contents.AddChild(container);
}
public void Populate(SharedPaperComponent.PaperBoundUserInterfaceState state)
{
if (state.Mode == SharedPaperComponent.PaperAction.Write)
{
Input.Visible = true;
}
var msg = new FormattedMessage();
msg.AddMarkupPermissive(state.Text);
_label.SetMessage(msg);
}
}
}