private void DoChatWindow() { if (ChatRoom.UpdateText || ChatRoom.chatTextLines == 0) { this.DoUpdateText(); } List <string> list = new List <string>(); list.AddRange(ChatRoom.irc.GetChannels()); GUILayout.BeginArea(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), this.skin.box); if (list.Count == 0) { this.labelStyle.normal.textColor = Gui.Gui.MainColor; GUI.Box(new Rect(10f, 10f, (float)(Screen.width - 20), (float)(Screen.height - 20)), string.Empty); GUI.Label(new Rect(ChatRoom.Width(200f), ChatRoom.Height(130f), ChatRoom.Width(560f), ChatRoom.Height(30f)), "Connecting to the server, please wait..."); if (GUI.Button(new Rect(ChatRoom.Width(200f), ChatRoom.Height(160f), ChatRoom.Width(560f), ChatRoom.Height(25f)), "Back")) { ChatRoom.IsShowing = false; } GUILayout.EndArea(); return; } this.chatStyle.fontSize = ChatRoom.FontSize(14); this.labelStyle.fontSize = ChatRoom.FontSize(14); this.buttonStyle.fontSize = ChatRoom.FontSize(14); this.fieldStyle.fontSize = ChatRoom.FontSize(14); this.fieldStyle.padding = new RectOffset((int)ChatRoom.Width(8f), 0, 0, 0); this.fieldStyle.alignment = TextAnchor.MiddleLeft; this.chatStyle.normal.textColor = Color.black; this.fieldStyle.normal.textColor = Color.black; this.buttonStyle.normal.textColor = Gui.Gui.MainColor; this.labelStyle.normal.textColor = Color.black; foreach (KeyValuePair <string, string> current in this.channelsText) { if (current.Key != "SERVER" && list.IndexOf(current.Key) == -1) { list.Add(current.Key); } } GUILayout.BeginVertical(new GUILayoutOption[0]); if (this.nextFrameChannel != string.Empty) { this.activeChannel = list.IndexOf(this.nextFrameChannel); this.nextFrameChannel = string.Empty; } if (this.unreadTextChannels.Length != list.Count) { int[] array = this.unreadTextChannels; this.unreadTextChannels = new int[list.Count]; for (int i = 0; i < array.Length; i++) { if (this.unreadTextChannels.Length > i) { this.unreadTextChannels[i] = array[i]; } } } string[] texts = new string[list.Count]; this.activeChannel = GUILayout.Toolbar(this.activeChannel, texts, new GUILayoutOption[0]); this.unreadTextChannels[this.activeChannel] = 0; if (this.selectedChannel != this.activeChannel) { this.selectedChannel = this.activeChannel; ChatRoom.UpdateText = true; } this.nameOfChatPartner = list[this.activeChannel]; int num = 940; int num2 = num / list.Count; this.labelStyle.alignment = TextAnchor.UpperCenter; for (int j = 0; j < list.Count; j++) { this.labelStyle.normal.textColor = Gui.Gui.MainColor; if (this.unreadTextChannels[j] == 1) { this.labelStyle.normal.textColor = Color.green; } GUI.Label(new Rect(ChatRoom.Width((float)(10 + j * num2)), ChatRoom.Height(5f), ChatRoom.Width((float)num2), ChatRoom.Height(28f)), list[j]); } this.labelStyle.normal.textColor = Color.black; this.labelStyle.alignment = TextAnchor.UpperLeft; Vector2 scrollPosition = new Vector2(0f, 3.40282347E+38f); if (this.channelsScrolls.ContainsKey(list[this.activeChannel])) { scrollPosition = this.channelsScrolls[list[this.activeChannel]]; } this.chatStyle.hover.background = this.whiteTexture; this.chatStyle.hover.textColor = Color.black; this.chatStyle.normal.background = this.whiteTexture; this.chatStyle.normal.textColor = Color.black; GUI.TextArea(new Rect(ChatRoom.Width(10f), ChatRoom.Height(40f), ChatRoom.Width(710f), ChatRoom.Height(25f)), ChatRoom.Topic); this.chatStyle.hover.textColor = this.chatColor; this.chatStyle.hover.background = this.chatTexture; this.chatStyle.normal.textColor = this.chatColor; this.chatStyle.normal.background = this.chatTexture; int num3 = (int)this.chatStyle.CalcHeight(new GUIContent(ChatRoom.chatTextString), ChatRoom.Width(704f)); this.channelsScrolls[list[this.activeChannel]] = GUI.BeginScrollView(new Rect(ChatRoom.Width(10f), ChatRoom.Height(70f), ChatRoom.Width(745f), ChatRoom.Height(440f)), scrollPosition, new Rect(0f, ChatRoom.Height(70f), ChatRoom.Width(700f), (float)num3 + ChatRoom.Height(0f))); int num4 = 440; if (num3 > 440) { num4 = num3; } GUI.TextArea(new Rect(ChatRoom.Width(0f), ChatRoom.Height(70f), ChatRoom.Width(710f), ChatRoom.Height((float)num4)), ChatRoom.chatTextString); float num5 = ChatRoom.Height(70f); int num6 = (int)this.chatStyle.CalcHeight(new GUIContent("base"), ChatRoom.Width(704f)); float num7 = 0f; if (ChatRoom.chatTextLines > 0) { num7 = (float)(num3 / ChatRoom.chatTextLines); } for (int k = 0; k < ChatRoom.chatText.Count; k++) { int num8 = (int)this.chatStyle.CalcHeight(new GUIContent(ChatRoom.chatText[k].Text), ChatRoom.Width(710f)); this.labelStyle.normal.textColor = ChatRoom.chatText[k].TextColor; GUI.Label(new Rect(ChatRoom.Width(3f), num5, ChatRoom.Width(704f), (float)num8), ChatRoom.chatText[k].Text); num5 += num7; if (num8 > num6) { int num9 = num8 / num6; num5 += num7 * (float)num9; } } this.labelStyle.normal.textColor = Color.black; GUI.EndScrollView(); bool flag = false; Channel channel = ChatRoom.irc.GetChannel(list[this.activeChannel]); if (channel != null) { if (channel.Users.Values.Count != 0) { this.usersScroll = GuiBase.TouchScrollView(new Rect(ChatRoom.Width(770f), ChatRoom.Height(40f), ChatRoom.Width(175f), ChatRoom.Height(500f)), this.usersScroll, new Rect(0f, ChatRoom.Height(40f), ChatRoom.Width(140f), ChatRoom.Height((float)this.marginTopUsers))); this.marginTopUsers = 70; if (this.sortedUsers.Count != channel.Users.Count) { this.sortedUsers = (from x in channel.Users orderby x.Value.Nick select x.Value).ToList <ChannelUser>(); } foreach (ChannelUser current2 in this.sortedUsers) { if (current2.Realname != null && !current2.Realname.Equals(this.userId)) { if (current2.IsIrcOp) { this.buttonStyle.normal.textColor = Color.green; } else { this.buttonStyle.normal.textColor = Gui.Gui.MainColor; } if (GUI.Button(new Rect(ChatRoom.Width(0f), ChatRoom.Height((float)this.marginTopUsers), ChatRoom.Width(145f), ChatRoom.Height(25f)), current2.Nick)) { if (this.closedChannelsText.ContainsKey(current2.Nick)) { this.channelsText.Add(current2.Nick, this.closedChannelsText[current2.Nick]); this.closedChannelsText.Remove(current2.Nick); this.nextFrameChannel = current2.Nick; } else if (!this.channelsText.ContainsKey(current2.Nick)) { this.channelsText[current2.Nick] = string.Empty; this.nextFrameChannel = current2.Nick; } if (list.Contains(current2.Nick)) { this.activeChannel = list.IndexOf(current2.Nick); } this.nameOfChatPartner = current2.Nick; flag = true; } this.marginTopUsers += 26; } else if (current2.Realname != null) { this.userName = current2.Nick; } } this.labelStyle.normal.textColor = Gui.Gui.MainColor; GUI.Label(new Rect(ChatRoom.Width(0f), ChatRoom.Height(40f), ChatRoom.Width(120f), ChatRoom.Height(35f)), this.userName); this.labelStyle.normal.textColor = Color.black; GUI.EndScrollView(); } } else { if (GUI.Button(new Rect(ChatRoom.Width(770f), ChatRoom.Height(40f), ChatRoom.Width(145f), ChatRoom.Height(30f)), new GUIContent("Close")) && this.channelsText.ContainsKey(this.nameOfChatPartner)) { this.closedChannelsText.Add(this.nameOfChatPartner, this.channelsText[this.nameOfChatPartner]); this.channelsText.Remove(this.nameOfChatPartner); this.nameOfChatPartner = string.Empty; this.activeChannel = 0; flag = true; } bool flag2 = ChatRoom.mutedUsers.Contains(this.nameOfChatPartner); string text = "Ignore"; if (flag2) { text = "Clear ignore"; } if (GUI.Button(new Rect(ChatRoom.Width(770f), ChatRoom.Height(80f), ChatRoom.Width(145f), ChatRoom.Height(30f)), new GUIContent(text)) && this.channelsText.ContainsKey(this.nameOfChatPartner)) { if (!flag2) { ChatRoom.mutedUsers.Add(this.nameOfChatPartner); } else { ChatRoom.mutedUsers.Remove(this.nameOfChatPartner); } } } GUI.SetNextControlName("Input"); this.inputString = GUI.TextField(new Rect(ChatRoom.Width(10f), ChatRoom.Height(520f), ChatRoom.Width(560f), ChatRoom.Height(30f)), this.inputString); if (ChatRoom.focusInput) { ChatRoom.focusInput = false; GUI.FocusControl("Input"); } Event current3 = Event.current; bool flag3 = current3.keyCode == KeyCode.Return || current3.keyCode == KeyCode.KeypadEnter; if ((GUI.Button(new Rect(ChatRoom.Width(580f), ChatRoom.Height(520f), ChatRoom.Width(140f), ChatRoom.Height(30f)), "SEND") || flag3) && !string.IsNullOrEmpty(this.inputString) && this.inputString.Length > 1) { ChatRoom.irc.SendMessage(SendType.Message, list[this.activeChannel], this.inputString); Dictionary <string, string> dictionary; if (!this.channelsText.ContainsKey(list[this.activeChannel])) { this.channelsText[list[this.activeChannel]] = string.Empty; } else { string key; (dictionary = this.channelsText)[key = list[this.activeChannel]] = dictionary[key] + "\r\n"; } Dictionary <string, string> expr_D89 = dictionary = this.channelsText; string key2; string expr_D98 = key2 = list[this.activeChannel]; string text2 = dictionary[key2]; expr_D89[expr_D98] = string.Concat(new string[] { text2, this.DateTimeString, this.userName, ": ", this.inputString }); this.inputString = string.Empty; this.channelsScrolls[list[this.activeChannel]] = new Vector2(0f, 3.40282347E+38f); ChatRoom.UpdateText = true; } if (GUI.Button(new Rect(ChatRoom.Width(10f), ChatRoom.Height(560f), ChatRoom.Width(800f), ChatRoom.Height(30f)), "Back (you will still stay in the chat)")) { ChatRoom.IsShowing = false; } if (GUI.Button(new Rect(ChatRoom.Width(820f), ChatRoom.Height(560f), ChatRoom.Width(120f), ChatRoom.Height(30f)), "Quit Chat")) { ChatRoom.IsShowing = false; ChatRoom.IsNotStarted = true; ChatRoom.IsChannelChoosen = false; ChatRoom.Disconnect(); } GUILayout.EndVertical(); GUILayout.EndArea(); this.fieldStyle.alignment = TextAnchor.MiddleCenter; this.fieldStyle.padding = new RectOffset(0, 0, 0, 0); if (flag) { ChatRoom.focusInput = true; } }