Beispiel #1
0
        public static void Update(GameTime gameTime)
        {
            GameTime = gameTime;

            KeyBoardHandler.Update();
            ControllerHandler.Update();

            BaseConnectScreen.UpdateConnectSet();

            if (!GameInstance.IsActive)
            {
                if (CurrentScreen.CanBePaused)
                {
                    Core.SetScreen(Screen.CreatePauseScreen(CurrentScreen));
                }
            }
            else
            {
                if (KeyBoardHandler.KeyPressed(KeyBindings.Escape) || ControllerHandler.ButtonDown(Buttons.Start))
                {
                    CurrentScreen.EscapePressed();
                }
            }

            CurrentScreen?.Update(gameTime);
            if (CurrentScreen.CanChat)
            {
                if (KeyBoardHandler.KeyPressed(KeyBindings.Chat) || ControllerHandler.ButtonPressed(Buttons.RightShoulder))
                {
                    if (BaseJoinServerScreen.Online || Player.SandBoxMode || GameController.IS_DEBUG_ACTIVE)
                    {
                        SetScreen(Screen.CreateChatScreen((CurrentScreen)));
                    }
                }
            }

            MainGameFunctions.FunctionKeys();
            MusicManager.Update(gameTime);

            GameMessage.Update();
            Controls.MakeMouseVisible();

            MouseHandler.Update();

            LoadingDots.Update();
            ForcedCrash.Update();

            ServersManager.Update();
        }
        public void Update()
        {
            if (Showing)
            {
                ResetCursor();
                if (PositionY <= Core.WindowSize.Height - 160f)
                {
                    if (!_through)
                    {
                        if (Text.Length > _currentChar)
                        {
                            if (_delay <= 0f)
                            {
                                if (Text[_currentChar].ToString(NumberFormatInfo.InvariantInfo) == "\\")
                                {
                                    if (Text.Length > _currentChar + 1)
                                    {
                                        _showText[_currentLine] += Text[_currentChar + 1];

                                        _currentChar += 2;
                                    }
                                    else
                                    {
                                        _currentChar += 1;
                                    }
                                }
                                else
                                {
                                    switch (Text[_currentChar])
                                    {
                                    case '~':
                                        if (_currentLine == 1)
                                        {
                                            _through = true;
                                        }
                                        else
                                        {
                                            _currentLine += 1;
                                        }
                                        break;

                                    case '*':
                                        _currentLine   = 0;
                                        _clearNextLine = true;
                                        _through       = true;
                                        break;

                                    case '%':
                                        ProcessChooseBox();
                                        break;

                                    default:
                                        _showText[_currentLine] += Text[_currentChar];
                                        break;
                                    }

                                    _currentChar += 1;
                                }

                                if (KeyBoardHandler.KeyDown(Core.KeyBindings.Enter1) || KeyBoardHandler.KeyDown(Core.KeyBindings.Enter2) || MouseHandler.ButtonDown(MouseHandler.MouseButtons.LeftButton) == true || ControllerHandler.ButtonDown(Buttons.A) == true || ControllerHandler.ButtonDown(Buttons.B) == true)
                                {
                                    _delay = 0f;
                                }
                                else
                                {
                                    _delay = GetTextSpeed();
                                }
                            }
                            else
                            {
                                _delay -= 0.1f;
                            }
                        }
                        else
                        {
                            _through = true;
                        }
                    }
                    else
                    {
                        if (Controls.Accept() || Controls.Dismiss())
                        {
                            SoundEffectManager.PlaySound("select");
                            if (Text.Length <= _currentChar)
                            {
                                if (CanProceed == true)
                                {
                                    Showing = false;
                                    ResetCursor();

                                    if ((FollowUp != null))
                                    {
                                        FollowUp.Invoke();
                                        FollowUp = null;
                                    }

                                    TextFont  = FontManager.GetFontContainer("textfont");
                                    TextColor = DefaultColor;
                                    if (_doReDelay == true)
                                    {
                                        ReDelay = 1f;
                                    }
                                }
                            }
                            else
                            {
                                if (_clearNextLine == true)
                                {
                                    _showText[0] = "";
                                }
                                else
                                {
                                    _showText[0] = _showText[1];
                                }
                                _showText[1]   = "";
                                _through       = false;
                                _clearNextLine = false;
                            }
                        }
                    }
                }
                else
                {
                    float ySpeed = 3.5f;
                    switch (TextSpeed)
                    {
                    case 1:
                        ySpeed = 3.5f;
                        break;

                    case 2:
                        ySpeed = 4.5f;
                        break;

                    case 3:
                        ySpeed = 6.5f;
                        break;
                    }
                    PositionY -= ySpeed;
                }
            }
            else
            {
                if (ReDelay > 0f)
                {
                    ReDelay -= 0.1f;
                    if (ReDelay <= 0f)
                    {
                        ReDelay = 0f;
                    }
                }
            }
        }