Skip to content

Commit

Permalink
Added Notification Popup for Leaderboard Started
Browse files Browse the repository at this point in the history
Added HandleLeaderboardStartedEvent with an OnScreenDisplay message when a player has triggered a leaderboard's start conditions. The message includes the title of the achievement.
  • Loading branch information
LillyJadeKatrin committed May 24, 2023
1 parent c20d0ae commit a4b7f43
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Source/Core/Core/AchievementManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ void AchievementManager::AchievementEventHandler(const rc_runtime_event_t* runti
case RC_RUNTIME_EVENT_ACHIEVEMENT_TRIGGERED:
HandleAchievementTriggeredEvent(runtime_event);
break;
case RC_RUNTIME_EVENT_LBOARD_STARTED:
HandleLeaderboardStartedEvent(runtime_event);
break;
case RC_RUNTIME_EVENT_LBOARD_TRIGGERED:
HandleLeaderboardTriggeredEvent(runtime_event);
break;
Expand Down Expand Up @@ -519,6 +522,19 @@ void AchievementManager::HandleAchievementTriggeredEvent(const rc_runtime_event_
Config::Get(Config::RA_ENCORE_ENABLED));
}

void AchievementManager::HandleLeaderboardStartedEvent(const rc_runtime_event_t* runtime_event)
{
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("Attempting leaderboard: {}", m_game_data.leaderboards[ix].title),
OSD::Duration::VERY_LONG, OSD::Color::GREEN);
break;
}
}
}

void AchievementManager::HandleLeaderboardTriggeredEvent(const rc_runtime_event_t* runtime_event)
{
m_queue.EmplaceItem(
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/AchievementManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class AchievementManager
ResponseType PingRichPresence(const RichPresence& rich_presence);

void HandleAchievementTriggeredEvent(const rc_runtime_event_t* runtime_event);
void HandleLeaderboardStartedEvent(const rc_runtime_event_t* runtime_event);
void HandleLeaderboardTriggeredEvent(const rc_runtime_event_t* runtime_event);

template <typename RcRequest, typename RcResponse>
Expand Down

0 comments on commit a4b7f43

Please sign in to comment.