Simplify and standardise scale for default display

This commit is contained in:
Dean Herbert
2020-07-30 11:50:13 +09:00
parent 64c7ae7686
commit 54fee7e716
3 changed files with 11 additions and 26 deletions

View File

@ -7,7 +7,6 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
@ -39,29 +38,20 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
// we are slightly bigger than our parent, to clip the top and bottom of the circle
Height = 1.3f;
Spinner = s; Spinner = s;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
ticks = new Container<DrawableSpinnerTick>(), ticks = new Container<DrawableSpinnerTick>(),
RotationTracker = new SpinnerRotationTracker(Spinner),
new AspectContainer new AspectContainer
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Scale = new Vector2(Spinner.Scale),
Children = new Drawable[] Children = new Drawable[]
{ {
new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SpinnerBody), _ => new DefaultSpinnerDisc()), new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SpinnerBody), _ => new DefaultSpinnerDisc()),
RotationTracker = new SpinnerRotationTracker(Spinner) RotationTracker = new SpinnerRotationTracker(Spinner)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
} }
}, },
SpmCounter = new SpinnerSpmCounter SpmCounter = new SpinnerSpmCounter
@ -162,8 +152,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
RotationTracker.Tracking = OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false; RotationTracker.Tracking = OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false;
} }
public float RelativeHeight => ToScreenSpace(new RectangleF(0, 0, 0, OsuHitObject.OBJECT_RADIUS * 2)).Height / DrawHeight;
protected override void UpdateAfterChildren() protected override void UpdateAfterChildren()
{ {
base.UpdateAfterChildren(); base.UpdateAfterChildren();

View File

@ -39,6 +39,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
// we are slightly bigger than our parent, to clip the top and bottom of the circle
// this should probably be revisited when scaled spinners are a thing.
Scale = new Vector2(1.3f);
Anchor = Anchor.Centre; Anchor = Anchor.Centre;
Origin = Anchor.Centre; Origin = Anchor.Centre;
} }
@ -95,22 +99,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {
centre.ScaleTo(0); centre.ScaleTo(0);
mainContainer.ScaleTo(0); mainContainer.ScaleTo(0);
this.ScaleTo(1);
using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimePreempt / 2, true)) using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimePreempt / 2, true))
{ {
float phaseOneScale = spinner.Scale * 0.7f; // constant ambient rotation to give the spinner "spinning" character.
centre.ScaleTo(phaseOneScale, spinner.TimePreempt / 4, Easing.OutQuint);
mainContainer
.ScaleTo(phaseOneScale * drawableSpinner.RelativeHeight * 1.6f, spinner.TimePreempt / 4, Easing.OutQuint);
this.RotateTo((float)(25 * spinner.Duration / 2000), spinner.TimePreempt + spinner.Duration); this.RotateTo((float)(25 * spinner.Duration / 2000), spinner.TimePreempt + spinner.Duration);
centre.ScaleTo(0.3f, spinner.TimePreempt / 4, Easing.OutQuint);
mainContainer.ScaleTo(0.2f, spinner.TimePreempt / 4, Easing.OutQuint);
using (BeginDelayedSequence(spinner.TimePreempt / 2, true)) using (BeginDelayedSequence(spinner.TimePreempt / 2, true))
{ {
centre.ScaleTo(spinner.Scale, spinner.TimePreempt / 2, Easing.OutQuint); centre.ScaleTo(0.5f, spinner.TimePreempt / 2, Easing.OutQuint);
mainContainer.ScaleTo(1, spinner.TimePreempt / 2, Easing.OutQuint); mainContainer.ScaleTo(1, spinner.TimePreempt / 2, Easing.OutQuint);
} }
} }
@ -160,8 +160,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
.FadeTo(tracking_alpha, 250, Easing.OutQuint); .FadeTo(tracking_alpha, 250, Easing.OutQuint);
} }
float relativeCircleScale = spinner.Scale * drawableSpinner.RelativeHeight; const float initial_scale = 0.2f;
float targetScale = relativeCircleScale + (1 - relativeCircleScale) * drawableSpinner.Progress; float targetScale = initial_scale + (1 - initial_scale) * drawableSpinner.Progress;
fill.Scale = new Vector2((float)Interpolation.Lerp(fill.Scale.X, targetScale, Math.Clamp(Math.Abs(Time.Elapsed) / 100, 0, 1))); fill.Scale = new Vector2((float)Interpolation.Lerp(fill.Scale.X, targetScale, Math.Clamp(Math.Abs(Time.Elapsed) / 100, 0, 1)));
mainContainer.Rotation = drawableSpinner.RotationTracker.Rotation; mainContainer.Rotation = drawableSpinner.RotationTracker.Rotation;

View File

@ -28,9 +28,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
spinner = (DrawableSpinner)drawableHitObject; spinner = (DrawableSpinner)drawableHitObject;
AutoSizeAxes = Axes.Both;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
glow = new GlowPiece(), glow = new GlowPiece(),