调整命名空间

master
lightyears 2 years ago
parent 947bdc83f0
commit f8294dff94
Signed by: lightyears
GPG Key ID: 98D80DDF26D4F2F9

@ -1,6 +1,7 @@
using CMSGame.Models;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace CMSGame namespace CMSGame.Autoloads
{ {
/// <summary> /// <summary>
/// 游戏设置持久化节点 /// 游戏设置持久化节点
@ -26,7 +27,6 @@ namespace CMSGame
RegisterAllSettings(); RegisterAllSettings();
MakeDirectories(); MakeDirectories();
LoadAllSettings(); LoadAllSettings();
ApplyVideoSettings();
} }
protected void RegisterAllSettings() protected void RegisterAllSettings()
@ -99,17 +99,5 @@ namespace CMSGame
using var file = FileAccess.Open(SettingsPaths[settingsType], FileAccess.ModeFlags.Write); using var file = FileAccess.Open(SettingsPaths[settingsType], FileAccess.ModeFlags.Write);
file.StoreString(settingsText); file.StoreString(settingsText);
} }
public void ApplyVideoSettings()
{
if (VideoSettings.UseFullScreen)
{
DisplayServer.WindowSetMode(DisplayServer.WindowMode.Fullscreen);
}
else
{
DisplayServer.WindowSetMode(DisplayServer.WindowMode.Windowed);
}
}
} }
} }

@ -1,8 +1,10 @@
using CMSGame.Autoloads;
namespace CMSGame namespace CMSGame
{ {
public partial class SettingsMenu : TabContainer public partial class SettingsMenu : TabContainer
{ {
private bool _inDevelopment => OS.HasFeature("debug") || OS.HasFeature("editor"); private static bool s_inDevelopment => OS.HasFeature("debug") || OS.HasFeature("editor");
public GameSettingsNode? Settings; public GameSettingsNode? Settings;
@ -23,7 +25,7 @@ namespace CMSGame
this.GetUniqueNode(ref AudioSettingsMenu, nameof(AudioSettingsMenu)); this.GetUniqueNode(ref AudioSettingsMenu, nameof(AudioSettingsMenu));
this.GetUniqueNode(ref DeveloperOptionsMenu, nameof(DeveloperOptionsMenu)); this.GetUniqueNode(ref DeveloperOptionsMenu, nameof(DeveloperOptionsMenu));
DeveloperOptionsMenu!.Visible = _inDevelopment; DeveloperOptionsMenu!.Visible = s_inDevelopment;
} }
} }
} }

@ -1,3 +1,5 @@
using CMSGame.Models;
namespace CMSGame namespace CMSGame
{ {
public partial class VideoSettingsMenu : Control public partial class VideoSettingsMenu : Control

@ -0,0 +1,17 @@
namespace CMSGame.Helpers
{
internal static class DisplayServerHelper
{
public static void ApplyAndPersistResolutionSettings(bool useFullScreen)
{
if (useFullScreen)
{
DisplayServer.WindowSetMode(DisplayServer.WindowMode.Fullscreen);
}
else
{
DisplayServer.WindowSetMode(DisplayServer.WindowMode.Windowed);
}
}
}
}

@ -40,7 +40,7 @@ namespace CMSGame.Models
if (fileContent == null) return; if (fileContent == null) return;
Changelog? changelog = null; Changelog? changelog = null;
StringBuilder contentBuilder = new StringBuilder(); StringBuilder contentBuilder = new();
var commitChangelog = () => var commitChangelog = () =>
{ {

@ -1,4 +1,4 @@
namespace CMSGame namespace CMSGame.Models
{ {
public record class GameSettings public record class GameSettings
{ {

@ -20,7 +20,7 @@ namespace CMSGame
{ {
var changelogText = _changelogList.Select(log => var changelogText = _changelogList.Select(log =>
{ {
StringBuilder textBuilder = new StringBuilder(); StringBuilder textBuilder = new();
textBuilder.Append($"[b]{log.Title}[/b]"); textBuilder.Append($"[b]{log.Title}[/b]");
if (log.Date != null) if (log.Date != null)

Loading…
Cancel
Save