summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XBattleStatistics.cs
blob: 3a2f967944b8f1789c2a3797bfa090db3b7f15a3 (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
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>(XCombatStatisticsDocument.uuID);
			specificDocument.bShowDamage = true;
		}

		public void StopPrintDamage()
		{
			DlgBase<DemoUI, DemoUIBehaviour>.singleton.AddMessage((this.m_Damage - this.m_StartPrintDamage).ToString("F1"));
		}
	}
}