Multiline edit everywhere (#15216)
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using Content.Shared.Communications;
|
||||
using Content.Shared.Communications;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Client.Communications.UI
|
||||
{
|
||||
@@ -59,8 +55,22 @@ namespace Content.Client.Communications.UI
|
||||
|
||||
public void AnnounceButtonPressed(string message)
|
||||
{
|
||||
var msg = message.Length <= 256 ? message.Trim() : $"{message.Trim().Substring(0, 256)}...";
|
||||
SendMessage(new CommunicationsConsoleAnnounceMessage(msg));
|
||||
var msg = (message.Length <= 256 ? message.Trim() : $"{message.Trim().Substring(0, 256)}...").ToCharArray();
|
||||
|
||||
// No more than 2 newlines, other replaced to spaces
|
||||
var newlines = 0;
|
||||
for (var i = 0; i < msg.Length; i++)
|
||||
{
|
||||
if (msg[i] != '\n')
|
||||
continue;
|
||||
|
||||
if (newlines >= 2)
|
||||
msg[i] = ' ';
|
||||
|
||||
newlines++;
|
||||
}
|
||||
|
||||
SendMessage(new CommunicationsConsoleAnnounceMessage(new string(msg)));
|
||||
}
|
||||
|
||||
public void CallShuttle()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<controls:FancyWindow xmlns="https://spacestation14.io"
|
||||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
|
||||
Title="{Loc 'comms-console-menu-title'}"
|
||||
MinSize="350 225">
|
||||
MinSize="400 225">
|
||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True" Margin="5">
|
||||
<LineEdit Name="MessageInput" PlaceHolder="{Loc 'comms-console-menu-announcement-placeholder'}" HorizontalExpand="True" Margin="0 0 0 5" />
|
||||
<TextEdit Name="MessageInput" HorizontalExpand="True" VerticalExpand="True" Margin="0 0 0 5" MinHeight="100" />
|
||||
<Button Name="AnnounceButton" Text="{Loc 'comms-console-menu-announcement-button'}" StyleClasses="OpenLeft" Access="Public" />
|
||||
|
||||
<OptionButton Name="AlertLevelButton" StyleClasses="OpenRight" Access="Public" />
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using System.Threading;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
||||
using Robust.Shared.Utility;
|
||||
using Timer = Robust.Shared.Timing.Timer;
|
||||
|
||||
namespace Content.Client.Communications.UI
|
||||
@@ -26,7 +20,10 @@ namespace Content.Client.Communications.UI
|
||||
|
||||
Owner = owner;
|
||||
|
||||
AnnounceButton.OnPressed += (_) => Owner.AnnounceButtonPressed(MessageInput.Text.Trim());
|
||||
var loc = IoCManager.Resolve<ILocalizationManager>();
|
||||
MessageInput.Placeholder = new Rope.Leaf(loc.GetString("comms-console-menu-announcement-placeholder"));
|
||||
|
||||
AnnounceButton.OnPressed += (_) => Owner.AnnounceButtonPressed(Rope.Collapse(MessageInput.TextRope).Trim());
|
||||
AnnounceButton.Disabled = !owner.CanAnnounce;
|
||||
|
||||
AlertLevelButton.OnItemSelected += args =>
|
||||
|
||||
Reference in New Issue
Block a user