mirror of
https://github.com/babalae/better-genshin-impact
synced 2025-01-09 04:19:47 +08:00
Clear draw content when triggers disabled
This commit is contained in:
parent
81a5819019
commit
fa770efcca
@ -20,7 +20,7 @@ using Pen = System.Drawing.Pen;
|
|||||||
|
|
||||||
namespace BetterGenshinImpact.GameTask.AutoFishing
|
namespace BetterGenshinImpact.GameTask.AutoFishing
|
||||||
{
|
{
|
||||||
public class AutoFishingTrigger : ITaskTrigger, IDisposable
|
public class AutoFishingTrigger : ITaskTrigger
|
||||||
{
|
{
|
||||||
private readonly ILogger<AutoFishingTrigger> _logger = App.GetLogger<AutoFishingTrigger>();
|
private readonly ILogger<AutoFishingTrigger> _logger = App.GetLogger<AutoFishingTrigger>();
|
||||||
private readonly IOcrService _ocrService = OcrFactory.Create(OcrEngineType.WinRT);
|
private readonly IOcrService _ocrService = OcrFactory.Create(OcrEngineType.WinRT);
|
||||||
@ -92,6 +92,8 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 在“开始钓鱼”按钮上方安排一个我们的“开始自动钓鱼”按钮
|
/// 在“开始钓鱼”按钮上方安排一个我们的“开始自动钓鱼”按钮
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -581,25 +583,25 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
|
|||||||
VisionContext.Instance().DrawContent.PutOrRemoveRectList(list);
|
VisionContext.Instance().DrawContent.PutOrRemoveRectList(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 清理画布
|
///// 清理画布
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public void ClearDraw()
|
//public void ClearDraw()
|
||||||
{
|
//{
|
||||||
VisionContext.Instance().DrawContent.PutOrRemoveRectList(new List<(string, RectDrawable)>
|
// VisionContext.Instance().DrawContent.PutOrRemoveRectList(new List<(string, RectDrawable)>
|
||||||
{
|
// {
|
||||||
("FishingBarLeft", new RectDrawable(System.Windows.Rect.Empty)),
|
// ("FishingBarLeft", new RectDrawable(System.Windows.Rect.Empty)),
|
||||||
("FishingBarCur", new RectDrawable(System.Windows.Rect.Empty)),
|
// ("FishingBarCur", new RectDrawable(System.Windows.Rect.Empty)),
|
||||||
("FishingBarRight", new RectDrawable(System.Windows.Rect.Empty))
|
// ("FishingBarRight", new RectDrawable(System.Windows.Rect.Empty))
|
||||||
});
|
// });
|
||||||
VisionContext.Instance().DrawContent.RemoveRect("FishBiteTips");
|
// VisionContext.Instance().DrawContent.RemoveRect("FishBiteTips");
|
||||||
VisionContext.Instance().DrawContent.RemoveRect("StartFishingButton");
|
// VisionContext.Instance().DrawContent.RemoveRect("StartFishingButton");
|
||||||
WeakReferenceMessenger.Default.Send(new PropertyChangedMessage<object>(this, "RemoveButton", new object(), "开始自动钓鱼"));
|
// WeakReferenceMessenger.Default.Send(new PropertyChangedMessage<object>(this, "RemoveButton", new object(), "开始自动钓鱼"));
|
||||||
}
|
//}
|
||||||
|
|
||||||
public void Dispose()
|
//public void Stop()
|
||||||
{
|
//{
|
||||||
ClearDraw();
|
// ClearDraw();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,9 +1,12 @@
|
|||||||
using BetterGenshinImpact.Core.Config;
|
using BetterGenshinImpact.Core.Config;
|
||||||
using BetterGenshinImpact.Core.Recognition.OpenCv;
|
using BetterGenshinImpact.Core.Recognition.OpenCv;
|
||||||
|
using CommunityToolkit.Mvvm.Messaging.Messages;
|
||||||
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using OpenCvSharp;
|
using OpenCvSharp;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using BetterGenshinImpact.View.Drawable;
|
||||||
|
|
||||||
namespace BetterGenshinImpact.GameTask
|
namespace BetterGenshinImpact.GameTask
|
||||||
{
|
{
|
||||||
@ -42,6 +45,9 @@ namespace BetterGenshinImpact.GameTask
|
|||||||
{
|
{
|
||||||
TriggerDictionary["AutoFishing"] = new AutoFishing.AutoFishingTrigger();
|
TriggerDictionary["AutoFishing"] = new AutoFishing.AutoFishingTrigger();
|
||||||
}
|
}
|
||||||
|
// 清理画布
|
||||||
|
WeakReferenceMessenger.Default.Send(new PropertyChangedMessage<object>(new object(), "RemoveAllButton", new object(), ""));
|
||||||
|
VisionContext.Instance().DrawContent.ClearAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,4 +93,15 @@ public class DrawContent
|
|||||||
MaskWindow.Instance().Refresh();
|
MaskWindow.Instance().Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理所有绘制内容
|
||||||
|
/// </summary>
|
||||||
|
public void ClearAll()
|
||||||
|
{
|
||||||
|
RectList.Clear();
|
||||||
|
TextList.Clear();
|
||||||
|
MaskWindow.Instance().Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
@ -56,6 +56,13 @@ namespace BetterGenshinImpact.ViewModel
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else if (msg.PropertyName == "RemoveAllButton")
|
||||||
|
{
|
||||||
|
UIDispatcherHelper.Invoke(() =>
|
||||||
|
{
|
||||||
|
_maskButtons.Clear();
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user