1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 03:25:11 +08:00

Add specific placeholder message for custom rulesets rather than showing network error

This commit is contained in:
Dean Herbert 2022-03-02 14:10:59 +09:00
parent 09a74cdfc6
commit c342030b2c
4 changed files with 17 additions and 5 deletions

View File

@ -119,7 +119,8 @@ namespace osu.Game.Tests.Visual.SongSelect
AddStep(@"Network failure", () => leaderboard.SetErrorState(LeaderboardState.NetworkFailure));
AddStep(@"No supporter", () => leaderboard.SetErrorState(LeaderboardState.NotSupporter));
AddStep(@"Not logged in", () => leaderboard.SetErrorState(LeaderboardState.NotLoggedIn));
AddStep(@"Unavailable", () => leaderboard.SetErrorState(LeaderboardState.Unavailable));
AddStep(@"Ruleset unavailable", () => leaderboard.SetErrorState(LeaderboardState.RulesetUnavailable));
AddStep(@"Beatmap unavailable", () => leaderboard.SetErrorState(LeaderboardState.BeatmapUnavailable));
AddStep(@"None selected", () => leaderboard.SetErrorState(LeaderboardState.NoneSelected));
}

View File

@ -319,7 +319,10 @@ namespace osu.Game.Online.Leaderboards
case LeaderboardState.NoneSelected:
return new MessagePlaceholder(@"Please select a beatmap!");
case LeaderboardState.Unavailable:
case LeaderboardState.RulesetUnavailable:
return new MessagePlaceholder(@"Leaderboards are not available for this ruleset!");
case LeaderboardState.BeatmapUnavailable:
return new MessagePlaceholder(@"Leaderboards are not available for this beatmap!");
case LeaderboardState.NoScores:

View File

@ -8,7 +8,8 @@ namespace osu.Game.Online.Leaderboards
Success,
Retrieving,
NetworkFailure,
Unavailable,
BeatmapUnavailable,
RulesetUnavailable,
NoneSelected,
NoScores,
NotLoggedIn,

View File

@ -98,6 +98,7 @@ namespace osu.Game.Screens.Select.Leaderboards
protected override APIRequest FetchScores(CancellationToken cancellationToken)
{
var fetchBeatmapInfo = BeatmapInfo;
var fetchRuleset = ruleset.Value ?? fetchBeatmapInfo.Ruleset;
if (fetchBeatmapInfo == null)
{
@ -117,9 +118,15 @@ namespace osu.Game.Screens.Select.Leaderboards
return null;
}
if (fetchRuleset.OnlineID <= 0 || fetchRuleset.OnlineID > ILegacyRuleset.MAX_LEGACY_RULESET_ID)
{
SetErrorState(LeaderboardState.RulesetUnavailable);
return null;
}
if (fetchBeatmapInfo.OnlineID <= 0 || fetchBeatmapInfo.Status <= BeatmapOnlineStatus.Pending)
{
SetErrorState(LeaderboardState.Unavailable);
SetErrorState(LeaderboardState.BeatmapUnavailable);
return null;
}
@ -137,7 +144,7 @@ namespace osu.Game.Screens.Select.Leaderboards
else if (filterMods)
requestMods = mods.Value;
var req = new GetScoresRequest(fetchBeatmapInfo, ruleset.Value ?? fetchBeatmapInfo.Ruleset, Scope, requestMods);
var req = new GetScoresRequest(fetchBeatmapInfo, fetchRuleset, Scope, requestMods);
req.Success += r =>
{