public XmlNode GenerateXML() { // Create XML Node and Attributes XmlDocument d = new XmlDocument(); XmlNode output = d.CreateNode("element", "InputInfo", null); XmlAttribute color = d.CreateAttribute("Color"); XmlAttribute numberOfLines = d.CreateAttribute("NumberOfLines"); XmlAttribute condition = d.CreateAttribute("Condition"); // Set Attribute values color.Value = Color; numberOfLines.Value = NumberOfLines.ToString(); condition.Value = Condition; // Attach Attributes and Content if (!string.IsNullOrEmpty(Color)) { output.Attributes.Append(color); } if (NumberOfLines == 2) { output.Attributes.Append(numberOfLines); } output.InnerText = Content; if (!string.IsNullOrEmpty(Condition)) { output.Attributes.Append(condition); } return(output); }
private void Init(SerializedProperty property) { if (m_initialized.ContainsKey(property.propertyPath) && m_initialized[property.propertyPath]) { return; } NumberOfLines.Add(property.propertyPath, 1); Elements.AddLabel(Contents.Add(AnimatorEvent.ParameterType.Bool.ToString().ToLower())); Elements.AddLabel(Contents.Add(AnimatorEvent.ParameterType.Float.ToString().ToLower())); Elements.AddLabel(Contents.Add(AnimatorEvent.ParameterType.Int.ToString().ToLower())); Elements.AddLabel(Contents.Add(AnimatorEvent.ParameterType.Trigger.ToString().ToLower())); Elements.AddLabel(Contents.Add(UILabels.TriggerName)); Elements.Add(Properties.Add(PropertyName.Animator, property), Contents.Add(UILabels.TargetAnimator)); Elements.Add(Properties.Add(PropertyName.TargetParameterType, property), Contents.Add(UILabels.ParameterType)); Elements.Add(Properties.Add(PropertyName.ParameterName, property), Contents.Add(UILabels.ParameterName)); Elements.Add(Properties.Add(PropertyName.BoolValue, property), Contents.Add(UILabels.SetBoolValueTo), 0f, DGUI.Toggle.Checkbox.Width); Elements.Add(Properties.Add(PropertyName.FloatValue, property), Contents.Add(UILabels.SetFloatValueTo)); Elements.Add(Properties.Add(PropertyName.IntValue, property), Contents.Add(UILabels.SetIntValueTo)); Elements.Add(Properties.Add(PropertyName.ResetTrigger, property), Contents.Add(UILabels.ResetTrigger), 0f, DGUI.Toggle.Checkbox.Width); UpdateParameters(property); if (!m_initialized.ContainsKey(property.propertyPath)) { m_initialized.Add(property.propertyPath, true); } else { m_initialized[property.propertyPath] = true; } }