From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Assets/Scripts/XMainClient/EffectDataParams.cs | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/EffectDataParams.cs (limited to 'Client/Assets/Scripts/XMainClient/EffectDataParams.cs') diff --git a/Client/Assets/Scripts/XMainClient/EffectDataParams.cs b/Client/Assets/Scripts/XMainClient/EffectDataParams.cs new file mode 100644 index 00000000..ee252f6b --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/EffectDataParams.cs @@ -0,0 +1,79 @@ +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(); + } + } +} -- cgit v1.1-26-g67d0