Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@smoogipoo
Copy link
Contributor

@smoogipoo smoogipoo commented Oct 16, 2025

Intro

In #35117 I included changes to OsuGame which allowed the footer to be displayed in subscreens for use in the playlist song selection. The change is fragile as evidenced by the failing tests, so I set out to do this more properly.

This is the culmination of about 6 attempts at this, because the footer is extremely complicated. There are many edge cases to consider, such as:

  • We still have a legacy back button, the state of which is controlled by both OsuScreen.BackButtonVisibility and whether the ScreenFooter itself is visible.
  • Some screens selectively show or hide the footer.
  • Some screens selectively show or hide the legacy back button.
  • Some screens work with the footer in other ways, which I'm not sure how to handle more universally at this point.
  • Footer buttons are expected to be single use, and disposed/expired when changing screens. In practice this means buttons must be recreated all the time.
  • Footer buttons are expected to be cleared/disabled as soon as the screen is pushed or exited. In practice this means putting related code in OnEntering()/OnExiting() produces slightly different behaviour.

Therefore I've tried to keep the changes somewhat simple for this attempt but I still foresee this going through several refactoring efforts.

Outline

I've tried to imagine somewhat complicated scenarios here, and reduced it to tracking what I call the "leading screen" which is the most-nested 'current screen'. For example:

Parent -> Parent
          ^^^^^^

Parent -> [ Child -> Child ]
                     ^^^^^

Parent -> [ Child -> Child ] -> Parent
                                ^^^^^^

Parent -> [ Child -> [ Child -> Child ] ]
                                ^^^^^

This is done by the new class ScreenStackFooter which handles both the footer and the legacy back button almost exactly as OsuGame already does it, except with the above leading screen detail included.

Testing

Besides the new included tests, I've also tested this works with #35117.

@smoogipoo smoogipoo changed the title Make ScreenFooter support subscreens Make ScreenFooter support subscreens Oct 16, 2025
Comment on lines 26 to 31
[Resolved]
private ISongSelect? songSelect { get; set; }
private readonly ISongSelect? songSelect;

public FooterButtonOptions(ISongSelect? songSelect)
{
this.songSelect = songSelect;
}
Copy link
Contributor Author

@smoogipoo smoogipoo Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was brought over from a previous attempt. It's somewhat irrelevant to the PR and can probably be reverted if too much. It results in the removal of OsuScreen.LoadComponentsAgainstScreenDependencies(), which I think is weird behaivour to have.

Copy link
Collaborator

@bdach bdach Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's pretty reasonable to expect that footer buttons specific to a screen can resolve dependencies from said screen. It's a pretty common pain point in use cases like popovers as well, currently (badly) solved by having popover containers nested in screens.

This particular case isn't too bad to change to ctor passing, but I really do wonder how long that conclusion will hold up as the footer sees more use.

Which is to say I'm not completely sure how to feel about this change, but I worry it will have to be reverted sooner rather than later. For the multiplayer song selects at least, do you have the knowledge that you won't need DI in footer buttons?

Copy link
Contributor Author

@smoogipoo smoogipoo Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've dropped the commit just to not draw this out. Simple enough to be done at any time in the future if deemed necessary.

Added back the necessary invocation here: https://github.com/ppy/osu/pull/35313/files#diff-49af9f4667a633afdb043b20538a2a6740cbb2e7cf42e7942637608346565570R118-R126

@bdach bdach self-requested a review October 17, 2025 07:29
Copy link
Collaborator

@bdach bdach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the singular review thread above, no real comments, this is pretty quaint.

@smoogipoo smoogipoo force-pushed the subscreen-footer branch 2 times, most recently from 3649d09 to 302d7df Compare October 17, 2025 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants