Dungeon Building p8

This commit is contained in:
dingo
2025-12-28 13:40:46 -05:00
parent d284897ae2
commit 0bdd9b0ffc
+38 -1
View File
@@ -2320,6 +2320,40 @@ public sealed partial class DungeonHandler : IClientMessageHandler
session.CurrentDungeonId = instance.Id;
session.PlayerInstance = player;
// Build visual tile data if V2 layout available
object? tileSheets = null;
object? visualTiles = null;
if (instance.LayoutV2 != null && instance.LayoutV2.TileDetails.Count > 0)
{
tileSheets = instance.LayoutV2.TileMapSheets.Select(s => new
{
id = s.Id,
path = s.CdnPath,
tileW = s.TileWidth,
tileH = s.TileHeight,
sheetW = s.SheetWidth,
sheetH = s.SheetHeight,
cols = s.Columns
}).ToArray();
visualTiles = instance.LayoutV2.TileDetails.Select(t => new
{
x = t.X,
y = t.Y,
tid = t.TileDefinitionId,
sid = t.SheetId,
frame = t.FrameIndex,
l = t.Layer,
r = t.Rotation,
fx = t.FlipX,
fy = t.FlipY
}).ToArray();
_log.LogInformation("Sending {SheetCount} sheets, {TileCount} visual tiles to client",
instance.LayoutV2.TileMapSheets.Count, instance.LayoutV2.TileDetails.Count);
}
await SendAsync(connection, DungeonOpCodes.DUNGEON_ENTER_RESULT, new
{
ok = true,
@@ -2367,7 +2401,10 @@ public sealed partial class DungeonHandler : IClientMessageHandler
x = p.X,
y = p.Y,
type = p.Type.ToString().ToLower()
})
}),
// V2 visual tile data
tileSheets,
visualTiles
}, ct);
_log.LogInformation("Player {Name} (Level {Level}) joined dungeon {Id}",