Files
sor/Client/origin-client/scenes/account/account_screen.gd
T
b1a51cb862 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>
2026-03-21 12:33:15 -04:00

85 lines
2.9 KiB
GDScript

extends Control
## Account Management screen.
const NOTIF_ROW = preload("res://scenes/account/components/NotificationRow.tscn")
## Shows the player's own profile (display name, OP, rank score)
## and a mailbox tab with admin responses to bug reports.
@onready var back_btn : Button = %BackBtn
@onready var display_label : Label = %DisplayLabel
@onready var op_label : Label = %OpLabel
@onready var rank_label : Label = %RankLabel
@onready var mailbox_list : VBoxContainer = %MailboxList
@onready var loading_label : Label = %LoadingLabel
@onready var empty_label : Label = %EmptyLabel
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
back_btn.pressed.connect(_on_back)
_load_profile()
_load_notifications()
# ── Profile ───────────────────────────────────────────────────────────────────
func _load_profile() -> void:
display_label.text = Auth.display_name
op_label.text = "◆ — OP"
rank_label.text = "Rank: —"
Network.request(
"account.get_profile",
{},
func(_type: String, p: Variant): _on_profile_ok(p),
func(_c: String, _m: String): pass
)
func _on_profile_ok(p: Variant) -> void:
var d := p as Dictionary
op_label.text = "◆ %d OP" % int(d.get("originPoints", 0))
rank_label.text = "Rank Score: %d" % int(d.get("rankScore", 1000))
# ── Notifications (mailbox) ────────────────────────────────────────────────────
func _load_notifications() -> void:
loading_label.visible = true
empty_label.visible = false
for c in mailbox_list.get_children():
c.queue_free()
Network.request(
"chat.get_notifications",
{ "unreadOnly": false },
func(_type: String, p: Variant): _on_notifications_ok(p),
func(_c: String, _m: String):
loading_label.text = "Failed to load mailbox."
)
func _on_notifications_ok(p: Variant) -> void:
loading_label.visible = false
var notifs : Array = (p as Dictionary).get("notifications", []) as Array
if notifs.is_empty():
empty_label.visible = true
return
for n in notifs:
var nd := n as Dictionary
var row := NOTIF_ROW.instantiate()
row.setup(
nd.get("title", "Notification"),
nd.get("body", ""),
nd.get("readAt", null) == null
)
mailbox_list.add_child(row)
# ── Navigation ────────────────────────────────────────────────────────────────
func _on_back() -> void:
get_tree().change_scene_to_file("res://scenes/main/MainScreen.tscn")