//--------------------------------------------------------
|
// [Author]: Alee
|
// [ Date ]: 2021年7月1日
|
//--------------------------------------------------------
|
|
using LitJson;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using System.Linq;
|
//分部类
|
public partial class ILGubaoStarConfig : IConfigPostProcess
|
{
|
//古宝*1000+星 :索引
|
static Dictionary<int, int> gubaoStarDict = new Dictionary<int, int>();
|
static Dictionary<int, int> gubaoMaxStar = new Dictionary<int, int>();
|
static Dictionary<int, List<Int2>> needItemDict = new Dictionary<int, List<Int2>>();
|
static Dictionary<int, List<Int2>> needQualityPieceDict = new Dictionary<int, List<Int2>>();//需要的品质碎片个数
|
public static List<int> needItemIDs = new List<int>(); //不重复的物品ID
|
public void OnConfigParseCompleted()
|
{
|
gubaoStarDict[GubaoID * 1000 + GubaoStar] = ID;
|
if (gubaoMaxStar.ContainsKey(GubaoID))
|
{
|
gubaoMaxStar[GubaoID] = Mathf.Max(gubaoMaxStar[GubaoID], GubaoStar);
|
}
|
else
|
{
|
gubaoMaxStar.Add(GubaoID, GubaoStar);
|
}
|
|
var items = JsonMapper.ToObject<int[][]>(StarUPNeedItem);
|
List<Int2> tmp = new List<Int2>();
|
for (int i = 0; i < items.Length; i++)
|
{
|
var itemID = items[i][0];
|
tmp.Add(new Int2(itemID, items[i][1]));
|
if (!needItemIDs.Contains(itemID))
|
{
|
needItemIDs.Add(itemID);
|
}
|
}
|
needItemDict[GubaoID * 1000 + GubaoStar] = tmp;
|
|
items = JsonMapper.ToObject<int[][]>(StarUPNeedQualityPiece);
|
if (!items.IsNullOrEmpty())
|
{
|
tmp = new List<Int2>();
|
for (int i = 0; i < items.Length; i++)
|
{
|
var quality = items[i][0];
|
var count = items[i][1];
|
tmp.Add(new Int2(quality, count));
|
}
|
needQualityPieceDict[GubaoID * 1000 + GubaoStar] = tmp;
|
}
|
|
}
|
|
public static int GetGubaoStarIndex(int gubaoID, int starLV)
|
{
|
var mark = gubaoID * 1000 + starLV;
|
if (gubaoStarDict.ContainsKey(mark))
|
return gubaoStarDict[mark];
|
|
return -1;
|
}
|
|
public static int GetMaxStar(int gubaoID)
|
{
|
return gubaoMaxStar[gubaoID];
|
}
|
|
public static List<Int2> GetGubaoStarItems(int gubaoID, int starLV)
|
{
|
var mark = gubaoID * 1000 + starLV;
|
return needItemDict[mark];
|
}
|
|
public static List<Int2> GetGubaQualityPieceInfoList(int gubaoID, int starLV)
|
{
|
var mark = gubaoID * 1000 + starLV;
|
if (needQualityPieceDict.IsNullOrEmpty() || !needQualityPieceDict.ContainsKey(mark))
|
return new List<Int2>();
|
return needQualityPieceDict[mark];
|
}
|
|
public static int GetNeedGubaPieceCountByQuality(int gubaoID, int starLV,int quality)
|
{
|
var mark = gubaoID * 1000 + starLV;
|
List<Int2> list;
|
if (!needQualityPieceDict.TryGetValue(mark,out list))
|
return 0;
|
for (int i = 0; i < list.Count; i++)
|
{
|
if (list[i].x == quality)
|
{
|
return list[i].y;
|
}
|
}
|
return 0;
|
}
|
}
|