コード例 #1
0
 public FlythroughState(string name, OverlayPlugin manager, string flythrough)
     : base(name, manager)
 {
     mFlythrough = flythrough;
     mInput = manager.Core.GetPlugin<FlythroughPlugin>();
     mStepListener = new Action<int>(mInput_StepStarted);
 }
コード例 #2
0
 public MouseActiveTrigger(OverlayPlugin plugin, XmlNode node)
     : base(node)
 {
     mManager = GetManager(plugin, node, "trigger");
     mCore = plugin.Core;
     mMoveListener = new Action<FrameOverlayManager, EventArgs>(mManager_CursorMoved);
 }
コード例 #3
0
ファイル: ImageBGState.cs プロジェクト: JohnMcCaffery/Chimera
 public ImageBGState(string name, OverlayPlugin manager, Bitmap defaultBG)
     : base(name, manager)
 {
     mDefaultBG = defaultBG;
     foreach (var window in mWindows.Values)
         window.BackgroundImage = defaultBG;
 }
コード例 #4
0
ファイル: State.cs プロジェクト: veyvin/ChimeraClean
        /// <summary>
        /// State the state, specifying the name, form and the window factory for creating window states.
        /// </summary>
        /// <param name="name">The name of the state. All state names should be unique.</param>
        /// <param name="form">The form which will control this state.</param>
        private State(string name, OverlayPlugin manager)
        {
            mName    = name;
            mManager = manager;

            mManager.Core.FrameAdded += new Action <Frame, EventArgs>(Coordinator_FrameAdded);
        }
コード例 #5
0
 public TouchscreenState(string name, bool avatar, OverlayPlugin manager, XmlNode node)
     : base(name, manager, node)
 {
     mPlugin = manager.Core.GetPlugin<TouchscreenPlugin>();
     mPlugin.Enabled = false;
     mAvatar = avatar;
 }
コード例 #6
0
ファイル: VideoState.cs プロジェクト: JohnMcCaffery/Chimera
        public VideoState(OverlayPlugin manager, XmlNode node, IMediaPlayer player)
            : base(manager, node)
        {
            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);
            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(StartTriggered));
            LoadTriggers(node, manager, "StopTriggers", mStopTriggers, new Action(StopTriggered));

            mRestartMode = GetBool(node, false, "RestartMode");
            if (mRestartMode) {
                LoadTriggers(node, manager, "ResetTriggers", mResetTriggers, new Action(RestartTriggered));
            }
        }
コード例 #7
0
        public static FrameOverlayManager GetManager(OverlayPlugin manager, XmlNode node, string request)
        {
            FrameOverlayManager mManager;

            if (node == null)
            {
                mManager = manager[0];
                Logger.Debug("No node specified when looking up frame for " + request + ". Using " + mManager.Frame.Name + " as default.");
                return(mManager);
            }
            XmlAttribute frameAttr = node.Attributes["Frame"];

            if (frameAttr == null)
            {
                mManager = manager[0];
                Logger.Debug("No window specified whilst resolving " + node.Name + " from " + node.Name + ". Using " + mManager.Frame.Name + " as default.");
            }
            else
            {
                if (!manager.IsKnownWindow(frameAttr.Value))
                {
                    mManager = manager[0];
                    Logger.Debug(frameAttr.Value + " is not a known frame. Using " + mManager.Frame.Name + " as default.");
                }
                else
                {
                    mManager = manager[frameAttr.Value];
                }
            }
            return(mManager);
        }
コード例 #8
0
 public TimerTrigger(OverlayPlugin plugin, XmlNode node)
     : base(node)
 {
     mCore = plugin.Core;
     mTickListener = new Action(mCore_Tick);
     mLengthMS = GetDouble(node, mLengthMS, "LengthMS");
 }
コード例 #9
0
ファイル: InfoState.cs プロジェクト: JohnMcCaffery/Chimera
 public InfoState(OverlayPlugin manager, XmlNode node)
     : base(GetName(node, "information state"), manager)
 {
     mPlugin = manager;
     mGlowString = GetString(node, "Glow", "GlowMessage");
     mNoGlowString = GetString(node, "NoGlow", "NoGlowMessage");
     mGlowChannel = GetInt(node, -40, "GlowChannel");
 }
コード例 #10
0
        public FillFeature(OverlayPlugin plugin, XmlNode node)
            : base(plugin, node)
        {
            mFill = GetEnum<Fill>(node, Fill.Full, LogManager.GetLogger("UnrealOverlay"), "Fill");

            mController = Manager.Frame.Output as UnrealController;
            if (mController == null)
                throw new Exception("Cannot use FillFeature, UnrealController is not the controller.");
        }
コード例 #11
0
 public KeyPressFeature(OverlayPlugin plugin, XmlNode node)
 {
     mPlugin = plugin;
     keys = node.Attributes["Keys"].Value;
     ThisLogger.WarnFormat("Creating KeyPress with: {0}", keys);
     mFrame = GetManager(plugin, node, "Click Feature").Name;
     if (plugin.Core[mFrame].Output is OpenSimController)
         mController = plugin.Core[mFrame].Output as OpenSimController;
 }
コード例 #12
0
        public MuteAudioFeature(OverlayPlugin plugin, XmlNode node)
        {
            mFrame = GetManager(plugin, node, "MuteAudio Feature").Name;
            mMute = GetBool(node, false, "Mute");

            if (plugin.Core[mFrame].Output is OpenSimController)
                mController = plugin.Core[mFrame].Output as OpenSimController;
            mPlugin = plugin;
        }
コード例 #13
0
        public KinectControlState(string name, OverlayPlugin manager, bool avatar)
            : base(name, manager)
        {
            mInput = manager.Core.GetPlugin<KinectMovementPlugin>();
            mAvatar = avatar;

            mStartOrientation = new Rotation(manager.Core.Orientation);
            mStartPosition = manager.Core.Position;
        }
コード例 #14
0
        public SayOnceFeature(OverlayPlugin plugin, XmlNode node)
        {
            mFrame = GetManager(plugin, node, "SayOnce Feature").Name;

            if (plugin.Core[mFrame].Output is OpenSimController)
                mController = plugin.Core[mFrame].Output as OpenSimController;
            mPlugin = plugin;
            mMessageString = GetString(node, "click", "Message");
            mChannel = GetInt(node, 1, "Channel");
        }
コード例 #15
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);
        }
コード例 #16
0
ファイル: Step.cs プロジェクト: JohnMcCaffery/ChimeraClean
        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;
                }
            }
        }
コード例 #17
0
        public FPSRecorderState(OverlayPlugin manager, XmlNode node)
            : base(GetName(node, "initialising FPSRecorder state"), manager, node)
        {
            mFolder = Path.GetFullPath(GetString(node, "FPS", "Folder"));
            mFlythrough = GetString(node, "Flythroughs/Expriment.xml", "Flythrough");

            if (manager.Core.HasPlugin<FlythroughPlugin>())
                mFlythroughPlugin = manager.Core.GetPlugin<FlythroughPlugin>();
            else
                Logger.Warn("Unable to initialise FPSRecorder, flythroughPlugin not bound.");
        }
コード例 #18
0
        public FlythroughEndTrigger(OverlayPlugin overlayPlugin, XmlNode node)
            : base(node)
        {
            if (!overlayPlugin.Core.HasPlugin<FlythroughPlugin>()) {
                Logger.Warn("Unable to instantiate FlythroughEndTrigger FlythroughPlugin is not registered.");
                return;
            }

            mFlythroughEndListener = new EventHandler(mPlugin_SequenceFinished);
            mPlugin = overlayPlugin.Core.GetPlugin<FlythroughPlugin>();
        }
コード例 #19
0
        public FrameOverlayManager(OverlayPlugin manager, Frame frame)
        {
            Logger   = LogManager.GetLogger(frame.Name + "Overlay");
            mManager = manager;
            mFrame   = frame;

            mConfig            = new OverlayConfig();
            mOverlayActive     = mConfig.LaunchOverlay;
            mEnableCursor      = mConfig.ControlPointer;
            mOverlayFullscreen = mConfig.Fullscreen;
        }
コード例 #20
0
        public StringReceivedTrigger(OverlayPlugin plugin, XmlNode node)
            : base(node)
        {
            mController = GetManager(plugin, node, "string received trigger").Frame.Output as UnrealController;
            if (mController == null)
                throw new Exception("Cannot use StringReceivedTrigger, UnrealController is not the controller.");

            mString = GetString(node, "", "String");
            mTextReceivedTrigger = (str) => {
                if (mString == str)
                    Trigger();
            };
        }
コード例 #21
0
        public FlythroughState(OverlayPlugin manager, XmlNode node, IMediaPlayer player)
            : base(GetName(node, "flythrough state"), manager, node, false)
        {
            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));
            }
        }
コード例 #22
0
        public FlythroughState(string name, OverlayPlugin manager, string flythrough, params ITrigger[] stepTriggers)
            : this(name, manager, flythrough)
        {
            mAutoStepping = true;
            Font f = new Font(FONT, FONT_SIZE, FontStyle.Bold);
            mStepText = new StaticText("1/" + mInput.Count, manager[0], f, FONT_COLOUR, STEP_TEXT_POS);
            AddFeature(mStepText);

            //mInput.CurrentEventChange += new Action<FlythroughEvent<Camera>,FlythroughEvent<Camera>>(mInput_CurrentEventChange);
            mInput.StepStarted += new Action<int>(mInput_StepStarted);

            foreach (var trigger in stepTriggers)
                AddStepTrigger(trigger);
        }
コード例 #23
0
        /// <param name="manager">The manager this transition works transition.</param>
        public StateTransition(OverlayPlugin manager, State from, State to, ITrigger trigger, ITransitionStyle factory)
        {
            mManager = manager;
            mFrom    = from;
            mTo      = to;
            mWindowTransitionFactory = factory;

            mManager.Core.FrameAdded += new Action <Frame, EventArgs>(Coordinator_FrameAdded);

            AddTrigger(trigger);

            foreach (var window in mManager.Core.Frames)
            {
                Coordinator_FrameAdded(window, null);
            }
        }
コード例 #24
0
        public KinectControlState(OverlayPlugin manager, XmlNode node)
            : base(GetName(node, "kinect movement state"), manager, node)
        {
            //mInput = manager.Core.GetPlugin<KinectMovementPlugin>();
            mAvatar = GetBool(node, true, "Avatar");

            double pitch = GetDouble(node, manager.Core.Orientation.Pitch);
            double yaw = GetDouble(node, manager.Core.Orientation.Yaw);
            float x = GetFloat(node, manager.Core.Position.X, "X");
            float y = GetFloat(node, manager.Core.Position.Y, "Y");
            float z = GetFloat(node, manager.Core.Position.Z, "Z");
            mStartOrientation = new Rotation(pitch, yaw);
            mStartPosition = new Vector3(x, y, z);

            mSetPosition = (node.Attributes["X"] !=  null && node.Attributes["Y"] != null && node.Attributes["Z"] != null) || node.Attributes["Pitch"] != null || node.Attributes["Yaw"] != null;
        }
コード例 #25
0
        public PageLoadTrigger(OverlayPlugin manager, XmlNode node)
            : base(node)
        {
            Logger = LogManager.GetLogger("PageLoadTrigger");
            mUrl = GetString(node, "http://openvirtualworlds.org", "URL");
            mNot = GetBool(node, false, "Not");
            mSaveURL = GetBool(node, false, "SaveURL");

            mPageLoadListener = (addr, browser) => {
                //if (BrowserFeature.IsActive(browser) && (mUrl == ANY_PAGE || mUrl == addr))
                if (BrowserFeature.IsActive(browser) && (mUrl == ANY_PAGE || (mUrl == addr && !mNot) || (mUrl != addr && mNot))) {
                    //Logger.WarnFormat("Triggering for : {0}", addr);
                    if(mSaveURL) TriggeredURL = addr;
                    Trigger();
                }
            };
        }
コード例 #26
0
        public ClickFeature(OverlayPlugin plugin, XmlNode node)
        {
            mTriggerListener = new Action<ITrigger>(TriggerListener);

            mLeft = GetBool(node, false, "LeftClick");
            mFrame = GetManager(plugin, node, "Click Feature").Name;

            List<ITrigger> triggers = new List<ITrigger>();
            foreach (XmlNode trigger in GetChildrenOfChild(node, "Triggers")) {
                ITrigger t = plugin.GetTrigger(trigger, "JoystickClick trigger", null);
                if (t != null)
                {
                    triggers.Add(t);
                }
            }
            mTriggers = triggers.ToArray();
        }
コード例 #27
0
        public KeyClickFeature(OverlayPlugin plugin, XmlNode node)
        {
            mTriggerListener = new Action<ITrigger>(TriggerListener);

            keys = node.Attributes["Keys"].Value;
            mFrame = GetManager(plugin, node, "Click Feature").Name;

            List<ITrigger> triggers = new List<ITrigger>();
            foreach (XmlNode trigger in GetChildrenOfChild(node, "Triggers"))
            {
                ITrigger t = plugin.GetTrigger(trigger, "KeyClick trigger", null);
                if (t != null)
                {
                    triggers.Add(t);
                }
            }
            mTriggers = triggers.ToArray();
            if (plugin.Core[mFrame].Output is OpenSimController)
                mController = plugin.Core[mFrame].Output as OpenSimController;
        }
コード例 #28
0
        public CloseBrowserFeature(OverlayPlugin plugin, XmlNode node)
        {
            mTriggerListener = new Action<ITrigger>(TriggerListener);

            mFrame = GetManager(plugin, node, "CloseBrowser Feature").Name;

            List<ITrigger> triggers = new List<ITrigger>();
            foreach (XmlNode trigger in GetChildrenOfChild(node, "Triggers"))
            {
                ITrigger t = plugin.GetTrigger(trigger, "CloseBrowser trigger", null);
                if (t != null)
                {
                    triggers.Add(t);
                }
            }
            mTriggers = triggers.ToArray();
            if (plugin.Core[mFrame].Output is OpenSimController)
                mController = plugin.Core[mFrame].Output as OpenSimController;
            mPlugin = plugin;
        }
コード例 #29
0
 public static FrameOverlayManager GetManager(OverlayPlugin manager, XmlNode node, string request)
 {
     FrameOverlayManager mManager;
     if (node == null) {
         mManager = manager[0];
         Logger.Debug("No node specified when looking up frame for " + request + ". Using " + mManager.Frame.Name + " as default.");
         return mManager;
     }
     XmlAttribute frameAttr = node.Attributes["Frame"];
     if (frameAttr == null) {
         mManager = manager[0];
         Logger.Debug("No window specified whilst resolving " + node.Name + " from " + node.Name + ". Using " + mManager.Frame.Name + " as default.");
     } else {
         if (!manager.IsKnownWindow(frameAttr.Value)) {
             mManager = manager[0];
             Logger.Debug(frameAttr.Value + " is not a known frame. Using " + mManager.Frame.Name + " as default.");
         } else
             mManager = manager[frameAttr.Value];
     }
     return mManager;
 }
コード例 #30
0
        public ImageBGState(OverlayPlugin manager, XmlNode node, bool enableCursor)
            : base(GetName(node, "image background state"), manager, node, enableCursor)
        {
            mDefaultBG = new Bitmap(manager.Clip.Width, manager.Clip.Height);
            using (Graphics g = Graphics.FromImage(mDefaultBG))
                g.FillRectangle(Brushes.Black, manager.Clip);

            foreach (XmlNode child in node.ChildNodes) {
                if (!(child is XmlElement))
                    continue;
                string imgStr = GetString(child, null, "File");
                if (imgStr != null && File.Exists(Path.GetFullPath(imgStr))) {
                    Bitmap img = new Bitmap(imgStr);
                    if (img != null) {
                        string window = GetManager(manager, child, "image background state").Frame.Name;
                        mWindowBGs.Add(window, img);
                        if (mWindows.ContainsKey(window))
                            mWindows[window].BackgroundImage = img;
                    }
                }
            }
        }
コード例 #31
0
        public SayFeature(OverlayPlugin plugin, XmlNode node)
        {
            mTriggerListener = new Action<ITrigger>(TriggerListener);

            mFrame = GetManager(plugin, node, "Say Feature").Name;

            List<ITrigger> triggers = new List<ITrigger>();
            foreach (XmlNode trigger in GetChildrenOfChild(node, "Triggers"))
            {
                ITrigger t = plugin.GetTrigger(trigger, "Say trigger", null);
                if (t != null)
                {
                    triggers.Add(t);
                }
            }
            mTriggers = triggers.ToArray();
            if (plugin.Core[mFrame].Output is OpenSimController)
                mController = plugin.Core[mFrame].Output as OpenSimController;
            mPlugin = plugin;
            mMessageString = GetString(node, "click", "Message");
            mChannel = GetInt(node, 1, "Channel");
        }
コード例 #32
0
ファイル: InfoState.cs プロジェクト: JohnMcCaffery/Chimera
 public InfoState(string name, OverlayPlugin manager, string mainWindow, string whereWindow)
     : base(name, manager)
 {
     mPlugin = manager;
     mMainWindow = manager[mainWindow];
 }
コード例 #33
0
ファイル: InfoState.cs プロジェクト: JohnMcCaffery/Chimera
 public State Create(OverlayPlugin manager, XmlNode node, Rectangle clip)
 {
     return Create(manager, node);
 }
コード例 #34
0
ファイル: InfoState.cs プロジェクト: JohnMcCaffery/Chimera
 public State Create(OverlayPlugin manager, XmlNode node)
 {
     return new InfoState(manager, node);
 }
コード例 #35
0
ファイル: State.cs プロジェクト: veyvin/ChimeraClean
 /// <summary>
 /// State the state, specifying the name, overlay, node to load values from and whether to control the cursor.
 /// </summary>
 /// <param name="name">The name of the state. All state names should be unique.</param>
 /// <param name="form">The form which will control this state.</param>
 public State(string name, OverlayPlugin manager, XmlNode node, bool enableCursor)
     : this(name, manager, node)
 {
     mEnableCursor = enableCursor;
     mEnableCursor = GetBool(node, mEnableCursor, "EnableCursor");
 }
コード例 #36
0
ファイル: State.cs プロジェクト: veyvin/ChimeraClean
 /// <summary>
 /// State the state, specifying the name, overlay and node to load values from.
 /// </summary>
 /// <param name="name">The name of the state. All state names should be unique.</param>
 /// <param name="form">The form which will control this state.</param>
 public State(string name, OverlayPlugin manager, XmlNode node)
     : this(name, manager)
 {
     mOpacity      = GetDouble(node, mOpacity, "Opacity");
     mEnableCursor = GetBool(node, mEnableCursor, "EnableCursor");
 }