Ejemplo n.º 1
0
	void CollisionSystem::AddNewActor(NamedProperties& np)
	{
		Actor* unit = NULL;

		np.Get("Actor", unit);
		m_registeredUnits.push_back(unit);
	}
Ejemplo n.º 2
0
//-----------------------------------------------------------------------------------------------
void Server::SetPortToBindToFromParameters( NamedProperties& parameters )
{
	std::string portAsString;

	parameters.Get( "param1", portAsString );

	FATAL_ASSERTION( portAsString != "", "Command: port did not receive the correct parameters.\nport expects a non empty string." );

	m_currentServerPort = u_short( atoi( portAsString.c_str() ) );
}
Ejemplo n.º 3
0
//-----------------------------------------------------------------------------------------------
void Server::SetServerIpFromParameters( NamedProperties& parameters )
{
	std::string ipAddressAsString;

	parameters.Get( "param1", ipAddressAsString );

	FATAL_ASSERTION( ipAddressAsString != "", "Command: ip did not receive the correct parameters.\nip expects a non empty string." );

	m_currentServerIPAddressAsString = ipAddressAsString;
}
Ejemplo n.º 4
0
void WidgetBase::ApplyWidgetProperties(const NamedProperties& widgetDescriptor)
{
	for (UIState state = UI_STATE_DEFAULT; state < NUM_UI_STATES; state = (UIState)(state + 1)) {
		std::string stateName = GetNameForState((UIState)state);
		NamedProperties currentNP;
		PropertyGetResult currentGetResult = widgetDescriptor.Get(stateName, currentNP);

		if (currentGetResult == RESULT_SUCCESS) {
			CopyStatePropertyToWidget(state, currentNP);
		}
	}
}
Ejemplo n.º 5
0
	void CollisionSystem::RemoveUnit(NamedProperties& np)
	{
		Actor* deadActor;
		np.Get("Actor", deadActor);

		for (auto it = m_registeredUnits.begin(); it != m_registeredUnits.end();)
		{
			if((*it)->GetID() == deadActor->GetID())
			{
				it = m_registeredUnits.erase(it);
			}
			else
				++it;
		}
	}
Ejemplo n.º 6
0
void WidgetBase::CopyStatePropertyToWidget(UIState state, const NamedProperties& currentNP)
{
			KeyFrameAnimation<Vec2> offset;
			KeyFrameAnimation<Vec2> size;
			KeyFrameAnimation<RGBA> color;
			KeyFrameAnimation<RGBA> edgeColor;
			KeyFrameAnimation<RGBA> innerColor;
			KeyFrameAnimation<float> borderSize;
			KeyFrameAnimation<float> opacity;
			KeyFrameAnimation<RGBA> textColor;
			KeyFrameAnimation<float> textScale;
			KeyFrameAnimation<float> textOpacity;
			KeyFrameAnimation<float> duration;
			KeyFrameAnimation<std::string> textContents;
			KeyFrameAnimation<std::vector<std::string>> updateEvent;
			KeyFrameAnimation<std::vector<std::string>> renderEvent;
			KeyFrameAnimation<std::vector<std::string>> enterEvent;
			KeyFrameAnimation<std::vector<std::string>> exitEvent;


			PropertyGetResult ofr = currentNP.Get("offset", offset);
			PropertyGetResult sr = currentNP.Get("size", size);
			PropertyGetResult cr = currentNP.Get("color", color);
			PropertyGetResult opr = currentNP.Get("opacity", opacity);
			PropertyGetResult ec = currentNP.Get("border color", edgeColor);
			PropertyGetResult bs = currentNP.Get("border size", borderSize);
			PropertyGetResult tc = currentNP.Get("text color", textColor);
			PropertyGetResult ts = currentNP.Get("text scale", textScale);
			PropertyGetResult to = currentNP.Get("text opacity", textOpacity);
			PropertyGetResult tcon = currentNP.Get("text", textContents);
			PropertyGetResult innerCol = currentNP.Get("inner color", innerColor);
			PropertyGetResult updEv = currentNP.Get("update event", updateEvent);
			PropertyGetResult renEv = currentNP.Get("render event", renderEvent);
			PropertyGetResult enEv = currentNP.Get("enter event", enterEvent);
			PropertyGetResult exEv = currentNP.Get("exit event", exitEvent);
			PropertyGetResult dur = currentNP.Get("duration", duration);

			if (ofr == RESULT_SUCCESS)
				m_stateProperties[state].Set("offset", offset);

			if (sr == RESULT_SUCCESS)
				m_stateProperties[state].Set("size", size);

			if (cr == RESULT_SUCCESS)
				m_stateProperties[state].Set("color", color);

			if (opr == RESULT_SUCCESS)
				m_stateProperties[state].Set("opacity", opacity);

			if (ec == RESULT_SUCCESS)
				m_stateProperties[state].Set("border color", edgeColor);

			if (bs == RESULT_SUCCESS)
				m_stateProperties[state].Set("border size", borderSize);

			if (tc == RESULT_SUCCESS)
				m_stateProperties[state].Set("text color", textColor);

			if (ts == RESULT_SUCCESS)
				m_stateProperties[state].Set("text scale", textScale);

			if (to == RESULT_SUCCESS)
				m_stateProperties[state].Set("text opacity", textOpacity);

			if (tcon == RESULT_SUCCESS)
				m_stateProperties[state].Set("text", textContents);

			if (innerCol == RESULT_SUCCESS)
				m_stateProperties[state].Set("inner color", innerColor);

			if (updEv == RESULT_SUCCESS)
				m_stateProperties[state].Set("update event", updateEvent);

			if (renEv == RESULT_SUCCESS)
				m_stateProperties[state].Set("render event", renderEvent);

			if (enEv == RESULT_SUCCESS)
				m_stateProperties[state].Set("enter event", enterEvent);

			if (exEv == RESULT_SUCCESS)
				m_stateProperties[state].Set("exit event", exitEvent);

			if (dur == RESULT_SUCCESS)
				m_stateProperties[state].Set("duration", duration);
}