using System; using System.Collections.Generic; using System.Globalization; using UnityEngine; namespace TKS.OutGame { /// /// 외형(코스튬) 표 4장(2026-11-20 개발요청_코스튬 §1 · 기획 tables/ 사본) — costume_slots(부위 4 · 그리는 순서 · 기준점 · 외형 = 추후) · costume_items(꾸미기 9) · /// costume_config · costume_anchors(유닛별 기준점 · 그림 비율 · 왼쪽 위 0) + 유닛 그림 알파 경계(frames · 임포트가 PNG 에서 계산 · 프레임 윗선 이동 · 자동 기준점). /// 임포트 = TKS/Import Costume → Resources/OutGame/CostumeDb.asset · 값은 전부 표(C45). /// public class CostumeDb : ScriptableObject { [Serializable] public class Slot { public string slot = ""; public int order; public string nameKo = ""; public int layer; public string anchor = ""; public bool open; } [Serializable] public class Item { public string id = ""; public string slot = ""; public string nameKo = ""; public string rarity = ""; public string source = ""; public string sourceKo = ""; public string art = ""; } [Serializable] public class Anchor { public string unit = ""; public string anchor = ""; public float x; public float y; public float scale = 1f; public float rot; } /// 유닛 그림 한 프레임의 알파 경계(px · 왼쪽 위 0 · 프레임 크기 w × h). [Serializable] public class Frame { public string art = ""; public string clip = ""; public int index; public int w; public int h; public int left; public int top; public int right; public int bottom; } [Serializable] public class KV { public string key = ""; public string value = ""; } public List slots = new List(); public List items = new List(); public List anchors = new List(); public List config = new List(); public List frames = new List(); Dictionary frameIndex; public string Cfg(string key) { foreach (var c in config) if (c.key == key) return c.value; return ""; } public Slot SlotOf(string s) { foreach (var x in slots) if (x.slot == s) return x; return null; } public Item ItemOf(string id) { foreach (var x in items) if (x.id == id) return x; return null; } public Anchor AnchorOf(string unit, string anchor) { foreach (var a in anchors) if (a.unit == unit && a.anchor == anchor) return a; return null; } public Frame FrameOf(string art, string clip, int index) { if (frameIndex == null || frameIndex.Count != frames.Count) { frameIndex = new Dictionary(); foreach (var f in frames) frameIndex[f.art + "/" + f.clip + "/" + f.index] = f; } Frame r; return frameIndex.TryGetValue(art + "/" + clip + "/" + index, out r) ? r : null; } /// costume_config rarity_color(Normal:white;…) → 등급 키(gear_grades · ui_theme gear_*). public string RarityGrade(string rarity) { foreach (var p in Cfg("rarity_color").Split(';')) { var kv = p.Split(':'); if (kv.Length == 2 && kv[0] == rarity) return kv[1]; } return "white"; } public static float F(string s) { float v; return float.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out v) ? v : 0f; } } }