示例#1
0
 protected Trigger(System.Xml.XmlReader reader)
 {
     StopMusic       = reader.GetBooleanAttribute("stopMusic");
     StopSounds      = reader.GetBooleanAttribute("stopSounds");
     TargetElementId = reader.GetIntegerAttribute("targetId");
     CrossFadeMusic  = reader.GetBooleanAttributeOrDefault("crossFadeMusic", false);
     FadeMusic       = reader.GetBooleanAttributeOrDefault("fadeMusic", false);
     FadeMusicTime   = reader.GetIntegerAttributeOrDefault("crossFadeMusicTime", 0);
     FadeSounds      = reader.GetBooleanAttributeOrDefault("fadeSounds", false);
     FadeSoundTime   = reader.GetIntegerAttributeOrDefault("fadeSoundTime", 0);
 }
示例#2
0
文件: MusicByTags.cs 项目: zBart/Ares
        internal MusicByTags(System.Xml.XmlReader reader)
            : base(reader)
        {
            m_Tags = new Dictionary <int, HashSet <int> >();
            bool isOperatorAnd          = reader.GetBooleanAttributeOrDefault("IsOperatorAnd", true);
            int  tagCategoryCombination = reader.GetIntegerAttributeOrDefault("TagCategoryCombination", -1);

            if (tagCategoryCombination >= (int)Data.TagCategoryCombination.UseAnyTag && tagCategoryCombination <= (int)Data.TagCategoryCombination.UseAllTags)
            {
                TagCategoryCombination = (Data.TagCategoryCombination)tagCategoryCombination;
            }
            else
            {
                TagCategoryCombination = isOperatorAnd ? Data.TagCategoryCombination.UseOneTagOfEachCategory : Data.TagCategoryCombination.UseAnyTag;
            }
            FadeTime = reader.GetIntegerAttributeOrDefault("FadeTime", 0);
            if (reader.IsEmptyElement)
            {
                XmlHelpers.ThrowException(StringResources.ExpectedContent, reader);
            }
            reader.Read();
            while (reader.IsStartElement())
            {
                if (reader.IsStartElement("Tags") && !reader.IsEmptyElement)
                {
                    reader.Read();
                    while (reader.IsStartElement())
                    {
                        if (reader.IsStartElement("Tag"))
                        {
                            int category = reader.GetIntegerAttribute("Category");
                            int tag      = reader.GetIntegerAttribute("Tag");
                            AddTag(category, tag);
                            reader.ReadOuterXml();
                        }
                        else
                        {
                            reader.ReadOuterXml();
                        }
                    }
                    reader.ReadEndElement();
                }
                else
                {
                    reader.ReadOuterXml();
                }
            }
            reader.ReadEndElement();
        }
示例#3
0
        protected ElementBase(System.Xml.XmlReader reader)
        {
            m_ID            = reader.GetIntegerAttribute("Id");
            Title           = reader.GetNonEmptyAttribute("Title");
            SetsMusicVolume = reader.GetBooleanAttributeOrDefault("SetsMusicVolume", false);
            SetsSoundVolume = reader.GetBooleanAttributeOrDefault("SetsSoundVolume", false);
            MusicVolume     = reader.GetIntegerAttributeOrDefault("MusicVolume", 100);
            if (MusicVolume < 0 || MusicVolume > 100)
            {
                XmlHelpers.ThrowException(StringResources.InvalidVolume, reader);
            }
            SoundVolume = reader.GetIntegerAttributeOrDefault("SoundVolume", 100);
            if (SoundVolume < 0 || SoundVolume > 100)
            {
                XmlHelpers.ThrowException(StringResources.InvalidVolume, reader);
            }

            DataModule.TheElementRepository.AddElement(ref m_ID, this);
            DataModule.TheElementFactory.UpdateNextID(m_ID);
        }
示例#4
0
文件: Projects.cs 项目: zBart/Ares
        internal Project(System.Xml.XmlReader reader, String fileName)
        {
            m_Modes = new List <IMode>();

            if (!reader.IsStartElement("Project"))
            {
                XmlHelpers.ThrowException(String.Format(StringResources.ExpectedElement, "Project"), reader);
            }
            Title         = reader.GetNonEmptyAttribute("Title");
            TagLanguageId = reader.GetIntegerAttributeOrDefault("LanguageId", -1);
            if (!reader.IsEmptyElement)
            {
                reader.Read();
                while (reader.IsStartElement())
                {
                    if (reader.IsStartElement("Modes") && !reader.IsEmptyElement)
                    {
                        reader.Read();
                        while (reader.IsStartElement())
                        {
                            if (reader.IsStartElement("Mode"))
                            {
                                m_Modes.Add(new Mode(reader));
                            }
                            else
                            {
                                reader.ReadOuterXml();
                            }
                        }
                        reader.ReadEndElement();
                    }
                    else if (reader.IsStartElement("HiddenTagCategories") && !reader.IsEmptyElement)
                    {
                        reader.Read();
                        while (reader.IsStartElement())
                        {
                            if (reader.IsStartElement("TagCategory"))
                            {
                                int id = reader.GetIntegerAttribute("id");
                                m_HiddenTagCategories.Add(id);
                            }
                            reader.ReadOuterXml();
                        }
                        reader.ReadEndElement();
                    }
                    else if (reader.IsStartElement("HiddenTags") && !reader.IsEmptyElement)
                    {
                        reader.Read();
                        while (reader.IsStartElement())
                        {
                            if (reader.IsStartElement("Tag"))
                            {
                                int id = reader.GetIntegerAttribute("id");
                                m_HiddenTags.Add(id);
                            }
                            reader.ReadOuterXml();
                        }
                        reader.ReadEndElement();
                    }
                    else
                    {
                        reader.ReadOuterXml();
                    }
                }
                reader.ReadEndElement();
            }
            else
            {
                reader.Read();
            }
            FileName = fileName;
            Changed  = false;
        }