Unstable 0.17.0.0
This commit is contained in:
@@ -44,11 +44,11 @@ namespace Barotrauma
|
||||
/// <summary>
|
||||
/// Holds the references to the input fields.
|
||||
/// </summary>
|
||||
public Dictionary<string, GUIComponent[]> Fields { get; private set; } = new Dictionary<string, GUIComponent[]>();
|
||||
public Dictionary<Identifier, GUIComponent[]> Fields { get; private set; } = new Dictionary<Identifier, GUIComponent[]>();
|
||||
|
||||
public void UpdateValue(SerializableProperty property, object newValue, bool flash = true)
|
||||
{
|
||||
if (!Fields.TryGetValue(property.Name, out GUIComponent[] fields))
|
||||
if (!Fields.TryGetValue(property.Name.ToIdentifier(), out GUIComponent[] fields))
|
||||
{
|
||||
DebugConsole.ThrowError($"No field for {property.Name} found!");
|
||||
return;
|
||||
@@ -64,7 +64,7 @@ namespace Barotrauma
|
||||
numInput.FloatValue = f;
|
||||
if (flash)
|
||||
{
|
||||
numInput.Flash(GUI.Style.Green);
|
||||
numInput.Flash(GUIStyle.Green);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ namespace Barotrauma
|
||||
numInput.IntValue = integer;
|
||||
if (flash)
|
||||
{
|
||||
numInput.Flash(GUI.Style.Green);
|
||||
numInput.Flash(GUIStyle.Green);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ namespace Barotrauma
|
||||
tickBox.Selected = b;
|
||||
if (flash)
|
||||
{
|
||||
tickBox.Flash(GUI.Style.Green);
|
||||
tickBox.Flash(GUIStyle.Green);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ namespace Barotrauma
|
||||
textBox.Text = s;
|
||||
if (flash)
|
||||
{
|
||||
textBox.Flash(GUI.Style.Green);
|
||||
textBox.Flash(GUIStyle.Green);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ namespace Barotrauma
|
||||
dropDown.Select((int)newValue);
|
||||
if (flash)
|
||||
{
|
||||
dropDown.Flash(GUI.Style.Green);
|
||||
dropDown.Flash(GUIStyle.Green);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@ namespace Barotrauma
|
||||
numInput.FloatValue = i == 0 ? v2.X : v2.Y;
|
||||
if (flash)
|
||||
{
|
||||
numInput.Flash(GUI.Style.Green);
|
||||
numInput.Flash(GUIStyle.Green);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ namespace Barotrauma
|
||||
}
|
||||
if (flash)
|
||||
{
|
||||
numInput.Flash(GUI.Style.Green);
|
||||
numInput.Flash(GUIStyle.Green);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,7 +193,7 @@ namespace Barotrauma
|
||||
}
|
||||
if (flash)
|
||||
{
|
||||
numInput.Flash(GUI.Style.Green);
|
||||
numInput.Flash(GUIStyle.Green);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,7 @@ namespace Barotrauma
|
||||
}
|
||||
if (flash)
|
||||
{
|
||||
numInput.Flash(GUI.Style.Green);
|
||||
numInput.Flash(GUIStyle.Green);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -265,7 +265,7 @@ namespace Barotrauma
|
||||
}
|
||||
if (flash)
|
||||
{
|
||||
numInput.Flash(GUI.Style.Green);
|
||||
numInput.Flash(GUIStyle.Green);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -281,27 +281,27 @@ namespace Barotrauma
|
||||
textBox.Text = a[i];
|
||||
if (flash)
|
||||
{
|
||||
textBox.Flash(GUI.Style.Green);
|
||||
textBox.Flash(GUIStyle.Green);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SerializableEntityEditor(RectTransform parent, ISerializableEntity entity, bool inGame, bool showName, string style = "", int elementHeight = 24, ScalableFont titleFont = null)
|
||||
public SerializableEntityEditor(RectTransform parent, ISerializableEntity entity, bool inGame, bool showName, string style = "", int elementHeight = 24, GUIFont titleFont = null)
|
||||
: this(parent, entity, inGame ?
|
||||
SerializableProperty.GetProperties<InGameEditable>(entity).Union(SerializableProperty.GetProperties<ConditionallyEditable>(entity).Where(p => p.GetAttribute<ConditionallyEditable>()?.IsEditable(entity) ?? false))
|
||||
: SerializableProperty.GetProperties<Editable>(entity).Where(p => p.GetAttribute<ConditionallyEditable>()?.IsEditable(entity) ?? true), showName, style, elementHeight, titleFont)
|
||||
{
|
||||
}
|
||||
|
||||
public SerializableEntityEditor(RectTransform parent, ISerializableEntity entity, IEnumerable<SerializableProperty> properties, bool showName, string style = "", int elementHeight = 24, ScalableFont titleFont = null)
|
||||
public SerializableEntityEditor(RectTransform parent, ISerializableEntity entity, IEnumerable<SerializableProperty> properties, bool showName, string style = "", int elementHeight = 24, GUIFont titleFont = null)
|
||||
: base(style, new RectTransform(Vector2.One, parent))
|
||||
{
|
||||
this.elementHeight = (int)(elementHeight * GUI.Scale);
|
||||
var tickBoxStyle = GUI.Style.GetComponentStyle("GUITickBox");
|
||||
var textBoxStyle = GUI.Style.GetComponentStyle("GUITextBox");
|
||||
var numberInputStyle = GUI.Style.GetComponentStyle("GUINumberInput");
|
||||
var tickBoxStyle = GUIStyle.GetComponentStyle("GUITickBox");
|
||||
var textBoxStyle = GUIStyle.GetComponentStyle("GUITextBox");
|
||||
var numberInputStyle = GUIStyle.GetComponentStyle("GUINumberInput");
|
||||
if (tickBoxStyle.Height.HasValue) { this.elementHeight = Math.Max(tickBoxStyle.Height.Value, this.elementHeight); }
|
||||
if (textBoxStyle.Height.HasValue) { this.elementHeight = Math.Max(textBoxStyle.Height.Value, this.elementHeight); }
|
||||
if (numberInputStyle.Height.HasValue) { this.elementHeight = Math.Max(numberInputStyle.Height.Value, this.elementHeight); }
|
||||
@@ -309,7 +309,7 @@ namespace Barotrauma
|
||||
layoutGroup = new GUILayoutGroup(new RectTransform(Vector2.One, RectTransform)) { AbsoluteSpacing = (int)(5 * GUI.Scale) };
|
||||
if (showName)
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Point(layoutGroup.Rect.Width, this.elementHeight), layoutGroup.RectTransform, isFixedSize: true), entity.Name, font: titleFont ?? GUI.Font)
|
||||
new GUITextBlock(new RectTransform(new Point(layoutGroup.Rect.Width, this.elementHeight), layoutGroup.RectTransform, isFixedSize: true), entity.Name, font: titleFont ?? GUIStyle.Font)
|
||||
{
|
||||
TextColor = Color.White,
|
||||
Color = Color.Black
|
||||
@@ -344,25 +344,24 @@ namespace Barotrauma
|
||||
value = "";
|
||||
}
|
||||
|
||||
string propertyTag = (entity.GetType().Name + "." + property.PropertyInfo.Name).ToLowerInvariant();
|
||||
string fallbackTag = property.PropertyInfo.Name.ToLowerInvariant();
|
||||
string displayName =
|
||||
TextManager.Get($"{propertyTag}", true, useEnglishAsFallBack: false) ??
|
||||
TextManager.Get($"sp.{propertyTag}.name", true, useEnglishAsFallBack: false);
|
||||
if (string.IsNullOrEmpty(displayName))
|
||||
Identifier propertyTag = $"{entity.GetType().Name}.{property.PropertyInfo.Name}".ToIdentifier();
|
||||
Identifier fallbackTag = property.PropertyInfo.Name.ToIdentifier();
|
||||
LocalizedString displayName =
|
||||
TextManager.Get(propertyTag, $"sp.{propertyTag}.name".ToIdentifier());
|
||||
if (displayName.IsNullOrEmpty())
|
||||
{
|
||||
Editable editable = property.GetAttribute<Editable>();
|
||||
if (editable != null && !string.IsNullOrEmpty(editable.FallBackTextTag))
|
||||
{
|
||||
displayName = TextManager.Get(editable.FallBackTextTag, true);
|
||||
displayName = TextManager.Get(editable.FallBackTextTag);
|
||||
}
|
||||
else
|
||||
{
|
||||
displayName = TextManager.Get(fallbackTag, true) ?? TextManager.Get($"sp.{fallbackTag}.name", true);
|
||||
displayName = TextManager.Get(fallbackTag, $"sp.{fallbackTag}.name".ToIdentifier());
|
||||
}
|
||||
}
|
||||
|
||||
if (displayName == null)
|
||||
if (displayName.IsNullOrEmpty())
|
||||
{
|
||||
displayName = property.Name.FormatCamelCaseWithSpaces();
|
||||
#if DEBUG
|
||||
@@ -379,7 +378,7 @@ namespace Barotrauma
|
||||
#endif
|
||||
}
|
||||
|
||||
string toolTip = TextManager.Get($"sp.{propertyTag}.description", true, !string.IsNullOrEmpty(fallbackTag) ? $"sp.{fallbackTag}.description" : null);
|
||||
LocalizedString toolTip = TextManager.Get($"sp.{propertyTag}.description", $"sp.{fallbackTag}.description");
|
||||
|
||||
if (toolTip == null)
|
||||
{
|
||||
@@ -445,20 +444,20 @@ namespace Barotrauma
|
||||
return propertyField;
|
||||
}
|
||||
|
||||
public GUIComponent CreateBoolField(ISerializableEntity entity, SerializableProperty property, bool value, string displayName, string toolTip)
|
||||
public GUIComponent CreateBoolField(ISerializableEntity entity, SerializableProperty property, bool value, LocalizedString displayName, LocalizedString toolTip)
|
||||
{
|
||||
var editableAttribute = property.GetAttribute<Editable>();
|
||||
if (editableAttribute.ReadOnly)
|
||||
{
|
||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform, isFixedSize: true), color: Color.Transparent);
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUIStyle.SmallFont)
|
||||
{
|
||||
ToolTip = toolTip
|
||||
};
|
||||
var valueField = new GUITextBlock(new RectTransform(new Vector2(inputFieldWidth, 1), frame.RectTransform, Anchor.TopRight), value.ToString())
|
||||
{
|
||||
ToolTip = toolTip,
|
||||
Font = GUI.SmallFont
|
||||
Font = GUIStyle.SmallFont
|
||||
};
|
||||
return valueField;
|
||||
}
|
||||
@@ -466,7 +465,7 @@ namespace Barotrauma
|
||||
{
|
||||
GUITickBox propertyTickBox = new GUITickBox(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform, isFixedSize: true), displayName)
|
||||
{
|
||||
Font = GUI.SmallFont,
|
||||
Font = GUIStyle.SmallFont,
|
||||
Selected = value,
|
||||
ToolTip = toolTip,
|
||||
OnSelected = (tickBox) =>
|
||||
@@ -489,15 +488,15 @@ namespace Barotrauma
|
||||
{
|
||||
propertyTickBox.Selected = (bool)property.GetValue(entity);
|
||||
};
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { propertyTickBox }); }
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name.ToIdentifier(), new GUIComponent[] { propertyTickBox }); }
|
||||
return propertyTickBox;
|
||||
}
|
||||
}
|
||||
|
||||
public GUIComponent CreateIntField(ISerializableEntity entity, SerializableProperty property, int value, string displayName, string toolTip)
|
||||
public GUIComponent CreateIntField(ISerializableEntity entity, SerializableProperty property, int value, LocalizedString displayName, LocalizedString toolTip)
|
||||
{
|
||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform, isFixedSize: true), color: Color.Transparent);
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUIStyle.SmallFont)
|
||||
{
|
||||
ToolTip = toolTip
|
||||
};
|
||||
@@ -508,7 +507,7 @@ namespace Barotrauma
|
||||
var numberInput = new GUITextBlock(new RectTransform(new Vector2(inputFieldWidth, 1), frame.RectTransform, Anchor.TopRight), value.ToString())
|
||||
{
|
||||
ToolTip = toolTip,
|
||||
Font = GUI.SmallFont
|
||||
Font = GUIStyle.SmallFont
|
||||
};
|
||||
field = numberInput;
|
||||
}
|
||||
@@ -517,7 +516,7 @@ namespace Barotrauma
|
||||
var numberInput = new GUINumberInput(new RectTransform(new Vector2(inputFieldWidth, 1), frame.RectTransform, Anchor.TopRight), GUINumberInput.NumberType.Int)
|
||||
{
|
||||
ToolTip = toolTip,
|
||||
Font = GUI.SmallFont
|
||||
Font = GUIStyle.SmallFont
|
||||
};
|
||||
numberInput.MinValueInt = editableAttribute.MinValueInt;
|
||||
numberInput.MaxValueInt = editableAttribute.MaxValueInt;
|
||||
@@ -535,17 +534,17 @@ namespace Barotrauma
|
||||
};
|
||||
field = numberInput;
|
||||
}
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { field }); }
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name.ToIdentifier(), new GUIComponent[] { field }); }
|
||||
return frame;
|
||||
}
|
||||
|
||||
public GUIComponent CreateFloatField(ISerializableEntity entity, SerializableProperty property, float value, string displayName, string toolTip)
|
||||
public GUIComponent CreateFloatField(ISerializableEntity entity, SerializableProperty property, float value, LocalizedString displayName, LocalizedString toolTip)
|
||||
{
|
||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform, isFixedSize: true), color: Color.Transparent)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUIStyle.SmallFont)
|
||||
{
|
||||
ToolTip = toolTip
|
||||
};
|
||||
@@ -554,7 +553,7 @@ namespace Barotrauma
|
||||
Anchor.TopRight), GUINumberInput.NumberType.Float)
|
||||
{
|
||||
ToolTip = toolTip,
|
||||
Font = GUI.SmallFont
|
||||
Font = GUIStyle.SmallFont
|
||||
};
|
||||
var editableAttribute = property.GetAttribute<Editable>();
|
||||
numberInput.MinValueFloat = editableAttribute.MinValueFloat;
|
||||
@@ -574,14 +573,14 @@ namespace Barotrauma
|
||||
{
|
||||
if (!numberInput.TextBox.Selected) { numberInput.FloatValue = (float)property.GetValue(entity); }
|
||||
};
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { numberInput }); }
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name.ToIdentifier(), new GUIComponent[] { numberInput }); }
|
||||
return frame;
|
||||
}
|
||||
|
||||
public GUIComponent CreateEnumField(ISerializableEntity entity, SerializableProperty property, object value, string displayName, string toolTip)
|
||||
public GUIComponent CreateEnumField(ISerializableEntity entity, SerializableProperty property, object value, LocalizedString displayName, LocalizedString toolTip)
|
||||
{
|
||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform, isFixedSize: true), color: Color.Transparent);
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUIStyle.SmallFont)
|
||||
{
|
||||
ToolTip = toolTip
|
||||
};
|
||||
@@ -607,14 +606,14 @@ namespace Barotrauma
|
||||
{
|
||||
if (!enumDropDown.Dropped) { enumDropDown.SelectItem(property.GetValue(entity)); }
|
||||
};
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { enumDropDown }); }
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name.ToIdentifier(), new GUIComponent[] { enumDropDown }); }
|
||||
return frame;
|
||||
}
|
||||
|
||||
public GUIComponent CreateEnumFlagField(ISerializableEntity entity, SerializableProperty property, object value, string displayName, string toolTip)
|
||||
public GUIComponent CreateEnumFlagField(ISerializableEntity entity, SerializableProperty property, object value, LocalizedString displayName, LocalizedString toolTip)
|
||||
{
|
||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform, isFixedSize: true), color: Color.Transparent);
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUIStyle.SmallFont)
|
||||
{
|
||||
ToolTip = toolTip
|
||||
};
|
||||
@@ -645,30 +644,30 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { enumDropDown }); }
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name.ToIdentifier(), new GUIComponent[] { enumDropDown }); }
|
||||
return frame;
|
||||
}
|
||||
|
||||
public GUIComponent CreateStringField(ISerializableEntity entity, SerializableProperty property, string value, string displayName, string toolTip)
|
||||
public GUIComponent CreateStringField(ISerializableEntity entity, SerializableProperty property, string value, LocalizedString displayName, LocalizedString toolTip)
|
||||
{
|
||||
var frame = new GUILayoutGroup(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform, isFixedSize: true), isHorizontal: true, childAnchor: Anchor.CenterLeft)
|
||||
{
|
||||
Stretch = true
|
||||
};
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUI.SmallFont, textAlignment: Alignment.Left)
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUIStyle.SmallFont, textAlignment: Alignment.Left)
|
||||
{
|
||||
ToolTip = toolTip
|
||||
};
|
||||
string translationTextTag = property.GetAttribute<Serialize>()?.translationTextTag;
|
||||
Identifier translationTextTag = property.GetAttribute<Serialize>()?.TranslationTextTag ?? Identifier.Empty;
|
||||
float browseButtonWidth = 0.1f;
|
||||
var editableAttribute = property.GetAttribute<Editable>();
|
||||
float textBoxWidth = inputFieldWidth;
|
||||
if (translationTextTag != null) { textBoxWidth -= browseButtonWidth; }
|
||||
if (!translationTextTag.IsEmpty) { textBoxWidth -= browseButtonWidth; }
|
||||
GUITextBox propertyBox = new GUITextBox(new RectTransform(new Vector2(textBoxWidth, 1), frame.RectTransform))
|
||||
{
|
||||
Enabled = editableAttribute != null && !editableAttribute.ReadOnly,
|
||||
ToolTip = toolTip,
|
||||
Font = GUI.SmallFont,
|
||||
Font = GUIStyle.SmallFont,
|
||||
Text = value,
|
||||
OverflowClip = true
|
||||
};
|
||||
@@ -702,7 +701,7 @@ namespace Barotrauma
|
||||
{
|
||||
TrySendNetworkUpdate(entity, property);
|
||||
textBox.Text = (string) property.GetValue(entity);
|
||||
textBox.Flash(GUI.Style.Green, flashDuration: 1f);
|
||||
textBox.Flash(GUIStyle.Green, flashDuration: 1f);
|
||||
}
|
||||
//restore the entities that were selected before applying
|
||||
MapEntity.SelectedList.Clear();
|
||||
@@ -713,23 +712,23 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
|
||||
if (translationTextTag != null)
|
||||
if (!translationTextTag.IsEmpty)
|
||||
{
|
||||
new GUIButton(new RectTransform(new Vector2(browseButtonWidth, 1), frame.RectTransform, Anchor.TopRight), "...", style: "GUIButtonSmall")
|
||||
{
|
||||
OnClicked = (bt, userData) => { CreateTextPicker(translationTextTag, entity, property, propertyBox); return true; }
|
||||
OnClicked = (bt, userData) => { CreateTextPicker(translationTextTag.Value, entity, property, propertyBox); return true; }
|
||||
};
|
||||
propertyBox.OnTextChanged += (tb, text) =>
|
||||
{
|
||||
string translatedText = TextManager.Get(text, returnNull: true);
|
||||
if (translatedText == null)
|
||||
LocalizedString translatedText = TextManager.Get(text);
|
||||
if (translatedText.IsNullOrEmpty())
|
||||
{
|
||||
propertyBox.TextColor = Color.Gray;
|
||||
propertyBox.ToolTip = TextManager.GetWithVariable("StringPropertyCannotTranslate", "[tag]", text ?? string.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
propertyBox.TextColor = GUI.Style.Green;
|
||||
propertyBox.TextColor = GUIStyle.Green;
|
||||
propertyBox.ToolTip = TextManager.GetWithVariable("StringPropertyTranslate", "[translation]", translatedText);
|
||||
}
|
||||
return true;
|
||||
@@ -737,14 +736,14 @@ namespace Barotrauma
|
||||
propertyBox.Text = value;
|
||||
}
|
||||
frame.RectTransform.MinSize = new Point(0, frame.RectTransform.Children.Max(c => c.MinSize.Y));
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { propertyBox }); }
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name.ToIdentifier(), new GUIComponent[] { propertyBox }); }
|
||||
return frame;
|
||||
}
|
||||
|
||||
public GUIComponent CreatePointField(ISerializableEntity entity, SerializableProperty property, Point value, string displayName, string toolTip)
|
||||
public GUIComponent CreatePointField(ISerializableEntity entity, SerializableProperty property, Point value, LocalizedString displayName, LocalizedString toolTip)
|
||||
{
|
||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform, isFixedSize: true), color: Color.Transparent);
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUIStyle.SmallFont)
|
||||
{
|
||||
ToolTip = toolTip
|
||||
};
|
||||
@@ -759,17 +758,17 @@ namespace Barotrauma
|
||||
{
|
||||
var element = new GUIFrame(new RectTransform(new Vector2(0.45f, 1), inputArea.RectTransform), style: null);
|
||||
|
||||
string componentLabel = GUI.vectorComponentLabels[i];
|
||||
LocalizedString componentLabel = GUI.VectorComponentLabels[i];
|
||||
if (editableAttribute.VectorComponentLabels != null && i < editableAttribute.VectorComponentLabels.Length)
|
||||
{
|
||||
componentLabel = TextManager.Get(editableAttribute.VectorComponentLabels[i]);
|
||||
}
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUI.SmallFont, textAlignment: Alignment.Center);
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
||||
GUINumberInput.NumberType.Int)
|
||||
{
|
||||
Font = GUI.SmallFont
|
||||
Font = GUIStyle.SmallFont
|
||||
};
|
||||
|
||||
if (i == 0)
|
||||
@@ -806,14 +805,14 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
frame.RectTransform.MinSize = new Point(0, frame.RectTransform.Children.Max(c => c.MinSize.Y));
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name.ToIdentifier(), fields); }
|
||||
return frame;
|
||||
}
|
||||
|
||||
public GUIComponent CreateVector2Field(ISerializableEntity entity, SerializableProperty property, Vector2 value, string displayName, string toolTip)
|
||||
public GUIComponent CreateVector2Field(ISerializableEntity entity, SerializableProperty property, Vector2 value, LocalizedString displayName, LocalizedString toolTip)
|
||||
{
|
||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform, isFixedSize: true), color: Color.Transparent);
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - inputFieldWidth, 1), frame.RectTransform), displayName, font: GUIStyle.SmallFont)
|
||||
{
|
||||
ToolTip = toolTip
|
||||
};
|
||||
@@ -828,16 +827,16 @@ namespace Barotrauma
|
||||
{
|
||||
var element = new GUIFrame(new RectTransform(new Vector2(0.45f, 1), inputArea.RectTransform), style: null);
|
||||
|
||||
string componentLabel = GUI.vectorComponentLabels[i];
|
||||
LocalizedString componentLabel = GUI.VectorComponentLabels[i];
|
||||
if (editableAttribute.VectorComponentLabels != null && i < editableAttribute.VectorComponentLabels.Length)
|
||||
{
|
||||
componentLabel = TextManager.Get(editableAttribute.VectorComponentLabels[i]);
|
||||
}
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUI.SmallFont, textAlignment: Alignment.Center);
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
||||
GUINumberInput.NumberType.Float)
|
||||
{
|
||||
Font = GUI.SmallFont
|
||||
Font = GUIStyle.SmallFont
|
||||
};
|
||||
|
||||
numberInput.MinValueFloat = editableAttribute.MinValueFloat;
|
||||
@@ -876,14 +875,14 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
frame.RectTransform.MinSize = new Point(0, frame.RectTransform.Children.Max(c => c.MinSize.Y));
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name.ToIdentifier(), fields); }
|
||||
return frame;
|
||||
}
|
||||
|
||||
public GUIComponent CreateVector3Field(ISerializableEntity entity, SerializableProperty property, Vector3 value, string displayName, string toolTip)
|
||||
public GUIComponent CreateVector3Field(ISerializableEntity entity, SerializableProperty property, Vector3 value, LocalizedString displayName, LocalizedString toolTip)
|
||||
{
|
||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform, isFixedSize: true), color: Color.Transparent);
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - largeInputFieldWidth, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - largeInputFieldWidth, 1), frame.RectTransform), displayName, font: GUIStyle.SmallFont)
|
||||
{
|
||||
ToolTip = toolTip
|
||||
};
|
||||
@@ -898,17 +897,17 @@ namespace Barotrauma
|
||||
{
|
||||
var element = new GUIFrame(new RectTransform(new Vector2(0.33f, 1), inputArea.RectTransform), style: null);
|
||||
|
||||
string componentLabel = GUI.vectorComponentLabels[i];
|
||||
LocalizedString componentLabel = GUI.VectorComponentLabels[i];
|
||||
if (editableAttribute.VectorComponentLabels != null && i < editableAttribute.VectorComponentLabels.Length)
|
||||
{
|
||||
componentLabel = TextManager.Get(editableAttribute.VectorComponentLabels[i]);
|
||||
}
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUI.SmallFont, textAlignment: Alignment.Center);
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
||||
GUINumberInput.NumberType.Float)
|
||||
{
|
||||
Font = GUI.SmallFont
|
||||
Font = GUIStyle.SmallFont
|
||||
};
|
||||
|
||||
numberInput.MinValueFloat = editableAttribute.MinValueFloat;
|
||||
@@ -952,14 +951,14 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
frame.RectTransform.MinSize = new Point(0, frame.RectTransform.Children.Max(c => c.MinSize.Y));
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name.ToIdentifier(), fields); }
|
||||
return frame;
|
||||
}
|
||||
|
||||
public GUIComponent CreateVector4Field(ISerializableEntity entity, SerializableProperty property, Vector4 value, string displayName, string toolTip)
|
||||
public GUIComponent CreateVector4Field(ISerializableEntity entity, SerializableProperty property, Vector4 value, LocalizedString displayName, LocalizedString toolTip)
|
||||
{
|
||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform, isFixedSize: true), color: Color.Transparent);
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - largeInputFieldWidth, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - largeInputFieldWidth, 1), frame.RectTransform), displayName, font: GUIStyle.SmallFont)
|
||||
{
|
||||
ToolTip = toolTip
|
||||
};
|
||||
@@ -974,17 +973,17 @@ namespace Barotrauma
|
||||
{
|
||||
var element = new GUIFrame(new RectTransform(new Vector2(0.22f, 1), inputArea.RectTransform) { MinSize = new Point(50, 0), MaxSize = new Point(150, 50) }, style: null);
|
||||
|
||||
string componentLabel = GUI.vectorComponentLabels[i];
|
||||
LocalizedString componentLabel = GUI.VectorComponentLabels[i];
|
||||
if (editableAttribute.VectorComponentLabels != null && i < editableAttribute.VectorComponentLabels.Length)
|
||||
{
|
||||
componentLabel = TextManager.Get(editableAttribute.VectorComponentLabels[i]);
|
||||
}
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUI.SmallFont, textAlignment: Alignment.Center);
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
||||
GUINumberInput.NumberType.Float)
|
||||
{
|
||||
Font = GUI.SmallFont
|
||||
Font = GUIStyle.SmallFont
|
||||
};
|
||||
|
||||
numberInput.MinValueFloat = editableAttribute.MinValueFloat;
|
||||
@@ -1033,14 +1032,14 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
frame.RectTransform.MinSize = new Point(0, frame.RectTransform.Children.Max(c => c.MinSize.Y));
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name.ToIdentifier(), fields); }
|
||||
return frame;
|
||||
}
|
||||
|
||||
public GUIComponent CreateColorField(ISerializableEntity entity, SerializableProperty property, Color value, string displayName, string toolTip)
|
||||
public GUIComponent CreateColorField(ISerializableEntity entity, SerializableProperty property, Color value, LocalizedString displayName, LocalizedString toolTip)
|
||||
{
|
||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform, isFixedSize: true), color: Color.Transparent);
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - largeInputFieldWidth, 1), frame.RectTransform) { MinSize = new Point(80, 26) }, displayName, font: GUI.SmallFont)
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f - largeInputFieldWidth, 1), frame.RectTransform) { MinSize = new Point(80, 26) }, displayName, font: GUIStyle.SmallFont)
|
||||
{
|
||||
ToolTip = displayName + '\n' + toolTip
|
||||
};
|
||||
@@ -1073,11 +1072,11 @@ namespace Barotrauma
|
||||
{
|
||||
Stretch = true
|
||||
};
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), element.RectTransform, Anchor.CenterLeft) { MinSize = new Point(15, 0) }, GUI.colorComponentLabels[i], font: GUI.SmallFont, textAlignment: Alignment.Center);
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), element.RectTransform, Anchor.CenterLeft) { MinSize = new Point(15, 0) }, GUI.ColorComponentLabels[i], font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
||||
GUINumberInput.NumberType.Int)
|
||||
{
|
||||
Font = GUI.SmallFont
|
||||
Font = GUIStyle.SmallFont
|
||||
};
|
||||
numberInput.MinValueInt = 0;
|
||||
numberInput.MaxValueInt = 255;
|
||||
@@ -1091,7 +1090,7 @@ namespace Barotrauma
|
||||
else
|
||||
numberInput.IntValue = value.A;
|
||||
|
||||
numberInput.Font = GUI.SmallFont;
|
||||
numberInput.Font = GUIStyle.SmallFont;
|
||||
|
||||
int comp = i;
|
||||
numberInput.OnValueChanged += (numInput) =>
|
||||
@@ -1127,14 +1126,14 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
frame.RectTransform.MinSize = new Point(0, frame.RectTransform.Children.Max(c => c.MinSize.Y));
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name.ToIdentifier(), fields); }
|
||||
return frame;
|
||||
}
|
||||
|
||||
public GUIComponent CreateRectangleField(ISerializableEntity entity, SerializableProperty property, Rectangle value, string displayName, string toolTip)
|
||||
public GUIComponent CreateRectangleField(ISerializableEntity entity, SerializableProperty property, Rectangle value, LocalizedString displayName, LocalizedString toolTip)
|
||||
{
|
||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform, isFixedSize: true), color: Color.Transparent);
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(0.25f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(0.25f, 1), frame.RectTransform), displayName, font: GUIStyle.SmallFont)
|
||||
{
|
||||
ToolTip = displayName + '\n' + toolTip
|
||||
};
|
||||
@@ -1148,11 +1147,11 @@ namespace Barotrauma
|
||||
for (int i = 3; i >= 0; i--)
|
||||
{
|
||||
var element = new GUIFrame(new RectTransform(new Vector2(0.22f, 1), inputArea.RectTransform) { MinSize = new Point(50, 0), MaxSize = new Point(150, 50) }, style: null);
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), GUI.rectComponentLabels[i], font: GUI.SmallFont, textAlignment: Alignment.Center);
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), GUI.RectComponentLabels[i], font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
||||
GUINumberInput.NumberType.Int)
|
||||
{
|
||||
Font = GUI.SmallFont
|
||||
Font = GUIStyle.SmallFont
|
||||
};
|
||||
// Not sure if the min value could in any case be negative.
|
||||
numberInput.MinValueInt = 0;
|
||||
@@ -1199,15 +1198,15 @@ namespace Barotrauma
|
||||
((GUINumberInput)fields[3]).IntValue = value.Height;
|
||||
}
|
||||
};
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name.ToIdentifier(), fields); }
|
||||
return frame;
|
||||
}
|
||||
|
||||
public GUIComponent CreateStringArrayField(ISerializableEntity entity, SerializableProperty property, string[] value, string displayName, string toolTip)
|
||||
public GUIComponent CreateStringArrayField(ISerializableEntity entity, SerializableProperty property, string[] value, LocalizedString displayName, LocalizedString toolTip)
|
||||
{
|
||||
int elementCount = (value.Length + 1);
|
||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, elementCount * elementHeight), layoutGroup.RectTransform, isFixedSize: true), color: Color.Transparent);
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f / elementCount), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f / elementCount), frame.RectTransform), displayName, font: GUIStyle.SmallFont)
|
||||
{
|
||||
ToolTip = toolTip
|
||||
};
|
||||
@@ -1225,8 +1224,8 @@ namespace Barotrauma
|
||||
var elementLayoutGroup = new GUILayoutGroup(new RectTransform(Vector2.One, element.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft);
|
||||
// Set the label to be (i + 1) so it's easier to understand for non-programmers
|
||||
string componentLabel = (i + 1).ToString();
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), elementLayoutGroup.RectTransform) { MaxSize = new Point(25, elementLayoutGroup.Rect.Height) }, componentLabel, font: GUI.SmallFont, textAlignment: Alignment.Center);
|
||||
GUITextBox textBox = new GUITextBox(new RectTransform(new Vector2(0.7f, 1), elementLayoutGroup.RectTransform), text: value[i]) { Font = GUI.SmallFont };
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), elementLayoutGroup.RectTransform) { MaxSize = new Point(25, elementLayoutGroup.Rect.Height) }, componentLabel, font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
||||
GUITextBox textBox = new GUITextBox(new RectTransform(new Vector2(0.7f, 1), elementLayoutGroup.RectTransform), text: value[i]) { Font = GUIStyle.SmallFont };
|
||||
int comp = i;
|
||||
textBox.OnEnterPressed += (textBox, text) => OnApply(textBox);
|
||||
textBox.OnDeselected += (textBox, keys) => OnApply(textBox);
|
||||
@@ -1243,13 +1242,13 @@ namespace Barotrauma
|
||||
if (SetPropertyValue(property, entity, newValue))
|
||||
{
|
||||
TrySendNetworkUpdate(entity, property);
|
||||
textBox.Flash(color: GUI.Style.Green, flashDuration: 1f);
|
||||
textBox.Flash(color: GUIStyle.Green, flashDuration: 1f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
textBox.Text = newValue[comp];
|
||||
textBox.Flash(color: GUI.Style.Red, flashDuration: 1f);
|
||||
textBox.Flash(color: GUIStyle.Red, flashDuration: 1f);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1268,13 +1267,13 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
frame.RectTransform.MinSize = new Point(0, frame.RectTransform.Children.Sum(c => c.MinSize.Y));
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
|
||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name.ToIdentifier(), fields); }
|
||||
return frame;
|
||||
}
|
||||
|
||||
public void CreateTextPicker(string textTag, ISerializableEntity entity, SerializableProperty property, GUITextBox textBox)
|
||||
{
|
||||
var msgBox = new GUIMessageBox("", "", new string[] { TextManager.Get("Cancel") }, new Vector2(0.2f, 0.5f), new Point(300, 400));
|
||||
var msgBox = new GUIMessageBox("", "", new LocalizedString[] { TextManager.Get("Cancel") }, new Vector2(0.2f, 0.5f), new Point(300, 400));
|
||||
msgBox.Buttons[0].OnClicked = msgBox.Close;
|
||||
|
||||
var textList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.8f), msgBox.Content.RectTransform, Anchor.TopCenter))
|
||||
@@ -1293,16 +1292,15 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
|
||||
textTag = textTag.ToLowerInvariant();
|
||||
var tagTextPairs = TextManager.GetAllTagTextPairs();
|
||||
var tagTextPairs = TextManager.GetAllTagTextPairs().ToList();
|
||||
tagTextPairs.Sort((t1, t2) => { return t1.Value.CompareTo(t2.Value); });
|
||||
foreach (KeyValuePair<string, string> tagTextPair in tagTextPairs)
|
||||
foreach (KeyValuePair<Identifier, string> tagTextPair in tagTextPairs)
|
||||
{
|
||||
if (!tagTextPair.Key.StartsWith(textTag)) { continue; }
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), textList.Content.RectTransform) { MinSize = new Point(0, 20) },
|
||||
ToolBox.LimitString(tagTextPair.Value, GUI.Font, textList.Content.Rect.Width))
|
||||
ToolBox.LimitString(tagTextPair.Value, GUIStyle.Font, textList.Content.Rect.Width))
|
||||
{
|
||||
UserData = tagTextPair.Key
|
||||
UserData = tagTextPair.Key.ToString()
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1352,7 +1350,7 @@ namespace Barotrauma
|
||||
}
|
||||
});
|
||||
|
||||
PropertyCommand cmd = new PropertyCommand(entities, property.Name, value, oldValues);
|
||||
PropertyCommand cmd = new PropertyCommand(entities, property.Name.ToIdentifier(), value, oldValues);
|
||||
if (CommandBuffer != null)
|
||||
{
|
||||
if (CommandBuffer.Item1 == property && CommandBuffer.Item2.PropertyCount == cmd.PropertyCount)
|
||||
@@ -1416,8 +1414,7 @@ namespace Barotrauma
|
||||
else if (entity is ISerializableEntity { SerializableProperties: { } } sEntity)
|
||||
{
|
||||
var props = sEntity.SerializableProperties;
|
||||
|
||||
if (props.TryGetValue(property.NameToLowerInvariant, out SerializableProperty foundProp))
|
||||
if (props.TryGetValue(property.Name.ToIdentifier(), out SerializableProperty foundProp) && foundProp.Attributes.OfType<Editable>().Any())
|
||||
{
|
||||
SafeAdd(sEntity, foundProp);
|
||||
foundProp.PropertyInfo.SetValue(entity, value);
|
||||
|
||||
Reference in New Issue
Block a user