use of com.faforever.client.achievements.AchievementItemController in project downlords-faf-client by FAForever.
the class UserInfoWindowController method setAvailableAchievements.
private void setAvailableAchievements(List<AchievementDefinition> achievementDefinitions) {
ObservableList<Node> children = lockedAchievementsContainer.getChildren();
Platform.runLater(children::clear);
achievementDefinitions.forEach(achievementDefinition -> {
AchievementItemController controller = uiService.loadFxml("theme/achievement_item.fxml");
controller.setAchievementDefinition(achievementDefinition);
achievementDefinitionById.put(achievementDefinition.getId(), achievementDefinition);
achievementItemById.put(achievementDefinition.getId(), controller);
Platform.runLater(() -> children.add(controller.getRoot()));
});
}
use of com.faforever.client.achievements.AchievementItemController in project downlords-faf-client by FAForever.
the class UserInfoWindowController method updatePlayerAchievements.
private void updatePlayerAchievements(List<? extends PlayerAchievement> playerAchievements) {
PlayerAchievement mostRecentPlayerAchievement = null;
ObservableList<Node> children = unlockedAchievementsContainer.getChildren();
Platform.runLater(children::clear);
for (PlayerAchievement playerAchievement : playerAchievements) {
AchievementItemController achievementItemController = achievementItemById.get(playerAchievement.getAchievement().getId());
achievementItemController.setPlayerAchievement(playerAchievement);
if (isUnlocked(playerAchievement)) {
Platform.runLater(() -> children.add(achievementItemController.getRoot()));
if (mostRecentPlayerAchievement == null || playerAchievement.getUpdateTime().compareTo(mostRecentPlayerAchievement.getUpdateTime()) > 0) {
mostRecentPlayerAchievement = playerAchievement;
}
}
}
if (mostRecentPlayerAchievement == null) {
mostRecentAchievementPane.setVisible(false);
} else {
mostRecentAchievementPane.setVisible(true);
AchievementDefinition mostRecentAchievement = achievementDefinitionById.get(mostRecentPlayerAchievement.getAchievement().getId());
if (mostRecentAchievement == null) {
return;
}
String mostRecentAchievementName = mostRecentAchievement.getName();
String mostRecentAchievementDescription = mostRecentAchievement.getDescription();
Platform.runLater(() -> {
mostRecentAchievementNameLabel.setText(mostRecentAchievementName);
mostRecentAchievementDescriptionLabel.setText(mostRecentAchievementDescription);
mostRecentAchievementImageView.setImage(achievementService.getImage(mostRecentAchievement, UNLOCKED));
});
}
}
Aggregations