1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-24 14:47:24 +08:00
osu-lazer/osu.Game.Rulesets.Osu/Mods/OsuModFlash.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

93 lines
3.0 KiB
C#
Raw Normal View History

2022-09-08 06:05:48 +08:00
using System;
2022-08-19 01:00:54 +08:00
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
2022-09-08 07:21:03 +08:00
using osu.Framework.Localisation;
2022-08-19 01:00:54 +08:00
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects;
2022-09-08 06:05:48 +08:00
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.UI;
2022-08-19 01:00:54 +08:00
namespace osu.Game.Rulesets.Osu.Mods
{
2022-09-08 06:05:48 +08:00
public class OsuModFlash : ModWithVisibilityAdjustment, IHidesApproachCircles, IApplicableToDrawableRuleset<OsuHitObject>
2022-08-19 01:00:54 +08:00
{
2022-09-08 06:05:48 +08:00
public override string Name => "Freeze frame";
public override string Acronym => "FF";
public override double ScoreMultiplier => 1;
2022-09-08 07:21:03 +08:00
public override LocalisableString Description => "Burn the notes into your memory";
2022-09-08 06:05:48 +08:00
2022-08-19 01:00:54 +08:00
public override ModType Type => ModType.Fun;
2022-09-08 06:05:48 +08:00
public override IconUsage? Icon => FontAwesome.Solid.Fire;
public override Type[] IncompatibleMods => new[] { typeof(OsuModTarget), typeof(OsuModStrictTracking) };
[SettingSource("Beat divisor")]
2022-09-08 07:21:03 +08:00
public BindableFloat BeatDivisor { get; } = new BindableFloat(1)
2022-09-08 06:05:48 +08:00
{
MinValue = .25f,
2022-09-08 07:21:03 +08:00
MaxValue = 5,
Precision = .25f
2022-09-08 06:05:48 +08:00
};
2022-08-19 01:00:54 +08:00
2022-09-08 17:14:56 +08:00
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
{
(drawableRuleset.Playfield as OsuPlayfield)?.FollowPoints.Hide();
}
2022-08-19 01:00:54 +08:00
public override void ApplyToBeatmap(IBeatmap beatmap)
{
base.ApplyToBeatmap(beatmap);
2022-09-08 07:21:03 +08:00
foreach (var obj in beatmap.HitObjects.OfType<OsuHitObject>())
2022-08-19 01:00:54 +08:00
{
2022-09-08 07:21:03 +08:00
var point = beatmap.ControlPointInfo.TimingPointAt(obj.StartTime);
2022-09-08 17:14:56 +08:00
double val = obj.TimePreempt + obj.StartTime % (point.BeatLength * BeatDivisor.Value);
applyFadeInAdjustment(obj);
2022-09-08 07:21:03 +08:00
2022-09-08 17:14:56 +08:00
void applyFadeInAdjustment(OsuHitObject osuObject)
{
osuObject.TimePreempt = val;
foreach (var nested in osuObject.NestedHitObjects.OfType<OsuHitObject>())
applyFadeInAdjustment(nested);
}
2022-08-19 01:00:54 +08:00
}
}
2022-09-08 06:05:48 +08:00
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
2022-08-19 01:00:54 +08:00
{
}
2022-09-08 06:05:48 +08:00
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) => applyFrozenState(hitObject, state);
private void applyFrozenState(DrawableHitObject drawable, ArmedState state)
2022-08-19 01:00:54 +08:00
{
2022-09-08 06:05:48 +08:00
if (drawable is DrawableSpinner)
return;
var h = (OsuHitObject)drawable.HitObject;
2022-09-08 17:14:56 +08:00
/*
2022-09-08 06:05:48 +08:00
switch (drawable)
{
case DrawableHitCircle circle:
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
{
circle.ApproachCircle.Hide();
}
break;
2022-09-08 17:14:56 +08:00
}*/
2022-09-08 06:05:48 +08:00
}
2022-08-19 01:00:54 +08:00
}
}
2022-09-08 06:05:48 +08:00