PropertyConditional fixes:
- Fixed Equals/NotEquals not working at all because they checked for float values when the property is not a float and vice versa. - Bool comparisons work now. - Removed unnecessary property.GetValue calls, no need to get the value twice in the same method.
This commit is contained in:
@@ -206,22 +206,30 @@ namespace Barotrauma
|
|||||||
switch (Operator)
|
switch (Operator)
|
||||||
{
|
{
|
||||||
case OperatorType.Equals:
|
case OperatorType.Equals:
|
||||||
if (floatValue == null)
|
if (type == typeof(bool))
|
||||||
{
|
{
|
||||||
return property.GetValue().Equals(floatValue);
|
return ((bool)propertyValue) == (Value.ToLowerInvariant() == "true");
|
||||||
|
}
|
||||||
|
else if (floatValue == null)
|
||||||
|
{
|
||||||
|
return propertyValue.ToString().Equals(Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return property.GetValue().Equals(Value);
|
return propertyValue.Equals(floatValue);
|
||||||
}
|
}
|
||||||
case OperatorType.NotEquals:
|
case OperatorType.NotEquals:
|
||||||
if (floatValue == null)
|
if (type == typeof(bool))
|
||||||
{
|
{
|
||||||
return !property.GetValue().Equals(floatValue);
|
return ((bool)propertyValue) != (Value.ToLowerInvariant() == "true");
|
||||||
|
}
|
||||||
|
else if (floatValue == null)
|
||||||
|
{
|
||||||
|
return !propertyValue.ToString().Equals(Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return !property.GetValue().Equals(Value);
|
return !propertyValue.Equals(floatValue);
|
||||||
}
|
}
|
||||||
case OperatorType.GreaterThan:
|
case OperatorType.GreaterThan:
|
||||||
if (floatValue == null)
|
if (floatValue == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user