mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 08:27:49 +08:00
Add view menu toggle for sample points
This commit is contained in:
parent
ea94f903c1
commit
e4cfa7c86f
@ -205,6 +205,7 @@ namespace osu.Game.Configuration
|
||||
|
||||
SetDefault(OsuSetting.EditorTimelineShowTimingChanges, true);
|
||||
SetDefault(OsuSetting.EditorTimelineShowTicks, true);
|
||||
SetDefault(OsuSetting.EditorTimelineShowSamples, true);
|
||||
|
||||
SetDefault(OsuSetting.AlwaysShowHoldForMenuButton, false);
|
||||
}
|
||||
@ -431,6 +432,7 @@ namespace osu.Game.Configuration
|
||||
HideCountryFlags,
|
||||
EditorTimelineShowTimingChanges,
|
||||
EditorTimelineShowTicks,
|
||||
AlwaysShowHoldForMenuButton
|
||||
AlwaysShowHoldForMenuButton,
|
||||
EditorTimelineShowSamples
|
||||
}
|
||||
}
|
||||
|
@ -139,6 +139,11 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
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}";
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
@ -40,6 +41,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
[Resolved]
|
||||
private Editor? editor { get; set; }
|
||||
|
||||
private Bindable<bool> samplesVisible = null!;
|
||||
|
||||
public SamplePointPiece(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;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
HitObject.DefaultsApplied += _ => updateText();
|
||||
updateText();
|
||||
|
||||
if (editor != null)
|
||||
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)
|
||||
|
@ -215,6 +215,7 @@ namespace osu.Game.Screens.Edit
|
||||
private Bindable<bool> editorLimitedDistanceSnap;
|
||||
private Bindable<bool> editorTimelineShowTimingChanges;
|
||||
private Bindable<bool> editorTimelineShowTicks;
|
||||
private Bindable<bool> editorTimelineShowSamples;
|
||||
|
||||
/// <summary>
|
||||
/// 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);
|
||||
editorTimelineShowTimingChanges = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTimingChanges);
|
||||
editorTimelineShowTicks = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTicks);
|
||||
editorTimelineShowSamples = config.GetBindable<bool>(OsuSetting.EditorTimelineShowSamples);
|
||||
|
||||
AddInternal(new OsuContextMenuContainer
|
||||
{
|
||||
@ -388,6 +390,10 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
State = { BindTarget = editorTimelineShowTicks }
|
||||
},
|
||||
new ToggleMenuItem(EditorStrings.TimelineShowSamples)
|
||||
{
|
||||
State = { BindTarget = editorTimelineShowSamples }
|
||||
}
|
||||
]
|
||||
},
|
||||
new BackgroundDimMenuItem(editorBackgroundDim),
|
||||
|
Loading…
Reference in New Issue
Block a user