1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 15:22:55 +08:00

Implement "prefer no video" option

This commit is contained in:
Endrik Tombak 2020-04-11 14:08:16 +03:00
parent 4d0454f2bf
commit df76636ffc
3 changed files with 13 additions and 4 deletions

View File

@ -49,6 +49,7 @@ namespace osu.Game.Configuration
};
Set(OsuSetting.ExternalLinkWarning, true);
Set(OsuSetting.PreferNoVideo, false);
// Audio
Set(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01);
@ -212,6 +213,7 @@ namespace osu.Game.Configuration
IncreaseFirstObjectVisibility,
ScoreDisplayMode,
ExternalLinkWarning,
PreferNoVideo,
Scaling,
ScalingPositionX,
ScalingPositionY,

View File

@ -4,6 +4,7 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online;
@ -14,12 +15,12 @@ namespace osu.Game.Overlays.Direct
{
protected bool DownloadEnabled => button.Enabled.Value;
private readonly bool noVideo;
private readonly bool? noVideo;
private readonly ShakeContainer shakeContainer;
private readonly DownloadButton button;
public PanelDownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false)
public PanelDownloadButton(BeatmapSetInfo beatmapSet, bool? noVideo = null)
: base(beatmapSet)
{
this.noVideo = noVideo;
@ -43,7 +44,7 @@ namespace osu.Game.Overlays.Direct
}
[BackgroundDependencyLoader(true)]
private void load(OsuGame game, BeatmapManager beatmaps)
private void load(OsuGame game, BeatmapManager beatmaps, OsuConfigManager osuConfig)
{
if (BeatmapSet.Value?.OnlineInfo?.Availability?.DownloadDisabled ?? false)
{
@ -66,7 +67,8 @@ namespace osu.Game.Overlays.Direct
break;
default:
beatmaps.Download(BeatmapSet.Value, noVideo);
var minimiseDownloadSize = noVideo ?? osuConfig.GetBindable<bool>(OsuSetting.PreferNoVideo).Value;
beatmaps.Download(BeatmapSet.Value, minimiseDownloadSize);
break;
}
};

View File

@ -21,6 +21,11 @@ namespace osu.Game.Overlays.Settings.Sections.Online
LabelText = "Warn about opening external links",
Bindable = config.GetBindable<bool>(OsuSetting.ExternalLinkWarning)
},
new SettingsCheckbox
{
LabelText = "Prefer no-video downloads",
Bindable = config.GetBindable<bool>(OsuSetting.PreferNoVideo)
},
};
}
}