Пример #1
0
        private bool ConvertChatMessage(string text, TypingQuirk quirk, bool isChatName, bool showChatName = true)
        {
            if (_isBbcMode)
            {
                _sb.Append($"[color=#{ColorToHex(quirk.ChatColor)}]");
            }

            if (showChatName)
            {
                _sb.Append(isChatName ? quirk.ChatHandleShort : quirk.Name);
                _sb.Append(seperator[0]);
            }

            if (quirk.ApplyQuirk(text, _isBbcMode, out text))
            {
                _sb.Append(text);

                if (_isBbcMode)
                {
                    _sb.Append("[/color]");
                }
                return(true);
            }
            return(false);
        }
Пример #2
0
        public bool ConvertChatMessage(ref string text, TypingQuirk quirk, bool isBbcMode, ShowNameMode showNameMode)
        {
            string[] lines = Regex.Split(text, nextLines).Select(l => l.Trim()).ToArray();
            string   line  = "";

            _sb.Clear();
            for (int i = 0; i < lines.Length;)
            {
                line = lines[i];
                if (isBbcMode)
                {
                    _sb.Append($"[color=#{ColorToHex(quirk.ChatColor)}]");
                }

                if (showNameMode != ShowNameMode.None)
                {
                    _sb.Append(showNameMode == ShowNameMode.ChatHandle ? quirk.ChatHandleShort : quirk.Name);
                    _sb.Append(seperator[0]);
                }

                if (quirk.ApplyQuirk(line, _isBbcMode, out text))
                {
                    _sb.Append(text);
                }
                else
                {
                    return(false);
                }
                i++;

                if (i < lines.Length)
                {
                    _sb.AppendLine();
                }
            }
            if (isBbcMode)
            {
                _sb.Append("[/color]");
            }


            text = _sb.ToString();
            return(true);
        }