#include "AssetManager.h"
#include "Asset/Asset_Script.h"

AssetManager::AssetManager()
{
}
AssetManager::~AssetManager()
{
}

AniScriptParser::AniInfo AssetManager::StructAniInfo(std::string path)
{
    std::vector<BYTE> Data = Asset_Script::GetInstance().GetFileContentByte(path);
    if (Data.size() > 0)
    {
        Blob blob(Data);
        return AniScriptParser::StructAniInfo(blob);
    }
    SDL_LogError(0, "Ani加载失败 Error : %s", path.c_str());
    return AniScriptParser::AniInfo();
}

AniScriptParser::AlsInfo AssetManager::StructAlsInfo(std::string path)
{
    std::vector<BYTE> Data = Asset_Script::GetInstance().GetFileContentByte(path);
    if (Data.size() > 0)
    {
        ScriptData Pvf;
        Pvf.Init(Data, path);
        AniScriptParser::AlsInfo Info = AniScriptParser::StructAlsInfo(Pvf);
        return Info;
    }
    SDL_LogError(0, "Als加载失败 Error : %s", path.c_str());
    return AniScriptParser::AlsInfo();
}

ScriptData AssetManager::GetScriptInfo(std::string path)
{
    std::vector<BYTE> Data = Asset_Script::GetInstance().GetFileContentByte(path);
    if (Data.size() > 0)
    {
        ScriptData Pvf;
        Pvf.Init(Data, path);
        return Pvf;
    }
    SDL_LogError(0, "Script加载失败 Error : %s", path.c_str());
    return ScriptData();
}
