Beispiel #1
0
        public virtual void Update()
        {
            if (!_isRendering)
            {
                return;
            }

            PreUpdateCallback?.Invoke(this, new EventArgs());

            // Mouse inputs are for dashboards only right now.

            if (DashboardOverlay != null && !DashboardOverlay.IsVisible())
            {
                if (_wasVisible)
                {
                    _wasVisible = false;
                    HandleMouseLeaveEvent();
                }
                return;
            }

            _wasVisible = true;

            // We'll handle mouse events here eventually.

            if (DashboardOverlay != null)
            {
                while (DashboardOverlay.PollEvent(ref ovrEvent))
                {
                    HandleEvent();
                }
            }

            PostUpdateCallback?.Invoke(this, new EventArgs());
        }
Beispiel #2
0
        public virtual void Draw()
        {
            if (!CanDoUpdates())
            {
                return;
            }

            PreDrawCallback?.Invoke(this, new EventArgs());

            UpdateTexture();

            if (DashboardOverlay != null && DashboardOverlay.IsVisible())
            {
                DashboardOverlay.SetTexture(ref _textureData);
                DashboardOverlay.Show();
            }

            if (InGameOverlay != null && InGameOverlay.IsVisible())
            {
                InGameOverlay.SetTexture(ref _textureData);
                InGameOverlay.Show();
            }

            PostDrawCallback?.Invoke(this, new EventArgs());
        }
        bool CanDoUpdates()
        {
            if (Browser == null)
            {
                return(false);
            }

            if (DashboardOverlay == null && InGameOverlay == null)
            {
                return(false); // We can go no further.
            }
            //This prevents Draw() from failing on get of bitmap when attachment is delayed for controllers
            if (InGameOverlay != null && !InGameOverlay.AttachmentSuccess)
            {
                return(false);
            }

            if (DashboardOverlay != null && DashboardOverlay.IsVisible())
            {
                return(true);
            }

            if (InGameOverlay != null && InGameOverlay.IsVisible())
            {
                return(true);
            }

            return(false);
        }
        public void UpdateInputSettings()
        {
            if (DashboardOverlay != null)
            {
                DashboardOverlay.ToggleInput(true);
            }

            if (InGameOverlay != null)
            {
                InGameOverlay.ToggleInput(EnableNonDashboardInput);
            }
        }
        public virtual void Update()
        {
            if (!_isRendering)
            {
                return;
            }

            PreUpdateCallback?.Invoke(this, new EventArgs());

            // Mouse inputs are for dashboards only right now.

            if (InGameOverlay != null)
            {
                while (InGameOverlay.PollEvent(ref eventData))
                {
                    EVREventType type = (EVREventType)eventData.eventType;

                    HandleEvent(type, eventData);
                }
            }

            if (DashboardOverlay != null)
            {
                while (DashboardOverlay.PollEvent(ref eventData))
                {
                    EVREventType type = (EVREventType)eventData.eventType;

                    HandleEvent(type, eventData);
                }
            }

            if ((!EnableNonDashboardInput || InGameOverlay == null) && DashboardOverlay != null && !DashboardOverlay.IsVisible())
            {
                if (_wasVisible)
                {
                    _wasVisible = false;
                    HandleMouseLeaveEvent();
                }
                return;
            }

            _wasVisible = true;

            PostUpdateCallback?.Invoke(this, new EventArgs());
        }
        public virtual void Draw()
        {
            if (!CanDoUpdates())
            {
                return;
            }

            PreDrawCallback?.Invoke(this, new EventArgs());

            var newbitmap = _browser.ScreenshotAsync().Result;

            if (newbitmap != null)
            {
                if (_bitmap != null)
                {
                    _bitmap.Dispose();
                }
                _bitmap           = newbitmap;
                _browserDidUpdate = true;
            }
            UpdateTexture();

            if (_bitmap != null)
            {
                if (DashboardOverlay != null && DashboardOverlay.IsVisible())
                {
                    DashboardOverlay.SetTexture(ref _textureData);
                    DashboardOverlay.Show();
                }

                if (InGameOverlay != null && InGameOverlay.IsVisible())
                {
                    InGameOverlay.SetTexture(ref _textureData);
                    InGameOverlay.Show();
                }
            }

            PostDrawCallback?.Invoke(this, new EventArgs());
        }
Beispiel #7
0
 private void load(DashboardOverlay dashboard)
 {
     StateContainer = dashboard;
 }
Beispiel #8
0
 public TestSceneDashboardOverlay()
 {
     Add(overlay = new DashboardOverlay());
 }