コード例 #1
0
ファイル: EntityScriptServer.cpp プロジェクト: ZappoMan/hifi
void EntityScriptServer::aboutToFinish() {
    shutdownScriptEngine();

    auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
    // our entity tree is going to go away so tell that to the EntityScriptingInterface
    entityScriptingInterface->setEntityTree(nullptr);

    // Should always be true as they are singletons.
    if (entityScriptingInterface->getPacketSender() == &_entityEditSender) {
        // The packet sender is about to go away.
        entityScriptingInterface->setPacketSender(nullptr);
    }

    DependencyManager::get<ResourceManager>()->cleanup();

    // cleanup the AudioInjectorManager (and any still running injectors)
    DependencyManager::destroy<AudioInjectorManager>();
    DependencyManager::destroy<ScriptEngines>();
    DependencyManager::destroy<EntityScriptServerServices>();

    // cleanup codec & encoder
    if (_codec && _encoder) {
        _codec->releaseEncoder(_encoder);
        _encoder = nullptr;
    }
}
コード例 #2
0
void ccPacketHandler::acknowledge()

{

    byte sender = getPacketSender(); /// save sender

    byte receiver = getPacketReceiver(); /// save receiver

    byte ulf = ccHash(); /// hash the data

    clearPacket(); /// clear the packet

    setReceiver(sender); /// set sender as receiver

    setSender(receiver); /// set receiver as sender

    setAdminKey(ACKNOWLEDGE_REQUEST); /// set acknowlegde key

    setPackNum(ulf); /// set the hash as data

}
コード例 #3
0
ファイル: EntityScriptServer.cpp プロジェクト: birarda/hifi
void EntityScriptServer::shutdownScriptEngine() {
    if (_entitiesScriptEngine) {
        _entitiesScriptEngine->disconnectNonEssentialSignals(); // disconnect all slots/signals from the script engine, except essential
    }
    _shuttingDown = true;

    clear(); // always clear() on shutdown

    auto scriptEngines = DependencyManager::get<ScriptEngines>();
    scriptEngines->shutdownScripting();

    _entitiesScriptEngine.clear();

    auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
    // our entity tree is going to go away so tell that to the EntityScriptingInterface
    entityScriptingInterface->setEntityTree(nullptr);

    // Should always be true as they are singletons.
    if (entityScriptingInterface->getPacketSender() == &_entityEditSender) {
        // The packet sender is about to go away.
        entityScriptingInterface->setPacketSender(nullptr);
    }
}