Beispiel #1
0
	virtual bool Execute(SActivationInfo *pActInfo)
	{
		bool bResult = false;

		SXmlDocument *doc;
		if (GDM->GetXmlDocument(pActInfo->pGraph, &doc) && doc->active)
		{
			const char* childName = GetPortString(pActInfo, EIP_Name);
			const int childIndex = GetPortInt(pActInfo, EIP_Index);
			const int childCount = doc->active->getChildCount();
			XmlNodeRef ref = NULL;
			for (int i = 0, realCount = 0; i < childCount; ++i)
			{
				ref = doc->active->getChild(i);
				if (ref && strcmp(ref->getTag(), childName) == 0)
				{
					if (++realCount >= childIndex)
					{
						doc->active->deleteChildAt(i);
						bResult = true;
						break;
					}
				}
			}
		}

		return bResult;
	}
Beispiel #2
0
	virtual bool Execute(SActivationInfo *pActInfo)
	{
		bool bResult = false;

		SXmlDocument *doc;
		if (GDM->GetXmlDocument(pActInfo->pGraph, &doc) && doc->active)
		{
			char const* name = GetPortString(pActInfo, EIP_Name);
			if (!name || !name[0])
			{
				doc->active->removeAllChilds();
			}
			else
			{
				const int childCount = doc->active->getChildCount();
				XmlNodeRef ref = NULL;
				for (int i = 0; i < childCount; ++i)
				{
					ref = doc->active->getChild(i);
					if (ref && strcmp(ref->getTag(), name) == 0)
					{
						doc->active->deleteChildAt(i);
					}
				}
			}
			bResult = true;
		}

		return bResult;
	}
Beispiel #3
0
void CFlashUIFunctionNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo )
{
	if (event == eFE_Activate && IsPortActive(pActInfo, eI_Call))
	{
		int          port = GetDynStartPort();
		SUIArguments args;
		for (TUIParams::const_iterator iter = m_funcDesc.InputParams.Params.begin(); iter != m_funcDesc.InputParams.Params.end(); ++iter)
		{
			GetDynInput( args, *iter, pActInfo, port++ );
		}

		TUIData   res;
		const int instanceId = GetPortInt( pActInfo, eI_InstanceID );

		if (IsTemplate() && !UpdateTmplDesc( GetPortString(pActInfo, eI_TemplateInstanceName), pActInfo ))
			return;

		SPerInstanceCall2< const SUIArguments &, TUIData & > caller;
		caller.Execute(m_pElement, instanceId, functor(*this, &CFlashUIFunctionNode::CallFunction), args, res);

		string out;
		res.GetValueWithConversion( out );
		ActivateOutput( pActInfo, eO_RetVal, out  );

		ActivateOutput( pActInfo, eO_OnCall, true );
	}
}
Beispiel #4
0
	virtual bool Execute(SActivationInfo *pActInfo)
	{
		bool bResult = false;

		SXmlDocument *doc;
		if (GDM->GetXmlDocument(pActInfo->pGraph, &doc) && doc->active)
		{
			char const* name = GetPortString(pActInfo, EIP_Name);
			XmlNodeRef ref = doc->active->findChild(name);
			if (ref)
			{
				doc->active = ref;
				bResult = true;
			}
			else if (GetPortBool(pActInfo, EIP_Create))
			{
				ref = doc->active->newChild(name);
				if (ref)
				{
					doc->active = ref;
					bResult = true;
				}
			}
		}

		return bResult;
	}
Beispiel #5
0
	virtual void WeaponAccessoryChanged(CWeapon* pWeapon, const char* accessory, bool bAdd)
	{
		const char* actWeaponName = pWeapon->GetEntity()->GetClass()->GetName();

		const string& weaponName = GetPortString(&m_actInfo, 0);
		if (weaponName.empty() == false && stricmp(actWeaponName, weaponName.c_str()) != 0)
			return;

		const string& itemName = GetPortString(&m_actInfo, 1);
		if (itemName.empty() == false && stricmp(accessory, itemName.c_str()) != 0)
			return;

		string name (actWeaponName);
		string accName (accessory);
		ActivateOutput(&m_actInfo, 0, name);
		ActivateOutput(&m_actInfo, bAdd ? 1 : 2, accName);
	}
	void ProcessEvent(EFlowEvent event, SActivationInfo* pActInfo)
	{
#if !defined(_RELEASE)
		if (event == eFE_Initialize && IsPortActive(pActInfo, eIP_Draw))
		{
			m_waitTime = 0.0f;
			pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, false);
		}
		else if (event == eFE_Activate && IsPortActive(pActInfo, eIP_Draw))
		{
			IEntity* pEntity = pActInfo->pEntity;
			if (pEntity)
			{
				IPersistantDebug* pPersistentDebug = CCryAction::GetCryAction()->GetIPersistantDebug();
				if (pPersistentDebug)
				{
					SEntityTagParams params;
					params.entity = pEntity->GetId();
					params.text = GetPortString(pActInfo, eIP_Message);
					params.size = GetPortFloat(pActInfo, eIP_FontSize);
					params.color = ColorF(GetPortVec3(pActInfo, eIP_Color), 1.0f);
					params.visibleTime = GetPortFloat(pActInfo, eIP_Time);
					params.fadeTime = GetPortFloat(pActInfo, eIP_FadeTime);
					params.viewDistance = GetPortFloat(pActInfo, eIP_ViewDistance);
					params.staticId = GetPortString(pActInfo, eIP_StaticID);
					params.column = GetPortInt(pActInfo, eIP_Column);
					params.tagContext = "FG_DrawEntityTagAdvanced";

					pPersistentDebug->AddEntityTag(params);

					m_waitTime = gEnv->pTimer->GetFrameStartTime() + (params.fadeTime + params.visibleTime);
					pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, true);
				}
			}
		}
		else if (event == eFE_Update)
		{
			if (m_waitTime < gEnv->pTimer->GetFrameStartTime())
			{
				m_waitTime.SetSeconds(0.0f);
				pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, false);
				ActivateOutput(pActInfo, eOP_Done, GetPortAny(pActInfo, eIP_Draw));
			}
		}
#endif
	}
Beispiel #7
0
	void GetRtpcID(SActivationInfo* const pActInfo)  
	{
		string const& rRtpcName = GetPortString(pActInfo, eIn_RtpcName);
		if (!rRtpcName.empty())
		{
			gEnv->pAudioSystem->GetAudioRtpcID(rRtpcName.c_str(), m_nRtpcID);
		}
	}
Beispiel #8
0
void CFlashUIVariableBaseNode::ProcessEvent( EFlowEvent event, SActivationInfo* pActInfo )
{
	if (event == eFE_Initialize)
	{
		UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIVariable)), pActInfo, m_isTemplate );
	}
	else if (event == eFE_Activate)
	{
		if (IsPortActive( pActInfo, GetInputPort(eI_UIVariable)))
		{
			UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIVariable)), pActInfo, m_isTemplate );
		}

		if (IsTemplate() && !UpdateTmplDesc( GetPortString( pActInfo, GetInputPort(eI_TemplateInstanceName)), pActInfo ))
			return;

		const int instanceId = GetPortInt( pActInfo, GetInputPort(eI_InstanceID));
		if (IsPortActive ( pActInfo, GetInputPort(eI_Set)))
		{
			const TFlowInputData &data = GetPortAny( pActInfo, GetInputPort(eI_Value));
			TUIData               value;
			ConvertToUIData(data, value, pActInfo);

			SPerInstanceCall1< const TUIData & > caller;
			caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIVariableBaseNode::SetVariable), value );

			ActivateOutput( pActInfo, eO_OnSet, true );
		}
		if (IsPortActive( pActInfo, GetInputPort(eI_Get)))
		{
			TUIData out;

			SPerInstanceCall1< TUIData & > caller;
			if (!caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIVariableBaseNode::GetVariable), out, false ))
			{
				UIACTION_WARNING( "FG: UIElement \"%s\" called get Variable for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetElement()->GetName(),instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ));
			}

			string res;
			out.GetValueWithConversion( res );
			ActivateOutput( pActInfo, eO_Value, res );
		}
	}

}
void CFlowNode_SimulateInput::ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
{
	if(event == eFE_Activate)
	{
		bool isPressPort = IsPortActive(pActInfo, eInputPorts_Press);
		bool isReleasePort = IsPortActive(pActInfo, eInputPorts_Release);
		bool isHoldPort = IsPortActive(pActInfo, eInputPorts_Hold);

		bool triggerResponse = false;
		int playerInputEvent;
		int nodeOutput;

		if(isPressPort)
		{
			triggerResponse = true;
			playerInputEvent = eAAM_OnPress;
			nodeOutput = eOutputPort_Pressed;
		}
		else if(isHoldPort)
		{
			triggerResponse = true;
			playerInputEvent = eAAM_OnHold;
			nodeOutput = eOutputPort_Held;
		}
		else if(isReleasePort)
		{
			triggerResponse = true;
			playerInputEvent = eAAM_OnRelease;
			nodeOutput = eOutputPort_Released;
		}

		if(triggerResponse)
		{
			CActor *pClientActor = static_cast<CActor *>(g_pGame->GetIGameFramework()->GetClientActor());

			if(pClientActor)
			{
				if(pClientActor->GetActorClass() == CPlayer::GetActorClassType())
				{
					CPlayer *pClientPlayer = static_cast<CPlayer *>(pClientActor);
					const char *action = GetPortString(pActInfo, eInputPorts_Action).c_str();
					const float inputValue = GetPortFloat(pActInfo, eInputPorts_Value);

					IPlayerInput *pPlayerInput = pClientPlayer->GetPlayerInput();

					if(pPlayerInput)
					{
						CODECHECKPOINT(SimulateInput_ProcessEvent_SendAction);
						pPlayerInput->OnAction(action, playerInputEvent, isPressPort ? clamp(inputValue, 0.0f, 1.0f) : 0.0f);
					}
				}
			}

			ActivateOutput(pActInfo, nodeOutput, true);
		}
	}
}
Beispiel #10
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo* pActInfo)
	{
		if (!m_pDialogMan)
			return;

		switch (event)
		{
		case eFE_Initialize:
			if (m_bDisplayed)
				m_pDialogMan->CancelDialog(m_id);
			m_ActInfo = *pActInfo;
			break;
		case eFE_Activate:
			if (IsPortActive(pActInfo, eI_Display))
			{
				if (m_bDisplayed)
				{
					gEnv->pLog->LogWarning("FG: Dialog is already displayed!");
					ActivateOutput(pActInfo, eO_OnShow, true);
					return;
				}
				EDialogType type = (EDialogType) GetPortInt(pActInfo, eI_Type);
				const string title = GetPortString(pActInfo, eI_Title);
				const string message = GetPortString(pActInfo, eI_Message);
				const string param = GetPortString(pActInfo, eI_Param);
				m_id = m_pDialogMan->DisplayDialog(type, title.c_str(), message.c_str(), param.c_str(), this);
				m_bDisplayed = true;
				ActivateOutput(pActInfo, eO_OnShow, true);
			}
			if (IsPortActive(pActInfo, eI_Cancel))
			{
				if (!m_bDisplayed)
				{
					gEnv->pLog->LogWarning("FG: Dialog is not displayed!");
					ActivateOutput(&m_ActInfo, eO_Param, string(""));
					ActivateOutput(&m_ActInfo, eO_Result, 2);
					return;
				}
				m_pDialogMan->CancelDialog(m_id);
			}
			break;
		}
	}
Beispiel #11
0
void CFlashUIArrayBaseNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo )
{
	if (event == eFE_Initialize)
	{
		UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIArray)), pActInfo, m_isTemplate );
	}
	else if (event == eFE_Activate)
	{
		if (IsPortActive( pActInfo, GetInputPort(eI_UIArray)))
		{
			UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIArray)), pActInfo, m_isTemplate );
		}

		if (IsTemplate() && !UpdateTmplDesc( GetPortString( pActInfo, GetInputPort(eI_TemplateInstanceName)), pActInfo ))
			return;

		if (GetElement())
		{
			const int instanceId = GetPortInt( pActInfo, GetInputPort(eI_InstanceID));
			if (IsPortActive ( pActInfo, GetInputPort(eI_Set)))
			{
				SUIArguments values( GetPortString( pActInfo, GetInputPort(eI_Value)).c_str());

				SPerInstanceCall1< const SUIArguments & > caller;
				caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIArrayBaseNode::SetArray), values );

				ActivateOutput( pActInfo, eO_OnSet, true );
			}
			else if (IsPortActive( pActInfo, GetInputPort(eI_Get)))
			{
				SUIArguments out;

				SPerInstanceCall1< SUIArguments & > caller;
				if (!caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIArrayBaseNode::GetArray), out, false ))
				{
					UIACTION_WARNING( "FG: UIElement \"%s\" called get Array for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetElement()->GetName(),instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ));
				}

				ActivateOutput( pActInfo, eO_Value, string( out.GetAsString()));
			}
		}
	}
}
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch(event)
		{
		case eFE_Activate:
			{
				if (IsPortActive(pActInfo, eIP_Get))
				{
					IPlayerProfile* pProfile = NULL;
					if (IPlayerProfileManager *pProfileMan = gEnv->pGame->GetIGameFramework()->GetIPlayerProfileManager())
					{
						const char* user = pProfileMan->GetCurrentUser();
						pProfile = pProfileMan->GetCurrentProfile(user);
						TFlowInputData data;
						if (!pProfile || pProfile->GetAttribute(GetPortString(pActInfo, eIP_Name), data))
						{
							ActivateOutput(pActInfo, eOP_Value, data);
						}
						else
						{
							ActivateOutput(pActInfo, eOP_Error, 1);
						}
					}
				}

				if (IsPortActive(pActInfo, eIP_Set))
				{
					IPlayerProfile* pProfile = NULL;
					if (IPlayerProfileManager *pProfileMan = gEnv->pGame->GetIGameFramework()->GetIPlayerProfileManager())
					{
						const char *user = pProfileMan->GetCurrentUser();
						pProfile = pProfileMan->GetCurrentProfile( user );
						if(!pProfile || !pProfile->SetAttribute(GetPortString(pActInfo, eIP_Name), GetPortAny(pActInfo, eIP_Set)))
						{
							ActivateOutput(pActInfo, eOP_Error, 1);
						}
					}
				}
			}
			break;
		}
	}
void CFlowAddModelToPostRender::ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
{
	switch (event)
	{
	case eFE_Initialize:
		break;
	case eFE_Activate:
		if (IsPortActive(pActInfo, IN_ADD))
		{
			INDENT_LOG_DURING_SCOPE();
			//Create scene
			CMenuRender3DModelMgr *renderModels = CMenuRender3DModelMgr::GetInstance();
			
			if (renderModels)
			{
				//Add model with animation if needed
				const float playSpeed = GetPortFloat(pActInfo, IN_ANIM_SPEED);
				const char * usePlayerModelName = GetPortString(pActInfo, IN_MODEL);
				const char * useAnimation = GetPortString(pActInfo, IN_ANIM);

				CMenuRender3DModelMgr::SModelParams params;
				params.pFilename = usePlayerModelName;
				params.posOffset = GetPortVec3(pActInfo, IN_ENTITYPOS);
				params.rot = Ang3(GetPortVec3(pActInfo, IN_ENTITYROT));
				params.continuousRot = Ang3(GetPortVec3(pActInfo, IN_ENTITYCONTROT));
				params.scale = GetPortFloat(pActInfo, IN_SCALE);
				params.pName = "char";
				params.screenRect[0] = GetPortVec3(pActInfo, IN_SCREENUV).x;
				params.screenRect[1] = GetPortVec3(pActInfo, IN_SCREENUV).y;
				params.screenRect[2] = GetPortVec3(pActInfo, IN_SCREENU2V2).x;
				params.screenRect[3] = GetPortVec3(pActInfo, IN_SCREENU2V2).y;

				if(strcmp(usePlayerModelName, "") != 0)
					characterModelIndex = renderModels->AddModel(params);

				if(strcmp(useAnimation, "") != 0)
					renderModels->UpdateAnim(characterModelIndex, useAnimation, playSpeed);
			}
		}
		break;
	}
}
	void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		if (event == eFE_Activate && IsPortActive(pActInfo, EIP_Trigger))
		{
			IActor* pActor = GetInputActor( pActInfo );
			if (!pActor)
				return;

			IInventory *pInventory = pActor->GetInventory();
			if (!pInventory)
				return;

			const bool& addPack = GetPortBool(pActInfo, EIP_AddToggle);
			const string& packName = GetPortString(pActInfo, EIP_EquipmentPack);
			const bool& selectPrimary = GetPortBool(pActInfo, EIP_SelectPrimary);

			if (pActor->IsPlayer())
				pInventory->RMIReqToServer_AddEquipmentPack( packName.c_str(), addPack, selectPrimary );
			else
			{
				if (gEnv->bServer)
					CCryAction::GetCryAction()->GetIItemSystem()->GetIEquipmentManager()->GiveEquipmentPack( pActor, packName.c_str(), addPack, selectPrimary );
			}
				
			// TODO: instant output activation, with delayed effective change in the inventory, it potentially could cause problems in rare situations
			ActivateOutput(pActInfo, EOP_Done, true);
		}
		else if (event == eFE_PrecacheResources)
		{
			const string& packName = GetPortString(pActInfo, 1);

			if (!packName.empty())
			{
				IGameRules* pGameRules = CCryAction::GetCryAction()->GetIGameRulesSystem()->GetCurrentGameRules();
				CRY_ASSERT_MESSAGE(pGameRules != NULL, "No game rules active, can not precache resources");
				if (pGameRules)
				{
					pGameRules->PrecacheLevelResource(packName.c_str(), eGameResourceType_Loadout);
				}
			}
		}
	}
	virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
	{
		m_actInfo = *pActInfo;
		switch (event)
		{
			case eFE_Activate:
			{
				if (GetPortBool(pActInfo, EIP_Enabled)) {
					if (IsPortActive(pActInfo, EIP_Send)) {
						// try to open port socket
						port = GetPortInt(pActInfo, EIP_Port);
						address = GetPortString(pActInfo, EIP_Address);
						string message = GetPortString(pActInfo, EIP_Message);
						SendMessage(port, address, message);
					}
				}
			}
			break;
		}
	}
Beispiel #16
0
	// INetMsgListener
	virtual void OnMessage(const SNetMsgData &data) override
	{
		// Notify if the expected message has arrived
		const string &key = GetPortString(&m_actInfo,IN_MSG);
		if (data.key == key)
		{
			NET_MSG_DISPATCHER_LOG("CFlowNode_MsgReceiver: %s Listener received message [%s->%s]-[%s/%s]", CNetMessageDistpatcher::DbgTranslateLocationToString(), data.DbgTranslateSourceToString(),  data.DbgTranslateTargetToString(), key.c_str(), data.value.c_str());
			ActivateOutput(&m_actInfo, OUT_RECEIVED, true);
			ActivateOutput(&m_actInfo, OUT_VALUE, data.value);
		}
	}
	void GetSwitchStateID(SActivationInfo* const pActInfo, uint32 const nStateInputIdx)
	{
		string const& rStateName = GetPortString(pActInfo, nStateInputIdx);
		if (!rStateName.empty() && (m_nSwitchID != INVALID_AUDIO_CONTROL_ID))
		{
			gEnv->pAudioSystem->GetAudioSwitchStateID(
				m_nSwitchID,
				rStateName.c_str(),
				m_aSwitchStates[nStateInputIdx-eIn_SwitchStateNameFirst]);
		}
	}
void CGeomEntity::OnFlowgraphActivation(EntityId entityId, IFlowNode::SActivationInfo* pActInfo, const class CFlowGameEntityNode* pNode)
{
	if (CGeomEntity* pGeomEntity = QueryExtension(entityId))
	{
		if (IsPortActive(pActInfo, eInputPorts_LoadGeometry))
		{
			pGeomEntity->GetEntity()->LoadGeometry(0, GetPortString(pActInfo, eInputPorts_LoadGeometry));
			ActivateOutputPort(entityId, eOutputPorts_Done, TFlowInputData(true));
		}
	}
}
Beispiel #19
0
void CFlashUIVariableBaseNode::ConvertToUIData( const TFlowInputData &in, TUIData &out, SActivationInfo* pActInfo)
{
	if (!GetObjectDesc())
	{
		UIACTION_WARNING( "FG: No valid Variable \"%s\"! (Referenced at node \"%s\")", GetPortString(pActInfo, GetInputPort(eI_UIVariable)).c_str(), pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ));
		return;
	}

	bool        ok      = false;
	const char* vartype = "any";
	switch (GetObjectDesc()->eType)
	{
	case SUIParameterDesc::eUIPT_Bool:
	{
		bool value;
		ok      = in.GetValueWithConversion(value);
		out     = TUIData(value);
		vartype = "bool";
	}
	break;
	case SUIParameterDesc::eUIPT_Int:
	{
		int value;
		ok      = in.GetValueWithConversion(value);
		out     = TUIData(value);
		vartype = "int";
	}
	break;
	case SUIParameterDesc::eUIPT_Float:
	{
		float value;
		ok      = in.GetValueWithConversion(value);
		out     = TUIData(value);
		vartype = "float";
	}
	break;
	case SUIParameterDesc::eUIPT_String: // fall through, just change the type desc
		vartype = "string";
	case SUIParameterDesc::eUIPT_Any:
	default:
	{
		string value;
		ok  = in.GetValueWithConversion(value);
		out = TUIData(value);
	}
	break;
	}

	if (!ok)
	{
		UIACTION_WARNING( "FG: UIElement \"%s\" Variable \"%s\" expected type \"%s\" given value was not compatible! (Referenced at node \"%s\")", GetElement()->GetName(),GetObjectDesc()->sDisplayName, vartype, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ));
	}
}
  virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
  {
    if (event != eFE_Activate)
      return;

		I3DEngine* pEngine = gEnv->p3DEngine;

		const string& message = GetPortString(pActInfo, EIP_ParamName);
		const float& fParamFloat = GetPortFloat(pActInfo, EIP_ParamFloat);

		pEngine->SetPostEffectParam(message, fParamFloat);
  }
	virtual void OnGrammarChange(const char * grammarName, eGrammaChange change)
	{
		const string & myGrammarName = GetPortString(&m_actInfo, eI_GrammarName);

		if (myGrammarName == grammarName)
		{
			EOutputs outputPort = change == eGC_Enabled ? eO_Enabled : 
														change == eGC_Disabled ? eO_Disabled : eO_NotLoaded;

			ActivateOutput(&m_actInfo, outputPort, true );
		}
	}
void CFlashUILayerNode::ProcessEvent( EFlowEvent event,SActivationInfo *pActInfo )
{
    if ( event == eFE_Initialize )
    {
        UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
    }
    else if ( event == eFE_Activate )
    {
        if ( IsPortActive( pActInfo, eI_UIElement ) )
        {
            UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
        }

        const int instanceId =  GetPortInt( pActInfo, eI_InstanceID );

        if ( IsPortActive( pActInfo, eI_Get ) )
        {
            int layer = 0;

            SPerInstanceCall1< int& > caller;
            if ( !caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUILayerNode::GetLayer), layer, false) )
            {
                UIACTION_WARNING( "FG: UIElement \"%s\" called get layer for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetPortString(pActInfo, eI_UIElement).c_str() ,instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ) );
            }

            ActivateOutput( pActInfo, eO_Layer, layer );
            ActivateOutput( pActInfo, eO_OnGet, true );
        }

        if ( IsPortActive( pActInfo, eI_Set ) )
        {
            const int layer = GetPortInt( pActInfo, eI_Layer );

            SPerInstanceCall1< int > caller;
            caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUILayerNode::SetLayer), layer );

            ActivateOutput( pActInfo, eO_OnSet, true );
        }
    }
}
Beispiel #23
0
    virtual void ProcessEvent( EFlowEvent event,SActivationInfo *pActInfo )
    {
        switch (event)
        {
        case eFE_Activate:
        {
            if (!m_file)
            {
                const string& filename = GetPortString(pActInfo, 0);
                if (filename.empty())
                    return;

                if (!(m_file = fopen(filename.c_str(), "w+")))
                    return;

                string name;
                name.reserve(256);

                for (int i = 0; i < 10; i++)
                    if (GetPortString(pActInfo, 1+i*2).length())
                        name += GetPortString(pActInfo, 1+i*2)+",";

                fputs(name.c_str(), m_file);
                fputs("\n", m_file);
            }

            string value;
            value.reserve(256);

            for (int i = 0; i < 10; i++)
                if (GetPortString(pActInfo, 1+i*2).length())
                    value += GetPortString(pActInfo, 2+i*2)+",";

            fputs(value.c_str(), m_file);
            fputs("\n", m_file);
            fflush(m_file);
        }
        break;
        };
    };
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		if (event == eFE_Activate)
		{
			const bool isSet = (IsPortActive(pActInfo, SET));
			if (isSet)
			{
				const string& stringToExecute = GetPortString(pActInfo, STRING);
				const bool nextFrame = GetPortBool(pActInfo, NEXT_FRAME);
				gEnv->pConsole->ExecuteString(stringToExecute, true, nextFrame);;
			}
		}
	}
void CFlowNode_ColorGradient::ProcessEvent(EFlowEvent event, SActivationInfo* activationInformation)
{
	//Preload texture
	if(event==IFlowNode::eFE_PrecacheResources && m_pTexture==NULL)
	{
		const string texturePath = GetPortString(activationInformation, eInputPorts_TexturePath);

		const uint32 COLORCHART_TEXFLAGS = FT_NOMIPS |  FT_DONT_STREAM | FT_DONT_RESIZE | FT_STATE_CLAMP;

		m_pTexture = gEnv->pRenderer->EF_LoadTexture(texturePath.c_str(), COLORCHART_TEXFLAGS);
		
		//CryLogAlways("CFlowNode_ColorGradient 0x%p: Precache texture %s", this, texturePath.c_str());
	}

	if (event==IFlowNode::eFE_Activate && IsPortActive(activationInformation, eIP_Trigger))
	{
		const string texturePath = GetPortString(activationInformation, eInputPorts_TexturePath);
		const float timeToFade = GetPortFloat(activationInformation, eInputPorts_TransitionTime);

		g_pGame->GetColorGradientManager().TriggerFadingColorGradient(texturePath, timeToFade);
	}
}
Beispiel #26
0
	bool IsClassAllowed(const char* entClass)
	{
		const char* classFilter = GetPortString(&m_pActInfo, eIP_Class).c_str();
		if(strcmp(classFilter, "AllClasses") == 0 || strcmp(classFilter, entClass) == 0)
		{
			return true;
		}
		else if(strcmp(classFilter, "CustomClasses") == 0)
		{
			string customClasses = GetPortString(&m_pActInfo, eIP_CustomClass);
			std::vector<string> CustomClassList;
			splitStringList(&CustomClassList, customClasses.c_str(), ',');
			for (unsigned int i = 0; i < CustomClassList.size(); i++)
			{
				if(strcmp(entClass, CustomClassList[i]) == 0)
					return true;
			}
			
		}

		return false;
	}
Beispiel #27
0
void CFlashUIFromArrayExNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo )
{
	if (event == eFE_Activate && IsPortActive( pActInfo, eI_Get ))
	{
		SUIArguments args( GetPortString( pActInfo, eI_Array ).c_str());
		int          index = GetPortInt( pActInfo, eI_Index );
		string       arg;
		if (args.GetArg( index, arg ))
		{
			ActivateOutput( pActInfo, eO_Val, arg );
		}
	}
}
	virtual void OnVoiceCommand(const char * voiceCommand)
	{
		if (m_active)
		{
			const string & command = GetPortString(&m_actInfo, eI_Command);
			if (command == voiceCommand)
			{
				// Note: the voieCommand will be the TAG field of the command input in the GRXML file
				// This is so to make sure that the recognition is independent from the language
				ActivateOutput(&m_actInfo, eO_Active, true );
			}
		}
	}
Beispiel #29
0
	virtual void OnExplosion(const ExplosionInfo &explosionInfo)
	{
		if(GetPortBool(&m_actInfo, EIP_Enable) == false)
			return;

		EntityId shooter = GetPortEntityId(&m_actInfo, EIP_ShooterId);

		if(shooter != 0 && shooter != explosionInfo.shooterId)
			return;

		EntityId impactTarget = GetPortEntityId(&m_actInfo, EIP_ImpactTargetId);

		if(impactTarget != 0 && explosionInfo.impact && impactTarget != explosionInfo.impact_targetId)
			return;

		IEntitySystem *pEntitySys = gEnv->pEntitySystem;
		IEntity *pTempEntity = pEntitySys->GetEntity(explosionInfo.weaponId);

		// check ammo match
		const string &ammo = GetPortString(&m_actInfo, EIP_Ammo);

		if(ammo.empty() == false)
		{
			if(pTempEntity == 0 || ammo.compare(pTempEntity->GetClass()->GetName()) != 0)
				return;
		}

		string ammoClass = pTempEntity ? pTempEntity->GetClass()->GetName() : "";
		ActivateOutput(&m_actInfo, EOP_ShooterId, explosionInfo.shooterId);
		ActivateOutput(&m_actInfo, EOP_Ammo, ammoClass);
		ActivateOutput(&m_actInfo, EOP_Pos, explosionInfo.pos);
		ActivateOutput(&m_actInfo, EOP_Dir, explosionInfo.dir);
		ActivateOutput(&m_actInfo, EOP_Radius, explosionInfo.radius);
		ActivateOutput(&m_actInfo, EOP_Damage, explosionInfo.damage);
		ActivateOutput(&m_actInfo, EOP_Pressure, explosionInfo.pressure);
		ActivateOutput(&m_actInfo, EOP_HoleSize, explosionInfo.hole_size);
		const char *hitType = 0;

		if(CGameRules *pGR = g_pGame->GetGameRules())
			hitType = pGR->GetHitType(explosionInfo.type);

		hitType = hitType ? hitType : "";
		ActivateOutput(&m_actInfo, EOP_Type, string(hitType));

		if(explosionInfo.impact)
		{
			ActivateOutput(&m_actInfo, EOP_ImpactTargetId, explosionInfo.impact_targetId);
			ActivateOutput(&m_actInfo, EOP_ImpactNormal, explosionInfo.impact_normal);
			ActivateOutput(&m_actInfo, EOP_ImpactVelocity, explosionInfo.impact_velocity);
		}
	}
void CFlashUIGetCompatibleAccessoriesNode ::ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
{
	if(event == eFE_Activate && IsPortActive(pActInfo, 0))
	{
		string accessories = "";
		IActor* pActor = GetInputActor( pActInfo );

		if(pActor)
		{
			IInventory* pInventory = pActor->GetInventory();
			if(pInventory)
			{
				//Get the item ID via the Input string
				const string weapon_name = GetPortString(pActInfo, eI_Weapon);
				IEntityClassRegistry *pRegistery = gEnv->pEntitySystem->GetClassRegistry();
				EntityId item = pInventory->GetItemByClass(pRegistery->FindClass(weapon_name));

				//Fetch the actual weapon via the ID
				IEntity* pEntity = gEnv->pEntitySystem->GetEntity(item);
				if(pEntity)
				{

					CGameObject * pGameObject = (CGameObject*)pEntity->GetProxy(ENTITY_PROXY_USER);
					const char* ext = pGameObject->GetEntity()->GetClass()->GetName();
					CWeapon* pWeapon = (CWeapon*)pGameObject->QueryExtension(pGameObject->GetEntity()->GetClass()->GetName());

					//If the weapon exists, ask for all compatible accessories
					if(pWeapon)
					{
						//All compatible accessories for this weapon
						const DynArray<string> pCompatibleAccessoriesVec = pWeapon->GetCompatibleAccessories();

						bool first = true;
						DynArray<string>::const_iterator it;
						for (it = pCompatibleAccessoriesVec.begin(); it != pCompatibleAccessoriesVec.end(); it++)
						{
							if (!first)
								accessories.append(",");
							accessories.append((*it));
							first = false;
						}
					}
				}
			}
		}

		//return, if 'accessories' is empty, it has no compatible attachments, or the weapon/inventory was invalid
		ActivateOutput(pActInfo, eO_OnCall, true);
		ActivateOutput(pActInfo, eO_Args, accessories);
	}
}