mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-24 04:22:29 +08:00
feat: 添加游戏控制和管理功能
- 新增GameControl节点用于统一处理游戏重启和退出 - 添加GameBusManager管理游戏重启时的资源清理 - 修改Pause和GameOver面板使用新的GameControl - 为EffectController和ItemDropped添加分组管理 - 统一使用WorldManager管理游戏时间
This commit is contained in:
@@ -3,23 +3,7 @@ extends FullscreenPanelBase
|
||||
|
||||
@onready var audio: AudioStreamPlayer2D = $%audio
|
||||
@onready var deadreason: RichTextLabel = $%deadreason
|
||||
@onready var returnBtn: Button = $%returnBtn
|
||||
@onready var exitBtn: Button = $%exitBtn
|
||||
|
||||
func _ready():
|
||||
returnBtn.pressed.connect(
|
||||
func():
|
||||
returnBtn.disabled = true
|
||||
for bullet in get_tree().get_nodes_in_group("bullets"):
|
||||
bullet.queue_free()
|
||||
for entity in get_tree().get_nodes_in_group("entities"):
|
||||
entity.queue_free()
|
||||
UIState.setPanel("Starter")
|
||||
)
|
||||
exitBtn.pressed.connect(
|
||||
func():
|
||||
get_tree().quit()
|
||||
)
|
||||
@onready var gameControl: GameControl = $%gameControl
|
||||
|
||||
func beforeOpen(args: Array = []):
|
||||
audio.play()
|
||||
@@ -28,5 +12,4 @@ func beforeOpen(args: Array = []):
|
||||
for item in OutGameStorage.inventory:
|
||||
OutGameStorage.inventory[item] += UIState.player.inventory[item]
|
||||
func afterOpen(_args: Array = []):
|
||||
returnBtn.disabled = false
|
||||
exitBtn.disabled = false
|
||||
gameControl.enable()
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
@tool
|
||||
extends FullscreenPanelBase
|
||||
|
||||
@onready var aboutBtn: Button = $"%aboutBtn"
|
||||
@onready var gameControl: GameControl = $%gameControl
|
||||
|
||||
func _ready():
|
||||
aboutBtn.pressed.connect(
|
||||
func():
|
||||
UIState.setPanel("Thanks")
|
||||
)
|
||||
func afterOpen(_args: Array = []):
|
||||
gameControl.enable()
|
||||
|
||||
Reference in New Issue
Block a user