yyl
2026-05-11 51b0f6ed9f4e1d3bb6f8144470b46908c7699a96
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
using System.Collections.Generic;
public partial class ActHeroAppearStarConfig : ConfigBase<int, ActHeroAppearStarConfig>
{
    // 升星礼包模版ID: 奖励记录索引 :配置ID
    private static Dictionary<int, Dictionary<int, int>> infoDict = new();
    // 升星礼包模版ID List<奖励记录索引>
    private static Dictionary<int, List<int>> sortDict = new();
    protected override void OnConfigParseCompleted()
    {
        if (!infoDict.TryGetValue(StarTempID, out var dict))
        {
            dict = new Dictionary<int, int>();
            infoDict[StarTempID] = dict;
        }
        dict[AwardIndex] = ID;
    }
 
    private static void LoadSortList()
    {
        if (!sortDict.IsNullOrEmpty()) return;
        foreach (var kvp in infoDict)
        {
            int starTempID = kvp.Key;
            List<int> list = new List<int>(kvp.Value.Keys);
            list.Sort();
            sortDict[starTempID] = list;
        }
    }
    public static List<int> GetHeroReturnAwardIndexSortList(int starTempID)
    {
        LoadSortList();
        sortDict.TryGetValue(starTempID, out var list);
 
        List<int> res = new List<int>();
        int heroId = HeroReturnManager.Instance.GetCurrentDisplayStarUpHeroId();
        int nowStar = HeroReturnManager.Instance.GetNowHeroMaxStarCnt(heroId);
        for (int i = HeroReturnManager.Instance.seeArr.Length - 1; i >= 0; i--)
        {
            int[] info = HeroReturnManager.Instance.seeArr[i];
            int needStar = info[0];
            int seeStar = info[1];
            if (nowStar >= needStar)
            {
                for (int j = 0; j < seeStar; j++)
                {
                    if (j >= list.Count) continue;
 
                    var config = GetConfig(starTempID, list[j]);
                    if (config == null) continue;
 
                    int tempStar = config.NeedStar;
                    if (tempStar > seeStar) continue;
 
                    res.Add(list[j]);
                }
                return res;
            }
        }
 
        return null;
    }
    public static List<int> GetHeroDebutAwardIndexSortList(int starTempID)
    {
        LoadSortList();
        sortDict.TryGetValue(starTempID, out var list);
 
        List<int> res = new List<int>();
        int heroId = HeroDebutManager.Instance.GetCurrentDisplayStarUpHeroId();
        int nowStar = HeroDebutManager.Instance.GetNowHeroMaxStarCnt(heroId);
        for (int i = HeroDebutManager.Instance.seeArr.Length - 1; i >= 0; i--)
        {
            int[] info = HeroDebutManager.Instance.seeArr[i];
            int needStar = info[0];
            int seeStar = info[1];
            if (nowStar >= needStar)
            {
                for (int j = 0; j < seeStar; j++)
                {
                    if (j >= list.Count) continue;
 
                    var config = GetConfig(starTempID, list[j]);
                    if (config == null) continue;
 
                    int tempStar = config.NeedStar;
                    if (tempStar > seeStar) continue;
 
                    res.Add(list[j]);
                }
                return res;
            }
        }
 
        return null;
    }
 
    public static Dictionary<int, int> GetAwardIndexDict(int starTempID)
    {
        infoDict.TryGetValue(starTempID, out var dict);
        return dict;
    }
 
    public static int GetID(int starTempID, int awardIndex)
    {
        var dict = GetAwardIndexDict(starTempID);
        if (dict == null) return 0;
 
        dict.TryGetValue(awardIndex, out var id);
        return id;
    }
 
    public static ActHeroAppearStarConfig GetConfig(int starTempID, int awardIndex)
    {
        int id = GetID(starTempID, awardIndex);
        return Get(id);
    }
 
}