コード例 #1
0
ファイル: CSLoader.cpp プロジェクト: MinhHTML5/FocusFire
ActionTimeline* CSLoader::createTimeline(const std::string &filename)
{
    std::string suffix = getExtentionName(filename);
    
    ActionTimelineCache* cache = ActionTimelineCache::getInstance();
    
    if (suffix == "csb")
    {
        return cache->createActionWithFlatBuffersFile(filename);
    }
    else if (suffix == "json" || suffix == "ExportJson")
    {
        return cache->createActionFromJson(filename);
    }
    
    return nullptr;
}
コード例 #2
0
ファイル: CSLoader.cpp プロジェクト: MinhHTML5/FocusFire
ActionTimeline* CSLoader::createTimeline(const Data& data, const std::string& filename)
{
    std::string suffix = getExtentionName(filename);

    ActionTimelineCache* cache = ActionTimelineCache::getInstance();

    if (suffix == "csb")
    {
        return cache->createActionWithDataBuffer(data, filename);
    }
    else if (suffix == "json" || suffix == "ExportJson")
    {
        std::string content((char *)data.getBytes(), data.getSize());
        return cache->createActionFromContent(filename, content);
    }

    return nullptr;
}
コード例 #3
0
ActionTimeline* ActionTimelineCache::createAction(const std::string& filename)
{
    std::string path = filename;
    size_t pos = path.find_last_of('.');
    std::string suffix = path.substr(pos + 1, path.length());
    
    ActionTimelineCache* cache = ActionTimelineCache::getInstance();
    
    if (suffix == "csb")
    {
        return cache->createActionWithFlatBuffersFile(filename);
    }
    else if (suffix == "json" || suffix == "ExportJson")
    {
        return cache->createActionFromJson(filename);
    }
    
    return nullptr;
}