Refactor UI components in ClassConfigEditorControl and ClassMacrosEditorControl

- Updated button labels for saving configurations to be more concise.
- Adjusted layout of panels to improve UI structure and readability.
- Introduced new methods for creating DataGridView columns to reduce redundancy.
- Enhanced handling of dynamic and static macro entries, including improved row numbering and offset hints.
- Removed unnecessary UI elements and streamlined event handling for better performance.
- Improved localization support by ensuring state names are correctly categorized and hidden where necessary.
This commit is contained in:
waynebian01
2026-07-28 23:24:00 +08:00
parent 3c206fc86b
commit 09ee3daa54
10 changed files with 642 additions and 336 deletions

View File

@@ -11,6 +11,15 @@ namespace Shigure;
internal static class ClassBlocksStore
{
public const string AssignmentName = "Fuyutsui.ClassBlocks";
private static readonly string[] StateCategories =
[
ClassStateCatalog.CategoryState,
ClassStateCatalog.CategoryResource,
ClassStateCatalog.CategoryItem,
ClassStateCatalog.CategoryConfig,
ClassStateCatalog.CategoryTarget,
ClassStateCatalog.CategoryFocus
];
public sealed class ClassFileDocument
{
@@ -28,9 +37,12 @@ internal static class ClassBlocksStore
public List<string> FlatStates { get; } = new();
public Dictionary<string, List<string>> CategorizedStates { get; } = new(StringComparer.Ordinal)
{
["状态"] = new List<string>(),
["目标"] = new List<string>(),
["焦点"] = new List<string>()
[ClassStateCatalog.CategoryState] = new List<string>(),
[ClassStateCatalog.CategoryResource] = new List<string>(),
[ClassStateCatalog.CategoryItem] = new List<string>(),
[ClassStateCatalog.CategoryConfig] = new List<string>(),
[ClassStateCatalog.CategoryTarget] = new List<string>(),
[ClassStateCatalog.CategoryFocus] = new List<string>()
};
public List<AuraEntry> PlayerAuras { get; } = new();
@@ -149,13 +161,11 @@ internal static class ClassBlocksStore
if (spec.GetTable("states") is { } states)
{
var nested = states.GetTable("状态") is not null
|| states.GetTable("目标") is not null
|| states.GetTable("焦点") is not null;
var nested = StateCategories.Any(category => states.GetTable(category) is not null);
result.NestedStates = nested;
if (nested)
{
foreach (var category in new[] { "状态", "目标", "焦点" })
foreach (var category in StateCategories)
{
if (states.GetTable(category) is not { } list)
{
@@ -350,7 +360,7 @@ internal static class ClassBlocksStore
sb.Append(indent).AppendLine("states = {");
if (spec.NestedStates)
{
foreach (var category in new[] { "状态", "目标", "焦点" })
foreach (var category in StateCategories)
{
var list = spec.CategorizedStates.GetValueOrDefault(category);
if (list is null || list.Count == 0)