예제 #1
0
    public void EnableSectionByGuiName(string guiName)
    {
        GuiSection foundGuiSection = _guiSections.Find(x => x.GuiName == guiName);

        if (foundGuiSection != null)
        {
            foundGuiSection.Enable();
        }
    }
예제 #2
0
    public void DisableSectionByGuiName(string guiName)
    {
        GuiSection foundGuiSection = _guiSections.Find(x => x.GuiName == guiName);

        if (foundGuiSection != null)
        {
            foundGuiSection.Disable();
        }
        else
        {
            Debug.Log("guiName: " + guiName + " not found");
        }
    }
        protected void RenderGUI(List <GuiSection> leftSections, GuiSection topSection, GuiSection bottomSection, ScrollViewGuiSection mainScrollViewGuiSection)
        {
            EnsureInitialized();

            if (_renderMainScrollView == null)
            {
                _renderMainScrollView = mainScrollViewGuiSection.RenderMainScrollViewSection;
            }

            EditorGUILayout.BeginHorizontal(GUIStyle.none, GUILayout.ExpandWidth(true));
            {
                if (leftSections != null && leftSections.Any())
                {
                    EditorGUILayout.BeginVertical(GUILayout.Width(leftSections.First().WidthPx));
                    foreach (var leftSection in leftSections)
                    {
                        {
                            RenderSectionStart(leftSection);

                            foreach (var element in leftSection.ClickableElements)
                            {
                                var lastUpdateButton = element as LastUpdateButton;
                                if (lastUpdateButton != null)
                                {
                                    if (!string.IsNullOrWhiteSpace(LastUpdateText))
                                    {
                                        if (!IsUpdateTextViewAlreadyPreselected)
                                        {
                                            ChangeMainScrollViewRenderFn(lastUpdateButton.RenderMainScrollViewFunction);
                                            IsUpdateTextViewAlreadyPreselected = true;
                                        }
                                        RenderClickableElement(element);
                                    }
                                }
                                else
                                {
                                    RenderClickableElement(element);
                                }
                            }

                            GUILayout.Space(10);
                        }
                    }

                    EditorGUILayout.EndVertical();
                }


                EditorGUILayout.BeginVertical(GUILayout.Width(topSection.WidthPx), GUILayout.ExpandHeight(true));
                {
                    if (topSection != null)
                    {
                        RenderSectionStart(topSection);

                        if (topSection.ClickableElements.Count > 0)
                        {
                            EditorGUILayout.BeginHorizontal(GUILayout.Width(topSection.WidthPx));
                            {
                                foreach (var element in topSection.ClickableElements)
                                {
                                    RenderClickableElement(element);
                                }
                            }
                            EditorGUILayout.EndHorizontal();
                        }
                    }


                    if (mainScrollViewGuiSection != null)
                    {
                        RenderSectionStart(mainScrollViewGuiSection);
                        _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, "ProgressBarBack", GUILayout.ExpandHeight(true), GUILayout.Width(mainScrollViewGuiSection.WidthPx));

                        _renderMainScrollView(this);

                        GUILayout.EndScrollView();
                    }


                    if (bottomSection != null)
                    {
                        EditorGUILayout.BeginHorizontal(GUILayout.Width(bottomSection.WidthPx));
                        {
                            EditorGUILayout.BeginVertical();
                            {
                                RenderSectionStart(bottomSection);

                                EditorGUILayout.BeginHorizontal();
                                {
                                    for (var i = 0; i < bottomSection.ClickableElements.Count; i++)
                                    {
                                        var bottomLink = bottomSection.ClickableElements[i];
                                        if (GUILayout.Button(bottomLink.Text, LinkStyle))
                                        {
                                            bottomLink.OnClick(this);
                                        }

                                        if (i < bottomSection.ClickableElements.Count - 1)
                                        {
                                            GUILayout.Label("-");
                                        }
                                    }
                                }
                                EditorGUILayout.EndHorizontal();
                                GUILayout.Space(7);
                            }
                            EditorGUILayout.EndVertical();

                            GUILayout.FlexibleSpace();
                            EditorGUILayout.BeginVertical();
                            GUILayout.Space(7);
                            if (_productIcon != null)
                            {
                                GUILayout.Label(_productIcon);
                            }
                            EditorGUILayout.EndVertical();
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();


            EditorGUILayout.BeginHorizontal("ProjectBrowserBottomBarBg", GUILayout.ExpandWidth(true), GUILayout.Height(22));
            {
                GUILayout.FlexibleSpace();
                EditorGUI.BeginChangeCheck();
                var cache = EditorGUIUtility.labelWidth;
                EditorGUIUtility.labelWidth = 100;
                _startupStartupShowMode     = (ProductPreferenceBase.StartupShowMode)EditorGUILayout.EnumPopup("Show At Startup", _startupStartupShowMode, GUILayout.Width(220));
                EditorGUIUtility.labelWidth = cache;
                if (EditorGUI.EndChangeCheck())
                {
                    EditorPrefs.SetInt(ShowAtStartupPreferenceKey, (int)_startupStartupShowMode);
                }
            }
            EditorGUILayout.EndHorizontal();
        }