void ScriptSystemScene::Initialize() { m_masterState->Initialize(); AnyType::AnyTypeMap results = m_serviceManager->MessageAll(System::Messages::RegisterScriptFunctions, AnyType::AnyTypeMap()); for(AnyType::AnyTypeMap::iterator i = results.begin(); i != results.end(); ++i) { m_masterState->RegisterTypes((*i).second.As<scope>()); } m_masterState->RegisterTypes(SystemFacade::RegisterFunctions()); m_masterState->RegisterTypes(SoundFacade::RegisterFunctions()); m_masterState->RegisterTypes(InstrumentationFacade::RegisterFunctions()); m_masterState->RegisterTypes(AnimationFacade::RegisterFunctions()); m_masterState->RegisterTypes(NetworkFacade::RegisterFunctions()); m_masterState->RegisterTypes(InputFacade::RegisterFunctions()); m_masterState->RegisterTypes(PhysicsFacade::RegisterFunctions()); m_scriptConfiguration = new ScriptConfiguration(m_configuration); if (typeid(*m_masterState) == typeid(LuaState)) { static_cast<LuaState*>(m_masterState)->SetGlobal("Configuration", m_scriptConfiguration); } }
AnyType::AnyTypeMap ServiceManager::MessageAll(const System::MessageType& message, AnyType::AnyTypeMap parameters) { AnyType::AnyTypeMap results; for(IService::ServiceList::const_iterator i = m_services.begin(); i != m_services.end(); ++i) { AnyType::AnyTypeMap serviceResults = (*i)->ProcessMessage(message, parameters); for (AnyType::AnyTypeMap::iterator i = serviceResults.begin(); i != serviceResults.end(); ++i) { results.insert(*i); } } return results; }