Example #1
0
        //void mInput_CurrentEventChange(FlythroughEvent<Camera> old, FlythroughEvent<Camera> n) {
        void mInput_StepStarted(int step)
        {
            if (mCurrentStep != null)
                mCurrentStep.Finish();

            mCurrentStep = null;
            if (mSteps.ContainsKey(step)) {
                mCurrentStep = mSteps[step];
                mCurrentStep.Start();
            }

            if (step == mInput.Count - 1) {
                foreach (var trigger in mStepTriggers)
                    trigger.Active = false;
                foreach (var manager in Manager.OverlayManagers)
                    manager.ForceRedrawStatic();
            }

            if (mStepText != null)
                mStepText.TextString = (step + 1) + "\\" + mInput.Count;
        }
Example #2
0
        public FlythroughState(OverlayPlugin manager, XmlNode node, IMediaPlayer player)
            : base(GetName(node, "flythrough state"), manager, node)
        {
            mStepListener = new Action<int>(mInput_StepStarted);

            mInput = manager.Core.GetPlugin<FlythroughPlugin>();
            bool displaySubtitles = GetBool(node, false, "DisplaySubtitles");
            mFlythrough = GetString(node, null, "File");
            mAutoStepping = GetBool(node, true, "AutoStep");
            mLoop = GetBool(node, true, "Loop");

            if (mFlythrough == null)
                throw new ArgumentException("Unable to load flythrough state. No flythrough file specified.");

            mPlayer = player;
            if (mPlayer != null)
                mDefaultWindow = Manager[0];

            if (displaySubtitles) {
                mSubtitlesText = Manager.MakeText(node.SelectSingleNode("child::SubtitleText"));
                mSubtitlesFont = Manager.MakeText(node.SelectSingleNode("child::SubtitleText"));
            }

            XmlNode stepTextNode = node.SelectSingleNode("child::StepText");
            if (stepTextNode != null)
                mStepText = Manager.MakeText(stepTextNode);

            //mInput.CurrentEventChange += new Action<FlythroughEvent<Camera>,FlythroughEvent<Camera>>(mInput_CurrentEventChange);
            int subtitleTimeout = GetInt(node, 20, "SubtitleTimeout");

            XmlNode stepsRoot = node.SelectSingleNode("child::Steps");
            if (stepsRoot != null) {
                foreach (XmlNode child in stepsRoot.ChildNodes) {
                    if (child is XmlElement) {
                        Step step = new Step(this, child, mSubtitlesText, subtitleTimeout, mPlayer);
                        mSteps.Add(step.StepNum, step);
                    }
                }
            }

            if (displaySubtitles)
                AddFeature(mSubtitlesText);
            if (mStepText != null)
                AddFeature(mStepText);

            XmlNode triggersRoot = node.SelectSingleNode("child::Triggers");
            if (triggersRoot != null) {
                foreach (XmlNode child in triggersRoot.ChildNodes)
                    AddStepTrigger(manager.GetTrigger(child, "flythrough step", null));
            }
        }