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/ImageMissTool.cs | 294 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 147 insertions(+), 147 deletions(-)
diff --git a/Assets/Editor/Tool/ImageMissTool.cs b/Assets/Editor/Tool/ImageMissTool.cs
index f02b9af..149db2e 100644
--- a/Assets/Editor/Tool/ImageMissTool.cs
+++ b/Assets/Editor/Tool/ImageMissTool.cs
@@ -1,166 +1,166 @@
-锘縰sing Snxxz.UI;
+锘縰sing Snxxz.UI;
using System.Collections;
using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using System.Text.RegularExpressions;
-using UnityEditor;
+using System.IO;
+using System.Reflection;
+using System.Text.RegularExpressions;
+using UnityEditor;
using UnityEngine;
-using UnityEngine.UI;
-
-public static class ImageMissTool
+using UnityEngine.UI;
+
+public static class ImageMissTool
{
static Dictionary<GameObject, List<MissImage>> missImageDict = new Dictionary<GameObject, List<MissImage>>();
static Vector2 m_ScrollPosition = Vector2.zero;
static bool viewserialized = true;
- public static void OnGUI()
- {
- ToolsHelper.DisplayFolderPath();
-
- viewserialized = GUILayout.Toggle(viewserialized, "鍏ㄩ儴");
-
- if (GUILayout.Button("鏌ユ壘"))
- {
- missImageDict.Clear();
- if (ToolsHelper.folderPath.Equals(string.Empty))
- {
- return;
- }
- StartFind();
- }
-
- m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition);
- foreach (var _object in missImageDict.Keys)
- {
- bool allserialized = true;
- var _list = missImageDict[_object];
- for (int i = 0; i < _list.Count; i++)
- {
- if (!_list[i].serialized)
- {
- allserialized = false;
- break;
- }
- }
-
- if (allserialized && !viewserialized)
- {
- continue;
- }
-
- GUILayout.BeginHorizontal();
- EditorGUILayout.ObjectField(_object, typeof(UnityEngine.Object), false);
- GUILayout.FlexibleSpace();
- GUILayout.EndHorizontal();
-
- for (int i = 0; i < _list.Count; i++)
- {
- if (_list[i].serialized && !viewserialized)
- {
- continue;
- }
- GUILayout.BeginHorizontal();
- GUILayout.Label(_list[i].path);
- if (_list[i].path != string.Empty && GUILayout.Button("Goto"))
- {
- var _go = GameObject.Find(_list[i].path);
- if (_go != null)
- {
- Selection.activeGameObject = _go;
- }
- }
- EditorGUILayout.Toggle(_list[i].serialized);
- GUILayout.FlexibleSpace();
- GUILayout.EndHorizontal();
- }
- GUILayout.Space(5);
- }
- GUILayout.EndScrollView();
+ public static void OnGUI()
+ {
+ ToolsHelper.DisplayFolderPath();
+
+ viewserialized = GUILayout.Toggle(viewserialized, "鍏ㄩ儴");
+
+ if (GUILayout.Button("鏌ユ壘"))
+ {
+ missImageDict.Clear();
+ if (ToolsHelper.folderPath.Equals(string.Empty))
+ {
+ return;
+ }
+ StartFind();
+ }
+
+ m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition);
+ foreach (var _object in missImageDict.Keys)
+ {
+ bool allserialized = true;
+ var _list = missImageDict[_object];
+ for (int i = 0; i < _list.Count; i++)
+ {
+ if (!_list[i].serialized)
+ {
+ allserialized = false;
+ break;
+ }
+ }
+
+ if (allserialized && !viewserialized)
+ {
+ continue;
+ }
+
+ GUILayout.BeginHorizontal();
+ EditorGUILayout.ObjectField(_object, typeof(UnityEngine.Object), false);
+ GUILayout.FlexibleSpace();
+ GUILayout.EndHorizontal();
+
+ for (int i = 0; i < _list.Count; i++)
+ {
+ if (_list[i].serialized && !viewserialized)
+ {
+ continue;
+ }
+ GUILayout.BeginHorizontal();
+ GUILayout.Label(_list[i].path);
+ if (_list[i].path != string.Empty && GUILayout.Button("Goto"))
+ {
+ var _go = GameObject.Find(_list[i].path);
+ if (_go != null)
+ {
+ Selection.activeGameObject = _go;
+ }
+ }
+ EditorGUILayout.Toggle(_list[i].serialized);
+ GUILayout.FlexibleSpace();
+ GUILayout.EndHorizontal();
+ }
+ GUILayout.Space(5);
+ }
+ GUILayout.EndScrollView();
}
- static void StartFind()
- {
- string[] _files = Directory.GetFiles(ToolsHelper.folderPath, "*.prefab", SearchOption.AllDirectories);
- if (_files == null || _files.Length == 0)
- {
- return;
- }
- var _index = 0;
- var inspectorModeInfo = typeof(SerializedObject).GetProperty("inspectorMode", BindingFlags.NonPublic | BindingFlags.Instance);
- EditorApplication.update = delegate ()
- {
- var _file = _files[_index];
- var _prefab = AssetDatabase.LoadAssetAtPath<GameObject>(ToolsHelper.GetRelativeAssetsPath(_file));
- if (_prefab != null)
- {
- var all_text = File.ReadAllText(_file);
- var images = _prefab.GetComponentsInChildren<Image>(true);
- if (images != null && images.Length > 0)
- {
- for (int i = 0; i < images.Length; i++)
- {
- var serializedObject = new SerializedObject(images[i]);
- inspectorModeInfo.SetValue(serializedObject, InspectorMode.Debug, null);
- var localIdProp = serializedObject.FindProperty("m_LocalIdentfierInFile");
- var fieldId = localIdProp.longValue;
-
- bool isSerialized = ContainGuid(all_text, fieldId.ToString());
-
- if (images[i].sprite == null && images[i].GetComponent<Mask>() == null)
- {
- if (!missImageDict.ContainsKey(_prefab))
- {
- missImageDict.Add(_prefab, new List<MissImage>());
- }
- missImageDict[_prefab].Add(new MissImage()
- {
- path = GetParentName(images[i].transform),
- serialized = isSerialized,
- });
- }
- }
- }
- }
- bool _isCancel = EditorUtility.DisplayCancelableProgressBar("鎻愬彇鐣岄潰涓㈠け鍥剧墖鐨勭粍浠�",
- StringUtility.Contact(_index, "/", _files.Length), (float)_index / _files.Length);
- _index++;
- if (_isCancel || _index >= _files.Length)
- {
- EditorUtility.ClearProgressBar();
- EditorApplication.update = null;
- _index = 0;
- }
- };
+ static void StartFind()
+ {
+ string[] _files = Directory.GetFiles(ToolsHelper.folderPath, "*.prefab", SearchOption.AllDirectories);
+ if (_files == null || _files.Length == 0)
+ {
+ return;
+ }
+ var _index = 0;
+ var inspectorModeInfo = typeof(SerializedObject).GetProperty("inspectorMode", BindingFlags.NonPublic | BindingFlags.Instance);
+ EditorApplication.update = delegate ()
+ {
+ var _file = _files[_index];
+ var _prefab = AssetDatabase.LoadAssetAtPath<GameObject>(ToolsHelper.GetRelativeAssetsPath(_file));
+ if (_prefab != null)
+ {
+ var all_text = File.ReadAllText(_file);
+ var images = _prefab.GetComponentsInChildren<Image>(true);
+ if (images != null && images.Length > 0)
+ {
+ for (int i = 0; i < images.Length; i++)
+ {
+ var serializedObject = new SerializedObject(images[i]);
+ inspectorModeInfo.SetValue(serializedObject, InspectorMode.Debug, null);
+ var localIdProp = serializedObject.FindProperty("m_LocalIdentfierInFile");
+ var fieldId = localIdProp.longValue;
+
+ bool isSerialized = ContainGuid(all_text, fieldId.ToString());
+
+ if (images[i].sprite == null && images[i].GetComponent<Mask>() == null)
+ {
+ if (!missImageDict.ContainsKey(_prefab))
+ {
+ missImageDict.Add(_prefab, new List<MissImage>());
+ }
+ missImageDict[_prefab].Add(new MissImage()
+ {
+ path = GetParentName(images[i].transform),
+ serialized = isSerialized,
+ });
+ }
+ }
+ }
+ }
+ bool _isCancel = EditorUtility.DisplayCancelableProgressBar("鎻愬彇鐣岄潰涓㈠け鍥剧墖鐨勭粍浠�",
+ StringUtility.Contact(_index, "/", _files.Length), (float)_index / _files.Length);
+ _index++;
+ if (_isCancel || _index >= _files.Length)
+ {
+ EditorUtility.ClearProgressBar();
+ EditorApplication.update = null;
+ _index = 0;
+ }
+ };
}
- static string GetParentName(Transform _parent)
- {
- if (_parent.parent != null && _parent.GetComponent<WindowInfo>() == null)
- {
- return StringUtility.Contact(GetParentName(_parent.parent), "/", _parent.name);
- }
- return _parent.name;
+ static string GetParentName(Transform _parent)
+ {
+ if (_parent.parent != null && _parent.GetComponent<WindowInfo>() == null)
+ {
+ return StringUtility.Contact(GetParentName(_parent.parent), "/", _parent.name);
+ }
+ return _parent.name;
}
- 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;
+ }
}
- public class MissImage
- {
- public string path;
- public bool serialized;
+ public class MissImage
+ {
+ public string path;
+ public bool serialized;
}
}
--
Gitblit v1.8.0