少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System.Collections.Generic;
using System.Linq;
 
public partial class PlayerFaceStarConfig : IConfigPostProcess
{
    //<头像ID,<头像星级,索引>>
    private static Dictionary<int, Dictionary<int, int>> resultDict = new Dictionary<int, Dictionary<int, int>>();
 
    public void OnConfigParseCompleted()
    {
        if (!resultDict.ContainsKey(FaceID))
        {
            resultDict[FaceID] = new Dictionary<int, int>();
        }
        resultDict[FaceID][FaceStar] = index;
    }
 
    public static bool TryGetMaxStarLV(int faceID, out int starCount)
    {
        starCount = 0;
        if (!resultDict.ContainsKey(faceID))
            return false;
        List<int> 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<int> 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;
    }
}