- 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
@@ -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)