From b9dd66f87a0ce18d513af64460b801ea09d78cdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E4=BA=91?= Date: Wed, 8 Jan 2025 00:53:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs b/BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs index c5500da2..f3cb6ec7 100644 --- a/BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs +++ b/BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs @@ -19,6 +19,7 @@ using System.Threading.Tasks; using BetterGenshinImpact.GameTask.Common.Exceptions; using Vanara.PInvoke; using static BetterGenshinImpact.GameTask.Common.TaskControl; +using BetterGenshinImpact.Core.Simulator.Extensions; namespace BetterGenshinImpact.GameTask.AutoTrackPath; @@ -151,7 +152,7 @@ public class TpTask(CancellationToken ct) return (clickX, clickY); } - public async Task<(double, double)> Tp(double tpX, double tpY, bool force = false) + private async Task checkInBigMapUi() { // M 打开地图识别当前位置,中心点为当前位置 var ra1 = CaptureToRectArea(); @@ -163,7 +164,7 @@ public class TpTask(CancellationToken ct) await Delay(1000, ct); ra1 = CaptureToRectArea(); } - Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_M); + Simulation.SendInput.SimulateAction(GIActions.OpenMap); await Delay(1000, ct); for (int i = 0; i < 3; i++) { @@ -173,8 +174,11 @@ public class TpTask(CancellationToken ct) await Delay(500, ct); } } - } - + } + } + public async Task<(double, double)> Tp(double tpX, double tpY, bool force = false) + { + await checkInBigMapUi(); for (var i = 0; i < 3; i++) { try