重构时间系统为回合制并新增主游戏场景
- TimeSystem 由实时天数推进改为按月回合制(advance_month), 新增 turn_started/season_changed 信号,移除 GameState.day - 新增 MainGame 场景及 HUD(时间显示、下一回合、返回主菜单) - 新增 SaveSystem 存档组框架并注册为 Autoload - 存档面板打开时隐藏新建槽按钮 - 窗口改为无边框,主场景切换为 MainGame
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
[gd_scene format=3 uid="uid://xecv3j1wfxmv"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bse6imt1ab1rx" path="res://resources/top_bar_hud_theme.tres" id="1_o3gra"]
|
||||
|
||||
[node name="MainGameButtomHud" type="Control" unique_id=12078477]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=1423942750]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer" unique_id=1433002269]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 10
|
||||
|
||||
[node name="Spacer" type="Control" parent="VBoxContainer/HBoxContainer" unique_id=990599719]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 8.0
|
||||
|
||||
[node name="Button" type="Button" parent="VBoxContainer/HBoxContainer" unique_id=1159144698]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme = ExtResource("1_o3gra")
|
||||
text = "继续"
|
||||
@@ -0,0 +1,24 @@
|
||||
extends Control
|
||||
|
||||
@onready var time_label: Label = %ValueTime
|
||||
|
||||
## 请求返回主菜单。
|
||||
signal sign_return_mainmenu
|
||||
|
||||
func _ready() -> void:
|
||||
time_label.text = TimeSystem.get_date_text()
|
||||
TimeSystem.month_passed.connect(_on_TimeMonthPassed)
|
||||
pass
|
||||
|
||||
func _on_ButtonEsc_ButtonUp() -> void:
|
||||
sign_return_mainmenu.emit()
|
||||
pass # Replace with function body.
|
||||
|
||||
func _on_TimeMonthPassed(_year: int, _month: int) -> void:
|
||||
time_label.text = "%d年 %d月" % [_year, _month]
|
||||
pass
|
||||
|
||||
|
||||
func _on_button_continue_button_up() -> void:
|
||||
TimeSystem.advance_month()
|
||||
pass # Replace with function body.
|
||||
@@ -0,0 +1 @@
|
||||
uid://cs7ybt78ckyy5
|
||||
@@ -0,0 +1,142 @@
|
||||
[gd_scene format=3 uid="uid://d3njijtx7ws1m"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bse6imt1ab1rx" path="res://resources/top_bar_hud_theme.tres" id="1_s184i"]
|
||||
[ext_resource type="Script" uid="uid://cs7ybt78ckyy5" path="res://src/UI/HUD/MainSceneHud.gd" id="1_v7u4p"]
|
||||
[ext_resource type="LabelSettings" uid="uid://p6m1pf424716" path="res://resources/top_bar_hud_label_settings.tres" id="2_yb6ac"]
|
||||
|
||||
[node name="TopBarHud" type="Control" unique_id=836125968]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_v7u4p")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=1135632274]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer" unique_id=1162212804]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Button_Management" type="Button" parent="VBoxContainer/HBoxContainer" unique_id=1258779200]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme = ExtResource("1_s184i")
|
||||
text = "管理"
|
||||
|
||||
[node name="Button_Save" type="Button" parent="VBoxContainer/HBoxContainer" unique_id=2034793066]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme = ExtResource("1_s184i")
|
||||
text = "保存"
|
||||
|
||||
[node name="Button_Esc" type="Button" parent="VBoxContainer/HBoxContainer" unique_id=1501249327]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme = ExtResource("1_s184i")
|
||||
text = "返回"
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer" unique_id=766940130]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/HBoxContainer2" unique_id=1734099818]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBoxContainerTime" type="HBoxContainer" parent="VBoxContainer/HBoxContainer2/VBoxContainer" unique_id=1748032643]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="LabelTime" type="Label" parent="VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainerTime" unique_id=2085063650]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
text = "时间"
|
||||
label_settings = ExtResource("2_yb6ac")
|
||||
|
||||
[node name="ValueTime" type="Label" parent="VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainerTime" unique_id=1958030372]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
|
||||
[node name="HBoxContainerCurrency" type="HBoxContainer" parent="VBoxContainer/HBoxContainer2/VBoxContainer" unique_id=1798089185]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="LabelCurrency" type="Label" parent="VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainerCurrency" unique_id=395079452]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
text = "灵石"
|
||||
label_settings = ExtResource("2_yb6ac")
|
||||
|
||||
[node name="ValueCurrency" type="Label" parent="VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainerCurrency" unique_id=882302618]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
|
||||
[node name="HBoxContainerReputation" type="HBoxContainer" parent="VBoxContainer/HBoxContainer2/VBoxContainer" unique_id=1201358977]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="LabelReputation" type="Label" parent="VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainerReputation" unique_id=2034134087]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
text = "声望"
|
||||
label_settings = ExtResource("2_yb6ac")
|
||||
|
||||
[node name="ValueReputation" type="Label" parent="VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainerReputation" unique_id=980381254]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
|
||||
[node name="HBoxContainerSpiritualEnergy" type="HBoxContainer" parent="VBoxContainer/HBoxContainer2/VBoxContainer" unique_id=190622035]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="LabelSpiritualEnergy" type="Label" parent="VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainerSpiritualEnergy" unique_id=835214265]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
text = "灵气"
|
||||
label_settings = ExtResource("2_yb6ac")
|
||||
|
||||
[node name="ValueSpiritualEnergy" type="Label" parent="VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainerSpiritualEnergy" unique_id=707382401]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
|
||||
[node name="Spacer" type="Control" parent="VBoxContainer/HBoxContainer2" unique_id=2110678606]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 5.0
|
||||
|
||||
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer" unique_id=1738894292]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 10
|
||||
|
||||
[node name="Spacer" type="Control" parent="VBoxContainer/HBoxContainer3" unique_id=643968057]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 5.0
|
||||
|
||||
[node name="ButtonContinue" type="Button" parent="VBoxContainer/HBoxContainer3" unique_id=472091035]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "继续"
|
||||
|
||||
[connection signal="button_up" from="VBoxContainer/HBoxContainer/Button_Esc" to="." method="_on_ButtonEsc_ButtonUp"]
|
||||
[connection signal="button_up" from="VBoxContainer/HBoxContainer3/ButtonContinue" to="." method="_on_button_continue_button_up"]
|
||||
@@ -1,15 +1,21 @@
|
||||
extends Control
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
func _on_MainMenu_NewGame_ButtonUp() -> void:
|
||||
pass # Replace with function body.
|
||||
func _draw() -> void:
|
||||
pass
|
||||
|
||||
func _on_MainMenu_NewGame_ButtonUp() -> void:
|
||||
#var pid := SaveSystem.create_profile()
|
||||
#GameState.request_new_game(pid)
|
||||
get_tree().change_scene_to_file("res://src/Core/MainGame.tscn")
|
||||
pass # Replace with function body.
|
||||
|
||||
func _on_MainMenu_LoadGame_ButtonUp() -> void:
|
||||
$Menu.hide()
|
||||
$SavePannel.show()
|
||||
$SavePannel.open_load()
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
@@ -21,7 +27,6 @@ func _on_MainMenu_Exit_ButtonUp() -> void:
|
||||
get_tree().quit()
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_SavePannel_Esc_pressed() -> void:
|
||||
$SavePannel.hide()
|
||||
$Menu.show()
|
||||
|
||||
@@ -15,7 +15,7 @@ const SAVE_SLOT_SCENE := preload("res://src/UI/Panels/SaveSlot.tscn")
|
||||
#@onready var title_label: Label = %TitleLabel
|
||||
#@onready var group_container: VBoxContainer = %GroupContainer
|
||||
#@onready var slot_list: VBoxContainer = %SlotList
|
||||
#@onready var new_slot_button: Button = %Button_NewSlot
|
||||
@onready var new_slot_button: Button = %Button_NewSlot
|
||||
|
||||
## 当前模式。
|
||||
var mode: Mode = Mode.LOAD
|
||||
@@ -24,6 +24,18 @@ var mode: Mode = Mode.LOAD
|
||||
### 打开面板前的暂停状态(存档模式关闭时恢复)。
|
||||
#var _was_paused := false
|
||||
|
||||
func open_load() -> void:
|
||||
mode = Mode.SAVE
|
||||
new_slot_button.visible = false
|
||||
visible = true
|
||||
pass
|
||||
|
||||
func open_save() -> void:
|
||||
mode = Mode.LOAD
|
||||
new_slot_button.visible = true
|
||||
visible = true
|
||||
pass
|
||||
|
||||
func _on_SavePanel_Esc_ButtonUp() -> void:
|
||||
save_panel_esc_pressed.emit()
|
||||
pass # Replace with function body.
|
||||
|
||||
Reference in New Issue
Block a user