summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs
blob: dc3028d15b335a241afbb4caf1429bc11ff2a953 (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
using System;
using XUtliPoolLib;

namespace XMainClient
{
	internal class XBuffManipulate : BuffEffect
	{
		private XEntity _entity;

		private XBuff _Buff;

		private long _Token;

		public static bool TryCreate(BuffTable.RowData rowData, XBuff buff)
		{
			bool flag = rowData.Manipulate == null || rowData.Manipulate.Length == 0;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				buff.AddEffect(new XBuffManipulate(buff));
				result = true;
			}
			return result;
		}

		public XBuffManipulate(XBuff buff)
		{
			this._Buff = buff;
		}

		private float _GetParam(int index)
		{
			bool flag = this._Buff.BuffInfo.Manipulate == null || this._Buff.BuffInfo.Manipulate.Length <= index;
			float result;
			if (flag)
			{
				result = 0f;
			}
			else
			{
				result = this._Buff.BuffInfo.Manipulate[index];
			}
			return result;
		}

		public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
		{
			this._entity = entity;
			XManipulationData xmanipulationData = new XManipulationData();
			xmanipulationData.Degree = 360f;
			xmanipulationData.Force = this._GetParam(0);
			xmanipulationData.Radius = this._GetParam(1);
			xmanipulationData.TargetIsOpponent = ((int)this._GetParam(2) == 0);
			XManipulationOnEventArgs @event = XEventPool<XManipulationOnEventArgs>.GetEvent();
			@event.data = xmanipulationData;
			@event.Firer = this._entity;
			this._Token = @event.Token;
			XSingleton<XEventMgr>.singleton.FireEvent(@event);
		}

		public override void OnRemove(XEntity entity, bool IsReplaced)
		{
			XManipulationOffEventArgs @event = XEventPool<XManipulationOffEventArgs>.GetEvent();
			@event.DenyToken = this._Token;
			@event.Firer = entity;
			XSingleton<XEventMgr>.singleton.FireEvent(@event);
		}
	}
}