Dungeon Builder. CONT.
This commit is contained in:
@@ -130,7 +130,7 @@
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- Test Generator -->
|
<!-- Test Generator -->
|
||||||
<a href="/admin/dungeonbuilder/test" class="card p-6 hover:border-orange-500 transition-colors group">
|
<a href="/admin/dungeonbuilder/testgen" class="card p-6 hover:border-orange-500 transition-colors group">
|
||||||
<div class="flex items-start gap-4">
|
<div class="flex items-start gap-4">
|
||||||
<div class="w-12 h-12 rounded-lg bg-orange-500/20 flex items-center justify-center text-orange-400 text-2xl">
|
<div class="w-12 h-12 rounded-lg bg-orange-500/20 flex items-center justify-center text-orange-400 text-2xl">
|
||||||
🧪
|
🧪
|
||||||
|
|||||||
@@ -28,8 +28,6 @@
|
|||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
.palette-item {
|
.palette-item {
|
||||||
width: 36px;
|
|
||||||
height: 36px;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: 2px solid transparent;
|
border: 2px solid transparent;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
@@ -38,6 +36,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
image-rendering: pixelated;
|
image-rendering: pixelated;
|
||||||
|
box-sizing: content-box;
|
||||||
}
|
}
|
||||||
.palette-item:hover { border-color: #60a5fa; }
|
.palette-item:hover { border-color: #60a5fa; }
|
||||||
.palette-item.active { border-color: #fbbf24; background: #374151; }
|
.palette-item.active { border-color: #fbbf24; background: #374151; }
|
||||||
@@ -387,7 +386,7 @@ function loadTilePalette() {
|
|||||||
for (let i = 0; i < total; i++) {
|
for (let i = 0; i < total; i++) {
|
||||||
const col = i % sheet.cols, row = Math.floor(i / sheet.cols);
|
const col = i % sheet.cols, row = Math.floor(i / sheet.cols);
|
||||||
html += `<div class="palette-item" data-type="tile" data-sid="${sheet.id}" data-f="${i}" title="Frame ${i}"
|
html += `<div class="palette-item" data-type="tile" data-sid="${sheet.id}" data-f="${i}" title="Frame ${i}"
|
||||||
style="background:url('${cdnBase}/${sheet.cdn}') ${-col*sheet.tw}px ${-row*sheet.th}px no-repeat; background-size:${sheet.sw}px ${sheet.sh}px;"
|
style="width:${sheet.tw}px; height:${sheet.th}px; background:url('${cdnBase}/${sheet.cdn}') ${-col*sheet.tw}px ${-row*sheet.th}px no-repeat; background-size:${sheet.sw}px ${sheet.sh}px;"
|
||||||
onclick="selectPaletteItem(this)"></div>`;
|
onclick="selectPaletteItem(this)"></div>`;
|
||||||
}
|
}
|
||||||
document.getElementById('tilePalette').innerHTML = html;
|
document.getElementById('tilePalette').innerHTML = html;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
.dungeon-cell.player { background: #48bb78; }
|
.dungeon-cell.player { background: #48bb78; }
|
||||||
.dungeon-cell.exit { background: #4299e1; }
|
.dungeon-cell.exit { background: #4299e1; }
|
||||||
.dungeon-cell.mob { background: #f56565; }
|
.dungeon-cell.mob { background: #f56565; }
|
||||||
|
.dungeon-cell.boss { background: #dc2626; }
|
||||||
.dungeon-cell.chest { background: #ecc94b; }
|
.dungeon-cell.chest { background: #ecc94b; }
|
||||||
.dungeon-cell.object { background: #9f7aea; }
|
.dungeon-cell.object { background: #9f7aea; }
|
||||||
.cell-icon {
|
.cell-icon {
|
||||||
@@ -145,6 +146,10 @@
|
|||||||
<span class="text-gray-400">Mobs:</span>
|
<span class="text-gray-400">Mobs:</span>
|
||||||
<span class="text-white">@Model.GeneratedDungeon.MobCount</span>
|
<span class="text-white">@Model.GeneratedDungeon.MobCount</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex justify-between">
|
||||||
|
<span class="text-gray-400">Bosses:</span>
|
||||||
|
<span class="text-white">@Model.GeneratedDungeon.BossCount</span>
|
||||||
|
</div>
|
||||||
<div class="flex justify-between">
|
<div class="flex justify-between">
|
||||||
<span class="text-gray-400">Chests:</span>
|
<span class="text-gray-400">Chests:</span>
|
||||||
<span class="text-white">@Model.GeneratedDungeon.ChestCount</span>
|
<span class="text-white">@Model.GeneratedDungeon.ChestCount</span>
|
||||||
@@ -163,6 +168,51 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if (Model.GeneratedDungeon.FloorTemplatesUsed.Any() || Model.GeneratedDungeon.WallTemplatesUsed.Any() ||
|
||||||
|
Model.GeneratedDungeon.ObjectTemplatesUsed.Any() || Model.GeneratedDungeon.RoomTemplatesUsed.Any())
|
||||||
|
{
|
||||||
|
<div class="card p-4">
|
||||||
|
<h3 class="font-semibold text-white mb-3">Templates Used</h3>
|
||||||
|
<div class="space-y-2 text-xs">
|
||||||
|
@if (Model.GeneratedDungeon.FloorTemplatesUsed.Any())
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<span class="text-blue-400">Floors:</span>
|
||||||
|
<span class="text-gray-300">@string.Join(", ", Model.GeneratedDungeon.FloorTemplatesUsed)</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (Model.GeneratedDungeon.WallTemplatesUsed.Any())
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<span class="text-red-400">Walls:</span>
|
||||||
|
<span class="text-gray-300">@string.Join(", ", Model.GeneratedDungeon.WallTemplatesUsed)</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (Model.GeneratedDungeon.ObjectTemplatesUsed.Any())
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<span class="text-purple-400">Objects:</span>
|
||||||
|
<span class="text-gray-300">@string.Join(", ", Model.GeneratedDungeon.ObjectTemplatesUsed)</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (Model.GeneratedDungeon.RoomTemplatesUsed.Any())
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<span class="text-green-400">Rooms:</span>
|
||||||
|
<span class="text-gray-300">@string.Join(", ", Model.GeneratedDungeon.RoomTemplatesUsed)</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="card p-4">
|
||||||
|
<h3 class="font-semibold text-white mb-2">Templates Used</h3>
|
||||||
|
<p class="text-xs text-gray-500">No custom templates - using procedural generation</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="card p-4">
|
<div class="card p-4">
|
||||||
@@ -174,6 +224,7 @@
|
|||||||
<div class="legend-item"><div class="legend-box bg-green-500"></div><span class="text-gray-300">Player Spawn</span></div>
|
<div class="legend-item"><div class="legend-box bg-green-500"></div><span class="text-gray-300">Player Spawn</span></div>
|
||||||
<div class="legend-item"><div class="legend-box bg-blue-500"></div><span class="text-gray-300">Exit Portal</span></div>
|
<div class="legend-item"><div class="legend-box bg-blue-500"></div><span class="text-gray-300">Exit Portal</span></div>
|
||||||
<div class="legend-item"><div class="legend-box bg-red-500"></div><span class="text-gray-300">Mob Spawn</span></div>
|
<div class="legend-item"><div class="legend-box bg-red-500"></div><span class="text-gray-300">Mob Spawn</span></div>
|
||||||
|
<div class="legend-item"><div class="legend-box bg-red-700"></div><span class="text-gray-300">Boss Spawn</span></div>
|
||||||
<div class="legend-item"><div class="legend-box bg-yellow-500"></div><span class="text-gray-300">Chest</span></div>
|
<div class="legend-item"><div class="legend-box bg-yellow-500"></div><span class="text-gray-300">Chest</span></div>
|
||||||
<div class="legend-item"><div class="legend-box bg-purple-400"></div><span class="text-gray-300">Object</span></div>
|
<div class="legend-item"><div class="legend-box bg-purple-400"></div><span class="text-gray-300">Object</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -217,7 +217,8 @@ public class TestGenModel : AdminPageModel
|
|||||||
for (int i = 1; i < rooms.Count; i++)
|
for (int i = 1; i < rooms.Count; i++)
|
||||||
{
|
{
|
||||||
var room = rooms[i];
|
var room = rooms[i];
|
||||||
int mobCount = room.Type == "Boss" ? 1 : rng.Next(1, 4);
|
bool isBossRoom = room.Type == "Boss";
|
||||||
|
int mobCount = isBossRoom ? 1 : rng.Next(1, 4);
|
||||||
|
|
||||||
for (int m = 0; m < mobCount; m++)
|
for (int m = 0; m < mobCount; m++)
|
||||||
{
|
{
|
||||||
@@ -225,8 +226,9 @@ public class TestGenModel : AdminPageModel
|
|||||||
int my = room.Y + rng.Next(1, room.Height - 1);
|
int my = room.Y + rng.Next(1, room.Height - 1);
|
||||||
if (dungeon.Cells[mx, my].Type == CellType.Floor)
|
if (dungeon.Cells[mx, my].Type == CellType.Floor)
|
||||||
{
|
{
|
||||||
dungeon.Cells[mx, my] = new CellInfo { Type = CellType.Mob };
|
dungeon.Cells[mx, my] = new CellInfo { Type = isBossRoom ? CellType.Boss : CellType.Mob };
|
||||||
dungeon.MobCount++;
|
if (isBossRoom) dungeon.BossCount++;
|
||||||
|
else dungeon.MobCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,11 +322,18 @@ public class TestGenModel : AdminPageModel
|
|||||||
public List<RoomInfo> Rooms { get; set; } = new();
|
public List<RoomInfo> Rooms { get; set; } = new();
|
||||||
public int RoomCount { get; set; }
|
public int RoomCount { get; set; }
|
||||||
public int MobCount { get; set; }
|
public int MobCount { get; set; }
|
||||||
|
public int BossCount { get; set; }
|
||||||
public int ChestCount { get; set; }
|
public int ChestCount { get; set; }
|
||||||
public int ObjectCount { get; set; }
|
public int ObjectCount { get; set; }
|
||||||
public int Seed { get; set; }
|
public int Seed { get; set; }
|
||||||
public long GenerationTimeMs { get; set; }
|
public long GenerationTimeMs { get; set; }
|
||||||
|
|
||||||
|
// Template usage tracking
|
||||||
|
public List<string> FloorTemplatesUsed { get; set; } = new();
|
||||||
|
public List<string> WallTemplatesUsed { get; set; } = new();
|
||||||
|
public List<string> ObjectTemplatesUsed { get; set; } = new();
|
||||||
|
public List<string> RoomTemplatesUsed { get; set; } = new();
|
||||||
|
|
||||||
public CellInfo GetCell(int x, int y)
|
public CellInfo GetCell(int x, int y)
|
||||||
{
|
{
|
||||||
if (x >= 0 && x < Width && y >= 0 && y < Height)
|
if (x >= 0 && x < Width && y >= 0 && y < Height)
|
||||||
@@ -345,6 +354,7 @@ public class TestGenModel : AdminPageModel
|
|||||||
CellType.PlayerSpawn => "player",
|
CellType.PlayerSpawn => "player",
|
||||||
CellType.Exit => "exit",
|
CellType.Exit => "exit",
|
||||||
CellType.Mob => "mob",
|
CellType.Mob => "mob",
|
||||||
|
CellType.Boss => "boss",
|
||||||
CellType.Chest => "chest",
|
CellType.Chest => "chest",
|
||||||
CellType.Object => "object",
|
CellType.Object => "object",
|
||||||
_ => "wall"
|
_ => "wall"
|
||||||
@@ -355,6 +365,7 @@ public class TestGenModel : AdminPageModel
|
|||||||
CellType.PlayerSpawn => "🧑",
|
CellType.PlayerSpawn => "🧑",
|
||||||
CellType.Exit => "🌀",
|
CellType.Exit => "🌀",
|
||||||
CellType.Mob => "👾",
|
CellType.Mob => "👾",
|
||||||
|
CellType.Boss => "💀",
|
||||||
CellType.Chest => "📦",
|
CellType.Chest => "📦",
|
||||||
CellType.Object => "•",
|
CellType.Object => "•",
|
||||||
_ => ""
|
_ => ""
|
||||||
@@ -369,6 +380,7 @@ public class TestGenModel : AdminPageModel
|
|||||||
PlayerSpawn,
|
PlayerSpawn,
|
||||||
Exit,
|
Exit,
|
||||||
Mob,
|
Mob,
|
||||||
|
Boss,
|
||||||
Chest,
|
Chest,
|
||||||
Object
|
Object
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,12 +28,11 @@
|
|||||||
outline-offset: -2px;
|
outline-offset: -2px;
|
||||||
}
|
}
|
||||||
.palette-tile {
|
.palette-tile {
|
||||||
width: 34px;
|
|
||||||
height: 34px;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: 2px solid transparent;
|
border: 2px solid transparent;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
image-rendering: pixelated;
|
image-rendering: pixelated;
|
||||||
|
box-sizing: content-box;
|
||||||
}
|
}
|
||||||
.palette-tile:hover { border-color: #60a5fa; }
|
.palette-tile:hover { border-color: #60a5fa; }
|
||||||
.palette-tile.active { border-color: #fbbf24; }
|
.palette-tile.active { border-color: #fbbf24; }
|
||||||
@@ -381,7 +380,8 @@ function loadSheet() {
|
|||||||
const col = i % sheet.cols;
|
const col = i % sheet.cols;
|
||||||
const row = Math.floor(i / sheet.cols);
|
const row = Math.floor(i / sheet.cols);
|
||||||
html += `<div class="palette-tile" data-frame="${i}" onclick="selectTile(${i})"
|
html += `<div class="palette-tile" data-frame="${i}" onclick="selectTile(${i})"
|
||||||
style="background: url('${cdnBase}/${sheet.cdn}') ${-col * sheet.tw}px ${-row * sheet.th}px no-repeat;
|
style="width: ${sheet.tw}px; height: ${sheet.th}px;
|
||||||
|
background: url('${cdnBase}/${sheet.cdn}') ${-col * sheet.tw}px ${-row * sheet.th}px no-repeat;
|
||||||
background-size: ${sheet.sw}px ${sheet.sh}px;"></div>`;
|
background-size: ${sheet.sw}px ${sheet.sh}px;"></div>`;
|
||||||
}
|
}
|
||||||
document.getElementById('palette').innerHTML = html;
|
document.getElementById('palette').innerHTML = html;
|
||||||
|
|||||||
Reference in New Issue
Block a user