mirror of
https://github.com/waynebian01/Shigure.git
synced 2026-09-03 07:15:24 +08:00
整合文件夹
This commit is contained in:
44
UI/ModuleDisplay.cs
Normal file
44
UI/ModuleDisplay.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
namespace Shigure;
|
||||
|
||||
internal static class ModuleDisplay
|
||||
{
|
||||
public static string FormatListItem(ModuleDefinition module)
|
||||
{
|
||||
return $"{module.Name} [{FormatMatch(module.Match)}]";
|
||||
}
|
||||
|
||||
public static string FormatMatch(ModuleMatch match)
|
||||
{
|
||||
return $"{FormatMatchValue(match.ClassId)}/{FormatMatchValue(match.SpecId)}/{FormatPartyTypeValue(match.PartyType)}/{FormatMatchValue(match.HeroTalent)}";
|
||||
}
|
||||
|
||||
public static string FormatState(RenderSnapshot snapshot)
|
||||
{
|
||||
var classText = snapshot.ClassName is null
|
||||
? FormatMatchValue(snapshot.ClassId)
|
||||
: $"{snapshot.ClassName} ({snapshot.ClassId})";
|
||||
var specText = snapshot.SpecName is null
|
||||
? FormatMatchValue(snapshot.SpecId)
|
||||
: $"{snapshot.SpecName} ({snapshot.SpecId})";
|
||||
var partyType = snapshot.State?.GetInt("队伍类型");
|
||||
var heroTalent = snapshot.State?.GetInt("英雄天赋");
|
||||
return $"{classText} / {specText} / {FormatPartyTypeValue(partyType?.ToString())} / {FormatMatchValue(heroTalent)}";
|
||||
}
|
||||
|
||||
private static string FormatMatchValue(int? value)
|
||||
{
|
||||
return value?.ToString() ?? "*";
|
||||
}
|
||||
|
||||
private static string FormatPartyTypeValue(string? value)
|
||||
{
|
||||
return ModuleMatch.NormalizePartyTypeValue(value) switch
|
||||
{
|
||||
null => "*",
|
||||
"0" => "单人",
|
||||
"1-40" => "团队",
|
||||
"46" => "队伍",
|
||||
var other => other
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user