From e4e9dd91f17e2ce90f99009258977c8a6f84986d Mon Sep 17 00:00:00 2001
From: DismissedLight <1686188646@qq.com>
Date: Sat, 4 Nov 2023 17:21:31 +0800
Subject: [PATCH] impl #1062
---
.../Snap.Hutao/Resource/Localization/SH.resx | 6 +
.../Snap.Hutao/Service/Game/LaunchOptions.cs | 21 ++
.../Snap.Hutao/View/Page/LaunchGamePage.xaml | 190 +++++++++---------
3 files changed, 126 insertions(+), 91 deletions(-)
diff --git a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
index 27e1b0e2..5f1db962 100644
--- a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
+++ b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
@@ -1967,6 +1967,12 @@
高级功能
+
+ 快速切换到指定的分辨率
+
+
+ 分辨率
+
将窗口创建为弹出窗口,不带框架
diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchOptions.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchOptions.cs
index ac514a31..74c72f2b 100644
--- a/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchOptions.cs
+++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchOptions.cs
@@ -1,6 +1,7 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
+using CommunityToolkit.WinUI.Controls;
using Microsoft.UI.Windowing;
using Snap.Hutao.Model;
using Snap.Hutao.Model.Entity;
@@ -35,6 +36,7 @@ internal sealed class LaunchOptions : DbStoreOptions
private int? targetFps;
private NameValue? monitor;
private bool? isMonitorEnabled;
+ private AspectRatio? selectedAspectRatio;
///
/// 构造一个新的启动游戏选项
@@ -162,6 +164,25 @@ internal sealed class LaunchOptions : DbStoreOptions
set => SetOption(ref isMonitorEnabled, SettingEntry.LaunchIsMonitorEnabled, value);
}
+ public List AspectRatios { get; } = new()
+ {
+ new(2560, 1440),
+ new(1920, 1080),
+ };
+
+ public AspectRatio? SelectedAspectRatio
+ {
+ get => selectedAspectRatio;
+ set
+ {
+ if (SetProperty(ref selectedAspectRatio, value) && value is AspectRatio aspectRatio)
+ {
+ ScreenWidth = (int)aspectRatio.Width;
+ ScreenHeight = (int)aspectRatio.Height;
+ }
+ }
+ }
+
private static void InitializeMonitors(List> monitors)
{
// This list can't use foreach
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml
index fa9098e9..87a87fb2 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml
@@ -34,6 +34,82 @@
DataContext="{Binding Mode=OneWay}"
Header="{shcm:ResourceString Name=ViewPageLaunchGameResourceDiffHeader}"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Visible
+
+
+
+
+
+
+
+
+
+ Collapsed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Visible
-
-
-
-
-
-
-
-
-
- Collapsed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
-
+
-
+
+
+
+
-
+
-
+
-
+
@@ -282,9 +293,6 @@
OnContent="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsOn}"/>
-
-
-