aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp')
-rw-r--r--Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp168
1 files changed, 168 insertions, 0 deletions
diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp
new file mode 100644
index 00000000..4ef7eb5d
--- /dev/null
+++ b/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp
@@ -0,0 +1,168 @@
+#include "stdafx.h"
+#include "UI.h"
+#include "UIScene_SettingsMenu.h"
+#include "..\..\Minecraft.h"
+
+UIScene_SettingsMenu::UIScene_SettingsMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
+{
+ // Setup all the Iggy references we need for this scene
+ initialiseMovie();
+
+ bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
+
+ m_buttons[BUTTON_ALL_OPTIONS].init(app.GetString(IDS_OPTIONS),BUTTON_ALL_OPTIONS);
+ m_buttons[BUTTON_ALL_AUDIO].init(app.GetString(IDS_AUDIO),BUTTON_ALL_AUDIO);
+ m_buttons[BUTTON_ALL_CONTROL].init(app.GetString(IDS_CONTROL),BUTTON_ALL_CONTROL);
+ m_buttons[BUTTON_ALL_GRAPHICS].init(app.GetString(IDS_GRAPHICS),BUTTON_ALL_GRAPHICS);
+ m_buttons[BUTTON_ALL_UI].init(app.GetString(IDS_USER_INTERFACE),BUTTON_ALL_UI);
+ m_buttons[BUTTON_ALL_RESETTODEFAULTS].init(app.GetString(IDS_RESET_TO_DEFAULTS),BUTTON_ALL_RESETTODEFAULTS);
+
+ if(ProfileManager.GetPrimaryPad()!=m_iPad)
+ {
+ removeControl( &m_buttons[BUTTON_ALL_AUDIO], true);
+ removeControl( &m_buttons[BUTTON_ALL_GRAPHICS], true);
+ }
+
+ doHorizontalResizeCheck();
+
+ if(app.GetLocalPlayerCount()>1)
+ {
+#if TO_BE_IMPLEMENTED
+ app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad,false);
+#endif
+ }
+}
+
+UIScene_SettingsMenu::~UIScene_SettingsMenu()
+{
+}
+
+wstring UIScene_SettingsMenu::getMoviePath()
+{
+ if(app.GetLocalPlayerCount() > 1)
+ {
+ return L"SettingsMenuSplit";
+ }
+ else
+ {
+ return L"SettingsMenu";
+ }
+}
+
+void UIScene_SettingsMenu::handleReload()
+{
+ if(ProfileManager.GetPrimaryPad()!=m_iPad)
+ {
+ removeControl( &m_buttons[BUTTON_ALL_AUDIO], true);
+ removeControl( &m_buttons[BUTTON_ALL_GRAPHICS], true);
+ }
+
+ doHorizontalResizeCheck();
+}
+
+void UIScene_SettingsMenu::updateTooltips()
+{
+ ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
+}
+
+void UIScene_SettingsMenu::updateComponents()
+{
+ bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
+ if(bNotInGame)
+ {
+ m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true);
+ m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true);
+ }
+ else
+ {
+ m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,false);
+
+ if( app.GetLocalPlayerCount() == 1 ) m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true);
+ else m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false);
+
+ }
+}
+
+void UIScene_SettingsMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
+{
+ //app.DebugPrintf("UIScene_DebugOverlay handling input for pad %d, key %d, down- %s, pressed- %s, released- %s\n", iPad, key, down?"TRUE":"FALSE", pressed?"TRUE":"FALSE", released?"TRUE":"FALSE");
+ ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released);
+
+ switch(key)
+ {
+ case ACTION_MENU_CANCEL:
+ if(pressed)
+ {
+ // 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);
+ navigateBack();
+ }
+ break;
+ case ACTION_MENU_OK:
+#ifdef __ORBIS__
+ case ACTION_MENU_TOUCHPAD_PRESS:
+#endif
+ sendInputToMovie(key, repeat, pressed, released);
+ break;
+ case ACTION_MENU_UP:
+ case ACTION_MENU_DOWN:
+ sendInputToMovie(key, repeat, pressed, released);
+ break;
+ }
+}
+
+void UIScene_SettingsMenu::handlePress(F64 controlId, F64 childId)
+{
+ //CD - Added for audio
+ ui.PlayUISFX(eSFX_Press);
+
+ switch((int)controlId)
+ {
+ case BUTTON_ALL_OPTIONS:
+ ui.NavigateToScene(m_iPad, eUIScene_SettingsOptionsMenu);
+ break;
+ case BUTTON_ALL_AUDIO:
+ ui.NavigateToScene(m_iPad, eUIScene_SettingsAudioMenu);
+ break;
+ case BUTTON_ALL_CONTROL:
+ ui.NavigateToScene(m_iPad, eUIScene_SettingsControlMenu);
+ break;
+ case BUTTON_ALL_GRAPHICS:
+ ui.NavigateToScene(m_iPad, eUIScene_SettingsGraphicsMenu);
+ break;
+ case BUTTON_ALL_UI:
+ ui.NavigateToScene(m_iPad, eUIScene_SettingsUIMenu);
+ break;
+ case BUTTON_ALL_RESETTODEFAULTS:
+ {
+ // check they really want to do this
+ UINT uiIDA[2];
+ uiIDA[0]=IDS_CONFIRM_CANCEL;
+ uiIDA[1]=IDS_CONFIRM_OK;
+
+ ui.RequestMessageBox(IDS_DEFAULTS_TITLE, IDS_DEFAULTS_TEXT, uiIDA, 2, m_iPad,&UIScene_SettingsMenu::ResetDefaultsDialogReturned,this, app.GetStringTable(), NULL, 0, false);
+ }
+ break;
+ }
+}
+
+int UIScene_SettingsMenu::ResetDefaultsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
+{
+ UIScene_SettingsMenu* pClass = (UIScene_SettingsMenu*)pParam;
+
+ // results switched for this dialog
+ if(result==C4JStorage::EMessage_ResultDecline)
+ {
+#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__)
+ app.SetDefaultOptions(StorageManager.GetDashboardProfileSettings(pClass->m_iPad),pClass->m_iPad);
+#else
+ app.SetDefaultOptions(ProfileManager.GetDashboardProfileSettings(pClass->m_iPad),pClass->m_iPad);
+#endif
+ // 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;
+}