using System.Collections; using System.Collections.Generic; using UnityEngine; [System.Serializable] public class AppearList { public string idx; public int cnt; public List mobNames = new List(); public AppearList() { } public AppearList(string[] spl) { int i = 0; idx = spl[i++]; cnt = int.Parse(spl[i++]); for(; i < spl.Length; i++) { if (1 < spl[i].Length) mobNames.Add(spl[i]); } } } [System.Serializable] public class DataMonsterAppear : IData { Dictionary apper; public List items; public override void TableLoad() { string[] strLine = FileLoadWithLineSplit(path == string.Empty ? "CSV/MonsterAppear" : path); string[] spl; apper = new Dictionary(); for (int i = 1; i < strLine.Length; i++) { if (1 < strLine[i].Length) { spl = strLine[i].Split(','); apper.Add(spl[0], new AppearList(spl)); } } items = new List(apper.Values); } public override void LoadedCheck() { if (apper == null) TableLoad(); } public AppearList AppearListGet(string idx) { LoadedCheck(); if (apper.ContainsKey(idx)) return apper[idx]; return null; } public List AppearsListGet(List idxs) { LoadedCheck(); List list = new List(); for (int i = 0; i < idxs.Count; i++) { AppearList data = AppearListGet(idxs[i]); if (data != null) list.Add(data); } return list; } }