the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 188 lines 5.3 kB view raw
1#include "stdafx.h" 2#include "UI.h" 3#include "UIScene_SaveMessage.h" 4 5#define PROFILE_LOADED_TIMER_ID 0 6#define PROFILE_LOADED_TIMER_TIME 50 7 8UIScene_SaveMessage::UIScene_SaveMessage(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 parentLayer->addComponent(iPad,eUIComponent_Panorama); 14 parentLayer->addComponent(iPad,eUIComponent_Logo); 15 16 m_buttonConfirm.init(app.GetString(IDS_CONFIRM_OK),eControl_Confirm); 17 m_labelDescription.init(app.GetString(IDS_SAVE_ICON_MESSAGE)); 18 19 IggyDataValue result; 20 21 // Russian needs to resize the box 22 IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , NULL ); 23 24 // 4J-PB - If we have a signed in user connected, let's get the DLC now 25 for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) 26 { 27 if( (InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i)) ) 28 { 29 if(!app.DLCInstallProcessCompleted() && !app.DLCInstallPending()) 30 { 31 app.StartInstallDLCProcess(i); 32 break; 33 } 34 } 35 } 36 37 m_bIgnoreInput=false; 38 39 // 4J-TomK - rebuild touch after auto resize 40#ifdef __PSVITA__ 41 ui.TouchBoxRebuild(this); 42#endif 43} 44 45UIScene_SaveMessage::~UIScene_SaveMessage() 46{ 47 m_parentLayer->removeComponent(eUIComponent_Panorama); 48 m_parentLayer->removeComponent(eUIComponent_Logo); 49} 50 51wstring UIScene_SaveMessage::getMoviePath() 52{ 53 return L"SaveMessage"; 54} 55 56void UIScene_SaveMessage::updateTooltips() 57{ 58 ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT ); 59} 60 61void UIScene_SaveMessage::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) 62{ 63 if(m_bIgnoreInput) return; 64#if defined (__ORBIS__) || defined (__PSVITA__) 65 // ignore all players except player 0 - it's their profile that is currently being used 66 if(iPad!=0) return; 67#endif 68 69 ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released); 70 71 switch(key) 72 { 73 case ACTION_MENU_OK: 74#ifdef __ORBIS__ 75 case ACTION_MENU_TOUCHPAD_PRESS: 76#endif 77 sendInputToMovie(key, repeat, pressed, released); 78 break; 79 // #ifdef __PS3__ 80 // case ACTION_MENU_Y: 81 // if(pressed) 82 // { 83 // // language select - switch to Greek for now 84 // if(app.GetMinecraftLanguage(iPad)==MINECRAFT_LANGUAGE_DEFAULT) 85 // { 86 // app.SetMinecraftLanguage(iPad,MINECRAFT_LANGUAGE_GREEK); 87 // } 88 // else 89 // { 90 // app.SetMinecraftLanguage(iPad,MINECRAFT_LANGUAGE_DEFAULT); 91 // } 92 // // reload the string table 93 // ui.SetupFont(); 94 // app.loadStringTable(); 95 // handleReload(); 96 // } 97 // break; 98 // #endif 99 } 100} 101 102void UIScene_SaveMessage::handlePress(F64 controlId, F64 childId) 103{ 104 switch((int)controlId) 105 { 106 case eControl_Confirm: 107 108 //CD - Added for audio 109 ui.PlayUISFX(eSFX_Press); 110 111 m_bIgnoreInput=true; 112 113#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) 114 // wait for the profile to be read - this has been kicked off earlier, so should be read by now 115 addTimer(PROFILE_LOADED_TIMER_ID,PROFILE_LOADED_TIMER_TIME); 116#else 117 ui.NavigateToHomeMenu(); 118#endif 119 break; 120 }; 121} 122 123void UIScene_SaveMessage::handleTimerComplete(int id) 124{ 125 switch(id) 126 { 127 case PROFILE_LOADED_TIMER_ID: 128 { 129#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) 130 C4JStorage::eOptionsCallback eStatus=app.GetOptionsCallbackStatus(0); 131 132 switch(eStatus) 133 { 134 case C4JStorage::eOptions_Callback_Read: 135 case C4JStorage::eOptions_Callback_Read_FileNotFound: 136 case C4JStorage::eOptions_Callback_Read_Fail: 137#ifdef __PSVITA__ 138 case C4JStorage::eOptions_Callback_Write_Fail: 139 case C4JStorage::eOptions_Callback_Write: 140#endif 141 // set defaults - which has already been done 142 killTimer(PROFILE_LOADED_TIMER_ID); 143 ui.NavigateToHomeMenu(); 144 SQRNetworkManager::SafeToRespondToGameBootInvite(); 145 app.SetOptionsCallbackStatus(0,C4JStorage::eOptions_Callback_Idle); 146 break; 147 case C4JStorage::eOptions_Callback_Read_CorruptDeleted: 148 killTimer(PROFILE_LOADED_TIMER_ID); 149 ui.NavigateToHomeMenu(); 150 SQRNetworkManager::SafeToRespondToGameBootInvite(); 151 app.SetOptionsCallbackStatus(0,C4JStorage::eOptions_Callback_Idle); 152 break; 153 case C4JStorage::eOptions_Callback_Read_Corrupt: 154 // get the user to delete the options file 155 app.DebugPrintf("Corrupt options file\n"); 156 app.SetOptionsCallbackStatus(0,C4JStorage::eOptions_Callback_Read_CorruptDeletePending); 157 m_bIgnoreInput=false; 158 // give the option to delete the save 159 UINT uiIDA[2]; 160 uiIDA[0]=IDS_CORRUPT_OPTIONS_RETRY; 161 uiIDA[1]=IDS_CORRUPT_OPTIONS_DELETE; 162 ui.RequestErrorMessage(IDS_CORRUPT_FILE, IDS_CORRUPT_OPTIONS, uiIDA, 2, 0,&UIScene_SaveMessage::DeleteOptionsDialogReturned,this); 163 break; 164 } 165#endif 166 } 167 168 break; 169 } 170} 171 172#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) 173int UIScene_SaveMessage::DeleteOptionsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) 174{ 175 //UIScene_SaveMessage* pClass = (UIScene_SaveMessage*)pParam; 176 if(result == C4JStorage::EMessage_ResultAccept) 177 { 178 // retry loading the options file 179 StorageManager.ReadFromProfile(iPad); 180 } 181 else // result == EMessage_ResultDecline 182 { 183 // kick off the delete 184 StorageManager.DeleteOptionsData(iPad); 185 } 186 return 0; 187} 188#endif