|
|
|
@@ -156,23 +156,28 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
|
|
|
|
{
|
|
|
|
|
TextureAtlasDataReader textureAtlasDataReader = new TextureAtlasDataReader();
|
|
|
|
|
FileInfo[] skinFiles = Directory.GetParent(path).GetFiles();
|
|
|
|
|
Dictionary<string, string> fileNameWithPath = new Dictionary<string, string>();
|
|
|
|
|
Dictionary<string, string> filePath = new Dictionary<string, string>();
|
|
|
|
|
for (int i = 0; i < skinFiles.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
fileNameWithPath.Add(skinFiles[i].Name, skinFiles[i].FullName);
|
|
|
|
|
filePath.Add(skinFiles[i].Name, skinFiles[i].FullName);
|
|
|
|
|
}
|
|
|
|
|
TextureAtlasDataReader tatlasDataReader = new TextureAtlasDataReader();
|
|
|
|
|
TextureAtlasData atlasData;
|
|
|
|
|
using (FileStream fileStream = new FileStream(filePath[skinData.nameOfTextureAtlas], FileMode.Open))
|
|
|
|
|
{
|
|
|
|
|
atlasData = tatlasDataReader.ReadTextureAtlasData(new BinaryReader(fileStream));
|
|
|
|
|
}
|
|
|
|
|
TextureAtlasData atlasData = JsonConvert.DeserializeObject<TextureAtlasData>(fileNameWithPath[skinData.nameOfTextureAtlas]);
|
|
|
|
|
Texture2D atlasTexture;
|
|
|
|
|
using (FileStream stream = new FileStream(fileNameWithPath[atlasData.textureName], FileMode.Open))
|
|
|
|
|
using (FileStream stream = new FileStream(filePath[atlasData.textureName], FileMode.Open))
|
|
|
|
|
{
|
|
|
|
|
atlasTexture = Texture2D.FromStream(graphicsDevice, stream);
|
|
|
|
|
}
|
|
|
|
|
TextureAtlas.Region[] regions = textureAtlasDataReader.GenerateAtlasRegionsFromData(atlasData, atlasTexture);
|
|
|
|
|
TextureAtlas textureAtlas = new TextureAtlas(atlasTexture, regions);
|
|
|
|
|
Texture2D cursorTexture;
|
|
|
|
|
if (Path.HasExtension(skinData.cursorTextureName) && fileNameWithPath.ContainsKey(skinData.cursorTextureName))
|
|
|
|
|
if (Path.HasExtension(skinData.cursorTextureName) && filePath.ContainsKey(skinData.cursorTextureName))
|
|
|
|
|
{
|
|
|
|
|
using (FileStream stream = new FileStream(fileNameWithPath[skinData.cursorTextureName], FileMode.Open))
|
|
|
|
|
using (FileStream stream = new FileStream(filePath[skinData.cursorTextureName], FileMode.Open))
|
|
|
|
|
{
|
|
|
|
|
cursorTexture = Texture2D.FromStream(graphicsDevice, stream);
|
|
|
|
|
}
|
|
|
|
|