Tile highlight texture system with cursor + hover glow

Server / DB:
- New HighlightConfig entity (catalog.highlight_configs): one row per
  highlight type (Movement/Attack/Ability/Terramorpha/Selector). Supports
  static texture URL or animated (base folder + frame count + FPS) with a
  FallbackHex RGBA colour for when no texture is configured.
- EF migration AddHighlightConfig.
- CosmeticType.HighlightPack added; AssetCdnUrl stores serialised JSON with
  per-type texture config so players can buy full highlight packs in the Bazaar.
- content.get_highlight_config handler in SOR.Content; response DTOs added to
  ContentMessages.cs; handler registered in ServiceRegistration.

Admin:
- /content/highlights page: inline editor for all five highlight types
  (CDN path, animated toggle, frame count, FPS, fallback hex with swatch).
  Upserts rows — no delete needed since there is always exactly one row per type.
- Highlights nav link added to Content section in NavMenu.
- CosmeticEditor: HighlightPack type renders a per-type table (Movement/
  Attack/Ability/Terramorpha/Selector), serialising to JSON in AssetCdnUrl.

Client (Godot):
- HighlightConfig autoload: fetches content.get_highlight_config on startup,
  caches to user://highlight_config.json. Provides get_texture(type) and
  get_color(type). Supports set_override/clear_override/apply_cosmetic_pack
  for cosmetic and settings overrides.
- Settings autoload: highlight_overrides Dictionary persisted in settings.cfg.
  set_highlight_override/clear_highlight_override push into HighlightConfig.
- settings_screen.gd: programmatic "Highlight Texture Overrides" section added
  with a LineEdit + Reset button per type; appended to Sections VBoxContainer.
- game_screen.gd:
  • _add_highlight() rewritten to use flat PlaneMesh quads with textured
    StandardMaterial3D. Accepts a string type key ("movement", "attack",
    "ability", "terramorpha", "selector") instead of a Color constant.
  • _cursor_highlight + _hover_team_overlay: two permanently-allocated quads
    that are never freed. The selector highlights the tile under the mouse at
    all times; the team overlay shows a coloured tint when hovering an occupied
    tile. Both are preserved across _clear_highlights() and _build_board().
  • _update_hover(): called on every InputEventMouseMotion event. Moves the
    selector quad, shows the team-colour overlay when hovering an occupied tile,
    and boosts MeshInstance3D emission on the hovered unit via
    set_surface_override_material (reset when hover leaves).
  • All existing _highlight_tiles() / _add_highlight() callers updated from
    HI_* Color constants to type key strings.

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-23 06:50:00 -04:00
co-authored by Claude Happy
parent 9c44657deb
commit fe293f6bee
17 changed files with 1655 additions and 67 deletions
@@ -127,6 +127,11 @@
<i class="bi bi-cloud-sun me-2"></i>Skyboxes
</NavLink>
</li>
<li class="nav-item">
<NavLink class="nav-link text-white-50 py-1" href="/content/highlights">
<i class="bi bi-grid-fill me-2"></i>Highlights
</NavLink>
</li>
</ul>
</li>
<li class="nav-item">
@@ -5,6 +5,7 @@
@using SOR.Database.Contexts
@using SOR.Database.Entities.Bazaar
@using SOR.Database.Enums
@using System.Text.Json.Nodes
@inject BazaarDbContext Db
@inject CatalogDbContext CatalogDb
@inject SOR.Cdn.ICdnClient Cdn
@@ -110,23 +111,84 @@ else
</div>
</div>
<!-- Asset -->
<div class="card shadow-sm">
<div class="card-header fw-medium">Asset URL (art / model)</div>
<div class="card-body">
<input @bind="_cosmetic.AssetCdnUrl"
class="form-control form-control-sm mb-2"
placeholder="https://cdn.sor.gg/…" />
<label class="btn btn-sm btn-outline-primary @(_uploadingAsset ? "disabled" : "")">
@if (_uploadingAsset) { <span class="spinner-border spinner-border-sm"></span> }
else { <i class="bi bi-upload"></i> }
<span class="ms-1">Upload</span>
<InputFile style="display:none"
accept="image/*,.glb,.gltf,.fbx"
OnChange="UploadAssetAsync" />
</label>
<!-- Asset — normal types -->
@if (_cosmetic.CosmeticType != CosmeticType.HighlightPack)
{
<div class="card shadow-sm">
<div class="card-header fw-medium">Asset URL (art / model)</div>
<div class="card-body">
<input @bind="_cosmetic.AssetCdnUrl"
class="form-control form-control-sm mb-2"
placeholder="https://cdn.sor.gg/…" />
<label class="btn btn-sm btn-outline-primary @(_uploadingAsset ? "disabled" : "")">
@if (_uploadingAsset) { <span class="spinner-border spinner-border-sm"></span> }
else { <i class="bi bi-upload"></i> }
<span class="ms-1">Upload</span>
<InputFile style="display:none"
accept="image/*,.glb,.gltf,.fbx"
OnChange="UploadAssetAsync" />
</label>
</div>
</div>
</div>
}
else
{
<!-- HighlightPack — per-type texture editor -->
<div class="card shadow-sm">
<div class="card-header fw-medium">Highlight Pack Textures</div>
<div class="card-body p-0">
<table class="table table-sm mb-0 align-middle">
<thead>
<tr>
<th style="width:110px">Type</th>
<th>CDN Path</th>
<th style="width:80px" class="text-center">Animated</th>
<th style="width:65px">Frames</th>
<th style="width:55px">FPS</th>
<th style="width:105px">Fallback Hex</th>
</tr>
</thead>
<tbody>
@foreach (var key in _packKeys)
{
var k = key;
var p = _highlightPack[k];
<tr>
<td class="fw-medium">@k</td>
<td>
<input value="@p.CdnPath"
@onchange='e => p.CdnPath = e.Value?.ToString() ?? ""'
class="form-control form-control-sm font-monospace"
placeholder="https://cdn.sor.gg/…" />
</td>
<td class="text-center">
<input type="checkbox" class="form-check-input"
checked="@p.IsAnimated"
@onchange='e => p.IsAnimated = (bool)(e.Value ?? false)' />
</td>
<td>
<input value="@p.FrameCount" type="number" min="1" max="256"
@onchange='e => p.FrameCount = int.TryParse(e.Value?.ToString(), out var n) ? n : 1'
class="form-control form-control-sm" />
</td>
<td>
<input value="@p.Fps" type="number" min="1" max="60" step="0.5"
@onchange='e => p.Fps = float.TryParse(e.Value?.ToString(), out var f) ? f : 12f'
class="form-control form-control-sm" />
</td>
<td>
<input value="@p.FallbackHex"
@onchange='e => p.FallbackHex = e.Value?.ToString() ?? "#FFFFFF66"'
class="form-control form-control-sm font-monospace"
placeholder="#RRGGBBAA" />
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
}
</div>
</div>
@@ -152,6 +214,25 @@ else
@code {
[Parameter] public Guid? Id { get; set; }
private sealed class PackEntry
{
public string CdnPath { get; set; } = string.Empty;
public bool IsAnimated { get; set; }
public int FrameCount { get; set; } = 1;
public float Fps { get; set; } = 12f;
public string FallbackHex{ get; set; } = "#FFFFFF66";
}
private static readonly string[] _packKeys = ["Movement", "Attack", "Ability", "Terramorpha", "Selector"];
private static readonly Dictionary<string, string> _packDefaultHex = new()
{
["Movement"] = "#33FF3366",
["Attack"] = "#FF404080",
["Ability"] = "#3380FF66",
["Terramorpha"] = "#FF990073",
["Selector"] = "#FFFFFF40",
};
private bool IsNew => !Id.HasValue;
private Cosmetic? _cosmetic;
private string _cosmeticTypeStr = nameof(CosmeticType.CardBack);
@@ -159,6 +240,11 @@ else
private bool _saving, _uploadingPreview, _uploadingAsset;
private string? _error;
// HighlightPack state — one entry per type.
private Dictionary<string, PackEntry> _highlightPack = _packKeys.ToDictionary(
k => k,
k => new PackEntry { FallbackHex = _packDefaultHex.GetValueOrDefault(k, "#FFFFFF66") });
protected override async Task OnInitializedAsync()
{
if (IsNew)
@@ -171,6 +257,8 @@ else
if (_cosmetic is null) { Nav.NavigateTo("/bazaar/cosmetics"); return; }
_cosmeticTypeStr = _cosmetic.CosmeticType.ToString();
_cardDefinitionIdStr = _cosmetic.CardDefinitionId?.ToString() ?? string.Empty;
if (_cosmetic.CosmeticType == CosmeticType.HighlightPack)
_ParseHighlightPack(_cosmetic.AssetCdnUrl);
}
}
@@ -202,18 +290,69 @@ else
finally { _uploadingAsset = false; }
}
private void _ParseHighlightPack(string json)
{
_highlightPack = _packKeys.ToDictionary(
k => k,
k => new PackEntry { FallbackHex = _packDefaultHex.GetValueOrDefault(k, "#FFFFFF66") });
try
{
var root = JsonNode.Parse(json) as JsonObject;
if (root is null) return;
foreach (var key in _packKeys)
{
var lk = key.ToLowerInvariant();
if (root[lk] is JsonObject o)
{
_highlightPack[key] = new PackEntry
{
CdnPath = o["cdnPath"]?.GetValue<string>() ?? "",
IsAnimated = o["isAnimated"]?.GetValue<bool>() ?? false,
FrameCount = o["frameCount"]?.GetValue<int>() ?? 1,
Fps = (float)(o["fps"]?.GetValue<double>() ?? 12.0),
FallbackHex = o["fallbackHex"]?.GetValue<string>() ?? _packDefaultHex.GetValueOrDefault(key, "#FFFFFF66"),
};
}
}
}
catch { /* malformed JSON — keep defaults */ }
}
private string _SerializeHighlightPack()
{
var root = new JsonObject();
foreach (var key in _packKeys)
{
var p = _highlightPack[key];
root[key.ToLowerInvariant()] = new JsonObject
{
["cdnPath"] = p.CdnPath,
["isAnimated"] = p.IsAnimated,
["frameCount"] = p.FrameCount,
["fps"] = p.Fps,
["fallbackHex"] = p.FallbackHex,
};
}
return root.ToJsonString();
}
private async Task SaveAsync()
{
_error = null;
if (string.IsNullOrWhiteSpace(_cosmetic!.Name))
{ _error = "Name is required."; return; }
if (string.IsNullOrWhiteSpace(_cosmetic.AssetCdnUrl))
{ _error = "Asset URL is required."; return; }
if (!Enum.TryParse<CosmeticType>(_cosmeticTypeStr, out var t))
{ _error = "Invalid cosmetic type."; return; }
_cosmetic.CosmeticType = t;
// For HighlightPack, AssetCdnUrl holds the serialized JSON pack.
if (t == CosmeticType.HighlightPack)
_cosmetic.AssetCdnUrl = _SerializeHighlightPack();
if (string.IsNullOrWhiteSpace(_cosmetic.AssetCdnUrl))
{ _error = "Asset URL is required."; return; }
_cosmetic.CardDefinitionId = string.IsNullOrWhiteSpace(_cardDefinitionIdStr) ? null
: Guid.TryParse(_cardDefinitionIdStr, out var g) ? g : null;
@@ -0,0 +1,194 @@
@page "/content/highlights"
@attribute [Authorize(Roles = "Admin,SuperAdmin")]
@using Microsoft.EntityFrameworkCore
@using SOR.Database.Contexts
@using SOR.Database.Entities.Catalog
@inject CatalogDbContext Db
<PageTitle>Highlight Textures – SOR Admin</PageTitle>
<div class="d-flex justify-content-between align-items-center mb-4">
<div>
<h1 class="mb-0">Tile Highlight Textures</h1>
<div class="text-muted small">
Configure textures for each battlefield tile highlight type. The client applies these
as flat quads on top of tiles. Leave CdnPath empty to use the fallback colour only.
</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>
}
@if (_loading)
{
<p class="text-muted">Loading…</p>
}
else
{
<div class="row g-3">
@foreach (var row in _rows)
{
var r = row;
<div class="col-12">
<div class="card shadow-sm">
<div class="card-header d-flex align-items-center gap-2">
<span class="fw-medium">@r.Config.HighlightType</span>
@{
var swatch = r.Config.FallbackHex;
if (swatch.Length == 9) swatch = swatch[..7]; // strip alpha for CSS
}
<span class="rounded-2 border"
style="display:inline-block;width:18px;height:18px;background:@swatch;"></span>
<span class="text-muted small fst-italic">@r.Config.FallbackHex</span>
</div>
<div class="card-body">
<div class="row g-3 align-items-end">
<div class="col-md-5">
<label class="form-label small">CDN Path / URL</label>
<input @bind='r.Config.CdnPath'
class="form-control form-control-sm font-monospace"
placeholder="https://cdn.sor.gg/highlights/… (leave empty for colour only)" />
</div>
<div class="col-md-2">
<label class="form-label small">Fallback Hex</label>
<input @bind='r.Config.FallbackHex'
class="form-control form-control-sm font-monospace"
placeholder="#RRGGBBAA" />
</div>
<div class="col-auto d-flex align-items-end gap-3 pb-1">
<div class="form-check mb-0">
<input @bind='r.Config.IsAnimated' type="checkbox"
class="form-check-input" id="@("anim_" + r.Config.HighlightType)" />
<label class="form-check-label small"
for="@("anim_" + r.Config.HighlightType)">Animated</label>
</div>
</div>
@if (r.Config.IsAnimated)
{
<div class="col-md-1">
<label class="form-label small">Frames</label>
<input @bind='r.Config.FrameCount' type="number"
class="form-control form-control-sm" min="1" max="256" />
</div>
<div class="col-md-1">
<label class="form-label small">FPS</label>
<input @bind='r.Config.Fps' type="number"
class="form-control form-control-sm" min="1" max="60" step="0.5" />
</div>
}
<div class="col-auto ms-auto d-flex align-items-end pb-0">
<button class="btn btn-sm btn-outline-primary"
@onclick='() => SaveRowAsync(r)'>
<i class="bi bi-floppy me-1"></i>Save
</button>
</div>
</div>
@if (r.Config.IsAnimated && !string.IsNullOrEmpty(r.Config.CdnPath))
{
<div class="mt-2 text-muted small">
Frames served at: <code>@r.Config.CdnPath/0.png</code> …
<code>@r.Config.CdnPath/@(r.Config.FrameCount - 1).png</code>
</div>
}
else if (!string.IsNullOrEmpty(r.Config.CdnPath))
{
<div class="mt-2">
<img src="@r.Config.CdnPath" alt="preview"
style="max-height:48px;max-width:200px;border-radius:4px;border:1px solid #444" />
</div>
}
</div>
</div>
</div>
}
</div>
}
@code {
private sealed class HighlightRow { public HighlightConfig Config { get; set; } = null!; }
private static readonly string[] Types = ["Movement", "Attack", "Ability", "Terramorpha", "Selector"];
private static readonly Dictionary<string, string> DefaultHex = new()
{
["Movement"] = "#33FF3366",
["Attack"] = "#FF404080",
["Ability"] = "#3380FF66",
["Terramorpha"]= "#FF990073",
["Selector"] = "#FFFFFF40",
};
private List<HighlightRow> _rows = new();
private bool _loading = true;
private string? _message;
private bool _isError;
protected override async Task OnInitializedAsync() => await LoadAsync();
private async Task LoadAsync()
{
_loading = true;
var existing = await Db.HighlightConfigs
.AsNoTracking()
.ToListAsync();
_rows = Types.Select(t =>
{
var cfg = existing.FirstOrDefault(e => string.Equals(e.HighlightType, t, StringComparison.OrdinalIgnoreCase))
?? new HighlightConfig
{
HighlightType = t,
FallbackHex = DefaultHex.GetValueOrDefault(t, "#FFFFFF66"),
};
return new HighlightRow { Config = cfg };
}).ToList();
_loading = false;
}
private async Task SaveRowAsync(HighlightRow row)
{
_message = null;
try
{
var tracked = await Db.HighlightConfigs
.FirstOrDefaultAsync(h => string.Equals(h.HighlightType, row.Config.HighlightType, StringComparison.OrdinalIgnoreCase));
if (tracked is null)
{
row.Config.Id = row.Config.Id == Guid.Empty ? Guid.NewGuid() : row.Config.Id;
Db.HighlightConfigs.Add(row.Config);
}
else
{
tracked.CdnPath = row.Config.CdnPath;
tracked.FallbackHex = row.Config.FallbackHex;
tracked.IsAnimated = row.Config.IsAnimated;
tracked.FrameCount = row.Config.FrameCount;
tracked.Fps = row.Config.Fps;
}
await Db.SaveChangesAsync();
_message = $"{row.Config.HighlightType} highlight saved.";
_isError = false;
// Re-attach the tracked entity to the row so future saves go through the tracked path.
if (!Db.HighlightConfigs.Local.Any(h => h.HighlightType == row.Config.HighlightType))
Db.Entry(row.Config).State = Microsoft.EntityFrameworkCore.EntityState.Detached;
}
catch (Exception ex)
{
_message = $"Save failed: {ex.Message}";
_isError = true;
}
}
}
+19
View File
@@ -157,6 +157,25 @@ public sealed record SkyboxDefinitionDto(
int FrameCount,
float Fps);
// ── Highlight config ──────────────────────────────────────────────────────────
/// <summary>Fetch all configured tile highlight definitions.</summary>
public sealed record GetHighlightConfigRequest;
public sealed record GetHighlightConfigResponse(IEnumerable<HighlightTypeConfigDto> Configs);
/// <summary>
/// Visual configuration for one type of tile highlight (Movement, Attack, Ability,
/// Terramorpha, or Selector). Mirrors the HighlightConfig DB entity.
/// </summary>
public sealed record HighlightTypeConfigDto(
string HighlightType,
bool IsAnimated,
string CdnPath,
int FrameCount,
float Fps,
string FallbackHex);
// ── BGM config ───────────────────────────────────────────────────────────────
/// <summary>Fetch all active background music tracks (keyed by game context).</summary>
@@ -0,0 +1,47 @@
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_highlight_config — returns all configured tile highlight definitions.
/// The client uses these to texture the Movement, Attack, Ability, Terramorpha, and
/// Selector highlight quads on the battlefield. Returns all rows (not filtered by
/// IsActive) so the admin can see partially-configured entries; the client just uses
/// whatever is present.
/// </summary>
internal sealed class ContentGetHighlightConfigHandler : IMessageHandler
{
private readonly CatalogDbContext _catalogDb;
public ContentGetHighlightConfigHandler(CatalogDbContext catalogDb)
{
_catalogDb = catalogDb;
}
public string MessageType => "content.get_highlight_config";
public async Task<IServerMessage?> HandleAsync(
IClientMessage message,
AuthenticatedConnection connection,
CancellationToken ct)
{
var configs = await _catalogDb.HighlightConfigs
.AsNoTracking()
.OrderBy(h => h.HighlightType)
.Select(h => new HighlightTypeConfigDto(
h.HighlightType,
h.IsAnimated,
h.CdnPath,
h.FrameCount,
h.Fps,
h.FallbackHex))
.ToListAsync(ct);
return ServerMessage.Reply("content.get_highlight_config.ack", message.Seq,
new GetHighlightConfigResponse(configs));
}
}
@@ -25,6 +25,7 @@ public static class ServiceRegistration
services.AddTransient<IMessageHandler, ContentGetTileBottomsHandler>();
services.AddTransient<IMessageHandler, ContentGetAudioConfigHandler>();
services.AddTransient<IMessageHandler, ContentGetSkyboxConfigHandler>();
services.AddTransient<IMessageHandler, ContentGetHighlightConfigHandler>();
return services;
}
@@ -30,6 +30,7 @@ public sealed class CatalogDbContext : DbContext
public DbSet<TileBottomModel> TileBottomModels => Set<TileBottomModel>();
public DbSet<GameAudioConfig> AudioConfigs => Set<GameAudioConfig>();
public DbSet<SkyboxDefinition> SkyboxDefinitions => Set<SkyboxDefinition>();
public DbSet<HighlightConfig> HighlightConfigs => Set<HighlightConfig>();
protected override void OnModelCreating(ModelBuilder builder)
{
@@ -172,5 +173,16 @@ public sealed class CatalogDbContext : DbContext
e.Property(s => s.CdnPath).IsRequired();
e.HasIndex(s => s.IsActive);
});
builder.Entity<HighlightConfig>(e =>
{
e.ToTable("highlight_configs");
e.HasKey(h => h.Id);
e.Property(h => h.HighlightType).IsRequired();
e.Property(h => h.CdnPath).IsRequired();
e.Property(h => h.FallbackHex).IsRequired();
// One row per highlight type — admin does an upsert by type name.
e.HasIndex(h => h.HighlightType).IsUnique();
});
}
}
@@ -0,0 +1,52 @@
namespace SOR.Database.Entities.Catalog;
/// <summary>
/// Configures the visual appearance of one type of tile highlight in the 3D gameplay scene.
/// One row per highlight type; HighlightType is the natural key.
///
/// Static: CdnPath is a direct URL to a PNG/WebP texture applied to the flat highlight quad.
/// Animated: CdnPath is a base folder URL; frames are sequential PNGs at /0.png, /1.png, …
///
/// FallbackHex is the RGBA hex colour used by the client when no texture is configured
/// or when the texture fails to load (e.g. "#33FF3366" — green @ 40 % alpha).
///
/// HighlightType values (matched by the client, case-insensitive):
/// Movement, Attack, Ability, Terramorpha, Selector
/// </summary>
public sealed class HighlightConfig
{
public Guid Id { get; set; } = Guid.NewGuid();
/// <summary>
/// Identifier for the highlight type.
/// One of: Movement | Attack | Ability | Terramorpha | Selector
/// </summary>
public string HighlightType { get; set; } = string.Empty;
/// <summary>
/// When false: CdnPath is a direct URL to a single texture image.
/// When true: CdnPath is a base folder URL; frames are at {CdnPath}/0.png … /N.png.
/// </summary>
public bool IsAnimated { get; set; }
/// <summary>
/// Static: full CDN URL to the texture (e.g. https://cdn.sor.gg/highlights/move.png).
/// Animated: base folder URL without trailing slash.
/// Empty string means "use FallbackHex only, no texture."
/// </summary>
public string CdnPath { get; set; } = string.Empty;
/// <summary>Number of animation frames. Always 1 for static highlights.</summary>
public int FrameCount { get; set; } = 1;
/// <summary>Playback speed in frames per second. Ignored for static highlights.</summary>
public float Fps { get; set; } = 12f;
/// <summary>
/// RGBA hex colour used as the fallback (and as a texture tint when a texture IS set).
/// Format: "#RRGGBBAA" (8-char with alpha) or "#RRGGBB" (opaque).
/// Example defaults: Movement "#33FF3366", Attack "#FF404080",
/// Ability "#3380FF66", Terramorpha "#FF990073", Selector "#FFFFFF40"
/// </summary>
public string FallbackHex { get; set; } = "#FFFFFF66";
}
+6 -1
View File
@@ -40,13 +40,18 @@ public enum PurchaseProductType
/// <summary>
/// Type of cosmetic item purchasable from the bazaar.
/// CardBack — replaces the card back artwork globally (not card-specific).
/// CardBack — replaces the card back artwork globally (not card-specific).
/// AlternateCardArt — replaces the 2D art for a specific card definition.
/// AlternateCardModel — replaces the 3D model for a specific card definition.
/// HighlightPack — replaces battlefield tile highlight textures (Movement, Attack,
/// Ability, Terramorpha, Selector). AssetCdnUrl stores a JSON blob:
/// { "movement": {"cdnPath":"…","isAnimated":false,"frameCount":1,"fps":12,"fallbackHex":"#RGBA"},
/// "attack":{…}, "ability":{…}, "terramorpha":{…}, "selector":{…} }
/// </summary>
public enum CosmeticType
{
CardBack,
AlternateCardArt,
AlternateCardModel,
HighlightPack,
}
@@ -0,0 +1,576 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using SOR.Database.Contexts;
#nullable disable
namespace SOR.Database.Migrations.Catalog
{
[DbContext(typeof(CatalogDbContext))]
[Migration("20260323102726_AddHighlightConfig")]
partial class AddHighlightConfig
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("catalog")
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAnimationBinding", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ActionName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("AnimationCdnUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("AnimationTrackName")
.HasColumnType("text");
b.Property<Guid>("CardDefinitionId")
.HasColumnType("uuid");
b.Property<string>("CastSoundCdnUrl")
.HasColumnType("text");
b.Property<string>("ImpactSoundCdnUrl")
.HasColumnType("text");
b.Property<bool>("IsAiGenerated")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("CardDefinitionId", "ActionName")
.IsUnique();
b.ToTable("card_animation_bindings", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAsset", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("AssetType")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("CardDefinitionId")
.HasColumnType("uuid");
b.Property<string>("CdnUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ContentETag")
.HasColumnType("text");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsAiGenerated")
.HasColumnType("boolean");
b.Property<string>("MimeType")
.HasColumnType("text");
b.Property<string>("ModelFacingDirection")
.HasColumnType("text");
b.Property<string>("ModelTintMaskUrl")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CardDefinitionId", "AssetType");
b.ToTable("card_assets", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("AbilitiesJson")
.HasColumnType("jsonb")
.HasColumnName("abilities");
b.Property<string>("Affinity")
.IsRequired()
.HasColumnType("text");
b.Property<string>("AttackSoundUrl")
.HasColumnType("text");
b.Property<string>("AttackType")
.HasColumnType("text");
b.Property<string>("BlockedSoundUrl")
.HasColumnType("text");
b.Property<bool?>("CanAttack")
.HasColumnType("boolean");
b.Property<bool?>("CanBeAttacked")
.HasColumnType("boolean");
b.Property<bool?>("CanBeBlocked")
.HasColumnType("boolean");
b.Property<bool?>("CanBeObstructed")
.HasColumnType("boolean");
b.Property<bool?>("CanBeSacrificed")
.HasColumnType("boolean");
b.Property<bool?>("CanDefend")
.HasColumnType("boolean");
b.Property<bool?>("CanMove")
.HasColumnType("boolean");
b.Property<bool?>("CanUseAbility")
.HasColumnType("boolean");
b.Property<string>("CardType")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("CollectorNumber")
.HasColumnType("integer");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<int?>("Damage")
.HasColumnType("integer");
b.Property<string>("DamagedSoundUrl")
.HasColumnType("text");
b.Property<string>("DeathSoundUrl")
.HasColumnType("text");
b.Property<long>("DefinitionVersion")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasDefaultValue(0L);
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("EffectsJson")
.HasColumnType("jsonb")
.HasColumnName("effects");
b.Property<string[]>("Genus")
.HasColumnType("text[]");
b.Property<bool>("IsPublished")
.HasColumnType("boolean");
b.Property<bool>("IsRetired")
.HasColumnType("boolean");
b.Property<int?>("MaxAttackRange")
.HasColumnType("integer");
b.Property<int?>("MaxChannelRange")
.HasColumnType("integer");
b.Property<int?>("MaxDefense")
.HasColumnType("integer");
b.Property<int?>("MaxHealth")
.HasColumnType("integer");
b.Property<int?>("MinAttackRange")
.HasColumnType("integer");
b.Property<int?>("MinChannelRange")
.HasColumnType("integer");
b.Property<float?>("ModelScale")
.HasColumnType("real");
b.Property<string>("ModelTintColor")
.HasColumnType("text");
b.Property<string>("MoveSoundUrl")
.HasColumnType("text");
b.Property<int?>("MovementPoints")
.HasColumnType("integer");
b.Property<string>("MovementType")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("OtherCostsJson")
.HasColumnType("jsonb")
.HasColumnName("other_costs");
b.Property<Guid?>("PreviousTierId")
.HasColumnType("uuid");
b.Property<string>("Rarity")
.IsRequired()
.HasColumnType("text");
b.Property<bool?>("RequiresLos")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("RetiredAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("SetId")
.HasColumnType("uuid");
b.Property<int>("SpCost")
.HasColumnType("integer");
b.Property<int>("StCost")
.HasColumnType("integer");
b.Property<string>("TerramorphaMode")
.HasColumnType("text");
b.Property<int?>("Tier")
.HasColumnType("integer");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Affinity");
b.HasIndex("CardType");
b.HasIndex("DefinitionVersion");
b.HasIndex("Name");
b.HasIndex("PreviousTierId");
b.HasIndex("Rarity");
b.HasIndex("SetId");
b.HasIndex("IsPublished", "SetId");
b.ToTable("card_definitions", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardSet", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateOnly?>("ReleaseDate")
.HasColumnType("date");
b.HasKey("Id");
b.HasIndex("Code")
.IsUnique();
b.ToTable("card_sets", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CdnUploadRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ContentType")
.HasColumnType("text");
b.Property<bool>("IsAiGenerated")
.HasColumnType("boolean");
b.Property<string>("ObjectKey")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Prefix")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PublicUrl")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("UploadedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("IsAiGenerated");
b.HasIndex("ObjectKey")
.IsUnique();
b.HasIndex("Prefix");
b.ToTable("cdn_upload_records", "catalog");
});
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.HighlightConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CdnPath")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FallbackHex")
.IsRequired()
.HasColumnType("text");
b.Property<float>("Fps")
.HasColumnType("real");
b.Property<int>("FrameCount")
.HasColumnType("integer");
b.Property<string>("HighlightType")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsAnimated")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("HighlightType")
.IsUnique();
b.ToTable("highlight_configs", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.SkyboxDefinition", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CdnPath")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<float>("Fps")
.HasColumnType("real");
b.Property<int>("FrameCount")
.HasColumnType("integer");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsAnimated")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("IsActive");
b.ToTable("skybox_definitions", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.TileBottomModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CdnKey")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("PublicUrl")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("IsActive");
b.ToTable("tile_bottom_models", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.TileModelBinding", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Affinity")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ModelCdnKey")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ModelPublicUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Shape")
.IsRequired()
.HasColumnType("text");
b.Property<string>("TexturePublicUrl")
.HasColumnType("text");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Affinity", "Shape")
.IsUnique();
b.ToTable("tile_model_bindings", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAnimationBinding", b =>
{
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "CardDefinition")
.WithMany("AnimationBindings")
.HasForeignKey("CardDefinitionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CardDefinition");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAsset", b =>
{
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "CardDefinition")
.WithMany("Assets")
.HasForeignKey("CardDefinitionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CardDefinition");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
{
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "PreviousTier")
.WithMany()
.HasForeignKey("PreviousTierId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("SOR.Database.Entities.Catalog.CardSet", "Set")
.WithMany("Cards")
.HasForeignKey("SetId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("PreviousTier");
b.Navigation("Set");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
{
b.Navigation("AnimationBindings");
b.Navigation("Assets");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardSet", b =>
{
b.Navigation("Cards");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,48 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SOR.Database.Migrations.Catalog
{
/// <inheritdoc />
public partial class AddHighlightConfig : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "highlight_configs",
schema: "catalog",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
HighlightType = table.Column<string>(type: "text", nullable: false),
IsAnimated = table.Column<bool>(type: "boolean", nullable: false),
CdnPath = table.Column<string>(type: "text", nullable: false),
FrameCount = table.Column<int>(type: "integer", nullable: false),
Fps = table.Column<float>(type: "real", nullable: false),
FallbackHex = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_highlight_configs", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_highlight_configs_HighlightType",
schema: "catalog",
table: "highlight_configs",
column: "HighlightType",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "highlight_configs",
schema: "catalog");
}
}
}
@@ -383,6 +383,41 @@ namespace SOR.Database.Migrations.Catalog
b.ToTable("game_audio_configs", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.HighlightConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CdnPath")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FallbackHex")
.IsRequired()
.HasColumnType("text");
b.Property<float>("Fps")
.HasColumnType("real");
b.Property<int>("FrameCount")
.HasColumnType("integer");
b.Property<string>("HighlightType")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsAnimated")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("HighlightType")
.IsUnique();
b.ToTable("highlight_configs", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.SkyboxDefinition", b =>
{
b.Property<Guid>("Id")