mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 05:32:54 +08:00
Check if the current leaderboard scope requires API (#5415)
Check if the current leaderboard scope requires API Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
commit
38d39be678
@ -194,13 +194,17 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
|
|
||||||
private APIRequest getScoresRequest;
|
private APIRequest getScoresRequest;
|
||||||
|
|
||||||
|
protected abstract bool IsOnlineScope { get; }
|
||||||
|
|
||||||
public void APIStateChanged(IAPIProvider api, APIState state)
|
public void APIStateChanged(IAPIProvider api, APIState state)
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case APIState.Online:
|
case APIState.Online:
|
||||||
case APIState.Offline:
|
case APIState.Offline:
|
||||||
UpdateScores();
|
if (IsOnlineScope)
|
||||||
|
UpdateScores();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,8 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool IsOnlineScope => true;
|
||||||
|
|
||||||
protected override APIRequest FetchScores(Action<IEnumerable<APIRoomScoreInfo>> scoresCallback)
|
protected override APIRequest FetchScores(Action<IEnumerable<APIRoomScoreInfo>> scoresCallback)
|
||||||
{
|
{
|
||||||
if (roomId.Value == null)
|
if (roomId.Value == null)
|
||||||
|
@ -79,6 +79,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool IsOnlineScope => Scope != BeatmapLeaderboardScope.Local;
|
||||||
|
|
||||||
protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback)
|
protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback)
|
||||||
{
|
{
|
||||||
if (Scope == BeatmapLeaderboardScope.Local)
|
if (Scope == BeatmapLeaderboardScope.Local)
|
||||||
|
Loading…
Reference in New Issue
Block a user