1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 17:32:54 +08:00

move creation of PlaybackSettings to ReplayPlayer

This commit is contained in:
Nitrous 2024-01-12 15:12:02 +08:00
parent 484e9e8ee6
commit c404628113
No known key found for this signature in database
GPG Key ID: A5D82BAEC7C1D1F5
5 changed files with 17 additions and 15 deletions

View File

@ -12,17 +12,19 @@ namespace osu.Game.Screens.Play.HUD
{
private const int fade_duration = 200;
public readonly PlaybackSettings PlaybackSettings;
public readonly VisualSettings VisualSettings;
protected override Container<Drawable> Content => content;
private readonly FillFlowContainer content;
public PlayerSettingsOverlay()
{
Anchor = Anchor.TopRight;
Origin = Anchor.TopRight;
AutoSizeAxes = Axes.Both;
Child = new FillFlowContainer<PlayerSettingsGroup>
InternalChild = content = new FillFlowContainer
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
@ -31,7 +33,6 @@ namespace osu.Game.Screens.Play.HUD
Spacing = new Vector2(0, 20),
Children = new PlayerSettingsGroup[]
{
PlaybackSettings = new PlaybackSettings { Expanded = { Value = false } },
VisualSettings = new VisualSettings { Expanded = { Value = false } },
new AudioSettings { Expanded = { Value = false } }
}

View File

@ -476,9 +476,6 @@ namespace osu.Game.Screens.Play
skipOutroOverlay.Expire();
}
if (GameplayClockContainer is MasterGameplayClockContainer master)
HUDOverlay.PlayerSettingsOverlay.PlaybackSettings.UserPlaybackRate.BindTarget = master.UserPlaybackRate;
return container;
}

View File

@ -27,7 +27,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
Precision = 0.1,
};
public readonly Bindable<bool> AllowControls = new BindableBool(true);
private readonly PlayerSliderBar<double> rateSlider;
@ -73,7 +72,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
Origin = Anchor.Centre,
Icon = FontAwesome.Solid.FastBackward,
Action = () => seek(-1, seek_fast_amount),
Enabled = { BindTarget = AllowControls },
},
new SeekButton
{
@ -81,7 +79,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
Origin = Anchor.Centre,
Icon = FontAwesome.Solid.Backward,
Action = () => seek(-1, seek_amount),
Enabled = { BindTarget = AllowControls },
},
play = new IconButton
{
@ -100,7 +97,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
gameplayClock.Start();
}
},
Enabled = { BindTarget = AllowControls },
},
new SeekButton
{
@ -108,7 +104,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
Origin = Anchor.Centre,
Icon = FontAwesome.Solid.Forward,
Action = () => seek(1, seek_amount),
Enabled = { BindTarget = AllowControls },
},
new SeekButton
{
@ -116,7 +111,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
Origin = Anchor.Centre,
Icon = FontAwesome.Solid.FastForward,
Action = () => seek(1, seek_fast_amount),
Enabled = { BindTarget = AllowControls },
},
},
},

View File

@ -15,6 +15,7 @@ using osu.Game.Input.Bindings;
using osu.Game.Rulesets.Mods;
using osu.Game.Scoring;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Play.PlayerSettings;
using osu.Game.Screens.Ranking;
using osu.Game.Users;
@ -49,6 +50,17 @@ namespace osu.Game.Screens.Play
this.createScore = createScore;
}
protected override void LoadComplete()
{
base.LoadComplete();
var playerSettingsOverlay = new PlaybackSettings { Expanded = { Value = false } };
HUDOverlay.PlayerSettingsOverlay.Add(playerSettingsOverlay);
if (GameplayClockContainer is MasterGameplayClockContainer master)
playerSettingsOverlay.UserPlaybackRate.BindTarget = master.UserPlaybackRate;
}
protected override void PrepareReplay()
{
DrawableRuleset?.SetReplayScore(Score);

View File

@ -68,8 +68,6 @@ namespace osu.Game.Screens.Play
master.UserPlaybackRate.Value = 1;
}
}, true);
HUDOverlay.PlayerSettingsOverlay.PlaybackSettings.AllowControls.Value = false;
}
/// <summary>