From fcb48b1d779ec150965643b2d912a2d3f526b89a Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期三, 23 一月 2019 14:09:51 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
---
System/Message/ColorAnalysis.cs | 140 ++++++++++++++++++++++++++--------------------
1 files changed, 79 insertions(+), 61 deletions(-)
diff --git a/System/Message/ColorAnalysis.cs b/System/Message/ColorAnalysis.cs
index 4b90be7..984c044 100644
--- a/System/Message/ColorAnalysis.cs
+++ b/System/Message/ColorAnalysis.cs
@@ -1,61 +1,79 @@
-锘縰sing 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)
- {
- 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 "109d06":
- return "35e122";
- case "ff6701":
- return "f8983b";
- case "006be3":
- return "31cefb";
- case "ff0303":
- return "fa0101";
- case "12a199":
- return "13a199";
- case "686868":
- return "f7f7f7";
- }
- return _value;
- }
-
- public override string CalculateTextIndex(string val, int index)
- {
- return string.Empty;
- }
-}
+锘縰sing 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)
+ {
+ 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 "109d06":
+ 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;
+ }
+}
--
Gitblit v1.8.0