Example #1
0
	void loadLevelData()
	{
		for(auto filePath : getAllFilePaths("Levels/", ".json"))
		{
			LevelData levelData{loadLevelFromJson(getJsonFileRoot(filePath))};
			levelDataMap.insert(make_pair(levelData.getId(), levelData)); // replace with getId
		}
	}
Example #2
0
	void loadLevelData(const string& mPath)
	{
		for(auto filePath : getScan<Mode::Single, Type::File, Pick::ByExt>(mPath + "Levels/", ".json"))
		{
			Json::Value root{getRootFromFile(filePath)};
			string luaScriptPath{mPath + "Scripts/" + root["lua_file"].asString()};

			LevelData levelData{loadLevelFromJson(root)};
			levelData.setPackPath(mPath);
			levelData.setLevelRootPath(filePath);
			levelData.setStyleRootPath(getStyleData(levelData.getStyleId()).getRootPath());
			levelData.setLuaScriptPath(luaScriptPath);
			levelDataMap.insert(make_pair(levelData.getId(), levelData));
			levelIdsByPackMap[levelData.getPackPath()].push_back(levelData.getId());
		}
	}