private Question CreateQuestion(XmlNode questionresource) { Question toRet = null; XmlNode nodeID = questionresource.Attributes.GetNamedItem("id"); Debug.Assert(nodeID != null, "[WARNING] - A question node must have a unique id!"); XmlNode textureNode = questionresource.Attributes.GetNamedItem("texture"); Debug.Assert(textureNode != null, "[WARNING] - A question node must have a texture assigned!"); XmlNode fadeNode = questionresource.Attributes.GetNamedItem("faderate"); String nodeName = ""; String textureName = ""; float fadeRate = 1.0f; if ( nodeID != null ) nodeName = nodeID.Value; if ( textureNode != null ) textureName = textureNode.Value; if ( fadeNode != null ) fadeRate = Convert.ToSingle(fadeNode.Value); // Create the question toRet = new Question(nodeName, textureName, fadeRate); if (nodeID != null) { // Add any scene properties foreach (XmlNode child in questionresource) { if (child.Attributes.Count > 0) { XmlAttribute attr = child.Attributes[0]; String propertyName = attr.Name; String value = attr.InnerText; // Set the property through the factory assigned properties bool success = Factory.Instance.SetProperty(toRet.GetType(), propertyName, value, toRet); Debug.Assert(success, "[Warning] - Loading property " + propertyName + " on node " + toRet.Name + " failed!"); } } } return toRet; }
private void AddQuestion(Question question) { m_Questions.Add(question); }