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,23 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/starter_deck/components/starter_deck_card.gd" id="1_sdc"]
|
||||
|
||||
[node name="StarterDeckCard" type="Button"]
|
||||
focus_mode = 1
|
||||
size_flags_horizontal = 2
|
||||
script = ExtResource("1_sdc")
|
||||
|
||||
[node name="Inner" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 5
|
||||
|
||||
[node name="NameLabel" type="Label" parent="Inner"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
|
||||
[node name="SubtitleLabel" type="Label" parent="Inner"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
modulate = Color(0.7, 0.7, 0.8, 1)
|
||||
theme_override_font_sizes/font_size = 12
|
||||
@@ -0,0 +1,46 @@
|
||||
extends Button
|
||||
## Selectable starter deck card in the deck picker screen.
|
||||
|
||||
signal selected(id: String)
|
||||
|
||||
const SEL_COLOR := Color(0.36, 0.56, 1.0, 1.0)
|
||||
const DEF_COLOR := Color(0.25, 0.25, 0.35, 1.0)
|
||||
|
||||
@onready var name_label : Label = %NameLabel
|
||||
@onready var subtitle_label : Label = %SubtitleLabel
|
||||
|
||||
var _id : String = ""
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
pressed.connect(func(): selected.emit(_id))
|
||||
_apply_style(false)
|
||||
|
||||
|
||||
func setup(id: String, deck_name: String, subtitle: String) -> void:
|
||||
_id = id
|
||||
name_label.text = deck_name
|
||||
subtitle_label.text = subtitle
|
||||
|
||||
|
||||
func set_selected(v: bool) -> void:
|
||||
_apply_style(v)
|
||||
|
||||
|
||||
func _apply_style(sel: bool) -> void:
|
||||
var bg := Color(0.13, 0.13, 0.20, 1.0)
|
||||
var make := func(b: Color) -> StyleBoxFlat:
|
||||
var s := StyleBoxFlat.new()
|
||||
s.bg_color = b
|
||||
s.border_color = SEL_COLOR if sel else DEF_COLOR
|
||||
s.set_border_width_all(2)
|
||||
s.set_corner_radius_all(6)
|
||||
s.content_margin_left = 14
|
||||
s.content_margin_right = 14
|
||||
s.content_margin_top = 12
|
||||
s.content_margin_bottom = 12
|
||||
return s
|
||||
add_theme_stylebox_override("normal", make.call(bg))
|
||||
add_theme_stylebox_override("hover", make.call(Color(0.20, 0.20, 0.30, 1.0)))
|
||||
add_theme_stylebox_override("pressed", make.call(bg))
|
||||
add_theme_stylebox_override("focus", make.call(bg))
|
||||
Reference in New Issue
Block a user