mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat(初始选择面板): 添加武器选择功能并优化界面布局
- 在初始选择面板中增加武器选择功能 - 添加开始游戏按钮 - 优化界面布局,将标题和选择项分组显示 - 实现选择后自动关闭对应选择区域的功能
This commit is contained in:
@@ -2,15 +2,39 @@
|
||||
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 = []):
|
||||
for feed in initialFeedSelection.get_children():
|
||||
feed.queue_free()
|
||||
clearFeeds()
|
||||
clearWeapons()
|
||||
ComponentManager.feeds.shuffle()
|
||||
for feed in ComponentManager.feeds:
|
||||
var card = feed.instantiate() as Feed
|
||||
if card.topic == FeedName.Topic.WEAPON:
|
||||
continue
|
||||
card.freeToBuy = true
|
||||
card.selected.connect(func(_success): UIState.closeCurrentPanel())
|
||||
initialFeedSelection.add_child(card)
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user