Build 0.20.10.0

This commit is contained in:
Markus Isberg
2022-12-05 19:48:59 +02:00
parent 31d2dc658e
commit 9d2f160314
55 changed files with 335 additions and 3511 deletions
@@ -512,5 +512,34 @@ namespace Barotrauma
return new Vector2(paddingX, paddingY);
}
public static string ColorSectionOfString(string text, int start, int length, Color color)
{
int end = start + length;
if (start < 0 || length < 0 || end > text.Length)
{
throw new ArgumentOutOfRangeException($"Invalid start ({start}) or length ({length}) for text \"{text}\".");
}
string stichedString = string.Empty;
if (start > 0)
{
stichedString += text[..start];
}
// this is the highlighted part
stichedString += ColorString(text[start..end], color);
if (end < text.Length)
{
stichedString += text[end..];
}
return stichedString;
static string ColorString(string text, Color color) => $"‖color:{color.ToStringHex()}‖{text}‖end‖";
}
}
}