mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Move spinner approach circle to its own SkinnableDrawable
This commit is contained in:
parent
f7b5341663
commit
843c8bd7a4
@ -111,7 +111,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
// todo: hide background
|
// todo: hide background
|
||||||
|
|
||||||
using (spinner.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt))
|
using (spinner.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt))
|
||||||
spinner.HideApproachCircle();
|
spinner.ApproachCircle.Hide();
|
||||||
|
|
||||||
using (spinner.BeginAbsoluteSequence(fadeStartTime))
|
using (spinner.BeginAbsoluteSequence(fadeStartTime))
|
||||||
spinner.FadeOut(fadeDuration);
|
spinner.FadeOut(fadeDuration);
|
||||||
|
@ -29,6 +29,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
public new OsuSpinnerJudgementResult Result => (OsuSpinnerJudgementResult)base.Result;
|
public new OsuSpinnerJudgementResult Result => (OsuSpinnerJudgementResult)base.Result;
|
||||||
|
|
||||||
|
public SkinnableDrawable ApproachCircle { get; private set; }
|
||||||
|
|
||||||
public SpinnerRotationTracker RotationTracker { get; private set; }
|
public SpinnerRotationTracker RotationTracker { get; private set; }
|
||||||
|
|
||||||
private SpinnerSpmCalculator spmCalculator;
|
private SpinnerSpmCalculator spmCalculator;
|
||||||
@ -42,8 +44,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
private const float spinning_sample_initial_frequency = 1.0f;
|
private const float spinning_sample_initial_frequency = 1.0f;
|
||||||
private const float spinning_sample_modulated_base_frequency = 0.5f;
|
private const float spinning_sample_modulated_base_frequency = 0.5f;
|
||||||
|
|
||||||
internal readonly Bindable<Visibility> ApproachCircleVisibility = new Bindable<Visibility>(Visibility.Visible);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of bonus score gained from spinning after the required number of spins, for display purposes.
|
/// The amount of bonus score gained from spinning after the required number of spins, for display purposes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -88,7 +88,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SpinnerBody), _ => new DefaultSpinner()),
|
ApproachCircle = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SpinnerApproachCircle)),
|
||||||
|
new SkinnableSpinnerBody(ApproachCircle.CreateProxy(), _ => new DefaultSpinner()),
|
||||||
RotationTracker = new SpinnerRotationTracker(this)
|
RotationTracker = new SpinnerRotationTracker(this)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -287,11 +288,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
updateBonusScore();
|
updateBonusScore();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Hides the spinner's approach circle if it has one.
|
|
||||||
/// </summary>
|
|
||||||
public void HideApproachCircle() => this.TransformBindableTo(ApproachCircleVisibility, Visibility.Hidden);
|
|
||||||
|
|
||||||
private static readonly int score_per_tick = new SpinnerBonusTick.OsuSpinnerBonusTickJudgement().MaxNumericResult;
|
private static readonly int score_per_tick = new SpinnerBonusTick.OsuSpinnerBonusTickJudgement().MaxNumericResult;
|
||||||
|
|
||||||
private int wholeSpins;
|
private int wholeSpins;
|
||||||
|
@ -10,7 +10,6 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
Cursor,
|
Cursor,
|
||||||
CursorTrail,
|
CursorTrail,
|
||||||
SliderScorePoint,
|
SliderScorePoint,
|
||||||
ApproachCircle,
|
|
||||||
ReverseArrow,
|
ReverseArrow,
|
||||||
HitCircleText,
|
HitCircleText,
|
||||||
SliderHeadHitCircle,
|
SliderHeadHitCircle,
|
||||||
@ -19,5 +18,6 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
SliderBall,
|
SliderBall,
|
||||||
SliderBody,
|
SliderBody,
|
||||||
SpinnerBody,
|
SpinnerBody,
|
||||||
|
SpinnerApproachCircle,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
|
|
||||||
protected DrawableSpinner DrawableSpinner { get; private set; }
|
protected DrawableSpinner DrawableSpinner { get; private set; }
|
||||||
|
|
||||||
private Drawable approachCircle;
|
|
||||||
|
|
||||||
private Sprite spin;
|
private Sprite spin;
|
||||||
private Sprite clear;
|
private Sprite clear;
|
||||||
@ -61,7 +60,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
approachCircle = getSpinnerApproachCircle(source),
|
|
||||||
spin = new Sprite
|
spin = new Sprite
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
@ -104,28 +102,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
}.With(s => s.Font = s.Font.With(fixedWidth: false)),
|
}.With(s => s.Font = s.Font.With(fixedWidth: false)),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static Drawable getSpinnerApproachCircle(ISkinSource source)
|
|
||||||
{
|
|
||||||
var spinnerProvider = source.FindProvider(s =>
|
|
||||||
s.GetTexture("spinner-circle") != null ||
|
|
||||||
s.GetTexture("spinner-top") != null);
|
|
||||||
|
|
||||||
if (spinnerProvider is DefaultLegacySkin)
|
|
||||||
return Empty();
|
|
||||||
|
|
||||||
return new Sprite
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Texture = source.GetTexture("spinner-approachcircle"),
|
|
||||||
Scale = new Vector2(SPRITE_SCALE * 1.86f),
|
|
||||||
Y = SPINNER_Y_CENTRE,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IBindable<Visibility> approachCircleVisibility;
|
|
||||||
private IBindable<double> gainedBonus;
|
private IBindable<double> gainedBonus;
|
||||||
private IBindable<double> spinsPerMinute;
|
private IBindable<double> spinsPerMinute;
|
||||||
|
|
||||||
@ -135,12 +113,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
approachCircleVisibility = DrawableSpinner.ApproachCircleVisibility.GetBoundCopy();
|
|
||||||
approachCircleVisibility.BindValueChanged(v =>
|
|
||||||
{
|
|
||||||
approachCircle.Alpha = v.NewValue == Visibility.Hidden ? 0 : 1;
|
|
||||||
}, true);
|
|
||||||
|
|
||||||
gainedBonus = DrawableSpinner.GainedBonus.GetBoundCopy();
|
gainedBonus = DrawableSpinner.GainedBonus.GetBoundCopy();
|
||||||
gainedBonus.BindValueChanged(bonus =>
|
gainedBonus.BindValueChanged(bonus =>
|
||||||
{
|
{
|
||||||
@ -204,9 +176,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
spmCounter.MoveToOffset(new Vector2(0, -spm_hide_offset), d.HitObject.TimeFadeIn, Easing.Out);
|
spmCounter.MoveToOffset(new Vector2(0, -spm_hide_offset), d.HitObject.TimeFadeIn, Easing.Out);
|
||||||
}
|
}
|
||||||
|
|
||||||
using (BeginAbsoluteSequence(d.HitObject.StartTime))
|
|
||||||
approachCircle.ScaleTo(SPRITE_SCALE * 1.86f).ScaleTo(SPRITE_SCALE * 0.1f, d.HitObject.Duration);
|
|
||||||
|
|
||||||
double spinFadeOutLength = Math.Min(400, d.HitObject.Duration);
|
double spinFadeOutLength = Math.Min(400, d.HitObject.Duration);
|
||||||
|
|
||||||
using (BeginAbsoluteSequence(drawableHitObject.HitStateUpdateTime - spinFadeOutLength, true))
|
using (BeginAbsoluteSequence(drawableHitObject.HitStateUpdateTime - spinFadeOutLength, true))
|
||||||
|
@ -0,0 +1,64 @@
|
|||||||
|
// 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 JetBrains.Annotations;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using osuTK;
|
||||||
|
using static osu.Game.Rulesets.Osu.Skinning.Legacy.LegacySpinner;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||||
|
{
|
||||||
|
public class LegacySpinnerApproachCircle : CompositeDrawable
|
||||||
|
{
|
||||||
|
private DrawableSpinner drawableSpinner;
|
||||||
|
|
||||||
|
[CanBeNull]
|
||||||
|
private Sprite sprite;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(DrawableHitObject drawableHitObject, ISkinSource source)
|
||||||
|
{
|
||||||
|
drawableSpinner = (DrawableSpinner)drawableHitObject;
|
||||||
|
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
var spinnerProvider = source.FindProvider(s =>
|
||||||
|
s.GetTexture("spinner-circle") != null ||
|
||||||
|
s.GetTexture("spinner-top") != null);
|
||||||
|
|
||||||
|
if (spinnerProvider is DefaultLegacySkin)
|
||||||
|
return;
|
||||||
|
|
||||||
|
InternalChild = sprite = new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Texture = source.GetTexture("spinner-approachcircle"),
|
||||||
|
Scale = new Vector2(SPRITE_SCALE * 1.86f),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
drawableSpinner.ApplyCustomUpdateState += updateStateTransforms;
|
||||||
|
updateStateTransforms(drawableSpinner, drawableSpinner.State.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
|
||||||
|
{
|
||||||
|
if (!(drawableHitObject is DrawableSpinner spinner))
|
||||||
|
return;
|
||||||
|
|
||||||
|
using (BeginAbsoluteSequence(spinner.HitObject.StartTime))
|
||||||
|
sprite?.ScaleTo(SPRITE_SCALE * 0.1f, spinner.HitObject.Duration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -121,6 +121,12 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
return new LegacyOldStyleSpinner();
|
return new LegacyOldStyleSpinner();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
case OsuSkinComponents.SpinnerApproachCircle:
|
||||||
|
if (Source.GetTexture("spinner-approachcircle") != null)
|
||||||
|
return new LegacySpinnerApproachCircle();
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user