mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +08:00
Fix footer content not accessible by overlay when overriden by a subclass
This commit is contained in:
parent
7a5624fd0e
commit
d4a4a059d4
@ -45,7 +45,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
private ScreenStack? stack;
|
||||
|
||||
public ShearedButton? NextButton => currentFooterContent?.NextButton;
|
||||
public ShearedButton? NextButton => DisplayedFooterContent?.NextButton;
|
||||
|
||||
private readonly Bindable<bool> showFirstRunSetup = new Bindable<bool>();
|
||||
|
||||
@ -148,17 +148,17 @@ namespace osu.Game.Overlays
|
||||
[Resolved]
|
||||
private ScreenFooter footer { get; set; } = null!;
|
||||
|
||||
private FirstRunSetupFooterContent? currentFooterContent;
|
||||
public new FirstRunSetupFooterContent? DisplayedFooterContent => base.DisplayedFooterContent as FirstRunSetupFooterContent;
|
||||
|
||||
public override VisibilityContainer CreateFooterContent()
|
||||
{
|
||||
currentFooterContent = new FirstRunSetupFooterContent
|
||||
var footerContent = new FirstRunSetupFooterContent
|
||||
{
|
||||
ShowNextStep = showNextStep,
|
||||
};
|
||||
|
||||
currentFooterContent.OnLoadComplete += _ => updateButtons();
|
||||
return currentFooterContent;
|
||||
footerContent.OnLoadComplete += _ => updateButtons();
|
||||
return footerContent;
|
||||
}
|
||||
|
||||
public override bool OnBackButton()
|
||||
@ -182,7 +182,7 @@ namespace osu.Game.Overlays
|
||||
switch (e.Action)
|
||||
{
|
||||
case GlobalAction.Select:
|
||||
currentFooterContent?.NextButton.TriggerClick();
|
||||
DisplayedFooterContent?.NextButton.TriggerClick();
|
||||
return true;
|
||||
|
||||
case GlobalAction.Back:
|
||||
@ -287,9 +287,9 @@ namespace osu.Game.Overlays
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
private void updateButtons() => currentFooterContent?.UpdateButtons(currentStepIndex, steps);
|
||||
private void updateButtons() => DisplayedFooterContent?.UpdateButtons(currentStepIndex, steps);
|
||||
|
||||
private partial class FirstRunSetupFooterContent : VisibilityContainer
|
||||
public partial class FirstRunSetupFooterContent : VisibilityContainer
|
||||
{
|
||||
public ShearedButton NextButton { get; private set; } = null!;
|
||||
|
||||
|
@ -254,9 +254,9 @@ namespace osu.Game.Overlays.Mods
|
||||
});
|
||||
}
|
||||
|
||||
private ModSelectFooterContent? currentFooterContent;
|
||||
public new ModSelectFooterContent? DisplayedFooterContent => base.DisplayedFooterContent as ModSelectFooterContent;
|
||||
|
||||
public override VisibilityContainer CreateFooterContent() => currentFooterContent = new ModSelectFooterContent(this)
|
||||
public override VisibilityContainer CreateFooterContent() => new ModSelectFooterContent(this)
|
||||
{
|
||||
Beatmap = { BindTarget = Beatmap },
|
||||
ActiveMods = { BindTarget = ActiveMods },
|
||||
@ -270,7 +270,7 @@ namespace osu.Game.Overlays.Mods
|
||||
base.Update();
|
||||
|
||||
SearchTextBox.PlaceholderText = SearchTextBox.HasFocus ? input_search_placeholder : tab_to_search_placeholder;
|
||||
aboveColumnsContent.Padding = aboveColumnsContent.Padding with { Bottom = currentFooterContent?.DisplaysStackedVertically == true ? 75f : 15f };
|
||||
aboveColumnsContent.Padding = aboveColumnsContent.Padding with { Bottom = DisplayedFooterContent?.DisplaysStackedVertically == true ? 75f : 15f };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -573,7 +573,7 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
if (!SearchTextBox.HasFocus && !customisationPanel.Expanded.Value)
|
||||
{
|
||||
currentFooterContent?.DeselectAllModsButton?.TriggerClick();
|
||||
DisplayedFooterContent?.DeselectAllModsButton?.TriggerClick();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,8 @@ namespace osu.Game.Overlays.Mods
|
||||
};
|
||||
}
|
||||
|
||||
public VisibilityContainer? DisplayedFooterContent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates content to be displayed on the game-wide footer.
|
||||
/// </summary>
|
||||
@ -137,7 +139,8 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
if (footer != null)
|
||||
{
|
||||
activeOverlayRegistration = footer.RegisterActiveOverlayContainer(this);
|
||||
activeOverlayRegistration = footer.RegisterActiveOverlayContainer(this, out var footerContent);
|
||||
DisplayedFooterContent = footerContent;
|
||||
|
||||
if (footer.State.Value == Visibility.Hidden)
|
||||
{
|
||||
@ -160,6 +163,7 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
activeOverlayRegistration?.Dispose();
|
||||
activeOverlayRegistration = null;
|
||||
DisplayedFooterContent = null;
|
||||
|
||||
if (hideFooterOnPopOut)
|
||||
{
|
||||
|
@ -190,7 +190,7 @@ namespace osu.Game.Screens.Footer
|
||||
|
||||
private readonly List<ScreenFooterButton> temporarilyHiddenButtons = new List<ScreenFooterButton>();
|
||||
|
||||
public IDisposable RegisterActiveOverlayContainer(ShearedOverlayContainer overlay)
|
||||
public IDisposable RegisterActiveOverlayContainer(ShearedOverlayContainer overlay, out VisibilityContainer? footerContent)
|
||||
{
|
||||
if (activeOverlay != null)
|
||||
{
|
||||
@ -219,7 +219,9 @@ namespace osu.Game.Screens.Footer
|
||||
|
||||
updateColourScheme(overlay.ColourProvider.ColourScheme);
|
||||
|
||||
var content = overlay.CreateFooterContent() ?? Empty();
|
||||
footerContent = overlay.CreateFooterContent();
|
||||
|
||||
var content = footerContent ?? Empty();
|
||||
|
||||
Add(contentContainer = new Container
|
||||
{
|
||||
|
@ -23,9 +23,7 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
set => base.IsValidMod = m => m.UserPlayable && value.Invoke(m);
|
||||
}
|
||||
|
||||
private FreeModSelectFooterContent? currentFooterContent;
|
||||
|
||||
protected override SelectAllModsButton? SelectAllModsButton => currentFooterContent?.SelectAllModsButton;
|
||||
protected override SelectAllModsButton? SelectAllModsButton => DisplayedFooterContent?.SelectAllModsButton;
|
||||
|
||||
public FreeModSelectOverlay()
|
||||
: base(OverlayColourScheme.Plum)
|
||||
@ -35,13 +33,15 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
|
||||
protected override ModColumn CreateModColumn(ModType modType) => new ModColumn(modType, true);
|
||||
|
||||
public override VisibilityContainer CreateFooterContent() => currentFooterContent = new FreeModSelectFooterContent(this)
|
||||
public new FreeModSelectFooterContent? DisplayedFooterContent => base.DisplayedFooterContent as FreeModSelectFooterContent;
|
||||
|
||||
public override VisibilityContainer CreateFooterContent() => new FreeModSelectFooterContent(this)
|
||||
{
|
||||
Beatmap = { BindTarget = Beatmap },
|
||||
ActiveMods = { BindTarget = ActiveMods },
|
||||
};
|
||||
|
||||
private partial class FreeModSelectFooterContent : ModSelectFooterContent
|
||||
public partial class FreeModSelectFooterContent : ModSelectFooterContent
|
||||
{
|
||||
private readonly FreeModSelectOverlay overlay;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user