2021-02-24 12:39:15 +08:00
|
|
|
// 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;
|
|
|
|
using System.Linq;
|
2023-01-09 15:49:36 +08:00
|
|
|
using osu.Framework.Bindables;
|
2021-02-24 12:39:15 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Game.Rulesets.Mania.Objects;
|
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2021-05-15 11:51:39 +08:00
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2021-02-24 12:39:15 +08:00
|
|
|
using osu.Game.Rulesets.UI;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Mods
|
|
|
|
{
|
2024-02-06 23:15:06 +08:00
|
|
|
public abstract class ManiaModWithPlayfieldCover : ModHidden, IApplicableToDrawableRuleset<ManiaHitObject>
|
2021-02-24 12:39:15 +08:00
|
|
|
{
|
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight<ManiaHitObject>) };
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The direction in which the cover should expand.
|
|
|
|
/// </summary>
|
2021-02-24 14:05:12 +08:00
|
|
|
protected abstract CoverExpandDirection ExpandDirection { get; }
|
2021-02-24 12:39:15 +08:00
|
|
|
|
2024-02-06 23:15:06 +08:00
|
|
|
/// <summary>
|
|
|
|
/// The relative area that should be completely covered. This does not include the fade.
|
|
|
|
/// </summary>
|
2023-01-09 15:49:36 +08:00
|
|
|
public abstract BindableNumber<float> Coverage { get; }
|
2022-12-20 07:31:28 +08:00
|
|
|
|
2021-02-24 12:39:15 +08:00
|
|
|
public virtual void ApplyToDrawableRuleset(DrawableRuleset<ManiaHitObject> drawableRuleset)
|
|
|
|
{
|
|
|
|
ManiaPlayfield maniaPlayfield = (ManiaPlayfield)drawableRuleset.Playfield;
|
|
|
|
|
|
|
|
foreach (Column column in maniaPlayfield.Stages.SelectMany(stage => stage.Columns))
|
|
|
|
{
|
|
|
|
HitObjectContainer hoc = column.HitObjectArea.HitObjectContainer;
|
2023-10-17 16:40:44 +08:00
|
|
|
Container hocParent = (Container)hoc.Parent!;
|
2021-02-24 12:39:15 +08:00
|
|
|
|
2022-08-26 14:19:05 +08:00
|
|
|
hocParent.Remove(hoc, false);
|
2024-02-07 23:20:32 +08:00
|
|
|
hocParent.Add(CreateCover(hoc).With(c =>
|
2021-02-24 12:39:15 +08:00
|
|
|
{
|
|
|
|
c.RelativeSizeAxes = Axes.Both;
|
|
|
|
c.Direction = ExpandDirection;
|
2024-02-06 22:32:54 +08:00
|
|
|
c.Coverage.BindTo(Coverage);
|
2021-02-24 12:39:15 +08:00
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
2021-05-15 11:51:39 +08:00
|
|
|
|
2024-02-07 23:20:32 +08:00
|
|
|
protected virtual PlayfieldCoveringWrapper CreateCover(Drawable content) => new PlayfieldCoveringWrapper(content);
|
|
|
|
|
2021-05-15 11:51:39 +08:00
|
|
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
|
|
|
{
|
|
|
|
}
|
2021-02-24 12:39:15 +08:00
|
|
|
}
|
|
|
|
}
|