S4-07 process 1
This commit is contained in:
@@ -32,20 +32,39 @@ namespace GeometryTD.UI
|
||||
{
|
||||
Title = rawData.Title,
|
||||
TypeText = rawData.TypeText,
|
||||
Description = rawData.Description,
|
||||
Description = BuildDescription(rawData),
|
||||
Price = rawData.Price,
|
||||
TargetPos = rawData.TargetPos,
|
||||
Tags = BuildTags(rawData)
|
||||
};
|
||||
}
|
||||
|
||||
private static string BuildDescription(ItemDescFormRawData rawData)
|
||||
{
|
||||
string baseDescription = rawData?.Description ?? string.Empty;
|
||||
string tagDescription = rawData?.TagRuntimes != null && rawData.TagRuntimes.Length > 0
|
||||
? TagDisplayUtility.BuildTagDescriptionText(rawData.TagRuntimes)
|
||||
: TagDisplayUtility.BuildTagDescriptionText(rawData?.Tags);
|
||||
if (string.IsNullOrWhiteSpace(tagDescription))
|
||||
{
|
||||
return baseDescription;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(baseDescription))
|
||||
{
|
||||
return tagDescription;
|
||||
}
|
||||
|
||||
return $"{baseDescription}\n{tagDescription}";
|
||||
}
|
||||
|
||||
private static TagItemContext[] BuildTags(ItemDescFormRawData rawData)
|
||||
{
|
||||
string[] tagTexts = rawData?.TagTexts;
|
||||
if ((tagTexts == null || tagTexts.Length <= 0) && rawData?.Tags != null)
|
||||
{
|
||||
tagTexts = TagDisplayUtility.BuildTagTexts(rawData.Tags);
|
||||
}
|
||||
string[] tagTexts = rawData?.TagRuntimes != null && rawData.TagRuntimes.Length > 0
|
||||
? TagDisplayUtility.BuildTagTexts(rawData.TagRuntimes)
|
||||
: rawData?.Tags != null
|
||||
? TagDisplayUtility.BuildTagTexts(rawData.Tags)
|
||||
: null;
|
||||
|
||||
if (tagTexts == null || tagTexts.Length <= 0)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,6 @@ namespace GeometryTD.UI
|
||||
public int Price;
|
||||
public Vector3 TargetPos;
|
||||
public TagType[] Tags;
|
||||
public string[] TagTexts;
|
||||
public TagRuntimeData[] TagRuntimes;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user