From 57a139cf9576389f5ab984f03e601235700a2928 Mon Sep 17 00:00:00 2001 From: lightyears Date: Sat, 3 Jun 2023 14:24:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9B=B4=E6=96=B0=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=8F=8A=E6=B8=B8=E6=88=8F=E5=86=85=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 7 ++++ Models/Changelog.cs | 87 +++++++++++++++++++++++++++++++++++++++++++ README.md | 3 +- Scenes/MainScene.tscn | 33 ++++++++++++++++ export_presets.cfg | 4 +- 5 files changed, 131 insertions(+), 3 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 Models/Changelog.cs diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c0e859f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# 更新日志 + +## [未发布] + +## [1.0.0] - 2023-06-03 + +- 第一个测试场景 diff --git a/Models/Changelog.cs b/Models/Changelog.cs new file mode 100644 index 0000000..86b1cf6 --- /dev/null +++ b/Models/Changelog.cs @@ -0,0 +1,87 @@ +using System.Text; + +namespace CMSGame.Models +{ + 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 + { + 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 StringBuilder(); + 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('-').Select(str => str.Trim()).ToArray(); + + string versionString = parts[0]; + string dateString = ""; + if (parts.Length >= 2) + { + dateString = parts[1]; + } + + if (changelog != null) + { + changelog.Description = contentBuilder.ToString(); + contentBuilder.Clear(); + this.Add(changelog); + } + + changelog = new Changelog(DateOnly.Parse(dateString), versionString, ""); + + continue; + } + } + + contentBuilder.AppendLine(line.Trim()); + } + } + } +} diff --git a/README.md b/README.md index 612436c..4c89989 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,5 @@ Godot 4.0 with Mono (.NET 7.0) ## 许可 -代码采用 MIT 协议许可;素材使用 CC-BY-4.0 协议授权。 +这是一个使用 Godot 引擎制作的开源游戏,项目中原创的代码采用 MIT 协议许可;原创素材使用 CC-BY-4.0 协议授权。 +项目中还使用了来自其他开源项目的代码和素材。这些资产的许可文件已在项目的源码树中列出。 diff --git a/Scenes/MainScene.tscn b/Scenes/MainScene.tscn index a6528c8..eebe404 100644 --- a/Scenes/MainScene.tscn +++ b/Scenes/MainScene.tscn @@ -55,6 +55,39 @@ title = "游戏设置" visible = false borderless = false +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -450.0 +offset_top = -338.0 +offset_right = -60.0 +offset_bottom = 374.0 +grow_horizontal = 0 +grow_vertical = 2 + +[node name="Label" type="Label" parent="VBoxContainer"] +layout_mode = 2 +theme = ExtResource("1_y72s3") +text = "更新日志" +horizontal_alignment = 1 + +[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="ChanglogLabel" type="RichTextLabel" parent="VBoxContainer/ScrollContainer"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +bbcode_enabled = true +text = "[b]标题[/b] +- 更新内容" + [connection signal="pressed" from="StartMenu/StartButton" to="." method="On_BattleDemo1Button_Pressed"] [connection signal="pressed" from="StartMenu/SettingsButton" to="." method="On_SettingsPopupButton_Pressed"] [connection signal="pressed" from="StartMenu/QuitButton" to="." method="On_QuitButton_Pressed"] diff --git a/export_presets.cfg b/export_presets.cfg index 14eb1cc..7212e82 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -8,7 +8,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="Temp/Exports/CMSGame.exe" +export_path="Temp/Exports/windows-64/CMSGame.exe" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false @@ -45,7 +45,7 @@ application/company_name="CMSGame Developers" application/product_name="CMSGame" application/file_description="The Country of Mountains and Seas" application/copyright="CMSGame Developers" -application/trademarks="CMSGame" +application/trademarks="" ssh_remote_deploy/enabled=false ssh_remote_deploy/host="user@host_ip" ssh_remote_deploy/port="22"