Paper and pen (#582)
* A very basic paper and pen implementation * Removes SharedWriteComponent * Update ContentNetIDs.cs
This commit is contained in:
36
Content.Client/GameObjects/Components/Paper/PaperWindow.cs
Normal file
36
Content.Client/GameObjects/Components/Paper/PaperWindow.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.GameObjects.Components
|
||||
{
|
||||
public class PaperWindow : SS14Window
|
||||
{
|
||||
private readonly RichTextLabel _label;
|
||||
public readonly LineEdit Input;
|
||||
protected override Vector2? CustomSize => (300, 300);
|
||||
|
||||
public PaperWindow()
|
||||
{
|
||||
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.AddMarkup(state.Text);
|
||||
_label.SetMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user