feat: 新增 SectManager 宗门资源管理单例
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.exe"
|
||||
}
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -0,0 +1 @@
|
||||
uid://c25eic5uquo2o
|
||||
Reference in New Issue
Block a user