public void LoadFromXml(XmlNode target) { name = target.Attributes ["Name"].Value; if (music == null) { music = new MusicTrackList(); } if (sound == null) { sound = new SoundTrackList(); } music.Clear(); sound.Clear(); if (XmlDataParser.IsAnyTagInChildExist(target, "Music")) { XmlNode musicNode = XmlDataParser.FindUniqueTagInChild(target, "Music"); if (XmlDataParser.IsAnyTagInChildExist(musicNode, "Track")) { if (musicNode.Attributes ["DelayBetweenTracks"] != null) { music.delay = AEngineTool.ParseFloat(musicNode.Attributes ["DelayBetweenTracks"].Value, 0f); } if (musicNode.Attributes ["MusicNotReplyLength"] != null) { music.musicNotReplyCount = int.Parse(musicNode.Attributes ["MusicNotReplyLength"].Value); } foreach (XmlNode musicTrack in XmlDataParser.FindAllTagsInChild(musicNode, "Track")) { Track track = LoadTrackFromXml(musicTrack); music.tracks.Add(track.name, track); if (musicTrack.Attributes ["Special"] == null) { music.AddTrackToBackgroundMusic(track); } } } } if (XmlDataParser.IsAnyTagInChildExist(target, "Sound")) { XmlNode soundNode = XmlDataParser.FindUniqueTagInChild(target, "Sound"); if (XmlDataParser.IsAnyTagInChildExist(soundNode, "Track")) { foreach (XmlNode soundTrack in XmlDataParser.FindAllTagsInChild(soundNode, "Track")) { Track track = LoadTrackFromXml(soundTrack); sound.tracks.Add(track.name, track); } } } }
public AudioBlock() { music = new MusicTrackList(); sound = new SoundTrackList(); }