示例#1
0
        public static SpriteFont GetFont(FONT_ID fontId)
        {
            if (null == Content)
            {
                throw new ContentNotDefinedException();
            }

            if (fonts.ContainsKey(fontId))
            {
                return(fonts[fontId]);
            }
            else
            {
                SpriteFont newFont = Content.Load <SpriteFont>(fontNames[(int)fontId]);
                fonts.Add(fontId, newFont);
                return(newFont);
            }
        }
        public static SpriteFont GetFont(FONT_ID fontId)
        {
            if (null == Content)
            {
                throw new ContentNotDefinedException();
            }

            if (fonts.ContainsKey(fontId))
            {
                return fonts[fontId];
            }
            else
            {
                SpriteFont newFont = Content.Load<SpriteFont>(fontNames[(int)fontId]);
                fonts.Add(fontId, newFont);
                return newFont;
            }
        }