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
|
using System;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
namespace XMainClient
{
internal class HeroBattleRankDlg : DlgBase<HeroBattleRankDlg, HeroBattleRankBehavior>
{
public override string fileName
{
get
{
return "GameSystem/HeroBattleRankDlg";
}
}
public override bool autoload
{
get
{
return true;
}
}
private XHeroBattleDocument _doc = null;
protected override void OnLoad()
{
base.OnLoad();
}
public override void RegisterEvent()
{
base.RegisterEvent();
}
protected override void OnUnload()
{
base.OnUnload();
}
protected override void Init()
{
base.Init();
base.uiBehaviour.m_RankWrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.WrapListUpdated));
this._doc = XDocuments.GetSpecificDocument<XHeroBattleDocument>(XHeroBattleDocument.uuID);
base.uiBehaviour.m_CloseBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseDlg));
}
private bool OnCloseDlg(IXUIButton button)
{
this.SetVisible(false, true);
return true;
}
protected override void OnHide()
{
base.OnHide();
}
protected override void OnShow()
{
base.OnShow();
}
public void SetupRankFrame()
{
this.SetRankTpl(base.uiBehaviour.m_MyRankTs, 0, true);
base.uiBehaviour.m_RankWrapContent.SetContentCount(this._doc.LastWeek_MainRankList.Count, false);
base.uiBehaviour.m_RankScrollView.ResetPosition();
}
public void WrapListUpdated(Transform t, int index)
{
bool flag = index < 0 || index >= this._doc.LastWeek_MainRankList.Count;
if (!flag)
{
this.SetRankTpl(t, index, false);
}
}
public void SetRankTpl(Transform t, int index, bool isMy)
{
HeroBattleRankData heroBattleRankData = isMy ? this._doc.LastWeek_MyRankData : this._doc.LastWeek_MainRankList[index];
IXUILabel ixuilabel = t.Find("Rank").GetComponent("XUILabel") as IXUILabel;
IXUISprite ixuisprite = t.Find("RankImage").GetComponent("XUISprite") as IXUISprite;
IXUILabel ixuilabel2 = t.Find("Name").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel3 = t.Find("Value1").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel4 = t.Find("Value2").GetComponent("XUILabel") as IXUILabel;
bool flag = heroBattleRankData.rank < 3u;
if (flag)
{
ixuisprite.SetVisible(true);
ixuilabel.SetVisible(false);
ixuisprite.spriteName = string.Format("N{0}", heroBattleRankData.rank + 1u);
}
else
{
ixuisprite.SetVisible(false);
ixuilabel.SetVisible(true);
ixuilabel.SetText(string.Format("No.{0}", heroBattleRankData.rank + 1u));
}
if (isMy)
{
bool flag2 = heroBattleRankData.rank == uint.MaxValue;
if (flag2)
{
base.uiBehaviour.m_OutOfRank.SetActive(true);
ixuisprite.SetVisible(false);
ixuilabel.SetVisible(false);
}
else
{
base.uiBehaviour.m_OutOfRank.SetActive(false);
}
}
bool flag3 = heroBattleRankData.fightTotal == 0u;
int num;
if (flag3)
{
num = 0;
}
else
{
num = (int)Mathf.Floor(heroBattleRankData.winTotal * 100u / heroBattleRankData.fightTotal);
}
ixuilabel2.SetText(heroBattleRankData.name);
ixuilabel3.SetText(string.Format("{0}%", num));
ixuilabel4.SetText(heroBattleRankData.fightTotal.ToString());
ixuilabel2.ID = heroBattleRankData.roleID;
ixuilabel2.RegisterLabelClickEventHandler(new LabelClickEventHandler(this.OnPlayerInfoClick));
}
private void OnPlayerInfoClick(IXUILabel label)
{
bool flag = label.ID == 0UL;
if (!flag)
{
XCharacterCommonMenuDocument.ReqCharacterMenuInfo(label.ID, false);
}
}
}
}
|