Achievements: Show unconfirmed unlocks in pause menu
This commit is contained in:
parent
37230107f4
commit
b4ae19411b
|
@ -141,6 +141,11 @@ RC_EXPORT void RC_CCONV rc_client_abort_async(rc_client_t* client, rc_client_asy
|
|||
*/
|
||||
RC_EXPORT size_t RC_CCONV rc_client_get_user_agent_clause(rc_client_t* client, char buffer[], size_t buffer_size);
|
||||
|
||||
/**
|
||||
* Returns true if any achievement submissions have failed and are currently pending.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_is_disconnected(rc_client_t* client);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Logging |
|
||||
\*****************************************************************************/
|
||||
|
@ -503,6 +508,11 @@ RC_EXPORT void RC_CCONV rc_client_destroy_achievement_list(rc_client_achievement
|
|||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_has_achievements(rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Returns the number of outstanding achievement unlocks.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_get_award_achievement_pending_count(rc_client_t* client);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Leaderboards |
|
||||
\*****************************************************************************/
|
||||
|
|
|
@ -3941,6 +3941,20 @@ static int rc_client_is_award_achievement_pending(const rc_client_t* client, uin
|
|||
return 0;
|
||||
}
|
||||
|
||||
int rc_client_get_award_achievement_pending_count(rc_client_t* client)
|
||||
{
|
||||
/* assume lock already held */
|
||||
int count = 0;
|
||||
rc_client_scheduled_callback_data_t* scheduled_callback = client->state.scheduled_callbacks;
|
||||
for (; scheduled_callback; scheduled_callback = scheduled_callback->next)
|
||||
{
|
||||
if (scheduled_callback->callback == rc_client_award_achievement_retry)
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static void rc_client_award_achievement_server_call(rc_client_award_achievement_callback_data_t* ach_data);
|
||||
|
||||
static void rc_client_award_achievement_retry(rc_client_scheduled_callback_data_t* callback_data, rc_client_t* client, rc_clock_t now)
|
||||
|
@ -6411,3 +6425,8 @@ size_t rc_client_get_user_agent_clause(rc_client_t* client, char buffer[], size_
|
|||
buffer[buffer_size - 1] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
int rc_client_is_disconnected(rc_client_t* client)
|
||||
{
|
||||
return (client && (client->state.disconnect & (RC_CLIENT_DISCONNECT_VISIBLE | RC_CLIENT_DISCONNECT_SHOW_PENDING) != 0));
|
||||
}
|
||||
|
|
|
@ -2576,6 +2576,8 @@ void Achievements::DrawPauseMenuOverlays(float start_pos_y)
|
|||
const float progress_rounding = LayoutScale(5.0f);
|
||||
const float badge_size = LayoutScale(40.0f);
|
||||
const float badge_text_width = box_content_width - badge_size - text_spacing - text_spacing;
|
||||
const bool disconnected = rc_client_is_disconnected(s_state.client);
|
||||
const int pending_count = disconnected ? rc_client_get_award_achievement_pending_count(s_state.client) : 0;
|
||||
|
||||
ImDrawList* dl = ImGui::GetBackgroundDrawList();
|
||||
|
||||
|
@ -2589,6 +2591,10 @@ void Achievements::DrawPauseMenuOverlays(float start_pos_y)
|
|||
|
||||
float box_height =
|
||||
box_padding + box_padding + UIStyle.MediumFont->FontSize + paragraph_spacing + progress_height + paragraph_spacing;
|
||||
if (pending_count > 0)
|
||||
{
|
||||
box_height += UIStyle.MediumFont->FontSize + paragraph_spacing;
|
||||
}
|
||||
if (s_state.most_recent_unlock)
|
||||
{
|
||||
box_height += UIStyle.MediumFont->FontSize + paragraph_spacing +
|
||||
|
@ -2664,6 +2670,16 @@ void Achievements::DrawPauseMenuOverlays(float start_pos_y)
|
|||
progress_bb.Min.y + ((progress_bb.Max.y - progress_bb.Min.y) / 2.0f) - (text_size.y / 2.0f)),
|
||||
text_color, buffer.c_str(), buffer.end_ptr());
|
||||
text_pos.y += progress_height + paragraph_spacing;
|
||||
|
||||
if (pending_count > 0)
|
||||
{
|
||||
buffer.format(ICON_EMOJI_WARNING " {}",
|
||||
TRANSLATE_PLURAL_SSTR("Achievements", "%n unlocks have not been confirmed by the server.",
|
||||
"Pause Menu", pending_count));
|
||||
dl->AddText(UIStyle.MediumFont, UIStyle.MediumFont->FontSize, text_pos, title_text_color, buffer.c_str(),
|
||||
buffer.end_ptr());
|
||||
text_pos.y += UIStyle.MediumFont->FontSize + paragraph_spacing;
|
||||
}
|
||||
}
|
||||
|
||||
if (s_state.most_recent_unlock)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<context>
|
||||
<name>Achievements</name>
|
||||
<message numerus="yes">
|
||||
<location filename="../../core/achievements.cpp" line="1348"/>
|
||||
<location filename="../../core/achievements.cpp" line="1401"/>
|
||||
<source>You have unlocked {} of %n achievements</source>
|
||||
<comment>Achievement popup</comment>
|
||||
<translation>
|
||||
|
@ -25,7 +25,7 @@
|
|||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../core/achievements.cpp" line="1351"/>
|
||||
<location filename="../../core/achievements.cpp" line="1404"/>
|
||||
<source>and earned {} of %n points</source>
|
||||
<comment>Achievement popup</comment>
|
||||
<translation>
|
||||
|
@ -34,7 +34,7 @@
|
|||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../core/achievements.cpp" line="1443"/>
|
||||
<location filename="../../core/achievements.cpp" line="1504"/>
|
||||
<source>%n achievements</source>
|
||||
<comment>Mastery popup</comment>
|
||||
<translation>
|
||||
|
@ -43,8 +43,8 @@
|
|||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../core/achievements.cpp" line="1445"/>
|
||||
<location filename="../../core/achievements.cpp" line="2843"/>
|
||||
<location filename="../../core/achievements.cpp" line="1506"/>
|
||||
<location filename="../../core/achievements.cpp" line="3067"/>
|
||||
<source>%n points</source>
|
||||
<comment>Achievement points</comment>
|
||||
<translation>
|
||||
|
@ -53,7 +53,16 @@
|
|||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../core/achievements.cpp" line="2661"/>
|
||||
<location filename="../../core/achievements.cpp" line="2711"/>
|
||||
<source>%n unlocks have not been confirmed by the server.</source>
|
||||
<comment>Pause Menu</comment>
|
||||
<translation>
|
||||
<numerusform>%n unlock has not been confirmed by the server.</numerusform>
|
||||
<numerusform>%n unlocks have not been confirmed by the server.</numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../core/achievements.cpp" line="2876"/>
|
||||
<source>You have unlocked all achievements and earned %n points!</source>
|
||||
<comment>Point count</comment>
|
||||
<translation>
|
||||
|
@ -62,7 +71,7 @@
|
|||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../core/achievements.cpp" line="3086"/>
|
||||
<location filename="../../core/achievements.cpp" line="3321"/>
|
||||
<source>This game has %n leaderboards.</source>
|
||||
<comment>Leaderboard count</comment>
|
||||
<translation>
|
||||
|
@ -74,7 +83,7 @@
|
|||
<context>
|
||||
<name>Cheats</name>
|
||||
<message numerus="yes">
|
||||
<location filename="../../core/cheats.cpp" line="1005"/>
|
||||
<location filename="../../core/cheats.cpp" line="1014"/>
|
||||
<source>%n game patches are active.</source>
|
||||
<comment>OSD Message</comment>
|
||||
<translation>
|
||||
|
@ -83,7 +92,7 @@
|
|||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../core/cheats.cpp" line="1012"/>
|
||||
<location filename="../../core/cheats.cpp" line="1021"/>
|
||||
<source>%n cheats are enabled. This may crash games.</source>
|
||||
<comment>OSD Message</comment>
|
||||
<translation>
|
||||
|
@ -92,7 +101,7 @@
|
|||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../core/cheats.cpp" line="1039"/>
|
||||
<location filename="../../core/cheats.cpp" line="1048"/>
|
||||
<source>%n cheats</source>
|
||||
<comment>Cheats blocked by hardcore mode</comment>
|
||||
<translation>
|
||||
|
@ -101,7 +110,7 @@
|
|||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../core/cheats.cpp" line="1041"/>
|
||||
<location filename="../../core/cheats.cpp" line="1050"/>
|
||||
<source>%n patches</source>
|
||||
<comment>Patches blocked by hardcore mode</comment>
|
||||
<translation>
|
||||
|
@ -124,7 +133,7 @@
|
|||
<context>
|
||||
<name>GPU_HW</name>
|
||||
<message numerus="yes">
|
||||
<location filename="../../core/gpu_hw_texture_cache.cpp" line="3615"/>
|
||||
<location filename="../../core/gpu_hw_texture_cache.cpp" line="3636"/>
|
||||
<source>%n replacement textures found.</source>
|
||||
<comment>Replacement texture count</comment>
|
||||
<translation>
|
||||
|
@ -136,8 +145,8 @@
|
|||
<context>
|
||||
<name>GameList</name>
|
||||
<message numerus="yes">
|
||||
<location filename="../gamelistmodel.cpp" line="343"/>
|
||||
<location filename="../../core/game_list.cpp" line="1521"/>
|
||||
<location filename="../gamelistwidget.cpp" line="345"/>
|
||||
<location filename="../../core/game_list.cpp" line="1551"/>
|
||||
<source>%n hours</source>
|
||||
<translation>
|
||||
<numerusform>%n hour</numerusform>
|
||||
|
@ -145,8 +154,8 @@
|
|||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../gamelistmodel.cpp" line="345"/>
|
||||
<location filename="../../core/game_list.cpp" line="1523"/>
|
||||
<location filename="../gamelistwidget.cpp" line="347"/>
|
||||
<location filename="../../core/game_list.cpp" line="1553"/>
|
||||
<source>%n minutes</source>
|
||||
<translation>
|
||||
<numerusform>%n minute</numerusform>
|
||||
|
@ -168,7 +177,7 @@
|
|||
<context>
|
||||
<name>MemoryCardEditorWindow</name>
|
||||
<message numerus="yes">
|
||||
<location filename="../memorycardeditorwindow.cpp" line="316"/>
|
||||
<location filename="../memorycardeditorwindow.cpp" line="317"/>
|
||||
<source>%n block(s) free%1</source>
|
||||
<translation>
|
||||
<numerusform>%n block free%1</numerusform>
|
||||
|
|
Loading…
Reference in New Issue