Improve on disposal routing code (#1795)

Co-authored-by: Julian Giebel <j.giebel@netrocks.info>
This commit is contained in:
Julian Giebel
2020-08-19 20:43:56 +02:00
committed by GitHub
parent 20ab566f8c
commit 7771f58460
8 changed files with 23 additions and 31 deletions

View File

@@ -1,7 +1,4 @@
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using Content.Shared.GameObjects.Components.Disposal;
using Robust.Client.Graphics.Drawing;
using Content.Shared.GameObjects.Components.Disposal;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
@@ -21,11 +18,9 @@ namespace Content.Client.GameObjects.Components.Disposal
protected override Vector2? CustomSize => (400, 80);
private Regex _tagRegex;
public DisposalRouterWindow()
{
_tagRegex = new Regex("^[a-zA-Z0-9, ]*$", RegexOptions.Compiled);
Title = Loc.GetString("Disposal Router");
Contents.AddChild(new VBoxContainer
{
@@ -38,7 +33,7 @@ namespace Content.Client.GameObjects.Components.Disposal
Children =
{
(TagInput = new LineEdit {SizeFlagsHorizontal = SizeFlags.Expand, CustomMinimumSize = (320, 0),
ToolTip = Loc.GetString("A comma separated list of tags"), IsValid = tags => _tagRegex.IsMatch(tags)}),
ToolTip = Loc.GetString("A comma separated list of tags"), IsValid = tags => TagRegex.IsMatch(tags)}),
new Control {CustomMinimumSize = (10, 0)},
(Confirm = new Button {Text = Loc.GetString("Confirm")})
}