- Input field for rects.

- Input fields for ItemComponent requiredItems.
- Added tooltips to a bunch of editable ItemComponent properties.
- Misc fixes.
This commit is contained in:
Joonas Rikkonen
2017-11-13 20:55:07 +02:00
parent f7298c241e
commit b3769b383a
17 changed files with 176 additions and 230 deletions
@@ -15,8 +15,8 @@ namespace Barotrauma
{
public int MaxLength;
public int? MinValueInt, MaxValueInt;
public float? MinValueFloat, MaxValueFloat;
public int MinValueInt = int.MinValue, MaxValueInt = int.MaxValue;
public float MinValueFloat = float.MinValue, MaxValueFloat = float.MaxValue;
public string ToolTip;
@@ -25,13 +25,13 @@ namespace Barotrauma
MaxLength = maxLength;
}
public Editable(int? minValue, int? maxValue)
public Editable(int minValue, int maxValue)
{
MinValueInt = minValue;
MaxValueInt = maxValue;
}
public Editable(float? minValue, float? maxValue)
public Editable(float minValue, float maxValue)
{
MinValueFloat = minValue;
MaxValueFloat = maxValue;
@@ -338,26 +338,22 @@ namespace Barotrauma
return new Color(components[0], components[1], components[2], components[3]);
}
public static Color ParseRect(string stringColor, bool errorMessages = true)
public static Rectangle ParseRect(string stringColor, bool errorMessages = true)
{
string[] strComponents = stringColor.Split(',');
Color color = Color.White;
if (strComponents.Length < 3)
{
if (errorMessages) DebugConsole.ThrowError("Failed to parse the string \"" + stringColor + "\" to Color");
return Color.White;
return new Rectangle(0, 0, 0, 0);
}
float[] components = new float[4] { 1.0f, 1.0f, 1.0f, 1.0f };
int[] components = new int[4] { 0, 0, 0, 0 };
for (int i = 0; i < 4 && i < strComponents.Length; i++)
{
float.TryParse(strComponents[i], NumberStyles.Float, CultureInfo.InvariantCulture, out components[i]);
int.TryParse(strComponents[i], out components[i]);
}
return new Color(components[0], components[1], components[2], components[3]);
return new Rectangle(components[0], components[1], components[2], components[3]);
}
public static float[] ParseFloatArray(string[] stringArray)