tilemapfix
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,207 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SystemRevivalServer.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class CreateDungeonAuthoringTables : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "tilemap_sheets",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
|
||||
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
|
||||
CdnPath = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
|
||||
Tags = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
|
||||
SheetWidth = table.Column<int>(type: "int", nullable: false),
|
||||
SheetHeight = table.Column<int>(type: "int", nullable: false),
|
||||
|
||||
TileWidth = table.Column<int>(type: "int", nullable: false),
|
||||
TileHeight = table.Column<int>(type: "int", nullable: false),
|
||||
|
||||
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_tilemap_sheets", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "room_templates",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
|
||||
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
|
||||
Description = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
|
||||
Tags = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
|
||||
Type = table.Column<int>(type: "int", nullable: false),
|
||||
|
||||
Width = table.Column<int>(type: "int", nullable: false),
|
||||
Height = table.Column<int>(type: "int", nullable: false),
|
||||
|
||||
MinTier = table.Column<int>(type: "int", nullable: false),
|
||||
MaxTier = table.Column<int>(type: "int", nullable: false),
|
||||
|
||||
Weight = table.Column<int>(type: "int", nullable: false),
|
||||
|
||||
TileDataJson = table.Column<string>(type: "json", nullable: true),
|
||||
SpawnPointsJson = table.Column<string>(type: "json", nullable: true),
|
||||
ConnectionPointsJson = table.Column<string>(type: "json", nullable: true),
|
||||
|
||||
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_room_templates", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "dungeon_templates",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
|
||||
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
|
||||
Description = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
|
||||
Tags = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
|
||||
Tier = table.Column<int>(type: "int", nullable: false),
|
||||
|
||||
Width = table.Column<int>(type: "int", nullable: false),
|
||||
Height = table.Column<int>(type: "int", nullable: false),
|
||||
|
||||
IsHandCrafted = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
|
||||
TileDataJson = table.Column<string>(type: "json", nullable: true),
|
||||
RoomPlacementsJson = table.Column<string>(type: "json", nullable: true),
|
||||
GenerationParamsJson = table.Column<string>(type: "json", nullable: true),
|
||||
|
||||
DefaultTileMapSheetId = table.Column<int>(type: "int", nullable: true),
|
||||
|
||||
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_dungeon_templates", x => x.Id);
|
||||
|
||||
table.ForeignKey(
|
||||
name: "FK_dungeon_templates_tilemap_sheets_DefaultTileMapSheetId",
|
||||
column: x => x.DefaultTileMapSheetId,
|
||||
principalTable: "tilemap_sheets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_dungeon_templates_DefaultTileMapSheetId",
|
||||
table: "dungeon_templates",
|
||||
column: "DefaultTileMapSheetId");
|
||||
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "tile_definitions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
|
||||
TileMapSheetId = table.Column<int>(type: "int", nullable: false),
|
||||
|
||||
FrameIndex = table.Column<int>(type: "int", nullable: false),
|
||||
|
||||
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
|
||||
Type = table.Column<int>(type: "int", nullable: false),
|
||||
|
||||
Tags = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
|
||||
IsWalkable = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
BlocksProjectiles = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
BlocksLineOfSight = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
|
||||
RenderLayer = table.Column<int>(type: "int", nullable: false),
|
||||
ZIndex = table.Column<int>(type: "int", nullable: false),
|
||||
|
||||
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_tile_definitions", x => x.Id);
|
||||
|
||||
table.ForeignKey(
|
||||
name: "FK_tile_definitions_tilemap_sheets_TileMapSheetId",
|
||||
column: x => x.TileMapSheetId,
|
||||
principalTable: "tilemap_sheets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_tile_definitions_TileMapSheetId",
|
||||
table: "tile_definitions",
|
||||
column: "TileMapSheetId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "tile_definitions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "dungeon_templates");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "room_templates");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "tilemap_sheets");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,72 +4,87 @@
|
||||
@{
|
||||
ViewData["Title"] = Model.Sheet.Id == 0 ? "New TileMap Sheet" : $"Edit: {Model.Sheet.Name}";
|
||||
var tileTypes = Enum.GetValues<TileType>();
|
||||
// Build image URL - handle both with and without /downloads/ path
|
||||
var imageUrl = Model.Sheet.CdnPath;
|
||||
if (!string.IsNullOrEmpty(imageUrl))
|
||||
{
|
||||
if (!imageUrl.StartsWith("http"))
|
||||
{
|
||||
// Ensure proper CDN URL construction
|
||||
var baseUrl = Model.CdnBaseUrl.TrimEnd('/');
|
||||
if (!baseUrl.EndsWith("/downloads"))
|
||||
{
|
||||
baseUrl += "/downloads";
|
||||
}
|
||||
imageUrl = $"{baseUrl}/{imageUrl.TrimStart('/')}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<div class="mb-6">
|
||||
<a href="/admin/tilemaps" class="text-blue-400 hover:text-blue-300">← Back to TileMap Sheets</a>
|
||||
<div class="mb-4 md:mb-6">
|
||||
<a href="/admin/tilemaps" class="text-blue-400 hover:text-blue-300 text-sm md:text-base">← Back to TileMap Sheets</a>
|
||||
</div>
|
||||
|
||||
@if (!string.IsNullOrEmpty(Model.Message))
|
||||
{
|
||||
<div class="mb-4 p-3 rounded @(Model.IsError ? "bg-red-900/50 text-red-300" : "bg-green-900/50 text-green-300")">
|
||||
<div class="mb-4 p-3 rounded text-sm @(Model.IsError ? "bg-red-900/50 text-red-300" : "bg-green-900/50 text-green-300")">
|
||||
@Model.Message
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="grid grid-cols-1 xl:grid-cols-2 gap-6">
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4 md:gap-6">
|
||||
<!-- Sheet Settings -->
|
||||
<div class="card">
|
||||
<h2 class="text-xl font-semibold text-white mb-4">TileMap Sheet Settings</h2>
|
||||
<div class="card p-4 md:p-6">
|
||||
<h2 class="text-lg md:text-xl font-semibold text-white mb-4">TileMap Sheet Settings</h2>
|
||||
|
||||
<form method="post">
|
||||
@Html.AntiForgeryToken()
|
||||
<input type="hidden" asp-for="Sheet.Id" />
|
||||
|
||||
<div class="space-y-4">
|
||||
<div class="space-y-3 md:space-y-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-300 mb-1">Name</label>
|
||||
<input type="text" asp-for="Sheet.Name" class="input w-full" placeholder="Dungeon Stone Tiles" />
|
||||
<input type="text" asp-for="Sheet.Name" class="input w-full text-sm md:text-base" placeholder="Dungeon Stone Tiles" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-300 mb-1">CDN Path</label>
|
||||
<div class="flex gap-2">
|
||||
<input type="text" asp-for="Sheet.CdnPath" class="input flex-1" placeholder="textures/tilemaps/dungeon.png" />
|
||||
<button type="button" onclick="showCdnBrowser()" class="btn btn-secondary">Browse</button>
|
||||
<input type="text" asp-for="Sheet.CdnPath" class="input flex-1 text-sm md:text-base" placeholder="textures/tilemaps/dungeon.png" />
|
||||
<button type="button" onclick="showCdnBrowser()" class="btn btn-secondary text-sm">Browse</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-300 mb-1">Tags (comma-separated)</label>
|
||||
<input type="text" asp-for="Sheet.Tags" class="input w-full" placeholder="dungeon, stone, dark" />
|
||||
<input type="text" asp-for="Sheet.Tags" class="input w-full text-sm md:text-base" placeholder="dungeon, stone, dark" />
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div class="grid grid-cols-2 gap-2 md:gap-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-300 mb-1">Sheet Width (px)</label>
|
||||
<input type="number" asp-for="Sheet.SheetWidth" class="input w-full" />
|
||||
<input type="number" asp-for="Sheet.SheetWidth" class="input w-full text-sm" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-300 mb-1">Sheet Height (px)</label>
|
||||
<input type="number" asp-for="Sheet.SheetHeight" class="input w-full" />
|
||||
<input type="number" asp-for="Sheet.SheetHeight" class="input w-full text-sm" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div class="grid grid-cols-2 gap-2 md:gap-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-300 mb-1">Tile Width (px)</label>
|
||||
<input type="number" asp-for="Sheet.TileWidth" class="input w-full" />
|
||||
<input type="number" asp-for="Sheet.TileWidth" class="input w-full text-sm" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-300 mb-1">Tile Height (px)</label>
|
||||
<input type="number" asp-for="Sheet.TileHeight" class="input w-full" />
|
||||
<input type="number" asp-for="Sheet.TileHeight" class="input w-full text-sm" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="checkbox" asp-for="Sheet.IsEnabled" class="rounded" />
|
||||
<label asp-for="Sheet.IsEnabled" class="text-gray-300">Enabled</label>
|
||||
<label asp-for="Sheet.IsEnabled" class="text-gray-300 text-sm">Enabled</label>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary w-full">
|
||||
@@ -80,28 +95,30 @@
|
||||
</div>
|
||||
|
||||
<!-- Preview -->
|
||||
<div class="card">
|
||||
<h2 class="text-xl font-semibold text-white mb-4">Preview</h2>
|
||||
<div class="card p-4 md:p-6">
|
||||
<h2 class="text-lg md:text-xl font-semibold text-white mb-4">Preview</h2>
|
||||
|
||||
@if (!string.IsNullOrEmpty(Model.Sheet.CdnPath))
|
||||
{
|
||||
<div class="bg-gray-900 rounded-lg p-4 overflow-auto max-h-96">
|
||||
<div class="bg-gray-900 rounded-lg p-2 md:p-4 overflow-auto" style="max-height: 50vh;">
|
||||
<div class="relative inline-block" style="image-rendering: pixelated;">
|
||||
<img src="@Model.CdnBaseUrl/@Model.Sheet.CdnPath"
|
||||
<img src="@imageUrl"
|
||||
alt="@Model.Sheet.Name"
|
||||
id="sheetPreview"
|
||||
class="max-w-none" />
|
||||
class="max-w-none"
|
||||
onerror="this.onerror=null; this.parentElement.innerHTML='<div class=\'p-4 text-red-400 text-sm\'>Failed to load image. Check CDN path.</div>';" />
|
||||
<!-- Grid overlay will be drawn by JavaScript -->
|
||||
<canvas id="gridOverlay" class="absolute top-0 left-0 pointer-events-none"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-sm text-gray-400 mt-2">
|
||||
Grid: @Model.Sheet.Columns columns × @Model.Sheet.Rows rows = @Model.Sheet.TotalTiles tiles
|
||||
<p class="text-xs md:text-sm text-gray-400 mt-2">
|
||||
Grid: @Model.Sheet.Columns × @Model.Sheet.Rows = @Model.Sheet.TotalTiles tiles
|
||||
</p>
|
||||
<p class="text-xs text-gray-500 mt-1 break-all">URL: @imageUrl</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="bg-gray-900 rounded-lg p-8 text-center text-gray-500">
|
||||
<div class="bg-gray-900 rounded-lg p-8 text-center text-gray-500 text-sm">
|
||||
Select a CDN path to preview the tilemap
|
||||
</div>
|
||||
}
|
||||
@@ -111,32 +128,33 @@
|
||||
@if (Model.Sheet.Id > 0)
|
||||
{
|
||||
<!-- Tile Editor Section -->
|
||||
<div class="card mt-6">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h2 class="text-xl font-semibold text-white">Tile Definitions</h2>
|
||||
<div class="card p-4 md:p-6 mt-4 md:mt-6">
|
||||
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-4">
|
||||
<h2 class="text-lg md:text-xl font-semibold text-white">Tile Definitions</h2>
|
||||
<div class="flex gap-2">
|
||||
<form method="post" asp-page-handler="AutoGenerate" class="inline">
|
||||
<form method="post" asp-page-handler="AutoGenerate" class="flex gap-2">
|
||||
<input type="hidden" name="sheetId" value="@Model.Sheet.Id" />
|
||||
<select name="defaultType" class="input">
|
||||
<select name="defaultType" class="input text-sm py-1">
|
||||
<option value="0">Floor (walkable)</option>
|
||||
<option value="1">Wall (blocked)</option>
|
||||
</select>
|
||||
<button type="submit" class="btn btn-secondary">Auto-Generate All</button>
|
||||
<button type="submit" class="btn btn-secondary text-sm py-1">Auto-Generate</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="text-gray-400 mb-4">Click on a tile to define its properties. Defined tiles: @Model.TileDefinitions.Count / @Model.Sheet.TotalTiles</p>
|
||||
<p class="text-gray-400 text-sm mb-4">Click on a tile to define its properties. Defined: @Model.TileDefinitions.Count / @Model.Sheet.TotalTiles</p>
|
||||
|
||||
<!-- Interactive Tile Grid -->
|
||||
<div class="bg-gray-900 rounded-lg p-4 overflow-auto">
|
||||
<div class="bg-gray-900 rounded-lg p-2 md:p-4 overflow-auto" style="max-height: 60vh;">
|
||||
<div class="relative inline-block" id="tileGridContainer" style="image-rendering: pixelated;">
|
||||
@if (!string.IsNullOrEmpty(Model.Sheet.CdnPath))
|
||||
{
|
||||
<img src="@Model.CdnBaseUrl/@Model.Sheet.CdnPath"
|
||||
<img src="@imageUrl"
|
||||
alt="@Model.Sheet.Name"
|
||||
id="tileGridImage"
|
||||
class="max-w-none" />
|
||||
class="max-w-none"
|
||||
onerror="this.style.display='none';" />
|
||||
|
||||
<!-- Clickable tile overlay -->
|
||||
<div id="tileClickOverlay" class="absolute top-0 left-0"
|
||||
@@ -150,14 +168,10 @@
|
||||
var hasDefinition = tileDef != null;
|
||||
var tileColor = hasDefinition ? GetTileTypeColor(tileDef!.Type) : "transparent";
|
||||
|
||||
<div class="absolute cursor-pointer border border-gray-700/50 hover:border-yellow-400 hover:bg-yellow-400/20 transition-all"
|
||||
<div class="absolute cursor-pointer border border-gray-600/30 hover:border-yellow-400 hover:bg-yellow-400/30 transition-all"
|
||||
style="left: @(col * Model.Sheet.TileWidth)px; top: @(row * Model.Sheet.TileHeight)px; width: @(Model.Sheet.TileWidth)px; height: @(Model.Sheet.TileHeight)px; background-color: @tileColor;"
|
||||
onclick="openTileEditor(@frameIndex, @(tileDef?.Id ?? 0))"
|
||||
title="Frame @frameIndex @(hasDefinition ? $"({tileDef!.Type})" : "(undefined)")">
|
||||
@if (hasDefinition)
|
||||
{
|
||||
<span class="absolute bottom-0 right-0 text-[8px] text-white bg-black/50 px-0.5">@frameIndex</span>
|
||||
}
|
||||
title="Frame @frameIndex @(hasDefinition ? $"({tileDef!.Type})" : "")">
|
||||
</div>
|
||||
}
|
||||
}
|
||||
@@ -167,36 +181,36 @@
|
||||
</div>
|
||||
|
||||
<!-- Tile Type Legend -->
|
||||
<div class="mt-4 flex flex-wrap gap-2">
|
||||
<span class="text-sm text-gray-400">Legend:</span>
|
||||
<span class="px-2 py-0.5 text-xs rounded" style="background-color: rgba(34, 197, 94, 0.3);">Floor</span>
|
||||
<span class="px-2 py-0.5 text-xs rounded" style="background-color: rgba(239, 68, 68, 0.3);">Wall</span>
|
||||
<span class="px-2 py-0.5 text-xs rounded" style="background-color: rgba(168, 85, 247, 0.3);">Door</span>
|
||||
<span class="px-2 py-0.5 text-xs rounded" style="background-color: rgba(59, 130, 246, 0.3);">Water</span>
|
||||
<span class="px-2 py-0.5 text-xs rounded" style="background-color: rgba(249, 115, 22, 0.3);">Lava</span>
|
||||
<span class="px-2 py-0.5 text-xs rounded" style="background-color: rgba(234, 179, 8, 0.3);">Spawn</span>
|
||||
<div class="mt-3 flex flex-wrap gap-1 md:gap-2 text-xs">
|
||||
<span class="text-gray-400">Legend:</span>
|
||||
<span class="px-1.5 py-0.5 rounded" style="background-color: rgba(34, 197, 94, 0.3);">Floor</span>
|
||||
<span class="px-1.5 py-0.5 rounded" style="background-color: rgba(239, 68, 68, 0.3);">Wall</span>
|
||||
<span class="px-1.5 py-0.5 rounded" style="background-color: rgba(168, 85, 247, 0.3);">Door</span>
|
||||
<span class="px-1.5 py-0.5 rounded" style="background-color: rgba(59, 130, 246, 0.3);">Water</span>
|
||||
<span class="px-1.5 py-0.5 rounded" style="background-color: rgba(249, 115, 22, 0.3);">Lava</span>
|
||||
<span class="px-1.5 py-0.5 rounded" style="background-color: rgba(234, 179, 8, 0.3);">Spawn</span>
|
||||
</div>
|
||||
|
||||
<!-- Defined Tiles Table -->
|
||||
@if (Model.TileDefinitions.Count > 0)
|
||||
{
|
||||
<div class="mt-6">
|
||||
<h3 class="text-lg font-semibold text-white mb-3">Defined Tiles</h3>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-sm">
|
||||
<h3 class="text-base md:text-lg font-semibold text-white mb-3">Defined Tiles (@Model.TileDefinitions.Count)</h3>
|
||||
<div class="overflow-x-auto -mx-4 md:mx-0">
|
||||
<table class="w-full text-xs md:text-sm min-w-[600px]">
|
||||
<thead>
|
||||
<tr class="text-left text-gray-400 border-b border-gray-700">
|
||||
<th class="p-2">Frame</th>
|
||||
<th class="p-2">#</th>
|
||||
<th class="p-2">Preview</th>
|
||||
<th class="p-2">Name</th>
|
||||
<th class="p-2">Type</th>
|
||||
<th class="p-2">Tags</th>
|
||||
<th class="p-2">Properties</th>
|
||||
<th class="p-2">Props</th>
|
||||
<th class="p-2">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var tile in Model.TileDefinitions)
|
||||
@foreach (var tile in Model.TileDefinitions.Take(50))
|
||||
{
|
||||
var col = tile.FrameIndex % Model.Sheet.Columns;
|
||||
var row = tile.FrameIndex / Model.Sheet.Columns;
|
||||
@@ -204,32 +218,36 @@
|
||||
<tr class="border-b border-gray-800 hover:bg-gray-800/50">
|
||||
<td class="p-2 text-gray-300">@tile.FrameIndex</td>
|
||||
<td class="p-2">
|
||||
<div class="w-8 h-8 bg-gray-900 overflow-hidden" style="image-rendering: pixelated;">
|
||||
<div style="width: @(Model.Sheet.TileWidth)px; height: @(Model.Sheet.TileHeight)px; background-image: url('@Model.CdnBaseUrl/@Model.Sheet.CdnPath'); background-position: -@(col * Model.Sheet.TileWidth)px -@(row * Model.Sheet.TileHeight)px; transform: scale(@(32.0 / Model.Sheet.TileWidth));"></div>
|
||||
<div class="w-6 h-6 md:w-8 md:h-8 bg-gray-900 overflow-hidden" style="image-rendering: pixelated;">
|
||||
<div style="width: @(Model.Sheet.TileWidth)px; height: @(Model.Sheet.TileHeight)px; background-image: url('@imageUrl'); background-position: -@(col * Model.Sheet.TileWidth)px -@(row * Model.Sheet.TileHeight)px; transform: scale(@(24.0 / Model.Sheet.TileWidth)); transform-origin: top left;"></div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="p-2 text-gray-300">@(tile.Name ?? "-")</td>
|
||||
<td class="p-2 text-gray-300 max-w-[100px] truncate">@(tile.Name ?? "-")</td>
|
||||
<td class="p-2">
|
||||
<span class="px-2 py-0.5 text-xs rounded" style="background-color: @GetTileTypeColor(tile.Type);">@tile.Type</span>
|
||||
<span class="px-1.5 py-0.5 text-xs rounded" style="background-color: @GetTileTypeColor(tile.Type);">@tile.Type</span>
|
||||
</td>
|
||||
<td class="p-2 text-gray-400 text-xs">@(tile.Tags ?? "-")</td>
|
||||
<td class="p-2 text-gray-400 text-xs max-w-[80px] truncate">@(tile.Tags ?? "-")</td>
|
||||
<td class="p-2 text-xs">
|
||||
@if (tile.IsWalkable) { <span class="text-green-400">Walk</span> }
|
||||
@if (tile.BlocksProjectiles) { <span class="text-red-400 ml-1">NoProj</span> }
|
||||
@if (tile.BlocksLineOfSight) { <span class="text-yellow-400 ml-1">NoLOS</span> }
|
||||
@if (tile.IsWalkable) { <span class="text-green-400">W</span> }
|
||||
@if (tile.BlocksProjectiles) { <span class="text-red-400">P</span> }
|
||||
@if (tile.BlocksLineOfSight) { <span class="text-yellow-400">L</span> }
|
||||
</td>
|
||||
<td class="p-2">
|
||||
<button onclick="openTileEditor(@tile.FrameIndex, @tile.Id)" class="text-blue-400 hover:text-blue-300 mr-2">Edit</button>
|
||||
<button onclick="openTileEditor(@tile.FrameIndex, @tile.Id)" class="text-blue-400 hover:text-blue-300 mr-1">Edit</button>
|
||||
<form method="post" asp-page-handler="DeleteTile" class="inline">
|
||||
<input type="hidden" name="tileId" value="@tile.Id" />
|
||||
<input type="hidden" name="sheetId" value="@Model.Sheet.Id" />
|
||||
<button type="submit" class="text-red-400 hover:text-red-300" onclick="return confirm('Delete?')">Delete</button>
|
||||
<button type="submit" class="text-red-400 hover:text-red-300" onclick="return confirm('Delete?')">×</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
@if (Model.TileDefinitions.Count > 50)
|
||||
{
|
||||
<p class="text-gray-500 text-xs p-2">Showing first 50 of @Model.TileDefinitions.Count tiles</p>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -237,8 +255,8 @@
|
||||
}
|
||||
|
||||
<!-- Tile Editor Modal -->
|
||||
<div id="tileEditorModal" class="fixed inset-0 bg-black/50 z-50 hidden items-center justify-center">
|
||||
<div class="bg-gray-900 rounded-xl shadow-xl p-6 w-full max-w-md mx-4 border border-gray-700">
|
||||
<div id="tileEditorModal" class="fixed inset-0 bg-black/50 z-50 hidden items-center justify-center p-4">
|
||||
<div class="bg-gray-900 rounded-xl shadow-xl p-4 md:p-6 w-full max-w-md border border-gray-700 max-h-[90vh] overflow-y-auto">
|
||||
<h3 class="text-lg font-semibold text-white mb-4">Edit Tile <span id="modalFrameIndex"></span></h3>
|
||||
|
||||
<form method="post" asp-page-handler="SaveTile">
|
||||
@@ -246,20 +264,20 @@
|
||||
<input type="hidden" name="sheetId" value="@Model.Sheet.Id" />
|
||||
<input type="hidden" name="frameIndex" id="editFrameIndex" />
|
||||
|
||||
<div class="space-y-4">
|
||||
<div class="space-y-3 md:space-y-4">
|
||||
<!-- Tile Preview -->
|
||||
<div class="flex justify-center">
|
||||
<div id="modalTilePreview" class="bg-gray-800 border border-gray-600" style="image-rendering: pixelated;"></div>
|
||||
<div id="modalTilePreview" class="bg-gray-800 border border-gray-600" style="image-rendering: pixelated; width: 64px; height: 64px;"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-300 mb-1">Name (optional)</label>
|
||||
<input type="text" name="name" id="editName" class="input w-full" placeholder="Stone Floor A" />
|
||||
<input type="text" name="name" id="editName" class="input w-full text-sm" placeholder="Stone Floor A" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-300 mb-1">Type</label>
|
||||
<select name="type" id="editType" class="input w-full">
|
||||
<select name="type" id="editType" class="input w-full text-sm">
|
||||
@foreach (var t in tileTypes)
|
||||
{
|
||||
<option value="@((int)t)">@t</option>
|
||||
@@ -268,92 +286,98 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-300 mb-1">Tags (comma-separated)</label>
|
||||
<input type="text" name="tags" id="editTags" class="input w-full" placeholder="stone, cracked, floor" />
|
||||
<label class="block text-sm font-medium text-gray-300 mb-1">Tags</label>
|
||||
<input type="text" name="tags" id="editTags" class="input w-full text-sm" placeholder="stone, cracked" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-300 mb-1">Render Layer</label>
|
||||
<select name="renderLayer" id="editRenderLayer" class="input w-full">
|
||||
<select name="renderLayer" id="editRenderLayer" class="input w-full text-sm">
|
||||
<option value="0">0 - Ground</option>
|
||||
<option value="1">1 - Floor Decor</option>
|
||||
<option value="2">2 - Walls</option>
|
||||
<option value="3">3 - Ceiling/Overlay</option>
|
||||
<option value="3">3 - Ceiling</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-3 gap-4">
|
||||
<label class="flex items-center gap-2 text-gray-300">
|
||||
<div class="grid grid-cols-3 gap-2 text-sm">
|
||||
<label class="flex items-center gap-1.5 text-gray-300">
|
||||
<input type="checkbox" name="isWalkable" id="editWalkable" value="true" class="rounded" />
|
||||
Walkable
|
||||
Walk
|
||||
</label>
|
||||
<label class="flex items-center gap-2 text-gray-300">
|
||||
<label class="flex items-center gap-1.5 text-gray-300">
|
||||
<input type="checkbox" name="blocksProjectiles" id="editBlocksProj" value="true" class="rounded" />
|
||||
Blocks Proj
|
||||
Block Proj
|
||||
</label>
|
||||
<label class="flex items-center gap-2 text-gray-300">
|
||||
<label class="flex items-center gap-1.5 text-gray-300">
|
||||
<input type="checkbox" name="blocksLineOfSight" id="editBlocksLOS" value="true" class="rounded" />
|
||||
Blocks LOS
|
||||
Block LOS
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-2 mt-6">
|
||||
<button type="submit" class="btn btn-primary flex-1">Save Tile</button>
|
||||
<button type="button" onclick="closeTileEditor()" class="btn btn-secondary flex-1">Cancel</button>
|
||||
<div class="flex gap-2 mt-5">
|
||||
<button type="submit" class="btn btn-primary flex-1 text-sm">Save</button>
|
||||
<button type="button" onclick="closeTileEditor()" class="btn btn-secondary flex-1 text-sm">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- CDN Browser Modal -->
|
||||
<div id="cdnBrowserModal" class="fixed inset-0 bg-black/50 z-50 hidden items-center justify-center">
|
||||
<div class="bg-gray-900 rounded-xl shadow-xl p-6 w-full max-w-2xl mx-4 border border-gray-700 max-h-[80vh] overflow-hidden flex flex-col">
|
||||
<div id="cdnBrowserModal" class="fixed inset-0 bg-black/50 z-50 hidden items-center justify-center p-4">
|
||||
<div class="bg-gray-900 rounded-xl shadow-xl p-4 md:p-6 w-full max-w-2xl border border-gray-700 max-h-[90vh] overflow-hidden flex flex-col">
|
||||
<h3 class="text-lg font-semibold text-white mb-4">Select TileMap from CDN</h3>
|
||||
<div class="flex-1 overflow-y-auto grid grid-cols-2 md:grid-cols-3 gap-3">
|
||||
<div class="flex-1 overflow-y-auto grid grid-cols-2 md:grid-cols-3 gap-2 md:gap-3">
|
||||
@foreach (var asset in Model.CdnImages)
|
||||
{
|
||||
var assetUrl = Model.CdnBaseUrl.TrimEnd('/');
|
||||
if (!assetUrl.EndsWith("/downloads")) { assetUrl += "/downloads"; }
|
||||
assetUrl += "/" + asset.DownloadPath.TrimStart('/');
|
||||
|
||||
<button type="button" onclick="selectCdnImage('@asset.DownloadPath')" class="p-2 bg-gray-800 rounded-lg hover:bg-gray-700 text-left">
|
||||
<img src="@Model.CdnBaseUrl/@asset.DownloadPath" alt="@asset.FilePath" class="w-full h-20 object-contain mb-1" style="image-rendering: pixelated;" />
|
||||
<img src="@assetUrl" alt="@asset.FilePath" class="w-full h-16 md:h-20 object-contain mb-1" style="image-rendering: pixelated;" onerror="this.src='data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>❌</text></svg>';" />
|
||||
<p class="text-xs text-gray-400 truncate">@asset.FilePath</p>
|
||||
</button>
|
||||
}
|
||||
@if (Model.CdnImages.Count == 0)
|
||||
{
|
||||
<p class="col-span-full text-gray-500 text-center py-8">No tilemap images found. Upload images to textures/tilemaps/ in CDN Assets.</p>
|
||||
}
|
||||
</div>
|
||||
<div class="flex justify-end pt-4">
|
||||
<button type="button" onclick="closeCdnBrowser()" class="btn btn-secondary">Cancel</button>
|
||||
<button type="button" onclick="closeCdnBrowser()" class="btn btn-secondary text-sm">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
// Tile definitions data from server
|
||||
const tileDefinitions = @Html.Raw(System.Text.Json.JsonSerializer.Serialize(Model.TileDefinitions.ToDictionary(t => t.FrameIndex)));
|
||||
const sheetWidth = @Model.Sheet.SheetWidth;
|
||||
const sheetHeight = @Model.Sheet.SheetHeight;
|
||||
const tileWidth = @Model.Sheet.TileWidth;
|
||||
const tileHeight = @Model.Sheet.TileHeight;
|
||||
const columns = @Model.Sheet.Columns;
|
||||
const cdnBaseUrl = '@Model.CdnBaseUrl';
|
||||
const cdnPath = '@Model.Sheet.CdnPath';
|
||||
const imageUrl = '@imageUrl';
|
||||
|
||||
function openTileEditor(frameIndex, existingId) {
|
||||
document.getElementById('editFrameIndex').value = frameIndex;
|
||||
document.getElementById('modalFrameIndex').textContent = '#' + frameIndex;
|
||||
|
||||
// Calculate tile position for preview
|
||||
const col = frameIndex % columns;
|
||||
const row = Math.floor(frameIndex / columns);
|
||||
|
||||
// Set preview
|
||||
// Set preview with proper scaling
|
||||
const preview = document.getElementById('modalTilePreview');
|
||||
preview.style.width = (tileWidth * 2) + 'px';
|
||||
preview.style.height = (tileHeight * 2) + 'px';
|
||||
preview.style.backgroundImage = `url('${cdnBaseUrl}/${cdnPath}')`;
|
||||
preview.style.backgroundPosition = `-${col * tileWidth * 2}px -${row * tileHeight * 2}px`;
|
||||
preview.style.backgroundSize = `${sheetWidth * 2}px ${sheetHeight * 2}px`;
|
||||
const scale = 64 / Math.max(tileWidth, tileHeight);
|
||||
preview.style.width = '64px';
|
||||
preview.style.height = '64px';
|
||||
preview.style.backgroundImage = `url('${imageUrl}')`;
|
||||
preview.style.backgroundPosition = `-${col * tileWidth * scale}px -${row * tileHeight * scale}px`;
|
||||
preview.style.backgroundSize = `${sheetWidth * scale}px ${sheetHeight * scale}px`;
|
||||
|
||||
// Load existing data if available
|
||||
// Load existing data
|
||||
const existing = tileDefinitions[frameIndex];
|
||||
if (existing) {
|
||||
document.getElementById('editName').value = existing.Name || '';
|
||||
@@ -364,7 +388,6 @@
|
||||
document.getElementById('editBlocksProj').checked = existing.BlocksProjectiles;
|
||||
document.getElementById('editBlocksLOS').checked = existing.BlocksLineOfSight;
|
||||
} else {
|
||||
// Defaults for new tile
|
||||
document.getElementById('editName').value = '';
|
||||
document.getElementById('editType').value = '0';
|
||||
document.getElementById('editTags').value = '';
|
||||
@@ -396,22 +419,22 @@
|
||||
function selectCdnImage(path) {
|
||||
document.getElementById('Sheet_CdnPath').value = path;
|
||||
closeCdnBrowser();
|
||||
// Submit form to refresh preview
|
||||
document.querySelector('form').submit();
|
||||
}
|
||||
|
||||
// Draw grid overlay on preview
|
||||
function drawGridOverlay() {
|
||||
const img = document.getElementById('sheetPreview');
|
||||
const canvas = document.getElementById('gridOverlay');
|
||||
if (!img || !canvas) return;
|
||||
if (!img || !canvas || !img.naturalWidth) return;
|
||||
|
||||
canvas.width = img.naturalWidth;
|
||||
canvas.height = img.naturalHeight;
|
||||
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.strokeStyle = 'rgba(255, 255, 255, 0.3)';
|
||||
ctx.strokeStyle = 'rgba(255, 255, 255, 0.4)';
|
||||
ctx.lineWidth = 1;
|
||||
|
||||
// Vertical lines
|
||||
for (let x = tileWidth; x < canvas.width; x += tileWidth) {
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x, 0);
|
||||
@@ -419,7 +442,6 @@
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
// Horizontal lines
|
||||
for (let y = tileHeight; y < canvas.height; y += tileHeight) {
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0, y);
|
||||
@@ -428,14 +450,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize when image loads
|
||||
const previewImg = document.getElementById('sheetPreview');
|
||||
if (previewImg) {
|
||||
previewImg.onload = drawGridOverlay;
|
||||
if (previewImg.complete) drawGridOverlay();
|
||||
}
|
||||
|
||||
// Close modals on escape
|
||||
document.addEventListener('keydown', e => {
|
||||
if (e.key === 'Escape') {
|
||||
closeTileEditor();
|
||||
|
||||
@@ -4,70 +4,83 @@
|
||||
ViewData["Title"] = "TileMap Sheets";
|
||||
}
|
||||
|
||||
<div class="flex items-center justify-between mb-6">
|
||||
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-4 md:mb-6">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-white">TileMap Sheets</h1>
|
||||
<p class="text-gray-400">Manage tilemap sprite sheets for dungeon generation</p>
|
||||
<h1 class="text-xl md:text-2xl font-bold text-white">TileMap Sheets</h1>
|
||||
<p class="text-gray-400 text-sm">Manage tilemap sprite sheets for dungeon generation</p>
|
||||
</div>
|
||||
<a href="/admin/tilemaps/edit" class="btn btn-primary">+ New TileMap Sheet</a>
|
||||
<a href="/admin/tilemaps/edit" class="btn btn-primary text-sm">+ New TileMap Sheet</a>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3 md:gap-4">
|
||||
@foreach (var sheet in Model.Sheets)
|
||||
{
|
||||
<div class="card">
|
||||
var imageUrl = sheet.CdnPath;
|
||||
if (!string.IsNullOrEmpty(imageUrl) && !imageUrl.StartsWith("http"))
|
||||
{
|
||||
var baseUrl = Model.CdnBaseUrl.TrimEnd('/');
|
||||
if (!baseUrl.EndsWith("/downloads")) { baseUrl += "/downloads"; }
|
||||
imageUrl = $"{baseUrl}/{imageUrl.TrimStart('/')}";
|
||||
}
|
||||
|
||||
<div class="card p-4">
|
||||
<div class="flex justify-between items-start mb-3">
|
||||
<div>
|
||||
<h3 class="text-lg font-semibold text-white">@sheet.Name</h3>
|
||||
<p class="text-sm text-gray-400">@sheet.CdnPath</p>
|
||||
<div class="min-w-0 flex-1">
|
||||
<h3 class="text-base md:text-lg font-semibold text-white truncate">@sheet.Name</h3>
|
||||
<p class="text-xs md:text-sm text-gray-400 truncate">@sheet.CdnPath</p>
|
||||
</div>
|
||||
<span class="px-2 py-1 text-xs rounded @(sheet.IsEnabled ? "bg-green-900 text-green-300" : "bg-red-900 text-red-300")">
|
||||
@(sheet.IsEnabled ? "Enabled" : "Disabled")
|
||||
<span class="px-2 py-0.5 text-xs rounded flex-shrink-0 ml-2 @(sheet.IsEnabled ? "bg-green-900 text-green-300" : "bg-red-900 text-red-300")">
|
||||
@(sheet.IsEnabled ? "On" : "Off")
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Preview -->
|
||||
<div class="mb-3 bg-gray-900 rounded-lg p-2 flex justify-center">
|
||||
<img src="@Model.CdnBaseUrl/@sheet.CdnPath"
|
||||
<div class="mb-3 bg-gray-900 rounded-lg p-2 flex justify-center h-24 md:h-32 overflow-hidden">
|
||||
<img src="@imageUrl"
|
||||
alt="@sheet.Name"
|
||||
class="max-h-32 object-contain"
|
||||
style="image-rendering: pixelated;" />
|
||||
class="max-h-full object-contain"
|
||||
style="image-rendering: pixelated;"
|
||||
onerror="this.src='data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><rect fill=%22%23374151%22 width=%22100%22 height=%22100%22/><text x=%2250%22 y=%2255%22 text-anchor=%22middle%22 fill=%22%239ca3af%22 font-size=%2212%22>No Image</text></svg>';" />
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-2 text-sm mb-3">
|
||||
<div class="grid grid-cols-2 gap-1 text-xs md:text-sm mb-3">
|
||||
<div>
|
||||
<span class="text-gray-500">Sheet Size:</span>
|
||||
<span class="text-gray-300">@sheet.SheetWidth x @sheet.SheetHeight</span>
|
||||
<span class="text-gray-500">Sheet:</span>
|
||||
<span class="text-gray-300">@sheet.SheetWidth×@sheet.SheetHeight</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="text-gray-500">Tile Size:</span>
|
||||
<span class="text-gray-300">@sheet.TileWidth x @sheet.TileHeight</span>
|
||||
<span class="text-gray-500">Tile:</span>
|
||||
<span class="text-gray-300">@sheet.TileWidth×@sheet.TileHeight</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="text-gray-500">Grid:</span>
|
||||
<span class="text-gray-300">@sheet.Columns x @sheet.Rows (@sheet.TotalTiles tiles)</span>
|
||||
<span class="text-gray-300">@sheet.Columns×@sheet.Rows</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="text-gray-500">Defined:</span>
|
||||
<span class="text-gray-300">@(sheet.Tiles?.Count ?? 0) tiles</span>
|
||||
<span class="text-gray-300">@(sheet.Tiles?.Count ?? 0)/@sheet.TotalTiles</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (!string.IsNullOrEmpty(sheet.Tags))
|
||||
{
|
||||
<div class="flex flex-wrap gap-1 mb-3">
|
||||
@foreach (var tag in sheet.Tags.Split(',', StringSplitOptions.RemoveEmptyEntries))
|
||||
@foreach (var tag in sheet.Tags.Split(',', StringSplitOptions.RemoveEmptyEntries).Take(3))
|
||||
{
|
||||
<span class="px-2 py-0.5 bg-blue-900/50 text-blue-300 text-xs rounded">@tag.Trim()</span>
|
||||
<span class="px-1.5 py-0.5 bg-blue-900/50 text-blue-300 text-xs rounded">@tag.Trim()</span>
|
||||
}
|
||||
@if (sheet.Tags.Split(',').Length > 3)
|
||||
{
|
||||
<span class="text-gray-500 text-xs">+@(sheet.Tags.Split(',').Length - 3)</span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="flex gap-2">
|
||||
<a href="/admin/tilemaps/edit?id=@sheet.Id" class="btn btn-secondary flex-1 text-center">Edit</a>
|
||||
<a href="/admin/tilemaps/edit?id=@sheet.Id" class="btn btn-secondary flex-1 text-center text-sm py-1.5">Edit</a>
|
||||
<form method="post" asp-page-handler="Delete" class="flex-1">
|
||||
<input type="hidden" name="id" value="@sheet.Id" />
|
||||
<button type="submit" class="btn bg-red-600 hover:bg-red-700 w-full"
|
||||
<button type="submit" class="btn bg-red-600 hover:bg-red-700 w-full text-sm py-1.5"
|
||||
onclick="return confirm('Delete this tilemap sheet?')">Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -77,7 +90,7 @@
|
||||
|
||||
@if (Model.Sheets.Count == 0)
|
||||
{
|
||||
<div class="card text-center py-12">
|
||||
<div class="card p-8 md:p-12 text-center">
|
||||
<p class="text-gray-400 mb-4">No tilemap sheets yet.</p>
|
||||
<a href="/admin/tilemaps/edit" class="btn btn-primary">Create Your First TileMap Sheet</a>
|
||||
</div>
|
||||
|
||||
@@ -32,13 +32,13 @@ public sealed class GameDbContext : DbContext
|
||||
public DbSet<MobAnimationDefinition> MobAnimationDefinitions => Set<MobAnimationDefinition>();
|
||||
public DbSet<MobAnimationAssignment> MobAnimationAssignments => Set<MobAnimationAssignment>();
|
||||
public DbSet<MobAbilityAnimationMapping> MobAbilityAnimationMappings => Set<MobAbilityAnimationMapping>();
|
||||
|
||||
|
||||
// TileMap system
|
||||
public DbSet<TileMapSheet> TileMapSheets => Set<TileMapSheet>();
|
||||
public DbSet<TileDefinition> TileDefinitions => Set<TileDefinition>();
|
||||
public DbSet<RoomTemplate> RoomTemplates => Set<RoomTemplate>();
|
||||
public DbSet<DungeonTemplate> DungeonTemplates => Set<DungeonTemplate>();
|
||||
|
||||
|
||||
public DbSet<DungeonBeltItem> DungeonBeltItems => Set<DungeonBeltItem>();
|
||||
public DbSet<DeathChest> DeathChests => Set<DeathChest>();
|
||||
public DbSet<DeathChestItem> DeathChestItems => Set<DeathChestItem>();
|
||||
|
||||
Reference in New Issue
Block a user