Dungeon Viewer changes
This commit is contained in:
@@ -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; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user