Admin updates, dungeon viewer
This commit is contained in:
@@ -3,8 +3,6 @@
|
||||
@using DataServer.Data.Entities
|
||||
@{
|
||||
ViewData["Title"] = Model.Sheet.Id == 0 ? "New TileMap Sheet" : $"Edit: {Model.Sheet.Name}";
|
||||
var tileTypes = Enum.GetValues<TileType>();
|
||||
var socketTypes = Enum.GetValues<SocketType>();
|
||||
// Build image URL - handle both with and without /downloads/ path
|
||||
var imageUrl = Model.Sheet.CdnPath;
|
||||
if (!string.IsNullOrEmpty(imageUrl))
|
||||
@@ -126,282 +124,23 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Note about Tile Templates -->
|
||||
@if (Model.Sheet.Id > 0)
|
||||
{
|
||||
<!-- Tile Editor Section -->
|
||||
<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 flex-wrap gap-2">
|
||||
<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 text-sm py-1">
|
||||
<option value="0">Floor (walkable)</option>
|
||||
<option value="1">Wall (blocked)</option>
|
||||
</select>
|
||||
<button type="submit" class="btn btn-secondary text-sm py-1">Auto-Generate</button>
|
||||
</form>
|
||||
|
||||
<!-- Socket bulk actions -->
|
||||
<form method="post" asp-page-handler="AutoConfigureSockets" class="inline">
|
||||
<input type="hidden" name="sheetId" value="@Model.Sheet.Id" />
|
||||
<button type="submit" class="btn btn-secondary text-sm py-1" title="Set sockets based on tile type">Auto Sockets</button>
|
||||
</form>
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="text-2xl">💡</div>
|
||||
<div>
|
||||
<h3 class="font-semibold text-white">Create Tile Templates</h3>
|
||||
<p class="text-gray-400 text-sm mt-1">
|
||||
To use tiles from this sheet, create <a href="/admin/dungeonbuilder/tiles" class="text-blue-400 hover:underline">Tile Templates</a>
|
||||
which define walkability, sockets, and other properties.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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-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="@imageUrl"
|
||||
alt="@Model.Sheet.Name"
|
||||
id="tileGridImage"
|
||||
class="max-w-none"
|
||||
onerror="this.style.display='none';" />
|
||||
|
||||
<!-- Clickable tile overlay -->
|
||||
<div id="tileClickOverlay" class="absolute top-0 left-0"
|
||||
style="width: @(Model.Sheet.SheetWidth)px; height: @(Model.Sheet.SheetHeight)px;">
|
||||
@for (int row = 0; row < Model.Sheet.Rows; row++)
|
||||
{
|
||||
@for (int col = 0; col < Model.Sheet.Columns; col++)
|
||||
{
|
||||
var frameIndex = row * Model.Sheet.Columns + col;
|
||||
var tileDef = Model.TileDefinitions.FirstOrDefault(t => t.FrameIndex == frameIndex);
|
||||
var hasDefinition = tileDef != null;
|
||||
var tileColor = hasDefinition ? GetTileTypeColor(tileDef!.Type) : "transparent";
|
||||
|
||||
<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})" : "")">
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tile Type Legend -->
|
||||
<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-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-[700px]">
|
||||
<thead>
|
||||
<tr class="text-left text-gray-400 border-b border-gray-700">
|
||||
<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">Sockets</th>
|
||||
<th class="p-2">Props</th>
|
||||
<th class="p-2">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var tile in Model.TileDefinitions.Take(50))
|
||||
{
|
||||
var col = tile.FrameIndex % Model.Sheet.Columns;
|
||||
var row = tile.FrameIndex / Model.Sheet.Columns;
|
||||
|
||||
<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-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 max-w-[100px] truncate">@(tile.Name ?? "-")</td>
|
||||
<td class="p-2">
|
||||
<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-xs">
|
||||
<span class="@GetSocketBadgeClass(tile.SocketN)" title="North">N</span>
|
||||
<span class="@GetSocketBadgeClass(tile.SocketE)" title="East">E</span>
|
||||
<span class="@GetSocketBadgeClass(tile.SocketS)" title="South">S</span>
|
||||
<span class="@GetSocketBadgeClass(tile.SocketW)" title="West">W</span>
|
||||
</td>
|
||||
<td class="p-2 text-xs">
|
||||
@if (tile.IsWalkable) { <span class="text-green-400" title="Walkable">W</span> }
|
||||
@if (tile.BlocksProjectiles) { <span class="text-red-400" title="Blocks Projectiles">P</span> }
|
||||
@if (tile.BlocksLineOfSight) { <span class="text-yellow-400" title="Blocks LOS">L</span> }
|
||||
</td>
|
||||
<td class="p-2">
|
||||
<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?')">×</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>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Tile Editor Modal -->
|
||||
<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-lg 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">
|
||||
@Html.AntiForgeryToken()
|
||||
<input type="hidden" name="sheetId" value="@Model.Sheet.Id" />
|
||||
<input type="hidden" name="frameIndex" id="editFrameIndex" />
|
||||
|
||||
<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; 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 text-sm" placeholder="Stone Floor A" />
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-300 mb-1">Type</label>
|
||||
<select name="type" id="editType" class="input w-full text-sm" onchange="onTypeChange()">
|
||||
@foreach (var t in tileTypes)
|
||||
{
|
||||
<option value="@((int)t)">@t</option>
|
||||
}
|
||||
</select>
|
||||
</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 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</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<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>
|
||||
|
||||
<!-- Socket Configuration -->
|
||||
<div class="border border-gray-700 rounded-lg p-3">
|
||||
<div class="flex items-center justify-between mb-2">
|
||||
<label class="text-sm font-medium text-gray-300">Sockets</label>
|
||||
<div class="flex gap-1">
|
||||
<button type="button" onclick="setAllSockets(1)" class="text-xs px-2 py-0.5 bg-green-900/50 text-green-400 rounded hover:bg-green-900">All Open</button>
|
||||
<button type="button" onclick="setAllSockets(0)" class="text-xs px-2 py-0.5 bg-red-900/50 text-red-400 rounded hover:bg-red-900">All Closed</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-3 gap-2 text-center">
|
||||
<!-- North -->
|
||||
<div></div>
|
||||
<div>
|
||||
<label class="text-xs text-gray-400 block">North</label>
|
||||
<select name="socketN" id="editSocketN" class="input w-full text-xs py-1" onchange="updateSocketCustom('N')">
|
||||
<option value="0">Closed</option>
|
||||
<option value="1">Open</option>
|
||||
<option value="2">Custom</option>
|
||||
</select>
|
||||
<input type="text" name="socketNCustom" id="editSocketNCustom" class="input w-full text-xs py-1 mt-1 hidden" placeholder="Custom type" />
|
||||
</div>
|
||||
<div></div>
|
||||
|
||||
<!-- West / Center / East -->
|
||||
<div>
|
||||
<label class="text-xs text-gray-400 block">West</label>
|
||||
<select name="socketW" id="editSocketW" class="input w-full text-xs py-1" onchange="updateSocketCustom('W')">
|
||||
<option value="0">Closed</option>
|
||||
<option value="1">Open</option>
|
||||
<option value="2">Custom</option>
|
||||
</select>
|
||||
<input type="text" name="socketWCustom" id="editSocketWCustom" class="input w-full text-xs py-1 mt-1 hidden" placeholder="Custom type" />
|
||||
</div>
|
||||
<div class="flex items-center justify-center">
|
||||
<div class="w-8 h-8 bg-gray-700 rounded flex items-center justify-center text-gray-500">
|
||||
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20"><rect x="2" y="2" width="16" height="16" rx="2"/></svg>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs text-gray-400 block">East</label>
|
||||
<select name="socketE" id="editSocketE" class="input w-full text-xs py-1" onchange="updateSocketCustom('E')">
|
||||
<option value="0">Closed</option>
|
||||
<option value="1">Open</option>
|
||||
<option value="2">Custom</option>
|
||||
</select>
|
||||
<input type="text" name="socketECustom" id="editSocketECustom" class="input w-full text-xs py-1 mt-1 hidden" placeholder="Custom type" />
|
||||
</div>
|
||||
|
||||
<!-- South -->
|
||||
<div></div>
|
||||
<div>
|
||||
<label class="text-xs text-gray-400 block">South</label>
|
||||
<select name="socketS" id="editSocketS" class="input w-full text-xs py-1" onchange="updateSocketCustom('S')">
|
||||
<option value="0">Closed</option>
|
||||
<option value="1">Open</option>
|
||||
<option value="2">Custom</option>
|
||||
</select>
|
||||
<input type="text" name="socketSCustom" id="editSocketSCustom" class="input w-full text-xs py-1 mt-1 hidden" placeholder="Custom type" />
|
||||
</div>
|
||||
<div></div>
|
||||
</div>
|
||||
<p class="text-xs text-gray-500 mt-2">Open↔Open, Closed↔Closed. Custom must match exactly.</p>
|
||||
</div>
|
||||
|
||||
<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" />
|
||||
Walk
|
||||
</label>
|
||||
<label class="flex items-center gap-1.5 text-gray-300">
|
||||
<input type="checkbox" name="blocksProjectiles" id="editBlocksProj" value="true" class="rounded" />
|
||||
Block Proj
|
||||
</label>
|
||||
<label class="flex items-center gap-1.5 text-gray-300">
|
||||
<input type="checkbox" name="blocksLineOfSight" id="editBlocksLOS" value="true" class="rounded" />
|
||||
Block LOS
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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 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">
|
||||
@@ -431,110 +170,10 @@
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
const tileDefinitions = @Html.Raw(System.Text.Json.JsonSerializer.Serialize(Model.TileDefinitions.ToDictionary(t => t.FrameIndex, t => new {
|
||||
t.Id, t.FrameIndex, t.Name, t.Type, t.Tags, t.IsWalkable, t.BlocksProjectiles, t.BlocksLineOfSight, t.RenderLayer,
|
||||
SocketN = (int)t.SocketN, SocketE = (int)t.SocketE, SocketS = (int)t.SocketS, SocketW = (int)t.SocketW,
|
||||
t.SocketNCustom, t.SocketECustom, t.SocketSCustom, t.SocketWCustom
|
||||
})));
|
||||
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 imageUrl = '@imageUrl';
|
||||
|
||||
function openTileEditor(frameIndex, existingId) {
|
||||
document.getElementById('editFrameIndex').value = frameIndex;
|
||||
document.getElementById('modalFrameIndex').textContent = '#' + frameIndex;
|
||||
|
||||
const col = frameIndex % columns;
|
||||
const row = Math.floor(frameIndex / columns);
|
||||
|
||||
// Set preview with proper scaling
|
||||
const preview = document.getElementById('modalTilePreview');
|
||||
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
|
||||
const existing = tileDefinitions[frameIndex];
|
||||
if (existing) {
|
||||
document.getElementById('editName').value = existing.Name || '';
|
||||
document.getElementById('editType').value = existing.Type;
|
||||
document.getElementById('editTags').value = existing.Tags || '';
|
||||
document.getElementById('editRenderLayer').value = existing.RenderLayer;
|
||||
document.getElementById('editWalkable').checked = existing.IsWalkable;
|
||||
document.getElementById('editBlocksProj').checked = existing.BlocksProjectiles;
|
||||
document.getElementById('editBlocksLOS').checked = existing.BlocksLineOfSight;
|
||||
// Sockets
|
||||
document.getElementById('editSocketN').value = existing.SocketN;
|
||||
document.getElementById('editSocketE').value = existing.SocketE;
|
||||
document.getElementById('editSocketS').value = existing.SocketS;
|
||||
document.getElementById('editSocketW').value = existing.SocketW;
|
||||
document.getElementById('editSocketNCustom').value = existing.SocketNCustom || '';
|
||||
document.getElementById('editSocketECustom').value = existing.SocketECustom || '';
|
||||
document.getElementById('editSocketSCustom').value = existing.SocketSCustom || '';
|
||||
document.getElementById('editSocketWCustom').value = existing.SocketWCustom || '';
|
||||
} else {
|
||||
document.getElementById('editName').value = '';
|
||||
document.getElementById('editType').value = '0';
|
||||
document.getElementById('editTags').value = '';
|
||||
document.getElementById('editRenderLayer').value = '0';
|
||||
document.getElementById('editWalkable').checked = true;
|
||||
document.getElementById('editBlocksProj').checked = false;
|
||||
document.getElementById('editBlocksLOS').checked = false;
|
||||
// Default sockets for new tile
|
||||
document.getElementById('editSocketN').value = '1'; // Open
|
||||
document.getElementById('editSocketE').value = '1';
|
||||
document.getElementById('editSocketS').value = '1';
|
||||
document.getElementById('editSocketW').value = '1';
|
||||
document.getElementById('editSocketNCustom').value = '';
|
||||
document.getElementById('editSocketECustom').value = '';
|
||||
document.getElementById('editSocketSCustom').value = '';
|
||||
document.getElementById('editSocketWCustom').value = '';
|
||||
}
|
||||
|
||||
// Update custom field visibility
|
||||
['N', 'E', 'S', 'W'].forEach(updateSocketCustom);
|
||||
|
||||
document.getElementById('tileEditorModal').classList.remove('hidden');
|
||||
document.getElementById('tileEditorModal').classList.add('flex');
|
||||
}
|
||||
|
||||
function closeTileEditor() {
|
||||
document.getElementById('tileEditorModal').classList.add('hidden');
|
||||
document.getElementById('tileEditorModal').classList.remove('flex');
|
||||
}
|
||||
|
||||
function updateSocketCustom(dir) {
|
||||
const select = document.getElementById('editSocket' + dir);
|
||||
const custom = document.getElementById('editSocket' + dir + 'Custom');
|
||||
custom.classList.toggle('hidden', select.value !== '2');
|
||||
}
|
||||
|
||||
function setAllSockets(value) {
|
||||
['N', 'E', 'S', 'W'].forEach(dir => {
|
||||
document.getElementById('editSocket' + dir).value = value;
|
||||
updateSocketCustom(dir);
|
||||
});
|
||||
}
|
||||
|
||||
function onTypeChange() {
|
||||
const type = parseInt(document.getElementById('editType').value);
|
||||
// Auto-set sockets based on type
|
||||
if (type === 0 || type === 30) { // Floor, FloorDecor
|
||||
setAllSockets(1); // Open
|
||||
document.getElementById('editWalkable').checked = true;
|
||||
} else if (type === 1 || type === 31) { // Wall, WallDecor
|
||||
setAllSockets(0); // Closed
|
||||
document.getElementById('editWalkable').checked = false;
|
||||
document.getElementById('editBlocksProj').checked = true;
|
||||
document.getElementById('editBlocksLOS').checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
function showCdnBrowser() {
|
||||
document.getElementById('cdnBrowserModal').classList.remove('hidden');
|
||||
@@ -588,47 +227,8 @@
|
||||
|
||||
document.addEventListener('keydown', e => {
|
||||
if (e.key === 'Escape') {
|
||||
closeTileEditor();
|
||||
closeCdnBrowser();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
@functions {
|
||||
string GetTileTypeColor(TileType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
TileType.Floor => "rgba(34, 197, 94, 0.3)",
|
||||
TileType.Wall => "rgba(239, 68, 68, 0.3)",
|
||||
TileType.Door => "rgba(168, 85, 247, 0.3)",
|
||||
TileType.Water => "rgba(59, 130, 246, 0.3)",
|
||||
TileType.Lava => "rgba(249, 115, 22, 0.3)",
|
||||
TileType.Pit => "rgba(31, 41, 55, 0.5)",
|
||||
TileType.Stairs => "rgba(236, 72, 153, 0.3)",
|
||||
TileType.PlayerSpawn => "rgba(234, 179, 8, 0.4)",
|
||||
TileType.MobSpawn => "rgba(234, 179, 8, 0.3)",
|
||||
TileType.BossSpawn => "rgba(220, 38, 38, 0.4)",
|
||||
TileType.ChestSpawn => "rgba(251, 191, 36, 0.4)",
|
||||
TileType.Trigger => "rgba(139, 92, 246, 0.3)",
|
||||
TileType.Transition => "rgba(14, 165, 233, 0.3)",
|
||||
TileType.Secret => "rgba(163, 163, 163, 0.3)",
|
||||
TileType.Trap => "rgba(239, 68, 68, 0.4)",
|
||||
TileType.FloorDecor => "rgba(34, 197, 94, 0.2)",
|
||||
TileType.WallDecor => "rgba(239, 68, 68, 0.2)",
|
||||
_ => "transparent"
|
||||
};
|
||||
}
|
||||
|
||||
string GetSocketBadgeClass(SocketType socket)
|
||||
{
|
||||
return socket switch
|
||||
{
|
||||
SocketType.Open => "text-green-400",
|
||||
SocketType.Closed => "text-red-400",
|
||||
SocketType.Custom => "text-yellow-400",
|
||||
_ => "text-gray-400"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user