diff --git a/P3D/Core/Core.vb b/P3D/Core/Core.vb index 07eb359c9..9e518d379 100644 --- a/P3D/Core/Core.vb +++ b/P3D/Core/Core.vb @@ -191,10 +191,10 @@ Else SpriteBatch.BeginBatch() FontRenderer.Begin() - GraphicsDevice.DepthStencilState = DepthStencilState.Default GraphicsDevice.SamplerStates(0) = sampler + GraphicsDevice.SamplerStates(0) = SamplerState.PointClamp CurrentScreen.Draw() If Not Core.Player Is Nothing Then diff --git a/P3D/Input/UI/MessageBox.vb b/P3D/Input/UI/MessageBox.vb index 4595b756e..869419c1e 100644 --- a/P3D/Input/UI/MessageBox.vb +++ b/P3D/Input/UI/MessageBox.vb @@ -12,9 +12,12 @@ Private _closing As Boolean = False Private _text As String = "" - - Private _width As Integer = 500 - Private _height As Integer = 200 + Private Scale As Single = CInt(2.0F) + Private _width As Integer = 320 + Private _height As Integer = 320 + Private _backColor As Color = Color.Black + Private _textColor As Color = Color.White + Private _shadowColor As Color = Color.Black ''' ''' Creates a new instance of the message box class. @@ -37,14 +40,23 @@ ''' Displays the Message box. ''' ''' The text to display. - Public Sub Show(ByVal text As String) + Public Sub Show(ByVal text As String, Optional backColor As Color = Nothing, Optional textColor As Color = Nothing, Optional shadowColor As Color = Nothing) _fadeIn = 0F _text = text _closing = False + If Not backColor = Nothing Then + _backColor = backColor + End If + If Not textColor = Nothing Then + _textColor = textColor + End If + If Not shadowColor = Nothing Then + _shadowColor = shadowColor + End If - Dim fontSize As Vector2 = FontManager.GameJoltFont.MeasureString(_text) - If fontSize.X > 480 Then - _width = CInt(fontSize.X + 20) + Dim fontSize As Vector2 = FontManager.MainFont.MeasureString(_text) * Scale + If fontSize.X > 196 Then + _width = CInt(fontSize.X + 24) End If SetScreen(Me) @@ -53,24 +65,23 @@ Public Overrides Sub Draw() PreScreen.Draw() + Dim fontSize As Vector2 = New Vector2(CInt(FontManager.MainFont.MeasureString(_text).X * Scale), CInt(FontManager.MainFont.MeasureString(_text).Y * Scale)) + Canvas.DrawRectangle(windowSize, New Color(0, 0, 0, CInt(140 * _fadeIn))) + Dim boxRect = New Rectangle(CInt(windowSize.Width / 2 - _width / 2 - (_width / 10)), + CInt(windowSize.Height / 2 - _height / 2 - (_height / 5) * (1 - _fadeIn)), + CInt(_width + (_width / 5)), + CInt(_height + fontSize.Y)) + Canvas.DrawRectangle(boxRect, New Color(_backColor.R, _backColor.G, _backColor.B, CInt(255 * _fadeIn)), True) - Canvas.DrawRectangle(New Rectangle(CInt(windowSize.Width / 2 - _width / 2 - (_width / 10) * (1 - _fadeIn)), - CInt(windowSize.Height / 2 - _height / 2 - (_height / 10) * (1 - _fadeIn)), - CInt(_width + (1 - _fadeIn) * (_width / 5)), - CInt(_height + (1 - _fadeIn) * (_height / 5))), New Color(0, 0, 0, CInt(255 * _fadeIn))) - - - Dim fontSizeMulti As Single = CSng(1 + (1 / 10) * (1 - _fadeIn)) * 0.75F - Dim fontSize As Vector2 = FontManager.GameJoltFont.MeasureString(_text) - GetFontRenderer().DrawString(FontManager.GameJoltFont, _text, New Vector2(windowSize.Width / 2.0F - (fontSize.X * fontSizeMulti) / 2.0F, - windowSize.Height / 2.0F - (fontSize.Y * fontSizeMulti) / 2.0F), New Color(255, 255, 255, CInt(255 * _fadeIn)), 0F, Vector2.Zero, fontSizeMulti, SpriteEffects.None, 0F) + Core.SpriteBatch.DrawString(FontManager.MainFont, _text, New Vector2(CInt(windowSize.Width / 2.0F - fontSize.X / 2.0F + 2 * Scale), CInt(boxRect.Y + (boxRect.Height / 2) - fontSize.Y / 2.0F + 2 * Scale)), New Color(_shadowColor.R, _shadowColor.G, _shadowColor.B, CInt(255 * _fadeIn)), 0F, Vector2.Zero, Scale, SpriteEffects.None, 0F) + Core.SpriteBatch.DrawString(FontManager.MainFont, _text, New Vector2(CInt(windowSize.Width / 2.0F - fontSize.X / 2.0F), CInt(boxRect.Y + (boxRect.Height / 2) - fontSize.Y / 2.0F)), New Color(_textColor.R, _textColor.G, _textColor.B, CInt(255 * _fadeIn)), 0F, Vector2.Zero, Scale, SpriteEffects.None, 0F) End Sub Public Overrides Sub Update() If _closing Then If _fadeIn > 0.0F Then - _fadeIn = MathHelper.Lerp(0.0F, _fadeIn, 0.4F) + _fadeIn = MathHelper.Lerp(0.0F, _fadeIn, 0.7F) If _fadeIn - 0.01F <= 0.0F Then _fadeIn = 0.0F SetScreen(PreScreen) diff --git a/P3D/Screens/MainMenu/PressStartScreen.vb b/P3D/Screens/MainMenu/PressStartScreen.vb index be259f82e..ecebb1e92 100644 --- a/P3D/Screens/MainMenu/PressStartScreen.vb +++ b/P3D/Screens/MainMenu/PressStartScreen.vb @@ -615,7 +615,7 @@ Public Class NewMainMenuScreen Select Case _menuIndex Case 0 If _selectedProfile = 1 And Security.FileValidation.IsValid(False) = False Then - _messageBox.Show("File validation failed!" & Environment.NewLine & "Redownload the game's files to solve this problem.") + _messageBox.Show("File validation failed!~Redownload the game's files to solve this problem.") Else _MainProfiles(_selectedProfile).SelectProfile() End If @@ -1373,7 +1373,7 @@ Public Class NewMainMenuScreen LoadGameJolt() ElseIf IsOptionsMenuButton = False Then Dim messageBox As New UI.MessageBox(CurrentScreen) - messageBox.Show("The required GameMode does not exist." & Environment.NewLine & "Reaquire the GameMode to play on this profile.") + messageBox.Show("The required GameMode does not exist.~Reaquire the GameMode to play on this profile.".Replace("~", Environment.NewLine)) Else _menuIndex = 2 _selectedProfileTemp = _selectedProfile diff --git a/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb b/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb index 44f64c12f..0874957cc 100644 --- a/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb +++ b/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb @@ -11,6 +11,21 @@ Dim argument As String = ScriptComparer.GetSubClassArgumentPair(subClass).Argument Select Case command.ToLower() + Case "showmessagebox" + Dim messageBox As New UI.MessageBox(CurrentScreen) + Dim colorsplit() As String = argument.Split("|") + Select Case argument.Split("|").Count + Case 1 + messageBox.Show(argument.Replace("~", Environment.NewLine).Replace("*", Environment.NewLine & Environment.NewLine)) + Case 2 + messageBox.Show(colorsplit(0).Replace("~", Environment.NewLine).Replace("*", Environment.NewLine & Environment.NewLine), New Color(CInt(colorsplit(1).GetSplit(0)), CInt(colorsplit(1).GetSplit(1)), CInt(colorsplit(1).GetSplit(2)))) + Case 3 + messageBox.Show(colorsplit(0).Replace("~", Environment.NewLine).Replace("*", Environment.NewLine & Environment.NewLine), New Color(CInt(colorsplit(1).GetSplit(0)), CInt(colorsplit(1).GetSplit(1)), CInt(colorsplit(1).GetSplit(2))), New Color(CInt(colorsplit(2).GetSplit(0)), CInt(colorsplit(2).GetSplit(1)), CInt(colorsplit(2).GetSplit(2)))) + Case 4 + messageBox.Show(colorsplit(0).Replace("~", Environment.NewLine).Replace("*", Environment.NewLine & Environment.NewLine), New Color(CInt(colorsplit(1).GetSplit(0)), CInt(colorsplit(1).GetSplit(1)), CInt(colorsplit(1).GetSplit(2))), New Color(CInt(colorsplit(2).GetSplit(0)), CInt(colorsplit(2).GetSplit(1)), CInt(colorsplit(2).GetSplit(2))), New Color(CInt(colorsplit(3).GetSplit(0)), CInt(colorsplit(3).GetSplit(1)), CInt(colorsplit(3).GetSplit(2)))) + End Select + IsReady = True + CanContinue = False Case "storagesystem" Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New StorageSystemScreen(Core.CurrentScreen), Color.Black, False))