#include "mapListbox.h" #include "map.h" #include "concreteGuiManager.h" #include "gameManager.h" #include #include #include #include #include #include namespace battleship{ using namespace vb01; using namespace vb01Gui; using namespace std; MapListbox::MapListbox(Vector2 pos, Vector2 size, std::vector &lines, int maxDisplay, string fontPath, bool closeable) : Listbox(pos, size, lines, maxDisplay, fontPath, closeable){} void MapListbox::onClose(){ ConcreteGuiManager *guiManager = ConcreteGuiManager::getSingleton(); Listbox *mapListbox = guiManager->getListboxes()[0]; int selectedMap = mapListbox->getSelectedOption(); string mapName = wstringToString(mapListbox->getContents()[selectedMap]); string mapPath = GameManager::getSingleton()->getPath() + "Models/Maps/" + mapName + "/" + mapName + ".lua"; int numSpawnPoints = Map::getNumSpawnPointsByMap(mapPath); guiManager->readLuaScreenScript("singlePlayerMenu.lua"); mapListbox = guiManager->getListboxes()[0]; vector buttons = guiManager->getButtons(); guiManager->readLuaScreenScript("playerSelection.lua", buttons, vector{mapListbox}, vector{}, vector{}, vector{}, vector{}, vector{}, numSpawnPoints); } }