Пример #1
0
        public static Texture GetAttributeIcon(Type attributeType)
        {
            if (attributeType == null)
            {
                throw new ArgumentNullException("attributeType");
            }

            Texture icon;

            if (AttributeIconMap.TryGetValue(attributeType, out icon) == false)
            {
                OdinRegisterAttributeAttribute registration;
                if (AttributeRegisterMap.TryGetValue(attributeType, out registration))
                {
                    if (registration.PngEncodedIcon != null)
                    {
                        icon = TextureUtilities.LoadImage(0, 0, System.Convert.FromBase64String(registration.PngEncodedIcon));
                    }
                    else if (registration.IconPath != null)
                    {
                        Debug.LogWarning("OdinRegisterAttribute.IconPath is not yet supported.");
                        icon = null;
                    }
                }

                AttributeIconMap.Add(attributeType, icon);
            }

            return(icon);
        }