Ejemplo n.º 1
0
void CUISettings::SendSoundChange()
{
	SUIArguments args;
	args.AddArgument(m_pMusicVar->GetFVal());
	args.AddArgument(m_pSFxVar->GetFVal());
	args.AddArgument(m_pVideoVar->GetFVal());
	m_pUIFunctions->SendEvent(SUIEvent(m_EventMap[EUIE_SoundSettingsChanged], args));
}
Ejemplo n.º 2
0
void CUISettings::SendResChange()
{
	SUIArguments args;
	args.AddArgument(m_pRXVar->GetIVal());
	args.AddArgument(m_pRYVar->GetIVal());
	args.AddArgument(m_pFSVar->GetIVal() != 0);
	m_pUIFunctions->SendEvent(SUIEvent(m_EventMap[EUIE_ResolutionChanged], args));
}
Ejemplo n.º 3
0
// ui functions
void CUISettings::SendResolutions()
{
	SUIArguments args;
	for (TResolutions::iterator it = m_Resolutions.begin(); it != m_Resolutions.end(); ++it)
	{
		args.AddArgument(it->first);
		args.AddArgument(it->second);
	}
	m_pUIFunctions->SendEvent(SUIEvent(m_EventMap[EUIE_OnGetResolutions], args));
}
Ejemplo n.º 4
0
//------------------------------------------------------------------------
int CScriptBind_UIAction::CallFunction( IFunctionHandler *pH, const char * elementName, int instanceID, const char* functionName )
{
	SUIArguments args;
	if (!SUIToLuaConversationHelper::LuaArgsToUIArgs(pH, 4, args))
	{
		UIACTION_WARNING( "LUA: Failed to call function %s on element %s: Invalid arguments", functionName, elementName );
		return pH->EndFunction(false);
	}

	IUIElement* pElement = GetElement( elementName, instanceID, true );
	if ( pElement )
	{
		const SUIEventDesc* pFctDesc = pElement->GetFunctionDesc( functionName );
		if ( pFctDesc )
		{
			TUIData res;
			bool bFctOk = true;
			if ( instanceID < 0 )
			{
				IUIElementIteratorPtr elements = pElement->GetInstances();
				while ( IUIElement* pInstance = elements->Next() )
					bFctOk &= pInstance->CallFunction( pFctDesc, args, &res);
			}
			else
			{
				bFctOk = pElement->CallFunction( pFctDesc, args, &res);
			}
			if ( bFctOk )
			{
				string sRes;
				res.GetValueWithConversion( sRes );
				return pH->EndFunction( sRes.c_str() );
			}
		}
		UIACTION_WARNING( "LUA: UIElement %s does not have function %s", elementName, functionName );
	}
	else if (IUIEventSystem* pEventSystem = GetEventSystem( elementName, IUIEventSystem::eEST_UI_TO_SYSTEM ))
	{
		uint eventid = pEventSystem->GetEventId( functionName );
		if ( eventid != ~0 )
		{
			SUIArguments res = pEventSystem->SendEvent( SUIEvent( eventid, args ) );
			SmartScriptTable table = gEnv->pScriptSystem->CreateTable();
			SUIToLuaConversationHelper::UIArgsToLuaTable(res, table);		
			return pH->EndFunction( table );
		}
		UIACTION_WARNING( "LUA: UIEventSystem %s does not have event %s", elementName, functionName );
	}
	else
	{
		UIACTION_WARNING( "LUA: UIElement or UIEventSystem %s does not exist", elementName );
	}
	return pH->EndFunction(false);
}
Ejemplo n.º 5
0
void CUIMultiPlayer::PlayerLeaved(EntityId playerid, const string& name)
{
	if (gEnv->pGame->GetIGameFramework()->GetClientActorId() == playerid)
		return;

	SUIArguments args;
	args.AddArgument(playerid);
	args.AddArgument(name);

	m_pUIFunctions->SendEvent(SUIEvent(m_EventMap[EUIE_PlayerLeaved], args));
}
Ejemplo n.º 6
0
void CUIMultiPlayer::PlayerKilled(EntityId playerid, EntityId shooterid)
{
	SUIArguments args;

	IEntity* pEntity = gEnv->pEntitySystem->GetEntity(playerid);
	assert(pEntity);
	IEntity* pShooterEntity = gEnv->pEntitySystem->GetEntity(shooterid);
	assert(pShooterEntity);

	args.AddArgument(playerid);
	args.AddArgument(pEntity ? string(pEntity->GetName()) : string(UNDEF_ENTITY_NAME));
	args.AddArgument(shooterid);
	args.AddArgument(pShooterEntity ? string(pShooterEntity->GetName()) : string("undefined"));

	m_pUIFunctions->SendEvent(SUIEvent(m_EventMap[EUIE_PlayerKilled], args));
}
Ejemplo n.º 7
0
void CUIObjectives::NotifyUI( EUIObjectiveEvent eventType, const SUIArguments& args )
{
	if( m_pUIOEvt )
		m_pUIOEvt->SendEvent( SUIEvent(m_EventMap[eventType], args) );
}
Ejemplo n.º 8
0
// ui functions
void CUIMultiPlayer::EnteredGame()
{
	m_pUIFunctions->SendEvent(SUIEvent(m_EventMap[EUIE_EnteredGame], SUIArguments()));
}