22 lines
913 B
C#
22 lines
913 B
C#
using DataServer.Data;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace GameServer.Dungeon;
|
|
|
|
public sealed partial class DungeonHandler
|
|
{
|
|
private async Task<(DungeonLayout layout, DungeonLayoutV2? layoutV2)> GenerateDungeonLayoutWithFallbackAsync(int seed, int tier, CancellationToken ct)
|
|
{
|
|
using var scope = _scopeFactory.CreateScope();
|
|
var db = scope.ServiceProvider.GetRequiredService<GameDbContext>();
|
|
var vnextLogger = scope.ServiceProvider.GetService<ILogger<DungeonGeneratorVNext>>();
|
|
|
|
var vnext = new DungeonGeneratorVNext(db, seed, tier, vnextLogger);
|
|
var layoutV2 = await vnext.GenerateAsync();
|
|
_log.LogInformation("Generated dungeon with VNext - {RoomCount} rooms, {TileCount} visual tiles",
|
|
layoutV2.Rooms.Count, layoutV2.TileDetails.Count);
|
|
return (layoutV2, layoutV2);
|
|
}
|
|
}
|