mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-05-29 14:14:37 +00:00
736 lines
22 KiB
C++
736 lines
22 KiB
C++
#include "UI.h"
|
|
#include "UIScene_PauseMenu.h"
|
|
#include "..\..\MinecraftServer.h"
|
|
#include "..\..\MultiplayerLocalPlayer.h"
|
|
#include "..\..\TexturePackRepository.h"
|
|
#include "..\..\TexturePack.h"
|
|
#include "..\..\DLCTexturePack.h"
|
|
#include "../DLC/DLCPack.h"
|
|
#include "../Tutorial/TutorialMode.h"
|
|
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
|
|
|
UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
|
{
|
|
// Setup all the Iggy references we need for this scene
|
|
initialiseMovie();
|
|
m_bIgnoreInput=false;
|
|
m_eAction=eAction_None;
|
|
|
|
m_buttons[BUTTON_PAUSE_RESUMEGAME].init(app.GetString(IDS_RESUME_GAME),BUTTON_PAUSE_RESUMEGAME);
|
|
m_buttons[BUTTON_PAUSE_HELPANDOPTIONS].init(app.GetString(IDS_HELP_AND_OPTIONS),BUTTON_PAUSE_HELPANDOPTIONS);
|
|
m_buttons[BUTTON_PAUSE_LEADERBOARDS].init(app.GetString(IDS_LEADERBOARDS),BUTTON_PAUSE_LEADERBOARDS);
|
|
#ifdef _DURANGO
|
|
m_buttons[BUTTON_PAUSE_XBOXHELP].init(app.GetString(IDS_XBOX_HELP_APP), BUTTON_PAUSE_XBOXHELP);
|
|
#else
|
|
m_buttons[BUTTON_PAUSE_ACHIEVEMENTS].init(app.GetString(IDS_ACHIEVEMENTS),BUTTON_PAUSE_ACHIEVEMENTS);
|
|
#endif
|
|
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
|
m_bTrialTexturePack = false;
|
|
if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin())
|
|
{
|
|
TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected();
|
|
DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack;
|
|
|
|
m_pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack();
|
|
|
|
if(!m_pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" ))
|
|
{
|
|
m_bTrialTexturePack = true;
|
|
}
|
|
}
|
|
|
|
// 4J-TomK - check for all possible labels being fed into BUTTON_PAUSE_SAVEGAME (Bug 163775)
|
|
// this has to be done before button initialisation!
|
|
wchar_t saveButtonLabels[2][256];
|
|
swprintf( saveButtonLabels[0], 256, L"%ls", app.GetString( IDS_SAVE_GAME ));
|
|
swprintf( saveButtonLabels[1], 256, L"%ls", app.GetString( IDS_DISABLE_AUTOSAVE ));
|
|
m_buttons[BUTTON_PAUSE_SAVEGAME].setAllPossibleLabels(2,saveButtonLabels);
|
|
|
|
if(app.GetGameHostOption(eGameHostOption_DisableSaving) || m_bTrialTexturePack)
|
|
{
|
|
m_savesDisabled = true;
|
|
m_buttons[BUTTON_PAUSE_SAVEGAME].init(app.GetString(IDS_SAVE_GAME),BUTTON_PAUSE_SAVEGAME);
|
|
}
|
|
else
|
|
{
|
|
m_savesDisabled = false;
|
|
m_buttons[BUTTON_PAUSE_SAVEGAME].init(app.GetString(IDS_DISABLE_AUTOSAVE),BUTTON_PAUSE_SAVEGAME);
|
|
}
|
|
#else
|
|
m_buttons[BUTTON_PAUSE_SAVEGAME].init(app.GetString(IDS_SAVE_GAME),BUTTON_PAUSE_SAVEGAME);
|
|
#endif
|
|
m_buttons[BUTTON_PAUSE_EXITGAME].init(app.GetString(IDS_EXIT_GAME),BUTTON_PAUSE_EXITGAME);
|
|
|
|
if(!ProfileManager.IsFullVersion())
|
|
{
|
|
// hide the trial timer
|
|
ui.ShowTrialTimer(false);
|
|
}
|
|
|
|
updateControlsVisibility();
|
|
|
|
doHorizontalResizeCheck();
|
|
|
|
// get rid of the quadrant display if it's on
|
|
ui.HidePressStart();
|
|
|
|
#if TO_BE_IMPLEMENTED
|
|
XuiSetTimer(m_hObj,IGNORE_KEYPRESS_TIMERID,IGNORE_KEYPRESS_TIME);
|
|
#endif
|
|
|
|
if( g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1 )
|
|
{
|
|
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_PauseServer,(void *)TRUE);
|
|
}
|
|
|
|
TelemetryManager->RecordMenuShown(m_iPad, eUIScene_PauseMenu, 0);
|
|
TelemetryManager->RecordPauseOrInactive(m_iPad);
|
|
|
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
|
if(pMinecraft != nullptr && pMinecraft->localgameModes[iPad] != nullptr )
|
|
{
|
|
TutorialMode *gameMode = static_cast<TutorialMode *>(pMinecraft->localgameModes[iPad]);
|
|
|
|
// This just allows it to be shown
|
|
gameMode->getTutorial()->showTutorialPopup(false);
|
|
}
|
|
m_bErrorDialogRunning = false;
|
|
}
|
|
|
|
UIScene_PauseMenu::~UIScene_PauseMenu()
|
|
{
|
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
|
if(pMinecraft != nullptr && pMinecraft->localgameModes[m_iPad] != nullptr )
|
|
{
|
|
TutorialMode *gameMode = static_cast<TutorialMode *>(pMinecraft->localgameModes[m_iPad]);
|
|
|
|
// This just allows it to be shown
|
|
gameMode->getTutorial()->showTutorialPopup(true);
|
|
}
|
|
|
|
m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,false);
|
|
m_parentLayer->showComponent(m_iPad,eUIComponent_MenuBackground,false);
|
|
m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false);
|
|
}
|
|
|
|
wstring UIScene_PauseMenu::getMoviePath()
|
|
{
|
|
if(app.GetLocalPlayerCount() > 1)
|
|
{
|
|
return L"PauseMenuSplit";
|
|
}
|
|
else
|
|
{
|
|
return L"PauseMenu";
|
|
}
|
|
}
|
|
|
|
void UIScene_PauseMenu::tick()
|
|
{
|
|
UIScene::tick();
|
|
|
|
#ifdef __PSVITA__
|
|
// 4J-MGH - Need to check for installed DLC here, as we delay the installation of the key file on Vita
|
|
if(!app.DLCInstallProcessCompleted()) app.StartInstallDLCProcess(0);
|
|
#endif
|
|
|
|
|
|
#if defined _XBOX_ONE || defined __ORBIS__
|
|
if(!m_bTrialTexturePack && m_savesDisabled != (app.GetGameHostOption(eGameHostOption_DisableSaving) != 0) && ProfileManager.GetPrimaryPad() == m_iPad )
|
|
{
|
|
// We show the save button if saves are disabled as this lets us show a prompt to enable them (via purchasing a texture pack)
|
|
if( app.GetGameHostOption(eGameHostOption_DisableSaving) )
|
|
{
|
|
m_savesDisabled = true;
|
|
m_buttons[BUTTON_PAUSE_SAVEGAME].setLabel( app.GetString(IDS_SAVE_GAME) );
|
|
}
|
|
else
|
|
{
|
|
m_savesDisabled = false;
|
|
m_buttons[BUTTON_PAUSE_SAVEGAME].setLabel( app.GetString(IDS_DISABLE_AUTOSAVE) );
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#ifdef __ORBIS__
|
|
// Process the error dialog (for a patch being available)
|
|
if(m_bErrorDialogRunning)
|
|
{
|
|
SceErrorDialogStatus stat = sceErrorDialogUpdateStatus();
|
|
if( stat == SCE_ERROR_DIALOG_STATUS_FINISHED )
|
|
{
|
|
sceErrorDialogTerminate();
|
|
m_bErrorDialogRunning=false;
|
|
}
|
|
}
|
|
#endif
|
|
}
|
|
|
|
void UIScene_PauseMenu::updateTooltips()
|
|
{
|
|
bool bUserisClientSide = ProfileManager.IsSignedInLive(m_iPad);
|
|
bool bIsisPrimaryHost=g_NetworkManager.IsHost() && (ProfileManager.GetPrimaryPad()==m_iPad);
|
|
|
|
#ifdef _XBOX_ONE
|
|
bool bDisplayBanTip = !g_NetworkManager.IsLocalGame() && !bIsisPrimaryHost && !ProfileManager.IsGuest(m_iPad);
|
|
#endif
|
|
|
|
int iY = -1;
|
|
#if defined __PS3__ || defined __ORBIS__
|
|
if(m_iPad == ProfileManager.GetPrimaryPad() ) iY = IDS_TOOLTIPS_GAME_INVITES;
|
|
#endif
|
|
int iRB = -1;
|
|
int iX = -1;
|
|
|
|
if(ProfileManager.IsFullVersion())
|
|
{
|
|
if(StorageManager.GetSaveDisabled())
|
|
{
|
|
iX = bIsisPrimaryHost?IDS_TOOLTIPS_SELECTDEVICE:-1;
|
|
#ifdef _XBOX_ONE
|
|
iRB = bDisplayBanTip?IDS_TOOLTIPS_BANLEVEL:-1;
|
|
#endif
|
|
if( CSocialManager::Instance()->IsTitleAllowedToPostImages() && CSocialManager::Instance()->AreAllUsersAllowedToPostImages() && bUserisClientSide )
|
|
{
|
|
#ifndef __PS3__
|
|
iY = IDS_TOOLTIPS_SHARE;
|
|
#endif
|
|
}
|
|
}
|
|
else
|
|
{
|
|
iX = bIsisPrimaryHost?IDS_TOOLTIPS_CHANGEDEVICE:-1;
|
|
#ifdef _XBOX_ONE
|
|
iRB = bDisplayBanTip?IDS_TOOLTIPS_BANLEVEL:-1;
|
|
#endif
|
|
if( CSocialManager::Instance()->IsTitleAllowedToPostImages() && CSocialManager::Instance()->AreAllUsersAllowedToPostImages() && bUserisClientSide)
|
|
{
|
|
#ifndef __PS3__
|
|
iY = IDS_TOOLTIPS_SHARE;
|
|
#endif
|
|
}
|
|
}
|
|
}
|
|
ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK,iX,iY, -1,-1,-1,iRB);
|
|
}
|
|
|
|
void UIScene_PauseMenu::updateComponents()
|
|
{
|
|
m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,false);
|
|
m_parentLayer->showComponent(m_iPad,eUIComponent_MenuBackground,true);
|
|
|
|
if( app.GetLocalPlayerCount() == 1 ) m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true);
|
|
else m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false);
|
|
}
|
|
|
|
void UIScene_PauseMenu::handlePreReload()
|
|
{
|
|
#if defined _XBOX_ONE || defined __ORBIS__
|
|
if(ProfileManager.GetPrimaryPad() == m_iPad)
|
|
{
|
|
// 4J-TomK - check for all possible labels being fed into BUTTON_PAUSE_SAVEGAME (Bug 163775)
|
|
// this has to be done before button initialisation!
|
|
wchar_t saveButtonLabels[2][256];
|
|
swprintf( saveButtonLabels[0], 256, L"%ls", app.GetString( IDS_SAVE_GAME ));
|
|
swprintf( saveButtonLabels[1], 256, L"%ls", app.GetString( IDS_DISABLE_AUTOSAVE ));
|
|
m_buttons[BUTTON_PAUSE_SAVEGAME].setAllPossibleLabels(2,saveButtonLabels);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
void UIScene_PauseMenu::handleReload()
|
|
{
|
|
updateTooltips();
|
|
updateControlsVisibility();
|
|
|
|
#if defined _XBOX_ONE || defined __ORBIS__
|
|
if(ProfileManager.GetPrimaryPad() == m_iPad)
|
|
{
|
|
// We show the save button if saves are disabled as this lets us show a prompt to enable them (via purchasing a texture pack)
|
|
if( app.GetGameHostOption(eGameHostOption_DisableSaving) || m_bTrialTexturePack )
|
|
{
|
|
m_savesDisabled = true;
|
|
m_buttons[BUTTON_PAUSE_SAVEGAME].setLabel( app.GetString(IDS_SAVE_GAME) );
|
|
}
|
|
else
|
|
{
|
|
m_savesDisabled = false;
|
|
m_buttons[BUTTON_PAUSE_SAVEGAME].setLabel( app.GetString(IDS_DISABLE_AUTOSAVE) );
|
|
}
|
|
}
|
|
#endif
|
|
|
|
doHorizontalResizeCheck();
|
|
}
|
|
|
|
void UIScene_PauseMenu::updateControlsVisibility()
|
|
{
|
|
// are we the primary player?
|
|
// 4J-PB - fix for 7844 & 7845 -
|
|
// TCR # 128: XLA Pause Menu: When in a multiplayer game as a client the Pause Menu does not have a Leaderboards option.
|
|
// TCR # 128: XLA Pause Menu: When in a multiplayer game as a client the Pause Menu does not have an Achievements option.
|
|
if(ProfileManager.GetPrimaryPad()==m_iPad) // && g_NetworkManager.IsHost())
|
|
{
|
|
// are we in splitscreen?
|
|
// how many local players do we have?
|
|
if( app.GetLocalPlayerCount()>1 )
|
|
{
|
|
// Hide the BUTTON_PAUSE_LEADERBOARDS and BUTTON_PAUSE_ACHIEVEMENTS
|
|
removeControl( &m_buttons[BUTTON_PAUSE_LEADERBOARDS], false );
|
|
#ifndef _XBOX_ONE
|
|
removeControl( &m_buttons[BUTTON_PAUSE_ACHIEVEMENTS], false );
|
|
#endif
|
|
}
|
|
|
|
if( !g_NetworkManager.IsHost() )
|
|
{
|
|
// Hide the BUTTON_PAUSE_SAVEGAME
|
|
removeControl( &m_buttons[BUTTON_PAUSE_SAVEGAME], false );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// Hide the BUTTON_PAUSE_LEADERBOARDS, BUTTON_PAUSE_ACHIEVEMENTS and BUTTON_PAUSE_SAVEGAME
|
|
removeControl( &m_buttons[BUTTON_PAUSE_LEADERBOARDS], false );
|
|
#ifndef _XBOX_ONE
|
|
removeControl( &m_buttons[BUTTON_PAUSE_ACHIEVEMENTS], false );
|
|
#endif
|
|
removeControl( &m_buttons[BUTTON_PAUSE_SAVEGAME], false );
|
|
}
|
|
|
|
// is saving disabled?
|
|
if(StorageManager.GetSaveDisabled())
|
|
{
|
|
#ifdef _XBOX
|
|
// disable save button
|
|
m_buttons[BUTTON_PAUSE_SAVEGAME].setEnable(false);
|
|
#endif
|
|
}
|
|
|
|
#if defined(__PS3__) || defined (__PSVITA__) || defined(__ORBIS__)
|
|
// We don't have a way to display trophies/achievements, so remove the button, and we're allowed to not have it on Xbox One
|
|
removeControl( &m_buttons[BUTTON_PAUSE_ACHIEVEMENTS], false );
|
|
#endif
|
|
|
|
}
|
|
|
|
void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
|
|
{
|
|
if(m_bIgnoreInput)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//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(iPad, key, repeat, pressed, released);
|
|
|
|
#ifdef _XBOX_ONE
|
|
bool bIsisPrimaryHost=g_NetworkManager.IsHost() && (ProfileManager.GetPrimaryPad()==iPad);
|
|
bool bDisplayBanTip = !g_NetworkManager.IsLocalGame() && !bIsisPrimaryHost && !ProfileManager.IsGuest(iPad);
|
|
#endif
|
|
|
|
switch(key)
|
|
{
|
|
#ifdef _DURANGO
|
|
case ACTION_MENU_GTC_RESUME:
|
|
#endif
|
|
#if defined(__PS3__) // not for Orbis - we want to use the pause menu (touchpad press) to select a menu item
|
|
case ACTION_MENU_PAUSEMENU:
|
|
#endif
|
|
case ACTION_MENU_CANCEL:
|
|
if(pressed)
|
|
{
|
|
if( iPad == ProfileManager.GetPrimaryPad() && g_NetworkManager.IsLocalGame() )
|
|
{
|
|
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_PauseServer,(void *)FALSE);
|
|
}
|
|
|
|
ui.PlayUISFX(eSFX_Back);
|
|
navigateBack();
|
|
if(!ProfileManager.IsFullVersion())
|
|
{
|
|
ui.ShowTrialTimer(true);
|
|
}
|
|
}
|
|
break;
|
|
case ACTION_MENU_OK:
|
|
#ifdef __ORBIS__
|
|
case ACTION_MENU_TOUCHPAD_PRESS:
|
|
#endif
|
|
case ACTION_MENU_UP:
|
|
case ACTION_MENU_DOWN:
|
|
if(pressed)
|
|
{
|
|
sendInputToMovie(key, repeat, pressed, released);
|
|
}
|
|
break;
|
|
|
|
#ifdef _XBOX_ONE
|
|
case ACTION_MENU_RIGHT_SCROLL:
|
|
if( bDisplayBanTip )
|
|
{
|
|
UINT uiIDA[2];
|
|
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
|
uiIDA[1]=IDS_CONFIRM_OK;
|
|
ui.RequestAlertMessage(IDS_ACTION_BAN_LEVEL_TITLE, IDS_ACTION_BAN_LEVEL_DESCRIPTION, uiIDA, 2, iPad,&UIScene_PauseMenu::BanGameDialogReturned,(LPVOID)GetCallbackUniqueId() );
|
|
|
|
//rfHandled = TRUE;
|
|
}
|
|
break;
|
|
#endif
|
|
}
|
|
}
|
|
|
|
void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId)
|
|
{
|
|
ui.PlayUISFX(eSFX_Press);
|
|
|
|
if(m_bIgnoreInput) return;
|
|
|
|
switch(static_cast<int>(controlId))
|
|
{
|
|
case BUTTON_PAUSE_RESUMEGAME:
|
|
if( m_iPad == ProfileManager.GetPrimaryPad() && g_NetworkManager.IsLocalGame() )
|
|
{
|
|
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_PauseServer,(void *)FALSE);
|
|
}
|
|
navigateBack();
|
|
break;
|
|
case BUTTON_PAUSE_LEADERBOARDS:
|
|
{
|
|
UINT uiIDA[1];
|
|
uiIDA[0]=IDS_OK;
|
|
|
|
//4J Gordon: Being used for the leaderboards proper now
|
|
// guests can't look at leaderboards
|
|
if(ProfileManager.IsGuest(m_iPad))
|
|
{
|
|
ui.RequestAlertMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad());
|
|
}
|
|
else if(!ProfileManager.IsSignedInLive(m_iPad))
|
|
{
|
|
UINT uiIDA[1] = { IDS_OK };
|
|
ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, m_iPad);
|
|
}
|
|
else
|
|
{
|
|
bool bContentRestricted=false;
|
|
|
|
if(!bContentRestricted)
|
|
ui.NavigateToScene(m_iPad, eUIScene_LeaderboardsMenu);
|
|
}
|
|
}
|
|
break;
|
|
case BUTTON_PAUSE_HELPANDOPTIONS:
|
|
ui.NavigateToScene(m_iPad,eUIScene_HelpAndOptionsMenu);
|
|
break;
|
|
case BUTTON_PAUSE_SAVEGAME:
|
|
PerformActionSaveGame();
|
|
break;
|
|
case BUTTON_PAUSE_EXITGAME:
|
|
{
|
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
|
// Check if it's the trial version
|
|
if(ProfileManager.IsFullVersion())
|
|
{
|
|
UINT uiIDA[3];
|
|
|
|
// is it the primary player exiting?
|
|
if(m_iPad==ProfileManager.GetPrimaryPad())
|
|
{
|
|
int playTime = -1;
|
|
if( pMinecraft->localplayers[m_iPad] != nullptr )
|
|
{
|
|
playTime = static_cast<int>(pMinecraft->localplayers[m_iPad]->getSessionTimer());
|
|
}
|
|
|
|
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
|
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
|
uiIDA[1]=IDS_CONFIRM_OK;
|
|
|
|
if(g_NetworkManager.IsHost() && StorageManager.GetSaveDisabled())
|
|
{
|
|
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 if(g_NetworkManager.IsHost() && g_NetworkManager.GetPlayerCount()>1)
|
|
{
|
|
ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned, (LPVOID)GetCallbackUniqueId());
|
|
}
|
|
else
|
|
{
|
|
ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned, (LPVOID)GetCallbackUniqueId());
|
|
}
|
|
#else
|
|
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());
|
|
}
|
|
}
|
|
#endif
|
|
}
|
|
else
|
|
{
|
|
int playTime = -1;
|
|
if( pMinecraft->localplayers[m_iPad] != nullptr )
|
|
{
|
|
playTime = static_cast<int>(pMinecraft->localplayers[m_iPad]->getSessionTimer());
|
|
}
|
|
|
|
TelemetryManager->RecordLevelExit(m_iPad, eSen_LevelExitStatus_Exited);
|
|
|
|
|
|
// just exit the player
|
|
app.SetAction(m_iPad,eAppAction_ExitPlayer);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// is it the primary player exiting?
|
|
if(m_iPad==ProfileManager.GetPrimaryPad())
|
|
{
|
|
int playTime = -1;
|
|
if( pMinecraft->localplayers[m_iPad] != nullptr )
|
|
{
|
|
playTime = static_cast<int>(pMinecraft->localplayers[m_iPad]->getSessionTimer());
|
|
}
|
|
|
|
// adjust the trial time played
|
|
ui.ReduceTrialTimerValue();
|
|
|
|
// exit the level
|
|
UINT uiIDA[2];
|
|
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
|
|
{
|
|
int playTime = -1;
|
|
if( pMinecraft->localplayers[m_iPad] != nullptr )
|
|
{
|
|
playTime = static_cast<int>(pMinecraft->localplayers[m_iPad]->getSessionTimer());
|
|
}
|
|
|
|
TelemetryManager->RecordLevelExit(m_iPad, eSen_LevelExitStatus_Exited);
|
|
|
|
// just exit the player
|
|
app.SetAction(m_iPad,eAppAction_ExitPlayer);
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
void UIScene_PauseMenu::PerformActionSaveGame()
|
|
{
|
|
// 4J-PB - Is the player trying to save but they are using a trial texturepack ?
|
|
if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin())
|
|
{
|
|
TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected();
|
|
DLCTexturePack *pDLCTexPack=static_cast<DLCTexturePack *>(tPack);
|
|
|
|
m_pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack();
|
|
|
|
if(!m_pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" ))
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
m_bTrialTexturePack = false;
|
|
}
|
|
}
|
|
|
|
// does the save exist?
|
|
bool bSaveExists;
|
|
C4JStorage::ESaveGameState result=StorageManager.DoesSaveExist(&bSaveExists);
|
|
|
|
#ifdef _XBOX
|
|
if(result == C4JStorage::ELoadGame_DeviceRemoved)
|
|
{
|
|
// this will be a tester trying to be clever
|
|
UINT uiIDA[2];
|
|
uiIDA[0]=IDS_SELECTANEWDEVICE;
|
|
uiIDA[1]=IDS_NODEVICE_DECLINE;
|
|
|
|
ui.RequestAlertMessage(IDS_STORAGEDEVICEPROBLEM_TITLE, IDS_FAILED_TO_LOADSAVE_TEXT, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::DeviceRemovedDialogReturned,(LPVOID)GetCallbackUniqueId());
|
|
}
|
|
else
|
|
#endif
|
|
{
|
|
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
|
if(!m_savesDisabled)
|
|
{
|
|
UINT uiIDA[2];
|
|
uiIDA[0]=IDS_CANCEL;
|
|
uiIDA[1]=IDS_CONFIRM_OK;
|
|
ui.RequestAlertMessage(IDS_TITLE_DISABLE_AUTOSAVE, IDS_CONFIRM_DISABLE_AUTOSAVE, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::DisableAutosaveDialogReturned,(LPVOID)GetCallbackUniqueId());
|
|
}
|
|
else
|
|
#endif
|
|
// we need to ask if they are sure they want to overwrite the existing game
|
|
if(bSaveExists)
|
|
{
|
|
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 defined(_XBOX_ONE) || defined(__ORBIS__)
|
|
UINT uiIDA[2];
|
|
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
|
uiIDA[1]=IDS_CONFIRM_OK;
|
|
ui.RequestAlertMessage(IDS_TITLE_ENABLE_AUTOSAVE, IDS_CONFIRM_ENABLE_AUTOSAVE, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::EnableAutosaveDialogReturned,(LPVOID)GetCallbackUniqueId());
|
|
#else
|
|
// flag a app action of save game
|
|
app.SetAction(m_iPad,eAppAction_SaveGame);
|
|
#endif
|
|
}
|
|
}
|
|
}
|
|
|
|
void UIScene_PauseMenu::ShowScene(bool show)
|
|
{
|
|
app.DebugPrintf("UIScene_PauseMenu::ShowScene is not implemented\n");
|
|
}
|
|
|
|
void UIScene_PauseMenu::HandleDLCInstalled()
|
|
{
|
|
// mounted DLC may have changed
|
|
if(app.StartInstallDLCProcess(m_iPad)==false)
|
|
{
|
|
// not doing a mount, so re-enable input
|
|
//m_bIgnoreInput=false;
|
|
app.DebugPrintf("UIScene_PauseMenu::HandleDLCInstalled - m_bIgnoreInput false\n");
|
|
}
|
|
else
|
|
{
|
|
// 4J-PB - Somehow, on th edisc build, we get in here, but don't call HandleDLCMountingComplete, so input locks up
|
|
//m_bIgnoreInput=true;
|
|
app.DebugPrintf("UIScene_PauseMenu::HandleDLCInstalled - m_bIgnoreInput true\n");
|
|
}
|
|
// this will send a CustomMessage_DLCMountingComplete when done
|
|
}
|
|
|
|
|
|
void UIScene_PauseMenu::HandleDLCMountingComplete()
|
|
{
|
|
// check if we should display the save option
|
|
|
|
//m_bIgnoreInput=false;
|
|
app.DebugPrintf("UIScene_PauseMenu::HandleDLCMountingComplete - m_bIgnoreInput false \n");
|
|
|
|
// if(ProfileManager.IsFullVersion())
|
|
// {
|
|
// bool bIsisPrimaryHost=g_NetworkManager.IsHost() && (ProfileManager.GetPrimaryPad()==m_iPad);
|
|
//
|
|
// if(bIsisPrimaryHost)
|
|
// {
|
|
// m_buttons[BUTTON_PAUSE_SAVEGAME].setEnable(true);
|
|
// }
|
|
// }
|
|
}
|
|
|
|
int UIScene_PauseMenu::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
|
{
|
|
Minecraft *pMinecraft=Minecraft::GetInstance();
|
|
|
|
if(result==C4JStorage::EMessage_ResultAccept)
|
|
{
|
|
if(ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad()))
|
|
{
|
|
// 4J-PB - need to check this user can access the store
|
|
#if defined(__PS3__) || defined(__PSVITA__)
|
|
bool bContentRestricted;
|
|
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr);
|
|
if(bContentRestricted)
|
|
{
|
|
UINT uiIDA[1];
|
|
uiIDA[0]=IDS_CONFIRM_OK;
|
|
ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad());
|
|
}
|
|
else
|
|
#endif
|
|
{
|
|
ProfileManager.DisplayFullVersionPurchase(false,pMinecraft->player->GetXboxPad(),eSen_UpsellID_Full_Version_Of_Game);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//SentientManager.RecordUpsellResponded(iPad, eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID, eSen_UpsellOutcome_Declined);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int UIScene_PauseMenu::SaveGame_SignInReturned(void *pParam,bool bContinue, int iPad)
|
|
{
|
|
UIScene_PauseMenu* pClass = static_cast<UIScene_PauseMenu *>(ui.GetSceneFromCallbackId((size_t)pParam));
|
|
if(pClass) pClass->SetIgnoreInput(false);
|
|
|
|
if(bContinue==true)
|
|
{
|
|
if(pClass) pClass->PerformActionSaveGame();
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
#ifdef _XBOX_ONE
|
|
int UIScene_PauseMenu::BanGameDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
|
{
|
|
// results switched for this dialog
|
|
if(result==C4JStorage::EMessage_ResultDecline)
|
|
{
|
|
app.SetAction(iPad,eAppAction_BanLevel);
|
|
}
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
void UIScene_PauseMenu::SetIgnoreInput(bool ignoreInput)
|
|
{
|
|
m_bIgnoreInput = ignoreInput;
|
|
} |