From 0e3bd2f648feebc5aba5da2081e6f0f3efa2cce9 Mon Sep 17 00:00:00 2001 From: haiwwkes <49613070+rhailrake@users.noreply.github.com> Date: Thu, 24 Jul 2025 20:32:54 +0500 Subject: [PATCH] fix editor (#2641) --- .../CustomInteractionEditor.xaml.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Content.Client/_Sunrise/InteractionsPanel/CustomInteractionEditor.xaml.cs b/Content.Client/_Sunrise/InteractionsPanel/CustomInteractionEditor.xaml.cs index b1676105de..bf2ca379fe 100644 --- a/Content.Client/_Sunrise/InteractionsPanel/CustomInteractionEditor.xaml.cs +++ b/Content.Client/_Sunrise/InteractionsPanel/CustomInteractionEditor.xaml.cs @@ -48,6 +48,10 @@ public sealed partial class CustomInteractionEditor : DefaultWindow private readonly Dictionary _effectIds = new(); private readonly Dictionary _soundIds = new(); + private const int MaxNameLength = 64; + private const int MaxDescriptionLength = 256; + private const int MaxMessageLength = 128; + #endregion #region Constructor @@ -300,6 +304,12 @@ public sealed partial class CustomInteractionEditor : DefaultWindow if (string.IsNullOrEmpty(message)) return; + if (message.Length > MaxMessageLength) + { + ShowError($"Сообщение слишком длинное (макс. {MaxMessageLength} символов)"); + return; + } + _interaction.InteractionMessages.Add(message); AddMessageToList(message); NewMessageInput.Text = string.Empty; @@ -336,6 +346,18 @@ public sealed partial class CustomInteractionEditor : DefaultWindow return; } + if (_interaction.Name.Length > MaxNameLength) + { + ShowError($"Имя слишком длинное (макс. {MaxNameLength} символов)"); + return; + } + + if (_interaction.Description.Length > MaxDescriptionLength) + { + ShowError($"Описание слишком длинное (макс. {MaxDescriptionLength} символов)"); + return; + } + if (_interaction.InteractionMessages.Count == 0) { ShowError("Добавьте хотя бы одно сообщение взаимодействия");