Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bfb83c957e | ||
|
|
0c4f7f30c8 | ||
|
|
62481baba9 | ||
|
|
3d6a24d11c | ||
|
|
1d9e05dc2c | ||
|
|
b612e70592 | ||
|
|
2854e14f97 | ||
|
|
af2028c2b5 | ||
|
|
99784c4263 | ||
|
|
e1545a3508 | ||
|
|
e9611d9e22 | ||
|
|
de79d8a61c | ||
|
|
ad4525c36f | ||
|
|
a169489ac0 | ||
|
|
1bc51be511 | ||
|
|
2a413c5dfc | ||
|
|
ea3f653d95 | ||
|
|
6e9da06f08 | ||
|
|
a90da14842 | ||
|
|
6efee18f69 | ||
|
|
98ceba2315 | ||
|
|
1d3e44c113 | ||
|
|
e25194e29a | ||
|
|
61eb5f4fe3 | ||
|
|
2d5c7f6e1f | ||
|
|
3b3236d9f9 | ||
|
|
01b52a5d78 | ||
|
|
2f44f74daa | ||
|
|
8a99c2a63b | ||
|
|
1b748f4dc7 | ||
|
|
cbef23b7ba | ||
|
|
9e18dcf018 | ||
|
|
d4b8b09210 | ||
|
|
a7f030711b | ||
|
|
8fd6c64c14 | ||
|
|
4e24701b1d | ||
|
|
3068069e79 | ||
|
|
73c142d33f | ||
|
|
7333020e3a | ||
|
|
5f4185b7f0 | ||
|
|
45a76d03d1 | ||
|
|
9372c007f8 | ||
|
|
53c2751eb0 | ||
|
|
117be11b8f | ||
|
|
655f938fb9 | ||
|
|
62a0611e3d | ||
|
|
7caab0854e | ||
|
|
fde3d79265 | ||
|
|
9697e4ebec | ||
|
|
b08e8485c3 | ||
|
|
b32da6f902 | ||
|
|
81f21e5bc9 | ||
|
|
f2ebea497c | ||
|
|
e0c495fae3 | ||
|
|
358b56fca2 | ||
|
|
9b888a2430 | ||
|
|
36477f9d39 | ||
|
|
ac915a9639 | ||
|
|
018bc35659 | ||
|
|
6eaea38dcf | ||
|
|
ddbf50121a | ||
|
|
843b929841 | ||
|
|
e278ac1bf0 | ||
|
|
158eb97056 | ||
|
|
af90b930bd | ||
|
|
f5d783d473 | ||
|
|
c7c0a1eb4b | ||
|
|
d07b5e8571 | ||
|
|
3167bf6590 | ||
|
|
1c05245b83 | ||
|
|
8eb50fade4 | ||
|
|
c0e1c4c28b | ||
|
|
cd3ace0b62 | ||
|
|
15d6525b14 | ||
|
|
6332905b7b | ||
|
|
16a8142faa | ||
|
|
6db5926dce | ||
|
|
24c134fb11 | ||
|
|
902dbdecd6 | ||
|
|
26d8499419 | ||
|
|
d0bb5be3b1 | ||
|
|
ba222b90a6 | ||
|
|
d2b2c9afb7 | ||
|
|
645b7fd607 | ||
|
|
9c3810a7ef | ||
|
|
f7190a9042 | ||
|
|
7229bf1c05 | ||
|
|
cbf1cf1efc | ||
|
|
6f9044c792 | ||
|
|
2174fc1b04 | ||
|
|
d830dea328 | ||
|
|
cd5b22548c | ||
|
|
71e64fe2a0 | ||
|
|
d46d594f31 | ||
|
|
bda91816d4 | ||
|
|
97486e7222 | ||
|
|
8fc0cc264f | ||
|
|
bcfc3f7c7e | ||
|
|
ed61c9dfe7 | ||
|
|
c3871e0286 | ||
|
|
947752f17b | ||
|
|
6eca5dfc7b | ||
|
|
8cc8d97780 | ||
|
|
cced20e8e4 | ||
|
|
88bcf9b151 | ||
|
|
b4a1e9a2ab | ||
|
|
cf7eab0939 | ||
|
|
f73a546acb | ||
|
|
f1dd7bdd54 | ||
|
|
f66a96f0c0 | ||
|
|
530c7df520 | ||
|
|
39be95f126 | ||
|
|
c1b7a3c1f7 | ||
|
|
a40643e828 | ||
|
|
85829868a1 | ||
|
|
a960ef40e9 | ||
|
|
573f7f13b8 | ||
|
|
3d526c2314 | ||
|
|
47784ca01c | ||
|
|
f618f87326 | ||
|
|
c7c25b104f | ||
|
|
59cf8316b0 | ||
|
|
2c32dafd44 | ||
|
|
048e69e78b | ||
|
|
4d5af17f98 | ||
|
|
9c3a2d738d | ||
|
|
fb272c1756 | ||
|
|
8f432f6a43 | ||
|
|
918aaf3b99 | ||
|
|
c2a7fd3b92 | ||
|
|
b2995e7402 | ||
|
|
72446fe519 | ||
|
|
275b2a5b90 | ||
|
|
08f9312fb3 | ||
|
|
15d688797f | ||
|
|
d282abfd49 | ||
|
|
a0cea560d6 | ||
|
|
9eac844757 | ||
|
|
5b748d6774 | ||
|
|
773b129bde | ||
|
|
c26fde5644 | ||
|
|
10dcf831e8 | ||
|
|
91c370433c | ||
|
|
a9f3f563e1 | ||
|
|
e3a67f309d | ||
|
|
be25f42e47 | ||
|
|
90c6a7d93a | ||
|
|
47f7ac1995 | ||
|
|
63a936afee | ||
|
|
7035bca982 | ||
|
|
f19a16e1d3 | ||
|
|
e62a76d238 | ||
|
|
c4df2324b5 | ||
|
|
a9f5541145 | ||
|
|
f8ec331a65 | ||
|
|
18efc69d0d | ||
|
|
fdd270068d | ||
|
|
38e541137e | ||
|
|
7bfe4ab87a | ||
|
|
ba4ec6f7f6 | ||
|
|
55ed41f878 | ||
|
|
971151eaa1 | ||
|
|
ea40534851 | ||
|
|
56959d356f | ||
|
|
16f4f5c311 | ||
|
|
12efb98edc | ||
|
|
b9707c43af | ||
|
|
eb1a06f4b6 | ||
|
|
89beeeccef | ||
|
|
49b78aafe2 | ||
|
|
dbf489fd04 |
No files matched your search
@@ -74,7 +74,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: zaodonganqi/bettergi-script-web
|
||||
repository: A-Little-AnQi/bettergi-script-web
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=chyan/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=enkanomiya/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Kongying/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=mirrorchan/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=onslaugh/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=retcode/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=serenitea/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=steambird/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=steambird/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Teyvat/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
@@ -20,6 +21,8 @@ using BetterGenshinImpact.View.Pages;
|
||||
using BetterGenshinImpact.ViewModel;
|
||||
using BetterGenshinImpact.ViewModel.Pages;
|
||||
using BetterGenshinImpact.ViewModel.Pages.View;
|
||||
using LazyCache;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -28,8 +31,13 @@ using Serilog.Events;
|
||||
using Serilog.Sinks.RichTextBox.Abstraction;
|
||||
using Wpf.Ui;
|
||||
using Wpf.Ui.DependencyInjection;
|
||||
using Wpf.Ui.Violeta.Appearance;
|
||||
using Wpf.Ui.Violeta.Controls;
|
||||
|
||||
// Wine 平台适配
|
||||
using BetterGenshinImpact.Platform.Wine;
|
||||
using BetterGenshinImpact.Service.Tavern;
|
||||
|
||||
namespace BetterGenshinImpact;
|
||||
|
||||
public partial class App : Application
|
||||
@@ -134,12 +142,20 @@ public partial class App : Application
|
||||
services.AddSingleton<HutaoNamedPipe>();
|
||||
services.AddSingleton<BgiOnnxFactory>();
|
||||
services.AddSingleton<OcrFactory>();
|
||||
services.AddMemoryCache();
|
||||
services.AddSingleton<IAppCache, CachingService>();
|
||||
services.AddSingleton<MemoryFileCache>();
|
||||
services.AddSingleton<IMihoyoMapApiService, MihoyoMapApiService>();
|
||||
services.AddSingleton<IKongyingTavernApiService, KongyingTavernApiService>();
|
||||
services.AddSingleton<IMaskMapPointService, MaskMapPointService>();
|
||||
|
||||
services.AddSingleton(TimeProvider.System);
|
||||
services.AddSingleton<IServerTimeProvider, ServerTimeProvider>();
|
||||
|
||||
// Configuration
|
||||
//services.Configure<AppConfig>(context.Configuration.GetSection(nameof(AppConfig)));
|
||||
|
||||
I18N.Culture = new CultureInfo("zh-Hans"); // #1846
|
||||
}
|
||||
)
|
||||
.Build();
|
||||
@@ -176,6 +192,8 @@ public partial class App : Application
|
||||
/// </summary>
|
||||
protected override async void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
// Wine 平台适配
|
||||
WinePlatformAddon.ApplyApplicationConfig();
|
||||
base.OnStartup(e);
|
||||
|
||||
try
|
||||
@@ -315,4 +333,4 @@ public partial class App : Application
|
||||
// log
|
||||
GetLogger<App>().LogDebug(e, "UnHandle Exception");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<AssemblyName>BetterGI</AssemblyName>
|
||||
<Version>0.53.2-alpha.1</Version>
|
||||
<Version>0.55.2-alpha.1</Version>
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
|
||||
@@ -43,8 +43,8 @@
|
||||
|
||||
|
||||
<PackageReference Include="BetterGI.VCRuntime" Version="14.44.35208" />
|
||||
<PackageReference Include="BetterGI.Assets.Map" Version="1.0.13" />
|
||||
<PackageReference Include="BetterGI.Assets.Model" Version="1.0.15" />
|
||||
<PackageReference Include="BetterGI.Assets.Map" Version="1.0.17" />
|
||||
<PackageReference Include="BetterGI.Assets.Model" Version="1.0.18" />
|
||||
<PackageReference Include="BetterGI.Assets.Other" Version="1.0.10" />
|
||||
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
@@ -53,9 +53,11 @@
|
||||
<PackageReference Include="DeviceId.Windows.Wmi" Version="6.9.0" />
|
||||
<PackageReference Include="Emoji.Wpf" Version="0.3.4" />
|
||||
<PackageReference Include="LibGit2Sharp" Version="0.31.0" />
|
||||
<PackageReference Include="LazyCache" Version="2.4.0" />
|
||||
<PackageReference Include="MailKit" Version="4.14.0" />
|
||||
<PackageReference Include="Meziantou.Framework.Win32.CredentialManager" Version="1.7.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.4" />
|
||||
@@ -82,16 +84,17 @@
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.RichTextBoxEx.Wpf" Version="1.1.0.1" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="9.0.5" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="10.0.0" />
|
||||
<PackageReference Include="System.IO.Hashing" Version="9.0.4" />
|
||||
<PackageReference Include="TorchSharp" Version="0.105.0" />
|
||||
<PackageReference Include="Vanara.PInvoke.NtDll" Version="4.1.3" />
|
||||
<PackageReference Include="Vanara.PInvoke.SHCore" Version="4.1.3" />
|
||||
<PackageReference Include="Vanara.PInvoke.User32" Version="4.1.3" />
|
||||
<PackageReference Include="WPF-UI" Version="4.0.2" />
|
||||
<PackageReference Include="WPF-UI.DependencyInjection" Version="4.0.2" />
|
||||
<PackageReference Include="WPF-UI.Tray" Version="4.0.2" />
|
||||
<PackageReference Include="WPF-UI.Violeta" Version="4.0.2.3" />
|
||||
<PackageReference Include="XamlAnimatedGif" Version="2.3.1" />
|
||||
<PackageReference Include="WPF-UI" Version="4.2.0" />
|
||||
<PackageReference Include="WPF-UI.DependencyInjection" Version="4.2.0" />
|
||||
<PackageReference Include="WPF-UI.Tray" Version="4.2.0" />
|
||||
<PackageReference Include="WPF-UI.Violeta" Version="4.2.0.1" />
|
||||
<PackageReference Include="gong-wpf-dragdrop" Version="3.2.1" />
|
||||
<PackageReference Include="YamlDotNet" Version="16.3.0" />
|
||||
<PackageReference Include="YoloSharp" Version="6.0.3" />
|
||||
|
||||
@@ -1,588 +0,0 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<AssemblyName>BetterGI</AssemblyName>
|
||||
<IntermediateOutputPath>obj\x64\Debug\</IntermediateOutputPath>
|
||||
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
|
||||
<MSBuildProjectExtensionsPath>D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\</MSBuildProjectExtensionsPath>
|
||||
<_TargetAssemblyProjectName>BetterGenshinImpact</_TargetAssemblyProjectName>
|
||||
<RootNamespace>BetterGenshinImpact</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
|
||||
<PropertyGroup>
|
||||
<Version>0.51.1-alpha.1</Version>
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ApplicationIcon>Resources\Images\logo.ico</ApplicationIcon>
|
||||
<Platforms>x64</Platforms>
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
<!-- <ItemGroup>
|
||||
<None Remove="Assets\Images\*.jpg" />
|
||||
<None Remove="Assets\Images\*" />
|
||||
<None Remove="Assets\Images\*.png" />
|
||||
<None Remove="Assets\Images\*.ico" />
|
||||
<None Remove="Assets\Fonts\*.ttf" />
|
||||
<None Remove="Assets\Highlighting\*.xshd" />
|
||||
<None Remove="Assets\Strings\*.html" />
|
||||
<None Remove="Assets\Strings\*.md" />
|
||||
<None Remove="Assets\Audios\*.mp3" />
|
||||
<None Update="Assets\Config\*"/>
|
||||
</ItemGroup>-->
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AvalonEdit" Version="6.3.1.120" />
|
||||
<PackageReference Include="BehaviourTree" Version="1.0.73" />
|
||||
<PackageReference Include="BetterGI.VCRuntime" Version="14.44.35208" />
|
||||
<PackageReference Include="BetterGI.Assets.Map" Version="1.0.12" />
|
||||
<PackageReference Include="BetterGI.Assets.Model" Version="1.0.12" />
|
||||
<PackageReference Include="BetterGI.Assets.Other" Version="1.0.9" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
<PackageReference Include="DeviceId" Version="6.9.0" />
|
||||
<PackageReference Include="DeviceId.Windows" Version="6.9.0" />
|
||||
<PackageReference Include="DeviceId.Windows.Wmi" Version="6.9.0" />
|
||||
<PackageReference Include="Emoji.Wpf" Version="0.3.4" />
|
||||
<PackageReference Include="LibGit2Sharp" Version="0.31.0" />
|
||||
<PackageReference Include="Meziantou.Framework.Win32.CredentialManager" Version="1.7.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime.DirectML" Version="1.21.0" />
|
||||
<!--排除掉cpu的runtime dll-->
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.21.0" IncludeAssets="none" />
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime.Managed" Version="1.21.0" />
|
||||
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2592.51" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
|
||||
<PackageReference Include="OpenCvSharp4.WpfExtensions" Version="4.11.0.20250507" />
|
||||
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.11.0.20250507" />
|
||||
<PackageReference Include="OpenCvSharp4.Windows" Version="4.11.0.20250507" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.122" />
|
||||
<PackageReference Include="Microsoft.ClearScript.V8" Version="7.4.5" />
|
||||
<PackageReference Include="Microsoft.ClearScript.V8.Native.win-x64" Version="7.4.5" />
|
||||
<PackageReference Include="MouseKeyHook" Version="5.7.1" />
|
||||
<PackageReference Include="PresentMonFps" Version="2.0.5" />
|
||||
<PackageReference Include="Sdl.MultiSelectComboBox" Version="1.0.103" />
|
||||
<PackageReference Include="Semver" Version="3.0.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="9.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.RichTextBoxEx.Wpf" Version="1.1.0.1" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="9.0.5" />
|
||||
<PackageReference Include="System.IO.Hashing" Version="9.0.4" />
|
||||
<PackageReference Include="TorchSharp" Version="0.105.0" />
|
||||
<PackageReference Include="Vanara.PInvoke.NtDll" Version="4.1.3" />
|
||||
<PackageReference Include="Vanara.PInvoke.SHCore" Version="4.1.3" />
|
||||
<PackageReference Include="Vanara.PInvoke.User32" Version="4.1.3" />
|
||||
<PackageReference Include="WPF-UI" Version="4.0.2" />
|
||||
<PackageReference Include="WPF-UI.DependencyInjection" Version="4.0.2" />
|
||||
<PackageReference Include="WPF-UI.Tray" Version="4.0.2" />
|
||||
<PackageReference Include="WPF-UI.Violeta" Version="4.0.2.3" />
|
||||
<PackageReference Include="gong-wpf-dragdrop" Version="3.2.1" />
|
||||
<PackageReference Include="YamlDotNet" Version="16.3.0" />
|
||||
<PackageReference Include="YoloSharp" Version="6.0.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug'">
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Fischless.GameCapture\Fischless.GameCapture.csproj" />
|
||||
<ProjectReference Include="..\Fischless.HotkeyCapture\Fischless.HotkeyCapture.csproj" />
|
||||
<ProjectReference Include="..\Fischless.WindowsInput\Fischless.WindowsInput.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="Assets\Map\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Config\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFight\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFight\Assets\combat_avatar.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\LogParse\Assets\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\tcg_character_card.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoPick\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\hangout.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoTrackPath\Assets\tp.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\Json\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoWood\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoMusicGame\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\GameLoading\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickSereniteaPot\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoEat\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickBuy\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\UseRedeemCode\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\LogParse\Assets\log.css">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\LogParse\Assets\log.js">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\GameLoading\Assets\1920x1080\enter_game.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\in_domain.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="GameTask\OneDragon\" />
|
||||
<Folder Include="GameTask\UseRedeemCode\Assets\1920x1080\" />
|
||||
<Folder Include="Resources\" />
|
||||
<Folder Include="Service\Notification\Builder\" />
|
||||
<Folder Include="User\AutoPathing\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="View\Windows\WelcomeDialog.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
<DependentUpon>WelcomeDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<_DeploymentManifestIconFile Remove="Resources\Images\logo.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\Accessibility.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\behaviourtree\1.0.73\lib\netstandard1.0\BehaviourTree.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\bettergi.assets.map\1.0.12\lib\net8.0\BetterGI.Assets.Map.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\bettergi.assets.model\1.0.12\lib\net8.0\BetterGI.Assets.Model.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\bettergi.assets.other\1.0.9\lib\net8.0\BetterGI.Assets.Other.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\bettergi.vcruntime\14.44.35208\lib\net8.0\BetterGI.VCRuntime.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.clearscript.core\7.4.5\lib\net5.0\ClearScript.Core.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.clearscript.v8\7.4.5\lib\net5.0\ClearScript.V8.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.clearscript.v8.icudata\7.4.5\lib\netstandard1.0\ClearScript.V8.ICUData.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\clipper2\1.4.0\lib\netstandard2.0\Clipper2Lib.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\communitytoolkit.mvvm\8.2.2\lib\net6.0\CommunityToolkit.Mvvm.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\deviceid\6.9.0\lib\net8.0\DeviceId.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\deviceid.windows\6.9.0\lib\net8.0-windows10.0.17763\DeviceId.Windows.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\deviceid.windows.wmi\6.9.0\lib\net8.0\DeviceId.Windows.Wmi.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.diagnostics.tracing.traceevent\3.1.13\lib\netstandard2.0\Dia2Lib.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\emoji.wpf\0.3.4\lib\netcoreapp3.1\Emoji.Wpf.dll" />
|
||||
<ReferencePath Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\Fischless.GameCapture\bin\x64\Debug\net8.0-windows10.0.22621.0\Fischless.GameCapture.dll" />
|
||||
<ReferencePath Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\Fischless.HotkeyCapture\bin\x64\Debug\net8.0-windows10.0.22621.0\Fischless.HotkeyCapture.dll" />
|
||||
<ReferencePath Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\Fischless.WindowsInput\bin\x64\Debug\netstandard2.0\Fischless.WindowsInput.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\mousekeyhook\5.7.1\lib\net7.0-windows7.0\Gma.System.MouseKeyHook.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\gong-wpf-dragdrop\3.2.1\lib\net6.0-windows7.0\GongSolutions.WPF.DragDrop.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\google.protobuf\3.21.9\lib\net5.0\Google.Protobuf.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\avalonedit\6.3.1.120\lib\net8.0-windows7.0\ICSharpCode.AvalonEdit.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sharpziplib\1.4.0\lib\net6.0\ICSharpCode.SharpZipLib.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\libgit2sharp\0.31.0\lib\net8.0\LibGit2Sharp.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\meziantou.framework.win32.credentialmanager\1.7.4\lib\net8.0\Meziantou.Framework.Win32.CredentialManager.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\Microsoft.CSharp.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.diagnostics.tracing.traceevent\3.1.13\lib\netstandard2.0\Microsoft.Diagnostics.FastSerialization.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.diagnostics.tracing.traceevent\3.1.13\lib\netstandard2.0\Microsoft.Diagnostics.Tracing.TraceEvent.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration.abstractions\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration.binder\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.Binder.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration.commandline\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.CommandLine.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration.environmentvariables\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.EnvironmentVariables.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration.fileextensions\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.FileExtensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration.json\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.Json.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration.usersecrets\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.UserSecrets.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.dependencyinjection.abstractions\9.0.4\lib\net8.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.dependencyinjection\9.0.4\lib\net8.0\Microsoft.Extensions.DependencyInjection.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.diagnostics.abstractions\9.0.4\lib\net8.0\Microsoft.Extensions.Diagnostics.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.diagnostics\9.0.4\lib\net8.0\Microsoft.Extensions.Diagnostics.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.fileproviders.abstractions\9.0.4\lib\net8.0\Microsoft.Extensions.FileProviders.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.fileproviders.physical\9.0.4\lib\net8.0\Microsoft.Extensions.FileProviders.Physical.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.filesystemglobbing\9.0.4\lib\net8.0\Microsoft.Extensions.FileSystemGlobbing.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.hosting.abstractions\9.0.4\lib\net8.0\Microsoft.Extensions.Hosting.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.hosting\9.0.4\lib\net8.0\Microsoft.Extensions.Hosting.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.localization.abstractions\9.0.4\lib\netstandard2.0\Microsoft.Extensions.Localization.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.localization\9.0.4\lib\netstandard2.0\Microsoft.Extensions.Localization.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging.abstractions\9.0.4\lib\net8.0\Microsoft.Extensions.Logging.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging.configuration\9.0.4\lib\net8.0\Microsoft.Extensions.Logging.Configuration.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging.console\9.0.4\lib\net8.0\Microsoft.Extensions.Logging.Console.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging.debug\9.0.4\lib\net8.0\Microsoft.Extensions.Logging.Debug.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging\9.0.4\lib\net8.0\Microsoft.Extensions.Logging.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging.eventlog\9.0.4\lib\net8.0\Microsoft.Extensions.Logging.EventLog.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging.eventsource\9.0.4\lib\net8.0\Microsoft.Extensions.Logging.EventSource.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.options.configurationextensions\9.0.4\lib\net8.0\Microsoft.Extensions.Options.ConfigurationExtensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.options\9.0.4\lib\net8.0\Microsoft.Extensions.Options.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.primitives\9.0.4\lib\net8.0\Microsoft.Extensions.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.ml.onnxruntime.managed\1.21.0\lib\net8.0\Microsoft.ML.OnnxRuntime.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.toolkit.uwp.notifications\7.1.3\lib\net5.0-windows10.0.17763\Microsoft.Toolkit.Uwp.Notifications.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\Microsoft.VisualBasic.Core.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\Microsoft.VisualBasic.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\Microsoft.VisualBasic.Forms.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.web.webview2\1.0.2592.51\lib\netcoreapp3.0\Microsoft.Web.WebView2.Core.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.web.webview2\1.0.2592.51\lib\netcoreapp3.0\Microsoft.Web.WebView2.WinForms.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.web.webview2\1.0.2592.51\lib\netcoreapp3.0\Microsoft.Web.WebView2.Wpf.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\Microsoft.Win32.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\Microsoft.Win32.Registry.AccessControl.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\Microsoft.Win32.Registry.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.win32.systemevents\9.0.5\lib\net8.0\Microsoft.Win32.SystemEvents.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windows.sdk.net.ref\10.0.22621.54\lib\net8.0\Microsoft.Windows.SDK.NET.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.xaml.behaviors.wpf\1.1.122\lib\net6.0-windows7.0\Microsoft.Xaml.Behaviors.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\mscorlib.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\netstandard.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\newtonsoft.json\13.0.3\lib\net6.0\Newtonsoft.Json.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\ookii.dialogs.wpf\5.0.1\lib\net6.0-windows7.0\Ookii.Dialogs.Wpf.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\opencvsharp4\4.11.0.20250507\lib\net6.0\OpenCvSharp.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\opencvsharp4.extensions\4.11.0.20250507\lib\net6.0\OpenCvSharp.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\opencvsharp4.wpfextensions\4.11.0.20250507\lib\net6.0\OpenCvSharp.WpfExtensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationCore.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationFramework.Aero.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationFramework.Aero2.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationFramework.AeroLite.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationFramework.Classic.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationFramework.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationFramework.Luna.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationFramework.Royale.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationUI.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\presentmonfps\2.0.5\lib\netstandard2.0\PresentMonFps.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\ReachFramework.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sdl.multiselectcombobox\1.0.103\lib\net6.0-windows7.0\Sdl.MultiSelectComboBox.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\semver\3.0.0\lib\net5.0\Semver.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\serilog\4.2.0\lib\net8.0\Serilog.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\serilog.extensions.logging\9.0.1\lib\net8.0\Serilog.Extensions.Logging.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\serilog.sinks.console\6.0.0\lib\net8.0\Serilog.Sinks.Console.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\serilog.sinks.file\6.0.0\lib\net8.0\Serilog.Sinks.File.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\serilog.sinks.richtextboxex.wpf\1.1.0.1\lib\net8.0-windows7.0\Serilog.Sinks.RichTextBoxEx.Wpf.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sharpdx.d3dcompiler\4.2.0\lib\netstandard1.1\SharpDX.D3DCompiler.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sharpdx.direct3d11\4.2.0\lib\netstandard1.1\SharpDX.Direct3D11.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sharpdx.directinput\4.2.0\lib\netstandard1.3\SharpDX.DirectInput.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sharpdx\4.2.0\lib\netstandard1.1\SharpDX.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sharpdx.dxgi\4.2.0\lib\netstandard1.1\SharpDX.DXGI.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sixlabors.fonts\2.0.8\lib\net6.0\SixLabors.Fonts.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sixlabors.imagesharp\3.1.7\lib\net6.0\SixLabors.ImageSharp.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sixlabors.imagesharp.drawing\2.1.5\lib\net6.0\SixLabors.ImageSharp.Drawing.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\skiasharp\2.88.6\lib\net6.0\SkiaSharp.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\stfu\0.1.1\lib\netcoreapp3.1\Stfu.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.AppContext.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Buffers.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.codedom\9.0.3\lib\net8.0\System.CodeDom.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Collections.Concurrent.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Collections.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Collections.Immutable.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Collections.NonGeneric.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Collections.Specialized.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ComponentModel.Annotations.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ComponentModel.DataAnnotations.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ComponentModel.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ComponentModel.EventBasedAsync.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ComponentModel.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ComponentModel.TypeConverter.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Configuration.ConfigurationManager.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Configuration.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Console.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Core.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Data.Common.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Data.DataSetExtensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Data.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Design.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.Contracts.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.Debug.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.diagnostics.diagnosticsource\9.0.4\lib\net8.0\System.Diagnostics.DiagnosticSource.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.diagnostics.eventlog\9.0.4\lib\net8.0\System.Diagnostics.EventLog.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.FileVersionInfo.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Diagnostics.PerformanceCounter.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.Process.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.StackTrace.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.TextWriterTraceListener.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.Tools.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.TraceSource.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.Tracing.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.DirectoryServices.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.drawing.common\9.0.5\lib\net8.0\System.Drawing.Common.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Drawing.Design.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Drawing.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Drawing.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Dynamic.Runtime.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Formats.Asn1.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Formats.Tar.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Globalization.Calendars.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Globalization.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Globalization.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.Compression.Brotli.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.Compression.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.Compression.FileSystem.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.Compression.ZipFile.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.FileSystem.AccessControl.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.FileSystem.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.FileSystem.DriveInfo.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.FileSystem.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.FileSystem.Watcher.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.io.hashing\9.0.4\lib\net8.0\System.IO.Hashing.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.IsolatedStorage.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.MemoryMappedFiles.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.IO.Packaging.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.io.pipelines\9.0.4\lib\net8.0\System.IO.Pipelines.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.Pipes.AccessControl.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.Pipes.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.UnmanagedMemoryStream.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Linq.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Linq.Expressions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Linq.Parallel.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Linq.Queryable.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.management\9.0.3\lib\net8.0\System.Management.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Memory.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Http.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Http.Json.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.HttpListener.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Mail.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.NameResolution.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.NetworkInformation.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Ping.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Quic.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Requests.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Security.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.ServicePoint.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Sockets.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.WebClient.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.WebHeaderCollection.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.WebProxy.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.WebSockets.Client.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.WebSockets.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Numerics.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.numerics.tensors\9.0.0\lib\net8.0\System.Numerics.Tensors.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Numerics.Vectors.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ObjectModel.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Printing.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.drawing.common\9.0.5\lib\net8.0\System.Private.Windows.Core.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.DispatchProxy.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.Emit.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.Emit.ILGeneration.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.Emit.Lightweight.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.Metadata.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.TypeExtensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Resources.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Resources.Reader.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Resources.ResourceManager.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Resources.Writer.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.CompilerServices.Unsafe.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.CompilerServices.VisualC.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Handles.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.InteropServices.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.InteropServices.JavaScript.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.InteropServices.RuntimeInformation.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Intrinsics.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Loader.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Numerics.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Serialization.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Serialization.Formatters.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Serialization.Json.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Serialization.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Serialization.Xml.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.AccessControl.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Claims.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.Algorithms.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.Cng.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.Csp.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.Encoding.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.OpenSsl.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.Pkcs.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.ProtectedData.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.X509Certificates.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.Xml.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Security.Permissions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Principal.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Principal.Windows.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.SecureString.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ServiceModel.Web.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ServiceProcess.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Text.Encoding.CodePages.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Text.Encoding.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Text.Encoding.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.text.encodings.web\9.0.4\lib\net8.0\System.Text.Encodings.Web.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.text.json\9.0.4\lib\net8.0\System.Text.Json.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Text.RegularExpressions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Threading.AccessControl.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Channels.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Overlapped.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Tasks.Dataflow.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Tasks.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Tasks.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Tasks.Parallel.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Thread.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.ThreadPool.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Timer.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Transactions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Transactions.Local.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ValueTuple.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Web.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Web.HttpUtility.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Controls.Ribbon.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Windows.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Forms.Design.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Forms.Design.Editors.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Forms.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Forms.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Input.Manipulations.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Presentation.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Xaml.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.Linq.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.ReaderWriter.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.Serialization.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.XDocument.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.XmlDocument.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.XmlSerializer.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.XPath.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.XPath.XDocument.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\torchsharp\0.105.0\lib\net6.0\TorchSharp.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.diagnostics.tracing.traceevent\3.1.13\lib\netstandard2.0\TraceReloggerLib.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\emoji.wpf\0.3.4\lib\netcoreapp3.1\Typography.GlyphLayout.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\emoji.wpf\0.3.4\lib\netcoreapp3.1\Typography.OpenFont.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\UIAutomationClient.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\UIAutomationClientSideProviders.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\UIAutomationProvider.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\UIAutomationTypes.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.core\4.1.3\lib\net8.0-windows7.0\Vanara.Core.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.pinvoke.dwmapi\4.1.3\lib\net8.0-windows7.0\Vanara.PInvoke.DwmApi.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.pinvoke.gdi32\4.1.3\lib\net8.0-windows7.0\Vanara.PInvoke.Gdi32.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.pinvoke.kernel32\4.1.3\lib\net8.0-windows7.0\Vanara.PInvoke.Kernel32.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.pinvoke.ntdll\4.1.3\lib\net8.0-windows7.0\Vanara.PInvoke.NtDll.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.pinvoke.shared\4.1.3\lib\net8.0-windows7.0\Vanara.PInvoke.Shared.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.pinvoke.shcore\4.1.3\lib\net8.0-windows7.0\Vanara.PInvoke.SHCore.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.pinvoke.user32\4.1.3\lib\net8.0-windows7.0\Vanara.PInvoke.User32.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.windows.extensions\4.1.3\lib\net8.0-windows7.0\Vanara.Windows.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\WindowsBase.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\WindowsFormsIntegration.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windows.sdk.net.ref\10.0.22621.54\lib\net8.0\WinRT.Runtime.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\wpf-ui.abstractions\4.0.2\lib\net8.0\Wpf.Ui.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\wpf-ui.dependencyinjection\4.0.2\lib\net8.0\Wpf.Ui.DependencyInjection.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\wpf-ui\4.0.2\lib\net8.0-windows7.0\Wpf.Ui.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\wpf-ui.tray\4.0.2\lib\net8.0-windows7.0\Wpf.Ui.Tray.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\wpf-ui.violeta\4.0.2.3\lib\net8.0-windows7.0\Wpf.Ui.Violeta.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\yamldotnet\16.3.0\lib\net8.0\YamlDotNet.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\yolosharp\6.0.3\lib\net8.0\YoloSharp.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\CaptureTestWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\MainWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\MaskWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\CommonSettingsPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\HomePage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\HotkeyPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\JsListPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\KeyBindingsSettingsPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\KeyMouseRecordPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\MacroSettingsPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\MapPathingPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\NotificationSettingsPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragonFlowPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\CraftPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\DailyCommissionPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\DailyRewardPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\DomainPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\ForgingPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\LeyLineBlossomPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\MailPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\SereniteaPotPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\TcgPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\ScriptControlPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\TaskSettingsPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\TriggerSettingsPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\View\HardwareAccelerationView.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\View\PathingConfigView.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\View\ScriptGroupConfigView.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\PickerWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\AboutWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\CheckUpdateWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\Editable\ScriptGroupProjectEditor.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\JsonMonoDialog.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\KeyBindingsWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\MapPathingDevWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\MapViewer.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\OcrDialog.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\PromptDialog.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\ScriptRepoWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\WelcomeDialog.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\App.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\BetterGI_Content.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\GeneratedInternalTypeHelper.g.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Analyzer Include="C:\Users\huiyadanli\.dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\targets\..\analyzers\Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll" />
|
||||
<Analyzer Include="C:\Users\huiyadanli\.dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\targets\..\analyzers\Microsoft.CodeAnalysis.NetAnalyzers.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\communitytoolkit.mvvm\8.2.2\analyzers\dotnet\roslyn4.3\cs\CommunityToolkit.Mvvm.CodeFixers.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\communitytoolkit.mvvm\8.2.2\analyzers\dotnet\roslyn4.3\cs\CommunityToolkit.Mvvm.SourceGenerators.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging.abstractions\9.0.4\analyzers\dotnet\roslyn4.4\cs\Microsoft.Extensions.Logging.Generators.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.extensions.options\9.0.4\analyzers\dotnet\roslyn4.4\cs\Microsoft.Extensions.Options.SourceGeneration.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\system.text.json\9.0.4\analyzers\dotnet\roslyn4.4\cs\System.Text.Json.SourceGeneration.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\analyzers/dotnet/cs/Microsoft.Interop.ComInterfaceGenerator.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\analyzers/dotnet/cs/Microsoft.Interop.JavaScript.JSImportGenerator.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\analyzers/dotnet/cs/Microsoft.Interop.LibraryImportGenerator.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\analyzers/dotnet/cs/Microsoft.Interop.SourceGeneration.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\analyzers/dotnet/cs/System.Text.RegularExpressions.Generator.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\analyzers/dotnet/System.Windows.Forms.Analyzers.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\analyzers/dotnet/cs/System.Windows.Forms.Analyzers.CSharp.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.windows.sdk.net.ref\10.0.22621.54\analyzers/dotnet/cs/WinRT.SourceGenerator.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.AutoCook;
|
||||
using BetterGenshinImpact.GameTask.AutoDomain;
|
||||
using BetterGenshinImpact.GameTask.AutoFight;
|
||||
@@ -22,6 +22,7 @@ using BetterGenshinImpact.GameTask.AutoArtifactSalvage;
|
||||
using BetterGenshinImpact.GameTask.AutoStygianOnslaught;
|
||||
using BetterGenshinImpact.GameTask.GetGridIcons;
|
||||
using BetterGenshinImpact.GameTask.AutoEat;
|
||||
using BetterGenshinImpact.GameTask.MapMask;
|
||||
using BetterGenshinImpact.GameTask.UseRedeemCode;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
@@ -172,6 +173,11 @@ public partial class AllConfig : ObservableObject
|
||||
/// </summary>
|
||||
public AutoEatConfig AutoEatConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 地图遮罩
|
||||
/// </summary>
|
||||
public MapMaskConfig MapMaskConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动使用
|
||||
/// </summary>
|
||||
@@ -261,6 +267,7 @@ public partial class AllConfig : ObservableObject
|
||||
AutoArtifactSalvageConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoRedeemCodeConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoEatConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
MapMaskConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoMusicGameConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
TpConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
ScriptConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
@@ -44,4 +44,7 @@ public partial class GenshinStartConfig : ObservableObject
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _recordGameTimeEnabled = false;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _startGameWithCmd = false;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using OpenCvSharp;
|
||||
using System;
|
||||
|
||||
@@ -75,4 +75,31 @@ public partial class MaskWindowConfig : ObservableObject
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private double _textOpacity = 1.0;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _overlayLayoutEditEnabled = false;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _logTextBoxLeftRatio = 20.0 / 1920;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _logTextBoxTopRatio = 832.0 / 1080;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _logTextBoxWidthRatio = 477.0 / 1920;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _logTextBoxHeightRatio = 188.0 / 1080;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _statusListLeftRatio = 20.0 / 1920;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _statusListTopRatio = 807.0 / 1080;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _statusListWidthRatio = 477.0 / 1920;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _statusListHeightRatio = 24.0 / 1080;
|
||||
}
|
||||
@@ -47,4 +47,7 @@ public partial class ScriptConfig : ObservableObject
|
||||
|
||||
// 仓库页面是否最大化
|
||||
[ObservableProperty] private WindowState _webviewState = WindowState.Normal;
|
||||
|
||||
// 仓库新手教程是否已阅读
|
||||
[ObservableProperty] private bool _guideStatus = false;
|
||||
}
|
||||
@@ -6,14 +6,18 @@ using BetterGenshinImpact.Model;
|
||||
using Gma.System.MouseKeyHook;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using Vanara.PInvoke;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
||||
// Wine 平台适配
|
||||
using BetterGenshinImpact.Platform.Wine;
|
||||
namespace BetterGenshinImpact.Core.Monitor;
|
||||
|
||||
public class MouseKeyMonitor
|
||||
public partial class MouseKeyMonitor
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 长按F变F连发
|
||||
/// </summary>
|
||||
@@ -41,21 +45,41 @@ public class MouseKeyMonitor
|
||||
/// </summary>
|
||||
private DateTime _firstSpaceKeyDownTime = DateTime.MaxValue;
|
||||
|
||||
private IKeyboardMouseEvents? _globalHook;
|
||||
private static IKeyboardMouseEvents? _globalHook;
|
||||
private static readonly object GlobalHookLock = new object();
|
||||
public static IKeyboardMouseEvents GlobalHook
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_globalHook == null)
|
||||
{
|
||||
lock (GlobalHookLock)
|
||||
{
|
||||
if (_globalHook == null)
|
||||
{
|
||||
_globalHook = Hook.GlobalEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
return _globalHook;
|
||||
}
|
||||
}
|
||||
private nint _hWnd;
|
||||
|
||||
public void Subscribe(nint gameHandle)
|
||||
{
|
||||
_hWnd = gameHandle;
|
||||
// Note: for the application hook, use the Hook.AppEvents() instead
|
||||
_globalHook = Hook.GlobalEvents();
|
||||
|
||||
_globalHook.KeyDown += GlobalHookKeyDown;
|
||||
_globalHook.KeyUp += GlobalHookKeyUp;
|
||||
_globalHook.MouseDownExt += GlobalHookMouseDownExt;
|
||||
_globalHook.MouseUpExt += GlobalHookMouseUpExt;
|
||||
_globalHook.MouseMoveExt += GlobalHookMouseMoveExt;
|
||||
_globalHook.MouseWheelExt += GlobalHookMouseWheelExt;
|
||||
if (!WinePlatformAddon.IsRunningOnWine) {
|
||||
GlobalHook.KeyDown += GlobalHookKeyDown;
|
||||
GlobalHook.KeyUp += GlobalHookKeyUp;
|
||||
GlobalHook.MouseDownExt += GlobalHookMouseDownExt;
|
||||
GlobalHook.MouseUpExt += GlobalHookMouseUpExt;
|
||||
GlobalHook.MouseMoveExt += GlobalHookMouseMoveExt;
|
||||
GlobalHook.MouseWheelExt += GlobalHookMouseWheelExt;
|
||||
}
|
||||
TrySubscribeWinePolling();
|
||||
//_globalHook.KeyPress += GlobalHookKeyPress;
|
||||
|
||||
_pickUpKey = TaskContext.Instance().Config.KeyBindingsConfig.PickUpOrInteract.ToWinFormKeys();
|
||||
@@ -190,7 +214,7 @@ public class MouseKeyMonitor
|
||||
|
||||
public void Unsubscribe()
|
||||
{
|
||||
if (_globalHook != null)
|
||||
if (_globalHook != null && !WinePlatformAddon.IsRunningOnWine)
|
||||
{
|
||||
_globalHook.KeyDown -= GlobalHookKeyDown;
|
||||
_globalHook.KeyUp -= GlobalHookKeyUp;
|
||||
@@ -200,6 +224,10 @@ public class MouseKeyMonitor
|
||||
_globalHook.MouseWheelExt -= GlobalHookMouseWheelExt;
|
||||
//_globalHook.KeyPress -= GlobalHookKeyPress;
|
||||
_globalHook.Dispose();
|
||||
_globalHook = null;
|
||||
}
|
||||
if (WinePlatformAddon.IsRunningOnWine){
|
||||
DisposeWineAddon();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -281,8 +281,10 @@ public class PaddleOcrService : IOcrService, IDisposable
|
||||
/// </summary>
|
||||
public string OcrWithoutDetector(Mat mat)
|
||||
{
|
||||
var startTime = Stopwatch.GetTimestamp();
|
||||
var str = _localRecModel.Run(mat).Text;
|
||||
Debug.WriteLine($"PaddleOcrWithoutDetector 结果: {str}");
|
||||
var time = Stopwatch.GetElapsedTime(startTime);
|
||||
Debug.WriteLine($"PaddleOcrWithoutDetector 耗时 {time.TotalMilliseconds}ms 结果: {str}");
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
@@ -407,6 +407,11 @@ public class BgiOnnxFactory
|
||||
break;
|
||||
case ProviderType.Cpu:
|
||||
sessionOptions.AppendExecutionProvider_CPU();
|
||||
if (model.Name.Contains("PpOcr") || model.Name.Contains("Yap"))
|
||||
{
|
||||
sessionOptions.IntraOpNumThreads = 2; // 限制算子内部并行线程数
|
||||
sessionOptions.InterOpNumThreads = 1; // 限制算子间并行线程数(顺序执行)
|
||||
}
|
||||
break;
|
||||
case ProviderType.Dnnl:
|
||||
sessionOptions.AppendExecutionProvider_Dnnl();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv.Model;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv.Model;
|
||||
using OpenCvSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -81,6 +81,79 @@ public class KeyPointFeatureBlockHelper
|
||||
return (cellRow, cellCol);
|
||||
}
|
||||
|
||||
public static (int RowStart, int RowEnd, int ColStart, int ColEnd) GetCellRange(Size originalImage, int rows, int cols, Rect rect)
|
||||
{
|
||||
int cellWidth = originalImage.Width / cols;
|
||||
int cellHeight = originalImage.Height / rows;
|
||||
|
||||
var rowStart = (int)(rect.Y / cellHeight);
|
||||
var rowEnd = (int)((rect.Y + rect.Height) / cellHeight);
|
||||
var colStart = (int)(rect.X / cellWidth);
|
||||
var colEnd = (int)((rect.X + rect.Width) / cellWidth);
|
||||
|
||||
rowStart = Math.Max(0, Math.Min(rowStart, rows - 1));
|
||||
rowEnd = Math.Max(0, Math.Min(rowEnd, rows - 1));
|
||||
colStart = Math.Max(0, Math.Min(colStart, cols - 1));
|
||||
colEnd = Math.Max(0, Math.Min(colEnd, cols - 1));
|
||||
|
||||
if (rowEnd < rowStart)
|
||||
{
|
||||
rowEnd = rowStart;
|
||||
}
|
||||
|
||||
if (colEnd < colStart)
|
||||
{
|
||||
colEnd = colStart;
|
||||
}
|
||||
|
||||
return (rowStart, rowEnd, colStart, colEnd);
|
||||
}
|
||||
|
||||
public static KeyPointFeatureBlock MergeFeaturesInRange(KeyPointFeatureBlock[][] splitKeyPoints, Mat matches, int rowStart, int rowEnd, int colStart, int colEnd)
|
||||
{
|
||||
var rows = splitKeyPoints.Length;
|
||||
if (rows == 0)
|
||||
{
|
||||
return new KeyPointFeatureBlock();
|
||||
}
|
||||
|
||||
var cols = splitKeyPoints[0].Length;
|
||||
|
||||
rowStart = Math.Max(0, Math.Min(rowStart, rows - 1));
|
||||
rowEnd = Math.Max(0, Math.Min(rowEnd, rows - 1));
|
||||
colStart = Math.Max(0, Math.Min(colStart, cols - 1));
|
||||
colEnd = Math.Max(0, Math.Min(colEnd, cols - 1));
|
||||
|
||||
var matchesCols = matches.Cols;
|
||||
var neighboringKeyPoints = new List<KeyPoint>();
|
||||
var neighboringKeyPointIndices = new List<int>();
|
||||
|
||||
for (int i = rowStart; i <= rowEnd; i++)
|
||||
{
|
||||
for (int j = colStart; j <= colEnd; j++)
|
||||
{
|
||||
if (splitKeyPoints[i][j] != null)
|
||||
{
|
||||
neighboringKeyPoints.AddRange(splitKeyPoints[i][j].KeyPointList);
|
||||
neighboringKeyPointIndices.AddRange(splitKeyPoints[i][j].KeyPointIndexList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var mergedKeyPointBlock = new KeyPointFeatureBlock
|
||||
{
|
||||
MergedCenterCellCol = (colStart + colEnd) / 2,
|
||||
MergedCenterCellRow = (rowStart + rowEnd) / 2,
|
||||
KeyPointList = neighboringKeyPoints,
|
||||
KeyPointIndexList = neighboringKeyPointIndices
|
||||
};
|
||||
|
||||
mergedKeyPointBlock.Descriptor = new Mat(mergedKeyPointBlock.KeyPointIndexList.Count, matchesCols, MatType.CV_32FC1);
|
||||
InitBlockMat(mergedKeyPointBlock.KeyPointIndexList, mergedKeyPointBlock.Descriptor, matches);
|
||||
|
||||
return mergedKeyPointBlock;
|
||||
}
|
||||
|
||||
public static KeyPointFeatureBlock MergeNeighboringFeatures(KeyPointFeatureBlock[][] splitKeyPoints, Mat matches, int cellRow, int cellCol)
|
||||
{
|
||||
var matchesCols = matches.Cols; // SURF 64 SIFT 128
|
||||
|
||||
@@ -14,71 +14,79 @@ public class ImageDifferenceDetector
|
||||
/// <returns>差异最大的图片索引(0-3),如果没有图片获得3票则返回-1</returns>
|
||||
public static int FindMostDifferentImage(Mat[] images)
|
||||
{
|
||||
if (images is not { Length: 4 })
|
||||
try
|
||||
{
|
||||
throw new ArgumentException("必须提供4张图片");
|
||||
}
|
||||
|
||||
// 验证所有图片尺寸相同
|
||||
Size firstSize = images[0].Size();
|
||||
for (int i = 1; i < 4; i++)
|
||||
{
|
||||
if (images[i].Size() != firstSize)
|
||||
if (images is not { Length: 4 })
|
||||
{
|
||||
throw new ArgumentException("所有图片必须具有相同的尺寸");
|
||||
throw new ArgumentException("必须提供4张图片");
|
||||
}
|
||||
}
|
||||
|
||||
// 存储每张图片获得的投票数
|
||||
int[] votes = new int[4];
|
||||
|
||||
// 每张图片投票给与它差异最大的图片
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
int maxDiffImageIndex = -1;
|
||||
double maxDifference = 0;
|
||||
|
||||
// 找出与图片i差异最大的图片
|
||||
for (int j = 0; j < 4; j++)
|
||||
// 验证所有图片尺寸相同
|
||||
Size firstSize = images[0].Size();
|
||||
for (int i = 1; i < 4; i++)
|
||||
{
|
||||
if (i != j)
|
||||
if (images[i].Size() != firstSize)
|
||||
{
|
||||
double difference = CalculateDifference(images[i], images[j]);
|
||||
Debug.WriteLine($"{i} vs {j} 差异像素数量: {difference}");
|
||||
|
||||
if (difference > maxDifference)
|
||||
{
|
||||
maxDifference = difference;
|
||||
maxDiffImageIndex = j;
|
||||
}
|
||||
throw new ArgumentException("所有图片必须具有相同的尺寸");
|
||||
}
|
||||
}
|
||||
|
||||
// 图片i投票给差异最大的图片
|
||||
if (maxDiffImageIndex != -1)
|
||||
{
|
||||
votes[maxDiffImageIndex]++;
|
||||
Debug.WriteLine($"图片 {i} 投票给图片 {maxDiffImageIndex} (差异值: {maxDifference:F2})");
|
||||
}
|
||||
}
|
||||
// 存储每张图片获得的投票数
|
||||
int[] votes = new int[4];
|
||||
|
||||
// 输出投票结果
|
||||
Debug.WriteLine("\n投票结果:");
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Debug.WriteLine($"图片 {i}: {votes[i]} 票");
|
||||
}
|
||||
|
||||
// 检查是否有图片获得3票
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (votes[i] >= 3)
|
||||
// 每张图片投票给与它差异最大的图片
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
return i;
|
||||
int maxDiffImageIndex = -1;
|
||||
double maxDifference = 0;
|
||||
|
||||
// 找出与图片i差异最大的图片
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
if (i != j)
|
||||
{
|
||||
double difference = CalculateDifference(images[i], images[j]);
|
||||
Debug.WriteLine($"{i} vs {j} 差异像素数量: {difference}");
|
||||
|
||||
if (difference > maxDifference)
|
||||
{
|
||||
maxDifference = difference;
|
||||
maxDiffImageIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 图片i投票给差异最大的图片
|
||||
if (maxDiffImageIndex != -1)
|
||||
{
|
||||
votes[maxDiffImageIndex]++;
|
||||
Debug.WriteLine($"图片 {i} 投票给图片 {maxDiffImageIndex} (差异值: {maxDifference:F2})");
|
||||
}
|
||||
}
|
||||
|
||||
// 输出投票结果
|
||||
Debug.WriteLine("\n投票结果:");
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Debug.WriteLine($"图片 {i}: {votes[i]} 票");
|
||||
}
|
||||
|
||||
// 检查是否有图片获得3票
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (votes[i] >= 3)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine($"FindMostDifferentImage 出错: {ex.Message}");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Recognition.OpenCv;
|
||||
|
||||
public class TemplateMatchStabilityDetector : IDisposable
|
||||
{
|
||||
private Mat previousFrame;
|
||||
private readonly double similarityThreshold = 0.98; // 相似度阈值(0-1)
|
||||
private readonly int stableFrameCount = 2;
|
||||
private int currentStableCount = 0;
|
||||
private double lastSimilarity = 0;
|
||||
|
||||
public bool IsStable(Mat currentFrame)
|
||||
{
|
||||
Mat processed = PreprocessFrame(currentFrame);
|
||||
|
||||
if (previousFrame == null)
|
||||
{
|
||||
previousFrame = processed;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 使用归一化相关系数进行匹配
|
||||
double similarity = ComputeSimilarity(previousFrame, processed);
|
||||
lastSimilarity = similarity;
|
||||
|
||||
Debug.WriteLine("Similarity: " + similarity);
|
||||
if (similarity >= similarityThreshold)
|
||||
{
|
||||
currentStableCount++;
|
||||
if (currentStableCount >= stableFrameCount)
|
||||
{
|
||||
previousFrame?.Dispose();
|
||||
previousFrame = processed;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
processed.Dispose();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currentStableCount = 0;
|
||||
previousFrame?.Dispose();
|
||||
previousFrame = processed;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private Mat PreprocessFrame(Mat frame)
|
||||
{
|
||||
Mat small = new Mat();
|
||||
|
||||
// 降采样加速
|
||||
Cv2.Resize(frame, small, new Size(320, 180), 0, 0, InterpolationFlags.Area);
|
||||
|
||||
return small;
|
||||
}
|
||||
|
||||
private double ComputeSimilarity(Mat template, Mat image)
|
||||
{
|
||||
// 确保两帧大小相同
|
||||
if (template.Size() != image.Size())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 使用归一化相关系数匹配
|
||||
Mat result = new Mat();
|
||||
Cv2.MatchTemplate(image, template, result, TemplateMatchModes.CCoeffNormed);
|
||||
|
||||
// 获取匹配结果(只有一个值)
|
||||
double minVal, maxVal;
|
||||
Point minLoc, maxLoc;
|
||||
Cv2.MinMaxLoc(result, out minVal, out maxVal, out minLoc, out maxLoc);
|
||||
|
||||
result.Dispose();
|
||||
|
||||
return maxVal; // 返回相关系数(-1 到 1,1 表示完全相同)
|
||||
}
|
||||
|
||||
public double GetLastSimilarity()
|
||||
{
|
||||
return lastSimilarity;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
currentStableCount = 0;
|
||||
previousFrame?.Dispose();
|
||||
previousFrame = null;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
previousFrame?.Dispose();
|
||||
previousFrame = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public class Genshin
|
||||
/// 获取当前在大地图上的位置坐标
|
||||
/// </summary>
|
||||
/// <returns>包含X和Y坐标的Point2f结构体</returns>
|
||||
public Point2f GetPositionFromBigMap()
|
||||
public Point2f? GetPositionFromBigMap()
|
||||
{
|
||||
TpTask tpTask = new TpTask(CancellationContext.Instance.Cts.Token);
|
||||
return tpTask.GetPositionFromBigMap(MapTypes.Teyvat.ToString());
|
||||
@@ -193,7 +193,7 @@ public class Genshin
|
||||
/// </summary>
|
||||
/// <param name="mapName">大地图名称</param>
|
||||
/// <returns>包含X和Y坐标的Point2f结构体</returns>
|
||||
public Point2f GetPositionFromBigMap(string mapName)
|
||||
public Point2f? GetPositionFromBigMap(string mapName)
|
||||
{
|
||||
TpTask tpTask = new TpTask(CancellationContext.Instance.Cts.Token);
|
||||
return tpTask.GetPositionFromBigMap(mapName);
|
||||
@@ -203,7 +203,7 @@ public class Genshin
|
||||
/// 获取当前在小地图上的位置坐标
|
||||
/// </summary>
|
||||
/// <returns>包含X和Y坐标的Point2f结构体</returns>
|
||||
public Point2f GetPositionFromMap()
|
||||
public Point2f? GetPositionFromMap()
|
||||
{
|
||||
return GetPositionFromMap(MapTypes.Teyvat.ToString());
|
||||
}
|
||||
@@ -220,7 +220,7 @@ public class Genshin
|
||||
/// <param name="mapName">大地图名称</param>
|
||||
/// <param name="cacheTimeMs">缓存时间,单位毫秒,默认900ms</param>
|
||||
/// <returns>包含X和Y坐标的Point2f结构体</returns>
|
||||
public Point2f GetPositionFromMap(string mapName, int cacheTimeMs = 900)
|
||||
public Point2f? GetPositionFromMap(string mapName, int cacheTimeMs = 900)
|
||||
{
|
||||
var imageRegion = CaptureToRectArea();
|
||||
if (!Bv.IsInMainUi(imageRegion))
|
||||
@@ -241,7 +241,7 @@ public class Genshin
|
||||
/// <param name="x">世界坐标x</param>
|
||||
/// <param name="y">世界坐标y</param>
|
||||
/// <returns>包含X和Y坐标的Point2f结构体</returns>
|
||||
public Point2f GetPositionFromMap(string mapName, float x, float y)
|
||||
public Point2f? GetPositionFromMap(string mapName, float x, float y)
|
||||
{
|
||||
var imageRegion = CaptureToRectArea();
|
||||
if (!Bv.IsInMainUi(imageRegion))
|
||||
@@ -377,6 +377,15 @@ public class Genshin
|
||||
{
|
||||
await new ExitAndReloginJob().Start(CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 进出千星奇域
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task WonderlandCycle()
|
||||
{
|
||||
await new EnterAndExitWonderlandJob().Start(CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调整时间
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using BetterGenshinImpact.Core.Simulator;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.Core.Simulator;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
@@ -23,6 +24,11 @@ public class GlobalMethod
|
||||
{
|
||||
await Task.Delay(millisecondsTimeout, CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
|
||||
public static string GetVersion()
|
||||
{
|
||||
return Global.Version;
|
||||
}
|
||||
|
||||
#region 键盘操作
|
||||
|
||||
|
||||
@@ -0,0 +1,420 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using BetterGenshinImpact.Core.Monitor;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using Gma.System.MouseKeyHook;
|
||||
using Microsoft.ClearScript;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Dependence;
|
||||
|
||||
public class KeyMouseHook: IDisposable
|
||||
{
|
||||
private IKeyboardMouseEvents? _appEvents;
|
||||
private IKeyboardMouseEvents AppHook => _appEvents ??= MouseKeyMonitor.GlobalHook;
|
||||
|
||||
private readonly List<ScriptObject> _keyDownDataCallbacks = new();
|
||||
private readonly List<ScriptObject> _keyUpDataCallbacks = new();
|
||||
private readonly List<ScriptObject> _keyDownCodeCallbacks = new();
|
||||
private readonly List<ScriptObject> _keyUpCodeCallbacks = new();
|
||||
private readonly List<ScriptObject> _mouseDownCallbacks = new();
|
||||
private readonly List<ScriptObject> _mouseUpCallbacks = new();
|
||||
private readonly List<ScriptObject> _mouseMoveCallbacks = new();
|
||||
private readonly List<ScriptObject> _mouseWheelCallbacks = new();
|
||||
|
||||
/// <summary>
|
||||
/// 存储每个鼠标移动回调的间隔时间(毫秒)
|
||||
/// </summary>
|
||||
private readonly Dictionary<ScriptObject, int> _mouseMoveCallbackIntervals = new();
|
||||
|
||||
/// <summary>
|
||||
/// 存储每个鼠标移动回调的上次调用时间
|
||||
/// </summary>
|
||||
private readonly Dictionary<ScriptObject, DateTime> _lastMouseMoveCallbackTimes = new();
|
||||
|
||||
private KeyEventHandler? _keyDownHandler;
|
||||
private KeyEventHandler? _keyUpHandler;
|
||||
private EventHandler<MouseEventExtArgs>? _mouseDownExtHandler;
|
||||
private EventHandler<MouseEventExtArgs>? _mouseUpExtHandler;
|
||||
private EventHandler<MouseEventExtArgs>? _mouseMoveExtHandler;
|
||||
private EventHandler<MouseEventExtArgs>? _mouseWheelExtHandler;
|
||||
|
||||
private readonly ILogger<KeyMouseHook> _logger = App.GetLogger<KeyMouseHook>();
|
||||
|
||||
/// <summary>
|
||||
/// 统一处理回调函数执行过程中的异常
|
||||
/// </summary>
|
||||
/// <param name="ex">捕获到的异常</param>
|
||||
/// <param name="eventType">事件类型描述</param>
|
||||
private void HandleCallbackException(Exception ex, string eventType)
|
||||
{
|
||||
if (ex is ScriptEngineException scriptEx)
|
||||
{
|
||||
_logger.LogError("执行{eventType}JS回调时发生错误:{scriptEx.Message},清除所有回调",eventType, scriptEx.Message);
|
||||
_logger.LogDebug("{scriptEx}",scriptEx);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogError("执行{eventType}回调时发生错误:{ex.Message},清除所有回调,如果此异常出现在JS脚本结束时,请在JS脚本结束前手动调用Dispose()方法",eventType,ex.Message);
|
||||
_logger.LogDebug("{ex}",ex);
|
||||
}
|
||||
|
||||
Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将全局屏幕坐标转换为游戏窗口局部坐标
|
||||
/// </summary>
|
||||
/// <param name="globalX">全局X坐标</param>
|
||||
/// <param name="globalY">全局Y坐标</param>
|
||||
/// <returns>游戏窗口局部坐标(X, Y),转换失败时返回(-1, -1)</returns>
|
||||
private (int X, int Y) ConvertToLocalCoordinates(int globalX, int globalY)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 检查TaskContext是否已初始化
|
||||
if (!TaskContext.Instance().IsInitialized)
|
||||
{
|
||||
_logger.LogError("TaskContext未初始化,无法获取游戏窗口信息");
|
||||
return (-1, -1);
|
||||
}
|
||||
|
||||
var gameHandle = TaskContext.Instance().GameHandle;
|
||||
if (gameHandle == IntPtr.Zero)
|
||||
{
|
||||
_logger.LogError("游戏窗口句柄无效,无法获取游戏窗口位置");
|
||||
return (-1, -1);
|
||||
}
|
||||
|
||||
// 获取游戏窗口捕获区域
|
||||
var captureRect = SystemControl.GetCaptureRect(gameHandle);
|
||||
|
||||
// 检查捕获区域是否有效
|
||||
if (captureRect.Width <= 0 || captureRect.Height <= 0)
|
||||
{
|
||||
_logger.LogError("获取的游戏窗口捕获区域无效,宽度或高度为0");
|
||||
return (-1, -1);
|
||||
}
|
||||
|
||||
// 计算局部坐标
|
||||
int localX = globalX - captureRect.Left;
|
||||
int localY = globalY - captureRect.Top;
|
||||
|
||||
return (localX, localY);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "转换鼠标坐标时发生错误");
|
||||
return (-1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
public KeyMouseHook()
|
||||
{
|
||||
// 初始化事件处理程序
|
||||
_keyDownHandler = (_, args) =>
|
||||
{
|
||||
// 创建回调列表的副本,避免迭代期间修改集合导致异常
|
||||
var keyDownDataCallbacksCopy = new List<ScriptObject>(_keyDownDataCallbacks);
|
||||
var keyDownCodeCallbacksCopy = new List<ScriptObject>(_keyDownCodeCallbacks);
|
||||
|
||||
// 调用KeyData回调
|
||||
foreach (var callback in keyDownDataCallbacksCopy)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.InvokeAsFunction(args.KeyData.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "键盘按下事件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 调用KeyCode回调
|
||||
foreach (var callback in keyDownCodeCallbacksCopy)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.InvokeAsFunction(args.KeyCode.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "键盘按下事件");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
_keyUpHandler = (_, args) =>
|
||||
{
|
||||
// 创建回调列表的副本,避免迭代期间修改集合导致异常
|
||||
var keyUpDataCallbacksCopy = new List<ScriptObject>(_keyUpDataCallbacks);
|
||||
var keyUpCodeCallbacksCopy = new List<ScriptObject>(_keyUpCodeCallbacks);
|
||||
|
||||
// 调用KeyData回调
|
||||
foreach (var callback in keyUpDataCallbacksCopy)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.InvokeAsFunction(args.KeyData.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "键盘释放事件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 调用KeyCode回调
|
||||
foreach (var callback in keyUpCodeCallbacksCopy)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.InvokeAsFunction(args.KeyCode.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "键盘释放事件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_mouseDownExtHandler = (_, args) =>
|
||||
{
|
||||
// 创建回调列表的副本,避免迭代期间修改集合导致异常
|
||||
var mouseDownCallbacksCopy = new List<ScriptObject>(_mouseDownCallbacks);
|
||||
|
||||
// 转换为局部坐标
|
||||
var (localX, localY) = ConvertToLocalCoordinates(args.X, args.Y);
|
||||
|
||||
foreach (var callback in mouseDownCallbacksCopy)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.InvokeAsFunction(args.Button.ToString(), localX, localY);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "鼠标按下事件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_mouseUpExtHandler = (_, args) =>
|
||||
{
|
||||
// 创建回调列表的副本,避免迭代期间修改集合导致异常
|
||||
var mouseUpCallbacksCopy = new List<ScriptObject>(_mouseUpCallbacks);
|
||||
|
||||
// 转换为局部坐标
|
||||
var (localX, localY) = ConvertToLocalCoordinates(args.X, args.Y);
|
||||
|
||||
foreach (var callback in mouseUpCallbacksCopy)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.InvokeAsFunction(args.Button.ToString(), localX, localY);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "鼠标释放事件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_mouseMoveExtHandler = (_, args) =>
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
// 创建回调列表的副本,避免迭代期间修改集合导致异常
|
||||
var mouseMoveCallbacksCopy = new List<ScriptObject>(_mouseMoveCallbacks);
|
||||
|
||||
// 转换为局部坐标
|
||||
var (localX, localY) = ConvertToLocalCoordinates(args.X, args.Y);
|
||||
|
||||
foreach (var callback in mouseMoveCallbacksCopy)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 获取回调的间隔时间
|
||||
if (_mouseMoveCallbackIntervals.TryGetValue(callback, out var interval))
|
||||
{
|
||||
// 获取上次调用时间
|
||||
if (_lastMouseMoveCallbackTimes.TryGetValue(callback, out var lastTime))
|
||||
{
|
||||
// 计算时间差
|
||||
var timeSpan = now - lastTime;
|
||||
// 如果时间差大于等于间隔时间,则执行回调
|
||||
if (timeSpan.TotalMilliseconds >= interval)
|
||||
{
|
||||
callback.InvokeAsFunction(localX, localY);
|
||||
// 更新上次调用时间
|
||||
_lastMouseMoveCallbackTimes[callback] = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "鼠标移动事件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_mouseWheelExtHandler = (_, args) =>
|
||||
{
|
||||
// 创建回调列表的副本,避免迭代期间修改集合导致异常
|
||||
var mouseWheelCallbacksCopy = new List<ScriptObject>(_mouseWheelCallbacks);
|
||||
|
||||
// 转换为局部坐标
|
||||
var (localX, localY) = ConvertToLocalCoordinates(args.X, args.Y);
|
||||
|
||||
foreach (var callback in mouseWheelCallbacksCopy)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.InvokeAsFunction(args.Delta, localX, localY);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "鼠标滚轮事件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 添加事件监听器
|
||||
AppHook.KeyDown += _keyDownHandler;
|
||||
AppHook.KeyUp += _keyUpHandler;
|
||||
AppHook.MouseDownExt += _mouseDownExtHandler;
|
||||
AppHook.MouseUpExt += _mouseUpExtHandler;
|
||||
AppHook.MouseMoveExt += _mouseMoveExtHandler;
|
||||
AppHook.MouseWheelExt += _mouseWheelExtHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册键盘按下事件回调
|
||||
/// </summary>
|
||||
/// <param name="callback">回调函数</param>
|
||||
/// <param name="useCodeOnly">是否仅返回KeyCode,默认为true(仅返回KeyCode)</param>
|
||||
public void OnKeyDown(ScriptObject callback, bool useCodeOnly = true)
|
||||
{
|
||||
if (useCodeOnly)
|
||||
_keyDownCodeCallbacks.Add(callback);
|
||||
else
|
||||
_keyDownDataCallbacks.Add(callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册键盘释放事件回调
|
||||
/// </summary>
|
||||
/// <param name="callback">回调函数</param>
|
||||
/// <param name="useCodeOnly">是否仅返回KeyCode,默认为true(仅返回KeyCode)</param>
|
||||
public void OnKeyUp(ScriptObject callback, bool useCodeOnly = true)
|
||||
{
|
||||
if (useCodeOnly)
|
||||
_keyUpCodeCallbacks.Add(callback);
|
||||
else
|
||||
_keyUpDataCallbacks.Add(callback);
|
||||
}
|
||||
|
||||
public void OnMouseDown(ScriptObject callback)
|
||||
{
|
||||
_mouseDownCallbacks.Add(callback);
|
||||
}
|
||||
|
||||
public void OnMouseUp(ScriptObject callback)
|
||||
{
|
||||
_mouseUpCallbacks.Add(callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册鼠标移动事件回调
|
||||
/// </summary>
|
||||
/// <param name="callback">回调函数</param>
|
||||
/// <param name="interval">回调间隔时间(毫秒),默认200ms</param>
|
||||
public void OnMouseMove(ScriptObject callback, int interval = 200)
|
||||
{
|
||||
_mouseMoveCallbacks.Add(callback);
|
||||
_mouseMoveCallbackIntervals[callback] = interval;
|
||||
_lastMouseMoveCallbackTimes[callback] = DateTime.MinValue;
|
||||
}
|
||||
|
||||
public void OnMouseWheel(ScriptObject callback)
|
||||
{
|
||||
_mouseWheelCallbacks.Add(callback);
|
||||
}
|
||||
|
||||
public void RemoveAllListeners()
|
||||
{
|
||||
_keyDownDataCallbacks.Clear();
|
||||
_keyUpDataCallbacks.Clear();
|
||||
_keyDownCodeCallbacks.Clear();
|
||||
_keyUpCodeCallbacks.Clear();
|
||||
_mouseDownCallbacks.Clear();
|
||||
_mouseUpCallbacks.Clear();
|
||||
_mouseMoveCallbacks.Clear();
|
||||
_mouseWheelCallbacks.Clear();
|
||||
|
||||
_mouseMoveCallbackIntervals.Clear();
|
||||
_lastMouseMoveCallbackTimes.Clear();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
// 移除所有事件监听器
|
||||
if (_keyDownHandler != null)
|
||||
{
|
||||
AppHook.KeyDown -= _keyDownHandler;
|
||||
_keyDownHandler = null;
|
||||
}
|
||||
|
||||
if (_keyUpHandler != null)
|
||||
{
|
||||
AppHook.KeyUp -= _keyUpHandler;
|
||||
_keyUpHandler = null;
|
||||
}
|
||||
|
||||
if (_mouseDownExtHandler != null)
|
||||
{
|
||||
AppHook.MouseDownExt -= _mouseDownExtHandler;
|
||||
_mouseDownExtHandler = null;
|
||||
}
|
||||
|
||||
if (_mouseUpExtHandler != null)
|
||||
{
|
||||
AppHook.MouseUpExt -= _mouseUpExtHandler;
|
||||
_mouseUpExtHandler = null;
|
||||
}
|
||||
|
||||
if (_mouseMoveExtHandler != null)
|
||||
{
|
||||
AppHook.MouseMoveExt -= _mouseMoveExtHandler;
|
||||
_mouseMoveExtHandler = null;
|
||||
}
|
||||
|
||||
if (_mouseWheelExtHandler != null)
|
||||
{
|
||||
AppHook.MouseWheelExt -= _mouseWheelExtHandler;
|
||||
_mouseWheelExtHandler = null;
|
||||
}
|
||||
|
||||
// 清空回调列表
|
||||
RemoveAllListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using BetterGenshinImpact.Core.Script.Dependence.Model.TimerConfig;
|
||||
using System;
|
||||
using BetterGenshinImpact.Core.Script.Dependence.Model.TimerConfig;
|
||||
using BetterGenshinImpact.GameTask.AutoSkip;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Dependence.Model;
|
||||
@@ -40,5 +42,16 @@ public class RealtimeTimer
|
||||
{
|
||||
Config = ScriptObjectConverter.ConvertTo<AutoPickExternalConfig>(config);
|
||||
}
|
||||
else if (Name == "AutoSkip")
|
||||
{
|
||||
if (config is AutoSkipConfig)
|
||||
{
|
||||
Config = config;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("AutoSkip的配置参数需要为AutoSkipConfig类型");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,18 @@
|
||||
using BetterGenshinImpact.Core.Script.Dependence;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BetterGenshinImpact.Core.Script.Dependence;
|
||||
using BetterGenshinImpact.Core.Script.Dependence.Model;
|
||||
using Microsoft.ClearScript;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using OpenCvSharp;
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.Core.Script.Utils;
|
||||
using BetterGenshinImpact.GameTask.AutoDomain;
|
||||
using BetterGenshinImpact.GameTask.AutoFight;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Model;
|
||||
using BetterGenshinImpact.GameTask.AutoSkip;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script;
|
||||
|
||||
@@ -34,11 +36,12 @@ public class EngineExtend
|
||||
engine.AddHostObject("file", new LimitedFile(workDir)); // 限制文件访问
|
||||
engine.AddHostObject("http", new Http()); // 限制文件访问
|
||||
engine.AddHostObject("notification", new Notification());
|
||||
|
||||
|
||||
// 任务调度器
|
||||
engine.AddHostObject("dispatcher", new Dispatcher(config));
|
||||
engine.AddHostType("RealtimeTimer", typeof(RealtimeTimer));
|
||||
engine.AddHostType("SoloTask", typeof(SoloTask));
|
||||
engine.AddHostType("AutoSkipConfig", typeof(AutoSkipConfig));
|
||||
|
||||
// 添加取消令牌相关类型
|
||||
engine.AddHostType("CancellationTokenSource", typeof(CancellationTokenSource));
|
||||
@@ -69,19 +72,35 @@ public class EngineExtend
|
||||
|
||||
engine.AddHostType("AutoDomainParam", typeof(AutoDomainParam));
|
||||
engine.AddHostType("AutoFightParam", typeof(AutoFightParam));
|
||||
|
||||
|
||||
|
||||
//鼠标回调
|
||||
engine.AddHostType("KeyMouseHook", typeof(KeyMouseHook));
|
||||
// 添加C#的类型
|
||||
engine.AddHostType(typeof(Task));
|
||||
|
||||
// 导入 CommonJS 模块
|
||||
// 导入 JavaScript 模块
|
||||
// https://microsoft.github.io/ClearScript/2023/01/24/module-interop.html
|
||||
// https://github.com/microsoft/ClearScript/blob/master/ClearScriptTest/V8ModuleTest.cs
|
||||
engine.DocumentSettings.AccessFlags = DocumentAccessFlags.EnableFileLoading | DocumentAccessFlags.AllowCategoryMismatch;
|
||||
if (searchPaths != null)
|
||||
{
|
||||
engine.DocumentSettings.SearchPath = string.Join(';', searchPaths);
|
||||
var normalizedPaths = new List<string>();
|
||||
foreach (var path in searchPaths)
|
||||
{
|
||||
try
|
||||
{
|
||||
var normalizedPath = ScriptUtils.NormalizePath(workDir, path);
|
||||
normalizedPaths.Add(normalizedPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception($"从 library 字段读取路径 '{path}' 失败: {ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (normalizedPaths.Count > 0)
|
||||
{
|
||||
engine.DocumentSettings.SearchPath = string.Join(';', normalizedPaths);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +118,7 @@ public class EngineExtend
|
||||
|
||||
#pragma warning disable CS8974 // Converting method group to non-delegate type
|
||||
engine.AddHostObject("sleep", GlobalMethod.Sleep);
|
||||
engine.AddHostObject("getVersion", GlobalMethod.GetVersion);
|
||||
engine.AddHostObject("keyDown", GlobalMethod.KeyDown);
|
||||
engine.AddHostObject("keyUp", GlobalMethod.KeyUp);
|
||||
engine.AddHostObject("keyPress", GlobalMethod.KeyPress);
|
||||
@@ -122,4 +142,4 @@ public class EngineExtend
|
||||
engine.AddHostObject("inputText", GlobalMethod.InputText);
|
||||
#pragma warning restore CS8974 // Converting method group to non-delegate type
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using BetterGenshinImpact.Core.Script.Dependence;
|
||||
using Microsoft.ClearScript.JavaScript;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Project;
|
||||
|
||||
@@ -89,7 +90,19 @@ public class ScriptProject
|
||||
}
|
||||
try
|
||||
{
|
||||
await (Task)engine.Evaluate(code);
|
||||
if (Manifest.Library.Length != 0)
|
||||
{
|
||||
// 清除Document缓存
|
||||
DocumentLoader.Default.DiscardCachedDocuments();
|
||||
|
||||
var evaluation = engine.Evaluate(new DocumentInfo { Category = ModuleCategory.Standard }, code);
|
||||
if (evaluation is Task task) await task;
|
||||
}
|
||||
else
|
||||
{
|
||||
var evaluation = engine.Evaluate(code);
|
||||
if (evaluation is Task task) await task;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ using BetterGenshinImpact.View.Controls.Webview;
|
||||
using BetterGenshinImpact.ViewModel.Pages;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -132,9 +133,8 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
try
|
||||
{
|
||||
// 检测repo.json是否存在,存在则备份
|
||||
var oldRepoJsonPath = Directory
|
||||
.GetFiles(CenterRepoPath, "repo.json", SearchOption.AllDirectories).FirstOrDefault();
|
||||
if (oldRepoJsonPath != null)
|
||||
var oldRepoJsonPath = Path.Combine(repoPath, "repo.json");
|
||||
if (File.Exists(oldRepoJsonPath))
|
||||
{
|
||||
oldRepoJsonContent = File.ReadAllText(oldRepoJsonPath);
|
||||
}
|
||||
@@ -168,30 +168,17 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取远程分支信息并拉取最新数据
|
||||
var remote = repo.Network.Remotes["origin"];
|
||||
var refSpecs = remote.FetchRefSpecs.Select(x => x.Specification);
|
||||
// 直接获取远程分支的 Commit SHA
|
||||
var remoteReferences = repo.Network.ListReferences(repoUrl, CreateCredentialsHandler());
|
||||
var remoteBranch = remoteReferences.FirstOrDefault(r => r.CanonicalName == "refs/heads/release");
|
||||
|
||||
var fetchOptions = new FetchOptions
|
||||
{
|
||||
ProxyOptions = { ProxyType = ProxyType.None },
|
||||
Depth = 1, // 浅拉取,只获取最新的提交
|
||||
CredentialsProvider = CreateCredentialsHandler() // 添加凭据处理器
|
||||
};
|
||||
|
||||
Commands.Fetch(repo, remote.Name, refSpecs, fetchOptions, "拉取最新更新");
|
||||
|
||||
// 获取本地和远程commit
|
||||
var currentCommitSha = repo.Head.Tip.Sha;
|
||||
|
||||
// 获取远程release分支的最新commit
|
||||
var remoteBranch = repo.Branches["refs/remotes/origin/release"];
|
||||
if (remoteBranch == null)
|
||||
{
|
||||
throw new Exception("未找到远程release分支");
|
||||
}
|
||||
|
||||
var remoteCommitSha = remoteBranch.Tip.Sha;
|
||||
var remoteCommitSha = remoteBranch.TargetIdentifier;
|
||||
var currentCommitSha = repo.Branches["release"]?.Tip?.Sha;
|
||||
|
||||
// 比较本地和远程commit
|
||||
if (currentCommitSha == remoteCommitSha)
|
||||
@@ -201,10 +188,9 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation($"检测到远程更新: 本地 {currentCommitSha[..7]} -> 远程 {remoteCommitSha[..7]},将重新克隆");
|
||||
|
||||
// commit不一致,删除本地仓库重新克隆
|
||||
_logger.LogInformation($"检测到远程更新: 本地 {currentCommitSha?[..7] ?? "无"} -> 远程 {remoteCommitSha[..7]}");
|
||||
repo?.Dispose();
|
||||
repo = null;
|
||||
CloneRepository(repoUrl, repoPath, "release", onCheckoutProgress);
|
||||
updated = true;
|
||||
}
|
||||
@@ -215,7 +201,9 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
_logger.LogError(ex, "Git仓库更新失败");
|
||||
UIDispatcherHelper.Invoke(() => Toast.Error("脚本仓库更新异常,直接删除后重新克隆\n原因:" + ex.Message));
|
||||
repo?.Dispose();
|
||||
repo = null;
|
||||
CloneRepository(repoUrl, repoPath, "release", onCheckoutProgress);
|
||||
updated = true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -226,9 +214,9 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
// 标记新repo.json中的更新节点
|
||||
try
|
||||
{
|
||||
var newRepoJsonPath = Directory.GetFiles(CenterRepoPath, "repo.json", SearchOption.AllDirectories)
|
||||
.FirstOrDefault();
|
||||
if (newRepoJsonPath != null)
|
||||
// 查找repo.json文件
|
||||
var newRepoJsonPath = Directory.GetFiles(repoPath, "repo.json", SearchOption.AllDirectories).FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(newRepoJsonPath))
|
||||
{
|
||||
var newRepoJsonContent = await File.ReadAllTextAsync(newRepoJsonPath);
|
||||
|
||||
@@ -405,7 +393,7 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
{
|
||||
if (token == null || token.Type == JTokenType.Null) return false;
|
||||
if (token.Type == JTokenType.Boolean) return (bool)token;
|
||||
if (token.Type == JTokenType.String) return string.Equals((string)token, "true", StringComparison.OrdinalIgnoreCase);
|
||||
if (token.Type == JTokenType.String) return string.Equals(token.ToString(), "true", StringComparison.OrdinalIgnoreCase);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -423,12 +411,17 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
// options.FetchOptions.Depth = 1; // 浅克隆,只获取最新的提交
|
||||
// 设置凭据处理器
|
||||
options.FetchOptions.CredentialsProvider = Instance.CreateCredentialsHandler();
|
||||
options.FetchOptions.OnTransferProgress = progress =>
|
||||
{
|
||||
onCheckoutProgress?.Invoke($"拉取对象 {progress.ReceivedObjects}/{progress.TotalObjects}", progress.ReceivedObjects, progress.TotalObjects);
|
||||
return true;
|
||||
};
|
||||
// 克隆仓库
|
||||
Repository.Clone(repoUrl, repoPath, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// 克隆Git仓库(只检出repo.json)
|
||||
/// 相当于 Repository.Clone(repoUrl, repoPath, options);
|
||||
/// 用这个方法可以无视本地代理
|
||||
/// </summary>
|
||||
@@ -458,22 +451,30 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
TagFetchMode = TagFetchMode.None,
|
||||
ProxyOptions = { ProxyType = ProxyType.None },
|
||||
Depth = 1, // 浅拉取,只获取最新的提交
|
||||
CredentialsProvider = CreateCredentialsHandler() // 添加凭据处理器
|
||||
CredentialsProvider = CreateCredentialsHandler(), // 添加凭据处理器
|
||||
OnTransferProgress = progress =>
|
||||
{
|
||||
onCheckoutProgress?.Invoke($"拉取对象 {progress.ReceivedObjects}/{progress.TotalObjects}", progress.ReceivedObjects, progress.TotalObjects);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
string refSpec = $"+refs/heads/{branchName}:refs/remotes/origin/{branchName}";
|
||||
Commands.Fetch(repo, remote.Name, new[] { refSpec }, fetchOptions, "初始化拉取");
|
||||
|
||||
// 获取远程分支
|
||||
var remoteBranch = repo.Branches[$"refs/remotes/origin/{branchName}"];
|
||||
var remoteBranch = repo.Branches[$"origin/{branchName}"];
|
||||
if (remoteBranch == null)
|
||||
throw new Exception($"远程仓库中未找到 {branchName} 分支");
|
||||
|
||||
// 创建并检出本地分支
|
||||
// 创建本地分支
|
||||
var localBranch = repo.CreateBranch(branchName, remoteBranch.Tip);
|
||||
repo.Branches.Update(localBranch, b => b.TrackedBranch = remoteBranch.CanonicalName);
|
||||
|
||||
var checkoutOptions = new CheckoutOptions { OnCheckoutProgress = onCheckoutProgress };
|
||||
Commands.Checkout(repo, localBranch, checkoutOptions);
|
||||
// 手动检出HEAD到新分支
|
||||
repo.Refs.UpdateTarget(repo.Refs.Head, localBranch.CanonicalName);
|
||||
|
||||
// 手动检出 repo.json 文件
|
||||
CheckoutRepoJson(repo, remoteBranch.Tip);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -481,6 +482,403 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从Git仓库检出repo.json文件到工作目录
|
||||
/// </summary>
|
||||
/// <param name="repo"></param>
|
||||
/// <param name="commit"></param>
|
||||
private void CheckoutRepoJson(Repository repo, Commit commit)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 查找repo.json文件
|
||||
var repoJsonEntry = commit.Tree.FirstOrDefault(e => e.Name == "repo.json");
|
||||
if (repoJsonEntry != null && repoJsonEntry.TargetType == TreeEntryTargetType.Blob)
|
||||
{
|
||||
var blob = (Blob)repoJsonEntry.Target;
|
||||
var repoJsonPath = Path.Combine(repo.Info.WorkingDirectory ?? repo.Info.Path, "repo.json");
|
||||
|
||||
// 创建目录(如果需要)
|
||||
var dir = Path.GetDirectoryName(repoJsonPath);
|
||||
if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
// 写入文件
|
||||
using (var contentStream = blob.GetContentStream())
|
||||
using (var fileStream = File.Create(repoJsonPath))
|
||||
{
|
||||
contentStream.CopyTo(fileStream);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning("未在仓库中找到 repo.json 文件");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "检出 repo.json 失败");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查指定路径是否为 Git 仓库(非文件式仓库)
|
||||
/// </summary>
|
||||
/// <param name="repoPath">仓库路径</param>
|
||||
/// <returns>如果是 Git 仓库返回 true,否则返回 false</returns>
|
||||
private bool IsGitRepository(string repoPath)
|
||||
{
|
||||
return Repository.IsValid(repoPath) && !Directory.Exists(Path.Combine(repoPath, "repo"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取仓库中 repo/ 子目录的树对象
|
||||
/// </summary>
|
||||
private Tree GetRepoSubdirectoryTree(Repository repo)
|
||||
{
|
||||
var commit = repo.Head?.Tip;
|
||||
if (commit == null)
|
||||
{
|
||||
throw new Exception("仓库HEAD未指向任何提交");
|
||||
}
|
||||
|
||||
// 脚本内容都在 repo/ 子目录下
|
||||
var repoEntry = commit.Tree["repo"];
|
||||
if (repoEntry == null || repoEntry.TargetType != TreeEntryTargetType.Tree)
|
||||
{
|
||||
throw new Exception("仓库结构错误:未找到 repo/ 子目录");
|
||||
}
|
||||
|
||||
return (Tree)repoEntry.Target;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从中央仓库读取文件内容
|
||||
/// </summary>
|
||||
/// <param name="relPath">相对于仓库根目录的路径</param>
|
||||
/// <returns>文件内容,如果文件不存在则返回null</returns>
|
||||
public string? ReadFileFromCenterRepo(string relPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
var repoPath = CenterRepoPath;
|
||||
|
||||
// 判断是否为 Git 仓库
|
||||
bool isGitRepo = IsGitRepository(repoPath);
|
||||
|
||||
if (isGitRepo)
|
||||
{
|
||||
return ReadFileFromGitRepository(repoPath, relPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 文件式仓库:从文件系统读取
|
||||
var filePath = Path.Combine(repoPath, "repo", relPath);
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
return File.ReadAllText(filePath);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, $"从中央仓库读取文件失败: {relPath}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从中央仓库读取二进制文件
|
||||
/// </summary>
|
||||
/// <param name="relPath">相对于仓库根目录的路径</param>
|
||||
/// <returns>文件字节数组,如果文件不存在则返回null</returns>
|
||||
public byte[]? ReadBinaryFileFromCenterRepo(string relPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
var repoPath = CenterRepoPath;
|
||||
|
||||
// 判断是否为 Git 仓库
|
||||
bool isGitRepo = IsGitRepository(repoPath);
|
||||
|
||||
if (isGitRepo)
|
||||
{
|
||||
return ReadBinaryFileFromGitRepository(repoPath, relPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 文件式仓库:从文件系统读取
|
||||
var filePath = Path.Combine(repoPath, "repo", relPath);
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
return File.ReadAllBytes(filePath);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, $"从中央仓库读取二进制文件失败: {relPath}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从Git仓库读取文件内容
|
||||
/// </summary>
|
||||
private string? ReadFileFromGitRepository(string repoPath, string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 判断是否为 Git 仓库
|
||||
bool isGitRepo = IsGitRepository(repoPath);
|
||||
if (!isGitRepo)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using var repo = new Repository(repoPath);
|
||||
|
||||
var manifestPath = $"repo/{filePath}";
|
||||
var pathParts = manifestPath.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
Tree currentTree = repo.Head.Tip!.Tree;
|
||||
TreeEntry? entry = null;
|
||||
|
||||
for (int i = 0; i < pathParts.Length; i++)
|
||||
{
|
||||
entry = currentTree[pathParts[i]];
|
||||
if (entry == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (i < pathParts.Length - 1)
|
||||
{
|
||||
if (entry.TargetType != TreeEntryTargetType.Tree)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
currentTree = (Tree)entry.Target;
|
||||
}
|
||||
}
|
||||
|
||||
if (entry == null || entry.TargetType != TreeEntryTargetType.Blob)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var blob = (Blob)entry.Target;
|
||||
using var contentStream = blob.GetContentStream();
|
||||
using var reader = new StreamReader(contentStream);
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, $"从Git仓库读取文件失败: {filePath}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从Git仓库读取二进制文件内容
|
||||
/// </summary>
|
||||
private byte[]? ReadBinaryFileFromGitRepository(string repoPath, string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 判断是否为 Git 仓库
|
||||
bool isGitRepo = IsGitRepository(repoPath);
|
||||
if (!isGitRepo)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using var repo = new Repository(repoPath);
|
||||
|
||||
var manifestPath = $"repo/{filePath}";
|
||||
var pathParts = manifestPath.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
Tree currentTree = repo.Head.Tip!.Tree;
|
||||
TreeEntry? entry = null;
|
||||
|
||||
for (int i = 0; i < pathParts.Length; i++)
|
||||
{
|
||||
entry = currentTree[pathParts[i]];
|
||||
if (entry == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (i < pathParts.Length - 1)
|
||||
{
|
||||
if (entry.TargetType != TreeEntryTargetType.Tree)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
currentTree = (Tree)entry.Target;
|
||||
}
|
||||
}
|
||||
|
||||
if (entry == null || entry.TargetType != TreeEntryTargetType.Blob)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var blob = (Blob)entry.Target;
|
||||
using var contentStream = blob.GetContentStream();
|
||||
using var memoryStream = new MemoryStream();
|
||||
contentStream.CopyTo(memoryStream);
|
||||
return memoryStream.ToArray();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, $"从Git仓库读取二进制文件失败: {filePath}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从仓库中检出指定路径的文件或文件夹到目标位置
|
||||
/// </summary>
|
||||
/// <param name="repoPath">仓库路径</param>
|
||||
/// <param name="sourcePath">仓库中的相对路径</param>
|
||||
/// <param name="destPath">目标路径</param>
|
||||
private void CheckoutPath(string repoPath, string sourcePath, string destPath)
|
||||
{
|
||||
// 判断仓库类型:检查是否为 Git 仓库且不存在 repo/ 子目录
|
||||
bool isGitRepo = IsGitRepository(repoPath);
|
||||
|
||||
if (isGitRepo)
|
||||
{
|
||||
// 从Git仓库检出
|
||||
using var repo = new Repository(repoPath);
|
||||
var commit = repo.Head.Tip;
|
||||
|
||||
if (commit == null)
|
||||
{
|
||||
_logger.LogError($"仓库HEAD未指向任何提交。HEAD: {repo.Head?.CanonicalName ?? "null"}");
|
||||
throw new Exception("仓库HEAD未指向任何提交");
|
||||
}
|
||||
|
||||
// 递归查找路径
|
||||
TreeEntry? entry = null;
|
||||
var pathParts = sourcePath.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
Tree currentTree = GetRepoSubdirectoryTree(repo);
|
||||
|
||||
for (int i = 0; i < pathParts.Length; i++)
|
||||
{
|
||||
entry = currentTree[pathParts[i]];
|
||||
if (entry == null)
|
||||
{
|
||||
// 调试信息:列出当前树中的所有条目
|
||||
// var availableEntries = string.Join(", ", currentTree.Select(e => e.Name));
|
||||
// _logger.LogError($"在路径 '{string.Join("/", pathParts.Take(i))}' 中未找到 '{pathParts[i]}'");
|
||||
// _logger.LogError($"可用的条目: {availableEntries}");
|
||||
// throw new Exception($"仓库中不存在路径: {sourcePath}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (i < pathParts.Length - 1)
|
||||
{
|
||||
if (entry.TargetType != TreeEntryTargetType.Tree)
|
||||
{
|
||||
throw new Exception($"路径中间部分不是目录: {string.Join("/", pathParts.Take(i + 1))}");
|
||||
}
|
||||
currentTree = (Tree)entry.Target;
|
||||
}
|
||||
}
|
||||
|
||||
// 检出文件或目录
|
||||
if (entry == null)
|
||||
{
|
||||
// throw new Exception($"未找到路径: {sourcePath}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (entry.TargetType == TreeEntryTargetType.Blob)
|
||||
{
|
||||
// 检出单个文件
|
||||
var blob = (Blob)entry.Target;
|
||||
|
||||
// 确保目标目录存在
|
||||
var dir = Path.GetDirectoryName(destPath);
|
||||
if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
using (var contentStream = blob.GetContentStream())
|
||||
using (var fileStream = File.Create(destPath))
|
||||
{
|
||||
contentStream.CopyTo(fileStream);
|
||||
}
|
||||
}
|
||||
else if (entry.TargetType == TreeEntryTargetType.Tree)
|
||||
{
|
||||
// 检出目录
|
||||
var tree = (Tree)entry.Target;
|
||||
CheckoutTree(tree, destPath, sourcePath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 文件式仓库:从文件系统复制
|
||||
var scriptPath = Path.Combine(repoPath, sourcePath);
|
||||
|
||||
if (Directory.Exists(scriptPath))
|
||||
{
|
||||
// 复制目录
|
||||
CopyDirectory(scriptPath, destPath);
|
||||
}
|
||||
else if (File.Exists(scriptPath))
|
||||
{
|
||||
// 复制文件
|
||||
var dir = Path.GetDirectoryName(destPath);
|
||||
if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
File.Copy(scriptPath, destPath, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"仓库中不存在路径: {sourcePath}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 递归检出树对象
|
||||
/// </summary>
|
||||
private void CheckoutTree(Tree tree, string destPath, string currentPath)
|
||||
{
|
||||
if (!Directory.Exists(destPath))
|
||||
{
|
||||
Directory.CreateDirectory(destPath);
|
||||
}
|
||||
|
||||
foreach (var entry in tree)
|
||||
{
|
||||
var entryDestPath = Path.Combine(destPath, entry.Name);
|
||||
var entrySourcePath = $"{currentPath}/{entry.Name}";
|
||||
|
||||
if (entry.TargetType == TreeEntryTargetType.Blob)
|
||||
{
|
||||
var blob = (Blob)entry.Target;
|
||||
using var contentStream = blob.GetContentStream();
|
||||
using var fileStream = File.Create(entryDestPath);
|
||||
contentStream.CopyTo(fileStream);
|
||||
}
|
||||
else if (entry.TargetType == TreeEntryTargetType.Tree)
|
||||
{
|
||||
var subTree = (Tree)entry.Target;
|
||||
CheckoutTree(subTree, entryDestPath, entrySourcePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GitConfig(Repository repo)
|
||||
{
|
||||
// 设置 Git 配置
|
||||
@@ -581,22 +979,42 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
|
||||
public string FindCenterRepoPath()
|
||||
{
|
||||
var localRepoJsonPath = Directory.GetFiles(CenterRepoPath, "repo.json", SearchOption.AllDirectories)
|
||||
.FirstOrDefault();
|
||||
if (localRepoJsonPath is null)
|
||||
// 查找 repo.json 文件
|
||||
var repoJsonPath = Path.Combine(CenterRepoPath, "repo.json");
|
||||
string? repoJsonDir = null;
|
||||
|
||||
if (File.Exists(repoJsonPath))
|
||||
{
|
||||
repoJsonDir = CenterRepoPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 递归查找 repo.json
|
||||
var localRepoJsonPath = Directory
|
||||
.GetFiles(CenterRepoPath, "repo.json", SearchOption.AllDirectories).FirstOrDefault();
|
||||
if (localRepoJsonPath != null)
|
||||
{
|
||||
repoJsonDir = Path.GetDirectoryName(localRepoJsonPath);
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(repoJsonDir))
|
||||
{
|
||||
throw new Exception("本地仓库缺少 repo.json");
|
||||
}
|
||||
|
||||
// 获取与 localRepoJsonPath 同名(无扩展名)的文件夹路径
|
||||
var folderName = Path.GetFileNameWithoutExtension(localRepoJsonPath);
|
||||
var folderPath = Path.Combine(Path.GetDirectoryName(localRepoJsonPath)!, folderName);
|
||||
if (!Directory.Exists(folderPath))
|
||||
// 检查 repo.json 同级是否存在 repo/ 目录来判断仓库类型
|
||||
var repoSubDir = Path.Combine(repoJsonDir, "repo");
|
||||
if (Directory.Exists(repoSubDir))
|
||||
{
|
||||
throw new Exception("本地仓库文件夹不存在");
|
||||
// 存在 repo/ 目录,说明是文件式仓库
|
||||
return repoSubDir;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 不存在 repo/ 目录,说明是 Git 仓库
|
||||
return repoJsonDir;
|
||||
}
|
||||
|
||||
return folderPath;
|
||||
}
|
||||
|
||||
private (string time, string url, string file) ParseJson(string jsonString)
|
||||
@@ -823,19 +1241,55 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
//顶层节点,按库中的文件夹来
|
||||
if (path == "pathing")
|
||||
{
|
||||
var scriptPath = Path.Combine(repoPath, path);
|
||||
if (Directory.Exists(scriptPath))
|
||||
// 判断仓库类型:Git 仓库或文件式仓库
|
||||
bool isGitRepo = IsGitRepository(repoPath);
|
||||
|
||||
if (isGitRepo)
|
||||
{
|
||||
// 获取该路径下的所有“仅第一层文件夹”
|
||||
string[] directories = Directory.GetDirectories(scriptPath, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (var dir in directories)
|
||||
// 从Git仓库读取
|
||||
using var repo = new Repository(repoPath);
|
||||
var commit = repo.Head.Tip;
|
||||
if (commit == null)
|
||||
{
|
||||
newPaths.Add("pathing" + "/" + Path.GetFileName(dir));
|
||||
throw new Exception("仓库HEAD未指向任何提交");
|
||||
}
|
||||
|
||||
Tree repoTree = GetRepoSubdirectoryTree(repo);
|
||||
|
||||
var pathingEntry = repoTree["pathing"];
|
||||
if (pathingEntry != null && pathingEntry.TargetType == TreeEntryTargetType.Tree)
|
||||
{
|
||||
var pathingTree = (Tree)pathingEntry.Target;
|
||||
foreach (var entry in pathingTree)
|
||||
{
|
||||
if (entry.TargetType == TreeEntryTargetType.Tree)
|
||||
{
|
||||
newPaths.Add("pathing/" + entry.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Toast.Warning($"未知的脚本路径:{path}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Toast.Warning($"未知的脚本路径:{path}");
|
||||
// 文件式仓库:从文件系统读取
|
||||
var pathingDir = Path.Combine(repoPath, "pathing");
|
||||
if (Directory.Exists(pathingDir))
|
||||
{
|
||||
// 获取该路径下的所有“仅第一层文件夹”
|
||||
string[] directories = Directory.GetDirectories(pathingDir, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (var dir in directories)
|
||||
{
|
||||
newPaths.Add("pathing/" + Path.GetFileName(dir));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Toast.Warning($"未知的脚本路径:{path}");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -844,13 +1298,12 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
}
|
||||
}
|
||||
|
||||
// 拷贝文件
|
||||
// 从 Git 仓库检出文件到用户文件夹
|
||||
foreach (var path in newPaths)
|
||||
{
|
||||
var (first, remainingPath) = GetFirstFolderAndRemainingPath(path);
|
||||
if (PathMapper.TryGetValue(first, out var userPath))
|
||||
{
|
||||
var scriptPath = Path.Combine(repoPath, path);
|
||||
var destPath = Path.Combine(userPath, remainingPath);
|
||||
|
||||
// 备份需要保存的文件
|
||||
@@ -860,29 +1313,23 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
backupFiles = BackupScriptFiles(path, repoPath);
|
||||
}
|
||||
|
||||
if (Directory.Exists(scriptPath))
|
||||
// 如果目标路径存在,先删除
|
||||
if (Directory.Exists(destPath))
|
||||
{
|
||||
if (Directory.Exists(destPath))
|
||||
{
|
||||
DirectoryHelper.DeleteDirectoryWithReadOnlyCheck(destPath);
|
||||
}
|
||||
|
||||
CopyDirectory(scriptPath, destPath);
|
||||
|
||||
// 图标处理
|
||||
DealWithIconFolder(destPath);
|
||||
DirectoryHelper.DeleteDirectoryWithReadOnlyCheck(destPath);
|
||||
}
|
||||
else if (File.Exists(scriptPath))
|
||||
else if (File.Exists(destPath))
|
||||
{
|
||||
// 目标文件所在文件夹不存在时创建它
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(destPath)!);
|
||||
File.Delete(destPath);
|
||||
}
|
||||
|
||||
if (File.Exists(destPath))
|
||||
{
|
||||
File.Delete(destPath);
|
||||
}
|
||||
// 从 Git 仓库检出文件或目录
|
||||
CheckoutPath(repoPath, path, destPath);
|
||||
|
||||
File.Copy(scriptPath, destPath, true);
|
||||
// 图标处理(仅对目录)
|
||||
if (Directory.Exists(destPath))
|
||||
{
|
||||
DealWithIconFolder(destPath);
|
||||
}
|
||||
|
||||
// 恢复备份的文件
|
||||
@@ -1151,10 +1598,20 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
|
||||
_webWindow = null;
|
||||
};
|
||||
|
||||
_webWindow.Panel!.DownloadFolderPath = MapPathingViewModel.PathJsonPath;
|
||||
_webWindow.NavigateToFile(Global.Absolute(@"Assets\Web\ScriptRepo\index.html"));
|
||||
// _webWindow.NavigateToFile(Global.Absolute(@"Assets\Web\ScriptRepo\index.html"));
|
||||
_webWindow.Panel!.OnWebViewInitializedAction = () =>
|
||||
{
|
||||
var assetsPath = Global.Absolute(@"Assets\Web\ScriptRepo");
|
||||
_webWindow.Panel!.WebView.CoreWebView2.SetVirtualHostNameToFolderMapping(
|
||||
"bettergi.local",
|
||||
assetsPath,
|
||||
CoreWebView2HostResourceAccessKind.Allow
|
||||
);
|
||||
|
||||
// _webWindow.Panel!.WebView.CoreWebView2.Navigate("https://bettergi.local/index.html");
|
||||
|
||||
_webWindow.Panel!.WebView.CoreWebView2.AddHostObjectToScript("repoWebBridge", new RepoWebBridge());
|
||||
|
||||
// 允许内部外链使用默认浏览器打开
|
||||
@@ -1170,6 +1627,8 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
e.Handled = true;
|
||||
};
|
||||
};
|
||||
|
||||
_webWindow.NavigateToUri(new Uri("https://bettergi.local/index.html"));
|
||||
_webWindow.Show();
|
||||
}
|
||||
else
|
||||
@@ -1286,16 +1745,35 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
Directory.CreateDirectory(backupScriptDir);
|
||||
}
|
||||
|
||||
// 获取脚本的manifest文件路径
|
||||
var scriptManifestPath = Path.Combine(repoPath, scriptPath, "manifest.json");
|
||||
if (!File.Exists(scriptManifestPath))
|
||||
// 获取脚本的manifest文件内容
|
||||
string? manifestContent = null;
|
||||
|
||||
// 判断仓库类型
|
||||
bool isGitRepo = IsGitRepository(repoPath);
|
||||
|
||||
if (isGitRepo)
|
||||
{
|
||||
_logger.LogWarning($"脚本manifest文件不存在: {scriptManifestPath}");
|
||||
return backupFiles;
|
||||
// 从Git仓库读取
|
||||
manifestContent = ReadFileFromGitRepository(repoPath, $"{scriptPath}/manifest.json");
|
||||
if (manifestContent == null)
|
||||
{
|
||||
_logger.LogWarning($"脚本manifest文件不存在: {scriptPath}/manifest.json");
|
||||
return backupFiles;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 文件式仓库:从文件系统读取
|
||||
var scriptManifestPath = Path.Combine(repoPath, scriptPath, "manifest.json");
|
||||
if (!File.Exists(scriptManifestPath))
|
||||
{
|
||||
_logger.LogWarning($"脚本manifest文件不存在: {scriptManifestPath}");
|
||||
return backupFiles;
|
||||
}
|
||||
manifestContent = File.ReadAllText(scriptManifestPath);
|
||||
}
|
||||
|
||||
// 解析manifest文件获取savedFiles
|
||||
var manifestContent = File.ReadAllText(scriptManifestPath);
|
||||
var manifest = Manifest.FromJson(manifestContent);
|
||||
|
||||
if (manifest.SavedFiles == null || manifest.SavedFiles.Length == 0)
|
||||
@@ -1392,16 +1870,35 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
var backupScriptDir = Path.Combine(tempBackupPath, scriptPathSafe);
|
||||
try
|
||||
{
|
||||
// 获取脚本的manifest文件路径
|
||||
var scriptManifestPath = Path.Combine(repoPath, scriptPath, "manifest.json");
|
||||
if (!File.Exists(scriptManifestPath))
|
||||
// 获取脚本的manifest文件内容
|
||||
string? manifestContent = null;
|
||||
|
||||
// 判断仓库类型
|
||||
bool isGitRepo = IsGitRepository(repoPath);
|
||||
|
||||
if (isGitRepo)
|
||||
{
|
||||
_logger.LogWarning($"脚本manifest文件不存在: {scriptManifestPath}");
|
||||
return;
|
||||
// 从Git仓库读取
|
||||
manifestContent = ReadFileFromGitRepository(repoPath, $"{scriptPath}/manifest.json");
|
||||
if (manifestContent == null)
|
||||
{
|
||||
_logger.LogWarning($"脚本manifest文件不存在: {scriptPath}/manifest.json");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 文件式仓库:从文件系统读取
|
||||
var scriptManifestPath = Path.Combine(repoPath, scriptPath, "manifest.json");
|
||||
if (!File.Exists(scriptManifestPath))
|
||||
{
|
||||
_logger.LogWarning($"脚本manifest文件不存在: {scriptManifestPath}");
|
||||
return;
|
||||
}
|
||||
manifestContent = File.ReadAllText(scriptManifestPath);
|
||||
}
|
||||
|
||||
// 解析manifest文件获取savedFiles
|
||||
var manifestContent = File.ReadAllText(scriptManifestPath);
|
||||
var manifest = Manifest.FromJson(manifestContent);
|
||||
|
||||
if (manifest.SavedFiles == null || manifest.SavedFiles.Length == 0)
|
||||
@@ -1466,4 +1963,4 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
_logger.LogError(ex, $"恢复脚本文件时发生错误: {scriptPath}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ using BetterGenshinImpact.View.Windows;
|
||||
using BetterGenshinImpact.ViewModel.Message;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Net;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.WebView;
|
||||
|
||||
@@ -25,7 +27,12 @@ public sealed class RepoWebBridge
|
||||
".vue", ".css", ".html", ".csv", ".xml",
|
||||
".yaml", ".yml", ".ini", ".config"
|
||||
};
|
||||
|
||||
|
||||
private static readonly HashSet<string> AllowedImageExtensions = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg", ".bmp", ".ico"
|
||||
};
|
||||
|
||||
public async Task<string> GetRepoJson()
|
||||
{
|
||||
try
|
||||
@@ -71,29 +78,68 @@ public sealed class RepoWebBridge
|
||||
return await File.ReadAllTextAsync(userConfigPath);
|
||||
}
|
||||
|
||||
public async Task<string> GetFile(string relPath)
|
||||
public Task<string> GetFile(string relPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
// URL 解码路径(处理中文文件名)
|
||||
relPath = WebUtility.UrlDecode(relPath);
|
||||
|
||||
string filePath = Path.Combine(ScriptRepoUpdater.CenterRepoPath, "repo", relPath)
|
||||
.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
|
||||
|
||||
if (!File.Exists(filePath))
|
||||
|
||||
// 验证解析后的路径在允许的目录范围内
|
||||
string normalizedBasePath = Path.GetFullPath(Path.Combine(ScriptRepoUpdater.CenterRepoPath, "repo"));
|
||||
string normalizedFilePath = Path.GetFullPath(filePath);
|
||||
if (!normalizedFilePath.StartsWith(normalizedBasePath, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "404";
|
||||
return Task.FromResult("404");
|
||||
}
|
||||
|
||||
string extension = Path.GetExtension(filePath);
|
||||
return AllowedTextExtensions.Contains(extension)
|
||||
? await File.ReadAllTextAsync(filePath)
|
||||
: "404";
|
||||
string extension = Path.GetExtension(filePath).ToLower();
|
||||
|
||||
if (AllowedTextExtensions.Contains(extension))
|
||||
{
|
||||
// 读取文本文件
|
||||
string? content = ScriptRepoUpdater.Instance.ReadFileFromCenterRepo(relPath);
|
||||
return Task.FromResult(string.IsNullOrEmpty(content) ? "404" : content);
|
||||
}
|
||||
else if (AllowedImageExtensions.Contains(extension))
|
||||
{
|
||||
// 读取图片文件,返回 Base64 编码
|
||||
byte[]? bytes = ScriptRepoUpdater.Instance.ReadBinaryFileFromCenterRepo(relPath);
|
||||
if (bytes == null || bytes.Length == 0)
|
||||
{
|
||||
return Task.FromResult("404");
|
||||
}
|
||||
|
||||
string base64 = Convert.ToBase64String(bytes);
|
||||
return Task.FromResult(base64);
|
||||
}
|
||||
|
||||
return Task.FromResult("404");
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "404";
|
||||
return Task.FromResult("404");
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetMimeType(string extension)
|
||||
{
|
||||
return extension.ToLower() switch
|
||||
{
|
||||
".png" => "image/png",
|
||||
".jpg" or ".jpeg" => "image/jpeg",
|
||||
".gif" => "image/gif",
|
||||
".bmp" => "image/bmp",
|
||||
".webp" => "image/webp",
|
||||
".svg" => "image/svg+xml",
|
||||
".ico" => "image/x-icon",
|
||||
_ => "application/octet-stream"
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateSubscribed(string path)
|
||||
{
|
||||
try
|
||||
@@ -150,6 +196,36 @@ public sealed class RepoWebBridge
|
||||
}
|
||||
}
|
||||
|
||||
// 设置新手引导标志位
|
||||
public bool SetGuideStatus(bool status)
|
||||
{
|
||||
try
|
||||
{
|
||||
var scriptConfig = TaskContext.Instance().Config.ScriptConfig;
|
||||
scriptConfig.GuideStatus = status;
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取新手引导标志位
|
||||
public bool GetGuideStatus()
|
||||
{
|
||||
try
|
||||
{
|
||||
return TaskContext.Instance().Config.ScriptConfig.GuideStatus;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetRepoJsonPath()
|
||||
{
|
||||
string updatedRepoJsonPath = Path.Combine(
|
||||
|
||||
@@ -9,6 +9,7 @@ using BetterGenshinImpact.GameTask.GetGridIcons;
|
||||
using BetterGenshinImpact.GameTask.Model;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using BetterGenshinImpact.GameTask.Model.GameUI;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using BetterGenshinImpact.View.Drawable;
|
||||
using Fischless.WindowsInput;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -104,7 +105,8 @@ public class AutoEatTask : BaseIndependentTask, ISoloTask<int?>
|
||||
itemRegion.Click();
|
||||
|
||||
#region 识别数量
|
||||
string numStr = itemRegion.SrcMat.GetGridItemIconText(OcrFactory.Paddle);
|
||||
string ocrText = itemRegion.SrcMat.GetGridItemIconText(OcrFactory.Paddle);
|
||||
string numStr = StringUtils.ConvertFullWidthNumToHalfWidth(ocrText);
|
||||
if (int.TryParse(numStr, out int num))
|
||||
{
|
||||
count = num - 1; // 算上吃掉的1个
|
||||
|
||||
|
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 1.8 KiB |
@@ -52,7 +52,7 @@
|
||||
"奇偶(男)",
|
||||
"MannequinBoy"
|
||||
],
|
||||
"id": "20000001",
|
||||
"id": "10000117",
|
||||
"name": "奇偶(男)",
|
||||
"nameEn": "MannequinBoy",
|
||||
"weapon": "1"
|
||||
@@ -62,7 +62,7 @@
|
||||
"奇偶(女)",
|
||||
"MannequinGirl"
|
||||
],
|
||||
"id": "20000002",
|
||||
"id": "10000118",
|
||||
"name": "奇偶(女)",
|
||||
"nameEn": "MannequinGirl",
|
||||
"weapon": "1"
|
||||
@@ -1981,5 +1981,73 @@
|
||||
"nameEn": "Nefer",
|
||||
"skillCD": 9,
|
||||
"weapon": "10"
|
||||
},
|
||||
{
|
||||
"alias": [
|
||||
"杜林",
|
||||
"Durin"
|
||||
],
|
||||
"burstCD": 18,
|
||||
"id": "10000123",
|
||||
"name": "杜林",
|
||||
"nameEn": "Durin",
|
||||
"skillCD": 12,
|
||||
"weapon": "10"
|
||||
},
|
||||
{
|
||||
"alias": [
|
||||
"雅珂达",
|
||||
"Jahoda"
|
||||
],
|
||||
"burstCD": 18,
|
||||
"id": "10000124",
|
||||
"name": "雅珂达",
|
||||
"nameEn": "Jahoda",
|
||||
"skillCD": 15,
|
||||
"weapon": "10"
|
||||
},
|
||||
{
|
||||
"alias": [
|
||||
"哥伦比娅",
|
||||
"Columbina",
|
||||
"少女",
|
||||
"库塔尔",
|
||||
"月神",
|
||||
"月之少女"
|
||||
],
|
||||
"burstCD": 15,
|
||||
"id": "10000125",
|
||||
"name": "哥伦比娅",
|
||||
"nameEn": "Columbina",
|
||||
"skillCD": 17,
|
||||
"weapon": "10"
|
||||
},
|
||||
{
|
||||
"alias": [
|
||||
"兹白",
|
||||
"Zibai",
|
||||
"白马仙人",
|
||||
"白马"
|
||||
],
|
||||
"burstCD": 15,
|
||||
"id": "10000126",
|
||||
"name": "兹白",
|
||||
"nameEn": "Zibai",
|
||||
"skillCD": 18,
|
||||
"weapon": "10"
|
||||
},
|
||||
{
|
||||
"alias": [
|
||||
"叶洛亚",
|
||||
"Illuga",
|
||||
"少爷",
|
||||
"小少爷"
|
||||
],
|
||||
"burstCD": 15,
|
||||
"id": "10000127",
|
||||
"name": "叶洛亚",
|
||||
"nameEn": "Illuga",
|
||||
"skillCD": 15,
|
||||
"weapon": "10"
|
||||
}
|
||||
]
|
||||
@@ -22,6 +22,9 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing.Model;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing.Handler;
|
||||
using BetterGenshinImpact.GameTask.AutoPick.Assets;
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask.Common.Element.Assets;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoFight;
|
||||
|
||||
@@ -44,6 +47,10 @@ public class AutoFightTask : ISoloTask
|
||||
public static bool FightStatusFlag { get; set; } = false;
|
||||
|
||||
private static readonly object PickLock = new object();
|
||||
|
||||
private readonly double _assetScale = TaskContext.Instance().SystemInfo.AssetScale;
|
||||
|
||||
private readonly ReturnMainUiTask _returnMainUiTask = new();
|
||||
|
||||
// 战斗点位
|
||||
public static WaypointForTrack? FightWaypoint {get; set;} = null;
|
||||
@@ -486,7 +493,58 @@ public class AutoFightTask : ISoloTask
|
||||
// 队伍中存在万叶的时候使用一次长E
|
||||
var picker = combatScenes.SelectAvatar("枫原万叶") ?? combatScenes.SelectAvatar("琴");
|
||||
|
||||
var oldPartyName = RunnerContext.Instance.PartyName;
|
||||
string? oldPartyName = null;
|
||||
if (RunnerContext.Instance.PartyName is not null)
|
||||
{
|
||||
oldPartyName = RunnerContext.Instance.PartyName;
|
||||
}
|
||||
else if (picker is null)
|
||||
{
|
||||
Logger.LogWarning("换队拾取:当前队伍名称为空,尝试读取!");
|
||||
await Delay(1000, ct);
|
||||
await _returnMainUiTask.Start(ct);
|
||||
|
||||
for (int attempt = 0; attempt < 3; attempt++)
|
||||
{
|
||||
Simulation.SendInput.SimulateAction(GIActions.OpenPartySetupScreen);
|
||||
var enterGameAppear = await NewRetry.WaitForElementAppear(
|
||||
ElementAssets.Instance.PartyBtnChooseView,
|
||||
() => { },
|
||||
ct,
|
||||
15,
|
||||
500
|
||||
);
|
||||
if (attempt == 2)
|
||||
{
|
||||
Logger.LogWarning("换队拾取:读取队伍名称失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//等待寻找2秒队伍按钮出现
|
||||
var timeWaitStart = 0;
|
||||
while(timeWaitStart < 6000)
|
||||
{
|
||||
using var ra = CaptureToRectArea();
|
||||
var partyViewBtn = ra.Find(ElementAssets.Instance.PartyBtnChooseView);
|
||||
if (partyViewBtn.IsExist())
|
||||
{
|
||||
// OCR 当前队伍名称(无法单字,中间禁止空格)
|
||||
oldPartyName = ra.Find(new RecognitionObject
|
||||
{
|
||||
RecognitionType = RecognitionTypes.Ocr,
|
||||
RegionOfInterest = new Rect(partyViewBtn.Right, partyViewBtn.Top, (int)(350 * _assetScale),
|
||||
partyViewBtn.Height)
|
||||
}).Text;
|
||||
Logger.LogInformation("换队拾取:当前队伍名称读取为:{oldPartyName}",oldPartyName);
|
||||
RunnerContext.Instance.PartyName = oldPartyName;
|
||||
// await _returnMainUiTask.Start(ct);
|
||||
break;
|
||||
}
|
||||
await Delay(200, ct);
|
||||
timeWaitStart += 200;
|
||||
}
|
||||
|
||||
var switchPartyFlag = false;
|
||||
if (picker == null && !timeOutFlag &&!string.IsNullOrEmpty(_taskParam.KazuhaPartyName) && oldPartyName != _taskParam.KazuhaPartyName)
|
||||
{
|
||||
|
||||
@@ -128,28 +128,37 @@ public class Avatar
|
||||
}
|
||||
|
||||
Logger.LogInformation("游泳检测:尝试回到战斗地点");
|
||||
var pathExecutor = new PathExecutor(ct);
|
||||
var cts = new CancellationTokenSource();
|
||||
var pathExecutor = new PathExecutor(cts.Token);
|
||||
|
||||
try
|
||||
{
|
||||
pathExecutor.FaceTo(AutoFightTask.FightWaypoint).Wait(2000, ct);
|
||||
AutoFightTask.FightWaypoint.MoveMode = MoveModeEnum.Fly.Code;//改为跳飞
|
||||
pathExecutor.FaceTo(AutoFightTask.FightWaypoint).Wait(2000,cts.Token);
|
||||
AutoFightTask.FightWaypoint.MoveMode = MoveModeEnum.Fly.Code; // 改为跳飞
|
||||
Simulation.SendInput.Mouse.RightButtonDown();
|
||||
pathExecutor.MoveTo(AutoFightTask.FightWaypoint).Wait(15000, ct);
|
||||
AutoFightTask.FightWaypoint = null;//执行后清空,即每次战斗只执行一次,第二次直接去七天神像
|
||||
pathExecutor.MoveTo(AutoFightTask.FightWaypoint).Wait(15000,cts.Token);
|
||||
cts.Cancel();
|
||||
AutoFightTask.FightWaypoint = null;
|
||||
Simulation.SendInput.Mouse.RightButtonUp();
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
{
|
||||
Logger.LogError("游泳检测:回到战斗地点任务被取消");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogWarning(ex, "游泳检测:回到战斗地点异常");
|
||||
Logger.LogError(ex, "游泳检测:回到战斗地点异常");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Simulation.ReleaseAllKey();
|
||||
}
|
||||
|
||||
Simulation.ReleaseAllKey();
|
||||
|
||||
using var ra2 = CaptureToRectArea();
|
||||
if (!SwimmingConfirm(ra2))
|
||||
using var bitmap2 = CaptureToRectArea();
|
||||
if (!SwimmingConfirm(bitmap2))
|
||||
{
|
||||
Logger.LogInformation("游泳检测:游泳脱困成功");
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.LogWarning("游泳检测:回到战斗地点失败");
|
||||
@@ -620,6 +629,32 @@ public class Avatar
|
||||
{
|
||||
Sleep(ms); // 由于存在宏操作,等待不应被cts取消
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 等待完成
|
||||
/// </summary>
|
||||
public void Ready()
|
||||
{
|
||||
Sleep(200, Ct);
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
if (Ct is { IsCancellationRequested: true })
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
using var region = CaptureToRectArea();
|
||||
// 等待角色编号块出现
|
||||
if (PartyAvatarSideIndexHelper.HasAnyIndexRect(region))
|
||||
{
|
||||
region.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
Sleep(150, Ct);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -857,6 +892,11 @@ public class Avatar
|
||||
GlobalMethod.MoveMouseBy(x, y);
|
||||
}
|
||||
|
||||
public void Scroll(int scrollAmountInClicks)
|
||||
{
|
||||
Simulation.SendInput.Mouse.VerticalScroll(scrollAmountInClicks);
|
||||
}
|
||||
|
||||
public void KeyDown(string key)
|
||||
{
|
||||
var vk = KeyBindingsSettingsPageViewModel.MappingKey(User32Helper.ToVk(key));
|
||||
|
||||
@@ -466,7 +466,7 @@ public class CombatScenes : IDisposable
|
||||
if (PartyAvatarSideIndexHelper.CountIndexRect(imageRegion) == Avatars.Length)
|
||||
{
|
||||
bool res = RefreshTeamAvatarIndexRectList(imageRegion);
|
||||
_logger.LogWarning("多次识别出战角色失败,尝试刷新角色编号位置(处理草露问题),刷新结果:{Result}", res ? "成功" : "失败");
|
||||
_logger.LogWarning("多次识别出战角色失败,尝试刷新角色编号位置,刷新结果:{Result}", res ? "成功" : "失败");
|
||||
imageRegion.SrcMat.SaveImage(Global.Absolute("log\\refresh_avatar_index_rect.png"));
|
||||
if (res)
|
||||
{
|
||||
|
||||
@@ -35,10 +35,12 @@ public class PartyAvatarSideIndexHelper
|
||||
{
|
||||
autoFightAssets = AutoFightAssets.Instance;
|
||||
}
|
||||
|
||||
if (logger == null)
|
||||
{
|
||||
logger = TaskControl.Logger;
|
||||
}
|
||||
|
||||
var status = new MultiGameStatus();
|
||||
// 判断当前联机人数
|
||||
var pRaList = imageRegion.FindMulti(autoFightAssets.PRa);
|
||||
@@ -246,7 +248,7 @@ public class PartyAvatarSideIndexHelper
|
||||
|
||||
public static List<Rect> GetAvatarSideIconRectFromIndexRect(List<Rect> indexRect, ISystemInfo systemInfo)
|
||||
{
|
||||
return indexRect.Select(r=> GetAvatarSideIconRectFromIndexRect(r, systemInfo)).ToList();
|
||||
return indexRect.Select(r => GetAvatarSideIconRectFromIndexRect(r, systemInfo)).ToList();
|
||||
}
|
||||
|
||||
public static bool IsIntersecting(double y1, double h1, double y2, double h2)
|
||||
@@ -373,8 +375,7 @@ public class PartyAvatarSideIndexHelper
|
||||
Mat[] mats = new Mat[rectArray.Length];
|
||||
try
|
||||
{
|
||||
var whiteCount = 0;
|
||||
var notWhiteRectNum = 0;
|
||||
int whiteCount = 0, notWhiteRectNum = 0;
|
||||
var mat = imageRegion.CacheGreyMat;
|
||||
for (int i = 0; i < rectArray.Length; i++)
|
||||
{
|
||||
@@ -396,8 +397,22 @@ public class PartyAvatarSideIndexHelper
|
||||
}
|
||||
else
|
||||
{
|
||||
// 使用更加靠谱的差值识别(-1是未识别)
|
||||
return ImageDifferenceDetector.FindMostDifferentImage(mats);
|
||||
// 方法2:边缘像素白色比例
|
||||
int m2 = FindActiveIndexRectByEdgeColor(mats);
|
||||
if (m2 > 0)
|
||||
{
|
||||
return m2;
|
||||
}
|
||||
|
||||
// 方法3:使用更加靠谱的差值识别(-1是未识别),但是不支持非满队
|
||||
if (mats.Length == 4)
|
||||
{
|
||||
return ImageDifferenceDetector.FindMostDifferentImage(mats);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -407,15 +422,13 @@ public class PartyAvatarSideIndexHelper
|
||||
mat?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static bool IsWhiteRect(Mat indexMat)
|
||||
{
|
||||
|
||||
var count1 = OpenCvCommonHelper.CountGrayMatColor(indexMat, 251, 255); // 白
|
||||
var count2 = OpenCvCommonHelper.CountGrayMatColor(indexMat, 50, 54); // 黑色文字
|
||||
if ((count1 + count2) * 1.0 / (indexMat.Width * indexMat.Height) > 0.4)
|
||||
if ((count1 + count2) * 1.0 / (indexMat.Width * indexMat.Height) > 0.35)
|
||||
{
|
||||
// Debug.WriteLine($"白色矩形占比{(count1 + count2) * 1.0 / (indexMat.Width * indexMat.Height)}");
|
||||
return true;
|
||||
@@ -443,7 +456,7 @@ public class PartyAvatarSideIndexHelper
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < rectArray.Length; i++)
|
||||
{
|
||||
if (IsIntersecting(curr.Y, curr.Height, rectArray[i].Y, rectArray[i].Height))
|
||||
@@ -454,4 +467,121 @@ public class PartyAvatarSideIndexHelper
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过边缘像素颜色识别出战角色编号
|
||||
/// </summary>
|
||||
/// <param name="mats"></param>
|
||||
/// <returns></returns>
|
||||
public static int FindActiveIndexRectByEdgeColor(Mat[] mats)
|
||||
{
|
||||
try
|
||||
{
|
||||
int whiteCount = 0, notWhiteRectNum = 0;
|
||||
for (int i = 0; i < mats.Length; i++)
|
||||
{
|
||||
if (CalculateWhiteEdgePixelsRatio(mats[i]) > 0.5)
|
||||
{
|
||||
whiteCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
notWhiteRectNum = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (whiteCount == mats.Length - 1)
|
||||
{
|
||||
return notWhiteRectNum;
|
||||
}
|
||||
else if (whiteCount == mats.Length)
|
||||
{
|
||||
// 如果四个都是白色,那就找内部有没有黑色
|
||||
int blackCount = 0, notBlackRectNum = -1;
|
||||
for (int i = 0; i < mats.Length; i++)
|
||||
{
|
||||
var count = OpenCvCommonHelper.CountGrayMatColorC1(mats[i], 50, 50); // 黑字
|
||||
if (count > 0)
|
||||
{
|
||||
blackCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
notBlackRectNum = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (notBlackRectNum >= 1)
|
||||
{
|
||||
TaskControl.Logger.LogDebug("当前所有编号边缘均为白色(背景过白),通过内部黑色像素识别出战编号为{Index},存在黑色数字的角色编号有{C1}个,总角色数量{C2}", notBlackRectNum, blackCount, mats.Length);
|
||||
return notBlackRectNum;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.WriteLine(e);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算灰度图最边缘一圈中纯白色(255)像素的占比
|
||||
/// </summary>
|
||||
/// <returns>返回纯白像素占比 (0.0 到 1.0)</returns>
|
||||
public static double CalculateWhiteEdgePixelsRatio(Mat image)
|
||||
{
|
||||
int whiteCount = 0;
|
||||
int height = image.Height;
|
||||
int width = image.Width;
|
||||
|
||||
// 如果图片太小,无法获取边缘
|
||||
if (height < 1 || width < 1)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// 计算总边缘像素数
|
||||
int totalCount = 2 * (width + height - 2);
|
||||
|
||||
// 顶边和底边
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
// 顶边
|
||||
if (image.At<byte>(0, x) == 255)
|
||||
{
|
||||
whiteCount++;
|
||||
}
|
||||
|
||||
// 底边(避免只有一行时重复计数)
|
||||
if (height > 1 && image.At<byte>(height - 1, x) == 255)
|
||||
{
|
||||
whiteCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// 左边和右边(不包括四个角,因为已经在顶边和底边中计算过)
|
||||
for (int y = 1; y < height - 1; y++)
|
||||
{
|
||||
// 左边
|
||||
if (image.At<byte>(y, 0) == 255)
|
||||
{
|
||||
whiteCount++;
|
||||
}
|
||||
|
||||
// 右边(避免只有一列时重复计数)
|
||||
if (width > 1 && image.At<byte>(y, width - 1) == 255)
|
||||
{
|
||||
whiteCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// 计算并返回占比
|
||||
return totalCount > 0 ? (double)whiteCount / totalCount : 0.0;
|
||||
}
|
||||
}
|
||||
@@ -167,9 +167,10 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
|
||||
{
|
||||
return new Task(() =>
|
||||
{
|
||||
Logger.LogInformation("→ {Name}执行宏", activeAvatar.Name);
|
||||
var round = 1;
|
||||
while (!ct.IsCancellationRequested && IsEnabled())
|
||||
{
|
||||
Logger.LogInformation("→ {Name}执行宏 (第{Round}轮)", activeAvatar.Name, round);
|
||||
if (IsHoldOnMode() && !_isKeyDown)
|
||||
{
|
||||
break;
|
||||
@@ -178,8 +179,14 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
|
||||
// 通用化战斗策略
|
||||
foreach (var command in combatCommands)
|
||||
{
|
||||
if (command.ActivatingRound != null && command.ActivatingRound.Count > 0 && !command.ActivatingRound.Contains(round))
|
||||
{
|
||||
// 跳过强制首轮指令
|
||||
continue;
|
||||
}
|
||||
command.Execute(activeAvatar);
|
||||
}
|
||||
round++;
|
||||
}
|
||||
|
||||
Logger.LogInformation("→ {Name}停止宏", activeAvatar.Name);
|
||||
@@ -194,7 +201,7 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
|
||||
|
||||
public Dictionary<string, List<CombatCommand>> LoadAvatarMacros()
|
||||
{
|
||||
var jsonPath = Global.Absolute("User/avatar_macro.json");
|
||||
var jsonPath = GetAvatarMacroJsonPath();
|
||||
var json = File.ReadAllText(jsonPath);
|
||||
_lastUpdateTime = File.GetLastWriteTime(jsonPath);
|
||||
var avatarMacros = JsonSerializer.Deserialize<List<AvatarMacro>>(json, ConfigService.JsonOptions);
|
||||
@@ -219,10 +226,20 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
|
||||
public bool IsAvatarMacrosEdited()
|
||||
{
|
||||
// 通过修改时间判断是否编辑过
|
||||
var jsonPath = Global.Absolute("User/avatar_macro.json");
|
||||
var jsonPath = GetAvatarMacroJsonPath();
|
||||
var lastWriteTime = File.GetLastWriteTime(jsonPath);
|
||||
return lastWriteTime > _lastUpdateTime;
|
||||
}
|
||||
|
||||
public static string GetAvatarMacroJsonPath()
|
||||
{
|
||||
var path = Global.Absolute("User/avatar_macro.json");
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
File.Copy(Global.Absolute("User/avatar_macro_default.json"), path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
public static bool IsEnabled()
|
||||
{
|
||||
|
||||
@@ -14,6 +14,8 @@ public class CombatCommand
|
||||
|
||||
public List<string>? Args { get; set; }
|
||||
|
||||
public List<int> ActivatingRound { get; set; }
|
||||
|
||||
public CombatCommand(string name, string command)
|
||||
{
|
||||
Name = name.Trim();
|
||||
@@ -62,6 +64,16 @@ public class CombatCommand
|
||||
throw new ArgumentException($"{Method.Alias[0]}方法的入参必须是VirtualKeyCodes枚举中的值,当前入参 {Args[0]} 不合法");
|
||||
}
|
||||
}
|
||||
else if (Method == Method.Scroll)
|
||||
{
|
||||
AssertUtils.IsTrue(Args.Count == 1, "scroll方法必须有一个入参,代表滚动格数。例:scroll(1) 或 scroll(-1)");
|
||||
AssertUtils.IsTrue(int.TryParse(Args[0], out _), "滚动格数必须是整数");
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"<CombatCommand {Name}, {Method}({Args}) (rounds {ActivatingRound})>";
|
||||
}
|
||||
|
||||
public void Execute(CombatScenes combatScenes, CombatCommand? lastCommand = null)
|
||||
@@ -95,7 +107,8 @@ public class CombatCommand
|
||||
&& Method != Method.MoveBy
|
||||
&& Method != Method.KeyDown
|
||||
&& Method != Method.KeyUp
|
||||
&& Method != Method.KeyPress)
|
||||
&& Method != Method.KeyPress
|
||||
&& Method != Method.Scroll)
|
||||
{
|
||||
avatar.Switch();
|
||||
}
|
||||
@@ -185,6 +198,10 @@ public class CombatCommand
|
||||
var s = double.Parse(Args![0]);
|
||||
avatar.Wait((int)TimeSpan.FromSeconds(s).TotalMilliseconds);
|
||||
}
|
||||
else if (Method == Method.Ready)
|
||||
{
|
||||
avatar.Ready();
|
||||
}
|
||||
else if (Method == Method.Aim)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -264,6 +281,14 @@ public class CombatCommand
|
||||
{
|
||||
avatar.KeyPress(Args![0]);
|
||||
}
|
||||
else if (Method == Method.Scroll)
|
||||
{
|
||||
avatar.Scroll(int.Parse(Args![0]));
|
||||
}
|
||||
else if (Method == Method.Round)
|
||||
{
|
||||
// 作为回合标记使用,不做任何操作
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
@@ -28,7 +28,8 @@ public class CombatScriptBag(List<CombatScript> combatScripts)
|
||||
}
|
||||
|
||||
if (matchCount != avatars.Count) continue;
|
||||
Logger.LogInformation("匹配到战斗脚本:{Name}", combatScript.Name);
|
||||
Logger.LogInformation("匹配到战斗脚本:{Name},共{Cnt}条指令,涉及角色:{Str}",
|
||||
combatScript.Name, combatScript.CombatCommands.Count, string.Join(",", combatScript.AvatarNames));
|
||||
return combatScript.CombatCommands;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public class CombatScriptParser
|
||||
}
|
||||
|
||||
var names = string.Join(",", combatAvatarNames);
|
||||
Logger.LogDebug("战斗脚本解析完成,共{Cnt}条指令,涉及角色:{Str}", combatCommands.Count, names);
|
||||
// Logger.LogDebug("战斗脚本解析完成,共{Cnt}条指令,涉及角色:{Str}", combatCommands.Count, names);
|
||||
|
||||
return new CombatScript(combatAvatarNames, combatCommands);
|
||||
}
|
||||
@@ -131,7 +131,70 @@ public class CombatScriptParser
|
||||
return oneLineCombatCommands;
|
||||
}
|
||||
|
||||
public static List<CombatCommand> ParseLineCommands(string lineWithoutAvatar, string avatarName)
|
||||
public static List<int> ParseRoundCommand(CombatCommand roundCommand) {
|
||||
// 解析round命令的入参,返回一个整数列表,代表在哪些回合执行后续指令
|
||||
// 支持Round(1)、Round(1,3,5)、Round(2-4)、Round(1,3-5)等格式
|
||||
var activatingRounds = new List<int>();
|
||||
if (roundCommand.Args == null || roundCommand.Args.Count == 0) {
|
||||
Logger.LogError("round方法必须有入参,代表在哪些回合执行后续指令,例:round(1)、round(1,3-5)");
|
||||
throw new ArgumentException("round方法必须有入参,代表在哪些回合执行后续指令,例:round(1)、round(1,3-5)");
|
||||
}
|
||||
foreach (var arg in roundCommand.Args) {
|
||||
if (arg.Contains('-')) {
|
||||
// 范围
|
||||
var parts = arg.Split('-', StringSplitOptions.TrimEntries);
|
||||
if (parts.Length != 2) {
|
||||
Logger.LogError("round方法的入参格式错误,例:round(1-3)");
|
||||
throw new ArgumentException("round方法的入参格式错误,例:round(1-3)");
|
||||
}
|
||||
var start = int.Parse(parts[0]);
|
||||
var end = int.Parse(parts[1]);
|
||||
if (start > end || start <= 0) {
|
||||
Logger.LogError("round方法的入参格式错误,起始回合必须小于等于结束回合且大于0,例:round(1-3)");
|
||||
throw new ArgumentException("round方法的入参格式错误,起始回合必须小于等于结束回合且大于0,例:round(1-3)");
|
||||
}
|
||||
for (int i = start; i <= end; i++) {
|
||||
activatingRounds.Add(i);
|
||||
}
|
||||
} else {
|
||||
// 单个回合
|
||||
var round = int.Parse(arg);
|
||||
if (round <= 0) {
|
||||
Logger.LogError("round方法的入参格式错误,回合数必须大于0,例:round(1)");
|
||||
throw new ArgumentException("round方法的入参格式错误,回合数必须大于0,例:round(1)");
|
||||
}
|
||||
activatingRounds.Add(round);
|
||||
}
|
||||
}
|
||||
return activatingRounds;
|
||||
}
|
||||
|
||||
public static List<CombatCommand> ParseLineCommands(string lineWithoutAvatar, string avatarName) {
|
||||
var parts = lineWithoutAvatar.Split("|", StringSplitOptions.RemoveEmptyEntries);
|
||||
var fullCombatCommands = new List<CombatCommand>();
|
||||
foreach (var part in parts)
|
||||
{
|
||||
var combatCommands = ParseLinePart(part, avatarName);
|
||||
if (combatCommands.Count > 0 && combatCommands[0].Method == Method.Round) {
|
||||
// 遇到round指令,作为回合分隔符使用,不加入最终指令列表
|
||||
var roundCommand = combatCommands[0];
|
||||
var activatingRounds = ParseRoundCommand(roundCommand);
|
||||
combatCommands.RemoveAt(0);
|
||||
foreach (var combatCommand in combatCommands) {
|
||||
|
||||
combatCommand.ActivatingRound = activatingRounds;
|
||||
}
|
||||
}
|
||||
fullCombatCommands.AddRange(combatCommands);
|
||||
}
|
||||
// foreach (var combatCommand in fullCombatCommands)
|
||||
// {
|
||||
// Logger.LogDebug("解析战斗脚本命令:{cmd}", combatCommand.ToString());
|
||||
// }
|
||||
return fullCombatCommands;
|
||||
}
|
||||
|
||||
public static List<CombatCommand> ParseLinePart(string lineWithoutAvatar, string avatarName)
|
||||
{
|
||||
var oneLineCombatCommands = new List<CombatCommand>();
|
||||
var commandArray = lineWithoutAvatar.Split(",", StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
@@ -12,6 +12,7 @@ public class Method
|
||||
public static readonly Method Attack = new(["attack", "普攻", "普通攻击"]);
|
||||
public static readonly Method Charge = new(["charge", "重击"]);
|
||||
public static readonly Method Wait = new(["wait", "after", "等待"]);
|
||||
public static readonly Method Ready = new(["ready", "完成"]);
|
||||
|
||||
public static readonly Method Walk = new(["walk", "行走"]);
|
||||
public static readonly Method W = new(["w"]);
|
||||
@@ -31,6 +32,8 @@ public class Method
|
||||
public static readonly Method KeyDown = new(["keydown"]);
|
||||
public static readonly Method KeyUp = new(["keyup"]);
|
||||
public static readonly Method KeyPress = new(["keypress"]);
|
||||
public static readonly Method Scroll = new(["scroll", "verticalscroll"]);
|
||||
public static readonly Method Round = new(["round"]);
|
||||
|
||||
public static IEnumerable<Method> Values
|
||||
{
|
||||
@@ -41,6 +44,7 @@ public class Method
|
||||
yield return Attack;
|
||||
yield return Charge;
|
||||
yield return Wait;
|
||||
yield return Ready;
|
||||
|
||||
yield return Walk;
|
||||
yield return W;
|
||||
@@ -60,6 +64,8 @@ public class Method
|
||||
yield return KeyDown;
|
||||
yield return KeyUp;
|
||||
yield return KeyPress;
|
||||
yield return Scroll;
|
||||
yield return Round;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,8 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
|
||||
{
|
||||
if (!SystemControl.IsGenshinImpactActiveByProcess())
|
||||
{
|
||||
_logger.LogInformation("当前获取焦点的窗口不是原神,停止执行");
|
||||
var name = SystemControl.GetActiveByProcess();
|
||||
_logger.LogWarning($"当前获取焦点的窗口为: {name},不是原神,停止执行");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -859,10 +859,8 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
|
||||
int hExtra = _cur.Height, vExtra = _cur.Height / 4;
|
||||
blackboard.fishBoxRect = new Rect(_cur.X - hExtra, _cur.Y - vExtra,
|
||||
(topMat.Width / 2 - _cur.X) * 2 + hExtra * 2, _cur.Height + vExtra * 2);
|
||||
// VisionContext.Instance().DrawContent.PutRect("FishBox", _fishBoxRect.ToRectDrawable(new Pen(Color.LightPink, 2)));
|
||||
using var boxRa = imageRegion.Derive(blackboard.fishBoxRect);
|
||||
using var pen = new System.Drawing.Pen(Color.LightPink, 2);
|
||||
boxRa.DrawSelf("FishBox", pen);
|
||||
boxRa.DrawSelf("FishBox", System.Drawing.Pens.LightPink);
|
||||
logger.LogInformation(" 识别到钓鱼框");
|
||||
return BehaviourStatus.Succeeded;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class BigFishType
|
||||
public static readonly BigFishType Rapidfish = new("rapidfish", BaitType.SpinelgrainBait, "斗士急流鱼", 9);
|
||||
public static readonly BigFishType PhonyUnihornfish = new("phony unihornfish", BaitType.EmberglowBait, "燃素独角鱼", 10);
|
||||
public static readonly BigFishType MagmaRapidfish = new("magma rapidfish", BaitType.EmberglowBait, "炽岩斗士急流鱼", 9);
|
||||
public static readonly BigFishType SecretSourceScoutSweeper = new ("secret", BaitType.EmberglowBait, "秘源机关・巡戒使", 9);
|
||||
public static readonly BigFishType SecretSourceScoutSweeper = new ("secret source", BaitType.EmberglowBait, "秘源机关・巡戒使", 9);
|
||||
|
||||
public static readonly BigFishType MaulerShark = new ("mauler shark", BaitType.RefreshingLakkaBait, "凶凶鲨", 9);
|
||||
public static readonly BigFishType CrystalEye = new("crystal eye", BaitType.RefreshingLakkaBait, "明眼鱼", 9);
|
||||
@@ -59,6 +59,7 @@ public class BigFishType
|
||||
yield return Rapidfish;
|
||||
yield return PhonyUnihornfish;
|
||||
yield return MagmaRapidfish;
|
||||
yield return SecretSourceScoutSweeper;
|
||||
yield return MaulerShark;
|
||||
yield return CrystalEye;
|
||||
yield return AxeheadFish;
|
||||
|
||||
@@ -648,7 +648,7 @@
|
||||
"nameEn": "charlotte",
|
||||
"type": "character",
|
||||
"name": "夏洛蒂",
|
||||
"hp": 10,
|
||||
"hp": 11,
|
||||
"energy": 2,
|
||||
"element": "冰元素",
|
||||
"weapon": "法器",
|
||||
@@ -996,6 +996,83 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1115,
|
||||
"nameEn": "escoffier",
|
||||
"type": "character",
|
||||
"name": "爱可菲",
|
||||
"hp": 11,
|
||||
"energy": 2,
|
||||
"element": "冰元素",
|
||||
"weapon": "长柄武器",
|
||||
"skills": [
|
||||
{
|
||||
"nameEn": "kitchen_skills",
|
||||
"name": "后厨手艺",
|
||||
"skillTag": [
|
||||
"普通攻击"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1101,
|
||||
"nameEn": "cryo",
|
||||
"type": "冰元素",
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"id": 1109,
|
||||
"nameEn": "unaligned_element",
|
||||
"type": "无色元素",
|
||||
"count": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "lowtemperature_cooking",
|
||||
"name": "低温烹饪",
|
||||
"skillTag": [
|
||||
"元素战技"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1101,
|
||||
"nameEn": "cryo",
|
||||
"type": "冰元素",
|
||||
"count": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "scoring_cuts",
|
||||
"name": "花刀技法",
|
||||
"skillTag": [
|
||||
"元素爆发"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1101,
|
||||
"nameEn": "cryo",
|
||||
"type": "冰元素",
|
||||
"count": 3
|
||||
},
|
||||
{
|
||||
"id": 1110,
|
||||
"nameEn": "energy",
|
||||
"type": "充能",
|
||||
"count": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "constant_offthecuff_cookery",
|
||||
"name": "时时刻刻的即兴料理",
|
||||
"skillTag": [
|
||||
"被动技能"
|
||||
],
|
||||
"cost": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1201,
|
||||
"nameEn": "barbara",
|
||||
@@ -1362,7 +1439,7 @@
|
||||
"nameEn": "kamisato_ayato",
|
||||
"type": "character",
|
||||
"name": "神里绫人",
|
||||
"hp": 10,
|
||||
"hp": 11,
|
||||
"energy": 2,
|
||||
"element": "水元素",
|
||||
"weapon": "单手剑",
|
||||
@@ -1715,7 +1792,7 @@
|
||||
"nameEn": "furina",
|
||||
"type": "character",
|
||||
"name": "芙宁娜",
|
||||
"hp": 10,
|
||||
"hp": 12,
|
||||
"energy": 2,
|
||||
"element": "水元素",
|
||||
"weapon": "单手剑",
|
||||
@@ -2643,7 +2720,7 @@
|
||||
"nameEn": "thoma",
|
||||
"type": "character",
|
||||
"name": "托马",
|
||||
"hp": 10,
|
||||
"hp": 12,
|
||||
"energy": 2,
|
||||
"element": "火元素",
|
||||
"weapon": "长柄武器",
|
||||
@@ -3001,6 +3078,75 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1316,
|
||||
"nameEn": "gaming",
|
||||
"type": "character",
|
||||
"name": "嘉明",
|
||||
"hp": 10,
|
||||
"energy": 3,
|
||||
"element": "火元素",
|
||||
"weapon": "双手剑",
|
||||
"skills": [
|
||||
{
|
||||
"nameEn": "stellar_rend",
|
||||
"name": "刃爪悬星",
|
||||
"skillTag": [
|
||||
"普通攻击"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1103,
|
||||
"nameEn": "pyro",
|
||||
"type": "火元素",
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"id": 1109,
|
||||
"nameEn": "unaligned_element",
|
||||
"type": "无色元素",
|
||||
"count": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "bestial_ascent",
|
||||
"name": "瑞兽登高楼",
|
||||
"skillTag": [
|
||||
"元素战技"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1103,
|
||||
"nameEn": "pyro",
|
||||
"type": "火元素",
|
||||
"count": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "suannis_gilded_dance",
|
||||
"name": "璨焰金猊舞",
|
||||
"skillTag": [
|
||||
"元素爆发"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1103,
|
||||
"nameEn": "pyro",
|
||||
"type": "火元素",
|
||||
"count": 3
|
||||
},
|
||||
{
|
||||
"id": 1110,
|
||||
"nameEn": "energy",
|
||||
"type": "充能",
|
||||
"count": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1401,
|
||||
"nameEn": "fischl",
|
||||
@@ -3927,7 +4073,7 @@
|
||||
"nameEn": "iansan",
|
||||
"type": "character",
|
||||
"name": "伊安珊",
|
||||
"hp": 12,
|
||||
"hp": 11,
|
||||
"energy": 2,
|
||||
"element": "雷元素",
|
||||
"weapon": "长柄武器",
|
||||
@@ -4076,6 +4222,83 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1416,
|
||||
"nameEn": "ororon",
|
||||
"type": "character",
|
||||
"name": "欧洛伦",
|
||||
"hp": 10,
|
||||
"energy": 2,
|
||||
"element": "雷元素",
|
||||
"weapon": "弓",
|
||||
"skills": [
|
||||
{
|
||||
"nameEn": "spiritvessel_snapshot",
|
||||
"name": "宿灵闪箭",
|
||||
"skillTag": [
|
||||
"普通攻击"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1104,
|
||||
"nameEn": "electro",
|
||||
"type": "雷元素",
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"id": 1109,
|
||||
"nameEn": "unaligned_element",
|
||||
"type": "无色元素",
|
||||
"count": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "nights_sling",
|
||||
"name": "暝色缒索",
|
||||
"skillTag": [
|
||||
"元素战技"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1104,
|
||||
"nameEn": "electro",
|
||||
"type": "雷元素",
|
||||
"count": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "dark_voices_echo",
|
||||
"name": "黯声回响",
|
||||
"skillTag": [
|
||||
"元素爆发"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1104,
|
||||
"nameEn": "electro",
|
||||
"type": "雷元素",
|
||||
"count": 3
|
||||
},
|
||||
{
|
||||
"id": 1110,
|
||||
"nameEn": "energy",
|
||||
"type": "充能",
|
||||
"count": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "nightshade_synesthesia",
|
||||
"name": "夜翳的通感",
|
||||
"skillTag": [
|
||||
"被动技能"
|
||||
],
|
||||
"cost": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1501,
|
||||
"nameEn": "sucrose",
|
||||
@@ -5922,7 +6145,7 @@
|
||||
"nameEn": "collei",
|
||||
"type": "character",
|
||||
"name": "柯莱",
|
||||
"hp": 10,
|
||||
"hp": 11,
|
||||
"energy": 2,
|
||||
"element": "草元素",
|
||||
"weapon": "弓",
|
||||
@@ -7311,7 +7534,7 @@
|
||||
"nameEn": "hydro_tulpa",
|
||||
"type": "character",
|
||||
"name": "水形幻人",
|
||||
"hp": 12,
|
||||
"hp": 11,
|
||||
"energy": 3,
|
||||
"element": "水元素",
|
||||
"weapon": "其他武器",
|
||||
@@ -7383,6 +7606,83 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2207,
|
||||
"nameEn": "consecrated_horned_crocodile",
|
||||
"type": "character",
|
||||
"name": "圣骸角鳄",
|
||||
"hp": 11,
|
||||
"energy": 2,
|
||||
"element": "水元素",
|
||||
"weapon": "其他武器",
|
||||
"skills": [
|
||||
{
|
||||
"nameEn": "fang_bite",
|
||||
"name": "尖牙噬咬",
|
||||
"skillTag": [
|
||||
"普通攻击"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1102,
|
||||
"nameEn": "hydro",
|
||||
"type": "水元素",
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"id": 1109,
|
||||
"nameEn": "unaligned_element",
|
||||
"type": "无色元素",
|
||||
"count": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "sawtoothed_surge",
|
||||
"name": "鳄齿锐波",
|
||||
"skillTag": [
|
||||
"元素战技"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1102,
|
||||
"nameEn": "hydro",
|
||||
"type": "水元素",
|
||||
"count": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "reptilian_rage",
|
||||
"name": "凶鳄狂浪",
|
||||
"skillTag": [
|
||||
"元素爆发"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1102,
|
||||
"nameEn": "hydro",
|
||||
"type": "水元素",
|
||||
"count": 3
|
||||
},
|
||||
{
|
||||
"id": 1110,
|
||||
"nameEn": "energy",
|
||||
"type": "充能",
|
||||
"count": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "consecrated_senses",
|
||||
"name": "圣骸感应",
|
||||
"skillTag": [
|
||||
"被动技能"
|
||||
],
|
||||
"cost": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2301,
|
||||
"nameEn": "fatui_pyro_agent",
|
||||
@@ -7696,7 +7996,7 @@
|
||||
"nameEn": "lord_of_eroded_primal_fire",
|
||||
"type": "character",
|
||||
"name": "蚀灭的源焰之主",
|
||||
"hp": 12,
|
||||
"hp": 11,
|
||||
"energy": 2,
|
||||
"element": "火元素",
|
||||
"weapon": "其他武器",
|
||||
@@ -8690,6 +8990,83 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2604,
|
||||
"nameEn": "black_serpent_knight_rockbreaker_ax",
|
||||
"type": "character",
|
||||
"name": "黑蛇骑士·摧岩之钺",
|
||||
"hp": 12,
|
||||
"energy": 2,
|
||||
"element": "岩元素",
|
||||
"weapon": "其他武器",
|
||||
"skills": [
|
||||
{
|
||||
"nameEn": "supreme_strike",
|
||||
"name": "顶位迅斩",
|
||||
"skillTag": [
|
||||
"普通攻击"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1106,
|
||||
"nameEn": "geo",
|
||||
"type": "岩元素",
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"id": 1109,
|
||||
"nameEn": "unaligned_element",
|
||||
"type": "无色元素",
|
||||
"count": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "axe_and_aegis",
|
||||
"name": "斧盾震击",
|
||||
"skillTag": [
|
||||
"元素战技"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1106,
|
||||
"nameEn": "geo",
|
||||
"type": "岩元素",
|
||||
"count": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "stone_stance",
|
||||
"name": "坚岩姿态",
|
||||
"skillTag": [
|
||||
"元素爆发"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1106,
|
||||
"nameEn": "geo",
|
||||
"type": "岩元素",
|
||||
"count": 3
|
||||
},
|
||||
{
|
||||
"id": 1110,
|
||||
"nameEn": "energy",
|
||||
"type": "充能",
|
||||
"count": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "attacking_momentum",
|
||||
"name": "攻阵气势",
|
||||
"skillTag": [
|
||||
"被动技能"
|
||||
],
|
||||
"cost": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2701,
|
||||
"nameEn": "jadeplume_terrorshroom",
|
||||
@@ -8997,5 +9374,76 @@
|
||||
"cost": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 6605,
|
||||
"nameEn": "skirk",
|
||||
"type": "character",
|
||||
"name": "丝柯克",
|
||||
"hp": 10,
|
||||
"energy": 0,
|
||||
"element": "冰元素",
|
||||
"weapon": "单手剑",
|
||||
"skills": [
|
||||
{
|
||||
"nameEn": "havoc_sunder",
|
||||
"name": "极恶技·断",
|
||||
"skillTag": [
|
||||
"普通攻击"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1101,
|
||||
"nameEn": "cryo",
|
||||
"type": "冰元素",
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"id": 1109,
|
||||
"nameEn": "unaligned_element",
|
||||
"type": "无色元素",
|
||||
"count": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "havoc_warp",
|
||||
"name": "极恶技·闪",
|
||||
"skillTag": [
|
||||
"元素战技"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1101,
|
||||
"nameEn": "cryo",
|
||||
"type": "冰元素",
|
||||
"count": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "havoc_extinction",
|
||||
"name": "极恶技·尽",
|
||||
"skillTag": [
|
||||
"元素爆发"
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"id": 1101,
|
||||
"nameEn": "cryo",
|
||||
"type": "冰元素",
|
||||
"count": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nameEn": "reason_beyond_reason",
|
||||
"name": "理外之理",
|
||||
"skillTag": [
|
||||
"被动技能"
|
||||
],
|
||||
"cost": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -101,13 +101,21 @@ public class GeniusInvokationControl
|
||||
|
||||
public void CheckTask()
|
||||
{
|
||||
if (_ct is { IsCancellationRequested: true })
|
||||
NewRetry.Do(() =>
|
||||
{
|
||||
throw new TaskCanceledException("任务取消");
|
||||
}
|
||||
if (_ct is { IsCancellationRequested: true })
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check pause state and window focus without sleeping
|
||||
TaskControl.CheckPauseAndWindowFocus();
|
||||
TaskControl.TrySuspend();
|
||||
if (!SystemControl.IsGenshinImpactActiveByProcess())
|
||||
{
|
||||
var name = SystemControl.GetActiveByProcess();
|
||||
_logger.LogWarning($"当前获取焦点的窗口为: {name},不是原神,暂停");
|
||||
throw new RetryException("当前获取焦点的窗口不是原神");
|
||||
}
|
||||
}, TimeSpan.FromSeconds(1), 100);
|
||||
|
||||
if (_ct is { IsCancellationRequested: true })
|
||||
{
|
||||
@@ -707,13 +715,6 @@ public class GeniusInvokationControl
|
||||
Sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
// 存在吞星之鲸的情况下,烧牌后等待加血动画
|
||||
if (duel.Characters.Any(c => c is { Name: "吞星之鲸" }))
|
||||
{
|
||||
Debug.WriteLine("存在吞星之鲸的情况下,烧牌后等待动画");
|
||||
Sleep(5000);
|
||||
}
|
||||
}
|
||||
|
||||
return ActionPhaseUseSkill(skillIndex);
|
||||
@@ -1247,4 +1248,4 @@ public class GeniusInvokationControl
|
||||
return -10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using BetterGenshinImpact.GameTask.AutoGeniusInvokation.Model;
|
||||
using BetterGenshinImpact.GameTask.Common.Job;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoPathing.Handler;
|
||||
|
||||
@@ -27,6 +28,7 @@ public class ActionFactory
|
||||
"mining" => new MiningHandler(),
|
||||
"fishing" => new FishingHandler(),
|
||||
"exit_and_relogin" => new ExitAndReloginHandler(),
|
||||
"wonderland_cycle" => new EnterAndExitWonderlandHandler(),
|
||||
"set_time" => new SetTimeHandler(),
|
||||
"use_gadget" => new UseGadgetHandler(),
|
||||
"pick_up_collect" => new PickUpCollectHandler(),
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing.Model;
|
||||
using BetterGenshinImpact.GameTask.Common.Job;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoPathing.Handler;
|
||||
|
||||
public class EnterAndExitWonderlandHandler : IActionHandler
|
||||
{
|
||||
private readonly EnterAndExitWonderlandJob _enterAndExitWonderlandJob = new();
|
||||
|
||||
public async Task RunAsync(CancellationToken ct, WaypointForTrack? waypointForTrack = null, object? config = null)
|
||||
{
|
||||
await _enterAndExitWonderlandJob.Start(ct);
|
||||
}
|
||||
}
|
||||
@@ -18,22 +18,23 @@ public class MiningHandler : IActionHandler
|
||||
{
|
||||
private readonly string[] _miningActions =
|
||||
[
|
||||
"诺艾尔 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"娜维娅 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"玛薇卡 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"爱诺 attack(0.8)",
|
||||
"诺艾尔 attack(1.25)",
|
||||
"玛薇卡 attack(0.20),j,wait(0.5),attack(0.6)",
|
||||
"迪希雅 attack(0.6),mousedown,wait(2.1),mouseup,j",
|
||||
"娜维娅 attack(1.25)",
|
||||
"辛焱 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"重云 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"迪卢克 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"荒泷一斗 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"迪希雅 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"荒泷一斗 attack(0.1),charge(1.9),j,wait(0.5),attack(0.2)",
|
||||
"基尼奇 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"菲米尼 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"卡维 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"优菈 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"嘉明 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"多莉 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"多莉 attack(2.0)",
|
||||
"北斗 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"早柚 attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8),attack(0.28),jump,wait(0.8)",
|
||||
"早柚 attack(0.23),j,wait(0.6),attack(0.23),j,wait(0.6),attack(0.23),j,wait(0.6),attack(0.23),j,wait(0.6)",
|
||||
"迪卢克 charge(3.15),j",
|
||||
"坎蒂丝 e(hold,wait)",
|
||||
"雷泽 e(hold,wait)",
|
||||
"凝光 attack(4.0)",
|
||||
|
||||
@@ -35,6 +35,13 @@ public class UseGadgetHandler : IActionHandler
|
||||
}
|
||||
else
|
||||
{
|
||||
double maxWaitSeconds = 100;
|
||||
if (waypointForTrack != null
|
||||
&& !string.IsNullOrEmpty(waypointForTrack.ActionParams))
|
||||
{
|
||||
double.TryParse(waypointForTrack.ActionParams, out maxWaitSeconds); // 最大等待时间,单位秒
|
||||
}
|
||||
|
||||
var screen = CaptureToRectArea();
|
||||
var cd = GetCurrentCd(screen);
|
||||
if (cd > 100)
|
||||
@@ -46,7 +53,17 @@ public class UseGadgetHandler : IActionHandler
|
||||
{
|
||||
Logger.LogInformation("小道具正在CD中,等待CD结束 :{Cd}秒", cd);
|
||||
// 等待小道具CD结束
|
||||
var waitTime = (int)(cd * 1000) + 100; // 等待CD结束后再继续
|
||||
int waitTime; // 等待CD结束后再继续
|
||||
if (cd > maxWaitSeconds)
|
||||
{
|
||||
waitTime = (int)(maxWaitSeconds * 1000);
|
||||
Logger.LogInformation("CD过长,使用最大CD:{Max}秒", maxWaitSeconds);
|
||||
}
|
||||
else
|
||||
{
|
||||
waitTime = (int)(cd * 1000) + 100; // 等待CD结束后再继续
|
||||
}
|
||||
|
||||
await Delay(waitTime, ct);
|
||||
Simulation.SendInput.SimulateAction(GIActions.QuickUseGadget);
|
||||
}
|
||||
@@ -55,6 +72,7 @@ public class UseGadgetHandler : IActionHandler
|
||||
Simulation.SendInput.SimulateAction(GIActions.QuickUseGadget);
|
||||
}
|
||||
}
|
||||
|
||||
Logger.LogInformation("使用小道具");
|
||||
await Delay(300, ct);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@ public class ActionEnum(string code, string msg, ActionUseWaypointTypeEnum useWa
|
||||
|
||||
public static readonly ActionEnum Fishing = new("fishing", "钓鱼", ActionUseWaypointTypeEnum.Custom);
|
||||
public static readonly ActionEnum ExitAndRelogin = new("exit_and_relogin", "退出重新登录", ActionUseWaypointTypeEnum.Custom);
|
||||
|
||||
public static readonly ActionEnum EnterAndExitWonderland =
|
||||
new("wonderland_cycle", "进出千星奇域", ActionUseWaypointTypeEnum.Custom);
|
||||
public static readonly ActionEnum SetTime = new("set_time", "设置时间", ActionUseWaypointTypeEnum.Custom);
|
||||
public static readonly ActionEnum UseGadget = new("use_gadget", "使用小道具", ActionUseWaypointTypeEnum.Custom);
|
||||
public static readonly ActionEnum PickUpCollect = new("pick_up_collect", "聚集材料", ActionUseWaypointTypeEnum.Custom);
|
||||
|
||||
@@ -53,7 +53,9 @@ public class WaypointForTrack : Waypoint
|
||||
// 坐标系转换
|
||||
mapMatchMethod ??= TaskContext.Instance().Config.PathingConditionConfig.MapMatchingMethod;
|
||||
MapMatchMethod = mapMatchMethod;
|
||||
(MatX, MatY) = MapManager.GetMap(mapName, MapMatchMethod).ConvertGenshinMapCoordinatesToImageCoordinates((float)waypoint.X, (float)waypoint.Y);
|
||||
var MatP = MapManager.GetMap(mapName, MapMatchMethod).ConvertGenshinMapCoordinatesToImageCoordinates(new OpenCvSharp.Point2f((float)waypoint.X, (float)waypoint.Y));
|
||||
MatX = MatP.X;
|
||||
MatY = MatP.Y;
|
||||
X = MatX;
|
||||
Y = MatY;
|
||||
if (waypoint.Action == ActionEnum.CombatScript.Code)
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Navigation
|
||||
{
|
||||
if (!_isWarmUp)
|
||||
{
|
||||
MapManager.GetMap(MapTypes.Teyvat, mapMatchMethod);
|
||||
MapManager.GetMap(MapTypes.Teyvat, mapMatchMethod).WarmUp();
|
||||
}
|
||||
|
||||
_isWarmUp = true;
|
||||
|
||||
@@ -186,6 +186,10 @@ public class PathExecutor
|
||||
|
||||
if (waypoint.Type == WaypointType.Teleport.Code)
|
||||
{
|
||||
if (CurWaypoints.Item1 > 0)
|
||||
{
|
||||
await Delay(1000, ct);
|
||||
}
|
||||
await HandleTeleportWaypoint(waypoint);
|
||||
}
|
||||
else
|
||||
@@ -689,7 +693,7 @@ public class PathExecutor
|
||||
await TryGetExpeditionRewardsDispatch(tpTask);
|
||||
var (tpX, tpY) = await tpTask.Tp(waypoint.GameX, waypoint.GameY, waypoint.MapName, forceTp);
|
||||
var (tprX, tprY) = MapManager.GetMap(waypoint.MapName, waypoint.MapMatchMethod)
|
||||
.ConvertGenshinMapCoordinatesToImageCoordinates((float)tpX, (float)tpY);
|
||||
.ConvertGenshinMapCoordinatesToImageCoordinates(new Point2f((float)tpX, (float)tpY));
|
||||
Navigation.SetPrevPosition(tprX, tprY); // 通过上一个位置直接进行局部特征匹配
|
||||
await Delay(500, ct); // 多等一会
|
||||
}
|
||||
@@ -721,6 +725,7 @@ public class PathExecutor
|
||||
var fastMode = false;
|
||||
var prevPositions = new List<Point2f>();
|
||||
var fastModeColdTime = DateTime.MinValue;
|
||||
var prevNotTooFarPosition = position;
|
||||
int num = 0, distanceTooFarRetryCount = 0, consecutiveRotationCountBeyondAngle = 0;
|
||||
|
||||
// 按下w,一直走
|
||||
@@ -790,10 +795,22 @@ public class PathExecutor
|
||||
{
|
||||
Logger.LogWarning($"距离过远({position.X},{position.Y})->({waypoint.X},{waypoint.Y})={distance},重试");
|
||||
}
|
||||
// 取余减少判断频率
|
||||
if (distanceTooFarRetryCount % 10 == 0)
|
||||
{
|
||||
await ResolveAnomalies(screen);
|
||||
Logger.LogInformation($"重置到上次正确识别的坐标 ({prevNotTooFarPosition.X},{prevNotTooFarPosition.Y})");
|
||||
Navigation.SetPrevPosition(prevNotTooFarPosition.X, prevNotTooFarPosition.Y);
|
||||
// 淡入淡出特效
|
||||
await Delay(500, ct);
|
||||
}
|
||||
await Delay(50, ct);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
prevNotTooFarPosition = position;
|
||||
}
|
||||
|
||||
// 非攀爬状态下,检测是否卡死(脱困触发器)
|
||||
@@ -1074,6 +1091,7 @@ public class PathExecutor
|
||||
|| waypoint.Action == ActionEnum.Mining.Code
|
||||
|| waypoint.Action == ActionEnum.Fishing.Code
|
||||
|| waypoint.Action == ActionEnum.ExitAndRelogin.Code
|
||||
|| waypoint.Action == ActionEnum.EnterAndExitWonderland.Code
|
||||
|| waypoint.Action == ActionEnum.SetTime.Code
|
||||
|| waypoint.Action == ActionEnum.UseGadget.Code
|
||||
|| waypoint.Action == ActionEnum.PickUpCollect.Code)
|
||||
@@ -1332,6 +1350,7 @@ public class PathExecutor
|
||||
if (disabledUiButtonRa.IsExist())
|
||||
{
|
||||
_autoSkipTrigger.OnCapture(new CaptureContent(ra));
|
||||
noDisabledUiButtonTimes = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -62,13 +62,16 @@ public class PathRecorder : Singleton<PathRecorder>
|
||||
var waypoint = new Waypoint();
|
||||
var screen = TaskControl.CaptureToRectArea();
|
||||
var position = Navigation.GetPositionStable(screen, GetMapName(), matchingMethod);
|
||||
if (position == default)
|
||||
var nullablePosition = MapManager.GetMap(GetMapName(), matchingMethod).ConvertImageCoordinatesToGenshinMapCoordinates(position);
|
||||
if (nullablePosition == null)
|
||||
{
|
||||
TaskControl.Logger.LogWarning("未识别到当前位置!");
|
||||
return;
|
||||
}
|
||||
|
||||
position = MapManager.GetMap(GetMapName(), matchingMethod).ConvertImageCoordinatesToGenshinMapCoordinates(position);
|
||||
else
|
||||
{
|
||||
position = nullablePosition.Value;
|
||||
}
|
||||
waypoint.X = position.X;
|
||||
waypoint.Y = position.Y;
|
||||
waypoint.Type = WaypointType.Teleport.Code;
|
||||
@@ -91,12 +94,16 @@ public class PathRecorder : Singleton<PathRecorder>
|
||||
var screen = TaskControl.CaptureToRectArea();
|
||||
var matchingMethod = TaskContext.Instance().Config.PathingConditionConfig.MapMatchingMethod;
|
||||
var position = Navigation.GetPositionStable(screen, GetMapName(), matchingMethod);
|
||||
position = MapManager.GetMap(GetMapName(), matchingMethod).ConvertImageCoordinatesToGenshinMapCoordinates(position);
|
||||
if (position == default)
|
||||
var nullablePosition = MapManager.GetMap(GetMapName(), matchingMethod).ConvertImageCoordinatesToGenshinMapCoordinates(position);
|
||||
if (nullablePosition == null)
|
||||
{
|
||||
TaskControl.Logger.LogWarning("未识别到当前位置!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
position = nullablePosition.Value;
|
||||
}
|
||||
|
||||
waypoint.X = position.X;
|
||||
waypoint.Y = position.Y;
|
||||
|
||||
|
After Width: | Height: | Size: 308 B |
@@ -16,6 +16,8 @@ public class AutoPickAssets : BaseAssets<AutoPickAssets>
|
||||
public RecognitionObject FRo;
|
||||
public RecognitionObject ChatIconRo;
|
||||
public RecognitionObject SettingsIconRo;
|
||||
public RecognitionObject LRo;
|
||||
|
||||
|
||||
public User32.VK PickVk = User32.VK.VK_F;
|
||||
public RecognitionObject PickRo;
|
||||
@@ -51,6 +53,18 @@ public class AutoPickAssets : BaseAssets<AutoPickAssets>
|
||||
DrawOnWindow = false,
|
||||
DrawOnWindowPen = new Pen(Color.Chocolate, 2)
|
||||
}.InitTemplate();
|
||||
|
||||
LRo = new RecognitionObject
|
||||
{
|
||||
Name = "L",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoPick", "L.png"),
|
||||
RegionOfInterest = new Rect(CaptureRect.Width-(int)(110 * AssetScale),
|
||||
(int)(550 * AssetScale),
|
||||
(int)(70 * AssetScale),
|
||||
(int)(100 * AssetScale)),
|
||||
}.InitTemplate();
|
||||
|
||||
|
||||
PickRo = FRo;
|
||||
var keyName = TaskContext.Instance().Config.AutoPickConfig.PickKey;
|
||||
|
||||
@@ -38,7 +38,7 @@ public partial class AutoPickTrigger : ITaskTrigger
|
||||
/// 拾取黑名单
|
||||
/// </summary>
|
||||
private HashSet<string> _blackList = [];
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 拾取黑名单(模糊匹配)
|
||||
/// </summary>
|
||||
@@ -54,6 +54,47 @@ public partial class AutoPickTrigger : ITaskTrigger
|
||||
// 外部配置
|
||||
private AutoPickExternalConfig? _externalConfig;
|
||||
|
||||
/// <summary>
|
||||
/// 上一帧 OCR 结果
|
||||
/// </summary>
|
||||
private string? _lastOcrText;
|
||||
|
||||
/// <summary>
|
||||
/// 连续相同 OCR 结果的帧数
|
||||
/// </summary>
|
||||
private int _sameOcrFrameCount;
|
||||
|
||||
/// <summary>
|
||||
/// 判定为稳定所需的最小连续帧数
|
||||
/// </summary>
|
||||
private const int OcrStableFrameThreshold = 2;
|
||||
|
||||
/// <summary>
|
||||
/// OCR 帧稳定确认
|
||||
/// </summary>
|
||||
private bool IsOcrTextStable(string text)
|
||||
{
|
||||
if (text == _lastOcrText)
|
||||
{
|
||||
_sameOcrFrameCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
_lastOcrText = text;
|
||||
_sameOcrFrameCount = 1;
|
||||
}
|
||||
|
||||
if (_sameOcrFrameCount >= OcrStableFrameThreshold)
|
||||
{
|
||||
// 重置
|
||||
_lastOcrText = null;
|
||||
_sameOcrFrameCount = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public AutoPickTrigger()
|
||||
{
|
||||
_autoPickAssets = AutoPickAssets.Instance;
|
||||
@@ -78,7 +119,8 @@ public partial class AutoPickTrigger : ITaskTrigger
|
||||
{
|
||||
_blackList.UnionWith(userBlackList);
|
||||
}
|
||||
_fuzzyBlackList = ReadTextList(@"User\pick_black_lists.txt");
|
||||
|
||||
_fuzzyBlackList = ReadTextList(@"User\pick_fuzzy_black_lists.txt");
|
||||
}
|
||||
|
||||
if (config.WhiteListEnabled)
|
||||
@@ -125,7 +167,7 @@ public partial class AutoPickTrigger : ITaskTrigger
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
private List<string> ReadTextList(string textFilePath)
|
||||
{
|
||||
try
|
||||
@@ -195,12 +237,19 @@ public partial class AutoPickTrigger : ITaskTrigger
|
||||
var scale = TaskContext.Instance().SystemInfo.AssetScale;
|
||||
var config = TaskContext.Instance().Config.AutoPickConfig;
|
||||
|
||||
// 存在 L 键位是千星奇遇,无需拾取
|
||||
using var lKeyRa = content.CaptureRectArea.Find(_autoPickAssets.LRo);
|
||||
if (lKeyRa.IsExist())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 识别到拾取键,开始识别物品图标
|
||||
var isExcludeIcon = false;
|
||||
_autoPickAssets.ChatIconRo.RegionOfInterest = new Rect(
|
||||
foundRectArea.X + (int)(config.ItemIconLeftOffset * scale), foundRectArea.Y,
|
||||
(int)((config.ItemTextLeftOffset - config.ItemIconLeftOffset) * scale), foundRectArea.Height);
|
||||
var chatIconRa = content.CaptureRectArea.Find(_autoPickAssets.ChatIconRo);
|
||||
using var chatIconRa = content.CaptureRectArea.Find(_autoPickAssets.ChatIconRo);
|
||||
speedTimer.Record("识别聊天图标");
|
||||
if (!chatIconRa.IsEmpty())
|
||||
{
|
||||
@@ -210,7 +259,7 @@ public partial class AutoPickTrigger : ITaskTrigger
|
||||
else
|
||||
{
|
||||
_autoPickAssets.SettingsIconRo.RegionOfInterest = _autoPickAssets.ChatIconRo.RegionOfInterest;
|
||||
var settingsIconRa = content.CaptureRectArea.Find(_autoPickAssets.SettingsIconRo);
|
||||
using var settingsIconRa = content.CaptureRectArea.Find(_autoPickAssets.SettingsIconRo);
|
||||
speedTimer.Record("识别设置图标");
|
||||
if (!settingsIconRa.IsEmpty())
|
||||
{
|
||||
@@ -255,8 +304,7 @@ public partial class AutoPickTrigger : ITaskTrigger
|
||||
return;
|
||||
}
|
||||
|
||||
// var textMat = new Mat(content.CaptureRectArea.SrcGreyMat, textRect);
|
||||
var gradMat = new Mat(content.CaptureRectArea.CacheGreyMat,
|
||||
using var gradMat = new Mat(content.CaptureRectArea.CacheGreyMat,
|
||||
new Rect(textRect.X, textRect.Y, textRect.Width, Math.Min(textRect.Height, 3)));
|
||||
var avgGrad = gradMat.Sobel(MatType.CV_32F, 1, 0).Mean().Val0;
|
||||
if (avgGrad < -3)
|
||||
@@ -273,16 +321,17 @@ public partial class AutoPickTrigger : ITaskTrigger
|
||||
}
|
||||
else
|
||||
{
|
||||
var textMat = new Mat(content.CaptureRectArea.SrcMat, textRect);
|
||||
using var textMat = new Mat(content.CaptureRectArea.SrcMat, textRect);
|
||||
var boundingRect = TextRectExtractor.GetTextBoundingRect(textMat);
|
||||
// var boundingRect = new Rect(); // 不使用自己写的文字区域提取
|
||||
// 如果找到有效区域
|
||||
if (boundingRect.X <20 && boundingRect.Width > 5 && boundingRect.Height > 5)
|
||||
if (boundingRect.X < 20 && boundingRect.Width > 5 && boundingRect.Height > 5)
|
||||
{
|
||||
// 截取只包含文字的区域
|
||||
var textOnlyMat = new Mat(textMat, new Rect(0, 0,
|
||||
using var textOnlyMat = new Mat(textMat, new Rect(0, 0,
|
||||
boundingRect.Right + 5 < textMat.Width ? boundingRect.Right + 5 : textMat.Width, textMat.Height));
|
||||
text = OcrFactory.Paddle.OcrWithoutDetector(textOnlyMat);
|
||||
|
||||
|
||||
// if (RuntimeHelper.IsDebug)
|
||||
// {
|
||||
// // 如果不等于正确文字,则保存图片
|
||||
@@ -307,44 +356,44 @@ public partial class AutoPickTrigger : ITaskTrigger
|
||||
}
|
||||
|
||||
speedTimer.Record("文字识别");
|
||||
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
// 处理OCR识别结果,清理无效字符并确保引号配对
|
||||
text = ProcessOcrText(text);
|
||||
|
||||
if (DoNotPick(text))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 单个字符不拾取
|
||||
if (text.Length <= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 连续多帧识别结果一致,进行下一步
|
||||
if (!IsOcrTextStable(text))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (config.WhiteListEnabled && _whiteList.Contains(text))
|
||||
{
|
||||
LogPick(content, text);
|
||||
Simulation.SendInput.Keyboard.KeyPress(AutoPickAssets.Instance.PickVk);
|
||||
return;
|
||||
}
|
||||
|
||||
speedTimer.Record("白名单判断");
|
||||
|
||||
if (isExcludeIcon)
|
||||
{
|
||||
//Debug.WriteLine("AutoPickTrigger: 物品图标是聊天气泡,一般是NPC对话,不拾取");
|
||||
return;
|
||||
}
|
||||
|
||||
if (config.BlackListEnabled)
|
||||
{
|
||||
if (_blackList.Contains(text))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_fuzzyBlackList.Count>0)
|
||||
if (_fuzzyBlackList.Count > 0)
|
||||
{
|
||||
if (_fuzzyBlackList.Any(item => text.Contains(item)))
|
||||
{
|
||||
@@ -352,16 +401,12 @@ public partial class AutoPickTrigger : ITaskTrigger
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
speedTimer.Record("黑名单判断");
|
||||
|
||||
LogPick(content, text);
|
||||
Simulation.SendInput.Keyboard.KeyPress(AutoPickAssets.Instance.PickVk);
|
||||
}
|
||||
|
||||
speedTimer.DebugPrint();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private bool DoNotPick(string text)
|
||||
@@ -378,12 +423,13 @@ public partial class AutoPickTrigger : ITaskTrigger
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// 挪德卡莱聚所中文名特殊处理,不拾取
|
||||
if (text.Contains("聚所"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (text.Contains("霜月") && text.Contains("坊"))
|
||||
{
|
||||
return true;
|
||||
@@ -394,6 +440,11 @@ public partial class AutoPickTrigger : ITaskTrigger
|
||||
return true;
|
||||
}
|
||||
|
||||
if (text.Contains("西风成垒") || text.Contains("望崖营壁") || text.Contains("魔女的花园"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -468,21 +519,21 @@ public partial class AutoPickTrigger : ITaskTrigger
|
||||
// 0. 首先替换相似的括号字符并删除换行符、空格,使用Span<char>进行原地替换以获得最佳性能
|
||||
Span<char> chars = stackalloc char[text.Length];
|
||||
text.AsSpan().CopyTo(chars);
|
||||
|
||||
|
||||
int writeIndex = 0;
|
||||
bool hasChanges = false;
|
||||
|
||||
|
||||
for (int i = 0; i < chars.Length; i++)
|
||||
{
|
||||
char c = chars[i];
|
||||
|
||||
|
||||
// 跳过换行符、回车符、空格、制表符等空白字符
|
||||
if (char.IsWhiteSpace(c))
|
||||
{
|
||||
hasChanges = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// 替换括号字符
|
||||
if (c == '【' || c == '[')
|
||||
{
|
||||
@@ -529,11 +580,11 @@ public partial class AutoPickTrigger : ITaskTrigger
|
||||
|
||||
// 获取清理后的文字
|
||||
var cleanedSpan = span.Slice(start, end - start + 1);
|
||||
|
||||
|
||||
// 3. 检查并补充引号配对
|
||||
bool hasLeftQuote = false;
|
||||
bool hasRightQuote = false;
|
||||
|
||||
|
||||
// 快速扫描是否存在引号
|
||||
for (int i = 0; i < cleanedSpan.Length; i++)
|
||||
{
|
||||
@@ -556,9 +607,7 @@ public partial class AutoPickTrigger : ITaskTrigger
|
||||
Debug.WriteLine("补充缺失的左引号");
|
||||
return string.Concat("「", cleanedSpan);
|
||||
}
|
||||
|
||||
|
||||
return cleanedSpan.ToString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -36,6 +36,12 @@ public partial class AutoSkipConfig : ObservableObject
|
||||
[ObservableProperty]
|
||||
private int _afterChooseOptionSleepDelay = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 点击对话框前的延迟(毫秒)
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private int _beforeClickConfirmDelay = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 自动领取每日委托奖励
|
||||
/// </summary>
|
||||
@@ -62,6 +68,18 @@ public partial class AutoSkipConfig : ObservableObject
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _clickChatOption = "优先选择第一个选项";
|
||||
|
||||
/// <summary>
|
||||
/// 自定义优先选项启用
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _customPriorityOptionsEnabled = false;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义优先选项文本,每行一个或用分号分隔
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _customPriorityOptions = "";
|
||||
|
||||
/// <summary>
|
||||
/// 自动邀约启用
|
||||
@@ -96,7 +114,6 @@ public partial class AutoSkipConfig : ObservableObject
|
||||
{
|
||||
return ClickChatOption == "随机选择选项";
|
||||
}
|
||||
|
||||
public bool IsClickNoneChatOption()
|
||||
{
|
||||
return ClickChatOption == "不选择选项";
|
||||
@@ -114,16 +131,43 @@ public partial class AutoSkipConfig : ObservableObject
|
||||
[ObservableProperty]
|
||||
private bool _submitGoodsEnabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// 游戏失焦时显示画中画
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _pictureInPictureEnabled = false;
|
||||
|
||||
/// <summary>
|
||||
/// 画中画的源图像类型
|
||||
/// TriggerDispatcher:来自于截图器50ms一次
|
||||
/// CaptureLoop:主动获取(60帧)
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _pictureInPictureSourceType = nameof(PictureSourceType.CaptureLoop);
|
||||
|
||||
/// <summary>
|
||||
/// 关闭弹出层
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _closePopupPagedEnabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// JS调用时跳过内置默认点击选项
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _skipBuiltInClickOptions = false;
|
||||
|
||||
// /// <summary>
|
||||
// /// 使用交互键
|
||||
// /// 使用鼠标
|
||||
// /// </summary>
|
||||
// [ObservableProperty]
|
||||
// private string _selectChatOptionType = SelectChatOptionTypes.UseMouse;
|
||||
}
|
||||
|
||||
|
||||
public enum PictureSourceType
|
||||
{
|
||||
TriggerDispatcher,
|
||||
CaptureLoop
|
||||
}
|
||||
@@ -40,6 +40,9 @@ public partial class AutoSkipTrigger : ITaskTrigger
|
||||
public bool IsEnabled { get; set; }
|
||||
public int Priority => 20;
|
||||
public bool IsExclusive => false;
|
||||
|
||||
public GameUiCategory SupportedGameUiCategory => GameUiCategory.Talk;
|
||||
|
||||
|
||||
public bool IsBackgroundRunning { get; private set; }
|
||||
|
||||
@@ -170,9 +173,9 @@ public partial class AutoSkipTrigger : ITaskTrigger
|
||||
GetDailyRewardsEsc(_config, content);
|
||||
|
||||
// 找左上角剧情自动的按钮
|
||||
using var foundRectArea = content.CaptureRectArea.Find(_autoSkipAssets.DisabledUiButtonRo);
|
||||
|
||||
var isPlaying = !foundRectArea.IsEmpty(); // 播放中
|
||||
var isPlaying = content.CurrentGameUiCategory == GameUiCategory.Talk
|
||||
|| Bv.IsInTalkUi(content.CaptureRectArea); // 播放中
|
||||
|
||||
if (!isPlaying && (DateTime.Now - _prevPlayingTime).TotalSeconds <= 5)
|
||||
{
|
||||
@@ -205,6 +208,11 @@ public partial class AutoSkipTrigger : ITaskTrigger
|
||||
_prevPlayingTime = DateTime.Now;
|
||||
if (TaskContext.Instance().Config.AutoSkipConfig.QuicklySkipConversationsEnabled)
|
||||
{
|
||||
if (_config.BeforeClickConfirmDelay > 0)
|
||||
{
|
||||
// 在触发点击动作之前延迟时间
|
||||
Thread.Sleep(_config.BeforeClickConfirmDelay);
|
||||
}
|
||||
if (IsUseInteractionKey)
|
||||
{
|
||||
_postMessageSimulator? .SimulateActionBackground(GIActions.PickUpOrInteract); // 注意这里不是交互键 NOTE By Ayu0K: 这里确实是交互键
|
||||
@@ -481,21 +489,18 @@ public partial class AutoSkipTrigger : ITaskTrigger
|
||||
/// </summary>
|
||||
private bool ChatOptionChoose(ImageRegion region)
|
||||
{
|
||||
if (_config.IsClickNoneChatOption())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var assetScale = TaskContext.Instance().SystemInfo.AssetScale;
|
||||
|
||||
// 感叹号识别 遇到直接点击
|
||||
using var exclamationIconRa = region.Find(_autoSkipAssets.ExclamationIconRo);
|
||||
if (!exclamationIconRa.IsEmpty())
|
||||
if (!_config.IsClickNoneChatOption())
|
||||
{
|
||||
Thread.Sleep(_config.AfterChooseOptionSleepDelay);
|
||||
exclamationIconRa.Click();
|
||||
AutoSkipLog("点击感叹号选项");
|
||||
return true;
|
||||
// 感叹号识别 遇到直接点击
|
||||
using var exclamationIconRa = region.Find(_autoSkipAssets.ExclamationIconRo);
|
||||
if (!exclamationIconRa.IsEmpty())
|
||||
{
|
||||
Thread.Sleep(_config.AfterChooseOptionSleepDelay);
|
||||
exclamationIconRa.Click();
|
||||
AutoSkipLog("点击感叹号选项");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 气泡识别
|
||||
@@ -544,56 +549,96 @@ public partial class AutoSkipTrigger : ITaskTrigger
|
||||
|
||||
if (rs.Count > 0)
|
||||
{
|
||||
// 用户自定义关键词 匹配
|
||||
foreach (var item in rs)
|
||||
{
|
||||
// 选择关键词
|
||||
if (_selectList.Any(s => item.Text.Contains(s)))
|
||||
// 自定义优先选项匹配
|
||||
if (_config.CustomPriorityOptionsEnabled && !string.IsNullOrEmpty(_config.CustomPriorityOptions))
|
||||
{
|
||||
var customOptions = _config.CustomPriorityOptions
|
||||
.Split(new[] { '\r', '\n', ';', ';' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(s => s.Trim())
|
||||
.Where(s => !string.IsNullOrEmpty(s))
|
||||
.ToList();
|
||||
|
||||
foreach (var item in rs)
|
||||
{
|
||||
ClickOcrRegion(item);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 不选择关键词
|
||||
if (_pauseList.Any(s => item.Text.Contains(s)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
foreach (var customOption in customOptions)
|
||||
{
|
||||
if (item.Text.Contains(customOption))
|
||||
{
|
||||
ClickOcrRegion(item);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 橙色选项
|
||||
foreach (var item in rs)
|
||||
|
||||
if(_config.IsClickNoneChatOption()){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!_config.SkipBuiltInClickOptions)
|
||||
{
|
||||
var textMat = item.ToImageRegion().SrcMat;
|
||||
if (IsOrangeOption(textMat))
|
||||
// 内置关键词 匹配
|
||||
foreach (var item in rs)
|
||||
{
|
||||
if (_config.AutoGetDailyRewardsEnabled && (item.Text.Contains("每日") || item.Text.Contains("委托")))
|
||||
{
|
||||
ClickOcrRegion(item, "每日委托");
|
||||
_prevGetDailyRewardsTime = DateTime.Now; // 记录领取时间
|
||||
}
|
||||
else if (_config.AutoReExploreEnabled && (item.Text.Contains("探索") || item.Text.Contains("派遣")))
|
||||
{
|
||||
ClickOcrRegion(item, "探索派遣");
|
||||
Thread.Sleep(800); // 等待探索派遣界面打开
|
||||
new OneKeyExpeditionTask().Run(_autoSkipAssets);
|
||||
}
|
||||
else
|
||||
// 选择关键词
|
||||
if (_selectList.Any(s => item.Text.Contains(s)))
|
||||
{
|
||||
ClickOcrRegion(item);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
// 不选择关键词
|
||||
if (_pauseList.Any(s => item.Text.Contains(s)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 默认不选择关键词
|
||||
foreach (var item in rs)
|
||||
{
|
||||
// 不选择关键词
|
||||
if (_defaultPauseList.Any(s => item.Text.Contains(s)))
|
||||
// 橙色选项
|
||||
foreach (var item in rs)
|
||||
{
|
||||
return true;
|
||||
var textMat = item.ToImageRegion().SrcMat;
|
||||
if (IsOrangeOption(textMat))
|
||||
{
|
||||
if (_config.AutoGetDailyRewardsEnabled && (item.Text.Contains("每日") || item.Text.Contains("委托")))
|
||||
{
|
||||
ClickOcrRegion(item, "每日委托");
|
||||
TaskControl.Sleep(800);
|
||||
|
||||
// 6.2 每日提示确认
|
||||
var ra1 = TaskControl.CaptureToRectArea();
|
||||
if (Bv.ClickBlackConfirmButton(ra1))
|
||||
{
|
||||
_logger.LogInformation("存在提示并确认");
|
||||
}
|
||||
ra1.Dispose();
|
||||
|
||||
_prevGetDailyRewardsTime = DateTime.Now; // 记录领取时间
|
||||
}
|
||||
else if (_config.AutoReExploreEnabled && (item.Text.Contains("探索") || item.Text.Contains("派遣")))
|
||||
{
|
||||
ClickOcrRegion(item, "探索派遣");
|
||||
Thread.Sleep(800); // 等待探索派遣界面打开
|
||||
new OneKeyExpeditionTask().Run(_autoSkipAssets);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClickOcrRegion(item);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 默认不选择关键词
|
||||
foreach (var item in rs)
|
||||
{
|
||||
// 不选择关键词
|
||||
if (_defaultPauseList.Any(s => item.Text.Contains(s)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -629,6 +674,16 @@ public partial class AutoSkipTrigger : ITaskTrigger
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 没有气泡的时候识别 F 选项
|
||||
using var pickRa = region.Find(AutoPickAssets.Instance.ChatPickRo);
|
||||
if (pickRa.IsExist())
|
||||
{
|
||||
_postMessageSimulator?.KeyPressBackground(AutoPickAssets.Instance.PickVk);
|
||||
AutoSkipLog("无气泡图标,但存在交互键,直接按下交互键");
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -45,4 +45,8 @@ public partial class AutoStygianOnslaughtConfig : ObservableObject
|
||||
// 使用脆弱树脂刷取副本次数
|
||||
[ObservableProperty]
|
||||
private int _fragileResinUseCount = 0;
|
||||
|
||||
// 指定战斗队伍
|
||||
[ObservableProperty]
|
||||
private string _fightTeamName = "";
|
||||
}
|
||||
@@ -10,6 +10,7 @@ using BetterGenshinImpact.GameTask.AutoFight.Model;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Script;
|
||||
using BetterGenshinImpact.GameTask.AutoGeniusInvokation.Exception;
|
||||
using BetterGenshinImpact.GameTask.AutoPick.Assets;
|
||||
using BetterGenshinImpact.GameTask.AutoTrackPath;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using BetterGenshinImpact.GameTask.Common.BgiVision;
|
||||
using BetterGenshinImpact.GameTask.Common.Element.Assets;
|
||||
@@ -30,6 +31,7 @@ using BetterGenshinImpact.GameTask.AutoDomain;
|
||||
using static BetterGenshinImpact.GameTask.Common.TaskControl;
|
||||
using static Vanara.PInvoke.User32;
|
||||
using BetterGenshinImpact.GameTask.AutoFight;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoStygianOnslaught;
|
||||
|
||||
@@ -94,6 +96,7 @@ public class AutoStygianOnslaughtTask : ISoloTask
|
||||
|
||||
// 前置进入秘境
|
||||
await TpToDomain(page);
|
||||
await SelectDifficulty(page);
|
||||
await EnterDomain(page);
|
||||
await ChooseBoss(page);
|
||||
|
||||
@@ -141,7 +144,12 @@ public class AutoStygianOnslaughtTask : ISoloTask
|
||||
|
||||
Bv.ClickWhiteCancelButton(ra); // 点击返回后是主角
|
||||
await Bv.WaitUntilFound(ElementAssets.Instance.LeylineDisorderIconRo, _ct);
|
||||
await Delay(6000, _ct); // 等待载入完成
|
||||
await Delay(2500, _ct); // 等待载入完成
|
||||
// 走一步防止在地脉花上
|
||||
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyDown);
|
||||
await Delay(200, _ct);
|
||||
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyUp);
|
||||
await Delay(3400, _ct); // 等待载入完成
|
||||
|
||||
// 4. 寻找地脉花
|
||||
_logger.LogInformation($"{Name}:{{Text}}", "3. 寻找地脉花");
|
||||
@@ -193,7 +201,7 @@ public class AutoStygianOnslaughtTask : ISoloTask
|
||||
}
|
||||
}
|
||||
|
||||
private async Task TpToDomain(BvPage page)
|
||||
private async Task TpToDomain(BvPage page, bool isRetry = false)
|
||||
{
|
||||
await new ReturnMainUiTask().Start(_ct);
|
||||
await Delay(100, _ct);
|
||||
@@ -203,6 +211,7 @@ public class AutoStygianOnslaughtTask : ISoloTask
|
||||
{
|
||||
if (page.GetByText("幽境危战").WithRoi(r => r.CutRight(0.5)).IsExist())
|
||||
{
|
||||
await Delay(500, _ct);
|
||||
Simulation.SendInput.Keyboard.KeyPress(AutoPickAssets.Instance.PickVk);
|
||||
_logger.LogInformation($"{Name}:交互秘境");
|
||||
return;
|
||||
@@ -216,6 +225,7 @@ public class AutoStygianOnslaughtTask : ISoloTask
|
||||
await page.GetByText("活动一览").WithRoi(r => r.CutLeftTop(0.3, 0.2)).WaitFor();
|
||||
await Delay(500, _ct);
|
||||
|
||||
// 查找并点击幽境危战 - 前往挑战
|
||||
if (page.GetByText("幽境危战").WithRoi(r => r.CutRight(0.5)).IsExist())
|
||||
{
|
||||
await page.GetByText("前往挑战").WithRoi(r => r.CutRight(0.5)).Click();
|
||||
@@ -226,11 +236,35 @@ public class AutoStygianOnslaughtTask : ISoloTask
|
||||
await Delay(1500, _ct);
|
||||
await page.GetByText("前往挑战").WithRoi(r => r.CutRight(0.5)).Click();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("未找到幽境危战选项");
|
||||
}
|
||||
|
||||
_logger.LogInformation($"{Name}:点击前往挑战");
|
||||
|
||||
// 传送
|
||||
await Delay(1000, _ct);
|
||||
|
||||
try
|
||||
{
|
||||
await page.Locator(QuickTeleportAssets.Instance.TeleportButtonRo)
|
||||
.WaitFor();
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (!isRetry)
|
||||
{
|
||||
// 未找到传送按钮,先返回主界面再重新进入
|
||||
_logger.LogWarning($"{Name}:未找到传送按钮,返回七天神像重新开始");
|
||||
await new TpTask(_ct).TpToStatueOfTheSeven();
|
||||
// 重新执行从打开活动界面开始的流程
|
||||
await TpToDomain(page, isRetry: true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
await page.Locator(QuickTeleportAssets.Instance.TeleportButtonRo).Click();
|
||||
_logger.LogInformation($"{Name}:点击传送");
|
||||
await Delay(800, _ct);
|
||||
@@ -246,7 +280,6 @@ public class AutoStygianOnslaughtTask : ISoloTask
|
||||
|
||||
private async Task EnterDomain(BvPage page)
|
||||
{
|
||||
await Delay(4000, _ct); // 等待动画完成
|
||||
await page.Locator(ElementAssets.Instance.BtnWhiteConfirm)
|
||||
.WithRoi(r => r.CutRight(0.5))
|
||||
.ClickUntilDisappears();
|
||||
@@ -285,6 +318,9 @@ public class AutoStygianOnslaughtTask : ISoloTask
|
||||
page.Click(203, 728);
|
||||
}
|
||||
|
||||
// 切换战斗队伍
|
||||
await SwitchTeam(page);
|
||||
|
||||
await Delay(120, _ct);
|
||||
|
||||
// 幽境危战确认界面
|
||||
@@ -362,10 +398,45 @@ public class AutoStygianOnslaughtTask : ISoloTask
|
||||
/// </summary>
|
||||
private Task DomainEndDetectionTask(CancellationTokenSource cts)
|
||||
{
|
||||
return new Task(async () =>
|
||||
return new Task(async void () =>
|
||||
{
|
||||
await Bv.WaitUntilFound(ElementAssets.Instance.BtnWhiteCancel, cts.Token, 150, 1000);
|
||||
await cts.CancelAsync();
|
||||
try
|
||||
{
|
||||
var captureRect = TaskContext.Instance().SystemInfo.ScaleMax1080PCaptureRect;
|
||||
var assetScale = TaskContext.Instance().SystemInfo.AssetScale;
|
||||
RecognitionObject whiteCancelRo = new RecognitionObject
|
||||
{
|
||||
Name = "BtnWhiteCancel",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = ElementAssets.Instance.BtnWhiteCancel.TemplateImageMat,
|
||||
RegionOfInterest = new Rect(captureRect.Width / 3, captureRect.Height - (int)(captureRect.Height * 0.22), captureRect.Width / 3, (int)(captureRect.Height * 0.22)),
|
||||
Use3Channels = true
|
||||
}.InitTemplate();
|
||||
|
||||
await NewRetry.WaitForAction(() =>
|
||||
{
|
||||
using var ra = CaptureToRectArea();
|
||||
using var ret = ra.Find(whiteCancelRo);
|
||||
if (ret.IsExist())
|
||||
{
|
||||
// OCR 保证识别不出错
|
||||
var list = ra.FindMulti(RecognitionObject.Ocr(ret.X + 40 * assetScale, ret.Y - 20 * assetScale, 270 * assetScale, ret.Height * 2));
|
||||
if (list.Any(o => o.Text.Contains("返回")))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}, cts.Token, 300, 1000);
|
||||
_logger.LogInformation("检测到战斗结束,结束战斗操作线程");
|
||||
await cts.CancelAsync();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogInformation("对局结束检测线程异常结束:{Msg}", e.Message);
|
||||
_logger.LogDebug(e, "对局结束检测线程异常结束");
|
||||
}
|
||||
}, cts.Token);
|
||||
}
|
||||
|
||||
@@ -568,13 +639,119 @@ public class AutoStygianOnslaughtTask : ISoloTask
|
||||
await new AutoArtifactSalvageTask(new AutoArtifactSalvageTaskParam(star, javaScript: null, artifactSetFilter: null, maxNumToCheck: null, recognitionFailurePolicy: null)).Start(_ct);
|
||||
}
|
||||
|
||||
private async Task SelectDifficulty(BvPage page)
|
||||
{
|
||||
await Delay(4000, _ct); // 等待动画完成
|
||||
|
||||
// 检查是否需要从至危挑战切换到困难
|
||||
if (page.GetByText("至危挑战").WithRoi(r => r.CutLeftTop(0.5, 0.2)).IsExist())
|
||||
{
|
||||
_logger.LogInformation($"{Name}:找到至危挑战,尝试切换到困难模式");
|
||||
await Delay(500, _ct);
|
||||
await page.GetByText("至危挑战").WithRoi(r => r.CutLeftTop(0.5, 0.2)).Click();
|
||||
await Delay(500, _ct);
|
||||
}
|
||||
|
||||
// 检查困难模式是否已选中
|
||||
var hardMode = page.GetByText("困难").WithRoi(r => r.CutRightTop(0.5, 0.2)).IsExist();
|
||||
|
||||
if (hardMode)
|
||||
{
|
||||
_logger.LogInformation($"{Name}:确认困难模式");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning("未找到困难模式,尝试切换");
|
||||
await Delay(500, _ct);
|
||||
page.Click(1096, 186);
|
||||
await Delay(500, _ct);
|
||||
page.Click(1093, 399);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SwitchTeam(BvPage page)
|
||||
{
|
||||
var fightTeamName = _taskParam.FightTeamName;
|
||||
if (string.IsNullOrEmpty(fightTeamName))
|
||||
{
|
||||
_logger.LogInformation($"{Name}:不更换战斗队伍");
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogInformation($"{Name}:配置战斗队伍为:{fightTeamName}");
|
||||
|
||||
// 查找预设队伍按钮并点击它打开面板
|
||||
var teamButton = page.GetByText("预设队伍").WithRoi(r => r.CutRightBottom(0.3, 0.1)).FindAll().FirstOrDefault();
|
||||
|
||||
if (teamButton == null)
|
||||
{
|
||||
// 如果按钮未找到,检查列表面板是否已打开
|
||||
var panelTitle = page.GetByText("预设队伍").WithRoi(r => r.CutLeftTop(0.15, 0.075)).FindAll().FirstOrDefault();
|
||||
if (panelTitle == null)
|
||||
{
|
||||
_logger.LogWarning("未找到预设队伍按钮,不执行切换操作");
|
||||
return;
|
||||
}
|
||||
// 列表面板已打开,跳过点击按钮步骤
|
||||
}
|
||||
else
|
||||
{
|
||||
// 点击预设队伍按钮打开队伍选择面板
|
||||
teamButton.Click();
|
||||
await Delay(100, _ct);
|
||||
}
|
||||
|
||||
// 此时面板已打开,点击滚动条准备拖动
|
||||
page.Click(936, 150);
|
||||
await Delay(100, _ct);
|
||||
|
||||
// 滚轮预操作 - 按住左键准备拖动列表
|
||||
Simulation.SendInput.Mouse.LeftButtonDown();
|
||||
await Delay(100, _ct);
|
||||
// 向上移动一点开始滚动
|
||||
GameCaptureRegion.GameRegion1080PPosMove(936, 140);
|
||||
await Delay(100, _ct);
|
||||
|
||||
int yOffset = 0;
|
||||
const int maxRetries = 30;
|
||||
|
||||
for (int retries = 0; retries < maxRetries; retries++)
|
||||
{
|
||||
// 查找队伍名称,OCR区域: 左侧竖列队伍列表
|
||||
var teamRegionList = page.GetByText(fightTeamName).WithRoi(r => r.CutLeft(0.18)).FindAll();
|
||||
var foundTeam = teamRegionList.FirstOrDefault();
|
||||
if (foundTeam != null)
|
||||
{
|
||||
Simulation.SendInput.Mouse.LeftButtonUp();
|
||||
await Delay(300, _ct);
|
||||
foundTeam.Click();
|
||||
await Delay(500, _ct);
|
||||
return;
|
||||
}
|
||||
|
||||
// 滚轮操作 - 在滚动条(936, y)位置拖动
|
||||
yOffset += 100;
|
||||
if (130 + yOffset > 1080)
|
||||
{
|
||||
Simulation.SendInput.Mouse.LeftButtonUp();
|
||||
await Delay(100, _ct);
|
||||
_logger.LogWarning("未找到预设战斗队伍名称,保持原有队伍");
|
||||
Simulation.SendInput.Keyboard.KeyPress(VK.VK_ESCAPE);
|
||||
await Delay(500, _ct);
|
||||
return;
|
||||
}
|
||||
|
||||
// 移动滚动条
|
||||
GameCaptureRegion.GameRegion1080PPosMove(936, 130 + yOffset);
|
||||
await Delay(200, _ct);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ExitDomain(BvPage page)
|
||||
{
|
||||
|
||||
var exitDoor = await NewRetry.WaitForElementAppear(
|
||||
ElementAssets.Instance.BtnExitDoor.Value,
|
||||
() => Simulation.SendInput.Keyboard.KeyPress(VK.VK_ESCAPE),// 点击队伍选择按钮
|
||||
() => Simulation.SendInput.Keyboard.KeyPress(VK.VK_ESCAPE), // 点击队伍选择按钮
|
||||
_ct,
|
||||
4,
|
||||
1000
|
||||
|
||||
@@ -29,7 +29,8 @@ public class GiPathPoint
|
||||
var pt = MapManager.GetMap(MapTypes.Teyvat, matchingMethod).ConvertImageCoordinatesToGenshinMapCoordinates(point);
|
||||
return new GiPathPoint
|
||||
{
|
||||
Pt = pt,
|
||||
// pt will not be null
|
||||
Pt = pt ?? new Point2f(0, 0),
|
||||
MatchPt = point,
|
||||
Index = index,
|
||||
Time = DateTime.Now
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace BetterGenshinImpact.GameTask.AutoTrackPath.Model;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoTrackPath.Model;
|
||||
|
||||
/// <summary>
|
||||
/// 原神世界坐标
|
||||
@@ -6,12 +8,6 @@
|
||||
/// </summary>
|
||||
public class GiWorldPosition
|
||||
{
|
||||
/// <summary>
|
||||
/// 坐标描述和
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 坐标 x,y,z 三个值,分别代表纵向、高度、横向,采用原神实际的坐标系
|
||||
/// 由于这个坐标系和一般的坐标系不同,所以为了方便理解,设这3个值为a,b,c
|
||||
@@ -37,11 +33,16 @@ public class GiTpPosition: GiWorldPosition
|
||||
public string? Name { get; set; } // tp 名称
|
||||
public string? Type { get; set; } // tp 类型
|
||||
public string? Country { get; set; } // 所在国家
|
||||
public string? Area { get; set; } // 所在区域
|
||||
|
||||
[JsonIgnore]
|
||||
public string[] Areas { get; set; } = []; // 所在区域
|
||||
[JsonIgnore]
|
||||
public string[] Rewards { get; set; } = [];
|
||||
[JsonIgnore]
|
||||
public string Level1Area => Areas[0]; // 一级区域
|
||||
// 实际传送的坐标
|
||||
public decimal[] TranPosition { get; set; } = new decimal[3];
|
||||
public double TranX => (double)TranPosition[2];
|
||||
public double TranY => (double)TranPosition[0];
|
||||
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class TpTask
|
||||
var center = GetBigMapCenterPoint(MapTypes.Teyvat.ToString());
|
||||
var giTpPoint = GetNearestGoddess(center.X, center.Y);
|
||||
country = giTpPoint.Country;
|
||||
area = giTpPoint.Area;
|
||||
area = giTpPoint.Level1Area;
|
||||
x = giTpPoint.X;
|
||||
y = giTpPoint.Y;
|
||||
revivePoint = giTpPoint;
|
||||
@@ -245,6 +245,7 @@ public class TpTask
|
||||
// 直接切换地区
|
||||
await SwitchArea(MapTypesExtensions.ParseFromName(mapName).GetDescription());
|
||||
}
|
||||
await Delay(50, ct);
|
||||
|
||||
|
||||
// 3. 调整初始缩放等级,避免识别中心点失败
|
||||
@@ -389,7 +390,7 @@ public class TpTask
|
||||
/// <returns></returns>
|
||||
private (double clickX, double clickY) ConvertToGameRegionPosition(string mapName, Rect bigMapInAllMapRect, double x, double y)
|
||||
{
|
||||
var (picX, picY) = MapManager.GetMap(mapName, _mapMatchingMethod).ConvertGenshinMapCoordinatesToImageCoordinates((float)x, (float)y);
|
||||
var (picX, picY) = MapManager.GetMap(mapName, _mapMatchingMethod).ConvertGenshinMapCoordinatesToImageCoordinates(new Point2f((float)x, (float)y));
|
||||
var picRect = MapManager.GetMap(mapName, _mapMatchingMethod).ConvertGenshinMapCoordinatesToImageCoordinates(bigMapInAllMapRect);
|
||||
Debug.WriteLine($"({picX},{picY}) 在 {picRect} 内,计算它在窗体内的位置");
|
||||
var clickX = (picX - picRect.X) / picRect.Width * _captureRect.Width;
|
||||
@@ -769,7 +770,7 @@ public class TpTask
|
||||
rect = new Rect(rect.X * s, rect.Y * s, rect.Width * s, rect.Height * s);
|
||||
}
|
||||
|
||||
return MapManager.GetMap(mapName, _mapMatchingMethod).ConvertImageCoordinatesToGenshinMapCoordinates(rect);
|
||||
return MapManager.GetMap(mapName, _mapMatchingMethod).ConvertImageCoordinatesToGenshinMapCoordinates(rect)!.Value;
|
||||
}
|
||||
|
||||
public Point2f GetBigMapCenterPoint(string mapName)
|
||||
@@ -793,7 +794,7 @@ public class TpTask
|
||||
(x, y) = (p.X * TeyvatMap.BigMap256ScaleTo2048, p.Y * TeyvatMap.BigMap256ScaleTo2048);
|
||||
}
|
||||
|
||||
return MapManager.GetMap(mapName, _mapMatchingMethod).ConvertImageCoordinatesToGenshinMapCoordinates(new Point2f(x, y));
|
||||
return MapManager.GetMap(mapName, _mapMatchingMethod).ConvertImageCoordinatesToGenshinMapCoordinates(new Point2f(x, y))!.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -894,7 +895,7 @@ public class TpTask
|
||||
if (matchRect == null)
|
||||
{
|
||||
Logger.LogWarning("切换区域失败:{Country}", areaName);
|
||||
if (areaName == MapTypes.TheChasm.GetDescription() || areaName == MapTypes.Enkanomiya.GetDescription())
|
||||
if (areaName == MapTypes.TheChasm.GetDescription() || areaName == MapTypes.Enkanomiya.GetDescription() || areaName == MapTypes.SeaOfBygoneEras.GetDescription() || areaName == MapTypes.AncientSacredMountain.GetDescription())
|
||||
{
|
||||
throw new Exception($"切换独立地图区域[{areaName}]失败");
|
||||
}
|
||||
@@ -927,6 +928,7 @@ public class TpTask
|
||||
|
||||
// 2. 判断是否已经点出传送按钮
|
||||
var hasTeleportButton = CheckTeleportButton(imageRegion);
|
||||
await Delay(50, ct);
|
||||
if (hasTeleportButton) return; // 可以传送了,结束
|
||||
// 3. 没点出传送按钮,且不存在外部地图关闭按钮
|
||||
// 说明只有两种可能,a. 点出来的是未激活传送点或者标点 b. 选择传送点选项列表
|
||||
|
||||
@@ -21,6 +21,12 @@ public partial class AutoWoodConfig : ObservableObject
|
||||
[ObservableProperty]
|
||||
private bool _woodCountOcrEnabled = false;
|
||||
|
||||
/// <summary>
|
||||
/// 使用进出千星奇域刷新CD
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _useWonderlandRefresh = true;
|
||||
|
||||
// /// <summary>
|
||||
// /// 按下两次ESC键,原因见:
|
||||
// /// https://github.com/babalae/better-genshin-impact/issues/235
|
||||
|
||||
@@ -4,6 +4,7 @@ using BetterGenshinImpact.GameTask.AutoGeniusInvokation.Exception;
|
||||
using BetterGenshinImpact.GameTask.AutoWood.Assets;
|
||||
using BetterGenshinImpact.GameTask.AutoWood.Utils;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using BetterGenshinImpact.GameTask.Common.Job;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using BetterGenshinImpact.Genshin.Settings;
|
||||
using BetterGenshinImpact.View.Drawable;
|
||||
@@ -45,6 +46,8 @@ public partial class AutoWoodTask : ISoloTask
|
||||
|
||||
private CancellationToken _ct;
|
||||
|
||||
private EnterAndExitWonderlandJob _enterAndExitWonderlandJob;
|
||||
|
||||
public AutoWoodTask(WoodTaskParam taskParam)
|
||||
{
|
||||
this._taskParam = taskParam;
|
||||
@@ -52,10 +55,11 @@ public partial class AutoWoodTask : ISoloTask
|
||||
AutoWoodAssets.DestroyInstance();
|
||||
}
|
||||
|
||||
public Task Start(CancellationToken ct)
|
||||
public async Task Start(CancellationToken ct)
|
||||
{
|
||||
_assets = AutoWoodAssets.Instance;
|
||||
_printer = new WoodStatisticsPrinter(_assets);
|
||||
_enterAndExitWonderlandJob = new EnterAndExitWonderlandJob();
|
||||
var runTimeWatch = new Stopwatch();
|
||||
_ct = ct;
|
||||
_printer.Ct = _ct;
|
||||
@@ -112,12 +116,12 @@ public partial class AutoWoodTask : ISoloTask
|
||||
break;
|
||||
}
|
||||
|
||||
Felling(_taskParam, i + 1 == _taskParam.WoodRoundNum);
|
||||
await Felling(_taskParam, i + 1 == _taskParam.WoodRoundNum);
|
||||
VisionContext.Instance().DrawContent.ClearAll();
|
||||
Sleep(500, _ct);
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
return;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -382,7 +386,7 @@ public partial class AutoWoodTask : ISoloTask
|
||||
}
|
||||
}
|
||||
|
||||
private void Felling(WoodTaskParam taskParam, bool isLast = false)
|
||||
private async Task Felling(WoodTaskParam taskParam, bool isLast = false)
|
||||
{
|
||||
// 1. 按 z 触发「王树瑞佑」
|
||||
PressZ(taskParam);
|
||||
@@ -399,11 +403,19 @@ public partial class AutoWoodTask : ISoloTask
|
||||
if (_printer.WoodStatisticsAlwaysEmpty() || _printer.ReachedWoodMaxCount) return;
|
||||
}
|
||||
|
||||
// 2. 按下 ESC 打开菜单 并退出游戏
|
||||
PressEsc(taskParam);
|
||||
if (TaskContext.Instance().Config.AutoWoodConfig.UseWonderlandRefresh)
|
||||
{
|
||||
// 使用进出千星奇域刷新CD
|
||||
await _enterAndExitWonderlandJob.Start(_ct);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 2. 按下 ESC 打开菜单 并退出游戏
|
||||
PressEsc(taskParam);
|
||||
|
||||
// 3. 等待进入游戏
|
||||
EnterGame(taskParam);
|
||||
// 3. 等待进入游戏
|
||||
EnterGame(taskParam);
|
||||
}
|
||||
|
||||
// 手动 GC
|
||||
GC.Collect();
|
||||
@@ -549,4 +561,4 @@ public partial class AutoWoodTask : ISoloTask
|
||||
throw new RetryException("未检测进入游戏界面");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using System.Threading;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using Vanara.PInvoke;
|
||||
using static BetterGenshinImpact.GameTask.Common.TaskControl;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoWood.Utils;
|
||||
|
||||
@@ -107,9 +108,10 @@ internal sealed class Login3rdParty
|
||||
var (loginWindow, windowType) = GetBiliLoginWindow(process);
|
||||
if (loginWindow != IntPtr.Zero)
|
||||
{
|
||||
var dpiScale = TaskContext.Instance().DpiScale;
|
||||
if (windowType.Contains("协议"))
|
||||
{
|
||||
GameCaptureRegion.GameRegion1080PPosClick(1030, 615);
|
||||
GameCaptureRegion.GameRegion1080PPosClick(960 + 70 * dpiScale, 540 + 75 * dpiScale);
|
||||
|
||||
// 检查窗口是否还存在
|
||||
var (remainingWindow, remainingType) = GetBiliLoginWindow(process);
|
||||
@@ -124,7 +126,7 @@ internal sealed class Login3rdParty
|
||||
if (windowType.Contains("登录"))
|
||||
{
|
||||
Thread.Sleep(2000);
|
||||
GameCaptureRegion.GameRegion1080PPosClick(960, 630);
|
||||
GameCaptureRegion.GameRegion1080PPosClick(960, 540 + 90 * dpiScale);
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// 检查窗口是否还存在
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using System;
|
||||
using BetterGenshinImpact.GameTask.Common.BgiVision;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask;
|
||||
@@ -17,6 +18,8 @@ public class CaptureContent : IDisposable
|
||||
public int FrameRate => (int)(1000 / TimerInterval);
|
||||
|
||||
public ImageRegion CaptureRectArea { get; }
|
||||
|
||||
public GameUiCategory CurrentGameUiCategory;
|
||||
|
||||
public CaptureContent(Mat image, int frameIndex, double interval)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ public static partial class Bv
|
||||
/// <returns></returns>
|
||||
public static async Task<bool> WaitUntilFound(RecognitionObject ro, CancellationToken ct, int retryTimes = 5, int delayMs = 1000)
|
||||
{
|
||||
return await NewRetry.WaitForAction(() => TaskControl.CaptureToRectArea().Find(ro).IsExist(), ct, retryTimes);
|
||||
return await NewRetry.WaitForAction(() => TaskControl.CaptureToRectArea().Find(ro).IsExist(), ct, retryTimes, delayMs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -44,7 +44,7 @@ public static partial class Bv
|
||||
}
|
||||
|
||||
return false;
|
||||
}, ct, retryTimes);
|
||||
}, ct, retryTimes, delayMs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using Fischless.WindowsInput;
|
||||
using OpenCvSharp;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.Common.BgiVision;
|
||||
|
||||
@@ -17,53 +18,47 @@ namespace BetterGenshinImpact.GameTask.Common.BgiVision;
|
||||
/// </summary>
|
||||
public static partial class Bv
|
||||
{
|
||||
/// <summary>
|
||||
/// 通用方法:查找识别对象,如果存在则点击
|
||||
/// </summary>
|
||||
/// <param name="captureRa">截图区域</param>
|
||||
/// <param name="ro">识别对象</param>
|
||||
/// <returns>是否找到并点击</returns>
|
||||
public static bool FindAndClick(ImageRegion captureRa, RecognitionObject ro)
|
||||
{
|
||||
var ra = captureRa.Find(ro);
|
||||
if (ra.IsExist())
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
ra.Click();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点击减少按钮
|
||||
/// </summary>
|
||||
/// <param name="captureRa"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ClickReduceButton(ImageRegion captureRa)
|
||||
{
|
||||
var ra = captureRa.Find(ElementAssets.Instance.Keyreduce);
|
||||
if (ra.IsExist())
|
||||
{
|
||||
ra.Click();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
=> FindAndClick(captureRa, ElementAssets.Instance.Keyreduce);
|
||||
|
||||
/// <summary>
|
||||
/// 点击增加按钮
|
||||
/// </summary>
|
||||
/// <param name="captureRa"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ClickAddButton(ImageRegion captureRa)
|
||||
{
|
||||
var ra = captureRa.Find(ElementAssets.Instance.Keyincrease);
|
||||
if (ra.IsExist())
|
||||
{
|
||||
ra.Click();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
=> FindAndClick(captureRa, ElementAssets.Instance.Keyincrease);
|
||||
|
||||
/// <summary>
|
||||
/// 点击白色确认按钮
|
||||
/// </summary>
|
||||
/// <param name="captureRa"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ClickWhiteConfirmButton(ImageRegion captureRa)
|
||||
{
|
||||
var ra = captureRa.Find(ElementAssets.Instance.BtnWhiteConfirm);
|
||||
if (ra.IsExist())
|
||||
{
|
||||
ra.Click();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
=> FindAndClick(captureRa, ElementAssets.Instance.BtnWhiteConfirm);
|
||||
|
||||
/// <summary>
|
||||
/// 点击白色取消按钮
|
||||
@@ -71,16 +66,7 @@ public static partial class Bv
|
||||
/// <param name="captureRa"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ClickWhiteCancelButton(ImageRegion captureRa)
|
||||
{
|
||||
var ra = captureRa.Find(ElementAssets.Instance.BtnWhiteCancel);
|
||||
if (ra.IsExist())
|
||||
{
|
||||
ra.Click();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
=> FindAndClick(captureRa, ElementAssets.Instance.BtnWhiteCancel);
|
||||
|
||||
/// <summary>
|
||||
/// 点击黑色确认按钮
|
||||
@@ -88,16 +74,7 @@ public static partial class Bv
|
||||
/// <param name="captureRa"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ClickBlackConfirmButton(ImageRegion captureRa)
|
||||
{
|
||||
var ra = captureRa.Find(ElementAssets.Instance.BtnBlackConfirm);
|
||||
if (ra.IsExist())
|
||||
{
|
||||
ra.Click();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
=> FindAndClick(captureRa, ElementAssets.Instance.BtnBlackConfirm);
|
||||
|
||||
/// <summary>
|
||||
/// 点击黑色取消按钮
|
||||
@@ -105,16 +82,7 @@ public static partial class Bv
|
||||
/// <param name="captureRa"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ClickBlackCancelButton(ImageRegion captureRa)
|
||||
{
|
||||
var ra = captureRa.Find(ElementAssets.Instance.BtnBlackCancel);
|
||||
if (ra.IsExist())
|
||||
{
|
||||
ra.Click();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
=> FindAndClick(captureRa, ElementAssets.Instance.BtnBlackCancel);
|
||||
|
||||
/// <summary>
|
||||
/// 点击联机确认按钮
|
||||
@@ -122,16 +90,7 @@ public static partial class Bv
|
||||
/// <param name="captureRa"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ClickOnlineYesButton(ImageRegion captureRa)
|
||||
{
|
||||
var ra = captureRa.Find(ElementAssets.Instance.BtnOnlineYes);
|
||||
if (ra.IsExist())
|
||||
{
|
||||
ra.Click();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
=> FindAndClick(captureRa, ElementAssets.Instance.BtnOnlineYes);
|
||||
|
||||
/// <summary>
|
||||
/// 点击联机取消按钮
|
||||
@@ -139,16 +98,7 @@ public static partial class Bv
|
||||
/// <param name="captureRa"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ClickOnlineNoButton(ImageRegion captureRa)
|
||||
{
|
||||
var ra = captureRa.Find(ElementAssets.Instance.BtnOnlineNo);
|
||||
if (ra.IsExist())
|
||||
{
|
||||
ra.Click();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
=> FindAndClick(captureRa, ElementAssets.Instance.BtnOnlineNo);
|
||||
|
||||
/// <summary>
|
||||
/// 点击确认按钮(优先点击白色背景的确认按钮)
|
||||
|
||||
@@ -17,20 +17,58 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.Common.BgiVision;
|
||||
|
||||
/// <summary>
|
||||
/// 模仿OpenCv的静态类
|
||||
/// 用于原神的各类识别与控制操作
|
||||
///
|
||||
/// 此处主要是对游戏内的一些状态进行识别
|
||||
/// </summary>
|
||||
public enum GameUiCategory
|
||||
{
|
||||
Unknown,
|
||||
Main,
|
||||
Talk,
|
||||
BigMap
|
||||
}
|
||||
|
||||
public static partial class Bv
|
||||
{
|
||||
|
||||
public static string WhichGameUi()
|
||||
public static GameUiCategory WhichGameUi()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
using var region = TaskControl.CaptureToRectArea();
|
||||
return WhichGameUi(region);
|
||||
}
|
||||
|
||||
public static GameUiCategory WhichGameUi(ImageRegion region)
|
||||
{
|
||||
if (IsInTalkUi(region))
|
||||
{
|
||||
return GameUiCategory.Talk;
|
||||
}
|
||||
|
||||
if (IsInBigMapUi(region))
|
||||
{
|
||||
return GameUiCategory.BigMap;
|
||||
}
|
||||
|
||||
if (IsInMainUi(region))
|
||||
{
|
||||
return GameUiCategory.Main;
|
||||
}
|
||||
|
||||
return GameUiCategory.Unknown;
|
||||
}
|
||||
|
||||
public static GameUiCategory WhichGameUiForTriggers(ImageRegion region)
|
||||
{
|
||||
if (IsInTalkUi(region))
|
||||
{
|
||||
return GameUiCategory.Talk;
|
||||
}
|
||||
|
||||
if (IsInBigMapUi(region))
|
||||
{
|
||||
return GameUiCategory.BigMap;
|
||||
}
|
||||
|
||||
return GameUiCategory.Unknown;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否在主界面
|
||||
/// </summary>
|
||||
@@ -38,7 +76,8 @@ public static partial class Bv
|
||||
/// <returns></returns>
|
||||
public static bool IsInMainUi(ImageRegion captureRa)
|
||||
{
|
||||
return captureRa.Find(ElementAssets.Instance.PaimonMenuRo).IsExist() && !IsInRevivePrompt(captureRa);
|
||||
using var ra = captureRa.Find(ElementAssets.Instance.PaimonMenuRo);
|
||||
return ra.IsExist() && !IsInRevivePrompt(captureRa);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -108,7 +147,8 @@ public static partial class Bv
|
||||
/// <returns></returns>
|
||||
public static bool IsInAnyClosableUi(ImageRegion captureRa)
|
||||
{
|
||||
return captureRa.Find(QuickTeleportAssets.Instance.MapCloseButtonRo).IsExist();
|
||||
using var ra = captureRa.Find(QuickTeleportAssets.Instance.MapCloseButtonRo);
|
||||
return ra.IsExist();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -118,7 +158,8 @@ public static partial class Bv
|
||||
/// <returns></returns>
|
||||
public static bool IsInPartyViewUi(ImageRegion captureRa)
|
||||
{
|
||||
return captureRa.Find(ElementAssets.Instance.PartyBtnChooseView).IsExist();
|
||||
using var ra = captureRa.Find(ElementAssets.Instance.PartyBtnChooseView);
|
||||
return ra.IsExist();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -129,7 +170,11 @@ public static partial class Bv
|
||||
/// <returns></returns>
|
||||
public static async Task<bool> WaitForPartyViewUi(CancellationToken ct, int retryTimes = 5)
|
||||
{
|
||||
return await NewRetry.WaitForAction(() => IsInPartyViewUi(TaskControl.CaptureToRectArea()), ct, retryTimes);
|
||||
return await NewRetry.WaitForAction(() =>
|
||||
{
|
||||
using var ra = TaskControl.CaptureToRectArea();
|
||||
return IsInPartyViewUi(ra);
|
||||
}, ct, retryTimes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -139,7 +184,14 @@ public static partial class Bv
|
||||
/// <returns></returns>
|
||||
public static bool IsInBigMapUi(ImageRegion captureRa)
|
||||
{
|
||||
return captureRa.Find(QuickTeleportAssets.Instance.MapScaleButtonRo).IsExist() || captureRa.Find(QuickTeleportAssets.Instance.MapSettingsButtonRo).IsExist();
|
||||
using var scaleRa = captureRa.Find(QuickTeleportAssets.Instance.MapScaleButtonRo);
|
||||
if (scaleRa.IsExist())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
using var settingsRa = captureRa.Find(QuickTeleportAssets.Instance.MapSettingsButtonRo);
|
||||
return settingsRa.IsExist();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -150,12 +202,13 @@ public static partial class Bv
|
||||
/// <returns></returns>
|
||||
public static bool BigMapIsUnderground(ImageRegion captureRa)
|
||||
{
|
||||
return captureRa.Find(QuickTeleportAssets.Instance.MapUndergroundSwitchButtonRo).IsExist();
|
||||
using var ra = captureRa.Find(QuickTeleportAssets.Instance.MapUndergroundSwitchButtonRo);
|
||||
return ra.IsExist();
|
||||
}
|
||||
|
||||
public static double GetBigMapScale(ImageRegion region)
|
||||
{
|
||||
var scaleRa = region.Find(QuickTeleportAssets.Instance.MapScaleButtonRo);
|
||||
using var scaleRa = region.Find(QuickTeleportAssets.Instance.MapScaleButtonRo);
|
||||
if (scaleRa.IsEmpty())
|
||||
{
|
||||
throw new Exception("当前未处于大地图界面,不能使用GetBigMapScale方法");
|
||||
@@ -171,8 +224,10 @@ public static partial class Bv
|
||||
|
||||
public static MotionStatus GetMotionStatus(ImageRegion captureRa)
|
||||
{
|
||||
var spaceExist = captureRa.Find(ElementAssets.Instance.SpaceKey).IsExist();
|
||||
var xExist = captureRa.Find(ElementAssets.Instance.XKey).IsExist();
|
||||
using var spaceRa = captureRa.Find(ElementAssets.Instance.SpaceKey);
|
||||
var spaceExist = spaceRa.IsExist();
|
||||
using var xRa = captureRa.Find(ElementAssets.Instance.XKey);
|
||||
var xExist = xRa.IsExist();
|
||||
if (spaceExist)
|
||||
{
|
||||
return xExist ? MotionStatus.Climb : MotionStatus.Fly;
|
||||
@@ -223,7 +278,7 @@ public static partial class Bv
|
||||
RecognitionType = RecognitionTypes.Ocr,
|
||||
RegionOfInterest = new Rect(0, region.Height / 4 * 3, region.Width, region.Height / 4)
|
||||
});
|
||||
var r = list.FirstOrDefault(r => r.Text.Contains("复苏"));
|
||||
using var r = list.FirstOrDefault(r => r.Text.Contains("复苏"));
|
||||
if (r != null)
|
||||
{
|
||||
r.Click();
|
||||
@@ -256,7 +311,16 @@ public static partial class Bv
|
||||
/// <returns></returns>
|
||||
public static bool IsInBlessingOfTheWelkinMoon(ImageRegion captureRa)
|
||||
{
|
||||
return captureRa.Find(GameLoadingAssets.Instance.WelkinMoonRo).IsExist();
|
||||
var ra = captureRa;
|
||||
|
||||
using var girlRa = ra.Find(GameLoadingAssets.Instance.GirlMoonRo);
|
||||
if (girlRa.IsExist())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
using var moonRa = ra.Find(GameLoadingAssets.Instance.WelkinMoonRo);
|
||||
return moonRa.IsExist();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -266,7 +330,8 @@ public static partial class Bv
|
||||
/// <returns></returns>
|
||||
public static bool IsInTalkUi(ImageRegion captureRa)
|
||||
{
|
||||
return captureRa.Find(AutoSkipAssets.Instance.DisabledUiButtonRo).IsExist();
|
||||
using var ra = captureRa.Find(AutoSkipAssets.Instance.DisabledUiButtonRo);
|
||||
return ra.IsExist();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -277,7 +342,11 @@ public static partial class Bv
|
||||
/// <returns></returns>
|
||||
public static async Task<bool> WaitAndSkipForTalkUi(CancellationToken ct, int retryTimes = 5)
|
||||
{
|
||||
return await NewRetry.WaitForAction(() => IsInTalkUi(TaskControl.CaptureToRectArea()), ct, retryTimes, 500);
|
||||
return await NewRetry.WaitForAction(() =>
|
||||
{
|
||||
using var ra = TaskControl.CaptureToRectArea();
|
||||
return IsInTalkUi(ra);
|
||||
}, ct, retryTimes, 500);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -288,7 +357,8 @@ public static partial class Bv
|
||||
/// <returns></returns>
|
||||
public static bool IsInPromptDialog(ImageRegion captureRa)
|
||||
{
|
||||
return captureRa.Find(ElementAssets.Instance.PromptDialogLeftBottomStar).IsExist();
|
||||
using var ra = captureRa.Find(ElementAssets.Instance.PromptDialogLeftBottomStar);
|
||||
return ra.IsExist();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,4 +367,4 @@ public enum MotionStatus
|
||||
Normal, // 正常
|
||||
Fly, // 飞行
|
||||
Climb, // 攀爬
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 810 B |
@@ -15,6 +15,7 @@ public class ElementAssets : BaseAssets<ElementAssets>
|
||||
public RecognitionObject BtnWhiteCancel;
|
||||
public RecognitionObject BtnBlackConfirm;
|
||||
public RecognitionObject BtnBlackCancel;
|
||||
public RecognitionObject BtnBackTeyvat;
|
||||
public RecognitionObject BtnOnlineYes;
|
||||
public RecognitionObject BtnOnlineNo;
|
||||
public Lazy<RecognitionObject> BtnExitDoor;
|
||||
@@ -88,6 +89,11 @@ public class ElementAssets : BaseAssets<ElementAssets>
|
||||
|
||||
public RecognitionObject LeylineDisorderIconRo;
|
||||
|
||||
public RecognitionObject EscDown;
|
||||
public RecognitionObject EscWonderlandHome;
|
||||
public RecognitionObject WonderlandEnter;
|
||||
public RecognitionObject WonderlandClose;
|
||||
|
||||
public RecognitionObject Index1;
|
||||
public RecognitionObject Index2;
|
||||
public RecognitionObject Index3;
|
||||
@@ -147,6 +153,12 @@ public class ElementAssets : BaseAssets<ElementAssets>
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "btn_black_cancel.png", systemInfo),
|
||||
Use3Channels = true
|
||||
}.InitTemplate();
|
||||
BtnBackTeyvat = new RecognitionObject
|
||||
{
|
||||
Name = "BtnBackTeyvat",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "btn_back_teyvat.png", systemInfo),
|
||||
}.InitTemplate();
|
||||
BtnOnlineYes = new RecognitionObject
|
||||
{
|
||||
Name = "BtnOnlineYes",
|
||||
@@ -678,7 +690,31 @@ public class ElementAssets : BaseAssets<ElementAssets>
|
||||
RegionOfInterest = new Rect(0, 0, (int)(200 * AssetScale), (int)(200 * AssetScale)),
|
||||
DrawOnWindow = false
|
||||
}.InitTemplate();
|
||||
|
||||
|
||||
EscDown = new RecognitionObject
|
||||
{
|
||||
Name = "EscDown",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "esc_down.png", systemInfo),
|
||||
}.InitTemplate();
|
||||
EscWonderlandHome = new RecognitionObject
|
||||
{
|
||||
Name = "EscWonderlandHome",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "esc_wonderland_home.png", systemInfo),
|
||||
}.InitTemplate();
|
||||
WonderlandEnter = new RecognitionObject
|
||||
{
|
||||
Name = "WonderlandEnter",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "wonderland_enter.png", systemInfo),
|
||||
}.InitTemplate();
|
||||
WonderlandClose = new RecognitionObject
|
||||
{
|
||||
Name = "WonderlandClose",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "wonderland_close.png", systemInfo),
|
||||
}.InitTemplate();
|
||||
|
||||
Rect partyRect = new Rect(CaptureRect.Width - (int)(65 * AssetScale), (int)(155 * AssetScale), (int)(35 * AssetScale), (int)(600 * AssetScale));
|
||||
// 1 2 3 4 按键
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"info": {
|
||||
"authors": [
|
||||
{
|
||||
"links": "",
|
||||
"name": "蜜柑魚"
|
||||
}
|
||||
],
|
||||
"bgi_version": "0.53.0",
|
||||
"description": "",
|
||||
"enable_monster_loot_split": false,
|
||||
"last_modified_time": 1762368339000,
|
||||
"map_match_method": "",
|
||||
"map_name": "Teyvat",
|
||||
"name": "冒险家协会_挪德卡莱",
|
||||
"tags": [],
|
||||
"type": "collect",
|
||||
"version": "1.0"
|
||||
},
|
||||
"positions": [
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 1,
|
||||
"move_mode": "walk",
|
||||
"type": "teleport",
|
||||
"x": 9458.0341796875,
|
||||
"y": 1660.66455078125
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 2,
|
||||
"move_mode": "walk",
|
||||
"type": "target",
|
||||
"x": 9461.4208984375,
|
||||
"y": 1663.5849609375
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,28 +1,48 @@
|
||||
{
|
||||
{
|
||||
"info": {
|
||||
"authors": [
|
||||
{
|
||||
"links": "",
|
||||
"name": "起个名字好难的喵"
|
||||
}
|
||||
],
|
||||
"bgi_version": "0.45.0",
|
||||
"description": "",
|
||||
"last_modified_time": 1769335370377,
|
||||
"map_match_method": "",
|
||||
"map_name": "Teyvat",
|
||||
"name": "冒险家协会_枫丹",
|
||||
"tags": [],
|
||||
"type": "collect",
|
||||
"author": "yemaxul",
|
||||
"version": "2.0",
|
||||
"description": "传送到枫丹冒险家协会",
|
||||
"bgiVersion": "0.35.0"
|
||||
"version": "1.0"
|
||||
},
|
||||
"positions": [
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 1,
|
||||
"x": 4508.97509765625,
|
||||
"y": 3630.557373046875,
|
||||
"type": "teleport",
|
||||
"move_mode": "walk",
|
||||
"action": ""
|
||||
"type": "teleport",
|
||||
"x": 4509.001953125,
|
||||
"y": 3630.5986328125
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 2,
|
||||
"x": 4495.0,
|
||||
"y": 3638.0,
|
||||
"type": "target",
|
||||
"move_mode": "walk",
|
||||
"action": ""
|
||||
"type": "path",
|
||||
"x": 4500.5625,
|
||||
"y": 3630.69677734375
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 3,
|
||||
"move_mode": "walk",
|
||||
"type": "target",
|
||||
"x": 4495.94140625,
|
||||
"y": 3638.5205078125
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,60 +1,93 @@
|
||||
{
|
||||
{
|
||||
"info": {
|
||||
"name": "璃月凯瑟琳",
|
||||
"type": "collect",
|
||||
"author": "½",
|
||||
"version": "1.0",
|
||||
"authors": [
|
||||
{
|
||||
"links": "",
|
||||
"name": "起个名字好难的喵"
|
||||
}
|
||||
],
|
||||
"bgi_version": "0.45.0",
|
||||
"description": "",
|
||||
"bgiVersion": "0.35.1"
|
||||
"last_modified_time": 1769343676091,
|
||||
"map_match_method": "",
|
||||
"map_name": "Teyvat",
|
||||
"name": "冒险家协会_璃月",
|
||||
"tags": [],
|
||||
"type": "collect",
|
||||
"version": "1.0"
|
||||
},
|
||||
"positions": [
|
||||
{
|
||||
"id": 1,
|
||||
"x": 267.958984375,
|
||||
"y": -665.10888671875,
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 1,
|
||||
"move_mode": "walk",
|
||||
"type": "teleport"
|
||||
"type": "teleport",
|
||||
"x": 267.947265625,
|
||||
"y": -665.119140625
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 2,
|
||||
"x": 258.3662109375,
|
||||
"y": -663.82177734375,
|
||||
"type": "path",
|
||||
"move_mode": "walk",
|
||||
"action": ""
|
||||
"type": "path",
|
||||
"x": 247.734375,
|
||||
"y": -662.94921875
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 3,
|
||||
"x": 246.689453125,
|
||||
"y": -662.83740234375,
|
||||
"type": "path",
|
||||
"move_mode": "walk",
|
||||
"action": ""
|
||||
"type": "path",
|
||||
"x": 230.8896484375,
|
||||
"y": -660.6494140625
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 4,
|
||||
"x": 233.8564453125,
|
||||
"y": -661.95849609375,
|
||||
"type": "path",
|
||||
"move_mode": "walk",
|
||||
"action": ""
|
||||
"type": "path",
|
||||
"x": 227.0048828125,
|
||||
"y": -658.09765625
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 5,
|
||||
"x": 219.0625,
|
||||
"y": -657.271484375,
|
||||
"type": "target",
|
||||
"move_mode": "walk",
|
||||
"action": ""
|
||||
"type": "path",
|
||||
"x": 217.0625,
|
||||
"y": -657.5771484375
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 6,
|
||||
"x": 203.84765625,
|
||||
"y": -659.7158203125,
|
||||
"type": "path",
|
||||
"move_mode": "walk",
|
||||
"action": ""
|
||||
"type": "path",
|
||||
"x": 209.7392578125,
|
||||
"y": -659.1416015625
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 7,
|
||||
"move_mode": "walk",
|
||||
"type": "path",
|
||||
"x": 204.67578125,
|
||||
"y": -662.45703125
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 8,
|
||||
"move_mode": "walk",
|
||||
"type": "target",
|
||||
"x": 203.5126953125,
|
||||
"y": -659.86328125
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,36 +1,57 @@
|
||||
{
|
||||
{
|
||||
"info": {
|
||||
"name": "稻妻凯瑟琳",
|
||||
"type": "collect",
|
||||
"author": "½",
|
||||
"version": "1.0",
|
||||
"authors": [
|
||||
{
|
||||
"links": "",
|
||||
"name": "起个名字好难的喵"
|
||||
}
|
||||
],
|
||||
"bgi_version": "0.45.0",
|
||||
"description": "",
|
||||
"bgiVersion": "0.35.1"
|
||||
"last_modified_time": 1769342575161,
|
||||
"map_match_method": "",
|
||||
"map_name": "Teyvat",
|
||||
"name": "冒险家协会_稻妻",
|
||||
"tags": [],
|
||||
"type": "collect",
|
||||
"version": "1.0"
|
||||
},
|
||||
"positions": [
|
||||
{
|
||||
"id": 1,
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 1,
|
||||
"move_mode": "walk",
|
||||
"type": "teleport",
|
||||
"x": -4402.556640625,
|
||||
"y": -3053.041015625
|
||||
"x": -4402.544921875,
|
||||
"y": -3052.9765625
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 2,
|
||||
"x": -4408.984375,
|
||||
"y": -3068.2470703125,
|
||||
"type": "path",
|
||||
"move_mode": "walk",
|
||||
"action": ""
|
||||
"type": "path",
|
||||
"x": -4416.03515625,
|
||||
"y": -3081.666015625
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 3,
|
||||
"x": -4418.185546875,
|
||||
"y": -3086.4326171875,
|
||||
"type": "path",
|
||||
"move_mode": "walk",
|
||||
"action": ""
|
||||
"type": "path",
|
||||
"x": -4419.468791093892,
|
||||
"y": -3086.062542740572
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 4,
|
||||
"move_mode": "walk",
|
||||
"type": "target",
|
||||
"x": -4418.54296875,
|
||||
"y": -3086.87890625
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"info": {
|
||||
"authors": [
|
||||
{
|
||||
"links": "",
|
||||
"name": "起个名字好难的喵"
|
||||
}
|
||||
],
|
||||
"bgi_version": "0.45.0",
|
||||
"description": "",
|
||||
"last_modified_time": 1769342917860,
|
||||
"map_match_method": "",
|
||||
"map_name": "Teyvat",
|
||||
"name": "冒险家协会_须弥",
|
||||
"tags": [],
|
||||
"type": "collect",
|
||||
"version": "1.0"
|
||||
},
|
||||
"positions": [
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 1,
|
||||
"move_mode": "walk",
|
||||
"type": "teleport",
|
||||
"x": 2786.9990234375,
|
||||
"y": -503.1044921875
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 2,
|
||||
"move_mode": "walk",
|
||||
"type": "path",
|
||||
"x": 2786.93359375,
|
||||
"y": -488.0771484375
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 3,
|
||||
"move_mode": "walk",
|
||||
"type": "path",
|
||||
"x": 2771.9033203125,
|
||||
"y": -476.23046875
|
||||
},
|
||||
{
|
||||
"action": "",
|
||||
"action_params": "",
|
||||
"id": 4,
|
||||
"move_mode": "walk",
|
||||
"type": "target",
|
||||
"x": 2765.5185546875,
|
||||
"y": -476.056640625
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -4,7 +4,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using BetterGenshinImpact.GameTask.Common.Map.Maps.Base;
|
||||
using BetterGenshinImpact.Model;
|
||||
using Newtonsoft.Json;
|
||||
@@ -32,20 +31,31 @@ public class MapLazyAssets : Singleton<MapLazyAssets>
|
||||
public readonly Dictionary<string, GiTpPosition> GoddessPositions = new();
|
||||
|
||||
public readonly List<String> DomainNameList = [];
|
||||
public readonly Dictionary<string, List<GiTpPosition>> CountryToDomains = new();
|
||||
|
||||
public MapLazyAssets()
|
||||
{
|
||||
var json = File.ReadAllText(Global.Absolute(@"GameTask\AutoTrackPath\Assets\tp.json"));
|
||||
var worldScenes = JsonConvert.DeserializeObject<List<GiWorldScene>>(json) ?? throw new Exception("tp.json deserialize failed");
|
||||
var worldScenes = Newtonsoft.Json.Linq.JObject.Parse(json)["data"]?.ToObject<List<GiWorldScene>>() ?? throw new Exception("tp.json deserialization failed");
|
||||
ScenesDic = worldScenes.ToDictionary(x => x.MapName, x => x);
|
||||
|
||||
|
||||
// 取出秘境 description=Domain
|
||||
var teyvatTpPositions = ScenesDic[MapTypes.Teyvat.ToString()].Points;
|
||||
foreach (var tp in teyvatTpPositions.Where(tp => (tp.Description == "材料本" || tp.Description == "圣遗物本")))
|
||||
var teyvatTpPositions = ScenesDic[nameof(MapTypes.Teyvat)].Points;
|
||||
foreach (var tp in teyvatTpPositions.Where(tp => tp.Type == "BlessDomain" || tp.Type == "ForgeryDomain" || tp.Type == "MasteryDomain"))
|
||||
{
|
||||
DomainPositionMap[tp.Name!] = tp;
|
||||
DomainNameList.Add(tp.Name!);
|
||||
|
||||
if (!string.IsNullOrEmpty(tp.Country))
|
||||
{
|
||||
if (!CountryToDomains.ContainsKey(tp.Country))
|
||||
{
|
||||
CountryToDomains[tp.Country] = [];
|
||||
}
|
||||
|
||||
CountryToDomains[tp.Country].Add(tp);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var tp in teyvatTpPositions.Where(tp => (tp.Type == "Goddess")))
|
||||
@@ -53,4 +63,15 @@ public class MapLazyAssets : Singleton<MapLazyAssets>
|
||||
GoddessPositions[tp.Id] = tp;
|
||||
}
|
||||
}
|
||||
|
||||
public string? GetCountryByDomain(string domain)
|
||||
{
|
||||
if (string.IsNullOrEmpty(domain)) return null;
|
||||
if (DomainPositionMap.TryGetValue(domain, out var tp))
|
||||
{
|
||||
return tp.Country;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class BlessingOfTheWelkinMoonTask
|
||||
if (t.Hour == 4 && t.Minute < 10)
|
||||
{
|
||||
using var ra = CaptureToRectArea();
|
||||
if (Bv.IsInBlessingOfTheWelkinMoon(ra))
|
||||
if (Bv.IsInBlessingOfTheWelkinMoon(ra) || ra.Find(ElementAssets.Instance.PrimogemRo).IsExist())
|
||||
{
|
||||
Logger.LogInformation("检测到空月祝福界面,自动点击");
|
||||
GameCaptureRegion.GameRegion1080PPosMove(100, 100);
|
||||
|
||||
@@ -157,7 +157,7 @@ public partial class ChooseTalkOptionTask
|
||||
|
||||
// 通过最下面的气泡框来文字识别
|
||||
var lowest = chatOptionResultList[0];
|
||||
var ocrRect = new Rect((int)(lowest.X + lowest.Width + 8 * assetScale), region.Height / 12,
|
||||
var ocrRect = new Rect((int)(lowest.X + lowest.Width + 8 * assetScale), region.Height / 8,
|
||||
(int)(535 * assetScale), (int)(lowest.Y + lowest.Height + 30 * assetScale - region.Height / 12d));
|
||||
var ocrResList = region.FindMulti(RecognitionObject.Ocr(ocrRect));
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using BetterGenshinImpact.GameTask.GetGridIcons;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using BetterGenshinImpact.GameTask.Model.GameUI;
|
||||
using BetterGenshinImpact.View.Drawable;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using Fischless.WindowsInput;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.ML.OnnxRuntime;
|
||||
@@ -100,7 +101,8 @@ namespace BetterGenshinImpact.GameTask.Common.Job
|
||||
string predName = result.Item1;
|
||||
if (predName == this.itemName!)
|
||||
{
|
||||
string numStr = itemRegion.SrcMat.GetGridItemIconText(OcrFactory.Paddle);
|
||||
string ocrText = itemRegion.SrcMat.GetGridItemIconText(OcrFactory.Paddle);
|
||||
string numStr = StringUtils.ConvertFullWidthNumToHalfWidth(ocrText);
|
||||
if (int.TryParse(numStr, out int num))
|
||||
{
|
||||
count = num;
|
||||
@@ -149,7 +151,8 @@ namespace BetterGenshinImpact.GameTask.Common.Job
|
||||
if (this.itemNames!.Contains(predName) && !itemsCountDic!.ContainsKey(predName))
|
||||
{
|
||||
int count;
|
||||
string numStr = itemRegion.SrcMat.GetGridItemIconText(OcrFactory.Paddle);
|
||||
string ocrText = itemRegion.SrcMat.GetGridItemIconText(OcrFactory.Paddle);
|
||||
string numStr = StringUtils.ConvertFullWidthNumToHalfWidth(ocrText);
|
||||
if (int.TryParse(numStr, out int num))
|
||||
{
|
||||
count = num;
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.Core.Simulator;
|
||||
using BetterGenshinImpact.GameTask.Common.BgiVision;
|
||||
using BetterGenshinImpact.GameTask.Common.Element.Assets;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Vanara.PInvoke;
|
||||
using static BetterGenshinImpact.GameTask.Common.TaskControl;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.Common.Job;
|
||||
|
||||
public class EnterAndExitWonderlandJob
|
||||
{
|
||||
private ElementAssets _assets = ElementAssets.Instance;
|
||||
|
||||
public async Task Start(CancellationToken ct)
|
||||
{
|
||||
Logger.LogInformation("进入千星奇域");
|
||||
SystemControl.FocusWindow(TaskContext.Instance().GameHandle);
|
||||
|
||||
// 等待千星奇域界面出现
|
||||
await NewRetry.WaitForElementAppear(
|
||||
_assets.WonderlandClose,
|
||||
() => Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_F6),
|
||||
ct,
|
||||
10,
|
||||
1000
|
||||
);
|
||||
|
||||
// 点击一个奇域并等待大厅按钮出现
|
||||
await NewRetry.WaitForElementAppear(
|
||||
_assets.BtnBlackConfirm,
|
||||
() => GameCaptureRegion.GameRegion1080PPosClick(680, 310),
|
||||
ct,
|
||||
5,
|
||||
800
|
||||
);
|
||||
|
||||
// // 点击大厅按钮并等待公共大厅按钮出现
|
||||
// await NewRetry.WaitForElementAppear(
|
||||
// _assets.WonderlandEnter,
|
||||
// () =>
|
||||
// {
|
||||
// using var ra = CaptureToRectArea();
|
||||
// Bv.FindAndClick(ra, _assets.EscWonderlandHome);
|
||||
// },
|
||||
// ct,
|
||||
// 5,
|
||||
// 1000
|
||||
// );
|
||||
//
|
||||
// // 点击公共大厅按钮并等待确认弹窗出现
|
||||
// await NewRetry.WaitForElementAppear(
|
||||
// _assets.BtnBlackConfirm,
|
||||
// () =>
|
||||
// {
|
||||
// using var ra = CaptureToRectArea();
|
||||
// Bv.FindAndClick(ra, _assets.WonderlandEnter);
|
||||
// },
|
||||
// ct,
|
||||
// 5,
|
||||
// 800
|
||||
// );
|
||||
|
||||
// 点击前往大厅并等待弹窗消失
|
||||
await NewRetry.WaitForElementDisappear(
|
||||
_assets.BtnBlackConfirm,
|
||||
screen =>
|
||||
{
|
||||
// 接收当前截图作为参数
|
||||
screen.Find(_assets.BtnBlackConfirm, ra =>
|
||||
{
|
||||
ra.Click();
|
||||
ra.Dispose();
|
||||
});
|
||||
},
|
||||
ct,
|
||||
5,
|
||||
1000
|
||||
);
|
||||
await Delay(1000, ct);
|
||||
|
||||
// 等待主界面出现
|
||||
var mainUiFound1 = await NewRetry.WaitForElementAppear(
|
||||
ElementAssets.Instance.PaimonMenuRo,
|
||||
() => { },
|
||||
ct,
|
||||
120,
|
||||
1000
|
||||
);
|
||||
|
||||
if (mainUiFound1)
|
||||
{
|
||||
Logger.LogInformation("已进入千星奇域大厅,准备返回提瓦特");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogWarning("未检测到主界面,可能未处于千星奇域");
|
||||
}
|
||||
|
||||
await Delay(500, ct);
|
||||
|
||||
// 等待菜单界面出现
|
||||
await NewRetry.WaitForElementAppear(
|
||||
_assets.BtnBackTeyvat,
|
||||
() => Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_ESCAPE),
|
||||
ct,
|
||||
20,
|
||||
800
|
||||
);
|
||||
|
||||
// 点击返回提瓦特按钮并等待确认弹窗出现
|
||||
await NewRetry.WaitForElementAppear(
|
||||
_assets.BtnBlackConfirm,
|
||||
() =>
|
||||
{
|
||||
using var ra = CaptureToRectArea();
|
||||
Bv.FindAndClick(ra, _assets.BtnBackTeyvat);
|
||||
},
|
||||
ct,
|
||||
5,
|
||||
800
|
||||
);
|
||||
|
||||
// 点击确认并等待确认弹窗消失
|
||||
await NewRetry.WaitForElementDisappear(
|
||||
_assets.BtnBlackConfirm,
|
||||
screen =>
|
||||
{
|
||||
// 接收当前截图作为参数
|
||||
screen.Find(_assets.BtnBlackConfirm, ra =>
|
||||
{
|
||||
ra.Click();
|
||||
ra.Dispose();
|
||||
});
|
||||
},
|
||||
ct,
|
||||
5,
|
||||
1000
|
||||
);
|
||||
await Delay(1000, ct);
|
||||
|
||||
// 等待主界面出现
|
||||
var mainUiFound2 = await NewRetry.WaitForElementAppear(
|
||||
ElementAssets.Instance.PaimonMenuRo,
|
||||
() => { },
|
||||
ct,
|
||||
120,
|
||||
1000
|
||||
);
|
||||
|
||||
if (mainUiFound2)
|
||||
{
|
||||
Logger.LogInformation("已返回提瓦特");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogWarning("未检测到主界面,可能未处于提瓦特");
|
||||
}
|
||||
|
||||
await Delay(500, ct);
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,16 @@ public class GoToAdventurersGuildTask
|
||||
if (res == TalkOptionRes.FoundAndClick)
|
||||
{
|
||||
Logger.LogInformation("▶ {Text}", "领取『每日委托』奖励!");
|
||||
await Delay(500, ct);
|
||||
await Delay(800, ct);
|
||||
|
||||
// 6.2 每日提示确认
|
||||
var ra1 = CaptureToRectArea();
|
||||
if (Bv.ClickBlackConfirmButton(ra1))
|
||||
{
|
||||
Logger.LogInformation("存在提示并确认");
|
||||
}
|
||||
ra1.Dispose();
|
||||
|
||||
await _chooseTalkOptionTask.SelectLastOptionUntilEnd(ct, null, 3); // 点几下
|
||||
await Bv.WaitUntilFound(ElementAssets.Instance.PaimonMenuRo, ct);
|
||||
await Delay(500, ct);
|
||||
|
||||
@@ -138,11 +138,12 @@ public class SwitchPartyTask
|
||||
|
||||
// 点击到最上方
|
||||
await Task.Delay(50, ct);
|
||||
GameCaptureRegion.GameRegion1080PPosClick(700, 120);
|
||||
GameCaptureRegion.GameRegion1080PPosClick(700, 125);
|
||||
await Task.Delay(50, ct);
|
||||
Simulation.SendInput.Mouse.LeftButtonDown();
|
||||
await Task.Delay(450, ct);
|
||||
Simulation.SendInput.Mouse.LeftButtonUp();
|
||||
await Task.Delay(100, ct);
|
||||
|
||||
Rect regionOfInterest = new Rect(0, (int)(80 * _assetScale), partyDeleteBtn.Right, partyDeleteBtn.Top - (int)(80 * _assetScale));
|
||||
RecognitionObject recognitionObject = new RecognitionObject
|
||||
@@ -197,6 +198,7 @@ public class SwitchPartyTask
|
||||
{
|
||||
// #ebe4d8 首次点一下第一个,防止第五个被点击过
|
||||
page.ClickTo(600 * _assetScale, 200 * _assetScale);
|
||||
await Task.Delay(300, ct); // 等待动画
|
||||
}
|
||||
|
||||
page.ClickTo(regionOfInterest.X + regionOfInterest.Width / 2, lowest.Bottom); // 点击最下方队伍下移
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using BetterGenshinImpact.GameTask.Common.Map.Maps.Base;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.GameTask.Common.Map.Maps.Base;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.Common.Map.Maps;
|
||||
@@ -11,10 +12,10 @@ public class AncientSacredMountainMap : SceneBaseMap
|
||||
{
|
||||
#region 地图参数
|
||||
|
||||
static readonly int GameMapRows = 2; // 游戏坐标下地图块的行数
|
||||
static readonly int GameMapCols = 2; // 游戏坐标下地图块的列数
|
||||
static readonly int GameMapUpRows = 0; // 游戏坐标下 左上角离地图原点的行数(注意原点在块的右下角)
|
||||
static readonly int GameMapLeftCols = 0; // 游戏坐标下 左上角离地图原点的列数(注意原点在块的右下角)
|
||||
static readonly int GameMapRows = 4; // 游戏坐标下地图块的行数
|
||||
static readonly int GameMapCols = 4; // 游戏坐标下地图块的列数
|
||||
static readonly int GameMapUpRows = 1; // 游戏坐标下 左上角离地图原点的行数(注意原点在块的右下角)
|
||||
static readonly int GameMapLeftCols = 1; // 游戏坐标下 左上角离地图原点的列数(注意原点在块的右下角)
|
||||
|
||||
#endregion 地图参数
|
||||
|
||||
@@ -27,6 +28,8 @@ public class AncientSacredMountainMap : SceneBaseMap
|
||||
splitRow: 0,
|
||||
splitCol: 0)
|
||||
{
|
||||
ExtractAndSaveFeature(Global.Absolute("Assets/Map/AncientSacredMountain/AncientSacredMountain_0_1024.png"));
|
||||
ExtractAndSaveFeature(Global.Absolute("Assets/Map/AncientSacredMountain/AncientSacredMountain_-1_1024.webp"));
|
||||
Layers = BaseMapLayer.LoadLayers(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ public class BaseMapLayer(SceneBaseMap baseMap)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return a.Floor > b.Floor ? 1 : -1;
|
||||
return a.Floor < b.Floor ? 1 : -1;
|
||||
});
|
||||
return layers;
|
||||
}
|
||||
|
||||
@@ -13,4 +13,10 @@ public enum DisplayMapTypes
|
||||
|
||||
[Description("渊下宫")]
|
||||
Enkanomiya,
|
||||
|
||||
[Description("旧日之海")]
|
||||
SeaOfBygoneEras,
|
||||
|
||||
[Description("远古圣山")]
|
||||
AncientSacredMountain,
|
||||
}
|
||||
@@ -9,6 +9,8 @@ namespace BetterGenshinImpact.GameTask.Common.Map.Maps.Base;
|
||||
/// </summary>
|
||||
public interface ISceneMap
|
||||
{
|
||||
void WarmUp();
|
||||
|
||||
/// <summary>
|
||||
/// 获取大地图在整张地图上的位置
|
||||
/// </summary>
|
||||
@@ -47,22 +49,18 @@ public interface ISceneMap
|
||||
/// </summary>
|
||||
/// <param name="imageCoordinates"></param>
|
||||
/// <returns></returns>
|
||||
Point2f ConvertImageCoordinatesToGenshinMapCoordinates(Point2f imageCoordinates);
|
||||
Point2f? ConvertImageCoordinatesToGenshinMapCoordinates(Point2f imageCoordinates);
|
||||
|
||||
(float x, float y) ConvertImageCoordinatesToGenshinMapCoordinates(float x, float y);
|
||||
|
||||
Rect ConvertImageCoordinatesToGenshinMapCoordinates(Rect rect);
|
||||
Rect? ConvertImageCoordinatesToGenshinMapCoordinates(Rect rect);
|
||||
|
||||
/// <summary>
|
||||
/// 原神游戏坐标系 -> 地图图像坐标系
|
||||
/// </summary>
|
||||
/// <param name="genshinMapCoordinates"></param>
|
||||
/// <returns></returns>
|
||||
Point2f ConvertGenshinMapCoordinatesToImageCoordinates(Point2f genshinMapCoordinates);
|
||||
|
||||
(float x, float y) ConvertGenshinMapCoordinatesToImageCoordinates(float c, float a);
|
||||
Point2f ConvertGenshinMapCoordinatesToImageCoordinates(Point2f? genshinMapCoordinates);
|
||||
|
||||
Rect ConvertGenshinMapCoordinatesToImageCoordinates(Rect rect);
|
||||
Rect ConvertGenshinMapCoordinatesToImageCoordinates(Rect? rect);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv.FeatureMatch;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.Common.Map.Maps.Base;
|
||||
@@ -63,11 +64,33 @@ public abstract class SceneBaseMap : ISceneMap
|
||||
/// 分层地图特征列表
|
||||
/// 0 是主地图
|
||||
/// </summary>
|
||||
public List<BaseMapLayer> Layers { get; set; } = [];
|
||||
private List<BaseMapLayer> _layers = [];
|
||||
private readonly object _layersLock = new();
|
||||
|
||||
public List<BaseMapLayer> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_layers.Count == 0)
|
||||
{
|
||||
lock (_layersLock)
|
||||
{
|
||||
if (_layers.Count == 0)
|
||||
{
|
||||
TaskControl.Logger.LogInformation("[SIFT]地图特征点加载中,预计耗时2秒,请等待...");
|
||||
_layers = BaseMapLayer.LoadLayers(this);
|
||||
TaskControl.Logger.LogInformation("地图特征点加载完成!");
|
||||
}
|
||||
}
|
||||
}
|
||||
return _layers;
|
||||
}
|
||||
set => _layers = value ?? [];
|
||||
}
|
||||
|
||||
protected BaseMapLayer MainLayer => Layers[0];
|
||||
|
||||
protected readonly Feature2D SiftMatcher = Feature2DFactory.Get(Feature2DType.SIFT);
|
||||
public readonly Feature2D SiftMatcher = Feature2DFactory.Get(Feature2DType.SIFT);
|
||||
|
||||
protected void ExtractAndSaveFeature(string basePath)
|
||||
{
|
||||
@@ -85,6 +108,11 @@ public abstract class SceneBaseMap : ISceneMap
|
||||
SiftMatcher.SaveFeatures(basePath, trainKeyPointsPath, trainDescriptorsPath);
|
||||
}
|
||||
|
||||
public virtual void WarmUp()
|
||||
{
|
||||
Console.WriteLine("提前加载地图,层数:" + Layers.Count);
|
||||
}
|
||||
|
||||
public virtual Point2f GetBigMapPosition(Mat greyBigMapMat)
|
||||
{
|
||||
return SiftMatcher.Match(MainLayer.TrainKeyPoints, MainLayer.TrainDescriptors, greyBigMapMat);
|
||||
@@ -151,48 +179,55 @@ public abstract class SceneBaseMap : ISceneMap
|
||||
|
||||
#region 坐标系转换
|
||||
|
||||
public Point2f ConvertImageCoordinatesToGenshinMapCoordinates(Point2f imageCoordinates)
|
||||
public Point2f? ConvertImageCoordinatesToGenshinMapCoordinates(Point2f imageCoordinates)
|
||||
{
|
||||
if (imageCoordinates.X == 0 && imageCoordinates.Y == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
// 原神坐标系是 1024 级别的,当图像坐标系不是 1024 级别的时候要做转换
|
||||
return new Point2f((MapOriginInImageCoordinate.X - imageCoordinates.X) / _mapImageBlockWidthScale,
|
||||
(MapOriginInImageCoordinate.Y - imageCoordinates.Y) / _mapImageBlockWidthScale);
|
||||
}
|
||||
|
||||
public (float x, float y) ConvertImageCoordinatesToGenshinMapCoordinates(float x, float y)
|
||||
{
|
||||
return new((MapOriginInImageCoordinate.X - x) / _mapImageBlockWidthScale,
|
||||
(MapOriginInImageCoordinate.Y - y) / _mapImageBlockWidthScale);
|
||||
}
|
||||
|
||||
public Rect ConvertImageCoordinatesToGenshinMapCoordinates(Rect rect)
|
||||
public Rect? ConvertImageCoordinatesToGenshinMapCoordinates(Rect rect)
|
||||
{
|
||||
if (rect.X == 0 && rect.Y == 0 && rect.Width == 0 && rect.Height == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var center = rect.GetCenterPoint();
|
||||
var (x, y) = ConvertImageCoordinatesToGenshinMapCoordinates(center.X, center.Y);
|
||||
return new Rect((int)(x - rect.Width / 2f / _mapImageBlockWidthScale), (int)(y - rect.Height / 2f / _mapImageBlockWidthScale),
|
||||
(int)(rect.Width / _mapImageBlockWidthScale), (int)(rect.Height / _mapImageBlockWidthScale));
|
||||
var nullablePoint = ConvertImageCoordinatesToGenshinMapCoordinates(new Point2f(center.X, center.Y));
|
||||
if (nullablePoint is Point2f p)
|
||||
{
|
||||
return new Rect((int)(p.X - rect.Width / 2f / _mapImageBlockWidthScale), (int)(p.Y - rect.Height / 2f / _mapImageBlockWidthScale),
|
||||
(int)(rect.Width / _mapImageBlockWidthScale), (int)(rect.Height / _mapImageBlockWidthScale));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Point2f ConvertGenshinMapCoordinatesToImageCoordinates(Point2f genshinMapCoordinates)
|
||||
public Point2f ConvertGenshinMapCoordinatesToImageCoordinates(Point2f? genshinMapCoordinates)
|
||||
{
|
||||
return new Point2f(MapOriginInImageCoordinate.X - genshinMapCoordinates.X * _mapImageBlockWidthScale,
|
||||
MapOriginInImageCoordinate.Y - genshinMapCoordinates.Y * _mapImageBlockWidthScale);
|
||||
if (genshinMapCoordinates is Point2f p)
|
||||
{
|
||||
return new Point2f(MapOriginInImageCoordinate.X - p.X * _mapImageBlockWidthScale,
|
||||
MapOriginInImageCoordinate.Y - p.Y * _mapImageBlockWidthScale);
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
public (float x, float y) ConvertGenshinMapCoordinatesToImageCoordinates(float c, float a)
|
||||
public Rect ConvertGenshinMapCoordinatesToImageCoordinates(Rect? genshinMapRect)
|
||||
{
|
||||
return new(MapOriginInImageCoordinate.X - c * _mapImageBlockWidthScale,
|
||||
MapOriginInImageCoordinate.Y - a * _mapImageBlockWidthScale);
|
||||
}
|
||||
|
||||
public Rect ConvertGenshinMapCoordinatesToImageCoordinates(Rect rect)
|
||||
{
|
||||
var center = rect.GetCenterPoint();
|
||||
var (x, y) = ConvertGenshinMapCoordinatesToImageCoordinates(center.X, center.Y);
|
||||
return new Rect((int)Math.Round(x - rect.Width / 2f * _mapImageBlockWidthScale),
|
||||
(int)Math.Round(y - rect.Height / 2f * _mapImageBlockWidthScale),
|
||||
(int)Math.Round(rect.Width * _mapImageBlockWidthScale),
|
||||
(int)Math.Round(rect.Height * _mapImageBlockWidthScale));
|
||||
if (genshinMapRect is Rect rect)
|
||||
{
|
||||
var (x, y) = ConvertGenshinMapCoordinatesToImageCoordinates(rect.GetCenterPoint());
|
||||
return new Rect((int)Math.Round(x - rect.Width / 2f * _mapImageBlockWidthScale),
|
||||
(int)Math.Round(y - rect.Height / 2f * _mapImageBlockWidthScale),
|
||||
(int)Math.Round(rect.Width * _mapImageBlockWidthScale),
|
||||
(int)Math.Round(rect.Height * _mapImageBlockWidthScale));
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using BetterGenshinImpact.Core.Recognition.OpenCv.TemplateMatch;
|
||||
using OpenCvSharp;
|
||||
using BetterGenshinImpact.GameTask.Common.Map.MiniMap;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.Common.Map.Maps.Base;
|
||||
|
||||
@@ -15,7 +16,28 @@ public abstract class SceneBaseMapByTemplateMatch : SceneBaseMap
|
||||
{
|
||||
private readonly MiniMapPreprocessor _miniMapPreprocessor = new();
|
||||
|
||||
public new List<BaseMapLayerByTemplateMatch> Layers { get; set; } = [];
|
||||
private List<BaseMapLayerByTemplateMatch> _layers = [];
|
||||
private readonly object _layersLock = new();
|
||||
public new List<BaseMapLayerByTemplateMatch> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_layers.Count == 0)
|
||||
{
|
||||
lock (_layersLock)
|
||||
{
|
||||
if (_layers.Count == 0)
|
||||
{
|
||||
TaskControl.Logger.LogInformation("[TemplateMatch]提瓦特大陆地图模板加载中,可能耗时较久,请耐心等待...");
|
||||
Layers = BaseMapLayerByTemplateMatch.LoadLayers(this);
|
||||
TaskControl.Logger.LogInformation("地图特征点加载完成!");
|
||||
}
|
||||
}
|
||||
}
|
||||
return _layers;
|
||||
}
|
||||
set => _layers = value ?? [];
|
||||
}
|
||||
|
||||
public MatchResult PrevSuccessResult;
|
||||
|
||||
@@ -43,10 +65,10 @@ public abstract class SceneBaseMapByTemplateMatch : SceneBaseMap
|
||||
: base(type, mapSize, mapOriginInImageCoordinate, mapImageBlockWidth, splitRow, splitCol)
|
||||
{
|
||||
}
|
||||
|
||||
protected void SetBaseLayers(List<BaseMapLayer> layers)
|
||||
|
||||
public override void WarmUp()
|
||||
{
|
||||
base.Layers = layers;
|
||||
Console.WriteLine("提前加载地图,层数:" + Layers.Count);
|
||||
}
|
||||
|
||||
public override Point2f GetMiniMapPosition(Mat colorMiniMapMat)
|
||||
@@ -84,7 +106,7 @@ public abstract class SceneBaseMapByTemplateMatch : SceneBaseMap
|
||||
using (miniMap)
|
||||
using (mask)
|
||||
{
|
||||
LocalMatch(miniMap, mask, ConvertImageCoordinatesToGenshinMapCoordinates(new Point2f(prevX, prevY)), ref curResult);
|
||||
LocalMatch(miniMap, mask, ConvertImageCoordinatesToGenshinMapCoordinates(new Point2f(prevX, prevY))!.Value, ref curResult);
|
||||
return UpdateResult(curResult, rank);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ public class EnkanomiyaMap : SceneBaseMap
|
||||
splitCol: 0)
|
||||
{
|
||||
ExtractAndSaveFeature(Global.Absolute("Assets/Map/Enkanomiya/Enkanomiya_0_1024.png"));
|
||||
Layers = BaseMapLayer.LoadLayers(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,8 +27,6 @@ public class EnkanomiyaMapTest : SceneBaseMapByTemplateMatch
|
||||
splitRow: 0,
|
||||
splitCol: 0)
|
||||
{
|
||||
Layers = BaseMapLayerByTemplateMatch.LoadLayers(this);
|
||||
ExtractAndSaveFeature(Global.Absolute("Assets/Map/Enkanomiya/Enkanomiya_0_1024.png"));
|
||||
SetBaseLayers(BaseMapLayer.LoadLayers(this));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv.FeatureMatch;
|
||||
using BetterGenshinImpact.GameTask.Common.Map.Maps.Base;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.Common.Map.Maps.Layer;
|
||||
|
||||
public class BigMapTeyvat256Layer : BaseMapLayer
|
||||
{
|
||||
// 大地图使用256 相对 2048 区块的缩放比例 2048/256=8
|
||||
public const int BigMap256ScaleTo2048 = 8;
|
||||
|
||||
private static BigMapTeyvat256Layer? _instance;
|
||||
private static readonly object LockObject = new();
|
||||
|
||||
private readonly Size _mapSize256;
|
||||
private readonly Feature2D _siftMatcher;
|
||||
|
||||
private BigMapTeyvat256Layer(SceneBaseMap baseMap) : base(baseMap)
|
||||
{
|
||||
Floor = 0;
|
||||
var layerDir = Path.Combine(Global.Absolute(@"Assets\Map\"), baseMap.Type.ToString());
|
||||
var kpFilePath = Path.Combine(layerDir, "Teyvat_0_256_SIFT.kp.bin");
|
||||
var matFilePath = Path.Combine(layerDir, "Teyvat_0_256_SIFT.mat.png");
|
||||
TrainKeyPoints = FeatureStorageHelper.LoadKeyPointArray(kpFilePath) ?? throw new Exception($"地图数据加载失败,文件: {kpFilePath}");
|
||||
TrainDescriptors = FeatureStorageHelper.LoadDescriptorMat(matFilePath) ?? throw new Exception($"地图数据加载失败,文件: {matFilePath}");
|
||||
|
||||
_mapSize256 = new Size(baseMap.MapSize.Width / BigMap256ScaleTo2048, baseMap.MapSize.Height / BigMap256ScaleTo2048);
|
||||
SplitBlocks = KeyPointFeatureBlockHelper.SplitFeatures(_mapSize256, TeyvatMap.GameMapRows * 4, TeyvatMap.GameMapCols * 4, TrainKeyPoints, TrainDescriptors);
|
||||
|
||||
_siftMatcher = baseMap.SiftMatcher;
|
||||
}
|
||||
|
||||
public static BigMapTeyvat256Layer GetInstance(SceneBaseMap baseMap)
|
||||
{
|
||||
if (_instance != null)
|
||||
{
|
||||
return _instance;
|
||||
}
|
||||
|
||||
lock (LockObject)
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new BigMapTeyvat256Layer(baseMap);
|
||||
}
|
||||
}
|
||||
|
||||
return _instance;
|
||||
}
|
||||
|
||||
public Rect GetBigMapRect(Mat greyBigMapMat)
|
||||
{
|
||||
greyBigMapMat = ResizeHelper.Resize(greyBigMapMat, 1d / 4);
|
||||
return _siftMatcher.KnnMatchRect(TrainKeyPoints, TrainDescriptors, greyBigMapMat);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据上一个矩形位置,自适应地扩大搜索范围
|
||||
/// 自适应扩展:
|
||||
/// - blockWidth = colEnd - colStart + 1 , blockHeight 类似,得到该矩形覆盖了多少个块。
|
||||
/// - maxBlock = max(blockWidth, blockHeight) 作为尺度。
|
||||
/// - expand = Max(1, Min(4, maxBlock / 2)) :
|
||||
/// - 小矩形(块数少)至少扩展 1 个块;
|
||||
/// - 大矩形(块数多)根据块数扩展,但最多扩展到 4 个块,避免一下子把全图拉进来。
|
||||
/// - 在块索引上做扩展,而不是继续固定 3×3,也就实现了“根据块多少决定扩展大小”。
|
||||
/// </summary>
|
||||
/// <param name="greyBigMapMat"></param>
|
||||
/// <param name="prevRect"></param>
|
||||
/// <returns></returns>
|
||||
public Rect GetBigMapRect(Mat greyBigMapMat, Rect prevRect)
|
||||
{
|
||||
var rows = SplitBlocks.Length;
|
||||
if (prevRect == default || rows == 0)
|
||||
{
|
||||
return GetBigMapRect(greyBigMapMat);
|
||||
}
|
||||
|
||||
var cols = SplitBlocks[0].Length;
|
||||
|
||||
var (rowStart, rowEnd, colStart, colEnd) = KeyPointFeatureBlockHelper.GetCellRange(_mapSize256, rows, cols, prevRect);
|
||||
|
||||
var blockWidth = colEnd - colStart + 1;
|
||||
var blockHeight = rowEnd - rowStart + 1;
|
||||
var maxBlock = Math.Max(blockWidth, blockHeight);
|
||||
|
||||
var expand = 1;
|
||||
// var expand = Math.Max(1, Math.Min(2, maxBlock / 2));
|
||||
// Debug.WriteLine($"[提瓦特大地图]自适应扩展搜索,块范围扩展: {expand},原范围行({rowStart},{rowEnd})列({colStart},{colEnd})");
|
||||
|
||||
rowStart -= expand;
|
||||
rowEnd += expand;
|
||||
colStart -= expand;
|
||||
colEnd += expand;
|
||||
|
||||
greyBigMapMat = ResizeHelper.Resize(greyBigMapMat, 1d / 4);
|
||||
var mergedBlock = KeyPointFeatureBlockHelper.MergeFeaturesInRange(SplitBlocks, TrainDescriptors, rowStart, rowEnd, colStart, colEnd);
|
||||
var keyPoints = mergedBlock.KeyPointArray;
|
||||
var descriptors = mergedBlock.Descriptor!;
|
||||
|
||||
var res = _siftMatcher.KnnMatchRect(keyPoints, descriptors, greyBigMapMat);
|
||||
if (res == default)
|
||||
{
|
||||
Debug.WriteLine("[提瓦特大地图]自适应扩展搜索失败,退回全图搜索");
|
||||
return _siftMatcher.KnnMatchRect(TrainKeyPoints, TrainDescriptors, greyBigMapMat);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,48 @@
|
||||
using BetterGenshinImpact.GameTask.Common.Map.Maps.Base;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.GameTask.Common.Map.Maps.Base;
|
||||
using OpenCvSharp;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using BetterGenshinImpact.GameTask.Common.Element.Assets;
|
||||
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.Common.Map.Maps;
|
||||
|
||||
/// <summary>
|
||||
/// 旧日之海
|
||||
/// 从3x4改成了1x2
|
||||
/// 大地图都是半黑的,传送可能有问题
|
||||
/// </summary>
|
||||
public class SeaOfBygoneErasMap : SceneBaseMap
|
||||
{
|
||||
#region 地图参数
|
||||
|
||||
static readonly int GameMapRows = 1; // 游戏坐标下地图块的行数
|
||||
static readonly int GameMapCols = 2; // 游戏坐标下地图块的列数
|
||||
static readonly int GameMapUpRows = 0; // 游戏坐标下 左上角离地图原点的行数(注意原点在块的右下角) TODO 没找到
|
||||
static readonly int GameMapLeftCols = 0; // 游戏坐标下 左上角离地图原点的列数(注意原点在块的右下角) TODO 没找到
|
||||
static readonly int GameMapRows = 3; // 游戏坐标下地图块的行数
|
||||
static readonly int GameMapCols = 4; // 游戏坐标下地图块的列数
|
||||
static readonly int GameMapUpRows = 2; // 游戏坐标下 左上角离地图原点的行数(注意原点在块的右下角)
|
||||
static readonly int GameMapLeftCols = 5; // 游戏坐标下 左上角离地图原点的列数(注意原点在块的右下角)
|
||||
|
||||
#endregion 地图参数
|
||||
|
||||
static readonly int SeaOfBygoneErasMapImageBlockWidth = 1024;
|
||||
|
||||
private static Mat TeleportTemplate;
|
||||
private static Mat TeleportTemplateMask;
|
||||
private List<Point> MapTeleports;
|
||||
|
||||
static SeaOfBygoneErasMap()
|
||||
{
|
||||
Mat img = GameTaskManager.LoadAssetImage("QuickTeleport", "TeleportTransparentBackground.png", ImreadModes.Unchanged);
|
||||
|
||||
TeleportTemplate = new Mat();
|
||||
Cv2.CvtColor(img, TeleportTemplate, ColorConversionCodes.BGRA2GRAY);
|
||||
|
||||
Mat[] channels = Cv2.Split(img);
|
||||
TeleportTemplateMask = channels[3];
|
||||
}
|
||||
|
||||
public SeaOfBygoneErasMap() : base(type: MapTypes.SeaOfBygoneEras,
|
||||
mapSize: new Size(GameMapCols * SeaOfBygoneErasMapImageBlockWidth, GameMapRows * SeaOfBygoneErasMapImageBlockWidth),
|
||||
mapOriginInImageCoordinate: new Point2f((GameMapLeftCols + 1) * SeaOfBygoneErasMapImageBlockWidth, (GameMapUpRows + 1) * SeaOfBygoneErasMapImageBlockWidth),
|
||||
@@ -28,7 +50,205 @@ public class SeaOfBygoneErasMap : SceneBaseMap
|
||||
splitRow: 0,
|
||||
splitCol: 0)
|
||||
{
|
||||
ExtractAndSaveFeature(Global.Absolute("Assets/Map/SeaOfBygoneEras/SeaOfBygoneEras_0_1024.png"));
|
||||
ExtractAndSaveFeature(Global.Absolute("Assets/Map/SeaOfBygoneEras/SeaOfBygoneEras_-1_1024.webp"));
|
||||
ExtractAndSaveFeature(Global.Absolute("Assets/Map/SeaOfBygoneEras/SeaOfBygoneEras_-2_1024.webp"));
|
||||
Layers = BaseMapLayer.LoadLayers(this);
|
||||
|
||||
MapTeleports = MapLazyAssets.Instance.ScenesDic["SeaOfBygoneEras"].Points.
|
||||
Where(i => i.Type == "TeleportWaypoint").
|
||||
Select(i => ConvertGenshinMapCoordinatesToImageCoordinates(new Point2f((float)i.TranX, (float)i.TranY))).
|
||||
Select(i => new Point(i.X, i.Y)).OrderBy(i => i.X).ThenBy(i => i.Y).ToList();
|
||||
}
|
||||
|
||||
public override Point2f GetBigMapPosition(Mat greyBigMapMat)
|
||||
{
|
||||
var rect = GetBigMapRectByTeleports(greyBigMapMat);
|
||||
if (rect != default)
|
||||
{
|
||||
return rect.GetCenterPoint();
|
||||
}
|
||||
|
||||
return base.GetBigMapPosition(greyBigMapMat);
|
||||
}
|
||||
|
||||
public override Rect GetBigMapRect(Mat greyBigMapMat)
|
||||
{
|
||||
var rect = GetBigMapRectByTeleports(greyBigMapMat);
|
||||
if (rect != default)
|
||||
{
|
||||
return rect;
|
||||
}
|
||||
|
||||
return base.GetBigMapRect(greyBigMapMat);
|
||||
}
|
||||
|
||||
private Rect GetBigMapRectByTeleports(Mat greyBigMapMat)
|
||||
{
|
||||
// It's fine to miss some, but definitely no false positive results.
|
||||
const double threshold = 0.99;
|
||||
using Mat result = new Mat();
|
||||
Cv2.MatchTemplate(greyBigMapMat, TeleportTemplate, result, TemplateMatchModes.CCorrNormed, TeleportTemplateMask);
|
||||
|
||||
var teleportPoints = new List<Point>();
|
||||
|
||||
// Step 1: Get all teleport positions from current screenshot
|
||||
for (int i = 1; i < result.Rows - 1; ++i)
|
||||
{
|
||||
for (int j = 1; j < result.Cols - 1; ++j)
|
||||
{
|
||||
float val = result.At<float>(i, j);
|
||||
|
||||
if (val > threshold)
|
||||
{
|
||||
if (val >= result.At<float>(i - 1, j - 1) &&
|
||||
val >= result.At<float>(i - 1, j) &&
|
||||
val >= result.At<float>(i - 1, j + 1) &&
|
||||
val >= result.At<float>(i, j - 1) &&
|
||||
val >= result.At<float>(i, j + 1) &&
|
||||
val >= result.At<float>(i + 1, j - 1) &&
|
||||
val >= result.At<float>(i + 1, j) &&
|
||||
val >= result.At<float>(i + 1, j + 1))
|
||||
{
|
||||
var newPoint = new Point(j, i);
|
||||
bool tooClose = false;
|
||||
foreach (var p in teleportPoints)
|
||||
{
|
||||
if (p.DistanceTo(newPoint) < 50)
|
||||
{
|
||||
tooClose = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!tooClose)
|
||||
{
|
||||
teleportPoints.Add(newPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (teleportPoints.Count < 2)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
teleportPoints = teleportPoints.Select(i => new Point(i.X + 12, i.Y + 12)).
|
||||
OrderBy(i => i.X).ThenBy(i => i.Y).ToList();
|
||||
/*
|
||||
foreach (var p in teleportPoints) {
|
||||
Logger.LogInformation("Teleport point: {a}", p);
|
||||
}
|
||||
Logger.LogInformation("Total telepoints: {c}", teleportPoints.Count);
|
||||
*/
|
||||
|
||||
Func<Point, Point, double> GetAngleOfTwoPoints = (p0, p1) =>
|
||||
{
|
||||
double deltaX = p0.X - p1.X;
|
||||
int deltaY = p0.Y - p1.Y;
|
||||
if (deltaY == 0) { return 90; }
|
||||
var val = Math.Atan(deltaX / deltaY);
|
||||
return val / Math.PI * 180;
|
||||
};
|
||||
|
||||
// Step 2: find a diagonal determined by two of the teleports, let's call these two teleports reference points
|
||||
Point rp0 = new Point();
|
||||
Point rp1 = new Point();
|
||||
double refAngle = 0.0;
|
||||
{
|
||||
double minAngleDiff = 180;
|
||||
for (int i = 0; i < teleportPoints.Count; ++i)
|
||||
{
|
||||
for (int j = i + 1; j < teleportPoints.Count; ++j)
|
||||
{
|
||||
var p0 = teleportPoints[i];
|
||||
var p1 = teleportPoints[j];
|
||||
var angle = GetAngleOfTwoPoints(p0, p1);
|
||||
if (Math.Abs(Math.Abs(angle) - 45) < minAngleDiff)
|
||||
{
|
||||
rp0 = p0;
|
||||
rp1 = p1;
|
||||
minAngleDiff = Math.Abs(Math.Abs(angle) - 45);
|
||||
}
|
||||
}
|
||||
}
|
||||
refAngle = GetAngleOfTwoPoints(rp0, rp1);
|
||||
// Logger.LogInformation("Reference points {a} and {b}, Angle {c}", rp0, rp1, refAngle);
|
||||
}
|
||||
|
||||
{
|
||||
/*
|
||||
var debugMat = new Mat();
|
||||
Cv2.CvtColor(greyBigMapMat, debugMat, ColorConversionCodes.GRAY2BGR);
|
||||
foreach (var p in teleportPoints)
|
||||
{
|
||||
Cv2.DrawMarker(debugMat, p, new Scalar(255, 0, 0), MarkerTypes.Cross, 20, 2);
|
||||
}
|
||||
Cv2.DrawMarker(debugMat, rp0, new Scalar(0, 255, 0), MarkerTypes.TriangleUp, 20, 2);
|
||||
Cv2.DrawMarker(debugMat, rp1, new Scalar(0, 255, 0), MarkerTypes.TriangleUp, 20, 2);
|
||||
Cv2.ImWrite(((DateTimeOffset)DateTime.UtcNow).ToUnixTimeMilliseconds().ToString() + ".png", debugMat);
|
||||
*/
|
||||
}
|
||||
|
||||
// Step 3: For all diagonals determined by pairs of teleports on this map.
|
||||
var minDeviation = double.MaxValue;
|
||||
var transformParamScale = 0.0;
|
||||
var transformParamDeltaX = 0.0;
|
||||
var transformParamDeltaY = 0.0;
|
||||
for (int i = 0; i < MapTeleports.Count; ++i)
|
||||
{
|
||||
for (int j = i + 1; j < MapTeleports.Count; ++j)
|
||||
{
|
||||
var mp0 = MapTeleports[i];
|
||||
var mp1 = MapTeleports[j];
|
||||
var angle = GetAngleOfTwoPoints(mp0, mp1);
|
||||
if (Math.Abs(angle - refAngle) < 5)
|
||||
{
|
||||
// Step 4: Assuming this pair corresponds to the reference points
|
||||
var mpDist = mp0.DistanceTo(mp1);
|
||||
var rpDist = rp0.DistanceTo(rp1);
|
||||
var scale = mpDist / rpDist;
|
||||
var deltaX = mp0.X - rp0.X * scale;
|
||||
var deltaY = mp0.Y - rp0.Y * scale;
|
||||
|
||||
Func<Point, Point> transformPoint = i =>
|
||||
{
|
||||
return new Point(i.X * scale + deltaX, i.Y * scale + deltaY);
|
||||
};
|
||||
|
||||
var transformedPoints = teleportPoints.Select(i => transformPoint(i)).ToList();
|
||||
// Step 5: Check how close the fit is
|
||||
double totalDeviation = 0;
|
||||
foreach (var p in transformedPoints)
|
||||
{
|
||||
var minDist = MapTeleports.Select(i => i.DistanceTo(p)).Min();
|
||||
totalDeviation += minDist;
|
||||
}
|
||||
if (totalDeviation < minDeviation)
|
||||
{
|
||||
minDeviation = totalDeviation;
|
||||
transformParamScale = scale;
|
||||
transformParamDeltaX = deltaX;
|
||||
transformParamDeltaY = deltaY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Logger.LogInformation("Min deviation: {d}", minDeviation);
|
||||
if (minDeviation < 200)
|
||||
{
|
||||
Func<Point, Point> transformPoint = i =>
|
||||
{
|
||||
return new Point(i.X * transformParamScale + transformParamDeltaX, i.Y * transformParamScale + transformParamDeltaY);
|
||||
};
|
||||
var pTopLeft = transformPoint(new Point(0, 0));
|
||||
var pBottomRight = transformPoint(new Point(greyBigMapMat.Width, greyBigMapMat.Height));
|
||||
// Logger.LogInformation("Rect: {a}, {b}", pTopLeft, pBottomRight);
|
||||
return new Rect(pTopLeft.X, pTopLeft.Y, pBottomRight.X - pTopLeft.X, pBottomRight.Y - pTopLeft.Y);
|
||||
}
|
||||
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv.FeatureMatch;
|
||||
using BetterGenshinImpact.GameTask.Common.Map.Maps.Base;
|
||||
using BetterGenshinImpact.GameTask.Common.Map.Maps.Layer;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OpenCvSharp;
|
||||
|
||||
@@ -15,9 +16,9 @@ public class TeyvatMap : SceneBaseMap
|
||||
{
|
||||
#region 每次地图扩大都要更新的参数
|
||||
|
||||
public static readonly int GameMapRows = 13; // 游戏坐标下地图块的行数
|
||||
public static readonly int GameMapRows = 15; // 游戏坐标下地图块的行数
|
||||
public static readonly int GameMapCols = 22; // 游戏坐标下地图块的列数
|
||||
public static readonly int GameMapUpRows = 5; // 游戏坐标下 左上角离地图原点的行数(注意原点在块的右下角)
|
||||
public static readonly int GameMapUpRows = 7; // 游戏坐标下 左上角离地图原点的行数(注意原点在块的右下角)
|
||||
public static readonly int GameMapLeftCols = 15; // 游戏坐标下 左上角离地图原点的列数(注意原点在块的右下角)
|
||||
|
||||
#endregion 每次地图扩大都要更新的参数
|
||||
@@ -25,8 +26,6 @@ public class TeyvatMap : SceneBaseMap
|
||||
|
||||
public static readonly int TeyvatMapImageBlockWidth = 2048;
|
||||
|
||||
private readonly BaseMapLayer _teyvat256MapLayer;
|
||||
|
||||
public TeyvatMap() : base(type: MapTypes.Teyvat,
|
||||
mapSize: new Size(GameMapCols * TeyvatMapImageBlockWidth, GameMapRows * TeyvatMapImageBlockWidth),
|
||||
mapOriginInImageCoordinate: new Point2f((GameMapLeftCols + 1) * TeyvatMapImageBlockWidth, (GameMapUpRows + 1) * TeyvatMapImageBlockWidth),
|
||||
@@ -34,15 +33,6 @@ public class TeyvatMap : SceneBaseMap
|
||||
splitRow: GameMapRows * 2,
|
||||
splitCol: GameMapCols * 2)
|
||||
{
|
||||
TaskControl.Logger.LogInformation("[SIFT]提瓦特大陆地图特征点加载中,预计耗时2秒,请等待...");
|
||||
|
||||
Layers = BaseMapLayer.LoadLayers(this);
|
||||
var layerDir = Path.Combine(Global.Absolute(@"Assets\Map\"), Type.ToString());
|
||||
|
||||
// 256用于大地图匹配
|
||||
_teyvat256MapLayer = BaseMapLayer.LoadLayer(this, Path.Combine(layerDir, "Teyvat_0_256_SIFT.kp.bin"), Path.Combine(layerDir, "Teyvat_0_256_SIFT.mat.png"));
|
||||
TaskControl.Logger.LogInformation("地图特征点加载完成!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -52,12 +42,17 @@ public class TeyvatMap : SceneBaseMap
|
||||
public override Point2f GetBigMapPosition(Mat greyBigMapMat)
|
||||
{
|
||||
greyBigMapMat = ResizeHelper.Resize(greyBigMapMat, 1d / 4);
|
||||
return SiftMatcher.Match(_teyvat256MapLayer.TrainKeyPoints, _teyvat256MapLayer.TrainDescriptors, greyBigMapMat);
|
||||
var layer = BigMapTeyvat256Layer.GetInstance(this);
|
||||
return SiftMatcher.Match(layer.TrainKeyPoints, layer.TrainDescriptors, greyBigMapMat);
|
||||
}
|
||||
|
||||
public override Rect GetBigMapRect(Mat greyBigMapMat)
|
||||
{
|
||||
greyBigMapMat = ResizeHelper.Resize(greyBigMapMat, 1d / 4);
|
||||
return SiftMatcher.KnnMatchRect(_teyvat256MapLayer.TrainKeyPoints, _teyvat256MapLayer.TrainDescriptors, greyBigMapMat);
|
||||
return BigMapTeyvat256Layer.GetInstance(this).GetBigMapRect(greyBigMapMat);
|
||||
}
|
||||
}
|
||||
|
||||
public Rect GetBigMapRect(Mat greyBigMapMat, Rect prevRect)
|
||||
{
|
||||
return BigMapTeyvat256Layer.GetInstance(this).GetBigMapRect(greyBigMapMat, prevRect);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv.FeatureMatch;
|
||||
using BetterGenshinImpact.GameTask.Common.Map.Maps.Base;
|
||||
using BetterGenshinImpact.GameTask.Common.Map.Maps.Layer;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OpenCvSharp;
|
||||
|
||||
@@ -23,8 +24,6 @@ public class TeyvatMapTest : SceneBaseMapByTemplateMatch
|
||||
#endregion 每次地图扩大都要更新的参数
|
||||
static readonly int TeyvatMapImageBlockWidth = TeyvatMap.TeyvatMapImageBlockWidth;
|
||||
|
||||
private readonly BaseMapLayer _teyvat256MapLayer;
|
||||
|
||||
public TeyvatMapTest() : base(type: MapTypes.Teyvat,
|
||||
mapSize: new Size(GameMapCols * TeyvatMapImageBlockWidth, GameMapRows * TeyvatMapImageBlockWidth),
|
||||
mapOriginInImageCoordinate: new Point2f((GameMapLeftCols + 1) * TeyvatMapImageBlockWidth, (GameMapUpRows + 1) * TeyvatMapImageBlockWidth),
|
||||
@@ -32,29 +31,17 @@ public class TeyvatMapTest : SceneBaseMapByTemplateMatch
|
||||
splitRow: GameMapRows * 2,
|
||||
splitCol: GameMapCols * 2)
|
||||
{
|
||||
TaskControl.Logger.LogInformation("[TemplateMatch]提瓦特大陆地图模板加载中,可能耗时较久,请耐心等待...");
|
||||
|
||||
Layers = BaseMapLayerByTemplateMatch.LoadLayers(this);
|
||||
var layerDir = Path.Combine(Global.Absolute(@"Assets\Map\"), Type.ToString());
|
||||
|
||||
// 256用于大地图匹配
|
||||
_teyvat256MapLayer = BaseMapLayer.LoadLayer(this, Path.Combine(layerDir, "Teyvat_0_256_SIFT.kp.bin"), Path.Combine(layerDir, "Teyvat_0_256_SIFT.mat.png"));
|
||||
TaskControl.Logger.LogInformation("地图特征点加载完成!");
|
||||
|
||||
}
|
||||
|
||||
// 大地图使用256 相对 2048 区块的缩放比例 2048/256=8
|
||||
public const int BigMap256ScaleTo2048 = 8;
|
||||
|
||||
public override Point2f GetBigMapPosition(Mat greyBigMapMat)
|
||||
{
|
||||
greyBigMapMat = ResizeHelper.Resize(greyBigMapMat, 1d / 4);
|
||||
return SiftMatcher.Match(_teyvat256MapLayer.TrainKeyPoints, _teyvat256MapLayer.TrainDescriptors, greyBigMapMat);
|
||||
var layer = BigMapTeyvat256Layer.GetInstance(this);
|
||||
return SiftMatcher.Match(layer.TrainKeyPoints, layer.TrainDescriptors, greyBigMapMat);
|
||||
}
|
||||
|
||||
public override Rect GetBigMapRect(Mat greyBigMapMat)
|
||||
{
|
||||
greyBigMapMat = ResizeHelper.Resize(greyBigMapMat, 1d / 4);
|
||||
return SiftMatcher.KnnMatchRect(_teyvat256MapLayer.TrainKeyPoints, _teyvat256MapLayer.TrainDescriptors, greyBigMapMat);
|
||||
return BigMapTeyvat256Layer.GetInstance(this).GetBigMapRect(greyBigMapMat);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,6 @@ public class TheChasmMap : SceneBaseMap
|
||||
splitCol: 0)
|
||||
{
|
||||
ExtractAndSaveFeature(Global.Absolute("Assets/Map/TheChasm/TheChasm_0_1024.png"));
|
||||
Layers = BaseMapLayer.LoadLayers(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,8 +28,6 @@ public class TheChasmMapTest : SceneBaseMapByTemplateMatch
|
||||
splitRow: 0,
|
||||
splitCol: 0)
|
||||
{
|
||||
Layers = BaseMapLayerByTemplateMatch.LoadLayers(this);
|
||||
ExtractAndSaveFeature(Global.Absolute("Assets/Map/TheChasm/TheChasm_0_1024.png"));
|
||||
SetBaseLayers(BaseMapLayer.LoadLayers(this));
|
||||
}
|
||||
}
|
||||
@@ -1,259 +0,0 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.GameTask.AutoGeniusInvokation.Exception;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Vanara.PInvoke;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Manages pausable delays with suspend/resume functionality and window focus checking.
|
||||
/// Uses event-based synchronization for efficient waiting instead of busy polling.
|
||||
/// </summary>
|
||||
public class PausableDelayManager
|
||||
{
|
||||
private static readonly ILogger Logger = App.GetLogger<PausableDelayManager>();
|
||||
|
||||
/// <summary>
|
||||
/// Performs a pausable sleep with suspend checking and window focus validation.
|
||||
/// </summary>
|
||||
/// <param name="millisecondsTimeout">Time to sleep in milliseconds</param>
|
||||
public void Sleep(int millisecondsTimeout)
|
||||
{
|
||||
if (millisecondsTimeout <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check and handle suspend/window focus before sleeping
|
||||
CheckAndHandleSuspend();
|
||||
CheckAndActivateGameWindow();
|
||||
|
||||
// Perform the actual sleep with periodic pause checks
|
||||
SleepWithPauseCheck(millisecondsTimeout);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Only checks and handles pause/suspend state and window focus without sleeping.
|
||||
/// Useful for ensuring the game is in the correct state before proceeding.
|
||||
/// </summary>
|
||||
public void CheckPauseAndWindowFocus()
|
||||
{
|
||||
CheckAndHandleSuspend();
|
||||
CheckAndActivateGameWindow();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a pausable sleep with cancellation support.
|
||||
/// </summary>
|
||||
/// <param name="millisecondsTimeout">Time to sleep in milliseconds</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
/// <exception cref="OperationCanceledException">Thrown when the operation is cancelled</exception>
|
||||
public void Sleep(int millisecondsTimeout, CancellationToken ct)
|
||||
{
|
||||
if (ct.IsCancellationRequested)
|
||||
{
|
||||
throw new OperationCanceledException(ct);
|
||||
}
|
||||
|
||||
if (millisecondsTimeout <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check and handle suspend/window focus before sleeping
|
||||
CheckAndHandleSuspend();
|
||||
CheckAndActivateGameWindow();
|
||||
|
||||
// Perform the actual sleep with periodic pause checks
|
||||
SleepWithPauseCheck(millisecondsTimeout, ct);
|
||||
|
||||
if (ct.IsCancellationRequested)
|
||||
{
|
||||
throw new OperationCanceledException(ct);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a pausable async delay with cancellation support.
|
||||
/// </summary>
|
||||
/// <param name="millisecondsTimeout">Time to delay in milliseconds</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
/// <exception cref="OperationCanceledException">Thrown when the operation is cancelled</exception>
|
||||
public async Task DelayAsync(int millisecondsTimeout, CancellationToken ct)
|
||||
{
|
||||
if (ct.IsCancellationRequested)
|
||||
{
|
||||
throw new OperationCanceledException(ct);
|
||||
}
|
||||
|
||||
if (millisecondsTimeout <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check and handle suspend/window focus before delaying
|
||||
CheckAndHandleSuspend();
|
||||
CheckAndActivateGameWindow();
|
||||
|
||||
// Perform the actual delay with periodic pause checks
|
||||
await DelayWithPauseCheckAsync(millisecondsTimeout, ct);
|
||||
|
||||
if (ct.IsCancellationRequested)
|
||||
{
|
||||
throw new OperationCanceledException(ct);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks and handles suspend state, blocking until resume if needed.
|
||||
/// Uses a simple polling approach with efficient waiting.
|
||||
/// </summary>
|
||||
private void CheckAndHandleSuspend()
|
||||
{
|
||||
var first = true;
|
||||
var isSuspend = RunnerContext.Instance.IsSuspend;
|
||||
|
||||
while (RunnerContext.Instance.IsSuspend)
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
RunnerContext.Instance.StopAutoPick();
|
||||
|
||||
// Release any pressed keys
|
||||
Thread.Sleep(300);
|
||||
ReleaseAllPressedKeys();
|
||||
|
||||
Logger.LogWarning("快捷键触发暂停,等待解除");
|
||||
|
||||
// Suspend all registered suspendables
|
||||
foreach (var item in RunnerContext.Instance.SuspendableDictionary)
|
||||
{
|
||||
item.Value.Suspend();
|
||||
}
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
// Wait before checking again
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
// Resume from suspend
|
||||
if (isSuspend)
|
||||
{
|
||||
Logger.LogWarning("暂停已经解除");
|
||||
RunnerContext.Instance.ResumeAutoPick();
|
||||
|
||||
// Resume all registered suspendables
|
||||
foreach (var item in RunnerContext.Instance.SuspendableDictionary)
|
||||
{
|
||||
item.Value.Resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckAndActivateGameWindow()
|
||||
{
|
||||
// If RestoreFocusOnLostEnabled is disabled, we require the game window to be active
|
||||
// Keep retrying until it is active
|
||||
if (!TaskContext.Instance().Config.OtherConfig.RestoreFocusOnLostEnabled)
|
||||
{
|
||||
// Just proceed to the retry loop below which will ensure window is active
|
||||
}
|
||||
|
||||
var count = 0;
|
||||
// Keep retrying until window is active
|
||||
while (!SystemControl.IsGenshinImpactActiveByProcess())
|
||||
{
|
||||
if (count >= 10 && count % 10 == 0)
|
||||
{
|
||||
Logger.LogInformation("多次尝试未恢复,尝试最小化后激活窗口!");
|
||||
SystemControl.MinimizeAndActivateWindow(TaskContext.Instance().GameHandle);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogInformation("当前获取焦点的窗口不是原神,尝试恢复窗口");
|
||||
SystemControl.FocusWindow(TaskContext.Instance().GameHandle);
|
||||
}
|
||||
|
||||
count++;
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sleeps with periodic pause state checks using event-based waiting.
|
||||
/// </summary>
|
||||
private void SleepWithPauseCheck(int millisecondsTimeout, CancellationToken ct = default)
|
||||
{
|
||||
var remaining = millisecondsTimeout;
|
||||
var checkInterval = Math.Min(1000, millisecondsTimeout); // Check every 1 second or less
|
||||
|
||||
while (remaining > 0)
|
||||
{
|
||||
if (ct.IsCancellationRequested)
|
||||
{
|
||||
throw new OperationCanceledException(ct);
|
||||
}
|
||||
|
||||
var sleepTime = Math.Min(checkInterval, remaining);
|
||||
Thread.Sleep(sleepTime);
|
||||
remaining -= sleepTime;
|
||||
|
||||
// Check if we need to suspend
|
||||
if (RunnerContext.Instance.IsSuspend)
|
||||
{
|
||||
CheckAndHandleSuspend();
|
||||
CheckAndActivateGameWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Async delay with periodic pause state checks using event-based waiting.
|
||||
/// </summary>
|
||||
private async Task DelayWithPauseCheckAsync(int millisecondsTimeout, CancellationToken ct)
|
||||
{
|
||||
var remaining = millisecondsTimeout;
|
||||
var checkInterval = Math.Min(1000, millisecondsTimeout); // Check every 1 second or less
|
||||
|
||||
while (remaining > 0)
|
||||
{
|
||||
if (ct.IsCancellationRequested)
|
||||
{
|
||||
throw new OperationCanceledException(ct);
|
||||
}
|
||||
|
||||
var delayTime = Math.Min(checkInterval, remaining);
|
||||
await Task.Delay(delayTime, ct);
|
||||
remaining -= delayTime;
|
||||
|
||||
// Check if we need to suspend
|
||||
if (RunnerContext.Instance.IsSuspend)
|
||||
{
|
||||
CheckAndHandleSuspend();
|
||||
CheckAndActivateGameWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsKeyPressed(User32.VK key)
|
||||
{
|
||||
var state = User32.GetAsyncKeyState((int)key);
|
||||
return (state & 0x8000) != 0;
|
||||
}
|
||||
|
||||
private static void ReleaseAllPressedKeys()
|
||||
{
|
||||
foreach (User32.VK key in Enum.GetValues(typeof(User32.VK)))
|
||||
{
|
||||
if (IsKeyPressed(key))
|
||||
{
|
||||
Logger.LogWarning($"解除{key}的按下状态.");
|
||||
Core.Simulator.Simulation.SendInput.Keyboard.KeyUp(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||