mirror of
https://github.com/ppy/osu.git
synced 2025-03-16 05:37:19 +08:00
Move blocking fail logic into a base class
This commit is contained in:
parent
72e5cbb07f
commit
a8e8650ddd
@ -9,18 +9,15 @@ using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Play;
|
||||
using static osu.Game.Input.Handlers.ReplayInputHandler;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
public class OsuModRelax : ModRelax, IApplicableFailOverride, IUpdatableByPlayfield, IApplicableToDrawableRuleset<OsuHitObject>, IApplicableToHUD
|
||||
public class OsuModRelax : ModRelax, IUpdatableByPlayfield, IApplicableToDrawableRuleset<OsuHitObject>
|
||||
{
|
||||
public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things.";
|
||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).ToArray();
|
||||
|
||||
public bool AllowFail => false;
|
||||
|
||||
public void Update(Playfield playfield)
|
||||
{
|
||||
bool requiresHold = false;
|
||||
@ -86,7 +83,5 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
osuInputManager = (OsuInputManager)drawableRuleset.KeyBindingInputManager;
|
||||
osuInputManager.AllowUserPresses = false;
|
||||
}
|
||||
|
||||
public void ApplyToHUD(HUDOverlay overlay) => overlay.HealthDisplay.Hide();
|
||||
}
|
||||
}
|
||||
|
30
osu.Game/Rulesets/Mods/ModBlockFail.cs
Normal file
30
osu.Game/Rulesets/Mods/ModBlockFail.cs
Normal file
@ -0,0 +1,30 @@
|
||||
// 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.Framework.Bindables;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Screens.Play;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public abstract class ModBlockFail : Mod, IApplicableFailOverride, IApplicableToHUD, IReadFromConfig
|
||||
{
|
||||
private Bindable<bool> hideHealthBar = new Bindable<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// We never fail, 'yo.
|
||||
/// </summary>
|
||||
public bool AllowFail => false;
|
||||
|
||||
public void ReadFromConfig(OsuConfigManager config)
|
||||
{
|
||||
hideHealthBar = config.GetBindable<bool>(OsuSetting.HideHealthBar);
|
||||
}
|
||||
|
||||
public void ApplyToHUD(HUDOverlay overlay)
|
||||
{
|
||||
if (hideHealthBar.Value)
|
||||
overlay.HealthDisplay.Hide();
|
||||
}
|
||||
}
|
||||
}
|
@ -4,11 +4,10 @@
|
||||
using System;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Screens.Play;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public abstract class ModNoFail : Mod, IApplicableFailOverride, IApplicableToHUD
|
||||
public abstract class ModNoFail : ModBlockFail
|
||||
{
|
||||
public override string Name => "No Fail";
|
||||
public override string Acronym => "NF";
|
||||
@ -18,12 +17,5 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override double ScoreMultiplier => 0.5;
|
||||
public override bool Ranked => true;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModAutoplay) };
|
||||
|
||||
/// <summary>
|
||||
/// We never fail, 'yo.
|
||||
/// </summary>
|
||||
public bool AllowFail => false;
|
||||
|
||||
public void ApplyToHUD(HUDOverlay overlay) => overlay.HealthDisplay.Hide();
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public abstract class ModRelax : Mod
|
||||
public abstract class ModRelax : ModBlockFail
|
||||
{
|
||||
public override string Name => "Relax";
|
||||
public override string Acronym => "RX";
|
||||
|
12
osu.sln
12
osu.sln
@ -29,6 +29,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Tournament", "osu.
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Tournament.Tests", "osu.Game.Tournament.Tests\osu.Game.Tournament.Tests.csproj", "{5789E78D-38F9-4072-AB7B-978F34B2C17F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework", "..\..\..\Desktop\osu-framework-master\osu.Framework\osu.Framework.csproj", "{05FD51FA-88EA-4895-85A0-FDE2D7DCF6F2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework.NativeLibs", "..\..\..\Desktop\osu-framework-master\osu.Framework.NativeLibs\osu.Framework.NativeLibs.csproj", "{2E9365F4-25A1-41D1-90ED-F91B5A946DBD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -87,6 +91,14 @@ Global
|
||||
{5789E78D-38F9-4072-AB7B-978F34B2C17F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5789E78D-38F9-4072-AB7B-978F34B2C17F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5789E78D-38F9-4072-AB7B-978F34B2C17F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{05FD51FA-88EA-4895-85A0-FDE2D7DCF6F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{05FD51FA-88EA-4895-85A0-FDE2D7DCF6F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{05FD51FA-88EA-4895-85A0-FDE2D7DCF6F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{05FD51FA-88EA-4895-85A0-FDE2D7DCF6F2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2E9365F4-25A1-41D1-90ED-F91B5A946DBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2E9365F4-25A1-41D1-90ED-F91B5A946DBD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2E9365F4-25A1-41D1-90ED-F91B5A946DBD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2E9365F4-25A1-41D1-90ED-F91B5A946DBD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
Loading…
x
Reference in New Issue
Block a user