//------------------------------------------------------------------------------------- void Space::onLoadedSpaceGeometryMapping(NavigationHandlePtr pNavHandle) { pNavHandle_ = pNavHandle; INFO_MSG(fmt::format("KBEngine::onLoadedSpaceGeometryMapping: spaceID={}, respath={}!\n", id(), getGeometryPath())); // 通知脚本 SCRIPT_OBJECT_CALL_ARGS2(Cellapp::getSingleton().getEntryScript().get(), const_cast<char*>("onSpaceGeometryLoaded"), const_cast<char*>("Is"), this->id(), getGeometryPath().c_str()); onAllSpaceGeometryLoaded(); }
//------------------------------------------------------------------------------------- void Space::onAllSpaceGeometryLoaded() { // 通知脚本 SCRIPT_OBJECT_CALL_ARGS3(Cellapp::getSingleton().getEntryScript().get(), const_cast<char*>("onAllSpaceGeometryLoaded"), const_cast<char*>("Iis"), this->getID(), true, getGeometryPath().c_str()); SPACE_ENTITIES::iterator iter = entities_.begin(); for(; iter != entities_.end(); iter++) { pNavHandle_->onEnterObject(iter->get()->layer(), iter->get()->getID(), iter->get()->getPosition()); } }
//------------------------------------------------------------------------------------- bool Space::addSpaceGeometryMapping(std::string respath, bool shouldLoadOnServer) { INFO_MSG(fmt::format("KBEngine::addSpaceGeometryMapping: spaceID={}, respath={}, shouldLoadOnServer={}!\n", id(), respath, shouldLoadOnServer)); hasGeometry_ = true; if(getGeometryPath() == respath) { WARNING_MSG(fmt::format("KBEngine::addSpaceGeometryMapping: spaceID={}, respath={} is exist!\n", id(), respath)); return true; } setGeometryPath(respath); if(shouldLoadOnServer) loadSpaceGeometry(); return true; }
//------------------------------------------------------------------------------------- bool Space::addSpaceGeometryMapping(std::string respath, bool shouldLoadOnServer) { INFO_MSG(boost::format("KBEngine::addSpaceGeometryMapping: spaceID=%1%, respath=%2%, shouldLoadOnServer=%3%!\n") % getID() % respath % shouldLoadOnServer); hasGeometry_ = true; if(getGeometryPath() == respath) { WARNING_MSG(boost::format("KBEngine::addSpaceGeometryMapping: spaceID=%1%, respath=%2% is exist!\n") % getID() % respath); return true; } setGeometryPath(respath); if(shouldLoadOnServer) loadSpaceGeometry(); return true; }
//------------------------------------------------------------------------------------- void Space::onAllSpaceGeometryLoaded() { // 通知脚本 SCRIPT_OBJECT_CALL_ARGS3(Cellapp::getSingleton().getEntryScript().get(), const_cast<char*>("onAllSpaceGeometryLoaded"), const_cast<char*>("Iis"), this->id(), true, getGeometryPath().c_str()); }
//------------------------------------------------------------------------------------- void Space::loadSpaceGeometry() { KBE_ASSERT(pNavHandle_ == NULL); Cellapp::getSingleton().threadPool().addTask(new LoadNavmeshTask(getGeometryPath(), this->id())); }