| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 | 
							- using System.Text.RegularExpressions;
 
- using System.Collections;
 
- using System;
 
- using FairyGUI;
 
- using UnityEngine;
 
- namespace GFGGame
 
- {
 
-     public class StoryUtil
 
-     {
 
-         public static ArrayList GetLettersList(string words)
 
-         {
 
-             Regex regex = new Regex("\\u005Bcolor.*?/color]");
 
-             MatchCollection mc = regex.Matches(words);
 
-             string[] splitResult = regex.Split(words);
 
-             ArrayList colorList = HandleColorTextList(mc);
 
-             ArrayList result = new ArrayList();
 
-             for(int i = 0; i < splitResult.Length; i++)
 
-             {
 
-                 string text = splitResult[i];
 
-                 char[] charArr = text.ToCharArray();
 
-                 foreach(char a in charArr)
 
-                 {
 
-                     result.Add(a.ToString());
 
-                 }
 
-                 if(i < colorList.Count)
 
-                 {
 
-                     string[] colorTextArr = (string[])colorList[i];
 
-                     foreach(string b in colorTextArr)
 
-                     {
 
-                         result.Add(b);
 
-                     }
 
-                 }
 
-             }
 
-             return result;
 
-         }
 
-         
 
-         private static ArrayList HandleColorTextList(MatchCollection mc)
 
-         {
 
-             ArrayList colorList = new ArrayList();
 
-             for(int i = 0; i < mc.Count; i++)
 
-             {
 
-                 Match m = mc[i];
 
-                 string[] result = HandleColorText(m);
 
-                 colorList.Add(result);
 
-             }
 
-             return colorList;
 
-         }
 
-         private static string[] HandleColorText(Match m)
 
-         {
 
-             string value = m.Value;
 
-             Regex regexColor = new Regex("\\u005B.*?]");
 
-             string text = regexColor.Replace(value, "");
 
-             string[] result = new string[text.Length];
 
-             Regex regexText = new Regex(text);
 
-             string colorTemp = regexText.Replace(value, "xx");
 
-             Regex regexLetter = new Regex("xx");
 
-             for(int i = 0; i < text.Length; i++)
 
-             {
 
-                 string letter = text.Substring(i, 1);
 
-                 string colorLetter = regexLetter.Replace(colorTemp, letter);
 
-                 result[i] = colorLetter;
 
-             }
 
-             return result;
 
-         }
 
-         public static string GetChapterOrderText(int chapterID)
 
-         {
 
-             int order = GetChapterOrder(chapterID);
 
-             return "第" + NumberUtil.GetChiniseNumberText(order) + "章";
 
-         }
 
-         /// <summary>
 
-         /// 获得章节显示的序号
 
-         /// </summary>
 
-         /// <param name="chapterCfgId"></param>
 
-         /// <returns></returns>
 
-         public static int GetChapterOrder(int chapterCfgId)
 
-         {
 
-             StoryChapterCfg storyChapterCfg = StoryChapterCfgArray.Instance.GetCfg(chapterCfgId);
 
-             return storyChapterCfg.order;
 
-         }
 
-         public static void UpdateStar(int starCount, GComponent component)
 
-         {
 
-             if(component != null)
 
-             {
 
-                 int num = component.numChildren;
 
-                 for(int i = 1; i <= 3; i++)
 
-                 {
 
-                     GObject obj = component.GetChild("f" +i);
 
-                     if(obj != null)
 
-                     {
 
-                         obj.visible = i <= starCount;
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         public static void UpdateStar(int starCount, GComponent component ,int currentIndex)
 
-         {
 
-             if (component != null)
 
-             {
 
-                 int num = component.numChildren;
 
-                 for (int i = 1; i <= 3; i++)
 
-                 {
 
-                     GObject obj = component.GetChild("f" + i);
 
-                     if (obj != null)
 
-                     {
 
-                         obj.visible = i <= starCount;
 
-                         
 
-                         if (currentIndex == 1)
 
-                         {
 
-                             (obj as GLoader).url = "ui://Main/tb_zx_jy_star";
 
-                         }
 
-                         else
 
-                         {
 
-                             (obj as GLoader).url = "ui://Main/tb_zx_pt_star";
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |