示例#1
0
        private void LoadAudio(XmlReader reader)
        {
            if (reader.AttributeCount > 0)
            {
                int count = 0;
                if (!int.TryParse(reader.GetAttribute("count"), out count))
                {
                    return;
                }
                this.loadedAudio = new int[count];
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.EndElement && reader.Name.ToLower() == "audio")
                {
                    return;
                }

                if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "audiosource")
                {
                    if (reader.AttributeCount > 0)
                    {
                        int id = AssetManager.AquireAudio(reader.GetAttribute("filename"));
                        AssetManager.GetAudio(id).ReadXml(reader);
                    }
                }
            }
        }