Add Settings, Account, Bug Reports, and Leaderboard
Server: - New SOR.Support project: SubmitBugReport, GetLeaderboard, GetAccountProfile handlers - New SOR.Database support schema: BugReport + BugReportResponse entities + SupportDbContext - EF migration: Migrations/Support/AddSupport - Admin panel: Bug Reports list + detail pages with reply-to-submitter flow - Admin NavMenu: Support section with Bug Reports link - Reply creates chat.Notification (type "admin_response") for in-game mailbox Client: - Settings autoload (Settings.gd): music/sfx volume+mute, persisted to user://settings.cfg - SettingsScreen: sliders + mute CheckButtons wired to Settings autoload - AccountScreen: profile (display name, OP, rank score) + mailbox (admin_response notifications) - LeaderboardScreen: paginated ranked player list, caller highlighted in blue - BugReportDialog: category/title/description/steps form, submits via support.submit_bug_report - MainScreen: new Leaderboard, Account, Settings, Report a Bug navigation buttons 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,139 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/account/account_screen.gd" id="1_acc"]
|
||||
|
||||
[node name="AccountScreen" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_acc")
|
||||
|
||||
[node name="Background" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0.094, 0.094, 0.137, 1.0)
|
||||
|
||||
[node name="Layout" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="TopBar" type="MarginContainer" parent="Layout"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 16
|
||||
theme_override_constants/margin_right = 16
|
||||
theme_override_constants/margin_top = 8
|
||||
theme_override_constants/margin_bottom = 8
|
||||
|
||||
[node name="TopBarInner" type="HBoxContainer" parent="Layout/TopBar"]
|
||||
layout_mode = 2
|
||||
custom_minimum_size = Vector2(0, 40)
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="BackBtn" type="Button" parent="Layout/TopBar/TopBarInner"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
custom_minimum_size = Vector2(40, 40)
|
||||
text = "←"
|
||||
theme_override_font_sizes/font_size = 18
|
||||
|
||||
[node name="TitleLabel" type="Label" parent="Layout/TopBar/TopBarInner"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Account"
|
||||
vertical_alignment = 1
|
||||
theme_override_font_sizes/font_size = 18
|
||||
|
||||
[node name="HSep" type="HSeparator" parent="Layout"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Scroll" type="ScrollContainer" parent="Layout"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
horizontal_scroll_mode = 0
|
||||
|
||||
[node name="Content" type="VBoxContainer" parent="Layout/Scroll"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ContentMargin" type="MarginContainer" parent="Layout/Scroll/Content"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_right = 20
|
||||
theme_override_constants/margin_top = 20
|
||||
theme_override_constants/margin_bottom = 20
|
||||
|
||||
[node name="Sections" type="VBoxContainer" parent="Layout/Scroll/Content/ContentMargin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 24
|
||||
|
||||
[node name="ProfileSection" type="VBoxContainer" parent="Layout/Scroll/Content/ContentMargin/Sections"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="ProfileLabel" type="Label" parent="Layout/Scroll/Content/ContentMargin/Sections/ProfileSection"]
|
||||
layout_mode = 2
|
||||
text = "PROFILE"
|
||||
modulate = Color(0.6, 0.6, 0.65, 1.0)
|
||||
theme_override_font_sizes/font_size = 11
|
||||
|
||||
[node name="DisplayLabel" type="Label" parent="Layout/Scroll/Content/ContentMargin/Sections/ProfileSection"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "—"
|
||||
theme_override_font_sizes/font_size = 22
|
||||
|
||||
[node name="OpLabel" type="Label" parent="Layout/Scroll/Content/ContentMargin/Sections/ProfileSection"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "◆ — OP"
|
||||
modulate = Color(0.95, 0.85, 0.30, 1.0)
|
||||
theme_override_font_sizes/font_size = 15
|
||||
|
||||
[node name="RankLabel" type="Label" parent="Layout/Scroll/Content/ContentMargin/Sections/ProfileSection"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Rank: —"
|
||||
modulate = Color(0.7, 0.7, 0.75, 1.0)
|
||||
theme_override_font_sizes/font_size = 14
|
||||
|
||||
[node name="MailboxSection" type="VBoxContainer" parent="Layout/Scroll/Content/ContentMargin/Sections"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="MailboxLabel" type="Label" parent="Layout/Scroll/Content/ContentMargin/Sections/MailboxSection"]
|
||||
layout_mode = 2
|
||||
text = "MAILBOX"
|
||||
modulate = Color(0.6, 0.6, 0.65, 1.0)
|
||||
theme_override_font_sizes/font_size = 11
|
||||
|
||||
[node name="LoadingLabel" type="Label" parent="Layout/Scroll/Content/ContentMargin/Sections/MailboxSection"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Loading…"
|
||||
modulate = Color(0.7, 0.7, 0.75, 1.0)
|
||||
theme_override_font_sizes/font_size = 13
|
||||
|
||||
[node name="EmptyLabel" type="Label" parent="Layout/Scroll/Content/ContentMargin/Sections/MailboxSection"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "No messages yet."
|
||||
visible = false
|
||||
modulate = Color(0.55, 0.55, 0.60, 1.0)
|
||||
theme_override_font_sizes/font_size = 13
|
||||
|
||||
[node name="MailboxList" type="VBoxContainer" parent="Layout/Scroll/Content/ContentMargin/Sections/MailboxSection"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 6
|
||||
@@ -0,0 +1,111 @@
|
||||
extends Control
|
||||
## Account Management screen.
|
||||
## 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 := _make_notification_row(nd)
|
||||
mailbox_list.add_child(row)
|
||||
|
||||
|
||||
func _make_notification_row(n: Dictionary) -> PanelContainer:
|
||||
var panel := PanelContainer.new()
|
||||
panel.custom_minimum_size = Vector2(0, 72)
|
||||
|
||||
var margin := MarginContainer.new()
|
||||
margin.add_theme_constant_override("margin_left", 12)
|
||||
margin.add_theme_constant_override("margin_right", 12)
|
||||
margin.add_theme_constant_override("margin_top", 8)
|
||||
margin.add_theme_constant_override("margin_bottom", 8)
|
||||
panel.add_child(margin)
|
||||
|
||||
var vbox := VBoxContainer.new()
|
||||
vbox.add_theme_constant_override("separation", 4)
|
||||
margin.add_child(vbox)
|
||||
|
||||
var title_lbl := Label.new()
|
||||
title_lbl.text = n.get("title", "Notification")
|
||||
title_lbl.add_theme_font_size_override("font_size", 13)
|
||||
vbox.add_child(title_lbl)
|
||||
|
||||
var body_lbl := Label.new()
|
||||
body_lbl.text = n.get("body", "")
|
||||
body_lbl.add_theme_font_size_override("font_size", 11)
|
||||
body_lbl.modulate = Color(0.7, 0.7, 0.75)
|
||||
body_lbl.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
vbox.add_child(body_lbl)
|
||||
|
||||
var is_unread : bool = n.get("readAt", null) == null
|
||||
if is_unread:
|
||||
title_lbl.modulate = Color(0.95, 0.85, 0.30)
|
||||
|
||||
return panel
|
||||
|
||||
|
||||
# ── Navigation ────────────────────────────────────────────────────────────────
|
||||
|
||||
func _on_back() -> void:
|
||||
get_tree().change_scene_to_file("res://scenes/main/MainScreen.tscn")
|
||||
Reference in New Issue
Block a user