private void LoadAudioConfiguration() { // Default settings fadeTime = 0; fadeOn = false; if (!File.Exists(AudioConstants.GetResourcesPath())) { return; } XmlDocument xmlDocument = XmlParser.LoadFromResources(AudioConstants.GetReadableRuntimeResourcesPath()); XmlNode rootNode = XmlDataParser.FindUniqueTag(xmlDocument, "AudioData"); if (!XmlDataParser.IsAnyTagInChildExist(rootNode, "AudioConfiguration")) { return; } XmlNode configNode = XmlDataParser.FindUniqueTagInChild(rootNode, "AudioConfiguration"); _generalAudioSettings.Load(configNode); fadeTime = float.Parse(configNode.Attributes ["fade"].Value); fadeOn = bool.Parse(configNode.Attributes ["fadeOn"].Value); }
private void InitConfiguration(XmlDocument xmlDocument) { if (audioData == null) { audioData = new Dictionary <string, AudioBlock> (); } else { audioData.Clear(); } XmlNode rootNode = XmlParser.GetRootTag(xmlDocument, AudioConstants.XML_ROOT); if (XmlDataParser.IsAnyTagInChildExist(rootNode, AudioConstants.XML_RUNTIME_TAG)) { XmlNode defaultNode = XmlDataParser.FindUniqueTagInChild(rootNode, AudioConstants.XML_RUNTIME_TAG); _runtimeAudioSettings.Load(defaultNode); } if (XmlDataParser.IsAnyTagInChildExist(rootNode, "AudioConfiguration")) { XmlNode configNode = XmlDataParser.FindUniqueTagInChild(rootNode, "AudioConfiguration"); _generalAudioSettings.Load(configNode); //soundSourceCount = int.Parse (configNode.Attributes ["SoundSourceCount"].Value); fadeTime = float.Parse(configNode.Attributes ["fade"].Value); useFadeOn = bool.Parse(configNode.Attributes ["fadeOn"].Value); } if (!XmlDataParser.IsAnyTagInChildExist(rootNode, "AudioBlock")) { return; } foreach (XmlNode item in XmlDataParser.FindAllTagsInChild(rootNode, "AudioBlock")) { string key = item.Attributes ["Name"].Value; if (!audioData.ContainsKey(key)) { audioData.Add(key, new AudioBlock()); audioData [key].LoadFromXml(item); } else { Debug.LogError("Some equals audio blocks name"); } } }