From 5e5763028cb7170694a8a1db05ddb9cd829aa5be Mon Sep 17 00:00:00 2001 From: chen Date: Wed, 5 Aug 2026 00:09:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20SectManager=20?= =?UTF-8?q?=E5=AE=97=E9=97=A8=E8=B5=84=E6=BA=90=E7=AE=A1=E7=90=86=E5=8D=95?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 3 +++ project.godot | 1 + src/Core/SectManager.gd | 25 +++++++++++++++++++++++++ src/Core/SectManager.gd.uid | 1 + 4 files changed, 30 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 src/Core/SectManager.gd create mode 100644 src/Core/SectManager.gd.uid diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..d359f31 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "godotTools.editorPath.godot4": "d:\\game\\Godot\\Godot_v4.7.1-stable_win64.exe\\Godot_v4.7.1-stable_win64.exe" +} \ No newline at end of file diff --git a/project.godot b/project.godot index 803f5e6..9f1a31a 100644 --- a/project.godot +++ b/project.godot @@ -19,6 +19,7 @@ config/features=PackedStringArray("4.7", "Forward Plus") GameState="*res://src/Core/GameState.gd" TimeSystem="*res://src/Core/TimeSystem.gd" Settings="*res://src/Core/Settings.gd" +SectManager="*res://src/Core/SectManager.gd" [display] diff --git a/src/Core/SectManager.gd b/src/Core/SectManager.gd new file mode 100644 index 0000000..744a31a --- /dev/null +++ b/src/Core/SectManager.gd @@ -0,0 +1,25 @@ +## 宗门资源管理器(Autoload 单例)。 +extends Node + +signal spirit_stones_changed(new_value: int, delta: int) +signal reputation_changed(new_value: int, delta: int) + +var spirit_stones := 0 # 灵石 +var reputation := 0 # 声望 + + +func add_spirit_stones(amount: int) -> void: + spirit_stones += amount + emit_signal("spirit_stones_changed", spirit_stones, amount) + +func remove_spirit_stones(amount: int) -> void: + spirit_stones -= amount + emit_signal("spirit_stones_changed", spirit_stones, -amount) + +func add_reputation(amount: int) -> void: + reputation += amount + emit_signal("reputation_changed", reputation, amount) + +func remove_reputation(amount: int) -> void: + reputation -= amount + emit_signal("reputation_changed", reputation, -amount) \ No newline at end of file diff --git a/src/Core/SectManager.gd.uid b/src/Core/SectManager.gd.uid new file mode 100644 index 0000000..7a12517 --- /dev/null +++ b/src/Core/SectManager.gd.uid @@ -0,0 +1 @@ +uid://c25eic5uquo2o