From 31c2cebbccba45a00a755981dd6d0cdd0a0459e9 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期二, 14 八月 2018 17:28:38 +0800
Subject: [PATCH] Merge branch 'master' into leonard

---
 Assets/Editor/Tool/CheckFontSwitch.cs |  292 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 146 insertions(+), 146 deletions(-)

diff --git a/Assets/Editor/Tool/CheckFontSwitch.cs b/Assets/Editor/Tool/CheckFontSwitch.cs
index 3d08ae9..42a1ccb 100644
--- a/Assets/Editor/Tool/CheckFontSwitch.cs
+++ b/Assets/Editor/Tool/CheckFontSwitch.cs
@@ -6,159 +6,159 @@
 using UnityEngine.UI;
 using System;
 using System.Text.RegularExpressions;
-using System.Reflection;
-
-public class CheckFontSwitch
+using System.Reflection;
+
+public class CheckFontSwitch
 {
-    static string windowRootPath = Application.dataPath + "/ResourcesOut/UI/Window";
-    static string windowRootPath2 = Application.dataPath + "/ResourcesOut/UI/PriorityWindow";
-    static string prefabRootPath = Application.dataPath + "/ResourcesOut/UI/Prefab";
-
-    [MenuItem("绋嬪簭/妫�娴嬪拰娣诲姞FontSwitch")]
-    public static void CheckAndReplaceFontSwitch()
-    {
-        try
-        {
-            var allFiles = new List<FileInfo>();
-            allFiles.AddRange(new DirectoryInfo(windowRootPath).GetFiles("*.prefab", SearchOption.TopDirectoryOnly));
-            allFiles.AddRange(new DirectoryInfo(windowRootPath2).GetFiles("*.prefab", SearchOption.TopDirectoryOnly));
-            allFiles.AddRange(new DirectoryInfo(prefabRootPath).GetFiles("*.prefab", SearchOption.TopDirectoryOnly));
-
-            var count = allFiles.Count;
-            var index = 0;
-
-            foreach (var file in allFiles)
-            {
-                var assetPath = file.FullName.Replace("\\", "/").Replace(Application.dataPath, "Assets");
-                var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(assetPath);
-
-                var texts = prefab.GetComponentsInChildren<Text>(true);
-                foreach (var text in texts)
-                {
-                    if (text.font != null)
-                    {
-                        if (text.font.name == FontUtility.preferred.name)
-                        {
-                            var fontSwitch = text.gameObject.AddMissingComponent<FontSwitch>();
-                            fontSwitch.fontType = FontSwitch.FontType.Preferred;
-                            text.font = null;
-                        }
-                        else if (text.font.name == FontUtility.secondary.name)
-                        {
-                            var fontSwitch = text.gameObject.AddMissingComponent<FontSwitch>();
-                            fontSwitch.fontType = FontSwitch.FontType.Secondary;
-                            text.font = null;
-                        }
-                    }
-                }
-
-                index++;
-                EditorUtility.SetDirty(prefab);
-                EditorUtility.DisplayProgressBar("妫�娴嬪拰鏇挎崲FontSwitch", StringUtility.Contact("姝e湪鏇挎崲:", prefab.name), (float)index / count);
-            }
-
-            AssetDatabase.SaveAssets();
-            AssetDatabase.Refresh();
-
-            EditorUtility.ClearProgressBar();
-        }
-        catch (Exception ex)
-        {
-            Debug.Log(ex);
-        }
-
-    }
-
-    static List<string> chineseCharactorErrors = new List<string>();
+    static string windowRootPath = Application.dataPath + "/ResourcesOut/UI/Window";
+    static string windowRootPath2 = Application.dataPath + "/ResourcesOut/UI/PriorityWindow";
+    static string prefabRootPath = Application.dataPath + "/ResourcesOut/UI/Prefab";
+
+    [MenuItem("绋嬪簭/妫�娴嬪拰娣诲姞FontSwitch")]
+    public static void CheckAndReplaceFontSwitch()
+    {
+        try
+        {
+            var allFiles = new List<FileInfo>();
+            allFiles.AddRange(new DirectoryInfo(windowRootPath).GetFiles("*.prefab", SearchOption.TopDirectoryOnly));
+            allFiles.AddRange(new DirectoryInfo(windowRootPath2).GetFiles("*.prefab", SearchOption.TopDirectoryOnly));
+            allFiles.AddRange(new DirectoryInfo(prefabRootPath).GetFiles("*.prefab", SearchOption.TopDirectoryOnly));
+
+            var count = allFiles.Count;
+            var index = 0;
+
+            foreach (var file in allFiles)
+            {
+                var assetPath = file.FullName.Replace("\\", "/").Replace(Application.dataPath, "Assets");
+                var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(assetPath);
+
+                var texts = prefab.GetComponentsInChildren<Text>(true);
+                foreach (var text in texts)
+                {
+                    if (text.font != null)
+                    {
+                        if (text.font.name == FontUtility.preferred.name)
+                        {
+                            var fontSwitch = text.gameObject.AddMissingComponent<FontSwitch>();
+                            fontSwitch.fontType = FontSwitch.FontType.Preferred;
+                            text.font = null;
+                        }
+                        else if (text.font.name == FontUtility.secondary.name)
+                        {
+                            var fontSwitch = text.gameObject.AddMissingComponent<FontSwitch>();
+                            fontSwitch.fontType = FontSwitch.FontType.Secondary;
+                            text.font = null;
+                        }
+                    }
+                }
+
+                index++;
+                EditorUtility.SetDirty(prefab);
+                EditorUtility.DisplayProgressBar("妫�娴嬪拰鏇挎崲FontSwitch", StringUtility.Contact("姝e湪鏇挎崲:", prefab.name), (float)index / count);
+            }
+
+            AssetDatabase.SaveAssets();
+            AssetDatabase.Refresh();
+
+            EditorUtility.ClearProgressBar();
+        }
+        catch (Exception ex)
+        {
+            Debug.Log(ex);
+        }
+
+    }
+
+    static List<string> chineseCharactorErrors = new List<string>();
     [MenuItem("绋嬪簭/鏌ユ壘涓枃瀛�")]
-    public static void FindChineseCharacter()
-    {
-        try
-        {
-            chineseCharactorErrors.Clear();
-            chineseCharactorErrors.Add(StringUtility.Contact("搴忓彿", "\t", "棰勭疆浣�", "\t", "缁勪欢鍚�", "\t", "鍐呭", "\t", "鏄惁闇�瑕佹暣鏀�"));
-            var allFiles = new List<FileInfo>();
-            allFiles.AddRange(new DirectoryInfo(windowRootPath).GetFiles("*.prefab", SearchOption.TopDirectoryOnly));
-            allFiles.AddRange(new DirectoryInfo(windowRootPath2).GetFiles("*.prefab", SearchOption.TopDirectoryOnly));
-            allFiles.AddRange(new DirectoryInfo(prefabRootPath).GetFiles("*.prefab", SearchOption.TopDirectoryOnly));
-
-            var inspectorModeInfo = typeof(SerializedObject).GetProperty("inspectorMode", BindingFlags.NonPublic | BindingFlags.Instance);
-
-            var count = allFiles.Count;
-            var index = 0;
-
-            foreach (var file in allFiles)
-            {
-                var assetPath = file.FullName.Replace("\\", "/").Replace(Application.dataPath, "Assets");
-                var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(assetPath);
-                var prefabText = File.ReadAllText(file.FullName);
-                var texts = prefab.GetComponentsInChildren<Text>(true);
-
-                foreach (var text in texts)
-                {
-                    if (ContainChineseCharacter(text.text))
-                    {
-                        var content = text.text.Replace("\t", "").Replace("\r\n", "").Replace("\n", "").Replace("\r", "");
-
-                        var serializedObject = new SerializedObject(text);
-                        inspectorModeInfo.SetValue(serializedObject, InspectorMode.Debug, null);
-                        var localIdProp = serializedObject.FindProperty("m_LocalIdentfierInFile");
-                        var fieldId = localIdProp.longValue;
-
-                        var serialized = ContainGuid(prefabText, fieldId.ToString());
-                        var isFromLanguage = text is TextEx && (text as TextEx).isKey;
-
-                        chineseCharactorErrors.Add(StringUtility.Contact(chineseCharactorErrors.Count, "\t", prefab.name, "\t", text.name, "\t", content, "\t", !serialized && !isFromLanguage));
-                        Debug.LogFormat("UI棰勭疆浣揟ext閰嶇疆閿欒-->棰勭疆浣撴槸锛歿0},缁勪欢鍚嶏細{1},鍐呭鏄細{2}", prefab, text.name, text.text);
-                    }
-                }
-
-                index++;
-                EditorUtility.SetDirty(prefab);
-                EditorUtility.DisplayProgressBar("鏌ユ壘涓枃瀛�", StringUtility.Contact("姝e湪妫�鏌�:", prefab.name), (float)index / count);
-            }
-
-            AssetDatabase.SaveAssets();
-            AssetDatabase.Refresh();
-
-            EditorUtility.ClearProgressBar();
-        }
-        catch (Exception ex)
-        {
-            Debug.Log(ex);
-        }
-        finally
-        {
-            File.WriteAllLines(Application.dataPath + "/UIPrefabChineseCharacterError.txt", chineseCharactorErrors.ToArray());
-        }
-
+    public static void FindChineseCharacter()
+    {
+        try
+        {
+            chineseCharactorErrors.Clear();
+            chineseCharactorErrors.Add(StringUtility.Contact("搴忓彿", "\t", "棰勭疆浣�", "\t", "缁勪欢鍚�", "\t", "鍐呭", "\t", "鏄惁闇�瑕佹暣鏀�"));
+            var allFiles = new List<FileInfo>();
+            allFiles.AddRange(new DirectoryInfo(windowRootPath).GetFiles("*.prefab", SearchOption.TopDirectoryOnly));
+            allFiles.AddRange(new DirectoryInfo(windowRootPath2).GetFiles("*.prefab", SearchOption.TopDirectoryOnly));
+            allFiles.AddRange(new DirectoryInfo(prefabRootPath).GetFiles("*.prefab", SearchOption.TopDirectoryOnly));
+
+            var inspectorModeInfo = typeof(SerializedObject).GetProperty("inspectorMode", BindingFlags.NonPublic | BindingFlags.Instance);
+
+            var count = allFiles.Count;
+            var index = 0;
+
+            foreach (var file in allFiles)
+            {
+                var assetPath = file.FullName.Replace("\\", "/").Replace(Application.dataPath, "Assets");
+                var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(assetPath);
+                var prefabText = File.ReadAllText(file.FullName);
+                var texts = prefab.GetComponentsInChildren<Text>(true);
+
+                foreach (var text in texts)
+                {
+                    if (ContainChineseCharacter(text.text))
+                    {
+                        var content = text.text.Replace("\t", "").Replace("\r\n", "").Replace("\n", "").Replace("\r", "");
+
+                        var serializedObject = new SerializedObject(text);
+                        inspectorModeInfo.SetValue(serializedObject, InspectorMode.Debug, null);
+                        var localIdProp = serializedObject.FindProperty("m_LocalIdentfierInFile");
+                        var fieldId = localIdProp.longValue;
+
+                        var serialized = ContainGuid(prefabText, fieldId.ToString());
+                        var isFromLanguage = text is TextEx && (text as TextEx).isKey;
+
+                        chineseCharactorErrors.Add(StringUtility.Contact(chineseCharactorErrors.Count, "\t", prefab.name, "\t", text.name, "\t", content, "\t", !serialized && !isFromLanguage));
+                        Debug.LogFormat("UI棰勭疆浣揟ext閰嶇疆閿欒-->棰勭疆浣撴槸锛歿0},缁勪欢鍚嶏細{1},鍐呭鏄細{2}", prefab, text.name, text.text);
+                    }
+                }
+
+                index++;
+                EditorUtility.SetDirty(prefab);
+                EditorUtility.DisplayProgressBar("鏌ユ壘涓枃瀛�", StringUtility.Contact("姝e湪妫�鏌�:", prefab.name), (float)index / count);
+            }
+
+            AssetDatabase.SaveAssets();
+            AssetDatabase.Refresh();
+
+            EditorUtility.ClearProgressBar();
+        }
+        catch (Exception ex)
+        {
+            Debug.Log(ex);
+        }
+        finally
+        {
+            File.WriteAllLines(Application.dataPath + "/UIPrefabChineseCharacterError.txt", chineseCharactorErrors.ToArray());
+        }
+
     }
 
     static string chineseCharacterPattern = "[\u4e00-\u9fa5]{2,4}";
-    static bool ContainChineseCharacter(string _input)
-    {
-        if (string.IsNullOrEmpty(_input))
-        {
-            return false;
-        }
-        else
-        {
-            return Regex.IsMatch(_input, chineseCharacterPattern);
-        }
+    static bool ContainChineseCharacter(string _input)
+    {
+        if (string.IsNullOrEmpty(_input))
+        {
+            return false;
+        }
+        else
+        {
+            return Regex.IsMatch(_input, chineseCharacterPattern);
+        }
     }
 
-    static bool ContainGuid(string _serializedFile, string _guid)
-    {
-        if (string.IsNullOrEmpty(_serializedFile))
-        {
-            return false;
-        }
-        else
-        {
-
-            var matches = Regex.Matches(_serializedFile, _guid);
-            return matches.Count > 2;
-        }
+    static bool ContainGuid(string _serializedFile, string _guid)
+    {
+        if (string.IsNullOrEmpty(_serializedFile))
+        {
+            return false;
+        }
+        else
+        {
+
+            var matches = Regex.Matches(_serializedFile, _guid);
+            return matches.Count > 2;
+        }
     }
 
 

--
Gitblit v1.8.0