mod: 使用新方案替代直接从KeyBindings中读取按键

This commit is contained in:
Ayu0K 2025-01-05 03:13:52 +08:00
parent c904ae5150
commit 15f363196c
2 changed files with 5 additions and 3 deletions

View File

@ -7,6 +7,7 @@ using BetterGenshinImpact.GameTask.AutoPathing.Model;
using Vanara.PInvoke;
using static BetterGenshinImpact.GameTask.Common.TaskControl;
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.Core.Simulator.Extensions;
namespace BetterGenshinImpact.GameTask.AutoPathing.Handler;
@ -19,7 +20,7 @@ public class ElementalSkillHandler : IActionHandler
public async Task RunAsync(CancellationToken ct, WaypointForTrack? waypointForTrack = null, object? config = null)
{
Logger.LogInformation("执行 {Text}", "释放元素战技");
Simulation.SendInput.Keyboard.KeyPress(TaskContext.Instance().Config.KeyBindingsConfig.ElementalSkill.ToVK()) ;
Simulation.SendInput.SimulateAction(GIActions.ElementalSkill);
await Delay(1000, ct);
}
}

View File

@ -3,6 +3,7 @@ using System.Threading;
using System.Threading.Tasks;
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.Core.Simulator;
using BetterGenshinImpact.Core.Simulator.Extensions;
using BetterGenshinImpact.GameTask.AutoPathing.Model;
using BetterGenshinImpact.Helpers;
using Microsoft.Extensions.Logging;
@ -55,7 +56,7 @@ public class NahidaCollectHandler : IActionHandler
await Delay(200, ct);
// 按住E技能 无死角扫码
Simulation.SendInput.Keyboard.KeyDown(TaskContext.Instance().Config.KeyBindingsConfig.ElementalSkill.ToVK());
Simulation.SendInput.SimulateAction(GIActions.ElementalSkill, KeyType.KeyDown);
await Delay(200, ct);
// 先地面来一圈
@ -77,7 +78,7 @@ public class NahidaCollectHandler : IActionHandler
Simulation.SendInput.Mouse.MoveMouseBy(x, y);
await Delay(30, ct);
}
Simulation.SendInput.Keyboard.KeyUp(TaskContext.Instance().Config.KeyBindingsConfig.ElementalSkill.ToVK());
Simulation.SendInput.SimulateAction(GIActions.ElementalSkill, KeyType.KeyUp);
lastETime = DateTime.Now;