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,150 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/leaderboard/leaderboard_screen.gd" id="1_lb"]
|
||||
|
||||
[node name="LeaderboardScreen" 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_lb")
|
||||
|
||||
[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 = "Leaderboard"
|
||||
vertical_alignment = 1
|
||||
theme_override_font_sizes/font_size = 18
|
||||
|
||||
[node name="HSep" type="HSeparator" parent="Layout"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HeaderRow" type="MarginContainer" parent="Layout"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_right = 20
|
||||
theme_override_constants/margin_top = 8
|
||||
theme_override_constants/margin_bottom = 4
|
||||
|
||||
[node name="HeaderInner" type="HBoxContainer" parent="Layout/HeaderRow"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 12
|
||||
|
||||
[node name="RankHeader" type="Label" parent="Layout/HeaderRow/HeaderInner"]
|
||||
layout_mode = 2
|
||||
custom_minimum_size = Vector2(48, 0)
|
||||
horizontal_alignment = 1
|
||||
text = "Rank"
|
||||
modulate = Color(0.6, 0.6, 0.65, 1.0)
|
||||
theme_override_font_sizes/font_size = 11
|
||||
|
||||
[node name="NameHeader" type="Label" parent="Layout/HeaderRow/HeaderInner"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Player"
|
||||
modulate = Color(0.6, 0.6, 0.65, 1.0)
|
||||
theme_override_font_sizes/font_size = 11
|
||||
|
||||
[node name="ScoreHeader" type="Label" parent="Layout/HeaderRow/HeaderInner"]
|
||||
layout_mode = 2
|
||||
custom_minimum_size = Vector2(80, 0)
|
||||
horizontal_alignment = 2
|
||||
text = "Score"
|
||||
modulate = Color(0.6, 0.6, 0.65, 1.0)
|
||||
theme_override_font_sizes/font_size = 11
|
||||
|
||||
[node name="HSep2" 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="ListMargin" type="MarginContainer" parent="Layout/Scroll"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_right = 20
|
||||
theme_override_constants/margin_top = 8
|
||||
theme_override_constants/margin_bottom = 8
|
||||
|
||||
[node name="EntryList" type="VBoxContainer" parent="Layout/Scroll/ListMargin"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/separation = 4
|
||||
|
||||
[node name="LoadingLabel" type="Label" parent="Layout/Scroll/ListMargin/EntryList"]
|
||||
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 = 14
|
||||
|
||||
[node name="PaginationRow" type="HBoxContainer" parent="Layout"]
|
||||
layout_mode = 2
|
||||
custom_minimum_size = Vector2(0, 44)
|
||||
alignment = 1
|
||||
theme_override_constants/separation = 12
|
||||
|
||||
[node name="PrevBtn" type="Button" parent="Layout/PaginationRow"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
custom_minimum_size = Vector2(80, 34)
|
||||
text = "← Prev"
|
||||
theme_override_font_sizes/font_size = 13
|
||||
|
||||
[node name="PageLabel" type="Label" parent="Layout/PaginationRow"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Page 1 / 1"
|
||||
vertical_alignment = 1
|
||||
modulate = Color(0.7, 0.7, 0.75, 1.0)
|
||||
theme_override_font_sizes/font_size = 13
|
||||
|
||||
[node name="NextBtn" type="Button" parent="Layout/PaginationRow"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
custom_minimum_size = Vector2(80, 34)
|
||||
text = "Next →"
|
||||
theme_override_font_sizes/font_size = 13
|
||||
@@ -0,0 +1,105 @@
|
||||
extends Control
|
||||
## Leaderboard screen — top players ranked by RankScore.
|
||||
|
||||
@onready var back_btn : Button = %BackBtn
|
||||
@onready var entry_list : VBoxContainer = %EntryList
|
||||
@onready var loading_lbl : Label = %LoadingLabel
|
||||
@onready var prev_btn : Button = %PrevBtn
|
||||
@onready var next_btn : Button = %NextBtn
|
||||
@onready var page_label : Label = %PageLabel
|
||||
|
||||
const PAGE_SIZE := 25
|
||||
|
||||
var _page : int = 0
|
||||
var _total : int = 0
|
||||
var _page_count : int = 1
|
||||
|
||||
# ── Lifecycle ─────────────────────────────────────────────────────────────────
|
||||
|
||||
func _ready() -> void:
|
||||
back_btn.pressed.connect(_on_back)
|
||||
prev_btn.pressed.connect(func(): _go_page(_page - 1))
|
||||
next_btn.pressed.connect(func(): _go_page(_page + 1))
|
||||
_load_page(0)
|
||||
|
||||
|
||||
# ── Loading ───────────────────────────────────────────────────────────────────
|
||||
|
||||
func _load_page(page: int) -> void:
|
||||
_page = page
|
||||
loading_lbl.visible = true
|
||||
for c in entry_list.get_children():
|
||||
c.queue_free()
|
||||
|
||||
Network.request(
|
||||
"leaderboard.get",
|
||||
{ "page": _page, "pageSize": PAGE_SIZE },
|
||||
func(_type: String, p: Variant): _on_leaderboard_ok(p),
|
||||
func(_c: String, _m: String):
|
||||
loading_lbl.text = "Failed to load."
|
||||
)
|
||||
|
||||
|
||||
func _on_leaderboard_ok(p: Variant) -> void:
|
||||
loading_lbl.visible = false
|
||||
var d := p as Dictionary
|
||||
var entries : Array = d.get("entries", []) as Array
|
||||
_total = int(d.get("totalCount", 0))
|
||||
_page_count = max(1, int(ceil(_total / float(PAGE_SIZE))))
|
||||
|
||||
_update_pagination()
|
||||
|
||||
if entries.is_empty():
|
||||
loading_lbl.text = "No players yet."
|
||||
loading_lbl.visible = true
|
||||
return
|
||||
|
||||
for entry in entries:
|
||||
entry_list.add_child(_make_row(entry as Dictionary))
|
||||
|
||||
|
||||
func _make_row(e: Dictionary) -> HBoxContainer:
|
||||
var hbox := HBoxContainer.new()
|
||||
hbox.custom_minimum_size = Vector2(0, 40)
|
||||
hbox.add_theme_constant_override("separation", 12)
|
||||
|
||||
var rank_lbl := Label.new()
|
||||
rank_lbl.custom_minimum_size = Vector2(48, 0)
|
||||
rank_lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
||||
rank_lbl.text = "#%d" % int(e.get("rank", 0))
|
||||
rank_lbl.add_theme_font_size_override("font_size", 14)
|
||||
if int(e.get("rank", 99)) <= 3:
|
||||
rank_lbl.modulate = Color(0.95, 0.85, 0.30)
|
||||
hbox.add_child(rank_lbl)
|
||||
|
||||
var name_lbl := Label.new()
|
||||
name_lbl.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
name_lbl.text = e.get("displayName", "???")
|
||||
name_lbl.add_theme_font_size_override("font_size", 14)
|
||||
if e.get("accountId", "") == Auth.user_id:
|
||||
name_lbl.modulate = Color(0.5, 0.9, 1.0)
|
||||
hbox.add_child(name_lbl)
|
||||
|
||||
var score_lbl := Label.new()
|
||||
score_lbl.custom_minimum_size = Vector2(80, 0)
|
||||
score_lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
||||
score_lbl.text = str(int(e.get("rankScore", 0)))
|
||||
score_lbl.add_theme_font_size_override("font_size", 14)
|
||||
score_lbl.modulate = Color(0.7, 0.7, 0.75)
|
||||
hbox.add_child(score_lbl)
|
||||
|
||||
return hbox
|
||||
|
||||
|
||||
func _update_pagination() -> void:
|
||||
page_label.text = "Page %d / %d" % [_page + 1, _page_count]
|
||||
prev_btn.disabled = _page <= 0
|
||||
next_btn.disabled = _page >= _page_count - 1
|
||||
|
||||
|
||||
func _go_page(p: int) -> void:
|
||||
_load_page(clamp(p, 0, _page_count - 1))
|
||||
|
||||
|
||||
func _on_back() -> void:
|
||||
get_tree().change_scene_to_file("res://scenes/main/MainScreen.tscn")
|
||||
Reference in New Issue
Block a user