2026-01-30 11:44:42 +08:00
|
|
|
@tool
|
|
|
|
|
extends FullscreenPanelBase
|
2026-05-03 16:43:27 +08:00
|
|
|
class_name SelectInitialFeedPanel
|
2026-01-30 11:44:42 +08:00
|
|
|
|
|
|
|
|
@onready var initialFeedSelection: HBoxContainer = $%initialFeedSelection
|
2026-01-31 13:01:27 +08:00
|
|
|
@onready var initialWeaponSelection: HBoxContainer = $%initialWeaponSelection
|
|
|
|
|
@onready var startBtn: Button = $%startBtn
|
|
|
|
|
@onready var title1: Label = $%title1
|
|
|
|
|
@onready var title2: Label = $%title2
|
|
|
|
|
|
|
|
|
|
func _ready():
|
2026-05-03 16:03:02 +08:00
|
|
|
startBtn.pressed.connect(
|
|
|
|
|
func():
|
2026-05-03 16:26:07 +08:00
|
|
|
startBtn.disabled = true
|
2026-05-03 16:03:02 +08:00
|
|
|
UIState.closeCurrentPanel()
|
|
|
|
|
StarterPanel.selectingFeed = false
|
|
|
|
|
)
|
2026-01-30 11:44:42 +08:00
|
|
|
|
|
|
|
|
func beforeOpen(_args: Array = []):
|
2026-01-31 13:01:27 +08:00
|
|
|
clearFeeds()
|
|
|
|
|
clearWeapons()
|
2026-05-04 07:03:18 +08:00
|
|
|
var feedCounted = 0
|
|
|
|
|
var weaponCounted = 0
|
2026-01-30 12:21:02 +08:00
|
|
|
ComponentManager.feeds.shuffle()
|
2026-01-30 11:44:42 +08:00
|
|
|
for feed in ComponentManager.feeds:
|
|
|
|
|
var card = feed.instantiate() as Feed
|
2026-01-30 11:50:16 +08:00
|
|
|
card.freeToBuy = true
|
2026-01-31 13:01:27 +08:00
|
|
|
if card.topic == FeedName.Topic.WEAPON:
|
2026-05-04 07:03:18 +08:00
|
|
|
if weaponCounted < OutGameStorage.maxInitialWeaponCount:
|
|
|
|
|
initialWeaponSelection.add_child(card)
|
|
|
|
|
card.selected.connect(
|
|
|
|
|
func(_x):
|
|
|
|
|
if WorldManager.isRelease():
|
|
|
|
|
clearWeapons()
|
|
|
|
|
title2.hide()
|
|
|
|
|
if !title1.visible:
|
|
|
|
|
startBtn.pressed.emit()
|
|
|
|
|
)
|
|
|
|
|
weaponCounted += 1
|
2026-01-31 13:01:27 +08:00
|
|
|
else:
|
2026-05-04 07:03:18 +08:00
|
|
|
if feedCounted < OutGameStorage.maxInitialFeedCount:
|
|
|
|
|
initialFeedSelection.add_child(card)
|
|
|
|
|
card.selected.connect(
|
|
|
|
|
func(_x):
|
|
|
|
|
if WorldManager.isRelease():
|
|
|
|
|
clearFeeds()
|
|
|
|
|
title1.hide()
|
|
|
|
|
if !title2.visible:
|
|
|
|
|
startBtn.pressed.emit()
|
|
|
|
|
)
|
|
|
|
|
feedCounted += 1
|
2026-01-31 13:01:27 +08:00
|
|
|
|
|
|
|
|
func clearFeeds():
|
|
|
|
|
for feed in initialFeedSelection.get_children():
|
|
|
|
|
feed.queue_free()
|
|
|
|
|
func clearWeapons():
|
|
|
|
|
for weapon in initialWeaponSelection.get_children():
|
|
|
|
|
weapon.queue_free()
|