调整命名空间

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;
namespace CMSGame
namespace CMSGame.Autoloads
{
/// <summary>
/// 游戏设置持久化节点
@ -26,7 +27,6 @@ namespace CMSGame
RegisterAllSettings();
MakeDirectories();
LoadAllSettings();
ApplyVideoSettings();
}
protected void RegisterAllSettings()
@ -99,17 +99,5 @@ namespace CMSGame
using var file = FileAccess.Open(SettingsPaths[settingsType], FileAccess.ModeFlags.Write);
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
{
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;
@ -23,7 +25,7 @@ namespace CMSGame
this.GetUniqueNode(ref AudioSettingsMenu, nameof(AudioSettingsMenu));
this.GetUniqueNode(ref DeveloperOptionsMenu, nameof(DeveloperOptionsMenu));
DeveloperOptionsMenu!.Visible = _inDevelopment;
DeveloperOptionsMenu!.Visible = s_inDevelopment;
}
}
}

@ -1,3 +1,5 @@
using CMSGame.Models;
namespace CMSGame
{
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;
Changelog? changelog = null;
StringBuilder contentBuilder = new StringBuilder();
StringBuilder contentBuilder = new();
var commitChangelog = () =>
{

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

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

Loading…
Cancel
Save