예제 #1
0
        public static void Init()
        {
            ReferencesResultWindow window = (ReferencesResultWindow)EditorWindow.GetWindow(typeof(ReferencesResultWindow));

            window.titleContent = new GUIContent("Find References");
            window.Show();
        }
예제 #2
0
        static void Init()
        {
            GameObject a = Selection.activeGameObject;

            if (a != null)
            {
                var references = a.GetComponentsInChildren <IReferenceable>().Select(r => r.References).ToList();

                references.ForEach(i => Debug.Log(i.referencedByDsgMems.Count));

                var dsgMemReferences = references.SelectMany(r => r.referencedByDsgMems);
                var scriptReferences = references.SelectMany(r => r.referencedByNodes);

                var persoBehaviours  = MapLoader.Loader.persos.Select(p => p.Gao.GetComponent <PersoBehaviour>());
                var scriptComponents = MapLoader.Loader.scriptComponents.OfType <ScriptComponent>();

                var dsgMemPersos = persoBehaviours.Where(p => dsgMemReferences.Contains(p.perso?.brain?.mind?.dsgMem)).Select(p => p.perso);
                var scriptList   = scriptComponents.Where(p => p?.script?.scriptNodes?.Intersect(scriptReferences).Any() ?? false);

                ReferencesResultWindow.Init();

                ReferencesResultWindow window = (ReferencesResultWindow)EditorWindow.GetWindow(typeof(ReferencesResultWindow));
                window.hasResults          = true;
                window.searchTarget        = a;
                window.dsgMemPersosResults = dsgMemPersos.ToList();
                window.scriptResults       = scriptList.ToList();
            }
        }