Refactor Leaderboard widget to allow partial updates

Similarly to the Progress widget (though without the separate object for each box, because each Leaderboard unit is just three text fields stacked vertically), AchievementLeaderboardWidget.UpdateData will now accept three options: destroy all and rebuild, update all, or update a set of rows.

As part of this, AchievementManager::GetLeaderboardsInfo has been refactored to GetLeaderboardInfo to return a single leaderboard for the ID passed in.
This commit is contained in:
LillyJadeKatrin committed 2024-05-01 06:43:20 -04:00
1 parent d2069e888d
commit c57be0efca
5 files changed
+118 -70

No files matched your search

+5 -3
View File
@@ -358,10 +358,12 @@ AchievementManager::GetAchievementProgress(AchievementId achievement_id, u32* va
return ResponseType::SUCCESS;
}
const std::unordered_map<AchievementManager::AchievementId, AchievementManager::LeaderboardStatus>&
AchievementManager::GetLeaderboardsInfo() const
const AchievementManager::LeaderboardStatus*
AchievementManager::GetLeaderboardInfo(AchievementManager::AchievementId leaderboard_id) const
{
return m_leaderboard_map;
if (m_leaderboard_map.count(leaderboard_id) < 1)
return nullptr;
return &m_leaderboard_map.at(leaderboard_id);
}
AchievementManager::RichPresence AchievementManager::GetRichPresence() const
+1 -1
View File
@@ -143,7 +143,7 @@ public:
const UnlockStatus* GetUnlockStatus(AchievementId achievement_id) const;
AchievementManager::ResponseType GetAchievementProgress(AchievementId achievement_id, u32* value,
u32* target);
const std::unordered_map<AchievementId, LeaderboardStatus>& GetLeaderboardsInfo() const;
const LeaderboardStatus* GetLeaderboardInfo(AchievementId leaderboard_id) const;
RichPresence GetRichPresence() const;
bool IsDisabled() const { return m_disabled; };
void SetDisabled(bool disabled);