mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-04-20 21:49:23 +08:00
reduce the frequency of black screen clicks
This commit is contained in:
@@ -215,19 +215,20 @@ public class AutoSkipTrigger : ITaskTrigger
|
||||
private bool ClickBlackGameScreen(CaptureContent content)
|
||||
{
|
||||
// 黑屏剧情要点击鼠标(多次) 几乎全黑的时候不用点击
|
||||
using var grayMat = new Mat(content.CaptureRectArea.SrcGreyMat, new Rect(0, content.CaptureRectArea.SrcGreyMat.Height / 3, content.CaptureRectArea.SrcGreyMat.Width, content.CaptureRectArea.SrcGreyMat.Height / 3));
|
||||
var blackCount = OpenCvCommonHelper.CountGrayMatColor(grayMat, 0);
|
||||
var rate = blackCount * 1d / (grayMat.Width * grayMat.Height);
|
||||
if (rate is >= 0.5 and < 0.98999)
|
||||
if ((DateTime.Now - _prevClickTime).TotalMilliseconds > 800)
|
||||
{
|
||||
Simulation.SendInputEx.Mouse.LeftButtonClick();
|
||||
if ((DateTime.Now - _prevClickTime).TotalMilliseconds > 1000)
|
||||
using var grayMat = new Mat(content.CaptureRectArea.SrcGreyMat, new Rect(0, content.CaptureRectArea.SrcGreyMat.Height / 3, content.CaptureRectArea.SrcGreyMat.Width, content.CaptureRectArea.SrcGreyMat.Height / 3));
|
||||
var blackCount = OpenCvCommonHelper.CountGrayMatColor(grayMat, 0);
|
||||
var rate = blackCount * 1d / (grayMat.Width * grayMat.Height);
|
||||
if (rate is >= 0.5 and < 0.98999)
|
||||
{
|
||||
_logger.LogInformation("自动剧情:{Text} 比例 {Rate}", "点击黑屏", rate.ToString("F"));
|
||||
}
|
||||
Simulation.SendInputEx.Mouse.LeftButtonClick();
|
||||
|
||||
_prevClickTime = DateTime.Now;
|
||||
return true;
|
||||
_logger.LogInformation("自动剧情:{Text} 比例 {Rate}", "点击黑屏", rate.ToString("F"));
|
||||
|
||||
_prevClickTime = DateTime.Now;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user