少年修仙传客户端代码仓库
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 ChatBubbleBoxStarConfig : IConfigPostProcess
{
    //<头像ID,<头像星级,索引>>
    private static Dictionary<int, Dictionary<int, int>> resultDict = new Dictionary<int, Dictionary<int, int>>();
 
    public void OnConfigParseCompleted()
    {
        if (!resultDict.ContainsKey(ID))
        {
            resultDict[ID] = new Dictionary<int, int>();
        }
        resultDict[ID][BoxStar] = index;
    }
 
    public static bool TryGetMaxStarLV(int id, out int starCount)
    {
        starCount = 0;
        if (!resultDict.ContainsKey(id))
            return false;
        List<int> 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<int> 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;
    }
}