Node* CSLoader::createNode(const std::string &filename, const ccNodeLoadCallback &callback) { std::string path = filename; size_t pos = path.find_last_of('.'); std::string suffix = path.substr(pos + 1, path.length()); CSLoader* load = CSLoader::getInstance(); if (suffix == "csb") { return load->createNodeWithFlatBuffersFile(filename, callback); } return nullptr; }
Node* CSLoader::createNode(const std::string& filename) { std::string path = filename; size_t pos = path.find_last_of('.'); std::string suffix = path.substr(pos + 1, path.length()); CSLoader* load = CSLoader::getInstance(); if (suffix == "csb") { return load->createNodeWithFlatBuffersFile(filename); } else if (suffix == "json" || suffix == "ExportJson") { return load->createNodeFromJson(filename); } return nullptr; }