Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove confirmation when game is asked to be restarted by the user #26558

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

peppy
Copy link
Sponsor Member

@peppy peppy commented Jan 16, 2024

Opening this as a draft to figure out direction with this. Arguably SessionStatics is not the correct place for the flag, and it should live in OsuGame. I'd keep it in the parameters alone but it's hard to get the message to MainMenu as part of the OnExiting flow.

Will add tests once a direction is agreed upon.

This is low priority.


All game restart requests are triggered via user intent, so they shouldn't require confirmation.

Addresses #25826 (reply in thread).

@peppy peppy marked this pull request as draft January 16, 2024 05:35
{
game.AttemptExit();
}
else
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

The flow here makes me wonder whether Restart should handle the confirmation for platforms which can't restart themselves, rather than having this handled on each usage.

But then again, the usages may be so few and far between that it's fine to leave it as-is?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd say per-usage is better because places like tournament client use Restart() and I don't really wanna think about how to make that work well across such varied usages.

@peppy
Copy link
Sponsor Member Author

peppy commented Apr 16, 2024

I guess bump to @ppy/team-client on this one, I think it's still good to go ahead if the direction of using SessionStatics is agreed upon 😄 .

@@ -125,7 +126,10 @@ public override bool RestartAppWhenExited()
return true;
}

return base.RestartAppWhenExited();
SessionStatics.SetValue(Static.RestartRequested, true);
AttemptExit();
Copy link
Member

Choose a reason for hiding this comment

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

This is never reached in Windows because of the early return above.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems valid to me, it looks like the game would not actually exit itself.

game.AttemptExit();
}
else
if (game?.Restart() != true)
Copy link
Member

@Joehuu Joehuu Apr 16, 2024

Choose a reason for hiding this comment

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

If I thinking this right, on Windows, changing the renderer will just outright restart. Would still expect a confirmation dialog here, but different wording that it will restart automatically.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Don't really think its necessary.

@bdach
Copy link
Collaborator

bdach commented Apr 16, 2024

The SessionStatics usage is not the prettiest but given the previous attempts at this I'm not sure I'm wanting to fight that too much.

{
SessionStatics.SetValue(Static.RestartRequested, true);
Copy link
Member

Choose a reason for hiding this comment

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

This is never set back to false if the user cancels the dialog on unsupported platforms.

With hold-to-confirm delay set to 0:

Kapture.2024-04-17.at.13.41.08.mp4

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.

None yet

3 participants