コード例 #1
0
        /// <inheritdoc/>
        protected override void Setup(Object[] inspect, bool lockView, Vector2 scrollPos, float minWidth = 280f, float minHeight = 130f, float maxWidth = 0f, float maxHeight = 0f)
        {
            var preferences = GetPreferences();

                        #if DEV_MODE && PI_ASSERTATIONS
            var minSize = PreferencesDrawer.GetExpectedMinSize();
            Debug.Assert(minWidth <= 0f || minWidth == minSize.x, StringUtils.ToString(minWidth));
            Debug.Assert(minHeight <= 0f || minHeight == minSize.y, StringUtils.ToString(minHeight));
            Debug.Assert(maxWidth <= 0f || maxWidth == minSize.x, StringUtils.ToString(maxWidth));
            Debug.Assert(maxHeight <= 0f || maxHeight == minSize.y, StringUtils.ToString(maxHeight));
                        #endif

            base.Setup(inspect, true, scrollPos, minWidth, minHeight, maxWidth, maxHeight);
            SelectionManager.Select(preferences);
        }
コード例 #2
0
        public static PreferencesDrawer GetExistingOrCreateNewWindow()
        {
            var inspectorManager = InspectorUtility.ActiveManager;

            if (inspectorManager != null)
            {
                var preferencesInstance = (PowerInspectorPreferencesWindow)inspectorManager.GetLastSelectedInspectorDrawer(typeof(PowerInspectorPreferencesWindow));
                if (preferencesInstance != null)
                {
                                        #if DEV_MODE && PI_ASSERTATIONS
                    Debug.Assert((object)preferencesInstance != null);
                                        #endif

                                        #if DEV_MODE
                    Debug.Log("Using existing preferences window: " + preferencesInstance);
                                        #endif

                    preferencesInstance.FocusWindow();
                    return(GetPrefencesDrawer(preferencesInstance));
                }
            }

            if (Event.current == null)
            {
                                #if DEV_MODE
                Debug.LogWarning("Opening preferences window on next OnGUI. Returning null");
                                #endif

                DrawGUI.OnNextBeginOnGUI(Open, true);
                return(null);
            }

                        #if DEV_MODE
            Debug.Log("Opening preferences window now!");
                        #endif

            var minSize = PreferencesDrawer.GetExpectedMinSize();
            var created = (PowerInspectorPreferencesWindow)CreateNew(typeof(PowerInspectorPreferencesWindow), "Preferences", ArrayPool <Object> .CreateWithContent(PowerInspector.GetPreferences()), true, false, minSize, minSize);
            return(GetPrefencesDrawer(created));
        }