From c4999c953aa63939c61780572f5dc0e16c148f0b Mon Sep 17 00:00:00 2001 From: dingo Date: Sun, 15 Mar 2026 14:06:55 -0400 Subject: [PATCH] Feature: GLB animation playback, model facing, CDN animation preview Server: - CardAnimationBinding.AnimationTrackName: nullable override for GLB track name (blank = case-insensitive convention match; Idle/Attack/Damaged/Moving/Dying) - CardAnimationBindingDto: includes AnimationTrackName in content sync - CardEditor: GLB Track Name column in animation bindings table - CdnBrowser: model-viewer animation list + playback (JS interop on load event) - Migration: AddAnimationTrackName applied to production Client: - ContentCache.get_anim_track(): resolves GLB track name from binding override or falls back to convention with case-insensitive aliases - game_screen.gd: - _find_animation_player(): recursive search in loaded GLB scene tree - _resolve_anim_track(): case-insensitive + alias resolution - _play_unit_anim(): plays track, returns to Idle when one-shot finishes - _play_damage_animations(): detects HP drops and unit deaths before rebuild - Model facing: P1 units rotated 180deg Y to face opponent across board - Idle loop starts automatically after real model loads - Attack animation fires immediately on attack input (before ACK) Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- .../origin-client/autoloads/ContentCache.gd | 19 + Client/origin-client/autoloads/Music.gd.uid | 1 + .../origin-client/scenes/game/game_screen.gd | 173 ++++++- .../scenes/game/in_game_settings.gd.uid | 1 + .../Components/Pages/Cards/CardEditor.razor | 6 +- .../Components/Pages/Content/CdnBrowser.razor | 87 +++- Server/src/SOR.Content/ContentMessages.cs | 1 + .../SOR.Content/Handlers/ContentDtoMapper.cs | 1 + .../Entities/Catalog/CardAnimationBinding.cs | 8 + ...15175036_AddAnimationTrackName.Designer.cs | 445 ++++++++++++++++++ .../20260315175036_AddAnimationTrackName.cs | 30 ++ .../Catalog/CatalogDbContextModelSnapshot.cs | 3 + 12 files changed, 747 insertions(+), 28 deletions(-) create mode 100644 Client/origin-client/autoloads/Music.gd.uid create mode 100644 Client/origin-client/scenes/game/in_game_settings.gd.uid create mode 100644 Server/src/SOR.Database/Migrations/Catalog/20260315175036_AddAnimationTrackName.Designer.cs create mode 100644 Server/src/SOR.Database/Migrations/Catalog/20260315175036_AddAnimationTrackName.cs diff --git a/Client/origin-client/autoloads/ContentCache.gd b/Client/origin-client/autoloads/ContentCache.gd index 3851bfe..f3daf46 100644 --- a/Client/origin-client/autoloads/ContentCache.gd +++ b/Client/origin-client/autoloads/ContentCache.gd @@ -83,6 +83,25 @@ func start_sync() -> void: fetch_tile_models() +## Return the GLB animation track name for a card action. +## +## Looks for an animationBinding with the given action_name (case-insensitive). +## If found and the binding has a non-empty animationTrackName, returns that. +## Otherwise returns the action_name itself so the caller can do its own +## case-insensitive fuzzy match against the AnimationPlayer's track list. +## +## card_def_id: card definition GUID string +## action_name: e.g. "attack", "idle", "death", "move" +func get_anim_track(card_def_id: String, action_name: String) -> String: + var def := get_definition(card_def_id) + var action_lower := action_name.to_lower() + for binding: Dictionary in def.get("animationBindings", []): + if str(binding.get("actionName", "")).to_lower() == action_lower: + var track := str(binding.get("animationTrackName", "")) + return track if not track.is_empty() else action_name + return action_name + + ## Return the CDN URL for a tile's 3D model, or "" if not assigned. ## affinity: e.g. "Forest" shape: "Square" or "Hex" func get_tile_model_url(affinity: String, shape: String) -> String: diff --git a/Client/origin-client/autoloads/Music.gd.uid b/Client/origin-client/autoloads/Music.gd.uid new file mode 100644 index 0000000..76d80fc --- /dev/null +++ b/Client/origin-client/autoloads/Music.gd.uid @@ -0,0 +1 @@ +uid://c8lby4cq8hsco diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index 772f9ee..62e71fa 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -149,8 +149,24 @@ var _friendly_unit_ids: Dictionary = {} # instanceId → true # ── Scene refs ──────────────────────────────────────────────────────────────── var _tile_bodies : Dictionary = {} # "x,y" → StaticBody3D -var _unit_meshes : Dictionary = {} # instanceId → MeshInstance3D (placeholder) +var _unit_meshes : Dictionary = {} # instanceId → Node3D (placeholder or real model) var _unit_bodies : Dictionary = {} # instanceId → StaticBody3D +var _anim_players : Dictionary = {} # instanceId → AnimationPlayer (null if none) +var _unit_def_ids : Dictionary = {} # instanceId → card definition ID string + +# ── Animation / facing state ─────────────────────────────────────────────────── +var _local_is_p1 : bool = false # true when Auth.user_id == playerOneAccountId +var _prev_unit_hp : Dictionary = {} # instanceId → int, HP from last rebuild + +## Animation name aliases: maps the canonical lower-case action to fallback track names. +## The AnimationPlayer track list is matched case-insensitively against each entry. +const ANIM_ALIASES : Dictionary = { + "idle": ["idle", "idle_a", "idle1", "idle_loop"], + "attack": ["attack", "attack_a", "attack1", "attack_b", "strike"], + "damaged": ["damaged", "attacked", "hit", "hurt", "flinch"], + "dying": ["dying", "death", "die", "dead"], + "moving": ["moving", "move", "walk", "run", "walk_cycle"], +} # ── Lifecycle ───────────────────────────────────────────────────────────────── @@ -520,19 +536,28 @@ func _rebuild_units(state: Dictionary) -> void: for c in _units_root.get_children(): c.queue_free() _unit_meshes.clear() _unit_bodies.clear() + _anim_players.clear() + _unit_def_ids.clear() + _prev_unit_hp.clear() var my_id := Auth.user_id for player: Dictionary in state.get("players", []): var is_mine : bool = str(player.get("accountId", "")).to_lower() == my_id.to_lower() var color : Color = Color(0.3, 0.5, 1.0) if is_mine else Color(1.0, 0.35, 0.35) var arch : Dictionary = player.get("archSpirit", {}) if not arch.is_empty() and arch.get("position") != null: - _add_unit_mesh(arch, color) + _add_unit_mesh(arch, color, not is_mine) for unit: Dictionary in player.get("field", []): if unit.get("position") != null: - _add_unit_mesh(unit, color) + _add_unit_mesh(unit, color, not is_mine) + # Store HP for damage detection on next state update. + for unit: Dictionary in ([arch] + player.get("field", [])): + if unit.is_empty(): continue + var iid := str(unit.get("instanceId", "")) + if not iid.is_empty(): + _prev_unit_hp[iid] = int(unit.get("currentHealth", 0)) -func _add_unit_mesh(unit: Dictionary, team_color: Color) -> void: +func _add_unit_mesh(unit: Dictionary, team_color: Color, is_enemy: bool = false) -> void: var pd : Dictionary = unit.get("position", {}) if pd.is_empty(): return var wp := _coord_to_world(pd.get("x", 0), pd.get("y", 0)) @@ -593,6 +618,8 @@ func _add_unit_mesh(unit: Dictionary, team_color: Color) -> void: # ── Try to load the real 3D model from the card definition ────────────── var def_id : String = str(unit.get("cardDefinitionId", "")) + if not def_id.is_empty(): + _unit_def_ids[iid] = def_id if def_id.is_empty(): return var def := ContentCache.get_definition(def_id) @@ -601,6 +628,10 @@ func _add_unit_mesh(unit: Dictionary, team_color: Color) -> void: return var body_ref : Variant = weakref(body) + # Capture facing flag: P1 units face +Z (rotate 180° Y); P2 units face -Z (default). + # Convention: GLB models exported facing -Z. P1 is at -Z side of the board. + # Rotate if: (local is P1 AND friendly) OR (local is P2 AND enemy). + var needs_face_rotation : bool = _local_is_p1 != is_enemy ModelCache.load_model(model_url, func(model_node: Node3D) -> void: # Guard: body may have been freed by a state rebuild before load finished. var b := body_ref.get_ref() as StaticBody3D @@ -616,12 +647,22 @@ func _add_unit_mesh(unit: Dictionary, team_color: Color) -> void: if child is MeshInstance3D: child.queue_free() + # Apply facing rotation so units face their opponent across the board. + if needs_face_rotation: + model_node.rotation_degrees = Vector3(0, 180, 0) + # Position model so its local origin sits at the body's position. # Models should be authored with their base (foot) at y = 0. # Adjust the body back down so the model base lands on the tile surface. b.position = wp + Vector3(0, 0.5, 0) b.add_child(model_node) _unit_meshes[iid] = model_node + + # Find and store the AnimationPlayer, then start the Idle loop. + var ap := _find_animation_player(model_node) + _anim_players[iid] = ap + if ap != null: + _play_unit_anim(iid, "idle", true) ) @@ -633,6 +674,87 @@ func _find_model3d_url(def: Dictionary) -> String: return str(d.get("cdnUrl", "")) return "" + +## Recursively find the first AnimationPlayer in a model subtree. +func _find_animation_player(node: Node) -> AnimationPlayer: + if node is AnimationPlayer: + return node as AnimationPlayer + for child in node.get_children(): + var found := _find_animation_player(child) + if found != null: + return found + return null + + +## Case-insensitive track name resolver with fallback aliases. +## Returns the exact track name in the AnimationPlayer, or "" if not found. +func _resolve_anim_track(ap: AnimationPlayer, action_lower: String) -> String: + # Strip library prefix (e.g. "model/Idle" → "idle") for comparison. + for full_name: String in ap.get_animation_list(): + var short := full_name.get_slice("/", full_name.get_slice_count("/") - 1) + if short.to_lower() == action_lower: + return full_name + # Try known aliases. + for alias: String in ANIM_ALIASES.get(action_lower, []): + for full_name: String in ap.get_animation_list(): + var short := full_name.get_slice("/", full_name.get_slice_count("/") - 1) + if short.to_lower() == alias: + return full_name + return "" + + +## Play an animation on a unit by action name. Uses card's AnimationTrackName +## override when set, then falls back to case-insensitive convention matching. +## Pass loop=true for looping animations (e.g. Idle). +func _play_unit_anim(iid: String, action: String, loop: bool = false) -> void: + var ap : AnimationPlayer = _anim_players.get(iid, null) + if ap == null or not is_instance_valid(ap): + return + # Resolve via CardAnimationBinding override first. + var def_id : String = _unit_def_ids.get(iid, "") + var desired := action + if not def_id.is_empty(): + var override := ContentCache.get_anim_track(def_id, action) + if not override.is_empty(): + desired = override + var track := _resolve_anim_track(ap, desired.to_lower()) + if track.is_empty(): + return + var anim := ap.get_animation(track) + if anim == null: + return + anim.loop_mode = Animation.LOOP_LINEAR if loop else Animation.LOOP_NONE + if not loop and ap.current_animation == track and ap.is_playing(): + return # Don't restart the same one-shot animation mid-play. + ap.play(track) + # Return to Idle after one-shot animations finish. + if not loop: + ap.animation_finished.connect( + func(_n: String) -> void: _play_unit_anim(iid, "idle", true), + CONNECT_ONE_SHOT) + + +## Detect HP decreases and unit deaths vs previous state, and fire animations. +## Called just before _rebuild_units so animations play on the existing nodes. +func _play_damage_animations(state: Dictionary) -> void: + if _prev_unit_hp.is_empty(): + return + var seen_iids : Dictionary = {} + for player: Dictionary in state.get("players", []): + for unit: Dictionary in ([player.get("archSpirit", {})] + player.get("field", [])): + if unit.is_empty(): continue + var iid := str(unit.get("instanceId", "")) + var new_hp := int(unit.get("currentHealth", 0)) + var old_hp : int = _prev_unit_hp.get(iid, new_hp) + seen_iids[iid] = true + if new_hp < old_hp: + _play_unit_anim(iid, "damaged") + # Units that vanished this update → play dying. + for iid: String in _prev_unit_hp: + if not seen_iids.has(iid): + _play_unit_anim(iid, "dying") + + # ── Highlights ──────────────────────────────────────────────────────────────── func _clear_highlights() -> void: @@ -912,6 +1034,7 @@ func _handle_board_click(mouse_pos: Vector2) -> void: Mode.UNIT_SELECTED: if not unit_id.is_empty(): if _is_enemy_unit(unit_id): + _play_unit_anim(_sel_unit_id, "attack") Game.send_attack(_sel_unit_id, unit_id) _set_mode(Mode.NONE) elif unit_id == _sel_unit_id: @@ -1816,24 +1939,26 @@ func _on_state_updated(state: Dictionary) -> void: _rebuild_ownership(state) # Orient camera behind the local player's row on the first state with playerOneAccountId. - if not _camera_oriented: - var p1_id : String = str(state.get("playerOneAccountId", "")) - if not p1_id.is_empty(): - _camera_oriented = true - var bh := float(Game.board_height()) - # Shift cam_pivot toward the opponent's side (30 % of board half-length) - # so the player's own row appears in the lower-middle of the screen, - # above the hand panel — not hidden behind it. - var pivot_offset := (bh - 1.0) * 0.3 - if Auth.user_id.to_lower() == p1_id.to_lower(): - # P1 row is at world -Z. Camera looks from -Z toward +Z → yaw=180°. - # Shift pivot toward world -Z so P1's row is NOT at the very bottom. - _cam_yaw = 180.0 - _cam_pivot = Vector3(0.0, 0.0, -pivot_offset) - else: - # P2 row is at world +Z (default yaw=0°). - _cam_pivot = Vector3(0.0, 0.0, pivot_offset) - _apply_camera() + var p1_id : String = str(state.get("playerOneAccountId", "")) + if not p1_id.is_empty(): + # Update P1/P2 flag every time — used for model facing on full rebuild. + _local_is_p1 = Auth.user_id.to_lower() == p1_id.to_lower() + if not _camera_oriented and not p1_id.is_empty(): + _camera_oriented = true + var bh := float(Game.board_height()) + # Shift cam_pivot toward the opponent's side (30 % of board half-length) + # so the player's own row appears in the lower-middle of the screen, + # above the hand panel — not hidden behind it. + var pivot_offset := (bh - 1.0) * 0.3 + if _local_is_p1: + # P1 row is at world -Z. Camera looks from -Z toward +Z → yaw=180°. + # Shift pivot toward world -Z so P1's row is NOT at the very bottom. + _cam_yaw = 180.0 + _cam_pivot = Vector3(0.0, 0.0, -pivot_offset) + else: + # P2 row is at world +Z (default yaw=0°). + _cam_pivot = Vector3(0.0, 0.0, pivot_offset) + _apply_camera() var board : Dictionary = state.get("board", {}) if _tile_bodies.is_empty() and not board.is_empty(): @@ -1844,6 +1969,10 @@ func _on_state_updated(state: Dictionary) -> void: _update_tile_affinity(c.get("x", 0), c.get("y", 0), tile.get("resolvedAffinity", "Void")) + # Play damage/death animations on existing unit nodes before the rebuild + # destroys them. These play for one frame — enough for a flash effect and + # as a foundation for a future deferred-rebuild architecture. + _play_damage_animations(state) _rebuild_units(state) var hand := Game.get_hand() print("[GameScreen] state phase=", state.get("phase","?"), diff --git a/Client/origin-client/scenes/game/in_game_settings.gd.uid b/Client/origin-client/scenes/game/in_game_settings.gd.uid new file mode 100644 index 0000000..2c968aa --- /dev/null +++ b/Client/origin-client/scenes/game/in_game_settings.gd.uid @@ -0,0 +1 @@ +uid://02h6fbskf8bq diff --git a/Server/src/SOR.Admin/Components/Pages/Cards/CardEditor.razor b/Server/src/SOR.Admin/Components/Pages/Cards/CardEditor.razor index c1e9792..75db9aa 100644 --- a/Server/src/SOR.Admin/Components/Pages/Cards/CardEditor.razor +++ b/Server/src/SOR.Admin/Components/Pages/Cards/CardEditor.razor @@ -323,7 +323,7 @@ else
Animation Bindings
- + @foreach (var anim in _card.AnimationBindings) { @@ -333,6 +333,10 @@ else +
ActionAnimation CDN URLCast Sound URLImpact Sound URLAIUpload
ActionGLB Track NameAnimation CDN URLCast Sound URLImpact Sound URLAIUpload
+ + diff --git a/Server/src/SOR.Admin/Components/Pages/Content/CdnBrowser.razor b/Server/src/SOR.Admin/Components/Pages/Content/CdnBrowser.razor index d491f9b..a619f10 100644 --- a/Server/src/SOR.Admin/Components/Pages/Content/CdnBrowser.razor +++ b/Server/src/SOR.Admin/Components/Pages/Content/CdnBrowser.razor @@ -1,5 +1,6 @@ @page "/content/cdn" @attribute [Authorize(Roles = "Admin,SuperAdmin")] +@implements IDisposable @using Amazon.S3 @using Amazon.S3.Model @using Microsoft.AspNetCore.Components.Forms @@ -283,10 +284,11 @@ @@ -309,6 +327,24 @@ } + @code { private readonly List _items = new(); @@ -345,6 +381,10 @@ // 3D preview private string? _previewUrl; + private List _previewAnimations = new(); + private string _selectedAnimation = ""; + private DotNetObjectReference? _dotNetRef; + private bool _animWatcherActive; private string _activePrefixDisplay => string.IsNullOrEmpty(_activePrefix) ? "/" : $"/{_activePrefix}"; @@ -384,8 +424,45 @@ private void OpenPreview(string url) { _previewUrl = url; + _previewAnimations.Clear(); + _selectedAnimation = ""; + _animWatcherActive = false; } + private void ClosePreview() + { + _previewUrl = null; + _previewAnimations.Clear(); + _selectedAnimation = ""; + _animWatcherActive = false; + } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (_previewUrl is not null && !_animWatcherActive) + { + _animWatcherActive = true; + _dotNetRef ??= DotNetObjectReference.Create(this); + await Js.InvokeVoidAsync("sorCdn.initModelViewerAnimations", "mv-preview", _dotNetRef); + } + } + + [JSInvokable] + public void OnAnimationsLoaded(string[] animations) + { + _previewAnimations = animations.ToList(); + _selectedAnimation = ""; + StateHasChanged(); + } + + private async Task OnAnimationSelected(ChangeEventArgs e) + { + _selectedAnimation = e.Value?.ToString() ?? ""; + await Js.InvokeVoidAsync("sorCdn.setModelAnimation", "mv-preview", _selectedAnimation); + } + + public void Dispose() => _dotNetRef?.Dispose(); + protected override async Task OnInitializedAsync() { var options = CdnOptionsAccessor.Value; diff --git a/Server/src/SOR.Content/ContentMessages.cs b/Server/src/SOR.Content/ContentMessages.cs index c9ea433..d274a0a 100644 --- a/Server/src/SOR.Content/ContentMessages.cs +++ b/Server/src/SOR.Content/ContentMessages.cs @@ -108,6 +108,7 @@ public sealed record CardAnimationBindingDto( string ActionName, string AnimationCdnUrl, bool IsAiGenerated, + string? AnimationTrackName, string? CastSoundCdnUrl, string? ImpactSoundCdnUrl); diff --git a/Server/src/SOR.Content/Handlers/ContentDtoMapper.cs b/Server/src/SOR.Content/Handlers/ContentDtoMapper.cs index 1a8222b..31e41e3 100644 --- a/Server/src/SOR.Content/Handlers/ContentDtoMapper.cs +++ b/Server/src/SOR.Content/Handlers/ContentDtoMapper.cs @@ -57,6 +57,7 @@ internal static class ContentDtoMapper b.ActionName, b.AnimationCdnUrl, b.IsAiGenerated, + b.AnimationTrackName, b.CastSoundCdnUrl, b.ImpactSoundCdnUrl))); } diff --git a/Server/src/SOR.Database/Entities/Catalog/CardAnimationBinding.cs b/Server/src/SOR.Database/Entities/Catalog/CardAnimationBinding.cs index ff612fe..f63253c 100644 --- a/Server/src/SOR.Database/Entities/Catalog/CardAnimationBinding.cs +++ b/Server/src/SOR.Database/Entities/Catalog/CardAnimationBinding.cs @@ -32,6 +32,14 @@ public sealed class CardAnimationBinding /// public bool IsAiGenerated { get; set; } + /// + /// The animation track name inside the card's GLB model that should play for this action. + /// When null or empty, the client falls back to convention (case-insensitive match of ActionName + /// against the model's animation list, with common aliases: death→dying, defend→damaged, etc.). + /// Use this to map non-standard GLB track names exported by artists. + /// + public string? AnimationTrackName { get; set; } + /// CDN URL to the sound played when this action begins (e.g. cast, attack swing). public string? CastSoundCdnUrl { get; set; } diff --git a/Server/src/SOR.Database/Migrations/Catalog/20260315175036_AddAnimationTrackName.Designer.cs b/Server/src/SOR.Database/Migrations/Catalog/20260315175036_AddAnimationTrackName.Designer.cs new file mode 100644 index 0000000..132f277 --- /dev/null +++ b/Server/src/SOR.Database/Migrations/Catalog/20260315175036_AddAnimationTrackName.Designer.cs @@ -0,0 +1,445 @@ +// +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("20260315175036_AddAnimationTrackName")] + partial class AddAnimationTrackName + { + /// + 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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ActionName") + .IsRequired() + .HasColumnType("text"); + + b.Property("AnimationCdnUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("AnimationTrackName") + .HasColumnType("text"); + + b.Property("CardDefinitionId") + .HasColumnType("uuid"); + + b.Property("CastSoundCdnUrl") + .HasColumnType("text"); + + b.Property("ImpactSoundCdnUrl") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AssetType") + .IsRequired() + .HasColumnType("text"); + + b.Property("CardDefinitionId") + .HasColumnType("uuid"); + + b.Property("CdnUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("IsAiGenerated") + .HasColumnType("boolean"); + + b.Property("MimeType") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CardDefinitionId", "AssetType"); + + b.ToTable("card_assets", "catalog"); + }); + + modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AbilitiesJson") + .HasColumnType("jsonb") + .HasColumnName("abilities"); + + b.Property("Affinity") + .IsRequired() + .HasColumnType("text"); + + b.Property("AttackType") + .HasColumnType("text"); + + b.Property("CanAttack") + .HasColumnType("boolean"); + + b.Property("CanBeAttacked") + .HasColumnType("boolean"); + + b.Property("CanBeBlocked") + .HasColumnType("boolean"); + + b.Property("CanBeObstructed") + .HasColumnType("boolean"); + + b.Property("CanBeSacrificed") + .HasColumnType("boolean"); + + b.Property("CanDefend") + .HasColumnType("boolean"); + + b.Property("CanMove") + .HasColumnType("boolean"); + + b.Property("CanUseAbility") + .HasColumnType("boolean"); + + b.Property("CardType") + .IsRequired() + .HasColumnType("text"); + + b.Property("CollectorNumber") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Damage") + .HasColumnType("integer"); + + b.Property("DefinitionVersion") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasDefaultValue(0L); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EffectsJson") + .HasColumnType("jsonb") + .HasColumnName("effects"); + + b.Property("Genus") + .HasColumnType("text[]"); + + b.Property("IsPublished") + .HasColumnType("boolean"); + + b.Property("IsRetired") + .HasColumnType("boolean"); + + b.Property("MaxAttackRange") + .HasColumnType("integer"); + + b.Property("MaxChannelRange") + .HasColumnType("integer"); + + b.Property("MaxDefense") + .HasColumnType("integer"); + + b.Property("MaxHealth") + .HasColumnType("integer"); + + b.Property("MinAttackRange") + .HasColumnType("integer"); + + b.Property("MinChannelRange") + .HasColumnType("integer"); + + b.Property("MovementPoints") + .HasColumnType("integer"); + + b.Property("MovementType") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("OtherCostsJson") + .HasColumnType("jsonb") + .HasColumnName("other_costs"); + + b.Property("PreviousTierId") + .HasColumnType("uuid"); + + b.Property("Rarity") + .IsRequired() + .HasColumnType("text"); + + b.Property("RequiresLos") + .HasColumnType("boolean"); + + b.Property("RetiredAt") + .HasColumnType("timestamp with time zone"); + + b.Property("SetId") + .HasColumnType("uuid"); + + b.Property("SpCost") + .HasColumnType("integer"); + + b.Property("StCost") + .HasColumnType("integer"); + + b.Property("TerramorphaMode") + .HasColumnType("text"); + + b.Property("Tier") + .HasColumnType("integer"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Code") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ContentType") + .HasColumnType("text"); + + b.Property("IsAiGenerated") + .HasColumnType("boolean"); + + b.Property("ObjectKey") + .IsRequired() + .HasColumnType("text"); + + b.Property("Prefix") + .IsRequired() + .HasColumnType("text"); + + b.Property("PublicUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Context") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("TrackCdnUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("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.TileModelBinding", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Affinity") + .IsRequired() + .HasColumnType("text"); + + b.Property("ModelCdnKey") + .IsRequired() + .HasColumnType("text"); + + b.Property("ModelPublicUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("Shape") + .IsRequired() + .HasColumnType("text"); + + b.Property("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 + } + } +} diff --git a/Server/src/SOR.Database/Migrations/Catalog/20260315175036_AddAnimationTrackName.cs b/Server/src/SOR.Database/Migrations/Catalog/20260315175036_AddAnimationTrackName.cs new file mode 100644 index 0000000..f9bbe34 --- /dev/null +++ b/Server/src/SOR.Database/Migrations/Catalog/20260315175036_AddAnimationTrackName.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SOR.Database.Migrations.Catalog +{ + /// + public partial class AddAnimationTrackName : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "AnimationTrackName", + schema: "catalog", + table: "card_animation_bindings", + type: "text", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "AnimationTrackName", + schema: "catalog", + table: "card_animation_bindings"); + } + } +} diff --git a/Server/src/SOR.Database/Migrations/Catalog/CatalogDbContextModelSnapshot.cs b/Server/src/SOR.Database/Migrations/Catalog/CatalogDbContextModelSnapshot.cs index 91e42da..3a44890 100644 --- a/Server/src/SOR.Database/Migrations/Catalog/CatalogDbContextModelSnapshot.cs +++ b/Server/src/SOR.Database/Migrations/Catalog/CatalogDbContextModelSnapshot.cs @@ -37,6 +37,9 @@ namespace SOR.Database.Migrations.Catalog .IsRequired() .HasColumnType("text"); + b.Property("AnimationTrackName") + .HasColumnType("text"); + b.Property("CardDefinitionId") .HasColumnType("uuid");