Options Menu & Join Server Screen fixes

Fixed ContentPacks menu layout

Fixed the cause of the Options Menu crashing

Replaced the MiniFont in the JoinServerScreen with the InGameFont

Adjusted positioning of text in AddServerScreen
This commit is contained in:
JappaWakka 2021-10-06 00:11:56 +02:00
parent 064af97b49
commit 0c76e718dd
3 changed files with 34 additions and 60 deletions

View File

@ -111,7 +111,7 @@
End If
Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(CInt(Core.windowSize.Width / 2) - 180 + i * 192, 544, 128, 64))
Core.SpriteBatch.DrawString(FontManager.InGameFont, Text, New Vector2(CInt(Core.windowSize.Width / 2) - 162 + i * 192, 574), Color.Black)
Core.SpriteBatch.DrawString(FontManager.InGameFont, Text, New Vector2(CInt(Core.windowSize.Width / 2) - 162 + i * 192, 578), Color.Black)
Next
If IsValid() <> "" Then

View File

@ -152,7 +152,7 @@ Public Class JoinServerScreen
End Select
Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(CInt(Core.ScreenSize.Width / 2) - 560 + i * 192, Core.ScreenSize.Height - 136, 128, 64), True)
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Text, New Vector2(CInt(Core.ScreenSize.Width / 2) - 542 + i * 192, Core.ScreenSize.Height - 106), Color.Black)
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Text, New Vector2(CInt(Core.ScreenSize.Width / 2) - 542 + i * 192, Core.ScreenSize.Height - 104), Color.Black)
Next
Dim vS As String = "Protocol version: " & Servers.ServersManager.PROTOCOLVERSION
@ -557,16 +557,16 @@ Public Class JoinServerScreen
Canvas.DrawRectangle(New Rectangle(CInt(startPos.X), CInt(startPos.Y), width, 80), New Color(0, 0, 0, 200), True)
Canvas.DrawBorder(2, New Rectangle(CInt(startPos.X), CInt(startPos.Y), width, 80), Color.LightGray, True)
End If
Core.SpriteBatch.DrawInterfaceString(FontManager.MiniFont, Me.GetName(), New Vector2(CInt(startPos.X) + 4, CInt(startPos.Y) + 3), Color.White, 0.0F, Vector2.Zero, 1.4F, SpriteEffects.None, 0.0F)
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Me.GetName(), New Vector2(CInt(startPos.X) + 4, CInt(startPos.Y) + 3), Color.White, 0.0F, Vector2.Zero, 1.0F, SpriteEffects.None, 0.0F)
If ReceivedError = True Then
Core.SpriteBatch.DrawInterfaceString(FontManager.MiniFont, GetServerStatus(), New Vector2(CInt(startPos.X) + 4, CInt(startPos.Y) + 30), New Color(190, 0, 0, 255), 0.0F, Vector2.Zero, 1.0F, SpriteEffects.None, 0.0F)
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, GetServerStatus(), New Vector2(CInt(startPos.X) + 4, CInt(startPos.Y) + 30), New Color(190, 0, 0, 255), 0.0F, Vector2.Zero, 1.0F, SpriteEffects.None, 0.0F)
Core.SpriteBatch.DrawInterface(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(150, 224, 14, 14), ""), New Rectangle(CInt(startPos.X) + width - 32, CInt(startPos.Y) + 3, 28, 28), Color.White)
If New Rectangle(CInt(startPos.X) + width - 32, CInt(startPos.Y) + 3, 28, 28).Contains(MouseHandler.MousePosition) = True Then
Canvas.DrawRectangle(New Rectangle(MouseHandler.MousePosition.X + 10, MouseHandler.MousePosition.Y + 10, 160, 32), Color.Black)
Canvas.DrawBorder(3, New Rectangle(MouseHandler.MousePosition.X + 10, MouseHandler.MousePosition.Y + 10, 160, 32), Color.Gray)
Core.SpriteBatch.DrawInterfaceString(FontManager.MiniFont, "(no connection)", New Vector2(MouseHandler.MousePosition.X + 14, MouseHandler.MousePosition.Y + 16), Color.White)
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, "(no connection)", New Vector2(MouseHandler.MousePosition.X + 14, MouseHandler.MousePosition.Y + 16), Color.White)
End If
Else
If Pinged = True Then
@ -584,30 +584,30 @@ Public Class JoinServerScreen
color = New Color(190, 0, 0, 255)
End If
Core.SpriteBatch.DrawInterfaceString(FontManager.MiniFont, message, New Vector2(CInt(startPos.X) + 4, CInt(startPos.Y) + 30), color, 0.0F, Vector2.Zero, 1.0F, SpriteEffects.None, 0.0F)
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, message, New Vector2(CInt(startPos.X) + 4, CInt(startPos.Y) + 30), color, 0.0F, Vector2.Zero, 1.0F, SpriteEffects.None, 0.0F)
Core.SpriteBatch.DrawInterfaceString(FontManager.MiniFont, Me.CurrentPlayersOnline & "/" & Me.MaxPlayersOnline, New Vector2(CInt(startPos.X) + width - 36 - FontManager.MiniFont.MeasureString(Me.CurrentPlayersOnline & "/" & Me.MaxPlayersOnline).X, CInt(startPos.Y) + 7), Color.LightGray)
Core.SpriteBatch.DrawInterface(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(80 + 14 * (4 - GetPingLevel()), 238, 14, 14), ""), New Rectangle(CInt(startPos.X) + width - 32, CInt(startPos.Y) + 3, 28, 28), Color.White)
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Me.CurrentPlayersOnline & "/" & Me.MaxPlayersOnline, New Vector2(CInt(startPos.X) + width - 36 - FontManager.InGameFont.MeasureString(Me.CurrentPlayersOnline & "/" & Me.MaxPlayersOnline).X, CInt(startPos.Y) + 9), Color.LightGray)
Core.SpriteBatch.DrawInterface(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(80 + 14 * (4 - GetPingLevel()), 238, 14, 14), ""), New Rectangle(CInt(startPos.X) + width - 30, CInt(startPos.Y) + 3, 28, 28), Color.White)
' Ping result tool tip.
If New Rectangle(CInt(startPos.X) + width - 32, CInt(startPos.Y) + 3, 28, 28).Contains(MouseHandler.MousePosition) = True Then
Canvas.DrawRectangle(New Rectangle(MouseHandler.MousePosition.X + 10, MouseHandler.MousePosition.Y + 10, 160, 32), Color.Black)
Canvas.DrawBorder(3, New Rectangle(MouseHandler.MousePosition.X + 10, MouseHandler.MousePosition.Y + 10, 160, 32), Color.Gray)
Core.SpriteBatch.DrawInterfaceString(FontManager.MiniFont, "Ping: " & PingResult & " ms", New Vector2(MouseHandler.MousePosition.X + 14, MouseHandler.MousePosition.Y + 16), Color.White)
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, "Ping: " & PingResult & " ms", New Vector2(MouseHandler.MousePosition.X + 14, MouseHandler.MousePosition.Y + 16), Color.White)
End If
Else
Core.SpriteBatch.DrawInterface(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(80 + 14 * CInt(Math.Floor(JoinServerScreen.BarAnimationState / 10)), 224, 14, 14), ""), New Rectangle(CInt(startPos.X) + width - 32, CInt(startPos.Y) + 3, 28, 28), Color.White)
If New Rectangle(CInt(startPos.X) + width - 32, CInt(startPos.Y) + 3, 28, 28).Contains(MouseHandler.MousePosition) = True Then
Canvas.DrawRectangle(New Rectangle(MouseHandler.MousePosition.X + 10, MouseHandler.MousePosition.Y + 10, 160, 32), Color.Black)
Canvas.DrawBorder(3, New Rectangle(MouseHandler.MousePosition.X + 10, MouseHandler.MousePosition.Y + 10, 160, 32), Color.Gray)
Core.SpriteBatch.DrawInterfaceString(FontManager.MiniFont, "Polling" & LoadingDots.Dots, New Vector2(MouseHandler.MousePosition.X + 14, MouseHandler.MousePosition.Y + 16), Color.White)
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, "Polling" & LoadingDots.Dots, New Vector2(MouseHandler.MousePosition.X + 14, MouseHandler.MousePosition.Y + 16), Color.White)
End If
Core.SpriteBatch.DrawInterfaceString(FontManager.MiniFont, "Polling" & LoadingDots.Dots, New Vector2(CInt(startPos.X) + 4, CInt(startPos.Y) + 30), New Color(180, 180, 180, 255), 0.0F, Vector2.Zero, 1.0F, SpriteEffects.None, 0.0F)
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, "Polling" & LoadingDots.Dots, New Vector2(CInt(startPos.X) + 4, CInt(startPos.Y) + 30), New Color(180, 180, 180, 255), 0.0F, Vector2.Zero, 1.0F, SpriteEffects.None, 0.0F)
End If
End If
Core.SpriteBatch.DrawInterfaceString(FontManager.MiniFont, GetAddressString(), New Vector2(CInt(startPos.X) + 4, CInt(startPos.Y) + 53), New Color(180, 180, 180, 255), 0.0F, Vector2.Zero, 1.0F, SpriteEffects.None, 0.0F)
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, GetAddressString(), New Vector2(CInt(startPos.X) + 4, CInt(startPos.Y) + 53), New Color(180, 180, 180, 255), 0.0F, Vector2.Zero, 1.0F, SpriteEffects.None, 0.0F)
End Sub
Public Sub DrawPlayerListToolTip(ByVal startPos As Vector2)

View File

@ -21,7 +21,6 @@
Dim PreferMultiSampling As Boolean = True
Private _subMenu As Integer = 0
Private _screenSize As Size = New Size(CInt(ScreenSize.Width), CInt(ScreenSize.Height))
Private LastControl As Integer = 0
Private Property SelectPackNoiseDelay As Integer = 10
@ -308,10 +307,10 @@
End If
If i + packsMenuIndex(2) = packsMenuIndex(0) Then
SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Name, New Vector2(CInt(ScreenSize.Width / 2) - 318, 220 + 2 + i * 50), textColor)
SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Name, New Vector2(CInt(ScreenSize.Width / 2) - 320, 220 + i * 50), New Color(255, 255, 255, CInt(255 * _interfaceFade * _pageFade)))
SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Name, New Vector2(CInt(ScreenSize.Width / 2) - 318, CInt(Core.windowSize.Height / 2 - 120 + i * 50 + 2)), textColor)
SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Name, New Vector2(CInt(ScreenSize.Width / 2) - 320, CInt(Core.windowSize.Height / 2 - 120 + i * 50)), New Color(255, 255, 255, CInt(255 * _interfaceFade * _pageFade)))
Else
SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Name, New Vector2(CInt(ScreenSize.Width / 2) - 320, 220 + i * 50), textColor)
SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Name, New Vector2(CInt(ScreenSize.Width / 2) - 320, CInt(Core.windowSize.Height / 2 - 120 + i * 50)), textColor)
End If
Next
End If
@ -324,7 +323,6 @@
For Each control As Control In ControlList
If control._position = _cursorDestPosition Then
LastControl = control.ID
currentControl = control
Exit For
End If
@ -484,48 +482,18 @@
Private PInfoContent As String = ""
Private Sub DrawPackInformationMenu()
Dim isEnabled As Boolean = False
Dim packName As String = PInfoName
If EnabledPackNames.Contains(packName) = True Then
isEnabled = True
End If
If Not PInfoSplash Is Nothing Then
SpriteBatch.DrawInterface(PInfoSplash, ScreenSize, Color.White)
End If
Dim CanvasTexture As Texture2D = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), "")
Canvas.DrawRectangle(New Rectangle(CInt(ScreenSize.Width / 2) - 240 + 4, 196, 480, 64), New Color(77, 147, 198, CInt(255 * _interfaceFade * _pageFade)))
SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("pack_menu_name") & ": " & PInfoName, New Vector2(CInt(ScreenSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(Localization.GetString("pack_menu_name") & ": " & PInfoName).X / 2) + 2, 212 + 2), New Color(0, 0, 0, CInt(255 * _interfaceFade * _pageFade)))
SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("pack_menu_name") & ": " & PInfoName, New Vector2(CInt(ScreenSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(Localization.GetString("pack_menu_name") & ": " & PInfoName).X / 2), 212), New Color(255, 255, 255, CInt(255 * _interfaceFade * _pageFade)))
Canvas.DrawRectangle(New Rectangle(CInt(ScreenSize.Width / 2) - 240 + 4, CInt(Core.windowSize.Height / 2 - 144), 480, 64), New Color(77, 147, 198, CInt(255 * _interfaceFade * _pageFade)))
SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("pack_menu_name") & ": " & PInfoName, New Vector2(CInt(ScreenSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(Localization.GetString("pack_menu_name") & ": " & PInfoName).X / 2) + 2, CInt(Core.windowSize.Height / 2 - 128 + 2)), New Color(0, 0, 0, CInt(255 * _interfaceFade * _pageFade)))
SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("pack_menu_name") & ": " & PInfoName, New Vector2(CInt(ScreenSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(Localization.GetString("pack_menu_name") & ": " & PInfoName).X / 2), CInt(Core.windowSize.Height / 2 - 128)), New Color(255, 255, 255, CInt(255 * _interfaceFade * _pageFade)))
Canvas.DrawRectangle(New Rectangle(CInt(ScreenSize.Width / 2) - 272 + 4, 272, 544, 196), New Color(255, 255, 255, CInt(255 * _interfaceFade * _pageFade)))
SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("pack_menu_version") & ": " & PInfoVersion & Environment.NewLine & Localization.GetString("pack_menu_by") & ": " & PInfoAuthor & Environment.NewLine & Localization.GetString("pack_menu_content") & ": " & PInfoContent & Environment.NewLine & Localization.GetString("pack_menu_description") & ": " & Environment.NewLine & PInfoDescription.Replace("<br>", Environment.NewLine), New Vector2(CInt(ScreenSize.Width / 2) - 272 + 16, 280), New Color(0, 0, 0, CInt(255 * _interfaceFade * _pageFade)))
For i = 0 To 1
If i = packInfoIndex Then
CanvasTexture = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 48, 48, 48), "")
Else
CanvasTexture = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), "")
End If
Dim Text As String = Localization.GetString("pack_menu_back")
Select Case i
Case 0
If isEnabled = True Then
Text = Localization.GetString("pack_menu_toggle_off")
Else
Text = Localization.GetString("pack_menu_toggle_on")
End If
Case 1
Text = Localization.GetString("pack_menu_back")
End Select
Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(CInt(ScreenSize.Width / 2) - 180 + (200 * i), 688, 128, 64), True)
SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Text, New Vector2(CInt(ScreenSize.Width / 2) - 160 + (200 * i), 720), Color.Black)
Next
Canvas.DrawRectangle(New Rectangle(CInt(ScreenSize.Width / 2) - 272 + 4, CInt(Core.windowSize.Height / 2 - 72), 544, 196), New Color(255, 255, 255, CInt(255 * _interfaceFade * _pageFade)))
SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("pack_menu_version") & ": " & PInfoVersion & Environment.NewLine & Localization.GetString("pack_menu_by") & ": " & PInfoAuthor & Environment.NewLine & Localization.GetString("pack_menu_content") & ": " & PInfoContent & Environment.NewLine & Localization.GetString("pack_menu_description") & ": " & Environment.NewLine & PInfoDescription.Replace("<br>", Environment.NewLine), New Vector2(CInt(ScreenSize.Width / 2) - 272 + 16, CInt(Core.windowSize.Height / 2 - 64)), New Color(0, 0, 0, CInt(255 * _interfaceFade * _pageFade)))
End Sub
Private Sub UpdatePackInformationMenu()
@ -671,14 +639,13 @@
Me.PreScreen.Update()
'New stuff
If _opening Then
LastControl = 0
InitializeControls()
_opening = False
End If
'Refresh button positions
If ScreenSize.Width <> _screenSize.Width Or ScreenSize.Height <> _screenSize.Height Then
_screenSize = New Size(CInt(ScreenSize.Width), CInt(ScreenSize.Height))
If windowSize.Width <> _screenSize.Width Or windowSize.Height <> _screenSize.Height Then
_screenSize = New Size(CInt(windowSize.Width), CInt(windowSize.Height))
InitializeControls()
End If
@ -777,7 +744,7 @@
If Controls.Left(True, True, False, True, True, True) = True Then
SetCursorPosition("left")
End If
If ScreenIndex <> 6 And ScreenIndex <> 8 Then
If ScreenIndex <> 6 Then
If Controls.Left(False, False, True, False, False, False) = True Then
SetCursorPosition("previous")
End If
@ -790,7 +757,11 @@
If _pageClosing = False And _pageOpening = False Then
SoundManager.PlaySound("select")
If ScreenIndex = 0 Or _subMenu <> 0 Then
_closing = True
If ScreenIndex = 8 Then
SwitchToContentPacks()
Else
_closing = True
End If
Else
SwitchToMain()
End If
@ -825,7 +796,6 @@
For Each control As Control In ControlList
If control._position = _cursorDestPosition Then
LastControl = control.ID
currentControl = control
Exit For
End If
@ -1044,7 +1014,11 @@
Me.ControlList.Add(New CommandButton(New Vector2(Delta_X + 530 + 24, Delta_Y + 336), 1, 48, "Back", AddressOf SwitchToContentPacks, 2))
End Select
_cursorDestPosition = ControlList(LastControl)._position
If ScreenIndex <> 7 Then
_cursorDestPosition = ControlList(0)._position
Else
_cursorDestPosition = ControlList(4)._position
End If
End Sub
Private Sub Apply()
@ -1189,8 +1163,8 @@
Me._pageClosing = True
Else
ScreenIndex = _nextIndex
InitializeControls()
End If
InitializeControls()
End Sub
Private Sub SwitchToPackInformation()
If PackNames.Count > 0 Then