mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 20:25:39 +08:00
add forced video/storyboard and disabled dim for mod inside new interface
This commit is contained in:
parent
3b9f59cb33
commit
b8e5796af5
@ -21,6 +21,11 @@ namespace osu.Game.Graphics.Containers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly Bindable<bool> EnableUserDim = new Bindable<bool>(true);
|
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>
|
/// <summary>
|
||||||
/// Whether or not the storyboard loaded should completely hide the background behind it.
|
/// Whether or not the storyboard loaded should completely hide the background behind it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -63,6 +68,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
ShowStoryboard.ValueChanged += _ => UpdateVisuals();
|
ShowStoryboard.ValueChanged += _ => UpdateVisuals();
|
||||||
ShowVideo.ValueChanged += _ => UpdateVisuals();
|
ShowVideo.ValueChanged += _ => UpdateVisuals();
|
||||||
StoryboardReplacesBackground.ValueChanged += _ => UpdateVisuals();
|
StoryboardReplacesBackground.ValueChanged += _ => UpdateVisuals();
|
||||||
|
IgnoreUserSettings.ValueChanged += _ => UpdateVisuals();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
26
osu.Game/Rulesets/Mods/IApplicableToScreen.cs
Normal file
26
osu.Game/Rulesets/Mods/IApplicableToScreen.cs
Normal 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; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,10 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.UI;
|
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 Name => "Cinema";
|
||||||
public override string Acronym => "CN";
|
public override string Acronym => "CN";
|
||||||
@ -33,5 +36,9 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
overlay.AlwaysPresent = true;
|
overlay.AlwaysPresent = true;
|
||||||
overlay.Hide();
|
overlay.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool EnableDim => false;
|
||||||
|
public bool ForceVideo => true;
|
||||||
|
public bool ForceStoryboard => true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,14 +33,14 @@ namespace osu.Game.Screens.Play
|
|||||||
base.LoadComplete();
|
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)
|
private void initializeStoryboard(bool async)
|
||||||
{
|
{
|
||||||
if (drawableStoryboard != null)
|
if (drawableStoryboard != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!ShowStoryboard.Value)
|
if (!ShowStoryboard.Value && !IgnoreUserSettings.Value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
drawableStoryboard = storyboard.CreateDrawable();
|
drawableStoryboard = storyboard.CreateDrawable();
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -33,7 +34,7 @@ namespace osu.Game.Screens.Play
|
|||||||
base.LoadComplete();
|
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)
|
private void initializeVideo(bool async)
|
||||||
{
|
{
|
||||||
@ -43,7 +44,7 @@ namespace osu.Game.Screens.Play
|
|||||||
if (drawableVideo != null)
|
if (drawableVideo != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!ShowVideo.Value)
|
if (!ShowVideo.Value && !IgnoreUserSettings.Value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
drawableVideo = new DrawableVideo(video);
|
drawableVideo = new DrawableVideo(video);
|
||||||
|
@ -498,8 +498,24 @@ namespace osu.Game.Screens.Play
|
|||||||
.Delay(250)
|
.Delay(250)
|
||||||
.FadeIn(250);
|
.FadeIn(250);
|
||||||
|
|
||||||
Background.EnableUserDim.Value = true;
|
var screenOverride = Mods.Value.OfType<IApplicableToScreen>();
|
||||||
Background.BlurAmount.Value = 0;
|
|
||||||
|
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);
|
Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
||||||
DimmableStoryboard.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
DimmableStoryboard.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
||||||
|
Loading…
Reference in New Issue
Block a user