优化 UI 效果
This commit is contained in:
@@ -28,7 +28,69 @@ namespace SepCore.CustomUtility
|
||||
"收获", // Harvesting = 15
|
||||
"幸运" // Luck = 16
|
||||
};
|
||||
|
||||
|
||||
private static readonly Dictionary<WeaponTag, string> _weaponTagNames = new()
|
||||
{
|
||||
{ WeaponTag.Blade, "刀剑" },
|
||||
{ WeaponTag.Precise, "精准" },
|
||||
{ WeaponTag.Gun, "枪械" },
|
||||
{ WeaponTag.Engineering, "工程" },
|
||||
{ WeaponTag.Blunt, "钝器" },
|
||||
{ WeaponTag.Primitive, "原始" },
|
||||
{ WeaponTag.Elemental, "元素" },
|
||||
{ WeaponTag.Unarmed, "徒手" },
|
||||
{ WeaponTag.Medical, "医疗" },
|
||||
{ WeaponTag.Heavy, "重型" },
|
||||
};
|
||||
|
||||
public static string GetWeaponTagName(WeaponTag tag)
|
||||
{
|
||||
return _weaponTagNames.TryGetValue(tag, out string name) ? name : tag.ToString();
|
||||
}
|
||||
|
||||
public static string FormatWeaponTags(IReadOnlyList<WeaponTag> tags)
|
||||
{
|
||||
if (tags == null || tags.Count == 0)
|
||||
{
|
||||
return "武器";
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < tags.Count; i++)
|
||||
{
|
||||
WeaponTag tag = tags[i];
|
||||
if (tag == WeaponTag.None)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
sb.Append(" - ");
|
||||
}
|
||||
|
||||
sb.Append(GetWeaponTagName(tag));
|
||||
}
|
||||
|
||||
return sb.Length > 0 ? sb.ToString() : "武器";
|
||||
}
|
||||
|
||||
public static string FormatWeaponTags(WeaponConfig config)
|
||||
{
|
||||
return FormatWeaponTags(config.Tags);
|
||||
}
|
||||
|
||||
public static string FormatWeaponTags(WeaponData data)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
Log.Error("Weapon data is invalid.");
|
||||
return "武器";
|
||||
}
|
||||
|
||||
return FormatWeaponTags(data.Tags);
|
||||
}
|
||||
|
||||
public static string Describe(StatModifierConfig statModifierConfig)
|
||||
{
|
||||
if (statModifierConfig == null)
|
||||
|
||||
Reference in New Issue
Block a user