コード例 #1
0
    void OnHierarchyChange()
    {
        ReferenceExplorerData.RestoreAllData();

        CallbackData.UpdateSenderRecieverlist();
        CallbackData.UpdateCallbacklist(isSelectedObject, searchText);
    }
コード例 #2
0
    void OnEnable()
    {
        codeSearch = new CodeSearch();

        ReferenceExplorerData.RestoreAllData();

        CallbackData.UpdateSenderRecieverlist();
        CallbackData.UpdateCallbacklist(isSelectedObject, searchText);
    }
コード例 #3
0
    private static void Collection(List <ReferenceInfomation> refList, List <Type> refTypes, bool isOnlyComponent)
    {
        List <Type> allTypes = new List <Type>();

        foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
        {
            if (ignoreAssemblys.Any(item => assembly.ManifestModule.ScopeName.IndexOf(item) != -1))
            {
                continue;
            }

            var types = Assembly.Load(assembly.GetName()).GetExportedTypes();
            allTypes.AddRange(types);
        }

        var allMonoScript = new List <MonoScript>();


        allMonoScript.AddRange(ReferenceExplorerData.allComponents
                               .Where(item => null != item as MonoBehaviour)
                               .Select(item => MonoScript.FromMonoBehaviour((MonoBehaviour)item))
                               .ToList());
        allMonoScript.AddRange(ReferenceExplorerData.animatorBehaviourList
                               .Where(item => item != null)
                               .Select(item => MonoScript.FromScriptableObject(item.behaviour)));
        var allUniqueMonoscript = allMonoScript.Distinct();


        EditorUtility.DisplayProgressBar("Export Comonent Graph", "Collection All Callbacks", 0);

        CallbackData.UpdateSenderRecieverlist();
        CallbackData.UpdateCallbacklist(false, null);



        int currentTypeCount = 0;
        int max = allUniqueMonoscript.Count();

        foreach (var monoscript in allUniqueMonoscript)
        {
            var ignoreNamespace = new Dictionary <string, bool>();

            currentTypeCount++;
            EditorUtility.DisplayProgressBar("Export Comonent Graph", "Lists reference class" + monoscript.name, (float)(currentTypeCount) / max);

            foreach (var type in allTypes)
            {
                if (ignoreTypes.Contains(type))
                {
                    continue;
                }

                if (isOnlyComponent == true && type.IsSubclassOf(typeof(Component)) == false)
                {
                    continue;
                }

                // ネームスペースでスキップ
                if (type.Namespace != null)
                {
                    if (ignoreNamespace.ContainsKey(type.Namespace))
                    {
                        if (ignoreNamespace[type.Namespace] == false)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        string namespacepattern = string.Format("{0}+[\\.;\\S]", type.Namespace);
                        if (Regex.IsMatch(monoscript.text, namespacepattern) == false)
                        {
                            ignoreNamespace.Add(type.Namespace, false);
                            continue;
                        }
                        else
                        {
                            ignoreNamespace.Add(type.Namespace, true);
                        }
                    }
                }



                string pattern = string.Format("[\\.\\s\\<)]+{0}[\\.\\s\\)>]", type.Name);

                if (monoscript.GetClass() == type ||
                    ignoreTypes.Contains(monoscript.GetClass()))
                {
                    continue;
                }

                var text = Regex.Replace(monoscript.text, "//.*\\n", "");
                text = text.Replace("\\n", " ");
                text = Regex.Replace(text, "/\\*.*\\*/", " ");

                var match = Regex.Match(text, pattern);

                if (match.Success == false)
                {
                    continue;
                }

                refList.Add(new ReferenceInfomation()
                {
                    from = monoscript.GetClass(),
                    to   = type
                });

                refTypes.Add(monoscript.GetClass());
                refTypes.Add(type);
            }
        }
    }