Enhance paperwork UI (#16006)
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<paper:PaperWindow xmlns="https://spacestation14.io"
|
<paper:PaperWindow xmlns="https://spacestation14.io"
|
||||||
xmlns:paper="clr-namespace:Content.Client.Paper.UI"
|
xmlns:paper="clr-namespace:Content.Client.Paper.UI"
|
||||||
MouseFilter="Stop" Resizable="True" MinSize="150 150"
|
MouseFilter="Stop" Resizable="True" MinSize="150 150"
|
||||||
SetSize="300 400"> <!-- Provide some reasonable sizes by default. Can be changed by the component -->
|
SetSize="510 660"> <!-- Provide some reasonable sizes by default. Can be changed by the component -->
|
||||||
|
|
||||||
<BoxContainer Name="ContentsRoot" Orientation="Vertical">
|
<BoxContainer Name="ContentsRoot" Orientation="Vertical">
|
||||||
<PanelContainer StyleClasses="AngleRect" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="6">
|
<PanelContainer StyleClasses="AngleRect" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="6">
|
||||||
@@ -12,9 +12,8 @@
|
|||||||
<PanelContainer Name="PaperContent" VerticalExpand="True" HorizontalExpand="True" MaxWidth="600">
|
<PanelContainer Name="PaperContent" VerticalExpand="True" HorizontalExpand="True" MaxWidth="600">
|
||||||
<BoxContainer Orientation="Vertical" VerticalAlignment="Stretch">
|
<BoxContainer Orientation="Vertical" VerticalAlignment="Stretch">
|
||||||
<TextureButton Name="HeaderImage" HorizontalAlignment="Center" VerticalAlignment="Top" MouseFilter="Ignore"/>
|
<TextureButton Name="HeaderImage" HorizontalAlignment="Center" VerticalAlignment="Top" MouseFilter="Ignore"/>
|
||||||
<Control Name="TextAlignmentPadding" VerticalAlignment="Top" />
|
<Control Name="TextAlignmentPadding" VerticalAlignment="Top"/>
|
||||||
<RichTextLabel Name="BlankPaperIndicator" StyleClasses="LabelSecondaryColor"
|
<RichTextLabel Name="BlankPaperIndicator" StyleClasses="LabelSecondaryColor" VerticalAlignment="Top" HorizontalAlignment="Center"/>
|
||||||
VerticalAlignment="Top" HorizontalAlignment="Center"/>
|
|
||||||
<RichTextLabel StyleClasses="PaperWrittenText" Name="WrittenTextLabel" VerticalAlignment="Top"/>
|
<RichTextLabel StyleClasses="PaperWrittenText" Name="WrittenTextLabel" VerticalAlignment="Top"/>
|
||||||
<PanelContainer Name="InputContainer" StyleClasses="TransparentBorderedWindowPanel" MinHeight="100"
|
<PanelContainer Name="InputContainer" StyleClasses="TransparentBorderedWindowPanel" MinHeight="100"
|
||||||
VerticalAlignment="Stretch" VerticalExpand="True" HorizontalExpand="True">
|
VerticalAlignment="Stretch" VerticalExpand="True" HorizontalExpand="True">
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Robust.Client.AutoGenerated;
|
|||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.ResourceManagement;
|
using Robust.Client.ResourceManagement;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
@@ -180,13 +181,19 @@ namespace Content.Client.Paper.UI
|
|||||||
InputContainer.Visible = isEditing;
|
InputContainer.Visible = isEditing;
|
||||||
|
|
||||||
var msg = new FormattedMessage();
|
var msg = new FormattedMessage();
|
||||||
// Remove any newlines from the end of the message. There can be a trailing
|
msg.AddMarkupPermissive(state.Text);
|
||||||
// new line at the end of user input, and we would like to display the input
|
|
||||||
// box immediately on the next line.
|
|
||||||
msg.AddMarkupPermissive(state.Text.TrimEnd('\r', '\n'));
|
|
||||||
WrittenTextLabel.SetMessage(msg);
|
|
||||||
WrittenTextLabel.Visible = state.Text.Length > 0;
|
|
||||||
|
|
||||||
|
Input.TextRope = Rope.Leaf.Empty;
|
||||||
|
Input.CursorPosition = new TextEdit.CursorPos();
|
||||||
|
Input.InsertAtCursor(msg.ToString());
|
||||||
|
|
||||||
|
for (var i = 0; i <= state.StampedBy.Count * 3 + 1; i++)
|
||||||
|
{
|
||||||
|
msg.AddMarkupPermissive("\r\n");
|
||||||
|
}
|
||||||
|
WrittenTextLabel.SetMessage(msg);
|
||||||
|
|
||||||
|
WrittenTextLabel.Visible = !isEditing && state.Text.Length > 0;
|
||||||
BlankPaperIndicator.Visible = !isEditing && state.Text.Length == 0;
|
BlankPaperIndicator.Visible = !isEditing && state.Text.Length == 0;
|
||||||
|
|
||||||
StampDisplay.RemoveAllChildren();
|
StampDisplay.RemoveAllChildren();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Content.Server.Paper
|
|||||||
public string Content { get; set; } = "";
|
public string Content { get; set; } = "";
|
||||||
|
|
||||||
[DataField("contentSize")]
|
[DataField("contentSize")]
|
||||||
public int ContentSize { get; set; } = 1000;
|
public int ContentSize { get; set; } = 6000;
|
||||||
|
|
||||||
[DataField("stampedBy")]
|
[DataField("stampedBy")]
|
||||||
public List<string> StampedBy { get; set; } = new();
|
public List<string> StampedBy { get; set; } = new();
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace Content.Server.Paper
|
|||||||
|
|
||||||
private void OnInteractUsing(EntityUid uid, PaperComponent paperComp, InteractUsingEvent args)
|
private void OnInteractUsing(EntityUid uid, PaperComponent paperComp, InteractUsingEvent args)
|
||||||
{
|
{
|
||||||
if (_tagSystem.HasTag(args.Used, "Write"))
|
if (_tagSystem.HasTag(args.Used, "Write") && paperComp.StampedBy.Count == 0)
|
||||||
{
|
{
|
||||||
var writeEvent = new PaperWriteEvent(uid, args.User);
|
var writeEvent = new PaperWriteEvent(uid, args.User);
|
||||||
RaiseLocalEvent(args.Used, ref writeEvent);
|
RaiseLocalEvent(args.Used, ref writeEvent);
|
||||||
@@ -113,6 +113,8 @@ namespace Content.Server.Paper
|
|||||||
_popupSystem.PopupEntity(stampPaperOtherMessage, args.User, Filter.PvsExcept(args.User, entityManager: EntityManager), true);
|
_popupSystem.PopupEntity(stampPaperOtherMessage, args.User, Filter.PvsExcept(args.User, entityManager: EntityManager), true);
|
||||||
var stampPaperSelfMessage = Loc.GetString("paper-component-action-stamp-paper-self", ("target", Identity.Entity(args.Target, EntityManager)),("stamp", args.Used));
|
var stampPaperSelfMessage = Loc.GetString("paper-component-action-stamp-paper-self", ("target", Identity.Entity(args.Target, EntityManager)),("stamp", args.Used));
|
||||||
_popupSystem.PopupEntity(stampPaperSelfMessage, args.User, args.User);
|
_popupSystem.PopupEntity(stampPaperSelfMessage, args.User, args.User);
|
||||||
|
|
||||||
|
UpdateUserInterface(uid, paperComp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +126,7 @@ namespace Content.Server.Paper
|
|||||||
var text = FormattedMessage.EscapeText(args.Text);
|
var text = FormattedMessage.EscapeText(args.Text);
|
||||||
|
|
||||||
if (text.Length + paperComp.Content.Length <= paperComp.ContentSize)
|
if (text.Length + paperComp.Content.Length <= paperComp.ContentSize)
|
||||||
paperComp.Content += text + '\n';
|
paperComp.Content = text;
|
||||||
|
|
||||||
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
||||||
_appearance.SetData(uid, PaperVisuals.Status, PaperStatus.Written, appearance);
|
_appearance.SetData(uid, PaperVisuals.Status, PaperStatus.Written, appearance);
|
||||||
@@ -136,6 +138,7 @@ namespace Content.Server.Paper
|
|||||||
_adminLogger.Add(LogType.Chat, LogImpact.Low,
|
_adminLogger.Add(LogType.Chat, LogImpact.Low,
|
||||||
$"{ToPrettyString(args.Session.AttachedEntity.Value):player} has written on {ToPrettyString(uid):entity} the following text: {args.Text}");
|
$"{ToPrettyString(args.Session.AttachedEntity.Value):player} has written on {ToPrettyString(uid):entity} the following text: {args.Text}");
|
||||||
|
|
||||||
|
paperComp.Mode = PaperAction.Read;
|
||||||
UpdateUserInterface(uid, paperComp);
|
UpdateUserInterface(uid, paperComp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
- state: book0
|
- state: book0
|
||||||
map: [ "enum.DamageStateVisualLayers.Base" ]
|
map: [ "enum.DamageStateVisualLayers.Base" ]
|
||||||
- type: Paper
|
- type: Paper
|
||||||
contentSize: 3000
|
contentSize: 12000
|
||||||
- type: ActivatableUI
|
- type: ActivatableUI
|
||||||
key: enum.PaperUiKey.Key
|
key: enum.PaperUiKey.Key
|
||||||
closeOnHandDeselect: false
|
closeOnHandDeselect: false
|
||||||
|
|||||||
Reference in New Issue
Block a user