1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00
Files
Dog-Lynx-And-HCN/scripts/Contents/Panels/SelectIntialFeed.gd
T
fallingshrimp 82ae6b343a feat(初始选择面板): 添加武器选择功能并优化界面布局
- 在初始选择面板中增加武器选择功能
- 添加开始游戏按钮
- 优化界面布局,将标题和选择项分组显示
- 实现选择后自动关闭对应选择区域的功能
2026-01-31 13:01:27 +08:00

41 lines
1.0 KiB
GDScript

@tool
extends FullscreenPanelBase
@onready var initialFeedSelection: HBoxContainer = $%initialFeedSelection
@onready var initialWeaponSelection: HBoxContainer = $%initialWeaponSelection
@onready var startBtn: Button = $%startBtn
@onready var title1: Label = $%title1
@onready var title2: Label = $%title2
func _ready():
startBtn.pressed.connect(func(): UIState.closeCurrentPanel())
func beforeOpen(_args: Array = []):
clearFeeds()
clearWeapons()
ComponentManager.feeds.shuffle()
for feed in ComponentManager.feeds:
var card = feed.instantiate() as Feed
card.freeToBuy = true
if card.topic == FeedName.Topic.WEAPON:
initialWeaponSelection.add_child(card)
card.selected.connect(
func(_x):
clearWeapons()
title2.hide()
)
else:
initialFeedSelection.add_child(card)
card.selected.connect(
func(_x):
clearFeeds()
title1.hide()
)
func clearFeeds():
for feed in initialFeedSelection.get_children():
feed.queue_free()
func clearWeapons():
for weapon in initialWeaponSelection.get_children():
weapon.queue_free()