Exemplo n.º 1
0
 public static string Color(string content, Color136 color)     //设置文字颜色,貌似只有在uilabel中文字颜色默认不设置情况下代码才起作用/
 {
     if (color136.Count == 0)
     {
         AddColorValue();
     }
     return("[" + color136[color].HEX + "]" + content + "[-]");
 }
Exemplo n.º 2
0
 public QuickText(string _url, int _beginIndex, int _length, Color136 _color, bool _isBold, bool _isUnderline, bool _isItalic)
 {
     url         = _url;
     beginIndex  = _beginIndex;
     length      = _length;
     color       = _color;
     isBold      = _isBold;
     isUnderline = _isUnderline;
     isItalic    = _isItalic;
 }
Exemplo n.º 3
0
        //void Awake()
        //{
        //    init();
        //}

        //private void init()
        //{
        //    this.textList = this.transform.Find("UIDebug/TextArea").GetComponent<UITextList>();
        //}

        public void log(object obj, Color136 color = Color136.Black)
        {
            if (this.textList == null)
            {
                this.textList = this.transform.Find("UIDebug/TextArea").GetComponent <UITextList>();
            }
            string content = obj.ToString();

            if (this.color136.Count == 0)
            {
                color136 = TextStyle.getColor136();
            }
            content = "[" + color136[color].HEX + "]" + content + "[-]";   //设置颜色/
            this.textList.Add(content);
        }
Exemplo n.º 4
0
 public static string QuickColorText(string content, Color136 mainColor, bool isBold = true, bool isUnderline = false, bool isItalic = false)
 {
     if (color136.Count == 0)
     {
         AddColorValue();
     }
     content = "[" + color136[mainColor].HEX + "]" + content + "[-]";   //设置颜色/
     if (isBold)
     {
         content = "[b]" + content + "[/b]";                        //设置粗体/
     }
     if (isUnderline)
     {
         content = "[u]" + content + "[/u]";                        //设置下划线/
     }
     if (isItalic)
     {
         content = "[i]" + content + "[/i]";                        //设置斜体/
     }
     return(content);
 }
Exemplo n.º 5
0
 public static string QuickLinkText(string content, string urlPath, Color136 color, bool isBold = true, bool isUnderline = true, bool isItalic = false)
 {
     if (color136.Count == 0)
     {
         AddColorValue();
     }
     content = "[" + color136[color].HEX + "]" + content + "[-]";        //设置颜色/
     content = "[url=" + urlPath + "]" + content + "[/url][url=][/url]"; //设置超链接/
     if (isBold)
     {
         content = "[b]" + content + "[/b]";                        //设置粗体/
     }
     if (isUnderline)
     {
         content = "[u]" + content + "[/u]";                        //设置下划线/
     }
     if (isItalic)
     {
         content = "[i]" + content + "[/i]";                        //设置斜体/
     }
     return(content);
 }
Exemplo n.º 6
0
        public static string QuickColorText(string content, int beginIndex, int length, Color136 mainColor, Color136 otherColor, bool isBold = true, bool isUnderline = false, bool isItalic = false, bool isAllSame = false)
        {
            int contentLength = content.Length;

            if (beginIndex < 0)
            {
                beginIndex = 0;
            }
            else if (beginIndex > contentLength - 1)
            {
                beginIndex = contentLength - 1;
            }

            if (length < 0)
            {
                length = 0;
            }
            else if (length > contentLength - beginIndex)
            {
                length = contentLength - beginIndex;
            }

            string str1 = content.Substring(0, beginIndex);          //第一段字符串/
            string str2 = content.Substring(beginIndex, length);     //第二段字符串/
            string str3 = content.Substring(beginIndex + length);    //第三段字符串/

            //将截取出来的第二段字符串进行设置颜色、设置粗体等操作/
            if (color136.Count == 0)
            {
                AddColorValue();
            }
            if (!string.IsNullOrEmpty(str1))
            {
                str1 = "[" + color136[otherColor].HEX + "]" + str1 + "[-]"; //设置颜色/
            }
            str2 = "[" + color136[mainColor].HEX + "]" + str2 + "[-]";      //设置颜色/
            str3 = "[" + color136[otherColor].HEX + "]" + str3 + "[-]";     //设置颜色/

            string str = "";

            if (isAllSame)
            {
                str = str1 + str2 + str3;
                if (isBold)                                           //设置粗体/
                {
                    str = "[b]" + str + "[/b]";
                }
                if (isUnderline)                                      //设置下划线/
                {
                    str = "[u]" + str + "[/u]";
                }
                if (isItalic)                                         //设置斜体/
                {
                    str = "[i]" + str + "[/i]";
                }
            }
            else
            {
                if (isBold)
                {
                    str2 = "[b]" + str2 + "[/b]";                      //设置粗体/
                }
                if (isUnderline)
                {
                    str2 = "[u]" + str2 + "[/u]";                      //设置下划线/
                }
                if (isItalic)
                {
                    str2 = "[i]" + str2 + "[/i]";                      //设置斜体/
                }
                str = str1 + str2 + str3;
            }

            return(str);
        }
Exemplo n.º 7
0
        public static string QuickContent(string content, Color136 bgTextColor, List <QuickText> contentProperty)
        {
            string newContent = content.Substring(0, contentProperty[0].BeginIndex);

            if (color136.Count == 0)
            {
                AddColorValue();
            }
            newContent = "[" + color136[bgTextColor].HEX + "]" + newContent + "[-]";            //设置颜色/
            for (int i = 0; i < contentProperty.Count; i++)
            {
                string childContent1 = "";             //由list分割出来的字符串/
                if (i + 1 < contentProperty.Count)     //排除掉当前字符串长度超过下一个字符串开头索引的情况/
                {
                    int childContent1Length = 0;
                    if (contentProperty[i].BeginIndex + contentProperty[i].Length >= contentProperty[i + 1].BeginIndex)
                    {
                        childContent1Length = contentProperty[i + 1].BeginIndex - contentProperty[i].BeginIndex;
                    }
                    else
                    {
                        childContent1Length = contentProperty[i].Length;
                    }
                    childContent1 = content.Substring(contentProperty[i].BeginIndex, childContent1Length);
                }
                else
                {
                    childContent1 = content.Substring(contentProperty[i].BeginIndex, contentProperty[i].Length);
                }
                if (!string.IsNullOrEmpty(contentProperty[i].Url))
                {
                    childContent1 = "[url=" + contentProperty[i].Url + "]" + childContent1 + "[/url][url=][/url]"; //设置超链接/
                }
                childContent1 = "[" + color136[contentProperty[i].Color].HEX + "]" + childContent1 + "[-]";        //设置颜色/
                if (contentProperty[i].IsBold)
                {
                    childContent1 = "[b]" + childContent1 + "[/b]";                                           //设置粗体/
                }
                if (contentProperty[i].IsUnderline)
                {
                    childContent1 = "[u]" + childContent1 + "[/u]";                                           //设置下划线/
                }
                if (contentProperty[i].IsItalic)
                {
                    childContent1 = "[i]" + childContent1 + "[/i]"; //设置斜体/
                }
                string childContent2 = "";                          //与被list分割出的字符串紧邻在后面的字符串/
                if (i + 1 < contentProperty.Count)
                {
                    int childContent2Length = 0;
                    if (contentProperty[i + 1].BeginIndex - (contentProperty[i].BeginIndex + contentProperty[i].Length) >= 0)      //排除掉字符串长度小于0的情况/
                    {
                        childContent2Length = contentProperty[i + 1].BeginIndex - (contentProperty[i].BeginIndex + contentProperty[i].Length);
                    }
                    childContent2 = content.Substring(contentProperty[i].BeginIndex + contentProperty[i].Length, childContent2Length);
                    childContent2 = "[" + color136[bgTextColor].HEX + "]" + childContent2 + "[-]";
                }
                else
                {
                    childContent2 = content.Substring(contentProperty[i].BeginIndex + contentProperty[i].Length);
                    childContent2 = "[" + color136[bgTextColor].HEX + "]" + childContent2 + "[-]";
                }

                newContent = newContent + childContent1 + childContent2;
            }
            return(newContent);
        }
Exemplo n.º 8
0
        public static string QuickLinkText(string content, string urlPath, int beginIndex, int length, Color136 color, bool isBold = true, bool isUnderline = true, bool isItalic = false)
        {
            int contentLength = content.Length;

            if (beginIndex < 0)
            {
                beginIndex = 0;
            }
            else if (beginIndex > contentLength - 1)
            {
                beginIndex = contentLength - 1;
            }

            if (length < 0)
            {
                length = 0;
            }
            else if (length > contentLength - beginIndex)
            {
                length = contentLength - beginIndex;
            }

            string str1 = content.Substring(0, beginIndex);          //第一段字符串/
            string str2 = content.Substring(beginIndex, length);     //第二段字符串/
            string str3 = content.Substring(beginIndex + length);    //第三段字符串/

            //将截取出来的第二段字符串进行添加超链接、设置颜色、设置粗体等操作/
            if (color136.Count == 0)
            {
                AddColorValue();
            }
            str2 = "[" + color136[color].HEX + "]" + str2 + "[-]";        //设置颜色/
            str2 = "[url=" + urlPath + "]" + str2 + "[/url][url=][/url]"; //设置超链接/
            if (isBold)
            {
                str2 = "[b]" + str2 + "[/b]";                        //设置粗体/
            }
            if (isUnderline)
            {
                str2 = "[u]" + str2 + "[/u]";                        //设置下划线/
            }
            if (isItalic)
            {
                str2 = "[i]" + str2 + "[/i]";                        //设置斜体/
            }
            return(str1 + str2 + str3);
        }