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
|
using System;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI.CustomBattle
{
internal class CustomBattleBriefHandler : DlgHandlerBase
{
protected override string FileName
{
get
{
return "GameSystem/CustomBattle/CustomModeBriefFrame";
}
}
private XCustomBattleDocument _doc = null;
private IXUISprite _close;
private IXUILabel _name;
private IXUILabel _type;
private IXUILabel _creater;
private Transform _slider;
private IXUILabel _left_time;
private IXUILabel _left_time_tip;
private IXUILabel _size;
private IXUILabel _length;
private IXUILabel _limit;
private IXUILabel _id;
private IXUIButton _start;
private IXUIButton _edit;
private XLeftTimeCounter _lefttime_counter;
protected override void Init()
{
base.Init();
this._doc = XDocuments.GetSpecificDocument<XCustomBattleDocument>(XCustomBattleDocument.uuID);
this._close = (base.transform.Find("Bg/Close").GetComponent("XUISprite") as IXUISprite);
this._name = (base.transform.Find("Bg/Name").GetComponent("XUILabel") as IXUILabel);
this._type = (base.transform.Find("Bg/Type").GetComponent("XUILabel") as IXUILabel);
this._creater = (base.transform.Find("Bg/Creater").GetComponent("XUILabel") as IXUILabel);
this._slider = base.transform.Find("Bg/Slider");
this._left_time = (base.transform.Find("Bg/Slider/Time").GetComponent("XUILabel") as IXUILabel);
this._left_time_tip = (base.transform.Find("Bg/Slider/Time/Tip").GetComponent("XUILabel") as IXUILabel);
this._lefttime_counter = new XLeftTimeCounter(this._left_time, false);
this._size = (base.transform.Find("Bg/Size").GetComponent("XUILabel") as IXUILabel);
this._length = (base.transform.Find("Bg/Length").GetComponent("XUILabel") as IXUILabel);
this._limit = (base.transform.Find("Bg/Limit").GetComponent("XUILabel") as IXUILabel);
this._id = (base.transform.Find("Bg/ID").GetComponent("XUILabel") as IXUILabel);
this._start = (base.transform.Find("Bg/Start").GetComponent("XUIButton") as IXUIButton);
this._edit = (base.transform.Find("Bg/Edit").GetComponent("XUIButton") as IXUIButton);
}
public override void RegisterEvent()
{
base.RegisterEvent();
this._close.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnCloseClicked));
this._start.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnStartButtonClicked));
this._edit.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnEditButtonClicked));
}
private void OnCloseClicked(IXUISprite sp)
{
base.SetVisible(false);
}
protected override void OnShow()
{
base.OnShow();
this.RefreshData();
}
public override void RefreshData()
{
base.RefreshData();
bool flag = this._doc.CurrentCustomData == null;
if (flag)
{
base.SetVisible(false);
}
else
{
CustomBattleTable.RowData customBattleData = this._doc.GetCustomBattleData(this._doc.CurrentCustomData.configID);
this._type.SetText(customBattleData.desc);
this._name.SetText(this._doc.CurrentCustomData.gameName);
this._id.SetText(this._doc.CurrentCustomData.token);
this._creater.SetText(this._doc.CurrentCustomData.gameCreator);
this._size.SetText(this._doc.CurrentCustomData.joinText);
this._length.SetText(XSingleton<UiUtility>.singleton.TimeAccFormatString((int)this._doc.CurrentCustomData.gameLength, 4, 0));
uint num = 1u << XFastEnumIntEqualityComparer<CustomBattleScale>.ToInt(CustomBattleScale.CustomBattle_Scale_Friend);
bool flag2 = (this._doc.CurrentCustomData.gameMask & num) == num;
num = 1u << XFastEnumIntEqualityComparer<CustomBattleScale>.ToInt(CustomBattleScale.CustomBattle_Scale_Guild);
bool flag3 = (this._doc.CurrentCustomData.gameMask & num) == num;
string text = "";
bool flag4 = flag2;
if (flag4)
{
text += XSingleton<XStringTable>.singleton.GetString("FriendOnlyJoin");
}
bool flag5 = flag3;
if (flag5)
{
text = text + ((text == "") ? "" : ",") + XSingleton<XStringTable>.singleton.GetString("GuildOnlyJoin");
}
bool flag6 = text == "";
if (flag6)
{
text = XSingleton<XStringTable>.singleton.GetString("AllJoin");
}
this._limit.SetText(text);
this._start.SetEnable(this._doc.CurrentCustomData.creatorID == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID, false);
this._edit.SetEnable(this._doc.CurrentCustomData.creatorID == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID, false);
switch (this._doc.CurrentCustomData.gameStatus)
{
case CustomBattleState.CustomBattle_Ready:
this._left_time_tip.SetText(XSingleton<XStringTable>.singleton.GetString("WaitForStart"));
this._lefttime_counter.SetLeftTime(this._doc.CurrentCustomData.gameStartLeftTime, -1);
break;
case CustomBattleState.CustomBattle_Going:
this._left_time_tip.SetText(XSingleton<XStringTable>.singleton.GetString("WaitForEnd"));
this._lefttime_counter.SetLeftTime(this._doc.CurrentCustomData.gameEndLeftTime, -1);
this._start.SetEnable(false, false);
break;
case CustomBattleState.CustomBattle_End:
this._left_time_tip.SetText(XSingleton<XStringTable>.singleton.GetString("WaitForEnd"));
this._lefttime_counter.SetLeftTime(this._doc.CurrentCustomData.gameEndLeftTime, -1);
this._start.SetEnable(false, false);
break;
case CustomBattleState.CustomBattle_Destory:
this._left_time_tip.SetText(XSingleton<XStringTable>.singleton.GetString("WaitForEnd"));
this._lefttime_counter.SetLeftTime(this._doc.CurrentCustomData.gameEndLeftTime, -1);
this._start.SetEnable(false, false);
break;
}
}
}
private bool OnStartButtonClicked(IXUIButton button)
{
this._doc.SendCustomBattleStartNow(this._doc.CurrentCustomData.gameID);
return true;
}
private bool OnEditButtonClicked(IXUIButton button)
{
DlgBase<CustomBattleView, TabDlgBehaviour>.singleton.ShowPasswordSettingHandler();
return true;
}
public override void OnUpdate()
{
base.OnUpdate();
this._lefttime_counter.Update();
}
}
}
|