mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-17 09:26:50 +08:00
add task page
This commit is contained in:
@@ -50,7 +50,7 @@ public class MouseKeyMonitor
|
||||
_spaceTimer.Interval = si;
|
||||
_spaceTimer.Elapsed += (sender, args) =>
|
||||
{
|
||||
MySimulator.PostMessage(_hWnd).KeyPress(User32.VK.VK_SPACE);
|
||||
Simulation.PostMessage(_hWnd).KeyPress(User32.VK.VK_SPACE);
|
||||
_spaceTimer.Interval = _random.Next(si, si + 20);
|
||||
};
|
||||
|
||||
@@ -58,7 +58,7 @@ public class MouseKeyMonitor
|
||||
_fTimer.Interval = fi;
|
||||
_fTimer.Elapsed += (sender, args) =>
|
||||
{
|
||||
MySimulator.PostMessage(_hWnd).KeyPress(User32.VK.VK_F);
|
||||
Simulation.PostMessage(_hWnd).KeyPress(User32.VK.VK_F);
|
||||
_fTimer.Interval = _random.Next(fi, fi + 20);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
using System;
|
||||
using WindowsInput;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Simulator;
|
||||
|
||||
public class MySimulator
|
||||
public class Simulation
|
||||
{
|
||||
public static PostMessageSimulator PostMessage(IntPtr hWnd)
|
||||
{
|
||||
return new PostMessageSimulator(hWnd);
|
||||
}
|
||||
|
||||
public static InputSimulator SenInput()
|
||||
{
|
||||
return new InputSimulator();
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ namespace BetterGenshinImpact.GameTask.AutoPick.Assets
|
||||
Name = "SettingsIcon",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssertImage("AutoPick", "settings.png"),
|
||||
DrawOnWindow = true,
|
||||
DrawOnWindow = false,
|
||||
DrawOnWindowPen = new Pen(Color.Chocolate, 2)
|
||||
}.InitTemplate();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using OpenCvSharp;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using BetterGenshinImpact.GameTask.Placeholder;
|
||||
using BetterGenshinImpact.View.Drawable;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask
|
||||
@@ -22,7 +23,7 @@ namespace BetterGenshinImpact.GameTask
|
||||
{
|
||||
TriggerDictionary = new Dictionary<string, ITaskTrigger>()
|
||||
{
|
||||
{ "RecognitionTest", new RecognitionTest.TestTrigger() },
|
||||
{ "RecognitionTest", new TestTrigger() },
|
||||
{ "AutoPick", new AutoPick.AutoPickTrigger() },
|
||||
{ "AutoSkip", new AutoSkip.AutoSkipTrigger() },
|
||||
{ "AutoFishing", new AutoFishing.AutoFishingTrigger() }
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask.AutoFishing.Assets;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.Placeholder;
|
||||
|
||||
/// <summary>
|
||||
/// 一个用于开发测试的识别、或者全局占位触发器
|
||||
/// 这个触发器启动的时候,直接独占
|
||||
/// </summary>
|
||||
public class TestTrigger : ITaskTrigger
|
||||
{
|
||||
public string Name => "自定义占位触发器";
|
||||
public bool IsEnabled { get; set; }
|
||||
public int Priority => 9999;
|
||||
public bool IsExclusive { get; private set; }
|
||||
|
||||
private readonly RecognitionObject _optionButtonRo;
|
||||
|
||||
private readonly AutoFishingAssets _autoFishingAssets;
|
||||
|
||||
public TestTrigger()
|
||||
{
|
||||
var info = TaskContext.Instance().SystemInfo;
|
||||
_optionButtonRo = new RecognitionObject
|
||||
{
|
||||
Name = "OptionButton",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssertImage("AutoSkip", "option.png"),
|
||||
DrawOnWindow = true
|
||||
}.InitTemplate();
|
||||
_autoFishingAssets = new AutoFishingAssets();
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
IsEnabled = false;
|
||||
IsExclusive = true;
|
||||
}
|
||||
|
||||
public void OnCapture(CaptureContent content)
|
||||
{
|
||||
//content.CaptureRectArea.Find(_optionButtonRo, (optionButtonRectArea) =>
|
||||
//{
|
||||
//});
|
||||
|
||||
//content.CaptureRectArea.Find(_autoFishingAssets.BaitButtonRo, (rectArea) =>
|
||||
//{
|
||||
//});
|
||||
|
||||
//content.CaptureRectArea.Find(_autoFishingAssets.WaitBiteButtonRo, (rectArea) =>
|
||||
//{
|
||||
//});
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask.AutoSkip.Assets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenCvSharp;
|
||||
using BetterGenshinImpact.GameTask.AutoFishing.Assets;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.RecognitionTest
|
||||
{
|
||||
public class TestTrigger : ITaskTrigger
|
||||
{
|
||||
public string Name => "开发测试识别触发器";
|
||||
public bool IsEnabled { get; set; }
|
||||
public int Priority => 9999;
|
||||
public bool IsExclusive { get; private set; }
|
||||
|
||||
private readonly RecognitionObject _optionButtonRo;
|
||||
|
||||
private readonly AutoFishingAssets _autoFishingAssets;
|
||||
|
||||
public TestTrigger()
|
||||
{
|
||||
var info = TaskContext.Instance().SystemInfo;
|
||||
_optionButtonRo = new RecognitionObject
|
||||
{
|
||||
Name = "OptionButton",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssertImage("AutoSkip", "option.png"),
|
||||
DrawOnWindow = true
|
||||
}.InitTemplate();
|
||||
_autoFishingAssets = new AutoFishingAssets();
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
IsEnabled = false;
|
||||
IsExclusive = false;
|
||||
}
|
||||
|
||||
public void OnCapture(CaptureContent content)
|
||||
{
|
||||
//content.CaptureRectArea.Find(_optionButtonRo, (optionButtonRectArea) =>
|
||||
//{
|
||||
//});
|
||||
|
||||
content.CaptureRectArea.Find(_autoFishingAssets.BaitButtonRo, (rectArea) =>
|
||||
{
|
||||
});
|
||||
|
||||
content.CaptureRectArea.Find(_autoFishingAssets.WaitBiteButtonRo, (rectArea) =>
|
||||
{
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
14
BetterGenshinImpact/View/Pages/TaskSettingsPage.xaml
Normal file
14
BetterGenshinImpact/View/Pages/TaskSettingsPage.xaml
Normal file
@@ -0,0 +1,14 @@
|
||||
<Page x:Class="BetterGenshinImpact.View.Pages.TaskSettingsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:BetterGenshinImpact.View.Pages"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="850" d:DesignWidth="600"
|
||||
Title="TaskSettingsPage">
|
||||
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Page>
|
||||
28
BetterGenshinImpact/View/Pages/TaskSettingsPage.xaml.cs
Normal file
28
BetterGenshinImpact/View/Pages/TaskSettingsPage.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace BetterGenshinImpact.View.Pages
|
||||
{
|
||||
/// <summary>
|
||||
/// TaskSettingsPage.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class TaskSettingsPage : Page
|
||||
{
|
||||
public TaskSettingsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
<ui:TextBlock
|
||||
Margin="0,0,0,8"
|
||||
FontTypography="BodyStrong"
|
||||
Text="自动化任务设置" />
|
||||
Text="实时自动化任务设置" />
|
||||
<ui:CardExpander Margin="0,0,0,12" ContentPadding="0" Icon="{ui:SymbolIcon HandWave24}">
|
||||
<ui:CardExpander.Header>
|
||||
<Grid>
|
||||
|
||||
Reference in New Issue
Block a user