mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +08:00
Merge pull request #14041 from Henry-YSLin/mod-muted
Add a mod that mutes the audio track
This commit is contained in:
commit
f9814a66cb
@ -130,7 +130,8 @@ namespace osu.Game.Rulesets.Catch
|
|||||||
return new Mod[]
|
return new Mod[]
|
||||||
{
|
{
|
||||||
new MultiMod(new ModWindUp(), new ModWindDown()),
|
new MultiMod(new ModWindUp(), new ModWindDown()),
|
||||||
new CatchModFloatingFruits()
|
new CatchModFloatingFruits(),
|
||||||
|
new CatchModMuted(),
|
||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
12
osu.Game.Rulesets.Catch/Mods/CatchModMuted.cs
Normal file
12
osu.Game.Rulesets.Catch/Mods/CatchModMuted.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// 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.Rulesets.Catch.Objects;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Catch.Mods
|
||||||
|
{
|
||||||
|
public class CatchModMuted : ModMuted<CatchHitObject>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -253,7 +253,8 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
case ModType.Fun:
|
case ModType.Fun:
|
||||||
return new Mod[]
|
return new Mod[]
|
||||||
{
|
{
|
||||||
new MultiMod(new ModWindUp(), new ModWindDown())
|
new MultiMod(new ModWindUp(), new ModWindDown()),
|
||||||
|
new ManiaModMuted(),
|
||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
12
osu.Game.Rulesets.Mania/Mods/ManiaModMuted.cs
Normal file
12
osu.Game.Rulesets.Mania/Mods/ManiaModMuted.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// 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.Rulesets.Mania.Objects;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Mods
|
||||||
|
{
|
||||||
|
public class ManiaModMuted : ModMuted<ManiaHitObject>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
12
osu.Game.Rulesets.Osu/Mods/OsuModMuted.cs
Normal file
12
osu.Game.Rulesets.Osu/Mods/OsuModMuted.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// 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.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
|
{
|
||||||
|
public class OsuModMuted : ModMuted<OsuHitObject>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -189,6 +189,7 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
new OsuModTraceable(),
|
new OsuModTraceable(),
|
||||||
new OsuModBarrelRoll(),
|
new OsuModBarrelRoll(),
|
||||||
new OsuModApproachDifferent(),
|
new OsuModApproachDifferent(),
|
||||||
|
new OsuModMuted(),
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.System:
|
case ModType.System:
|
||||||
|
12
osu.Game.Rulesets.Taiko/Mods/TaikoModMuted.cs
Normal file
12
osu.Game.Rulesets.Taiko/Mods/TaikoModMuted.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// 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.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Mods
|
||||||
|
{
|
||||||
|
public class TaikoModMuted : ModMuted<TaikoHitObject>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -149,7 +149,8 @@ namespace osu.Game.Rulesets.Taiko
|
|||||||
case ModType.Fun:
|
case ModType.Fun:
|
||||||
return new Mod[]
|
return new Mod[]
|
||||||
{
|
{
|
||||||
new MultiMod(new ModWindUp(), new ModWindDown())
|
new MultiMod(new ModWindUp(), new ModWindDown()),
|
||||||
|
new TaikoModMuted(),
|
||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
48
osu.Game/Rulesets/Mods/ModMuted.cs
Normal file
48
osu.Game/Rulesets/Mods/ModMuted.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// 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.Audio;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mods
|
||||||
|
{
|
||||||
|
public abstract class ModMuted : Mod
|
||||||
|
{
|
||||||
|
public override string Name => "Muted";
|
||||||
|
public override string Acronym => "MU";
|
||||||
|
public override IconUsage? Icon => FontAwesome.Solid.VolumeMute;
|
||||||
|
public override string Description => "Can you still feel the rhythm without music?";
|
||||||
|
public override ModType Type => ModType.Fun;
|
||||||
|
public override double ScoreMultiplier => 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class ModMuted<TObject> : ModMuted, IApplicableToDrawableRuleset<TObject>, IApplicableToTrack
|
||||||
|
where TObject : HitObject
|
||||||
|
{
|
||||||
|
private readonly BindableNumber<double> volumeAdjust = new BindableDouble();
|
||||||
|
|
||||||
|
[SettingSource("Enable metronome", "Add a metronome to help you keep track of the rhythm.")]
|
||||||
|
public BindableBool EnableMetronome { get; } = new BindableBool
|
||||||
|
{
|
||||||
|
Default = true,
|
||||||
|
Value = true
|
||||||
|
};
|
||||||
|
|
||||||
|
public void ApplyToTrack(ITrack track)
|
||||||
|
{
|
||||||
|
track.AddAdjustment(AdjustableProperty.Volume, volumeAdjust);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ApplyToDrawableRuleset(DrawableRuleset<TObject> drawableRuleset)
|
||||||
|
{
|
||||||
|
if (EnableMetronome.Value)
|
||||||
|
drawableRuleset.Overlays.Add(new Metronome(drawableRuleset.Beatmap.HitObjects.First().StartTime));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user