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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
|
using System;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
public class ChatItem : MonoBehaviour
{
private ChatInfo mChatInfo;
private int boardHeight = 144;
private IXUISprite m_sprHead;
private IXUISprite m_sprHost;
private IXUISprite m_sprFrame;
private IXUILabel m_lblTime;
private IXUILabelSymbol m_symContent;
private IXUILabel m_lblContent;
private IXUISprite m_sprBoard;
private GameObject m_objName;
private IXUILabelSymbol m_lblName;
private GameObject m_objVoice;
private IXUISprite m_sprRoot;
private Transform m_offset;
private IXUISprite m_regression;
private IXUISprite m_campDuel;
private void Awake()
{
this.m_sprHead = (base.transform.Find("head").GetComponent("XUISprite") as IXUISprite);
this.m_sprHost = (base.transform.Find("head/hoster").GetComponent("XUISprite") as IXUISprite);
this.m_regression = (base.transform.Find("head/Regression").GetComponent("XUISprite") as IXUISprite);
this.m_sprFrame = (base.transform.Find("head/AvatarFrame").GetComponent("XUISprite") as IXUISprite);
this.m_campDuel = (base.transform.Find("head/CampDuel").GetComponent("XUISprite") as IXUISprite);
this.m_lblTime = (base.transform.Find("board/offset/time").GetComponent("XUILabel") as IXUILabel);
this.m_symContent = (base.transform.Find("board/offset/content").GetComponent("XUILabelSymbol") as IXUILabelSymbol);
this.m_lblContent = (this.m_symContent.gameObject.GetComponent("XUILabel") as IXUILabel);
this.m_sprBoard = (base.transform.Find("board").GetComponent("XUISprite") as IXUISprite);
this.m_objName = base.transform.Find("board/offset/name").gameObject;
this.m_lblName = (base.transform.Find("board/offset/selfname").GetComponent("XUILabelSymbol") as IXUILabelSymbol);
this.m_objVoice = base.transform.Find("board/offset/voice").gameObject;
this.m_sprRoot = (base.GetComponent("XUISprite") as IXUISprite);
this.m_offset = base.transform.Find("board/offset");
this.m_sprHead.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickChatHead));
}
public void Refresh(ChatInfo info)
{
bool flag = this.mChatInfo == info || this.m_lblTime == null;
if (!flag)
{
this.mChatInfo = info;
this.mChatInfo.id = (info.id = DlgBase<XChatView, XChatBehaviour>.singleton.ChatIdIndex);
this.mChatInfo.isUIShowed = (info.isUIShowed = true);
DateTime mTime = info.mTime;
TimeSpan timeSpan = DateTime.Now - mTime;
string text = string.Format("{0:D2}:{1:D2}:{2:D2}", mTime.Hour, mTime.Minute, mTime.Second);
bool flag2 = timeSpan.Days > 0;
if (flag2)
{
text = XStringDefineProxy.GetString("CHAT_DAY", new object[]
{
timeSpan.Days
});
}
bool flag3 = this.m_lblTime != null;
if (flag3)
{
this.m_lblTime.SetText(text);
}
IXUILabelSymbol ixuilabelSymbol = this.m_objName.GetComponent("XUILabelSymbol") as IXUILabelSymbol;
string text2 = XSingleton<UiUtility>.singleton.GetChatDesignation(info.mCoverDesignationID, info.mSpecialDesignation, info.mSenderName);
text2 = XSingleton<XCommon>.singleton.StringCombine(text2, XWelfareDocument.GetMemberPrivilegeIconString(info.mSenderPaymemberid));
ixuilabelSymbol.InputText = XMilitaryRankDocument.GetMilitaryRankWithFormat(info.militaryRank, text2, false);
this.m_regression.SetVisible(info.mRegression);
this.m_campDuel.SetVisible(info.CampDuelID > 0u);
bool flag4 = info.CampDuelID == 1u;
if (flag4)
{
this.m_campDuel.SetSprite(XSingleton<XGlobalConfig>.singleton.GetValue("CampDuelChatLeftIcon"));
}
bool flag5 = info.CampDuelID == 2u;
if (flag5)
{
this.m_campDuel.SetSprite(XSingleton<XGlobalConfig>.singleton.GetValue("CampDuelChatRightIcon"));
}
bool isSelfSender = info.isSelfSender;
if (isSelfSender)
{
this.m_sprHead.SetSprite(XSingleton<XProfessionSkillMgr>.singleton.GetProfHeadIcon2((int)XSingleton<XEntityMgr>.singleton.Player.PlayerAttributes.Profession));
bool flag6 = info.payConsume != null && info.payConsume.setid != null;
if (flag6)
{
XSingleton<UiUtility>.singleton.ParseHeadIcon(info.payConsume.setid, this.m_sprFrame);
}
else
{
this.m_sprFrame.SetVisible(false);
}
}
else
{
bool flag7 = info.mSenderId == 0UL && info.mChannelId == ChatChannelType.Guild;
if (flag7)
{
this.m_sprHead.SetSprite("zy_0_0");
this.m_sprFrame.SetVisible(false);
}
else
{
bool flag8 = info.mSenderId == 0UL && info.mChannelId == ChatChannelType.Team;
if (flag8)
{
this.m_sprHead.SetSprite("zy_0_1");
this.m_sprFrame.SetVisible(false);
}
else
{
this.m_sprHead.SetSprite(XSingleton<XProfessionSkillMgr>.singleton.GetProfHeadIcon2((int)info.mServerProfession));
bool flag9 = info.payConsume != null && info.payConsume.setid != null;
if (flag9)
{
XSingleton<UiUtility>.singleton.ParseHeadIcon(info.payConsume.setid, this.m_sprFrame);
}
else
{
this.m_sprFrame.SetVisible(false);
}
}
}
}
bool flag10 = !info.isSelfSender && (info.mChannelId == ChatChannelType.Guild || info.mChannelId == ChatChannelType.World || info.mChannelId == ChatChannelType.Team);
bool flag11 = flag10;
if (flag11)
{
IXUILabelSymbol ixuilabelSymbol2 = this.m_objName.GetComponent("XUILabelSymbol") as IXUILabelSymbol;
string text3 = XSingleton<UiUtility>.singleton.GetChatDesignation(info.mCoverDesignationID, info.mSpecialDesignation, info.mSenderName);
text3 = XSingleton<XCommon>.singleton.StringCombine(text3, XWelfareDocument.GetMemberPrivilegeIconString(info.mSenderPaymemberid));
ixuilabelSymbol2.InputText = XMilitaryRankDocument.GetMilitaryRankWithFormat(info.militaryRank, text3, false);
}
else
{
bool flag12 = this.m_lblName != null;
if (flag12)
{
bool flag13 = info.mSenderId == 0UL && info.mChannelId == ChatChannelType.Guild;
if (flag13)
{
this.m_lblName.InputText = XStringDefineProxy.GetString("CHAT_GUILD_NEW");
}
else
{
bool flag14 = info.mChatType == ChatType.OtherText || info.mChatType == ChatType.OtherVoice;
if (flag14)
{
this.m_lblName.InputText = ((info.mChannelId == ChatChannelType.Friends) ? XStringDefineProxy.GetString("CHAT_FRIENDS2", new object[]
{
info.mReceiverName
}) : info.mSenderName);
}
else
{
string text4 = XSingleton<XCommon>.singleton.StringCombine(XSingleton<XAttributeMgr>.singleton.XPlayerData.Name, XWelfareDocument.GetMemberPrivilegeIconString(info.mSenderPaymemberid));
text4 = XMilitaryRankDocument.GetMilitaryRankWithFormat(info.militaryRank, text4, false);
this.m_lblName.InputText = ((info.mChannelId == ChatChannelType.Friends) ? XStringDefineProxy.GetString("CHAT_FRIENDS1", new object[]
{
info.mReceiverName
}) : text4);
}
}
}
}
this.m_objVoice.SetActive(info.isAudioChat);
bool isAudioChat = info.isAudioChat;
if (isAudioChat)
{
this.InitAudioUI();
}
else
{
this.InitTextUI();
}
float num = (float)(info.isAudioChat ? -16 : 30);
float num2 = (float)(info.isSelfSender ? 14 : 24);
this.m_lblContent.gameObject.transform.localPosition = new Vector3(num2, num, 0f);
this.SetPivot();
XChatView singleton = DlgBase<XChatView, XChatBehaviour>.singleton;
int chatIdIndex = singleton.ChatIdIndex;
singleton.ChatIdIndex = chatIdIndex + 1;
XRadioDocument specificDocument = XDocuments.GetSpecificDocument<XRadioDocument>(XRadioDocument.uuID);
this.m_sprHost.SetVisible(specificDocument.hostIDs.Contains(this.mChatInfo.mSenderId) && this.mChatInfo.mChannelId == ChatChannelType.Broadcast);
}
}
private void SetPivot()
{
this.m_sprBoard.SetFlipHorizontal(this.mChatInfo.isSelfSender);
float num = (float)(this.mChatInfo.isSelfSender ? -215 : -145);
this.m_sprBoard.gameObject.transform.localPosition = new Vector3(num, -30f, 0f);
this.m_objName.SetActive(!this.mChatInfo.isSelfSender);
this.m_lblName.SetVisible(this.mChatInfo.isSelfSender);
num = (float)(this.mChatInfo.isSelfSender ? 175 : -180);
float num2 = this.m_offset.transform.localPosition.y + this.m_sprBoard.gameObject.transform.localPosition.y;
float num3 = this.m_lblTime.gameObject.transform.localPosition.y + num2 + 4f;
this.m_sprHead.gameObject.transform.localPosition = new Vector3(num, num3, 0f);
}
private void InitAudioUI()
{
this.mChatInfo.mUIObject = this.m_objVoice;
IXUISprite ixuisprite = this.m_objVoice.transform.Find("board").GetComponent("XUISprite") as IXUISprite;
IXUISprite ixuisprite2 = this.m_objVoice.transform.Find("redpoint").GetComponent("XUISprite") as IXUISprite;
IXUILabel ixuilabel = this.m_objVoice.transform.Find("time").GetComponent("XUILabel") as IXUILabel;
IXUIButton ixuibutton = this.m_objVoice.transform.Find("sendFlower").GetComponent("XUIButton") as IXUIButton;
ixuibutton.ID = (ulong)((long)this.mChatInfo.id);
ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(DlgBase<XChatView, XChatBehaviour>.singleton.UIOP.OnSendFlowerClicked));
ixuibutton.SetVisible(!this.mChatInfo.isSelfSender && !DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded());
ixuilabel.SetText((this.mChatInfo.mAudioTime / 1000u + 1u).ToString() + "\"");
string mContent = this.mChatInfo.mContent;
this.m_symContent.InputText = ChatItem.ParsePayComsume(this.mChatInfo, mContent, false);
ixuisprite.ID = (ulong)((long)this.mChatInfo.id);
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(DlgBase<XChatView, XChatBehaviour>.singleton.UIOP.OnStartPlayAudio));
ixuisprite2.SetVisible(!this.mChatInfo.isUIShowed);
this.m_sprBoard.spriteHeight = 56 + this.m_lblContent.spriteHeight;
this.m_sprRoot.spriteHeight = this.m_sprBoard.spriteHeight + 40;
this.m_offset.transform.localPosition = new Vector3(0f, (float)((this.m_sprBoard.spriteHeight - this.boardHeight) / 2 + 30), 0f);
IXUISpriteAnimation ixuispriteAnimation = this.m_objVoice.transform.Find("sign").GetComponent("XUISpriteAnimation") as IXUISpriteAnimation;
ixuispriteAnimation.SetFrameRate(0);
}
private void InitTextUI()
{
this.mChatInfo.mContent = DlgBase<ChatEmotionView, ChatEmotionBehaviour>.singleton.OnParseEmotion(this.mChatInfo.mContent);
XLabelSymbolHelper.RegisterHyperLinkClicks(this.m_symContent);
string mContent = this.mChatInfo.mContent;
this.m_symContent.InputText = ChatItem.ParsePayComsume(this.mChatInfo, mContent, false);
this.m_sprBoard.spriteHeight = ((this.mChatInfo.mChannelId != ChatChannelType.System) ? (20 + this.m_lblContent.spriteHeight) : (10 + this.m_lblContent.spriteHeight));
this.m_sprRoot.spriteHeight = ((this.mChatInfo.mChannelId != ChatChannelType.System) ? (60 + this.m_lblContent.spriteHeight) : (10 + this.m_lblContent.spriteHeight));
this.m_offset.transform.localPosition = new Vector3(0f, (float)((this.m_sprBoard.spriteHeight - this.boardHeight) / 2 + 30), 0f);
}
private void OnClickChatHead(IXUISprite sp)
{
bool flag = !this.mChatInfo.isSelfSender && this.mChatInfo.mSenderId != 0UL && XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.Hall;
if (flag)
{
bool flag2 = this.mChatInfo.mChannelId == ChatChannelType.Broadcast;
if (!flag2)
{
XCharacterCommonMenuDocument.ReqCharacterMenuInfo(this.mChatInfo.mSenderId, false);
}
}
}
public static string ParsePayComsume(ChatInfo info, string txt, bool ismini)
{
bool flag = info != null && info.payConsume != null;
if (flag)
{
string text = string.Empty;
string text2 = string.Empty;
string text3 = XPrerogativeDocument.ConvertTypeToPreContent(PrerogativeType.PreStart, info.payConsume.setid);
string[] array = text3.Split(new char[]
{
'='
});
bool flag2 = !string.IsNullOrEmpty(text3);
if (flag2)
{
text = array[0];
bool flag3 = ismini && array.Length > 1;
if (flag3)
{
text = array[1];
}
}
text2 = XPrerogativeDocument.ConvertTypeToPreContent(PrerogativeType.PreChatAdorn, info.payConsume.setid);
bool flag4 = !string.IsNullOrEmpty(text2);
if (flag4)
{
text2 = XLabelSymbolHelper.FormatImage("Chat/Chat", text2);
}
bool flag5 = !string.IsNullOrEmpty(text2);
if (flag5)
{
txt = text2 + txt + text2;
}
bool flag6 = !string.IsNullOrEmpty(text);
if (flag6)
{
txt = string.Format("[c][{0}]{1}[/c]", text, DlgBase<ChatEmotionView, ChatEmotionBehaviour>.singleton.OnParseEmotion(txt));
}
}
return txt;
}
}
}
|