| 82 | } |
| 83 | |
| 84 | void MenuModeLoad::activate() |
| 85 | { |
| 86 | // Loads the corresponding Gui sheet. |
| 87 | getModeManager().getGui().loadGuiSheet(Gui::guiSheet::loadSavedGameMenu); |
| 88 | |
| 89 | giveFocus(); |
| 90 | |
| 91 | // Play the main menu music |
| 92 | MusicPlayer::getSingleton().play(ConfigManager::getSingleton().getMainMenuMusic()); |
| 93 | |
| 94 | |
| 95 | GameMap* gameMap = ODFrameListener::getSingleton().getClientGameMap(); |
| 96 | gameMap->clearAll(); |
| 97 | gameMap->setGamePaused(true); |
| 98 | |
| 99 | CEGUI::Window* tmpWin = getModeManager().getGui().getGuiSheet(Gui::loadSavedGameMenu)->getChild("LevelWindowFrame/SaveGameSelect"); |
| 100 | CEGUI::Listbox* levelSelectList = static_cast<CEGUI::Listbox*>(tmpWin); |
| 101 | |
| 102 | tmpWin = getModeManager().getGui().getGuiSheet(Gui::loadSavedGameMenu)->getChild("LoadingText"); |
| 103 | tmpWin->hide(); |
| 104 | mFilesList.clear(); |
| 105 | levelSelectList->resetList(); |
| 106 | |
| 107 | std::string levelPath = ResourceManager::getSingleton().getSaveGamePath(); |
| 108 | if(Helper::fillFilesList(levelPath, mFilesList, SAVEGAME_EXTENSION)) |
| 109 | { |
| 110 | for (uint32_t n = 0; n < mFilesList.size(); ++n) |
| 111 | { |
| 112 | std::string filename = boost::filesystem::path(mFilesList[n]).filename().string(); |
| 113 | CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem(filename); |
| 114 | item->setID(n); |
| 115 | item->setSelectionBrushImage("OpenDungeonsSkin/SelectionBrush"); |
| 116 | levelSelectList->addItem(item); |
| 117 | } |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | bool MenuModeLoad::launchSelectedButtonPressed(const CEGUI::EventArgs&) |
| 122 | { |
nothing calls this directly
no test coverage detected