重构时间系统为回合制并新增主游戏场景
- TimeSystem 由实时天数推进改为按月回合制(advance_month), 新增 turn_started/season_changed 信号,移除 GameState.day - 新增 MainGame 场景及 HUD(时间显示、下一回合、返回主菜单) - 新增 SaveSystem 存档组框架并注册为 Autoload - 存档面板打开时隐藏新建槽按钮 - 窗口改为无边框,主场景切换为 MainGame
This commit is contained in:
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"godotTools.editorPath.godot4": "d:\\game\\Godot\\Godot_v4.7.1-stable_win64.exe\\Godot_v4.7.1-stable_win64_console.exe"
|
||||
}
|
||||
+3
-2
@@ -11,7 +11,7 @@ config_version=5
|
||||
[application]
|
||||
|
||||
config/name="仙宗"
|
||||
run/main_scene="uid://c1exffg84ojqx"
|
||||
run/main_scene="uid://q1b6t22ej3ej"
|
||||
config/features=PackedStringArray("4.7", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
@@ -21,12 +21,13 @@ GameState="*res://src/Core/GameState.gd"
|
||||
TimeSystem="*res://src/Core/TimeSystem.gd"
|
||||
Settings="*res://src/Core/Settings.gd"
|
||||
GameConfig="*res://src/Core/GameConfig.gd"
|
||||
|
||||
SaveSystem="*res://src/Core/SaveSystem.gd"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=1280
|
||||
window/size/viewport_height=720
|
||||
window/size/borderless=true
|
||||
window/stretch/mode="canvas_items"
|
||||
window/stretch/aspect="expand"
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[gd_resource type="LabelSettings" format=3 uid="uid://p6m1pf424716"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://dv0mnlx0fqjad" path="res://assets/fonts/lxgw-wenkai-v1.522/LXGWWenKaiMono-Light.ttf" id="1_bvywk"]
|
||||
|
||||
[resource]
|
||||
font = ExtResource("1_bvywk")
|
||||
font_size = 24
|
||||
@@ -0,0 +1,7 @@
|
||||
[gd_resource type="Theme" format=3 uid="uid://bse6imt1ab1rx"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://b0sai8dfnn2vq" path="res://assets/fonts/lxgw-wenkai-v1.522/LXGWWenKaiMono-Medium.ttf" id="1_im1m5"]
|
||||
|
||||
[resource]
|
||||
default_font = ExtResource("1_im1m5")
|
||||
default_font_size = 24
|
||||
@@ -15,7 +15,6 @@ var save_slot: String = ""
|
||||
# 游戏内时间(12 月 × 30 天 = 360 天/年),实际推进由 TimeSystem 负责
|
||||
var year: int = 1 # 年
|
||||
var month: int = 1 # 月(1-12)
|
||||
var day: int = 1 # 日(1-30)
|
||||
|
||||
## 请求开始新游戏。
|
||||
## @param pid: 新存档组 ID(主菜单创建)
|
||||
@@ -25,7 +24,6 @@ func request_new_game(pid: int) -> void:
|
||||
save_slot = ""
|
||||
year = 1
|
||||
month = 1
|
||||
day = 1
|
||||
|
||||
## 请求加载指定存档。
|
||||
## @param pid: 存档组 ID
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
extends Node
|
||||
|
||||
|
||||
func _on_top_bar_hud_sign_return_mainmenu() -> void:
|
||||
# SaveSystem.save_auto(GameState.profile_id)
|
||||
get_tree().change_scene_to_file("res://src/UI/Panels/MainMenu/MainMenu.tscn")
|
||||
pass # Replace with function body.
|
||||
@@ -0,0 +1 @@
|
||||
uid://cr4by5k8vgkcq
|
||||
+12
-2
@@ -1,7 +1,17 @@
|
||||
[gd_scene format=3 uid="uid://c1exffg84ojqx"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://q1b6t22ej3ej" path="res://src/UI/Panels/MainMenu/MainMenu.tscn" id="1_g6xmk"]
|
||||
[ext_resource type="Script" uid="uid://cr4by5k8vgkcq" path="res://src/Core/MainGame.gd" id="1_8bu23"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3njijtx7ws1m" path="res://src/UI/HUD/MainSceneHud.tscn" id="2_8bu23"]
|
||||
[ext_resource type="PackedScene" uid="uid://xecv3j1wfxmv" path="res://src/UI/HUD/MainGameButtomHud.tscn" id="3_oyqkd"]
|
||||
|
||||
[node name="MainGame" type="Node" unique_id=42551660]
|
||||
script = ExtResource("1_8bu23")
|
||||
|
||||
[node name="MainMenu" parent="." unique_id=285750365 instance=ExtResource("1_g6xmk")]
|
||||
[node name="MainHud" parent="." unique_id=836125968 instance=ExtResource("2_8bu23")]
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="MainGameButtomHud" parent="." unique_id=12078477 instance=ExtResource("3_oyqkd")]
|
||||
visible = false
|
||||
|
||||
[connection signal="sign_return_mainmenu" from="MainHud" to="." method="_on_top_bar_hud_sign_return_mainmenu"]
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
## 存档系统(Autoload 单例)。
|
||||
## 两级存档:存档组 SaveGroup(一个角色/一次轮回)→ 存档槽 SaveSlot(该组下任意多个进度快照)。
|
||||
## 每个新游戏创建一个组;每次存档在该组下新建一个槽;组与槽数量无上限。
|
||||
## 文件:user://saves/profile_{组id}/{auto|slot_{时间戳}}.json
|
||||
extends Node
|
||||
|
||||
## 存档根目录。
|
||||
const SAVE_ROOT := "user://saves"
|
||||
## 存档组列表文件。
|
||||
const PROFILES_PATH := "user://saves/profiles.json"
|
||||
## 自动槽文件名(固定)。
|
||||
const AUTO_SLOT := "auto"
|
||||
## 存档格式版本(兼容迁移预留)。
|
||||
const VERSION := 1
|
||||
|
||||
## 新建存档组(主菜单"新游戏"调用),返回组 id(名"存档N")。
|
||||
func create_profile() -> int:
|
||||
var profiles := _load_profiles()
|
||||
var id := 1
|
||||
for p in profiles:
|
||||
id = maxi(id, int(p["id"]) + 1)
|
||||
profiles.append({
|
||||
"id": id,
|
||||
"name": "存档%d" % id,
|
||||
"created": Time.get_date_string_from_system(),
|
||||
"last_date": "",
|
||||
})
|
||||
_save_profiles(profiles)
|
||||
return id
|
||||
|
||||
|
||||
|
||||
## 读取存档组列表。
|
||||
func _load_profiles() -> Array[Dictionary]:
|
||||
if not FileAccess.file_exists(PROFILES_PATH):
|
||||
return []
|
||||
var f := FileAccess.open(PROFILES_PATH, FileAccess.READ)
|
||||
if f == null:
|
||||
return []
|
||||
var parsed: Variant = JSON.parse_string(f.get_as_text())
|
||||
if parsed is not Dictionary or not parsed.has("profiles"):
|
||||
return []
|
||||
var result: Array[Dictionary] = []
|
||||
for p in parsed["profiles"]:
|
||||
result.append(p)
|
||||
return result
|
||||
|
||||
## 写入存档组列表。
|
||||
## @param profiles: 存档组列表
|
||||
func _save_profiles(profiles: Array[Dictionary]) -> void:
|
||||
var da := DirAccess.open("user://")
|
||||
if da != null:
|
||||
da.make_dir_recursive("saves")
|
||||
var f := FileAccess.open(PROFILES_PATH, FileAccess.WRITE)
|
||||
if f == null:
|
||||
return
|
||||
f.store_string(JSON.stringify({"profiles": profiles}, "\t"))
|
||||
@@ -0,0 +1 @@
|
||||
uid://d20eejtj1ayoi
|
||||
+84
-118
@@ -3,137 +3,103 @@
|
||||
## 历法:12 月 × 30 日 = 360 日/年。
|
||||
extends Node
|
||||
|
||||
## 每当推进一日后发出。
|
||||
## @param year: 当前年份
|
||||
## @param month: 当前月份(1-12)
|
||||
## @param day: 当前日(1-30)
|
||||
signal day_passed(year: int, month: int, day: int)
|
||||
## 每当进入新月份时发出(同一天内 day_passed 之后)。
|
||||
## @param year: 当前年份
|
||||
## @param month: 当前月份(1-12)
|
||||
signal month_passed(year: int, month: int)
|
||||
## 每当进入新年份时发出(同一天内 month_passed 之后)。
|
||||
## @param year: 当前年份
|
||||
signal year_passed(year: int)
|
||||
## 时间流速档位变化时发出。
|
||||
## @param speed_index: 新档位在 SPEEDS 中的索引
|
||||
signal speed_changed(speed_index: int)
|
||||
## 暂停状态变化时发出。
|
||||
## @param paused: 是否已暂停
|
||||
signal pause_changed(paused: bool)
|
||||
|
||||
## 可选的时间流速倍率档位。
|
||||
const SPEEDS := [1.0, 5.0, 20.0]
|
||||
## 每月的天数。
|
||||
const DAYS_PER_MONTH := 30
|
||||
## 每年的月数。
|
||||
const MONTHS_PER_YEAR := 12
|
||||
## 现实世界每 1 天对应的时长(秒)。
|
||||
const DAY_LENGTH := 0.5
|
||||
const MONTHS_PER_SEASON := 3
|
||||
const SEASON_NAMES := ["春", "夏", "秋", "冬"]
|
||||
|
||||
## 当前流速档位在 SPEEDS 中的索引。
|
||||
var speed_index := 0
|
||||
## 当前流速倍率(与 SPEEDS[speed_index] 保持一致)。
|
||||
var speed := 1.0
|
||||
## 是否暂停时间推进。
|
||||
var paused := false
|
||||
## 已累积的现实时间(秒),未满 1 天。
|
||||
var _elapsed := 0.0
|
||||
var _in_turn: bool = false # 防止 advance_month() 重入(处理中再点按钮)
|
||||
|
||||
## 每帧累积时间,满一天推进日期(仅游戏世界场景内)。
|
||||
func _process(delta: float) -> void:
|
||||
if paused or not _is_in_game():
|
||||
## 回合开始,系统尚未处理本回合(事件调度器在此检查触发条件、物价更新)。
|
||||
## @param year: 当前年份
|
||||
## @param month: 当前月份(1-12)
|
||||
signal turn_started(year: int, month: int)
|
||||
|
||||
## 月份推进完毕,所有系统已处理(修炼结算、建筑产出、口粮消耗),
|
||||
## UI 在此连接更新。
|
||||
## @param year: 当前年份
|
||||
## @param month: 当前月份
|
||||
signal month_passed(year: int, month: int)
|
||||
|
||||
## 年份更替(month 滚动到 1 时触发,在 month_passed 之后)。
|
||||
## @param year: 新年度
|
||||
signal year_passed(year: int)
|
||||
|
||||
## 季节更替(每 3 个月触发一次,在 month_passed 之后)。
|
||||
## @param year: 当前年份
|
||||
## @param season: 季节索引(0=春, 1=夏, 2=秋, 3=冬)
|
||||
signal season_changed(year: int, season: int)
|
||||
|
||||
## 执行一回合推进。绑定到"下一回合"按钮。
|
||||
## 发送 turn_started → 系统处理 → month_passed → year/season 信号。
|
||||
func advance_month() -> void:
|
||||
if _in_turn:
|
||||
return
|
||||
_elapsed += delta * speed
|
||||
if _elapsed >= DAY_LENGTH:
|
||||
_elapsed -= DAY_LENGTH
|
||||
_advance()
|
||||
_in_turn = true
|
||||
|
||||
# 计算下月日期,暂不写入 GameState
|
||||
var new_month := GameState.month + 1
|
||||
var new_year := GameState.year
|
||||
if new_month > MONTHS_PER_YEAR:
|
||||
new_month = 1
|
||||
new_year += 1
|
||||
|
||||
## 判断当前场景是否为游戏世界场景(主菜单/存档界面不推进时间)。
|
||||
## 通过 "game_scene" 分组识别,而非场景名。
|
||||
func _is_in_game() -> bool:
|
||||
var scene := get_tree().current_scene
|
||||
return scene != null and scene.is_in_group("game_scene")
|
||||
# 保留旧季节,供换季判断(此时 GameState 仍是旧值)
|
||||
var prev_season := get_current_season()
|
||||
|
||||
# 1. 回合开始 —— 传新月,事件调度器&物价拿到的就是新月份
|
||||
turn_started.emit(new_year, new_month)
|
||||
|
||||
## 推进一日并广播对应信号,跨月/跨年时补发 month_passed / year_passed。
|
||||
func _advance() -> void:
|
||||
var new_month := false
|
||||
var new_year := false
|
||||
GameState.day += 1
|
||||
if GameState.day > DAYS_PER_MONTH:
|
||||
GameState.day = 1
|
||||
GameState.month += 1
|
||||
new_month = true
|
||||
if GameState.month > MONTHS_PER_YEAR:
|
||||
GameState.month = 1
|
||||
GameState.year += 1
|
||||
new_year = true
|
||||
day_passed.emit(GameState.year, GameState.month, GameState.day)
|
||||
if new_month:
|
||||
month_passed.emit(GameState.year, GameState.month)
|
||||
if new_year:
|
||||
year_passed.emit(GameState.year)
|
||||
# 2. 推进日期
|
||||
GameState.year = new_year
|
||||
GameState.month = new_month
|
||||
|
||||
# 3. 系统处理完毕
|
||||
month_passed.emit(new_year, new_month)
|
||||
|
||||
## 循环切换下一档流速,返回新倍率。
|
||||
func cycle_speed() -> float:
|
||||
speed_index = (speed_index + 1) % SPEEDS.size()
|
||||
speed = SPEEDS[speed_index]
|
||||
speed_changed.emit(speed_index)
|
||||
return speed
|
||||
# 4. 跨年
|
||||
if new_month == 1:
|
||||
year_passed.emit(new_year)
|
||||
|
||||
# 5. 换季
|
||||
var curr_season := get_current_season()
|
||||
if curr_season != prev_season:
|
||||
season_changed.emit(new_year, curr_season)
|
||||
|
||||
## 应用用户设置中的默认流速档位(新游戏开局调用)。
|
||||
func apply_default_speed() -> void:
|
||||
set_speed_index(Settings.default_speed_index)
|
||||
_in_turn = false
|
||||
|
||||
|
||||
## 直接设置流速档位(越界自动钳制)。
|
||||
## @param index: 目标档位索引
|
||||
func set_speed_index(index: int) -> void:
|
||||
speed_index = clampi(index, 0, SPEEDS.size() - 1)
|
||||
speed = SPEEDS[speed_index]
|
||||
speed_changed.emit(speed_index)
|
||||
|
||||
|
||||
## 切换暂停状态,返回切换后的暂停状态。
|
||||
func toggle_pause() -> bool:
|
||||
paused = not paused
|
||||
pause_changed.emit(paused)
|
||||
return paused
|
||||
|
||||
|
||||
## 显式设置暂停状态(幂等,状态未变化时不发信号)。
|
||||
## @param value: 目标暂停状态
|
||||
func set_paused(value: bool) -> void:
|
||||
if paused == value:
|
||||
return
|
||||
paused = value
|
||||
pause_changed.emit(paused)
|
||||
|
||||
|
||||
## 当前流速的显示文本,如 "x5"。
|
||||
func get_speed_label() -> String:
|
||||
return "x%d" % int(speed)
|
||||
|
||||
|
||||
## 当前日期数组 [年, 月, 日]。
|
||||
func get_current_date() -> Array:
|
||||
return [GameState.year, GameState.month, GameState.day]
|
||||
|
||||
|
||||
## 当前日期文本,如 "3年 5月 12日"。
|
||||
## 日期显示文本,如 "第3年 5月"。
|
||||
func get_date_text() -> String:
|
||||
return "%d年 %d月 %d日" % [GameState.year, GameState.month, GameState.day]
|
||||
return "%d年 %d月" % [GameState.year, GameState.month]
|
||||
pass
|
||||
|
||||
## 当前年份。
|
||||
func get_current_year() -> int:
|
||||
return GameState.year
|
||||
|
||||
## 当前月份(1-12)。
|
||||
func get_current_month() -> int:
|
||||
return GameState.month
|
||||
|
||||
## 自开局以来经过的总月数(用于事件调度器计算延迟)。
|
||||
func get_total_months() -> int:
|
||||
return (GameState.year - 1) * 12 + (GameState.month - 1)
|
||||
|
||||
## 当前季节索引:0=春, 1=夏, 2=秋, 3=冬。
|
||||
func get_current_season() -> int:
|
||||
return (GameState.month - 1) / 3
|
||||
|
||||
## 当前季节名称:"春"/"夏"/"秋"/"冬"。
|
||||
func get_season_name() -> String:
|
||||
var curr_season := get_current_season()
|
||||
return SEASON_NAMES[curr_season]
|
||||
|
||||
## 设置日期(读档/测试用)。
|
||||
func set_date(year: int, month: int) -> void:
|
||||
GameState.year = maxi(1, year)
|
||||
GameState.month = clampi(month, 1, MONTHS_PER_YEAR)
|
||||
|
||||
|
||||
## 直接设置日期(供读档/测试使用)。
|
||||
## @param y: 年
|
||||
## @param m: 月(1-12)
|
||||
## @param d: 日(1-30)
|
||||
func set_date(y: int, m: int, d: int) -> void:
|
||||
GameState.year = y
|
||||
GameState.month = m
|
||||
GameState.day = d
|
||||
## 重置到第1年1月(新游戏)。
|
||||
func reset() -> void:
|
||||
GameState.year = 1
|
||||
GameState.month = 1
|
||||
|
||||
@@ -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