the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 191 lines 5.5 kB view raw
1#include "stdafx.h" 2#include "UI.h" 3#include "UIScene_DeathMenu.h" 4#include "IUIScene_PauseMenu.h" 5#include "..\..\Minecraft.h" 6#include "..\..\MultiplayerLocalPlayer.h" 7 8UIScene_DeathMenu::UIScene_DeathMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) 9{ 10 // Setup all the Iggy references we need for this scene 11 initialiseMovie(); 12 13 m_buttonRespawn.init(app.GetString(IDS_RESPAWN),eControl_Respawn); 14 m_buttonExitGame.init(app.GetString(IDS_EXIT_GAME),eControl_ExitGame); 15 16 m_labelTitle.setLabel(app.GetString(IDS_YOU_DIED)); 17 18 m_bIgnoreInput = false; 19 20 Minecraft *pMinecraft = Minecraft::GetInstance(); 21 if(pMinecraft != NULL && pMinecraft->localgameModes[iPad] != NULL ) 22 { 23 TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; 24 25 // This just allows it to be shown 26 gameMode->getTutorial()->showTutorialPopup(false); 27 } 28} 29 30UIScene_DeathMenu::~UIScene_DeathMenu() 31{ 32 Minecraft *pMinecraft = Minecraft::GetInstance(); 33 if(pMinecraft != NULL && pMinecraft->localgameModes[m_iPad] != NULL ) 34 { 35 TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; 36 37 // This just allows it to be shown 38 gameMode->getTutorial()->showTutorialPopup(true); 39 } 40} 41 42wstring UIScene_DeathMenu::getMoviePath() 43{ 44 if(app.GetLocalPlayerCount() > 1) 45 { 46 return L"DeathMenuSplit"; 47 } 48 else 49 { 50 return L"DeathMenu"; 51 } 52} 53 54void UIScene_DeathMenu::updateTooltips() 55{ 56 ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT); 57} 58 59void UIScene_DeathMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) 60{ 61 if(m_bIgnoreInput) return; 62 63 ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released); 64 65 switch(key) 66 { 67 case ACTION_MENU_CANCEL: 68 handled = true; 69 break; 70 case ACTION_MENU_OK: 71#ifdef __ORBIS__ 72 case ACTION_MENU_TOUCHPAD_PRESS: 73#endif 74 case ACTION_MENU_UP: 75 case ACTION_MENU_DOWN: 76 sendInputToMovie(key, repeat, pressed, released); 77 handled = true; 78 break; 79 } 80} 81 82void UIScene_DeathMenu::handlePress(F64 controlId, F64 childId) 83{ 84 switch((int)controlId) 85 { 86 case eControl_Respawn: 87 m_bIgnoreInput = true; 88 app.SetAction(m_iPad,eAppAction_Respawn); 89#ifdef _DURANGO 90 //InputManager.SetEnabledGtcButtons(_360_GTC_MENU|_360_GTC_PAUSE|_360_GTC_VIEW); 91#endif 92 break; 93 case eControl_ExitGame: 94 { 95 Minecraft *pMinecraft=Minecraft::GetInstance(); 96 // 4J-PB - fix for #8333 - BLOCKER: If player decides to exit game, then cancels the exit player becomes stuck at game over screen 97 //m_bIgnoreInput = true; 98 // Check if it's the trial version 99 if(ProfileManager.IsFullVersion()) 100 { 101 102 // is it the primary player exiting? 103 if(m_iPad==ProfileManager.GetPrimaryPad()) 104 { 105 UINT uiIDA[3]; 106 int playTime = -1; 107 if( pMinecraft->localplayers[m_iPad] != NULL ) 108 { 109 playTime = (int)pMinecraft->localplayers[m_iPad]->getSessionTimer(); 110 } 111 TelemetryManager->RecordLevelExit(m_iPad, eSen_LevelExitStatus_Failed); 112 113#if defined (_XBOX_ONE) || defined(__ORBIS__) 114 if(g_NetworkManager.IsHost() && StorageManager.GetSaveDisabled()) 115 { 116 uiIDA[0]=IDS_CONFIRM_CANCEL; 117 uiIDA[1]=IDS_EXIT_GAME_SAVE; 118 uiIDA[2]=IDS_EXIT_GAME_NO_SAVE; 119 120 ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, m_iPad,&IUIScene_PauseMenu::ExitGameSaveDialogReturned,(LPVOID)GetCallbackUniqueId()); 121 } 122 else 123 { 124 uiIDA[0]=IDS_CONFIRM_CANCEL; 125 uiIDA[1]=IDS_CONFIRM_OK; 126 ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned,(LPVOID)GetCallbackUniqueId()); 127 } 128 129#else 130 if(StorageManager.GetSaveDisabled()) 131 { 132 uiIDA[0]=IDS_CONFIRM_CANCEL; 133 uiIDA[1]=IDS_CONFIRM_OK; 134 ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_PROGRESS_LOST, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned,(LPVOID)GetCallbackUniqueId()); 135 } 136 else 137 { 138 if( g_NetworkManager.IsHost() ) 139 { 140 uiIDA[0]=IDS_CONFIRM_CANCEL; 141 uiIDA[1]=IDS_EXIT_GAME_SAVE; 142 uiIDA[2]=IDS_EXIT_GAME_NO_SAVE; 143 144 ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, m_iPad,&IUIScene_PauseMenu::ExitGameSaveDialogReturned,(LPVOID)GetCallbackUniqueId()); 145 } 146 else 147 { 148 uiIDA[0]=IDS_CONFIRM_CANCEL; 149 uiIDA[1]=IDS_CONFIRM_OK; 150 151 ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned,(LPVOID)GetCallbackUniqueId()); 152 } 153 } 154#endif 155 } 156 else 157 { 158 TelemetryManager->RecordLevelExit(m_iPad, eSen_LevelExitStatus_Failed); 159 160 // just exit the player 161 app.SetAction(m_iPad,eAppAction_ExitPlayer); 162 } 163 } 164 else 165 { 166 // is it the primary player exiting? 167 if(m_iPad==ProfileManager.GetPrimaryPad()) 168 { 169 TelemetryManager->RecordLevelExit(m_iPad, eSen_LevelExitStatus_Failed); 170 171 // adjust the trial time played 172 ui.ReduceTrialTimerValue(); 173 174 // exit the level 175 UINT uiIDA[2]; 176 uiIDA[0]=IDS_CONFIRM_CANCEL; 177 uiIDA[1]=IDS_CONFIRM_OK; 178 ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_PROGRESS_LOST, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned,(LPVOID)GetCallbackUniqueId()); 179 } 180 else 181 { 182 TelemetryManager->RecordLevelExit(m_iPad, eSen_LevelExitStatus_Failed); 183 184 // just exit the player 185 app.SetAction(m_iPad,eAppAction_ExitPlayer); 186 } 187 } 188 } 189 break; 190 } 191}