diff --git a/assets/fonts/dingliezhuhaifont-20240831GengXinBan)-2.ttf b/assets/fonts/dingliezhuhaifont-20240831GengXinBan)-2.ttf new file mode 100644 index 0000000..b387fc5 Binary files /dev/null and b/assets/fonts/dingliezhuhaifont-20240831GengXinBan)-2.ttf differ diff --git a/assets/fonts/dingliezhuhaifont-20240831GengXinBan)-2.ttf.import b/assets/fonts/dingliezhuhaifont-20240831GengXinBan)-2.ttf.import new file mode 100644 index 0000000..de37009 --- /dev/null +++ b/assets/fonts/dingliezhuhaifont-20240831GengXinBan)-2.ttf.import @@ -0,0 +1,36 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://drt448qncx27p" +path="res://.godot/imported/dingliezhuhaifont-20240831GengXinBan)-2.ttf-7b6c32418ce639305b17af2723dddc58.fontdata" + +[deps] + +source_file="res://assets/fonts/dingliezhuhaifont-20240831GengXinBan)-2.ttf" +dest_files=["res://.godot/imported/dingliezhuhaifont-20240831GengXinBan)-2.ttf-7b6c32418ce639305b17af2723dddc58.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +modulate_color_glyphs=false +hinting=3 +subpixel_positioning=4 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/project.godot b/project.godot index aa432f4..e197dd8 100644 --- a/project.godot +++ b/project.godot @@ -17,13 +17,22 @@ config/icon="res://icon.svg" [display] -window/size/window_mode=2 +window/size/viewport_width=1920 +window/size/viewport_height=1080 window/stretch/mode="viewport" +window/size/window_mode=2 [dotnet] project/assembly_name="模拟宗门" +[internationalization] + +locale/locale_filter_mode=1 +locale/script_filter=["Hans"] +locale/country_filter=["CN"] +locale/language_filter=[] + [physics] 3d/physics_engine="Jolt Physics" @@ -31,3 +40,7 @@ project/assembly_name="模拟宗门" [rendering] rendering_device/driver.windows="d3d12" +anti_aliasing/quality/msaa_2d=3 +anti_aliasing/quality/msaa_3d=3 +anti_aliasing/quality/screen_space_aa=2 +anti_aliasing/quality/use_taa=true diff --git a/src/Core/GameState.gd b/src/Core/GameState.gd new file mode 100644 index 0000000..d57484f --- /dev/null +++ b/src/Core/GameState.gd @@ -0,0 +1,14 @@ +extends Node + +enum GameMode { NEW_GAME, LOAD_GAME } + +var mode: GameMode = GameMode.NEW_GAME +var save_id: String = "" + +func request_new_game() -> void: + mode = GameMode.NEW_GAME + save_id = "" + +func request_load_game(id: String) -> void: + mode = GameMode.LOAD_GAME + save_id = id diff --git a/src/Core/GameState.gd.uid b/src/Core/GameState.gd.uid new file mode 100644 index 0000000..d5c0aae --- /dev/null +++ b/src/Core/GameState.gd.uid @@ -0,0 +1 @@ +uid://d1ajv537oir2l diff --git a/src/Core/MainGame.gd b/src/Core/MainGame.gd new file mode 100644 index 0000000..af08020 --- /dev/null +++ b/src/Core/MainGame.gd @@ -0,0 +1,9 @@ +extends Node + +func _ready() -> void: + pass + + +func _on_top_bar_hud_sign_return_mainmenu() -> void: + get_tree().change_scene_to_file("res://src/UI/Panels/MainMenu/MainMenu.tscn") + pass # Replace with function body. diff --git a/src/Core/MainGame.gd.uid b/src/Core/MainGame.gd.uid new file mode 100644 index 0000000..a9656a4 --- /dev/null +++ b/src/Core/MainGame.gd.uid @@ -0,0 +1 @@ +uid://centrk8l54j7c diff --git a/src/Core/MainGame.tscn b/src/Core/MainGame.tscn index 2c5ce37..c740df3 100644 --- a/src/Core/MainGame.tscn +++ b/src/Core/MainGame.tscn @@ -1,3 +1,11 @@ [gd_scene format=3 uid="uid://box7tj5iyiopq"] +[ext_resource type="Script" uid="uid://centrk8l54j7c" path="res://src/Core/MainGame.gd" id="1_8bu23"] +[ext_resource type="PackedScene" uid="uid://dl0tb68vsw3c6" path="res://src/UI/HUD/TopBarHUD.tscn" id="1_g6xmk"] + [node name="MainGame" type="Node" unique_id=2053561265] +script = ExtResource("1_8bu23") + +[node name="TopBarHud" parent="." unique_id=1115394694 instance=ExtResource("1_g6xmk")] + +[connection signal="sign_return_mainmenu" from="TopBarHud" to="." method="_on_top_bar_hud_sign_return_mainmenu"] diff --git a/src/UI/HUD/TopBarHUD.tscn b/src/UI/HUD/TopBarHUD.tscn index a9d6a91..6ac7f6f 100644 --- a/src/UI/HUD/TopBarHUD.tscn +++ b/src/UI/HUD/TopBarHUD.tscn @@ -1,13 +1,120 @@ [gd_scene format=3 uid="uid://dl0tb68vsw3c6"] +[ext_resource type="FontFile" uid="uid://drt448qncx27p" path="res://assets/fonts/dingliezhuhaifont-20240831GengXinBan)-2.ttf" id="1_pa2rn"] +[ext_resource type="Script" uid="uid://d3o1ssph7ca58" path="res://src/UI/HUD/top_bar_hud.gd" id="1_vm4eo"] + +[sub_resource type="LabelSettings" id="LabelSettings_bn2o5"] +font = ExtResource("1_pa2rn") + [node name="TopBarHud" type="Control" unique_id=1115394694] layout_mode = 3 -anchors_preset = 0 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_vm4eo") [node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=1608257100] -layout_mode = 0 -offset_right = 40.0 -offset_bottom = 40.0 +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_bottom = 23.0 +grow_horizontal = 2 -[node name="Currency" type="Label" parent="HBoxContainer" unique_id=766096596] +[node name="Label_Currency" type="Label" parent="HBoxContainer" unique_id=766096596] layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 +text = "灵石" +label_settings = SubResource("LabelSettings_bn2o5") + +[node name="Value_Currency" type="Label" parent="HBoxContainer" unique_id=1150573727] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 +label_settings = SubResource("LabelSettings_bn2o5") + +[node name="Label_Time" type="Label" parent="HBoxContainer" unique_id=671872515] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 +text = "时间" +label_settings = SubResource("LabelSettings_bn2o5") + +[node name="Value_Time" type="Label" parent="HBoxContainer" unique_id=1229577188] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 +label_settings = SubResource("LabelSettings_bn2o5") + +[node name="Label_Reputation" type="Label" parent="HBoxContainer" unique_id=985110673] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 +text = "声望" +label_settings = SubResource("LabelSettings_bn2o5") + +[node name="Value_Reputation" type="Label" parent="HBoxContainer" unique_id=2011931119] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 +label_settings = SubResource("LabelSettings_bn2o5") + +[node name="placeholder_1" type="Label" parent="HBoxContainer" unique_id=1042446504] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 +label_settings = SubResource("LabelSettings_bn2o5") + +[node name="placeholder_2" type="Label" parent="HBoxContainer" unique_id=1526548351] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 +label_settings = SubResource("LabelSettings_bn2o5") + +[node name="placeholder_3" type="Label" parent="HBoxContainer" unique_id=1170426663] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 +label_settings = SubResource("LabelSettings_bn2o5") + +[node name="placeholder_4" type="Label" parent="HBoxContainer" unique_id=1878816574] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 +label_settings = SubResource("LabelSettings_bn2o5") + +[node name="placeholder_5" type="Label" parent="HBoxContainer" unique_id=491155620] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 +label_settings = SubResource("LabelSettings_bn2o5") + +[node name="placeholder_6" type="Label" parent="HBoxContainer" unique_id=1738250574] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 +label_settings = SubResource("LabelSettings_bn2o5") + +[node name="Button_StaffManagement" type="Button" parent="HBoxContainer" unique_id=568204305] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 4 +theme_override_fonts/font = ExtResource("1_pa2rn") +text = "管理" + +[node name="Button_ResourcesManagement" type="Button" parent="HBoxContainer" unique_id=1424251140] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 4 +theme_override_fonts/font = ExtResource("1_pa2rn") +text = "资源" + +[node name="Button_Return" type="Button" parent="HBoxContainer" unique_id=867839141] +layout_mode = 2 +size_flags_horizontal = 3 +theme_override_fonts/font = ExtResource("1_pa2rn") +text = "返回" + +[connection signal="button_up" from="HBoxContainer/Button_Return" to="." method="_on_button_return_button_up"] diff --git a/src/UI/HUD/top_bar_hud.gd b/src/UI/HUD/top_bar_hud.gd new file mode 100644 index 0000000..e2035a2 --- /dev/null +++ b/src/UI/HUD/top_bar_hud.gd @@ -0,0 +1,8 @@ +extends Control + +signal sign_return_mainmenu + + +func _on_button_return_button_up() -> void: + sign_return_mainmenu.emit() + pass # Replace with function body. diff --git a/src/UI/HUD/top_bar_hud.gd.uid b/src/UI/HUD/top_bar_hud.gd.uid new file mode 100644 index 0000000..b504bbb --- /dev/null +++ b/src/UI/HUD/top_bar_hud.gd.uid @@ -0,0 +1 @@ +uid://d3o1ssph7ca58 diff --git a/src/UI/Panels/MainMenu/MainMenu.gd b/src/UI/Panels/MainMenu/MainMenu.gd index ead8985..187cf5c 100644 --- a/src/UI/Panels/MainMenu/MainMenu.gd +++ b/src/UI/Panels/MainMenu/MainMenu.gd @@ -1,11 +1,13 @@ extends Control - func MainMenu_NewGame_ButtonUp() -> void: + get_tree().change_scene_to_file("res://src/Core/MainGame.tscn") pass # Replace with function body. func MainMenu_LoadGame_ButtonUp() -> void: + $ButtonGroup.hide() + $SavePanel.show() pass # Replace with function body. @@ -16,3 +18,9 @@ func MainMenu_Settings_ButtonUp() -> void: func MainMenu_Quit_ButtonUp() -> void: get_tree().quit(); pass # Replace with function body. + + +func _on_save_panel_back_pressed() -> void: + $SavePanel.hide() + $ButtonGroup.show() + pass # Replace with function body. diff --git a/src/UI/Panels/MainMenu/MainMenu.tscn b/src/UI/Panels/MainMenu/MainMenu.tscn index a54bb3e..9264b30 100644 --- a/src/UI/Panels/MainMenu/MainMenu.tscn +++ b/src/UI/Panels/MainMenu/MainMenu.tscn @@ -2,9 +2,11 @@ [ext_resource type="Script" uid="uid://drfyh36my6gj2" path="res://src/UI/Panels/MainMenu/MainMenu.gd" id="1_cwvg5"] [ext_resource type="Texture2D" uid="uid://caeqoc6wx8toy" path="res://assets/sprites/ui/BG1.png" id="1_hrti0"] +[ext_resource type="FontFile" uid="uid://drt448qncx27p" path="res://assets/fonts/dingliezhuhaifont-20240831GengXinBan)-2.ttf" id="3_q7typ"] +[ext_resource type="PackedScene" uid="uid://dj7b5vssydifa" path="res://src/UI/Panels/SavePanel.tscn" id="3_wrf65"] [node name="MainMenu" type="Control" unique_id=1416317040] -layout_mode = 1 +layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 @@ -20,7 +22,6 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 texture = ExtResource("1_hrti0") -stretch_mode = 0 [node name="Logo" type="TextureRect" parent="." unique_id=1485724026] layout_mode = 1 @@ -50,24 +51,33 @@ theme_override_constants/separation = 16 [node name="NewGame" type="Button" parent="ButtonGroup" unique_id=835084060] custom_minimum_size = Vector2(200, 48) layout_mode = 2 +theme_override_fonts/font = ExtResource("3_q7typ") text = "新游戏" [node name="LoadGame" type="Button" parent="ButtonGroup" unique_id=2093610529] custom_minimum_size = Vector2(200, 48) layout_mode = 2 +theme_override_fonts/font = ExtResource("3_q7typ") text = "读取存档" [node name="Settings" type="Button" parent="ButtonGroup" unique_id=2045302694] custom_minimum_size = Vector2(200, 48) layout_mode = 2 +theme_override_fonts/font = ExtResource("3_q7typ") text = "设置" [node name="Quit" type="Button" parent="ButtonGroup" unique_id=818112870] custom_minimum_size = Vector2(200, 48) layout_mode = 2 +theme_override_fonts/font = ExtResource("3_q7typ") text = "退出" +[node name="SavePanel" parent="." unique_id=619488443 instance=ExtResource("3_wrf65")] +visible = false +layout_mode = 1 + [connection signal="button_up" from="ButtonGroup/NewGame" to="." method="MainMenu_NewGame_ButtonUp"] [connection signal="button_up" from="ButtonGroup/LoadGame" to="." method="MainMenu_LoadGame_ButtonUp"] [connection signal="button_up" from="ButtonGroup/Settings" to="." method="MainMenu_Settings_ButtonUp"] [connection signal="button_up" from="ButtonGroup/Quit" to="." method="MainMenu_Quit_ButtonUp"] +[connection signal="back_pressed" from="SavePanel" to="." method="_on_save_panel_back_pressed"] diff --git a/src/UI/Panels/SavePanel.gd b/src/UI/Panels/SavePanel.gd new file mode 100644 index 0000000..69113db --- /dev/null +++ b/src/UI/Panels/SavePanel.gd @@ -0,0 +1,8 @@ +extends PanelContainer + +signal back_pressed + + +func _on_button_esc_button_up() -> void: + back_pressed.emit() + pass # Replace with function body. diff --git a/src/UI/Panels/SavePanel.gd.uid b/src/UI/Panels/SavePanel.gd.uid new file mode 100644 index 0000000..33d5a36 --- /dev/null +++ b/src/UI/Panels/SavePanel.gd.uid @@ -0,0 +1 @@ +uid://boao04d7accm diff --git a/src/UI/Panels/SavePanel.tscn b/src/UI/Panels/SavePanel.tscn new file mode 100644 index 0000000..5da79ed --- /dev/null +++ b/src/UI/Panels/SavePanel.tscn @@ -0,0 +1,46 @@ +[gd_scene format=3 uid="uid://dj7b5vssydifa"] + +[ext_resource type="Script" uid="uid://boao04d7accm" path="res://src/UI/Panels/SavePanel.gd" id="1_oi6jj"] +[ext_resource type="PackedScene" uid="uid://dk7ggyngkyt18" path="res://src/UI/Panels/SaveSlot.tscn" id="2_uloko"] + +[node name="SavePanel" type="PanelContainer" unique_id=619488443] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_oi6jj") + +[node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=1850400883] +layout_mode = 2 +theme_override_constants/separation = 16 + +[node name="Header" type="HBoxContainer" parent="VBoxContainer" unique_id=2020722155] +layout_mode = 2 + +[node name="TitleLabel" type="Label" parent="VBoxContainer/Header" unique_id=784512345] +layout_mode = 2 +theme_override_font_sizes/font_size = 24 +text = "选择存档" + +[node name="Spacer" type="Control" parent="VBoxContainer/Header" unique_id=784512346] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="Button_Esc" type="Button" parent="VBoxContainer/Header" unique_id=866430190] +layout_mode = 2 +text = "返回" + +[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer" unique_id=500577526] +layout_mode = 2 +size_flags_vertical = 3 +size_flags_stretch_ratio = 9.0 + +[node name="SlotList" type="VBoxContainer" parent="VBoxContainer/ScrollContainer" unique_id=674823582] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="SaveSlot" parent="VBoxContainer/ScrollContainer/SlotList" unique_id=214547620 instance=ExtResource("2_uloko")] +layout_mode = 2 + +[connection signal="button_up" from="VBoxContainer/Header/Button_Esc" to="." method="_on_button_esc_button_up"] diff --git a/src/UI/Panels/SaveSlot.gd b/src/UI/Panels/SaveSlot.gd new file mode 100644 index 0000000..4b1dcd2 --- /dev/null +++ b/src/UI/Panels/SaveSlot.gd @@ -0,0 +1,38 @@ +extends PanelContainer + +signal slot_pressed(save_id: String) + +@onready var slot_index_label: Label = %SlotIndexLabel +@onready var save_name_label: Label = %SaveNameLabel +@onready var meta_line1: Label = %MetaLine1 +@onready var meta_line2: Label = %MetaLine2 +@onready var delete_button: Button = %DeleteButton +@onready var arrow_button: Button = %ArrowIcon + +var save_id: String = "" +var has_data: bool = false + +func setup(id: String, name_text: String, meta1: String, meta2: String) -> void: + save_id = id + has_data = true + slot_index_label.text = id.get_slice("save_", 1) # "save_001" -> "001" + save_name_label.text = name_text + meta_line1.text = meta1 + meta_line2.text = meta2 + delete_button.visible = true + arrow_button.visible = true + +func setup_empty() -> void: + has_data = false + slot_index_label.text = "+" + save_name_label.text = "新建存档" + meta_line1.text = "点击创建新的存档" + meta_line2.text = "" + delete_button.visible = false + arrow_button.visible = false + +func _on_pressed() -> void: + slot_pressed.emit(save_id) + +func _on_delete_button_button_up() -> void: + print("删除存档: ", save_id) diff --git a/src/UI/Panels/SaveSlot.gd.uid b/src/UI/Panels/SaveSlot.gd.uid new file mode 100644 index 0000000..49a8232 --- /dev/null +++ b/src/UI/Panels/SaveSlot.gd.uid @@ -0,0 +1 @@ +uid://b0uq6cg05y428 diff --git a/src/UI/Panels/SaveSlot.tscn b/src/UI/Panels/SaveSlot.tscn new file mode 100644 index 0000000..77f513c --- /dev/null +++ b/src/UI/Panels/SaveSlot.tscn @@ -0,0 +1,57 @@ +[gd_scene format=3 uid="uid://dk7ggyngkyt18"] + +[ext_resource type="Script" uid="uid://b0uq6cg05y428" path="res://src/UI/Panels/SaveSlot.gd" id="1_ss0t"] + +[node name="SaveSlot" type="PanelContainer" unique_id=214547620] +anchors_preset = 14 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_top = -4.0 +offset_bottom = 4.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +script = ExtResource("1_ss0t") + +[node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=2068970062] +layout_mode = 2 + +[node name="SlotIndexLabel" type="Label" parent="HBoxContainer" unique_id=945932834] +unique_name_in_owner = true +custom_minimum_size = Vector2(40, 0) +layout_mode = 2 +size_flags_horizontal = 3 +vertical_alignment = 1 + +[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer" unique_id=94051654] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 15.0 + +[node name="SaveNameLabel" type="Label" parent="HBoxContainer/VBoxContainer" unique_id=131729571] +unique_name_in_owner = true +layout_mode = 2 + +[node name="MetaLine1" type="Label" parent="HBoxContainer/VBoxContainer" unique_id=1955990569] +unique_name_in_owner = true +layout_mode = 2 + +[node name="MetaLine2" type="Label" parent="HBoxContainer/VBoxContainer" unique_id=1454183959] +unique_name_in_owner = true +layout_mode = 2 + +[node name="DeleteButton" type="Button" parent="HBoxContainer" unique_id=1697002131] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +text = "删除" + +[node name="ArrowIcon" type="Button" parent="HBoxContainer" unique_id=540783971] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +text = "▶" + +[connection signal="button_up" from="HBoxContainer/DeleteButton" to="." method="_on_delete_button_button_up"] diff --git a/src/UI/Panels/StartMenu.tscn b/src/UI/Panels/StartMenu.tscn deleted file mode 100644 index 7ee1f53..0000000 --- a/src/UI/Panels/StartMenu.tscn +++ /dev/null @@ -1,16 +0,0 @@ -[gd_scene format=3 uid="uid://bkatopgh40fte"] - -[ext_resource type="PackedScene" uid="uid://dl0tb68vsw3c6" path="res://src/UI/HUD/TopBarHUD.tscn" id="1_jy7gm"] - -[node name="StartMenu" type="Control" unique_id=1272477823] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 - -[node name="TopBarHud" parent="." unique_id=1115394694 instance=ExtResource("1_jy7gm")] -custom_minimum_size = Vector2(100, 100) -custom_maximum_size = Vector2(100, 100) -layout_mode = 0