1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:07:52 +08:00

Add view menu toggle for sample points

This commit is contained in:
OliBomby 2024-09-17 11:27:23 +02:00
parent ea94f903c1
commit e4cfa7c86f
4 changed files with 28 additions and 2 deletions

View File

@ -205,6 +205,7 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.EditorTimelineShowTimingChanges, true); SetDefault(OsuSetting.EditorTimelineShowTimingChanges, true);
SetDefault(OsuSetting.EditorTimelineShowTicks, true); SetDefault(OsuSetting.EditorTimelineShowTicks, true);
SetDefault(OsuSetting.EditorTimelineShowSamples, true);
SetDefault(OsuSetting.AlwaysShowHoldForMenuButton, false); SetDefault(OsuSetting.AlwaysShowHoldForMenuButton, false);
} }
@ -431,6 +432,7 @@ namespace osu.Game.Configuration
HideCountryFlags, HideCountryFlags,
EditorTimelineShowTimingChanges, EditorTimelineShowTimingChanges,
EditorTimelineShowTicks, EditorTimelineShowTicks,
AlwaysShowHoldForMenuButton AlwaysShowHoldForMenuButton,
EditorTimelineShowSamples
} }
} }

View File

@ -139,6 +139,11 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString TimelineShowTicks => new TranslatableString(getKey(@"timeline_show_ticks"), @"Show ticks"); public static LocalisableString TimelineShowTicks => new TranslatableString(getKey(@"timeline_show_ticks"), @"Show ticks");
/// <summary>
/// "Show samples"
/// </summary>
public static LocalisableString TimelineShowSamples => new TranslatableString(getKey(@"timeline_show_samples"), @"Show samples");
private static string getKey(string key) => $@"{prefix}:{key}"; private static string getKey(string key) => $@"{prefix}:{key}";
} }
} }

View File

@ -16,6 +16,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; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
@ -40,6 +41,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
[Resolved] [Resolved]
private Editor? editor { get; set; } private Editor? editor { get; set; }
private Bindable<bool> samplesVisible = null!;
public SamplePointPiece(HitObject hitObject) public SamplePointPiece(HitObject hitObject)
{ {
HitObject = hitObject; HitObject = hitObject;
@ -53,13 +56,23 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
protected virtual double GetTime() => HitObject is IHasRepeats r ? HitObject.StartTime + r.Duration / r.SpanCount() / 2 : HitObject.StartTime; protected virtual double GetTime() => HitObject is IHasRepeats r ? HitObject.StartTime + r.Duration / r.SpanCount() / 2 : HitObject.StartTime;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(OsuConfigManager config)
{ {
HitObject.DefaultsApplied += _ => updateText(); HitObject.DefaultsApplied += _ => updateText();
updateText(); updateText();
if (editor != null) if (editor != null)
editor.ShowSampleEditPopoverRequested += onShowSampleEditPopoverRequested; editor.ShowSampleEditPopoverRequested += onShowSampleEditPopoverRequested;
samplesVisible = config.GetBindable<bool>(OsuSetting.EditorTimelineShowSamples);
}
protected override void LoadComplete()
{
base.LoadComplete();
samplesVisible.BindValueChanged(visible => this.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint));
this.FadeTo(samplesVisible.Value ? 1 : 0);
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)

View File

@ -215,6 +215,7 @@ namespace osu.Game.Screens.Edit
private Bindable<bool> editorLimitedDistanceSnap; private Bindable<bool> editorLimitedDistanceSnap;
private Bindable<bool> editorTimelineShowTimingChanges; private Bindable<bool> editorTimelineShowTimingChanges;
private Bindable<bool> editorTimelineShowTicks; private Bindable<bool> editorTimelineShowTicks;
private Bindable<bool> editorTimelineShowSamples;
/// <summary> /// <summary>
/// This controls the opacity of components like the timelines, sidebars, etc. /// This controls the opacity of components like the timelines, sidebars, etc.
@ -323,6 +324,7 @@ namespace osu.Game.Screens.Edit
editorLimitedDistanceSnap = config.GetBindable<bool>(OsuSetting.EditorLimitedDistanceSnap); editorLimitedDistanceSnap = config.GetBindable<bool>(OsuSetting.EditorLimitedDistanceSnap);
editorTimelineShowTimingChanges = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTimingChanges); editorTimelineShowTimingChanges = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTimingChanges);
editorTimelineShowTicks = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTicks); editorTimelineShowTicks = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTicks);
editorTimelineShowSamples = config.GetBindable<bool>(OsuSetting.EditorTimelineShowSamples);
AddInternal(new OsuContextMenuContainer AddInternal(new OsuContextMenuContainer
{ {
@ -388,6 +390,10 @@ namespace osu.Game.Screens.Edit
{ {
State = { BindTarget = editorTimelineShowTicks } State = { BindTarget = editorTimelineShowTicks }
}, },
new ToggleMenuItem(EditorStrings.TimelineShowSamples)
{
State = { BindTarget = editorTimelineShowSamples }
}
] ]
}, },
new BackgroundDimMenuItem(editorBackgroundDim), new BackgroundDimMenuItem(editorBackgroundDim),