using System.Collections.Generic;
|
using System.Linq;
|
public partial class ActLunhuidianTypeConfig : ConfigBase<int, ActLunhuidianTypeConfig>
|
{
|
static List<int> tabIndexList = new List<int>();
|
//<轮回类型,<界面类型,配置ID>>
|
static Dictionary<int, Dictionary<int, int>> infoDict = new Dictionary<int, Dictionary<int, int>>();
|
|
protected override void OnConfigParseCompleted()
|
{
|
if (!infoDict.ContainsKey(RoundType))
|
infoDict[RoundType] = new Dictionary<int, int>();
|
infoDict[RoundType][TabType] = ID;
|
}
|
|
public static List<int> GetTabList()
|
{
|
if (tabIndexList.IsNullOrEmpty())
|
{
|
tabIndexList = GetKeys().OrderBy(id => Get(id)?.TabSort ?? int.MaxValue).ToList();
|
}
|
return tabIndexList;
|
}
|
|
public static int GetId(int roundType, int tabType)
|
{
|
return infoDict.TryGetValue(roundType, out var info) && info.TryGetValue(tabType, out var index) ? index : 0;
|
}
|
|
public static bool TryGetId(int roundType, int tabType, out int id)
|
{
|
id = 0;
|
return infoDict != null && infoDict.TryGetValue(roundType, out var info) && info.TryGetValue(tabType, out id);
|
}
|
|
public static bool TryGetConfig(int id, out ActLunhuidianTypeConfig config)
|
{
|
config = null;
|
if (!HasKey(id))
|
return false;
|
config = Get(id);
|
return true;
|
}
|
|
public static bool TryGetConfig(int roundType, int tabType, out ActLunhuidianTypeConfig config)
|
{
|
config = null;
|
if (!TryGetId(roundType, tabType, out int id))
|
return false;
|
return TryGetConfig(id, out config);
|
}
|
|
|
}
|