Example #1
0
        /// <inheritdoc/>
        protected override void DoGenerateMemberBuildList()
        {
                        #if DEV_MODE
            Debug.Log(ToString() + ".DoGenerateMemberBuildList");
                        #endif

            base.DoGenerateMemberBuildList();

                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(Views.Length > 0);
            Debug.Assert(sideBarItemHeight > 0f);
            Debug.Assert(inspector.ToolbarHeight > 0f);
                        #endif

            height = Views.Length * sideBarItemHeight + inspector.ToolbarHeight + HeaderHeight - 4f;

                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(ExpectedViewCount == Views.Length, "ExpectedViewCount " + ExpectedViewCount + " != Views.Length " + Views.Length);
            Debug.Assert(ExpectedSideBarItemHeight == sideBarItemHeight);
            Debug.Assert(ExpectedHeaderHeight == HeaderHeight, "ExpectedHeaderHeight " + ExpectedHeaderHeight + " != " + HeaderHeight);
            Debug.Assert(ExpectedToolbarHeight == inspector.ToolbarHeight, "ExpectedToolbarHeight " + ExpectedToolbarHeight + " != " + inspector.ToolbarHeight);
            Debug.Assert(GetExpectedHeight() == height, "GetExpectedHeight() " + GetExpectedHeight() + " != " + height);
            Debug.Assert(GetExpectedHeight(inspector.ToolbarHeight) == height, "GetExpectedHeight(ToolbarHeight) " + GetExpectedHeight(inspector.ToolbarHeight) + " != " + height);
                        #endif

            UpdateMinMaxSize();

            PowerInspectorDocumentation.ShowPreferencesIfWindowOpen("", OnFailToLoadDocumentationPage);
        }
Example #2
0
 public static void Open()
 {
                 #if !UNITY_2020_1_OR_NEWER // WebView class no longer exists in Unity 2020.1 or later
     Open(true, "", null);
                 #else
     PowerInspectorDocumentation.Show();
                 #endif
 }
Example #3
0
        private void OnFailToLoadDocumentationPage([NotNull] string failedToLoadUrl)
        {
                        #if DEV_MODE
            Debug.LogWarning("Failed to load documentation page: " + failedToLoadUrl);
                        #endif

            if (!string.IsNullOrEmpty(failedToLoadUrl))
            {
                PowerInspectorDocumentation.ShowPreferencesIfWindowOpen("");
            }
        }
Example #4
0
        public void SetSelectedItem(IInspectorToolbarItem item, ReasonSelectionChanged reason)
        {
                        #if DEV_MODE && DEBUG_SET_SELECTED_ITEM
            Debug.Log(StringUtils.ToColorizedString("SetSelectedItem(", item, "), was: ", SelectedItem));
                        #endif

                        #if DEV_MODE && PI_ASSERTATIONS
            if (item != null && inspector.Manager.SelectedInspectorPart != InspectorPart.Toolbar)
            {
                Debug.LogError(GetType().Name + ".SetSelectedItem(" + item.GetType().Name + ") called but SelectedInspectorPart was " + inspector.Manager.SelectedInspectorPart);
            }
                        #endif

            if (item == null)
            {
                if (selectedItemIndex != -1)
                {
                    items[selectedItemIndex].OnDeselected(reason);
                    selectedItemIndex = -1;
                }
                return;
            }

            int setIndex = Array.IndexOf(items, item);

                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(setIndex != -1);
                        #endif

            if (selectedItemIndex != setIndex)
            {
                if (selectedItemIndex != -1)
                {
                    items[selectedItemIndex].OnDeselected(reason);
                }
                selectedItemIndex = setIndex;

                var select = items[setIndex];

                var documentationUrl = select.DocumentationPageUrl;
                if (documentationUrl.Length > 0)
                {
                    PowerInspectorDocumentation.ShowFeatureIfWindowOpen(documentationUrl);
                }

                select.OnSelected(reason);
            }
        }
Example #5
0
        private void ShowDocumentationForMember([NotNull] IDrawer member)
        {
            if (member == this)
            {
                PowerInspectorDocumentation.ShowPreferencesIfWindowOpen("", OnFailToLoadDocumentationPage);
                OnAutoDocumentationUpdated(PowerInspectorDocumentation.PreferencesUrl);
                return;
            }

            var parent = member.Parent;

            if (parent != this && member != this && parent != null)
            {
                switch (parent.Name)
                {
                // Usually we want to get the documentation page for the member that is at the root of the preferences drawer.
                default:
                    for (; member.Parent != this && member.Parent != null; member = member.Parent)
                    {
                        ;
                    }
                    break;

                // Sometimes we have specific documentation pages for nested members too.
                case "Mouseover Effects":
                case "Default Inspector":
                case "Create Script Wizard":
                    break;
                }
            }

            var memberInfo = member.MemberInfo;

            if (memberInfo != null)
            {
                var name = memberInfo.DisplayName;
                var url  = GetDocumentationPageUrl(name);

                                #if DEV_MODE
                Debug.Log("Showing preferences documentation: " + url);
                                #endif

                PowerInspectorDocumentation.ShowPreferencesIfWindowOpen(url, OnFailToLoadDocumentationPage);
                OnAutoDocumentationUpdated(url);
            }
        }
        private void SetActiveView(int index)
        {
            if (index < 0)
            {
                index = 0;
            }
            else if (index >= Urls.Length)
            {
                index = Urls.Length - 1;
            }

            activeView = index;
            url        = PowerInspectorDocumentation.GetUrl(Urls[index].Value);

                        #if DEV_MODE
            Debug.Log("OPENING URL: " + url);
                        #endif

            webView.LoadURL(url);
            GUI.changed = true;
            Repaint();
        }
Example #7
0
 /// <inheritdoc/>
 protected override string OverrideDocumentationUrl(out string documentationTitle)
 {
     documentationTitle = "Preferences";
     return(PowerInspectorDocumentation.GetCategoryUrl("preferences"));
 }
Example #8
0
        protected void OpenDocumentationPage()
        {
            var url = DocumentationPageUrl;

            PowerInspectorDocumentation.OpenUrl(url);
        }
Example #9
0
 /// <inheritdoc/>
 protected override string OverrideDocumentationUrl([NotNull] out string documentationTitle)
 {
     documentationTitle = "Script Drawer";
     return(PowerInspectorDocumentation.GetDrawerInfoUrl("script-drawer"));
 }
Example #10
0
 private static void OpenDocumentation()
 {
     PowerInspectorDocumentation.ShowFeature("split-view");
 }