diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs index 135e5129ae..54f8d656fe 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs @@ -7,7 +7,9 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input; using osu.Framework.Input.Events; +using osu.Game.Configuration; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Online; @@ -35,6 +37,18 @@ namespace osu.Game.Beatmaps.Drawables.Cards protected readonly BeatmapDownloadTracker DownloadTracker; + private readonly Bindable preferNoVideo = new BindableBool(); + private InputManager? containingInputManager; + + [Resolved] + private BeatmapSetOverlay? beatmapSetOverlay { get; set; } + + [Resolved] + private BeatmapModelDownloader? beatmaps { get; set; } + + [Resolved] + private OsuGame? game { get; set; } + protected BeatmapCard(APIBeatmapSet beatmapSet, bool allowExpansion = true) : base(HoverSampleSet.Button) { @@ -45,10 +59,10 @@ namespace osu.Game.Beatmaps.Drawables.Cards DownloadTracker = new BeatmapDownloadTracker(beatmapSet); } - [BackgroundDependencyLoader(true)] - private void load(BeatmapSetOverlay? beatmapSetOverlay) + [BackgroundDependencyLoader] + private void load(OsuConfigManager configManager) { - Action = () => beatmapSetOverlay?.FetchAndShowBeatmapSet(BeatmapSet.OnlineID); + configManager.BindWith(OsuSetting.PreferNoVideo, preferNoVideo); AddInternal(DownloadTracker); } @@ -60,6 +74,28 @@ namespace osu.Game.Beatmaps.Drawables.Cards DownloadTracker.State.BindValueChanged(_ => UpdateState()); Expanded.BindValueChanged(_ => UpdateState(), true); FinishTransforms(true); + + containingInputManager = GetContainingInputManager(); + + Action = () => + { + if (containingInputManager?.CurrentState.Keyboard.ShiftPressed == true) + { + switch (DownloadTracker.State.Value) + { + case DownloadState.NotDownloaded: + if (!BeatmapSet.Availability.DownloadDisabled) + beatmaps?.Download(BeatmapSet, preferNoVideo.Value); + break; + + case DownloadState.LocallyAvailable: + game?.PresentBeatmap(BeatmapSet); + break; + } + } + else + beatmapSetOverlay?.FetchAndShowBeatmapSet(BeatmapSet.OnlineID); + }; } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Localisation/MenuTipStrings.cs b/osu.Game/Localisation/MenuTipStrings.cs index 4d1f2ceaa6..ebab9f4d02 100644 --- a/osu.Game/Localisation/MenuTipStrings.cs +++ b/osu.Game/Localisation/MenuTipStrings.cs @@ -154,6 +154,11 @@ namespace osu.Game.Localisation /// public static LocalisableString RightMouseAbsoluteScroll => new TranslatableString(getKey(@"right_mouse_absolute_scroll"), @"Try holding your right mouse button near the beatmap carousel to quickly scroll to an absolute position!"); + /// + /// "Shift-click on a beatmap panel in the beatmap listing overlay to quickly download or view the beatmap in song select!" + /// + public static LocalisableString ShiftClickInBeatmapOverlay => new TranslatableString(getKey(@"shift_click_in_beatmap_overlay"), @"Shift-click on a beatmap panel in the beatmap listing overlay to quickly download or view the beatmap in song select!"); + /// /// "a tip for you:" /// diff --git a/osu.Game/Screens/Menu/MenuTipDisplay.cs b/osu.Game/Screens/Menu/MenuTipDisplay.cs index 7e538995b2..d9c90b069d 100644 --- a/osu.Game/Screens/Menu/MenuTipDisplay.cs +++ b/osu.Game/Screens/Menu/MenuTipDisplay.cs @@ -118,7 +118,7 @@ namespace osu.Game.Screens.Menu .FadeOutFromOne(2000, Easing.OutQuint); } - private const int available_tips = 29; + private const int available_tips = 30; private LocalisableString getRandomTip() { @@ -216,6 +216,9 @@ namespace osu.Game.Screens.Menu case 28: return MenuTipStrings.RightMouseAbsoluteScroll; + + case 29: + return MenuTipStrings.ShiftClickInBeatmapOverlay; } return string.Empty;