summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/EffectDataParams.cs
blob: ee252f6b204d00bbed5209f3588f181e76478c30 (plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using System;
using System.Collections.Generic;
using XUtliPoolLib;

namespace XMainClient
{
	internal class EffectDataParams : XDataBase
	{
		private Dictionary<CombatEffectType, EffectDataParams.TypeDataCollection> type2DataMap = new Dictionary<CombatEffectType, EffectDataParams.TypeDataCollection>(default(XFastEnumIntEqualityComparer<CombatEffectType>));

		public class TypeDataCollection : XDataBase
		{
			public CombatEffectType type;

			public List<EffectDataParams.TypeData> datas = new List<EffectDataParams.TypeData>();

			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<int> randomParams = new List<int>();

			public List<string> constantParams = new List<string>();

			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<EffectDataParams.TypeDataCollection>.GetData();
				data.type = type;
				this.type2DataMap[type] = data;
			}
			return data;
		}

		public override void Recycle()
		{
			base.Recycle();
			foreach (KeyValuePair<CombatEffectType, EffectDataParams.TypeDataCollection> keyValuePair in this.type2DataMap)
			{
				keyValuePair.Value.Recycle();
			}
			this.type2DataMap.Clear();
		}
	}
}