diff --git a/Services/Admin/Pages/DungeonBuilder/Stamps/Edit.cshtml b/Services/Admin/Pages/DungeonBuilder/Stamps/Edit.cshtml
index abb11b7..b702460 100644
--- a/Services/Admin/Pages/DungeonBuilder/Stamps/Edit.cshtml
+++ b/Services/Admin/Pages/DungeonBuilder/Stamps/Edit.cshtml
@@ -148,6 +148,7 @@ let stampData = {};
const loadedSheets = {};
const tileDefs = @Html.Raw(Model.TileDefinitionsJson);
+const tileDefMap = {};
function preloadSheets() {
document.querySelectorAll('#sheetSelect option').forEach(opt => {
@@ -167,6 +168,9 @@ function preloadSheets() {
document.addEventListener('DOMContentLoaded', () => {
preloadSheets();
+ tileDefs.forEach(t => {
+ tileDefMap[`${t.sheetId}:${t.frameIndex}`] = t.id;
+ });
loadExisting();
buildStampGrid();
});
@@ -245,20 +249,17 @@ function loadSheet() {
currentSheetId = +opt.value;
const sheet = loadedSheets[currentSheetId];
- const tiles = tileDefs.filter(t => t.sheetId === currentSheetId);
-
+ const total = sheet.cols * Math.ceil(sheet.sh / sheet.th);
let html = '';
- if (tiles.length === 0) {
- html = '
No tile definitions for this sheet.
';
- } else {
- tiles.forEach(t => {
- const col = t.frameIndex % sheet.cols;
- const row = Math.floor(t.frameIndex / sheet.cols);
- html += ``;
- });
+ for (let i = 0; i < total; i++) {
+ const col = i % sheet.cols;
+ const row = Math.floor(i / sheet.cols);
+ const tileDefId = tileDefMap[`${currentSheetId}:${i}`] || 0;
+ html += ``;
}
document.getElementById('palette').innerHTML = html;
}
@@ -268,9 +269,9 @@ function selectTile(frameIndex, tileId) {
document.querySelector(`.palette-tile[data-frame="${frameIndex}"]`)?.classList.add('active');
const sheet = loadedSheets[currentSheetId];
- selected = { sheetId: currentSheetId, frameIndex, tileDefinitionId: tileId };
+ selected = { sheetId: currentSheetId, frameIndex, tileDefinitionId: tileId || 0 };
- document.getElementById('selectedInfo').textContent = `Frame ${frameIndex}`;
+ document.getElementById('selectedInfo').textContent = `Frame ${frameIndex}${tileId ? '' : ' (no definition)'}`;
const col = frameIndex % sheet.cols;
const row = Math.floor(frameIndex / sheet.cols);
diff --git a/Services/Admin/Pages/Dungeons/View.cshtml b/Services/Admin/Pages/Dungeons/View.cshtml
index 250e6c7..a4cdfb2 100644
--- a/Services/Admin/Pages/Dungeons/View.cshtml
+++ b/Services/Admin/Pages/Dungeons/View.cshtml
@@ -297,6 +297,56 @@ else
}
+
+
+
+
+
Setup Tile Definition
+
+
+
Frame
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@section Scripts {