Example #1
0
////////////////////////////////////////////////////////////////////////////
// functions that generate events for the UI 
////////////////////////////////////////////////////////////////////////////
void CUIObjectives::MissionObjectiveAdded( const string& objectiveID, int state )
{
	if ( gEnv->IsEditor() )
	{
		UpdateObjectiveInfo();
	}
	SMissionObjectiveInfo* pInfo = GetMissionObjectiveInfo( objectiveID );
	if ( pInfo )
	{
		m_eventSender.SendEvent<eUIOE_ObjectiveAdded>(objectiveID, pInfo->Name, pInfo->Desc, state);
	}
}
Example #2
0
void CUIObjectives::MissionObjectiveAdded( const string& objectiveID, int state )
{
	if ( gEnv->IsEditor() )
	{
		UpdateObjectiveInfo();
	}
	SMissionObjectiveInfo* pInfo = GetMissionObjectiveInfo( objectiveID );
	if ( pInfo )
	{
		SUIArguments args;
		args.AddArgument( objectiveID );
		args.AddArgument( pInfo->Name );
		args.AddArgument( pInfo->Desc );
		args.AddArgument( state );
		NotifyUI( eUIOE_ObjectiveAdded, args );
	}
}
Example #3
0
void CUIObjectives::InitEventSystem()
{
	if ( gEnv->pFlashUI )
	{
		// events that be fired to the UI
		m_pUIEvents = gEnv->pFlashUI->CreateEventSystem( "UIObjectives", IUIEventSystem::eEST_SYSTEM_TO_UI );
		m_eventSender.Init(m_pUIEvents);

		{
			SUIEventDesc evtDesc("ObjectiveAdded", "Mission objective added");
			evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("MissionID", "ID of the mission" );
			evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Name", "Name of the mission");
			evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Desc", "Description of the mission");
			evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("State", "State of the objective");
			m_eventSender.RegisterEvent<eUIOE_ObjectiveAdded>(evtDesc);
		}

		{
			SUIEventDesc evtDesc( "ObjectiveRemoved", "Mission objective removed" );
			evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("MissionID", "ID of the mission" );
			m_eventSender.RegisterEvent<eUIOE_ObjectiveRemoved>(evtDesc);
		}

		{
			SUIEventDesc evtDesc( "ObjectivesReset", "All mission objectives reset" );
			m_eventSender.RegisterEvent<eUIOE_ObjectivesReset>(evtDesc);
		}

		{
			SUIEventDesc evtDesc( "ObjectiveStateChanged", "Objective status changed" );
			evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("MissionID", "ID of the mission" );
			evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("State", "State of the objective");
			m_eventSender.RegisterEvent<eUIOE_ObjectiveStateChanged>(evtDesc);
		}

		// event system to receive events from UI
		m_pUIFunctions = gEnv->pFlashUI->CreateEventSystem( "UIObjectives", IUIEventSystem::eEST_UI_TO_SYSTEM );
		m_eventDispatcher.Init(m_pUIFunctions, this, "CUIObjectives");

		{
			SUIEventDesc evtDesc( "RequestObjectives", "Request all mission objectives (force to call ObjectiveAdded for each objective)" );
			m_eventDispatcher.RegisterEvent( evtDesc, &CUIObjectives::OnRequestMissionObjectives );
		}
	}
	UpdateObjectiveInfo();
}
Example #4
0
//--------------------------------------------------------------------------------------------
CUIObjectives::CUIObjectives()
{
	if ( gEnv->pFlashUI )
	{
		// events that be fired to the UI
		m_pUIOEvt = gEnv->pFlashUI->CreateEventSystem( "UIObjectives", IUIEventSystem::eEST_SYSTEM_TO_UI );

		{
			SUIEventDesc evtDesc( "ObjectiveAdded", "ObjectiveAdded", "Mission objective added" );
			evtDesc.Params.push_back( SUIParameterDesc( "ObjectiveID", "MissionID", "ID of the mission" ) );
			evtDesc.Params.push_back( SUIParameterDesc( "Name", "Name", "Name of the mission" ) );
			evtDesc.Params.push_back( SUIParameterDesc( "Desc", "Desc", "Description of the mission" ) );
			evtDesc.Params.push_back( SUIParameterDesc( "State", "State", "State of the objective" ) );
			m_EventMap[ eUIOE_ObjectiveAdded ] = m_pUIOEvt->RegisterEvent( evtDesc );
		}

		{
			SUIEventDesc evtDesc( "ObjectiveRemoved", "ObjectiveRemoved", "Mission objective removed" );
			evtDesc.Params.push_back( SUIParameterDesc( "ObjectiveID", "MissionID", "ID of the mission" ) );
			m_EventMap[ eUIOE_ObjectiveRemoved ] = m_pUIOEvt->RegisterEvent( evtDesc );
		}

		{
			SUIEventDesc evtDesc( "ObjectivesReset", "ObjectivesReset", "All mission objectives reset" );
			m_EventMap[ eUIOE_ObjectivesReset ] = m_pUIOEvt->RegisterEvent( evtDesc );
		}

		{
			SUIEventDesc evtDesc( "ObjectiveStateChanged", "ObjectiveStateChanged", "Objective status changed" );
			evtDesc.Params.push_back( SUIParameterDesc( "ObjectiveID", "MissionID", "ID of the mission" ) );
			evtDesc.Params.push_back( SUIParameterDesc( "State", "State", "State of the objective" ) );
			m_EventMap[ eUIOE_ObjectiveStateChanged ] = m_pUIOEvt->RegisterEvent( evtDesc );
		}

		// event system to receive events from UI
		m_pUIOFct = gEnv->pFlashUI->CreateEventSystem( "UIObjectives", IUIEventSystem::eEST_UI_TO_SYSTEM );
		m_pUIOFct->RegisterListener( this );

		{
			SUIEventDesc evtDesc( "RequestObjectives", "RequestObjectives", "Request all mission objectives (force to call ObjectiveAdded for each objective)" );
			s_EventDispatcher.RegisterEvent( m_pUIOFct, evtDesc, &CUIObjectives::OnRequestMissionObjectives );
		}
	}
	UpdateObjectiveInfo();
}