1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-06 21:02:59 +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] [BackgroundDependencyLoader]
private void load(Player? player) private void load(Player? player)
{ {
if (player is ReplayPlayer || player is SpectatorPlayer) if (player != null && player.ShowAnalysisSettings)
{ {
ReplayAnalysisOverlay analysisOverlay; ReplayAnalysisOverlay analysisOverlay;
PlayfieldAdjustmentContainer.Add(analysisOverlay = new ReplayAnalysisOverlay(player.Score.Replay)); PlayfieldAdjustmentContainer.Add(analysisOverlay = new ReplayAnalysisOverlay(player.Score.Replay));

View File

@ -104,6 +104,8 @@ namespace osu.Game.Screens.Play
/// </summary> /// </summary>
public IBindable<bool> ShowingOverlayComponents = new Bindable<bool>(); 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 // 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). // without the loading screen (one such usage is the skin editor's scene library).
[Cached] [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. // 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)); failAnimationContainer.Add(createOverlayComponents(Beatmap.Value));
if (ShowAnalysisSettings)
addReplayAnalysisSettings();
if (!DrawableRuleset.AllowGameplayOverlays) if (!DrawableRuleset.AllowGameplayOverlays)
{ {
HUDOverlay.ShowHud.Value = false; HUDOverlay.ShowHud.Value = false;
@ -1298,12 +1303,13 @@ namespace osu.Game.Screens.Play
} }
/// <summary> /// <summary>
/// Create and add <see cref="ReplayAnalysisSettings"/> to settings overlay. /// Create and add <see cref="ReplayAnalysisSettings"/> to player settings overlay.
/// </summary> /// </summary>
protected void AddReplayAnalysisSettings() private void addReplayAnalysisSettings()
{ {
var replayAnalysisSettings = DrawableRuleset.Ruleset.CreateReplayAnalysisSettings(); var replayAnalysisSettings = DrawableRuleset.Ruleset.CreateReplayAnalysisSettings();
if (replayAnalysisSettings is not null)
if (replayAnalysisSettings != null)
HUDOverlay.PlayerSettingsOverlay.Add(replayAnalysisSettings); HUDOverlay.PlayerSettingsOverlay.Add(replayAnalysisSettings);
} }

View File

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

View File

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