1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 02:42:54 +08:00

Add slider reverse arrow pulse settings

This commit is contained in:
Sebastian Krajewski 2020-01-04 13:01:42 +01:00
parent fc0b622a69
commit 46271ccbc8
5 changed files with 108 additions and 21 deletions

View File

@ -3,6 +3,7 @@
using osu.Game.Configuration;
using osu.Game.Rulesets.Configuration;
using osu.Game.Rulesets.Osu.UI;
namespace osu.Game.Rulesets.Osu.Configuration
{
@ -19,6 +20,7 @@ namespace osu.Game.Rulesets.Osu.Configuration
Set(OsuRulesetSetting.SnakingInSliders, true);
Set(OsuRulesetSetting.SnakingOutSliders, true);
Set(OsuRulesetSetting.ShowCursorTrail, true);
Set(OsuRulesetSetting.ReverseArrowPulse, ReverseArrowPulseMode.Synced);
}
}
@ -26,6 +28,7 @@ namespace osu.Game.Rulesets.Osu.Configuration
{
SnakingInSliders,
SnakingOutSliders,
ShowCursorTrail
ShowCursorTrail,
ReverseArrowPulse,
}
}

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// 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;
@ -6,13 +6,13 @@ using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.MathUtils;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Configuration;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.Scoring;
using osuTK;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
@ -21,9 +21,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private readonly RepeatPoint repeatPoint;
private readonly DrawableSlider drawableSlider;
public readonly Bindable<ReverseArrowPulseMode> PulseMode = new Bindable<ReverseArrowPulseMode>(ReverseArrowPulseMode.Synced);
private double animDuration;
private readonly SkinnableDrawable scaleContainer;
private readonly Drawable scaleContainer;
[Resolved(CanBeNull = true)]
private OsuRulesetConfigManager config { get; set; }
public DrawableRepeatPoint(RepeatPoint repeatPoint, DrawableSlider drawableSlider)
: base(repeatPoint)
@ -36,16 +41,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Blending = BlendingParameters.Additive;
Origin = Anchor.Centre;
InternalChild = scaleContainer = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.ReverseArrow), _ => new SpriteIcon
{
RelativeSizeAxes = Axes.Both,
Icon = FontAwesome.Solid.ChevronRight,
Size = new Vector2(0.35f)
}, confineMode: ConfineMode.NoScaling)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
InternalChild = scaleContainer = new ReverseArrowPiece();
}
private readonly IBindable<float> scaleBindable = new Bindable<float>();
@ -55,6 +51,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
scaleBindable.BindValueChanged(scale => scaleContainer.Scale = new Vector2(scale.NewValue), true);
scaleBindable.BindTo(HitObject.ScaleBindable);
config?.BindWith(OsuRulesetSetting.ReverseArrowPulse, PulseMode);
}
protected override void CheckForResult(bool userTriggered, double timeOffset)
@ -69,6 +67,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
this.FadeIn(animDuration);
if (PulseMode.Value == ReverseArrowPulseMode.Stable)
{
double fadeInStart = repeatPoint.StartTime - 2 * repeatPoint.SpanDuration;
// We want first repeat arrow to start pulsing during snake in
@ -78,6 +78,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
for (double pulseStartTime = fadeInStart; pulseStartTime < repeatPoint.StartTime; pulseStartTime += 300)
this.Delay(pulseStartTime - LifetimeStart).ScaleTo(1.3f).ScaleTo(1f, Math.Min(300, repeatPoint.StartTime - pulseStartTime), Easing.Out);
}
else if (PulseMode.Value == ReverseArrowPulseMode.Off)
this.ScaleTo(0.5f).ScaleTo(1f, animDuration * 2, Easing.OutElasticHalf);
}
protected override void UpdateStateTransforms(ArmedState state)
{

View File

@ -0,0 +1,58 @@
// 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.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osuTK;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers;
using osu.Game.Rulesets.Osu.Configuration;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
public class ReverseArrowPiece : BeatSyncedContainer
{
public readonly Bindable<ReverseArrowPulseMode> PulseMode = new Bindable<ReverseArrowPulseMode>(ReverseArrowPulseMode.Synced);
[Resolved(CanBeNull = true)]
private OsuRulesetConfigManager config { get; set; }
public ReverseArrowPiece()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Blending = BlendingParameters.Additive;
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
InternalChild = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.ReverseArrow), _ => new SpriteIcon
{
RelativeSizeAxes = Axes.Both,
Icon = FontAwesome.Solid.ChevronRight,
Size = new Vector2(0.35f)
}, confineMode: ConfineMode.NoScaling)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
}
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
{
if (PulseMode.Value == ReverseArrowPulseMode.Synced)
InternalChild.ScaleTo(1.3f).ScaleTo(1f, timingPoint.BeatLength, Easing.Out);
}
[BackgroundDependencyLoader]
private void load()
{
config?.BindWith(OsuRulesetSetting.ReverseArrowPulse, PulseMode);
}
}
}

View File

@ -39,6 +39,11 @@ namespace osu.Game.Rulesets.Osu.UI
LabelText = "Cursor trail",
Bindable = config.GetBindable<bool>(OsuRulesetSetting.ShowCursorTrail)
},
new SettingsEnumDropdown<ReverseArrowPulseMode>
{
LabelText = "Slider reverse arrow pulse",
Bindable = config.GetBindable<ReverseArrowPulseMode>(OsuRulesetSetting.ReverseArrowPulse)
},
};
}
}

View File

@ -0,0 +1,18 @@
// 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.ComponentModel;
namespace osu.Game.Rulesets.Osu.UI
{
public enum ReverseArrowPulseMode
{
Off,
[Description("Match osu!stable")]
Stable,
[Description("Sync to beatmap")]
Synced
}
}