コード例 #1
0
ファイル: UILayer.cs プロジェクト: kevinmel2000/FreeSO
        public void Update(UpdateState state)
        {
            GameThread.DigestUpdate(state);

            var mousePosition = state.MouseState.Position;
            var bounds        = GameFacade.Game.Window.ClientBounds;

            state.MouseOverWindow = mousePosition.X > 0 && mousePosition.Y > 0 &&
                                    mousePosition.X < bounds.Width && mousePosition.Y < bounds.Height;
            if (FSOEnvironment.SoftwareKeyboard)
            {
                state.MouseOverWindow = true;
            }
            state.WindowFocused = GameFacade.Game.IsActive;

            /**
             * Handle the mouse events from the previous frame
             * Its important to do this before the update calls because
             * a lot of mouse events will make changes to the UI. If they do
             * we want the Matrix's to be recalculated before the draw
             * method and that is done in the update method.
             */
            if (state.ProcessMouseEvents)
            {
                inputManager.HandleMouseEvents(state);
            }
            state.MouseEvents.Clear();

            state.InputManager = inputManager;
            Content.Content.Get()?.Changes.RunResModifications();
            mainUI.Update(state);

            if (state.AltDown && state.NewKeys.Contains(Microsoft.Xna.Framework.Input.Keys.Enter))
            {
                GameFacade.GraphicsDeviceManager.ToggleFullScreen();
            }

            lock (m_ExtContainers)
            {
                var extCopy = new List <UIExternalContainer>(m_ExtContainers);
                foreach (var ext in extCopy)
                {
                    lock (ext)
                    {
                        ext.Update(state);
                    }
                }
            }

            /** Process external update handlers **/
            foreach (var item in m_UIProcess)
            {
                item.Update(state);
            }

            Tooltip           = state.UIState.Tooltip;
            TooltipProperties = state.UIState.TooltipProperties;
        }
コード例 #2
0
        public void Update(UpdateState state)
        {
            /**
             * Handle the mouse events from the previous frame
             * Its important to do this before the update calls because
             * a lot of mouse events will make changes to the UI. If they do
             * we want the Matrix's to be recalculated before the draw
             * method and that is done in the update method.
             */

            inputManager.HandleMouseEvents(state);
            state.MouseEvents.Clear();

            state.InputManager = inputManager;
            Content.Content.Get().Changes.RunResModifications();
            mainUI.Update(state);

            lock (m_ExtContainers)
            {
                var extCopy = new List <UIExternalContainer>(m_ExtContainers);
                foreach (var ext in extCopy)
                {
                    lock (ext)
                    {
                        ext.Update(state);
                    }
                }
            }

            /** Process external update handlers **/
            foreach (var item in m_UIProcess)
            {
                item.Update(state);
            }

            Tooltip           = state.UIState.Tooltip;
            TooltipProperties = state.UIState.TooltipProperties;
        }