summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/ServerBuffInfo.cs
blob: 93af9d5abe649a14aeb6dd1ef787066eb12fa167 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using System;
using KKSG;
using UnityEngine;

namespace XMainClient
{
	internal class ServerBuffInfo
	{
		public float leftTime
		{
			get
			{
				return this.startLeftTime - (Time.realtimeSinceStartup - this.startTime);
			}
			set
			{
				this.startLeftTime = value;
				this.startTime = Time.realtimeSinceStartup;
			}
		}

		public UIBuffInfo UIBuff
		{
			get
			{
				return this.m_UIBuffInfo;
			}
		}

		public uint buffID;

		public uint buffLevel;

		public double HP;

		public double maxHP;

		public ulong mobUID;

		public bool bReduceCD = false;

		public int transformID;

		public uint stackCount = 1u;

		private float startTime;

		private float startLeftTime;

		private UIBuffInfo m_UIBuffInfo = new UIBuffInfo();

		public bool Set(BuffInfo data)
		{
			this.buffID = data.BuffID;
			this.buffLevel = data.BuffLevel;
			this.leftTime = data.LeftTime / 1000f;
			bool mobUIDSpecified = data.MobUIDSpecified;
			if (mobUIDSpecified)
			{
				this.mobUID = data.MobUID;
			}
			bool curHPSpecified = data.CurHPSpecified;
			if (curHPSpecified)
			{
				this.HP = data.CurHP;
			}
			bool maxHPSpecified = data.MaxHPSpecified;
			if (maxHPSpecified)
			{
				this.maxHP = data.MaxHP;
			}
			bool stackCountSpecified = data.StackCountSpecified;
			if (stackCountSpecified)
			{
				this.stackCount = data.StackCount;
			}
			bool bReduceCDSpecified = data.bReduceCDSpecified;
			if (bReduceCDSpecified)
			{
				this.bReduceCD = data.bReduceCD;
			}
			bool transformIDSpecified = data.TransformIDSpecified;
			if (transformIDSpecified)
			{
				this.transformID = data.TransformID;
			}
			return this.m_UIBuffInfo.Set(this);
		}

		public void UpdateFromRemoveBuff(BuffInfo info)
		{
			this.transformID = info.TransformID;
		}
	}
}