49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
using SepCore.InputModule;
|
|
|
|
namespace SepCore.UI
|
|
{
|
|
public static class InputPromptTextUtility
|
|
{
|
|
public static string BuildTmpText(InputPrompt prompt)
|
|
{
|
|
string spriteText = BuildSpriteTags(prompt.SpriteName);
|
|
if (string.IsNullOrEmpty(spriteText))
|
|
{
|
|
return prompt.TextLabel;
|
|
}
|
|
|
|
return string.IsNullOrEmpty(prompt.TextLabel)
|
|
? spriteText
|
|
: $"{spriteText} {prompt.TextLabel}";
|
|
}
|
|
|
|
public static string BuildSpriteTags(string spriteNames)
|
|
{
|
|
if (string.IsNullOrEmpty(spriteNames))
|
|
{
|
|
return string.Empty;
|
|
}
|
|
|
|
string[] names = spriteNames.Split('|');
|
|
string result = string.Empty;
|
|
for (int i = 0; i < names.Length; i++)
|
|
{
|
|
string name = names[i].Trim();
|
|
if (string.IsNullOrEmpty(name))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(result))
|
|
{
|
|
result += " ";
|
|
}
|
|
|
|
result += $"<sprite name=\"{name}\">";
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|