Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Writes the trigger data.
- for (auto trigger : writerData->m_LayerManager->m_LevelEditorTriggers)
- {
- rapidxml::xml_node<>* triggerElement = levelDocument->allocate_node(rapidxml::node_element, "Trigger");
- levelElement->append_node(triggerElement);
- // Saves the name of the trigger.
- PXMLUtil::AddAttribute(triggerElement, levelDocument, "name", trigger->GetTriggerName());
- // Saves the dimensions of the rect of the trigger.
- PXMLUtil::AddAttribute(triggerElement, levelDocument, "x", TString((int)trigger->GetTriggerRect().X));
- PXMLUtil::AddAttribute(triggerElement, levelDocument, "y", TString((int)trigger->GetTriggerRect().Y));
- PXMLUtil::AddAttribute(triggerElement, levelDocument, "w", TString((int)trigger->GetTriggerRect().W));
- PXMLUtil::AddAttribute(triggerElement, levelDocument, "h", TString((int)trigger->GetTriggerRect().H));
- // Saves the actions and their properties.
- for (auto triggerAction : trigger->GetTriggerActions())
- {
- rapidxml::xml_node<>* actionElement = levelDocument->allocate_node(rapidxml::node_element, "Action");
- triggerElement->append_node(actionElement);
- // Saves the type of the action.
- PXMLUtil::AddAttribute(actionElement, levelDocument, "type", g_LevelTriggerActionTypeNames[(int)triggerAction->m_ActionType]);
- // Then saves the properties.
- for (auto property : triggerAction->m_ActionData->GetActionProperties())
- {
- // Creates the property element.
- rapidxml::xml_node<>* propertyElement = levelDocument->allocate_node(rapidxml::node_element, "Property");
- actionElement->append_node(propertyElement);
- // Saves the name of the property.
- PXMLUtil::AddAttribute(propertyElement, levelDocument, "name", property->m_PropertyName);
- // Then saves the value of the property.
- PXMLUtil::AddAttribute(propertyElement, levelDocument, "value", property->PropertyValueToString());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement