1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 03:25:11 +08:00

add forced video/storyboard and disabled dim for mod inside new interface

This commit is contained in:
Albie 2019-11-24 07:37:06 +00:00
parent 3b9f59cb33
commit b8e5796af5
6 changed files with 63 additions and 7 deletions

View File

@ -21,6 +21,11 @@ namespace osu.Game.Graphics.Containers
/// </summary>
public readonly Bindable<bool> EnableUserDim = new Bindable<bool>(true);
/// <summary>
/// Whether or not user-configured settings relating to visibility of elements should be ignored
/// </summary>
public readonly Bindable<bool> IgnoreUserSettings = new Bindable<bool>();
/// <summary>
/// Whether or not the storyboard loaded should completely hide the background behind it.
/// </summary>
@ -63,6 +68,7 @@ namespace osu.Game.Graphics.Containers
ShowStoryboard.ValueChanged += _ => UpdateVisuals();
ShowVideo.ValueChanged += _ => UpdateVisuals();
StoryboardReplacesBackground.ValueChanged += _ => UpdateVisuals();
IgnoreUserSettings.ValueChanged += _ => UpdateVisuals();
}
protected override void LoadComplete()

View File

@ -0,0 +1,26 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Game.Rulesets.Mods
{
/// <summary>
/// An interface for a mod which can temporarily override screen settings.
/// </summary>
public interface IApplicableToScreen : IApplicableMod
{
/// <summary>
/// Whether to enable image, video and storyboard dimming
/// </summary>
bool EnableDim { get; }
/// <summary>
/// Weather to force the video (if present)
/// </summary>
bool ForceVideo { get; }
/// <summary>
/// Weather to force the storyboard (if present)
/// </summary>
bool ForceStoryboard { get; }
}
}

View File

@ -1,7 +1,10 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI;
@ -21,7 +24,7 @@ namespace osu.Game.Rulesets.Mods
}
}
public class ModCinema : ModAutoplay, IApplicableToHUD
public class ModCinema : ModAutoplay, IApplicableToHUD, IApplicableToScreen
{
public override string Name => "Cinema";
public override string Acronym => "CN";
@ -33,5 +36,9 @@ namespace osu.Game.Rulesets.Mods
overlay.AlwaysPresent = true;
overlay.Hide();
}
public bool EnableDim => false;
public bool ForceVideo => true;
public bool ForceStoryboard => true;
}
}

View File

@ -33,14 +33,14 @@ namespace osu.Game.Screens.Play
base.LoadComplete();
}
protected override bool ShowDimContent => ShowStoryboard.Value && DimLevel < 1;
protected override bool ShowDimContent => IgnoreUserSettings.Value || ShowStoryboard.Value && DimLevel < 1;
private void initializeStoryboard(bool async)
{
if (drawableStoryboard != null)
return;
if (!ShowStoryboard.Value)
if (!ShowStoryboard.Value && !IgnoreUserSettings.Value)
return;
drawableStoryboard = storyboard.CreateDrawable();

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -33,7 +34,7 @@ namespace osu.Game.Screens.Play
base.LoadComplete();
}
protected override bool ShowDimContent => ShowVideo.Value && DimLevel < 1;
protected override bool ShowDimContent => IgnoreUserSettings.Value || ShowVideo.Value && DimLevel < 1;
private void initializeVideo(bool async)
{
@ -43,7 +44,7 @@ namespace osu.Game.Screens.Play
if (drawableVideo != null)
return;
if (!ShowVideo.Value)
if (!ShowVideo.Value && !IgnoreUserSettings.Value)
return;
drawableVideo = new DrawableVideo(video);

View File

@ -498,8 +498,24 @@ namespace osu.Game.Screens.Play
.Delay(250)
.FadeIn(250);
Background.EnableUserDim.Value = true;
Background.BlurAmount.Value = 0;
var screenOverride = Mods.Value.OfType<IApplicableToScreen>();
if (screenOverride.Count() == 1)
{
var setting = screenOverride.Single();
Background.EnableUserDim.Value = setting.EnableDim;
DimmableVideo.EnableUserDim.Value = setting.EnableDim;
DimmableStoryboard.EnableUserDim.Value = setting.EnableDim;
DimmableVideo.IgnoreUserSettings.Value = setting.ForceVideo;
DimmableStoryboard.IgnoreUserSettings.Value = setting.ForceStoryboard;
}
else
{
Background.EnableUserDim.Value = true;
Background.BlurAmount.Value = 0;
}
Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
DimmableStoryboard.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);