hch
8 天以前 303f5970d2bef26905c9d6d471cd13f41bc722a7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using UnityEngine;
 
public class ColorAnalysis : TRichAnalysis<ColorAnalysis>
{
    public static Regex Color_Start_Regex = new Regex(@"<color=#([0-9a-zA-Z]+)>", RegexOptions.Singleline);
 
    public override string Analysis(string val, bool IsRich)
    {
        return val;
        // if (!Color_Start_Regex.IsMatch(val) || RichTextMgr.Inst.presentRichText == null)
        // {
        //     return val;
        // }
        // int index = 0;
        // m_StringBuilder.Length = 0;
        // var _text = RichTextMgr.Inst.presentRichText;
        // if (_text.colorType == RichText.ColorType.Bright)
        // {
        //     return val;
        // }
        // foreach (Match match in Color_Start_Regex.Matches(val))
        // {
        //     m_StringBuilder.Append(val.Substring(index, match.Groups[1].Index - index));
        //     m_StringBuilder.Append(GetColorMap(match.Groups[1].Value));
        //     index = match.Groups[1].Index + match.Groups[1].Length;
        // }
        // m_StringBuilder.Append(val.Substring(index, val.Length - index));
        // return m_StringBuilder.ToString();
    }
 
    private string GetColorMap(string _value)
    {
        if (_value.Length > 6)
        {
            _value = _value.Substring(0, 6);
        }
        // switch (_value.ToLower())
        // {
        //     case "248B12":
        //         return "35e122";
        //     case "ff6701":
        //         return "f8983b";
        //     case "006be3":
        //         return "31cefb";
        //     case "ff0303":
        //         return "fa0101";
        //     case "12a199":
        //         return "13a199";
        //     case "686868":
        //         return "f7f7f7";
        //     case "da48d5":
        //         return "ec4bf6";
        //     case "f6408d":
        //         return "ff7c7c";
        //     case "bb8800":
        //         return "ffde00";
        //     case "666666":
        //         return "dddddd";
        //     case "9460ff":
        //         return "7999ff";
        //     case "0066ff":
        //         return "00c6ff";
        //     case "00b337":
        //         return "66ff00";
        //     case "ff6600":
        //         return "ff9000";
        //     case "ff00f6":
        //         return "f000ff";
        // }
        return _value;
    }
 
    public override string CalculateTextIndex(string val, int index)
    {
        return string.Empty;
    }
}