From 92772be9d1b43dcef39238e4671effdb86c2f320 Mon Sep 17 00:00:00 2001 From: lightyears Date: Mon, 15 May 2023 14:19:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=BB=E5=BA=A6=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 5 ++++ Autoloads/GameSettings.cs | 7 +++++- Scenes/MainScene.tscn | 51 ++++++++++++++++++++------------------- 3 files changed, 37 insertions(+), 26 deletions(-) diff --git a/.editorconfig b/.editorconfig index 249b90b..45fc684 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,4 +4,9 @@ root = true [*.{cs,vb}] +charset = utf-8 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true + dotnet_diagnostic.CA1822.severity = none ; Mark members as static diff --git a/Autoloads/GameSettings.cs b/Autoloads/GameSettings.cs index 2a6429f..32fa19e 100644 --- a/Autoloads/GameSettings.cs +++ b/Autoloads/GameSettings.cs @@ -2,11 +2,16 @@ using Newtonsoft.Json; namespace CMSGame { + /// + /// 游戏设置持久化 + /// + /// TODO 添加 VideoSettings 并重构 + /// public partial class GameSettings : Node { public BattleSettings? OriginalBattleSettings; - public BattleSettings? BattleSettings; + public BattleSettings BattleSettings { set; get; } = new(); protected string BattleSettingsSavePath = new GodotPath("user://Settings/BattleSettings.json"); diff --git a/Scenes/MainScene.tscn b/Scenes/MainScene.tscn index 7fc6b9a..a7a5d3b 100644 --- a/Scenes/MainScene.tscn +++ b/Scenes/MainScene.tscn @@ -12,40 +12,41 @@ grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_kso8c") -[node name="GameTitleLabel" type="Label" parent="."] +[node name="BackgroundImage" type="Label" parent="."] layout_mode = 1 -anchors_preset = 5 -anchor_left = 0.5 -anchor_right = 0.5 -offset_left = -137.5 -offset_right = 137.5 -offset_bottom = 26.0 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 grow_horizontal = 2 -text = "The Country of Mountains and Seas" +grow_vertical = 2 +text = "鑳屾櫙鍥惧儚" +horizontal_alignment = 1 +vertical_alignment = 1 -[node name="VBoxContainer" type="VBoxContainer" parent="."] +[node name="GameMenu" type="VBoxContainer" parent="."] layout_mode = 1 -anchors_preset = 8 -anchor_left = 0.5 +anchors_preset = 4 anchor_top = 0.5 -anchor_right = 0.5 anchor_bottom = 0.5 -offset_left = -52.5 -offset_top = -20.0 -offset_right = 52.5 -offset_bottom = 20.0 -grow_horizontal = 2 +offset_left = 85.0 +offset_top = -50.5 +offset_right = 221.0 +offset_bottom = 50.5 grow_vertical = 2 -[node name="BattleDemo1Button" type="Button" parent="VBoxContainer"] +[node name="ContinueButton" type="Button" parent="GameMenu"] +layout_mode = 2 +text = "缁х画娓告垙" + +[node name="StartButton" type="Button" parent="GameMenu"] layout_mode = 2 -text = "鎴樻枟鍦烘櫙 Demo 1" +text = "寮濮嬫父鎴" -[node name="SettingsPopupButton" type="Button" parent="VBoxContainer"] +[node name="SettingsButton" type="Button" parent="GameMenu"] layout_mode = 2 -text = "娓告垙璁剧疆" +text = "璁剧疆" -[node name="QuitButton" type="Button" parent="VBoxContainer"] +[node name="QuitButton" type="Button" parent="GameMenu"] layout_mode = 2 text = "閫鍑" @@ -53,6 +54,6 @@ text = "閫鍑" unique_name_in_owner = true visible = false -[connection signal="pressed" from="VBoxContainer/BattleDemo1Button" to="." method="On_BattleDemo1Button_Pressed"] -[connection signal="pressed" from="VBoxContainer/SettingsPopupButton" to="." method="On_SettingsPopupButton_Pressed"] -[connection signal="pressed" from="VBoxContainer/QuitButton" to="." method="On_QuitButton_Pressed"] +[connection signal="pressed" from="GameMenu/StartButton" to="." method="On_BattleDemo1Button_Pressed"] +[connection signal="pressed" from="GameMenu/SettingsButton" to="." method="On_SettingsPopupButton_Pressed"] +[connection signal="pressed" from="GameMenu/QuitButton" to="." method="On_QuitButton_Pressed"]