void HGAssets::saveCurrentLocalProfile() { if(currentProfilePtr == nullptr) return; ssvuj::Obj profileRoot; ssvuj::arch(profileRoot, "version", Config::getVersion()); ssvuj::arch(profileRoot, "name", getCurrentLocalProfile().getName()); ssvuj::arch(profileRoot, "scores", getCurrentLocalProfile().getScores()); for(const auto& n : getCurrentLocalProfile().getTrackedNames()) profileRoot["trackedNames"].append(n); ssvuj::writeToFile(profileRoot, getCurrentLocalProfileFilePath()); }
inline void pAddTrackedName(const std::string& mName) { if(!playingLocally) { Online::trySendAddFriend(mName); return; } getCurrentLocalProfile().addTrackedName(mName); }
inline void pClearTrackedNames() { if(!playingLocally) { Online::trySendClearFriends(); return; } getCurrentLocalProfile().clearTrackedNames(); }
inline const std::vector<std::string>& pGetTrackedNames() const { if(!playingLocally) return Online::getUserStats().trackedNames; return getCurrentLocalProfile().getTrackedNames(); }
inline std::string pGetName() const { if(!playingLocally) return Online::getCurrentUsername(); return getCurrentLocalProfile().getName(); }
void HGAssets::setLocalScore(const string& mId, float mScore) { getCurrentLocalProfile().setScore(mId, mScore); }
float HGAssets::getLocalScore(const string& mId) { return getCurrentLocalProfile().getScore(mId); }