comparison GUI/UI/UIRest.cpp @ 2544:c674d547cc7c

GUIWindow switch logic refactored into behaviour classes
author a.parshin
date Mon, 11 May 2015 09:51:04 +0200
parents b6140dfeac27
children e06a3fe9ad6e
comparison
equal deleted inserted replaced
2543:b6140dfeac27 2544:c674d547cc7c
28 current_screen_type = SCREEN_GAME; 28 current_screen_type = SCREEN_GAME;
29 viewparams->bRedrawGameUI = true; 29 viewparams->bRedrawGameUI = true;
30 } 30 }
31 pEventTimer->Pause(); 31 pEventTimer->Pause();
32 if (_506F14_resting_stage != 2) 32 if (_506F14_resting_stage != 2)
33 GUIWindow::Create(518, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_Rest, 0); 33 new OnButtonClick2(518, 450, 0, 0, (int)pBtn_Rest, 0);
34 _506F18_num_minutes_to_sleep = 0; 34 _506F18_num_minutes_to_sleep = 0;
35 _506F14_resting_stage = 0; 35 _506F14_resting_stage = 0;
36 uRestUI_FoodRequiredToRest = 2; 36 uRestUI_FoodRequiredToRest = 2;
37 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) 37 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
38 uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); 38 uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
70 uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE); 70 uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE);
71 uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE); 71 uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE);
72 72
73 OutdoorLocation::LoadActualSkyFrame(); 73 OutdoorLocation::LoadActualSkyFrame();
74 74
75 auto wnd = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Rest, 0, 0); 75 auto wnd = new GUIWindow_Rest(0, 0, window->GetWidth(), window->GetHeight(), 0, 0);
76 pButton_RestUI_Exit = wnd->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0); 76 pButton_RestUI_Exit = wnd->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0);
77 pButton_RestUI_Main = wnd->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 'R', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0); 77 pButton_RestUI_Main = wnd->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 'R', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0);
78 pButton_RestUI_WaitUntilDawn = wnd->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 'D', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0); 78 pButton_RestUI_WaitUntilDawn = wnd->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 'D', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0);
79 pButton_RestUI_Wait1Hour = wnd->CreateButton( 61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour, 0, 'H', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb2), 0); 79 pButton_RestUI_Wait1Hour = wnd->CreateButton( 61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour, 0, 'H', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb2), 0);
80 pButton_RestUI_Wait5Minutes = wnd->CreateButton( 61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes, 0, 'M', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb3), 0); 80 pButton_RestUI_Wait5Minutes = wnd->CreateButton( 61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes, 0, 'M', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb3), 0);
168 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193)); 168 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193));
169 if ( _506F14_resting_stage ) 169 if ( _506F14_resting_stage )
170 Party::Sleep6Hours(); 170 Party::Sleep6Hours();
171 } 171 }
172 else 172 else
173 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, 173 new OnCancel(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]); // "Exit Rest"
174 (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]); // "Exit Rest"
175 } 174 }