Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
9 changes: 9 additions & 0 deletions osu.Game/Localisation/SongSelectStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@
/// </summary>
public static LocalisableString WatchReplay => new TranslatableString(getKey(@"watch_replay"), @"Watch replay");

/// <summary>
/// "Download replay"
/// </summary>
public static LocalisableString DownloadReplay => new TranslatableString(getKey(@"download_replay"), @"Download replay");
Comment on lines +117 to +120

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UsersStrings.ShowExtraTopRanksDownloadReplay.ToSentence() can be used instead

/// <summary>
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
/// "Replay downloading"
/// </summary>
public static LocalisableString ReplayDownloading => new TranslatableString(getKey(@"replay_downloading"), @"Replay downloading");

/// <summary>
/// "For all difficulties"
/// </summary>
Expand Down
17 changes: 16 additions & 1 deletion osu.Game/Screens/Select/BeatmapLeaderboardScore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public sealed partial class BeatmapLeaderboardScore : OsuClickableContainer, IHa
[Resolved]
private IAPIProvider api { get; set; } = null!;

[Resolved]
private ScoreModelDownloader scoreDownloader { get; set; } = null!;

private const float expanded_right_content_width = 200;
private const float grade_width = 35;
private const float username_min_width = 120;
Expand Down Expand Up @@ -620,13 +623,25 @@ MenuItem[] IHasContextMenu.ContextMenuItems
// system mods should never be copied across regardless of anything.
var copyableMods = Score.Mods.Where(m => IsValidMod.Invoke(m) && m.Type != ModType.System).ToArray();

bool replayAvailableLocally = scoreManager.IsAvailableLocally(Score);
bool replayDownloading = scoreDownloader.GetExistingDownload(Score) != null;

if (copyableMods.Length > 0)
items.Add(new OsuMenuItem(SongSelectStrings.UseTheseMods, MenuItemType.Highlighted, () => SelectedMods.Value = copyableMods));

if (Score.OnlineID > 0)
items.Add(new OsuMenuItem(CommonStrings.CopyLink, MenuItemType.Standard, () => game?.CopyToClipboard($@"{api.Endpoints.WebsiteUrl}/scores/{Score.OnlineID}")));

if (Score.Files.Count <= 0) return items.ToArray();
if (!replayAvailableLocally)
{
if (replayDownloading)
items.Add(new OsuMenuItem(SongSelectStrings.ReplayDownloading));
else if (Score.HasOnlineReplay)
items.Add(new OsuMenuItem(SongSelectStrings.DownloadReplay, MenuItemType.Standard, () => scoreDownloader.Download(Score)));
}

if (Score.Files.Count <= 0)
return items.ToArray();

if (items.Count > 0)
items.Add(new OsuMenuItemSpacer());
Expand Down
Loading