change name of interface and expose method instead of seperate values

This commit is contained in:
Albie
2019-11-25 07:24:29 +00:00
parent 9a8e3fe1da
commit 9fdbb2a58e
5 changed files with 33 additions and 51 deletions

View File

@ -0,0 +1,15 @@
// 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 osu.Game.Screens.Play;
namespace osu.Game.Rulesets.Mods
{
/// <summary>
/// An interface for a mod which can temporarily override the <see cref="Player"/> settings.
/// </summary>
public interface IApplicableToPlayer : IApplicableMod
{
void ApplyToPlayer(Player player);
}
}

View File

@ -1,26 +0,0 @@
// 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

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Mods
}
}
public class ModCinema : ModAutoplay, IApplicableToHUD, IApplicableToScreen
public class ModCinema : ModAutoplay, IApplicableToHUD, IApplicableToPlayer
{
public override string Name => "Cinema";
public override string Acronym => "CN";
@ -34,8 +34,14 @@ namespace osu.Game.Rulesets.Mods
overlay.Hide();
}
public bool EnableDim => false;
public bool ForceVideo => true;
public bool ForceStoryboard => true;
public void ApplyToPlayer(Player player)
{
player.Background.EnableUserDim.Value = false;
player.DimmableVideo.EnableUserDim.Value = false;
player.DimmableStoryboard.EnableUserDim.Value = false;
player.DimmableVideo.IgnoreUserSettings.Value = true;
player.DimmableStoryboard.IgnoreUserSettings.Value = true;
}
}
}