1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-07 20:52:56 +08:00

Merge pull request #31576 from CloneWith/feature/highlight-friend

Don't highlight friends' scores under beatmap's friend score leaderboard
This commit is contained in:
Dean Herbert 2025-01-20 14:53:59 +09:00 committed by GitHub
commit e098f60f42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -54,6 +54,7 @@ namespace osu.Game.Online.Leaderboards
private readonly int? rank; private readonly int? rank;
private readonly bool isOnlineScope; private readonly bool isOnlineScope;
private readonly bool highlightFriend;
private Box background; private Box background;
private Container content; private Container content;
@ -86,12 +87,13 @@ namespace osu.Game.Online.Leaderboards
[Resolved] [Resolved]
private ScoreManager scoreManager { get; set; } = null!; private ScoreManager scoreManager { get; set; } = null!;
public LeaderboardScore(ScoreInfo score, int? rank, bool isOnlineScope = true) public LeaderboardScore(ScoreInfo score, int? rank, bool isOnlineScope = true, bool highlightFriend = true)
{ {
Score = score; Score = score;
this.rank = rank; this.rank = rank;
this.isOnlineScope = isOnlineScope; this.isOnlineScope = isOnlineScope;
this.highlightFriend = highlightFriend;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = HEIGHT; Height = HEIGHT;
@ -130,7 +132,7 @@ namespace osu.Game.Online.Leaderboards
background = new Box background = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = isUserFriend ? colour.Yellow : (user.OnlineID == api.LocalUser.Value.Id && isOnlineScope ? colour.Green : Color4.Black), Colour = (highlightFriend && isUserFriend) ? colour.Yellow : (user.OnlineID == api.LocalUser.Value.Id && isOnlineScope ? colour.Green : Color4.Black),
Alpha = background_alpha, Alpha = background_alpha,
}, },
}, },

View File

@ -169,12 +169,12 @@ namespace osu.Game.Screens.Select.Leaderboards
return scoreRetrievalRequest = newRequest; return scoreRetrievalRequest = newRequest;
} }
protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) => new LeaderboardScore(model, index, IsOnlineScope) protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) => new LeaderboardScore(model, index, IsOnlineScope, Scope != BeatmapLeaderboardScope.Friend)
{ {
Action = () => ScoreSelected?.Invoke(model) Action = () => ScoreSelected?.Invoke(model)
}; };
protected override LeaderboardScore CreateDrawableTopScore(ScoreInfo model) => new LeaderboardScore(model, model.Position, false) protected override LeaderboardScore CreateDrawableTopScore(ScoreInfo model) => new LeaderboardScore(model, model.Position, false, Scope != BeatmapLeaderboardScope.Friend)
{ {
Action = () => ScoreSelected?.Invoke(model) Action = () => ScoreSelected?.Invoke(model)
}; };