remove: package H.InputSimulator #154

This commit is contained in:
ema 2024-05-12 05:16:27 +08:00
parent c27b5176e7
commit 9378a134bd
19 changed files with 74 additions and 79 deletions

View File

@ -30,7 +30,6 @@
<ItemGroup>
<PackageReference Include="AvalonEdit" Version="6.3.0.90" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="H.InputSimulator" Version="1.4.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />

View File

@ -1,15 +1,12 @@
using System;
using WindowsInput;
using Fischless.WindowsInput;
using System;
namespace BetterGenshinImpact.Core.Simulator;
public class Simulation
{
[Obsolete]
public static InputSimulator SendInput { get; } = new();
public static Fischless.WindowsInput.InputSimulator SendInputEx { get; } = new();
public static MouseEventSimulator MouseEvent { get; } = new();
public static PostMessageSimulator PostMessage(IntPtr hWnd)

View File

@ -191,7 +191,7 @@ public class AutoDomainTask
using var fRectArea = GetRectAreaFromDispatcher().Find(AutoPickAssets.Instance.FRo);
if (!fRectArea.IsEmpty())
{
Simulation.SendInputEx.Keyboard.KeyPress(VK.VK_F);
Simulation.SendInput.Keyboard.KeyPress(VK.VK_F);
Logger.LogInformation("自动秘境:{Text}", "进入秘境");
// 秘境开门动画 5s
Sleep(5000, _taskParam.Cts);
@ -254,7 +254,7 @@ public class AutoDomainTask
// 组合键好像不能直接用 postmessage
if (!_config.WalkToF)
{
Simulation.SendInputEx.Keyboard.KeyDown(VK.VK_SHIFT);
Simulation.SendInput.Keyboard.KeyDown(VK.VK_SHIFT);
}
try
@ -269,7 +269,7 @@ public class AutoDomainTask
else
{
Logger.LogInformation("检测到交互键");
Simulation.SendInputEx.Keyboard.KeyPress(VK.VK_F);
Simulation.SendInput.Keyboard.KeyPress(VK.VK_F);
break;
}
}
@ -280,7 +280,7 @@ public class AutoDomainTask
Sleep(50);
if (!_config.WalkToF)
{
Simulation.SendInputEx.Keyboard.KeyUp(VK.VK_SHIFT);
Simulation.SendInput.Keyboard.KeyUp(VK.VK_SHIFT);
}
}
});
@ -399,7 +399,7 @@ public class AutoDomainTask
CancellationTokenSource treeCts = new CancellationTokenSource();
_taskParam.Cts.Token.Register(treeCts.Cancel);
// 中键回正视角
Simulation.SendInputEx.Mouse.MiddleButtonClick();
Simulation.SendInput.Mouse.MiddleButtonClick();
Sleep(900, _taskParam.Cts);
// 左右移动直到石化古树位于屏幕中心任务
@ -612,7 +612,7 @@ public class AutoDomainTask
moveAngle *= 2;
}
Simulation.SendInputEx.Mouse.MoveMouseBy(-moveAngle, 0);
Simulation.SendInput.Mouse.MoveMouseBy(-moveAngle, 0);
continuousCount = 0;
}
else if (angle is > 180 and < 360)
@ -624,7 +624,7 @@ public class AutoDomainTask
moveAngle *= 2;
}
Simulation.SendInputEx.Mouse.MoveMouseBy(moveAngle, 0);
Simulation.SendInput.Mouse.MoveMouseBy(moveAngle, 0);
continuousCount = 0;
}
else

View File

@ -108,9 +108,9 @@ public class Avatar
using var confirmRectArea = region.Find(AutoFightContext.Instance.FightAssets.ConfirmRa);
if (!confirmRectArea.IsEmpty())
{
Simulation.SendInputEx.Keyboard.KeyPress(User32.VK.VK_ESCAPE);
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_ESCAPE);
Sleep(600, Cts);
Simulation.SendInputEx.Keyboard.KeyPress(User32.VK.VK_M);
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_M);
throw new Exception("存在角色被击败,按 M 键打开地图,并停止自动秘境。");
}
}
@ -260,7 +260,7 @@ public class Avatar
Sleep(300, Cts);
for (int j = 0; j < 10; j++)
{
Simulation.SendInputEx.Mouse.MoveMouseBy(1000, 0);
Simulation.SendInput.Mouse.MoveMouseBy(1000, 0);
Sleep(50); // 持续操作不应该被cts取消
}
@ -419,7 +419,7 @@ public class Avatar
/// <param name="pixelDeltaY"></param>
public void MoveCamera(int pixelDeltaX, int pixelDeltaY)
{
Simulation.SendInputEx.Mouse.MoveMouseBy(pixelDeltaX, pixelDeltaY);
Simulation.SendInput.Mouse.MoveMouseBy(pixelDeltaX, pixelDeltaY);
}
/// <summary>
@ -459,7 +459,7 @@ public class Avatar
return;
}
Simulation.SendInputEx.Mouse.MoveMouseBy(1000, 0);
Simulation.SendInput.Mouse.MoveMouseBy(1000, 0);
ms -= 50;
Sleep(50); // 持续操作不应该被cts取消
}
@ -527,7 +527,7 @@ public class Avatar
public void MoveBy(int x, int y)
{
Simulation.SendInputEx.Mouse.MoveMouseBy(x, y);
Simulation.SendInput.Mouse.MoveMouseBy(x, y);
}
public void KeyDown(string key)

View File

@ -273,18 +273,18 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
// 往左移动是正数,往右移动是负数
if (fishpond.FishpondRect.Left > centerX)
{
Simulation.SendInputEx.Mouse.MoveMouseBy(100, 0);
Simulation.SendInput.Mouse.MoveMouseBy(100, 0);
}
if (fishpond.FishpondRect.Right < centerX)
{
Simulation.SendInputEx.Mouse.MoveMouseBy(-100, 0);
Simulation.SendInput.Mouse.MoveMouseBy(-100, 0);
}
// 鱼塘尽量在上半屏幕
if (fishpond.FishpondRect.Bottom > centerY)
{
Simulation.SendInputEx.Mouse.MoveMouseBy(0, -100);
Simulation.SendInput.Mouse.MoveMouseBy(0, -100);
}
if ((fishpond.FishpondRect.Left < centerX && fishpond.FishpondRect.Right > centerX && fishpond.FishpondRect.Bottom >= centerY) || fishpond.FishpondRect.Width < content.CaptureRectArea.SrcBitmap.Width / 4)
@ -322,7 +322,7 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
// 30s 没有上钩,重新抛竿
if (_throwRodWaitFrameNum >= content.FrameRate * TaskContext.Instance().Config.AutoFishingConfig.AutoThrowRodTimeOut)
{
Simulation.SendInputEx.Mouse.LeftButtonClick();
Simulation.SendInput.Mouse.LeftButtonClick();
_throwRodWaitFrameNum = 0;
_waitBiteContinuouslyFrameNum = 0;
Debug.WriteLine("超时自动收竿");
@ -365,9 +365,9 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
private string ChooseBait(CaptureContent content, Fishpond fishpond)
{
// 打开换饵界面
Simulation.SendInputEx.Mouse.RightButtonClick();
Simulation.SendInput.Mouse.RightButtonClick();
Sleep(100);
Simulation.SendInputEx.Mouse.MoveMouseBy(0, 200); // 鼠标移走,防止干扰
Simulation.SendInput.Mouse.MoveMouseBy(0, 200); // 鼠标移走,防止干扰
Sleep(500);
_selectedBaitName = fishpond.Fishes[0].FishType.BaitName; // 选择最多鱼吃的饵料
@ -417,7 +417,7 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
private void ApproachFishAndThrowRod(CaptureContent content)
{
// 预抛竿
Simulation.SendInputEx.Mouse.LeftButtonDown();
Simulation.SendInput.Mouse.LeftButtonDown();
_logger.LogInformation("长按预抛竿");
Sleep(3000);
@ -451,7 +451,7 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
var moveX = 100 * (cX - rdX) / ra.SrcBitmap.Width;
var moveY = 100 * (cY - rdY) / ra.SrcBitmap.Height;
Simulation.SendInputEx.Mouse.MoveMouseBy(moveX, moveY);
Simulation.SendInput.Mouse.MoveMouseBy(moveX, moveY);
if (noPlacementTimes > 25)
{
@ -503,10 +503,10 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
{
// 没有找到目标鱼,重新选择鱼饵
_logger.LogInformation("没有找到目标鱼1.直接抛竿");
Simulation.SendInputEx.Mouse.LeftButtonUp();
Simulation.SendInput.Mouse.LeftButtonUp();
Sleep(1500);
_logger.LogInformation("没有找到目标鱼2.收杆");
Simulation.SendInputEx.Mouse.LeftButtonClick();
Simulation.SendInput.Mouse.LeftButtonClick();
Sleep(800);
_logger.LogInformation("没有找到目标鱼3.准备重新选择鱼饵");
_selectedBaitName = string.Empty;
@ -569,12 +569,12 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
var moveY = 100 * (cY - rdY) / content.CaptureRectArea.SrcBitmap.Height;
_logger.LogInformation("失败 随机移动 {DX}, {DY}", moveX, moveY);
Simulation.SendInputEx.Mouse.MoveMouseBy(moveX, moveY);
Simulation.SendInput.Mouse.MoveMouseBy(moveX, moveY);
}
else if (state == 0)
{
// 成功 抛竿
Simulation.SendInputEx.Mouse.LeftButtonUp();
Simulation.SendInput.Mouse.LeftButtonUp();
_logger.LogInformation("尝试钓取 {Text}", currentFish.FishType.ChineseName);
_isThrowRod = true;
VisionContext.Instance().DrawContent.RemoveRect("Target");
@ -589,13 +589,13 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
dx = dx / dl * 30;
dy = dy / dl * 30;
// _logger.LogInformation("太近 移动 {DX}, {DY}", dx, dy);
Simulation.SendInputEx.Mouse.MoveMouseBy((int)(-dx / 1.5), (int)(-dy * 1.5));
Simulation.SendInput.Mouse.MoveMouseBy((int)(-dx / 1.5), (int)(-dy * 1.5));
}
else if (state == 2)
{
// 太远
// _logger.LogInformation("太远 移动 {DX}, {DY}", dx, dy);
Simulation.SendInputEx.Mouse.MoveMouseBy((int)(dx / 1.5), (int)(dy * 1.5));
Simulation.SendInput.Mouse.MoveMouseBy((int)(dx / 1.5), (int)(dy * 1.5));
}
}
@ -621,9 +621,9 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
if (TaskContext.Instance().Config.AutoFishingConfig.AutoThrowRodEnabled)
{
// 下移视角方便看鱼
Simulation.SendInputEx.Mouse.MoveMouseBy(0, 400);
Simulation.SendInput.Mouse.MoveMouseBy(0, 400);
Sleep(500);
Simulation.SendInputEx.Mouse.MoveMouseBy(0, 500);
Simulation.SendInput.Mouse.MoveMouseBy(0, 500);
Sleep(500);
}
}
@ -661,7 +661,7 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
}
//_logger.LogInformation("移动鼠标 {X} {Y}", 0, moveY);
Simulation.SendInputEx.Mouse.MoveMouseBy(0, moveY);
Simulation.SendInput.Mouse.MoveMouseBy(0, moveY);
return (0, minDistance);
}
@ -681,7 +681,7 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
}
//_logger.LogInformation("移动鼠标 {X} {Y}", moveX, 0);
Simulation.SendInputEx.Mouse.MoveMouseBy(moveX, 0);
Simulation.SendInput.Mouse.MoveMouseBy(moveX, 0);
return (minDistance, 0);
}
@ -714,7 +714,7 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
}
//_logger.LogInformation("移动鼠标 {X} {Y}", moveX, moveY);
Simulation.SendInputEx.Mouse.MoveMouseBy(moveX, moveY);
Simulation.SendInput.Mouse.MoveMouseBy(moveX, moveY);
return (dpX, dpY);
}
@ -846,7 +846,7 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
using var liftRodButtonRa = content.CaptureRectArea.Find(_autoFishingAssets.LiftRodButtonRo);
if (!liftRodButtonRa.IsEmpty())
{
Simulation.SendInputEx.Mouse.LeftButtonClick();
Simulation.SendInput.Mouse.LeftButtonClick();
_logger.LogInformation(@"┌------------------------┐");
_logger.LogInformation(" 自动提竿(图像识别)");
_isFishingProcess = true;
@ -863,7 +863,7 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
currentBiteWordsTips.Width, currentBiteWordsTips.Height)));
if (!string.IsNullOrEmpty(text) && StringUtils.RemoveAllSpace(text).Contains("上钩"))
{
Simulation.SendInputEx.Mouse.LeftButtonClick();
Simulation.SendInput.Mouse.LeftButtonClick();
_logger.LogInformation(@"┌------------------------┐");
_logger.LogInformation(" 自动提竿(OCR)");
_isFishingProcess = true;
@ -882,7 +882,7 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
if (_biteTipsExitCount >= content.FrameRate / 2d)
{
Simulation.SendInputEx.Mouse.LeftButtonClick();
Simulation.SendInput.Mouse.LeftButtonClick();
_logger.LogInformation(@"┌------------------------┐");
_logger.LogInformation(" 自动提竿(文字块)");
_isFishingProcess = true;
@ -906,7 +906,7 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
/// <param name="fishBarMat"></param>
private void Fishing(CaptureContent content, Mat fishBarMat)
{
var simulator = Simulation.SendInputEx;
var simulator = Simulation.SendInput;
var rects = AutoFishingImageRecognition.GetFishBarRect(fishBarMat);
if (rects != null && rects.Count > 0)
{

View File

@ -539,7 +539,7 @@ public class GeniusInvokationControl
public void ActionPhaseElementalTuning(int currentCardCount)
{
var rect = TaskContext.Instance().SystemInfo.CaptureAreaRect;
var m = Simulation.SendInputEx.Mouse;
var m = Simulation.SendInput.Mouse;
ClickExtension.Click(rect.X + rect.Width / 2d, rect.Y + rect.Height - 50);
Sleep(1500);
if (currentCardCount == 1)

View File

@ -118,12 +118,12 @@ public class AutoMusicGameTask(AutoMusicGameParam taskParam)
private void KeyUp(User32.VK key)
{
Simulation.SendInputEx.Keyboard.KeyUp(key);
Simulation.SendInput.Keyboard.KeyUp(key);
}
private void KeyDown(User32.VK key)
{
Simulation.SendInputEx.Keyboard.KeyDown(key);
Simulation.SendInput.Keyboard.KeyDown(key);
}
private void Init()

View File

@ -175,7 +175,7 @@ public class AutoPickTrigger : ITaskTrigger
if (_whiteList.Contains(text))
{
LogPick(content, text);
Simulation.SendInputEx.Keyboard.KeyPress(User32.VK.VK_F);
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_F);
return;
}
@ -195,7 +195,7 @@ public class AutoPickTrigger : ITaskTrigger
speedTimer.Record("黑名单判断");
LogPick(content, text);
Simulation.SendInputEx.Keyboard.KeyPress(User32.VK.VK_F);
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_F);
}
});
speedTimer.DebugPrint();

View File

@ -182,7 +182,7 @@ public class AutoSkipTrigger : ITaskTrigger
_prevPlayingTime = DateTime.Now;
if (TaskContext.Instance().Config.AutoSkipConfig.QuicklySkipConversationsEnabled)
{
Simulation.SendInputEx.Keyboard.KeyPress(User32.VK.VK_SPACE);
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_SPACE);
}
// 对话选项选择
@ -221,7 +221,7 @@ public class AutoSkipTrigger : ITaskTrigger
var rate = blackCount * 1d / (grayMat.Width * grayMat.Height);
if (rate is >= 0.5 and < 0.98999)
{
Simulation.SendInputEx.Mouse.LeftButtonClick();
Simulation.SendInput.Mouse.LeftButtonClick();
_logger.LogInformation("自动剧情:{Text} 比例 {Rate}", "点击黑屏", rate.ToString("F"));
@ -367,7 +367,7 @@ public class AutoSkipTrigger : ITaskTrigger
content.CaptureRectArea.Find(_autoSkipAssets.PrimogemRo, primogemRa =>
{
Thread.Sleep(100);
Simulation.SendInputEx.Keyboard.KeyPress(User32.VK.VK_ESCAPE);
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_ESCAPE);
_prevGetDailyRewardsTime = DateTime.MinValue;
primogemRa.Dispose();
});

View File

@ -92,7 +92,7 @@ public class AutoTrackTask(AutoTrackParam param) : BaseIndependentTask
}
// 任务文字有动效等待2s重新截图
Simulation.SendInputEx.Mouse.MoveMouseBy(0, 7000);
Simulation.SendInput.Mouse.MoveMouseBy(0, 7000);
Sleep(2000, param.Cts);
// OCR 任务文字 在小地图下方
@ -111,7 +111,7 @@ public class AutoTrackTask(AutoTrackParam param) : BaseIndependentTask
{
// 距离大于150米先传送到最近的传送点
// J 打开任务 切换追踪打开地图 中心点就是任务点
Simulation.SendInputEx.Keyboard.KeyPress(User32.VK.VK_J);
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_J);
Sleep(800, param.Cts);
// TODO 识别是否在任务界面
// 切换追踪
@ -177,7 +177,7 @@ public class AutoTrackTask(AutoTrackParam param) : BaseIndependentTask
private void StartTrackPoint()
{
// V键直接追踪
Simulation.SendInputEx.Keyboard.KeyPress(User32.VK.VK_V);
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_V);
Sleep(3000, param.Cts);
var ra = GetRectAreaFromDispatcher();
@ -211,10 +211,10 @@ public class AutoTrackTask(AutoTrackParam param) : BaseIndependentTask
var centerY = blueTrackPointRa.Y + blueTrackPointRa.Height / 2;
if (centerY > CaptureRect.Height / 2)
{
Simulation.SendInputEx.Mouse.MoveMouseBy(-50, 0);
Simulation.SendInput.Mouse.MoveMouseBy(-50, 0);
if (wDown)
{
Simulation.SendInputEx.Keyboard.KeyUp(User32.VK.VK_W);
Simulation.SendInput.Keyboard.KeyUp(User32.VK.VK_W);
wDown = false;
}
Debug.WriteLine("使追踪点位于俯视角上方");
@ -232,7 +232,7 @@ public class AutoTrackTask(AutoTrackParam param) : BaseIndependentTask
};
if (moveX != 0)
{
Simulation.SendInputEx.Mouse.MoveMouseBy(moveX, 0);
Simulation.SendInput.Mouse.MoveMouseBy(moveX, 0);
Debug.WriteLine("调整方向:" + moveX);
}
@ -240,7 +240,7 @@ public class AutoTrackTask(AutoTrackParam param) : BaseIndependentTask
{
if (!wDown)
{
Simulation.SendInputEx.Keyboard.KeyDown(User32.VK.VK_W);
Simulation.SendInput.Keyboard.KeyDown(User32.VK.VK_W);
wDown = true;
}
}
@ -249,7 +249,7 @@ public class AutoTrackTask(AutoTrackParam param) : BaseIndependentTask
{
if (wDown)
{
Simulation.SendInputEx.Keyboard.KeyUp(User32.VK.VK_W);
Simulation.SendInput.Keyboard.KeyUp(User32.VK.VK_W);
wDown = false;
}
// 识别距离
@ -271,7 +271,7 @@ public class AutoTrackTask(AutoTrackParam param) : BaseIndependentTask
Logger.LogInformation("未找到追踪点");
}
Simulation.SendInputEx.Mouse.MoveMouseBy(0, 500); // 保证俯视角
Simulation.SendInput.Mouse.MoveMouseBy(0, 500); // 保证俯视角
Sleep(100);
}
// });

View File

@ -42,7 +42,7 @@ public class OneKeyExpeditionTask
// 3.退出派遣页面 ESC
Sleep(500);
Simulation.SendInputEx.Keyboard.KeyPress(VK.VK_ESCAPE);
Simulation.SendInput.Keyboard.KeyPress(VK.VK_ESCAPE);
Logger.LogInformation("探索派遣:{Text}", "完成");
});
}

View File

@ -154,7 +154,7 @@ public class AutoWoodTask
}
else
{
Simulation.SendInputEx.Keyboard.KeyPress(_zKey);
Simulation.SendInput.Keyboard.KeyPress(_zKey);
Debug.WriteLine("[AutoWood] Z");
_first = false;
}
@ -175,7 +175,7 @@ public class AutoWoodTask
#endif
}
Simulation.SendInputEx.Keyboard.KeyPress(_zKey);
Simulation.SendInput.Keyboard.KeyPress(_zKey);
Debug.WriteLine("[AutoWood] Z");
Sleep(500, taskParam.Cts);
}, TimeSpan.FromSeconds(1), 120);
@ -188,7 +188,7 @@ public class AutoWoodTask
private void PressEsc(WoodTaskParam taskParam)
{
SystemControl.Focus(TaskContext.Instance().GameHandle);
Simulation.SendInputEx.Keyboard.KeyPress(VK.VK_ESCAPE);
Simulation.SendInput.Keyboard.KeyPress(VK.VK_ESCAPE);
Debug.WriteLine("[AutoWood] Esc");
Sleep(800, taskParam.Cts);
// 确认在菜单界面

View File

@ -75,7 +75,7 @@ public class GameLoadingTrigger : ITaskTrigger
// 随便找个相对点击的位置
// _clickOffset?.Click(955, 666);
_postMessageSimulator?.LeftButtonClick();
Simulation.SendInputEx.Mouse.LeftButtonClick();
Simulation.SendInput.Mouse.LeftButtonClick();
_enterGameClickCount++;
}
else

View File

@ -7,7 +7,7 @@ namespace BetterGenshinImpact.GameTask.Macro
{
public static void Done()
{
Simulation.SendInputEx.Mouse.MoveMouseBy(TaskContext.Instance().Config.MacroConfig.RunaroundMouseXInterval, 0);
Simulation.SendInput.Mouse.MoveMouseBy(TaskContext.Instance().Config.MacroConfig.RunaroundMouseXInterval, 0);
Thread.Sleep(TaskContext.Instance().Config.MacroConfig.RunaroundInterval);
}
}

View File

@ -14,7 +14,7 @@ public class DesktopRegion() : Region(0, 0, PrimaryScreen.WorkingArea.Width, Pri
{
public void DesktopRegionClick(int x, int y, int w, int h)
{
Simulation.SendInputEx.Mouse.MoveMouseTo((x + (w * 1d / 2)) * 65535 / Width,
Simulation.SendInput.Mouse.MoveMouseTo((x + (w * 1d / 2)) * 65535 / Width,
(y + (h * 1d / 2)) * 65535 / Height).LeftButtonClick().Sleep(50).LeftButtonUp();
}
@ -25,13 +25,13 @@ public class DesktopRegion() : Region(0, 0, PrimaryScreen.WorkingArea.Width, Pri
/// <param name="cy"></param>
public static void DesktopRegionClick(double cx, double cy)
{
Simulation.SendInputEx.Mouse.MoveMouseTo(cx * 65535 * 1d / PrimaryScreen.WorkingArea.Width,
Simulation.SendInput.Mouse.MoveMouseTo(cx * 65535 * 1d / PrimaryScreen.WorkingArea.Width,
cy * 65535 * 1d / PrimaryScreen.WorkingArea.Height).LeftButtonDown().Sleep(50).LeftButtonUp();
}
public static void DesktopRegionMove(double cx, double cy)
{
Simulation.SendInputEx.Mouse.MoveMouseTo(cx * 65535 * 1d / PrimaryScreen.WorkingArea.Width,
Simulation.SendInput.Mouse.MoveMouseTo(cx * 65535 * 1d / PrimaryScreen.WorkingArea.Width,
cy * 65535 * 1d / PrimaryScreen.WorkingArea.Height);
}

View File

@ -30,13 +30,13 @@ public class QuickBuyTask
// 选中左边点 742x601
GameCaptureRegion.GameRegion1080PPosMove(742, 601);
TaskControl.CheckAndSleep(100);
Simulation.SendInputEx.Mouse.LeftButtonDown();
Simulation.SendInput.Mouse.LeftButtonDown();
TaskControl.CheckAndSleep(50);
// 向右滑动
Simulation.SendInputEx.Mouse.MoveMouseBy(1000, 0);
Simulation.SendInput.Mouse.MoveMouseBy(1000, 0);
TaskControl.CheckAndSleep(200);
Simulation.SendInputEx.Mouse.LeftButtonUp();
Simulation.SendInput.Mouse.LeftButtonUp();
TaskControl.CheckAndSleep(100);
// 点击弹出页的购买/兑换 1100x780

View File

@ -60,7 +60,7 @@ public class QuickSereniteaPotTask
try
{
// 打开背包
Simulation.SendInputEx.Keyboard.KeyPress(VK.VK_B);
Simulation.SendInput.Keyboard.KeyPress(VK.VK_B);
TaskControl.CheckAndSleep(500);
WaitForBagToOpen();
@ -79,7 +79,7 @@ public class QuickSereniteaPotTask
TaskControl.CheckAndSleep(800);
// 按F进入
Simulation.SendInputEx.Keyboard.KeyPress(VK.VK_F);
Simulation.SendInput.Keyboard.KeyPress(VK.VK_F);
}
catch (Exception e)
{

View File

@ -11,7 +11,7 @@ public static class ClickExtension
public static void Click(this Point point)
{
Simulation.SendInputEx.Mouse.MoveMouseTo(point.X * 65535 * 1d / PrimaryScreen.WorkingArea.Width,
Simulation.SendInput.Mouse.MoveMouseTo(point.X * 65535 * 1d / PrimaryScreen.WorkingArea.Width,
point.Y * 65535 * 1d / PrimaryScreen.WorkingArea.Height).LeftButtonDown().Sleep(50).LeftButtonUp();
}
@ -23,13 +23,13 @@ public static class ClickExtension
public static IMouseSimulator Click(double x, double y)
{
return Simulation.SendInputEx.Mouse.MoveMouseTo(x * 65535 * 1d / PrimaryScreen.WorkingArea.Width,
return Simulation.SendInput.Mouse.MoveMouseTo(x * 65535 * 1d / PrimaryScreen.WorkingArea.Width,
y * 65535 * 1d / PrimaryScreen.WorkingArea.Height).LeftButtonDown().Sleep(50).LeftButtonUp();
}
public static IMouseSimulator Move(double x, double y)
{
return Simulation.SendInputEx.Mouse.MoveMouseTo(x * 65535 * 1d / PrimaryScreen.WorkingArea.Width,
return Simulation.SendInput.Mouse.MoveMouseTo(x * 65535 * 1d / PrimaryScreen.WorkingArea.Width,
y * 65535 * 1d / PrimaryScreen.WorkingArea.Height);
}

View File

@ -1,5 +1,4 @@
using System.Diagnostics;
using Vanara.PInvoke;
namespace Fischless.KeyboardCapture;
@ -117,8 +116,8 @@ public class KeyboardReader : IDisposable
DateTime now = DateTime.Now;
#if true
//Debug.WriteLine(e.KeyCode);
#if false
Debug.WriteLine(e.KeyCode);
#endif
KeyboardItem item;