Standardize programmatic UI to scene-based instantiation (Phases 1-5)
Convert all screens that built UI nodes in GDScript into proper .tscn
scene files. Each component gets its own scene; parent screens use
preload + instantiate; data flows through setup() methods; actions use
signals. Eliminates ~1000 lines of boilerplate node-creation code.
Phase 1 — Simple row components (6 new scenes):
LeaderboardRow, NotificationRow, StarterDeckCard, DeckPickerButton,
StatRow, AbilityRow
Modifies: leaderboard_screen, account_screen, starter_deck_screen,
matchmaking_screen, card_detail_popup (GridContainer→VBox)
Phase 2 — Lobby browser rows (2 new scenes):
LobbyBrowserRow (signal join_requested), ActiveGameRow (signal spectate_requested)
Modifies: free_play_screen
Phase 3 — RulesEditorDialog (1 new scene):
Replaces 150+ line _open_rules_editor() in lobby_room_screen with
4-line instantiate pattern; signal confirmed(overrides)
Phase 4 — DeckEditorPanel.tscn:
Moves split-pane deck editor into scene file; removes _setup_ui(),
_make_left_pane(), _make_right_pane(); switches to @onready refs;
DecksView.tscn updated to instance the scene
Phase 5 — ChatOverlay.tscn:
Fully populates ChatPanel with header, 7 tab buttons, 7 content panes
(FriendsPane/PresencePane/GlobalPane/LobbyPane/GamePane/PartyPane/DmsPane),
and InputBar; removes _build_panel() and all _make_*/_build_*_tab()
functions from chat_overlay.gd; replaces with @onready refs and
_ready() wiring from scene children
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:
@@ -0,0 +1,20 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/collection/components/ability_row.gd" id="1_ar"]
|
||||
|
||||
[node name="AbilityRow" type="VBoxContainer"]
|
||||
theme_override_constants/separation = 2
|
||||
script = ExtResource("1_ar")
|
||||
|
||||
[node name="NameLabel" type="Label" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 13
|
||||
modulate = Color(0.90, 0.80, 0.50, 1)
|
||||
|
||||
[node name="DescLabel" type="Label" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
autowrap_mode = 2
|
||||
modulate = Color(0.80, 0.80, 0.85, 1)
|
||||
theme_override_font_sizes/font_size = 12
|
||||
@@ -117,12 +117,10 @@ theme_override_font_sizes/font_size = 13
|
||||
[node name="StatsSep" type="HSeparator" parent="Center/Panel/Scroll/Inner/VBox"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="StatsGrid" type="GridContainer" parent="Center/Panel/Scroll/Inner/VBox"]
|
||||
[node name="StatsGrid" type="VBoxContainer" parent="Center/Panel/Scroll/Inner/VBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_constants/h_separation = 8
|
||||
theme_override_constants/v_separation = 6
|
||||
columns = 4
|
||||
theme_override_constants/separation = 4
|
||||
|
||||
[node name="AbilitiesSep" type="HSeparator" parent="Center/Panel/Scroll/Inner/VBox"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/collection/components/deck_editor_panel.gd" id="1_dep"]
|
||||
|
||||
[node name="DeckEditorPanel" type="VBoxContainer"]
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 0
|
||||
script = ExtResource("1_dep")
|
||||
|
||||
[node name="TopPanel" type="PanelContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TopMargin" type="MarginContainer" parent="TopPanel"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 10
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_top = 8
|
||||
theme_override_constants/margin_bottom = 8
|
||||
|
||||
[node name="TopBar" type="HBoxContainer" parent="TopPanel/TopMargin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="BackBtn" type="Button" parent="TopPanel/TopMargin/TopBar"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
custom_minimum_size = Vector2(80, 32)
|
||||
text = "◄ Back"
|
||||
|
||||
[node name="TitleLabel" type="Label" parent="TopPanel/TopMargin/TopBar"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Editing deck"
|
||||
text_overrun_behavior = 3
|
||||
theme_override_font_sizes/font_size = 15
|
||||
|
||||
[node name="CountLabel" type="Label" parent="TopPanel/TopMargin/TopBar"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "0 / 40"
|
||||
modulate = Color(0.75, 0.75, 0.8, 1)
|
||||
theme_override_font_sizes/font_size = 13
|
||||
|
||||
[node name="Split" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="Left" type="VBoxContainer" parent="Split"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/separation = 4
|
||||
|
||||
[node name="LeftMargin" type="MarginContainer" parent="Split/Left"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/margin_left = 8
|
||||
theme_override_constants/margin_right = 8
|
||||
theme_override_constants/margin_top = 6
|
||||
theme_override_constants/margin_bottom = 6
|
||||
|
||||
[node name="LeftInner" type="VBoxContainer" parent="Split/Left/LeftMargin"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 4
|
||||
|
||||
[node name="LeftHeader" type="Label" parent="Split/Left/LeftMargin/LeftInner"]
|
||||
layout_mode = 2
|
||||
text = "Deck Contents"
|
||||
modulate = Color(0.8, 0.8, 0.85, 1)
|
||||
theme_override_font_sizes/font_size = 13
|
||||
|
||||
[node name="DeckLoadingLabel" type="Label" parent="Split/Left/LeftMargin/LeftInner"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
visible = false
|
||||
text = "Loading…"
|
||||
modulate = Color(0.65, 0.65, 0.7, 1)
|
||||
theme_override_font_sizes/font_size = 12
|
||||
|
||||
[node name="DeckScroll" type="ScrollContainer" parent="Split/Left/LeftMargin/LeftInner"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
horizontal_scroll_mode = 0
|
||||
|
||||
[node name="DeckCardList" type="VBoxContainer" parent="Split/Left/LeftMargin/LeftInner/DeckScroll"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/separation = 2
|
||||
|
||||
[node name="VSep" type="VSeparator" parent="Split"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Right" type="VBoxContainer" parent="Split"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/separation = 4
|
||||
|
||||
[node name="RightMargin" type="MarginContainer" parent="Split/Right"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/margin_left = 8
|
||||
theme_override_constants/margin_right = 8
|
||||
theme_override_constants/margin_top = 6
|
||||
theme_override_constants/margin_bottom = 6
|
||||
|
||||
[node name="RightInner" type="VBoxContainer" parent="Split/Right/RightMargin"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 4
|
||||
|
||||
[node name="RightHeader" type="Label" parent="Split/Right/RightMargin/RightInner"]
|
||||
layout_mode = 2
|
||||
text = "Add Cards"
|
||||
modulate = Color(0.8, 0.8, 0.85, 1)
|
||||
theme_override_font_sizes/font_size = 13
|
||||
|
||||
[node name="SearchBar" type="HBoxContainer" parent="Split/Right/RightMargin/RightInner"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 4
|
||||
|
||||
[node name="SearchInput" type="LineEdit" parent="Split/Right/RightMargin/RightInner/SearchBar"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
custom_minimum_size = Vector2(0, 30)
|
||||
placeholder_text = "Search…"
|
||||
theme_override_font_sizes/font_size = 13
|
||||
|
||||
[node name="TypeOption" type="OptionButton" parent="Split/Right/RightMargin/RightInner/SearchBar"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
custom_minimum_size = Vector2(110, 30)
|
||||
theme_override_font_sizes/font_size = 12
|
||||
|
||||
[node name="CollLoadingLabel" type="Label" parent="Split/Right/RightMargin/RightInner"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
visible = false
|
||||
text = "Loading…"
|
||||
modulate = Color(0.65, 0.65, 0.7, 1)
|
||||
theme_override_font_sizes/font_size = 12
|
||||
|
||||
[node name="CollScroll" type="ScrollContainer" parent="Split/Right/RightMargin/RightInner"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
horizontal_scroll_mode = 0
|
||||
|
||||
[node name="CollList" type="VBoxContainer" parent="Split/Right/RightMargin/RightInner/CollScroll"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/separation = 2
|
||||
|
||||
[node name="LoadMoreBtn" type="Button" parent="Split/Right/RightMargin/RightInner"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
visible = false
|
||||
text = "Load More"
|
||||
@@ -0,0 +1,18 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/collection/components/stat_row.gd" id="1_sr"]
|
||||
|
||||
[node name="StatRow" type="HBoxContainer"]
|
||||
theme_override_constants/separation = 8
|
||||
script = ExtResource("1_sr")
|
||||
|
||||
[node name="KeyLabel" type="Label" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
custom_minimum_size = Vector2(72, 0)
|
||||
modulate = Color(0.65, 0.65, 0.72, 1)
|
||||
|
||||
[node name="ValueLabel" type="Label" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
@@ -0,0 +1,11 @@
|
||||
extends VBoxContainer
|
||||
## Single ability row used in CardDetailPopup.
|
||||
|
||||
@onready var name_label : Label = %NameLabel
|
||||
@onready var desc_label : Label = %DescLabel
|
||||
|
||||
|
||||
func setup(ability_name: String, description: String) -> void:
|
||||
name_label.text = "[%s]" % ability_name
|
||||
desc_label.text = description
|
||||
desc_label.visible = not description.is_empty()
|
||||
@@ -8,6 +8,8 @@ extends Control
|
||||
## above the VBoxContainer layout regardless of scene structure.
|
||||
|
||||
const _CardWidget = preload("res://scenes/collection/components/card_widget.gd")
|
||||
const _StatRow = preload("res://scenes/collection/components/StatRow.tscn")
|
||||
const _AbilityRow = preload("res://scenes/collection/components/AbilityRow.tscn")
|
||||
|
||||
const RARITY_COLOR := {
|
||||
"Common": Color(0.67, 0.67, 0.67),
|
||||
@@ -27,7 +29,7 @@ const RARITY_COLOR := {
|
||||
@onready var type_label : Label = %TypeLabel
|
||||
@onready var affinity_label : Label = %AffinityLabel
|
||||
@onready var rarity_label : Label = %RarityLabel
|
||||
@onready var stats_grid : GridContainer = %StatsGrid
|
||||
@onready var stats_grid : VBoxContainer = %StatsGrid
|
||||
@onready var abilities_sep : HSeparator = %AbilitiesSep
|
||||
@onready var abilities_title: Label = %AbilitiesTitle
|
||||
@onready var abilities_list : VBoxContainer = %AbilitiesList
|
||||
@@ -81,29 +83,18 @@ func _populate_stats(def: Dictionary) -> void:
|
||||
var dfs : Variant = def.get("maxDefense", null)
|
||||
var mov : Variant = def.get("movementPoints", null)
|
||||
|
||||
_add_stat("Spirit", "◆ %s" % (str(sp) if sp != null else "—"))
|
||||
if st != null and int(st) > 0:
|
||||
_add_stat("Stamina", "⚡ %s" % str(st))
|
||||
else:
|
||||
_add_stat("Stamina", "—")
|
||||
_add_stat("Damage", "⚔ %s" % (str(dmg) if dmg != null else "—"))
|
||||
_add_stat("Health", "♥ %s" % (str(hp) if hp != null else "—"))
|
||||
_add_stat("Defense", "▲ %s" % (str(dfs) if dfs != null else "—"))
|
||||
_add_stat("Move", str(mov) if mov != null else "—")
|
||||
_add_stat("Spirit", "◆ %s" % (str(sp) if sp != null else "—"))
|
||||
_add_stat("Stamina", "⚡ %s" % str(st) if (st != null and int(st) > 0) else "—")
|
||||
_add_stat("Damage", "⚔ %s" % (str(dmg) if dmg != null else "—"))
|
||||
_add_stat("Health", "♥ %s" % (str(hp) if hp != null else "—"))
|
||||
_add_stat("Defense", "▲ %s" % (str(dfs) if dfs != null else "—"))
|
||||
_add_stat("Move", str(mov) if mov != null else "—")
|
||||
|
||||
|
||||
func _add_stat(label_text: String, value_text: String) -> void:
|
||||
var lbl := Label.new()
|
||||
lbl.text = label_text
|
||||
lbl.modulate = Color(0.65, 0.65, 0.72)
|
||||
#lbl.theme_override_font_sizes["font_size"] = 12
|
||||
|
||||
var val := Label.new()
|
||||
val.text = value_text
|
||||
#val.theme_override_font_sizes["font_size"] = 13
|
||||
|
||||
stats_grid.add_child(lbl)
|
||||
stats_grid.add_child(val)
|
||||
func _add_stat(key: String, value: String) -> void:
|
||||
var row := _StatRow.instantiate()
|
||||
row.setup(key, value)
|
||||
stats_grid.add_child(row)
|
||||
|
||||
|
||||
func _populate_abilities(def: Dictionary) -> void:
|
||||
@@ -128,27 +119,12 @@ func _populate_abilities(def: Dictionary) -> void:
|
||||
for ab in parsed as Array:
|
||||
if typeof(ab) != TYPE_DICTIONARY:
|
||||
continue
|
||||
var d := ab as Dictionary
|
||||
var d := ab as Dictionary
|
||||
var name_ := str(d.get("name", d.get("Name", "")))
|
||||
var desc := str(d.get("description", d.get("Description", "")))
|
||||
|
||||
var row := VBoxContainer.new()
|
||||
row.add_theme_constant_override("separation", 2)
|
||||
|
||||
var name_lbl := Label.new()
|
||||
name_lbl.text = "[%s]" % name_
|
||||
name_lbl.add_theme_font_size_override("font_size", 13)
|
||||
name_lbl.modulate = Color(0.90, 0.80, 0.50)
|
||||
row.add_child(name_lbl)
|
||||
|
||||
if not desc.is_empty():
|
||||
var desc_lbl := Label.new()
|
||||
desc_lbl.text = desc
|
||||
desc_lbl.add_theme_font_size_override("font_size", 12)
|
||||
desc_lbl.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
desc_lbl.modulate = Color(0.80, 0.80, 0.85)
|
||||
row.add_child(desc_lbl)
|
||||
|
||||
var row := _AbilityRow.instantiate()
|
||||
row.setup(name_, desc)
|
||||
abilities_list.add_child(row)
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
extends VBoxContainer
|
||||
## Deck editor panel — add/remove cards from an existing deck.
|
||||
##
|
||||
## The entire UI is built programmatically in _setup_ui() so no separate
|
||||
## .tscn is needed. Embed this script on a VBoxContainer node in DecksView.
|
||||
##
|
||||
## Usage:
|
||||
## call open_deck(deck_id, deck_name) to load a deck for editing.
|
||||
## connect back_pressed to return to the deck list.
|
||||
@@ -12,17 +9,17 @@ signal back_pressed()
|
||||
|
||||
const PAGE_SIZE := 100
|
||||
|
||||
# ── Node refs (created in _setup_ui) ─────────────────────────────────────────
|
||||
# ── Node refs ─────────────────────────────────────────────────────────────────
|
||||
|
||||
var _title_lbl : Label
|
||||
var _count_lbl : Label
|
||||
var _deck_loading_lbl : Label
|
||||
var _deck_card_list : VBoxContainer
|
||||
var _search_input : LineEdit
|
||||
var _type_option : OptionButton
|
||||
var _coll_loading_lbl : Label
|
||||
var _coll_list : VBoxContainer
|
||||
var _load_more_btn : Button
|
||||
@onready var _title_lbl : Label = %TitleLabel
|
||||
@onready var _count_lbl : Label = %CountLabel
|
||||
@onready var _deck_loading_lbl : Label = %DeckLoadingLabel
|
||||
@onready var _deck_card_list : VBoxContainer = %DeckCardList
|
||||
@onready var _search_input : LineEdit = %SearchInput
|
||||
@onready var _type_option : OptionButton = %TypeOption
|
||||
@onready var _coll_loading_lbl : Label = %CollLoadingLabel
|
||||
@onready var _coll_list : VBoxContainer = %CollList
|
||||
@onready var _load_more_btn : Button = %LoadMoreBtn
|
||||
|
||||
# ── State ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -42,7 +39,11 @@ const _DEBOUNCE := 0.4
|
||||
# ── Lifecycle ─────────────────────────────────────────────────────────────────
|
||||
|
||||
func _ready() -> void:
|
||||
_setup_ui()
|
||||
%BackBtn.pressed.connect(func(): back_pressed.emit())
|
||||
_search_input.text_changed.connect(_on_search_changed)
|
||||
_type_option.item_selected.connect(func(_i): _reload_collection())
|
||||
_load_more_btn.pressed.connect(_on_load_more)
|
||||
_populate_type_options()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
@@ -52,175 +53,6 @@ func _process(delta: float) -> void:
|
||||
_search_timer = 0.0
|
||||
_reload_collection()
|
||||
|
||||
# ── UI construction ───────────────────────────────────────────────────────────
|
||||
|
||||
func _setup_ui() -> void:
|
||||
size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
add_theme_constant_override("separation", 0)
|
||||
|
||||
# Top bar
|
||||
var top_panel := PanelContainer.new()
|
||||
var top_margin := MarginContainer.new()
|
||||
top_margin.add_theme_constant_override("margin_left", 10)
|
||||
top_margin.add_theme_constant_override("margin_right", 10)
|
||||
top_margin.add_theme_constant_override("margin_top", 8)
|
||||
top_margin.add_theme_constant_override("margin_bottom", 8)
|
||||
top_panel.add_child(top_margin)
|
||||
|
||||
var top_bar := HBoxContainer.new()
|
||||
top_bar.add_theme_constant_override("separation", 8)
|
||||
top_margin.add_child(top_bar)
|
||||
|
||||
var back_btn := Button.new()
|
||||
back_btn.text = "◄ Back"
|
||||
back_btn.custom_minimum_size = Vector2(80, 32)
|
||||
back_btn.pressed.connect(func(): back_pressed.emit())
|
||||
top_bar.add_child(back_btn)
|
||||
|
||||
_title_lbl = Label.new()
|
||||
_title_lbl.text = "Editing deck"
|
||||
_title_lbl.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
_title_lbl.add_theme_font_size_override("font_size", 15)
|
||||
_title_lbl.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
||||
top_bar.add_child(_title_lbl)
|
||||
|
||||
_count_lbl = Label.new()
|
||||
_count_lbl.text = "0 / 40"
|
||||
_count_lbl.add_theme_font_size_override("font_size", 13)
|
||||
_count_lbl.modulate = Color(0.75, 0.75, 0.8)
|
||||
top_bar.add_child(_count_lbl)
|
||||
|
||||
add_child(top_panel)
|
||||
|
||||
# Split area
|
||||
var split := HBoxContainer.new()
|
||||
split.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
split.add_theme_constant_override("separation", 0)
|
||||
|
||||
var left := _make_left_pane()
|
||||
left.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
split.add_child(left)
|
||||
|
||||
var vsep := VSeparator.new()
|
||||
split.add_child(vsep)
|
||||
|
||||
var right := _make_right_pane()
|
||||
right.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
split.add_child(right)
|
||||
|
||||
add_child(split)
|
||||
|
||||
|
||||
func _make_left_pane() -> VBoxContainer:
|
||||
var pane := VBoxContainer.new()
|
||||
pane.add_theme_constant_override("separation", 4)
|
||||
|
||||
var margin := MarginContainer.new()
|
||||
margin.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
margin.add_theme_constant_override("margin_left", 8)
|
||||
margin.add_theme_constant_override("margin_right", 8)
|
||||
margin.add_theme_constant_override("margin_top", 6)
|
||||
margin.add_theme_constant_override("margin_bottom", 6)
|
||||
pane.add_child(margin)
|
||||
|
||||
var inner := VBoxContainer.new()
|
||||
inner.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
inner.add_theme_constant_override("separation", 4)
|
||||
margin.add_child(inner)
|
||||
|
||||
var hdr := Label.new()
|
||||
hdr.text = "Deck Contents"
|
||||
hdr.add_theme_font_size_override("font_size", 13)
|
||||
hdr.modulate = Color(0.8, 0.8, 0.85)
|
||||
inner.add_child(hdr)
|
||||
|
||||
_deck_loading_lbl = Label.new()
|
||||
_deck_loading_lbl.text = "Loading…"
|
||||
_deck_loading_lbl.modulate = Color(0.65, 0.65, 0.7)
|
||||
_deck_loading_lbl.add_theme_font_size_override("font_size", 12)
|
||||
_deck_loading_lbl.visible = false
|
||||
inner.add_child(_deck_loading_lbl)
|
||||
|
||||
var scroll := ScrollContainer.new()
|
||||
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
|
||||
inner.add_child(scroll)
|
||||
|
||||
_deck_card_list = VBoxContainer.new()
|
||||
_deck_card_list.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
_deck_card_list.add_theme_constant_override("separation", 2)
|
||||
scroll.add_child(_deck_card_list)
|
||||
|
||||
return pane
|
||||
|
||||
|
||||
func _make_right_pane() -> VBoxContainer:
|
||||
var pane := VBoxContainer.new()
|
||||
pane.add_theme_constant_override("separation", 4)
|
||||
|
||||
var margin := MarginContainer.new()
|
||||
margin.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
margin.add_theme_constant_override("margin_left", 8)
|
||||
margin.add_theme_constant_override("margin_right", 8)
|
||||
margin.add_theme_constant_override("margin_top", 6)
|
||||
margin.add_theme_constant_override("margin_bottom", 6)
|
||||
pane.add_child(margin)
|
||||
|
||||
var inner := VBoxContainer.new()
|
||||
inner.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
inner.add_theme_constant_override("separation", 4)
|
||||
margin.add_child(inner)
|
||||
|
||||
var hdr := Label.new()
|
||||
hdr.text = "Add Cards"
|
||||
hdr.add_theme_font_size_override("font_size", 13)
|
||||
hdr.modulate = Color(0.8, 0.8, 0.85)
|
||||
inner.add_child(hdr)
|
||||
|
||||
var search_bar := HBoxContainer.new()
|
||||
search_bar.add_theme_constant_override("separation", 4)
|
||||
inner.add_child(search_bar)
|
||||
|
||||
_search_input = LineEdit.new()
|
||||
_search_input.placeholder_text = "Search…"
|
||||
_search_input.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
_search_input.custom_minimum_size = Vector2(0, 30)
|
||||
_search_input.add_theme_font_size_override("font_size", 13)
|
||||
_search_input.text_changed.connect(_on_search_changed)
|
||||
search_bar.add_child(_search_input)
|
||||
|
||||
_type_option = OptionButton.new()
|
||||
_type_option.custom_minimum_size = Vector2(110, 30)
|
||||
_type_option.add_theme_font_size_override("font_size", 12)
|
||||
_type_option.item_selected.connect(func(_i): _reload_collection())
|
||||
_populate_type_options()
|
||||
search_bar.add_child(_type_option)
|
||||
|
||||
_coll_loading_lbl = Label.new()
|
||||
_coll_loading_lbl.text = "Loading…"
|
||||
_coll_loading_lbl.modulate = Color(0.65, 0.65, 0.7)
|
||||
_coll_loading_lbl.add_theme_font_size_override("font_size", 12)
|
||||
_coll_loading_lbl.visible = false
|
||||
inner.add_child(_coll_loading_lbl)
|
||||
|
||||
var scroll := ScrollContainer.new()
|
||||
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
|
||||
inner.add_child(scroll)
|
||||
|
||||
_coll_list = VBoxContainer.new()
|
||||
_coll_list.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
_coll_list.add_theme_constant_override("separation", 2)
|
||||
scroll.add_child(_coll_list)
|
||||
|
||||
_load_more_btn = Button.new()
|
||||
_load_more_btn.text = "Load More"
|
||||
_load_more_btn.visible = false
|
||||
_load_more_btn.pressed.connect(_on_load_more)
|
||||
inner.add_child(_load_more_btn)
|
||||
|
||||
return pane
|
||||
|
||||
|
||||
func _populate_type_options() -> void:
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
extends HBoxContainer
|
||||
## Single stat key/value row used in CardDetailPopup.
|
||||
|
||||
@onready var key_label : Label = %KeyLabel
|
||||
@onready var value_label : Label = %ValueLabel
|
||||
|
||||
|
||||
func setup(key: String, value: String) -> void:
|
||||
key_label.text = key
|
||||
value_label.text = value
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=3 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/collection/views/decks_view.gd" id="1_dv"]
|
||||
[ext_resource type="Script" path="res://scenes/collection/components/deck_editor_panel.gd" id="2_dep"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/collection/components/DeckEditorPanel.tscn" id="2_dep"]
|
||||
|
||||
[node name="DecksView" type="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
@@ -143,12 +143,11 @@ visible = false
|
||||
modulate = Color(0.6, 0.6, 0.65, 1.0)
|
||||
theme_override_font_sizes/font_size = 14
|
||||
|
||||
[node name="DeckEditorPanel" type="VBoxContainer" parent="."]
|
||||
[node name="DeckEditorPanel" parent="." instance=ExtResource("2_dep")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
visible = false
|
||||
script = ExtResource("2_dep")
|
||||
|
||||
[node name="ConfirmDialog" type="ConfirmationDialog" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
||||
Reference in New Issue
Block a user