重构
- 统一 ItemDescForm/RewardItem/GoodsItem 的描述格式 - 减少组件属性的 Clone 数量,目前只在合并仓库、组装防御塔时才进行复制 - 删除先前留下的冗余 fallback 代码
This commit is contained in:
@@ -284,21 +284,11 @@ namespace GeometryTD.UI
|
||||
Title = string.IsNullOrWhiteSpace(title) ? $"Item {itemId}" : title,
|
||||
TypeText = typeText ?? string.Empty,
|
||||
Description = description ?? string.Empty,
|
||||
Tags = CloneTags(tags),
|
||||
TagRuntimes = CloneTagRuntimes(tagRuntimes)
|
||||
Tags = tags,
|
||||
TagRuntimes = tagRuntimes
|
||||
};
|
||||
}
|
||||
|
||||
private static TagType[] CloneTags(TagType[] tags)
|
||||
{
|
||||
return tags != null ? (TagType[])tags.Clone() : System.Array.Empty<TagType>();
|
||||
}
|
||||
|
||||
private static TagRuntimeData[] CloneTagRuntimes(TagRuntimeData[] tagRuntimes)
|
||||
{
|
||||
return InventoryCloneUtility.CloneTagRuntimes(tagRuntimes);
|
||||
}
|
||||
|
||||
private static string BuildComponentTypeText(TowerCompSlotType slotType)
|
||||
{
|
||||
return slotType switch
|
||||
@@ -391,8 +381,8 @@ namespace GeometryTD.UI
|
||||
Description = seed.Description ?? string.Empty,
|
||||
Price = 0,
|
||||
ScreenPosition = args.ScreenPosition,
|
||||
Tags = CloneTags(seed.Tags),
|
||||
TagRuntimes = CloneTagRuntimes(seed.TagRuntimes)
|
||||
Tags = seed.Tags,
|
||||
TagRuntimes = seed.TagRuntimes
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user