1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 16:12:54 +08:00

Merge pull request #25160 from bdach/repeat-arrow-hidden-fade

Adjust slider repeat transforms to closer match stable
This commit is contained in:
Dean Herbert 2023-10-18 18:03:48 +09:00 committed by GitHub
commit 54da6f1048
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 51 additions and 29 deletions

View File

@ -27,6 +27,7 @@ using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Rulesets.Osu.Configuration;
using osu.Game.Rulesets.Osu.Mods;
namespace osu.Game.Rulesets.Osu.Tests namespace osu.Game.Rulesets.Osu.Tests
{ {
@ -50,6 +51,8 @@ namespace osu.Game.Rulesets.Osu.Tests
snakingOut.Value = !v; snakingOut.Value = !v;
}); });
AddToggleStep("toggle hidden", hiddenActive => SelectedMods.Value = hiddenActive ? new[] { new OsuModHidden() } : Array.Empty<Mod>());
AddSliderStep("hit at", 0f, 1f, 0f, v => AddSliderStep("hit at", 0f, 1f, 0f, v =>
{ {
progressToHit = v; progressToHit = v;

View File

@ -98,6 +98,9 @@ namespace osu.Game.Rulesets.Osu.Mods
// only apply to circle piece reverse arrow is not affected by hidden. // only apply to circle piece reverse arrow is not affected by hidden.
sliderRepeat.CirclePiece.FadeOut(fadeDuration); sliderRepeat.CirclePiece.FadeOut(fadeDuration);
using (drawableObject.BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
sliderRepeat.FadeOut();
break; break;
case DrawableHitCircle circle: case DrawableHitCircle circle:

View File

@ -118,11 +118,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
case ArmedState.Hit: case ArmedState.Hit:
this.FadeOut(animDuration, Easing.Out); this.FadeOut(animDuration, Easing.Out);
const float final_scale = 1.5f;
Arrow.ScaleTo(Scale * final_scale, animDuration, Easing.Out);
CirclePiece.ScaleTo(Scale * final_scale, animDuration, Easing.Out);
break; break;
} }
} }

View File

@ -1,6 +1,7 @@
// 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. // See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
@ -12,6 +13,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -19,8 +21,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
{ {
public partial class ArgonReverseArrow : CompositeDrawable public partial class ArgonReverseArrow : CompositeDrawable
{ {
[Resolved] private DrawableSliderRepeat drawableRepeat { get; set; } = null!;
private DrawableHitObject drawableObject { get; set; } = null!;
private Bindable<Color4> accentColour = null!; private Bindable<Color4> accentColour = null!;
@ -29,8 +30,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
private Sprite side = null!; private Sprite side = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(TextureStore textures) private void load(DrawableHitObject drawableObject, TextureStore textures)
{ {
drawableRepeat = (DrawableSliderRepeat)drawableObject;
Anchor = Anchor.Centre; Anchor = Anchor.Centre;
Origin = Anchor.Centre; Origin = Anchor.Centre;
@ -70,10 +73,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
} }
}; };
accentColour = drawableObject.AccentColour.GetBoundCopy(); accentColour = drawableRepeat.AccentColour.GetBoundCopy();
accentColour.BindValueChanged(accent => icon.Colour = accent.NewValue.Darken(4), true); accentColour.BindValueChanged(accent => icon.Colour = accent.NewValue.Darken(4), true);
drawableObject.ApplyCustomUpdateState += updateStateTransforms; drawableRepeat.ApplyCustomUpdateState += updateStateTransforms;
} }
private void updateStateTransforms(DrawableHitObject hitObject, ArmedState state) private void updateStateTransforms(DrawableHitObject hitObject, ArmedState state)
@ -96,6 +99,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
.MoveToX(0, move_in_duration, Easing.Out) .MoveToX(0, move_in_duration, Easing.Out)
.Loop(total - (move_in_duration + move_out_duration)); .Loop(total - (move_in_duration + move_out_duration));
break; break;
case ArmedState.Hit:
double animDuration = Math.Min(300, drawableRepeat.HitObject.SpanDuration);
this.ScaleTo(1.5f, animDuration, Easing.Out);
break;
} }
} }
@ -103,8 +111,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
{ {
base.Dispose(isDisposing); base.Dispose(isDisposing);
if (drawableObject.IsNotNull()) if (drawableRepeat.IsNotNull())
drawableObject.ApplyCustomUpdateState -= updateStateTransforms; drawableRepeat.ApplyCustomUpdateState -= updateStateTransforms;
} }
} }
} }

View File

@ -1,6 +1,7 @@
// 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. // See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -8,14 +9,14 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osuTK; using osuTK;
namespace osu.Game.Rulesets.Osu.Skinning.Default namespace osu.Game.Rulesets.Osu.Skinning.Default
{ {
public partial class DefaultReverseArrow : CompositeDrawable public partial class DefaultReverseArrow : CompositeDrawable
{ {
[Resolved] private DrawableSliderRepeat drawableRepeat { get; set; } = null!;
private DrawableHitObject drawableObject { get; set; } = null!;
public DefaultReverseArrow() public DefaultReverseArrow()
{ {
@ -36,9 +37,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(DrawableHitObject drawableObject)
{ {
drawableObject.ApplyCustomUpdateState += updateStateTransforms; drawableRepeat = (DrawableSliderRepeat)drawableObject;
drawableRepeat.ApplyCustomUpdateState += updateStateTransforms;
} }
private void updateStateTransforms(DrawableHitObject hitObject, ArmedState state) private void updateStateTransforms(DrawableHitObject hitObject, ArmedState state)
@ -55,6 +57,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
.ScaleTo(1f, move_in_duration, Easing.Out) .ScaleTo(1f, move_in_duration, Easing.Out)
.Loop(total - (move_in_duration + move_out_duration)); .Loop(total - (move_in_duration + move_out_duration));
break; break;
case ArmedState.Hit:
double animDuration = Math.Min(300, drawableRepeat.HitObject.SpanDuration);
InternalChild.ScaleTo(1.5f, animDuration, Easing.Out);
break;
} }
} }
@ -62,8 +69,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
{ {
base.Dispose(isDisposing); base.Dispose(isDisposing);
if (drawableObject.IsNotNull()) if (drawableRepeat.IsNotNull())
drawableObject.ApplyCustomUpdateState -= updateStateTransforms; drawableRepeat.ApplyCustomUpdateState -= updateStateTransforms;
} }
} }
} }

View File

@ -1,6 +1,7 @@
// 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. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Diagnostics; using System.Diagnostics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
@ -17,8 +18,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{ {
public partial class LegacyReverseArrow : CompositeDrawable public partial class LegacyReverseArrow : CompositeDrawable
{ {
[Resolved] private DrawableSliderRepeat drawableRepeat { get; set; } = null!;
private DrawableHitObject drawableObject { get; set; } = null!;
private Drawable proxy = null!; private Drawable proxy = null!;
@ -31,8 +31,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
private bool shouldRotate; private bool shouldRotate;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ISkinSource skinSource) private void load(DrawableHitObject drawableObject, ISkinSource skinSource)
{ {
drawableRepeat = (DrawableSliderRepeat)drawableObject;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
string lookupName = new OsuSkinComponentLookup(OsuSkinComponents.ReverseArrow).LookupName; string lookupName = new OsuSkinComponentLookup(OsuSkinComponents.ReverseArrow).LookupName;
@ -58,10 +60,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
proxy = CreateProxy(); proxy = CreateProxy();
drawableObject.HitObjectApplied += onHitObjectApplied; drawableRepeat.HitObjectApplied += onHitObjectApplied;
onHitObjectApplied(drawableObject); onHitObjectApplied(drawableRepeat);
accentColour = drawableObject.AccentColour.GetBoundCopy(); accentColour = drawableRepeat.AccentColour.GetBoundCopy();
accentColour.BindValueChanged(c => accentColour.BindValueChanged(c =>
{ {
arrow.Colour = textureIsDefaultSkin && c.NewValue.R + c.NewValue.G + c.NewValue.B > (600 / 255f) ? Color4.Black : Color4.White; arrow.Colour = textureIsDefaultSkin && c.NewValue.R + c.NewValue.G + c.NewValue.B > (600 / 255f) ? Color4.Black : Color4.White;
@ -73,8 +75,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
Debug.Assert(proxy.Parent == null); Debug.Assert(proxy.Parent == null);
// see logic in LegacySliderHeadHitCircle. // see logic in LegacySliderHeadHitCircle.
(drawableObject as DrawableSliderRepeat)?.DrawableSlider drawableRepeat.DrawableSlider.OverlayElementContainer.Add(proxy);
.OverlayElementContainer.Add(proxy);
} }
private void updateStateTransforms(DrawableHitObject hitObject, ArmedState state) private void updateStateTransforms(DrawableHitObject hitObject, ArmedState state)
@ -102,6 +103,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
} }
break; break;
case ArmedState.Hit:
double animDuration = Math.Min(300, drawableRepeat.HitObject.SpanDuration);
InternalChild.ScaleTo(1.4f, animDuration, Easing.Out);
break;
} }
} }
@ -109,10 +115,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{ {
base.Dispose(isDisposing); base.Dispose(isDisposing);
if (drawableObject.IsNotNull()) if (drawableRepeat.IsNotNull())
{ {
drawableObject.HitObjectApplied -= onHitObjectApplied; drawableRepeat.HitObjectApplied -= onHitObjectApplied;
drawableObject.ApplyCustomUpdateState -= updateStateTransforms; drawableRepeat.ApplyCustomUpdateState -= updateStateTransforms;
} }
} }
} }