Пример #1
0
void CFlashUIConstraintsNode::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 ) )
        {
            IUIElement::SUIConstraints constraints;
            SPerInstanceCall1< IUIElement::SUIConstraints& > caller;
            if ( !caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIConstraintsNode::GetConstraints), constraints, false) )
            {
                UIACTION_WARNING( "FG: UIElement \"%s\" can't get Constraints 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_PosType, (int) constraints.eType );
            ActivateOutput( pActInfo, eO_Left, constraints.iLeft );
            ActivateOutput( pActInfo, eO_Top, constraints.iTop );
            ActivateOutput( pActInfo, eO_Width, constraints.iWidth );
            ActivateOutput( pActInfo, eO_Height, constraints.iHeight );
            ActivateOutput( pActInfo, eO_Scale, constraints.bScale );
            ActivateOutput( pActInfo, eO_HAlign, (int) constraints.eHAlign );
            ActivateOutput( pActInfo, eO_VAlign, (int) constraints.eVAlign );
            ActivateOutput( pActInfo, eO_Maximize, constraints.bMax );
            ActivateOutput( pActInfo, eO_OnGet, true );
        }

        if ( IsPortActive( pActInfo, eI_Set ) )
        {
            IUIElement::SUIConstraints constraints;
            constraints.eType = (IUIElement::SUIConstraints::EPositionType) GetPortInt( pActInfo, eI_PosType );
            constraints.iLeft = GetPortInt( pActInfo, eI_Left );
            constraints.iTop = GetPortInt( pActInfo, eI_Top );
            constraints.iWidth = GetPortInt( pActInfo, eI_Width );
            constraints.iHeight = GetPortInt( pActInfo, eI_Height );
            constraints.eHAlign = (IUIElement::SUIConstraints::EPositionAlign) GetPortInt( pActInfo, eI_HAlign );
            constraints.eVAlign = (IUIElement::SUIConstraints::EPositionAlign) GetPortInt( pActInfo, eI_VAlign );
            constraints.bScale = GetPortBool( pActInfo, eI_Scale );
            constraints.bMax = GetPortBool( pActInfo, eI_Maximize );

            SPerInstanceCall1< const IUIElement::SUIConstraints& > caller;
            caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIConstraintsNode::SetConstraints), constraints);

            ActivateOutput( pActInfo, eO_OnSet, true );
        }
    }
}
Пример #2
0
//------------------------------------------------------------------------
int CScriptBind_UIAction::GetScale( IFunctionHandler *pH, const char * elementName, int instanceID, const char * mcName )
{
	IUIElement* pElement = GetElement( elementName, instanceID );
	if ( pElement )
	{
		IFlashVariableObject* pMC = pElement->GetMovieClip( mcName );
		if ( pMC )
		{
			SFlashDisplayInfo info;
			pMC->GetDisplayInfo( info );
			return pH->EndFunction( Script::SetCachedVector( Vec3( info.GetXScale(), info.GetYScale(), info.GetZScale() ), pH, 1 ) );
		}
		UIACTION_WARNING( "LUA: Element %s has no movieclip %s", elementName, mcName );
	}
	else
	{
		UIACTION_WARNING( "LUA: UIElement %s does not exist", elementName );
	}
	return pH->EndFunction( false );
}
Пример #3
0
//------------------------------------------------------------------------
int CScriptBind_UIAction::EnableAction( IFunctionHandler *pH, const char * actionName )
{
	IUIAction* pAction = GetAction( actionName );
	if ( pAction )
	{
		pAction->SetEnabled( true );
		return pH->EndFunction( true );
	}
	UIACTION_WARNING( "LUA: UIAction %s does not exist", actionName );
	return pH->EndFunction( false );
}
Пример #4
0
//------------------------------------------------------------------------
int CScriptBind_UIAction::GotoAndStopFrameName( IFunctionHandler *pH, const char * elementName, int instanceID, const char * mcName, const char * frameName )
{
	IUIElement* pElement = GetElement( elementName, instanceID );
	if ( pElement )
	{
		IFlashVariableObject* pMC = pElement->GetMovieClip( mcName );
		if ( pMC )
		{
			pMC->GotoAndStop( frameName );
			return pH->EndFunction( true );
		}
		UIACTION_WARNING( "LUA: Element %s has no movieclip %s", elementName, mcName );
	}
	else
	{
		UIACTION_WARNING( "LUA: UIElement %s does not exist", elementName );
	}
	return pH->EndFunction( false );

}
Пример #5
0
//------------------------------------------------------------------------
int CScriptBind_UIAction::RegisterActionListener( IFunctionHandler *pH, SmartScriptTable pTable, const char* actionName, const char* eventName, const char* callback )
{
	if (!pTable)
	{
		UIACTION_WARNING( "LUA: RegisterActionListener received non-valid script table!");
		return pH->EndFunction( false );
	}

	IUIAction* pAction = strlen(actionName) > 0 ? GetAction( actionName ) : NULL;
	m_ActionCallbacks.AddCallback(pTable, callback, SUILuaCallbackInfo<IUIAction>::CreateInfo(pAction, eventName ? eventName : ""));
	return pH->EndFunction(true);
}
Пример #6
0
// ---------------------------------------------------------------
void CFlashUIBaseNode::UpdateUIElement( const string &sName, SActivationInfo* pActInfo )
{
	if (gEnv->pFlashUI)
	{
		m_pElement = gEnv->pFlashUI->GetUIElement( sName );

		if (!m_pElement)
		{
			UIACTION_WARNING( "FG: UIElement \"%s\" does not exist, referenced at node \"%s\"", sName.c_str(), pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ));
		}
	}
}
Пример #7
0
// ---------------------------------------------------------------
void CFlashUIBaseNodeDynPorts::ActivateDynOutput( const TUIData &arg, const SUIParameterDesc &desc, SActivationInfo* pActInfo, int port)
{
	switch (desc.eType)
	{
	case SUIParameterDesc::eUIPT_Bool:
	{
		bool       val;
		const bool ok = arg.GetValueWithConversion(val);
		if (!ok) UIACTION_WARNING( "FG: Node \"%s\" received wrong data on typed input!", pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ));
		ActivateOutput(pActInfo, port, val);
	}
	break;
	case SUIParameterDesc::eUIPT_Int:
	{
		int        val;
		const bool ok = arg.GetValueWithConversion(val);
		if (!ok) UIACTION_WARNING( "FG: Node \"%s\" received wrong data on typed input!", pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ));
		ActivateOutput(pActInfo, port, val);
	}
	break;
	case SUIParameterDesc::eUIPT_Float:
	{
		float      val;
		const bool ok = arg.GetValueWithConversion(val);
		if (!ok) UIACTION_WARNING( "FG: Node \"%s\" received wrong data on typed input!", pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ));
		ActivateOutput(pActInfo, port, val);
	}
	break;
	case SUIParameterDesc::eUIPT_String:
	case SUIParameterDesc::eUIPT_WString:
	default:
	{
		string     val;
		const bool ok = arg.GetValueWithConversion(val);
		if (!ok) UIACTION_WARNING( "FG: Node \"%s\" received wrong data on typed input!", pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ));
		ActivateOutput(pActInfo, port, val);
	}
	break;
	}
}
Пример #8
0
void CFlashUIMCPosRotScaleBaseNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo )
{
	if (event == eFE_Initialize)
	{
		UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIMovieClip)), pActInfo, m_isTemplate );
	}
	else if (event == eFE_Activate)
	{
		if (IsPortActive( pActInfo, GetInputPort(eI_UIMovieClip)))
		{
			UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIMovieClip)), 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)))
			{
				const Vec3 pos   = GetPortVec3( pActInfo, GetInputPort(eI_Pos));
				const Vec3 rot   = GetPortVec3( pActInfo, GetInputPort(eI_Rot));
				const Vec3 scale = GetPortVec3( pActInfo, GetInputPort(eI_Scale));

				SPerInstanceCall3< const Vec3 &, const Vec3 &, const Vec3 & > caller;
				caller.Execute(GetElement(), instanceId, functor(*this, &CFlashUIMCPosRotScaleBaseNode::SetValues), pos, rot, scale);

				ActivateOutput( pActInfo, eO_OnSet, true );
				ActivateOutput( pActInfo, eO_Pos, pos );
				ActivateOutput( pActInfo, eO_Rot, rot );
				ActivateOutput( pActInfo, eO_Scale, scale );
			}
			else if (IsPortActive( pActInfo, GetInputPort(eI_Get)))
			{
				Vec3 pos;
				Vec3 rot;
				Vec3 scale;

				SPerInstanceCall3< Vec3 &, Vec3 &, Vec3 & > caller;
				if (!caller.Execute(GetElement(), instanceId, functor(*this, &CFlashUIMCPosRotScaleBaseNode::GetValues), pos, rot, scale, false))
				{
					UIACTION_WARNING( "FG: UIElement \"%s\" called get PosRotScale for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetElement()->GetName(),instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ));
				}

				ActivateOutput( pActInfo, eO_Pos, pos );
				ActivateOutput( pActInfo, eO_Rot, rot );
				ActivateOutput( pActInfo, eO_Scale, scale );
			}
		}
	}
}
Пример #9
0
//------------------------------------------------------------------------
int CScriptBind_UIAction::SetVisible( IFunctionHandler *pH, const char * elementName, int instanceID, const char * mcName, bool bVisible )
{
	IUIElement* pElement = GetElement( elementName, instanceID );
	if ( pElement )
	{
		IFlashVariableObject* pMC = pElement->GetMovieClip( mcName );
		if ( pMC )
		{
			SFlashDisplayInfo info;
			pMC->GetDisplayInfo( info );
			info.SetVisible( bVisible );
			pMC->SetDisplayInfo( info );
			return pH->EndFunction( true );
		}
		UIACTION_WARNING( "LUA: Element %s has no movieclip %s", elementName, mcName );
	}
	else
	{
		UIACTION_WARNING( "LUA: UIElement %s does not exist", elementName );
	}
	return pH->EndFunction( false );
}
Пример #10
0
//------------------------------------------------------------------------
int CScriptBind_UIAction::RegisterEventSystemListener( IFunctionHandler *pH, SmartScriptTable pTable, const char* eventSystem, const char* eventName, const char* callback )
{
	if (!pTable)
	{
		UIACTION_WARNING( "LUA: RegisterEventSystemListener received non-valid script table!");
		return pH->EndFunction( false );
	}

	IUIEventSystem* pEventSystem = GetEventSystem( eventSystem, IUIEventSystem::eEST_SYSTEM_TO_UI );
	m_EventSystemCallbacks.Init(pEventSystem);
	m_EventSystemCallbacks.AddCallback(pTable, callback, SUILuaCallbackInfo<IUIEventSystem>::CreateInfo(pEventSystem, eventName ? eventName : ""));
	return pH->EndFunction(true);
}
Пример #11
0
void CFlashUIMCTemplateCreateNode::CreateMoviclip( IUIElement* pElement, const SUIMovieClipDesc* pTemplate, const SUIMovieClipDesc* pParent, string &newname )
{
	const SUIMovieClipDesc* pNewMC = NULL;
	pElement->CreateMovieClip( pNewMC, pTemplate, pParent, newname.length() > 0 ? newname.c_str() : NULL);
	if (pNewMC)
	{
		newname = pNewMC->sDisplayName;
	}
	else
	{
		UIACTION_WARNING( "FG: UIElement \"%s\" could not create MovieClip with name \"%s\" (MovieClip with same name already exists!)", pElement->GetName(),newname.c_str());
	}
}
Пример #12
0
//------------------------------------------------------------------------
IUIEventSystem* CScriptBind_UIAction::GetEventSystem( const char* sName, IUIEventSystem::EEventSystemType type )
{
	if (gEnv->IsDedicated())
		return NULL;

	CRY_ASSERT_MESSAGE( gEnv->pFlashUI, "FlashUI extension does not exist!" );
	if ( !gEnv->pFlashUI )
	{
		UIACTION_WARNING( "LUA: FlashUI extension does not exist!" );
		return NULL;
	}

	return gEnv->pFlashUI->GetEventSystem( sName, type );
}
Пример #13
0
//------------------------------------------------------------------------
int CScriptBind_UIAction::RegisterElementListener( IFunctionHandler *pH, SmartScriptTable pTable, const char* elementName, int instanceID, const char* eventName, const char* callback )
{
	if (!pTable)
	{
		UIACTION_WARNING( "LUA: RegisterElementListener received non-valid script table!");
		return pH->EndFunction( false );
	}

	IUIElement* pElement = strlen(elementName) > 0 ? GetElement( elementName, 0 ) : NULL;
	m_ElementCallbacks.Init(pElement);
	m_ElementCallbacks.AddCallback(pTable, callback, SUILuaCallbackInfo<IUIElement>::CreateInfo(pElement, eventName ? eventName : "", instanceID));
	return pH->EndFunction(true);

}
Пример #14
0
//------------------------------------------------------------------------
int CScriptBind_UIAction::SetArray( IFunctionHandler *pH, const char * elementName, int instanceID, const char* arrayName, SmartScriptTable values )
{
	IUIElement* pElement = GetElement( elementName, instanceID );
	if ( pElement )
	{
		const SUIParameterDesc* pArrayDesc = pElement->GetArrayDesc( arrayName );
		if ( pArrayDesc )
		{
			SUIArguments vals;
			if (SUIToLuaConversationHelper::LuaTableToUIArgs(values, vals))
			{
				bool bVarOk = true;
				if ( instanceID < 0 )
				{
					IUIElementIteratorPtr elements = pElement->GetInstances();
					while ( IUIElement* pInstance = elements->Next() )
						bVarOk &= pInstance->SetArray( pArrayDesc, vals );
				}
				else
				{
					bVarOk = pElement->SetArray( pArrayDesc, vals );
				}

				if ( bVarOk )
					return pH->EndFunction(true);
			}
			UIACTION_ERROR( "LUA: Failed to set array %s on Element %s: Invalid arguments", arrayName, elementName);
		}
		UIACTION_WARNING( "LUA: Element %s has no array %s", elementName, arrayName);
	}
	else
	{
		UIACTION_WARNING( "LUA: UIElement %s does not exist", elementName);
	}
	return pH->EndFunction(false);
}
Пример #15
0
void CFlashUIMCVisibleBaseNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo )
{
	if (event == eFE_Initialize)
	{
		UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIMovieClip)), pActInfo, m_isTemplate );
	}
	else if (event == eFE_Activate)
	{
		if (IsPortActive( pActInfo, GetInputPort(eI_UIMovieClip)))
		{
			UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIMovieClip)), 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)))
			{
				const bool  bVis  = GetPortBool( pActInfo, GetInputPort(eI_Visible));
				const float alpha = clamp_tpl( GetPortFloat( pActInfo, GetInputPort(eI_Alpha)), 0.0f, 1.f );

				SPerInstanceCall2< bool, float > caller;
				caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIMCVisibleBaseNode::SetValues), bVis, alpha );

				ActivateOutput( pActInfo, eO_OnSet, true );
				ActivateOutput( pActInfo, eO_Visible, bVis );
				ActivateOutput( pActInfo, eO_Alpha, alpha );
			}
			else if (IsPortActive( pActInfo, GetInputPort(eI_Get)))
			{
				bool  bVis  = false;
				float alpha = 0.f;

				SPerInstanceCall2< bool &, float & > caller;
				if (!caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIMCVisibleBaseNode::GetValues), bVis, alpha, 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_Visible, bVis );
				ActivateOutput( pActInfo, eO_Alpha, alpha );
			}
		}
	}
}
Пример #16
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 );
		}
	}

}
Пример #17
0
void CFlashUIActionBaseNode::UpdateAction( IFlowGraph* pGraph )
{
	if ( gEnv->pFlashUI )
	{
		int i = 0;
		while ( IUIAction* pAction = gEnv->pFlashUI->GetUIAction(i++) )
		{
			if ( pAction->GetType() == IUIAction::eUIAT_FlowGraph && pAction->GetFlowGraph() == pGraph )
			{
				m_pAction = pAction;
				break;
			}
		}
	}
	if ( !m_pAction )
	{
		UIACTION_WARNING( "FG: UI:Action:Start/End nodes only allowed within UIAction graph!" );
	}
}
Пример #18
0
//------------------------------------------------------------------------------------
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" );
}
Пример #19
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()));
			}
		}
	}
}
Пример #20
0
//------------------------------------------------------------------------
int CScriptBind_UIAction::RequestHide( IFunctionHandler *pH, const char * elementName, int instanceID )
{
	IUIElement* pElement = GetElement( elementName, instanceID );
	if ( pElement )
	{
		if ( instanceID < 0 )
		{
			IUIElementIteratorPtr elements = pElement->GetInstances();
			while ( IUIElement* pInstance = elements->Next() )
				pInstance->RequestHide();
		}
		else
		{
			pElement->RequestHide();
		}
		return pH->EndFunction( true );
	}
	UIACTION_WARNING( "LUA: UIElement %s does not exist", elementName );
	return pH->EndFunction( false );
}
Пример #21
0
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 );
        }
    }
}
Пример #22
0
void CFlashUIDisplayConfigNode::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 ) )
        {
            SPerInstanceCall1< SActivationInfo* > caller;
            if ( !caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIDisplayConfigNode::GetFromInstance), pActInfo, false) )
            {
                UIACTION_WARNING( "FG: UIElement \"%s\" called get flags 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_OnGet, true );
        }

        if ( IsPortActive( pActInfo, eI_Set ) )
        {
            const float alpha = GetPortFloat( pActInfo, eI_Alpha );
            const int layer = GetPortInt( pActInfo, eI_Layer );
            const uint64 flags = GetFlags( pActInfo );

            SPerInstanceCall3< uint64, float, int > caller;
            caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIDisplayConfigNode::SetToInstance), flags, alpha, layer );
            ActivateOutput( pActInfo, eO_OnSet, true );
        }
    }
}