Compare commits
7 Commits
9c7fc660cc
...
f8f281f2f7
Author | SHA1 | Date |
---|---|---|
|
f8f281f2f7 | 2 years ago |
|
f8294dff94 | 2 years ago |
|
947bdc83f0 | 2 years ago |
|
7cfe069804 | 2 years ago |
|
35e45556fa | 2 years ago |
|
d80bf0cbfb | 2 years ago |
|
57a139cf95 | 2 years ago |
@ -0,0 +1,7 @@
|
|||||||
|
# 更新日志
|
||||||
|
|
||||||
|
## [未发布]
|
||||||
|
|
||||||
|
## [1.0.0] - 2023-06-03
|
||||||
|
|
||||||
|
- 第一个测试场景
|
@ -1,10 +1,26 @@
|
|||||||
namespace CMSGame
|
namespace CMSGame
|
||||||
{
|
{
|
||||||
public partial class VideoSettingsMenu : VBoxContainer
|
public partial class VideoSettingsMenu : Control
|
||||||
{
|
{
|
||||||
public override void _Ready()
|
public VideoSettings? Settings;
|
||||||
{
|
|
||||||
}
|
public CheckButton? FullScreenCheckButton;
|
||||||
}
|
|
||||||
}
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
Settings = this.GetAutoloadNode<GameSettingsNode>(nameof(GameSettingsNode)).VideoSettings;
|
||||||
|
|
||||||
|
this.GetUniqueNode(ref FullScreenCheckButton, nameof(FullScreenCheckButton));
|
||||||
|
|
||||||
|
FullScreenCheckButton!.Toggled += FullScreenCheckButton_Toggled;
|
||||||
|
|
||||||
|
FullScreenCheckButton.SetPressedNoSignal(Settings.UseFullScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FullScreenCheckButton_Toggled(bool buttonPressed)
|
||||||
|
{
|
||||||
|
Settings!.UseFullScreen = buttonPressed;
|
||||||
|
DisplayServerHelper.ApplyResolutionSettings(buttonPressed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
global using System;
|
global using System;
|
||||||
global using System.Collections;
|
|
||||||
global using System.Collections.Generic;
|
global using System.Collections.Generic;
|
||||||
global using System.Linq;
|
global using System.Linq;
|
||||||
global using Godot;
|
global using Godot;
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
namespace CMSGame
|
||||||
|
{
|
||||||
|
internal static class DisplayServerHelper
|
||||||
|
{
|
||||||
|
public static void ApplyResolutionSettings(bool useFullScreen)
|
||||||
|
{
|
||||||
|
if (useFullScreen)
|
||||||
|
{
|
||||||
|
DisplayServer.WindowSetMode(DisplayServer.WindowMode.Fullscreen);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DisplayServer.WindowSetMode(DisplayServer.WindowMode.Windowed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,95 @@
|
|||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace CMSGame
|
||||||
|
{
|
||||||
|
internal record class Changelog
|
||||||
|
{
|
||||||
|
public DateOnly? Date { set; get; }
|
||||||
|
|
||||||
|
public string Title { set; get; }
|
||||||
|
|
||||||
|
public string Description { set; get; }
|
||||||
|
|
||||||
|
public Changelog(DateOnly? date, string title, string description)
|
||||||
|
{
|
||||||
|
Date = date;
|
||||||
|
Title = title;
|
||||||
|
Description = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal sealed class ChangelogList : List<Changelog>
|
||||||
|
{
|
||||||
|
public ChangelogList()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ParseChangelogFile();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
GD.PushError(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ParseChangelogFile()
|
||||||
|
{
|
||||||
|
var file = FileAccess.Open(new GodotPath("res://CHANGELOG.md"), FileAccess.ModeFlags.Read);
|
||||||
|
var fileContent = file.GetAsText();
|
||||||
|
|
||||||
|
if (fileContent == null) return;
|
||||||
|
|
||||||
|
Changelog? changelog = null;
|
||||||
|
StringBuilder contentBuilder = new();
|
||||||
|
|
||||||
|
var commitChangelog = () =>
|
||||||
|
{
|
||||||
|
if (changelog != null)
|
||||||
|
{
|
||||||
|
changelog.Description = contentBuilder.ToString();
|
||||||
|
contentBuilder.Clear();
|
||||||
|
this.Add(changelog);
|
||||||
|
changelog = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var line in fileContent.Split("\n"))
|
||||||
|
{
|
||||||
|
if (line.Trim() == "")
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.StartsWith("#"))
|
||||||
|
{
|
||||||
|
if (line.StartsWith("# ")) // 一号标题
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.StartsWith("## ")) // 二号标题,格式为 [未发布] 或 [1.0.0] - 2023-06-03
|
||||||
|
{
|
||||||
|
string title = line.TrimStart(new char[] { '#', ' ' });
|
||||||
|
string[] parts = title.Split('-', 2).Select(str => str.Trim()).ToArray();
|
||||||
|
|
||||||
|
string versionString = parts[0];
|
||||||
|
string dateString = "";
|
||||||
|
if (parts.Length >= 2)
|
||||||
|
{
|
||||||
|
dateString = parts[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
commitChangelog();
|
||||||
|
changelog = new Changelog(dateString != string.Empty ? DateOnly.Parse(dateString) : null, versionString, "");
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
contentBuilder.AppendLine(line.Trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
commitChangelog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace CMSGame
|
||||||
|
{
|
||||||
|
public partial class ChangelogContainer : VBoxContainer
|
||||||
|
{
|
||||||
|
private readonly ChangelogList _changelogList = new();
|
||||||
|
|
||||||
|
public RichTextLabel? ChangelogLabel;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
this.GetUniqueNode(ref ChangelogLabel, nameof(ChangelogLabel));
|
||||||
|
|
||||||
|
SetLabelText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetLabelText()
|
||||||
|
{
|
||||||
|
var changelogText = _changelogList.Select(log =>
|
||||||
|
{
|
||||||
|
StringBuilder textBuilder = new();
|
||||||
|
textBuilder.Append($"[b]{log.Title}[/b]");
|
||||||
|
|
||||||
|
if (log.Date != null)
|
||||||
|
{
|
||||||
|
textBuilder.Append($" [i]{log.Date}[/i]");
|
||||||
|
}
|
||||||
|
|
||||||
|
textBuilder.Append('\n');
|
||||||
|
textBuilder.Append(log.Description);
|
||||||
|
|
||||||
|
return textBuilder.ToString();
|
||||||
|
}).ToArray().Join("\n");
|
||||||
|
|
||||||
|
ChangelogLabel!.Text = changelogText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
namespace CMSGame
|
namespace CMSGame
|
||||||
{
|
{
|
||||||
public partial class MainScene : Control
|
public partial class LandingScene : Control
|
||||||
{
|
{
|
||||||
public void On_SettingsPopupButton_Pressed()
|
public void On_SettingsPopupButton_Pressed()
|
||||||
{
|
{
|
Loading…
Reference in new issue