From 68d6cb18efcc0c1582ae0c2b3400a4af217522f8 Mon Sep 17 00:00:00 2001 From: Ayu0K Date: Sun, 5 Jan 2025 10:52:34 +0800 Subject: [PATCH] =?UTF-8?q?mod:=20=E6=9B=BF=E6=8D=A2=E4=B8=BA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=89=A9=E5=B1=95=E6=96=B9=E6=B3=95=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E8=B0=83=E7=94=A8SimulateKeyHelper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Core/Simulator/Extensions/InputSimulatorExtension.cs | 2 +- .../Simulator/Extensions/PostMessageSimulatorExtension.cs | 4 ++-- BetterGenshinImpact/GameTask/AutoFight/Model/Avatar.cs | 8 ++++---- .../GameTask/AutoPathing/Handler/PickAroundHandler.cs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/BetterGenshinImpact/Core/Simulator/Extensions/InputSimulatorExtension.cs b/BetterGenshinImpact/Core/Simulator/Extensions/InputSimulatorExtension.cs index 59199161..fb18baf0 100644 --- a/BetterGenshinImpact/Core/Simulator/Extensions/InputSimulatorExtension.cs +++ b/BetterGenshinImpact/Core/Simulator/Extensions/InputSimulatorExtension.cs @@ -21,7 +21,7 @@ public static class InputSimulatorExtension /// 按键类型 public static void SimulateAction(this InputSimulator self, GIActions action, KeyType type = KeyType.KeyPress) { - var key = SimulateKeyHelper.GetActionKey(action); + var key = action.ToActionKey(); switch (type) { case KeyType.KeyPress: diff --git a/BetterGenshinImpact/Core/Simulator/Extensions/PostMessageSimulatorExtension.cs b/BetterGenshinImpact/Core/Simulator/Extensions/PostMessageSimulatorExtension.cs index 4baf8dda..daa7faa9 100644 --- a/BetterGenshinImpact/Core/Simulator/Extensions/PostMessageSimulatorExtension.cs +++ b/BetterGenshinImpact/Core/Simulator/Extensions/PostMessageSimulatorExtension.cs @@ -20,7 +20,7 @@ public static class PostMessageSimulatorExtension /// 按键类型 public static PostMessageSimulator SimulateAction(this PostMessageSimulator self, GIActions action, KeyType type = KeyType.KeyPress) { - var key = SimulateKeyHelper.GetActionKey(action); + var key = action.ToActionKey(); switch (type) { case KeyType.KeyPress: @@ -122,7 +122,7 @@ public static class PostMessageSimulatorExtension /// 按键类型 public static PostMessageSimulator SimulateActionBackground(this PostMessageSimulator self, GIActions action, KeyType type = KeyType.KeyPress) { - var key = SimulateKeyHelper.GetActionKey(action); + var key = action.ToActionKey(); switch (type) { case KeyType.KeyPress: diff --git a/BetterGenshinImpact/GameTask/AutoFight/Model/Avatar.cs b/BetterGenshinImpact/GameTask/AutoFight/Model/Avatar.cs index 95410b4a..c0fc7260 100644 --- a/BetterGenshinImpact/GameTask/AutoFight/Model/Avatar.cs +++ b/BetterGenshinImpact/GameTask/AutoFight/Model/Avatar.cs @@ -524,19 +524,19 @@ public class Avatar User32.VK vk = User32.VK.VK_NONAME; if (key == "w") { - vk = SimulateKeyHelper.GetActionKey(GIActions.MoveForward).ToVK(); + vk = GIActions.MoveForward.ToActionKey().ToVK(); } else if (key == "s") { - vk = SimulateKeyHelper.GetActionKey(GIActions.MoveBackward).ToVK(); + vk = GIActions.MoveBackward.ToActionKey().ToVK(); } else if (key == "a") { - vk = SimulateKeyHelper.GetActionKey(GIActions.MoveLeft).ToVK(); + vk = GIActions.MoveLeft.ToActionKey().ToVK(); } else if (key == "d") { - vk = SimulateKeyHelper.GetActionKey(GIActions.MoveRight).ToVK(); + vk = GIActions.MoveRight.ToActionKey().ToVK(); } if (vk == User32.VK.VK_NONAME) diff --git a/BetterGenshinImpact/GameTask/AutoPathing/Handler/PickAroundHandler.cs b/BetterGenshinImpact/GameTask/AutoPathing/Handler/PickAroundHandler.cs index 0c67820c..fb23a90e 100644 --- a/BetterGenshinImpact/GameTask/AutoPathing/Handler/PickAroundHandler.cs +++ b/BetterGenshinImpact/GameTask/AutoPathing/Handler/PickAroundHandler.cs @@ -81,8 +81,8 @@ public class PickAroundHandler() : IActionHandler double y = oldRadius * Math.Sin(angle); Simulation.SendInput.Mouse.MiddleButtonClick(); await Delay(500, _ct); - await MoveAfterTurn(SimulateKeyHelper.GetActionKey(GIActions.MoveBackward).ToVK(), (int)Math.Round(y) + 200); - await MoveAfterTurn(SimulateKeyHelper.GetActionKey(GIActions.MoveLeft).ToVK(), (int)Math.Round(x)); + await MoveAfterTurn(GIActions.MoveBackward.ToActionKey().ToVK(), (int)Math.Round(y) + 200); + await MoveAfterTurn(GIActions.MoveLeft.ToActionKey().ToVK(), (int)Math.Round(x)); } }