Added Notification Popup for Leaderboard Scored

Added an OnScreenDisplay message to HandleLeaderboardTriggeredEvent to display a message when a player has completed a leaderboard. The message includes the title of the achievement and the player's score/time.
This commit is contained in:
LillyJadeKatrin 2023-05-22 22:41:32 -04:00
parent a7b09413f9
commit c20d0ae9e1
1 changed files with 10 additions and 0 deletions

View File

@ -523,6 +523,16 @@ void AchievementManager::HandleLeaderboardTriggeredEvent(const rc_runtime_event_
{
m_queue.EmplaceItem(
[this, runtime_event] { SubmitLeaderboard(runtime_event->id, runtime_event->value); });
for (u32 ix = 0; ix < m_game_data.num_leaderboards; ix++)
{
if (m_game_data.leaderboards[ix].id == runtime_event->id)
{
OSD::AddMessage(fmt::format("Scored {} on leaderboard: {}", runtime_event->value,
m_game_data.leaderboards[ix].title),
OSD::Duration::VERY_LONG, OSD::Color::YELLOW);
break;
}
}
}
// Every RetroAchievements API call, with only a partial exception for fetch_image, follows