Beispiel #1
0
	void HGAssets::loadAssets()
	{
		lo("::loadAssets") << "loading local profiles" << endl; loadLocalProfiles();

		for(const auto& packPath : getScan<Mode::Single, Type::Folder>("Packs/"))
		{
			const auto& packPathStr(packPath.getStr());
			string packName{packPathStr.substr(6, packPathStr.size() - 7)}, packLua;
			for(const auto& p : getScan<Mode::Recurse, Type::File, Pick::ByExt>(packPath, ".lua")) packLua.append(getFileContents(p));

			ssvuj::Obj packRoot{getFromFile(packPath + "/pack.json")};
			ssvu::getEmplaceUptrMap<PackData>(packDatas, packName, packName, getExtr<string>(packRoot, "name"), getExtr<float>(packRoot, "priority"));
		}

		for(auto& p : packDatas)
		{
			const auto& pd(p.second);
			string packId{pd->id}, packPath{"Packs/" + packId + "/"};
			packIds.emplace_back(packId);
			packPaths.emplace_back(packPath);
			if(!levelsOnly) {	lo("::loadAssets") << "loading " << packId << " music\n";			loadMusic(packPath); }
			if(!levelsOnly) {	lo("::loadAssets") << "loading " << packId << " music data\n";		loadMusicData(packPath); }
								lo("::loadAssets") << "loading " << packId << " style data\n";		loadStyleData(packPath);
								lo("::loadAssets") << "loading " << packId << " level data\n";		loadLevelData(packPath);
			if(!levelsOnly) {	lo("::loadAssets") << "loading " << packId << " custom sounds\n";	loadCustomSounds(packId, packPath); }

			lo().flush();
		}
	}
Beispiel #2
0
	void HGAssets::loadStyleData(const Path& mPath)
	{
		for(const auto& p : getScan<Mode::Single, Type::File, Pick::ByExt>(mPath + "Styles/", ".json"))
		{
			StyleData styleData{getFromFile(p), p};
			styleDataMap.insert(make_pair(styleData.id, styleData));
		}
	}
Beispiel #3
0
	void HGAssets::loadMusicData(const Path& mPath)
	{
		for(const auto& p : getScan<Mode::Single, Type::File, Pick::ByExt>(mPath + "Music/", ".json"))
		{
			MusicData musicData{loadMusicFromJson(getFromFile(p))};
			musicDataMap.insert(make_pair(musicData.id, musicData));
		}
	}
Beispiel #4
0
	HGAssets::HGAssets(bool mLevelsOnly) : levelsOnly{mLevelsOnly}
	{
		if(!levelsOnly) loadAssetsFromJson(assetManager, "Assets/", getFromFile("Assets/assets.json"));
		loadAssets();

		for(auto& v : levelDataIdsByPack) sort(begin(v.second), end(v.second), [&](const string& mA, const string& mB){ return levelDatas[mA]->menuPriority < levelDatas[mB]->menuPriority; });
		sort(begin(packIds), end(packIds), [&](const string& mA, const string& mB){ return packDatas[mA]->priority < packDatas[mB]->priority; });
	}
Beispiel #5
0
	void HGAssets::loadLevelData(const Path& mPath)
	{
		for(const auto& p : getScan<Mode::Single, Type::File, Pick::ByExt>(mPath + "Levels/", ".json"))
		{
			auto levelData(new LevelData{getFromFile(p), mPath});
			levelDataIdsByPack[levelData->packPath].emplace_back(levelData->id);
			levelDatas.insert(make_pair(levelData->id, Uptr<LevelData>(levelData)));
		}
	}
Beispiel #6
0
	void HGAssets::loadLocalProfiles()
	{
		for(const auto& p : getScan<Mode::Single, Type::File, Pick::ByExt>("Profiles/", ".json"))
		{
			//string fileName{getNameFromPath(p, "Profiles/", ".json")};

			ProfileData profileData{loadProfileFromJson(getFromFile(p))};
			profileDataMap.insert(make_pair(profileData.getName(), profileData));
		}
	}
Beispiel #7
0
int digitEmbedder(Bool_t fromFile = true, Int_t simEvOffset = 0, TString filename = "mydigits.root")
{
    AliLog::SetGlobalLogLevel(AliLog::kInfo);
    if (!fromFile)
    {
        retreiveCalibrationData(137366);
        getSimulatedDigits(".");
    }
    else
    {
        retreiveCalibrationData(137366);
        //addBadChannels(0.0);
        getFromFile(filename);
        mergeDigits(".", simEvOffset);
    }

    return 0;
}
Beispiel #8
0
/* 'fgets' function.
 * The problem is fgets doesn't works correctly with
 * binary opened files. ( WHY ??? ).
 */
void rfc::String::getFromFile(char *data, const uint32_t maxLen, FILE * &fileIn)
{
	strcpy(data, getFromFile(fileIn).toLatin1());
} /* end of 'getFromFile' function */
Beispiel #9
0
GFLC_FILE_INFORMATION :: GFLC_FILE_INFORMATION(
	const std::string &filename
	)
{
	getFromFile(filename.data()); 
}
Beispiel #10
0
GFLC_FILE_INFORMATION :: GFLC_FILE_INFORMATION(
	const char *filename
	)
{
	getFromFile(filename); 
}