Skip to content

Commit 7913898

Browse files
KonHclaude
andauthored
Add Leaderboard modal UI, visual-state leaderboard projection, and wiring (#35)
* Review leaderboard modal behavior * Fix leaderboard UI layering, scaling, and HUD placement The leaderboard modal was rendering behind the HUD/map because its UIDocument shared sortingOrder 0 with every other document and relied on scene-authoring order to win ties. Give it an explicit sortingOrder in code instead, per this project's own guidance not to rely on scene ordering for stacking. The table header wasn't scaling with the panel because .gs-panel uses align-items: center, so header children shrank to content size instead of stretching to the panel width — only the table header needed the fix, the title bar stays centered by design. Also moves the leaderboard button next to the player org panel, fixes org/country flag aspect ratio, disables map zoom while the window is open (full scroll-forwarding into the list is deferred), and formats scores with thousands separators. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Pin leaderboard close button to the panel's top-right corner The close button lived inside the centered title row, so it sat next to the title instead of at a fixed corner. Move it out to its own absolutely-positioned element inset by the panel's own padding, independent of the title, which stays centered. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Replace InternalsVisibleTo with public API for test-only access Game.Main and Game.Configs.Loader each carried an AssemblyInfo.cs whose only purpose was granting Game.Tests blanket access to internal members. That's an invisible, all-or-nothing escape hatch rather than a deliberate API decision, and it hides which members tests actually depend on. Flip just the members Game.Tests calls (VisualStateConverter's constructor and Update/UpdateCountryScore/UpdateLeaderboards; Program .ApplyPreservedFields; ProvinceProcessor.Process, plus their containing types) to public instead, and drop both AssemblyInfo.cs files now that nothing needs InternalsVisibleTo. Document the preference in code_style.md so future test-only access follows the same pattern. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
1 parent d4918be commit 7913898

39 files changed

Lines changed: 1208 additions & 43 deletions

‎.claude/rules/csharp/code_style.md‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,28 @@
2020
```
2121
- Fail fast with descriptive, contextual error messages rather than continuing on bad state
2222
- Never silently swallow an exception — at minimum log it at error level
23+
24+
## Prefer `public` over `InternalsVisibleTo` for test access
25+
26+
When a `Game.Tests` test needs to call a class/method that's currently `internal` only
27+
because nothing outside its own assembly needs it *yet*, make the class and that member
28+
`public` instead of adding an `[assembly: InternalsVisibleTo("Game.Tests")]` escape hatch
29+
in an `AssemblyInfo.cs`. `InternalsVisibleTo` grants the test assembly access to
30+
*everything* internal, invisibly, forever — it decays into a blanket bypass of the
31+
access-modifier boundary rather than a deliberate API decision. A `public` member is
32+
visible in the type's own file, doesn't require readers to know a separate
33+
`AssemblyInfo.cs` exists, and if it turns out other assemblies want it too, no further
34+
change is needed.
35+
36+
If an existing `AssemblyInfo.cs` only exists for `InternalsVisibleTo`, grep the target
37+
assembly's test project for which specific `internal` members it actually calls, make
38+
just those (and their containing types, if the type itself is `internal`/default-access)
39+
`public`, then delete the `AssemblyInfo.cs` file entirely. Example: `Game.Main`'s
40+
`VisualStateConverter` (constructor + `Update`/`UpdateCountryScore`/`UpdateLeaderboards`)
41+
and `Game.Configs.Loader`'s `Program.ApplyPreservedFields`/`ProvinceProcessor.Process`
42+
(plus their containing `static class`es) were flipped to `public` this way, removing
43+
both assemblies' `AssemblyInfo.cs`.
44+
45+
This does not apply to genuine encapsulation boundaries (e.g. hiding a helper that would
46+
be actively misleading or unsafe to call from outside its owning system) — those should
47+
stay `internal` and get exercised only through the assembly's public entry points.

‎Assets/Localization/en.asset‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ MonoBehaviour:
1414
m_EditorClassIdentifier: GS.Unity.UI::LocaleConfig
1515
Locale: en
1616
Entries:
17+
- Key: leaderboard.title
18+
Value: Leaderboard
19+
- Key: leaderboard.tab.organizations
20+
Value: Organizations
21+
- Key: leaderboard.tab.countries
22+
Value: Countries
23+
- Key: leaderboard.empty
24+
Value: No leaderboard entries available
25+
- Key: hud.leaderboard
26+
Value: Leaderboard
1727
- Key: country_name.Afghanistan
1828
Value: Afghanistan
1929
- Key: country_name.Algeria

‎Assets/Localization/ru.asset‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ MonoBehaviour:
1414
m_EditorClassIdentifier: GS.Unity.UI::LocaleConfig
1515
Locale: ru
1616
Entries:
17+
- Key: leaderboard.title
18+
Value: Таблица лидеров
19+
- Key: leaderboard.tab.organizations
20+
Value: Организации
21+
- Key: leaderboard.tab.countries
22+
Value: Страны
23+
- Key: leaderboard.empty
24+
Value: Нет записей таблицы лидеров
25+
- Key: hud.leaderboard
26+
Value: Лидеры
1727
- Key: country_name.Afghanistan
1828
Value: "\u0410\u0444\u0433\u0430\u043D\u0438\u0441\u0442\u0430\u043D"
1929
- Key: country_name.Algeria
0 Bytes
Binary file not shown.

‎Assets/Plugins/Core/Core.Map.dll‎

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

‎Assets/Plugins/Core/ECS.Core.dll‎

0 Bytes
Binary file not shown.

‎Assets/Plugins/Core/ECS.Viewer.dll‎

0 Bytes
Binary file not shown.

‎Assets/Plugins/Core/Game.Bots.dll‎

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)