示例#1
0
        public override void Update(DwarfTime gameTime)
        {
            TimeSinceOutput += (float)gameTime.ElapsedRealTime.TotalSeconds;

            SoundManager.Update(gameTime, null, null);

            SkipNextLine = false;
            foreach (var @event in DwarfGame.GumInputMapper.GetInputQueue())
            {
                GuiRoot.HandleInput(@event.Message, @event.Args);
                if ([email protected] && (@event.Message == InputEvents.KeyUp || @event.Message == InputEvents.MouseClick))
                {
                    SkipNextLine = true;
                }
            }

            if (AutoHideBubble)
            {
                _Output.Hidden       = TimeSinceOutput > 2.0f;
                SpeakerBorder.Hidden = TimeSinceOutput > 2.0f;
                GuiRoot.RootItem.Invalidate();
            }
            else
            {
                _Output.Hidden       = false;
                SpeakerBorder.Hidden = false;
                GuiRoot.RootItem.Invalidate();
            }

            GuiRoot.Update(gameTime.ToRealTime());

            YarnEngine.Update(gameTime);
        }
示例#2
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;
        }
示例#3
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;
        }