57 lines
1.7 KiB
C#
57 lines
1.7 KiB
C#
using System;
|
|
using GeometryTD.CustomUtility;
|
|
using GeometryTD.Definition;
|
|
|
|
namespace GeometryTD.UI
|
|
{
|
|
public static class RewardSelectItemRawDataBuilder
|
|
{
|
|
public static RewardSelectItemRawData Build(TowerCompItemData item)
|
|
{
|
|
return new RewardSelectItemRawData
|
|
{
|
|
SlotType = item.SlotType,
|
|
Title = item.Name,
|
|
TypeText = BuildTypeText(item.SlotType),
|
|
Description = BuildDescription(item),
|
|
Rarity = item.Rarity,
|
|
Tags = item.Tags != null ? (TagType[])item.Tags.Clone() : Array.Empty<TagType>(),
|
|
Icon = null,
|
|
SourceItem = item
|
|
};
|
|
}
|
|
|
|
private static string BuildTypeText(TowerCompSlotType slotType)
|
|
{
|
|
return slotType switch
|
|
{
|
|
TowerCompSlotType.Muzzle => "Muzzle Component",
|
|
TowerCompSlotType.Bearing => "Bearing Component",
|
|
TowerCompSlotType.Base => "Base Component",
|
|
TowerCompSlotType.Accessory => "Accessory",
|
|
_ => "Component"
|
|
};
|
|
}
|
|
|
|
private static string BuildDescription(TowerCompItemData item)
|
|
{
|
|
if (item is MuzzleCompItemData muzzle)
|
|
{
|
|
return ItemDescUtility.BuildMuzzleDesc(muzzle);
|
|
}
|
|
|
|
if (item is BearingCompItemData bearing)
|
|
{
|
|
return ItemDescUtility.BuildBearingDesc(bearing);
|
|
}
|
|
|
|
if (item is BaseCompItemData baseComp)
|
|
{
|
|
return ItemDescUtility.BuildBaseDesc(baseComp);
|
|
}
|
|
|
|
return string.Empty;
|
|
}
|
|
}
|
|
}
|