2022-03-31 18:22:38 +13:00
|
|
|
using System.Text.RegularExpressions;
|
2022-12-23 23:55:31 -05:00
|
|
|
using Content.Shared.Tools;
|
|
|
|
|
using Robust.Shared.GameStates;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Robust.Shared.Serialization;
|
2022-12-23 23:55:31 -05:00
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
2020-10-30 01:16:26 +01:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Configurable
|
2020-10-30 01:16:26 +01:00
|
|
|
{
|
2022-12-23 23:55:31 -05:00
|
|
|
[RegisterComponent, NetworkedComponent]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class ConfigurationComponent : Component
|
2020-10-30 01:16:26 +01:00
|
|
|
{
|
2022-12-23 23:55:31 -05:00
|
|
|
[DataField("config")]
|
2023-08-22 18:14:33 -07:00
|
|
|
public Dictionary<string, string?> Config = new();
|
2022-12-23 23:55:31 -05:00
|
|
|
|
|
|
|
|
[DataField("qualityNeeded", customTypeSerializer: typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
|
|
|
|
|
public string QualityNeeded = "Pulsing";
|
|
|
|
|
|
2022-03-31 18:22:38 +13:00
|
|
|
[DataField("validation")]
|
2023-08-22 18:14:33 -07:00
|
|
|
public Regex Validation = new("^[a-zA-Z0-9 ]*$", RegexOptions.Compiled);
|
2022-03-31 18:22:38 +13:00
|
|
|
|
2020-10-30 01:16:26 +01:00
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class ConfigurationBoundUserInterfaceState : BoundUserInterfaceState
|
2020-10-30 01:16:26 +01:00
|
|
|
{
|
2023-05-28 22:06:54 +02:00
|
|
|
public Dictionary<string, string?> Config { get; }
|
2020-11-06 04:04:21 +11:00
|
|
|
|
2023-05-28 22:06:54 +02:00
|
|
|
public ConfigurationBoundUserInterfaceState(Dictionary<string, string?> config)
|
2020-11-06 04:04:21 +11:00
|
|
|
{
|
|
|
|
|
Config = config;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-30 01:16:26 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Message data sent from client to server when the device configuration is updated.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class ConfigurationUpdatedMessage : BoundUserInterfaceMessage
|
2020-10-30 01:16:26 +01:00
|
|
|
{
|
2020-11-06 04:04:21 +11:00
|
|
|
public Dictionary<string, string> Config { get; }
|
2020-10-30 01:16:26 +01:00
|
|
|
|
|
|
|
|
public ConfigurationUpdatedMessage(Dictionary<string, string> config)
|
|
|
|
|
{
|
|
|
|
|
Config = config;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class ValidationUpdateMessage : BoundUserInterfaceMessage
|
2020-10-30 01:16:26 +01:00
|
|
|
{
|
2020-11-06 04:04:21 +11:00
|
|
|
public string ValidationString { get; }
|
2020-10-30 01:16:26 +01:00
|
|
|
|
|
|
|
|
public ValidationUpdateMessage(string validationString)
|
|
|
|
|
{
|
|
|
|
|
ValidationString = validationString;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public enum ConfigurationUiKey
|
|
|
|
|
{
|
|
|
|
|
Key
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|