mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:07:52 +08:00
Adjust behaviour of hit animations toggle to match user expectations
This commit is contained in:
parent
cd4dce2c7e
commit
ad2cd0ba8f
@ -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.Shapes;
|
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
@ -16,7 +15,6 @@ using osu.Game.Rulesets.Osu.Skinning.Default;
|
|||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
|
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
|
||||||
{
|
{
|
||||||
@ -48,13 +46,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Circle
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = Color4.White,
|
|
||||||
},
|
|
||||||
ring = new RingPiece
|
ring = new RingPiece
|
||||||
{
|
{
|
||||||
BorderThickness = 4,
|
BorderThickness = 4,
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
// 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 osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
@ -16,6 +19,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
|
|||||||
|
|
||||||
protected readonly HitCirclePiece CirclePiece;
|
protected readonly HitCirclePiece CirclePiece;
|
||||||
private readonly HitCircleOverlapMarker marker;
|
private readonly HitCircleOverlapMarker marker;
|
||||||
|
private readonly Bindable<bool> showHitMarkers = new Bindable<bool>();
|
||||||
|
|
||||||
public HitCircleSelectionBlueprint(HitCircle circle)
|
public HitCircleSelectionBlueprint(HitCircle circle)
|
||||||
: base(circle)
|
: base(circle)
|
||||||
@ -27,12 +31,32 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuConfigManager config)
|
||||||
|
{
|
||||||
|
config.BindWith(OsuSetting.EditorShowHitMarkers, showHitMarkers);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
showHitMarkers.BindValueChanged(_ =>
|
||||||
|
{
|
||||||
|
if (!showHitMarkers.Value)
|
||||||
|
DrawableObject.RestoreHitAnimations();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
CirclePiece.UpdateFrom(HitObject);
|
CirclePiece.UpdateFrom(HitObject);
|
||||||
marker.UpdateFrom(HitObject);
|
marker.UpdateFrom(HitObject);
|
||||||
|
|
||||||
|
if (showHitMarkers.Value)
|
||||||
|
DrawableObject.SuppressHitAnimations();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => DrawableObject.HitArea.ReceivePositionalInputAt(screenSpacePos);
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => DrawableObject.HitArea.ReceivePositionalInputAt(screenSpacePos);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// 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 osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
@ -14,18 +13,17 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
|
|
||||||
private readonly Slider slider;
|
private readonly Slider slider;
|
||||||
private readonly SliderPosition position;
|
private readonly SliderPosition position;
|
||||||
private readonly HitCircleOverlapMarker marker;
|
private readonly HitCircleOverlapMarker? marker;
|
||||||
|
|
||||||
public SliderCircleOverlay(Slider slider, SliderPosition position)
|
public SliderCircleOverlay(Slider slider, SliderPosition position)
|
||||||
{
|
{
|
||||||
this.slider = slider;
|
this.slider = slider;
|
||||||
this.position = position;
|
this.position = position;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
if (position == SliderPosition.Start)
|
||||||
{
|
AddInternal(marker = new HitCircleOverlapMarker());
|
||||||
marker = new HitCircleOverlapMarker(),
|
|
||||||
CirclePiece = new HitCirclePiece(),
|
AddInternal(CirclePiece = new HitCirclePiece());
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@ -35,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
var circle = position == SliderPosition.Start ? (HitCircle)slider.HeadCircle : slider.TailCircle;
|
var circle = position == SliderPosition.Start ? (HitCircle)slider.HeadCircle : slider.TailCircle;
|
||||||
|
|
||||||
CirclePiece.UpdateFrom(circle);
|
CirclePiece.UpdateFrom(circle);
|
||||||
marker.UpdateFrom(circle);
|
marker?.UpdateFrom(circle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Hide()
|
public override void Hide()
|
||||||
|
@ -14,6 +14,7 @@ using osu.Framework.Graphics.UserInterface;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -59,6 +60,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
private readonly BindableList<PathControlPoint> controlPoints = new BindableList<PathControlPoint>();
|
private readonly BindableList<PathControlPoint> controlPoints = new BindableList<PathControlPoint>();
|
||||||
private readonly IBindable<int> pathVersion = new Bindable<int>();
|
private readonly IBindable<int> pathVersion = new Bindable<int>();
|
||||||
private readonly BindableList<HitObject> selectedObjects = new BindableList<HitObject>();
|
private readonly BindableList<HitObject> selectedObjects = new BindableList<HitObject>();
|
||||||
|
private readonly Bindable<bool> showHitMarkers = new Bindable<bool>();
|
||||||
|
|
||||||
public SliderSelectionBlueprint(Slider slider)
|
public SliderSelectionBlueprint(Slider slider)
|
||||||
: base(slider)
|
: base(slider)
|
||||||
@ -66,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -74,6 +76,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
HeadOverlay = CreateCircleOverlay(HitObject, SliderPosition.Start),
|
HeadOverlay = CreateCircleOverlay(HitObject, SliderPosition.Start),
|
||||||
TailOverlay = CreateCircleOverlay(HitObject, SliderPosition.End),
|
TailOverlay = CreateCircleOverlay(HitObject, SliderPosition.End),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config.BindWith(OsuSetting.EditorShowHitMarkers, showHitMarkers);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -90,6 +94,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
if (editorBeatmap != null)
|
if (editorBeatmap != null)
|
||||||
selectedObjects.BindTo(editorBeatmap.SelectedHitObjects);
|
selectedObjects.BindTo(editorBeatmap.SelectedHitObjects);
|
||||||
selectedObjects.BindCollectionChanged((_, _) => updateVisualDefinition(), true);
|
selectedObjects.BindCollectionChanged((_, _) => updateVisualDefinition(), true);
|
||||||
|
showHitMarkers.BindValueChanged(_ =>
|
||||||
|
{
|
||||||
|
if (!showHitMarkers.Value)
|
||||||
|
DrawableObject.RestoreHitAnimations();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool HandleQuickDeletion()
|
public override bool HandleQuickDeletion()
|
||||||
@ -110,6 +119,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
|
|
||||||
if (IsSelected)
|
if (IsSelected)
|
||||||
BodyPiece.UpdateFrom(HitObject);
|
BodyPiece.UpdateFrom(HitObject);
|
||||||
|
|
||||||
|
if (showHitMarkers.Value)
|
||||||
|
DrawableObject.SuppressHitAnimations();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
@ -19,6 +19,7 @@ using osu.Game.Rulesets.Osu.UI;
|
|||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||||
{
|
{
|
||||||
@ -319,5 +320,27 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region FOR EDITOR USE ONLY, DO NOT USE FOR ANY OTHER PURPOSE
|
||||||
|
|
||||||
|
internal void SuppressHitAnimations()
|
||||||
|
{
|
||||||
|
UpdateState(ArmedState.Idle);
|
||||||
|
UpdateComboColour();
|
||||||
|
|
||||||
|
using (BeginAbsoluteSequence(StateUpdateTime - 5))
|
||||||
|
this.TransformBindableTo(AccentColour, Color4.White, Math.Max(0, HitStateUpdateTime - StateUpdateTime));
|
||||||
|
|
||||||
|
using (BeginAbsoluteSequence(HitStateUpdateTime))
|
||||||
|
this.FadeOut(700).Expire();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void RestoreHitAnimations()
|
||||||
|
{
|
||||||
|
UpdateState(ArmedState.Hit, force: true);
|
||||||
|
UpdateComboColour();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -370,5 +370,23 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
private partial class DefaultSliderBody : PlaySliderBody
|
private partial class DefaultSliderBody : PlaySliderBody
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region FOR EDITOR USE ONLY, DO NOT USE FOR ANY OTHER PURPOSE
|
||||||
|
|
||||||
|
internal void SuppressHitAnimations()
|
||||||
|
{
|
||||||
|
UpdateState(ArmedState.Idle);
|
||||||
|
HeadCircle.SuppressHitAnimations();
|
||||||
|
TailCircle.SuppressHitAnimations();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void RestoreHitAnimations()
|
||||||
|
{
|
||||||
|
UpdateState(ArmedState.Hit, force: true);
|
||||||
|
HeadCircle.RestoreHitAnimations();
|
||||||
|
TailCircle.RestoreHitAnimations();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -12,6 +13,7 @@ using osu.Game.Rulesets.Objects.Drawables;
|
|||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||||
{
|
{
|
||||||
@ -125,5 +127,27 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
if (Slider != null)
|
if (Slider != null)
|
||||||
Position = Slider.CurvePositionAt(HitObject.RepeatIndex % 2 == 0 ? 1 : 0);
|
Position = Slider.CurvePositionAt(HitObject.RepeatIndex % 2 == 0 ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region FOR EDITOR USE ONLY, DO NOT USE FOR ANY OTHER PURPOSE
|
||||||
|
|
||||||
|
internal void SuppressHitAnimations()
|
||||||
|
{
|
||||||
|
UpdateState(ArmedState.Idle);
|
||||||
|
UpdateComboColour();
|
||||||
|
|
||||||
|
using (BeginAbsoluteSequence(StateUpdateTime - 5))
|
||||||
|
this.TransformBindableTo(AccentColour, Color4.White, Math.Max(0, HitStateUpdateTime - StateUpdateTime));
|
||||||
|
|
||||||
|
using (BeginAbsoluteSequence(HitStateUpdateTime))
|
||||||
|
this.FadeOut(700).Expire();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void RestoreHitAnimations()
|
||||||
|
{
|
||||||
|
UpdateState(ArmedState.Hit);
|
||||||
|
UpdateComboColour();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -314,11 +314,11 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
private void updateStateFromResult()
|
private void updateStateFromResult()
|
||||||
{
|
{
|
||||||
if (Result.IsHit)
|
if (Result.IsHit)
|
||||||
updateState(ArmedState.Hit, true);
|
UpdateState(ArmedState.Hit, true);
|
||||||
else if (Result.HasResult)
|
else if (Result.HasResult)
|
||||||
updateState(ArmedState.Miss, true);
|
UpdateState(ArmedState.Miss, true);
|
||||||
else
|
else
|
||||||
updateState(ArmedState.Idle, true);
|
UpdateState(ArmedState.Idle, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected sealed override void OnFree(HitObjectLifetimeEntry entry)
|
protected sealed override void OnFree(HitObjectLifetimeEntry entry)
|
||||||
@ -402,7 +402,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
|
|
||||||
private void onRevertResult()
|
private void onRevertResult()
|
||||||
{
|
{
|
||||||
updateState(ArmedState.Idle);
|
UpdateState(ArmedState.Idle);
|
||||||
OnRevertResult?.Invoke(this, Result);
|
OnRevertResult?.Invoke(this, Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,7 +421,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
if (Result is not null)
|
if (Result is not null)
|
||||||
{
|
{
|
||||||
Result.TimeOffset = 0;
|
Result.TimeOffset = 0;
|
||||||
updateState(State.Value, true);
|
UpdateState(State.Value, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultsApplied?.Invoke(this);
|
DefaultsApplied?.Invoke(this);
|
||||||
@ -461,7 +461,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
$"Should never clear a {nameof(DrawableHitObject)} as the base implementation adds components. If attempting to use {nameof(InternalChild)} or {nameof(InternalChildren)}, using {nameof(AddInternal)} or {nameof(AddRangeInternal)} instead.");
|
$"Should never clear a {nameof(DrawableHitObject)} as the base implementation adds components. If attempting to use {nameof(InternalChild)} or {nameof(InternalChildren)}, using {nameof(AddInternal)} or {nameof(AddRangeInternal)} instead.");
|
||||||
|
|
||||||
private void updateState(ArmedState newState, bool force = false)
|
protected void UpdateState(ArmedState newState, bool force = false)
|
||||||
{
|
{
|
||||||
if (State.Value == newState && !force)
|
if (State.Value == newState && !force)
|
||||||
return;
|
return;
|
||||||
@ -506,7 +506,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reapplies the current <see cref="ArmedState"/>.
|
/// Reapplies the current <see cref="ArmedState"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void RefreshStateTransforms() => updateState(State.Value, true);
|
public void RefreshStateTransforms() => UpdateState(State.Value, true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Apply (generally fade-in) transforms leading into the <see cref="HitObject"/> start time.
|
/// Apply (generally fade-in) transforms leading into the <see cref="HitObject"/> start time.
|
||||||
@ -565,7 +565,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
ApplySkin(CurrentSkin, true);
|
ApplySkin(CurrentSkin, true);
|
||||||
|
|
||||||
if (IsLoaded)
|
if (IsLoaded)
|
||||||
updateState(State.Value, true);
|
UpdateState(State.Value, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void UpdateComboColour()
|
protected void UpdateComboColour()
|
||||||
@ -725,7 +725,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
Result.GameplayRate = (Clock as IGameplayClock)?.GetTrueGameplayRate() ?? Clock.Rate;
|
Result.GameplayRate = (Clock as IGameplayClock)?.GetTrueGameplayRate() ?? Clock.Rate;
|
||||||
|
|
||||||
if (Result.HasResult)
|
if (Result.HasResult)
|
||||||
updateState(Result.IsHit ? ArmedState.Hit : ArmedState.Miss);
|
UpdateState(Result.IsHit ? ArmedState.Hit : ArmedState.Miss);
|
||||||
|
|
||||||
OnNewResult?.Invoke(this, Result);
|
OnNewResult?.Invoke(this, Result);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user