using System.Collections.Generic; using System.Linq; public partial class ActLunhuidianTypeConfig : ConfigBase { static List tabIndexList = new List(); //<轮回类型,<界面类型,配置ID>> static Dictionary> infoDict = new Dictionary>(); protected override void OnConfigParseCompleted() { if (!infoDict.ContainsKey(RoundType)) infoDict[RoundType] = new Dictionary(); infoDict[RoundType][TabType] = ID; } public static List 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); } }