Remove dependency.

Yeah, let's not ever again. Please.
This commit is contained in:
Víctor Aguilera Puerto
2020-11-07 01:04:15 +01:00
parent b5d00a2cf6
commit a7e7f20417

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using Namotion.Reflection;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
@@ -101,7 +100,7 @@ namespace Content.Client.GameObjects.Components.Wires
{
_column.Children.Clear();
_inputs.Clear();
foreach (var field in state.Config)
{
var margin = new MarginContainer
@@ -142,8 +141,8 @@ namespace Content.Client.GameObjects.Components.Wires
private void OnConfirm(ButtonEventArgs args)
{
var config = GenerateDictionary<string, LineEdit>(_inputs, "Text");
var config = GenerateDictionary(_inputs, "Text");
Owner.SendConfiguration(config);
Close();
}
@@ -153,13 +152,13 @@ namespace Content.Client.GameObjects.Components.Wires
return Owner.Validation == null || Owner.Validation.IsMatch(value);
}
private Dictionary<string, TConfig> GenerateDictionary<TConfig, TInput>(List<(string name, TInput input)> inputs, string propertyName) where TInput : Control
private Dictionary<string, string> GenerateDictionary(IEnumerable<(string name, LineEdit input)> inputs, string propertyName)
{
var dictionary = new Dictionary<string, TConfig>();
var dictionary = new Dictionary<string, string>();
foreach (var input in inputs)
{
var value = input.input.TryGetPropertyValue<TConfig>(propertyName);
dictionary.Add(input.name, value);
dictionary.Add(input.name, input.input.Text);
}
return dictionary;