Compare commits

...
23 Commits
Author SHA1 Message Date
辉鸭蛋 fe2fd5d67c fix merge 2024-05-28 18:02:56 +08:00
辉鸭蛋 08fbd6e2a2 +main 2024-05-28 10:28:16 +08:00
辉鸭蛋 e1f3b01eb1 add icon in mask window 2024-05-28 01:20:59 +08:00
辉鸭蛋 0973ca0887 use new icon 2024-05-28 01:08:42 +08:00
ema be4039a77a Update TriggerSettingsPage.xaml 2024-05-27 23:33:28 +08:00
ema 684fac7d29 fix style about CardExpander 2024-05-27 23:04:55 +08:00
辉鸭蛋 5c6a96957e add new icon font 2024-05-27 22:28:32 +08:00
ema 56477f3490 use font in mask window 2024-05-26 21:23:22 +08:00
辉鸭蛋 95757a5ed6 test PostMessage 2024-05-26 19:14:44 +08:00
ema c4eae50716 fix: hide mask window from Alt+Tab 2024-05-26 19:10:10 +08:00
ema 6da76f4ef7 Update README.md 2024-05-26 18:09:40 +08:00
辉鸭蛋 443f79bde3 Update README.md 2024-05-26 09:29:33 +08:00
辉鸭蛋 57e24c8e33 update readme 2024-05-25 20:10:02 +08:00
辉鸭蛋 edff49c9cb fix #394 2024-05-25 11:15:36 +08:00
辉鸭蛋 594b517936 0.30.2 2024-05-25 11:00:56 +08:00
辉鸭蛋 5f35d483c2 remove system version judgment #394 2024-05-25 11:00:30 +08:00
辉鸭蛋 b8e5c179fc fix the performance of mask windows at different resolutions - 0.30.1 2024-05-24 12:13:51 +08:00
辉鸭蛋 36dcbebdfa add GPU title flag 2024-04-06 12:00:14 +08:00
辉鸭蛋 ed63a68ee5 add switch inference device UI 2024-04-06 11:57:19 +08:00
辉鸭蛋 f14d4a4d10 Merge branch 'main' into feat-gpu 2024-04-06 11:25:04 +08:00
辉鸭蛋 d69242f7c2 edit onnx version 2024-04-06 11:23:14 +08:00
辉鸭蛋 034d695bf8 all use gpu 2024-04-06 02:43:43 +08:00
辉鸭蛋 4b41fdcecc test gpu 2024-04-06 00:26:55 +08:00
27 changed files with 250 additions and 63 deletions

No files matched your search

+1
View File
@@ -8,6 +8,7 @@
<ResourceDictionary.MergedDictionaries>
<ui:ThemesDictionary Theme="Dark" />
<ui:ControlsDictionary />
<ResourceDictionary Source="/View/Controls/WpfUi/FaFontIconStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<FontFamily x:Key="TextThemeFontFamily">/Assets/Fonts/MiSans-Regular.ttf#MiSans</FontFamily>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
+7
View File
@@ -57,6 +57,7 @@ public partial class App : Application
{
loggerConfiguration.WriteTo.RichTextBox(maskWindow.LogBox, LogEventLevel.Information, outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}");
}
Log.Logger = loggerConfiguration.CreateLogger();
services.AddLogging(c => c.AddSerilog());
@@ -227,8 +228,14 @@ public partial class App : Application
private static void HandleException(Exception e)
{
if (e.InnerException != null)
{
e = e.InnerException;
}
MessageBox.Show("程序异常:" + e.Source + "\r\n--" + Environment.NewLine + e.StackTrace + "\r\n---" + Environment.NewLine + e.Message);
// log
GetLogger<App>().LogDebug(e, "UnHandle Exception");
}
}
Binary file not shown.
@@ -35,7 +35,7 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.17.1" />
<PackageReference Include="Microsoft.ML.OnnxRuntime.Gpu" Version="1.17.1" />
<PackageReference Include="Microsoft.ML.OnnxRuntime.Managed" Version="1.17.1" />
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.8.0.20230708" />
@@ -43,6 +43,7 @@
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.77" />
<PackageReference Include="MouseKeyHook" Version="5.7.1" />
<PackageReference Include="Sdcb.PaddleInference" Version="2.5.0.1" />
<PackageReference Include="Sdcb.PaddleInference.runtime.win64.cuda118_cudnn86_tr85_sm86_89" Version="2.5.1" />
<PackageReference Include="Sdcb.PaddleInference.runtime.win64.openblas" Version="2.5.1" />
<PackageReference Include="Sdcb.PaddleOCR" Version="2.7.0" />
<PackageReference Include="Sdcb.PaddleOCR.Models.Online" Version="2.7.0.1" />
@@ -54,7 +55,7 @@
<PackageReference Include="Vanara.PInvoke.User32" Version="3.4.17" />
<PackageReference Include="WPF-UI" Version="3.0.0-preview.7" />
<PackageReference Include="WPF-UI.Tray" Version="3.0.0-preview.7" />
<PackageReference Include="YoloV8" Version="2.0.1" />
<PackageReference Include="YoloV8.Gpu" Version="2.0.1" />
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Debug'">
@@ -592,6 +593,7 @@
<ItemGroup>
<Folder Include="GameTask\Common\Element\Assets\MapPoint\" />
<Folder Include="View\Controls\WpfUi\" />
</ItemGroup>
</Project>
+6 -5
View File
@@ -41,11 +41,6 @@ public partial class AllConfig : ObservableObject
[ObservableProperty]
private string _notShowNewVersionNoticeEndVersion = "";
///// <summary>
///// 窗口捕获帧数/触发器触发频率
///// </summary>
//[ObservableProperty] private int _frameRate = 30;
/// <summary>
/// 触发器触发频率(ms)
/// </summary>
@@ -60,6 +55,12 @@ public partial class AllConfig : ObservableObject
[ObservableProperty]
private bool _wgcUseBitmapCache = true;
/// <summary>
/// 推理使用的设备
/// </summary>
[ObservableProperty]
private string _inferenceDevice = "CPU";
/// <summary>
/// 遮罩窗口配置
/// </summary>
+1 -1
View File
@@ -5,7 +5,7 @@ namespace BetterGenshinImpact.Core.Config;
public class Global
{
public static string Version { get; } = "0.30.0";
public static string Version { get; } = "0.30.2";
public static string StartUpPath { get; set; } = AppContext.BaseDirectory;
@@ -155,4 +155,11 @@ public partial class HotKeyConfig : ObservableObject
[ObservableProperty]
private string _autoTrackPathHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
// 测试
[ObservableProperty]
private string _test1Hotkey = "";
[ObservableProperty]
private string _test1HotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
}
@@ -69,6 +69,11 @@ public partial class MaskWindowConfig : ObservableObject
/// </summary>
public Rect UidCoverRect { get; set; } = new(1690, 1052, 173, 22);
/// <summary>
/// 1080p下UID遮盖的位置与大小
/// </summary>
public Rect UidCoverRightBottomRect { get; set; } = new(1920 - 1690, 1080 - 1052, 173, 22);
public Point EastPoint { get; set; } = new(274, 109);
public Point SouthPoint { get; set; } = new(150, 233);
public Point WestPoint { get; set; } = new(32, 109);
@@ -4,8 +4,10 @@ using Sdcb.PaddleInference;
using Sdcb.PaddleOCR;
using Sdcb.PaddleOCR.Models;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using BetterGenshinImpact.GameTask;
namespace BetterGenshinImpact.Core.Recognition.OCR;
@@ -28,7 +30,13 @@ public class PaddleOcrService : IOcrService
var localClsModel = ClassificationModel.FromDirectory(Path.Combine(path, "ch_ppocr_mobile_v2.0_cls"));
var localRecModel = RecognizationModel.FromDirectory(Path.Combine(path, "ch_PP-OCRv4_rec"), Path.Combine(path, "ppocr_keys_v1.txt"), ModelVersion.V4);
var model = new FullOcrModel(localDetModel, localClsModel, localRecModel);
_paddleOcrAll = new PaddleOcrAll(model, PaddleDevice.Onnx())
Action<PaddleConfig> device = TaskContext.Instance().Config.InferenceDevice switch
{
"CPU" => PaddleDevice.Onnx(),
"GPU" => PaddleDevice.Gpu(),
_ => throw new InvalidEnumArgumentException("无效的推理设备")
};
_paddleOcrAll = new PaddleOcrAll(model, device)
{
AllowRotateDetection = false, /* 允许识别有角度的文字 */
Enable180Classification = false /* 允许识别旋转角度大于90度的文字 */
@@ -0,0 +1,16 @@
using BetterGenshinImpact.GameTask;
using BetterGenshinImpact.Model;
using Microsoft.ML.OnnxRuntime;
using System.ComponentModel;
namespace BetterGenshinImpact.Core.Recognition.ONNX;
public class BgiSessionOption : Singleton<BgiSessionOption>
{
public SessionOptions Options { get; set; } = TaskContext.Instance().Config.InferenceDevice switch
{
"CPU" => new SessionOptions(),
"GPU" => SessionOptions.MakeSessionOptionWithCudaProvider(),
_ => throw new InvalidEnumArgumentException("无效的推理设备")
};
}
@@ -1,10 +1,12 @@
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.GameTask;
using Microsoft.ML.OnnxRuntime;
using Microsoft.ML.OnnxRuntime.Tensors;
using OpenCvSharp;
using System;
using System.Buffers;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
@@ -25,11 +27,10 @@ public class PickTextInference : ITextInference
public PickTextInference()
{
var options = new SessionOptions();
var modelPath = Global.Absolute("Assets\\Model\\Yap\\model_training.onnx");
if (!File.Exists(modelPath)) throw new FileNotFoundException("Yap模型文件不存在", modelPath);
_session = new InferenceSession(modelPath, options);
_session = new InferenceSession(modelPath, BgiSessionOption.Instance.Options);
var wordJsonPath = Global.Absolute("Assets\\Model\\Yap\\index_2_word.json");
if (!File.Exists(wordJsonPath)) throw new FileNotFoundException("Yap字典文件不存在", wordJsonPath);
@@ -39,6 +39,23 @@ public class PostMessageSimulator
return this;
}
/// <summary>
/// 指定位置并按下左键
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public PostMessageSimulator LeftButtonClickBackground(int x, int y)
{
User32.PostMessage(_hWnd, User32.WindowMessage.WM_ACTIVATE, 1, 0);
var p = MakeLParam(x, y);
User32.PostMessage(_hWnd, WM_LBUTTONDOWN, 1, p);
Thread.Sleep(100);
User32.PostMessage(_hWnd, WM_LBUTTONUP, 0, p);
return this;
}
public static int MakeLParam(int x, int y) => (y << 16) | (x & 0xFFFF);
public PostMessageSimulator LeftButtonClick()
{
IntPtr p = (16 << 16) | 16;
@@ -25,7 +25,7 @@ public class AutoCookTrigger : ITaskTrigger
{
// 判断是否处于烹饪界面
IsExclusive = false;
content.CaptureRectArea.Find(ElementAssets.Instance.UiLeftTopCookIcon, foundRectArea =>
content.CaptureRectArea.Find(ElementAssets.Instance.UiLeftTopCookIcon, _ =>
{
IsExclusive = true;
var captureRect = TaskContext.Instance().SystemInfo.ScaleMax1080PCaptureRect;
@@ -1,5 +1,6 @@
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.Core.Recognition.OCR;
using BetterGenshinImpact.Core.Recognition.ONNX;
using BetterGenshinImpact.Core.Simulator;
using BetterGenshinImpact.GameTask.AutoFight;
using BetterGenshinImpact.GameTask.AutoFight.Assets;
@@ -36,7 +37,7 @@ public class AutoDomainTask
private readonly PostMessageSimulator _simulator;
private readonly YoloV8 _predictor = new(Global.Absolute("Assets\\Model\\Domain\\bgi_tree.onnx"));
private readonly YoloV8 _predictor;
private readonly AutoDomainConfig _config;
@@ -47,7 +48,7 @@ public class AutoDomainTask
_taskParam = taskParam;
_simulator = AutoFightContext.Instance.Simulator;
_config = TaskContext.Instance().Config.AutoDomainConfig;
_predictor = new(Global.Absolute("Assets\\Model\\Domain\\bgi_tree.onnx"), BgiSessionOption.Instance.Options);
_combatScriptBag = CombatScriptParser.ReadAndParse(_taskParam.CombatStrategyPath);
}
@@ -1,6 +1,7 @@
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.Core.Recognition;
using BetterGenshinImpact.Core.Recognition.OCR;
using BetterGenshinImpact.Core.Recognition.ONNX;
using BetterGenshinImpact.Core.Recognition.OpenCv;
using BetterGenshinImpact.Core.Simulator;
using BetterGenshinImpact.GameTask.AutoFishing.Assets;
@@ -35,7 +36,7 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
{
private readonly ILogger<AutoFishingTrigger> _logger = App.GetLogger<AutoFishingTrigger>();
private readonly IOcrService _ocrService = OcrFactory.Paddle;
private readonly YoloV8 _predictor = new(Global.Absolute("Assets\\Model\\Fish\\bgi_fish.onnx"));
private readonly YoloV8 _predictor = new(Global.Absolute("Assets\\Model\\Fish\\bgi_fish.onnx"), BgiSessionOption.Instance.Options);
public string Name => "自动钓鱼";
public bool IsEnabled { get; set; }
+6 -2
View File
@@ -16,13 +16,17 @@ internal static class RuntimeHelper
public static bool IsElevated { get; } = GetElevated();
public static bool IsDebuggerAttached => Debugger.IsAttached;
public static bool IsDesignMode { get; } = GetDesignMode();
public static bool IsDebug =>
#if DEBUG
true;
#else
false;
#endif
public static bool IsGpuPackage => true;
private static bool GetElevated()
{
using WindowsIdentity identity = WindowsIdentity.GetCurrent();
@@ -81,9 +85,9 @@ internal static class RuntimeHelper
catch (Exception ex)
{
Debug.WriteLine(ex);
MessageBox.Show("以管理员权限启动 BetterGI 失败,非管理员权限下所有模拟操作功能均不可用!\r\n请尝试 右键 —— 以管理员身份运行 的方式启动 BetterGI",
MessageBox.Show("以管理员权限启动 BetterGI 失败,非管理员权限下所有模拟操作功能均不可用!\r\n请尝试 右键 —— 以管理员身份运行 的方式启动 BetterGI",
"警告", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
return;
}
}
catch (Win32Exception)
@@ -0,0 +1,15 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
<FontFamily x:Key="FgiIconFontFamily">/Assets/Fonts/#FgiRegular</FontFamily>
<Style x:Key="FaFontIconStyle" TargetType="ui:FontIcon">
<Setter Property="Width" Value="32" />
<Setter Property="Margin" Value="0,0,-8,0" />
<Setter Property="FontFamily" Value="{StaticResource FgiIconFontFamily}" />
<Setter Property="RenderTransform">
<Setter.Value>
<ScaleTransform ScaleX="0.79167" ScaleY="0.79167" />
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
+5 -2
View File
@@ -64,9 +64,10 @@
Height="188"
Style="{StaticResource OuterDraggableResizableItemStyle}">
<RichTextBox x:Name="LogTextBox"
Padding="0,5,0,0"
Background="Transparent"
BorderThickness="0"
FontFamily="Cascadia Mono, Consolas, Courier New, monospace"
FontFamily="Cascadia Mono, Consolas, Courier New, monospace, /Assets/Fonts/MiSans-Regular.ttf#MiSans"
FontSize="12"
Foreground="LightGray"
IsHitTestVisible="False"
@@ -101,7 +102,9 @@
<Setter Property="Margin" Value="0,0,8,0" />
</Style>
</StackPanel.Resources>
<TextBlock FontSize="12" Text="{Binding Name}">
<TextBlock FontFamily="{StaticResource FgiIconFontFamily}"
FontSize="12"
Text="{Binding Name}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="LightGray" />
+26 -3
View File
@@ -28,10 +28,19 @@ public partial class MaskWindow : Window
{
private static MaskWindow? _maskWindow;
private static readonly Typeface MyTypeface = new FontFamily("Microsoft Yahei UI").GetTypefaces().First();
private static readonly Typeface _typeface;
static MaskWindow()
{
if (Application.Current.TryFindResource("TextThemeFontFamily") is FontFamily fontFamily)
{
_typeface = fontFamily.GetTypefaces().First();
}
else
{
_typeface = new FontFamily("Microsoft Yahei UI").GetTypefaces().First();
}
DefaultStyleKeyProperty.OverrideMetadata(typeof(MaskWindow), new FrameworkPropertyMetadata(typeof(MaskWindow)));
}
@@ -97,6 +106,7 @@ public partial class MaskWindow : Window
{
base.OnSourceInitialized(e);
this.SetLayeredWindow();
this.HideFromAltTab();
}
private void LogTextBoxTextChanged(object sender, TextChangedEventArgs e)
@@ -166,7 +176,7 @@ public partial class MaskWindow : Window
drawingContext.DrawText(new FormattedText(drawable.Text,
CultureInfo.GetCultureInfo("zh-cn"),
FlowDirection.LeftToRight,
MyTypeface,
_typeface,
36, Brushes.Black, 1), drawable.Point);
}
}
@@ -185,6 +195,19 @@ public partial class MaskWindow : Window
file static class MaskWindowExtension
{
public static void HideFromAltTab(this Window window)
{
HideFromAltTab(new WindowInteropHelper(window).Handle);
}
public static void HideFromAltTab(nint hWnd)
{
int style = User32.GetWindowLong(hWnd, User32.WindowLongFlags.GWL_EXSTYLE);
style |= (int)User32.WindowStylesEx.WS_EX_TOOLWINDOW;
User32.SetWindowLong(hWnd, User32.WindowLongFlags.GWL_EXSTYLE, style);
}
public static void SetLayeredWindow(this Window window, bool isLayered = true)
{
SetLayeredWindow(new WindowInteropHelper(window).Handle, isLayered);
@@ -207,4 +230,4 @@ file static class MaskWindowExtension
_ = User32.SetWindowLong(hWnd, User32.WindowLongFlags.GWL_EXSTYLE, style);
}
}
}
@@ -194,6 +194,33 @@
IsChecked="{Binding Config.WgcUseBitmapCache, Mode=TwoWay}" />
</Grid>
<Separator Margin="-18,0" BorderThickness="0,1,0,0" />
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ui:TextBlock Grid.Row="0"
Grid.Column="0"
FontTypography="Body"
Text="切换AI推理设备"
TextWrapping="Wrap" />
<ui:TextBlock Grid.Row="1"
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
Text="GPU推理需要安装CUDA,切换后需要重启程序"
TextWrapping="Wrap" />
<ComboBox Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
Margin="0,0,36,0"
ItemsSource="{Binding InferenceDevices}"
SelectedItem="{Binding Config.InferenceDevice, Mode=TwoWay}" />
</Grid>
<Separator Margin="-18,0" BorderThickness="0,1,0,0" />
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -81,9 +81,10 @@
<ui:TextBlock Margin="0,0,0,8"
FontTypography="BodyStrong"
Text="独立任务设置" />
<ui:CardExpander Margin="0,0,0,12"
ContentPadding="0"
Icon="{ui:SymbolIcon PlayingCards20}">
<ui:CardExpander Margin="0,0,0,12" ContentPadding="0">
<ui:CardExpander.Icon>
<ui:FontIcon Glyph="&#xf6d2;" Style="{StaticResource FaFontIconStyle}" />
</ui:CardExpander.Icon>
<ui:CardExpander.Header>
<Grid>
<Grid.RowDefinitions>
@@ -180,9 +181,10 @@
</StackPanel>
</ui:CardExpander>
<ui:CardExpander Margin="0,0,0,12"
ContentPadding="0"
Icon="{ui:SymbolIcon LeafThree24}">
<ui:CardExpander Margin="0,0,0,12" ContentPadding="0">
<ui:CardExpander.Icon>
<ui:FontIcon Glyph="&#xf6b2;" Style="{StaticResource FaFontIconStyle}" />
</ui:CardExpander.Icon>
<ui:CardExpander.Header>
<Grid>
<Grid.RowDefinitions>
@@ -346,9 +348,11 @@
</StackPanel>
</ui:CardExpander>
<ui:CardExpander Margin="0,0,0,12"
ContentPadding="0"
Icon="{ui:SymbolIcon ArrowSyncCircle24}">
<!-- 自动战斗 -->
<ui:CardExpander Margin="0,0,0,12" ContentPadding="0">
<ui:CardExpander.Icon>
<ui:FontIcon Glyph="&#xf71d;" Style="{StaticResource FaFontIconStyle}" />
</ui:CardExpander.Icon>
<ui:CardExpander.Header>
<Grid>
<Grid.RowDefinitions>
@@ -445,9 +449,11 @@
</StackPanel>
</ui:CardExpander>
<ui:CardExpander Margin="0,0,0,12"
ContentPadding="0"
Icon="{ui:SymbolIcon BuildingBankToolbox24}">
<!-- 自动刷本 -->
<ui:CardExpander Margin="0,0,0,12" ContentPadding="0">
<ui:CardExpander.Icon>
<ui:FontIcon Glyph="&#xf438;" Style="{StaticResource FaFontIconStyle}" />
</ui:CardExpander.Icon>
<ui:CardExpander.Header>
<Grid>
<Grid.RowDefinitions>
@@ -674,9 +680,13 @@
<ui:CardExpander Margin="0,0,0,12"
ContentPadding="0"
Icon="{ui:SymbolIcon PeopleQueue24}"
Visibility="{markup:Converter Value={x:Static helpers:RuntimeHelper.IsDebuggerAttached},
Converter={StaticResource BooleanToVisibilityConverter}}">
<ui:CardExpander.Icon>
<ui:FontIcon Glyph="&#xf54b;" Style="{StaticResource FaFontIconStyle}" />
</ui:CardExpander.Icon>
<ui:CardExpander.Header>
<Grid>
<Grid.RowDefinitions>
@@ -740,7 +750,11 @@
</StackPanel>
</ui:CardExpander>
<ui:CardControl Margin="0,0,0,12" Icon="{ui:SymbolIcon MusicNote224}">
<!-- 活动音游(限时,已失效) -->
<ui:CardControl Margin="0,0,0,12"
Icon="{ui:SymbolIcon MusicNote224}"
Visibility="{markup:Converter Value={x:Static helpers:RuntimeHelper.IsDebuggerAttached},
Converter={StaticResource BooleanToVisibilityConverter}}">
<ui:CardControl.Header>
<Grid>
<Grid.RowDefinitions>
@@ -750,7 +764,7 @@
<ui:TextBlock Grid.Row="0"
Grid.Column="0"
FontTypography="Body"
Text="活动音游(限时)"
Text="活动音游(限时,已失效)"
TextWrapping="Wrap" />
<ui:TextBlock Grid.Row="1"
Grid.Column="0"
@@ -2,9 +2,9 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BetterGenshinImpact.View.Pages"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="clr-namespace:BetterGenshinImpact.ViewModel.Pages"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="HomePage"
d:DataContext="{d:DesignInstance Type=pages:TriggerSettingsPageViewModel}"
@@ -15,7 +15,9 @@
FontFamily="{StaticResource TextThemeFontFamily}"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
mc:Ignorable="d">
<StackPanel Margin="42,16,42,12">
<ui:TextBlock Margin="0,0,0,8"
FontTypography="BodyStrong"
Text="实时触发的自动化任务设置" />
@@ -161,9 +163,10 @@
</ui:CardExpander>
<!-- 自动剧情 -->
<ui:CardExpander Margin="0,0,0,12"
ContentPadding="0"
Icon="{ui:SymbolIcon PlayCircle24}">
<ui:CardExpander Margin="0,0,0,12" ContentPadding="0">
<ui:CardExpander.Icon>
<ui:FontIcon Glyph="&#xf075;" Style="{StaticResource FaFontIconStyle}" />
</ui:CardExpander.Icon>
<ui:CardExpander.Header>
<Grid>
<Grid.RowDefinitions>
@@ -332,9 +335,10 @@
<!-- 自动邀约 -->
<ui:CardExpander Margin="0,0,0,12"
ContentPadding="0"
Icon="{ui:SymbolIcon CommentMultiple24}">
<ui:CardExpander Margin="0,0,0,12" ContentPadding="0">
<ui:CardExpander.Icon>
<ui:FontIcon Glyph="&#xe5c8;" Style="{StaticResource FaFontIconStyle}" />
</ui:CardExpander.Icon>
<ui:CardExpander.Header>
<Grid>
<Grid.RowDefinitions>
@@ -483,9 +487,10 @@
</ui:CardExpander>
<!-- 快速传送 -->
<ui:CardExpander Margin="0,0,0,12"
ContentPadding="0"
Icon="{ui:SymbolIcon DoorArrowLeft24}">
<ui:CardExpander Margin="0,0,0,12" ContentPadding="0">
<ui:CardExpander.Icon>
<ui:FontIcon Glyph="&#xf3c5;" Style="{StaticResource FaFontIconStyle}" />
</ui:CardExpander.Icon>
<ui:CardExpander.Header>
<Grid>
<Grid.RowDefinitions>
@@ -598,7 +603,10 @@
</ui:CardExpander>
<!-- 自动烹饪 -->
<ui:CardControl Margin="0,0,0,12" Icon="{ui:SymbolIcon Fireplace24}">
<ui:CardControl Margin="0,0,0,12">
<ui:CardControl.Icon>
<ui:FontIcon Glyph="&#xe43f;" Style="{StaticResource FaFontIconStyle}" />
</ui:CardControl.Icon>
<ui:CardControl.Header>
<Grid>
<Grid.RowDefinitions>
@@ -23,7 +23,7 @@ public partial class MainWindowViewModel : ObservableObject, IViewModel
{
private readonly ILogger<MainWindowViewModel> _logger;
private readonly IConfigService _configService;
public string Title => $"BetterGI · 更好的原神 · {Global.Version}{(RuntimeHelper.IsDebug ? " · Dev" : string.Empty)}";
public string Title => $"BetterGI · 更好的原神 · {Global.Version}{(RuntimeHelper.IsDebug ? " · Dev" : string.Empty)}{(RuntimeHelper.IsGpuPackage ? " · GPU" : string.Empty)}";
[ObservableProperty]
public bool _isVisible = true;
@@ -30,7 +30,6 @@ namespace BetterGenshinImpact.ViewModel
[ObservableProperty] private Point _westPoint = new(32, 109);
[ObservableProperty] private Point _northPoint = new(150, -9);
public MaskWindowViewModel()
{
WeakReferenceMessenger.Default.Register<PropertyChangedMessage<object>>(this, (sender, msg) =>
@@ -74,11 +73,11 @@ namespace BetterGenshinImpact.ViewModel
{
if (Config != null)
{
StatusList.Add(new StatusItem("自动拾取", Config.AutoPickConfig));
StatusList.Add(new StatusItem("自动剧情", Config.AutoSkipConfig));
StatusList.Add(new StatusItem("自动邀约", Config.AutoSkipConfig, "AutoHangoutEventEnabled"));
StatusList.Add(new StatusItem("自动钓鱼", Config.AutoFishingConfig));
StatusList.Add(new StatusItem("快速传送", Config.QuickTeleportConfig));
StatusList.Add(new StatusItem("\uf256 拾取", Config.AutoPickConfig));
StatusList.Add(new StatusItem("\uf075 剧情", Config.AutoSkipConfig));
StatusList.Add(new StatusItem("\ue5c8 邀约", Config.AutoSkipConfig, "AutoHangoutEventEnabled"));
StatusList.Add(new StatusItem("\uf578 钓鱼", Config.AutoFishingConfig));
StatusList.Add(new StatusItem("\uf3c5 传送", Config.QuickTeleportConfig));
}
}
@@ -98,12 +97,13 @@ namespace BetterGenshinImpact.ViewModel
// 比较特殊,必须要启动过任务调度器才能够获取到缩放信息
if (TaskContext.Instance().SystemInfo != null)
{
var assetScale = TaskContext.Instance().SystemInfo.AssetScale;
var captureRect = TaskContext.Instance().SystemInfo.CaptureAreaRect;
var assetScale = TaskContext.Instance().SystemInfo.ScaleTo1080PRatio;
var dpiScale = TaskContext.Instance().DpiScale;
UidCoverRect = new Rect(Config.MaskWindowConfig.UidCoverRect.X * assetScale / dpiScale,
Config.MaskWindowConfig.UidCoverRect.Y * assetScale / dpiScale,
Config.MaskWindowConfig.UidCoverRect.Width * assetScale / dpiScale,
Config.MaskWindowConfig.UidCoverRect.Height * assetScale / dpiScale);
UidCoverRect = new Rect((captureRect.Width - Config.MaskWindowConfig.UidCoverRightBottomRect.X * assetScale) / dpiScale,
(captureRect.Height - Config.MaskWindowConfig.UidCoverRightBottomRect.Y * assetScale) / dpiScale,
Config.MaskWindowConfig.UidCoverRightBottomRect.Width * assetScale / dpiScale,
Config.MaskWindowConfig.UidCoverRightBottomRect.Height * assetScale / dpiScale);
EastPoint = new Point(Config.MaskWindowConfig.EastPoint.X * assetScale / dpiScale,
Config.MaskWindowConfig.EastPoint.Y * assetScale / dpiScale);
SouthPoint = new Point(Config.MaskWindowConfig.SouthPoint.X * assetScale / dpiScale,
@@ -131,4 +131,4 @@ namespace BetterGenshinImpact.ViewModel
}
}
}
}
}
@@ -48,6 +48,8 @@ public partial class HomePageViewModel : ObservableObject, INavigationAware, IVi
// 记录上次使用原神的句柄
private IntPtr _hWnd;
[ObservableProperty] private string[] _inferenceDevices = ["CPU", "GPU"];
public HomePageViewModel(IConfigService configService, TaskTriggerDispatcher taskTriggerDispatcher)
{
_taskDispatcher = taskTriggerDispatcher;
@@ -56,7 +58,7 @@ public partial class HomePageViewModel : ObservableObject, INavigationAware, IVi
// WindowsGraphicsCapture 只支持 Win10 18362 及以上的版本 (Windows 10 version 1903 or later)
// https://github.com/babalae/better-genshin-impact/issues/394
if (OsVersionHelper.IsWindows10_1903_OrGreater)
if (!OsVersionHelper.IsWindows10_1903_OrGreater)
{
_modeNames = _modeNames.Where(x => x != CaptureModes.WindowsGraphicsCapture.ToString()).ToArray();
}
@@ -7,6 +7,7 @@ using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Reflection;
using System.Threading;
using BetterGenshinImpact.Core.Simulator;
using BetterGenshinImpact.GameTask.AutoFight;
using BetterGenshinImpact.GameTask.AutoTrackPath;
using BetterGenshinImpact.GameTask.Common;
@@ -20,6 +21,7 @@ using BetterGenshinImpact.GameTask.QucikBuy;
using BetterGenshinImpact.GameTask.QuickSereniteaPot;
using BetterGenshinImpact.Helpers;
using BetterGenshinImpact.Model;
using Vanara.PInvoke;
namespace BetterGenshinImpact.ViewModel.Pages;
@@ -357,6 +359,23 @@ public partial class HotKeyPageViewModel : ObservableObject, IViewModel
Config.HotKeyConfig.AutoTrackPathHotkeyType,
(_, _) => { _taskSettingsPageViewModel.OnSwitchAutoTrackPath(); }
));
PostMessageSimulator? postMessageSimulator = null;
HotKeySettingModels.Add(new HotKeySettingModel(
"(测试)按键模拟测试",
nameof(Config.HotKeyConfig.Test1Hotkey),
Config.HotKeyConfig.Test1Hotkey,
Config.HotKeyConfig.Test1HotkeyType,
(_, _) =>
{
if (postMessageSimulator == null)
{
postMessageSimulator = Simulation.PostMessage(TaskContext.Instance().GameHandle);
}
// postMessageSimulator.KeyPressBackground(User32.VK.VK_W);
postMessageSimulator.LeftButtonClickBackground(1340, 655);
}
));
}
}
+6 -1
View File
@@ -26,6 +26,7 @@ BetterGI · 更好的原神, 一个基于计算机视觉技术,意图让原
* 与凯瑟琳对话时有橙色选项会 [自动领取「每日委托」奖励](https://bgi.huiyadan.com/doc.html#%E8%87%AA%E5%8A%A8%E9%A2%86%E5%8F%96%E3%80%8E%E6%AF%8F%E6%97%A5%E5%A7%94%E6%89%98%E3%80%8F%E5%A5%96%E5%8A%B1)、[自动重新派遣](https://bgi.huiyadan.com/doc.html#%E8%87%AA%E5%8A%A8%E9%87%8D%E6%96%B0%E6%B4%BE%E9%81%A3)
* [自动邀约](https://bgi.huiyadan.com/doc.html#%E8%87%AA%E5%8A%A8%E9%82%80%E7%BA%A6):自动剧情开启的情况下此功能才会生效,自动选择邀约选项
* [全自动钓鱼](https://bgi.huiyadan.com/doc.html#%E5%85%A8%E8%87%AA%E5%8A%A8%E9%92%93%E9%B1%BC):AI 识别自动抛竿,鱼上钩时自动收杆,并自动完成钓鱼进度
* [自动烹饪](https://bgi.huiyadan.com/doc.html#%E8%87%AA%E5%8A%A8%E7%83%B9%E9%A5%AA):自动在完美区域完成食物烹饪,暂不支持“仙跳墙”
* [全自动七圣召唤](https://bgi.huiyadan.com/doc.html#%E8%87%AA%E5%8A%A8%E4%B8%83%E5%9C%A3%E5%8F%AC%E5%94%A4):帮助你轻松完成七圣召唤角色邀请、每周来客挑战等 PVE 内容
* [自动伐木](http://bgi.huiyadan.com/doc.html#%E8%87%AA%E5%8A%A8%E4%BC%90%E6%9C%A8):自动 <kbd>Z</kbd> 键使用「王树瑞佑」,利用上下线可以刷新木材的原理,挂机刷满一背包的木材
* [自动战斗](http://bgi.huiyadan.com/feats/domain.html):编写战斗脚本,让队伍按照你的策略进行自动战斗
@@ -98,6 +99,10 @@ BetterGI · 更好的原神, 一个基于计算机视觉技术,意图让原
格式化:[CodeMaid.config](CodeMaid.config)、[Settings.XamlStyler](Settings.XamlStyler);
## 许可证
![GPL-v3](https://www.gnu.org/graphics/gplv3-127x51.png)
## 问题反馈
提 [Issue](https://github.com/babalae/genius-invokation-auto-toy/issues) 或 QQ群[906536632](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=_nmC8Neh7mZaGb2hIsO3p4-DKdxBlReQ&authKey=X7rGdx4jbA%2Bs2Juotlov0cg57%2Bv8CwRdjMgYYsxPtdtkl5NKniJhbDILKhWCYS4B&noverify=0&group_code=906536632)
提 [Issue](https://github.com/babalae/better-genshin-impact/issues) 或 QQ群[906536632](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=_nmC8Neh7mZaGb2hIsO3p4-DKdxBlReQ&authKey=X7rGdx4jbA%2Bs2Juotlov0cg57%2Bv8CwRdjMgYYsxPtdtkl5NKniJhbDILKhWCYS4B&noverify=0&group_code=906536632)