예제 #1
0
bool GAFAsset::initWithGAFFile(const std::string& filePath, GAFTextureLoadDelegate_t delegate, GAFLoader* customLoader /*= nullptr*/)
{
    m_gafFileName = filePath;
    std::string fullfilePath = cocos2d::FileUtils::getInstance()->fullPathForFilename(filePath);

    bool isLoaded = false;
    if (customLoader)
    {
        isLoaded = customLoader->loadFile(fullfilePath, this);
    }
    else
    {
        GAFLoader* loader = new GAFLoader();
        isLoaded = loader->loadFile(fullfilePath, this);
        delete loader;
    }

    if (m_timelines.empty())
    {
        return false;
    }
    if (isLoaded && m_state == State::Normal)
    {
        m_textureManager = new GAFAssetTextureManager();
        GAFShaderManager::Initialize();
        loadTextures(fullfilePath, delegate);
    }

    return isLoaded;
}
예제 #2
0
파일: GAFAsset.cpp 프로젝트: w1ng/Quick-3.3
bool GAFAsset::initWithGAFFile(const std::string& filePath, GAFTextureLoadDelegate_t delegate)
{
    GAFLoader* loader = new GAFLoader();

    m_gafFileName = filePath;
    std::string fullfilePath = cocos2d::FileUtils::getInstance()->fullPathForFilename(filePath);

    bool isLoaded = loader->loadFile(fullfilePath, this);

    if (m_timelines.empty())
    {
        delete loader;
        return false;
    }
    if (isLoaded)
    {
        loadTextures(fullfilePath, delegate);
    }

    delete loader;

    return isLoaded;
}