//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Thursday, May 03, 2018
|
//--------------------------------------------------------
|
|
using UnityEngine;
|
using System;
|
using System.Collections.Generic;
|
|
public partial class ItemPlusMasterConfig : IConfigPostProcess
|
{
|
// SortedDictionary 效率不高 只用于少量数据存储
|
private static Dictionary<int, SortedDictionary<int, ItemPlusMasterConfig>> m_ItemPlusMaster = new Dictionary<int, SortedDictionary<int, ItemPlusMasterConfig>>();
|
|
|
public void OnConfigParseCompleted()
|
{
|
if (!m_ItemPlusMaster.ContainsKey(ClassLV))
|
{
|
m_ItemPlusMaster[ClassLV] = new SortedDictionary<int, ItemPlusMasterConfig>();
|
}
|
m_ItemPlusMaster[ClassLV][MasterPlusLV] = this;
|
|
}
|
|
public static ItemPlusMasterConfig TryGetNextMaster(int classLV, int masterPlusLV)
|
{
|
//获取下一个大师等级数据
|
if (!m_ItemPlusMaster.ContainsKey(classLV)) return null;
|
|
var plusList = m_ItemPlusMaster[classLV].Keys;
|
|
if (m_ItemPlusMaster[classLV].ContainsKey(masterPlusLV))
|
{
|
bool findx = false;
|
foreach (var items in m_ItemPlusMaster[classLV])
|
{
|
if (findx) return items.Value;
|
if (items.Key == masterPlusLV) findx = true;
|
}
|
return null;
|
}
|
else
|
{
|
// 第一个大师等级
|
foreach (var items in m_ItemPlusMaster[classLV])
|
{
|
return items.Value;
|
}
|
}
|
|
return null;
|
}
|
|
public static SortedDictionary<int, ItemPlusMasterConfig> GetMasters(int classLV)
|
{
|
var tmpDict = new SortedDictionary<int, ItemPlusMasterConfig>();
|
m_ItemPlusMaster.TryGetValue(classLV, out tmpDict);
|
return tmpDict;
|
}
|
|
|
public static ItemPlusMasterConfig TryGetMasterInfo(int classLV, int masterPlusLV)
|
{
|
//获取下一个大师等级数据
|
if (!m_ItemPlusMaster.ContainsKey(classLV)) return null;
|
|
if (!m_ItemPlusMaster[classLV].ContainsKey(masterPlusLV)) return null;
|
|
return m_ItemPlusMaster[classLV][masterPlusLV];
|
|
}
|
}
|