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:
14
SVSim.Bootstrap/Data/seeds/home-dialogs.json
Normal file
14
SVSim.Bootstrap/Data/seeds/home-dialogs.json
Normal file
@@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"title_text_id": "HomeDialog_0066",
|
||||
"image": "home_dialog_000312",
|
||||
"button_list": [
|
||||
{ "button_text_id": "HomeDialog_0002", "scene": "card_pack", "status": "80032" }
|
||||
],
|
||||
"begin_time": "2026-06-01 02:00:00",
|
||||
"end_time": "2026-07-01 01:59:59",
|
||||
"type": 1,
|
||||
"priority": 0
|
||||
}
|
||||
]
|
||||
@@ -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"));
|
||||
|
||||
16
SVSim.Bootstrap/Models/Seed/HomeDialogSeed.cs
Normal file
16
SVSim.Bootstrap/Models/Seed/HomeDialogSeed.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SVSim.Bootstrap.Models.Seed;
|
||||
|
||||
public sealed class HomeDialogSeed
|
||||
{
|
||||
[JsonPropertyName("id")] public int Id { get; set; }
|
||||
[JsonPropertyName("title_text_id")] public string TitleTextId { get; set; } = "";
|
||||
[JsonPropertyName("image")] public string Image { get; set; } = "";
|
||||
[JsonPropertyName("button_list")] public JsonElement ButtonList { get; set; }
|
||||
[JsonPropertyName("begin_time")] public string BeginTime { get; set; } = "";
|
||||
[JsonPropertyName("end_time")] public string EndTime { get; set; } = "";
|
||||
[JsonPropertyName("type")] public int? Type { get; set; }
|
||||
[JsonPropertyName("priority")] public int Priority { get; set; }
|
||||
}
|
||||
@@ -115,6 +115,7 @@ public static class Program
|
||||
await mypage.ImportSealedAsync(context, opts.SeedDir);
|
||||
await mypage.ImportMasterPointRankingPeriodAsync(context, opts.SeedDir);
|
||||
await mypage.ImportSpecialDeckFormatsAsync(context, opts.SeedDir);
|
||||
await mypage.ImportHomeDialogsAsync(context, opts.SeedDir);
|
||||
|
||||
await new DefaultDeckImporter().ImportAsync(context, opts.SeedDir);
|
||||
await new PackImporter().ImportAsync(context, opts.SeedDir);
|
||||
|
||||
Reference in New Issue
Block a user