mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-07-10 21:58:18 +00:00
RMLUI Menu Updates.
* LoadCreateJoin Menu: Adjusted size (Is not 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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user