2019-01-24 16:43:03 +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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using System;
|
2020-07-14 21:06:15 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2018-11-12 01:38:12 +08:00
|
|
|
|
using osu.Game.Rulesets.Mania.Objects;
|
2020-07-14 21:06:15 +08:00
|
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2020-07-14 21:06:15 +08:00
|
|
|
|
using osu.Game.Rulesets.UI;
|
2020-07-16 16:26:18 +08:00
|
|
|
|
using osuTK;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Mods
|
|
|
|
|
{
|
2020-07-14 21:06:15 +08:00
|
|
|
|
public class ManiaModHidden : ModHidden, IApplicableToDrawableRuleset<ManiaHitObject>
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
public override string Description => @"Keys fade out before you hit them!";
|
|
|
|
|
public override double ScoreMultiplier => 1;
|
2018-11-12 01:38:12 +08:00
|
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight<ManiaHitObject>) };
|
2020-07-14 21:06:15 +08:00
|
|
|
|
|
2020-07-15 17:15:47 +08:00
|
|
|
|
public virtual void ApplyToDrawableRuleset(DrawableRuleset<ManiaHitObject> drawableRuleset)
|
2020-07-14 21:06:15 +08:00
|
|
|
|
{
|
|
|
|
|
ManiaPlayfield maniaPlayfield = (ManiaPlayfield)drawableRuleset.Playfield;
|
|
|
|
|
|
|
|
|
|
foreach (Column column in maniaPlayfield.Stages.SelectMany(stage => stage.Columns))
|
|
|
|
|
{
|
|
|
|
|
HitObjectContainer hoc = column.HitObjectArea.HitObjectContainer;
|
|
|
|
|
Container hocParent = (Container)hoc.Parent;
|
|
|
|
|
|
|
|
|
|
hocParent.Remove(hoc);
|
2020-07-16 20:17:51 +08:00
|
|
|
|
hocParent.Add(CreateCover(hoc).With(c =>
|
2020-07-14 21:06:15 +08:00
|
|
|
|
{
|
2020-07-16 16:26:18 +08:00
|
|
|
|
c.RelativeSizeAxes = Axes.Both;
|
|
|
|
|
c.Coverage = 0.5f;
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-15 17:15:47 +08:00
|
|
|
|
|
2020-07-16 20:18:24 +08:00
|
|
|
|
protected virtual PlayfieldCoveringWrapper CreateCover(Drawable content) => new ModHiddenCoveringWrapper(content);
|
2020-07-16 16:26:18 +08:00
|
|
|
|
|
2020-07-16 20:18:24 +08:00
|
|
|
|
private class ModHiddenCoveringWrapper : PlayfieldCoveringWrapper
|
2020-07-16 16:26:18 +08:00
|
|
|
|
{
|
2020-07-16 20:18:24 +08:00
|
|
|
|
public ModHiddenCoveringWrapper(Drawable content)
|
2020-07-16 20:17:51 +08:00
|
|
|
|
: base(content)
|
2020-07-16 16:26:18 +08:00
|
|
|
|
{
|
2020-07-16 16:47:00 +08:00
|
|
|
|
// This cover extends outwards from the hit position.
|
2020-07-16 16:26:18 +08:00
|
|
|
|
Cover.Scale = new Vector2(1, -1);
|
2020-07-14 21:06:15 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|