menus::add_packs
This commit is contained in:
parent
9a0e8f4540
commit
0863e40b3b
@ -53,10 +53,10 @@ namespace menus {
|
|||||||
std::vector<std::string> packs
|
std::vector<std::string> packs
|
||||||
);
|
);
|
||||||
|
|
||||||
void add_pack_to_world(
|
void add_packs(
|
||||||
const ContentPack& pack,
|
|
||||||
Engine* engine,
|
Engine* engine,
|
||||||
LevelController* controller
|
LevelController* controller,
|
||||||
|
std::vector<std::string> packs
|
||||||
);
|
);
|
||||||
|
|
||||||
/// @brief Create development version label at the top-right screen corner
|
/// @brief Create development version label at the top-right screen corner
|
||||||
|
|||||||
@ -164,16 +164,18 @@ void menus::remove_packs(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void menus::add_pack_to_world(
|
void menus::add_packs(
|
||||||
const ContentPack& pack,
|
|
||||||
Engine* engine,
|
Engine* engine,
|
||||||
LevelController* controller
|
LevelController* controller,
|
||||||
|
std::vector<std::string> packs
|
||||||
) {
|
) {
|
||||||
auto level = controller->getLevel();
|
auto level = controller->getLevel();
|
||||||
auto gui = engine->getGUI();
|
auto gui = engine->getGUI();
|
||||||
auto world = level->getWorld();
|
auto world = level->getWorld();
|
||||||
auto new_packs = PacksManager::getNames(world->getPacks());
|
auto new_packs = PacksManager::getNames(world->getPacks());
|
||||||
new_packs.push_back(pack.id);
|
for (auto& id : packs) {
|
||||||
|
new_packs.push_back(id);
|
||||||
|
}
|
||||||
|
|
||||||
auto manager = engine->createPacksManager(world->wfile->getFolder());
|
auto manager = engine->createPacksManager(world->wfile->getFolder());
|
||||||
manager.scan();
|
manager.scan();
|
||||||
@ -220,7 +222,7 @@ void create_content_panel(Engine* engine, LevelController* controller) {
|
|||||||
langs::get(L"Add", L"content"), glm::vec4(10.0f), glm::vec4(1), [=](GUI* gui) {
|
langs::get(L"Add", L"content"), glm::vec4(10.0f), glm::vec4(1), [=](GUI* gui) {
|
||||||
auto panel = menus::create_packs_panel(scanned, engine, true,
|
auto panel = menus::create_packs_panel(scanned, engine, true,
|
||||||
[=](const ContentPack& pack) {
|
[=](const ContentPack& pack) {
|
||||||
menus::add_pack_to_world(pack, engine, controller);
|
menus::add_packs(engine, controller, {pack.id});
|
||||||
}, nullptr);
|
}, nullptr);
|
||||||
menu->addPage("content-packs", panel);
|
menu->addPage("content-packs", panel);
|
||||||
menu->setPage("content-packs");
|
menu->setPage("content-packs");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user