Files
tbd-station-14/Content.Shared/GameObjects/Components/Disposal/SharedDisposalRouterComponent.cs
Julian Giebel 7771f58460 Improve on disposal routing code (#1795)
Co-authored-by: Julian Giebel <j.giebel@netrocks.info>
2020-08-19 20:43:56 +02:00

56 lines
1.5 KiB
C#

using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.Serialization;
using System;
using System.Text.RegularExpressions;
namespace Content.Shared.GameObjects.Components.Disposal
{
public class SharedDisposalRouterComponent : Component
{
public override string Name => "DisposalRouter";
public static readonly Regex TagRegex = new Regex("^[a-zA-Z0-9, ]*$", RegexOptions.Compiled);
[Serializable, NetSerializable]
public class DisposalRouterUserInterfaceState : BoundUserInterfaceState
{
public readonly string Tags;
public DisposalRouterUserInterfaceState(string tags)
{
Tags = tags;
}
}
[Serializable, NetSerializable]
public class UiActionMessage : BoundUserInterfaceMessage
{
public readonly UiAction Action;
public readonly string Tags = "";
public UiActionMessage(UiAction action, string tags)
{
Action = action;
if (Action == UiAction.Ok)
{
Tags = tags.Substring(0, Math.Min(tags.Length, 150));
}
}
}
[Serializable, NetSerializable]
public enum UiAction
{
Ok
}
[Serializable, NetSerializable]
public enum DisposalRouterUiKey
{
Key
}
}
}