From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/XChatUIOP.cs | 228 +++++++++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XChatUIOP.cs (limited to 'Client/Assets/Scripts/XMainClient/XChatUIOP.cs') diff --git a/Client/Assets/Scripts/XMainClient/XChatUIOP.cs b/Client/Assets/Scripts/XMainClient/XChatUIOP.cs new file mode 100644 index 00000000..a30e4f1f --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XChatUIOP.cs @@ -0,0 +1,228 @@ +using System; +using System.Collections.Generic; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XChatUIOP : XSingleton + { + private XChatView m_ChatView + { + get + { + return DlgBase.singleton; + } + } + + public Comparison CompareNewMsgCb + { + get + { + bool flag = this.m_CompareNewMsg == null; + if (flag) + { + this.m_CompareNewMsg = new Comparison(this.CompareNewMsg); + } + return this.m_CompareNewMsg; + } + } + + public XChatDocument _doc + { + get + { + return XDocuments.GetSpecificDocument(XChatDocument.uuID); + } + } + + public ChatFriendData CurrChatFriendData + { + get + { + return this._doc.FindFriendData(this.m_ChatView.ChatFriendId); + } + } + + private Comparison m_CompareNewMsg = null; + + private int CompareNewMsg(ChatFriendData a, ChatFriendData b) + { + int num = b.msgtime.CompareTo(a.msgtime); + int num2 = b.isOnline.CompareTo(a.isOnline); + int num3 = b.degreelevel.CompareTo(a.degreelevel); + bool flag = num != 0; + int result; + if (flag) + { + result = num; + } + else + { + bool flag2 = num2 != 0; + if (flag2) + { + result = num2; + } + else + { + bool flag3 = num3 != 0; + if (flag3) + { + result = num3; + } + else + { + result = b.roleid.CompareTo(a.roleid); + } + } + } + return result; + } + + public void RefreshFriendChat(XFriendData friendData, bool refreshUI) + { + ChatFriendData chatFriendData = this._doc.FindFriendData(friendData.roleid); + bool flag = chatFriendData != null; + if (flag) + { + chatFriendData.isfriend = true; + } + else + { + chatFriendData = new ChatFriendData(); + chatFriendData.isfriend = true; + chatFriendData.name = friendData.name; + chatFriendData.powerpoint = friendData.powerpoint; + chatFriendData.profession = friendData.profession; + chatFriendData.roleid = friendData.roleid; + chatFriendData.viplevel = friendData.viplevel; + chatFriendData.online = friendData.online; + chatFriendData.setid = friendData.setid; + chatFriendData.msgtime = this._doc.GetFriendChatInfoTime(chatFriendData.roleid); + this._doc.ChatFriendList.Add(chatFriendData); + } + if (refreshUI) + { + DlgBase.singleton.RefreshFriendUI(); + } + } + + public void RefreshAudioUI(ChatInfo info) + { + bool flag = !this.m_ChatView.IsVisible(); + if (!flag) + { + bool flag2 = info.mUIObject == null; + if (!flag2) + { + Transform transform = info.mUIObject.transform.Find("sign"); + IXUISpriteAnimation ixuispriteAnimation = transform.GetComponent("XUISpriteAnimation") as IXUISpriteAnimation; + ixuispriteAnimation.SetFrameRate(5); + IXUISprite ixuisprite = info.mUIObject.transform.Find("redpoint").GetComponent("XUISprite") as IXUISprite; + info.isUIShowed = true; + ixuisprite.SetVisible(false); + XSingleton.singleton.SetTimer((float)info.AudioIntTime / 1000f, new XTimerMgr.ElapsedEventHandler(this.OnStopSignPlay), ixuispriteAnimation); + } + } + } + + public void RefreshVoiceUI(ChatInfo info) + { + XRadioDocument specificDocument = XDocuments.GetSpecificDocument(XRadioDocument.uuID); + specificDocument.MuteSounds(true); + XSingleton.singleton.InsertAutoPlayList(info, false); + this.RefreshAudioUI(info); + } + + public void OnStopSignPlay(object ob) + { + IXUISpriteAnimation ixuispriteAnimation = (IXUISpriteAnimation)ob; + bool flag = ixuispriteAnimation != null; + if (flag) + { + ixuispriteAnimation.SetFrameRate(0); + ixuispriteAnimation.Reset(); + } + } + + public void OnStartPlayAudio(IXUISprite sp) + { + int id = (int)sp.ID; + ChatInfo chatInfoById = this._doc.GetChatInfoById(id); + bool flag = chatInfoById == null; + if (flag) + { + XSingleton.singleton.AddLog("chatinfo is null ", id.ToString(), null, null, null, null, XDebugColor.XDebug_None); + } + else + { + XSingleton.singleton.ClearPlayList(); + bool isAudioPlayed = chatInfoById.isAudioPlayed; + if (isAudioPlayed) + { + this.RefreshVoiceUI(chatInfoById); + } + else + { + bool flag2 = chatInfoById.mChannelId == ChatChannelType.World || chatInfoById.mChannelId == ChatChannelType.Guild; + if (flag2) + { + List chatInfoList = this._doc.GetChatInfoList(chatInfoById.mChannelId); + List list = new List(); + for (int i = 0; i < chatInfoList.Count; i++) + { + bool flag3 = chatInfoList[i].mTime.CompareTo(chatInfoById.mTime) >= 0 && chatInfoList[i].isAudioChat && !chatInfoList[i].isAudioPlayed; + if (flag3) + { + list.Add(chatInfoList[i]); + } + } + XSingleton.singleton.AutoPlayAudioList = list; + XSingleton.singleton.StartAutoPlay(true, true); + } + else + { + bool flag4 = chatInfoById.mChannelId == ChatChannelType.Friends; + if (flag4) + { + List friendChatInfoList = this._doc.GetFriendChatInfoList(chatInfoById.mSenderId); + List list2 = new List(); + for (int j = 0; j < friendChatInfoList.Count; j++) + { + bool flag5 = friendChatInfoList[j].mTime.CompareTo(chatInfoById.mTime) >= 0 && friendChatInfoList[j].isAudioChat && !friendChatInfoList[j].isAudioPlayed; + if (flag5) + { + list2.Add(friendChatInfoList[j]); + } + } + XSingleton.singleton.AutoPlayAudioList = list2; + XSingleton.singleton.StartAutoPlay(true, true); + } + } + } + } + } + + public bool OnSendFlowerClicked(IXUIButton btn) + { + int id = (int)btn.ID; + ChatInfo chatInfoById = this._doc.GetChatInfoById(id); + bool flag = chatInfoById == null; + bool result; + if (flag) + { + XSingleton.singleton.AddLog("[OnSendFlowerClicked]chatinfo is null, " + id.ToString(), null, null, null, null, null, XDebugColor.XDebug_None); + result = false; + } + else + { + DlgBase.singleton.ShowBoard(chatInfoById.mSenderId, chatInfoById.mSenderName); + result = true; + } + return result; + } + } +} -- cgit v1.1-26-g67d0