Beispiel #1
0
        protected virtual void  OnEnable()
        {
            Metrics.UseTool(17);             // NGSyncFolders

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            Utility.RegisterWindow(this);
            Utility.LoadEditorPref(this, NGEditorPrefs.GetPerProjectPrefix());
            Utility.RestoreIcon(this, NGSyncFoldersWindow.TitleColor);

            this.slavesList = new ReorderableList(null, typeof(Project), true, true, this.showSlaves, false);
            this.slavesList.drawHeaderCallback  = this.OnDrawHeaderSlaves;
            this.slavesList.elementHeight       = this.showSlaves == true ? NGSyncFoldersWindow.SlaveHeight : 0F;
            this.slavesList.drawElementCallback = this.OnDrawSlave;
            this.slavesList.onAddCallback       = this.OnAddSlave;

            this.filtersList = new ReorderableList(null, typeof(string), true, true, this.showFilters, false);
            this.filtersList.drawHeaderCallback  = this.OnDrawHeaderFilters;
            this.filtersList.elementHeight       = this.showFilters == true ? NGSyncFoldersWindow.FilterHeight : 0F;
            this.filtersList.drawElementCallback = this.OnDrawFilter;
            this.filtersList.onAddCallback       = this.OnAddFilter;

            //this.profile.master.WatchFileChanged += this.ReplicateOnSlaves;

            this.minSize        = new Vector2(370F, 200F);
            this.wantsMouseMove = true;

            HQ.SettingsChanged += this.Repaint;
            Utility.RegisterIntervalCallback(this.Repaint, 250);
            Undo.undoRedoPerformed += this.RepaintAndClearCaches;
        }
        protected virtual void  OnEnable()
        {
            Utility.RestoreIcon(this, NGShaderFinderWindow.TitleColor);

            Metrics.UseTool(8);             // NGShaderFinder

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            Undo.undoRedoPerformed += this.Repaint;
        }
Beispiel #3
0
        protected virtual void  OnEnable()
        {
            Utility.RestoreIcon(this, NGScenesWindow.TitleColor);

            Metrics.UseTool(10);             // NGScenes

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            if (NGScenesWindow.allScenes == null)
            {
                string[] allScenes = AssetDatabase.GetAllAssetPaths();

                list.Clear();
                for (int i = 0; i < allScenes.Length; i++)
                {
                    if (allScenes[i].EndsWith(".unity", StringComparison.OrdinalIgnoreCase) == true)
                    {
                        list.Add(new Scene(allScenes[i]));
                    }
                }

                list.Sort((a, b) => a.name.CompareTo(b.name));
                NGScenesWindow.allScenes = list.ToArray();
            }

            this.allListDrawer            = new GUIListDrawer <Scene>();
            this.allListDrawer.array      = NGScenesWindow.allScenes;
            this.allListDrawer.ElementGUI = this.DrawSceneRow;

            this.recentListDrawer            = new GUIListDrawer <Scene>();
            this.recentListDrawer.ElementGUI = this.DrawSceneRow;

            this.UpdateRecentScenes();

            this.buildListDrawer = new GUIListDrawer <EditorBuildSettingsScene>();
            this.buildListDrawer.drawBackgroundColor = true;
            this.buildListDrawer.handleSelection     = true;
            this.buildListDrawer.handleDrag          = true;
            this.buildListDrawer.ElementGUI          = this.DrawBuildSceneRow;
            this.buildListDrawer.PostGUI             = this.DropScene;
            this.buildListDrawer.DeleteSelection     = this.DeleteBuildScenes;
            this.buildListDrawer.ArrayReordered      = (l) => EditorBuildSettings.scenes = l.array;

            NGEditorApplication.ChangeScene += this.UpdateRecentScenes;

            this.wantsMouseMove = true;
        }
Beispiel #4
0
        protected virtual void  OnEnable()
        {
            Utility.RestoreIcon(this, NGHubWindow.TitleColor);

            Metrics.UseTool(4);             // NGHub

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            if (this.initialized == true || HQ.Settings == null)
            {
                return;
            }

            try
            {
                this.titleContent.text = NGHubWindow.Title;
                this.minSize           = Vector2.zero;
                this.components        = new List <HubComponent>();
                this.RestoreComponents();

                if (this.initOnce == false)
                {
                    this.backgroundColor = (Color)Utility.LoadEditorPref(this.backgroundColor, typeof(Color), NGHubWindow.BackgroundColorKeyPref);
                }

                HQ.SettingsChanged     += this.OnSettingsChanged;
                Undo.undoRedoPerformed += this.RestoreComponents;

                // Force repaint to hide part.
                EditorApplication.delayCall += EditorApplication.delayCall += this.Repaint;

                NGDiagnostic.DelayDiagnostic(this.Diagnose);

                if (this.dockedAsMenu == true)
                {
                    this.SetDockMode(true);
                }

                this.initialized = true;
            }
            catch (Exception ex)
            {
                this.errorPopup.exception = ex;
            }

            this.initOnce = true;
        }
Beispiel #5
0
        protected virtual void  OnEnable()
        {
            Metrics.UseTool(14);             // NGMissingScriptRecovery

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            this.wantsMouseMove = true;

            if (this.tab == Tab.Recovery)
            {
                this.tab = Tab.Selection;
            }

            Selection.selectionChanged += this.Repaint;

            Utility.LoadEditorPref(this);
            Utility.RestoreIcon(this, NGMissingScriptRecoveryWindow.TitleColor);
        }
        public static void      ToggleFullscreen(int f)
        {
            Metrics.UseTool(22);             // NGFullscreenBindings

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            if (NGFullscreenBindingsWindow.DetectDiff() == true)
            {
                return;
            }

            if (HQ.Settings == null || f > HQ.Settings.Get <FullscreenBindingsSettings>().bindings.Length)
            {
                EditorUtility.DisplayDialog(Constants.PackageTitle, "The binding is invalid. Please regenerate it.", "OK");
                NGFullscreenBindingsWindow.Open();
                return;
            }

            Type type = NGFullscreenBindingsWindow.GetType(HQ.Settings.Get <FullscreenBindingsSettings>().bindings[f - 1].type);

            if (type == null)
            {
                EditorUtility.DisplayDialog(Constants.PackageTitle, "The binding has been assigned an invalid Window.", "OK");
                NGFullscreenBindingsWindow.Open();
                return;
            }

            InternalNGDebug.VerboseLogFormat("Toggling fullscreen window \"{0}\".", type);

            EditorWindow[] windows = Resources.FindObjectsOfTypeAll <EditorWindow>();

            for (int i = 0; i < windows.Length; i++)
            {
                if (windows[i].GetType() != type && windows[i].maximized == true)
                {
                    windows[i].maximized = false;
                    break;
                }
            }

            EditorWindow window = EditorWindow.GetWindow(type);

            EditorApplication.delayCall += () => window.maximized = !window.maximized;
        }
Beispiel #7
0
        protected virtual void  OnEnable()
        {
            Utility.RestoreIcon(this, NGRenamerWindow.TitleColor);

            Metrics.UseTool(11);             // NGRenamer

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            foreach (Type type in Utility.EachNGTSubClassesOf(typeof(TextFilter)))
            {
                this.filters.Add(Activator.CreateInstance(type, new object[] { this }) as TextFilter);
                Utility.LoadEditorPref(this.filters[this.filters.Count - 1], NGEditorPrefs.GetPerProjectPrefix());
            }

            this.filters.Sort((a, b) => b.priority - a.priority);

            Selection.selectionChanged += this.UpdateSelection;
            Undo.undoRedoPerformed     += this.Repaint;
        }
        protected virtual void  OnEnable()
        {
            Utility.RegisterWindow(this);
            Utility.RestoreIcon(this, NGNavSelectionWindow.TitleColor);

            Metrics.UseTool(9);             // NGNavSelection

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            this.minSize = new Vector2(140F, Constants.SingleLineHeight);

            this.listDrawer             = new GUIListDrawer <AssetsSelection>();
            this.listDrawer.list        = NGNavSelectionWindow.historic;
            this.listDrawer.ElementGUI  = this.DrawSelection;
            this.listDrawer.reverseList = true;

            HQ.SettingsChanged += this.Repaint;
            NGNavSelectionWindow.SelectionChanged += this.Repaint;
        }
Beispiel #9
0
        protected virtual void  OnEnable()
        {
            Utility.RestoreIcon(this, NGComponentsInspectorWindow.TitleColor);

            Metrics.UseTool(13);             // NGComponentsInspector

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            for (int i = 0; i < this.history.Count; i++)
            {
                if (this.history[i].component != null)
                {
                    this.history[i].Init(this.history[i].component);
                }
                else
                {
                    this.history.RemoveAt(i--);
                }
            }

            Undo.undoRedoPerformed += this.Repaint;
        }
Beispiel #10
0
        protected virtual void  OnEnable()
        {
            Utility.RestoreIcon(this, NGPrefsWindow.TitleColor);

            Metrics.UseTool(6);             // NGPrefs

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            this.filteredIndexes = new List <int>();

            this.prefManagers     = Utility.CreateNGTInstancesOf <PrefsManager>();
            this.prefManagerNames = new string[this.prefManagers.Length];

            for (int i = 0; i < this.prefManagers.Length; i++)
            {
                this.prefManagerNames[i] = Utility.NicifyVariableName(this.prefManagers[i].GetType().Name);
            }

            if (this.searchKeywords != null)
            {
                this.searchPatterns = Utility.SplitKeywords(this.searchKeywords, ' ');
            }

            if (this.currentManager >= this.prefManagers.Length)
            {
                this.currentManager = this.prefManagers.Length - 1;
            }

            if (this.currentManager >= 0)
            {
                this.LoadCurrentPreferences();
            }

            this.minSize = new Vector2(this.minSize.x, 100F);

            this.resetContent = new GUIContent("↺", LC.G("NGPrefs_Reset"));
            this.applyContent = new GUIContent("↣", LC.G("NGPrefs_Apply"));
        }
Beispiel #11
0
        protected virtual void  OnEnable()
        {
            Utility.RestoreIcon(this, NGFavWindow.TitleColor);

            Metrics.UseTool(3);             // NGFav

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            this.wantsMouseMove = true;

            this.minSize = new Vector2(this.minSize.x, 0F);

            this.horizontalScrolls = new List <HorizontalScrollbar>();
            this.delayToDelete     = -1;

            this.list = new ReorderableList(null, typeof(GameObject), true, false, false, false);
            this.list.showDefaultBackground = false;
            this.list.headerHeight          = 0F;
            this.list.footerHeight          = 0F;
            this.list.drawElementCallback   = this.DrawElement;
            this.list.onReorderCallback     = (ReorderableList list) => { HQ.InvalidateSettings(); };

            if (this.backgroundColor.a == 0F)
            {
                this.backgroundColor = (Color)Utility.LoadEditorPref(this.backgroundColor, typeof(Color), "NGFav.backgroundColor");
            }

            NGDiagnostic.DelayDiagnostic(this.Diagnose);

            HQ.SettingsChanged += this.CheckSettings;
            Utility.RegisterIntervalCallback(this.TryReconnectkNullObjects, NGFavWindow.ForceRepaintRefreshTick);
            RootGameObjectsManager.RootChanged += this.OnRootObjectsChanged;
            Undo.undoRedoPerformed             += this.Repaint;

            this.CheckSettings();
        }
Beispiel #12
0
        protected virtual void  OnEnable()
        {
            Utility.RegisterWindow(this);
            Utility.RestoreIcon(this, NGConsoleWindow.TitleColor);

            Metrics.UseTool(2);             // NGConsole

            if (this.initialized == true || HQ.Settings == null)
            {
                return;
            }

            NGChangeLogWindow.CheckLatestVersion(NGTools.NGConsole.NGAssemblyInfo.Name);

            try
            {
                //Debug.Log("StartEnable");
                int i = 0;

                PerWindowVars.InitWindow(this, "NGConsole");

                this.syncLogs                = new SyncLogs(this);
                this.syncLogs.EndNewLog     += this.RepaintWithModules;
                this.syncLogs.UpdateLog     += this.UpdateLog;
                this.syncLogs.NewLog        += this.ConvertNewLog;
                this.syncLogs.ResetLog      += this.LocalResetLogs;
                this.syncLogs.ClearLog      += this.Clear;
                this.syncLogs.OptionAltered += this.UpdateConsoleFlags;

                this.rows = new List <Row>(ConsoleConstants.PreAllocatedArray);

                this.r = new Rect();

                List <RowType> rowDrawerTypes = new List <RowType>();

                foreach (Type c in Utility.EachNGTSubClassesOf(typeof(Row)))
                {
                    object[] attributes = c.GetCustomAttributes(typeof(RowLogHandlerAttribute), false);

                    if (attributes.Length == 0)
                    {
                        continue;
                    }

                    MethodInfo handler = c.GetMethod(RowLogHandlerAttribute.StaticVerifierMethodName, BindingFlags.Static | BindingFlags.NonPublic);

                    if (handler == null)
                    {
                        InternalNGDebug.LogWarning("The class \"" + c + "\" inherits from \"" + typeof(Row) + "\" and has the attribute \"" + typeof(RowLogHandlerAttribute) + "\" must implement: private static bool " + RowLogHandlerAttribute.StaticVerifierMethodName + "(UnityLogEntry log).");
                        continue;
                    }

                    RowType rdt = new RowType()
                    {
                        type      = c,
                        attribute = attributes[0] as RowLogHandlerAttribute
                    };

                    rdt.attribute.handler = (Func <UnityLogEntry, bool>)Delegate.CreateDelegate(typeof(Func <UnityLogEntry, bool>), handler);

                    rowDrawerTypes.Add(rdt);
                }

                rowDrawerTypes.Sort((r1, r2) => r2.attribute.priority - r1.attribute.priority);
                NGConsoleWindow.rowDrawers = rowDrawerTypes.ToArray();

                List <Module> filteredModules = new List <Module>();

                if (HQ.Settings.Get <ConsoleSettings>().serializedModules.Count > 0)
                {
                    this.modules = HQ.Settings.Get <ConsoleSettings>().serializedModules.Deserialize <Module>();
                }

                if (this.modules == null)
                {
                    foreach (Type t in Utility.EachNGTSubClassesOf(typeof(Module)))
                    {
                        filteredModules.Add((Module)Activator.CreateInstance(t));
                    }
                }
                else
                {
                    filteredModules.AddRange(this.modules);

                    // Detect new Module.
                    foreach (Type t in Utility.EachNGTSubClassesOf(typeof(Module), c => filteredModules.Exists(m => m.GetType() == c) == false))
                    {
                        InternalNGDebug.VerboseLogFormat("Module \"{0}\" generated.", t);
                        filteredModules.Add((Module)Activator.CreateInstance(t));
                    }
                }

                this.modules        = filteredModules.ToArray();
                this.visibleModules = this.GetVisibleModules(filteredModules);

                // Initialize modules
                int id = NGConsoleWindow.StartModuleID;

                for (i = 0; i < this.modules.Length; i++)
                {
                    if (this.visibleModules.Contains(this.modules[i]) == true)
                    {
                        this.modules[i].OnEnable(this, id++);
                    }
                    else
                    {
                        this.modules[i].OnEnable(this, -1);
                    }
                }

                // Do not overflow if there is removed modules.
                if (this.visibleModules.Length > 0)
                {
                    if (this.workingModuleId == -1)
                    {
                        this.workingModuleId = this.visibleModules[0].Id;
                    }
                    else
                    {
                        this.workingModuleId = Mathf.Clamp(this.workingModuleId, NGConsoleWindow.StartModuleID, this.visibleModules.Length);
                    }

                    Module module = this.GetModule(this.workingModuleId);
                    if (module != null)
                    {
                        module.OnEnter();
                    }
                }
                else
                {
                    this.workingModuleId = -1;
                }

                GUI.FocusControl(null);

                Object[] nativeConsoleInstances = Resources.FindObjectsOfTypeAll(NGConsoleWindow.nativeConsoleType);

                if (nativeConsoleInstances.Length > 0)
                {
                    NGConsoleWindow.nativeConsoleWindowField.SetValue(null, nativeConsoleInstances[nativeConsoleInstances.Length - 1]);
                }

                this.settings = HQ.Settings;

                HQ.SettingsChanged     += this.OnSettingsChanged;
                Undo.undoRedoPerformed += this.Repaint;

                EditorApplication.delayCall += () => GUICallbackWindow.Open(this.VerifySettingsStyles);

                this.initialized = true;
            }
            catch (Exception ex)
            {
                InternalNGDebug.LogException(ex);
            }
        }
Beispiel #13
0
        private static void     DrawOverlay(int instanceID, Rect selectionRect)
        {
            HierarchyEnhancerSettings settings = HQ.Settings.Get <HierarchyEnhancerSettings>();

            if ((NGHierarchyEnhancer.instance == null ||
                 // When an Object is destroyed, it returns null but is not null...
                 NGHierarchyEnhancer.instance.Equals(null) == true) &&
                NGHierarchyEnhancer.hierarchyType != null)
            {
                Object[] consoles = Resources.FindObjectsOfTypeAll(NGHierarchyEnhancer.hierarchyType);

                if (consoles.Length > 0)
                {
                    NGHierarchyEnhancer.instance = consoles[0] as EditorWindow;
                    NGHierarchyEnhancer.instance.wantsMouseMove = true;
                }
            }

            if (EditorWindow.mouseOverWindow == NGHierarchyEnhancer.instance)
            {
                // HACK Need to shift by one.
                // Ref Bug #720211_8cg6m8s7akdbf1r5
                if (settings.holdModifiers > 0)
                {
                    NGHierarchyEnhancer.holding = ((int)Event.current.modifiers & ((int)settings.holdModifiers)) == ((int)settings.holdModifiers);
                }
                if (settings.selectionHoldModifiers > 0)
                {
                    NGHierarchyEnhancer.selectionHolding = ((int)Event.current.modifiers & ((int)settings.selectionHoldModifiers)) == ((int)settings.selectionHoldModifiers);
                }
            }

            selectionRect.width += selectionRect.x;
            selectionRect.x      = 0F;

            Object obj;

            if (instanceID == NGHierarchyEnhancer.lastInstanceID)
            {
                obj = NGHierarchyEnhancer.lastObject;
            }
            else
            {
                obj = EditorUtility.InstanceIDToObject(instanceID);
                NGHierarchyEnhancer.lastInstanceID = instanceID;
                NGHierarchyEnhancer.lastObject     = obj;
                NGHierarchyEnhancer.lastBehaviours = null;
            }

            if (obj != null)
            {
                GameObject go = obj as GameObject;

                if (settings.layers != null &&
                    settings.layers.Length > go.layer &&
                    settings.layers[go.layer].a > 0F)
                {
                    EditorGUI.DrawRect(selectionRect, settings.layers[go.layer]);
                }

                if (settings.layersIcon != null &&
                    settings.layersIcon.Length > go.layer &&
                    settings.layersIcon[go.layer] != null)
                {
                    NGHierarchyEnhancer.ProcessIndentLevel(selectionRect.y, go);
                    GUI.DrawTexture(NGHierarchyEnhancer.indentRect, settings.layersIcon[go.layer], ScaleMode.ScaleToFit);
                }

                // Draw Component' color over layer's background color.
                go.GetComponents <Component>(cacheComponents);

                Rect r = selectionRect;

                if (settings.widthPerComponent > 0F)
                {
                    NGHierarchyEnhancer.ProcessIndentLevel(selectionRect.y, go);
                    r = NGHierarchyEnhancer.indentRect;

                    for (int i = 1; i < cacheComponents.Count; i++)                     // Skip Transform.
                    {
                        if (cacheComponents[i] == null)
                        {
                            continue;
                        }

                        bool drawn = false;
                        Type t     = cacheComponents[i].GetType();

                        if (settings.drawUnityComponents == true)
                        {
                            int k = 0;

                            r.width = 16F;

                            for (; k < NGHierarchyEnhancer.unityComponentData.Count; k++)
                            {
                                if (t == NGHierarchyEnhancer.unityComponentData[k].type)
                                {
                                    if (NGHierarchyEnhancer.unityComponentData[k].icon != null)
                                    {
                                        GUI.DrawTexture(r, NGHierarchyEnhancer.unityComponentData[k].icon);
                                        r.x  += r.width;
                                        drawn = true;
                                    }
                                    break;
                                }
                            }

                            if (k < NGHierarchyEnhancer.unityComponentData.Count)
                            {
                                if (drawn == true)
                                {
                                    continue;
                                }
                            }
                            else if (t.Assembly != typeof(Editor).Assembly)
                            {
                                NGHierarchyEnhancer.unityComponentData.Add(new HierarchyEnhancerSettings.ComponentColor()
                                {
                                    type = t, icon = EditorGUIUtility.ObjectContent(null, t).image
                                });
                            }
                        }

                        for (int j = 0; j < settings.componentData.Length; j++)
                        {
                            if (settings.componentData[j].type == null)
                            {
                                continue;
                            }

                            if (t == settings.componentData[j].type)
                            {
                                if (settings.componentData[j].icon != null)
                                {
                                    r.width = 16F;
                                    GUI.DrawTexture(r, settings.componentData[j].icon);
                                }
                                else
                                {
                                    r.width = settings.widthPerComponent;
                                    EditorGUI.DrawRect(r, settings.componentData[j].color);
                                }

                                r.x += r.width;
                                break;
                            }
                        }
                    }
                }
                else
                {
                    for (int j = 0; j < settings.componentData.Length; j++)
                    {
                        if (settings.componentData[j].type == null)
                        {
                            continue;
                        }

                        int i = 0;

                        for (; i < cacheComponents.Count; i++)
                        {
                            if (cacheComponents[i].GetType() == settings.componentData[j].type)
                            {
                                EditorGUI.DrawRect(r, settings.componentData[j].color);
                                break;
                            }
                        }

                        if (i < cacheComponents.Count)
                        {
                            break;
                        }
                    }
                }
            }

            if (NGHierarchyEnhancer.IsInSelection(obj) ||
                (selectionRect.Contains(Event.current.mousePosition) == true && NGHierarchyEnhancer.holding == false) ||
                (NGHierarchyEnhancer.holding == true && NGHierarchyEnhancer.lastInstanceId == instanceID))
            {
                if (NGHierarchyEnhancer.lastInstanceId != instanceID &&
                    NGHierarchyEnhancer.holding == false)
                {
                    NGHierarchyEnhancer.lastInstanceId = instanceID;
                    NGHierarchyEnhancer.menuOpen       = false;
                }

                if (Event.current.type == EventType.MouseMove)
                {
                    NGHierarchyEnhancer.instance.Repaint();
                }

                if (obj != null)
                {
                    float x     = selectionRect.x;
                    float width = selectionRect.width;

                    selectionRect.x    += selectionRect.width - 30F - settings.margin;
                    selectionRect.width = 30F;

                    if ((NGHierarchyEnhancer.selectionHolding == true && NGHierarchyEnhancer.IsInSelection(obj)) ||
                        NGHierarchyEnhancer.holding == true ||
                        selectionRect.Contains(Event.current.mousePosition) == true)
                    {
                        if (NGHierarchyEnhancer.menuOpen == false)
                        {
                            NGHierarchyEnhancer.menuOpen = true;
                            NGHierarchyEnhancer.instance.Repaint();
                        }
                    }

                    if (NGHierarchyEnhancer.menuOpen == false)
                    {
                        GUI.Button(selectionRect, "NG");
                    }
                    else
                    {
                        selectionRect.x     = 0F;
                        selectionRect.width = width + x - settings.margin;

                        EditorGUI.BeginChangeCheck();

                        // Draws DynamicObjectMenu first.

                        if (NGHierarchyEnhancer.objectMenus == null)
                        {
                            List <DynamicObjectMenu> menus = new List <DynamicObjectMenu>();

                            foreach (Type c in Utility.EachNGTSubClassesOf(typeof(DynamicObjectMenu)))
                            {
                                menus.Add(Activator.CreateInstance(c) as DynamicObjectMenu);
                            }

                            menus.Sort((a, b) => a.priority - b.priority);
                            NGHierarchyEnhancer.objectMenus = menus.ToArray();
                        }

                        for (int i = 0; i < NGHierarchyEnhancer.objectMenus.Length; i++)
                        {
                            // Shrink available width with new end point on X axis.
                            selectionRect.width = NGHierarchyEnhancer.objectMenus[i].DrawHierarchy(selectionRect, obj) - selectionRect.x;
                        }

                        if (EditorGUI.EndChangeCheck() == true)
                        {
                            Metrics.UseTool(12);                             // NGHierarchyEnhancer
                            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);
                        }

                        // Then all sub-implementations.
                        GameObject gameObject = obj as GameObject;

                        if (gameObject != null)
                        {
                            Behaviour[] behaviours;

                            if (NGHierarchyEnhancer.lastBehaviours == null)
                            {
                                behaviours = gameObject.GetComponents <Behaviour>();
                                NGHierarchyEnhancer.lastBehaviours = behaviours;
                            }
                            else
                            {
                                behaviours = NGHierarchyEnhancer.lastBehaviours;
                            }

                            for (int i = 0; i < behaviours.Length; i++)
                            {
                                if (behaviours[i] == null)
                                {
                                    continue;
                                }

                                INGHierarchyEnhancerGUI drawer = behaviours[i] as INGHierarchyEnhancerGUI;

                                if (drawer != null)
                                {
                                    selectionRect.width = drawer.OnHierarchyGUI(selectionRect) - selectionRect.x;
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #14
0
 public DragObjectDrawer()
 {
     Metrics.UseTool(5);             // NGDraggableObject
     NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);
 }