using System; using System.Collections.Generic; using XUtliPoolLib; namespace XMainClient { internal class EffectDataParams : XDataBase { private Dictionary type2DataMap = new Dictionary(default(XFastEnumIntEqualityComparer)); public class TypeDataCollection : XDataBase { public CombatEffectType type; public List datas = new List(); public override void Recycle() { base.Recycle(); for (int i = 0; i < this.datas.Count; i++) { this.datas[i].Recycle(); } this.datas.Clear(); this.type = CombatEffectType.CET_INVALID; } } public class TypeData : XDataBase { public uint effectID; public uint templatebuffID; public List randomParams = new List(); public List constantParams = new List(); public override void Recycle() { base.Recycle(); this.randomParams.Clear(); this.constantParams.Clear(); this.effectID = 0u; this.templatebuffID = 0u; } } public EffectDataParams.TypeDataCollection GetCollection(CombatEffectType type) { EffectDataParams.TypeDataCollection result; this.type2DataMap.TryGetValue(type, out result); return result; } public EffectDataParams.TypeDataCollection EnsureGetCollection(CombatEffectType type) { EffectDataParams.TypeDataCollection data; bool flag = !this.type2DataMap.TryGetValue(type, out data); if (flag) { data = XDataPool.GetData(); data.type = type; this.type2DataMap[type] = data; } return data; } public override void Recycle() { base.Recycle(); foreach (KeyValuePair keyValuePair in this.type2DataMap) { keyValuePair.Value.Recycle(); } this.type2DataMap.Clear(); } } }