Skip to content

Conversation

@Arufonsu
Copy link
Contributor

This commit restores some of the original engine behavior that prevented accidental game exits and ensures players don't lose progress by accidentally pressing Alt+F4 or clicking the window close button, especially during combat situations.

  • Intercept OnExiting event to prevent immediate closure when player is in-game
  • Show combat warning dialog if player is in combat, requiring confirmation to exit
  • Show standard quit confirmation dialog if player is not in combat
  • Add _isShowingExitConfirmation flag to prevent infinite OnExiting event loop
  • Makes InputBox.Closed event to handle X button clicks on dialogs
  • Add QuitTitle and QuitPrompt strings to General localization
  • Normal cleanup continues if player is not logged in or not in-game

While not in combat - (press either Alt+F4 or the X window close button)
{E268CBC0-3E8E-4152-B1F2-EB8EDF8BFC95}

While in combat - (press either Alt+F4 or the X window close button)
{FB63C52A-BCAB-4746-9695-417832CCAF5F}

While not in combat - (from game menu / simplified menu desktop button)
{CDFE70FC-E2BF-40B9-B83C-0E06FF8FA95A}

While in combat - (from game menu / simplified menu desktop button) (not changed at all)
{17FCA23D-0404-4586-8476-7A42409F4F8A}

This commit restores original engine behavior that prevents accidental game exits and ensures players don't lose progress by accidentally pressing Alt+F4 or clicking the window close button,
especially during combat situations.

- Intercept OnExiting event to prevent immediate closure when player is in-game
- Show combat warning dialog if player is in combat, requiring confirmation to exit
- Show standard quit confirmation dialog if player is not in combat
- Add _isShowingExitConfirmation flag to prevent infinite OnExiting event loop
- Makes InputBox.Closed event to handle X button clicks on dialogs
- Add QuitTitle and QuitPrompt strings to General localization
- Normal cleanup continues if player is not logged in or not in-game
- replicated this logic for both, simplified and regular game menus when pressing the desktop option
@WeylonSantana WeylonSantana merged commit c4a912b into main Dec 27, 2025
1 check passed
@WeylonSantana WeylonSantana deleted the enhancement/OnExiting-Update branch December 27, 2025 03:17
Arufonsu added a commit that referenced this pull request Dec 27, 2025
(PR #2788 was not finished)
This Commit finishes the job and fixes #2762 as well
- No more SDL hack for Linux, args.Cancel = true should be sufficient for all platforms (MonoGame).
- Improved logic working for: simplified and regular game menus desktop/logout buttons, Alt+F4 and X close button
- Improved logic works either in game and mainmenu
Arufonsu added a commit that referenced this pull request Dec 27, 2025
(PR #2788 was not finished)
This Commit finishes the job and fixes #2762 as well
- No more SDL hack for Linux, args.Cancel = true should be sufficient for all platforms (MonoGame).
- Improved logic working for: simplified and regular game menus desktop/logout buttons, Alt+F4 and X close button
- Improved logic works either in game and mainmenu
Arufonsu added a commit that referenced this pull request Dec 27, 2025
(PR #2788 was not finished)
This Commit finishes the job and fixes #2762 as well
- No more SDL hack for Linux, args.Cancel = true should be sufficient for all platforms (MonoGame).
- Improved logic working for: simplified and regular game menus desktop/logout buttons, Alt+F4 and X close button
- Improved logic works either in game and mainmenu
Arufonsu added a commit that referenced this pull request Dec 27, 2025
(PR #2788 was not finished)
This Commit finishes the job and fixes #2762 as well
- No more SDL hack for Linux, args.Cancel = true should be sufficient for all platforms (MonoGame).
- Improved logic working for: simplified and regular game menus desktop/logout buttons, Alt+F4 and X close button
- Improved logic works either in game and mainmenu
- Prevents game crash due to disposal of already disposed UI elements
WeylonSantana pushed a commit that referenced this pull request Dec 27, 2025
(PR #2788 was not finished)
This Commit finishes the job and fixes #2762 as well
- No more SDL hack for Linux, args.Cancel = true should be sufficient for all platforms (MonoGame).
- Improved logic working for: simplified and regular game menus desktop/logout buttons, Alt+F4 and X close button
- Improved logic works either in game and mainmenu
- Prevents game crash due to disposal of already disposed UI elements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants