S4-07 process 1
This commit is contained in:
@@ -92,5 +92,84 @@ namespace GeometryTD.CustomUtility
|
||||
|
||||
return BuildTagTexts(towerStats.Tags);
|
||||
}
|
||||
|
||||
public static string BuildTagDescriptionText(IReadOnlyList<TagType> tags)
|
||||
{
|
||||
if (tags == null || tags.Count <= 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
List<string> results = new List<string>(tags.Count);
|
||||
for (int i = 0; i < tags.Count; i++)
|
||||
{
|
||||
TagType tagType = tags[i];
|
||||
if (tagType == TagType.None)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string tagName = ResolveTagName(tagType);
|
||||
string tagDescription = ResolveTagDescription(tagType);
|
||||
if (string.IsNullOrWhiteSpace(tagDescription))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
results.Add(string.IsNullOrWhiteSpace(tagName) ? tagDescription : $"{tagName}: {tagDescription}");
|
||||
}
|
||||
|
||||
return string.Join("\n", results);
|
||||
}
|
||||
|
||||
public static string BuildTagDescriptionText(IReadOnlyList<TagRuntimeData> tagRuntimes)
|
||||
{
|
||||
if (tagRuntimes == null || tagRuntimes.Count <= 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
List<string> results = new List<string>(tagRuntimes.Count);
|
||||
for (int i = 0; i < tagRuntimes.Count; i++)
|
||||
{
|
||||
TagRuntimeData runtime = tagRuntimes[i];
|
||||
if (runtime == null || runtime.TagType == TagType.None || runtime.TotalStack <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string tagName = ResolveTagName(runtime.TagType);
|
||||
if (runtime.TotalStack > 1 && !string.IsNullOrWhiteSpace(tagName))
|
||||
{
|
||||
tagName = $"{tagName} x{runtime.TotalStack}";
|
||||
}
|
||||
|
||||
string tagDescription = ResolveTagDescription(runtime.TagType);
|
||||
if (string.IsNullOrWhiteSpace(tagDescription))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
results.Add(string.IsNullOrWhiteSpace(tagName) ? tagDescription : $"{tagName}: {tagDescription}");
|
||||
}
|
||||
|
||||
return string.Join("\n", results);
|
||||
}
|
||||
|
||||
public static string ResolveTagDescription(TagType tagType)
|
||||
{
|
||||
if (tagType == TagType.None)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
if (TagConfigRegistry.TryGetDefinition(tagType, out TagDefinitionData definition) &&
|
||||
!string.IsNullOrWhiteSpace(definition.Description))
|
||||
{
|
||||
return definition.Description;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user