Exemple #1
0
        public static void OpenSpotlightAll()
        {
            SpotlightWindow.FillActionData(true);
            SpotlightWindow.win = EditorWindow.CreateInstance <SpotlightWindow>();

            int w = Screen.currentResolution.width;
            int h = Screen.currentResolution.height;

            if (h > w)
            {
                // OnEnd Display roation
                w = Screen.currentResolution.height;
                h = Screen.currentResolution.width;
            }

            SpotlightWindow.win.position = new Rect(w / 2 - WIDTH_WINDOW * 0.5f, h / 2 - HEIGHT_WINDOW * 0.5f, WIDTH_WINDOW, HEIGHT_WINDOW);
            SpotlightWindow.background   = GrabScreen(win.position);

            SpotlightWindow.Blur b = new SpotlightWindow.Blur(WIDTH_WINDOW, HEIGHT_WINDOW, 16);
            SpotlightWindow.background = b.BlurTexture(SpotlightWindow.background);

            SpotlightWindow.win.ShowPopup();
            SpotlightWindow.win.Focus();
            SpotlightWindow.win.Init();
        }
Exemple #2
0
        //-----------------------------------------------------------------------------

        private static void FillActionData(bool includeAssetdatabase = false)
        {
            if (SpotlightWindow.actionData.Count == 0)
            {
                SpotlightWindow.actionData.Clear();
                SpotlightWindow.AddDefaultItems();
                SpotlightWindow.GetMenuItems();
                SpotlightWindow.GetComponentsItems();
                if (includeAssetdatabase)
                {
                    SpotlightWindow.GetAssetItems(); // this is fast but the search ends up beeing slow as hell
                }
            }
        }
Exemple #3
0
        //-----------------------------------------------------------------------------

        private static void GetMenuItems()
        {
            List <Type> classes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(s => s.GetTypes())
                                  .Where(t =>
                                         t.Assembly.FullName.Contains("Assembly-CSharp-Editor")
                                         ).ToList();

            for (int i = 0; i < classes.Count; i++)
            {
                List <MethodInfo> methods = classes[i].GetMethods(BindingFlags.CreateInstance | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static)
                                            .Where(m => SpotlightWindow.GetCustomAttribute <MenuItem>(m) != null).ToList();

                foreach (var method in methods)
                {
                    var attr = SpotlightWindow.GetCustomAttribute <MenuItem>(method);
                    if (!attr.menuItem.StartsWith("CONTEXT") && !SpotlightWindow.actionData.ContainsKey(attr.menuItem))
                    {
                        SpotlightWindow.actionData.Add(attr.menuItem, () => EditorApplication.ExecuteMenuItem(attr.menuItem));
                    }
                }
            }
        }