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)); }
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)); }
// 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)); }
//------------------------------------------------------------------------ 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); }
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)); }
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)); }
void CUIObjectives::NotifyUI( EUIObjectiveEvent eventType, const SUIArguments& args ) { if( m_pUIOEvt ) m_pUIOEvt->SendEvent( SUIEvent(m_EventMap[eventType], args) ); }
// ui functions void CUIMultiPlayer::EnteredGame() { m_pUIFunctions->SendEvent(SUIEvent(m_EventMap[EUIE_EnteredGame], SUIArguments())); }