接入 Hud 输入提示并完善 InputModule 提示映射
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 314a19cffa89e7a448d576d26d8787bf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"reference": "GUID:73a59a40d41e9ce48b3e0515aeec4217"
|
||||
}
|
||||
"reference": "GUID:0e1d182005e0ae647ab3fa40f5492dbb"
|
||||
}
|
||||
Reference in New Issue
Block a user