Ejemplo n.º 1
0
void ObjectBase::SerializeObject( ticpp::Element* serializedElement )
{
	ticpp::Element element( "object" );
	element.SetAttribute( "class", _STDSTR( GetClassName() ) );
	element.SetAttribute( "expanded", GetExpanded() );

	for ( unsigned int i = 0; i < GetPropertyCount(); i++ )
	{
		PProperty prop = GetProperty( i );
		ticpp::Element prop_element( "property" );
		prop_element.SetAttribute( "name", _STDSTR( prop->GetName() ) );
		prop_element.SetText( _STDSTR( prop->GetValue() ) );
		element.LinkEndChild( &prop_element );
	}

	for ( unsigned int i = 0; i < GetEventCount(); i++ )
	{
		PEvent event = GetEvent( i );
		ticpp::Element event_element( "event" );
		event_element.SetAttribute( "name", _STDSTR( event->GetName() ) );
		event_element.SetText( _STDSTR( event->GetValue() ) );
		element.LinkEndChild( &event_element );
	}

	for ( unsigned int i = 0 ; i < GetChildCount(); i++ )
	{
		PObjectBase child = GetChild( i );
		ticpp::Element child_element;
		child->SerializeObject( &child_element );
		element.LinkEndChild( &child_element );
	}

	*serializedElement = element;
}
Ejemplo n.º 2
0
 void Update(float deltaSeconds)
 {
     while(GetEventCount() > 0)
     {
         auto event = GetEvent();
     }
     
     rotation += deltaSeconds * NinjaParty::PI;
 }
Ejemplo n.º 3
0
    /** 
     * Final processing.  Scales the histogram to the nubmer of events
     * and the bin width.
     */
    virtual void Terminate()
    {
      fOK = GetEventCount();
      if (fOK <= 0) {
	SetStatus(-1);
	Warning("Terminate", "No events selected");
	return;
      }
      fdNdy = static_cast<TH1*>(GetOutputObject("dNdy", TH1::Class()));
      if (!fdNdy) {
	SetStatus(-1);
	Warning("Terminate", "No dN/deta histogram found");
	return;
      }
      Printf("A total of %ld events", fOK);
      TH1* copy = static_cast<TH1*>(fdNdy->Clone("before"));
      fOutput->Add(copy);
						
      fdNdy->Scale(1. / fOK, "width");
      fdNdy->Draw();
      SetStatus(0);
    }
Ejemplo n.º 4
0
CEntityClass::SEventInfo CEntityClass::GetEventInfo( int nIndex )
{
	SEventInfo info;

	if (m_pEventHandler)
	{
		IEntityEventHandler::SEventInfo eventInfo;

		if (m_pEventHandler->GetEventInfo(nIndex, eventInfo))
		{
			info.name = eventInfo.name;
			info.bOutput = (eventInfo.type == IEntityEventHandler::Output);

			switch (eventInfo.valueType)
			{
			case IEntityEventHandler::Int:
				info.type = EVT_INT;
				break;
			case IEntityEventHandler::Float:
				info.type = EVT_FLOAT;
				break;
			case IEntityEventHandler::Bool:
				info.type = EVT_BOOL;
				break;
			case IEntityEventHandler::Vector:
				info.type = EVT_VECTOR;
				break;
			case IEntityEventHandler::Entity:
				info.type = EVT_ENTITY;
				break;
			case IEntityEventHandler::String:
				info.type = EVT_STRING;
				break;
			default:
				assert(0);
				break;
			}
		}
		else
		{
			info.name = "";
			info.bOutput = false;
		}

		return info;
	}

	if (!m_bScriptLoaded)
		LoadScript(false);

	assert( nIndex >= 0 && nIndex < GetEventCount() );

	if (m_pEntityScript)
	{
		const SEntityScriptEvent &scriptEvent = ((CEntityScript*)m_pEntityScript)->GetEvent( nIndex );
		info.name = scriptEvent.name.c_str();
		info.bOutput = scriptEvent.bOutput;
		info.type = scriptEvent.valueType;
	}
	else
	{
		info.name = "";
		info.bOutput = false;
	}

	return info;
}