少年修仙传客户端代码仓库
hch
2025-07-02 600733c8f592cb9e65f2b7a3e110ac1d686e6bfe
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
//--------------------------------------------------------
//    [Author]:           Alee
//    [  Date ]:           2021年7月1日
//--------------------------------------------------------
 
using LitJson;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
//分部类
public partial class ILGubaoStarConfig : IConfigPostProcess
{
    //古宝*1000+星 :索引
    static Dictionary<int, int> gubaoStarDict = new Dictionary<int, int>();
    static Dictionary<int, int> gubaoMaxStar = new Dictionary<int, int>();
    static Dictionary<int, List<Int2>> needItemDict = new Dictionary<int, List<Int2>>();
    static Dictionary<int, List<Int2>> needQualityPieceDict = new Dictionary<int, List<Int2>>();//需要的品质碎片个数
    public static List<int> needItemIDs = new List<int>(); //不重复的物品ID
    public void OnConfigParseCompleted()
    {
        gubaoStarDict[GubaoID * 1000 + GubaoStar] = ID;
        if (gubaoMaxStar.ContainsKey(GubaoID))
        {
            gubaoMaxStar[GubaoID] = Mathf.Max(gubaoMaxStar[GubaoID], GubaoStar);
        }
        else
        {
            gubaoMaxStar.Add(GubaoID, GubaoStar);
        }
 
        var items = JsonMapper.ToObject<int[][]>(StarUPNeedItem);
        List<Int2> tmp = new List<Int2>();
        for (int i = 0; i < items.Length; i++)
        {
            var itemID = items[i][0];
            tmp.Add(new Int2(itemID, items[i][1]));
            if (!needItemIDs.Contains(itemID))
            {
                needItemIDs.Add(itemID);
            }
        }
        needItemDict[GubaoID * 1000 + GubaoStar] = tmp;
 
        items = JsonMapper.ToObject<int[][]>(StarUPNeedQualityPiece);
        if (!items.IsNullOrEmpty())
        {
            tmp = new List<Int2>();
            for (int i = 0; i < items.Length; i++)
            {
                var quality = items[i][0];
                var count = items[i][1];
                tmp.Add(new Int2(quality, count));
            }
            needQualityPieceDict[GubaoID * 1000 + GubaoStar] = tmp;
        }
 
    }
 
    public static int GetGubaoStarIndex(int gubaoID, int starLV)
    {
        var mark = gubaoID * 1000 + starLV;
        if (gubaoStarDict.ContainsKey(mark))
            return gubaoStarDict[mark];
 
        return -1;
    }
 
    public static int GetMaxStar(int gubaoID)
    {
        return gubaoMaxStar[gubaoID];
    }
 
    public static List<Int2> GetGubaoStarItems(int gubaoID, int starLV)
    {
        var mark = gubaoID * 1000 + starLV;
        return needItemDict[mark];
    }
 
    public static List<Int2> GetGubaQualityPieceInfoList(int gubaoID, int starLV)
    {
        var mark = gubaoID * 1000 + starLV;
        if (needQualityPieceDict.IsNullOrEmpty() || !needQualityPieceDict.ContainsKey(mark))
            return new List<Int2>();
        return needQualityPieceDict[mark];
    }
 
    public static int GetNeedGubaPieceCountByQuality(int gubaoID, int starLV,int quality)
    {
        var mark = gubaoID * 1000 + starLV;
        List<Int2> list;
        if (!needQualityPieceDict.TryGetValue(mark,out list))
            return 0;
        for (int i = 0; i < list.Count; i++)
        {
            if (list[i].x == quality)
            {
                return list[i].y;
            }
        }
        return 0;
    }
}