少年修仙传客户端代码仓库
hch
3 天以前 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
//--------------------------------------------------------
//    [Author]:           Alee
//    [  Date ]:           2021年7月1日
//--------------------------------------------------------
 
using LitJson;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
//分部类
public partial class ILNPCRealmStrengthenConfig : IConfigPostProcess
{
    private static Dictionary<Int2, ILNPCRealmStrengthenConfig> npcDict = new Dictionary<Int2, ILNPCRealmStrengthenConfig>();
 
    private static Dictionary<int, Int2> realmToLVRange = new Dictionary<int, Int2>();
 
    public void OnConfigParseCompleted()
    {
        Int2 typeID = new Int2(NPCID, RealmDifficulty);
        if (!npcDict.ContainsKey(typeID))
        {
            npcDict.Add(typeID, this);
        }
 
        //取最小和最大的等级
        if (!realmToLVRange.ContainsKey(RealmDifficulty))
        {
            realmToLVRange.Add(RealmDifficulty, new Int2(LowLV, HighestLV));
        }
        else
        {
            var range = realmToLVRange[RealmDifficulty];
            if (LowLV < range.x)
            {
                realmToLVRange[RealmDifficulty] = new Int2(LowLV, range.y);
            }
            if (HighestLV > range.y)
            {
                realmToLVRange[RealmDifficulty] = new Int2(range.x, HighestLV);
            }
        }
 
    }
 
    public static ILNPCRealmStrengthenConfig GetConfig(Int2 npcRealmID)
    {
        if (npcDict.ContainsKey(npcRealmID))
        {
            return npcDict[npcRealmID];
        }
        return null;
    }
 
    public static Int2 GetLVRange(int realm)
    {
        if (realmToLVRange.ContainsKey(realm))
        {
            return realmToLVRange[realm];
        }
        return new Int2(0, 0);
    }
}