Esempio n. 1
0
        public IBackgroundSoundChoice AddElement(String title)
        {
            BackgroundSoundChoice choice = new BackgroundSoundChoice(
                DataModule.TheElementFactory.GetNextID(), title);
            IParallelElement parallelElement = m_Container.AddElement(choice);

            parallelElement.RepeatCount = -1;
            choice.ParallelElement      = parallelElement;
            m_Elements.Add(choice);
            return(choice);
        }
Esempio n. 2
0
        internal BackgroundSounds(System.Xml.XmlReader reader)
            : base(reader)
        {
            m_Elements = new List <IBackgroundSoundChoice>();
            int id = reader.GetIntegerAttribute("ContainerId");

            m_Container = DataModule.TheElementFactory.CreateParallelContainer(Title + "_Parallel", id);

            if (reader.IsEmptyElement)
            {
                XmlHelpers.ThrowException(StringResources.ExpectedContent, reader);
            }
            reader.Read();
            while (reader.IsStartElement())
            {
                if (reader.IsStartElement("SubElements") && !reader.IsEmptyElement)
                {
                    reader.Read();
                    while (reader.IsStartElement())
                    {
                        if (reader.IsStartElement("BackgroundSoundChoice"))
                        {
                            BackgroundSoundChoice choice          = new BackgroundSoundChoice(reader);
                            IParallelElement      parallelElement = m_Container.AddElement(choice);
                            parallelElement.RepeatCount = -1;
                            choice.ParallelElement      = parallelElement;
                            if (reader.IsStartElement("ParallelElementData"))
                            {
                                AdditionalChoiceData data = ReadAdditionalData(reader);
                                parallelElement.FixedStartDelay                = data.FixedStartDelay;
                                parallelElement.MaximumRandomStartDelay        = data.MaximumRandomStartDelay;
                                parallelElement.FixedIntermediateDelay         = data.FixedIntermediateDelay;
                                parallelElement.MaximumRandomIntermediateDelay = data.MaximumRandomIntermediateDelay;
                                parallelElement.RepeatCount = data.RepeatCount;
                            }
                            m_Elements.Add(choice);
                        }
                        else
                        {
                            reader.ReadOuterXml();
                        }
                    }
                    reader.ReadEndElement();
                }
                else
                {
                    reader.ReadOuterXml();
                }
            }

            reader.ReadEndElement();
        }
Esempio n. 3
0
        public IBackgroundSoundChoice AddImportedElement(IXmlWritable writable)
        {
            ImportedChoice choice = writable as ImportedChoice;

            if (choice == null)
            {
                return(null);
            }
            BackgroundSoundChoice bgChoice        = choice.SoundChoice;
            IParallelElement      parallelElement = m_Container.AddElement(bgChoice);

            parallelElement.FixedStartDelay                = choice.ChoiceData.FixedStartDelay;
            parallelElement.FixedIntermediateDelay         = choice.ChoiceData.FixedIntermediateDelay;
            parallelElement.MaximumRandomStartDelay        = choice.ChoiceData.MaximumRandomStartDelay;
            parallelElement.MaximumRandomIntermediateDelay = choice.ChoiceData.MaximumRandomIntermediateDelay;
            parallelElement.RepeatCount = choice.ChoiceData.RepeatCount;
            bgChoice.ParallelElement    = parallelElement;
            m_Elements.Add(bgChoice);
            return(bgChoice);
        }