feat(home-dialog): seed file + importer + bootstrap hookup
Mirrors banners pattern: clear-and-rewrite from per-table JSON seed. Ships one entry pointing at parent_gacha_id 80032 to match the 2026-06-03 prod capture. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -46,6 +46,41 @@ public class MyPageGlobalsImporter
|
||||
return seed.Count;
|
||||
}
|
||||
|
||||
public async Task<int> ImportHomeDialogsAsync(SVSimDbContext context, string seedDir)
|
||||
{
|
||||
var seed = SeedLoader.LoadList<HomeDialogSeed>(Path.Combine(seedDir, "home-dialogs.json"));
|
||||
if (seed.Count == 0)
|
||||
{
|
||||
Console.WriteLine("[MyPageGlobalsImporter] No home-dialog seed rows; skipping.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Clear-and-rewrite — same semantics as banners. Seed file is authoritative.
|
||||
var existing = await context.HomeDialogEntries.ToListAsync();
|
||||
context.HomeDialogEntries.RemoveRange(existing);
|
||||
|
||||
foreach (var s in seed)
|
||||
{
|
||||
context.HomeDialogEntries.Add(new HomeDialogEntry
|
||||
{
|
||||
Id = s.Id,
|
||||
TitleTextId = s.TitleTextId,
|
||||
Image = s.Image,
|
||||
ButtonListJson = s.ButtonList.ValueKind == JsonValueKind.Undefined
|
||||
? "[]"
|
||||
: JsonSerializer.Serialize(s.ButtonList),
|
||||
BeginTime = ImporterBase.ParseWireDateTime(s.BeginTime),
|
||||
EndTime = ImporterBase.ParseWireDateTime(s.EndTime),
|
||||
Type = s.Type,
|
||||
Priority = s.Priority,
|
||||
});
|
||||
}
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
Console.WriteLine($"[MyPageGlobalsImporter] HomeDialogs: -{existing.Count}/+{seed.Count}");
|
||||
return seed.Count;
|
||||
}
|
||||
|
||||
public async Task<int> ImportColosseumAsync(SVSimDbContext context, string seedDir)
|
||||
{
|
||||
var s = SeedLoader.LoadObject<ColosseumSeed>(Path.Combine(seedDir, "colosseum.json"));
|
||||
|
||||
Reference in New Issue
Block a user