mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-21 09:45:48 +08:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ApplicationIcon>Assets\Images\logo.ico</ApplicationIcon>
|
||||
<AssemblyName>BetterGI</AssemblyName>
|
||||
<AssemblyVersion>0.39.5</AssemblyVersion>
|
||||
<AssemblyVersion>0.39.6</AssemblyVersion>
|
||||
<Platforms>x64</Platforms>
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -436,6 +436,7 @@ public class AutoDomainTask : ISoloTask
|
||||
finally
|
||||
{
|
||||
Logger.LogInformation("自动战斗线程结束");
|
||||
combatScenes.AfterTask();
|
||||
}
|
||||
}, cts.Token);
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ public class CombatScenes : IDisposable
|
||||
{
|
||||
throw new Exception("当前处于联机状态,但是队伍人数超过4人,无法识别");
|
||||
}
|
||||
|
||||
// 联机状态下判断
|
||||
var onePRa = imageRegion.Find(AutoFightAssets.Instance.OnePRa);
|
||||
var p = "p";
|
||||
@@ -246,6 +247,21 @@ public class CombatScenes : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
public void AfterTask()
|
||||
{
|
||||
var mwk = SelectAvatar("玛薇卡");
|
||||
if (mwk != null)
|
||||
{
|
||||
foreach (var avatar in Avatars)
|
||||
{
|
||||
if (avatar.Name != "玛薇卡")
|
||||
{
|
||||
avatar.Switch();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Avatar? SelectAvatar(string name)
|
||||
{
|
||||
return AvatarMap.GetValueOrDefault(name);
|
||||
@@ -381,4 +397,4 @@ public class CombatScenes : IDisposable
|
||||
{
|
||||
_predictor.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,4 +109,34 @@ public class DirectoryHelper
|
||||
CopyDirectory(subDir, destSubDir); // 递归拷贝子目录
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 递归删除指定目录及其所有子目录和文件
|
||||
/// </summary>
|
||||
/// <param name="directoryPath">要删除的目录的路径</param>
|
||||
public static void DeleteDirectoryRecursively(string directoryPath)
|
||||
{
|
||||
// 检查目录是否存在
|
||||
if (Directory.Exists(directoryPath))
|
||||
{
|
||||
// 获取目录中的所有子目录
|
||||
string[] subDirectories = Directory.GetDirectories(directoryPath);
|
||||
foreach (string subDirectory in subDirectories)
|
||||
{
|
||||
// 递归调用删除子目录
|
||||
DeleteDirectoryRecursively(subDirectory);
|
||||
}
|
||||
|
||||
// 获取目录中的所有文件
|
||||
string[] files = Directory.GetFiles(directoryPath);
|
||||
foreach (string file in files)
|
||||
{
|
||||
// 删除文件
|
||||
File.Delete(file);
|
||||
}
|
||||
|
||||
// 删除空目录
|
||||
Directory.Delete(directoryPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Windows.Media;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Media;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
@@ -8,31 +9,30 @@ public class WindowHelper
|
||||
{
|
||||
public static void TryApplySystemBackdrop(System.Windows.Window window)
|
||||
{
|
||||
window.Background = new SolidColorBrush(Colors.Transparent);
|
||||
|
||||
if (WindowBackdrop.IsSupported(TaskContext.Instance().Config.CommonConfig.CurrentBackdropType))
|
||||
{
|
||||
if (TaskContext.Instance().Config.CommonConfig.CurrentBackdropType == WindowBackdropType.Acrylic)
|
||||
{
|
||||
window.Background = new SolidColorBrush(Color.FromArgb(100, 0, 0, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
window.Background = new SolidColorBrush(Colors.Transparent);
|
||||
}
|
||||
|
||||
WindowBackdrop.ApplyBackdrop(window, TaskContext.Instance().Config.CommonConfig.CurrentBackdropType);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (WindowBackdrop.IsSupported(WindowBackdropType.Mica))
|
||||
{
|
||||
WindowBackdrop.ApplyBackdrop(window, WindowBackdropType.Mica);
|
||||
}
|
||||
else if (WindowBackdrop.IsSupported(WindowBackdropType.Tabbed))
|
||||
{
|
||||
WindowBackdrop.ApplyBackdrop(window, WindowBackdropType.Tabbed);
|
||||
}
|
||||
else if (WindowBackdrop.IsSupported(WindowBackdropType.Acrylic))
|
||||
if (WindowBackdrop.IsSupported(WindowBackdropType.Acrylic))
|
||||
{
|
||||
window.Background = new SolidColorBrush(Color.FromArgb(100, 0, 0, 0));
|
||||
WindowBackdrop.ApplyBackdrop(window, WindowBackdropType.Acrylic);
|
||||
}
|
||||
else if (WindowBackdrop.IsSupported(WindowBackdropType.Mica))
|
||||
{
|
||||
window.Background = new SolidColorBrush(Colors.Transparent);
|
||||
WindowBackdrop.ApplyBackdrop(window, WindowBackdropType.Mica);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,12 +66,16 @@ public partial class MainWindowViewModel : ObservableObject, IViewModel
|
||||
[RelayCommand]
|
||||
private void OnSwitchBackdrop()
|
||||
{
|
||||
if (!OsVersionHelper.IsWindows11_22523_OrGreater)
|
||||
{
|
||||
return; // win10 不支持切换主题
|
||||
}
|
||||
|
||||
CurrentBackdropType = CurrentBackdropType switch
|
||||
{
|
||||
WindowBackdropType.Mica => WindowBackdropType.Acrylic,
|
||||
WindowBackdropType.Acrylic => WindowBackdropType.Tabbed,
|
||||
WindowBackdropType.Tabbed => WindowBackdropType.Mica,
|
||||
_ => WindowBackdropType.Mica
|
||||
WindowBackdropType.Acrylic => WindowBackdropType.Mica,
|
||||
_ => WindowBackdropType.Acrylic
|
||||
};
|
||||
|
||||
Config.CommonConfig.CurrentBackdropType = CurrentBackdropType;
|
||||
@@ -79,7 +83,6 @@ public partial class MainWindowViewModel : ObservableObject, IViewModel
|
||||
if (Application.Current.MainWindow is MainWindow mainWindow)
|
||||
{
|
||||
mainWindow.Background = new SolidColorBrush(Color.FromArgb(100, 0, 0, 0));
|
||||
;
|
||||
WindowBackdrop.ApplyBackdrop(mainWindow, CurrentBackdropType);
|
||||
}
|
||||
}
|
||||
@@ -153,14 +156,14 @@ public partial class MainWindowViewModel : ObservableObject, IViewModel
|
||||
&& Directory.Exists(Global.Absolute("BetterGI/User"))
|
||||
)
|
||||
{
|
||||
var res = await MessageBox.ShowAsync("检测到旧的 BetterGI 配置,是否迁移配置并清理旧目录?", "BetterGI", System.Windows.MessageBoxButton.YesNo);
|
||||
var res = await MessageBox.ShowAsync("检测到旧的 BetterGI 配置,是否迁移配置并清理旧目录?", "BetterGI", System.Windows.MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (res == System.Windows.MessageBoxResult.Yes)
|
||||
{
|
||||
var dir = Global.Absolute("BetterGI/User");
|
||||
// 迁移配置,拷贝整个目录并覆盖
|
||||
DirectoryHelper.CopyDirectory(dir, Global.Absolute("User"));
|
||||
// 删除旧目录
|
||||
Directory.Delete(Global.Absolute("BetterGI"));
|
||||
DirectoryHelper.DeleteDirectoryRecursively(Global.Absolute("BetterGI"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -747,6 +747,7 @@ public partial class ScriptControlViewModel : ObservableObject, INavigationAware
|
||||
private List<ScriptProject> LoadAllJsScriptProjects()
|
||||
{
|
||||
var path = Global.ScriptPath();
|
||||
Directory.CreateDirectory(path);
|
||||
// 获取所有脚本项目
|
||||
var projects = Directory.GetDirectories(path)
|
||||
.Select(x => new ScriptProject(Path.GetFileName(x)))
|
||||
|
||||
Reference in New Issue
Block a user