mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 15:01:53 +08:00
82ae6b343a
- 在初始选择面板中增加武器选择功能 - 添加开始游戏按钮 - 优化界面布局,将标题和选择项分组显示 - 实现选择后自动关闭对应选择区域的功能
41 lines
1.0 KiB
GDScript
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()
|