mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-26 00:45:20 +00:00
29 lines
820 B
C#
29 lines
820 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using MonoGame.Extended.BitmapFonts;
|
|
using MonoGame.Extended.TextureAtlases;
|
|
|
|
namespace MonoGame.Extended.Gui.Serialization
|
|
{
|
|
public class GuiJsonConverterService
|
|
{
|
|
private readonly Dictionary<string, BitmapFont> _bitmapFonts;
|
|
private readonly TextureAtlas _textureAtlas;
|
|
|
|
public GuiJsonConverterService(TextureAtlas textureAtlas, IEnumerable<BitmapFont> bitmapFonts)
|
|
{
|
|
_textureAtlas = textureAtlas;
|
|
_bitmapFonts = bitmapFonts.ToDictionary(f => f.Name);
|
|
}
|
|
|
|
public TextureRegion2D GetTextureRegion(string name)
|
|
{
|
|
return _textureAtlas[name];
|
|
}
|
|
|
|
public BitmapFont GetFont(string name)
|
|
{
|
|
return _bitmapFonts[name];
|
|
}
|
|
}
|
|
} |