46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
|
|
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<ApprearMonsterPatternTableData> tableDatas;
|
||
|
|
// 그룹, 몹아이디 리스트
|
||
|
|
Dictionary<int, List<int>> dic_mobids = new Dictionary<int, List<int>>();
|
||
|
|
|
||
|
|
protected override void Awake()
|
||
|
|
{
|
||
|
|
Ins = this;
|
||
|
|
base.Awake();
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void Start()
|
||
|
|
{
|
||
|
|
tableDatas = JsonConvert.DeserializeObject<List<ApprearMonsterPatternTableData>>(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<int>());
|
||
|
|
dic_mobids[tableDatas[i].n_AppearMonserGroup].Add(tableDatas[i].n_MonsterID);
|
||
|
|
}
|
||
|
|
|
||
|
|
base.Start();
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<ApprearMonsterPatternTableData> Get_DataList() { return tableDatas; }
|
||
|
|
public List<ApprearMonsterPatternTableData> 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);
|
||
|
|
}
|
||
|
|
}
|