mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 02:43:19 +08:00
Expose the ability to update global offset from the player loader screen
This commit is contained in:
parent
160342ceed
commit
b7f3c83514
@ -3,19 +3,21 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Overlays.Settings.Sections;
|
||||
using osu.Game.Overlays.Settings.Sections.Input;
|
||||
using osuTK.Graphics;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Localisation;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
@ -55,6 +57,21 @@ namespace osu.Game.Overlays
|
||||
|
||||
public override bool AcceptsFocus => lastOpenedSubPanel == null || lastOpenedSubPanel.State.Value == Visibility.Hidden;
|
||||
|
||||
public void ShowAtControl<T>()
|
||||
where T : Drawable
|
||||
{
|
||||
Show();
|
||||
|
||||
// wait for load of sections
|
||||
if (!SectionsContainer.Any())
|
||||
{
|
||||
Scheduler.Add(ShowAtControl<T>);
|
||||
return;
|
||||
}
|
||||
|
||||
SectionsContainer.ScrollTo(SectionsContainer.ChildrenOfType<T>().Single());
|
||||
}
|
||||
|
||||
private T createSubPanel<T>(T subPanel)
|
||||
where T : SettingsSubPanel
|
||||
{
|
||||
|
@ -21,7 +21,9 @@ using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Overlays.Settings.Sections.Audio;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
@ -213,6 +215,8 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
lastPlayAverage = average;
|
||||
lastPlayBeatmapOffset = Current.Value;
|
||||
|
||||
LinkFlowContainer globalOffsetText;
|
||||
|
||||
referenceScoreContainer.AddRange(new Drawable[]
|
||||
{
|
||||
lastPlayGraph = new HitEventTimingDistributionGraph(hitEvents)
|
||||
@ -226,9 +230,24 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
Text = BeatmapOffsetControlStrings.CalibrateUsingLastPlay,
|
||||
Action = () => Current.Value = lastPlayBeatmapOffset - lastPlayAverage
|
||||
},
|
||||
globalOffsetText = new LinkFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
}
|
||||
});
|
||||
|
||||
if (settings != null)
|
||||
{
|
||||
globalOffsetText.AddText("You can also ");
|
||||
globalOffsetText.AddLink("adjust the global offset", () => settings.ShowAtControl<AudioOffsetAdjustControl>());
|
||||
globalOffsetText.AddText(" based off this play.");
|
||||
}
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private SettingsOverlay? settings { get; set; }
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
Loading…
Reference in New Issue
Block a user