//-------------------------------------------------------- // [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 npcDict = new Dictionary(); private static Dictionary realmToLVRange = new Dictionary(); 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); } }