Feat: scroll block over hand, camera follow, chat overlay, admin cleanup
Client (game_screen.gd): - Scroll wheel no longer zooms camera when mouse is over the hand panel - Clicking a friendly unit smoothly tweens camera pivot to that unit (EASE_OUT CUBIC, 0.4s) — respects Settings.camera_follow_unit toggle - Chat overlay instantiated from game screen and removed on exit Client (Settings.gd + SettingsScreen): - Added camera_follow_unit bool (default: on) to gameplay settings section - Persisted to user://settings.cfg under [gameplay] - Toggle visible in Settings screen under new GAMEPLAY section Server Admin (MatchmakingQueuePage): - "Clear History" button deletes all non-Searching matchmaking entries Server Admin (GameSessionsPage): - Per-row "Abandon" button for Active/Initializing sessions - "Abandon All Active" bulk button marks all live sessions as Abandoned with EndedAt=now and WinCondition="admin" 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:
@@ -9,9 +9,14 @@
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1 class="mb-0">Game Sessions</h1>
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="LoadAsync">
|
||||
<i class="bi bi-arrow-clockwise me-1"></i>Refresh
|
||||
</button>
|
||||
<div class="d-flex gap-2">
|
||||
<button class="btn btn-outline-danger btn-sm" @onclick="AbandonAllActiveAsync">
|
||||
<i class="bi bi-x-circle me-1"></i>Abandon All Active
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="LoadAsync">
|
||||
<i class="bi bi-arrow-clockwise me-1"></i>Refresh
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stats -->
|
||||
@@ -93,6 +98,7 @@ else
|
||||
<th>Duration</th>
|
||||
<th>Winner</th>
|
||||
<th>Win Condition</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -109,12 +115,21 @@ else
|
||||
@(s.WinnerAccountId.HasValue ? s.WinnerAccountId.Value.ToString()[..8] + "…" : "—")
|
||||
</td>
|
||||
<td class="text-muted small">@(s.WinCondition ?? "—")</td>
|
||||
<td>
|
||||
@if (s.Status is nameof(GameSessionStatus.Active) or nameof(GameSessionStatus.Initializing))
|
||||
{
|
||||
<button class="btn btn-outline-danger btn-sm py-0"
|
||||
@onclick="() => AbandonSessionAsync(s.Id)">
|
||||
Abandon
|
||||
</button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if (!_sessions.Any())
|
||||
{
|
||||
<tr>
|
||||
<td colspan="8" class="text-muted text-center py-3">No sessions found.</td>
|
||||
<td colspan="9" class="text-muted text-center py-3">No sessions found.</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
@@ -211,6 +226,31 @@ else
|
||||
await LoadAsync();
|
||||
}
|
||||
|
||||
private async Task AbandonSessionAsync(Guid id)
|
||||
{
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
await Db.GameSessions
|
||||
.Where(s => s.Id == id &&
|
||||
(s.Status == GameSessionStatus.Active || s.Status == GameSessionStatus.Initializing))
|
||||
.ExecuteUpdateAsync(s => s
|
||||
.SetProperty(x => x.Status, GameSessionStatus.Abandoned)
|
||||
.SetProperty(x => x.EndedAt, now)
|
||||
.SetProperty(x => x.WinCondition, "admin"));
|
||||
await LoadAsync();
|
||||
}
|
||||
|
||||
private async Task AbandonAllActiveAsync()
|
||||
{
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
await Db.GameSessions
|
||||
.Where(s => s.Status == GameSessionStatus.Active || s.Status == GameSessionStatus.Initializing)
|
||||
.ExecuteUpdateAsync(s => s
|
||||
.SetProperty(x => x.Status, GameSessionStatus.Abandoned)
|
||||
.SetProperty(x => x.EndedAt, now)
|
||||
.SetProperty(x => x.WinCondition, "admin"));
|
||||
await LoadAsync();
|
||||
}
|
||||
|
||||
private static string FormatDurationEf(TimeSpan ts)
|
||||
{
|
||||
if (ts.TotalHours >= 1) return $"{(int)ts.TotalHours}h {ts.Minutes}m";
|
||||
|
||||
@@ -83,7 +83,12 @@ else
|
||||
|
||||
<!-- Recent Entries -->
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header fw-medium">Recent Activity (last 100)</div>
|
||||
<div class="card-header fw-medium d-flex justify-content-between align-items-center">
|
||||
<span>Recent Activity (last 100)</span>
|
||||
<button class="btn btn-outline-danger btn-sm" @onclick="ClearRecentAsync">
|
||||
<i class="bi bi-trash me-1"></i>Clear History
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-sm table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
@@ -136,6 +141,14 @@ else
|
||||
|
||||
protected override async Task OnInitializedAsync() => await LoadAsync();
|
||||
|
||||
private async Task ClearRecentAsync()
|
||||
{
|
||||
await Db.MatchmakingEntries
|
||||
.Where(e => e.Status != MatchmakingStatus.Searching)
|
||||
.ExecuteDeleteAsync();
|
||||
await LoadAsync();
|
||||
}
|
||||
|
||||
private async Task LoadAsync()
|
||||
{
|
||||
_loading = true;
|
||||
|
||||
Reference in New Issue
Block a user