-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserdata.h
More file actions
43 lines (37 loc) · 1.16 KB
/
Copy pathuserdata.h
File metadata and controls
43 lines (37 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef USERDATA_H
#define USERDATA_H
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include <iostream>
struct UserScore {
std::string username;
std::string songName;
int score;
int pureCount;
int farCount;
int lostCount;
int maxCombo;
double accuracy;
};
class UserManager {
private:
std::string currentUser;
std::map<std::string, std::vector<UserScore>> userScores;
std::string dataFile = "userdata.txt";
public:
UserManager(); // ??????????
void setCurrentUser(const std::string& username);
std::string getCurrentUser() const;
void saveScore(const std::string& songName, int score, int pureCount, int farCount, int lostCount, int maxCombo, double accuracy);
std::vector<UserScore> getUserScores(const std::string& username) const;
std::vector<UserScore> getSongRanking(const std::string& songName) const;
bool hasScoreForSong(const std::string& username, const std::string& songName) const;
std::vector<std::string> getAllUsers() const;
// ?????????????????
void saveToFile();
void loadFromFile();
};
#endif