Files
PCK-Studio/PckStudio.Core/Deserializer/AtlasDeserializer.cs
2025-11-20 02:45:41 +01:00

25 lines
742 B
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OMI.Formats.Pck;
using PckStudio.Core.Extensions;
using PckStudio.Interfaces;
namespace PckStudio.Core.Deserializer
{
public sealed class AtlasDeserializer : IPckAssetDeserializer<Atlas>
{
private readonly AtlasResource _resourceLocation;
public AtlasDeserializer(ResourceLocation resourceLocation)
{
_resourceLocation = resourceLocation as AtlasResource ?? throw new InvalidDataException(nameof(resourceLocation));
}
public Atlas Deserialize(PckAsset asset) => Atlas.FromResourceLocation(asset.GetTexture(), _resourceLocation);
}
}