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/ServerBuffInfo.cs | 95 ++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/ServerBuffInfo.cs (limited to 'Client/Assets/Scripts/XMainClient/ServerBuffInfo.cs') diff --git a/Client/Assets/Scripts/XMainClient/ServerBuffInfo.cs b/Client/Assets/Scripts/XMainClient/ServerBuffInfo.cs new file mode 100644 index 00000000..93af9d5a --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/ServerBuffInfo.cs @@ -0,0 +1,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; + } + } +} -- cgit v1.1-26-g67d0