mirror of
https://github.com/ApfelTeeSaft/PlanetFleet.git
synced 2026-08-26 19:33:38 +00:00
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
#include "mapListbox.h"
|
|
#include "map.h"
|
|
#include "concreteGuiManager.h"
|
|
#include "gameManager.h"
|
|
|
|
#include <solUtil.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;
|
|
using namespace gameBase;
|
|
|
|
MapListbox::MapListbox(Vector3 pos, Vector2 size, std::vector<string> &lines, int maxDisplay, bool adg, string fontPath, bool closeable) :
|
|
Listbox(pos, size, lines, maxDisplay, fontPath, closeable),
|
|
addPlayerGui(adg) {
|
|
}
|
|
|
|
void MapListbox::onClose(){
|
|
if(addPlayerGui){
|
|
ConcreteGuiManager *guiManager = ConcreteGuiManager::getSingleton();
|
|
|
|
for(Listbox *listbox : cpuPlayerListboxes)
|
|
guiManager->removeListbox(listbox);
|
|
|
|
cpuPlayerListboxes.clear();
|
|
|
|
string mapName = wstringToString(getContents()[getSelectedOption()]);
|
|
int numSpawnPoints = Map::getSingleton()->getNumMapSpawnPoints(mapName);
|
|
sol::state_view SOL_LUA_VIEW = generateView();
|
|
|
|
for(int i = 0; i < numSpawnPoints; i++){
|
|
SOL_LUA_VIEW.script("lineId = " + to_string(i));
|
|
guiManager->parseLuaScript("playerSelection.lua");
|
|
|
|
std::vector<Listbox*> listboxes = guiManager->getListboxes();
|
|
cpuPlayerListboxes.push_back(listboxes[listboxes.size() - 1]);
|
|
}
|
|
}
|
|
}
|
|
}
|