Skip to content

Commit

Permalink
CLIENT-MENU: Modif now text button can reappeared even if the scene i…
Browse files Browse the repository at this point in the history
…s changed

MINOR
  • Loading branch information
KitetsuK committed Nov 5, 2023
1 parent a8b12ff commit c9c32c0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Client/Systems/Menus/Menu/ButtonCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,15 @@ namespace Menu {
Scene::SceneManager::getInstance().stop();
}

static const std::size_t MAX_TEXT_OF_SCENE = 9;

void createServer()
{
auto arrInputBox = Registry::getInstance().getComponents<Types::InputBox>();
auto idsText = Registry::getInstance().getEntitiesByComponents({typeid(Raylib::TextShared)});
auto ids = Registry::getInstance().getEntitiesByComponents({typeid(Types::InputBox)});
static bool isExist = false;

if (Nitwork::NitworkClient::getInstance().serverAlreadyCreated() && !isExist) {
if (Nitwork::NitworkClient::getInstance().serverAlreadyCreated() && idsText.size() < MAX_TEXT_OF_SCENE) {
try {
nlohmann::json jsonData = Json::getInstance().getDataByJsonType<nlohmann::json>(
ResourcesManager::getPathByJsonType(JsonType::CREATE_SERVER),
Expand All @@ -204,7 +206,6 @@ namespace Menu {
} catch (std::runtime_error &err) {
Logger::warn(err.what());
}
isExist = true;
return;
}
for (auto id : ids) {
Expand Down

0 comments on commit c9c32c0

Please sign in to comment.