mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +00:00
Merge pull request #2281 from CookiePLMonster/leaderboards-hardcore-only
Allow submitting entries to Leaderboards only in Hardcore Mode.
This commit is contained in:
commit
1fe85a0d91
|
@ -590,6 +590,19 @@ static void DisplayAchievementSummary()
|
|||
{
|
||||
summary = GetHostInterface()->TranslateString("Cheevos", "This game has no achievements.");
|
||||
}
|
||||
if (GetLeaderboardCount() > 0)
|
||||
{
|
||||
summary.push_back('\n');
|
||||
if (g_challenge_mode)
|
||||
{
|
||||
summary.append(GetHostInterface()->TranslateString("Cheevos", "Leaderboards are enabled."));
|
||||
}
|
||||
else
|
||||
{
|
||||
summary.append(
|
||||
GetHostInterface()->TranslateString("Cheevos", "Leaderboards are DISABLED because Hardcore Mode is off."));
|
||||
}
|
||||
}
|
||||
|
||||
ImGuiFullscreen::AddNotification(10.0f, std::move(title), std::move(summary), s_game_icon);
|
||||
}
|
||||
|
@ -1350,6 +1363,13 @@ void SubmitLeaderboard(u32 leaderboard_id, int value)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!g_challenge_mode)
|
||||
{
|
||||
Log_WarningPrintf("Skipping sending leaderboard %u result to server because Challenge mode is off.",
|
||||
leaderboard_id);
|
||||
return;
|
||||
}
|
||||
|
||||
char url[512];
|
||||
rc_url_submit_lboard(url, sizeof(url), s_username.c_str(), s_login_token.c_str(), leaderboard_id, value);
|
||||
s_http_downloader->CreateRequest(url, SubmitLeaderboardCallback);
|
||||
|
|
|
@ -4505,6 +4505,18 @@ void DrawLeaderboardsWindow()
|
|||
ImGui::PushFont(g_medium_font);
|
||||
ImGui::RenderTextClipped(summary_bb.Min, summary_bb.Max, text.GetCharArray(),
|
||||
text.GetCharArray() + text.GetLength(), nullptr, ImVec2(0.0f, 0.0f), &summary_bb);
|
||||
|
||||
if (!IsCheevosHardcoreModeActive())
|
||||
{
|
||||
const ImRect hardcore_warning_bb(ImVec2(left, top), ImVec2(right, top + g_medium_font->FontSize));
|
||||
top += g_medium_font->FontSize + spacing;
|
||||
|
||||
ImGui::RenderTextClipped(
|
||||
hardcore_warning_bb.Min, hardcore_warning_bb.Max,
|
||||
"Submitting scores is DISABLED because Hardcore Mode is off. Leaderboards are read-only.", nullptr, nullptr,
|
||||
ImVec2(0.0f, 0.0f), &hardcore_warning_bb);
|
||||
}
|
||||
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue