void CUIManager::Init() { CHUDEventDispatcher::SetUpEventListener(); SHUDEvent::InitDataStack(); m_pWarningManager = new CWarningsManager(); m_pOptions = new CProfileOptions(); m_pScreenLayoutMan = new ScreenLayoutManager(); m_p2DRendUtils = new C2DRenderUtils(m_pScreenLayoutMan); m_pHudSilhouettes = new CHUDSilhouettes(); m_pCVars = new CUICVars(); m_pMOSystem = new CHUDMissionObjectiveSystem(); m_pCVars->RegisterConsoleCommandsAndVars(); IUIEventSystemFactory* pFactory = IUIEventSystemFactory::GetFirst(); while (pFactory) { TUIEventSystemPtr pGameEvent = pFactory->Create(); CRY_ASSERT_MESSAGE(pGameEvent != NULL, "Invalid IUIEventSystemFactory!"); const char* name = pGameEvent->GetTypeName(); TUIEventSystems::const_iterator it = m_EventSystems.find(name); if(it == m_EventSystems.end()) { m_EventSystems[name] = pGameEvent; } else { string str; str.Format("IUIGameEventSystem \"%s\" already exists!", name); CRY_ASSERT_MESSAGE(false, str.c_str()); } pFactory = pFactory->GetNext(); } TUIEventSystems::const_iterator it = m_EventSystems.begin(); TUIEventSystems::const_iterator end = m_EventSystems.end(); for (;it != end; ++it) { it->second->InitEventSystem(); } InitSound(); gEnv->pSystem->GetISystemEventDispatcher()->RegisterListener( this ); g_pGame->GetIGameFramework()->RegisterListener(this, "CUIManager", FRAMEWORKLISTENERPRIORITY_HUD); m_bRegistered = true; }
///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////// CTor/DTor /////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// CUIManager::CUIManager() : m_bPickupMsgVisible(false) { IUIEventSystemFactory *pFactory = IUIEventSystemFactory::GetFirst(); while(pFactory) { IUIGameEventSystem *pGameEvent = pFactory->Create(); CRY_ASSERT_MESSAGE(pGameEvent, "Invalid IUIEventSystemFactory!"); const char *name = pGameEvent->GetTypeName(); TUIEventSystems::const_iterator it = m_EventSystems.find(name); if(it == m_EventSystems.end()) { m_EventSystems[name] = pGameEvent; } else { string str; str.Format("IUIGameEventSystem \"%s\" already exists!", name); CRY_ASSERT_MESSAGE(false, str.c_str()); SAFE_DELETE(pGameEvent); } pFactory = pFactory->GetNext(); } TUIEventSystems::const_iterator it = m_EventSystems.begin(); TUIEventSystems::const_iterator end = m_EventSystems.end(); for(; it != end; ++it) { it->second->InitEventSystem(); } m_soundListener = gEnv->pSoundSystem->CreateListener(); InitSound(); gEnv->pSystem->GetISystemEventDispatcher()->RegisterListener(this); LoadProfile(); }