1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 00:03:08 +08:00

rely on virtual method instead of player type

This commit is contained in:
Sheppsu 2024-12-10 22:58:59 -05:00
parent b12f781425
commit a441b6aeb0
4 changed files with 14 additions and 8 deletions

View File

@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Osu.UI
[BackgroundDependencyLoader]
private void load(Player? player)
{
if (player is ReplayPlayer || player is SpectatorPlayer)
if (player != null && player.ShowAnalysisSettings)
{
ReplayAnalysisOverlay analysisOverlay;
PlayfieldAdjustmentContainer.Add(analysisOverlay = new ReplayAnalysisOverlay(player.Score.Replay));

View File

@ -104,6 +104,8 @@ namespace osu.Game.Screens.Play
/// </summary>
public IBindable<bool> ShowingOverlayComponents = new Bindable<bool>();
public virtual bool ShowAnalysisSettings => false;
// Should match PlayerLoader for consistency. Cached here for the rare case we push a Player
// without the loading screen (one such usage is the skin editor's scene library).
[Cached]
@ -329,6 +331,9 @@ namespace osu.Game.Screens.Play
// we may want to limit this in the future to disallow rulesets from outright replacing elements the user expects to be there.
failAnimationContainer.Add(createOverlayComponents(Beatmap.Value));
if (ShowAnalysisSettings)
addReplayAnalysisSettings();
if (!DrawableRuleset.AllowGameplayOverlays)
{
HUDOverlay.ShowHud.Value = false;
@ -1298,12 +1303,13 @@ namespace osu.Game.Screens.Play
}
/// <summary>
/// Create and add <see cref="ReplayAnalysisSettings"/> to settings overlay.
/// Create and add <see cref="ReplayAnalysisSettings"/> to player settings overlay.
/// </summary>
protected void AddReplayAnalysisSettings()
private void addReplayAnalysisSettings()
{
var replayAnalysisSettings = DrawableRuleset.Ruleset.CreateReplayAnalysisSettings();
if (replayAnalysisSettings is not null)
if (replayAnalysisSettings != null)
HUDOverlay.PlayerSettingsOverlay.Add(replayAnalysisSettings);
}

View File

@ -28,6 +28,8 @@ namespace osu.Game.Screens.Play
{
public const double BASE_SEEK_AMOUNT = 1000;
public override bool ShowAnalysisSettings => true;
private readonly Func<IBeatmap, IReadOnlyList<Mod>, Score> createScore;
private readonly bool replayIsFailedScore;
@ -71,8 +73,6 @@ namespace osu.Game.Screens.Play
playbackSettings.UserPlaybackRate.BindTo(master.UserPlaybackRate);
HUDOverlay.PlayerSettingsOverlay.AddAtStart(playbackSettings);
AddReplayAnalysisSettings();
}
protected override void PrepareReplay()

View File

@ -18,6 +18,8 @@ namespace osu.Game.Screens.Play
{
public abstract partial class SpectatorPlayer : Player
{
public override bool ShowAnalysisSettings => true;
[Resolved]
protected SpectatorClient SpectatorClient { get; private set; } = null!;
@ -50,8 +52,6 @@ namespace osu.Game.Screens.Play
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
});
AddReplayAnalysisSettings();
}
protected override void LoadComplete()