diff --git a/src/Snap.Hutao/Snap.Hutao/Model/Metadata/SpecialNameHandler.cs b/src/Snap.Hutao/Snap.Hutao/Model/Metadata/SpecialNameHandler.cs
index 31d0f076..5e2c5b74 100644
--- a/src/Snap.Hutao/Snap.Hutao/Model/Metadata/SpecialNameHandler.cs
+++ b/src/Snap.Hutao/Snap.Hutao/Model/Metadata/SpecialNameHandler.cs
@@ -12,6 +12,11 @@ internal static partial class SpecialNameHandler
// "#(?!.*(?:F#|M#|NON_BREAK_SPACE|REALNAME\[ID\(1\)(\|HOSTONLY\(true\)|)\]|\{LAYOUT_MOBILE#.+?\}\{LAYOUT_PC#.+?\}\{LAYOUT_PS#.+?\})).*
public static string Handle(string input)
{
+ if (string.IsNullOrEmpty(input))
+ {
+ return input;
+ }
+
if (input.AsSpan()[0] is not '#')
{
return input;
diff --git a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
index 845c5372..3497c346 100644
--- a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
+++ b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
@@ -2543,6 +2543,12 @@
重置图片资源
+
+ 在启动游戏页面的进程部分加入解锁帧率限制选项
+
+
+ 启动游戏-解锁帧率限制
+
更改目录后需要手动移动目录内的数据,否则会重新创建用户数据
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Card/LaunchGameCard.xaml b/src/Snap.Hutao/Snap.Hutao/View/Card/LaunchGameCard.xaml
index b0581d20..c4937be0 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Card/LaunchGameCard.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Card/LaunchGameCard.xaml
@@ -9,10 +9,12 @@
xmlns:shcb="using:Snap.Hutao.Control.Behavior"
xmlns:shcm="using:Snap.Hutao.Control.Markup"
xmlns:shvg="using:Snap.Hutao.ViewModel.Game"
+ MinHeight="180"
Padding="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
+ VerticalContentAlignment="Stretch"
d:DataContext="{d:DesignInstance shvg:LaunchGameViewModelSlim}"
Background="Transparent"
Command="{Binding LaunchCommand}"
@@ -22,12 +24,6 @@
-
diff --git a/src/Snap.Hutao/Snap.Hutao/View/MainView.xaml.cs b/src/Snap.Hutao/Snap.Hutao/View/MainView.xaml.cs
index 942bb556..06a98e47 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/MainView.xaml.cs
+++ b/src/Snap.Hutao/Snap.Hutao/View/MainView.xaml.cs
@@ -2,7 +2,10 @@
// Licensed under the MIT license.
using CommunityToolkit.WinUI.Animations;
+using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Media.Animation;
+using Snap.Hutao.Control.Theme;
using Snap.Hutao.Service.BackgroundImage;
using Snap.Hutao.Service.Navigation;
using Snap.Hutao.View.Page;
@@ -17,6 +20,8 @@ internal sealed partial class MainView : UserControl
{
private readonly INavigationService navigationService;
private readonly IBackgroundImageService backgroundImageService;
+ private TaskCompletionSource acutalThemeChangedTaskCompletionSource = new();
+ private CancellationTokenSource periodicTimerCancellationTokenSource = new();
///
/// 构造一个新的主视图
@@ -25,6 +30,8 @@ internal sealed partial class MainView : UserControl
{
InitializeComponent();
+ ActualThemeChanged += OnActualThemeChanged;
+
IServiceProvider serviceProvider = Ioc.Default;
backgroundImageService = serviceProvider.GetRequiredService();
@@ -52,20 +59,38 @@ internal sealed partial class MainView : UserControl
await AnimationBuilder
.Create()
- .Opacity(to: 0D, duration: TimeSpan.FromMilliseconds(300), easingType: EasingType.Sine)
+ .Opacity(to: 0D, duration: TimeSpan.FromMilliseconds(1000), easingType: EasingType.Sine, easingMode: EasingMode.EaseIn)
.StartAsync(BackdroundImagePresenter)
.ConfigureAwait(true);
BackdroundImagePresenter.Source = backgroundImage.ImageSource;
- double targetOpacity = (1 - backgroundImage.Luminance) * 0.8;
+ double targetOpacity = ThemeHelper.IsDarkMode(ActualTheme) ? 1 - backgroundImage.Luminance : backgroundImage.Luminance;
await AnimationBuilder
.Create()
- .Opacity(to: targetOpacity, duration: TimeSpan.FromMilliseconds(300), easingType: EasingType.Sine)
+ .Opacity(to: targetOpacity, duration: TimeSpan.FromMilliseconds(1000), easingType: EasingType.Sine, easingMode: EasingMode.EaseOut)
.StartAsync(BackdroundImagePresenter)
.ConfigureAwait(true);
}
- } while (await timer.WaitForNextTickAsync().ConfigureAwait(false));
+
+ try
+ {
+ await Task.WhenAny(timer.WaitForNextTickAsync(periodicTimerCancellationTokenSource.Token).AsTask(), acutalThemeChangedTaskCompletionSource.Task).ConfigureAwait(false);
+ }
+ catch (OperationCanceledException)
+ {
+ }
+
+ acutalThemeChangedTaskCompletionSource = new();
+ periodicTimerCancellationTokenSource = new();
+ }
+ while (true);
}
}
+
+ private void OnActualThemeChanged(FrameworkElement frameworkElement, object args)
+ {
+ acutalThemeChangedTaskCompletionSource.TrySetResult();
+ periodicTimerCancellationTokenSource.Cancel();
+ }
}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/SettingPage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/SettingPage.xaml
index f6023be1..fceeb67f 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/SettingPage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/SettingPage.xaml
@@ -119,10 +119,7 @@
cw:Effects.Shadow="{ThemeResource CompatCardShadow}">
-
+
@@ -476,7 +473,8 @@
+ HeaderIcon="{shcm:FontIcon Glyph=}"
+ IsExpanded="True">
+
+ HeaderIcon="{shcm:FontIcon Glyph=}"
+ IsExpanded="True">
-
-
-
+ IsEnabled="{Binding RuntimeOptions.IsElevated}"
+ IsExpanded="True">
+
-
+
-
+
+
+
+