Exemplo n.º 1
0
        static MaterialUIIconHelper()
        {
            if (m_Font == null)
            {
                m_Font = VectorImageManager.GetIconFont(VectorImageManager.materialUIIconsFontName);
            }

            if (m_IconSet == null)
            {
                m_IconSet = VectorImageManager.GetIconSet(VectorImageManager.materialUIIconsFontName);
            }
        }
Exemplo n.º 2
0
        public static ImageData GetIcon(string set, MaterialIconEnum name)
        {
            VectorImageSet iconSet = VectorImageManager.GetIconSet(set);
            Glyph          glyph   = iconSet.iconGlyphList.FirstOrDefault(x => x.name.ToLower().Equals(name.ToString().ToLower()));
            Font           font    = VectorImageManager.GetIconFont(set);

            if (glyph == null)
            {
                Debug.LogError("Could not find an icon with the name: " + name + " inside the MaterialDesign icon font");
                return(null);
            }
            return(new ImageData(new VectorImageData(glyph, font)));
        }
        private void UpdateFontPackInfo()
        {
            string name = m_VectorImageData.font.name;

            m_VectorImageSet = VectorImageManager.GetIconSet(name);
            m_IconFont       = VectorImageManager.GetIconFont(name);
            m_GuiStyle       = new GUIStyle {
                font = m_IconFont
            };
            m_GuiStyle.normal.textColor = Color.white;

            UpdateGlyphList();

            // Assign the very first icon of the imageSet if the glyph is null
            Glyph glyph = m_VectorImageSet.iconGlyphList.Where(x => x.name.Equals(m_VectorImageData.glyph.name) && x.unicode.Equals(m_VectorImageData.glyph.unicode.Replace("\\u", ""))).FirstOrDefault();

            if (glyph == null)
            {
                SetGlyph(0);
            }
        }