/// <summary>
        /// Gets all updates for InspectorPreferences.
        /// Update files should be located in the same directory as the PreferencesAsset inside
        /// a folder named "Updates"
        /// </summary>
        /// <param name="preferences"></param>
        /// <returns></returns>
        public static InspectorPreferencesUpdate[] GetAllUpdates([NotNull] InspectorPreferences preferences)
        {
            var preferencesPath = AssetDatabase.GetAssetPath(preferences);
            var directoryPath   = FileUtility.GetParentDirectory(preferencesPath);

            directoryPath = FileUtility.GetChildDirectory(directoryPath, "Updates");

            if (!AssetDatabase.IsValidFolder(directoryPath))
            {
                                #if DEV_MODE
                Debug.LogWarning(preferences.name + " had no Updates folder next to it.");
                                #endif
                return(ArrayPool <InspectorPreferencesUpdate> .ZeroSizeArray);
            }

            var updateGuids = AssetDatabase.FindAssets("t:InspectorPreferencesUpdate", ArrayExtensions.TempStringArray(directoryPath));
            int count       = updateGuids.Length;
            var results     = new InspectorPreferencesUpdate[count];

            for (int n = updateGuids.Length - 1; n >= 0; n--)
            {
                var updatePath = AssetDatabase.GUIDToAssetPath(updateGuids[n]);
                results[n] = AssetDatabase.LoadAssetAtPath <InspectorPreferencesUpdate>(updatePath);
            }

            return(results);
        }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        public override void Setup(IInspectorDrawer drawer, InspectorPreferences setPreferences, Object[] inspected, Vector2 scrollPos, bool viewIsLocked)
        {
                        #if DEV_MODE && DEBUG_SETUP_TIME
            var timer = new ExecutionTimeLogger();
            timer.Start(GetType().Name + ".Setup");
                        #endif

                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(setPreferences != null);
                        #endif

            previewDrawer = new PreviewDrawer(this);

            // Call base.Setup before calling Setup for the toolbar, so that the Preferences field gets assigned first
            base.Setup(drawer, setPreferences, inspected, scrollPos, viewIsLocked);

                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(Preferences != null);
            Debug.Assert(Preferences == setPreferences);
                        #endif

                        #if DEV_MODE && DEBUG_SETUP_TIME
            timer.FinishAndLogResults();
                        #endif
        }
Ejemplo n.º 3
0
        public IInspector Create(Type inspectorType, IInspectorDrawer drawer, InspectorPreferences preferences, Object[] inspected, Vector2 scrollPos, bool viewIsLocked)
        {
            IInspector result;
            object     instanceFromPool;

            if (pool.TryGet(inspectorType, out instanceFromPool))
            {
                result = (IInspector)instanceFromPool;;
            }
            else
            {
                result = (IInspector)inspectorType.CreateInstance();
            }
                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(!activeInstances.Contains(result));
            Debug.Assert(!activeInstances.Contains(null));
                        #endif
            AddToActiveInstances(result);
            result.Setup(drawer, preferences, inspected, scrollPos, viewIsLocked);

                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(activeInstances.Contains(result), "Created inspector " + result + " not found in InspectorManager.activeInstances");
            Debug.Assert(!pool.Contains(result), "Created inspector " + result + " still found in InspectorManager.pool");
                        #endif

            return(result);
        }
Ejemplo n.º 4
0
 public static InspectorPreferences GetSettingsCached(ref InspectorPreferences preferencesCached, bool editorMode)
 {
     if (preferencesCached == null)
     {
         preferencesCached = GetDefaultPreferences();
     }
     return(preferencesCached);
 }
        public void UpdateNow([NotNull] InspectorPreferences preferences)
        {
            UndoHandler.RegisterUndoableAction(preferences, "Update Inspector Preferences");

                        #if DEV_MODE
            Debug.Log("Updating preferences to version " + ToVersion + " now...");
                        #endif

            ApplyUpdates(preferences);

            EditorUtility.SetDirty(preferences);
        }
Ejemplo n.º 6
0
        private static InspectorPreferences GetDefaultPreferencesEditorMode()
        {
            var guids = AssetDatabase.FindAssets("t:InspectorPreferences");
            int found = guids.Length;

            if (found > 0)
            {
                string path;
                for (int n = found - 1; n >= 0; n--)
                {
                    path = AssetDatabase.GUIDToAssetPath(guids[n]);
                    if (path.IndexOf("editor", StringComparison.OrdinalIgnoreCase) != -1)
                    {
                        fallbackPreferences = AssetDatabase.LoadAssetAtPath <InspectorPreferences>(path);
                        if (fallbackPreferences != null)
                        {
                                                        #if DEV_MODE && DEBUG_GET
                            Debug.Log("GetDefaultPreferencesEditorMode returning asset @ " + path + ": " + StringUtils.TypeToString(fallbackPreferences));
                                                        #endif

                            if (!fallbackPreferences.setupDone)
                            {
                                if (Event.current != null)
                                {
                                                                        #if DEV_MODE && DEBUG_GET
                                    Debug.Log("Calling fallbackPreferences.Setup()");
                                                                        #endif
                                    fallbackPreferences.Setup();
                                }
                                                                #if DEV_MODE
                                else
                                {
                                    Debug.LogWarning("Could not run InspectorPreferences.Setup because Event.current was null!");
                                }
                                                                #endif
                            }

                            return(fallbackPreferences);
                        }
                    }
                }
            }
                        #if DEV_MODE
            else
            {
                Debug.LogWarning("GetDefaultPreferencesEditorMode found 0 results with AssetDatabase.FindAssets(\"t:InspectorPreferences\")");
            }
                        #endif

            return(null);
        }
Ejemplo n.º 7
0
        /// <inheritdoc/>
        public override void Setup(IInspectorDrawer drawer, InspectorPreferences setPreferences, Object[] inspected, Vector2 scrollPos, bool viewIsLocked)
        {
                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(setPreferences != null);
                        #endif

            // Call base.Setup before calling Setup for the toolbar, so that the Preferences field gets assigned first
            base.Setup(drawer, setPreferences, inspected, scrollPos, viewIsLocked);

                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(Preferences != null);
            Debug.Assert(Preferences == setPreferences);
                        #endif
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Sets up DrawGUI and Default Inspector Preferences
        /// </summary>
        private static void Setup()
        {
                        #if DEV_MODE && DEBUG_SETUP_TIME
            var setupTimer = new ExecutionTimeLogger();
            setupTimer.Start("InspectorPreferencesDrawerProvider.Setup");
                        #endif

            var settings = InspectorPreferences.GetDefaultPreferences();
            settings.Setup();
            DrawGUI.Setup(settings);

                        #if DEV_MODE && DEBUG_SETUP_TIME
            setupTimer.FinishAndLogResults();
                        #endif
        }
        /// <inheritdoc/>
        protected override void ApplyUpdates(InspectorPreferences preferences)
        {
            preferences.themes.ProClassic.PrefixIdleText = new Color32(209, 209, 209, 255);

            var color = new Color32(103, 103, 103, 128);

            preferences.themes.PersonalClassic.SelectedLineIndicatorUnfocused = color;
            preferences.themes.PersonalModern.SelectedLineIndicatorUnfocused  = color;

            color = new Color32(86, 86, 86, 128);
            preferences.themes.ProClassic.SelectedLineIndicatorUnfocused = color;
            preferences.themes.ProModern.SelectedLineIndicatorUnfocused  = color;

            color = new Color32(72, 72, 72, 255);
            preferences.themes.ProClassic.ToolbarItemSelectedUnfocused = color;
            preferences.themes.ProModern.ToolbarItemSelectedUnfocused  = color;

            color = new Color32(143, 143, 143, 255);
            preferences.themes.ProClassic.PrefixSelectedUnfocusedText = color;
            preferences.themes.ProModern.PrefixSelectedUnfocusedText  = color;

            color = new Color32(72, 72, 72, 255);
            preferences.themes.PersonalClassic.PrefixSelectedUnfocusedText = color;
            preferences.themes.PersonalModern.PrefixSelectedUnfocusedText  = color;

            color = new Color32(73, 142, 228, 128);
            preferences.themes.ProClassic.SelectedLineIndicator = color;
            preferences.themes.ProModern.SelectedLineIndicator  = color;

            color = new Color32(100, 100, 100, 255);
            preferences.themes.ProClassic.ControlSelectedUnfocusedRect = color;
            preferences.themes.ProModern.ControlSelectedUnfocusedRect  = color;

            color = new Color32(115, 115, 115, 255);
            preferences.themes.PersonalClassic.ControlSelectedUnfocusedRect = color;
            preferences.themes.PersonalModern.ControlSelectedUnfocusedRect  = color;

            preferences.labels.contextMenu.image = contextMenuIcon;
        }
Ejemplo n.º 10
0
 /// <summary> Initializes the PreferencesInspector instance. </summary>
 /// <param name="inspector"> The inspector. </param>
 /// <param name="preferences"> inspector preferences. </param>
 /// <param name="drawer"> The drawer. </param>
 /// <param name="inspected"> The inspected targets. </param>
 /// <param name="scrollPos"> The viewport scroll position. </param>
 /// <param name="viewIsLocked"> True if view is locked. </param>
 public static void Setup(PreferencesInspector inspector, InspectorPreferences preferences, PowerInspectorPreferencesWindow drawer, Object[] inspected, Vector2 scrollPos, bool viewIsLocked)
 {
     inspector.Setup(drawer, preferences, inspected, scrollPos, viewIsLocked);
 }
Ejemplo n.º 11
0
 public IInspector Create <TInspector>(IInspectorDrawer drawer, InspectorPreferences preferences) where TInspector : class, IInspector, new()
 {
     return(Create <TInspector>(drawer, preferences, ArrayPool <Object> .ZeroSizeArray, Vector2.zero, false));
 }
        /// <inheritdoc/>
        protected override void ApplyUpdates(InspectorPreferences preferences)
        {
            preferences.themes.PersonalClassic.ComponentHeaderBackground            = new Color32(194, 194, 194, 255);
            preferences.themes.PersonalClassic.ComponentMouseoveredHeaderBackground = new Color32(194, 194, 194, 255);
            preferences.themes.PersonalClassic.AssetHeaderBackground = new Color32(218, 218, 218, 255);

            preferences.themes.ProClassic.ComponentHeaderBackground            = new Color32(56, 56, 56, 255);
            preferences.themes.ProClassic.ComponentMouseoveredHeaderBackground = new Color32(56, 56, 56, 255);
            preferences.themes.ProClassic.AssetHeaderBackground = new Color32(62, 62, 62, 255);

            preferences.themes.PersonalModern.ComponentHeaderBackground            = new Color32(203, 203, 203, 255);
            preferences.themes.PersonalModern.ComponentMouseoveredHeaderBackground = new Color32(214, 214, 214, 255);
            preferences.themes.PersonalModern.AssetHeaderBackground = new Color32(203, 203, 203, 255);

            preferences.themes.ProModern.ComponentHeaderBackground            = new Color32(62, 62, 62, 255);
            preferences.themes.ProModern.ComponentMouseoveredHeaderBackground = new Color32(71, 71, 71, 255);
            preferences.themes.ProModern.AssetHeaderBackground  = new Color32(60, 60, 60, 255);
            preferences.themes.ProModern.ComponentSeparatorLine = new Color32(26, 26, 26, 255);

            if (EditorPrefs.HasKey("PI.NewScript/SaveIn"))
            {
                                #if DEV_MODE
                Debug.Log("Deleting PI.NewScript/SaveIn");
                                #endif
                EditorPrefs.DeleteKey("PI.NewScript/SaveIn");
            }
            if (EditorPrefs.HasKey("PI.NewScript/Template"))
            {
                                #if DEV_MODE
                Debug.Log("Deleting PI.NewScript/Template");
                                #endif
                EditorPrefs.DeleteKey("PI.NewScript/Template");
            }
            if (EditorPrefs.HasKey("PI.NewScript/Namespace"))
            {
                                #if DEV_MODE
                Debug.Log("Deleting PI.NewScript/Namespace");
                                #endif
                EditorPrefs.DeleteKey("PI.NewScript/Namespace");
            }
            if (EditorPrefs.HasKey("PI.NewScript/Name"))
            {
                                #if DEV_MODE
                Debug.Log("Deleting PI.NewScript/Name");
                                #endif
                EditorPrefs.DeleteKey("PI.NewScript/Name");
            }
            if (EditorPrefs.HasKey("PI.NewScript/AttachTo"))
            {
                                #if DEV_MODE
                Debug.Log("Deleting PI.NewScript/AttachTo");
                                #endif
                EditorPrefs.DeleteKey("PI.NewScript/AttachTo");
            }
            if (EditorPrefs.HasKey("PI.NewScript/CreatedAtPath"))
            {
                                #if DEV_MODE
                Debug.Log("Deleting PI.NewScript/CreatedAtPath");
                                #endif
                EditorPrefs.DeleteKey("PI.NewScript/CreatedAtPath");
            }
        }
Ejemplo n.º 13
0
        /// <returns> True if should stop receiving OnGUIEvents. </returns>
        private static bool OnGUIStatic()
        {
            if (preferences == null)
            {
                                #if UNITY_EDITOR
                if (EditorApplication.isCompiling)
                {
                                        #if DEV_MODE
                    Debug.Log("OnGUIEventHelper - waiting before fetching preferences asset because still compiling scripts...");
                                        #endif
                    return(false);
                }

                if (EditorApplication.isUpdating)
                {
                                        #if DEV_MODE
                    Debug.Log("OnGUIEventHelper - waiting before fetching preferences asset because still updating asset database...");
                                        #endif
                    return(false);
                }
                                #endif

                try
                {
                    preferences = InspectorUtility.Preferences;
                }
                                #if DEV_MODE
                catch (NullReferenceException e)
                {
                    Debug.LogWarning("OnGUIEventHelper.OnGUI failed to fetch preferences asset. " + e);
                                #else
                catch (NullReferenceException)
                {
                                #endif
                    return(false);
                }

                if (preferences == null)
                {
                                        #if DEV_MODE
                    Debug.LogWarning("OnGUIEventHelper.OnGUI failed to find preferences asset.");
                                        #endif
                    return(false);
                }
            }

            preferences.Setup();

                        #if DEV_MODE && DEBUG_IS_STILL_NEEDED
            Debug.Log(StringUtils.ToColorizedString("EnsureOnGUICallbacks calling BeginOnGUI with isStillNeeded: " + isStillNeeded.Count + ", Event: ", Event.current));
                        #endif

            DrawGUI.BeginOnGUI(preferences, true);

            if (Event.current.type == EventType.Layout)
            {
                InspectorManager.Instance().OnLayout();

                for (int n = isStillNeeded.Count - 1; n >= 0; n--)
                {
                    if (isStillNeeded[n]())
                    {
                        return(false);
                    }
                }
                                #if DEV_MODE && DEBUG_ENABLED
                Debug.Log("EnsureOnGUICallbacks closing because all " + isStillNeeded.Count + " isStillNeeded returned false");
                                #endif

                return(true);
            }

            return(false);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Method used for creating new Inspector instances. All instances should be
        /// created through the Manager, so that the IInspectorManager->IInspectorDrawer->IInspector
        /// hierarchy can be properly set up.
        /// </summary>
        /// <typeparam name="TInspector"> Type of the inspector. </typeparam>
        /// <param name="result">[out]The created inspector</param>
        /// <param name="drawer"> The drawer of the inspector. </param>
        /// <param name="preferences"> Preferences for the inspector. </param>
        /// <param name="inspected"> The inspected Unity Objects. </param>
        /// <param name="scrollPos"> The current scroll position of the inspector. </param>
        /// <param name="viewIsLocked"> True if view is locked. </param>
        /// <param name="setup"> Delegate to the Setup method for the Inspector. </param>
        public void Create <TInspector>(out TInspector result, IInspectorDrawer drawer, InspectorPreferences preferences, Object[] inspected, Vector2 scrollPos, bool viewIsLocked, SetupForInspected <TInspector> setup) where TInspector : class, IInspector, new()
        {
            if (!pool.TryGet(out result))
            {
                result = new TInspector();
            }
                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(!activeInstances.Contains(result));
            Debug.Assert(!activeInstances.Contains(null));
                        #endif
            AddToActiveInstances(result);
            setup(result, preferences, drawer, inspected, scrollPos, viewIsLocked);

                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(activeInstances.Contains(result), "Created inspector " + result + " not found in InspectorManager.activeInstances");
            Debug.Assert(!pool.Contains(result), "Created inspector " + result + " still found in InspectorManager.pool");
                        #endif
        }
Ejemplo n.º 15
0
        public static InspectorPreferences GetDefaultPreferences()
        {
            if (fallbackPreferences != null)
            {
                return(fallbackPreferences);
            }

                        #if UNITY_EDITOR
            if (Platform.EditorMode)
            {
                fallbackPreferences = GetDefaultPreferencesEditorMode();
                if (fallbackPreferences != null)
                {
                                        #if DEV_MODE && DEBUG_GET
                    Debug.Log("GetDefaultPreferences returning result of GetDefaultPreferencesEditorMode: " + StringUtils.TypeToString(fallbackPreferences));
                                        #endif

                    if (!fallbackPreferences.setupDone)
                    {
                        if (Event.current != null)
                        {
                                                        #if DEV_MODE && DEBUG_GET
                            Debug.Log("Calling fallbackPreferences.Setup()");
                                                        #endif
                            fallbackPreferences.Setup();
                        }
                                                #if DEV_MODE
                        else
                        {
                            Debug.LogWarning("Could not run InspectorPreferences.Setup because Event.current was null!");
                        }
                                                #endif
                    }

                    return(fallbackPreferences);
                }
                                #if DEV_MODE
                Debug.LogWarning("GetDefaultPreferencesEditorMode returned null");
                                #endif
            }
                        #if DEV_MODE
            else
            {
                Debug.LogWarning("!Platform.EditorMode");
            }
                        #endif
                        #endif

            var findAll = Resources.FindObjectsOfTypeAll <InspectorPreferences>();
            for (int n = findAll.Length - 1; n >= 0; n--)
            {
                fallbackPreferences = findAll[n];
                if (fallbackPreferences != null)
                {
                                        #if DEV_MODE
                    Debug.Log("GetDefaultPreferences returning FindObjectsOfTypeAll result #" + n + ": " + StringUtils.TypeToString(fallbackPreferences));
                                        #endif

                    if (!fallbackPreferences.setupDone)
                    {
                        if (Event.current != null)
                        {
                            fallbackPreferences.Setup();
                        }
                                                #if DEV_MODE
                        else
                        {
                            Debug.LogWarning("Could not run InspectorPreferences.Setup because Event.current was null!");
                        }
                                                #endif
                    }

                    return(fallbackPreferences);
                }
            }
                        #if DEV_MODE
            Debug.LogWarning("FindObjectsOfTypeAll could not find non-null InspectorPreferences. FindObjectsOfTypeAll returned " + findAll.Length + " results.");
                        #endif

            fallbackPreferences = Resources.Load <InspectorPreferences>("RuntimePowerInspectorPreferences");

            if (fallbackPreferences != null)
            {
                if (!fallbackPreferences.setupDone)
                {
                    if (Event.current != null)
                    {
                        fallbackPreferences.Setup();
                    }
                                        #if DEV_MODE
                    else
                    {
                        Debug.LogWarning("Could not run InspectorPreferences.Setup because Event.current was null!");
                    }
                                        #endif
                }

                return(fallbackPreferences);
            }

                        #if UNITY_EDITOR
            if (!Platform.EditorMode)
            {
                fallbackPreferences = GetDefaultPreferencesEditorMode();
                if (fallbackPreferences != null)
                {
                    return(fallbackPreferences);
                }
            }
                        #endif

            throw new NullReferenceException("Failed to find default InspectorPreferences with Platform.EditorMode=" + Platform.EditorMode + "!");
        }
Ejemplo n.º 16
0
 public NotificationMessageDispenser(EditorWindow setTarget, InspectorPreferences preferences)
 {
     Setup(setTarget, preferences);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Gets the preferences asset for
 /// </summary>
 /// <returns> The preferences for  </returns>
 public static InspectorPreferences GetPreferences()
 {
     return(InspectorPreferences.GetSettingsCached(ref preferencesCached, true));
 }
 /// <inheritdoc/>
 protected override void ApplyUpdates(InspectorPreferences preferences)
 {
     preferences.themes.ProModern.PrefixIdleText     = new Color32(210, 210, 210, 255);
     preferences.themes.ProModern.PrefixSelectedText = new Color32(124, 171, 240, 255);
 }
Ejemplo n.º 19
0
 /// <inheritdoc/>
 public void Setup(EditorWindow setTarget, InspectorPreferences preferences)
 {
     Setup(setTarget);
 }
Ejemplo n.º 20
0
 public IInspector Create(Type inspectorType, IInspectorDrawer drawer, InspectorPreferences preferences)
 {
     return(Create(inspectorType, drawer, preferences, ArrayPool <Object> .ZeroSizeArray, Vector2.zero, false));
 }
Ejemplo n.º 21
0
 public static void Setup([NotNull] SimpleInspector inspector, [NotNull] InspectorPreferences preferences, [NotNull] IInspectorDrawer drawer, [NotNull] Object[] inspected, Vector2 scrollPos, bool viewIsLocked)
 {
     inspector.Setup(drawer, preferences, inspected, scrollPos, viewIsLocked);
 }
Ejemplo n.º 22
0
        /// <summary>
        /// Sets up the drawer so that it is ready to be used.
        /// LateSetup should be called right after this.
        /// </summary>
        /// <param name="setButtonText"> Text to shown on the button. </param>
        /// <param name="setValue"> The initial cached value of the drawers. </param>
        /// <param name="setMemberInfo"> LinkedMemberInfo for the field or property that these drawers represent. </param>
        /// <param name="setParent"> Drawer whose member these Drawer are. Can be null. </param>
        /// <param name="setLabel"> The prefix label to precede the button. Can be null. </param>
        /// <param name="setReadOnly"> True if Drawer should be read only. </param>
        protected virtual void Setup([NotNull] LinkedMemberInfo setMemberInfo, [CanBeNull] IParentDrawer setParent, [CanBeNull] GUIContent setPrefixLabel, [CanBeNull] GUIContent setButtonLabel, bool setReadOnly)
        {
                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(setMemberInfo != null);
                        #endif

            result    = null;
            hasResult = false;

            preferences = setParent != null ? setParent.Inspector.Preferences : InspectorUtility.Preferences;

            if (setMemberInfo == null)
            {
                Debug.LogError("Null fieldInfo detected for \"" + (setPrefixLabel != null ? setPrefixLabel.text : "") + "\"");
                return;
            }

            var methodInfo = setMemberInfo.MethodInfo;

            if (methodInfo == null)
            {
                Debug.LogError("Null MethodInfo detected for \"" + (setPrefixLabel != null ? setPrefixLabel.text : "") + "\" / " + setMemberInfo.Name);
                return;
            }

                        #if DEV_MODE && DEBUG_SETUP
            Debug.Log(Msg(ToString(setLabel, setMemberInfo), ".Setup with Type.ToString()=" + setMemberInfo.Type + ", Type.Name=" + setMemberInfo.Type.Name + ", ToString(Type)=" + StringUtils.ToString(setMemberInfo.Type)));
                        #endif

            memberInfo = setMemberInfo;

            hasParameters  = methodInfo.GetParameters().Length > 0;
            isGeneric      = methodInfo.IsGenericMethod;
            hasReturnValue = methodInfo.ReturnType != Types.Void;
            isCoroutine    = methodInfo.ReturnType == Types.IEnumerator;
            monoBehaviour  = UnityObject as MonoBehaviour;

            if (setButtonLabel == null)
            {
                setButtonLabel = isCoroutine ? preferences.labels.startCoroutine : preferences.labels.invokeMethod;
            }
            buttonLabel = setButtonLabel;

            if (InvokeMethodUtility.IsDisabled(setMemberInfo.UnityObjects, methodInfo))
            {
                                #if DEV_MODE
                Debug.LogWarning("Setting MethodDrawer(" + methodInfo.Name + ") to ReadOnly because InvokeMethodUtility.IsDisabled returned " + StringUtils.True);
                                #endif

                setReadOnly = true;
            }

            base.Setup(null, DrawerUtility.GetType <object>(setMemberInfo, null), setMemberInfo, setParent, setPrefixLabel, setReadOnly);

            // Make count be at least 1, so it works with static classes that have no targets
            int count = Mathf.Max(MemberHierarchy.TargetCount, 1);

                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(count >= 1);
                        #endif

            ArrayPool <object> .Resize(ref results, count);

            for (int n = count - 1; n >= 0; n--)
            {
                results[n] = null;
            }

                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(results.Length == count);
            Debug.Assert(results.Length >= 1);
                        #endif

                        #if DEV_MODE && DEBUG_SETUP
            Debug.Log(ToString() + ".Setup()");
                        #endif
        }
Ejemplo n.º 23
0
 /// <inheritdoc/>
 public void Setup(EditorWindow setTarget, InspectorPreferences preferences)
 {
     Setup(setTarget, preferences.displayDurationPerWord, preferences.minDisplayDuration, preferences.maxDisplayDuration, preferences.messageDisplayMethod.HasFlag(MessageDisplayMethod.Console));
 }
 /// <summary>
 /// Handle updating user preferences from FromVersion to ToVersion.
 /// </summary>
 protected abstract void ApplyUpdates(InspectorPreferences preferences);