AnnotationText CreateAnnotationText(XmlNode xmlAnnotation) { AnnotationText annotationText = new AnnotationText(); XmlNode xmlElements = null; XmlNodeList annotationChildNodeList = xmlAnnotation.ChildNodes; for (int w = 0; w < annotationChildNodeList.Count; w++) { xmlElements = annotationChildNodeList.Item(w); switch (xmlElements.Name) { case "value": //Debug.Log ("value: " + xmlElements.InnerText); if (xmlElements.InnerText.Length == 0) { return(null); } annotationText.TextValue = xmlElements.InnerText; break; case "formatting": //Debug.Log ("formatting: " + xmlElements.InnerText); XmlNodeList formattingChildNodes = xmlElements.ChildNodes; XmlNode xmlColor = formattingChildNodes.Item(0); FormattingText formattingText = new FormattingText(); int red = Int32.Parse(formattingChildNodes.Item(0).ChildNodes.Item(0).InnerText); int green = Int32.Parse(formattingChildNodes.Item(0).ChildNodes.Item(1).InnerText); int blue = Int32.Parse(formattingChildNodes.Item(0).ChildNodes.Item(2).InnerText); formattingText.Color = new Color32((byte)red, (byte)green, (byte)blue, 0); annotationText.FormattingText = formattingText; break; default: break; } } annotationText = (AnnotationText)AddAnnotationCommonFields(xmlAnnotation, annotationText); return(annotationText); }
AnnotationText CreateAnnotationText(XmlNode xmlAnnotation) { AnnotationText annotationText = new AnnotationText (); XmlNode xmlElements = null; XmlNodeList annotationChildNodeList = xmlAnnotation.ChildNodes; for (int w = 0; w < annotationChildNodeList.Count; w++) { xmlElements = annotationChildNodeList.Item (w); switch (xmlElements.Name) { case "value": //Debug.Log ("value: " + xmlElements.InnerText); if(xmlElements.InnerText.Length == 0) return null; annotationText.TextValue = xmlElements.InnerText; break; case "formatting": //Debug.Log ("formatting: " + xmlElements.InnerText); XmlNodeList formattingChildNodes = xmlElements.ChildNodes; XmlNode xmlColor = formattingChildNodes.Item (0); FormattingText formattingText = new FormattingText (); int red = Int32.Parse (formattingChildNodes.Item (0).ChildNodes.Item (0).InnerText); int green = Int32.Parse (formattingChildNodes.Item (0).ChildNodes.Item (1).InnerText); int blue = Int32.Parse (formattingChildNodes.Item (0).ChildNodes.Item (2).InnerText); formattingText.Color = new Color32 ((byte)red, (byte)green, (byte)blue, 0); annotationText.FormattingText = formattingText; break; default: break; } } annotationText = (AnnotationText) AddAnnotationCommonFields (xmlAnnotation, annotationText); return annotationText; }