diff --git a/Client/origin-client/autoloads/ContentCache.gd b/Client/origin-client/autoloads/ContentCache.gd index 1d4266a..939e3fe 100644 --- a/Client/origin-client/autoloads/ContentCache.gd +++ b/Client/origin-client/autoloads/ContentCache.gd @@ -36,6 +36,9 @@ var _is_syncing: bool = false ## "Affinity_Shape" (e.g. "Forest_Square") → CDN model URL string var _tile_models: Dictionary = {} +## "Affinity_Shape" → CDN texture URL string (2D texture for placeholder tiles) +var _tile_textures: Dictionary = {} + ## Array of CDN URL strings for tile bottom (stalagmite) models. var _tile_bottom_urls: Array = [] @@ -115,6 +118,11 @@ func get_tile_model_url(affinity: String, shape: String) -> String: return _tile_models.get(affinity + "_" + shape, "") +## Return the CDN URL for a tile's 2D placeholder texture, or "" if not assigned. +func get_tile_texture_url(affinity: String, shape: String) -> String: + return _tile_textures.get(affinity + "_" + shape, "") + + ## Returns a random active tile bottom (stalagmite) CDN URL, or "" if none configured. func get_random_tile_bottom_url() -> String: if _tile_bottom_urls.is_empty(): @@ -193,13 +201,18 @@ func _on_tile_models(payload: Variant) -> void: var p := payload as Dictionary var bindings : Array = p.get("bindings", []) _tile_models.clear() + _tile_textures.clear() for item in bindings: var d := item as Dictionary if d == null: continue var key := str(d.get("affinity", "")) + "_" + str(d.get("shape", "")) - var url := str(d.get("modelPublicUrl", "")) - if not key.is_empty() and not url.is_empty(): - _tile_models[key] = url + if key.is_empty(): continue + var model_url := str(d.get("modelPublicUrl", "")) + if not model_url.is_empty(): + _tile_models[key] = model_url + var tex_url := str(d.get("texturePublicUrl", "")) + if not tex_url.is_empty() and tex_url != "null": + _tile_textures[key] = tex_url _save_tile_models_to_disk() tile_models_ready.emit() diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index 5ee1d99..804a4ff 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -376,9 +376,13 @@ func _touch_pair_dist() -> float: # ── Coord helpers ───────────────────────────────────────────────────────────── +## Grid spacing: 1.0 tile + 0.1 gap between tiles (visual only). +const TILE_SPACING := 1.1 + func _coord_to_world(x: int, y: int) -> Vector3: - return Vector3(x - (Game.board_width() - 1) * 0.5, 0.0, - y - (Game.board_height() - 1) * 0.5) + return Vector3( + x * TILE_SPACING - (Game.board_width() - 1) * TILE_SPACING * 0.5, 0.0, + y * TILE_SPACING - (Game.board_height() - 1) * TILE_SPACING * 0.5) func _mouse_to_tile_coord(mouse_pos: Vector2) -> Vector2i: @@ -449,13 +453,17 @@ func _build_board(board: Dictionary) -> void: func _add_tile(x: int, y: int, affinity: String) -> void: var wp := _coord_to_world(x, y) - # Deterministic random height per tile (seeded by coord) so the same board - # always produces the same heights. Bottom is fixed at world Y=0; the TOP - # varies between 0.8 and 1.0, giving each tile a distinct elevation visible - # from the camera angle. - var rng := RandomNumberGenerator.new() - rng.seed = hash("%d_%d" % [x, y]) - var h : float = rng.randf_range(0.8, 1.0) + # Tiles with a 3D model get a small randomised height (0.8-1.0) for visual + # variety. Placeholder tiles (no model assigned) are a fixed 0.5 height + # so they read clearly as "undecorated" without towering over the board. + var has_model : bool = not ContentCache.get_tile_model_url(affinity, "Square").is_empty() + var h : float + if has_model: + var rng := RandomNumberGenerator.new() + rng.seed = hash("%d_%d" % [x, y]) + h = rng.randf_range(0.8, 1.0) + else: + h = 0.5 _tile_heights["%d,%d" % [x, y]] = h var body := StaticBody3D.new() @@ -493,6 +501,14 @@ func _add_tile(x: int, y: int, affinity: String) -> void: func _try_load_tile_model(body: StaticBody3D, affinity: String) -> void: var model_url := ContentCache.get_tile_model_url(affinity, "Square") if model_url.is_empty(): + # No 3D model — apply a 2D texture to the placeholder box and attach + # a stalagmite bottom so undecorated tiles still look coherent. + var tex_url := ContentCache.get_tile_texture_url(affinity, "Square") + if not tex_url.is_empty(): + _apply_tile_texture(body, tex_url) + var bottom_url := ContentCache.get_random_tile_bottom_url() + if not bottom_url.is_empty(): + _try_load_tile_bottom(weakref(body), bottom_url) return var body_ref : Variant = weakref(body) @@ -554,6 +570,45 @@ func _try_load_tile_bottom(body_ref: Variant, url: String) -> void: ) +## Downloads a CDN image and applies it as the albedo texture on the +## placeholder BoxMesh of a tile body (used when no 3D model is assigned). +func _apply_tile_texture(body: StaticBody3D, tex_url: String) -> void: + var mi : MeshInstance3D = null + for child in body.get_children(): + if child is MeshInstance3D: + mi = child as MeshInstance3D + break + if mi == null or tex_url.is_empty(): + return + var requester := HTTPRequest.new() + add_child(requester) + requester.request_completed.connect( + func(_result: int, code: int, _headers: PackedStringArray, data: PackedByteArray) -> void: + requester.queue_free() + if code < 200 or code >= 300 or not is_instance_valid(mi): + return + var img := Image.new() + var ext := tex_url.get_extension().to_lower() + var err : int + if ext in ["jpg", "jpeg"]: + err = img.load_jpg_from_buffer(data) + elif ext == "webp": + err = img.load_webp_from_buffer(data) + else: + err = img.load_png_from_buffer(data) + if err != OK: + return + var tex := ImageTexture.create_from_image(img) + var mat := mi.material_override as StandardMaterial3D + if mat == null: + mat = StandardMaterial3D.new() + mat.roughness = 0.85 + mi.material_override = mat + mat.albedo_texture = tex + ) + requester.request(tex_url) + + ## Scales model so its largest XZ dimension equals `tile_size`, then centres ## it on XZ and seats the bottom at y = 0 in the parent body's local space. func _fit_model_to_tile(model: Node3D, tile_size: float) -> void: diff --git a/Server/src/SOR.Admin/Components/Pages/Content/TileModelManagerPage.razor b/Server/src/SOR.Admin/Components/Pages/Content/TileModelManagerPage.razor index a5c6910..3b0c983 100644 --- a/Server/src/SOR.Admin/Components/Pages/Content/TileModelManagerPage.razor +++ b/Server/src/SOR.Admin/Components/Pages/Content/TileModelManagerPage.razor @@ -49,7 +49,9 @@ else Affinity Square Model + Square Texture Hex Model + Hex Texture @@ -63,9 +65,15 @@ else @ModelCell(squareBinding, affinity, TileShape.Square) + + @TextureCell(squareBinding, affinity, TileShape.Square) + @ModelCell(hexBinding, affinity, TileShape.Hex) + + @TextureCell(hexBinding, affinity, TileShape.Hex) + } @@ -308,6 +316,75 @@ else } + +@if (_texPickerOpen) +{ + +} + @code { @@ -346,6 +423,15 @@ else ("Gateways", new[] { Affinity.GatewayLake, Affinity.GatewayHill, Affinity.GatewayForest, Affinity.GatewayField }), }; + // Texture picker state + private bool _texPickerOpen; + private bool _texPickerLoading; + private Affinity _texPickerAffinity; + private TileShape _texPickerShape; + private string _texPickerSearch = ""; + private string? _texPickerSelected; + private List _texPickerItems = new(); + // Tile bottom models private List _bottomModels = new(); private bool _bottomPickerOpen; @@ -495,6 +581,145 @@ else _isError = false; } + // ── Texture Picker ──────────────────────────────────────────────────────── + + private async Task OpenTexPickerAsync(Affinity affinity, TileShape shape) + { + _texPickerAffinity = affinity; + _texPickerShape = shape; + _texPickerSelected = _bindings.TryGetValue((affinity, shape), out var b) ? b.TexturePublicUrl : null; + _texPickerSearch = ""; + _texPickerOpen = true; + _texPickerLoading = true; + await LoadTexPickerItemsAsync(); + } + + private async Task LoadTexPickerItemsAsync() + { + try + { + var options = CdnOptionsAccessor.Value; + var request = new ListObjectsV2Request + { + BucketName = options.BucketName, + Prefix = "textures/", + MaxKeys = 1000, + }; + var response = await S3.ListObjectsV2Async(request); + _texPickerItems = response.S3Objects + .Where(o => !o.Key.EndsWith('/') && IsImageKey(o.Key)) + .Select(o => new TexItem + { + Key = o.Key, + ShortName = o.Key.Contains('/') ? o.Key[(o.Key.LastIndexOf('/') + 1)..] : o.Key, + PublicUrl = BuildPublicUrl(options, o.Key), + }) + .OrderBy(t => t.Key) + .ToList(); + } + catch (Exception ex) + { + _message = $"Failed to load CDN textures: {ex.Message}"; + _isError = true; + } + finally { _texPickerLoading = false; } + } + + private IEnumerable TexPickerFiltered() => + string.IsNullOrWhiteSpace(_texPickerSearch) + ? _texPickerItems + : _texPickerItems.Where(t => t.Key.Contains(_texPickerSearch, StringComparison.OrdinalIgnoreCase)); + + private void CloseTexPicker() + { + _texPickerOpen = false; + _texPickerItems = new(); + _texPickerSelected = null; + } + + private async Task SaveTextureAsync() + { + if (_texPickerSelected is null) return; + _saving = true; + try + { + var binding = await Db.TileModelBindings + .FirstOrDefaultAsync(b => b.Affinity == _texPickerAffinity && b.Shape == _texPickerShape); + + if (binding is null) + { + // Create a texture-only binding (no 3D model yet). + binding = new TileModelBinding + { + Affinity = _texPickerAffinity, + Shape = _texPickerShape, + ModelCdnKey = "", + ModelPublicUrl = "", + }; + Db.TileModelBindings.Add(binding); + } + + binding.TexturePublicUrl = _texPickerSelected; + binding.UpdatedAt = DateTimeOffset.UtcNow; + await Db.SaveChangesAsync(); + + _bindings[(_texPickerAffinity, _texPickerShape)] = binding; + _message = $"Texture assigned to {_texPickerAffinity} / {_texPickerShape}."; + _isError = false; + CloseTexPicker(); + } + catch (Exception ex) + { + _message = $"Save failed: {ex.Message}"; + _isError = true; + } + finally { _saving = false; } + } + + private async Task ClearTextureAsync(Affinity affinity, TileShape shape) + { + var binding = await Db.TileModelBindings + .FirstOrDefaultAsync(b => b.Affinity == affinity && b.Shape == shape); + if (binding is null) return; + + binding.TexturePublicUrl = null; + binding.UpdatedAt = DateTimeOffset.UtcNow; + await Db.SaveChangesAsync(); + _bindings[(affinity, shape)] = binding; + _message = $"Texture cleared for {affinity} / {shape}."; + _isError = false; + } + + private RenderFragment TextureCell(TileModelBinding? binding, Affinity affinity, TileShape shape) => __builder => + { + var url = binding?.TexturePublicUrl; + if (url is not null) + { +
+ texture + + +
+ } + else + { + + } + }; + + private static bool IsImageKey(string key) => + key.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase) || + key.EndsWith(".jpeg", StringComparison.OrdinalIgnoreCase) || + key.EndsWith(".png", StringComparison.OrdinalIgnoreCase) || + key.EndsWith(".webp", StringComparison.OrdinalIgnoreCase); + // ── Tile Bottom Models ──────────────────────────────────────────────────── private async Task OpenBottomPickerAsync() @@ -608,4 +833,11 @@ else public string ShortName { get; init; } = ""; public string PublicUrl { get; init; } = ""; } + + private sealed class TexItem + { + public string Key { get; init; } = ""; + public string ShortName { get; init; } = ""; + public string PublicUrl { get; init; } = ""; + } } diff --git a/Server/src/SOR.Content/ContentMessages.cs b/Server/src/SOR.Content/ContentMessages.cs index 733b932..207ed98 100644 --- a/Server/src/SOR.Content/ContentMessages.cs +++ b/Server/src/SOR.Content/ContentMessages.cs @@ -38,9 +38,10 @@ public sealed record GetTileModelsResponse(IEnumerable Bindings); public sealed record GetTileBottomsResponse(IEnumerable Urls); public sealed record TileModelDto( - string Affinity, - string Shape, - string ModelPublicUrl); + string Affinity, + string Shape, + string ModelPublicUrl, + string? TexturePublicUrl); // ── DTOs ────────────────────────────────────────────────────────────────────── diff --git a/Server/src/SOR.Content/Handlers/ContentGetTileModelsHandler.cs b/Server/src/SOR.Content/Handlers/ContentGetTileModelsHandler.cs index a94a082..627509f 100644 --- a/Server/src/SOR.Content/Handlers/ContentGetTileModelsHandler.cs +++ b/Server/src/SOR.Content/Handlers/ContentGetTileModelsHandler.cs @@ -33,7 +33,8 @@ internal sealed class ContentGetTileModelsHandler : IMessageHandler .Select(b => new TileModelDto( b.Affinity.ToString(), b.Shape.ToString(), - b.ModelPublicUrl)) + b.ModelPublicUrl, + b.TexturePublicUrl)) .ToListAsync(ct); return ServerMessage.Reply("content.tile_models.ack", message.Seq, diff --git a/Server/src/SOR.Database/Entities/Catalog/TileModelBinding.cs b/Server/src/SOR.Database/Entities/Catalog/TileModelBinding.cs index bedec74..f07d618 100644 --- a/Server/src/SOR.Database/Entities/Catalog/TileModelBinding.cs +++ b/Server/src/SOR.Database/Entities/Catalog/TileModelBinding.cs @@ -22,5 +22,11 @@ public sealed class TileModelBinding /// Publicly accessible CDN URL for the model file. public string ModelPublicUrl { get; set; } = string.Empty; + /// + /// Optional CDN URL for a 2D texture applied to the placeholder tile mesh + /// (shown when no 3D model is assigned for this affinity). + /// + public string? TexturePublicUrl { get; set; } + public DateTimeOffset UpdatedAt { get; set; } } diff --git a/Server/src/SOR.Database/Migrations/Catalog/20260317000001_AddTileTexture.Designer.cs b/Server/src/SOR.Database/Migrations/Catalog/20260317000001_AddTileTexture.Designer.cs new file mode 100644 index 0000000..aaf68d6 --- /dev/null +++ b/Server/src/SOR.Database/Migrations/Catalog/20260317000001_AddTileTexture.Designer.cs @@ -0,0 +1,487 @@ +// +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("20260317000001_AddTileTexture")] + partial class AddTileTexture + { + /// + 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.Property("ModelFacingDirection") + .HasColumnType("text"); + + b.Property("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("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("ModelScale") + .HasColumnType("real"); + + b.Property("ModelTintColor") + .HasColumnType("text"); + + 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.TileBottomModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CdnKey") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("PublicUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("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("TexturePublicUrl") + .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/20260317000001_AddTileTexture.cs b/Server/src/SOR.Database/Migrations/Catalog/20260317000001_AddTileTexture.cs new file mode 100644 index 0000000..f185b64 --- /dev/null +++ b/Server/src/SOR.Database/Migrations/Catalog/20260317000001_AddTileTexture.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SOR.Database.Migrations.Catalog +{ + /// + public partial class AddTileTexture : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TexturePublicUrl", + schema: "catalog", + table: "tile_model_bindings", + type: "text", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "TexturePublicUrl", + schema: "catalog", + table: "tile_model_bindings"); + } + } +} diff --git a/Server/src/SOR.Database/Migrations/Catalog/CatalogDbContextModelSnapshot.cs b/Server/src/SOR.Database/Migrations/Catalog/CatalogDbContextModelSnapshot.cs index c34e3eb..ae632f1 100644 --- a/Server/src/SOR.Database/Migrations/Catalog/CatalogDbContextModelSnapshot.cs +++ b/Server/src/SOR.Database/Migrations/Catalog/CatalogDbContextModelSnapshot.cs @@ -387,6 +387,9 @@ namespace SOR.Database.Migrations.Catalog .IsRequired() .HasColumnType("text"); + b.Property("TexturePublicUrl") + .HasColumnType("text"); + b.Property("UpdatedAt") .HasColumnType("timestamp with time zone");