public void Update() { if (Delay > 0f) { Delay -= 0.1f; if (Delay <= 0f) { Delay = 0f; } } else if (Delay == 0f) { if (Controls.Accept() == true || Controls.Dismiss() == true) { this.Showing = false; } } }
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; } } } }