mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-07-09 16:08:14 +00:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -13,13 +13,6 @@
|
||||
<button id="ui">[IDS_USER_INTERFACE]</button>
|
||||
<button id="reset_defaults">[IDS_RESET_TO_DEFAULTS]</button>
|
||||
</div>
|
||||
<div id="confirm_dialog">
|
||||
<p id="confirm_text">[IDS_RESET_TO_DEFAULTS]</p>
|
||||
<div id="confirm_buttons">
|
||||
<button id="confirm_no">[IDS_NO]</button>
|
||||
<button id="confirm_yes">[IDS_YES]</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</rml>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@@ -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<int>(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<int>(pMinecraft->localplayers[m_iPad]->getSessionTimer());
|
||||
TelemetryManager->RecordLevelExit(m_iPad, eSen_LevelExitStatus_Exited);
|
||||
}
|
||||
|
||||
app.SetAction(m_iPad, eAppAction_ExitWorld);
|
||||
}
|
||||
|
||||
void UIScene_PauseMenu::OnExitCancel()
|
||||
{
|
||||
ShowExitDialog(false);
|
||||
}
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user