summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UIBuffInfo.cs
blob: 50ade5e0a77fb769d49ca58bfcc303b0a63f5b44 (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
using System;
using UnityEngine;
using XUtliPoolLib;

namespace XMainClient
{
	internal class UIBuffInfo
	{
		public uint buffID;

		public uint buffLevel;

		public float leftTime;

		public float startTime;

		public double HP;

		public double maxHP;

		public ulong mobUID;

		public bool bReduceCD;

		public int transformID;

		public uint stackCount;

		public BuffTable.RowData buffInfo;

		public static UIBuffInfo Create(XBuff buff)
		{
			UIBuffInfo uibuffInfo = new UIBuffInfo();
			uibuffInfo.Set(buff);
			return uibuffInfo;
		}

		public void Set(XBuff buff)
		{
			this.buffID = (uint)buff.ID;
			this.buffLevel = (uint)buff.Level;
			this.leftTime = buff.GetLeftTime();
			this.startTime = Time.time;
			this.HP = buff.HP;
			this.maxHP = buff.MaxHP;
			this.mobUID = buff.EffectData.MobID;
			this.stackCount = buff.StackCount;
			this.buffInfo = buff.BuffInfo;
		}

		public static UIBuffInfo Create(ServerBuffInfo buff)
		{
			UIBuffInfo uibuffInfo = new UIBuffInfo();
			uibuffInfo.Set(buff);
			return uibuffInfo;
		}

		public bool Set(ServerBuffInfo buff)
		{
			this.buffID = buff.buffID;
			this.buffLevel = buff.buffLevel;
			this.leftTime = buff.leftTime;
			this.startTime = Time.realtimeSinceStartup;
			this.HP = buff.HP;
			this.maxHP = buff.maxHP;
			this.mobUID = buff.mobUID;
			this.bReduceCD = buff.bReduceCD;
			this.transformID = buff.transformID;
			this.stackCount = buff.stackCount;
			this.buffInfo = XSingleton<XBuffTemplateManager>.singleton.GetBuffData((int)this.buffID, (int)this.buffLevel);
			bool flag = this.buffInfo == null;
			bool result;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddErrorLog(string.Format("Set Server Buff data not found: [{0} {1}]", this.buffID, this.buffLevel), null, null, null, null, null);
				result = false;
			}
			else
			{
				result = true;
			}
			return result;
		}
	}
}