Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed User Ruleset from Leaderboard #31720

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions osu.Game/Online/Leaderboards/LeaderboardScore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public partial class LeaderboardScore : OsuClickableContainer, IHasContextMenu,
[Resolved]
private ScoreManager scoreManager { get; set; } = null!;

[Resolved]
private OsuGame game { get; set; }
Ianlucht marked this conversation as resolved.
Show resolved Hide resolved

public LeaderboardScore(ScoreInfo score, int? rank, bool isOnlineScope = true, bool highlightFriend = true)
{
Score = score;
Expand All @@ -103,6 +106,7 @@ public LeaderboardScore(ScoreInfo score, int? rank, bool isOnlineScope = true, b
private void load(IAPIProvider api, OsuColour colour)
{
var user = Score.User;
var ruleset = Score.Ruleset;
bool isUserFriend = api.Friends.Any(friend => friend.TargetID == user.OnlineID);

statisticsLabels = GetStatistics(Score).Select(s => new ScoreComponentLabel(s)).ToList();
Expand Down Expand Up @@ -264,6 +268,7 @@ private void load(IAPIProvider api, OsuColour colour)
},
};

innerAvatar.Action = () => game?.ShowUser(user, ruleset);
innerAvatar.OnLoadComplete += d => d.FadeInFromZero(200);
}

Expand Down
4 changes: 3 additions & 1 deletion osu.Game/OsuGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
using osu.Game.Overlays.OSD;
using osu.Game.Overlays.SkinEditor;
using osu.Game.Overlays.Toolbar;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Scoring;
using osu.Game.Screens;
Expand Down Expand Up @@ -551,7 +552,8 @@ public void ShowChannel(string channel) => waitForReady(() => channelManager, _
/// Show a user's profile as an overlay.
/// </summary>
/// <param name="user">The user to display.</param>
public void ShowUser(IUser user) => waitForReady(() => userProfile, _ => userProfile.ShowUser(user));
/// <param name="ruleset">The user's ruleset to display on profile.</param>
public void ShowUser(IUser user, IRulesetInfo ruleset = null) => waitForReady(() => userProfile, _ => userProfile.ShowUser(user, ruleset));

/// <summary>
/// Show a beatmap's set as an overlay, displaying the given beatmap.
Expand Down
4 changes: 4 additions & 0 deletions osu.Game/Screens/SelectV2/Leaderboards/LeaderboardScoreV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ public partial class LeaderboardScoreV2 : OsuClickableContainer, IHasContextMenu
[Resolved]
private IAPIProvider api { get; set; } = null!;

[Resolved]
private OsuGame? game { get; set; }

private Container content = null!;
private Box background = null!;
private Box foreground = null!;
Expand Down Expand Up @@ -185,6 +188,7 @@ private void load()
}
};

innerAvatar.Action = () => game?.ShowUser(user, score.Ruleset);
innerAvatar.OnLoadComplete += d => d.FadeInFromZero(200);
}

Expand Down
Loading