2019-07-28 16:00:41 +00: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-09-19 03:15:36 +00:00
|
|
|
|
2018-09-20 23:06:37 +00:00
|
|
|
using System;
|
2018-09-19 03:15:36 +00:00
|
|
|
using osu.Framework.Graphics;
|
2019-07-28 16:00:41 +00:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
2022-08-10 20:09:11 +00:00
|
|
|
using osu.Framework.Localisation;
|
2018-09-19 03:15:36 +00:00
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
2019-07-28 16:00:41 +00:00
|
|
|
using osuTK;
|
2018-09-19 03:15:36 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Mods
|
|
|
|
{
|
2021-06-28 15:54:21 +00:00
|
|
|
public class OsuModSpinIn : ModWithVisibilityAdjustment, IHidesApproachCircles
|
2018-09-19 03:15:36 +00:00
|
|
|
{
|
2018-09-20 23:06:37 +00:00
|
|
|
public override string Name => "Spin In";
|
2019-07-28 16:00:41 +00:00
|
|
|
public override string Acronym => "SI";
|
2020-01-14 13:22:00 +00:00
|
|
|
public override IconUsage? Icon => FontAwesome.Solid.Undo;
|
2018-09-19 03:15:36 +00:00
|
|
|
public override ModType Type => ModType.Fun;
|
2022-08-10 20:09:11 +00:00
|
|
|
public override LocalisableString Description => "Circles spin in. No approach circles.";
|
2018-09-19 03:15:36 +00:00
|
|
|
public override double ScoreMultiplier => 1;
|
2019-07-28 16:15:54 +00:00
|
|
|
|
2021-06-30 06:57:15 +00:00
|
|
|
// todo: this mod needs to be incompatible with "hidden" due to forcing the circle to remain opaque,
|
|
|
|
// further implementation will be required for supporting that.
|
2023-12-03 02:39:44 +00:00
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(IRequiresApproachCircles), typeof(OsuModObjectScaleTween), typeof(OsuModHidden), typeof(OsuModDepth) };
|
2018-09-20 23:06:37 +00:00
|
|
|
|
|
|
|
private const int rotate_offset = 360;
|
2019-07-28 16:00:41 +00:00
|
|
|
private const float rotate_starting_width = 2;
|
2018-09-20 23:06:37 +00:00
|
|
|
|
2020-11-05 07:03:10 +00:00
|
|
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
2019-07-28 16:00:41 +00:00
|
|
|
{
|
2018-09-19 03:15:36 +00:00
|
|
|
}
|
|
|
|
|
2020-11-05 07:03:10 +00:00
|
|
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) => applyZoomState(hitObject, state);
|
|
|
|
|
2019-07-28 16:00:41 +00:00
|
|
|
private void applyZoomState(DrawableHitObject drawable, ArmedState state)
|
2018-09-19 03:15:36 +00:00
|
|
|
{
|
2020-11-05 06:52:06 +00:00
|
|
|
if (drawable is DrawableSpinner)
|
|
|
|
return;
|
|
|
|
|
2018-09-19 03:15:36 +00:00
|
|
|
var h = (OsuHitObject)drawable.HitObject;
|
2018-09-21 03:51:43 +00:00
|
|
|
|
2018-09-20 03:56:25 +00:00
|
|
|
switch (drawable)
|
2018-09-19 03:15:36 +00:00
|
|
|
{
|
2018-09-20 03:56:25 +00:00
|
|
|
case DrawableHitCircle circle:
|
2021-07-05 15:52:39 +00:00
|
|
|
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
|
2018-09-20 03:56:25 +00:00
|
|
|
{
|
2019-07-28 16:00:41 +00:00
|
|
|
circle.ApproachCircle.Hide();
|
2018-09-19 03:15:36 +00:00
|
|
|
|
2019-07-28 16:00:41 +00:00
|
|
|
circle.RotateTo(rotate_offset).Then().RotateTo(0, h.TimePreempt, Easing.InOutSine);
|
|
|
|
circle.ScaleTo(new Vector2(rotate_starting_width, 0)).Then().ScaleTo(1, h.TimePreempt, Easing.InOutSine);
|
2021-06-30 07:26:27 +00:00
|
|
|
|
|
|
|
// bypass fade in.
|
|
|
|
if (state == ArmedState.Idle)
|
|
|
|
circle.FadeIn();
|
2018-09-21 04:07:09 +00:00
|
|
|
}
|
2018-09-20 03:56:25 +00:00
|
|
|
|
|
|
|
break;
|
2018-09-19 03:15:36 +00:00
|
|
|
|
2018-09-20 03:56:25 +00:00
|
|
|
case DrawableSlider slider:
|
2019-07-28 16:00:41 +00:00
|
|
|
using (slider.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
|
2018-09-20 03:56:25 +00:00
|
|
|
{
|
2019-07-28 16:00:41 +00:00
|
|
|
slider.ScaleTo(0).Then().ScaleTo(1, h.TimePreempt, Easing.InOutSine);
|
2018-09-20 03:56:25 +00:00
|
|
|
|
2019-07-28 16:00:41 +00:00
|
|
|
// bypass fade in.
|
|
|
|
if (state == ArmedState.Idle)
|
|
|
|
slider.FadeIn();
|
2018-09-20 03:56:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-09-19 03:15:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|