using Newtonsoft.Json; using System.Collections.Generic; public class ApprearMonsterPatternTableData : TableDataBase { public int n_AppearMonserGroup; public int n_MonsterID; public int n_AppearRate; } public class table_ApprearMonsterPattern : table_base { public static table_ApprearMonsterPattern Ins; List tableDatas; // 그룹, 몹아이디 리스트 Dictionary> dic_mobids = new Dictionary>(); protected override void Awake() { Ins = this; base.Awake(); } protected override void Start() { tableDatas = JsonConvert.DeserializeObject>(json_last); for (int i = 0; i < tableDatas.Count; i++) { if (!dic_mobids.ContainsKey(tableDatas[i].n_AppearMonserGroup)) dic_mobids.Add(tableDatas[i].n_AppearMonserGroup, new List()); dic_mobids[tableDatas[i].n_AppearMonserGroup].Add(tableDatas[i].n_MonsterID); } base.Start(); } public List Get_DataList() { return tableDatas; } public List Get_DataList(int group) { return tableDatas.FindAll(x => x.n_AppearMonserGroup == group); } public ApprearMonsterPatternTableData Get_Data(int group) { var list = tableDatas.FindAll(x => x.n_AppearMonserGroup == group); return DSUtil.WeightedPick(list, x => x.n_AppearRate); } }