PaperWindow to XAML UI (#4639)

* Rename/add files

* PaperWindow to XAML
This commit is contained in:
Visne
2021-09-19 19:01:01 +02:00
committed by GitHub
parent 5063689d81
commit 093cf98b93
3 changed files with 40 additions and 39 deletions

View File

@@ -1,39 +0,0 @@
using Content.Shared.Paper;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.BoxContainer;
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 BoxContainer
{
Orientation = LayoutOrientation.Vertical
};
_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);
}
}
}

View File

@@ -0,0 +1,9 @@
<SS14Window xmlns="https://spacestation14.io"
MinSize="300 300"
SetSize="300 300">
<BoxContainer Orientation="Vertical">
<RichTextLabel Name="Label" />
<LineEdit Name="InputProtected"
Visible="False" />
</BoxContainer>
</SS14Window>

View File

@@ -0,0 +1,31 @@
using Content.Shared.Paper;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;
namespace Content.Client.Paper.UI
{
[GenerateTypedNameReferences]
public partial class PaperWindow : SS14Window
{
public LineEdit Input => InputProtected;
public PaperWindow()
{
RobustXamlLoader.Load(this);
}
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);
}
}
}