Beispiel #1
0
    virtual void ProcessEvent(EFlowEvent event, SActivationInfo* pActInfo)
    {
        if (event == eFE_Activate)
        {
            if (!IsPortActive(pActInfo, Get))
                return;

            EControlScheme curControlScheme = g_pGame->GetUI()->GetCurControlScheme();

            switch (curControlScheme)
            {
            case eControlScheme_Keyboard:
                ActivateOutput(pActInfo, Keyboard, GetPortAny(pActInfo, Get));
                break;
            case eControlScheme_KeyboardMouse:
                ActivateOutput(pActInfo, KeyboardMouse, GetPortAny(pActInfo, Get));
                break;
            case eControlScheme_XBoxOneController:
                ActivateOutput(pActInfo, XBoxOneController, GetPortAny(pActInfo, Get));
                break;
            case eControlScheme_PS4Controller:
                ActivateOutput(pActInfo, PS4Controller, GetPortAny(pActInfo, Get));
                break;

            default:
                GameWarning("CFlowNode_InputControlScheme::ProcessEvent: Failed to activate output port, unhandled control scheme type");
            }
        }
    }
Beispiel #2
0
// ---------------------------------------------------------------
void CFlashUIBaseNodeDynPorts::GetDynInput( SUIArguments &args, const SUIParameterDesc &desc, SActivationInfo* pActInfo, int port)
{
	switch (desc.eType)
	{
	case SUIParameterDesc::eUIPT_Bool:
		args.AddArgument( GetPortBool(pActInfo, port));
		break;
	case SUIParameterDesc::eUIPT_Int:
		args.AddArgument( GetPortInt(pActInfo, port));
		break;
	case SUIParameterDesc::eUIPT_Float:
		args.AddArgument( GetPortFloat(pActInfo, port));
		break;
	case SUIParameterDesc::eUIPT_String:
		args.AddArgument( GetPortString(pActInfo, port));
		break;
	case SUIParameterDesc::eUIPT_WString:
		args.AddArgument( GetPortString(pActInfo, port), eUIDT_WString );
		break;
	case SUIParameterDesc::eUIPT_Vec3:
		args.AddArgument( GetPortVec3(pActInfo, port));
		break;
	default:
	{
		string               val;
		const TFlowInputData data = GetPortAny(pActInfo, port);
		data.GetValueWithConversion(val);
		args.AddArgument(val, eUIDT_Any);
	}
	break;
	}
}
Beispiel #3
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo * pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
			if (gEnv->IsEditor())
				m_bTriggered = false;
			break;
		case eFE_Activate:
			if (m_bTriggered == false)
			{
				for (int i=0; i<6; i++)
				{
					if (IsPortActive(pActInfo, i))
					{
						ActivateOutput(pActInfo, 0, GetPortAny(pActInfo, i));
						m_bTriggered = true;
						break;
					}
				}
			}
			if (IsPortActive(pActInfo, 6))
				m_bTriggered = false;
			break;
		}
	}
  virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
  {
    if (event != eFE_Activate)
      return;

		if (InputEntityIsLocalPlayer( pActInfo )) 
    {     
      SFlowNodeConfig config;
      T::GetConfiguration(config);
      I3DEngine* pEngine = gEnv->p3DEngine;
      for (int i = 0; config.pInputPorts[i].name; ++i)
      {
        if (IsPortActive(pActInfo, i))
        {
          const TFlowInputData& anyVal = GetPortAny(pActInfo, i);
          float fVal;
          bool ok = anyVal.GetValueWithConversion(fVal);
          if (ok)
          {
            // set postfx param
            pEngine->SetPostEffectParam(config.pInputPorts[i].name, fVal);
          }
        }
      }
    }
  }
Beispiel #5
0
	virtual void ProcessEvent(EFlowEvent event, SActivationInfo* pActInfo)
	{
		if (event == eFE_Activate)
		{
			if (!IsPortActive(pActInfo, eInPort_Get))
				return;
#if defined(WIN32) || defined(WIN64)
			ActivateOutput(pActInfo, eOutPort_Pc, GetPortAny(pActInfo, eInPort_Get));
#elif defined(XENON)
			ActivateOutput(pActInfo, eOutPort_Xbox360, GetPortAny(pActInfo, eInPort_Get));
#elif defined(PS3)
			ActivateOutput(pActInfo, eOutPort_PS3, GetPortAny(pActInfo, eInPort_Get));
#elif defined(ORBIS)
			ActivateOutput(pActInfo, eOutPort_PS4, GetPortAny(pActInfo, eInPort_Get));
#elif defined(DURANGO)
			ActivateOutput(pActInfo, eOutPort_XboxOne, GetPortAny(pActInfo, eInPort_Get));
#endif
		}
	}
Beispiel #6
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo * pActInfo )
	{
		switch (event)
		{
		case eFE_Activate:
		case eFE_Initialize:
			if (IsPortActive(pActInfo, 1) && !GetPortBool(pActInfo, 0))
			{
				ActivateOutput(pActInfo,0,GetPortAny(pActInfo, 1));
			}
			break;
		}
	}
    virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
    {
        switch (event)
        {
        case eFE_Initialize:
        {
            pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, false );
        }
        break;

        case eFE_Update:
        {
            float fPeriod = GetPortFloat(pActInfo,IN_PERIOD);
            CTimeValue time = gEnv->pTimer->GetFrameStartTime();
            CTimeValue dt = time - m_lastTickTime;
            if (dt.GetSeconds() >= fPeriod)
            {
                m_lastTickTime = time;
                ++m_count;
                ActivateOutput( pActInfo, OUT_COUNT, m_count );
                if (m_count >= GetPortInt( pActInfo, IN_LIMIT ))
                {
                    pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, false );
                    ActivateOutput( pActInfo, OUT_FINISHED, GetPortAny( pActInfo, IN_START ));
                }
            }
        }
        break;
        case eFE_Activate:
        {
            if (IsPortActive(pActInfo,IN_START))
            {
                pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, true );
                m_count = 0;
                m_lastTickTime = gEnv->pTimer->GetFrameStartTime();
            }

            if (IsPortActive(pActInfo,IN_STOP))
            {
                pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, false );
            }

            if (IsPortActive(pActInfo,IN_CONTINUE))
            {
                pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, true );
            }
        }
        break;
        }
    }
Beispiel #8
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo * pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
		case eFE_Activate:
			if (IsPortActive(pActInfo, 0))
			{
				int minOut = GetPortInt(pActInfo,1);
				int maxOut = GetPortInt(pActInfo,2);

				minOut = CLAMP(minOut, 0, NUM_OUTPUTS);
				maxOut = CLAMP(maxOut, 0, NUM_OUTPUTS);
				if (maxOut < minOut) 
					std::swap(minOut, maxOut);

				int n = cry_random(minOut, maxOut);

				// Collect the outputs to use
				static int	out[NUM_OUTPUTS];
				for (unsigned i = 0; i < NUM_OUTPUTS; i++)
					out[i] = -1;
				int nout = 0;
				for (int i = 0; i < NUM_OUTPUTS; i++)
				{
					if (IsOutputConnected(pActInfo, i))
					{
						out[nout] = i;
						nout++;
					}
				}
				if (n > nout)
					n = nout;

				// Shuffle
				for (int i = 0; i < n; i++)
					std::swap(out[i], out[cry_random(0, nout - 1)]);

				// Set outputs.
				for (int i = 0; i < n; i++)
				{
					if (out[i] == -1)
						continue;
					ActivateOutput(pActInfo,out[i],GetPortAny(pActInfo, 0));
				}

			}
			break;
		}
	}
Beispiel #9
0
	IFlowSystemContainerPtr GetContainer(SActivationInfo* pActInfo)
	{
		TFlowSystemContainerId id = GetPortInt(pActInfo, EIP_Id);
		IFlowSystemContainerPtr container = gEnv->pFlowSystem->GetContainer(id);
		TFlowInputData data = GetPortAny(pActInfo, EIP_Add);
		if(container)
		{
			return container;
		}
		else
		{
			ActivateOutput(pActInfo, EOP_Error, 1); // Container doesn't exist			
			return NULL;
		}
	}
	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 #11
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 );
		}
	}

}
	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;
		}
	}
Beispiel #13
0
void CFlashUIToArrayNode::ProcessEvent( EFlowEvent event, SActivationInfo* pActInfo )
{
	if (event == eFE_Activate && IsPortActive( pActInfo, eI_Set ))
	{
		int count = GetPortInt( pActInfo, eI_Count );
		int port  = eI_Val1;

		SUIArguments args;
		for (int i = 0; i < count; ++i)
		{
			TFlowInputData data = GetPortAny( pActInfo, port + i );
			string         val;
			data.GetValueWithConversion( val );
			args.AddArgument( val );
		}

		ActivateOutput( pActInfo, eO_OnSet, true );
		ActivateOutput( pActInfo, eO_ArgList, string( args.GetAsString()));
	}
}
Beispiel #14
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo * pActInfo )
	{
		switch (event)
		{
			case eFE_Initialize:
				m_bClosed = GetPortBool( pActInfo, INP_Closed );
				break;						
		
			case eFE_Activate:
				if ( IsPortActive(pActInfo, INP_Closed) )
					m_bClosed = GetPortBool( pActInfo, INP_Closed );
				if ( IsPortActive(pActInfo, INP_Open) )
					m_bClosed = false;
				if ( IsPortActive(pActInfo, INP_Close) )
					m_bClosed = true;
				if ( IsPortActive(pActInfo, INP_In) && !m_bClosed )
					ActivateOutput( pActInfo, INP_In, GetPortAny(pActInfo, INP_In) );
			break;
		}
	}
Beispiel #15
0
void CFlashUIDelayNode::ProcessEvent( EFlowEvent event, SActivationInfo * pActInfo )
{
	switch (event)
	{
	case eFE_Initialize:
		pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, false);
		break;
	case eFE_Activate:
		pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, true);
		m_fTime = gEnv->pTimer->GetAsyncCurTime();
		break;
	case eFE_Update:
		if (m_fTime + GetPortFloat(pActInfo, eI_Delay) < gEnv->pTimer->GetAsyncCurTime())
		{
			ActivateOutput(pActInfo, eO_Done, GetPortAny(pActInfo, eI_Start));
			pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, false);
		}
		break;
	}
}
Beispiel #16
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo * pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
			m_timesTriggered = 0;
			break;
		case eFE_Activate:
			int limit =  GetPortInt(pActInfo, INP_Limit);

			if (m_timesTriggered < limit && IsPortActive(pActInfo, INP_In))
			{
				ActivateOutput(pActInfo, OUT_Out, GetPortAny(pActInfo, INP_In));
				m_timesTriggered++;
				break;
			}
			if (IsPortActive(pActInfo, INP_Reset))
				m_timesTriggered = 0;
			break;
		}
	}
Beispiel #17
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo * pActInfo )
	{
		switch (event)
		{
			case eFE_Initialize:
				m_closed = GetPortBool( pActInfo, IN_Closed );
			
			case eFE_ConnectOutputPort:
			case eFE_DisconnectOutputPort:
			{
				m_lastTriggeredPort = PORT_NONE;
				m_needToCheckConnectedPorts = true;
				m_numConnectedPorts = 0;
				break;
			}

			case eFE_Activate:
			{
				if ( IsPortActive(pActInfo, IN_Closed) )
					m_closed = GetPortBool( pActInfo, IN_Closed );
				if ( IsPortActive(pActInfo, IN_Open) )
					m_closed = false;
				if ( IsPortActive(pActInfo, IN_Close) )
					m_closed = true;
					
				if (IsPortActive(pActInfo, IN_Reset))
				{
					m_lastTriggeredPort = PORT_NONE;
				}
				
				if (m_needToCheckConnectedPorts)
				{
					m_needToCheckConnectedPorts = false;
					m_numConnectedPorts = 0;
					for (int port = 0; port<NUM_OUTPUTS; ++port)
					{
						if (IsOutputConnected( pActInfo, port ))
						{
							m_connectedPorts[m_numConnectedPorts] = port;
							m_numConnectedPorts++;
						}
					}
				}
				
				if (IsPortActive(pActInfo, IN_Input) && m_numConnectedPorts>0 && !m_closed)
				{
					bool reversed = GetPortBool( pActInfo, IN_Reverse );
					unsigned int port = m_lastTriggeredPort;

					if (reversed)
					{
						port = min( m_numConnectedPorts-1, port-1 ); // this takes care of both the initial state when it has the PORT_NONE value, and the overflow in the normal decrement situation
					}
					else
					{
						port = (port + 1) % m_numConnectedPorts;
					}

					ActivateOutput( pActInfo, m_connectedPorts[port], GetPortAny(pActInfo, IN_Input));
					m_lastTriggeredPort = port;
				}
				break;
			}
		}
	}
Beispiel #18
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo* pActInfo )
	{
		switch(event)
		{
			case eFE_Activate:
			{
				if(IsPortActive(pActInfo, EIP_Add))
				{
					if(IFlowSystemContainerPtr container = GetContainer(pActInfo))
					{
						TFlowInputData data = GetPortAny(pActInfo, EIP_Add);
						container->AddItem(data);
						ActivateOutput(pActInfo, EOP_Success, 1);
					}
				}			

				if(IsPortActive(pActInfo, EIP_AddUnique))
				{
					if(IFlowSystemContainerPtr container = GetContainer(pActInfo))
					{
						container->AddItemUnique(GetPortAny(pActInfo, EIP_AddUnique));
						ActivateOutput(pActInfo, EOP_Success, 1);
					}
				}			
				
				if(IsPortActive(pActInfo, EIP_Remove))
				{
					if(IFlowSystemContainerPtr container = GetContainer(pActInfo))
					{
						container->RemoveItem(GetPortAny(pActInfo, EIP_Remove));
						ActivateOutput(pActInfo, EOP_Success, 1);
					}
				}				

				if(IsPortActive(pActInfo, EIP_Clear))
				{
					if(IFlowSystemContainerPtr container = GetContainer(pActInfo))
					{
						container->Clear();
						ActivateOutput(pActInfo, EOP_Success, 1);
					}
				}				

				if(IsPortActive(pActInfo, EIP_GetCount))
				{
					if(IFlowSystemContainerPtr container = GetContainer(pActInfo))
					{
						ActivateOutput(pActInfo, EOP_Success, container->GetItemCount());
					}
				}			

				if(IsPortActive(pActInfo, EIP_Delete))
				{
					if(IFlowSystemContainerPtr container = GetContainer(pActInfo))
					{
						gEnv->pFlowSystem->DeleteContainer(GetPortInt(pActInfo, EIP_Id));
						ActivateOutput(pActInfo, EOP_Success, 1);
					}
				}			
			}
			break;
		}
	}
Beispiel #19
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo * pActInfo )
	{
		switch (event)
		{
		case eFE_ConnectOutputPort:
			if (pActInfo->connectPort < NUM_OUTPUTS)
			{
				++m_nConnectionCounts[pActInfo->connectPort];
				// check if already connected
				for (int i=0; i<m_nOutputCount; ++i)
				{
					if (m_nConnectedPorts[i] == pActInfo->connectPort) 
						return;
				}
				m_nConnectedPorts[m_nOutputCount++] = pActInfo->connectPort;
				Reset();
			}
			break;
		case eFE_DisconnectOutputPort:
			if (pActInfo->connectPort < NUM_OUTPUTS)
			{
				for (int i=0; i<m_nOutputCount; ++i)
				{
					// check if really connected
					if (m_nConnectedPorts[i] == pActInfo->connectPort)
					{
						if (m_nConnectionCounts[pActInfo->connectPort] == 1)
						{
							m_nConnectedPorts[i] = m_nPorts[m_nOutputCount - 1]; // copy last value to here
							m_nConnectedPorts[m_nOutputCount - 1] = -1;
							--m_nOutputCount;
							Reset();
						}
						--m_nConnectionCounts[pActInfo->connectPort];
						return;
					}
				}
			}
			break;
		case eFE_Initialize:
			Reset();
			break;

		case eFE_Activate:
			if (IsPortActive(pActInfo, EIP_Reset))
			{
				Reset();
			}
			if (IsPortActive(pActInfo, EIP_Input))
			{
				int numCandidates = m_nOutputCount - m_nTriggered;
				if (numCandidates <= 0)
					return;
				const int cand = cry_random(0, numCandidates - 1);
				const int whichPort = m_nPorts[cand];
				m_nPorts[cand] = m_nPorts[numCandidates-1];
				m_nPorts[numCandidates-1] = -1;
				++m_nTriggered;
				assert (whichPort >= 0 && whichPort < NUM_OUTPUTS);
				// CryLogAlways("CFlowNode_RandomTrigger: Activating %d", whichPort);
				ActivateOutput(pActInfo, whichPort, GetPortAny(pActInfo, EIP_Input));
				assert (m_nTriggered > 0 && m_nTriggered <= m_nOutputCount);
				if (m_nTriggered == m_nOutputCount)
				{
					// CryLogAlways("CFlowNode_RandomTrigger: Done.");
					// Done
					ActivateOutput(pActInfo, NUM_OUTPUTS, true);
					Reset();
				}
			}
			break;
		}
	}