private static bool loadResourceParsing(XmlNodeList nodeLists, SoundGroup soundParentGroup) { // Read nodes for (int i = 0; i < nodeLists.Count; i++) { XmlNode nodeList = nodeLists[i]; // Read sound if (nodeList.Name == "SOUND") { string name = ""; string fname = ""; string type = ""; int volume = 100; bool loop = false; bool unique = false; int mindist = 100; int maxdist = 1000; int priority = 128; for (int j = 0; j < nodeList.Attributes.Count; j++) { XmlAttribute attrSound = nodeList.Attributes[j]; if (attrSound.Name == "name") { name = attrSound.Value; } else if (attrSound.Name == "filename") { fname = attrSound.Value; } else if (attrSound.Name == "type") { type = attrSound.Value; } else if (attrSound.Name == "volume") { volume = (int)(double.Parse(attrSound.Value) * 100.0); } else if (attrSound.Name == "loop") { loop = bool.Parse(attrSound.Value); } else if (attrSound.Name == "unique") { unique = bool.Parse(attrSound.Value); } else if (attrSound.Name == "min_dist") { mindist = int.Parse(attrSound.Value); } else if (attrSound.Name == "max_dist") { maxdist = int.Parse(attrSound.Value); } else if (attrSound.Name == "priority") { priority = int.Parse(attrSound.Value); } } SoundItem soundItem = new SoundItem(); soundItem.Parent = soundParentGroup; soundItem.Name = name; soundItem.Filename = fname; soundItem.Type = type; soundItem.Volume = volume; soundItem.Loop = loop; soundItem.Unique = unique; soundItem.MinDistance = mindist; soundItem.MaxDistance = maxdist; soundItem.Priority = priority; soundParentGroup.Nodes.Add(soundItem); // Read controls XmlNodeList nodelistControl = nodeList.ChildNodes; for (int j = 0; j < nodelistControl.Count; j++) { XmlNode nodeControl = nodelistControl[j]; if (nodeControl.Name != "CONTROL") { continue; } string nameControl = ""; string typeControl = ""; double scaleControl = 1.0; for (int k = 0; k < nodeControl.Attributes.Count; k++) { XmlAttribute attrControl = nodeControl.Attributes[k]; if (attrControl.Name == "name") { nameControl = attrControl.Value; } else if (attrControl.Name == "type") { typeControl = attrControl.Value; } else if (attrControl.Name == "volume") { scaleControl = Double.Parse(attrControl.Value); } } } } // Read group else if (nodeList.Name == "GROUP") { string name = ""; for (int j = 0; j < nodeList.Attributes.Count; j++) { XmlAttribute attrGroup = nodeList.Attributes[j]; if (attrGroup.Name == "name") { name = attrGroup.Value; } } SoundGroup soundGroup = new SoundGroup(); soundGroup.Parent = soundParentGroup; soundGroup.Name = name; soundParentGroup.Nodes.Add(soundGroup); XmlNodeList nodelistNext = nodeList.ChildNodes; if (loadResourceParsing(nodelistNext, soundGroup) == false) { return(false); } } } return(true); }