From: Echo Date: Sat, 6 May 2023 07:35:22 +0000 (-0700) Subject: Enhance paperwork UI (#16006) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=68eb28ac95f3be6e314417eb4e8cd907a67cf223;p=space-station-14.git Enhance paperwork UI (#16006) --- diff --git a/Content.Client/Paper/UI/PaperWindow.xaml b/Content.Client/Paper/UI/PaperWindow.xaml index 9b4a03f086..562db53809 100644 --- a/Content.Client/Paper/UI/PaperWindow.xaml +++ b/Content.Client/Paper/UI/PaperWindow.xaml @@ -1,7 +1,7 @@ + SetSize="510 660"> @@ -12,9 +12,8 @@ - - + + diff --git a/Content.Client/Paper/UI/PaperWindow.xaml.cs b/Content.Client/Paper/UI/PaperWindow.xaml.cs index 56b8f00afa..e270cebc35 100644 --- a/Content.Client/Paper/UI/PaperWindow.xaml.cs +++ b/Content.Client/Paper/UI/PaperWindow.xaml.cs @@ -3,6 +3,7 @@ using Robust.Client.AutoGenerated; using Robust.Client.Graphics; using Robust.Client.ResourceManagement; using Robust.Client.UserInterface.CustomControls; +using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.XAML; using Robust.Shared.Utility; @@ -180,13 +181,19 @@ namespace Content.Client.Paper.UI InputContainer.Visible = isEditing; var msg = new FormattedMessage(); - // Remove any newlines from the end of the message. There can be a trailing - // 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')); + msg.AddMarkupPermissive(state.Text); + + 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 = state.Text.Length > 0; + WrittenTextLabel.Visible = !isEditing && state.Text.Length > 0; BlankPaperIndicator.Visible = !isEditing && state.Text.Length == 0; StampDisplay.RemoveAllChildren(); diff --git a/Content.Server/Paper/PaperComponent.cs b/Content.Server/Paper/PaperComponent.cs index 3fe6232cd1..9844afcc1f 100644 --- a/Content.Server/Paper/PaperComponent.cs +++ b/Content.Server/Paper/PaperComponent.cs @@ -11,7 +11,7 @@ namespace Content.Server.Paper public string Content { get; set; } = ""; [DataField("contentSize")] - public int ContentSize { get; set; } = 1000; + public int ContentSize { get; set; } = 6000; [DataField("stampedBy")] public List StampedBy { get; set; } = new(); diff --git a/Content.Server/Paper/PaperSystem.cs b/Content.Server/Paper/PaperSystem.cs index dda31b0e5b..eb764f5782 100644 --- a/Content.Server/Paper/PaperSystem.cs +++ b/Content.Server/Paper/PaperSystem.cs @@ -92,7 +92,7 @@ namespace Content.Server.Paper 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); 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); 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); + + UpdateUserInterface(uid, paperComp); } } @@ -124,7 +126,7 @@ namespace Content.Server.Paper var text = FormattedMessage.EscapeText(args.Text); if (text.Length + paperComp.Content.Length <= paperComp.ContentSize) - paperComp.Content += text + '\n'; + paperComp.Content = text; if (TryComp(uid, out var appearance)) _appearance.SetData(uid, PaperVisuals.Status, PaperStatus.Written, appearance); @@ -136,6 +138,7 @@ namespace Content.Server.Paper _adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(args.Session.AttachedEntity.Value):player} has written on {ToPrettyString(uid):entity} the following text: {args.Text}"); + paperComp.Mode = PaperAction.Read; UpdateUserInterface(uid, paperComp); } diff --git a/Resources/Prototypes/Entities/Objects/Misc/books.yml b/Resources/Prototypes/Entities/Objects/Misc/books.yml index 49ebec9d96..539e53c637 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/books.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/books.yml @@ -11,7 +11,7 @@ - state: book0 map: [ "enum.DamageStateVisualLayers.Base" ] - type: Paper - contentSize: 3000 + contentSize: 12000 - type: ActivatableUI key: enum.PaperUiKey.Key closeOnHandDeselect: false