static Styles()
 {
     smallWarningIcon = EditorGUIUtility.LoadIconRequired("console.warnicon.sml");
     boldFoldout      = new GUIStyle(EditorStyles.foldout)
     {
         fontStyle = FontStyle.Bold
     };
 }
        static SettingsProvider CreateProjectSettingsProvider()
        {
            var provider = new AssetSettingsProvider("Project/Tags and Layers", "ProjectSettings/TagManager.asset")
            {
                icon = EditorGUIUtility.LoadIconRequired("CustomSorting")
            };

            provider.PopulateSearchKeywordsFromGUIContentProperties <Styles>();
            return(provider);
        }
        internal static SettingsProvider CreateProjectSettingsProvider()
        {
            var provider = new AssetSettingsProvider("Project/Quality", "ProjectSettings/QualitySettings.asset")
            {
                icon = EditorGUIUtility.LoadIconRequired("Profiler.Rendering")
            };

            provider.PopulateSearchKeywordsFromGUIContentProperties <Styles>();
            SettingsProvider.GetSearchKeywordsFromSerializedObject(provider.CreateEditor().serializedObject, provider.keywords);
            return(provider);
        }
示例#4
0
        public static GUIContent IconContent(string name, [DefaultValue("null")] string tooltip)
        {
            GUIContent gUIContent = (GUIContent)EditorGUIUtility.s_IconGUIContents[name];

            if (gUIContent != null)
            {
                return(gUIContent);
            }
            gUIContent = new GUIContent();
            if (tooltip != null)
            {
                string[] nameAndTooltipString = EditorGUIUtility.GetNameAndTooltipString(tooltip);
                if (nameAndTooltipString[2] != null)
                {
                    gUIContent.tooltip = nameAndTooltipString[2];
                }
            }
            gUIContent.image = EditorGUIUtility.LoadIconRequired(name);
            EditorGUIUtility.s_IconGUIContents[name] = gUIContent;
            return(gUIContent);
        }
示例#5
0
        internal static GUIContent TextContentWithIcon(string textAndTooltip, string icon)
        {
            if (textAndTooltip == null)
            {
                textAndTooltip = string.Empty;
            }
            GUIContent gUIContent = (GUIContent)EditorGUIUtility.s_TextGUIContents[textAndTooltip];

            if (gUIContent == null)
            {
                string[] nameAndTooltipString = EditorGUIUtility.GetNameAndTooltipString(textAndTooltip);
                gUIContent       = new GUIContent(nameAndTooltipString[1]);
                gUIContent.image = EditorGUIUtility.LoadIconRequired(icon);
                if (nameAndTooltipString[2] != null)
                {
                    gUIContent.tooltip = nameAndTooltipString[2];
                }
                EditorGUIUtility.s_TextGUIContents[textAndTooltip] = gUIContent;
            }
            return(gUIContent);
        }
        public static GUIContent IconContent(string name)
        {
            GUIContent gUIContent = (GUIContent)EditorGUIUtility.s_IconGUIContents[name];

            if (gUIContent == null)
            {
                if (EditorGUIUtility.s_ScriptInfos == null)
                {
                    EditorGUIUtility.LoadScriptInfos();
                }
                GUIContent gUIContent2 = (GUIContent)EditorGUIUtility.s_ScriptInfos[name];
                gUIContent = new GUIContent();
                if (gUIContent2 != null)
                {
                    gUIContent.tooltip = gUIContent2.tooltip;
                }
                gUIContent.image = EditorGUIUtility.LoadIconRequired(name);
                EditorGUIUtility.s_IconGUIContents[name] = gUIContent;
            }
            return(gUIContent);
        }
        public static GUIContent TextContentWithIcon(string text, string iconName)
        {
            if (!LocalizationDatabase.enableEditorLocalization)
            {
                return(EditorGUIUtility.TextContentWithIcon(text, iconName));
            }

            var groupName = GetGroupName(Assembly.GetCallingAssembly());

            if (groupName != null)
            {
                var new_text = LocalizationDatabase.GetLocalizedStringWithGroupName(text, groupName);
                var gc       = new GUIContent(new_text);
                gc.image = EditorGUIUtility.LoadIconRequired(iconName);
                return(gc);
            }
            else
            {
                return(EditorGUIUtility.TextContentWithIcon(text, iconName));
            }
        }
        public static GUIContent IconContent(string iconName, string tooltip = null)
        {
            if (!LocalizationDatabase.enableEditorLocalization)
            {
                return(EditorGUIUtility.TrIconContent(iconName, tooltip));
            }

            var groupName = GetGroupName(Assembly.GetCallingAssembly());

            if (groupName != null)
            {
                var new_tooltip = LocalizationDatabase.GetLocalizedStringWithGroupName(tooltip, groupName);
                var gc          = new GUIContent();
                gc.tooltip = new_tooltip;
                gc.image   = EditorGUIUtility.LoadIconRequired(iconName);
                return(gc);
            }
            else
            {
                return(EditorGUIUtility.TrIconContent(iconName, tooltip));
            }
        }
示例#9
0
        private GUIContent asGUIContent()
        {
            var dpi                = EditorGUIUtility.pixelsPerPoint;
            var resourcePath       = m_CurrentResourcePath;
            var resourceDpi        = 1.0f;
            var normalResourcePath = m_TextureResources[0].resourcePath;

            for (int i = 0, count = m_TextureResources.Count; i < count; ++i)
            {
                var currentResource = m_TextureResources[i];
                resourcePath = currentResource.resourcePath;
                resourceDpi  = currentResource.pixelsPerPoint;
                if (resourceDpi >= dpi)
                {
                    break;
                }
            }

            if (resourcePath != m_CurrentResourcePath)
            {
                Texture2D loadedResource = EditorGUIUtility.LoadIconRequired(normalResourcePath);
                loadedResource.pixelsPerPoint = resourceDpi;

                m_GuiContent.image    = loadedResource;
                m_CurrentResourcePath = resourcePath;
            }

            if (resourceDpi != GUIUtility.pixelsPerPoint)
            {
                Texture2D image = m_GuiContent.image as Texture2D;
                if (image != null)
                {
                    image.filterMode = FilterMode.Bilinear;
                }
            }

            return(m_GuiContent);
        }
        void UpdateViewToolIcon()
        {
            if (!Tools.viewToolActive)
            {
                return;
            }

            switch (Tools.viewTool)
            {
            case ViewTool.Orbit:
            case ViewTool.FPS:
                collapsedIcon = EditorGUIUtility.LoadIconRequired("ViewToolOrbit");
                break;

            case ViewTool.Pan:
                collapsedIcon = EditorGUIUtility.LoadIconRequired("ViewToolMove");
                break;

            case ViewTool.Zoom:
                collapsedIcon = EditorGUIUtility.LoadIconRequired("ViewToolZoom");
                break;
            }
        }
 public Resources()
 {
     this.smallWarningIcon = EditorGUIUtility.LoadIconRequired("console.warnicon.sml");
 }
示例#12
0
        public void SetupGUI()
        {
            var root = this.GetRootVisualContainer();

            root.AddStyleSheetPath("StyleSheets/CollabHistoryCommon.uss");
            if (EditorGUIUtility.isProSkin)
            {
                root.AddStyleSheetPath("StyleSheets/CollabHistoryDark.uss");
            }
            else
            {
                root.AddStyleSheetPath("StyleSheets/CollabHistoryLight.uss");
            }

            m_Container = new VisualElement();
            m_Container.StretchToParentSize();
            root.Add(m_Container);

            m_Pager = new PagedListView()
            {
                name     = "PagedElement",
                pageSize = m_ItemsPerPage
            };

            var errorView = new StatusView()
            {
                message = "An Error Occurred",
                icon    = EditorGUIUtility.LoadIconRequired("Collab.Warning") as Texture,
            };

            var noInternetView = new StatusView()
            {
                message = "No Internet Connection",
                icon    = EditorGUIUtility.LoadIconRequired("Collab.NoInternet") as Texture,
            };

            var maintenanceView = new StatusView()
            {
                message = "Maintenance",
            };

            var loginView = new StatusView()
            {
                message    = "Sign in to access Collaborate",
                buttonText = "Sign in...",
                callback   = SignInClick,
            };

            var noSeatView = new StatusView()
            {
                message    = "Ask your project owner for access to Unity Teams",
                buttonText = "Learn More",
                callback   = NoSeatClick,
            };

            var waitingView = new StatusView()
            {
                message = "Updating...",
            };

            m_HistoryView = new ScrollView()
            {
                name = "HistoryContainer", showHorizontal = false
            };
            m_HistoryView.contentContainer.StretchToParentWidth();
            m_HistoryView.Add(m_Pager);

            m_Views = new Dictionary <HistoryState, VisualElement>()
            {
                { HistoryState.Error, errorView },
                { HistoryState.Offline, noInternetView },
                { HistoryState.Maintenance, maintenanceView },
                { HistoryState.LoggedOut, loginView },
                { HistoryState.NoSeat, noSeatView },
                { HistoryState.Waiting, waitingView },
                { HistoryState.Ready, m_HistoryView }
            };
        }
 static Styles()
 {
     smallWarningIcon = EditorGUIUtility.LoadIconRequired("console.warnicon.sml");
 }
        public void SetupGUI()
        {
            VisualElement rootVisualContainer = this.GetRootVisualContainer();

            rootVisualContainer.AddStyleSheetPath("StyleSheets/CollabHistoryCommon.uss");
            if (EditorGUIUtility.isProSkin)
            {
                rootVisualContainer.AddStyleSheetPath("StyleSheets/CollabHistoryDark.uss");
            }
            else
            {
                rootVisualContainer.AddStyleSheetPath("StyleSheets/CollabHistoryLight.uss");
            }
            this.m_Container = new VisualElement();
            this.m_Container.StretchToParentSize();
            rootVisualContainer.Add(this.m_Container);
            this.m_Pager = new PagedListView
            {
                name     = "PagedElement",
                PagerLoc = PagerLocation.Top,
                pageSize = this.m_ItemsPerPage
            };
            StatusView value = new StatusView
            {
                message = "An Error Occurred",
                icon    = EditorGUIUtility.LoadIconRequired("Collab.Warning")
            };
            StatusView value2 = new StatusView
            {
                message = "No Internet Connection",
                icon    = EditorGUIUtility.LoadIconRequired("Collab.NoInternet")
            };
            StatusView value3 = new StatusView
            {
                message = "Maintenance"
            };
            StatusView value4 = new StatusView
            {
                message    = "Sign in to access Collaborate",
                buttonText = "Sign in...",
                callback   = new Action(this.SignInClick)
            };
            StatusView value5 = new StatusView
            {
                message    = "Ask your project owner for access to Unity Teams",
                buttonText = "Learn More",
                callback   = new Action(this.NoSeatClick)
            };
            StatusView value6 = new StatusView
            {
                message = "Connecting..."
            };
            ScrollView scrollView = new ScrollView
            {
                name           = "HistoryContainer",
                showHorizontal = false
            };

            scrollView.contentContainer.StretchToParentWidth();
            scrollView.Add(this.m_Pager);
            this.m_Views = new Dictionary <HistoryState, VisualElement>
            {
                {
                    HistoryState.Error,
                    value
                },
                {
                    HistoryState.Offline,
                    value2
                },
                {
                    HistoryState.Maintenance,
                    value3
                },
                {
                    HistoryState.LoggedOut,
                    value4
                },
                {
                    HistoryState.NoSeat,
                    value5
                },
                {
                    HistoryState.Waiting,
                    value6
                },
                {
                    HistoryState.Ready,
                    scrollView
                }
            };
        }