diff --git a/BetterGenshinImpact/BetterGenshinImpact.csproj b/BetterGenshinImpact/BetterGenshinImpact.csproj index 2d6a15d8..2af69aaa 100644 --- a/BetterGenshinImpact/BetterGenshinImpact.csproj +++ b/BetterGenshinImpact/BetterGenshinImpact.csproj @@ -27,7 +27,6 @@ - diff --git a/BetterGenshinImpact/GameTask/AutoPick/Assets/1920x1080/F.png b/BetterGenshinImpact/GameTask/AutoPick/Assets/1920x1080/F.png new file mode 100644 index 00000000..5447da44 Binary files /dev/null and b/BetterGenshinImpact/GameTask/AutoPick/Assets/1920x1080/F.png differ diff --git a/BetterGenshinImpact/GameTask/AutoPick/Assets/AutoPickAssets.cs b/BetterGenshinImpact/GameTask/AutoPick/Assets/AutoPickAssets.cs new file mode 100644 index 00000000..ac22e335 --- /dev/null +++ b/BetterGenshinImpact/GameTask/AutoPick/Assets/AutoPickAssets.cs @@ -0,0 +1,15 @@ +using BetterGenshinImpact.Core.Config; +using OpenCvSharp; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BetterGenshinImpact.GameTask.AutoPick.Assets +{ + public class AutoPickAssets + { + public static Mat StopAutoButtonMat = new(Global.Absolute(@"GameTask\AutoPick\Assets\1920x1080\F.png"), ImreadModes.Grayscale); + } +} diff --git a/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs b/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs index 2b6405e9..403beb1b 100644 --- a/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs +++ b/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs @@ -27,20 +27,20 @@ namespace BetterGenshinImpact.GameTask.AutoSkip IsEnabled = true; } - public void OnCapture(Mat matSrc, int frameIndex) + public void OnCapture(CaptureContent content) { - if (frameIndex % 2 == 0) + if (content.FrameIndex % 2 == 0) { return; } - var grayMat = new Mat(); - Cv2.CvtColor(matSrc, grayMat, ColorConversionCodes.BGR2GRAY); + var grayMat = content.SrcGreyMat; // 找左上角剧情自动的按钮 var grayLeftTopMat = CutHelper.CutLeftTop(grayMat, grayMat.Width / 5, grayMat.Height / 5); var p1 = MatchTemplateHelper.FindSingleTarget(grayLeftTopMat, AutoSkipAssets.StopAutoButtonMat, 0.9); if (p1 is { X: > 0, Y: > 0 }) { + //_logger.LogInformation($"找到剧情自动按钮:{p1}"); VisionContext.Instance().DrawContent.PutRect("StopAutoButton", p1.CenterPointToRect(AutoSkipAssets.StopAutoButtonMat)); new InputSimulator().Keyboard.KeyPress(VirtualKeyCode.SPACE); diff --git a/BetterGenshinImpact/GameTask/TaskDispatcher.cs b/BetterGenshinImpact/GameTask/TaskDispatcher.cs index 45cb86ff..4cad6d50 100644 --- a/BetterGenshinImpact/GameTask/TaskDispatcher.cs +++ b/BetterGenshinImpact/GameTask/TaskDispatcher.cs @@ -98,17 +98,17 @@ namespace BetterGenshinImpact.GameTask } // 循环执行所有触发器 有独占状态的触发器的时候只执行独占触发器 - var mat = bitmap.ToMat(); + var content = new CaptureContent(bitmap, _frameIndex); var exclusiveTrigger = _triggers.FirstOrDefault(t => t is { IsEnabled: true, IsExclusive: true }); if (exclusiveTrigger != null) { - exclusiveTrigger.OnCapture(mat, _frameIndex); + exclusiveTrigger.OnCapture(content); } else { foreach (var trigger in _triggers.Where(trigger => trigger.IsEnabled)) { - trigger.OnCapture(mat, _frameIndex); + trigger.OnCapture(content); } } } diff --git a/BetterGenshinImpact/ViewModel/MainWindowViewModel.cs b/BetterGenshinImpact/ViewModel/MainWindowViewModel.cs index 1d7e9aef..4126e548 100644 --- a/BetterGenshinImpact/ViewModel/MainWindowViewModel.cs +++ b/BetterGenshinImpact/ViewModel/MainWindowViewModel.cs @@ -119,7 +119,7 @@ namespace BetterGenshinImpact.ViewModel _maskWindow.Top = y; _maskWindow.Width = w; _maskWindow.Height = h; - + _maskWindow.Logger = App.GetLogger(); _maskWindow.Show(); _logger.LogInformation("Mask Window showed 遮罩窗口启动成功"); diff --git a/Vision.Recognition/MaskWindow.xaml b/Vision.Recognition/MaskWindow.xaml index f34b2904..c17a6d1d 100644 --- a/Vision.Recognition/MaskWindow.xaml +++ b/Vision.Recognition/MaskWindow.xaml @@ -54,7 +54,8 @@ Foreground="LightGray" FontFamily="Cascadia Mono, Consolas, Courier New, monospace" BorderThickness="0" - VerticalScrollBarVisibility="Auto" /> + VerticalScrollBarVisibility="Hidden" Margin="0,0,-258,10"> +