mirror of
https://github.com/ApfelTeeSaft/PlanetFleet.git
synced 2026-08-26 19:33:38 +00:00
35 lines
1.3 KiB
C++
35 lines
1.3 KiB
C++
#include "mapListbox.h"
|
|
#include "map.h"
|
|
#include "concreteGuiManager.h"
|
|
#include "gameManager.h"
|
|
|
|
#include <button.h>
|
|
#include <checkbox.h>
|
|
#include <slider.h>
|
|
#include <textbox.h>
|
|
#include <node.h>
|
|
#include <text.h>
|
|
|
|
namespace battleship{
|
|
using namespace vb01;
|
|
using namespace vb01Gui;
|
|
using namespace std;
|
|
|
|
MapListbox::MapListbox(Vector2 pos, Vector2 size, std::vector<string> &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<Button*> buttons = guiManager->getButtons();
|
|
guiManager->readLuaScreenScript("playerSelection.lua", buttons, vector<Listbox*>{mapListbox}, vector<Checkbox*>{}, vector<Slider*>{}, vector<Textbox*>{}, vector<Node*>{}, vector<Text*>{}, numSpawnPoints);
|
|
}
|
|
}
|