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