Skip to content

Commit

Permalink
现在自定义分辨率也将可用
Browse files Browse the repository at this point in the history
  • Loading branch information
Asttear committed Apr 29, 2021
1 parent d516ecb commit 5eeee13
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 29 deletions.
3 changes: 2 additions & 1 deletion UminekoLauncher/Dialogs/ConfigPopup.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@
<TextBlock Text="分辨率" FontSize="17" FontWeight="Bold"/>
<TextBlock Text="设置游戏使用的画面分辨率。" FontSize="10"/>
</StackPanel>
<ComboBox x:Name="cmbDisplayResolution" SelectedIndex="0" HorizontalAlignment="Right">
<ComboBox x:Name="cmbDisplayResolution" SelectedIndex="6" HorizontalAlignment="Right">
<ComboBoxItem Content="1280×720"/>
<ComboBoxItem Content="1366×768"/>
<ComboBoxItem Content="1440×810"/>
<ComboBoxItem Content="1600×900"/>
<ComboBoxItem Content="1920×1080"/>
<ComboBoxItem Content="2560×1440"/>
<ComboBoxItem Content="自定义"/>
</ComboBox>
</DockPanel>
<DockPanel Margin="0,0,0,19">
Expand Down
1 change: 0 additions & 1 deletion UminekoLauncher/Dialogs/UpdateWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.IO;
using System.Net;
using System.Net.Mime;
using System.Security.Cryptography;
using System.Text;
using System.Windows;

Expand Down
66 changes: 41 additions & 25 deletions UminekoLauncher/GameConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public enum DisplayResolution
[Description("1920x1080")]
x1920,
[Description("2560x1440")]
x2560
x2560,
[Description("Custom")]
Custom
}
/// <summary>
/// 该静态类用于执行游戏配置的相关操作。
Expand Down Expand Up @@ -59,6 +61,11 @@ static class GameConfig
/// </summary>
public static DisplayResolution DisplayResolution { get; set; } = DisplayResolution.x1920;

/// <summary>
/// 获取或设置自定义游戏分辨率。此属性默认为空。
/// </summary>
public static string CustomDisplayResolution { get; set; } = null;

/// <summary>
/// 获取或设置游戏显示模式。
/// </summary>
Expand Down Expand Up @@ -99,7 +106,8 @@ public static void LoadConfig()
#region 分辨率
if (line.StartsWith("window-width"))
{
switch (line.Split('=')[1])
string strValue = line.Split('=')[1];
switch (strValue)
{
case "1280":
DisplayResolution = DisplayResolution.x1280;
Expand All @@ -120,7 +128,8 @@ public static void LoadConfig()
DisplayResolution = DisplayResolution.x2560;
break;
default:
DisplayResolution = DisplayResolution.x1920;
DisplayResolution = DisplayResolution.Custom;
CustomDisplayResolution = strValue;
break;
}
continue;
Expand Down Expand Up @@ -170,29 +179,36 @@ public static void SaveConfig()

#region 分辨率
string displayResolution = "window-width=";
switch (DisplayResolution)
if (DisplayResolution == DisplayResolution.Custom && !string.IsNullOrEmpty(CustomDisplayResolution))
{
case DisplayResolution.x1280:
displayResolution += "1280";
break;
case DisplayResolution.x1366:
displayResolution += "1366";
break;
case DisplayResolution.x1440:
displayResolution += "1440";
break;
case DisplayResolution.x1600:
displayResolution += "1600";
break;
case DisplayResolution.x1920:
displayResolution += "1920";
break;
case DisplayResolution.x2560:
displayResolution += "2560";
break;
default:
displayResolution += "1920";
break;
displayResolution += CustomDisplayResolution;
}
else
{
switch (DisplayResolution)
{
case DisplayResolution.x1280:
displayResolution += "1280";
break;
case DisplayResolution.x1366:
displayResolution += "1366";
break;
case DisplayResolution.x1440:
displayResolution += "1440";
break;
case DisplayResolution.x1600:
displayResolution += "1600";
break;
case DisplayResolution.x1920:
displayResolution += "1920";
break;
case DisplayResolution.x2560:
displayResolution += "2560";
break;
default:
displayResolution += "1920";
break;
}
}
config.Add(displayResolution);
#endregion
Expand Down
4 changes: 2 additions & 2 deletions UminekoLauncher/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.4")]
[assembly: AssemblyFileVersion("1.3.0.4")]
[assembly: AssemblyVersion("1.3.0.6")]
[assembly: AssemblyFileVersion("1.3.0.6")]

0 comments on commit 5eeee13

Please sign in to comment.