mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
code style
This commit is contained in:
@@ -23,7 +23,7 @@ internal sealed class LaunchOptions : DbStoreOptions
|
||||
private readonly int primaryScreenHeight;
|
||||
private readonly int primaryScreenFps;
|
||||
|
||||
private bool? isLaunchOptionsEnabled;
|
||||
private bool? isEnabled;
|
||||
private bool? isFullScreen;
|
||||
private bool? isBorderless;
|
||||
private bool? isExclusive;
|
||||
@@ -54,10 +54,10 @@ internal sealed class LaunchOptions : DbStoreOptions
|
||||
/// <summary>
|
||||
/// 是否启用启动参数
|
||||
/// </summary>
|
||||
public bool IsLaunchOptionsEnabled
|
||||
public bool IsEnabled
|
||||
{
|
||||
get => GetOption(ref isLaunchOptionsEnabled, SettingEntry.LaunchIsLaunchOptionsEnabled, false);
|
||||
set => SetOption(ref isLaunchOptionsEnabled, SettingEntry.LaunchIsLaunchOptionsEnabled, value);
|
||||
get => GetOption(ref isEnabled, SettingEntry.LaunchIsLaunchOptionsEnabled, true);
|
||||
set => SetOption(ref isEnabled, SettingEntry.LaunchIsLaunchOptionsEnabled, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -26,13 +26,14 @@ internal static class ProcessInterop
|
||||
/// <returns>初始化后的游戏进程</returns>
|
||||
public static Process InitializeGameProcess(LaunchOptions options, string gamePath)
|
||||
{
|
||||
Must.Argument(!(options.IsBorderless && options.IsExclusive), "无边框与独占全屏选项无法同时生效");
|
||||
string commandLine = string.Empty;
|
||||
|
||||
// https://docs.unity.cn/cn/current/Manual/PlayerCommandLineArguments.html
|
||||
// https://docs.unity3d.com/2017.4/Documentation/Manual/CommandLineArguments.html
|
||||
string commandLine;
|
||||
if (options.IsLaunchOptionsEnabled)
|
||||
if (options.IsEnabled)
|
||||
{
|
||||
Must.Argument(!(options.IsBorderless && options.IsExclusive), "无边框与独占全屏选项无法同时生效");
|
||||
|
||||
// https://docs.unity.cn/cn/current/Manual/PlayerCommandLineArguments.html
|
||||
// https://docs.unity3d.com/2017.4/Documentation/Manual/CommandLineArguments.html
|
||||
commandLine = new CommandLineBuilder()
|
||||
.AppendIf("-popupwindow", options.IsBorderless)
|
||||
.AppendIf("-window-mode", options.IsExclusive, "exclusive")
|
||||
@@ -42,10 +43,6 @@ internal static class ProcessInterop
|
||||
.AppendIf("-monitor", options.IsMonitorEnabled, options.Monitor.Value)
|
||||
.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
commandLine = string.Empty;
|
||||
}
|
||||
|
||||
return new()
|
||||
{
|
||||
|
||||
@@ -192,25 +192,36 @@
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</Border>
|
||||
|
||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" Text="{shcm:ResourceString Name=ViewPageLaunchGameProcessHeader}"/>
|
||||
<cwc:SettingsExpander
|
||||
Description="{shcm:ResourceString Name=ViewPageLaunchGameArgumentsDescription}"
|
||||
Header="{shcm:ResourceString Name=ViewPageLaunchGameArgumentsHeader}"
|
||||
HeaderIcon="{shcm:FontIcon Glyph=}"
|
||||
IsExpanded="True">
|
||||
<ToggleSwitch Width="156" IsOn="{Binding Options.IsLaunchOptionsEnabled, Mode=TwoWay}"/>
|
||||
<ToggleSwitch Width="156" IsOn="{Binding Options.IsEnabled, Mode=TwoWay}"/>
|
||||
<cwc:SettingsExpander.Items>
|
||||
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceExclusiveDescription}" Header="-window-mode exclusive" IsEnabled="{Binding Options.IsLaunchOptionsEnabled}">
|
||||
<cwc:SettingsCard
|
||||
Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceExclusiveDescription}"
|
||||
Header="-window-mode exclusive"
|
||||
IsEnabled="{Binding Options.IsEnabled}">
|
||||
<ToggleSwitch Width="156" IsOn="{Binding Options.IsExclusive, Mode=TwoWay}"/>
|
||||
</cwc:SettingsCard>
|
||||
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceFullscreenDescription}" Header="-screen-fullscreen" IsEnabled="{Binding Options.IsLaunchOptionsEnabled}">
|
||||
<cwc:SettingsCard
|
||||
Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceFullscreenDescription}"
|
||||
Header="-screen-fullscreen"
|
||||
IsEnabled="{Binding Options.IsEnabled}">
|
||||
<ToggleSwitch Width="156" IsOn="{Binding Options.IsFullScreen, Mode=TwoWay}"/>
|
||||
</cwc:SettingsCard>
|
||||
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceBorderlessDescription}" Header="-popupwindow" IsEnabled="{Binding Options.IsLaunchOptionsEnabled}">
|
||||
<cwc:SettingsCard
|
||||
Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceBorderlessDescription}"
|
||||
Header="-popupwindow"
|
||||
IsEnabled="{Binding Options.IsEnabled}">
|
||||
<ToggleSwitch Width="156" IsOn="{Binding Options.IsBorderless, Mode=TwoWay}"/>
|
||||
</cwc:SettingsCard>
|
||||
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceScreenWidthDescription}" Header="-screen-width" IsEnabled="{Binding Options.IsLaunchOptionsEnabled}">
|
||||
<cwc:SettingsCard
|
||||
Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceScreenWidthDescription}"
|
||||
Header="-screen-width"
|
||||
IsEnabled="{Binding Options.IsEnabled}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="16">
|
||||
<NumberBox
|
||||
Width="156"
|
||||
@@ -220,7 +231,10 @@
|
||||
<ToggleSwitch Width="156" IsOn="{Binding Options.IsScreenWidthEnabled, Mode=TwoWay}"/>
|
||||
</StackPanel>
|
||||
</cwc:SettingsCard>
|
||||
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceScreenHeightDescription}" Header="-screen-height" IsEnabled="{Binding Options.IsLaunchOptionsEnabled}">
|
||||
<cwc:SettingsCard
|
||||
Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceScreenHeightDescription}"
|
||||
Header="-screen-height"
|
||||
IsEnabled="{Binding Options.IsEnabled}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="16">
|
||||
<NumberBox
|
||||
Width="156"
|
||||
@@ -230,7 +244,10 @@
|
||||
<ToggleSwitch Width="156" IsOn="{Binding Options.IsScreenHeightEnabled, Mode=TwoWay}"/>
|
||||
</StackPanel>
|
||||
</cwc:SettingsCard>
|
||||
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameMonitorsDescription}" Header="-monitor" IsEnabled="{Binding Options.IsLaunchOptionsEnabled}">
|
||||
<cwc:SettingsCard
|
||||
Description="{shcm:ResourceString Name=ViewPageLaunchGameMonitorsDescription}"
|
||||
Header="-monitor"
|
||||
IsEnabled="{Binding Options.IsEnabled}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="16">
|
||||
<ComboBox
|
||||
Width="156"
|
||||
|
||||
Reference in New Issue
Block a user