using System.Collections.Generic; using UnityEngine; namespace TKS.OutGame { /// 외형(코스튬) 표 4장 해석·검증(2026-11-20 개발요청_코스튬 §1) — 알파 경계(frames)는 임포트(DataImporter.ImportCostume)가 그림에서 채운다. public static partial class OutGameTables { static readonly string[] CostumeOpenStates = { "Open", "Later" }; static CostumeDb ParseCostume(Dictionary>> rows, OutGameData d, List e) { var t = ScriptableObject.CreateInstance(); const string fs = "costume_slots.csv"; if (Cols(rows[fs], fs, e, "s_slot", "n_order", "s_name_ko", "n_layer", "s_anchor", "e_state")) { var seen = new HashSet(); foreach (var r in rows[fs]) { string st = Get(r, "e_state"); if (System.Array.IndexOf(CostumeOpenStates, st) < 0) e.Add(fs + ": " + Get(r, "s_slot") + " e_state 「" + st + "」 = Open · Later 가 아님"); var s = new CostumeDb.Slot { slot = Get(r, "s_slot"), order = Int(r, "n_order", fs, e), nameKo = Get(r, "s_name_ko"), anchor = Get(r, "s_anchor"), open = st == "Open" }; if (s.open) s.layer = Int(r, "n_layer", fs, e); if (!Unique(seen, s.slot, fs, r, e)) continue; if (s.open && (s.layer <= 0 || s.anchor.Length == 0)) e.Add(fs + ": " + s.slot + " 열린 부위인데 n_layer · s_anchor 없음"); t.slots.Add(s); } t.slots.Sort((a, b) => a.order.CompareTo(b.order)); } const string fi = "costume_items.csv"; if (Cols(rows[fi], fi, e, "s_id", "s_slot", "s_name_ko", "e_rarity", "s_source", "s_source_ko", "s_art")) { var seen = new HashSet(); foreach (var r in rows[fi]) { var it = new CostumeDb.Item { id = Get(r, "s_id"), slot = Get(r, "s_slot"), nameKo = Get(r, "s_name_ko"), rarity = Get(r, "e_rarity"), source = Get(r, "s_source"), sourceKo = Get(r, "s_source_ko"), art = Get(r, "s_art") }; if (!Unique(seen, it.id, fi, r, e)) continue; var sl = t.SlotOf(it.slot); if (sl == null) e.Add(fi + ": " + it.id + " s_slot 「" + it.slot + "」 = costume_slots 에 없음"); else if (!sl.open) e.Add(fi + ": " + it.id + " 부위 「" + it.slot + "」 = 잠긴 부위(추후)"); if (Resources.Load(it.art) == null) e.Add(fi + ": " + it.id + " 그림 Resources/" + it.art + " 없음"); t.items.Add(it); } } const string fc = "costume_config.csv"; if (Cols(rows[fc], fc, e, "s_key", "s_value")) foreach (var r in rows[fc]) t.config.Add(new CostumeDb.KV { key = Get(r, "s_key"), value = Get(r, "s_value") }); foreach (var k in new[] { "own_scope", "wear_scope", "preview", "rarity_color", "anchor_fallback" }) if (t.Cfg(k).Length == 0) e.Add(fc + ": 「" + k + "」 줄 없음"); CfgIs(t.Cfg("own_scope"), fc + " own_scope", e, "account"); CfgIs(t.Cfg("wear_scope"), fc + " wear_scope", e, "per_hero"); CfgIs(t.Cfg("preview"), fc + " preview", e, "free"); CfgIs(t.Cfg("anchor_fallback"), fc + " anchor_fallback", e, "auto_bbox"); foreach (var it in t.items) if (d.Gear != null && d.Gear.GradeOf(t.RarityGrade(it.rarity)) == null) e.Add(fc + ": rarity_color 에 " + it.id + " 등급 「" + it.rarity + "」 없음(gear_grades 키)"); const string fa = "costume_anchors.csv"; if (Cols(rows[fa], fa, e, "s_unit_id", "s_anchor", "f_x", "f_y", "f_scale", "f_rot")) foreach (var r in rows[fa]) { var a = new CostumeDb.Anchor { unit = Get(r, "s_unit_id"), anchor = Get(r, "s_anchor"), x = Float(r, "f_x", fa, e), y = Float(r, "f_y", fa, e), scale = Float(r, "f_scale", fa, e), rot = Float(r, "f_rot", fa, e) }; if (d.Heroes != null && d.Heroes.Get(a.unit) == null) e.Add(fa + ": 유닛 「" + a.unit + "」 = heroes 에 없음"); bool known = false; foreach (var s in t.slots) if (s.anchor == a.anchor) known = true; if (!known) e.Add(fa + ": 기준점 「" + a.anchor + "」 = costume_slots s_anchor 에 없음"); if (a.x < 0f || a.x > 1f || a.y < 0f || a.y > 1f || a.scale <= 0f) e.Add(fa + ": " + a.unit + " " + a.anchor + " 값 범위(0~1 · scale > 0) 밖"); t.anchors.Add(a); } return t; } } }