diff --git a/BetterGenshinImpact/GameTask/AutoFishing/AutoFishingTrigger.cs b/BetterGenshinImpact/GameTask/AutoFishing/AutoFishingTrigger.cs
index 389a48ab..f0c6fcf4 100644
--- a/BetterGenshinImpact/GameTask/AutoFishing/AutoFishingTrigger.cs
+++ b/BetterGenshinImpact/GameTask/AutoFishing/AutoFishingTrigger.cs
@@ -93,7 +93,6 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
}
-
///
/// 在“开始钓鱼”按钮上方安排一个我们的“开始自动钓鱼”按钮
///
@@ -135,7 +134,7 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
var maskButton = new MaskButton("开始自动钓鱼", btnPosition, () =>
{
VisionContext.Instance().DrawContent.RemoveRect("StartFishingButton");
- _logger.LogInformation("自动钓鱼,启动!");
+ _logger.LogInformation("→ {Text}", "自动钓鱼,启动!");
// 点击下面的按钮
var rc = info.GameWindowRect;
new InputSimulator()
@@ -229,10 +228,11 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
_isThrowRod = true;
}
}
+
if (baitRectArea.IsEmpty() && !waitBiteArea.IsEmpty() && _isThrowRod)
{
_switchBaitContinuouslyFrameNum = 0;
- _waitBiteContinuouslyFrameNum ++;
+ _waitBiteContinuouslyFrameNum++;
_noFishActionContinuouslyFrameNum = 0;
_throwRodWaitFrameNum++;
@@ -565,7 +565,7 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
if (!IsExclusive)
{
_isThrowRod = false;
- _logger.LogInformation("退出钓鱼界面");
+ _logger.LogInformation("← {Text}", "退出钓鱼界面");
_fishBoxRect = Rect.Empty;
VisionContext.Instance().DrawContent.RemoveRect("FishBox");
}
diff --git a/BetterGenshinImpact/GameTask/AutoPick/AutoPickTrigger.cs b/BetterGenshinImpact/GameTask/AutoPick/AutoPickTrigger.cs
index 9d26cf1e..2fee0558 100644
--- a/BetterGenshinImpact/GameTask/AutoPick/AutoPickTrigger.cs
+++ b/BetterGenshinImpact/GameTask/AutoPick/AutoPickTrigger.cs
@@ -38,7 +38,6 @@ public class AutoPickTrigger : ITaskTrigger
public AutoPickTrigger()
{
_autoPickAssets = new AutoPickAssets();
-
}
public void Init()
@@ -49,6 +48,7 @@ public class AutoPickTrigger : ITaskTrigger
{
_blackList = JsonSerializer.Deserialize>(blackListJson) ?? new List();
}
+
var whiteListJson = Global.ReadAllTextIfExist("Config\\pick_white_lists.json");
if (!string.IsNullOrEmpty(whiteListJson))
{
@@ -64,9 +64,16 @@ public class AutoPickTrigger : ITaskTrigger
var scale = TaskContext.Instance().SystemInfo.AssetScale;
var config = TaskContext.Instance().Config.AutoPickConfig;
// 计算出文字区域
- var textMat = new Mat(content.CaptureRectArea.SrcGreyMat,
- new Rect(foundRectArea.X + (int)(config.FLeftOffset * scale), foundRectArea.Y,
- (int)((config.FRightOffset - config.FLeftOffset) * scale), foundRectArea.Height));
+ var textRect = new Rect(foundRectArea.X + (int)(config.FLeftOffset * scale), foundRectArea.Y,
+ (int)((config.FRightOffset - config.FLeftOffset) * scale), foundRectArea.Height);
+ if (textRect.X + textRect.Width > content.CaptureRectArea.SrcGreyMat.Width
+ || textRect.Y + textRect.Height > content.CaptureRectArea.SrcGreyMat.Height)
+ {
+ Debug.WriteLine("AutoPickTrigger: 文字区域 out of range");
+ return;
+ }
+
+ var textMat = new Mat(content.CaptureRectArea.SrcGreyMat, textRect);
var paddedMat = PreProcessForInference(textMat);
var text = _pickTextInference.Inference(paddedMat);
@@ -74,15 +81,17 @@ public class AutoPickTrigger : ITaskTrigger
{
if (_whiteList.Contains(text))
{
- _logger.LogInformation($"交互或拾取:{text}");
+ _logger.LogInformation("交互或拾取:{Text}", text);
new InputSimulator().Keyboard.KeyPress(VirtualKeyCode.VK_F);
return;
}
+
if (_blackList.Contains(text))
{
return;
}
- _logger.LogInformation($"交互或拾取:{text}");
+
+ _logger.LogInformation("交互或拾取:{Text}", text);
new InputSimulator().Keyboard.KeyPress(VirtualKeyCode.VK_F);
}
});
diff --git a/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs b/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs
index ceab2988..9655015d 100644
--- a/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs
+++ b/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs
@@ -3,6 +3,8 @@ using BetterGenshinImpact.GameTask.AutoSkip.Assets;
using Microsoft.Extensions.Logging;
using System;
using System.Diagnostics;
+using OpenCvSharp;
+using Vanara.PInvoke;
using WindowsInput;
namespace BetterGenshinImpact.GameTask.AutoSkip;
@@ -31,6 +33,12 @@ public class AutoSkipTrigger : ITaskTrigger
IsEnabled = TaskContext.Instance().Config.AutoSkipConfig.Enabled;
}
+ ///
+ /// 用于日志只输出一次
+ /// frame最好取模,应对极端场景
+ ///
+ private int _prevClickFrameIndex = -1;
+
public void OnCapture(CaptureContent content)
{
if (content.IsReachInterval(TimeSpan.FromMilliseconds(200)))
@@ -52,7 +60,12 @@ public class AutoSkipTrigger : ITaskTrigger
if (menuRectArea.IsEmpty())
{
optionButtonRectArea.ClickCenter();
- _logger.LogInformation("点击选项按钮");
+
+ if (_prevClickFrameIndex <= content.FrameIndex - 1 && _prevClickFrameIndex >= content.FrameIndex - 5)
+ {
+ _logger.LogInformation("自动剧情:{Text}", "点击选项");
+ }
+ _prevClickFrameIndex = content.FrameIndex;
}
});
diff --git a/BetterGenshinImpact/ViewModel/MainWindowViewModel.cs b/BetterGenshinImpact/ViewModel/MainWindowViewModel.cs
index a1a10c50..fbcf3ef6 100644
--- a/BetterGenshinImpact/ViewModel/MainWindowViewModel.cs
+++ b/BetterGenshinImpact/ViewModel/MainWindowViewModel.cs
@@ -24,18 +24,20 @@ namespace BetterGenshinImpact.ViewModel
{
public partial class MainWindowViewModel : ObservableObject
{
+ private readonly ILogger _logger;
private readonly IConfigService _configService;
public MainWindowViewModel(INavigationService navigationService, IConfigService configService)
{
_configService = configService;
+ _logger = App.GetLogger();
}
[RelayCommand]
private void OnLoaded()
{
-
+ _logger.LogInformation("更好的原神({Text}) Alpha {Ver}","内测版", 2.2);
}
[RelayCommand]