1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 16:02: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.ExternalLinkWarning, true);
Set(OsuSetting.PreferNoVideo, false);
// Audio // Audio
Set(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01); Set(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01);
@ -212,6 +213,7 @@ namespace osu.Game.Configuration
IncreaseFirstObjectVisibility, IncreaseFirstObjectVisibility,
ScoreDisplayMode, ScoreDisplayMode,
ExternalLinkWarning, ExternalLinkWarning,
PreferNoVideo,
Scaling, Scaling,
ScalingPositionX, ScalingPositionX,
ScalingPositionY, ScalingPositionY,

View File

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

View File

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