mirror of
https://github.com/waynebian01/Shigure.git
synced 2026-09-03 07:15:24 +08:00
Refactor keymap service to support specialization selection, enhance pixel scanner error reporting, and improve UI for dynamic spec management
- Updated KeymapService to handle class and specialization selection, allowing for more granular hotkey management. - Added MapVirtualKeyW method to NativeMethods for virtual key mapping. - Enhanced ModuleLogic to include rate limiting and improved logging for rule execution. - Introduced new reserved units for channeling states in ReservedUnit. - Modified PixelScanner to return detailed failure reasons for window scanning issues. - Updated RenderSnapshot to include scan failure reasons for better debugging. - Enhanced ShigureRuntime to track scan failure reasons and log them appropriately. - Improved ClassMacrosEditorControl to manage dynamic specialization selection and UI updates. - Updated MainForm to log scan failure reasons and step details for better traceability. - Adjusted StatusForm layout and watermark settings for improved visual presentation. - Updated UI theme to support dynamic spec icons in list boxes. - Changed configuration files to standardize enemy count terminology from "敌人人数" to "敌人数量".
This commit is contained in:
@@ -9,6 +9,7 @@ public sealed class KeymapService
|
||||
private readonly ConfigService _config;
|
||||
private readonly Dictionary<(int Unit, string Spell), string> _hotkeys = new();
|
||||
private int? _currentClassId;
|
||||
private int? _currentSpecId;
|
||||
|
||||
public KeymapService(string baseDirectory, ConfigService config)
|
||||
{
|
||||
@@ -18,12 +19,18 @@ public sealed class KeymapService
|
||||
|
||||
public void SelectForClass(int? classId)
|
||||
{
|
||||
if (_currentClassId == classId && _hotkeys.Count > 0)
|
||||
SelectForClass(classId, null);
|
||||
}
|
||||
|
||||
public void SelectForClass(int? classId, int? specId)
|
||||
{
|
||||
if (_currentClassId == classId && _currentSpecId == specId && _hotkeys.Count > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_currentClassId = classId;
|
||||
_currentSpecId = specId;
|
||||
_hotkeys.Clear();
|
||||
|
||||
var path = KeymapCatalog.ResolveKeymapFilePath(_baseDirectory, _config.GetKeymapName(classId));
|
||||
@@ -43,7 +50,15 @@ public sealed class KeymapService
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var (_, node) in root)
|
||||
var entries = root;
|
||||
if (specId is { } id
|
||||
&& JsonHelpers.Get(root, "专精") is JsonObject specRoot
|
||||
&& JsonHelpers.Get(specRoot, id.ToString()) is JsonObject specEntries)
|
||||
{
|
||||
entries = specEntries;
|
||||
}
|
||||
|
||||
foreach (var (_, node) in entries)
|
||||
{
|
||||
if (node is not JsonObject entry)
|
||||
{
|
||||
@@ -79,4 +94,3 @@ public sealed class KeymapService
|
||||
return _config.GetOneKeySpells(_currentClassId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user