mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-03-19 08:19:48 +08:00
NumEnter key support was added to the Fischless.WindowsInput
This commit is contained in:
@@ -30,8 +30,6 @@ public class AutoWoodTask
|
||||
|
||||
private VK _zKey = VK.VK_Z;
|
||||
|
||||
private bool? _zIsExt = null;
|
||||
|
||||
public AutoWoodTask()
|
||||
{
|
||||
var captureArea = TaskContext.Instance().SystemInfo.CaptureAreaRect;
|
||||
@@ -59,7 +57,6 @@ public class AutoWoodTask
|
||||
if (key != ElementIdentifierId.Z)
|
||||
{
|
||||
_zKey = key.ToVK();
|
||||
_zIsExt = key.ToIsExt();
|
||||
Logger.LogInformation($"自动伐木检测到用户改键 {ElementIdentifierId.Z.ToName()} 改为 {key.ToName()}");
|
||||
if (key == ElementIdentifierId.LeftShift || key == ElementIdentifierId.RightShift)
|
||||
{
|
||||
@@ -127,14 +124,14 @@ public class AutoWoodTask
|
||||
throw new NormalEndException("请先装备小道具「王树瑞佑」!");
|
||||
#else
|
||||
Thread.Sleep(2000);
|
||||
Simulation.SendInputEx.Keyboard.KeyPress(_zIsExt, _zKey);
|
||||
Simulation.SendInputEx.Keyboard.KeyPress(_zKey);
|
||||
Debug.WriteLine("[AutoWood] Z");
|
||||
_first = false;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
Simulation.SendInputEx.Keyboard.KeyPress(_zIsExt, _zKey);
|
||||
Simulation.SendInputEx.Keyboard.KeyPress(_zKey);
|
||||
Debug.WriteLine("[AutoWood] Z");
|
||||
_first = false;
|
||||
}
|
||||
@@ -155,7 +152,7 @@ public class AutoWoodTask
|
||||
#endif
|
||||
}
|
||||
|
||||
Simulation.SendInputEx.Keyboard.KeyPress(_zIsExt, _zKey);
|
||||
Simulation.SendInputEx.Keyboard.KeyPress(_zKey);
|
||||
Debug.WriteLine("[AutoWood] Z");
|
||||
Sleep(500, taskParam.Cts);
|
||||
}, TimeSpan.FromSeconds(1), 120);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Fischless.WindowsInput;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
@@ -405,7 +406,7 @@ public static class ElementIdentifierIdConverter
|
||||
ElementIdentifierId.NumpadAsterisk => VK.VK_MULTIPLY,
|
||||
ElementIdentifierId.NumpadMinus => VK.VK_SUBTRACT,
|
||||
ElementIdentifierId.NumpadPlus => VK.VK_ADD,
|
||||
ElementIdentifierId.NumpadEnter => VK.VK_RETURN,
|
||||
ElementIdentifierId.NumpadEnter => (VK)VK2.VK_NUMPAD_ENTER,
|
||||
ElementIdentifierId.ArrowUp => VK.VK_UP,
|
||||
ElementIdentifierId.ArrowDown => VK.VK_DOWN,
|
||||
ElementIdentifierId.ArrowRight => VK.VK_RIGHT,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using Vanara.PInvoke;
|
||||
using static Vanara.PInvoke.User32;
|
||||
|
||||
namespace Fischless.WindowsInput;
|
||||
|
||||
@@ -55,7 +56,7 @@ internal class InputBuilder : IEnumerable<User32.INPUT>, IEnumerable
|
||||
{
|
||||
bool isUseExtendedKey = isExtendedKey == null ? IsExtendedKey(keyCode) : isExtendedKey.Value;
|
||||
|
||||
if ((VK2)keyCode == VK2.NumEnter)
|
||||
if ((VK2)keyCode == VK2.VK_NUMPAD_ENTER)
|
||||
{
|
||||
keyCode = User32.VK.VK_RETURN;
|
||||
isUseExtendedKey = true;
|
||||
@@ -82,7 +83,7 @@ internal class InputBuilder : IEnumerable<User32.INPUT>, IEnumerable
|
||||
{
|
||||
bool isUseExtendedKey = isExtendedKey == null ? IsExtendedKey(keyCode) : isExtendedKey.Value;
|
||||
|
||||
if ((VK2)keyCode == VK2.NumEnter)
|
||||
if ((VK2)keyCode == VK2.VK_NUMPAD_ENTER)
|
||||
{
|
||||
keyCode = User32.VK.VK_RETURN;
|
||||
isUseExtendedKey = true;
|
||||
@@ -364,8 +365,13 @@ internal class InputBuilder : IEnumerable<User32.INPUT>, IEnumerable
|
||||
/// </summary>
|
||||
public enum VK2
|
||||
{
|
||||
/// <summary>
|
||||
/// ENTER key
|
||||
/// </summary>
|
||||
VK_ENTER = VK.VK_RETURN,
|
||||
|
||||
/// <summary>
|
||||
/// The Unassigned code: The Num ENTER key.
|
||||
/// </summary>
|
||||
NumEnter = 0x0E,
|
||||
VK_NUMPAD_ENTER = 0x0E,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user