diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/XChatDocument.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/XChatDocument.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/XChatDocument.cs | 1462 |
1 files changed, 1462 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/XChatDocument.cs b/Client/Assets/Scripts/XMainClient/XChatDocument.cs new file mode 100644 index 00000000..48d2bb02 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XChatDocument.cs @@ -0,0 +1,1462 @@ +using System;
+using System.Collections.Generic;
+using System.Text;
+using KKSG;
+using UnityEngine;
+using XMainClient.UI;
+using XMainClient.UI.UICommon;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XChatDocument : XDocComponent
+ {
+ public override uint ID
+ {
+ get
+ {
+ return XChatDocument.uuID;
+ }
+ }
+
+ public XChatView ChatView
+ {
+ get
+ {
+ return DlgBase<XChatView, XChatBehaviour>.singleton;
+ }
+ set
+ {
+ this._XChatView = value;
+ }
+ }
+
+ public XChatSmallView ChatSmallView
+ {
+ get
+ {
+ return this._XChatSmallView;
+ }
+ set
+ {
+ this._XChatSmallView = value;
+ }
+ }
+
+ public XChatSettingView ChatSettingView
+ {
+ get
+ {
+ return this._XChatSettingView;
+ }
+ set
+ {
+ this._XChatSettingView = value;
+ }
+ }
+
+ public XChatMaqueeView ChatMaqueeView
+ {
+ get
+ {
+ return this._XChatMaqueeView;
+ }
+ set
+ {
+ this._XChatMaqueeView = value;
+ }
+ }
+
+ public bool onlyDisplayTeamChannel
+ {
+ get
+ {
+ XOptionsDocument specificDocument = XDocuments.GetSpecificDocument<XOptionsDocument>(XOptionsDocument.uuID);
+ bool flag = specificDocument != null;
+ return !flag || specificDocument.GetValue(XOptionsDefine.OD_Shield_NoTeam_Chat) != 0;
+ }
+ }
+
+ public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("XChatDocument");
+
+ private XChatView _XChatView = null;
+
+ private XChatSmallView _XChatSmallView = null;
+
+ private XChatSettingView _XChatSettingView = null;
+
+ private XChatMaqueeView _XChatMaqueeView = null;
+
+ private DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
+
+ public List<ChatFriendData> ChatFriendList = new List<ChatFriendData>();
+
+ //confirm
+ private static Dictionary<ChatChannelType, List<XMainClient.ChatInfo>> m_ChatDic = new Dictionary<ChatChannelType, List<XMainClient.ChatInfo>>();
+
+ private const int CHAT_MEMORY_COUNT = 200;
+
+ //confirm
+ private static List<XMainClient.ChatInfo> m_ChatSmallList = new List<XMainClient.ChatInfo>();
+
+ //confirm
+ private static List<XMainClient.ChatInfo> m_ProcessListSmall = new List<XMainClient.ChatInfo>();
+
+ //confirm
+ public static List<XMainClient.ChatInfo> offlineProcessList = new List<XMainClient.ChatInfo>();
+
+ public List<string> recentSendmsg = new List<string>();
+
+ public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();
+
+ public static byte[] m_ApolloKey = new byte[1024];
+
+ public static int[] m_ApolloIPtable = new int[4];
+
+ public static bool m_ApolloInited = false;
+
+ public static string m_ClientIP = "127.0.0.1";
+
+ public static int CLEAR_ENTER_AUDIO_COUNT = 5;
+
+ public static bool is_delete_audio = true;
+
+ public static bool m_AnswerUseApollo = true;
+
+ public static bool UseApollo = true;
+
+ public int getFlowerLeftTime;
+
+ public bool canGetFlower;
+
+ private string color_r1;
+
+ private string color_r2;
+
+ private string color_g;
+
+ private string color_n;
+
+ private string color_dg;
+
+ private static ChatTable _chatTable = new ChatTable();
+
+ private static ChatOpen _chatOpenTabel = new ChatOpen();
+
+ public static ChatApollo _chatApolloTable = new ChatApollo();
+
+ private static bool[] s_commonIcons = new bool[15];
+
+ private bool firstIn = true;
+
+ private const int MAX_RECNET_COUNT = 10;
+
+ private const int MAX_OFFLINE_COUNT = 10;
+
+ private Dictionary<int, ChatOpen.RowData> openTable = new Dictionary<int, ChatOpen.RowData>();
+
+ private Dictionary<uint, ChatOpen.RowData> sOpenTbale = new Dictionary<uint, ChatOpen.RowData>();
+
+ private XGuildDocument guildDoc;
+
+ private XTeamDocument teamDoc;
+
+ public static void Execute(OnLoadedCallback callback = null)
+ {
+ XChatDocument.AsyncLoader.AddTask("Table/Chat", XChatDocument._chatTable, false);
+ XChatDocument.AsyncLoader.AddTask("Table/ChatOpen", XChatDocument._chatOpenTabel, false);
+ XChatDocument.AsyncLoader.AddTask("Table/ChatApollo", XChatDocument._chatApolloTable, false);
+ XChatDocument.AsyncLoader.Execute(callback);
+ }
+
+ public ChatTable.RowData GetRawData(ChatChannelType type)
+ {
+ int num = XFastEnumIntEqualityComparer<ChatChannelType>.ToInt(type);
+ for (int i = 0; i < XChatDocument._chatTable.Table.Length; i++)
+ {
+ bool flag = (ulong)XChatDocument._chatTable.Table[i].id == (ulong)((long)num);
+ if (flag)
+ {
+ return XChatDocument._chatTable.Table[i];
+ }
+ }
+ return XChatDocument._chatTable.Table[0];
+ }
+
+ public ChatApollo.RowData GetApollo(int speak, int music, int click)
+ {
+ int num = 100 * speak + 10 * music + click;
+ for (int i = 0; i < XChatDocument._chatApolloTable.Table.Length; i++)
+ {
+ ChatApollo.RowData rowData = XChatDocument._chatApolloTable.Table[i];
+ int num2 = 100 * rowData.speak + 10 * rowData.music + rowData.click;
+ bool flag = num2 == num;
+ if (flag)
+ {
+ return rowData;
+ }
+ }
+ return null;
+ }
+
+ protected override void EventSubscribe()
+ {
+ base.EventSubscribe();
+ }
+
+ public override void OnEnterSceneFinally()
+ {
+ base.OnEnterSceneFinally();
+ DlgBase<XChatView, XChatBehaviour>.singleton.cacheShow = false;
+ bool flag = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.Hall;
+ if (flag)
+ {
+ XSingleton<XChatIFlyMgr>.singleton.EnableAutoPlay(true);
+ }
+ bool flag2 = this.recentSendmsg.Count <= 0;
+ if (flag2)
+ {
+ this.recentSendmsg = XSingleton<XGlobalConfig>.singleton.GetStringList("ChatArray");
+ }
+ bool flag3 = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.Hall;
+ if (flag3)
+ {
+ bool flag4 = !XChatDocument.m_ApolloInited;
+ if (flag4)
+ {
+ RpcC2G_QueryClientIp rpc = new RpcC2G_QueryClientIp();
+ XSingleton<XClientNetwork>.singleton.Send(rpc);
+ }
+ DlgBase<ReplaykitDlg, ReplayBehaviour>.singleton.CheckShow();
+ XChatDocument.m_AnswerUseApollo = (int.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("UseApollo")) == 1);
+ DlgBase<XChatMaqueeView, XChatMaqueeBehaviour>.singleton.SetMaqueeSwitch(true);
+ }
+ }
+
+ public override void OnGamePause(bool pause)
+ {
+ base.OnGamePause(pause);
+ DlgBase<BarrageDlg, BarrageBehaviour>.singleton.OnFouceGame(pause);
+ bool flag = !pause;
+ if (flag)
+ {
+ DlgBase<ReplaykitDlg, ReplayBehaviour>.singleton.ResumeReplay();
+ }
+ DlgBase<WebView, WebViewBehaviour>.singleton.OnScreenLock(pause);
+ }
+
+ public override void OnLeaveScene()
+ {
+ base.OnLeaveScene();
+ bool flag = DlgBase<XChatView, XChatBehaviour>.singleton.IsVisible();
+ if (flag)
+ {
+ DlgBase<XChatView, XChatBehaviour>.singleton.SetVisibleWithAnimation(false, null);
+ }
+ XSingleton<XChatIFlyMgr>.singleton.OnCloseWebView();
+ }
+
+ protected override void OnReconnected(XReconnectedEventArgs arg)
+ {
+ }
+
+ public override void PostUpdate(float fDeltaT)
+ {
+ bool flag = this.ChatMaqueeView != null;
+ if (flag)
+ {
+ this.ChatMaqueeView.UpdateMaquee(fDeltaT);
+ }
+ }
+
+ public override void Update(float fDeltaT)
+ {
+ bool flag = XChatDocument.m_ProcessListSmall.Count > 0;
+ if (flag)
+ {
+ for (int i = 0; i < XChatDocument.m_ProcessListSmall.Count; i++)
+ {
+ this.AddSmallChatInfo(XChatDocument.m_ProcessListSmall[i]);
+ }
+ DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.OnReceieveChatInfos(XChatDocument.m_ProcessListSmall);
+ XChatDocument.m_ProcessListSmall.Clear();
+ }
+ }
+
+ private void HanderSereverChatinfo(KKSG.ChatInfo info)
+ {
+ bool flag = info == null;
+ if (!flag)
+ {
+ bool flag2 = info.source != null;
+ if (flag2)
+ {
+ bool flag3 = !DlgBase<XFriendsView, XFriendsBehaviour>.singleton.IsBlock(info.source.roleid);
+ if (flag3)
+ {
+ this.HandlerReceiveChatInfo(info);
+ }
+ }
+ else
+ {
+ bool flag4 = info != null && XSingleton<XAttributeMgr>.singleton.XPlayerData != null && info.level <= XSingleton<XAttributeMgr>.singleton.XPlayerData.Level;
+ if (flag4)
+ {
+ this.HandlerReceiveChatInfo(info);
+ }
+ }
+ }
+ }
+
+ public override void OnAttachToHost(XObject host)
+ {
+ base.OnAttachToHost(host);
+ int @int = XSingleton<XGlobalConfig>.singleton.GetInt("BroadcastOpen");
+ PlayerPrefs.SetInt("BroadcastOpen", @int);
+ XChatDocument.is_delete_audio = (int.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("IsDeleteAudio")) == 1);
+ this.color_r1 = XSingleton<XGlobalConfig>.singleton.GetValue("Chat_R1");
+ this.color_r2 = XSingleton<XGlobalConfig>.singleton.GetValue("Chat_R2");
+ this.color_g = XSingleton<XGlobalConfig>.singleton.GetValue("Chat_G");
+ this.color_n = XSingleton<XGlobalConfig>.singleton.GetValue("Chat_N");
+ this.color_dg = XSingleton<XGlobalConfig>.singleton.GetValue("Chat_DG");
+ }
+
+ public override void OnDetachFromHost()
+ {
+ this.OnClearAllData();
+ this.firstIn = true;
+ DlgBase<BroadMiniDlg, BroadcastMiniBehaviour>.singleton.StopBroad();
+ DlgBase<ReplaykitDlg, ReplayBehaviour>.singleton.OnStopClick(null);
+ }
+
+ public void SendOfflineMsg()
+ {
+ bool flag = this.firstIn;
+ if (flag)
+ {
+ this.ClearAllData();
+ PtcC2M_LoadOfflineChatNtf ptcC2M_LoadOfflineChatNtf = new PtcC2M_LoadOfflineChatNtf();
+ ptcC2M_LoadOfflineChatNtf.Data.roleID = XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
+ XSingleton<XClientNetwork>.singleton.Send(ptcC2M_LoadOfflineChatNtf);
+ this.firstIn = false;
+ }
+ }
+
+ public void ClearRoleMsg(ulong roleid)
+ {
+ List<XMainClient.ChatInfo> list;
+ XChatDocument.m_ChatDic.TryGetValue(ChatChannelType.World, out list);
+ List<XMainClient.ChatInfo> list2;
+ XChatDocument.m_ChatDic.TryGetValue(ChatChannelType.Guild, out list2);
+ List<XMainClient.ChatInfo> list3;
+ XChatDocument.m_ChatDic.TryGetValue(ChatChannelType.Team, out list3);
+ List<XMainClient.ChatInfo> list4;
+ XChatDocument.m_ChatDic.TryGetValue(ChatChannelType.Spectate, out list4);
+ List<XMainClient.ChatInfo> list5;
+ XChatDocument.m_ChatDic.TryGetValue(ChatChannelType.Friends, out list5);
+ bool flag = list != null;
+ if (flag)
+ {
+ this.RemveRoleMsg(roleid, list);
+ }
+ bool flag2 = list2 != null;
+ if (flag2)
+ {
+ this.RemveRoleMsg(roleid, list2);
+ }
+ bool flag3 = list3 != null;
+ if (flag3)
+ {
+ this.RemveRoleMsg(roleid, list3);
+ }
+ bool flag4 = list4 != null;
+ if (flag4)
+ {
+ this.RemveRoleMsg(roleid, list4);
+ }
+ bool flag5 = list5 != null;
+ if (flag5)
+ {
+ this.RemveRoleMsg(roleid, list5);
+ }
+ bool flag6 = XChatDocument.offlineProcessList != null;
+ if (flag6)
+ {
+ this.RemveRoleMsg(roleid, XChatDocument.offlineProcessList);
+ }
+ bool flag7 = XChatDocument.m_ChatSmallList != null;
+ if (flag7)
+ {
+ this.RemveRoleMsg(roleid, XChatDocument.m_ChatSmallList);
+ }
+ bool flag8 = XChatDocument.m_ProcessListSmall != null;
+ if (flag8)
+ {
+ this.RemveRoleMsg(roleid, XChatDocument.m_ProcessListSmall);
+ }
+ this.ChatView.RefreshLoopScroll(this.ChatView.activeChannelType);
+ bool flag9 = this.ChatSmallView.IsVisible();
+ if (flag9)
+ {
+ this.ChatSmallView.ShowCacheMsg();
+ }
+ }
+
+ private void RemveRoleMsg(ulong roleid, List<XMainClient.ChatInfo> list)
+ {
+ bool flag = list != null;
+ if (flag)
+ {
+ for (int i = list.Count - 1; i >= 0; i--)
+ {
+ bool flag2 = list[i].mSenderId == roleid;
+ if (flag2)
+ {
+ list.RemoveAt(i);
+ }
+ }
+ }
+ }
+
+ public void ReceiveOfflineMsg(PtcM2C_MCChatOffLineNotify roPtc)
+ {
+ DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.CacheMsg();
+ List<KKSG.ChatInfo> list = new List<KKSG.ChatInfo>();
+ bool flag = !DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.IsInited;
+ if (flag)
+ {
+ for (int i = 0; i < roPtc.Data.rolechat.Count; i++)
+ {
+ list.Add(roPtc.Data.rolechat[i]);
+ }
+ for (int j = 0; j < roPtc.Data.guildchat.Count; j++)
+ {
+ list.Add(roPtc.Data.guildchat[j]);
+ }
+ for (int k = 0; k < roPtc.Data.teamchat.Count; k++)
+ {
+ list.Add(roPtc.Data.teamchat[k]);
+ }
+ for (int l = 0; l < roPtc.Data.worldchat.Count; l++)
+ {
+ list.Add(roPtc.Data.worldchat[l]);
+ }
+ for (int m = 0; m < roPtc.Data.partnerchat.Count; m++)
+ {
+ list.Add(roPtc.Data.partnerchat[m]);
+ }
+ for (int n = 0; n < roPtc.Data.groupchat.Count; n++)
+ {
+ list.Add(roPtc.Data.groupchat[n]);
+ }
+ list.Sort(new Comparison<KKSG.ChatInfo>(this.SortOfflineData));
+ for (int num = 0; num < list.Count; num++)
+ {
+ this.HanderSereverChatinfo(list[num]);
+ }
+ this.HandlerOfflineFriend(roPtc.Data.privatechatlist);
+ }
+ }
+
+ private int SortOfflineData(KKSG.ChatInfo x, KKSG.ChatInfo y)
+ {
+ return x.time.CompareTo(y.time);
+ }
+
+ public void OnReceiveChatInfo(KKSG.ChatInfo info)
+ {
+ this.HanderSereverChatinfo(info);
+ }
+
+ private ChatFriendData Chatinfo2FriendData(ChatSource friend, uint time)
+ {
+ return new ChatFriendData
+ {
+ isfriend = DlgBase<XFriendsView, XFriendsBehaviour>.singleton.IsMyFriend(friend.roleid),
+ name = friend.name,
+ powerpoint = friend.powerpoint,
+ profession = friend.profession,
+ viplevel = friend.viplevel,
+ roleid = friend.roleid,
+ setid = ((friend.pre != null) ? friend.pre.setid : new List<uint>()),
+ msgtime = this.startTime.AddSeconds(time)
+ };
+ }
+
+ private void HandlerOfflineFriend(PrivateChatList friends)
+ {
+ bool flag = friends != null && friends.rolelist != null;
+ if (flag)
+ {
+ for (int i = 0; i < friends.rolelist.Count; i++)
+ {
+ ChatFriendData chatFriendData = new ChatFriendData();
+ XPlayerAttributes xplayerData = XSingleton<XAttributeMgr>.singleton.XPlayerData;
+ bool flag2 = friends.rolelist[i] != null && xplayerData != null && friends.rolelist[i].roleid != xplayerData.RoleID;
+ if (flag2)
+ {
+ chatFriendData = this.Chatinfo2FriendData(friends.rolelist[i], friends.lastChatTime[i]);
+ chatFriendData.hasOfflineRead = friends.hasOfflineChat[i];
+ this.ChatFriendList.Add(chatFriendData);
+ }
+ }
+ }
+ this.RemoveBlockFriends();
+ }
+
+ public void SetFriendRelation(ulong uid, bool isfriend)
+ {
+ for (int i = 0; i < this.ChatFriendList.Count; i++)
+ {
+ bool flag = this.ChatFriendList[i].roleid == uid;
+ if (flag)
+ {
+ this.ChatFriendList[i].isfriend = isfriend;
+ break;
+ }
+ }
+ }
+
+ public void OnReceiveChatSmallInfo(XMainClient.ChatInfo info)
+ {
+ bool flag = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.World && this.onlyDisplayTeamChannel && info.mChannelId != ChatChannelType.Team && info.mChannelId != ChatChannelType.Curr && info.mChannelId != ChatChannelType.Battle;
+ if (!flag)
+ {
+ XChatDocument.m_ProcessListSmall.Add(info);
+ }
+ }
+
+ private void CacheRecentSendmsg(string str)
+ {
+ bool flag = !this.recentSendmsg.Contains(str);
+ if (flag)
+ {
+ bool flag2 = this.recentSendmsg.Count > 10;
+ if (flag2)
+ {
+ this.recentSendmsg.RemoveAt(0);
+ }
+ this.recentSendmsg.Add(str);
+ }
+ }
+
+ private void CacheRecentChatinfo(XMainClient.ChatInfo info)
+ {
+ bool flag = XChatDocument.offlineProcessList.Count > 10;
+ if (flag)
+ {
+ XChatDocument.offlineProcessList.RemoveRange(0, XChatDocument.offlineProcessList.Count - 10);
+ }
+ XChatDocument.offlineProcessList.Add(info);
+ }
+
+ public bool OnJoinTeam(XEventArgs args)
+ {
+ return true;
+ }
+
+ public bool OnLeaveTeam(XEventArgs args)
+ {
+ return true;
+ }
+
+ public ChatFriendData FindFriendData(ulong uid)
+ {
+ for (int i = 0; i < this.ChatFriendList.Count; i++)
+ {
+ bool flag = this.ChatFriendList[i].roleid == uid;
+ if (flag)
+ {
+ return this.ChatFriendList[i];
+ }
+ }
+ return null;
+ }
+
+ public void RemoveBlockFriends()
+ {
+ for (int i = this.ChatFriendList.Count - 1; i >= 0; i--)
+ {
+ ChatFriendData chatFriendData = this.ChatFriendList[i];
+ bool flag = DlgBase<XFriendsView, XFriendsBehaviour>.singleton.IsBlock(chatFriendData.roleid);
+ if (flag)
+ {
+ this.ChatFriendList.RemoveAt(i);
+ }
+ }
+ }
+
+ public void RemoveFriend(ulong uid)
+ {
+ this.SetFriendRelation(uid, false);
+ }
+
+ public void RemoveStranger(ulong uid)
+ {
+ this.SetFriendRelation(uid, true);
+ }
+
+ public void AddStranger(ulong uid)
+ {
+ this.SetFriendRelation(uid, false);
+ }
+
+ public List<XMainClient.ChatInfo> GetChatInfoList(ChatChannelType channelType)
+ {
+ List<XMainClient.ChatInfo> result = null;
+ XChatDocument.m_ChatDic.TryGetValue(channelType, out result);
+ return result;
+ }
+
+ public DateTime GetFriendChatInfoTime(ulong uid)
+ {
+ DateTime dateTime = DateTime.Today;
+ List<XMainClient.ChatInfo> friendChatInfoList = this.GetFriendChatInfoList(uid);
+ for (int i = 0; i < friendChatInfoList.Count; i++)
+ {
+ bool flag = friendChatInfoList[i].mTime.CompareTo(dateTime) > 0;
+ if (flag)
+ {
+ dateTime = friendChatInfoList[i].mTime;
+ }
+ }
+ return dateTime;
+ }
+
+ public List<XMainClient.ChatInfo> GetFriendChatInfoList(ulong uid)
+ {
+ List<XMainClient.ChatInfo> list = null;
+ List<XMainClient.ChatInfo> list2 = new List<XMainClient.ChatInfo>();
+ XChatDocument.m_ChatDic.TryGetValue(ChatChannelType.Friends, out list);
+ bool flag = list != null;
+ if (flag)
+ {
+ for (int i = 0; i < list.Count; i++)
+ {
+ XPlayerAttributes xplayerData = XSingleton<XAttributeMgr>.singleton.XPlayerData;
+ bool flag2 = xplayerData != null;
+ if (flag2)
+ {
+ bool flag3 = list[i].mSenderId == xplayerData.RoleID && list[i].mReceiverId == uid;
+ bool flag4 = list[i].mReceiverId == xplayerData.RoleID && list[i].mSenderId == uid;
+ bool flag5 = flag4 || flag3;
+ if (flag5)
+ {
+ list2.Add(list[i]);
+ }
+ }
+ }
+ }
+ return list2;
+ }
+
+ public List<XMainClient.ChatInfo> GetGroupChatInfoList(ulong groupid)
+ {
+ List<XMainClient.ChatInfo> list = null;
+ List<XMainClient.ChatInfo> list2 = new List<XMainClient.ChatInfo>();
+ XChatDocument.m_ChatDic.TryGetValue(ChatChannelType.Group, out list);
+ bool flag = list != null;
+ if (flag)
+ {
+ int i = 0;
+ int count = list.Count;
+ while (i < count)
+ {
+ bool flag2 = list[i].group != null && list[i].group.groupchatID == groupid;
+ if (flag2)
+ {
+ list2.Add(list[i]);
+ }
+ i++;
+ }
+ }
+ return list2;
+ }
+
+ public XMainClient.ChatInfo GetChatInfoById(int id)
+ {
+ List<XMainClient.ChatInfo> list = null;
+ for (ChatChannelType chatChannelType = ChatChannelType.World; chatChannelType <= ChatChannelType.ChannelNum; chatChannelType++)
+ {
+ XChatDocument.m_ChatDic.TryGetValue(chatChannelType, out list);
+ bool flag = list != null;
+ if (flag)
+ {
+ for (int i = 0; i < list.Count; i++)
+ {
+ bool flag2 = list[i].id == id;
+ if (flag2)
+ {
+ return list[i];
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private string ReplaceRoleName(string name)
+ {
+ bool flag = name.Length > 3;
+ if (flag)
+ {
+ name = name.Remove(name.Length - 2, 2);
+ name = name.Insert(name.Length, "**");
+ }
+ else
+ {
+ bool flag2 = name.Length == 3;
+ if (flag2)
+ {
+ name = name.Remove(name.Length - 1, 1);
+ name = name.Insert(name.Length, "*");
+ }
+ }
+ return name;
+ }
+
+ public string ProcessText(KKSG.ChatInfo serverChatInfo)
+ {
+ int num = 0;
+ int num2 = XFastEnumIntEqualityComparer<ChatChannelType>.ToInt(ChatChannelType.System);
+ int num3 = XFastEnumIntEqualityComparer<ChatChannelType>.ToInt(ChatChannelType.System);
+ for (int i = 0; i < serverChatInfo.param.Count; i++)
+ {
+ ChatParam chatParam = serverChatInfo.param[i];
+ bool flag = chatParam == null;
+ if (!flag)
+ {
+ for (int j = 0; j < serverChatInfo.info.Length; j++)
+ {
+ bool flag2 = serverChatInfo.info[j] == '$' && serverChatInfo.info.Length >= j + 2;
+ if (flag2)
+ {
+ string text = "";
+ bool flag3 = chatParam.role != null && serverChatInfo.info[j + 1] == 'R';
+ if (flag3)
+ {
+ string name = chatParam.role.name;
+ bool flag4 = (long)XFastEnumIntEqualityComparer<ChatChannelType>.ToInt(ChatChannelType.System) == (long)((ulong)serverChatInfo.channel);
+ if (flag4)
+ {
+ text = name;
+ }
+ else
+ {
+ bool flag5 = chatParam.role.uniqueid == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
+ if (flag5)
+ {
+ text = this.color_r1 + name + "[-]";
+ }
+ else
+ {
+ text = this.color_r2 + name + "[-]";
+ }
+ }
+ num = (int)(chatParam.role.profession % 10u - 1u);
+ }
+ else
+ {
+ bool flag6 = chatParam.item != null && serverChatInfo.info[j + 1] == 'I';
+ if (flag6)
+ {
+ ItemList.RowData itemConf = XBagDocument.GetItemConf((int)chatParam.item.item.itemID);
+ bool flag7 = itemConf == null;
+ if (flag7)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog("itemid: ", chatParam.item.item.itemID.ToString(), " content:", serverChatInfo.info, null, null);
+ }
+ else
+ {
+ bool flag8 = (long)XFastEnumIntEqualityComparer<ChatChannelType>.ToInt(ChatChannelType.System) == (long)((ulong)serverChatInfo.channel);
+ if (flag8)
+ {
+ bool flag9 = itemConf != null;
+ if (flag9)
+ {
+ bool flag10 = XBagDocument.GetItemConf((int)chatParam.item.item.itemID).ItemName.Length > num;
+ if (flag10)
+ {
+ text = chatParam.item.item.itemCount.ToString() + itemConf.NumberName + itemConf.ItemName[num];
+ }
+ else
+ {
+ text = chatParam.item.item.itemCount.ToString() + itemConf.NumberName + itemConf.ItemName[0];
+ }
+ }
+ }
+ else
+ {
+ int itemQuality = (int)XBagDocument.GetItemConf((int)chatParam.item.item.itemID).ItemQuality;
+ string itemQualityColorStr = XSingleton<UiUtility>.singleton.GetItemQualityColorStr(itemQuality);
+ bool flag11 = itemConf != null;
+ if (flag11)
+ {
+ bool flag12 = XBagDocument.GetItemConf((int)chatParam.item.item.itemID).ItemName.Length > 1;
+ if (flag12)
+ {
+ text = string.Concat(new string[]
+ {
+ "[",
+ itemQualityColorStr,
+ "]",
+ chatParam.item.item.itemCount.ToString(),
+ itemConf.NumberName,
+ itemConf.ItemName[num],
+ "[-]"
+ });
+ }
+ else
+ {
+ text = string.Concat(new string[]
+ {
+ "[",
+ itemQualityColorStr,
+ "]",
+ chatParam.item.item.itemCount.ToString(),
+ itemConf.NumberName,
+ itemConf.ItemName[0],
+ "[-]"
+ });
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ bool flag13 = chatParam.num != null && serverChatInfo.info[j + 1] == 'N';
+ if (flag13)
+ {
+ bool flag14 = (long)XFastEnumIntEqualityComparer<ChatChannelType>.ToInt(ChatChannelType.System) == (long)((ulong)serverChatInfo.channel);
+ if (flag14)
+ {
+ text = chatParam.num.num.ToString();
+ }
+ else
+ {
+ text = this.color_n + chatParam.num.num.ToString() + "[-]";
+ }
+ }
+ else
+ {
+ bool flag15 = chatParam.team != null && serverChatInfo.info[j + 1] == 'T';
+ if (flag15)
+ {
+ text = XLabelSymbolHelper.FormatTeam(chatParam.team.teamname, (int)chatParam.team.teamid, chatParam.team.expeditionid);
+ }
+ else
+ {
+ bool flag16 = chatParam.guild != null && serverChatInfo.info[j + 1] == 'G';
+ if (flag16)
+ {
+ text = this.color_g + chatParam.guild.guildname.ToString() + "[-]";
+ }
+ else
+ {
+ bool flag17 = chatParam.link != null && serverChatInfo.info[j + 1] == 'L';
+ if (flag17)
+ {
+ XInvitationDocument specificDocument = XDocuments.GetSpecificDocument<XInvitationDocument>(XInvitationDocument.uuID);
+ text = specificDocument.ParseLink(chatParam);
+ }
+ else
+ {
+ bool flag18 = chatParam.dragonguild != null && serverChatInfo.info[j + 1] == 'D';
+ if (flag18)
+ {
+ text = this.color_dg + chatParam.dragonguild.dragonguildname.ToString() + "[-]";
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ string value = serverChatInfo.info.Substring(0, j);
+ string value2 = serverChatInfo.info.Substring(j + 2, serverChatInfo.info.Length - (j + 2));
+ text = text.Replace("$", "%^&%");
+ StringBuilder stringBuilder = new StringBuilder();
+ stringBuilder.Append(value);
+ stringBuilder.Append(text);
+ stringBuilder.Append(value2);
+ serverChatInfo.info = stringBuilder.ToString();
+ break;
+ }
+ }
+ }
+ }
+ return serverChatInfo.info.Replace("%^&%", "$");
+ }
+
+ private ulong GetFriendID(XMainClient.ChatInfo chatInfo)
+ {
+ XPlayerAttributes xplayerData = XSingleton<XAttributeMgr>.singleton.XPlayerData;
+ bool flag = xplayerData != null && chatInfo != null;
+ ulong result;
+ if (flag)
+ {
+ result = ((chatInfo.mSenderId != xplayerData.RoleID) ? chatInfo.mSenderId : chatInfo.mReceiverId);
+ }
+ else
+ {
+ result = 0UL;
+ }
+ return result;
+ }
+
+ public void RefreshSelfMemberPriviligeInfo(uint payMemberID)
+ {
+ List<ChatChannelType> list = new List<ChatChannelType>
+ {
+ ChatChannelType.World,
+ ChatChannelType.Guild,
+ ChatChannelType.Curr,
+ ChatChannelType.Team
+ };
+ for (int i = 0; i < list.Count; i++)
+ {
+ List<XMainClient.ChatInfo> list2 = null;
+ XChatDocument.m_ChatDic.TryGetValue(list[i], out list2);
+ bool flag = list2 != null;
+ if (flag)
+ {
+ for (int j = 0; j < list2.Count; j++)
+ {
+ bool isSelfSender = list2[j].isSelfSender;
+ if (isSelfSender)
+ {
+ list2[j].mSenderPaymemberid = payMemberID;
+ }
+ }
+ this.ChatView.RefreshLoopScroll(list[i]);
+ }
+ }
+ }
+
+ public List<XMainClient.ChatInfo> AddChatInfo(XMainClient.ChatInfo chatInfo, ChatChannelType channelId)
+ {
+ List<XMainClient.ChatInfo> list = null;
+ XChatDocument.m_ChatDic.TryGetValue(channelId, out list);
+ bool flag = list == null;
+ if (flag)
+ {
+ list = new List<XMainClient.ChatInfo>();
+ list.Add(chatInfo);
+ XChatDocument.m_ChatDic.Add(channelId, list);
+ }
+ else
+ {
+ bool flag2 = list.Count > 200;
+ if (flag2)
+ {
+ list.RemoveAt(0);
+ }
+ list.Add(chatInfo);
+ }
+ bool flag3 = channelId == ChatChannelType.Friends;
+ if (flag3)
+ {
+ ulong friendID = this.GetFriendID(chatInfo);
+ ChatFriendData chatFriendData = this.FindFriendData(friendID);
+ bool flag4 = chatFriendData == null && DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.IsInited;
+ if (flag4)
+ {
+ this.AddChatinfo2FriendList(chatInfo);
+ }
+ bool flag5 = chatFriendData != null;
+ if (flag5)
+ {
+ chatFriendData.msgtime = DateTime.Now;
+ }
+ list = this.GetFriendChatInfoList(this.ChatView.ChatFriendId);
+ }
+ else
+ {
+ bool flag6 = channelId == ChatChannelType.Group;
+ if (flag6)
+ {
+ GroupChatDocument specificDocument = XDocuments.GetSpecificDocument<GroupChatDocument>(GroupChatDocument.uuID);
+ specificDocument.AddChat2Group(chatInfo);
+ }
+ }
+ return list;
+ }
+
+ public void AddChatinfo2FriendList(XMainClient.ChatInfo info)
+ {
+ ChatFriendData chatFriendData = new ChatFriendData();
+ chatFriendData.msgtime = info.mTime;
+ bool flag = !info.isSelfSender;
+ if (flag)
+ {
+ chatFriendData.name = info.mSenderName;
+ chatFriendData.roleid = info.mSenderId;
+ chatFriendData.powerpoint = info.mSenderPowerPoint;
+ chatFriendData.profession = info.mServerProfession;
+ chatFriendData.viplevel = info.mSenderVip;
+ chatFriendData.setid = ((info.payConsume != null) ? info.payConsume.setid : new List<uint>());
+ bool flag2 = info.payConsume != null;
+ if (flag2)
+ {
+ chatFriendData.setid = info.payConsume.setid;
+ }
+ chatFriendData.isfriend = DlgBase<XFriendsView, XFriendsBehaviour>.singleton.IsMyFriend(info.mSenderId);
+ }
+ else
+ {
+ chatFriendData.name = info.mReceiverName;
+ chatFriendData.roleid = info.mReceiverId;
+ chatFriendData.powerpoint = info.mReciverPowerPoint;
+ chatFriendData.profession = info.mRecieverProfession;
+ chatFriendData.viplevel = info.mReceiverVip;
+ chatFriendData.isfriend = DlgBase<XFriendsView, XFriendsBehaviour>.singleton.IsMyFriend(info.mReceiverId);
+ }
+ bool flag3 = !this.ContainRole(chatFriendData.roleid);
+ if (flag3)
+ {
+ this.ChatFriendList.Add(chatFriendData);
+ }
+ }
+
+ private bool ContainRole(ulong roleID)
+ {
+ for (int i = 0; i < this.ChatFriendList.Count; i++)
+ {
+ bool flag = this.ChatFriendList[i].roleid == roleID;
+ if (flag)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void HandlerMaqueeInfo(KKSG.ChatInfo serverChatInfo)
+ {
+ for (int i = 0; i < serverChatInfo.param.Count; i++)
+ {
+ ChatParam chatParam = serverChatInfo.param[i];
+ bool flag = chatParam == null;
+ if (!flag)
+ {
+ for (int j = 0; j < serverChatInfo.info.Length; j++)
+ {
+ bool flag2 = serverChatInfo.info[j] == '$' && serverChatInfo.info.Length >= j + 2;
+ if (flag2)
+ {
+ bool flag3 = chatParam.role != null && serverChatInfo.info[j + 1] == 'R';
+ if (flag3)
+ {
+ chatParam.role.name = this.ReplaceRoleName(chatParam.role.name);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public void HandlerReceiveChatInfo(KKSG.ChatInfo serverChatInfo)
+ {
+ bool flag = serverChatInfo.info == null || serverChatInfo.info == "" || XSingleton<XAttributeMgr>.singleton.XPlayerData == null;
+ if (!flag)
+ {
+ string info = serverChatInfo.info;
+ bool flag2 = serverChatInfo.channel == 5u || serverChatInfo.channel == 6u;
+ if (flag2)
+ {
+ this.HandlerMaqueeInfo(serverChatInfo);
+ serverChatInfo.info = this.ProcessText(serverChatInfo);
+ DlgBase<XChatMaqueeView, XChatMaqueeBehaviour>.singleton.ReceiveChatInfo(serverChatInfo);
+ serverChatInfo.channel = (uint)XFastEnumIntEqualityComparer<ChatChannelType>.ToInt(ChatChannelType.System);
+ serverChatInfo.info = info;
+ }
+ serverChatInfo.info = this.ProcessText(serverChatInfo);
+ XMainClient.ChatInfo chatInfo = new XMainClient.ChatInfo();
+ chatInfo.mTime = this.startTime.AddSeconds(serverChatInfo.time);
+ chatInfo.mAudioId = serverChatInfo.audioUid;
+ chatInfo.mAudioTime = serverChatInfo.audioLen;
+ chatInfo.voice = chatInfo.GetVoice(serverChatInfo.audioUid, serverChatInfo.audioLen);
+ chatInfo.mRegression = false;
+ chatInfo.CampDuelID = 0u;
+ chatInfo.isAudioPlayed = !DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.IsInited;
+ chatInfo.isUIShowed = !DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.IsInited;
+ bool flag3 = serverChatInfo.source != null;
+ if (flag3)
+ {
+ chatInfo.mSenderName = serverChatInfo.source.name.TrimEnd(new char[0]);
+ chatInfo.mSenderId = serverChatInfo.source.roleid;
+ chatInfo.mSenderVip = serverChatInfo.source.viplevel;
+ chatInfo.mSenderPaymemberid = serverChatInfo.source.paymemberid;
+ chatInfo.mServerProfession = serverChatInfo.source.profession;
+ chatInfo.mSenderPowerPoint = serverChatInfo.source.powerpoint;
+ chatInfo.mCoverDesignationID = serverChatInfo.source.coverDesignationID;
+ chatInfo.mSpecialDesignation = serverChatInfo.source.desname;
+ chatInfo.militaryRank = serverChatInfo.source.military_rank;
+ chatInfo.payConsume = serverChatInfo.source.pre;
+ chatInfo.mHeroID = serverChatInfo.source.heroid;
+ chatInfo.group = serverChatInfo.groupchatinfo;
+ chatInfo.mRegression = serverChatInfo.source.isBackFlow;
+ chatInfo.CampDuelID = serverChatInfo.source.campDuelID;
+ }
+ else
+ {
+ bool flag4 = serverChatInfo.channel == 7u && this.CheckTeam();
+ if (flag4)
+ {
+ chatInfo.mSenderId = 0UL;
+ chatInfo.mSenderName = XStringDefineProxy.GetString("CHAT_TEAM_NEW");
+ chatInfo.mSenderVip = 1u;
+ chatInfo.mSenderPaymemberid = 0u;
+ }
+ else
+ {
+ bool flag5 = serverChatInfo.channel == 2u && this.CheckGuild();
+ if (flag5)
+ {
+ chatInfo.mSenderId = 0UL;
+ chatInfo.mSenderName = XStringDefineProxy.GetString("CHAT_GUILD_NEW");
+ chatInfo.mSenderVip = 1u;
+ chatInfo.mSenderPaymemberid = 0u;
+ }
+ }
+ }
+ bool flag6 = serverChatInfo.destList != null && serverChatInfo.destList.Count > 0;
+ if (flag6)
+ {
+ chatInfo.mReceiverId = serverChatInfo.destList[0].roleid;
+ chatInfo.mReceiverName = serverChatInfo.destList[0].name;
+ chatInfo.mReceiverVip = serverChatInfo.destList[0].viplevel;
+ chatInfo.mRecieverProfession = serverChatInfo.destList[0].profession;
+ chatInfo.mReciverPowerPoint = serverChatInfo.destList[0].powerpoint;
+ }
+ else
+ {
+ bool flag7 = serverChatInfo.dest != null && serverChatInfo.dest.roleid.Count > 0;
+ if (flag7)
+ {
+ chatInfo.mReceiverId = serverChatInfo.dest.roleid[0];
+ }
+ }
+ chatInfo.mContent = serverChatInfo.info;
+ chatInfo.mChannelId = (ChatChannelType)serverChatInfo.channel;
+ bool flag8 = chatInfo.mSenderId == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
+ if (flag8)
+ {
+ chatInfo.isSelfSender = true;
+ chatInfo.mChatType = (chatInfo.isAudioChat ? ChatType.SelfVoice : ChatType.SelfText);
+ }
+ else
+ {
+ chatInfo.isSelfSender = false;
+ chatInfo.mChatType = (chatInfo.isAudioChat ? ChatType.OtherVoice : ChatType.OtherText);
+ }
+ this.ReceiveChatInfo(chatInfo);
+ }
+ }
+
+ public void ReceiveChatInfo(XMainClient.ChatInfo chatInfo)
+ {
+ bool flag = chatInfo.isAudioChat && !chatInfo.isAudioPlayed;
+ if (flag)
+ {
+ bool isSelfSender = chatInfo.isSelfSender;
+ if (isSelfSender)
+ {
+ XSingleton<XChatIFlyMgr>.singleton.StopAutoPlay();
+ XSingleton<XChatIFlyMgr>.singleton.InsertAutoPlayList(chatInfo, true);
+ return;
+ }
+ bool isAutoPlayEnable = XSingleton<XChatIFlyMgr>.singleton.IsAutoPlayEnable;
+ if (isAutoPlayEnable)
+ {
+ bool flag2 = XSingleton<XChatIFlyMgr>.singleton.AddAutoPlayList(chatInfo);
+ bool flag3 = !flag2;
+ if (!flag3)
+ {
+ return;
+ }
+ chatInfo.isAudioPlayed = true;
+ }
+ chatInfo.isAudioPlayed = true;
+ }
+ bool isInited = DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.IsInited;
+ if (isInited)
+ {
+ this.OnReceiveChatSmallInfo(chatInfo);
+ bool flag4 = chatInfo.isSelfSender && !chatInfo.isAudioChat && !chatInfo.mContent.Contains("tm=") && !chatInfo.mContent.Contains("gd=") && !chatInfo.mContent.Contains("ui=") && !chatInfo.mContent.Contains("sp=");
+ if (flag4)
+ {
+ this.CacheRecentSendmsg(chatInfo.mContent);
+ }
+ XEntity entity = XSingleton<XEntityMgr>.singleton.GetEntity(chatInfo.mSenderId);
+ bool flag5 = entity != null;
+ if (flag5)
+ {
+ XCharacterShowChatComponent xcharacterShowChatComponent = entity.GetXComponent(XCharacterShowChatComponent.uuID) as XCharacterShowChatComponent;
+ bool flag6 = xcharacterShowChatComponent != null;
+ if (flag6)
+ {
+ xcharacterShowChatComponent.AttachChatBubble();
+ }
+ bool flag7 = xcharacterShowChatComponent != null;
+ if (flag7)
+ {
+ xcharacterShowChatComponent.DealWithChat(chatInfo.mContent);
+ }
+ }
+ DlgBase<BarrageDlg, BarrageBehaviour>.singleton.RealPush(chatInfo);
+ }
+ this.CacheRecentChatinfo(chatInfo);
+ List<XMainClient.ChatInfo> list = this.AddChatInfo(chatInfo, chatInfo.mChannelId);
+ bool flag8 = chatInfo.mChannelId == ChatChannelType.Friends;
+ if (flag8)
+ {
+ DlgBase<XChatView, XChatBehaviour>.singleton.ShowTabFriendRed();
+ }
+ bool flag9 = !this.ChatView.IsInited || !this.ChatView.IsVisible() || chatInfo.mChannelId != this.ChatView.activeChannelType;
+ if (!flag9)
+ {
+ bool flag10 = chatInfo.mContent.IndexOf("\\n") != -1;
+ if (flag10)
+ {
+ chatInfo.mContent = chatInfo.mContent.Replace("\\n", "/n");
+ }
+ this.ChatView.RefreshLoopScroll(this.ChatView.activeChannelType);
+ }
+ }
+
+ public void ClearFriendMsg(ulong roleid)
+ {
+ bool flag = roleid == 0UL;
+ if (flag)
+ {
+ this.ChatFriendList.Clear();
+ }
+ else
+ {
+ for (int i = 0; i < this.ChatFriendList.Count; i++)
+ {
+ bool flag2 = this.ChatFriendList[i].roleid == roleid;
+ if (flag2)
+ {
+ this.ChatFriendList.RemoveAt(i);
+ }
+ }
+ }
+ }
+
+ public List<XMainClient.ChatInfo> GetSmallChatList()
+ {
+ return XChatDocument.m_ChatSmallList;
+ }
+
+ public void RestrainSmallChatInfoNum()
+ {
+ bool flag = (long)XChatDocument.m_ChatSmallList.Count > (long)((ulong)XChatSmallBehaviour.m_MaxShowMsg);
+ if (flag)
+ {
+ XChatDocument.m_ChatSmallList.RemoveRange(0, XChatDocument.m_ChatSmallList.Count - (int)XChatSmallBehaviour.m_MaxShowMsg);
+ }
+ }
+
+ //confirm
+ public void AddSmallChatInfo(XMainClient.ChatInfo info)
+ {
+ XChatDocument.m_ChatSmallList.Add(info);
+ }
+
+ public void OnClearAllData()
+ {
+ this.ClearAllData();
+ XSingleton<XChatIFlyMgr>.singleton.EnableAutoPlay(false);
+ XSingleton<XChatIFlyMgr>.singleton.StopAutoPlay();
+ XSingleton<XChatIFlyMgr>.singleton.ClearPlayList();
+ DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.IsInited = false;
+ DlgBase<XChatView, XChatBehaviour>.singleton.ChatFriendId = 0UL;
+ }
+
+ private void ClearAllData()
+ {
+ List<ChatChannelType> list = new List<ChatChannelType>(XChatDocument.m_ChatDic.Keys);
+ for (int i = 0; i < list.Count; i++)
+ {
+ List<XMainClient.ChatInfo> list2 = XChatDocument.m_ChatDic[list[i]];
+ bool flag = list2 != null;
+ if (flag)
+ {
+ list2.Clear();
+ }
+ }
+ XChatDocument.m_ChatSmallList.Clear();
+ XChatDocument.offlineProcessList.Clear();
+ XChatDocument.m_ChatDic.Clear();
+ XChatDocument.m_ProcessListSmall.Clear();
+ }
+
+ private ChatOpen.RowData ChatOpenRow(int type)
+ {
+ bool flag = this.openTable.Count <= 0;
+ if (flag)
+ {
+ this.sOpenTbale.Clear();
+ for (int i = 0; i < XChatDocument._chatOpenTabel.Table.Length; i++)
+ {
+ bool flag2 = XChatDocument._chatOpenTabel.Table[i].sceneid == 0u;
+ if (flag2)
+ {
+ this.openTable.Add((int)XChatDocument._chatOpenTabel.Table[i].id, XChatDocument._chatOpenTabel.Table[i]);
+ }
+ else
+ {
+ bool flag3 = !this.sOpenTbale.ContainsKey(XChatDocument._chatOpenTabel.Table[i].sceneid);
+ if (flag3)
+ {
+ this.sOpenTbale.Add(XChatDocument._chatOpenTabel.Table[i].sceneid, XChatDocument._chatOpenTabel.Table[i]);
+ }
+ }
+ }
+ }
+ uint sceneID = XSingleton<XScene>.singleton.SceneID;
+ bool flag4 = type < 100 && this.sOpenTbale.ContainsKey(sceneID);
+ ChatOpen.RowData result;
+ if (flag4)
+ {
+ result = this.sOpenTbale[sceneID];
+ }
+ else
+ {
+ bool flag5 = this.openTable.ContainsKey(type);
+ if (flag5)
+ {
+ result = this.openTable[type];
+ }
+ else
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog("找胡博聃,配chatopen表! new scenetype:", type.ToString(), null, null, null, null);
+ result = this.openTable[1];
+ }
+ }
+ return result;
+ }
+
+ public List<int> SortCommonIcons(int type)
+ {
+ List<int> list = new List<int>(this.ChatOpenRow(type).opens);
+ bool flag = this.CheckGuild();
+ bool flag2 = this.CheckTeam();
+ bool flag3 = this.CheckLevelLimit(ChatChannelType.World);
+ bool flag4 = list.Contains(1) && !flag3;
+ if (flag4)
+ {
+ list.Remove(1);
+ }
+ bool flag5 = list.Contains(2) && !flag;
+ if (flag5)
+ {
+ list.Remove(2);
+ }
+ bool flag6 = list.Contains(7) && !flag2;
+ if (flag6)
+ {
+ list.Remove(7);
+ }
+ return list;
+ }
+
+ public ChatOpen.RowData GetYuyinRaw(int type)
+ {
+ return this.ChatOpenRow(type);
+ }
+
+ public ChatOpen.RowData GetBattleRaw()
+ {
+ return this.GetYuyinRaw((int)XSingleton<XScene>.singleton.SceneType);
+ }
+
+ public List<ChatFriendData> FetchFriendsIcons()
+ {
+ this.ChatFriendList.Sort(XSingleton<XChatUIOP>.singleton.CompareNewMsgCb);
+ return this.ChatFriendList;
+ }
+
+ public uint GetChatMaxFriendCount(int type)
+ {
+ return this.ChatOpenRow(type).friends;
+ }
+
+ public bool CheckLevelLimit(ChatChannelType type)
+ {
+ int key = XFastEnumIntEqualityComparer<ChatChannelType>.ToInt(type);
+ XPlayerAttributes xplayerData = XSingleton<XAttributeMgr>.singleton.XPlayerData;
+ bool flag = xplayerData != null;
+ return flag && XChatDocument._chatTable.GetByid((uint)key).level <= xplayerData.Level;
+ }
+
+ public bool CheckGuild()
+ {
+ bool flag = this.guildDoc == null;
+ if (flag)
+ {
+ this.guildDoc = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
+ }
+ return this.guildDoc.bInGuild;
+ }
+
+ public bool CheckTeam()
+ {
+ bool flag = this.teamDoc == null;
+ if (flag)
+ {
+ this.teamDoc = XDocuments.GetSpecificDocument<XTeamDocument>(XTeamDocument.uuID);
+ }
+ return this.teamDoc.MyTeam != null && this.teamDoc.MyTeam.teamBrief.teamID != 0;
+ }
+
+ public void ReqGetFlowerLeftTime()
+ {
+ RpcC2G_GetFlowerLeftTime rpc = new RpcC2G_GetFlowerLeftTime();
+ XSingleton<XClientNetwork>.singleton.Send(rpc);
+ }
+
+ public void OnGetFlowerLeftTime(GetFlowerLeftTimeRes oRes)
+ {
+ bool flag = oRes.errorCode == ErrorCode.ERR_SUCCESS;
+ if (flag)
+ {
+ XSingleton<XGameSysMgr>.singleton.GetFlowerRemainTime = (float)oRes.leftTime;
+ this.getFlowerLeftTime = oRes.leftTime;
+ this.canGetFlower = oRes.canGet;
+ bool flag2 = !oRes.canGet;
+ if (flag2)
+ {
+ this.getFlowerLeftTime = 0;
+ }
+ DlgBase<XChatView, XChatBehaviour>.singleton.OnRefreshGetFlowerInfo();
+ }
+ }
+
+ public void ReqGetFlower()
+ {
+ RpcC2G_GetFlower rpc = new RpcC2G_GetFlower();
+ XSingleton<XClientNetwork>.singleton.Send(rpc);
+ }
+
+ public void OnGetFlower(GetFlowerRes oRes)
+ {
+ bool flag = oRes.errorCode == ErrorCode.ERR_SUCCESS;
+ if (flag)
+ {
+ XSingleton<XGameSysMgr>.singleton.GetFlowerRemainTime = (float)oRes.leftTime;
+ this.getFlowerLeftTime = oRes.leftTime;
+ this.canGetFlower = oRes.canGet;
+ bool flag2 = !oRes.canGet;
+ if (flag2)
+ {
+ this.getFlowerLeftTime = 0;
+ }
+ DlgBase<XChatView, XChatBehaviour>.singleton.OnRefreshGetFlowerInfo();
+ }
+ }
+ }
+}
|