forked from External/mage
Changed history handling for user a bit. Added history to table waiting dialog and user avatar tooltip.
This commit is contained in:
parent
24dddd3e06
commit
151e678e84
9 changed files with 102 additions and 79 deletions
|
|
@ -88,7 +88,6 @@ public class User {
|
|||
private UserState userState;
|
||||
private UserData userData;
|
||||
private UserStats userStats;
|
||||
private String history;
|
||||
|
||||
public User(String userName, String host) {
|
||||
this.userId = UUID.randomUUID();
|
||||
|
|
@ -108,12 +107,7 @@ public class User {
|
|||
this.watchedGames = new ArrayList<>();
|
||||
this.tablesToDelete = new ArrayList<>();
|
||||
this.sessionId = "";
|
||||
this.userStats = UserStatsRepository.instance.getUser(this.userName);
|
||||
if (userStats != null) {
|
||||
this.history = userStatsToString(userStats.getProto());
|
||||
} else {
|
||||
this.history = "<No Games yet>";
|
||||
}
|
||||
this.userStats = null;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
@ -406,6 +400,12 @@ public class User {
|
|||
this.userData.update(userData);
|
||||
} else {
|
||||
this.userData = userData;
|
||||
this.userStats = UserStatsRepository.instance.getUser(this.userName);
|
||||
if (userStats != null) {
|
||||
this.userData.setHistory(userStatsToString(userStats.getProto()));
|
||||
} else {
|
||||
this.userData.setHistory("<new player>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -549,11 +549,16 @@ public class User {
|
|||
// resetUserStats loads UserStats from DB.
|
||||
public void resetUserStats() {
|
||||
this.userStats = UserStatsRepository.instance.getUser(this.userName);
|
||||
this.history = userStatsToString(userStats.getProto());
|
||||
if (userData != null) {
|
||||
userData.setHistory(userStatsToString(userStats.getProto()));
|
||||
}
|
||||
}
|
||||
|
||||
public String getHistory() {
|
||||
return history;
|
||||
if (userData != null) {
|
||||
return userData.getHistory();
|
||||
}
|
||||
return "<not available>";
|
||||
}
|
||||
|
||||
private static String userStatsToString(ResultProtos.UserStatsProto proto) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue