From 80c595e0b38a574d5023b43650bf648ba950a4e2 Mon Sep 17 00:00:00 2001 From: GabsPuNs Date: Thu, 18 Jun 2026 22:22:07 -0400 Subject: [PATCH] RMLUI Menu Updates. * LoadCreateJoin Menu: Adjusted size (Is 100% accurate but works fine), fix X Padding (Y Padding still need fixes), * Settings Menu: Added Message Box to "Reset Defaults Settings" * Pause Menu: Added Message Box for Save Game and Exit. --- Minecraft.Client/Assets/UI/HelpOptions.rcss | 6 +- .../Assets/UI/LoadCreateJoinMenu.rcss | 12 +- Minecraft.Client/Assets/UI/MessageBox.rcss | 6 +- Minecraft.Client/Assets/UI/PauseMenu.rcss | 12 +- Minecraft.Client/Assets/UI/SettingsMenu.rcss | 57 +---- Minecraft.Client/Assets/UI/SettingsMenu.rml | 7 - .../lce/LoadCreateJoinMenu/gui_load.png | Bin 14184 -> 14447 bytes .../Common/UI/UIScene_PauseMenu.cpp | 229 +++++------------- .../Common/UI/UIScene_PauseMenu.h | 10 - .../Common/UI/UIScene_SettingsMenu.cpp | 75 ++---- .../Common/UI/UIScene_SettingsMenu.h | 5 +- 11 files changed, 86 insertions(+), 333 deletions(-) diff --git a/Minecraft.Client/Assets/UI/HelpOptions.rcss b/Minecraft.Client/Assets/UI/HelpOptions.rcss index dcc9db80..ed66cefe 100644 --- a/Minecraft.Client/Assets/UI/HelpOptions.rcss +++ b/Minecraft.Client/Assets/UI/HelpOptions.rcss @@ -3,7 +3,7 @@ body width: 100%; height: 100%; font-family: Minecraft Default; - font-size: 14dp; + font-size: 36dp; font-effect: shadow(1dp 1dp #000000); color: #ffffff; background: transparent; @@ -18,8 +18,6 @@ div#help_options_menu height: 330dp; margin: auto; background: rgba(0, 0, 0, 0.65); - border-radius: 8dp; - padding: 40dp 48dp; } div#buttons @@ -36,8 +34,6 @@ button width: 674dp; height: 60dp; margin-bottom: 15dp; - color: #ffffff; - font-size: 36dp; text-align: center; line-height: 60dp; cursor: pointer; diff --git a/Minecraft.Client/Assets/UI/LoadCreateJoinMenu.rcss b/Minecraft.Client/Assets/UI/LoadCreateJoinMenu.rcss index e925efec..d71ba679 100644 --- a/Minecraft.Client/Assets/UI/LoadCreateJoinMenu.rcss +++ b/Minecraft.Client/Assets/UI/LoadCreateJoinMenu.rcss @@ -14,12 +14,11 @@ body div#lcj_menu { - width: 898dp; - height: 774dp; + width: 930dp; + height: 812dp; margin: auto; display: flex; flex-direction: column; - padding: 0; } div#tab_bar @@ -49,7 +48,6 @@ button.tab border-width: 0px; image-color: #ffffff; margin: 0; - padding: 0; box-sizing: border-box; } @@ -98,9 +96,9 @@ button.tab_right.selected div#panel_container { width: 100%; + height: 100%; flex-grow: 1; decorator: image(images/lce/LoadCreateJoinMenu/gui_load.png); - padding: 12dp 16dp; overflow: hidden; } @@ -119,7 +117,7 @@ div.list_container overflow-y: auto; display: flex; flex-direction: column; - padding-top: 10dp; + padding-top: 38dp; } div.list_item @@ -146,7 +144,7 @@ div.list_item button justify-content: flex-start; padding-left: 20dp; padding-right: 16dp; - margin: 0 44dp; + margin: 0 58dp; gap: 30dp; color: #ffffff; font-size: 36dp; diff --git a/Minecraft.Client/Assets/UI/MessageBox.rcss b/Minecraft.Client/Assets/UI/MessageBox.rcss index 025129a2..6f50f931 100644 --- a/Minecraft.Client/Assets/UI/MessageBox.rcss +++ b/Minecraft.Client/Assets/UI/MessageBox.rcss @@ -3,7 +3,7 @@ body width: 100%; height: 100%; font-family: Minecraft Default; - font-size: 14dp; + font-size: 36dp; color: #ffffff; background: transparent; display: flex; @@ -25,7 +25,6 @@ div#message_box p#title { - font-size: 36dp; color: #333333; margin-bottom: 23dp; text-align: left; @@ -44,7 +43,6 @@ div#text_container p#description { - font-size: 36dp; color: #333333; white-space: pre-wrap; } @@ -63,8 +61,6 @@ button width: 600dp; height: 60dp; margin-bottom: 7.5dp; - color: #ffffff; - font-size: 36dp; font-effect: shadow(1dp 1dp #000000); text-align: center; line-height: 60dp; diff --git a/Minecraft.Client/Assets/UI/PauseMenu.rcss b/Minecraft.Client/Assets/UI/PauseMenu.rcss index c608ed37..da9f85bb 100644 --- a/Minecraft.Client/Assets/UI/PauseMenu.rcss +++ b/Minecraft.Client/Assets/UI/PauseMenu.rcss @@ -3,7 +3,7 @@ body width: 100%; height: 100%; font-family: Minecraft Default; - font-size: 14dp; + font-size: 36dp; font-effect: shadow(1dp 1dp #000000); color: #ffffff; background: transparent; @@ -18,8 +18,6 @@ div#pause_menu height: 330dp; margin: auto; background: rgba(0, 0, 0, 0.65); - border-radius: 8dp; - padding: 40dp 48dp; } div#buttons @@ -36,8 +34,6 @@ button width: 674dp; height: 60dp; margin-bottom: 15dp; - color: #ffffff; - font-size: 36dp; text-align: center; line-height: 60dp; cursor: pointer; @@ -63,7 +59,6 @@ div#exit_dialog p#exit_text { - font-size: 36dp; font-effect: none; color: #333333; margin-bottom: 23dp; @@ -85,8 +80,6 @@ button#exit_nosave width: 600dp; height: 60dp; margin-bottom: 7.5dp; - color: #ffffff; - font-size: 36dp; text-align: center; line-height: 60dp; cursor: pointer; @@ -119,7 +112,6 @@ div#save_dialog p#save_text { - font-size: 36dp; font-effect: none; color: #333333; margin-bottom: 23dp; @@ -140,8 +132,6 @@ button#save_confirm width: 600dp; height: 60dp; margin-bottom: 7.5dp; - color: #ffffff; - font-size: 36dp; text-align: center; line-height: 60dp; cursor: pointer; diff --git a/Minecraft.Client/Assets/UI/SettingsMenu.rcss b/Minecraft.Client/Assets/UI/SettingsMenu.rcss index 2163d7bc..29a6f2b1 100644 --- a/Minecraft.Client/Assets/UI/SettingsMenu.rcss +++ b/Minecraft.Client/Assets/UI/SettingsMenu.rcss @@ -3,7 +3,7 @@ body width: 100%; height: 100%; font-family: Minecraft Default; - font-size: 14dp; + font-size: 36dp; font-effect: shadow(1dp 1dp #000000); color: #ffffff; background: transparent; @@ -18,8 +18,6 @@ div#settings_menu height: 330dp; margin: auto; background: rgba(0, 0, 0, 0.65); - border-radius: 8dp; - padding: 40dp 48dp; } div#buttons @@ -36,8 +34,6 @@ button width: 674dp; height: 60dp; margin-bottom: 15dp; - color: #ffffff; - font-size: 36dp; text-align: center; line-height: 60dp; cursor: pointer; @@ -49,53 +45,4 @@ button:hover { color: #ffff00; decorator: image(images/lce/Button/MainMenuButton_Over.png); -} - -div#confirm_dialog -{ - display: none; - width: 100%; - margin-top: 16dp; - text-align: center; -} - -p#confirm_text -{ - font-size: 31dp; - color: #ffffff; - margin-bottom: 23dp; -} - -div#confirm_buttons -{ - width: 100%; - display: flex; - justify-content: center; - gap: 10dp; -} - -button#confirm_no, -button#confirm_yes -{ - display: inline-block; - width: auto; - min-width: 204dp; - height: 58dp; - margin: 0; - padding-left: 29dp; - padding-right: 29dp; - color: #ffffff; - font-size: 36dp; - text-align: center; - line-height: 58dp; - cursor: pointer; - background: transparent; - decorator: image(images/lce/Button/MainMenuButton_Norm.png); -} - -button#confirm_no:hover, -button#confirm_yes:hover -{ - color: #ffff00; - decorator: image(images/lce/Button/MainMenuButton_Over.png); -} +} \ No newline at end of file diff --git a/Minecraft.Client/Assets/UI/SettingsMenu.rml b/Minecraft.Client/Assets/UI/SettingsMenu.rml index cb9cf818..e076d36d 100644 --- a/Minecraft.Client/Assets/UI/SettingsMenu.rml +++ b/Minecraft.Client/Assets/UI/SettingsMenu.rml @@ -13,13 +13,6 @@ -
-

[IDS_RESET_TO_DEFAULTS]

-
- - -
-
diff --git a/Minecraft.Client/Assets/UI/images/lce/LoadCreateJoinMenu/gui_load.png b/Minecraft.Client/Assets/UI/images/lce/LoadCreateJoinMenu/gui_load.png index cf034e174e1b6c95daca3c241c78bc27d325bb74..14ae25115b59fd82cbca455fca8306d1ad40b1fd 100644 GIT binary patch literal 14447 zcmeHOeKeF=7=LZTROnP&yGceHcsxK757IT1JM9@iCKRZ7S{Q#42YL zN48?LRMHqjomO^yGzqm#lYEV04w>;W4Ev6E=G~8+S=xVe&b|N4d!D)XzV|-&_xzsw zKKHpl?s2x)oVR=)1VNe(JMH#Ckh&cN%{{B32209rZFGTuR7m^mw?T~B72Obog&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raft.Client/Common/UI/UIScene_PauseMenu.cpp index 3f331e70..d365dba7 100644 --- a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp @@ -25,8 +25,6 @@ UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void *initData, UILayer *parentLa : UIScene(iPad, parentLayer) , m_document(nullptr) , m_bIgnoreInput(false) - , m_bExitDialog(false) - , m_bSaveDialog(false) { Rml::Context* ctx = RmlManager::Get().GetContext(); if (!ctx) @@ -47,11 +45,6 @@ UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void *initData, UILayer *parentLa m_document->GetElementById("achievements")->AddEventListener(Rml::EventId::Click, this); m_document->GetElementById("save_game")->AddEventListener(Rml::EventId::Click, this); m_document->GetElementById("exit_game")->AddEventListener(Rml::EventId::Click, this); - m_document->GetElementById("exit_save")->AddEventListener(Rml::EventId::Click, this); - m_document->GetElementById("exit_nosave")->AddEventListener(Rml::EventId::Click, this); - m_document->GetElementById("exit_cancel")->AddEventListener(Rml::EventId::Click, this); - m_document->GetElementById("save_cancel")->AddEventListener(Rml::EventId::Click, this); - m_document->GetElementById("save_confirm")->AddEventListener(Rml::EventId::Click, this); m_document->GetElementById("resume")->Focus(); } else @@ -77,11 +70,6 @@ UIScene_PauseMenu::~UIScene_PauseMenu() m_document->GetElementById("achievements")->RemoveEventListener(Rml::EventId::Click, this); m_document->GetElementById("save_game")->RemoveEventListener(Rml::EventId::Click, this); m_document->GetElementById("exit_game")->RemoveEventListener(Rml::EventId::Click, this); - m_document->GetElementById("exit_save")->RemoveEventListener(Rml::EventId::Click, this); - m_document->GetElementById("exit_nosave")->RemoveEventListener(Rml::EventId::Click, this); - m_document->GetElementById("exit_cancel")->RemoveEventListener(Rml::EventId::Click, this); - m_document->GetElementById("save_cancel")->RemoveEventListener(Rml::EventId::Click, this); - m_document->GetElementById("save_confirm")->RemoveEventListener(Rml::EventId::Click, this); m_document->Close(); m_document = nullptr; } @@ -184,42 +172,25 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, bool pressed { case ACTION_MENU_UP: ctx->ProcessKeyDown(Rml::Input::KI_UP, 0); - handled = true; break; case ACTION_MENU_DOWN: ctx->ProcessKeyDown(Rml::Input::KI_DOWN, 0); - handled = true; break; case ACTION_MENU_OK: // Only forward as keyboard Enter if actually coming from keyboard, // not from mouse click (mouse is handled in tick()). if (g_KBMInput.IsKeyPressed(VK_RETURN)) - { ctx->ProcessKeyDown(Rml::Input::KI_RETURN, 0); - handled = true; - } break; case ACTION_MENU_CANCEL: case ACTION_MENU_PAUSEMENU: - if (m_bExitDialog) - { - OnExitCancel(); - handled = true; - } - else if (m_bSaveDialog) - { - OnSaveCancel(); - handled = true; - } - else - { - navigateBack(); - handled = true; - } + navigateBack(); break; default: break; } + + handled = true; } void UIScene_PauseMenu::ProcessEvent(Rml::Event& event) @@ -236,11 +207,6 @@ void UIScene_PauseMenu::ProcessEvent(Rml::Event& event) else if (id == "achievements") OnAchievements(); else if (id == "save_game") OnSaveGame(); else if (id == "exit_game") OnExitGame(); - else if (id == "exit_save") OnExitSave(); - else if (id == "exit_nosave") OnExitNoSave(); - else if (id == "exit_cancel") OnExitCancel(); - else if (id == "save_confirm") OnSaveConfirm(); - else if (id == "save_cancel") OnSaveCancel(); } } @@ -280,114 +246,27 @@ void UIScene_PauseMenu::OnAchievements() ui.NavigateToScene(m_iPad, eUIScene_AchievementsMenu); } -void UIScene_PauseMenu::ShowSaveDialog(bool show) -{ - if (!m_document) - return; - - auto* saveDialog = m_document->GetElementById("save_dialog"); - auto* buttons = m_document->GetElementById("buttons"); - - if (show) - { - if (buttons) buttons->SetProperty("display", "none"); - if (saveDialog) saveDialog->SetProperty("display", "block"); - - auto* saveText = m_document->GetElementById("save_text"); - - if (saveText) - saveText->SetInnerRML("[IDS_CONFIRM_SAVE_GAME]"); - - m_document->GetElementById("save_cancel")->Focus(); - m_bSaveDialog = true; - } - else - { - if (saveDialog) saveDialog->SetProperty("display", "none"); - if (buttons) buttons->SetProperty("display", "block"); - - m_document->GetElementById("save_game")->Focus(); - m_bSaveDialog = false; - } -} - void UIScene_PauseMenu::OnSaveGame() { if (m_iPad != ProfileManager.GetPrimaryPad()) return; + // Does the save exist? bool bSaveExists; StorageManager.DoesSaveExist(&bSaveExists); + // We need to ask if they are sure they want to overwrite the existing game if (bSaveExists) - ShowSaveDialog(true); - else - app.SetAction(m_iPad, eAppAction_SaveGame); -} - -void UIScene_PauseMenu::OnSaveConfirm() -{ - ShowSaveDialog(false); - app.SetAction(m_iPad, eAppAction_SaveGame); -} - -void UIScene_PauseMenu::OnSaveCancel() -{ - ShowSaveDialog(false); -} - -void UIScene_PauseMenu::ShowExitDialog(bool show) -{ - if (!m_document) - return; - - auto* exitDialog = m_document->GetElementById("exit_dialog"); - auto* buttons = m_document->GetElementById("buttons"); - - if (show) { - Minecraft* pMinecraft = Minecraft::GetInstance(); - - if (buttons) buttons->SetProperty("display", "none"); - if (exitDialog) exitDialog->SetProperty("display", "block"); - - // Configure dialog for current state - auto* exitSave = m_document->GetElementById("exit_save"); - auto* exitNosave = m_document->GetElementById("exit_nosave"); - auto* exitCancel = m_document->GetElementById("exit_cancel"); - auto* exitText = m_document->GetElementById("exit_text"); - - if (m_iPad == ProfileManager.GetPrimaryPad()) - { - if (exitSave) - exitSave->SetProperty("display", "inline-block"); - if (exitNosave) - exitNosave->SetProperty("display", "inline-block"); - - if (g_NetworkManager.GetPlayerCount() > 1) - if (exitText) exitText->SetInnerRML("[IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE]"); - else - if (exitText) exitText->SetInnerRML("[IDS_CONFIRM_EXIT_GAME]"); - - if (exitCancel) exitCancel->Focus(); - } - - m_bExitDialog = true; + UINT uiIDA[2]; + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_CONFIRM_OK; + ui.RequestAlertMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, m_iPad, &IUIScene_PauseMenu::SaveGameDialogReturned, (LPVOID)GetCallbackUniqueId()); } else { - if (exitDialog) exitDialog->SetProperty("display", "none"); - if (buttons) buttons->SetProperty("display", "block"); - - // Restore default button state - auto* exitSave = m_document->GetElementById("exit_save"); - auto* exitNosave = m_document->GetElementById("exit_nosave"); - if (exitSave) exitSave->SetProperty("display", "inline-block"); - if (exitNosave) exitNosave->SetInnerRML("[IDS_EXIT_GAME_NO_SAVE]"); - if (exitNosave) exitNosave->SetProperty("display", "inline-block"); - - m_document->GetElementById("exit_game")->Focus(); - m_bExitDialog = false; + // Flag a app action of save game + app.SetAction(m_iPad, eAppAction_SaveGame); } } @@ -395,51 +274,53 @@ void UIScene_PauseMenu::OnExitGame() { Minecraft* pMinecraft = Minecraft::GetInstance(); - // Non-primary pad: exit directly without dialog - if (m_iPad != ProfileManager.GetPrimaryPad()) + UINT uiIDA[3]; + + // Is it the primary player exiting? + if (m_iPad == ProfileManager.GetPrimaryPad()) { + int playTime = -1; + if (pMinecraft->localplayers[m_iPad] != NULL) + playTime = (int)pMinecraft->localplayers[m_iPad]->getSessionTimer(); + + if (StorageManager.GetSaveDisabled()) + { + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_CONFIRM_OK; + ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_PROGRESS_LOST, uiIDA, 2, m_iPad, &IUIScene_PauseMenu::ExitGameDialogReturned, (LPVOID)GetCallbackUniqueId()); + } + else + { + if (g_NetworkManager.IsHost()) + { + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_EXIT_GAME_SAVE; + uiIDA[2] = IDS_EXIT_GAME_NO_SAVE; + + if (g_NetworkManager.GetPlayerCount() > 1) + ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE, uiIDA, 3, m_iPad, &UIScene_PauseMenu::ExitGameSaveDialogReturned, (LPVOID)GetCallbackUniqueId()); + else + ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, m_iPad, &UIScene_PauseMenu::ExitGameSaveDialogReturned, (LPVOID)GetCallbackUniqueId()); + } + else + { + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_CONFIRM_OK; + + ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, m_iPad, &IUIScene_PauseMenu::ExitGameDialogReturned, (LPVOID)GetCallbackUniqueId()); + } + } + } + else // Non-primary pad: exit directly without dialog + { + int playTime = -1; + if (pMinecraft->localplayers[m_iPad] != NULL) + playTime = (int)pMinecraft->localplayers[m_iPad]->getSessionTimer(); + if (pMinecraft->localplayers[m_iPad] != nullptr) TelemetryManager->RecordLevelExit(m_iPad, eSen_LevelExitStatus_Exited); + app.SetAction(m_iPad, eAppAction_ExitPlayer); return; } - - // Primary pad: show inline confirmation dialog (no Iggy MessageBox) - ShowExitDialog(true); -} - -void UIScene_PauseMenu::OnExitSave() -{ - ShowExitDialog(false); - SetIgnoreInput(true); - - Minecraft* pMinecraft = Minecraft::GetInstance(); - if (pMinecraft->localplayers[m_iPad] != nullptr) - { - int playTime = static_cast(pMinecraft->localplayers[m_iPad]->getSessionTimer()); - TelemetryManager->RecordLevelExit(m_iPad, eSen_LevelExitStatus_Exited); - } - - MinecraftServer::getInstance()->setSaveOnExit(true); - app.SetAction(m_iPad, eAppAction_ExitWorld); -} - -void UIScene_PauseMenu::OnExitNoSave() -{ - ShowExitDialog(false); - SetIgnoreInput(true); - - Minecraft* pMinecraft = Minecraft::GetInstance(); - if (pMinecraft->localplayers[m_iPad] != nullptr) - { - int playTime = static_cast(pMinecraft->localplayers[m_iPad]->getSessionTimer()); - TelemetryManager->RecordLevelExit(m_iPad, eSen_LevelExitStatus_Exited); - } - - app.SetAction(m_iPad, eAppAction_ExitWorld); -} - -void UIScene_PauseMenu::OnExitCancel() -{ - ShowExitDialog(false); -} +} \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_PauseMenu.h b/Minecraft.Client/Common/UI/UIScene_PauseMenu.h index 9d67f593..8ec681ed 100644 --- a/Minecraft.Client/Common/UI/UIScene_PauseMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_PauseMenu.h @@ -49,20 +49,10 @@ protected: void OnAchievements(); void OnSaveGame(); void OnExitGame(); - void OnExitSave(); - void OnExitNoSave(); - void OnExitCancel(); - void OnSaveConfirm(); - void OnSaveCancel(); - - void ShowExitDialog(bool show); - void ShowSaveDialog(bool show); private: Rml::ElementDocument* m_document; bool m_bIgnoreInput; - bool m_bExitDialog; - bool m_bSaveDialog; }; #pragma pop_macro("GetFirstChild") diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp index 6af780cc..3b70694d 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp @@ -23,7 +23,6 @@ UIScene_SettingsMenu::UIScene_SettingsMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) , m_document(nullptr) - , m_bConfirmDialog(false) { Rml::Context* ctx = RmlManager::Get().GetContext(); if (!ctx) @@ -56,8 +55,6 @@ UIScene_SettingsMenu::UIScene_SettingsMenu(int iPad, void *initData, UILayer *pa m_document->GetElementById("graphics")->AddEventListener(Rml::EventId::Click, this); m_document->GetElementById("ui")->AddEventListener(Rml::EventId::Click, this); m_document->GetElementById("reset_defaults")->AddEventListener(Rml::EventId::Click, this); - m_document->GetElementById("confirm_yes")->AddEventListener(Rml::EventId::Click, this); - m_document->GetElementById("confirm_no")->AddEventListener(Rml::EventId::Click, this); // Focus first visible button m_document->GetElementById("options")->Focus(); @@ -83,8 +80,6 @@ UIScene_SettingsMenu::~UIScene_SettingsMenu() m_document->GetElementById("graphics")->RemoveEventListener(Rml::EventId::Click, this); m_document->GetElementById("ui")->RemoveEventListener(Rml::EventId::Click, this); m_document->GetElementById("reset_defaults")->RemoveEventListener(Rml::EventId::Click, this); - m_document->GetElementById("confirm_yes")->RemoveEventListener(Rml::EventId::Click, this); - m_document->GetElementById("confirm_no")->RemoveEventListener(Rml::EventId::Click, this); m_document->Close(); m_document = nullptr; } @@ -187,36 +182,24 @@ void UIScene_SettingsMenu::handleInput(int iPad, int key, bool repeat, bool pres { case ACTION_MENU_UP: ctx->ProcessKeyDown(Rml::Input::KI_UP, 0); - handled = true; break; case ACTION_MENU_DOWN: ctx->ProcessKeyDown(Rml::Input::KI_DOWN, 0); - handled = true; break; case ACTION_MENU_OK: if (g_KBMInput.IsKeyPressed(VK_RETURN)) - { ctx->ProcessKeyDown(Rml::Input::KI_RETURN, 0); - handled = true; - } break; case ACTION_MENU_CANCEL: case ACTION_MENU_PAUSEMENU: - if (m_bConfirmDialog) - { - OnConfirmNo(); - handled = true; - } - else - { app.CheckGameSettingsChanged(true, iPad); navigateBack(); - handled = true; - } break; default: break; } + + handled = true; } void UIScene_SettingsMenu::ProcessEvent(Rml::Event& event) @@ -231,8 +214,6 @@ void UIScene_SettingsMenu::ProcessEvent(Rml::Event& event) else if (id == "graphics") OnGraphics(); else if (id == "ui") OnUI(); else if (id == "reset_defaults") OnResetToDefaults(); - else if (id == "confirm_yes") OnConfirmYes(); - else if (id == "confirm_no") OnConfirmNo(); } } @@ -272,43 +253,27 @@ void UIScene_SettingsMenu::OnUI() ui.NavigateToScene(m_iPad, eUIScene_SettingsUIMenu); } -void UIScene_SettingsMenu::ShowConfirmDialog(bool show) -{ - if (!m_document) - return; - - auto* confirmDialog = m_document->GetElementById("confirm_dialog"); - auto* buttons = m_document->GetElementById("buttons"); - - if (show) - { - if (buttons) buttons->SetProperty("display", "none"); - if (confirmDialog) confirmDialog->SetProperty("display", "block"); - m_document->GetElementById("confirm_no")->Focus(); - m_bConfirmDialog = true; - } - else - { - if (confirmDialog) confirmDialog->SetProperty("display", "none"); - if (buttons) buttons->SetProperty("display", "block"); - m_document->GetElementById("reset_defaults")->Focus(); - m_bConfirmDialog = false; - } -} - void UIScene_SettingsMenu::OnResetToDefaults() { - ShowConfirmDialog(true); + UINT uiIDA[2]; + uiIDA[0]=IDS_CONFIRM_CANCEL; + uiIDA[1]=IDS_CONFIRM_OK; + + ui.RequestAlertMessage(IDS_DEFAULTS_TITLE, IDS_DEFAULTS_TEXT, uiIDA, 2, m_iPad,&UIScene_SettingsMenu::ResetDefaultsDialogReturned,this); } -void UIScene_SettingsMenu::OnConfirmYes() +int UIScene_SettingsMenu::ResetDefaultsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - app.SetDefaultOptions(ProfileManager.GetDashboardProfileSettings(m_iPad), m_iPad); - app.CheckGameSettingsChanged(true, m_iPad); - navigateBack(); -} + UIScene_SettingsMenu* pClass = (UIScene_SettingsMenu*)pParam; -void UIScene_SettingsMenu::OnConfirmNo() -{ - ShowConfirmDialog(false); -} + // results switched for this dialog + if(result==C4JStorage::EMessage_ResultDecline) + { + app.SetDefaultOptions(ProfileManager.GetDashboardProfileSettings(pClass->m_iPad),pClass->m_iPad); + + // if the profile data has been changed, then force a profile write + // It seems we're allowed to break the 5 minute rule if it's the result of a user action + app.CheckGameSettingsChanged(true,iPad); + } + return 0; +} \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsMenu.h b/Minecraft.Client/Common/UI/UIScene_SettingsMenu.h index f63ebb32..7987d825 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SettingsMenu.h @@ -48,14 +48,11 @@ protected: void OnGraphics(); void OnUI(); void OnResetToDefaults(); - void OnConfirmYes(); - void OnConfirmNo(); - void ShowConfirmDialog(bool show); + static int ResetDefaultsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); private: Rml::ElementDocument* m_document; - bool m_bConfirmDialog; }; #pragma pop_macro("GetFirstChild")