Godot client: Collection screen — cards grid, deck management, card widget

- CardWidget (146×204px): affinity-coloured border + art placeholder,
  stats with tooltips, foil/serial indicators, selection highlight
- DeckListItem: inline rename, clone/delete signals to parent
- CardsView: paginated + filterable grid (search debounce, type/affinity
  filters, responsive columns, Load More pagination)
- DecksView: deck list with New Deck form (ArchSpirit card picker),
  clone/rename/delete wired to API, ConfirmationDialog for delete
- CollectionScreen: pill-tab container (Cards / Decks), background
  incremental content sync, back button → MainScreen
- MainScreen: wire CollectionBtn → CollectionScreen
- ContentCache: expose is_syncing() public method

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-02-28 07:48:07 -05:00
co-authored by Claude Happy
parent 1b440e92ba
commit 6a33e26237
13 changed files with 1366 additions and 3 deletions
@@ -61,6 +61,11 @@ func definition_count() -> int:
return _defs.size()
## True while a sync is in progress.
func is_syncing() -> bool:
return _is_syncing
## Start (or resume) the incremental sync.
## Emits sync_progress during, sync_complete or sync_failed when done.
func start_sync() -> void:
@@ -0,0 +1,105 @@
[gd_scene load_steps=4 format=3]
[ext_resource type="Script" path="res://scenes/collection/collection_screen.gd" id="1_cs"]
[ext_resource type="PackedScene" path="res://scenes/collection/views/CardsView.tscn" id="2_cv"]
[ext_resource type="PackedScene" path="res://scenes/collection/views/DecksView.tscn" id="3_dv"]
[node name="CollectionScreen" type="VBoxContainer"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_cs")
[node name="TopBarMargin" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 12
theme_override_constants/margin_right = 12
theme_override_constants/margin_top = 8
theme_override_constants/margin_bottom = 8
[node name="TopBar" type="HBoxContainer" parent="TopBarMargin"]
layout_mode = 2
custom_minimum_size = Vector2(0, 40)
theme_override_constants/separation = 8
[node name="BackBtn" type="Button" parent="TopBarMargin/TopBar"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(40, 40)
text = "←"
tooltip_text = "Back"
theme_override_font_sizes/font_size = 18
[node name="TitleLabel" type="Label" parent="TopBarMargin/TopBar"]
layout_mode = 2
size_flags_horizontal = 3
text = "Collection"
vertical_alignment = 1
theme_override_font_sizes/font_size = 18
[node name="SyncLabel" type="Label" parent="TopBarMargin/TopBar"]
unique_name_in_owner = true
layout_mode = 2
text = ""
visible = false
modulate = Color(0.65, 0.65, 0.80, 1.0)
theme_override_font_sizes/font_size = 12
[node name="HSeparator" type="HSeparator" parent="."]
layout_mode = 2
[node name="TabBarMargin" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 16
theme_override_constants/margin_right = 16
theme_override_constants/margin_top = 6
theme_override_constants/margin_bottom = 6
[node name="TabBar" type="HBoxContainer" parent="TabBarMargin"]
layout_mode = 2
custom_minimum_size = Vector2(0, 36)
theme_override_constants/separation = 8
[node name="CardsTabBtn" type="Button" parent="TabBarMargin/TabBar"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
custom_minimum_size = Vector2(0, 36)
text = "Cards"
theme_override_font_sizes/font_size = 14
[node name="DecksTabBtn" type="Button" parent="TabBarMargin/TabBar"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
custom_minimum_size = Vector2(0, 36)
text = "Decks"
theme_override_font_sizes/font_size = 14
[node name="ContentArea" type="Control" parent="."]
layout_mode = 2
size_flags_vertical = 3
[node name="CardsView" type="VBoxContainer" parent="ContentArea"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("2_cv")
[node name="DecksView" type="VBoxContainer" parent="ContentArea"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
visible = false
script = ExtResource("3_dv")
@@ -0,0 +1,85 @@
extends VBoxContainer
## Collection screen — pill-tab container for Cards and Decks views.
##
## Checks for a background content sync on load; if the cache is already
## syncing (started by InitScreen) the SyncLabel shows "Syncing…" until done.
## If not syncing, triggers a silent background sync to pick up any new cards
## added since last session.
# ── Node references ───────────────────────────────────────────────────────────
@onready var back_btn : Button = %BackBtn
@onready var sync_label : Label = %SyncLabel
@onready var cards_tab_btn : Button = %CardsTabBtn
@onready var decks_tab_btn : Button = %DecksTabBtn
@onready var cards_view : VBoxContainer = %CardsView
@onready var decks_view : VBoxContainer = %DecksView
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
back_btn.pressed.connect(_on_back)
cards_tab_btn.pressed.connect(func(): _show_tab(0))
decks_tab_btn.pressed.connect(func(): _show_tab(1))
_show_tab(0)
_setup_sync()
func _exit_tree() -> void:
if ContentCache.sync_complete.is_connected(_on_sync_done):
ContentCache.sync_complete.disconnect(_on_sync_done)
if ContentCache.sync_failed.is_connected(_on_sync_done_or_failed):
ContentCache.sync_failed.disconnect(_on_sync_done_or_failed)
# ── Tab switching ─────────────────────────────────────────────────────────────
func _show_tab(index: int) -> void:
cards_view.visible = (index == 0)
decks_view.visible = (index == 1)
_apply_tab_style(cards_tab_btn, index == 0)
_apply_tab_style(decks_tab_btn, index == 1)
func _apply_tab_style(btn: Button, active: bool) -> void:
var style := StyleBoxFlat.new()
style.corner_radius_top_left = 6
style.corner_radius_top_right = 6
style.corner_radius_bottom_left = 6
style.corner_radius_bottom_right = 6
if active:
style.bg_color = Color(0.27, 0.47, 0.80, 1.0)
else:
style.bg_color = Color(0.18, 0.18, 0.26, 1.0)
btn.add_theme_stylebox_override("normal", style)
btn.add_theme_stylebox_override("hover", style)
btn.add_theme_stylebox_override("pressed", style)
# ── Background sync ───────────────────────────────────────────────────────────
func _setup_sync() -> void:
if ContentCache.is_syncing():
sync_label.text = "Syncing…"
sync_label.visible = true
ContentCache.sync_complete.connect(_on_sync_done, CONNECT_ONE_SHOT)
ContentCache.sync_failed.connect(_on_sync_done_or_failed, CONNECT_ONE_SHOT)
else:
# Trigger a silent background incremental sync
ContentCache.sync_complete.connect(_on_sync_done, CONNECT_ONE_SHOT)
ContentCache.sync_failed.connect(_on_sync_done_or_failed, CONNECT_ONE_SHOT)
sync_label.text = "Syncing…"
sync_label.visible = true
ContentCache.start_sync()
func _on_sync_done(_total: int) -> void:
sync_label.visible = false
func _on_sync_done_or_failed(_detail = null) -> void:
sync_label.visible = false
# ── Navigation ────────────────────────────────────────────────────────────────
func _on_back() -> void:
get_tree().change_scene_to_file("res://scenes/main/MainScreen.tscn")
@@ -0,0 +1,137 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://scenes/collection/components/card_widget.gd" id="1_cw"]
[node name="CardWidget" type="PanelContainer"]
custom_minimum_size = Vector2(146, 204)
script = ExtResource("1_cw")
[node name="Margin" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 5
theme_override_constants/margin_top = 5
theme_override_constants/margin_right = 5
theme_override_constants/margin_bottom = 5
[node name="VBox" type="VBoxContainer" parent="Margin"]
layout_mode = 2
theme_override_constants/separation = 3
[node name="TopRow" type="HBoxContainer" parent="Margin/VBox"]
layout_mode = 2
custom_minimum_size = Vector2(0, 20)
theme_override_constants/separation = 2
[node name="SpLabel" type="Label" parent="Margin/VBox/TopRow"]
unique_name_in_owner = true
layout_mode = 2
text = "◆?"
theme_override_font_sizes/font_size = 12
[node name="TopFill" type="Control" parent="Margin/VBox/TopRow"]
layout_mode = 2
size_flags_horizontal = 3
[node name="FoilLabel" type="Label" parent="Margin/VBox/TopRow"]
unique_name_in_owner = true
layout_mode = 2
text = "✦"
visible = false
modulate = Color(0.95, 0.85, 0.30, 1.0)
theme_override_font_sizes/font_size = 12
[node name="StLabel" type="Label" parent="Margin/VBox/TopRow"]
unique_name_in_owner = true
layout_mode = 2
text = ""
visible = false
theme_override_font_sizes/font_size = 12
[node name="ArtArea" type="Panel" parent="Margin/VBox"]
layout_mode = 2
size_flags_vertical = 3
custom_minimum_size = Vector2(0, 80)
[node name="ArtRect" type="ColorRect" parent="Margin/VBox/ArtArea"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.18, 0.18, 0.24, 1.0)
[node name="ArtSymbol" type="Label" parent="Margin/VBox/ArtArea"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
text = "◇"
horizontal_alignment = 1
vertical_alignment = 1
theme_override_font_sizes/font_size = 28
[node name="NameLabel" type="Label" parent="Margin/VBox"]
unique_name_in_owner = true
layout_mode = 2
text = "Card Name"
text_overrun_behavior = 3
custom_minimum_size = Vector2(0, 18)
theme_override_font_sizes/font_size = 13
[node name="TypeRarityRow" type="HBoxContainer" parent="Margin/VBox"]
layout_mode = 2
custom_minimum_size = Vector2(0, 14)
theme_override_constants/separation = 2
[node name="TypeLabel" type="Label" parent="Margin/VBox/TypeRarityRow"]
unique_name_in_owner = true
layout_mode = 2
text = ""
modulate = Color(0.70, 0.70, 0.75, 1.0)
theme_override_font_sizes/font_size = 10
[node name="TypeFill" type="Control" parent="Margin/VBox/TypeRarityRow"]
layout_mode = 2
size_flags_horizontal = 3
[node name="RarityLabel" type="Label" parent="Margin/VBox/TypeRarityRow"]
unique_name_in_owner = true
layout_mode = 2
text = ""
theme_override_font_sizes/font_size = 10
[node name="StatsRow" type="HBoxContainer" parent="Margin/VBox"]
layout_mode = 2
custom_minimum_size = Vector2(0, 18)
theme_override_constants/separation = 2
[node name="DmgLabel" type="Label" parent="Margin/VBox/StatsRow"]
unique_name_in_owner = true
layout_mode = 2
text = "⚔ –"
theme_override_font_sizes/font_size = 11
[node name="StatsFill" type="Control" parent="Margin/VBox/StatsRow"]
layout_mode = 2
size_flags_horizontal = 3
[node name="HpLabel" type="Label" parent="Margin/VBox/StatsRow"]
unique_name_in_owner = true
layout_mode = 2
text = "♥ –"
theme_override_font_sizes/font_size = 11
[node name="StatsFill2" type="Control" parent="Margin/VBox/StatsRow"]
layout_mode = 2
size_flags_horizontal = 3
[node name="DefLabel" type="Label" parent="Margin/VBox/StatsRow"]
unique_name_in_owner = true
layout_mode = 2
text = "▲ –"
theme_override_font_sizes/font_size = 11
@@ -0,0 +1,115 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://scenes/collection/components/deck_list_item.gd" id="1_di"]
[node name="DeckListItem" type="PanelContainer"]
custom_minimum_size = Vector2(0, 64)
script = ExtResource("1_di")
[node name="Margin" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 8
[node name="HBox" type="HBoxContainer" parent="Margin"]
layout_mode = 2
theme_override_constants/separation = 8
[node name="Info" type="VBoxContainer" parent="Margin/HBox"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 4
[node name="NameRow" type="HBoxContainer" parent="Margin/HBox/Info"]
layout_mode = 2
theme_override_constants/separation = 0
[node name="NameLabel" type="Label" parent="Margin/HBox/Info/NameRow"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "Deck Name"
text_overrun_behavior = 3
theme_override_font_sizes/font_size = 14
[node name="NameEdit" type="LineEdit" parent="Margin/HBox/Info/NameRow"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
visible = false
custom_minimum_size = Vector2(0, 28)
theme_override_font_sizes/font_size = 14
[node name="SubRow" type="HBoxContainer" parent="Margin/HBox/Info"]
layout_mode = 2
theme_override_constants/separation = 8
[node name="ArchSpiritLabel" type="Label" parent="Margin/HBox/Info/SubRow"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "No ArchSpirit"
text_overrun_behavior = 3
theme_override_font_sizes/font_size = 11
[node name="CountLabel" type="Label" parent="Margin/HBox/Info/SubRow"]
unique_name_in_owner = true
layout_mode = 2
text = "0 cards"
modulate = Color(0.65, 0.65, 0.70, 1.0)
theme_override_font_sizes/font_size = 11
[node name="ValidLabel" type="Label" parent="Margin/HBox/Info/SubRow"]
unique_name_in_owner = true
layout_mode = 2
text = "⚠"
modulate = Color(1.0, 0.75, 0.2, 1.0)
theme_override_font_sizes/font_size = 11
[node name="Actions" type="HBoxContainer" parent="Margin/HBox"]
layout_mode = 2
theme_override_constants/separation = 4
[node name="RenameBtn" type="Button" parent="Margin/HBox/Actions"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(36, 36)
text = "✏"
tooltip_text = "Rename"
theme_override_font_sizes/font_size = 14
[node name="CloneBtn" type="Button" parent="Margin/HBox/Actions"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(36, 36)
text = "⧉"
tooltip_text = "Clone deck"
theme_override_font_sizes/font_size = 14
[node name="DeleteBtn" type="Button" parent="Margin/HBox/Actions"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(36, 36)
text = "🗑"
tooltip_text = "Delete deck"
theme_override_font_sizes/font_size = 14
[node name="ConfirmRenameBtn" type="Button" parent="Margin/HBox/Actions"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(36, 36)
text = "✓"
tooltip_text = "Save name"
visible = false
theme_override_font_sizes/font_size = 14
[node name="CancelRenameBtn" type="Button" parent="Margin/HBox/Actions"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(36, 36)
text = "✕"
tooltip_text = "Cancel rename"
visible = false
theme_override_font_sizes/font_size = 14
@@ -0,0 +1,175 @@
extends PanelContainer
## Visual card widget.
##
## Call setup(dto, def) after instantiation, where:
## dto — PlayerCardDto dictionary from collection.get_cards
## def — CardDefinitionDto from ContentCache.get_definition() (pass {} if absent)
##
## Emits card_pressed(definition_id) on tap/click.
## Call set_selected(true/false) to highlight the card (used by the arch-spirit picker).
# ── Colour tables ─────────────────────────────────────────────────────────────
const AFFINITY_BORDER := {
"Fire": Color(0.91, 0.33, 0.13),
"Water": Color(0.20, 0.53, 1.00),
"Earth": Color(0.45, 0.69, 0.20),
"Air": Color(0.53, 0.80, 0.93),
"Lightning": Color(0.94, 0.88, 0.19),
"Dark": Color(0.60, 0.25, 0.93),
"Light": Color(0.97, 0.84, 0.25),
}
const AFFINITY_BG := {
"Fire": Color(0.54, 0.15, 0.08),
"Water": Color(0.06, 0.23, 0.43),
"Earth": Color(0.19, 0.26, 0.08),
"Air": Color(0.18, 0.34, 0.44),
"Lightning": Color(0.42, 0.36, 0.03),
"Dark": Color(0.23, 0.06, 0.38),
"Light": Color(0.47, 0.38, 0.04),
}
const AFFINITY_SYMBOL := {
"Fire": "🔥", "Water": "💧", "Earth": "⛰",
"Air": "💨", "Lightning": "⚡", "Dark": "✦", "Light": "★",
}
const RARITY_COLOR := {
"Common": Color(0.67, 0.67, 0.67),
"Uncommon": Color(0.27, 0.85, 0.27),
"Rare": Color(0.27, 0.53, 1.00),
"Epic": Color(0.67, 0.27, 1.00),
"Legendary": Color(1.00, 0.67, 0.13),
}
# ── Signals ───────────────────────────────────────────────────────────────────
## Emitted on mouse-click or screen-touch.
signal card_pressed(definition_id: String)
# ── Node refs ─────────────────────────────────────────────────────────────────
@onready var sp_label : Label = %SpLabel
@onready var st_label : Label = %StLabel
@onready var foil_label : Label = %FoilLabel
@onready var art_rect : ColorRect = %ArtRect
@onready var art_symbol : Label = %ArtSymbol
@onready var name_label : Label = %NameLabel
@onready var type_label : Label = %TypeLabel
@onready var rarity_label : Label = %RarityLabel
@onready var dmg_label : Label = %DmgLabel
@onready var hp_label : Label = %HpLabel
@onready var def_label : Label = %DefLabel
# ── State ─────────────────────────────────────────────────────────────────────
var _affinity : String = ""
var _definition_id : String = ""
var _is_selected : bool = false
# ── Public API ────────────────────────────────────────────────────────────────
## Populate the widget.
func setup(dto: Dictionary, def: Dictionary = {}) -> void:
_affinity = str(dto.get("affinity", ""))
_definition_id = str(dto.get("cardDefinitionId", ""))
var rarity := str(dto.get("rarity", ""))
var is_foil := bool(dto.get("isFoil", false))
_apply_style()
art_rect.color = AFFINITY_BG.get(_affinity, Color(0.18, 0.18, 0.24))
art_symbol.text = AFFINITY_SYMBOL.get(_affinity, "◇")
foil_label.visible = is_foil
name_label.text = str(dto.get("name", "—"))
type_label.text = str(dto.get("cardType", ""))
rarity_label.text = rarity
rarity_label.modulate = RARITY_COLOR.get(rarity, Color(0.67, 0.67, 0.67))
_load_stats(def)
_load_abilities(def)
## Toggle the selection highlight (arch-spirit picker).
func set_selected(selected: bool) -> void:
_is_selected = selected
_apply_style()
## The cached definition ID this widget represents.
func get_definition_id() -> String:
return _definition_id
# ── Input ─────────────────────────────────────────────────────────────────────
func _gui_input(event: InputEvent) -> void:
if event is InputEventMouseButton \
and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
card_pressed.emit(_definition_id)
accept_event()
elif event is InputEventScreenTouch and event.pressed:
card_pressed.emit(_definition_id)
accept_event()
# ── Visuals ───────────────────────────────────────────────────────────────────
func _apply_style() -> void:
var border: Color
var width: int
if _is_selected:
border = Color(1.0, 1.0, 1.0)
width = 3
else:
border = AFFINITY_BORDER.get(_affinity, Color(0.31, 0.38, 0.63))
width = 2
var s := StyleBoxFlat.new()
s.bg_color = Color(0.09, 0.09, 0.14)
s.border_color = border
s.set_border_width_all(width)
s.set_corner_radius_all(6)
add_theme_stylebox_override("panel", s)
# ── Stats ─────────────────────────────────────────────────────────────────────
func _load_stats(def: Dictionary) -> void:
var sp : Variant = def.get("spCost", null)
var st : Variant = def.get("stCost", null)
var dmg : Variant = def.get("damage", null)
var hp : Variant = def.get("maxHealth", null)
var dfs : Variant = def.get("maxDefense", null)
var mov : Variant = def.get("movementPoints", null)
sp_label.text = ("◆%s" % str(sp)) if sp != null else "◆?"
st_label.text = ("⚡%s" % str(st)) if (st != null and int(st) > 0) else ""
st_label.visible = st != null and int(st) > 0
dmg_label.text = "⚔ %s" % (str(dmg) if dmg != null else "–")
hp_label.text = "♥ %s" % (str(hp) if hp != null else "–")
def_label.text = "▲ %s" % (str(dfs) if dfs != null else "–")
sp_label.tooltip_text = "Spirit Cost"
st_label.tooltip_text = "Stamina Cost"
dmg_label.tooltip_text = "Attack Damage" \
+ (" | Move: %s" % str(mov) if mov != null else "")
hp_label.tooltip_text = "Max Health"
def_label.tooltip_text = "Max Defense"
func _load_abilities(def: Dictionary) -> void:
var json_str := str(def.get("abilitiesJson", ""))
if json_str.is_empty() or json_str == "[]":
return
var parsed: Variant = JSON.parse_string(json_str)
if typeof(parsed) != TYPE_ARRAY:
return
var lines: PackedStringArray = []
for ab in parsed as Array:
if typeof(ab) == TYPE_DICTIONARY:
var d := ab as Dictionary
var n := str(d.get("name", d.get("Name", "")))
var t := str(d.get("description", d.get("Description", "")))
lines.append(("[%s] %s" % [n, t]) if not t.is_empty() else ("[%s]" % n))
if not lines.is_empty():
art_rect.tooltip_text = "\n".join(lines)
@@ -0,0 +1,109 @@
extends PanelContainer
## One row in the deck list.
##
## Signals back to DecksView for all mutating actions so the parent
## owns the API calls and state. Inline rename editing is handled here.
signal rename_requested(deck_id: String, new_name: String)
signal delete_requested(deck_id: String, deck_name: String)
signal clone_requested(deck_id: String)
@onready var name_label : Label = %NameLabel
@onready var name_edit : LineEdit = %NameEdit
@onready var arch_spirit_label : Label = %ArchSpiritLabel
@onready var count_label : Label = %CountLabel
@onready var valid_label : Label = %ValidLabel
@onready var rename_btn : Button = %RenameBtn
@onready var clone_btn : Button = %CloneBtn
@onready var delete_btn : Button = %DeleteBtn
@onready var confirm_rename : Button = %ConfirmRenameBtn
@onready var cancel_rename : Button = %CancelRenameBtn
var _deck_id : String = ""
var _deck_name : String = ""
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
_apply_row_style()
_exit_rename_mode()
rename_btn.pressed.connect(_start_rename)
clone_btn.pressed.connect(func(): clone_requested.emit(_deck_id))
delete_btn.pressed.connect(func(): delete_requested.emit(_deck_id, _deck_name))
confirm_rename.pressed.connect(_finish_rename)
cancel_rename.pressed.connect(_cancel_rename)
name_edit.text_submitted.connect(func(_t): _finish_rename())
# ── Public ────────────────────────────────────────────────────────────────────
func setup(deck: Dictionary) -> void:
_deck_id = str(deck.get("id", ""))
_deck_name = str(deck.get("name", "Unnamed Deck"))
name_label.text = _deck_name
name_edit.text = _deck_name
var arch_name : String = str(deck.get("archSpiritName", ""))
arch_spirit_label.text = arch_name if not arch_name.is_empty() else "No ArchSpirit"
arch_spirit_label.modulate = Color(0.6, 0.6, 0.7) if arch_name.is_empty() \
else Color(0.8, 0.8, 0.9)
count_label.text = "%d cards" % int(deck.get("cardCount", 0))
var is_valid : bool = bool(deck.get("isValid", false))
var warnings : Variant = deck.get("validationWarnings", null)
if is_valid:
valid_label.text = "✓"
valid_label.modulate = Color(0.3, 0.9, 0.4)
valid_label.tooltip_text = "Deck is valid"
else:
valid_label.text = "⚠"
valid_label.modulate = Color(1.0, 0.75, 0.2)
if typeof(warnings) == TYPE_ARRAY and (warnings as Array).size() > 0:
valid_label.tooltip_text = "\n".join(warnings as Array)
else:
valid_label.tooltip_text = "Deck is incomplete"
# ── Rename flow ───────────────────────────────────────────────────────────────
func _start_rename() -> void:
name_label.visible = false
name_edit.visible = true
confirm_rename.visible = true
cancel_rename.visible = true
rename_btn.visible = false
name_edit.grab_focus()
name_edit.select_all()
func _finish_rename() -> void:
var new_name := name_edit.text.strip_edges()
if new_name.is_empty():
_cancel_rename()
return
_deck_name = new_name
name_label.text = new_name
_exit_rename_mode()
rename_requested.emit(_deck_id, new_name)
func _cancel_rename() -> void:
name_edit.text = _deck_name
_exit_rename_mode()
func _exit_rename_mode() -> void:
name_label.visible = true
name_edit.visible = false
confirm_rename.visible = false
cancel_rename.visible = false
rename_btn.visible = true
# ── Style ─────────────────────────────────────────────────────────────────────
func _apply_row_style() -> void:
var s := StyleBoxFlat.new()
s.bg_color = Color(0.11, 0.11, 0.17)
s.set_corner_radius_all(6)
add_theme_stylebox_override("panel", s)
@@ -0,0 +1,90 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://scenes/collection/views/cars_view.gd" id="1_cv"]
[node name="CardsView" type="VBoxContainer"]
layout_mode = 2
script = ExtResource("1_cv")
[node name="FilterBar" type="VBoxContainer" parent="."]
layout_mode = 2
theme_override_constants/separation = 6
theme_override_constants/margin_left = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_bottom = 8
[node name="SearchInput" type="LineEdit" parent="FilterBar"]
unique_name_in_owner = true
layout_mode = 2
placeholder_text = "Search cards…"
theme_override_font_sizes/font_size = 14
[node name="FilterRow" type="HBoxContainer" parent="FilterBar"]
layout_mode = 2
theme_override_constants/separation = 6
[node name="TypeOption" type="OptionButton" parent="FilterBar/FilterRow"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 13
[node name="AffinityOption" type="OptionButton" parent="FilterBar/FilterRow"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 13
[node name="Scroll" type="ScrollContainer" parent="."]
layout_mode = 2
size_flags_vertical = 3
horizontal_scroll_mode = 0
[node name="ScrollInner" type="VBoxContainer" parent="Scroll"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 0
[node name="CardGridMargin" type="MarginContainer" parent="Scroll/ScrollInner"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_bottom = 8
[node name="CardGrid" type="GridContainer" parent="Scroll/ScrollInner/CardGridMargin"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
columns = 2
theme_override_constants/h_separation = 8
theme_override_constants/v_separation = 8
[node name="StatusRow" type="HBoxContainer" parent="Scroll/ScrollInner"]
layout_mode = 2
custom_minimum_size = Vector2(0, 44)
alignment = 1
[node name="LoadingLabel" type="Label" parent="Scroll/ScrollInner/StatusRow"]
unique_name_in_owner = true
layout_mode = 2
text = "Loading…"
modulate = Color(0.75, 0.75, 0.8, 1.0)
theme_override_font_sizes/font_size = 14
[node name="EmptyLabel" type="Label" parent="Scroll/ScrollInner/StatusRow"]
unique_name_in_owner = true
layout_mode = 2
text = "No cards found."
visible = false
modulate = Color(0.6, 0.6, 0.65, 1.0)
theme_override_font_sizes/font_size = 14
[node name="LoadMoreBtn" type="Button" parent="Scroll/ScrollInner/StatusRow"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(120, 36)
text = "Load More"
visible = false
theme_override_font_sizes/font_size = 14
@@ -0,0 +1,148 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://scenes/collection/views/decks_view.gd" id="1_dv"]
[node name="DecksView" type="VBoxContainer"]
layout_mode = 2
script = ExtResource("1_dv")
[node name="HeaderMargin" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 12
theme_override_constants/margin_right = 12
theme_override_constants/margin_top = 8
theme_override_constants/margin_bottom = 8
[node name="Header" type="HBoxContainer" parent="HeaderMargin"]
layout_mode = 2
custom_minimum_size = Vector2(0, 34)
theme_override_constants/separation = 8
[node name="HeaderLabel" type="Label" parent="HeaderMargin/Header"]
layout_mode = 2
size_flags_horizontal = 3
text = "Decks"
theme_override_font_sizes/font_size = 16
[node name="NewDeckBtn" type="Button" parent="HeaderMargin/Header"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(0, 34)
text = "+ New Deck"
theme_override_font_sizes/font_size = 14
[node name="NewDeckForm" type="PanelContainer" parent="."]
unique_name_in_owner = true
layout_mode = 2
visible = false
[node name="FormMargin" type="MarginContainer" parent="NewDeckForm"]
layout_mode = 2
theme_override_constants/margin_left = 12
theme_override_constants/margin_right = 12
theme_override_constants/margin_top = 10
theme_override_constants/margin_bottom = 10
[node name="FormVBox" type="VBoxContainer" parent="NewDeckForm/FormMargin"]
layout_mode = 2
theme_override_constants/separation = 10
[node name="FormTitle" type="Label" parent="NewDeckForm/FormMargin/FormVBox"]
layout_mode = 2
text = "New Deck"
theme_override_font_sizes/font_size = 15
[node name="DeckNameInput" type="LineEdit" parent="NewDeckForm/FormMargin/FormVBox"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(0, 36)
placeholder_text = "Deck Name"
theme_override_font_sizes/font_size = 14
[node name="ArchSpiritLabel" type="Label" parent="NewDeckForm/FormMargin/FormVBox"]
layout_mode = 2
text = "ArchSpirit Card"
theme_override_font_sizes/font_size = 13
modulate = Color(0.8, 0.8, 0.85, 1.0)
[node name="ArchSpiritScroll" type="ScrollContainer" parent="NewDeckForm/FormMargin/FormVBox"]
layout_mode = 2
custom_minimum_size = Vector2(0, 170)
vertical_scroll_mode = 0
[node name="ArchSpiritGrid" type="HBoxContainer" parent="NewDeckForm/FormMargin/FormVBox/ArchSpiritScroll"]
unique_name_in_owner = true
layout_mode = 2
theme_override_constants/separation = 8
[node name="ArchSpiritHint" type="Label" parent="NewDeckForm/FormMargin/FormVBox"]
unique_name_in_owner = true
layout_mode = 2
text = "Select an ArchSpirit card to continue."
modulate = Color(1.0, 0.75, 0.3, 1.0)
theme_override_font_sizes/font_size = 12
[node name="FormButtons" type="HBoxContainer" parent="NewDeckForm/FormMargin/FormVBox"]
layout_mode = 2
theme_override_constants/separation = 8
[node name="CancelNewBtn" type="Button" parent="NewDeckForm/FormMargin/FormVBox/FormButtons"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
custom_minimum_size = Vector2(0, 36)
text = "Cancel"
theme_override_font_sizes/font_size = 14
[node name="CreateBtn" type="Button" parent="NewDeckForm/FormMargin/FormVBox/FormButtons"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
custom_minimum_size = Vector2(0, 36)
text = "Create"
disabled = true
theme_override_font_sizes/font_size = 14
[node name="Scroll" type="ScrollContainer" parent="."]
layout_mode = 2
size_flags_vertical = 3
horizontal_scroll_mode = 0
[node name="DeckListMargin" type="MarginContainer" parent="Scroll"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/margin_left = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_top = 4
theme_override_constants/margin_bottom = 8
[node name="DeckList" type="VBoxContainer" parent="Scroll/DeckListMargin"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 4
[node name="StatusRow" type="HBoxContainer" parent="."]
layout_mode = 2
custom_minimum_size = Vector2(0, 44)
alignment = 1
[node name="LoadingLabel" type="Label" parent="StatusRow"]
unique_name_in_owner = true
layout_mode = 2
text = "Loading…"
modulate = Color(0.75, 0.75, 0.8, 1.0)
theme_override_font_sizes/font_size = 14
[node name="EmptyLabel" type="Label" parent="StatusRow"]
unique_name_in_owner = true
layout_mode = 2
text = "No decks yet. Tap + to create one."
visible = false
modulate = Color(0.6, 0.6, 0.65, 1.0)
theme_override_font_sizes/font_size = 14
[node name="ConfirmDialog" type="ConfirmationDialog" parent="."]
unique_name_in_owner = true
title = "Confirm Delete"
ok_button_text = "Delete"
@@ -0,0 +1,171 @@
extends VBoxContainer
## Cards tab — paginated, filterable grid of the player's owned cards.
##
## Fetches from collection.get_cards (page, pageSize, nameFilter?,
## cardTypeFilter?, affinityFilter?). Displays results as CardWidget
## instances in a responsive GridContainer.
##
## Typing in the search box starts a 0.4 s debounce before reloading.
## "Load More" appends the next page without clearing the existing cards.
const CARD_WIDGET := preload("res://scenes/collection/components/CardWidget.tscn")
const PAGE_SIZE := 20
# ── Node references ───────────────────────────────────────────────────────────
@onready var search_input : LineEdit = %SearchInput
@onready var type_option : OptionButton = %TypeOption
@onready var affinity_option : OptionButton = %AffinityOption
@onready var card_grid : GridContainer = %CardGrid
@onready var loading_label : Label = %LoadingLabel
@onready var empty_label : Label = %EmptyLabel
@onready var load_more_btn : Button = %LoadMoreBtn
# ── State ─────────────────────────────────────────────────────────────────────
var _current_page : int = 1
var _total_count : int = 0
var _has_more : bool = false
var _loading : bool = false
var _search_timer : float = 0.0
const _SEARCH_DEBOUNCE := 0.4
# Signals emitted to parent when a card is tapped (for future deck-editor use)
signal card_selected(player_card_id: String, definition_id: String)
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
_populate_type_options()
_populate_affinity_options()
_update_columns()
search_input.text_changed.connect(_on_search_changed)
type_option.item_selected.connect(func(_i): _reload())
affinity_option.item_selected.connect(func(_i): _reload())
load_more_btn.pressed.connect(_on_load_more)
get_viewport().size_changed.connect(_update_columns)
_reload()
func _exit_tree() -> void:
if get_viewport() and get_viewport().size_changed.is_connected(_update_columns):
get_viewport().size_changed.disconnect(_update_columns)
func _process(delta: float) -> void:
if _search_timer > 0.0:
_search_timer -= delta
if _search_timer <= 0.0:
_search_timer = 0.0
_reload()
# ── Option population ─────────────────────────────────────────────────────────
func _populate_type_options() -> void:
type_option.clear()
type_option.add_item("All Types")
for t in ["Creature", "Spell", "Item", "ArchSpirit"]:
type_option.add_item(t)
func _populate_affinity_options() -> void:
affinity_option.clear()
affinity_option.add_item("All Affinities")
for a in ["Fire", "Water", "Earth", "Air", "Lightning", "Dark", "Light"]:
affinity_option.add_item(a)
# ── Responsive columns ────────────────────────────────────────────────────────
func _update_columns() -> void:
var vp_w := get_viewport_rect().size.x
card_grid.columns = max(2, int(vp_w / 160))
# ── Data fetching ─────────────────────────────────────────────────────────────
func _reload() -> void:
_current_page = 1
_total_count = 0
_has_more = false
for child in card_grid.get_children():
child.queue_free()
_fetch_page(1)
func _fetch_page(page: int) -> void:
if _loading:
return
_loading = true
_set_status("loading")
var payload := {
"page": page,
"pageSize": PAGE_SIZE,
}
var search := search_input.text.strip_edges()
if not search.is_empty():
payload["nameFilter"] = search
# Type filter — index 0 = "All Types" (skip)
var type_idx := type_option.selected
if type_idx > 0:
payload["cardTypeFilter"] = type_option.get_item_text(type_idx)
# Affinity filter — index 0 = "All Affinities" (skip)
var aff_idx := affinity_option.selected
if aff_idx > 0:
payload["affinityFilter"] = affinity_option.get_item_text(aff_idx)
Network.request(
"collection.get_cards",
payload,
func(_t: String, p: Variant): _on_cards_response(p, page),
func(_code: String, msg: String): _on_error(msg)
)
func _on_cards_response(payload: Variant, page: int) -> void:
_loading = false
var p := payload as Dictionary
var cards : Array = p.get("cards", [])
_total_count = int(p.get("totalCount", 0))
var page_size : int = int(p.get("pageSize", PAGE_SIZE))
_current_page = page
_has_more = (page * page_size) < _total_count
for dto in cards:
var def := ContentCache.get_definition(str(dto.get("cardDefinitionId", "")))
var widget = CARD_WIDGET.instantiate() as PanelContainer
widget.setup(dto, def)
widget.card_pressed.connect(func(def_id: String):
card_selected.emit(str(dto.get("playerCardId", "")), def_id))
card_grid.add_child(widget)
if cards.is_empty() and page == 1:
_set_status("empty")
else:
_set_status("done")
load_more_btn.visible = _has_more
func _on_error(msg: String) -> void:
_loading = false
_set_status("empty")
push_warning("CardsView: %s" % msg)
# ── Button handlers ───────────────────────────────────────────────────────────
func _on_search_changed(_text: String) -> void:
_search_timer = _SEARCH_DEBOUNCE
func _on_load_more() -> void:
_fetch_page(_current_page + 1)
# ── Status helper ─────────────────────────────────────────────────────────────
func _set_status(state: String) -> void:
loading_label.visible = (state == "loading")
empty_label.visible = (state == "empty")
if state != "loading":
load_more_btn.visible = _has_more
@@ -0,0 +1,219 @@
extends VBoxContainer
## Decks tab — browse, create, clone, rename, and delete decks.
##
## New Deck flow:
## 1. User taps "+ New Deck" → NewDeckForm slides into view.
## 2. Player types a deck name and picks an ArchSpirit card from
## a horizontal scroll of CardWidgets.
## 3. "Create" is only enabled once both are set.
## 4. On Create: collection.create_deck → reload deck list.
##
## All mutating operations go through this node via signals from DeckListItem.
const DECK_LIST_ITEM := preload("res://scenes/collection/components/DeckListItem.tscn")
const CARD_WIDGET := preload("res://scenes/collection/components/CardWidget.tscn")
# ── Node references ───────────────────────────────────────────────────────────
@onready var new_deck_btn : Button = %NewDeckBtn
@onready var new_deck_form : PanelContainer = %NewDeckForm
@onready var deck_name_input : LineEdit = %DeckNameInput
@onready var arch_spirit_grid : HBoxContainer = %ArchSpiritGrid
@onready var arch_spirit_hint : Label = %ArchSpiritHint
@onready var cancel_new_btn : Button = %CancelNewBtn
@onready var create_btn : Button = %CreateBtn
@onready var deck_list : VBoxContainer = %DeckList
@onready var loading_label : Label = %LoadingLabel
@onready var empty_label : Label = %EmptyLabel
@onready var confirm_dialog : ConfirmationDialog = %ConfirmDialog
# ── State ─────────────────────────────────────────────────────────────────────
var _selected_arch_spirit_id : String = "" ## cardDefinitionId of chosen ArchSpirit
var _pending_delete_id : String = ""
var _pending_delete_name : String = ""
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
new_deck_btn.pressed.connect(_on_new_deck_pressed)
cancel_new_btn.pressed.connect(_on_cancel_new)
create_btn.pressed.connect(_on_create_deck)
deck_name_input.text_changed.connect(_on_name_changed)
confirm_dialog.confirmed.connect(_on_delete_confirmed)
create_btn.disabled = true
_load_decks()
# ── Deck list ─────────────────────────────────────────────────────────────────
func _load_decks() -> void:
for child in deck_list.get_children():
child.queue_free()
_set_status("loading")
Network.request(
"collection.get_decks",
{},
func(_t: String, p: Variant): _on_decks_response(p),
func(_code: String, msg: String): _on_load_error(msg)
)
func _on_decks_response(payload: Variant) -> void:
var decks : Array = (payload as Dictionary).get("decks", [])
_set_status(decks.is_empty(), "empty")
for deck in decks:
var item = DECK_LIST_ITEM.instantiate()
item.setup(deck)
item.rename_requested.connect(_on_rename_requested)
item.delete_requested.connect(_on_delete_requested)
item.clone_requested.connect(_on_clone_requested)
deck_list.add_child(item)
func _on_load_error(msg: String) -> void:
_set_status(true, "empty")
push_warning("DecksView load: %s" % msg)
# ── New Deck form ─────────────────────────────────────────────────────────────
func _on_new_deck_pressed() -> void:
new_deck_form.visible = true
new_deck_btn.visible = false
deck_name_input.text = ""
_selected_arch_spirit_id = ""
arch_spirit_hint.visible = true
create_btn.disabled = true
_load_arch_spirits()
func _on_cancel_new() -> void:
new_deck_form.visible = false
new_deck_btn.visible = true
_clear_arch_spirit_grid()
func _clear_arch_spirit_grid() -> void:
for child in arch_spirit_grid.get_children():
child.queue_free()
_selected_arch_spirit_id = ""
func _load_arch_spirits() -> void:
_clear_arch_spirit_grid()
Network.request(
"collection.get_cards",
{ "page": 1, "pageSize": 50, "cardTypeFilter": "ArchSpirit" },
func(_t: String, p: Variant): _on_arch_spirits(p),
func(_code: String, msg: String): push_warning("DecksView arch spirits: %s" % msg)
)
func _on_arch_spirits(payload: Variant) -> void:
var cards : Array = (payload as Dictionary).get("cards", [])
for dto in cards:
var def := ContentCache.get_definition(str(dto.get("cardDefinitionId", "")))
var widget = CARD_WIDGET.instantiate()
widget.setup(dto, def)
widget.custom_minimum_size = Vector2(110, 154)
var def_id := str(dto.get("cardDefinitionId", ""))
widget.card_pressed.connect(func(_d: String): _on_arch_spirit_selected(widget, def_id))
arch_spirit_grid.add_child(widget)
func _on_arch_spirit_selected(tapped_widget, def_id: String) -> void:
_selected_arch_spirit_id = def_id
arch_spirit_hint.visible = false
# Deselect all, select tapped
for child in arch_spirit_grid.get_children():
child.set_selected(false)
tapped_widget.set_selected(true)
_update_create_btn()
func _on_name_changed(_text: String) -> void:
_update_create_btn()
func _update_create_btn() -> void:
create_btn.disabled = deck_name_input.text.strip_edges().is_empty() \
or _selected_arch_spirit_id.is_empty()
func _on_create_deck() -> void:
var name_val := deck_name_input.text.strip_edges()
if name_val.is_empty() or _selected_arch_spirit_id.is_empty():
return
create_btn.disabled = true
Network.request(
"collection.create_deck",
{ "name": name_val, "archSpiritCardDefinitionId": _selected_arch_spirit_id },
func(_t: String, _p: Variant): _on_deck_created(),
func(_code: String, msg: String): _on_mutate_error(msg)
)
func _on_deck_created() -> void:
new_deck_form.visible = false
new_deck_btn.visible = true
_clear_arch_spirit_grid()
_load_decks()
# ── Rename / Delete / Clone ───────────────────────────────────────────────────
func _on_rename_requested(deck_id: String, new_name: String) -> void:
Network.request(
"collection.rename_deck",
{ "deckId": deck_id, "name": new_name },
func(_t: String, _p: Variant): _load_decks(),
func(_code: String, msg: String): _on_mutate_error(msg)
)
func _on_delete_requested(deck_id: String, deck_name: String) -> void:
_pending_delete_id = deck_id
_pending_delete_name = deck_name
confirm_dialog.dialog_text = "Delete \"%s\"? This cannot be undone." % deck_name
confirm_dialog.popup_centered()
func _on_delete_confirmed() -> void:
if _pending_delete_id.is_empty():
return
Network.request(
"collection.delete_deck",
{ "deckId": _pending_delete_id },
func(_t: String, _p: Variant): _load_decks(),
func(_code: String, msg: String): _on_mutate_error(msg)
)
_pending_delete_id = ""
_pending_delete_name = ""
func _on_clone_requested(deck_id: String) -> void:
Network.request(
"collection.clone_deck",
{ "deckId": deck_id },
func(_t: String, _p: Variant): _load_decks(),
func(_code: String, msg: String): _on_mutate_error(msg)
)
func _on_mutate_error(msg: String) -> void:
push_warning("DecksView mutate: %s" % msg)
_load_decks()
# ── Status helper ─────────────────────────────────────────────────────────────
## Pass a bool (is_empty) + the desired state string, or just a string "loading".
func _set_status(first_arg, second_arg = null) -> void:
if second_arg == null:
# Called as _set_status("loading")
var state: String = first_arg
loading_label.visible = (state == "loading")
empty_label.visible = false
else:
# Called as _set_status(is_empty, "empty")
loading_label.visible = false
empty_label.visible = bool(first_arg)
@@ -103,6 +103,7 @@ layout_mode = 2
theme_override_constants/separation = 10
[node name="CollectionBtn" type="Button" parent="Layout/Scroll/Content/ContentMargin/ContentInner/NavButtons"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(0, 52)
text = "My Collection"
@@ -7,9 +7,10 @@ extends Control
## If auth.hello re-validation fails after a reconnect (expired session),
## Auth.auth_failed fires and we redirect back to the login screen.
@onready var welcome_label : Label = %WelcomeLabel
@onready var status_label : Label = %StatusLabel
@onready var logout_btn : Button = %LogoutBtn
@onready var welcome_label : Label = %WelcomeLabel
@onready var status_label : Label = %StatusLabel
@onready var logout_btn : Button = %LogoutBtn
@onready var collection_btn : Button = %CollectionBtn
# ── Lifecycle ─────────────────────────────────────────────────────────────────
@@ -20,6 +21,8 @@ func _ready() -> void:
Network.disconnected.connect(_update_status)
Auth.auth_failed.connect(_on_auth_failed)
logout_btn.pressed.connect(_on_logout_pressed)
collection_btn.pressed.connect(func():
get_tree().change_scene_to_file("res://scenes/collection/CollectionScreen.tscn"))
_update_status()