Added @screen.showmessagebox(text|r.g.b|r,g,b|r,g,b) command and fixed blurry scaling
This commit is contained in:
parent
7731e9cbc0
commit
6d30a0ebdf
|
@ -191,10 +191,10 @@
|
||||||
Else
|
Else
|
||||||
SpriteBatch.BeginBatch()
|
SpriteBatch.BeginBatch()
|
||||||
FontRenderer.Begin()
|
FontRenderer.Begin()
|
||||||
|
|
||||||
GraphicsDevice.DepthStencilState = DepthStencilState.Default
|
GraphicsDevice.DepthStencilState = DepthStencilState.Default
|
||||||
|
|
||||||
GraphicsDevice.SamplerStates(0) = sampler
|
GraphicsDevice.SamplerStates(0) = sampler
|
||||||
|
GraphicsDevice.SamplerStates(0) = SamplerState.PointClamp
|
||||||
CurrentScreen.Draw()
|
CurrentScreen.Draw()
|
||||||
|
|
||||||
If Not Core.Player Is Nothing Then
|
If Not Core.Player Is Nothing Then
|
||||||
|
|
|
@ -12,9 +12,12 @@
|
||||||
Private _closing As Boolean = False
|
Private _closing As Boolean = False
|
||||||
|
|
||||||
Private _text As String = ""
|
Private _text As String = ""
|
||||||
|
Private Scale As Single = CInt(2.0F)
|
||||||
Private _width As Integer = 500
|
Private _width As Integer = 320
|
||||||
Private _height As Integer = 200
|
Private _height As Integer = 320
|
||||||
|
Private _backColor As Color = Color.Black
|
||||||
|
Private _textColor As Color = Color.White
|
||||||
|
Private _shadowColor As Color = Color.Black
|
||||||
|
|
||||||
''' <summary>
|
''' <summary>
|
||||||
''' Creates a new instance of the message box class.
|
''' Creates a new instance of the message box class.
|
||||||
|
@ -37,14 +40,23 @@
|
||||||
''' Displays the Message box.
|
''' Displays the Message box.
|
||||||
''' </summary>
|
''' </summary>
|
||||||
''' <param name="text">The text to display.</param>
|
''' <param name="text">The text to display.</param>
|
||||||
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
|
_fadeIn = 0F
|
||||||
_text = text
|
_text = text
|
||||||
_closing = False
|
_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)
|
Dim fontSize As Vector2 = FontManager.MainFont.MeasureString(_text) * Scale
|
||||||
If fontSize.X > 480 Then
|
If fontSize.X > 196 Then
|
||||||
_width = CInt(fontSize.X + 20)
|
_width = CInt(fontSize.X + 24)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
SetScreen(Me)
|
SetScreen(Me)
|
||||||
|
@ -53,24 +65,23 @@
|
||||||
Public Overrides Sub Draw()
|
Public Overrides Sub Draw()
|
||||||
PreScreen.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)))
|
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)),
|
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)
|
||||||
CInt(windowSize.Height / 2 - _height / 2 - (_height / 10) * (1 - _fadeIn)),
|
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)
|
||||||
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)
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Overrides Sub Update()
|
Public Overrides Sub Update()
|
||||||
If _closing Then
|
If _closing Then
|
||||||
If _fadeIn > 0.0F 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
|
If _fadeIn - 0.01F <= 0.0F Then
|
||||||
_fadeIn = 0.0F
|
_fadeIn = 0.0F
|
||||||
SetScreen(PreScreen)
|
SetScreen(PreScreen)
|
||||||
|
|
|
@ -615,7 +615,7 @@ Public Class NewMainMenuScreen
|
||||||
Select Case _menuIndex
|
Select Case _menuIndex
|
||||||
Case 0
|
Case 0
|
||||||
If _selectedProfile = 1 And Security.FileValidation.IsValid(False) = False Then
|
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
|
Else
|
||||||
_MainProfiles(_selectedProfile).SelectProfile()
|
_MainProfiles(_selectedProfile).SelectProfile()
|
||||||
End If
|
End If
|
||||||
|
@ -1373,7 +1373,7 @@ Public Class NewMainMenuScreen
|
||||||
LoadGameJolt()
|
LoadGameJolt()
|
||||||
ElseIf IsOptionsMenuButton = False Then
|
ElseIf IsOptionsMenuButton = False Then
|
||||||
Dim messageBox As New UI.MessageBox(CurrentScreen)
|
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
|
Else
|
||||||
_menuIndex = 2
|
_menuIndex = 2
|
||||||
_selectedProfileTemp = _selectedProfile
|
_selectedProfileTemp = _selectedProfile
|
||||||
|
|
|
@ -11,6 +11,21 @@
|
||||||
Dim argument As String = ScriptComparer.GetSubClassArgumentPair(subClass).Argument
|
Dim argument As String = ScriptComparer.GetSubClassArgumentPair(subClass).Argument
|
||||||
|
|
||||||
Select Case command.ToLower()
|
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"
|
Case "storagesystem"
|
||||||
Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New StorageSystemScreen(Core.CurrentScreen), Color.Black, False))
|
Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New StorageSystemScreen(Core.CurrentScreen), Color.Black, False))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue