From 6432ff1aed620459dd560b2c93a4e5f50fb098e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=89=E9=B8=AD=E8=9B=8B?= Date: Sun, 29 Dec 2024 17:08:08 +0800 Subject: [PATCH] fix key mouse --- BetterGenshinImpact/Core/Recorder/KeyMouseMacroPlayer.cs | 2 +- BetterGenshinImpact/Core/Recorder/KeyMouseRecorder.cs | 7 ++++++- BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs | 2 +- BetterGenshinImpact/View/Pages/CommonSettingsPage.xaml | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/BetterGenshinImpact/Core/Recorder/KeyMouseMacroPlayer.cs b/BetterGenshinImpact/Core/Recorder/KeyMouseMacroPlayer.cs index 32164d89..cf2231c6 100644 --- a/BetterGenshinImpact/Core/Recorder/KeyMouseMacroPlayer.cs +++ b/BetterGenshinImpact/Core/Recorder/KeyMouseMacroPlayer.cs @@ -60,7 +60,7 @@ public class KeyMouseMacroPlayer var timeToWait = e.Time - (Kernel32.GetTickCount() - startTime); if (timeToWait < 0) { - TaskControl.Logger.LogWarning("无法原速重放事件{Event},落后{TimeToWait}ms", e.Type.ToString(), -timeToWait); + TaskControl.Logger.LogDebug("无法原速重放事件{Event},落后{TimeToWait}ms", e.Type.ToString(), (-timeToWait).ToString("F0")); } else { diff --git a/BetterGenshinImpact/Core/Recorder/KeyMouseRecorder.cs b/BetterGenshinImpact/Core/Recorder/KeyMouseRecorder.cs index d75a3f0a..1743063d 100644 --- a/BetterGenshinImpact/Core/Recorder/KeyMouseRecorder.cs +++ b/BetterGenshinImpact/Core/Recorder/KeyMouseRecorder.cs @@ -35,6 +35,11 @@ public class KeyMouseRecorder public string ToJsonMacro() { + // MacroEvents 需要以实际时间进行排序 + MacroEvents.Sort((a, b) => a.Time.CompareTo(b.Time)); + // 删除为负数的时间 + MacroEvents.RemoveAll(m => m.Time < 0); + var rect = TaskContext.Instance().SystemInfo.CaptureAreaRect; // 合并鼠标移动事件 var mergedMacroEvents = new List(); @@ -189,7 +194,7 @@ public class KeyMouseRecorder Type = MacroEventType.MouseMoveBy, MouseX = state.X, MouseY = state.Y, - Time = time - 5, + Time = time - 5 - StartTime, CameraOrientation = cao, }); } diff --git a/BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs b/BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs index 653d7710..ea25e3ad 100644 --- a/BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs +++ b/BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs @@ -161,7 +161,7 @@ public class TpTask(CancellationToken ct) ra1 = CaptureToRectArea(); } currentZoomLevel = GetBigMapZoomLevel(ra1); - Logger.LogInformation($"当前缩放等级为{currentZoomLevel},地图移动过程中不要操作鼠标中键。"); + Logger.LogInformation($"当前缩放等级为{currentZoomLevel:F},地图移动过程中不要操作鼠标中键。"); for (var i = 0; i < 3; i++) { diff --git a/BetterGenshinImpact/View/Pages/CommonSettingsPage.xaml b/BetterGenshinImpact/View/Pages/CommonSettingsPage.xaml index 2628f93b..70dec5d1 100644 --- a/BetterGenshinImpact/View/Pages/CommonSettingsPage.xaml +++ b/BetterGenshinImpact/View/Pages/CommonSettingsPage.xaml @@ -274,7 +274,7 @@ - +