using System; using System.Collections.Generic; using System.Globalization; using UnityEngine; namespace TKS.OutGame { /// key,value 표(economy.csv · gacha.csv) 공용 — 값은 문자열로 두고 읽을 때 변환한다. [Serializable] public class KeyValueList { [Serializable] public class Entry { public string key; public string value; } public List entries = new List(); public bool Has(string key) { foreach (var e in entries) if (e.key == key) return true; return false; } public string S(string key) { foreach (var e in entries) if (e.key == key) return e.value; Debug.LogError("[TKS] 표에 키 없음: " + key + " (TKS/Import OutGame Data)"); return ""; } public float F(string key) { float v; return float.TryParse(S(key), NumberStyles.Float, CultureInfo.InvariantCulture, out v) ? v : 0f; } public int I(string key) { return Mathf.RoundToInt(F(key)); } /// 「a;b;c」 목록. public string[] List(string key) { var s = S(key); return s.Length == 0 ? new string[0] : s.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); } } }