1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 12:33:01 +08:00

Add the ability to toggle off hit marker displays in the editor

This commit is contained in:
Dean Herbert 2022-11-08 18:07:06 +09:00
parent 30700ee68b
commit ada039151b
5 changed files with 59 additions and 15 deletions

View File

@ -4,9 +4,12 @@
#nullable disable
using osu.Framework.Allocation;
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;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Skinning.Default;
@ -27,31 +30,45 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
private readonly RingPiece ring;
private readonly Container content;
[Resolved]
private EditorClock editorClock { get; set; }
private Bindable<bool> showHitMarkers;
public HitCircleOverlapMarker()
{
Origin = Anchor.Centre;
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
InternalChildren = new Drawable[]
InternalChild = content = new Container
{
new Circle
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
},
ring = new RingPiece
{
BorderThickness = 4,
new Circle
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
},
ring = new RingPiece
{
BorderThickness = 4,
}
}
};
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
showHitMarkers = config.GetBindable<bool>(OsuSetting.EditorShowHitMarkers);
}
[Resolved]
private ISkinSource skin { get; set; }
@ -68,21 +85,26 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
double hitObjectTime = hitObject.StartTime;
bool hasReachedObject = editorTime >= hitObjectTime;
if (hasReachedObject)
if (hasReachedObject && showHitMarkers.Value)
{
float alpha = Interpolation.ValueAt(editorTime, 0, 1f, hitObjectTime, hitObjectTime + FADE_OUT_EXTENSION, Easing.In);
float ringScale = MathHelper.Clamp(Interpolation.ValueAt(editorTime, 0, 1f, hitObjectTime, hitObjectTime + FADE_OUT_EXTENSION / 2, Easing.OutQuint), 0, 1);
ring.Scale = new Vector2(1 + 0.1f * ringScale);
Alpha = 0.9f * (1 - alpha);
content.Alpha = 0.9f * (1 - alpha);
}
else
Alpha = 0;
content.Alpha = 0;
}
public override void Show()
{
// intentional no op so SelectionBlueprint Selection/Deselection logic doesn't touch us.
}
public override void Hide()
{
// intentional no op so we are not hidden when not selected.
// intentional no op so SelectionBlueprint Selection/Deselection logic doesn't touch us.
}
}
}

View File

@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints
protected override bool AlwaysShowWhenSelected => true;
protected override bool ShouldBeAlive => base.ShouldBeAlive
|| (editorClock.CurrentTime >= Item.StartTime && editorClock.CurrentTime - Item.GetEndTime() < HitCircleOverlapMarker.FADE_OUT_EXTENSION);
|| (ShowHitMarkers.Value && editorClock.CurrentTime >= Item.StartTime && editorClock.CurrentTime - Item.GetEndTime() < HitCircleOverlapMarker.FADE_OUT_EXTENSION);
protected OsuSelectionBlueprint(T hitObject)
: base(hitObject)

View File

@ -173,6 +173,7 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.EditorDim, 0.25f, 0f, 0.75f, 0.25f);
SetDefault(OsuSetting.EditorWaveformOpacity, 0.25f, 0f, 1f, 0.25f);
SetDefault(OsuSetting.EditorShowHitMarkers, true);
SetDefault(OsuSetting.LastProcessedMetadataId, -1);
}
@ -367,5 +368,6 @@ namespace osu.Game.Configuration
ShowOnlineExplicitContent,
LastProcessedMetadataId,
SafeAreaConsiderations,
EditorShowHitMarkers
}
}

View File

@ -3,7 +3,10 @@
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Primitives;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
@ -23,6 +26,11 @@ namespace osu.Game.Rulesets.Edit
/// </summary>
protected virtual bool AlwaysShowWhenSelected => false;
/// <summary>
/// Whether extra animations should be shown to convey hit position / state in addition to gameplay animations.
/// </summary>
protected Bindable<bool> ShowHitMarkers { get; private set; }
protected override bool ShouldBeAlive => (DrawableObject?.IsAlive == true && DrawableObject.IsPresent) || (AlwaysShowWhenSelected && State == SelectionState.Selected);
protected HitObjectSelectionBlueprint(HitObject hitObject)
@ -30,6 +38,12 @@ namespace osu.Game.Rulesets.Edit
{
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
ShowHitMarkers = config.GetBindable<bool>(OsuSetting.EditorShowHitMarkers);
}
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => DrawableObject.ReceivePositionalInputAt(screenSpacePos);
public override Vector2 ScreenSpaceSelectionPoint => DrawableObject.ScreenSpaceDrawQuad.Centre;

View File

@ -176,6 +176,7 @@ namespace osu.Game.Screens.Edit
private OnScreenDisplay onScreenDisplay { get; set; }
private Bindable<float> editorBackgroundDim;
private Bindable<bool> editorHitMarkers;
public Editor(EditorLoader loader = null)
{
@ -262,6 +263,7 @@ namespace osu.Game.Screens.Edit
OsuMenuItem redoMenuItem;
editorBackgroundDim = config.GetBindable<float>(OsuSetting.EditorDim);
editorHitMarkers = config.GetBindable<bool>(OsuSetting.EditorShowHitMarkers);
AddInternal(new OsuContextMenuContainer
{
@ -316,6 +318,10 @@ namespace osu.Game.Screens.Edit
{
new WaveformOpacityMenuItem(config.GetBindable<float>(OsuSetting.EditorWaveformOpacity)),
new BackgroundDimMenuItem(editorBackgroundDim),
new ToggleMenuItem("Show hit markers")
{
State = { BindTarget = editorHitMarkers },
}
}
}
}