Dungeon Viewer changes

This commit is contained in:
dingo
2026-01-11 08:21:50 -05:00
parent fb2b339121
commit 14c50f0aae
3 changed files with 268 additions and 292 deletions
+17 -6
View File
@@ -37,6 +37,23 @@ public class ViewModel : AdminPageModel
MobDefinitions = await _db.DungeonMobDefinitions
.Where(m => m.IsEnabled).OrderBy(m => m.Name).ToListAsync();
// Load ALL available tile sheets from database (not just those in dungeon)
var allSheets = await _db.Set<TileMapSheet>()
.Where(s => s.IsEnabled)
.OrderBy(s => s.Name)
.ToListAsync();
TileSheetsJson = JsonSerializer.Serialize(allSheets.Select(s => new {
id = s.Id,
name = s.Name,
path = s.CdnPath,
tileW = s.TileWidth,
tileH = s.TileHeight,
sheetW = s.SheetWidth,
sheetH = s.SheetHeight,
cols = s.Columns
}));
if (Dungeon == null) return;
Duration = FormatDuration(DateTime.UtcNow - Dungeon.CreatedAt);
@@ -58,12 +75,6 @@ public class ViewModel : AdminPageModel
x = t.X, y = t.Y, sid = t.SheetId, frame = t.FrameIndex,
l = t.Layer, r = t.Rotation, fx = t.FlipX, fy = t.FlipY
}));
TileSheetsJson = JsonSerializer.Serialize(layout.TileMapSheets.Select(s => new {
id = s.Id, name = s.CdnPath?.Split('/').LastOrDefault() ?? $"Sheet {s.Id}",
path = s.CdnPath, tileW = s.TileWidth, tileH = s.TileHeight,
sheetW = s.SheetWidth, sheetH = s.SheetHeight, cols = s.Columns
}));
}
else { MapWidth = 100; MapHeight = 100; }