mod: 替换为使用扩展方法,不直接调用SimulateKeyHelper

This commit is contained in:
Ayu0K 2025-01-05 10:52:34 +08:00
parent 6d430429f7
commit 68d6cb18ef
4 changed files with 9 additions and 9 deletions

View File

@ -21,7 +21,7 @@ public static class InputSimulatorExtension
/// <param name="type">按键类型</param>
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:

View File

@ -20,7 +20,7 @@ public static class PostMessageSimulatorExtension
/// <param name="type">按键类型</param>
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
/// <param name="type">按键类型</param>
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:

View File

@ -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)

View File

@ -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));
}
}