示例#1
0
        public UnityState(OverlayPlugin manager, XmlNode node)
            : base(GetName(node, "creating unity state"), manager, node, false)
        {
            mUnity      = Path.GetFullPath(GetString(node, null, "File"));
            mManager    = manager;
            mMainWindow = GetManager(manager, node, "unity state");
            mBounds     = manager.GetBounds(node, "unity state");

            ResizedHandler = new System.EventHandler(this.Resized);
        }
示例#2
0
        public VideoState(OverlayPlugin manager, XmlNode node, IMediaPlayer player)
            : base(GetName(node, "creating video state"), manager, node, false)
        {
            //: base(manager, node, false) {

            mPlayer = player;
            mVideo  = GetString(node, null, "File");
            if (mVideo == null)
            {
                throw new ArgumentException("Unable to load VideoState. No File attribute specified.");
            }
            mVideo = Path.GetFullPath(mVideo);
            if (!File.Exists(mVideo))
            {
                throw new ArgumentException("Unable to load VideoState. The file '" + mVideo + "' does not exist.");
            }

            mPlayer.PlaybackFinished += new Action(mPlayer_VideoFinished);
            mPlayer.PlaybackStarted  += new Action(mPlayer_VideoStarted);
            mMainWindow = GetManager(manager, node, "video state");
            mBounds     = manager.GetBounds(node, "video state");

            XmlAttribute toAttr = node.Attributes["FinishState"];

            if (toAttr != null && manager.GetState(toAttr.Value) != null)
            {
                mTrigger = new SimpleTrigger();
                ITransitionStyle transition = manager.GetTransition(node, "video state finish transition", new FeatureFrameTransitionFactory(new FeatureFadeFactory(), 2000), "Transition");
                if (transition == null)
                {
                    Logger.Debug("No transition specified for VideoState. using default 2s bitmap fade transition.");
                    transition = new FeatureFrameTransitionFactory(new FeatureFadeFactory(), 2000);
                }
                AddTransition(new StateTransition(Manager, this, manager.GetState(toAttr.Value), mTrigger, transition));
            }

            LoadTriggers(node, manager, "StartTriggers", mStartTriggers, new Action <ITrigger>(StartTriggered));
            LoadTriggers(node, manager, "StopTriggers", mStopTriggers, new Action <ITrigger>(StopTriggered));

            mRestartMode = GetBool(node, false, "RestartMode");
            if (mRestartMode)
            {
                LoadTriggers(node, manager, "ResetTriggers", mResetTriggers, new Action <ITrigger>(RestartTriggered));
            }
        }