blob: 551f8fe6f3ab1f99454c3ad95acaf04f24ab193b (
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
using System;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class PPTDlg : DlgBase<PPTDlg, PPTBehaviour>
{
public override string fileName
{
get
{
return "Common/PPTDlg";
}
}
public override int group
{
get
{
return 1;
}
}
public override bool autoload
{
get
{
return true;
}
}
public override bool hideMainMenu
{
get
{
return false;
}
}
private int _curPPT = 0;
private int _targetPPT = 0;
private float _PPTtime = 0f;
private const float _PPTExistTime = 2.5f;
private int delta = 0;
private DateTime _last_power_sound_time = DateTime.Now;
private bool is_inited = false;
public void InitDlg()
{
bool flag = !this.is_inited;
if (flag)
{
XPlayer player = XSingleton<XEntityMgr>.singleton.Player;
XPlayerAttributes xplayerAttributes = player.Attributes as XPlayerAttributes;
this._curPPT = (int)xplayerAttributes.GetAttr(XAttributeDefine.XAttr_POWER_POINT_Basic);
this._targetPPT = this._curPPT;
this.is_inited = true;
}
}
public void UnInit()
{
this.is_inited = false;
this._targetPPT = (this._curPPT = 0);
}
protected override void Init()
{
base.Init();
}
public override void OnUpdate()
{
bool flag = this._curPPT != this._targetPPT;
if (flag)
{
this._curPPT += this.delta;
bool flag2 = (this.delta > 0 && this._curPPT >= this._targetPPT) || (this.delta < 0 && this._curPPT <= this._targetPPT);
if (flag2)
{
this._curPPT = this._targetPPT;
this._PPTtime = Time.time;
}
base.uiBehaviour.m_PPT.SetText(this._curPPT.ToString());
}
else
{
bool flag3 = this._PPTtime > 0f && Time.time - this._PPTtime > 2.5f;
if (flag3)
{
this._PPTtime = 0f;
bool flag4 = base.IsVisible();
if (flag4)
{
this.SetVisible(false, true);
}
}
}
}
public void ShowPPT(int ppt)
{
this.InitDlg();
bool flag = ppt != this._targetPPT;
if (flag)
{
this.SetPowerpoint(ppt);
}
}
private void SetPowerpoint(int ppt)
{
bool flag = ppt > this._curPPT;
if (flag)
{
bool flag2 = (DateTime.Now - this._last_power_sound_time).TotalMilliseconds > 1000.0;
if (flag2)
{
this._last_power_sound_time = DateTime.Now;
XSingleton<XAudioMgr>.singleton.PlayUISound("Audio/UI/zhandoulitishen", true, AudioChannel.Action);
}
}
bool flag3 = ppt != this._targetPPT;
if (flag3)
{
this.OnPowerpointChanged(this._targetPPT, ppt);
}
else
{
this._targetPPT = ppt;
this._curPPT = ppt;
}
}
public void OnPowerpointChanged(int oldValue, int newValue)
{
this._curPPT = oldValue;
this._targetPPT = newValue;
this._PPTtime = 0f;
int num = newValue - oldValue;
bool flag = num > 0;
if (flag)
{
this.SetVisible(true, true);
base.uiBehaviour.m_IncreasePPT.SetVisible(true);
base.uiBehaviour.m_IncreasePPT.SetText(num.ToString());
base.uiBehaviour.m_DecreasePPT.SetVisible(false);
}
else
{
bool flag2 = num < 0;
if (flag2)
{
this.SetVisible(true, true);
base.uiBehaviour.m_IncreasePPT.SetVisible(false);
base.uiBehaviour.m_DecreasePPT.SetText((-num).ToString());
base.uiBehaviour.m_DecreasePPT.SetVisible(true);
}
}
this.delta = (newValue - oldValue) / 30;
bool flag3 = this.delta == 0;
if (flag3)
{
this.delta = 1;
}
}
}
}
|