private void chatWindow(int windowID)
{
//Init label styles
chatLineStyle = new GUIStyle(GUI.skin.label);
chatLineStyle.normal.textColor = Color.white;
chatLineStyle.margin = new RectOffset(0, 0, 0, 0);
chatLineStyle.padding = new RectOffset(0, 0, 0, 0);
chatLineStyle.alignment = TextAnchor.LowerLeft;
chatLineStyle.wordWrap = true;
chatLineStyle.stretchWidth = true;
chatLineStyle.fontStyle = FontStyle.Normal;
GUILayoutOption[] entry_field_options = new GUILayoutOption[1];
entry_field_options[0] = GUILayout.MaxWidth(KLFChatDisplay.windowWidth-58);
GUIStyle chat_entry_style = new GUIStyle(GUI.skin.textField);
chat_entry_style.stretchWidth = true;
GUILayout.BeginVertical();
//Mode toggles
GUILayout.BeginHorizontal();
KLFGlobalSettings.instance.chatWindowWide = GUILayout.Toggle(KLFGlobalSettings.instance.chatWindowWide, "Wide", GUI.skin.button);
KLFChatDisplay.displayCommands = GUILayout.Toggle(KLFChatDisplay.displayCommands, "Help", GUI.skin.button);
GUILayout.EndHorizontal();
//Commands
if (KLFChatDisplay.displayCommands)
{
chatLineStyle.normal.textColor = Color.white;
GUILayout.Label("/quit - Leave the server", chatLineStyle);
GUILayout.Label(KLFCommon.SHARE_CRAFT_COMMAND + " <craftname> - Share a craft", chatLineStyle);
GUILayout.Label(KLFCommon.GET_CRAFT_COMMAND + " <playername> - Get the craft the player last shared", chatLineStyle);
GUILayout.Label("!list - View players on the server", chatLineStyle);
}
KLFChatDisplay.scrollPos = GUILayout.BeginScrollView(KLFChatDisplay.scrollPos);
//Chat text
GUILayout.BeginVertical();
foreach (KLFChatDisplay.ChatLine line in KLFChatDisplay.chatLineQueue)
{
if (KLFGlobalSettings.instance.chatColors)
chatLineStyle.normal.textColor = line.color;
GUILayout.Label(line.message, chatLineStyle);
}
GUILayout.EndVertical();
GUILayout.EndScrollView();
GUILayout.BeginHorizontal();
//Entry text field
KLFChatDisplay.chatEntryString = GUILayout.TextField(
KLFChatDisplay.chatEntryString,
KLFChatDisplay.MAX_CHAT_LINE_LENGTH,
chat_entry_style,
entry_field_options);
if (KLFChatDisplay.chatEntryString.Contains('\n') || GUILayout.Button("Send"))
{
enqueueChatOutMessage(KLFChatDisplay.chatEntryString);
KLFChatDisplay.chatEntryString = String.Empty;
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUI.DragWindow();
}