<commit_before>//
// This file is part of the game Voxalia, created by FreneticXYZ.
// This code is Copyright (C) 2016 FreneticXYZ under the terms of the MIT license.
// See README.md or LICENSE.txt for contents of the MIT license.
// If these are not available, see https://opensource.org/licenses/MIT
//

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Voxalia.ClientGame.UISystem;
using Voxalia.ClientGame.UISystem.MenuSystem;
using Voxalia.Shared;
using Voxalia.ClientGame.OtherSystems;
using Voxalia.ClientGame.GraphicsSystems;
using Voxalia.ClientGame.NetworkSystem.PacketsOut;

namespace Voxalia.ClientGame.ClientMainSystem
{
    public partial class Client
    {
        public UIGroup ChatMenu;

        public List<ChatMessage> ChatMessages = new List<ChatMessage>();
        
        public UIInputBox ChatBox;

        public UIScrollBox ChatScroller;

        public bool[] Channels;

        public void InitChatSystem()
        {
            FontSet font = FontSets.Standard;
            ChatBox = new UIInputBox("", "Enter a /command or a chat message...", font, UIAnchor.BOTTOM_LEFT, () => Window.Width - (30 * 2), () => 0, () => 0);
            ChatBox.EnterPressed = EnterChatMessage;
            int minY = 10 + (int)font.font_default.Height;
            ChatScroller = new UIScrollBox(UIAnchor.TOP_LEFT, ChatBox.GetWidth, () => -minY, () => 0, () => minY);
            ChatMenu = new UIGroup(UIAnchor.BOTTOM_LEFT, ChatBox.GetWidth, () => ChatBox.GetHeight() + ChatScroller.GetHeight(), () => 30, () => -10 - ((int)font.font_default.Height) - UIBottomHeight);
            ChatMenu.AddChild(ChatBox);
            ChatMenu.AddChild(ChatScroller);
            Channels = new bool[(int)TextChannel.COUNT];
            Func<int> xer = () => 30;
            for (int i = 0; i < Channels.Length; i++)
            {
                Channels[i] = true;
                string n = ((TextChannel)i).ToString();
                int len = (int)FontSets.Standard.MeasureFancyText(n);
                UITextLink link = null;
                Func<int> fxer = xer;
                int chan = i;
                link = new UITextLink(null, "^r^t^0^h^o^2" + n, "^!^e^t^0^h^o^2" + n, "^2^e^t^0^h^o^0" + n, FontSets.Standard, () => ToggleLink(link, n, chan), UIAnchor.TOP_LEFT, fxer, () => 10);
                xer = () => fxer() + len + 10;
                ChatBox.AddChild(link);
            }
        }
<commit_msg>Show the chat menu in somewhat right places<commit_after>//
// This file is part of the game Voxalia, created by FreneticXYZ.
// This code is Copyright (C) 2016 FreneticXYZ under the terms of the MIT license.
// See README.md or LICENSE.txt for contents of the MIT license.
// If these are not available, see https://opensource.org/licenses/MIT
//

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Voxalia.ClientGame.UISystem;
using Voxalia.ClientGame.UISystem.MenuSystem;
using Voxalia.Shared;
using Voxalia.ClientGame.OtherSystems;
using Voxalia.ClientGame.GraphicsSystems;
using Voxalia.ClientGame.NetworkSystem.PacketsOut;

namespace Voxalia.ClientGame.ClientMainSystem
{
    public partial class Client
    {
        public UIGroup ChatMenu;

        public List<ChatMessage> ChatMessages = new List<ChatMessage>();
        
        public UIInputBox ChatBox;

        public UIScrollBox ChatScroller;

        public bool[] Channels;

        public void InitChatSystem()
        {
            FontSet font = FontSets.Standard;
            int minY = 10 + (int)font.font_default.Height;
            ChatBox = new UIInputBox("", "Enter a /command or a chat message...", font, UIAnchor.BOTTOM_LEFT, () => Window.Width - (30 * 2), () => 0, () => -minY * 5);
            ChatBox.EnterPressed = EnterChatMessage;
            ChatScroller = new UIScrollBox(UIAnchor.TOP_LEFT, ChatBox.GetWidth, () => ChatMenu.GetHeight() - minY, () => 0, () => minY);
            ChatMenu = new UIGroup(UIAnchor.TOP_LEFT, ChatBox.GetWidth, () => Window.Height - minY - UIBottomHeight, () => 30, () => 0);
            ChatMenu.AddChild(ChatBox);
            ChatMenu.AddChild(ChatScroller);
            Channels = new bool[(int)TextChannel.COUNT];
            Func<int> xer = () => 0;
            for (int i = 0; i < Channels.Length; i++)
            {
                Channels[i] = true;
                string n = ((TextChannel)i).ToString();
                int len = (int)FontSets.Standard.MeasureFancyText(n);
                UITextLink link = null;
                Func<int> fxer = xer;
                int chan = i;
                link = new UITextLink(null, "^r^t^0^h^o^2" + n, "^!^e^t^0^h^o^2" + n, "^2^e^t^0^h^o^0" + n, FontSets.Standard, () => ToggleLink(link, n, chan), UIAnchor.TOP_LEFT, fxer, () => 10);
                xer = () => fxer() + len + 10;
                ChatMenu.AddChild(link);
            }
        }

{'fraction_non_alphanumeric': 0.1289933694996986, 'fraction_numerical': 0.011653606590315451, 'mean_word_length': 2.452149791955617, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 37, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2552428', 'n_tokens_mistral': 1623, 'n_tokens_neox': 1541, 'n_words': 382}