Exemplo n.º 1
0
        protected override void Update(GameTime time)
        {
            if (!IsActive)
            {
                base.Update(time);
                return;
            }
#if SHARP_RAVEN && !DEBUG
            try
            {
#endif
            if (GumInputMapper.WasConsoleTogglePressed())
            {
                ConsoleVisible = !ConsoleVisible;

                if (ConsoleVisible)
                {
                    var commandPanel = GetConsoleTile("COMMAND");
                    commandPanel.AddCommandEntry();
                    ConsoleGui.SetFocus(commandPanel.Children[0]);
                }
            }

            if (ConsoleVisible)
            {
                ConsoleGui.Update(time);
                if (ConsoleGui.FocusItem != null)
                {
                    DwarfGame.GumInput.FireKeyboardActionsOnly(ConsoleGui);
                }
            }

            PerformanceMonitor.BeginFrame();
            PerformanceMonitor.PushFrame("Update");
            AssetManagement.Steam.Steam.Update();
            DwarfTime.LastTime.Update(time);
            StateManager.Update(DwarfTime.LastTime);
            base.Update(time);
            PerformanceMonitor.PopFrame();
#if SHARP_RAVEN && !DEBUG
        }

        catch (Exception exception)
        {
            if (ravenClient != null)
            {
                ravenClient.Capture(new SentryEvent(exception));
            }
            throw;
        }
#endif
            HasRendered = false;
        }
Exemplo n.º 2
0
        protected override void Update(GameTime time)
        {
            if (!IsActive)
            {
                base.Update(time);
                return;
            }

#if !DEBUG
            try
            {
#endif
            if (GumInputMapper.WasConsoleTogglePressed())
            {
                ConsoleVisible = !ConsoleVisible;

                if (ConsoleVisible)
                {
                    var commandPanel = GetConsoleTile("COMMAND");
                    commandPanel.AddCommandEntry();
                    ConsoleGui.SetFocus(commandPanel.Children[0]);
                }
            }

            if (ConsoleVisible)
            {
                ConsoleGui.Update(time);
                if (ConsoleGui.FocusItem != null)
                {
                    DwarfGame.GumInput.FireKeyboardActionsOnly(ConsoleGui);
                }
            }

            PerformanceMonitor.BeginFrame();
            PerformanceMonitor.PushFrame("Update");
            AssetManagement.Steam.Steam.Update();
            DwarfTime.LastTime.Update(time);
            GameStateManager.Update(DwarfTime.LastTime);

            lock (_actionMutex)
            {
                foreach (var action in _lazyActions)
                {
                    action.Action();
                    action.Result?.Invoke();
                }
                _lazyActions.Clear();
            }

            base.Update(time);
            PerformanceMonitor.PopFrame();
#if !DEBUG
        }

        catch (HandledException)
        {
            throw;
        }
        catch (Exception exception)
        {
            Program.CaptureException(exception);
            if (Program.ShowErrorDialog(exception.Message))
            {
                throw new HandledException(exception);
            }
        }
#endif
            HasRendered = false;
        }