using System.Collections; using System.Collections.Generic; using UnityEngine; public partial class GodWeaponEffectConfig : IConfigPostProcess { static Dictionary> allConfigs = new Dictionary>(); public void OnConfigParseCompleted() { if (!allConfigs.ContainsKey(this.type)) { allConfigs[this.type] = new Dictionary(); } allConfigs[this.type][this.level] = this; } public static GodWeaponEffectConfig Get(int type, int level) { if (!allConfigs.ContainsKey(type)) { return null; } GodWeaponEffectConfig config = null; foreach (var item in allConfigs[type].Values) { if (config != null) { if (item.level <= level && item.level > config.level) { config = item; } } else { if (item.level <= level) { config = item; } } } return config; } }