From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/XBattleStatistics.cs | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XBattleStatistics.cs (limited to 'Client/Assets/Scripts/XMainClient/XBattleStatistics.cs') diff --git a/Client/Assets/Scripts/XMainClient/XBattleStatistics.cs b/Client/Assets/Scripts/XMainClient/XBattleStatistics.cs new file mode 100644 index 00000000..3a2f9679 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XBattleStatistics.cs @@ -0,0 +1,76 @@ +using System; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; + +namespace XMainClient +{ + internal struct XBattleStatistics + { + public double Dps + { + get + { + return (this.m_TimeTotal > 0f) ? (this.m_Damage / (double)this.m_TimeTotal) : 0.0; + } + } + + public double PrintDamage + { + get + { + return this.m_Damage - this.m_StartPrintDamage; + } + } + + private double m_Damage; + + private double m_StartPrintDamage; + + private float m_TimeTotal; + + private float m_TimeBase; + + private float m_TimeEnd; + + public void Reset() + { + this.m_Damage = 0.0; + this.m_TimeTotal = 0f; + } + + public void AppendDamage(double damage) + { + this.m_Damage += damage; + } + + public void AppendTime() + { + float time = Time.time; + this.m_TimeTotal += time - this.m_TimeBase; + this.m_TimeBase = time; + } + + public void MarkTimeBaseLine() + { + this.m_TimeBase = Time.time - this.m_TimeEnd; + } + + public void MarkTimEndLine() + { + this.m_TimeEnd = Time.time - this.m_TimeBase; + } + + public void StartPrintDamage(float time) + { + this.m_StartPrintDamage = this.m_Damage; + XCombatStatisticsDocument specificDocument = XDocuments.GetSpecificDocument(XCombatStatisticsDocument.uuID); + specificDocument.bShowDamage = true; + } + + public void StopPrintDamage() + { + DlgBase.singleton.AddMessage((this.m_Damage - this.m_StartPrintDamage).ToString("F1")); + } + } +} -- cgit v1.1-26-g67d0