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; }
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; }