diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs index fe335a048db0..8ed9d0476a29 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs @@ -7,7 +7,6 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Utils; using osu.Game.Configuration; using osu.Game.Rulesets.Objects.Types; @@ -16,7 +15,6 @@ using osu.Game.Screens.Edit; using osu.Game.Skinning; using osuTK; -using osuTK.Graphics; namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components { @@ -48,13 +46,6 @@ public HitCircleOverlapMarker() RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new Circle - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Colour = Color4.White, - }, ring = new RingPiece { BorderThickness = 4, diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs index 0608f8c92905..fd2bbe991682 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs @@ -1,8 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // 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.Primitives; +using osu.Game.Configuration; using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; @@ -16,6 +19,7 @@ public partial class HitCircleSelectionBlueprint : OsuSelectionBlueprint showHitMarkers = new Bindable(); public HitCircleSelectionBlueprint(HitCircle circle) : base(circle) @@ -27,12 +31,32 @@ public HitCircleSelectionBlueprint(HitCircle circle) }; } + [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() { base.Update(); CirclePiece.UpdateFrom(HitObject); marker.UpdateFrom(HitObject); + + if (showHitMarkers.Value) + DrawableObject.SuppressHitAnimations(); } public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => DrawableObject.HitArea.ReceivePositionalInputAt(screenSpacePos); diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs index d47cf6bf23f4..bd3b4bbc5459 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; @@ -14,18 +13,17 @@ public partial class SliderCircleOverlay : CompositeDrawable private readonly Slider slider; private readonly SliderPosition position; - private readonly HitCircleOverlapMarker marker; + private readonly HitCircleOverlapMarker? marker; public SliderCircleOverlay(Slider slider, SliderPosition position) { this.slider = slider; this.position = position; - InternalChildren = new Drawable[] - { - marker = new HitCircleOverlapMarker(), - CirclePiece = new HitCirclePiece(), - }; + if (position == SliderPosition.Start) + AddInternal(marker = new HitCircleOverlapMarker()); + + AddInternal(CirclePiece = new HitCirclePiece()); } protected override void Update() @@ -35,7 +33,7 @@ protected override void Update() var circle = position == SliderPosition.Start ? (HitCircle)slider.HeadCircle : slider.TailCircle; CirclePiece.UpdateFrom(circle); - marker.UpdateFrom(circle); + marker?.UpdateFrom(circle); } public override void Hide() diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs index 49fdf12d606c..7ee65300992b 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs @@ -14,6 +14,7 @@ using osu.Framework.Input.Events; using osu.Framework.Utils; using osu.Game.Audio; +using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; @@ -59,6 +60,7 @@ public partial class SliderSelectionBlueprint : OsuSelectionBlueprint private readonly BindableList controlPoints = new BindableList(); private readonly IBindable pathVersion = new Bindable(); private readonly BindableList selectedObjects = new BindableList(); + private readonly Bindable showHitMarkers = new Bindable(); public SliderSelectionBlueprint(Slider slider) : base(slider) @@ -66,7 +68,7 @@ public SliderSelectionBlueprint(Slider slider) } [BackgroundDependencyLoader] - private void load() + private void load(OsuConfigManager config) { InternalChildren = new Drawable[] { @@ -74,6 +76,8 @@ private void load() HeadOverlay = CreateCircleOverlay(HitObject, SliderPosition.Start), TailOverlay = CreateCircleOverlay(HitObject, SliderPosition.End), }; + + config.BindWith(OsuSetting.EditorShowHitMarkers, showHitMarkers); } protected override void LoadComplete() @@ -90,6 +94,11 @@ protected override void LoadComplete() if (editorBeatmap != null) selectedObjects.BindTo(editorBeatmap.SelectedHitObjects); selectedObjects.BindCollectionChanged((_, _) => updateVisualDefinition(), true); + showHitMarkers.BindValueChanged(_ => + { + if (!showHitMarkers.Value) + DrawableObject.RestoreHitAnimations(); + }); } public override bool HandleQuickDeletion() @@ -110,6 +119,9 @@ protected override void Update() if (IsSelected) BodyPiece.UpdateFrom(HitObject); + + if (showHitMarkers.Value) + DrawableObject.SuppressHitAnimations(); } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index c3ce6acce9ef..6f419073eb8c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -19,6 +19,7 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; using osuTK; +using osuTK.Graphics; namespace osu.Game.Rulesets.Osu.Objects.Drawables { @@ -319,5 +320,31 @@ public ProxyableSkinnableDrawable(ISkinComponentLookup lookup, Func 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."); - private void updateState(ArmedState newState, bool force = false) + protected void UpdateState(ArmedState newState, bool force = false) { if (State.Value == newState && !force) return; @@ -506,7 +506,7 @@ private void clearExistingStateTransforms() /// /// Reapplies the current . /// - public void RefreshStateTransforms() => updateState(State.Value, true); + public void RefreshStateTransforms() => UpdateState(State.Value, true); /// /// Apply (generally fade-in) transforms leading into the start time. @@ -565,7 +565,7 @@ private void skinChanged() ApplySkin(CurrentSkin, true); if (IsLoaded) - updateState(State.Value, true); + UpdateState(State.Value, true); } protected void UpdateComboColour() @@ -725,7 +725,7 @@ protected void ApplyResult(Action application, T state) Result.GameplayRate = (Clock as IGameplayClock)?.GetTrueGameplayRate() ?? Clock.Rate; if (Result.HasResult) - updateState(Result.IsHit ? ArmedState.Hit : ArmedState.Miss); + UpdateState(Result.IsHit ? ArmedState.Hit : ArmedState.Miss); OnNewResult?.Invoke(this, Result); }