Пример #1
0
        private static EditorTexture GetResourcesTypeIcon(string fileName)
        {
            if (!resourcesTypeIcons.TryGetValue(fileName, out var icon))
            {
                icon = PluginResources.LoadSharedIcon($"Icons/Types/{fileName}.png", false);
                resourcesTypeIcons.Add(fileName, icon);
            }

            return(icon);
        }
Пример #2
0
        public static EditorTexture Namespace(Namespace @namespace)
        {
            Ensure.That(nameof(@namespace)).IsNotNull(@namespace);

            if (@namespace.IsGlobal)
            {
                return(Language.@namespace.@public);
            }

            if (!namespaceIcons.ContainsKey(@namespace))
            {
                var path = $"Icons/Namespaces/{@namespace}.png";

                namespaceIcons.Add(@namespace, PluginResources.LoadSharedIcon(path, false) ?? Language.@namespace.@public);
            }

            return(namespaceIcons[@namespace]);
        }
Пример #3
0
        public static EditorTexture Enum(Enum @enum)
        {
            Ensure.That(nameof(@enum)).IsNotNull(@enum);

            if (!enumIcons.ContainsKey(@enum))
            {
                var enumType = @enum.GetType();

                if (!enumType.IsEnum)
                {
                    throw new ArgumentException(nameof(@enum));
                }

                var namespaced    = PluginResources.LoadSharedIcon($"Icons/Enums/{enumType.CSharpFileName(true)}/{@enum}.png", false);
                var nonNamespaced = PluginResources.LoadSharedIcon($"Icons/Enums/{enumType.CSharpFileName(false)}/{@enum}.png", false);

                enumIcons.Add(@enum, namespaced ?? nonNamespaced);
            }

            return(enumIcons[@enum]);
        }