@@ -33,9 +33,9 @@ namespace RTE {
33
33
GUICollectionBox *rootBox = dynamic_cast <GUICollectionBox *>(m_GUIControlManager->GetControl (" root" ));
34
34
rootBox->Resize (rootBoxMaxWidth, g_WindowMan.GetResY ());
35
35
36
- GUICollectionBox *saveGameMenuBox = dynamic_cast <GUICollectionBox *>(m_GUIControlManager->GetControl (" CollectionBoxSaveGameMenu" ));
37
- saveGameMenuBox ->CenterInParent (true , true );
38
- saveGameMenuBox ->SetPositionAbs (saveGameMenuBox ->GetXPos (), (rootBox->GetHeight () < 540 ) ? saveGameMenuBox ->GetYPos () - 15 : 140 );
36
+ m_SaveGameMenuBox = dynamic_cast <GUICollectionBox *>(m_GUIControlManager->GetControl (" CollectionBoxSaveGameMenu" ));
37
+ m_SaveGameMenuBox ->CenterInParent (true , true );
38
+ m_SaveGameMenuBox ->SetPositionAbs (m_SaveGameMenuBox ->GetXPos (), (rootBox->GetHeight () < 540 ) ? m_SaveGameMenuBox ->GetYPos () - 15 : 140 );
39
39
40
40
m_OrderByComboBox = dynamic_cast <GUIComboBox*>(m_GUIControlManager->GetControl (" ComboOrderBy" ));
41
41
m_OrderByComboBox->AddItem (" Name" );
@@ -49,7 +49,7 @@ namespace RTE {
49
49
m_BackToMainButton->SetSize (120 , 20 );
50
50
m_BackToMainButton->SetText (" Back to Pause Menu" );
51
51
}
52
- m_BackToMainButton->SetPositionAbs ((rootBox->GetWidth () - m_BackToMainButton->GetWidth ()) / 2 , saveGameMenuBox ->GetYPos () + saveGameMenuBox ->GetHeight () + 10 );
52
+ m_BackToMainButton->SetPositionAbs ((rootBox->GetWidth () - m_BackToMainButton->GetWidth ()) / 2 , m_SaveGameMenuBox ->GetYPos () + m_SaveGameMenuBox ->GetHeight () + 10 );
53
53
54
54
m_SaveGamesListBox = dynamic_cast <GUIListBox *>(m_GUIControlManager->GetControl (" ListBoxSaveGames" ));
55
55
m_SaveGamesListBox->SetFont (m_GUIControlManager->GetSkin ()->GetFont (" FontConsoleMonospace.png" ));
@@ -64,6 +64,15 @@ namespace RTE {
64
64
m_DeleteButton = dynamic_cast <GUIButton *>(m_GUIControlManager->GetControl (" ButtonDelete" ));
65
65
m_ActivityCannotBeSavedLabel = dynamic_cast <GUILabel *>(m_GUIControlManager->GetControl (" ActivityCannotBeSavedWarning" ));
66
66
67
+ m_ConfirmationBox = dynamic_cast <GUICollectionBox *>(m_GUIControlManager->GetControl (" ConfirmDialog" ));
68
+ m_ConfirmationBox->CenterInParent (true , true );
69
+
70
+ m_ConfirmationLabel = dynamic_cast <GUILabel *>(m_GUIControlManager->GetControl (" ConfirmLabel" ));
71
+ m_ConfirmationButton = dynamic_cast <GUIButton *>(m_GUIControlManager->GetControl (" ConfirmButton" ));
72
+ m_CancelButton = dynamic_cast <GUIButton *>(m_GUIControlManager->GetControl (" CancelButton" ));
73
+
74
+ SwitchToConfirmDialogMode (ConfirmDialogMode::None);
75
+
67
76
m_SaveGamesFetched = false ;
68
77
}
69
78
@@ -240,6 +249,27 @@ namespace RTE {
240
249
m_ActivityCannotBeSavedLabel->SetVisible (g_ActivityMan.GetActivity () && !g_ActivityMan.GetActivityAllowsSaving ());
241
250
}
242
251
252
+ // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
253
+
254
+ void SaveLoadMenuGUI::SwitchToConfirmDialogMode (ConfirmDialogMode mode)
255
+ {
256
+ m_ConfirmDialogMode = mode;
257
+
258
+ bool dialogOpen = m_ConfirmDialogMode != ConfirmDialogMode::None;
259
+ m_SaveGameMenuBox->SetEnabled (!dialogOpen);
260
+ m_ConfirmationBox->SetEnabled (dialogOpen);
261
+ m_ConfirmationBox->SetVisible (dialogOpen);
262
+
263
+ switch (m_ConfirmDialogMode) {
264
+ case ConfirmDialogMode::ConfirmOverwrite:
265
+ m_ConfirmationLabel->SetText (" Are you sure you want to overwrite this savegame?" );
266
+ break ;
267
+ case ConfirmDialogMode::ConfirmDelete:
268
+ m_ConfirmationLabel->SetText (" Are you sure you want to delete this savegame?" );
269
+ break ;
270
+ }
271
+ }
272
+
243
273
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
244
274
245
275
bool SaveLoadMenuGUI::HandleInputEvents (PauseMenuGUI *pauseMenu) {
@@ -263,10 +293,24 @@ namespace RTE {
263
293
}
264
294
return true ;
265
295
}
266
- } else if (guiEvent.GetControl () == m_CreateButton || guiEvent. GetControl () == m_OverwriteButton ) {
296
+ } else if (guiEvent.GetControl () == m_CreateButton) {
267
297
CreateSave ();
298
+ } else if (guiEvent.GetControl () == m_OverwriteButton) {
299
+ SwitchToConfirmDialogMode (ConfirmDialogMode::ConfirmOverwrite);
268
300
} else if (guiEvent.GetControl () == m_DeleteButton) {
269
- DeleteSave ();
301
+ SwitchToConfirmDialogMode (ConfirmDialogMode::ConfirmDelete);
302
+ } else if (guiEvent.GetControl () == m_ConfirmationButton) {
303
+ switch (m_ConfirmDialogMode) {
304
+ case ConfirmDialogMode::ConfirmOverwrite:
305
+ CreateSave ();
306
+ break ;
307
+ case ConfirmDialogMode::ConfirmDelete:
308
+ DeleteSave ();
309
+ break ;
310
+ }
311
+ SwitchToConfirmDialogMode (ConfirmDialogMode::None);
312
+ } else if (guiEvent.GetControl () == m_CancelButton) {
313
+ SwitchToConfirmDialogMode (ConfirmDialogMode::None);
270
314
}
271
315
} else if (guiEvent.GetType () == GUIEvent::Notification) {
272
316
if (guiEvent.GetMsg () == GUIButton::Focused && dynamic_cast <GUIButton *>(guiEvent.GetControl ())) {
0 commit comments