public void PlayScene(string sceneName, int returnMs = -1)
        {
            lastScenePlayed = sceneName;
            string dmMessage = $"Playing scene: {sceneName}";

            try
            {
                if (ObsManager.IsConnected)
                {
                    if (returnMs > 0)
                    {
                        foundationalScene = GetFoundationalScene();
                    }

                    ObsManager.SetCurrentScene(sceneName);

                    if (returnMs > 0)
                    {
                        sceneReturnTimer.Interval = TimeSpan.FromMilliseconds(returnMs);
                        sceneReturnTimer.Start();
                    }
                }
            }
            catch (Exception ex)
            {
                dmMessage = $"{Icons.WarningSign} Unable to play {sceneName}: {ex.Message}";
            }
            DungeonMasterApp.TellDungeonMaster(dmMessage);
        }
Example #2
0
 void RenderActiveFrame(ObsTransform liveFeedFrame)
 {
     ScreenAnchorLeft = liveFeedFrame.Origin.X;
     ScreenAnchorTop  = liveFeedFrame.Origin.Y;
     SetCamera(liveFeedFrame.Camera);
     ObsManager.SizeAndPositionItem(this, (float)liveFeedFrame.Scale, liveFeedFrame.Opacity, liveFeedFrame.Rotation, liveFeedFrame.Flipped);
 }
Example #3
0
 public void SetObsSourceVisibility(string sceneName, string sourceName, bool visible)
 {
     try
     {
         ObsManager.SetSourceRender(sourceName, visible, sceneName);
     }
     catch             //(Exception ex)
     {
     }
 }
Example #4
0
 private static void HubtasticBaseStation_OnUpdateVideoFeed(object sender, VideoFeedDto videoFeedDto)
 {
     LiveFeedAnimator.ScreenAnchorLeft = videoFeedDto.X;
     LiveFeedAnimator.ScreenAnchorTop  = videoFeedDto.Y;
     if (videoFeedDto.Scale == 0)
     {
         videoFeedDto.Scale = 1;
     }
     ObsManager.SizeAndPositionItem(LiveFeedAnimator, (float)videoFeedDto.Scale, 1, videoFeedDto.Rotation);
 }
Example #5
0
 void Awake()
 {
     Map        = gameObject.GetComponent <MapManager>();
     Obs        = gameObject.GetComponent <ObsManager>();
     Enemy      = gameObject.GetComponent <EnemyManager>();
     Player     = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerManager>();
     CameraMove = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraMove>();
     Ui         = GameObject.FindGameObjectWithTag("UI").GetComponent <UIControl>();
     Le         = GameObject.Find("Level").GetComponent <Level>();
 }
Example #6
0
    public void Init()
    {
        _curtime  = 0;
        _resttime = 0.5f;
        _target   = new Vector2(0, 1);
        _hp       = 1;

        _animator = gameObject.GetComponent <Animator>();
        _rigid    = gameObject.GetComponent <Rigidbody2D>();
        _collider = gameObject.GetComponent <BoxCollider2D>();
        Obs       = GameObject.FindGameObjectWithTag("GameController").GetComponent <ObsManager>();

        Staus = Staus.Gaming;
    }
        public static void SetSourceVisibility(SetObsSourceVisibilityEventArgs ea)
        {
            if (ea.DelaySeconds > 0)
            {
                SourceVisibilityTimer delayShowSourceTimer = new SourceVisibilityTimer();
                delayShowSourceTimer.Interval = ea.DelaySeconds * 1000;
                ea.DelaySeconds = 0;                  // Prevents us from setting multiple timers for a single source switch.
                delayShowSourceTimer.Elapsed += DelayShowSourceTimer_Elapsed;
                delayShowSourceTimer.ea       = ea;
                delayShowSourceTimer.Start();
                return;
            }

            ObsManager.SetSourceVisibility(ea.SceneName, ea.SourceName, ea.Visible);
        }
 string GetFoundationalScene()
 {
     try
     {
         OBSScene currentScene = ObsManager.GetCurrentScene();
         if (IsFoundationScene(currentScene.Name))
         {
             return(currentScene.Name);
         }
         return(DndObsManager.STR_PlayerScene);
     }
     catch             //(Exception ex)
     {
         return(DndObsManager.STR_PlayerScene);
     }
 }
        void StartLiveFeedAnimation(string itemName, string sceneName, double playerX, double videoAnchorHorizontal, double videoAnchorVertical, double videoWidth, double videoHeight, double targetScale, double timeMs)
        {
            SceneItem sceneItem = ObsManager.GetSceneItem(sceneName, itemName);

            SceneItemProperties sceneItemProperties = ObsManager.GetSceneItemProperties(itemName, sceneName);
            double startScale = sceneItemProperties.Bounds.Height / videoHeight;

            VideoFeed[]    videoFeeds        = GetVideoFeeds(sceneName, itemName, videoAnchorHorizontal, videoAnchorVertical, videoWidth, videoHeight);
            LiveFeedScaler liveFeedAnimation = new LiveFeedScaler(videoFeeds, playerX, startScale, targetScale, timeMs);

            if (!sceneItem.Render)
            {
                ObsManager.SizeAndPositionItem(liveFeedAnimation, (float)liveFeedAnimation.TargetScale);
            }
            else
            {
                liveFeedAnimation.Render += LiveFeedAnimation_Render;
            }
        }
Example #10
0
 public void Execute(IDungeonMasterApp dungeonMasterApp, ChatMessage chatMessage)
 {
     ObsManager.SetSourceVisibility(sourceVideo, "CR.Templates", true);
     DndObsManager.SetSourceVisibility(sourceVideo, "CR.Templates", false, 7.7);
 }
        private void LiveFeedAnimation_Render(object sender, LiveFeedScaler e)
        {
            float scale = (float)e.GetTargetScale();

            ObsManager.SizeAndPositionItem(e, scale);
        }
 private void ShowStampedeMediaSource(string mediaSource, bool visible)
 {
     ObsManager.SetSourceVisibility(Scene_Stampedes, mediaSource, visible);
 }