using System.Collections.Generic; using System.Linq; public partial class ChatBubbleBoxStarConfig : IConfigPostProcess { //<头像ID,<头像星级,索引>> private static Dictionary> resultDict = new Dictionary>(); public void OnConfigParseCompleted() { if (!resultDict.ContainsKey(ID)) { resultDict[ID] = new Dictionary(); } resultDict[ID][BoxStar] = index; } public static bool TryGetMaxStarLV(int id, out int starCount) { starCount = 0; if (!resultDict.ContainsKey(id)) return false; List starList = resultDict[id].Keys.ToList(); if (starList == null) return false; starList.Sort(); starList.Reverse(); starCount = starList.First(); return true; } public static int GetMaxStarCount(int id) { if (!resultDict.ContainsKey(id)) return 0; List starList = resultDict[id].Keys.ToList(); if (starList.IsNullOrEmpty()) return 0; starList.Sort(); starList.Reverse(); return starList.First(); } public static bool TryGetIndex(int id, int boxStar, out int index) { index = 0; if (resultDict == null) return false; if (!resultDict.TryGetValue(id, out var info) || info == null) return false; if (!info.TryGetValue(boxStar, out index)) return false; return true; } }