Exemplo n.º 1
0
        public SlideshowState(OverlayPlugin manager, XmlNode node)
            : base(GetName(node, "slideshow state"), manager, node)
        {
            mTickListener = new Action(Core_Tick);

            mStepLengthS = GetInt(node, -1, "StepLengthS");

            int count = 1;
            List<List<IFeature>> steps = new List<List<IFeature>>();
            foreach (var step in GetChildrenOfChild(node, "Steps")) {
                List<IFeature> stepFeatures = new List<IFeature>();
                foreach (var stepFeature in step.ChildNodes.OfType<XmlElement>()) {
                    IFeature feature = manager.GetFeature(stepFeature, "slideshow step " + count, null);
                    if (feature != null) {
                        stepFeatures.Add(feature);
                        AddFeature(feature);
                    }
                }
                steps.Add(stepFeatures);
                count++;
            }

            if (steps.Count == 0)
                throw new ArgumentException("Unable to create slideshow state. No steps specified.");

            mSteps = steps.ToArray();

            LoadTriggers(manager, node, true);
            LoadTriggers(manager, node, false);
        }
        public ConditionalFeature(OverlayPlugin plugin, XmlNode node)
        {
            mPlugin = plugin;
            XmlNode featureNode = node.SelectSingleNode("child::Feature");

            mStartActive = GetBool(node, false, "StartActive");
            mMultiActivate = GetBool(node, false, "MultiActivate");

            if (featureNode == null)
                throw new ArgumentException("Unable to load Conditional Feature. Unable to parse feature.");

            foreach (var child in GetChildrenOfChild(node, "ActiveTriggers")) {
                var trigger = plugin.GetTrigger(child, "conditional feature", null);
                mActiveTriggers.Add(trigger);
                trigger.Triggered += mActiveTrigger_Triggered;
            } foreach (var child in GetChildrenOfChild(node, "InactiveTriggers")) {
                var trigger = plugin.GetTrigger(child, "conditional feature", null);
                mInactiveTriggers.Add(trigger);
                trigger.Triggered += mInactiveTrigger_Triggered;
            }

            mFeature = mPlugin.GetFeature(featureNode, "conditional feature", null);

            if (node.SelectSingleNode("child::ActiveTriggers") == null)
                Logger.Info("No active trigger node found in conditional feature " + Name + ".");
            if (node.SelectSingleNode("child::InactiveTriggers") == null)
                Logger.Info("No inactive trigger node found in conditional feature.");

            if (mActiveTriggers.Count == 0)
                Logger.Info("No active triggers loaded in conditional feature " + Name + ".");
            if (mInactiveTriggers.Count == 0)
                Logger.Info("No inactive triggers loaded in conditional feature " + Name + ".");
        }
Exemplo n.º 3
0
        public ConditionalFeature(OverlayPlugin plugin, XmlNode node)
        {
            mPlugin = plugin;
            XmlNode featureNode = node.SelectSingleNode("child::Feature");

            mStartActive   = GetBool(node, false, "StartActive");
            mMultiActivate = GetBool(node, false, "MultiActivate");

            if (featureNode == null)
            {
                throw new ArgumentException("Unable to load Conditional Feature. Unable to parse feature.");
            }

            foreach (var child in GetChildrenOfChild(node, "ActiveTriggers"))
            {
                var trigger = plugin.GetTrigger(child, "conditional feature", null);
                mActiveTriggers.Add(trigger);
                trigger.Triggered += mActiveTrigger_Triggered;
            }
            foreach (var child in GetChildrenOfChild(node, "InactiveTriggers"))
            {
                var trigger = plugin.GetTrigger(child, "conditional feature", null);
                mInactiveTriggers.Add(trigger);
                trigger.Triggered += mInactiveTrigger_Triggered;
            }

            mFeature = mPlugin.GetFeature(featureNode, "conditional feature", null);

            if (node.SelectSingleNode("child::ActiveTriggers") == null)
            {
                Logger.Info("No active trigger node found in conditional feature " + Name + ".");
            }
            if (node.SelectSingleNode("child::InactiveTriggers") == null)
            {
                Logger.Info("No inactive trigger node found in conditional feature.");
            }

            if (mActiveTriggers.Count == 0)
            {
                Logger.Info("No active triggers loaded in conditional feature " + Name + ".");
            }
            if (mInactiveTriggers.Count == 0)
            {
                Logger.Info("No inactive triggers loaded in conditional feature " + Name + ".");
            }
        }
Exemplo n.º 4
0
        public ActiveAreaFeature(OverlayPlugin plugin, XmlNode node)
        {
            mPlugin = plugin;
            XmlNode triggerNode = node.SelectSingleNode("child::Trigger");
            XmlNode featureNode = node.SelectSingleNode("child::Feature");
            if (triggerNode == null)
                throw new ArgumentException("Unable to load Active Area. No 'Trigger' attribute specified.");
            if (featureNode == null)
                throw new ArgumentException("Unable to load Active Area. No 'Feature' attribute specified.");

            mTrigger = new ActiveAreaTrigger(plugin, triggerNode);
            mFeature = mPlugin.GetFeature(featureNode, "conditional feature", null);

            if (mFeature == null)
                throw new ArgumentException("Unable to load Active Area. Unable to parse feature.");

            mTrigger.Triggered += new Action(mActiveTrigger_Triggered);
        }
Exemplo n.º 5
0
        public SlideshowState(OverlayPlugin manager, XmlNode node)
            : base(GetName(node, "slideshow state"), manager, node)
        {
            mTickListener = new Action(Core_Tick);

            mStepLengthS = GetInt(node, -1, "StepLengthS");

            int count = 1;
            List <List <IFeature> > steps = new List <List <IFeature> >();

            foreach (var step in GetChildrenOfChild(node, "Steps"))
            {
                List <IFeature> stepFeatures = new List <IFeature>();
                foreach (var stepFeature in step.ChildNodes.OfType <XmlElement>())
                {
                    IFeature feature = manager.GetFeature(stepFeature, "slideshow step " + count, null);
                    if (feature != null)
                    {
                        stepFeatures.Add(feature);
                        AddFeature(feature);
                    }
                }
                steps.Add(stepFeatures);
                count++;
            }

            if (steps.Count == 0)
            {
                throw new ArgumentException("Unable to create slideshow state. No steps specified.");
            }

            mSteps = steps.ToArray();

            LoadTriggers(manager, node, true);
            LoadTriggers(manager, node, false);
        }
Exemplo n.º 6
0
        public Step(FlythroughState state, XmlNode node, Text subtitlesText, int subtitleTimeoutS, IMediaPlayer player)
        {
            if (node.Attributes["St››ep"] == null && !int.TryParse(node.Attributes["Step"].Value, out mStep))
            {
                throw new ArgumentException("Unable to load slideshow step. A valid 'Step' attribute must be supplied.");
            }

#if DEBUG
            if (sStatistics == null)
            {
                sStatistics = new TickStatistics();
                StatisticsCollection.AddStatistics(sStatistics, "Flythrough Steps");
            }
#endif

            mPlayer  = player;
            mManager = state.Manager;
            mStep    = GetInt(node, -1, "Step");
            if (mStep == -1)
            {
                throw new ArgumentException("Unable to load step ID. A valid Step attribute is expected.");
            }

            XmlAttribute voiceoverAttribute = node.Attributes["Voiceover"];
            if (voiceoverAttribute != null && File.Exists(Path.GetFullPath(voiceoverAttribute.Value)))
            {
                if (mPlayer != null)
                {
                    mVoiceoverFile = Path.GetFullPath(voiceoverAttribute.Value);
                }
                else
                {
                    Logger.Warn("Unable to load voiceover for flythrough step. No MediaPlayer supplied.");
                }
            }

            mSubtitlesText = subtitlesText;

            XmlNode newFontNode = node.SelectSingleNode("child::SubtitlesFont");
            if (newFontNode != null)
            {
                mNewSubtitlesFont = state.Manager.MakeText(newFontNode);
            }

            if (mSubtitlesText != null)
            {
                mTickListener     = new Action(mCoordinator_Tick);
                mSubtitleTimeoutS = subtitleTimeoutS;
                XmlNode subtitlesNode = node.SelectSingleNode("child::Subtitles");
                if (subtitlesNode != null)
                {
                    foreach (XmlNode child in subtitlesNode.ChildNodes)
                    {
                        if (child is XmlElement)
                        {
                            double time = child.Attributes["Time"] != null?double.Parse(child.Attributes["Time"].Value) : 0;

                            mSubtitles.Add(time, child.InnerText.Trim('\n', ' ', Environment.NewLine[0]).Replace("  ", ""));
                        }
                    }
                }
            }

            foreach (var featureNode in GetChildrenOfChild(node, "Features"))
            {
                IFeature feature = mManager.GetFeature(featureNode, "flythrough step " + (mStep + 1), null);
                if (feature != null)
                {
                    mFeatures.Add(feature);
                    state.AddFeature(feature);
                    feature.Active = false;
                }
            }
        }
Exemplo n.º 7
0
        public FadeTransition(OverlayPlugin manager, XmlNode node)
        {
            mLengthMS = GetDouble(node, 2000, "Length");
            mStart = manager.GetFeature(node.SelectSingleNode("child::Start"), "Fade Feature", null);
            mFinish = manager.GetFeature(node.SelectSingleNode("child::Finish"), "Fade Feature", null);
            if (mStart == null && mFinish == null)
                throw new Exception("No from or to features specified.");
            if (mStart == null)
                throw new Exception("No from feature specified.");
            if (mFinish == null)
                throw new Exception("No to feature specified.");

            mPreload = GetBool(node, mPreload, "Preload");
        }