コード例 #1
0
ファイル: FlashUIArrayNodes.cpp プロジェクト: joewan/pycmake
void CFlashUIFromArrayNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo )
{
	if (event == eFE_Activate && IsPortActive( pActInfo, eI_Array ))
	{
		SUIArguments args( GetPortString( pActInfo, eI_Array ).c_str());
		ActivateOutput( pActInfo, eO_Count, args.GetArgCount());

		SUIArguments leftOver;
		int          port = eO_Val1;

		for (int i = 0; i < args.GetArgCount(); ++i)
		{
			string arg;
			args.GetArg( i, arg );
			if (port + i < eO_LeftOver)
			{
				ActivateOutput( pActInfo, port + i, arg );
			}
			else
			{
				leftOver.AddArgument( arg );
			}
		}
		if (leftOver.GetArgCount() > 0)
		{
			ActivateOutput( pActInfo, eO_LeftOver, string( leftOver.GetAsString()));
		}
	}
}
コード例 #2
0
void CFlashUIEventNode::FlushNextEvent( SActivationInfo* pActInfo )
{
	if (m_events.size() > 0)
	{
		const std::pair<SUIArguments, int> &data          = m_events.get();
		const SUIArguments &                args          = data.first;
		bool                                bTriggerEvent = true;
		const int                           checkValue    = GetPortInt(pActInfo, eI_CheckPort);

		if (checkValue >= 0)
		{
			bTriggerEvent = false;
			CRY_ASSERT_MESSAGE(checkValue < args.GetArgCount(), "Port does not exist!" );
			if (checkValue < args.GetArgCount())
			{
				string val = GetPortString(pActInfo, eI_CheckValue);
				string compstr;
				args.GetArg(checkValue).GetValueWithConversion(compstr);
				bTriggerEvent = val == compstr;
			}
		}

		if (bTriggerEvent)
		{
			int    end = m_eventDesc.InputParams.Params.size();
			string val;

			int i = 0;
			for (; i < end; ++i)
			{
				CRY_ASSERT_MESSAGE( i < args.GetArgCount(), "UIEvent received wrong number of arguments!" );
				ActivateDynOutput( i < args.GetArgCount() ? args.GetArg(i) : TUIData(string("")), m_eventDesc.InputParams.Params[i], pActInfo, i + 2 );
			}
			if (m_eventDesc.InputParams.IsDynamic)
			{
				SUIArguments dynarg;
				for (; i < args.GetArgCount(); ++i)
				{
					if (args.GetArg( i, val ))
						dynarg.AddArgument( val );
				}
				ActivateOutput( pActInfo, end + eO_DynamicPorts, string( dynarg.GetAsString()));
			}
			ActivateOutput( pActInfo, eO_OnEvent, true );
			ActivateOutput( pActInfo, eO_OnInstanceId, data.second );
		}
		m_events.pop();
	}
}
コード例 #3
0
ファイル: FlashUIAction.cpp プロジェクト: souxiaosou/FireNET
//------------------------------------------------------------------------------------
void CUIActionManager::EndActionInt( IUIAction* pAction, const SUIArguments& args )
{
    FUNCTION_PROFILER(GetISystem(), PROFILE_ACTION);

    if ( pAction && m_actionStateMap[ pAction ] ) // only allow to end actions that are started
    {
        m_actionStateMap[pAction] = false;

        UIACTION_LOG( "UIAction %s end (Args: %s)", pAction->GetName(), args.GetAsString() );

        if (pAction->GetType() == IUIAction::eUIAT_LuaScript)
            ((CFlashUIAction*)pAction)->EndScript();

        for (TActionListener::Notifier notifier(m_listener); notifier.IsValid(); notifier.Next())
            notifier->OnEnd( pAction, args );
    }
}
コード例 #4
0
ファイル: FlashUIAction.cpp プロジェクト: souxiaosou/FireNET
//------------------------------------------------------------------------------------
void CUIActionManager::StartActionInt( IUIAction* pAction, const SUIArguments& args )
{
    FUNCTION_PROFILER(GetISystem(), PROFILE_ACTION);

    if ( pAction && pAction->IsValid() )
    {
        m_actionStateMap[ pAction ] = true;

        EnableActionInt( pAction, true );

        UIACTION_LOG( "UIAction %s start (Args: %s)", pAction->GetName(), args.GetAsString() );

        if (pAction->GetType() == IUIAction::eUIAT_LuaScript)
            ((CFlashUIAction*)pAction)->StartScript(args);

        for (TActionListener::Notifier notifier(m_listener); notifier.IsValid(); notifier.Next())
            notifier->OnStart( pAction, args );
    }
}
コード例 #5
0
ファイル: FlashUIAction.cpp プロジェクト: souxiaosou/FireNET
//------------------------------------------------------------------------------------
void CUIActionManager::EndAction( IUIAction* pAction, const SUIArguments& args )
{
    if (!m_bAcceptRequests) return;

    if ( pAction && pAction->IsValid() )
    {
#ifndef _RELEASE
        if (m_actionEndMap.find(pAction) != m_actionEndMap.end())
        {
            UIACTION_WARNING( "UIAction %s already ended! Old args will be discarded!", pAction->GetName() );
        }
#endif
        m_actionEndMap[pAction] = args;
        stl::member_find_and_erase(m_actionStartMap, pAction);
        UIACTION_LOG( "UIAction %s end request (Args: %s)", pAction->GetName(), args.GetAsString() );
        return;
    }
    UIACTION_ERROR( "EndAction failed! UIAction %s not valid!", pAction ? pAction->GetName() : "NULL" );
}
コード例 #6
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()));
			}
		}
	}
}
コード例 #7
0
ファイル: FlashUIArrayNodes.cpp プロジェクト: joewan/pycmake
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()));
	}
}
コード例 #8
0
void CFlashUIActionNode::OnEnd( IUIAction* pAction, const SUIArguments& args  )
{
	if ( m_pAction != NULL && pAction == m_pAction )
	{
		UI_STACK_PUSH( m_endStack, std::make_pair( pAction, args ), "OnEnd UIAction %s (%s)", pAction->GetName(), args.GetAsString() );
		if ( m_bWasStarted )
		{
			m_bWasStarted = false;
			UI_STACK_PUSH( m_selfEndStack, std::make_pair( pAction, args ), "OnEnd (self) UIAction %s (%s)", pAction->GetName(), args.GetAsString() );
		}
	}
}
コード例 #9
0
void CFlashUIActionNode::OnStart( IUIAction* pAction, const SUIArguments& args  )
{
	if ( m_pAction != NULL && pAction == m_pAction )
	{
		UI_STACK_PUSH(m_startStack, std::make_pair( pAction, args ), "OnStart UIAction %s (%s)", pAction->GetName(), args.GetAsString() );
	}
}
コード例 #10
0
void CFlashUIEventNode::OnUIEvent( IUIElement* pSender, const SUIEventDesc &event, const SUIArguments &args )
{
	if (m_eventDesc == event)
	{
		UI_STACK_PUSH(m_events, std::make_pair(args, pSender->GetInstanceID()), "OnFlashEvent %s@%i %s (%s)", pSender->GetName(), pSender->GetInstanceID(), event.sDisplayName, args.GetAsString());
	}
}