Feature: leaderboard hide, ability animations, card sounds, BGM, in-game settings

Server:
- Account.IsHiddenFromLeaderboard: filter bots/devs from leaderboard
- AbilityAnimationDefinition: type, effect, dimensions, asset/sound URLs per ability
- CardAnimationBinding: CastSoundCdnUrl + ImpactSoundCdnUrl per card action
- GameAudioConfig entity: admin-configurable BGM tracks per context
- GetGameAudioConfigHandler (content.get_audio_config) + ServiceRegistration
- Admin pages: AccountDetail toggle, AudioConfig CRUD, CardEditor + AbilityBuilder UI
- Migrations: AddLeaderboardHide, AddCardActionSounds, AddGameAudioConfig

Client:
- Music.gd autoload: fetches BGM config, crossfades between context tracks
- InGameSettings overlay: audio sliders, camera follow toggle, concede with confirm
- GameScreen: gear button opens settings; ConcedeBtn moved into settings panel
- project.godot: Music autoload registered

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:
dingo
2026-03-13 23:31:10 -04:00
co-authored by Claude Happy
parent c44dadec45
commit 3810742fe6
27 changed files with 1086 additions and 25 deletions
@@ -117,6 +117,11 @@
<i class="bi bi-robot me-2"></i>AI Art Tracker
</NavLink>
</li>
<li class="nav-item">
<NavLink class="nav-link text-white-50 py-1" href="/content/audio">
<i class="bi bi-music-note-beamed me-2"></i>Audio Config
</NavLink>
</li>
</ul>
</li>
<li class="nav-item">
@@ -396,6 +396,28 @@ else
</div>
</div>
<!-- Leaderboard -->
<div class="col-md-6">
<div class="card shadow-sm">
<div class="card-header fw-medium">Leaderboard</div>
<div class="card-body">
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" role="switch"
id="hideLeaderboard"
checked="@_account.IsHiddenFromLeaderboard"
@onchange="ToggleLeaderboardHideAsync" />
<label class="form-check-label" for="hideLeaderboard">
Hidden from leaderboard
</label>
</div>
<div class="form-text">
When enabled, this account will not appear in the public leaderboard.
Use for bots, dev accounts, and internal test accounts.
</div>
</div>
</div>
</div>
<!-- Account Properties -->
<div class="col-12">
<div class="card shadow-sm">
@@ -800,6 +822,27 @@ else
}
}
// ── Leaderboard ───────────────────────────────────────────────────────────
private async Task ToggleLeaderboardHideAsync()
{
if (_account == null) return;
_account.IsHiddenFromLeaderboard = !_account.IsHiddenFromLeaderboard;
var result = await UserManager.UpdateAsync(_account);
if (result.Succeeded)
{
_message = _account.IsHiddenFromLeaderboard
? "Account hidden from leaderboard."
: "Account restored to leaderboard.";
_isError = false;
}
else
{
_message = string.Join(" ", result.Errors.Select(e => e.Description));
_isError = true;
}
}
// ── Account Properties ─────────────────────────────────────────────────────
private void StartEditProp(AccountProperty prop)
@@ -371,6 +371,72 @@
@onclick="() => { ab.Actions.Add(new ActionDraft()); Compile(); }">
<i class="bi bi-plus-lg me-1"></i>Add Action
</button>
<!-- Animation & Sound -->
<hr class="my-3" />
<div class="d-flex align-items-center gap-2 mb-2">
<h6 class="text-muted small mb-0">Animation &amp; Sound</h6>
<div class="form-check form-switch mb-0">
<input class="form-check-input" type="checkbox" role="switch"
id="hasAnim_@idx"
@bind="ab.HasAnimation" @bind:after="Compile" />
<label class="form-check-label small" for="hasAnim_@idx">Enable</label>
</div>
</div>
@if (ab.HasAnimation)
{
<div class="row g-2 mb-2">
<div class="col-md-3">
<label class="form-label small">Type</label>
<select class="form-select form-select-sm" @bind="ab.AnimationType" @bind:after="Compile">
@foreach (var t in AnimationTypes)
{ <option value="@t">@t</option> }
</select>
</div>
<div class="col-md-3">
<label class="form-label small">Effect</label>
<select class="form-select form-select-sm" @bind="ab.AnimationEffect" @bind:after="Compile">
@foreach (var e in AnimationEffects)
{ <option value="@e">@e</option> }
</select>
</div>
<div class="col-md-2">
<label class="form-label small">Width</label>
<input type="number" step="0.1" class="form-control form-control-sm"
@bind="ab.AnimationWidth" @bind:after="Compile" />
</div>
<div class="col-md-2">
<label class="form-label small">Height</label>
<input type="number" step="0.1" class="form-control form-control-sm"
@bind="ab.AnimationHeight" @bind:after="Compile" />
</div>
<div class="col-md-2">
<label class="form-label small">Duration (s)</label>
<input type="number" step="0.1" class="form-control form-control-sm"
@bind="ab.AnimationDuration" @bind:after="Compile" />
</div>
</div>
<div class="row g-2 mb-2">
<div class="col-12">
<label class="form-label small">Asset URL</label>
<input class="form-control form-control-sm" @bind="ab.AnimationAssetUrl" @bind:after="Compile"
placeholder="https://cdn.sor.gg/fx/…" />
</div>
</div>
<div class="row g-2">
<div class="col-md-6">
<label class="form-label small">Cast Sound URL</label>
<input class="form-control form-control-sm" @bind="ab.CastSoundUrl" @bind:after="Compile"
placeholder="https://cdn.sor.gg/sfx/…" />
</div>
<div class="col-md-6">
<label class="form-label small">Impact Sound URL</label>
<input class="form-control form-control-sm" @bind="ab.ImpactSoundUrl" @bind:after="Compile"
placeholder="https://cdn.sor.gg/sfx/…" />
</div>
</div>
}
</div>
</div>
}
@@ -442,6 +508,9 @@
private static readonly string[] ControllerValues = ["Owner", "Opponent"];
private static readonly string[] ZoneValues = ["Hand", "Deck", "Discard", "Battlefield"];
private static readonly string[] AnimationTypes = ["Projectile", "LinearProjectile", "ArcProjectile", "Aura"];
private static readonly string[] AnimationEffects = ["Self", "Target", "Some", "All"];
private static readonly string[] CostTypes = [
"SpiritPoints", "SacrificeTokens", "DiscardFromHand", "MillTopOfDeck",
"MillBottomOfDeck", "SendSpiritFromBattlefieldToDiscard",
@@ -647,6 +716,19 @@
ab.Actions.Add(act);
}
if (node["Animation"] is JsonObject anim)
{
ab.HasAnimation = true;
ab.AnimationType = anim["Type"]?.GetValue<string>() ?? "Projectile";
ab.AnimationEffect = anim["Effect"]?.GetValue<string>() ?? "Target";
ab.AnimationAssetUrl = anim["AssetUrl"]?.GetValue<string>() ?? "";
ab.AnimationWidth = anim["Width"]?.GetValue<float>() ?? 1f;
ab.AnimationHeight = anim["Height"]?.GetValue<float>() ?? 1f;
ab.AnimationDuration = anim["Duration"]?.GetValue<float>() ?? 1f;
ab.CastSoundUrl = anim["CastSoundUrl"]?.GetValue<string>() ?? "";
ab.ImpactSoundUrl = anim["ImpactSoundUrl"]?.GetValue<string>() ?? "";
}
_abilities.Add(ab);
}
@@ -900,6 +982,26 @@
}
node["Actions"] = actionsArr;
if (ab.HasAnimation)
{
var animNode = new JsonObject
{
["Type"] = ab.AnimationType,
["Effect"] = ab.AnimationEffect,
["Width"] = ab.AnimationWidth,
["Height"] = ab.AnimationHeight,
["Duration"] = ab.AnimationDuration,
};
if (!string.IsNullOrWhiteSpace(ab.AnimationAssetUrl))
animNode["AssetUrl"] = ab.AnimationAssetUrl;
if (!string.IsNullOrWhiteSpace(ab.CastSoundUrl))
animNode["CastSoundUrl"] = ab.CastSoundUrl;
if (!string.IsNullOrWhiteSpace(ab.ImpactSoundUrl))
animNode["ImpactSoundUrl"] = ab.ImpactSoundUrl;
node["Animation"] = animNode;
}
arr.Add(node);
}
@@ -1474,6 +1576,17 @@
public List<CostDraft> Costs { get; set; } = new();
public List<ConditionDraft> Conditions { get; set; } = new();
public List<ActionDraft> Actions { get; set; } = new();
// Animation & Sound (client-side metadata only)
public bool HasAnimation { get; set; } = false;
public string AnimationType { get; set; } = "Projectile";
public string AnimationEffect { get; set; } = "Target";
public string AnimationAssetUrl { get; set; } = "";
public float AnimationWidth { get; set; } = 1f;
public float AnimationHeight { get; set; } = 1f;
public float AnimationDuration { get; set; } = 1f;
public string CastSoundUrl { get; set; } = "";
public string ImpactSoundUrl { get; set; } = "";
}
private sealed class ActionDraft
@@ -323,19 +323,27 @@ else
<h6 class="text-muted mb-3">Animation Bindings</h6>
<table class="table table-sm">
<thead><tr><th>Action</th><th>CDN URL</th><th>AI</th><th>Upload</th><th></th></tr></thead>
<thead><tr><th>Action</th><th>Animation CDN URL</th><th>Cast Sound URL</th><th>Impact Sound URL</th><th>AI</th><th>Upload</th><th></th></tr></thead>
<tbody>
@foreach (var anim in _card.AnimationBindings)
{
var capturedAnim = anim;
<tr>
<td style="width:160px">
<td style="width:130px">
<input @bind="anim.ActionName" class="form-control form-control-sm"
placeholder="e.g. attack" />
</td>
<td>
<input @bind="anim.AnimationCdnUrl" class="form-control form-control-sm"
placeholder="https://cdn.sor.gg/…" />
placeholder="https://cdn.sor.gg/anims/…" />
</td>
<td>
<input @bind="anim.CastSoundCdnUrl" class="form-control form-control-sm"
placeholder="https://cdn.sor.gg/sfx/…" />
</td>
<td>
<input @bind="anim.ImpactSoundCdnUrl" class="form-control form-control-sm"
placeholder="https://cdn.sor.gg/sfx/…" />
</td>
<td style="width:50px" class="text-center align-middle">
<div class="form-check d-flex justify-content-center">
@@ -0,0 +1,202 @@
@page "/content/audio"
@attribute [Authorize(Roles = "Admin,SuperAdmin")]
@using Microsoft.EntityFrameworkCore
@using SOR.Database.Contexts
@using SOR.Database.Entities.Catalog
@inject CatalogDbContext Db
<PageTitle>Audio Config – SOR Admin</PageTitle>
<div class="d-flex justify-content-between align-items-center mb-4">
<div>
<h1 class="mb-0">Background Music</h1>
<div class="text-muted small">Configure BGM tracks served to clients per game context</div>
</div>
<button class="btn btn-outline-secondary btn-sm" @onclick="LoadAsync" disabled="@_loading">
<i class="bi bi-arrow-clockwise me-1"></i>Refresh
</button>
</div>
@if (_message is not null)
{
<div class="alert @(_isError ? "alert-danger" : "alert-success") alert-dismissible">
@_message
<button type="button" class="btn-close" @onclick="() => _message = null"></button>
</div>
}
<div class="card shadow-sm mb-4">
<div class="card-header fw-medium">Tracks</div>
<div class="card-body p-0">
@if (_loading)
{
<p class="p-3 text-muted">Loading…</p>
}
else if (_tracks.Count == 0)
{
<p class="p-3 text-muted fst-italic">No tracks configured. Add one below.</p>
}
else
{
<table class="table table-sm table-hover mb-0">
<thead>
<tr>
<th>Context</th>
<th>Track Name</th>
<th>CDN URL</th>
<th style="width:80px" class="text-center">Active</th>
<th style="width:80px"></th>
</tr>
</thead>
<tbody>
@foreach (var t in _tracks.OrderBy(t => t.Context).ThenBy(t => t.TrackName))
{
var track = t;
<tr class="@(track.IsActive ? "" : "opacity-50")">
<td class="align-middle">
<input @bind="track.Context" class="form-control form-control-sm"
placeholder="e.g. Game" style="width:140px" />
</td>
<td class="align-middle">
<input @bind="track.TrackName" class="form-control form-control-sm"
placeholder="e.g. Battle Theme 1" />
</td>
<td class="align-middle">
<input @bind="track.TrackCdnUrl" class="form-control form-control-sm"
placeholder="https://cdn.sor.gg/music/…" />
</td>
<td class="text-center align-middle">
<div class="form-check d-flex justify-content-center">
<input @bind="track.IsActive" type="checkbox" class="form-check-input" />
</div>
</td>
<td class="align-middle">
<button class="btn btn-sm btn-outline-primary me-1" @onclick="() => SaveTrackAsync(track)">
<i class="bi bi-floppy"></i>
</button>
<button class="btn btn-sm btn-outline-danger" @onclick="() => DeleteTrackAsync(track)">
<i class="bi bi-trash"></i>
</button>
</td>
</tr>
}
</tbody>
</table>
}
</div>
</div>
<div class="card shadow-sm">
<div class="card-header fw-medium">Add Track</div>
<div class="card-body">
<div class="row g-2 align-items-end">
<div class="col-md-2">
<label class="form-label small">Context</label>
<input @bind="_newContext" class="form-control form-control-sm"
placeholder="Lobby" list="context-suggestions" />
<datalist id="context-suggestions">
<option value="Lobby" />
<option value="Game" />
<option value="Matchmaking" />
<option value="CharacterSelect" />
<option value="Victory" />
</datalist>
</div>
<div class="col-md-3">
<label class="form-label small">Track Name</label>
<input @bind="_newTrackName" class="form-control form-control-sm"
placeholder="e.g. Main Theme" />
</div>
<div class="col-md-5">
<label class="form-label small">CDN URL</label>
<input @bind="_newCdnUrl" class="form-control form-control-sm"
placeholder="https://cdn.sor.gg/music/…" />
</div>
<div class="col-md-2">
<button class="btn btn-primary btn-sm w-100"
@onclick="AddTrackAsync"
disabled="@(string.IsNullOrWhiteSpace(_newContext) || string.IsNullOrWhiteSpace(_newTrackName) || string.IsNullOrWhiteSpace(_newCdnUrl))">
<i class="bi bi-plus-lg me-1"></i>Add
</button>
</div>
</div>
</div>
</div>
@code {
private List<GameAudioConfig> _tracks = new();
private bool _loading;
private string? _message;
private bool _isError;
private string _newContext = "";
private string _newTrackName = "";
private string _newCdnUrl = "";
protected override async Task OnInitializedAsync() => await LoadAsync();
private async Task LoadAsync()
{
_loading = true;
_tracks = await Db.AudioConfigs.OrderBy(t => t.Context).ToListAsync();
_loading = false;
}
private async Task SaveTrackAsync(GameAudioConfig track)
{
try
{
await Db.SaveChangesAsync();
_message = $"Track \"{track.TrackName}\" saved.";
_isError = false;
}
catch (Exception ex)
{
_message = $"Save failed: {ex.Message}";
_isError = true;
}
}
private async Task DeleteTrackAsync(GameAudioConfig track)
{
Db.AudioConfigs.Remove(track);
try
{
await Db.SaveChangesAsync();
_tracks.Remove(track);
_message = $"Track \"{track.TrackName}\" deleted.";
_isError = false;
}
catch (Exception ex)
{
_message = $"Delete failed: {ex.Message}";
_isError = true;
}
}
private async Task AddTrackAsync()
{
var track = new GameAudioConfig
{
Id = Guid.NewGuid(),
Context = _newContext.Trim(),
TrackName = _newTrackName.Trim(),
TrackCdnUrl = _newCdnUrl.Trim(),
IsActive = true,
};
Db.AudioConfigs.Add(track);
try
{
await Db.SaveChangesAsync();
_tracks.Add(track);
_newContext = _newTrackName = _newCdnUrl = "";
_message = $"Track \"{track.TrackName}\" added.";
_isError = false;
}
catch (Exception ex)
{
_message = $"Add failed: {ex.Message}";
_isError = true;
}
}
}
+18 -3
View File
@@ -104,7 +104,22 @@ public sealed record CardAssetDto(
bool IsAiGenerated);
public sealed record CardAnimationBindingDto(
Guid Id,
string ActionName,
string AnimationCdnUrl,
bool IsAiGenerated,
string? CastSoundCdnUrl,
string? ImpactSoundCdnUrl);
// ── BGM config ───────────────────────────────────────────────────────────────
/// <summary>Fetch all active background music tracks (keyed by game context).</summary>
public sealed record GetGameAudioConfigRequest;
public sealed record GetGameAudioConfigResponse(IEnumerable<GameAudioConfigDto> Tracks);
public sealed record GameAudioConfigDto(
Guid Id,
string ActionName,
string AnimationCdnUrl,
bool IsAiGenerated);
string Context,
string TrackName,
string TrackCdnUrl);
@@ -56,5 +56,7 @@ internal static class ContentDtoMapper
b.Id,
b.ActionName,
b.AnimationCdnUrl,
b.IsAiGenerated)));
b.IsAiGenerated,
b.CastSoundCdnUrl,
b.ImpactSoundCdnUrl)));
}
@@ -0,0 +1,40 @@
namespace SOR.Content.Handlers;
using Microsoft.EntityFrameworkCore;
using SOR.Database.Contexts;
using SOR.Networking.Abstractions.Messaging;
using SOR.Networking.Abstractions.Transport;
using SOR.Shared.Networking;
/// <summary>
/// content.get_audio_config — returns all active background music tracks.
/// The client uses these to stream BGM for each game context (Lobby, Game, Matchmaking, etc.).
/// </summary>
internal sealed class ContentGetAudioConfigHandler : IMessageHandler
{
private readonly CatalogDbContext _catalogDb;
public ContentGetAudioConfigHandler(CatalogDbContext catalogDb)
{
_catalogDb = catalogDb;
}
public string MessageType => "content.get_audio_config";
public async Task<IServerMessage?> HandleAsync(
IClientMessage message,
AuthenticatedConnection connection,
CancellationToken ct)
{
var tracks = await _catalogDb.AudioConfigs
.AsNoTracking()
.Where(g => g.IsActive)
.OrderBy(g => g.Context)
.ThenBy(g => g.TrackName)
.Select(g => new GameAudioConfigDto(g.Id, g.Context, g.TrackName, g.TrackCdnUrl))
.ToListAsync(ct);
return ServerMessage.Reply("content.get_audio_config.ack", message.Seq,
new GetGameAudioConfigResponse(tracks));
}
}
@@ -22,6 +22,7 @@ public static class ServiceRegistration
services.AddTransient<IMessageHandler, ContentGetCardSetsHandler>();
services.AddTransient<IMessageHandler, ContentGetCardDefinitionHandler>();
services.AddTransient<IMessageHandler, ContentGetTileModelsHandler>();
services.AddTransient<IMessageHandler, ContentGetAudioConfigHandler>();
return services;
}
@@ -27,6 +27,7 @@ public sealed class CatalogDbContext : DbContext
public DbSet<CardAnimationBinding> AnimationBindings => Set<CardAnimationBinding>();
public DbSet<CdnUploadRecord> CdnUploadRecords => Set<CdnUploadRecord>();
public DbSet<TileModelBinding> TileModelBindings => Set<TileModelBinding>();
public DbSet<GameAudioConfig> AudioConfigs => Set<GameAudioConfig>();
protected override void OnModelCreating(ModelBuilder builder)
{
@@ -140,5 +141,16 @@ public sealed class CatalogDbContext : DbContext
// One model per affinity+shape pair.
e.HasIndex(t => new { t.Affinity, t.Shape }).IsUnique();
});
builder.Entity<GameAudioConfig>(e =>
{
e.ToTable("game_audio_configs");
e.HasKey(g => g.Id);
e.Property(g => g.Context).IsRequired();
e.Property(g => g.TrackName).IsRequired();
e.Property(g => g.TrackCdnUrl).IsRequired();
e.HasIndex(g => g.Context);
e.HasIndex(g => g.IsActive);
});
}
}
@@ -32,5 +32,11 @@ public sealed class CardAnimationBinding
/// </summary>
public bool IsAiGenerated { get; set; }
/// <summary>CDN URL to the sound played when this action begins (e.g. cast, attack swing).</summary>
public string? CastSoundCdnUrl { get; set; }
/// <summary>CDN URL to the sound played on impact or effect resolution.</summary>
public string? ImpactSoundCdnUrl { get; set; }
public CardDefinition CardDefinition { get; set; } = null!;
}
@@ -0,0 +1,26 @@
namespace SOR.Database.Entities.Catalog;
/// <summary>
/// Configures a background music track for a specific game context.
/// Contexts are free-form strings matched by the client (e.g. "Lobby", "Game", "Matchmaking").
/// Multiple tracks per context are allowed; the client picks one at random or plays them in order.
/// </summary>
public sealed class GameAudioConfig
{
public Guid Id { get; set; } = Guid.NewGuid();
/// <summary>
/// Scene/context identifier as expected by the client.
/// Examples: "Lobby", "Game", "Matchmaking", "CharacterSelect".
/// </summary>
public string Context { get; set; } = string.Empty;
/// <summary>Human-readable name for the track (shown in admin UI).</summary>
public string TrackName { get; set; } = string.Empty;
/// <summary>CDN URL to the audio file (mp3, ogg, etc.).</summary>
public string TrackCdnUrl { get; set; } = string.Empty;
/// <summary>When false, the track is excluded from the client response.</summary>
public bool IsActive { get; set; } = true;
}
@@ -44,4 +44,10 @@ public sealed class Account : IdentityUser<Guid>
/// Starts at 1000. Adjusted after each ranked game using K=32 factor.
/// </summary>
public int RankScore { get; set; } = 1000;
/// <summary>
/// When true, this account is excluded from the public leaderboard.
/// Use for bots, dev accounts, and internal test accounts.
/// </summary>
public bool IsHiddenFromLeaderboard { get; set; }
}
@@ -0,0 +1,29 @@
namespace SOR.Database.Migrations.Catalog;
using Microsoft.EntityFrameworkCore.Migrations;
public partial class AddCardActionSounds : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "CastSoundCdnUrl",
schema: "catalog",
table: "card_animation_bindings",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ImpactSoundCdnUrl",
schema: "catalog",
table: "card_animation_bindings",
type: "text",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(name: "CastSoundCdnUrl", schema: "catalog", table: "card_animation_bindings");
migrationBuilder.DropColumn(name: "ImpactSoundCdnUrl", schema: "catalog", table: "card_animation_bindings");
}
}
@@ -0,0 +1,43 @@
namespace SOR.Database.Migrations.Catalog;
using System;
using Microsoft.EntityFrameworkCore.Migrations;
public partial class AddGameAudioConfig : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "game_audio_configs",
schema: "catalog",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Context = table.Column<string>(type: "text", nullable: false),
TrackName = table.Column<string>(type: "text", nullable: false),
TrackCdnUrl = table.Column<string>(type: "text", nullable: false),
IsActive = table.Column<bool>(type: "boolean", nullable: false, defaultValue: true),
},
constraints: table =>
{
table.PrimaryKey("PK_game_audio_configs", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_game_audio_configs_Context",
schema: "catalog",
table: "game_audio_configs",
column: "Context");
migrationBuilder.CreateIndex(
name: "IX_game_audio_configs_IsActive",
schema: "catalog",
table: "game_audio_configs",
column: "IsActive");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(name: "game_audio_configs", schema: "catalog");
}
}
@@ -23,6 +23,36 @@ namespace SOR.Database.Migrations.Catalog
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("SOR.Database.Entities.Catalog.GameAudioConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Context")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("TrackCdnUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("TrackName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("Context");
b.HasIndex("IsActive");
b.ToTable("game_audio_configs", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAnimationBinding", b =>
{
b.Property<Guid>("Id")
@@ -40,6 +70,12 @@ namespace SOR.Database.Migrations.Catalog
b.Property<Guid>("CardDefinitionId")
.HasColumnType("uuid");
b.Property<string>("CastSoundCdnUrl")
.HasColumnType("text");
b.Property<string>("ImpactSoundCdnUrl")
.HasColumnType("text");
b.Property<bool>("IsAiGenerated")
.HasColumnType("boolean");
@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SOR.Database.Migrations.Identity
{
/// <inheritdoc />
public partial class AddLeaderboardHide : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsHiddenFromLeaderboard",
schema: "identity",
table: "accounts",
type: "boolean",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsHiddenFromLeaderboard",
schema: "identity",
table: "accounts");
}
}
}
@@ -182,6 +182,9 @@ namespace SOR.Database.Migrations.Identity
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("IsHiddenFromLeaderboard")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LastLoginAt")
.HasColumnType("timestamp with time zone");
@@ -0,0 +1,56 @@
namespace SOR.Game.Abilities.Models;
/// <summary>The visual presentation style for an ability animation.</summary>
public enum AbilityAnimationType
{
/// <summary>A projectile that arcs from caster to target.</summary>
Projectile,
/// <summary>A projectile that travels in a straight line from caster to target.</summary>
LinearProjectile,
/// <summary>A projectile that follows a parabolic arc from caster to target.</summary>
ArcProjectile,
/// <summary>A radial aura effect centered on the caster or target.</summary>
Aura,
}
/// <summary>Where the animation effect VFX is rendered.</summary>
public enum AbilityAnimationEffect
{
/// <summary>Effect plays on the ability's source unit.</summary>
Self,
/// <summary>Effect plays on each selected target.</summary>
Target,
/// <summary>Effect plays on a subset of affected units.</summary>
Some,
/// <summary>Effect covers the entire board (e.g. board-wide clear).</summary>
All,
}
/// <summary>
/// Client-side animation and sound metadata for an ability.
/// Stored inside AbilityDefinition.Animation (JSONB).
/// Not used by server game logic — purely for the client renderer and audio system.
/// </summary>
public sealed class AbilityAnimationDefinition
{
public AbilityAnimationType Type { get; set; } = AbilityAnimationType.Projectile;
public AbilityAnimationEffect Effect { get; set; } = AbilityAnimationEffect.Target;
/// <summary>CDN URL to the animation asset (particle effect, sprite sheet, etc.).</summary>
public string? AssetUrl { get; set; }
/// <summary>Scale width multiplier for the effect (1.0 = default size).</summary>
public float Width { get; set; } = 1f;
/// <summary>Scale height multiplier for the effect (1.0 = default size).</summary>
public float Height { get; set; } = 1f;
/// <summary>Duration of the animation in seconds.</summary>
public float Duration { get; set; } = 1f;
/// <summary>CDN URL to the sound played when the ability is cast/activated.</summary>
public string? CastSoundUrl { get; set; }
/// <summary>CDN URL to the sound played on impact/effect resolution.</summary>
public string? ImpactSoundUrl { get; set; }
}
@@ -50,4 +50,10 @@ public sealed class AbilityDefinition
/// Used in the admin ability builder. Not used by game logic.
/// </summary>
public string? Description { get; set; }
/// <summary>
/// Optional client-side animation and sound metadata.
/// Not used by server game logic. Null means the client uses its default effect.
/// </summary>
public AbilityAnimationDefinition? Animation { get; set; }
}
@@ -38,9 +38,11 @@ internal sealed class GetLeaderboardHandler : IMessageHandler
var pageSize = Math.Clamp(req.PageSize, 1, MaxPageSize);
var skip = page * pageSize;
var total = await _identityDb.Users.CountAsync(cancellationToken);
var visible = _identityDb.Users.Where(a => !a.IsHiddenFromLeaderboard);
var entries = await _identityDb.Users
var total = await visible.CountAsync(cancellationToken);
var entries = await visible
.OrderByDescending(a => a.RankScore)
.Skip(skip)
.Take(pageSize)