From 172d8ffbf5fe3bdd60b3d71a3a60feeed1cb1762 Mon Sep 17 00:00:00 2001
From: chenxin <chenxin6991@163.com>
Date: Mon, 09 Nov 2020 16:37:47 +0800
Subject: [PATCH] Merge commit '894e974d944190fb2e10e14827f0d878626bd048' into master

---
 Assets/Scripts/Guide/CharForeach.cs |   78 ++++++++++++++++++++++-----------------
 1 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/Assets/Scripts/Guide/CharForeach.cs b/Assets/Scripts/Guide/CharForeach.cs
index 69441ec..baee205 100644
--- a/Assets/Scripts/Guide/CharForeach.cs
+++ b/Assets/Scripts/Guide/CharForeach.cs
@@ -13,14 +13,14 @@
     public delegate void CallBack();
     private Action callBack;
 
-    RectTransform contentRect;
+    //RectTransform contentRect;
 
-    Vector2 offsetV;
+    //Vector2 offsetV;
     void Awake()
     {
-        contentRect = transform.Find("Scroll View/Viewport/Content").GetComponent<RectTransform>();
-        text = transform.Find("Scroll View/Viewport/Content/Text").GetComponent<Text>();
-        offsetV = new Vector2(0, 20);
+        //contentRect = transform.Find("Scroll View/Viewport/Content").GetComponent<RectTransform>();
+        //offsetV = new Vector2(0, 20);
+        text = transform.Find("Text").GetComponent<Text>();
     }
 
     public void StartShowWord(string str, Action cb)
@@ -30,10 +30,10 @@
         word = str;
         text.text = "";
         callBack = cb;
-        if (contentRect.anchoredPosition.y != 0)
-        {
-            contentRect.anchoredPosition = Vector2.zero;
-        }
+        // if (contentRect.anchoredPosition.y != 0)
+        // {
+        //     contentRect.anchoredPosition = Vector2.zero;
+        // }
         StartCoroutine("TypeText");
     }
 
@@ -43,33 +43,38 @@
         StopCoroutine("TypeText");
         text.text = "";
         char[] charArray = word.ToCharArray();
-        length = 0;
+        //length = 0;
         for (int i = 0; i < charArray.Length; i++)
         {
             if (charArray[i].Equals('$'))
             {
                 text.text += GuideConfig.showWordsUBB[0];
-                length += 19;
+                //length += 19;
             }
             else if (charArray[i].Equals('%'))
             {
-                length += 19;
+                //length += 19;
                 text.text += GuideConfig.showWordsUBB[1];
             }
             else if (charArray[i].Equals('`'))
             {
-                length += 23;
+                //length += 23;
                 text.text += GuideConfig.showWordsUBB[2];
             }
             else if (charArray[i].Equals('&'))
             {
-                length += 19;
+                //length += 19;
                 text.text += GuideConfig.showWordsUBB[3];
             }
             else if (charArray[i].Equals('*'))
             {
-                length += 23;
+                //length += 23;
                 text.text += GuideConfig.showWordsUBB[4];
+            }
+            else if (charArray[i].Equals('<'))
+            {
+                //length += 23;
+                text.text += GuideConfig.showWordsUBB[5];
             }
             else
             {
@@ -79,14 +84,14 @@
         }
         //text.text = word;
 
-        if (text.text.Length - length >= 39 && contentRect.anchoredPosition != offsetV)
-        {
-            contentRect.anchoredPosition = offsetV;
-        }
-        else
-        {
-            contentRect.anchoredPosition = Vector2.zero;
-        }
+        // if (text.text.Length - length >= 39 && contentRect.anchoredPosition != offsetV)
+        // {
+        //     contentRect.anchoredPosition = offsetV;
+        // }
+        // else
+        // {
+        //     contentRect.anchoredPosition = Vector2.zero;
+        // }
         if (callBack != null)
         {
             callBack();
@@ -95,47 +100,52 @@
 
     }
 
-    int length = 0;
+    //int length = 0;
     private IEnumerator TypeText()
     {
         char[] charArray = word.ToCharArray();
-        length = 0;
+        //length = 0;
         for (int i = 0; i < charArray.Length; i++)
         {
             if (charArray[i].Equals('$'))
             {
                 text.text += GuideConfig.showWordsUBB[0];
-                length += 19;
+                //length += 19;
             }
             else if (charArray[i].Equals('%'))
             {
-                length += 19;
+                //length += 19;
                 text.text += GuideConfig.showWordsUBB[1];
             }
             else if (charArray[i].Equals('`'))
             {
-                length += 23;
+                //length += 23;
                 text.text += GuideConfig.showWordsUBB[2];
             }
             else if (charArray[i].Equals('&'))
             {
-                length += 19;
+                //length += 19;
                 text.text += GuideConfig.showWordsUBB[3];
             }
             else if (charArray[i].Equals('*'))
             {
-                length += 23;
+                //length += 23;
                 text.text += GuideConfig.showWordsUBB[4];
+            }
+            else if (charArray[i].Equals('<'))
+            {
+                //length += 23;
+                text.text += GuideConfig.showWordsUBB[5];
             }
             else
             {
                 text.text += charArray[i];
             }
 
-            if (text.text.Length - length >= 39 && contentRect.anchoredPosition != offsetV)
-            {
-                contentRect.anchoredPosition = offsetV;
-            }
+            // if (text.text.Length - length >= 39 && contentRect.anchoredPosition != offsetV)
+            // {
+            //     contentRect.anchoredPosition = offsetV;
+            // }
             yield return new WaitForSeconds(letterPause);
         }
 

--
Gitblit v1.9.1