Skip to content

Commit

Permalink
fix auto skip
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyadanli committed Nov 19, 2023
1 parent f41129a commit a97a67d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 4 additions & 4 deletions BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void Init()
/// <summary>
/// 上一次播放中的帧
/// </summary>
private int _prevPlayingFrameIndex = -1;
private DateTime _prevPlayingTime = DateTime.MinValue;

public void OnCapture(CaptureContent content)
{
Expand All @@ -65,14 +65,14 @@ public void OnCapture(CaptureContent content)
var isPlaying = !foundRectArea.IsEmpty(); // 播放中

// 播放中图标消失3s内OCR判断文字
if (!isPlaying && Math.Abs(content.FrameIndex - _prevPlayingFrameIndex) <= content.FrameRate * 2)
if (!isPlaying && (DateTime.Now - _prevPlayingTime).TotalSeconds <= 2)
{
// 找播放中的文字
content.CaptureRectArea.Find(_autoSkipAssets.PlayingTextRo, _ => { isPlaying = true; });

if (!isPlaying)
{
// 关闭弹出页 //todo 可能会误判关闭传送窗口,可以加上二次判断
// 关闭弹出页
content.CaptureRectArea.Find(_autoSkipAssets.PageCloseRo, pageCloseRoRa =>
{
pageCloseRoRa.ClickCenter();
Expand All @@ -91,7 +91,7 @@ public void OnCapture(CaptureContent content)

if (isPlaying)
{
_prevPlayingFrameIndex = content.FrameIndex;
_prevPlayingTime = DateTime.Now;
if (TaskContext.Instance().Config.AutoSkipConfig.QuicklySkipConversationsEnabled)
{
Simulation.SendInput.Keyboard.KeyPress(VirtualKeyCode.SPACE);
Expand Down
3 changes: 0 additions & 3 deletions BetterGenshinImpact/User/pick_black_lists.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
"",
"",

"薄荷",
"甜甜花",
"树莓",
"合成",
"烹饪",
"锻造",
Expand Down

0 comments on commit a97a67d

Please sign in to comment.