Main Menu Work in Progress 21-09-2021

This commit is contained in:
JappaWakkaP3D 2021-09-21 17:45:56 +02:00
parent a6713d0c4d
commit 8263bbe390
1 changed files with 473 additions and 286 deletions

View File

@ -8,7 +8,7 @@ Public Class PressStartScreen
Inherits Screen Inherits Screen
Private _fadeIn As Single = 1.0F Private _fadeInMain As Single = 1.0F
Private _introDelay As Single = 4.0F Private _introDelay As Single = 4.0F
Private _logoFade As Single = 1.0F Private _logoFade As Single = 1.0F
@ -131,10 +131,10 @@ Public Class PressStartScreen
End If End If
Else Else
If IsCurrentScreen() Then If IsCurrentScreen() Then
If _fadeIn > 0.0F Then If _fadeInMain > 0.0F Then
_fadeIn = MathHelper.Lerp(0.0F, _fadeIn, 0.93F) _fadeInMain = MathHelper.Lerp(0.0F, _fadeInMain, 0.93F)
If _fadeIn - 0.01F <= 0.0F Then If _fadeInMain - 0.01F <= 0.0F Then
_fadeIn = 0.0F _fadeInMain = 0.0F
End If End If
End If End If
Else Else
@ -202,27 +202,26 @@ Public Class PressStartScreen
End If End If
_shineRenderer.Begin(SpriteSortMode.Texture, BlendState.Additive) _shineRenderer.Begin(SpriteSortMode.Texture, BlendState.Additive)
_logoRenderer.Draw(_logoTexture, New Rectangle(CInt(ScreenSize.Width / 2) - 350, CInt(160 * _fadeIn), 700, 300), New Color(255, 255, 255, CInt(255 * _logoFade))) _logoRenderer.Draw(_logoTexture, New Rectangle(CInt(ScreenSize.Width / 2) - 350, CInt(160 * _fadeInMain), 700, 300), New Color(255, 255, 255, CInt(255 * _logoFade)))
_shineRenderer.Draw(_shineTexture, New Rectangle(CInt(ScreenSize.Width / 2 - 250 + Math.Sin(tempF) * 240.0F), CInt(-100 + Math.Sin(tempG) * 10.0F + CInt(160 * _fadeIn)), 512, 512), New Color(255, 255, 255, CInt(255 * _logoFade))) _shineRenderer.Draw(_shineTexture, New Rectangle(CInt(ScreenSize.Width / 2 - 250 + Math.Sin(tempF) * 240.0F), CInt(-100 + Math.Sin(tempG) * 10.0F + CInt(160 * _fadeInMain)), 512, 512), New Color(255, 255, 255, CInt(255 * _logoFade)))
If _fadeIn = 0F Then If _fadeInMain = 0F Then
If IsCurrentScreen() And Core.GameOptions.ShowGUI Then ' Want to implement fading of text, but core doesn't seem to support this. If IsCurrentScreen() And Core.GameOptions.ShowGUI Then ' Want to implement fading of text, but core doesn't seem to support this.
Dim text As String = String.Empty Dim text As String = String.Empty
If ControllerHandler.IsConnected() Then If ControllerHandler.IsConnected() Then
text = "Press to start." text = "Press" & " " & "to start."
Else Else
text = "Press " & KeyBindings.EnterKey1.ToString().ToUpper & " to start." text = "Press" & " " & KeyBindings.EnterKey1.ToString().ToUpper & " " & "to start."
'text = "Press " & KeyBindings.EnterKey1.ToString() & ", " & KeyBindings.EnterKey2.ToString() & ", or primary mouse button to start." 'text = "Press " & KeyBindings.EnterKey1.ToString() & ", " & KeyBindings.EnterKey2.ToString() & ", or primary mouse button to start."
End If End If
Dim textSize As Vector2 = FontManager.GameJoltFont.MeasureString(text) Dim textSize As Vector2 = FontManager.InGameFont.MeasureString(text)
GetFontRenderer().DrawString(FontManager.GameJoltFont, text, New Vector2(windowSize.Width / 2.0F - textSize.X / 2.0F, GetFontRenderer().DrawString(FontManager.InGameFont, text, New Vector2(windowSize.Width / 2.0F - textSize.X / 2.0F,
windowSize.Height - textSize.Y - 50), _textColor) windowSize.Height - textSize.Y - 50), _textColor)
If ControllerHandler.IsConnected() Then If ControllerHandler.IsConnected() Then
SpriteBatch.Draw(TextureManager.GetTexture("GUI\GamePad\xboxControllerButtonA"), New Rectangle(CInt(windowSize.Width / 2 - textSize.X / 2 + FontManager.GameJoltFont.MeasureString("Press ").X), SpriteBatch.Draw(TextureManager.GetTexture("GUI\GamePad\xboxControllerButtonA"), New Rectangle(CInt(windowSize.Width / 2 - textSize.X / 2 + FontManager.InGameFont.MeasureString("Press" & " ").X + 2), CInt(windowSize.Height - textSize.Y - 58), 40, 40), Color.White)
CInt(windowSize.Height - textSize.Y - 50), 40, 40), Color.White)
End If End If
End If End If
End If End If
@ -230,7 +229,7 @@ Public Class PressStartScreen
_logoRenderer.End() _logoRenderer.End()
_shineRenderer.End() _shineRenderer.End()
Canvas.DrawRectangle(windowSize, New Color(0, 0, 0, CInt(255 * _fadeIn))) Canvas.DrawRectangle(windowSize, New Color(0, 0, 0, CInt(255 * _fadeInMain)))
End Sub End Sub
Public Overrides Sub ChangeTo() Public Overrides Sub ChangeTo()
@ -247,29 +246,32 @@ End Class
Public Class NewMainMenuScreen Public Class NewMainMenuScreen
' TODO: Replace old MainMenuScreen.
Inherits Screen Inherits Screen
Private _screenOffset As Vector2 = New Vector2(20, 180) Private _screenOffset As Vector2 = New Vector2(0, 0) 'Position of the main menu relative to the _screenOrigin
Private _screenOffsetTarget As Vector2 = New Vector2(20, 180) Private _screenOffsetTarget As Vector2 = New Vector2(0, 0) 'Target where the main menu needs to move to
Private _screenOrigin As Vector2 = New Vector2(CSng(ScreenSize.Width / 2 - 80 - 180), CSng(ScreenSize.Height / 2 - 80)) 'Center of the game window. It's adjusted when resizing the window.
Private _loading As Boolean = True Private _loading As Boolean = True
Private _fadeIn As Single = 0F Private _fadeInMain As Single = 0F
Private _fadeInOptions As Single = 0F
Private _fadeInGameJolt As Single = 0F
Private _expandDisplay As Single = 0F Private _expandDisplay As Single = 0F
Private _closingDisplay As Boolean = False Private _closingDisplay As Boolean = False
Private _displayTextFade As Single = 0F Private _displayTextFade As Single = 0F
Private _sliderPosition As Single = 0F Private _sliderPosition As Single = 0F 'Horizontal position of the main menu arrow
Private _sliderTarget As Integer = 0 Private _sliderTarget As Integer = 0 'Target where the arrow needs to move to
Private _menuTexture As Texture2D = Nothing Private _menuTexture As Texture2D
Private _oldMenuTexture As Texture2D Private _oldMenuTexture As Texture2D
Private _profiles As New List(Of GameProfile) Private _MainProfiles As New List(Of GameProfile)
Private _selectedProfile As Integer = 0 Private _GameJoltProfiles As New List(Of GameProfile)
Private _yIndex As Integer = 0 Private _OptionProfiles As New List(Of GameProfile)
Private _menuIndex As Integer = 1 '0 = New Game, 1 = Profiles Private _selectedProfile As Integer = 1
Private _GameJoltButtonIndex As Integer = 0 'This is to tell which button on a GameJolt profile is selected: the profile itself or the gender & reset buttons
Public Shared _menuIndex As Integer = 0 '0 = Game Profiles, 1 = GameJolt Submenu, 2 = Options Submenu, 3 = GameJolt Options Submenu
Private _messageBox As UI.MessageBox Private _messageBox As UI.MessageBox
@ -284,34 +286,66 @@ Public Class NewMainMenuScreen
_menuTexture = TextureManager.GetTexture("GUI\Menus\MainMenu") _menuTexture = TextureManager.GetTexture("GUI\Menus\MainMenu")
_oldMenuTexture = TextureManager.GetTexture("GUI\Menus\Menu") _oldMenuTexture = TextureManager.GetTexture("GUI\Menus\Menu")
_screenOffset.X = CSng(windowSize.Width / 2 - 80) _screenOffset.X = 0
_screenOffsetTarget.X = _screenOffset.X _screenOffsetTarget.X = _screenOffset.X
_screenOffset.Y = 0
_screenOffsetTarget.Y = _screenOffset.Y
_sliderTarget = GetSliderTarget(_selectedProfile) _sliderTarget = GetSliderTarget(_selectedProfile)
_sliderPosition = _sliderTarget _sliderPosition = _sliderTarget
_messageBox = New UI.MessageBox(Me) _messageBox = New UI.MessageBox(Me)
End Sub End Sub
Public Overrides Sub Update() Public Overrides Sub Update()
PreScreen.Update() PreScreen.Update()
If _loading = False Then If _loading = False Then
If _fadeIn < 1.0F Then 'Shift the main menu vertically
_fadeIn = MathHelper.Lerp(1.0F, _fadeIn, 0.93F) Select Case _menuIndex
If _fadeIn + 0.01F >= 1.0F Then Case 0
_fadeIn = 1.0F _screenOffsetTarget.Y = 0
Case 1, 2
_screenOffsetTarget.Y = -180 - 32
Case 3
_screenOffsetTarget.Y = -320 - 32
End Select
If _menuIndex = 2 Or _menuIndex = 3 Then
If _fadeInOptions < 1.0F Then
_fadeInOptions = MathHelper.Lerp(1.0F, _fadeInOptions, 0.93F)
If _fadeInOptions + 0.01F >= 1.0F Then
_fadeInOptions = 1.0F
End If
End If
Else
If _fadeInOptions > 1.0F Then
_fadeInOptions = MathHelper.Lerp(0.0F, _fadeInOptions, -0.93F)
If _fadeInOptions + 0.01F <= 0.0F Then
_fadeInOptions = 0.0F
End If
End If
End If
If _fadeInMain < 1.0F Then
_fadeInMain = MathHelper.Lerp(1.0F, _fadeInMain, 0.93F)
If _fadeInMain + 0.01F >= 1.0F Then
_fadeInMain = 1.0F
_sliderPosition = _sliderTarget _sliderPosition = _sliderTarget
End If End If
Else Else
If CurrentScreen.Identification = Identifications.MainMenuScreen Then
If Controls.Accept(True, False, False) Then If Controls.Accept(True, False, False) Then
' Click on profiles. ' Click on profiles.
For x = 0 To _profiles.Count - 1 For x = 0 To _MainProfiles.Count - 1
Dim xOffset As Single = _screenOffset.X + x * 180 + ((x + 1) * 100 * (1 - _fadeIn)) Dim xOffset As Single = _screenOrigin.X + _screenOffset.X + x * 180 + ((x + 1) * 100 * (1 - _fadeInMain))
If New Rectangle(CInt(xOffset), CInt(_screenOffset.Y), 160, 160).Contains(MouseHandler.MousePosition) Then If New Rectangle(CInt(xOffset), CInt(_screenOrigin.Y + _screenOffset.Y), 160, 160).Contains(MouseHandler.MousePosition) Then
If _selectedProfile = x Then If _selectedProfile = x Then
If CurrentScreen.Identification = Identifications.MainMenuScreen Then
ClickedProfile() ClickedProfile()
SoundManager.PlaySound("select") SoundManager.PlaySound("select")
End If
Else Else
If CurrentScreen.Identification = Identifications.MainMenuScreen Then
Dim diff As Integer = x - _selectedProfile Dim diff As Integer = x - _selectedProfile
_screenOffsetTarget.X -= diff * 180 _screenOffsetTarget.X -= diff * 180
@ -319,11 +353,12 @@ Public Class NewMainMenuScreen
End If End If
Exit For Exit For
End If End If
End If
Next Next
If _profiles(_selectedProfile).IsGameJolt AndAlso _profiles(_selectedProfile).Loaded Then If _MainProfiles(_selectedProfile).IsGameJolt AndAlso _MainProfiles(_selectedProfile).Loaded Then
' Click on gamejolt buttons ' Click on gamejolt buttons
Dim _xOffset As Single = _screenOffset.X + (100 * (1 - _fadeIn)) Dim xOffset As Single = _screenOrigin.X + _screenOffset.X + (100 * (1 - _fadeInMain))
Dim r As New Vector2(_xOffset + 400, _screenOffset.Y + 200) Dim r As New Vector2(xOffset + 400, _screenOrigin.Y + _screenOffset.Y + 200)
If New Rectangle(CInt(r.X), CInt(r.Y), 32, 32).Contains(MouseHandler.MousePosition) Then If New Rectangle(CInt(r.X), CInt(r.Y), 32, 32).Contains(MouseHandler.MousePosition) Then
ButtonChangeMale() ButtonChangeMale()
ElseIf New Rectangle(CInt(r.X), CInt(r.Y) + 48, 32, 32).Contains(MouseHandler.MousePosition) Then ElseIf New Rectangle(CInt(r.X), CInt(r.Y) + 48, 32, 32).Contains(MouseHandler.MousePosition) Then
@ -335,10 +370,10 @@ Public Class NewMainMenuScreen
End If End If
If Controls.Dismiss(True, False, False) Then If Controls.Dismiss(True, False, False) Then
' Click on profiles. ' Click on profiles.
For x = 0 To _profiles.Count - 1 For x = 0 To _MainProfiles.Count - 1
Dim xOffset As Single = _screenOffset.X + x * 180 + ((x + 1) * 100 * (1 - _fadeIn)) Dim xOffset As Single = _screenOrigin.X + _screenOffset.X + x * 180 + ((x + 1) * 100 * (1 - _fadeInMain))
If New Rectangle(CInt(xOffset), CInt(_screenOffset.Y), 160, 160).Contains(MouseHandler.MousePosition) Then If New Rectangle(CInt(xOffset), CInt(_screenOrigin.Y + _screenOffset.Y), 160, 160).Contains(MouseHandler.MousePosition) Then
If _selectedProfile = x Then If _selectedProfile = x Then
SoundManager.PlaySound("select") SoundManager.PlaySound("select")
DismissProfile() DismissProfile()
@ -347,32 +382,34 @@ Public Class NewMainMenuScreen
End If End If
Next Next
End If End If
If CurrentScreen.Identification = Screen.Identifications.MainMenuScreen Then
If Controls.Right(True) And _selectedProfile < _profiles.Count - 1 Then If Controls.Right(True) And _selectedProfile < _MainProfiles.Count - 1 Then
_selectedProfile += 1 _selectedProfile += 1
_screenOffsetTarget.X -= 180 _screenOffsetTarget.X -= 180
_yIndex = 0 _GameJoltButtonIndex = 0
End If End If
If Controls.Left(True) And _selectedProfile > 0 Then If Controls.Left(True) And _selectedProfile > 0 Then
_selectedProfile -= 1 _selectedProfile -= 1
_screenOffsetTarget.X += 180 _screenOffsetTarget.X += 180
_yIndex = 0 _GameJoltButtonIndex = 0
End If End If
If _profiles(_selectedProfile).IsGameJolt AndAlso _profiles(_selectedProfile).Loaded Then End If
If _MainProfiles(_selectedProfile).IsGameJolt AndAlso _MainProfiles(_selectedProfile).Loaded Then
If Controls.Down(True, True, False) Then If Controls.Down(True, True, False) Then
_yIndex += 1 _GameJoltButtonIndex += 1
End If End If
If Controls.Up(True, True, False) Then If Controls.Up(True, True, False) Then
_yIndex -= 1 _GameJoltButtonIndex -= 1
End If End If
_yIndex = Clamp(_yIndex, 0, 3) _GameJoltButtonIndex = Clamp(_GameJoltButtonIndex, 0, 3)
End If End If
_selectedProfile = _selectedProfile.Clamp(0, _profiles.Count - 1) _selectedProfile = _selectedProfile.Clamp(0, _MainProfiles.Count - 1)
If _fadeIn = 1.0F Then If _fadeInMain = 1.0F Then
If Controls.Accept(False, True, True) Then If Controls.Accept(False, True, True) Then
Select Case _yIndex Select Case _GameJoltButtonIndex
Case 0 Case 0
SoundManager.PlaySound("select") SoundManager.PlaySound("select")
ClickedProfile() ClickedProfile()
@ -390,13 +427,13 @@ Public Class NewMainMenuScreen
If Controls.Dismiss(False, True, True) Then If Controls.Dismiss(False, True, True) Then
SoundManager.PlaySound("select") SoundManager.PlaySound("select")
DismissProfile() DismissProfile()
_yIndex = 0 _GameJoltButtonIndex = 0
End If End If
' Try to load the GameJolt profile once the player has logged in. ' Try to load the GameJolt profile once the player has logged in.
_profiles(0).LoadGameJolt() _MainProfiles(0).LoadGameJolt()
End If End If
If _profiles(_selectedProfile).Loaded = False Then If _MainProfiles(_selectedProfile).Loaded = False Then
_closingDisplay = True _closingDisplay = True
Else Else
_closingDisplay = False _closingDisplay = False
@ -408,13 +445,20 @@ Public Class NewMainMenuScreen
ElseIf _sliderPosition > _sliderTarget Then ElseIf _sliderPosition > _sliderTarget Then
_sliderPosition = MathHelper.Lerp(_sliderTarget, _sliderPosition, 0.8F) _sliderPosition = MathHelper.Lerp(_sliderTarget, _sliderPosition, 0.8F)
End If End If
If KeyBoardHandler.KeyPressed(KeyBindings.EscapeKey) Or KeyBoardHandler.KeyPressed(KeyBindings.BackKey1) Or KeyBoardHandler.KeyPressed(KeyBindings.BackKey2) Or MouseHandler.ButtonPressed(MouseHandler.MouseButtons.RightButton) Or ControllerHandler.ButtonPressed(Buttons.B) Then If KeyBoardHandler.KeyPressed(KeyBindings.EscapeKey) Or KeyBoardHandler.KeyPressed(KeyBindings.BackKey1) Or KeyBoardHandler.KeyPressed(KeyBindings.BackKey2) Or MouseHandler.ButtonPressed(MouseHandler.MouseButtons.RightButton) Or ControllerHandler.ButtonPressed(Buttons.B) Then
Select Case _menuIndex
Case 0
'SetScreen(New TransitionScreen(CurrentScreen, Me.PreScreen, Color.White, False)) 'SetScreen(New TransitionScreen(CurrentScreen, Me.PreScreen, Color.White, False))
If CurrentScreen.Identification = Identifications.MainMenuScreen Then
SetScreen(New PressStartScreen()) SetScreen(New PressStartScreen())
End If End If
Case 1, 2
If _fadeIn = 1.0F Then _menuIndex = 0
Case 3
_menuIndex = 1
End Select
End If
If _fadeInMain = 1.0F Then
If _closingDisplay Then If _closingDisplay Then
If _expandDisplay > 0.0F Then If _expandDisplay > 0.0F Then
_expandDisplay = MathHelper.Lerp(0.0F, _expandDisplay, 0.9F) _expandDisplay = MathHelper.Lerp(0.0F, _expandDisplay, 0.9F)
@ -434,6 +478,7 @@ Public Class NewMainMenuScreen
End If End If
UpdateScreenOffset() UpdateScreenOffset()
End If End If
End If
End Sub End Sub
Private Sub ButtonChangeMale() Private Sub ButtonChangeMale()
@ -443,7 +488,7 @@ Public Class NewMainMenuScreen
GameJoltSave.Gender = "0" GameJoltSave.Gender = "0"
Core.Player.Skin = GameJolt.Emblem.GetPlayerSpriteFile(GameJolt.Emblem.GetPlayerLevel(GameJoltSave.Points), GameJoltSave.GameJoltID, GameJoltSave.Gender) Core.Player.Skin = GameJolt.Emblem.GetPlayerSpriteFile(GameJolt.Emblem.GetPlayerLevel(GameJoltSave.Points), GameJoltSave.GameJoltID, GameJoltSave.Gender)
_profiles(_selectedProfile).Sprite = GameJolt.Emblem.GetPlayerSprite(GameJolt.Emblem.GetPlayerLevel(GameJoltSave.Points), GameJoltSave.GameJoltID, GameJoltSave.Gender) _MainProfiles(_selectedProfile).Sprite = GameJolt.Emblem.GetPlayerSprite(GameJolt.Emblem.GetPlayerLevel(GameJoltSave.Points), GameJoltSave.GameJoltID, GameJoltSave.Gender)
End Sub End Sub
Private Sub ButtonChangeFemale() Private Sub ButtonChangeFemale()
If GameJoltSave.Gender = "1" Then If GameJoltSave.Gender = "1" Then
@ -452,28 +497,29 @@ Public Class NewMainMenuScreen
GameJoltSave.Gender = "1" GameJoltSave.Gender = "1"
Core.Player.Skin = GameJolt.Emblem.GetPlayerSpriteFile(GameJolt.Emblem.GetPlayerLevel(GameJoltSave.Points), GameJoltSave.GameJoltID, GameJoltSave.Gender) Core.Player.Skin = GameJolt.Emblem.GetPlayerSpriteFile(GameJolt.Emblem.GetPlayerLevel(GameJoltSave.Points), GameJoltSave.GameJoltID, GameJoltSave.Gender)
_profiles(_selectedProfile).Sprite = GameJolt.Emblem.GetPlayerSprite(GameJolt.Emblem.GetPlayerLevel(GameJoltSave.Points), GameJoltSave.GameJoltID, GameJoltSave.Gender) _MainProfiles(_selectedProfile).Sprite = GameJolt.Emblem.GetPlayerSprite(GameJolt.Emblem.GetPlayerLevel(GameJoltSave.Points), GameJoltSave.GameJoltID, GameJoltSave.Gender)
End Sub End Sub
Private Sub ButtonResetSave() Private Sub ButtonResetSave()
GameJoltSave.ResetSave() GameJoltSave.ResetSave()
_profiles(_selectedProfile).Sprite = GameJolt.Emblem.GetPlayerSprite(GameJolt.Emblem.GetPlayerLevel(GameJoltSave.Points), GameJoltSave.GameJoltID, GameJoltSave.Gender) _MainProfiles(_selectedProfile).Sprite = GameJolt.Emblem.GetPlayerSprite(GameJolt.Emblem.GetPlayerLevel(GameJoltSave.Points), GameJoltSave.GameJoltID, GameJoltSave.Gender)
_profiles(_selectedProfile).SetToDefault() _MainProfiles(_selectedProfile).SetToDefault()
End Sub End Sub
Private Sub ClickedProfile() Private Sub ClickedProfile()
If _selectedProfile = 0 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!" & Environment.NewLine & "Redownload the game's files to solve this problem.")
Else Else
_profiles(_selectedProfile).SelectProfile() _MainProfiles(_selectedProfile).SelectProfile()
End If End If
End Sub End Sub
Private Sub DismissProfile() Private Sub DismissProfile()
_profiles(_selectedProfile).UnSelectProfile() _MainProfiles(_selectedProfile).UnSelectProfile()
End Sub End Sub
Private Sub UpdateScreenOffset() Private Sub UpdateScreenOffset()
_screenOrigin = New Vector2(CSng(ScreenSize.Width / 2 - 80 - 180), CSng(ScreenSize.Height / 2 - 80))
If _screenOffset.X > _screenOffsetTarget.X Then If _screenOffset.X > _screenOffsetTarget.X Then
_screenOffset.X = MathHelper.Lerp(_screenOffsetTarget.X, _screenOffset.X, 0.93F) _screenOffset.X = MathHelper.Lerp(_screenOffsetTarget.X, _screenOffset.X, 0.93F)
If _screenOffset.X - 0.01F <= _screenOffsetTarget.X Then If _screenOffset.X - 0.01F <= _screenOffsetTarget.X Then
@ -504,20 +550,42 @@ Public Class NewMainMenuScreen
PreScreen.Draw() PreScreen.Draw()
If _loading = False Then If _loading = False Then
If _selectedProfile = 0 Then Select Case _menuIndex
DrawGradients(CInt(255 * _fadeIn), True) Case 0
If _MainProfiles(_selectedProfile).IsGameJolt = True Then
DrawGradients(CInt(255 * _fadeInMain), True)
Else Else
DrawGradients(CInt(255 * _fadeIn), False) DrawGradients(CInt(255 * _fadeInMain), False)
End If
Case 1
If Not _GameJoltProfiles(_selectedProfile).IsOptionsMenuButton Then
DrawGradients(CInt(255 * _fadeInMain), True)
Else
DrawGradients(CInt(255 * _fadeInMain), False)
End If
Case Else
DrawGradients(CInt(255 * _fadeInMain), False)
End Select
If _selectedProfile = 1 Then
DrawGradients(CInt(255 * _fadeInMain), True)
Else
DrawGradients(CInt(255 * _fadeInMain), False)
End If End If
End If End If
If IsCurrentScreen() Then If IsCurrentScreen() Then
If _loading Then If _loading Then
Dim textSize As Vector2 = FontManager.GameJoltFont.MeasureString("Please wait..") Dim textSize As Vector2 = FontManager.InGameFont.MeasureString("Please wait..")
GetFontRenderer().DrawString(FontManager.GameJoltFont, "Please wait" & LoadingDots.Dots, New Vector2(windowSize.Width / 2.0F - textSize.X / 2.0F, GetFontRenderer().DrawString(FontManager.InGameFont, "Please wait" & LoadingDots.Dots, New Vector2(windowSize.Width / 2.0F - textSize.X / 2.0F, windowSize.Height / 2.0F - textSize.Y / 2.0F + 100), Color.White)
windowSize.Height / 2.0F - textSize.Y / 2.0F + 100), Color.White)
Else Else
DrawProfiles() DrawMainProfiles()
Select Case _menuIndex
Case 2
DrawOptionProfiles(False)
Case 3
DrawOptionProfiles(True)
End Select
End If End If
End If End If
End Sub End Sub
@ -531,46 +599,58 @@ Public Class NewMainMenuScreen
fontColor = Color.Black fontColor = Color.Black
End If End If
If ScaleScreenRec(New Rectangle(r.X, r.Y, 32, 32)).Contains(MouseHandler.MousePosition) = True And GameInstance.IsMouseVisible OrElse Not GameInstance.IsMouseVisible And _yIndex = 1 Then If ScaleScreenRec(New Rectangle(r.X, r.Y, 32, 32)).Contains(MouseHandler.MousePosition) = True And GameInstance.IsMouseVisible OrElse Not GameInstance.IsMouseVisible And _GameJoltButtonIndex = 1 Then
y = 16 y = 16
SpriteBatch.DrawInterfaceString(FontManager.MiniFont, "Change to male", New Vector2(r.X + 64 + 4, r.Y + 4), fontColor) SpriteBatch.DrawInterfaceString(FontManager.InGameFont, "Change to male", New Vector2(r.X + 64 + 4, r.Y + 4), fontColor)
End If End If
SpriteBatch.DrawInterface(_oldMenuTexture, New Rectangle(r.X, r.Y, 32, 32), New Rectangle(144, 32 + y, 16, 16), Color.White) SpriteBatch.DrawInterface(_oldMenuTexture, New Rectangle(r.X, r.Y, 32, 32), New Rectangle(144, 32 + y, 16, 16), Color.White)
y = 0 y = 0
If ScaleScreenRec(New Rectangle(r.X, r.Y + 48, 32, 32)).Contains(MouseHandler.MousePosition) = True And GameInstance.IsMouseVisible OrElse Not GameInstance.IsMouseVisible And _yIndex = 2 Then If ScaleScreenRec(New Rectangle(r.X, r.Y + 48, 32, 32)).Contains(MouseHandler.MousePosition) = True And GameInstance.IsMouseVisible OrElse Not GameInstance.IsMouseVisible And _GameJoltButtonIndex = 2 Then
y = 16 y = 16
SpriteBatch.DrawInterfaceString(FontManager.MiniFont, "Change to female", New Vector2(r.X + 64 + 4, r.Y + 4 + 48), fontColor) SpriteBatch.DrawInterfaceString(FontManager.InGameFont, "Change to female", New Vector2(r.X + 64 + 4, r.Y + 4 + 48), fontColor)
End If End If
SpriteBatch.DrawInterface(_oldMenuTexture, New Rectangle(r.X, r.Y + 48, 32, 32), New Rectangle(160, 32 + y, 16, 16), Color.White) SpriteBatch.DrawInterface(_oldMenuTexture, New Rectangle(r.X, r.Y + 48, 32, 32), New Rectangle(160, 32 + y, 16, 16), Color.White)
y = 0 y = 0
If ScaleScreenRec(New Rectangle(r.X, r.Y + 48 + 48, 32, 32)).Contains(MouseHandler.MousePosition) = True And GameInstance.IsMouseVisible OrElse Not GameInstance.IsMouseVisible And _yIndex = 3 Then If ScaleScreenRec(New Rectangle(r.X, r.Y + 48 + 48, 32, 32)).Contains(MouseHandler.MousePosition) = True And GameInstance.IsMouseVisible OrElse Not GameInstance.IsMouseVisible And _GameJoltButtonIndex = 3 Then
y = 16 y = 16
SpriteBatch.DrawInterfaceString(FontManager.MiniFont, "Reset save", New Vector2(r.X + 64 + 4, r.Y + 4 + 48 + 48), fontColor) SpriteBatch.DrawInterfaceString(FontManager.InGameFont, "Reset save", New Vector2(r.X + 64 + 4, r.Y + 4 + 48 + 48), fontColor)
End If End If
SpriteBatch.DrawInterface(_oldMenuTexture, New Rectangle(r.X, r.Y + 48 + 48, 32, 32), New Rectangle(176, 32 + y, 16, 16), Color.White) SpriteBatch.DrawInterface(_oldMenuTexture, New Rectangle(r.X, r.Y + 48 + 48, 32, 32), New Rectangle(176, 32 + y, 16, 16), Color.White)
End Sub End Sub
Private Sub DrawProfiles() Private Sub DrawMainProfiles()
' Draw profiles. Dim MoveOffset As Single = 0
For x = 0 To _profiles.Count - 1 If _menuIndex = 0 Then
Dim xOffset As Single = _screenOffset.X + x * 180 + ((x + 1) * 100 * (1 - _fadeIn)) MoveOffset = _screenOffset.X
End If
For x = 0 To _MainProfiles.Count - 1
' Draw main profiles.
_profiles(x).Draw(New Vector2(xOffset, _screenOffset.Y), CInt(_fadeIn * 255), (x = _selectedProfile), _menuTexture) Dim xmain As Boolean = x = _selectedProfile
If _profiles(x).IsGameJolt AndAlso _profiles(x).Loaded AndAlso (x = _selectedProfile) Then If _menuIndex <> 0 Then
DrawGameJoltButtons(New Vector2(xOffset, _screenOffset.Y)) xmain = False
End If
Dim xOffset As Single = _screenOrigin.X + MoveOffset + x * 180 + ((x + 1) * 100 * (1 - _fadeInMain))
_MainProfiles(x).Draw(New Vector2(CInt(xOffset), CInt(_screenOrigin.Y + _screenOffset.Y)), CInt(_fadeInMain * 255), (xmain), _menuTexture)
If _MainProfiles(x).IsGameJolt AndAlso _MainProfiles(x).Loaded AndAlso (xmain) Then
DrawGameJoltButtons(New Vector2(CInt(xOffset), CInt(_screenOffset.Y)))
End If End If
Next Next
If _fadeIn = 1.0F Then If _fadeInMain = 1.0F And _menuIndex = 0 Then
' Draw arrow. ' Draw arrow.
SpriteBatch.Draw(_menuTexture, New Rectangle(CInt(_sliderPosition - 16), CInt(_screenOffset.Y + 170), 32, 16), New Rectangle(0, 16, 32, 16), Color.White) If _MainProfiles(_selectedProfile).IsGameJolt = False Then
SpriteBatch.Draw(_menuTexture, New Rectangle(CInt(_screenOrigin.X + _sliderPosition - 16), CInt(_screenOrigin.Y + 170), 32, 16), New Rectangle(0, 16, 32, 16), Color.White)
Dim displayRect = New Rectangle(CInt((_sliderPosition - 300).Clamp(20, windowSize.Width - 620)), CInt(_screenOffset.Y + 170 + 16), 600, CInt(240 * _expandDisplay)) Else
SpriteBatch.Draw(_menuTexture, New Rectangle(CInt(_screenOrigin.X + _sliderPosition - 16), CInt(_screenOrigin.Y + 170), 32, 16), New Rectangle(32, 16, 32, 16), Color.White)
End If
Dim displayRect = New Rectangle(CInt((_screenOrigin.X + _sliderPosition - 300).Clamp(20, windowSize.Width - 620)), CInt(_screenOrigin.Y + 170 + 16), 600, CInt(240 * _expandDisplay))
' Draw display. ' Draw display.
If _expandDisplay > 0F Then If _expandDisplay > 0F Then
@ -579,16 +659,15 @@ Public Class NewMainMenuScreen
End If End If
' Dark theme. ' Dark theme.
If (_selectedProfile = 0 Or _selectedProfile = 1) And _sliderPosition <= GetSliderTarget(1) Then If (_selectedProfile = 1 Or _selectedProfile = 2) And _sliderPosition <= GetSliderTarget(1) Then
Dim maxDistance As Integer = 180 Dim maxDistance As Integer = 180
Dim distance As Integer = CInt(Math.Abs(_sliderTarget - _sliderPosition)) Dim distance As Integer = CInt(Math.Abs(_sliderTarget - _sliderPosition))
Dim dist As Double = distance / maxDistance Dim dist As Double = distance / maxDistance
If _selectedProfile = 0 Then If _selectedProfile = 1 Then
dist = 1 - dist dist = 1 - dist
End If End If
SpriteBatch.Draw(_menuTexture, New Rectangle(CInt(_sliderPosition - 16), CInt(_screenOffset.Y + 170), 32, 16), New Rectangle(32, 16, 32, 16), New Color(255, 255, 255, CInt(255 * dist)))
If _expandDisplay > 0F Then If _expandDisplay > 0F Then
Canvas.DrawRectangle(displayRect, Screens.UI.ColorProvider.MainColor(True, CInt(255 * dist))) Canvas.DrawRectangle(displayRect, Screens.UI.ColorProvider.MainColor(True, CInt(255 * dist)))
Canvas.DrawRectangle(New Rectangle(displayRect.X, displayRect.Y + displayRect.Height - 3, displayRect.Width, 3), Screens.UI.ColorProvider.AccentColor(True, CInt(255 * dist * _expandDisplay))) Canvas.DrawRectangle(New Rectangle(displayRect.X, displayRect.Y + displayRect.Height - 3, displayRect.Width, 3), Screens.UI.ColorProvider.AccentColor(True, CInt(255 * dist * _expandDisplay)))
@ -596,21 +675,21 @@ Public Class NewMainMenuScreen
End If End If
' Draw profile info. ' Draw profile info.
Dim tmpProfile = _profiles(_selectedProfile) Dim tmpProfile = _MainProfiles(_selectedProfile)
If _expandDisplay = 1.0F Then If _expandDisplay = 1.0F Then
If tmpProfile.GameModeExists Then If tmpProfile.GameModeExists Then
For i = 0 To tmpProfile.PokemonTextures.Count - 1 For i = 0 To tmpProfile.PokemonTextures.Count - 1
SpriteBatch.Draw(tmpProfile.PokemonTextures(i), New Rectangle(displayRect.X + 30 + i * 70, displayRect.Y + 70, 64, 64), Color.White) SpriteBatch.Draw(tmpProfile.PokemonTextures(i), New Rectangle(displayRect.X + 30 + i * 70, displayRect.Y + 70, 64, 64), Color.White)
Next Next
GetFontRenderer().DrawString(FontManager.GameJoltFont, "Player Name: " & tmpProfile.Name & Environment.NewLine & GetFontRenderer().DrawString(FontManager.InGameFont, "Player Name: " & tmpProfile.Name & Environment.NewLine &
"GameMode: " & tmpProfile.GameMode, New Vector2(displayRect.X + 30, displayRect.Y + 20), Color.White, 0F, Vector2.Zero, 0.5F, SpriteEffects.None, 0F) "GameMode: " & tmpProfile.GameMode, New Vector2(displayRect.X + 30, displayRect.Y + 20), Color.White, 0F, Vector2.Zero, 1.0F, SpriteEffects.None, 0F)
GetFontRenderer().DrawString(FontManager.GameJoltFont, "Badges: " & tmpProfile.Badges.ToString() & Environment.NewLine & GetFontRenderer().DrawString(FontManager.InGameFont, "Badges: " & tmpProfile.Badges.ToString() & Environment.NewLine &
"Play time: " & tmpProfile.TimePlayed & Environment.NewLine & "Play time: " & tmpProfile.TimePlayed & Environment.NewLine &
"Location: " & tmpProfile.Location, New Vector2(displayRect.X + 30, displayRect.Y + 150), Color.White, 0F, Vector2.Zero, 0.5F, SpriteEffects.None, 0F) "Location: " & tmpProfile.Location, New Vector2(displayRect.X + 30, displayRect.Y + 150), Color.White, 0F, Vector2.Zero, 1.0F, SpriteEffects.None, 0F)
Else Else
GetFontRenderer().DrawString(FontManager.GameJoltFont, "Player Name: " & tmpProfile.Name & Environment.NewLine & GetFontRenderer().DrawString(FontManager.InGameFont, "Player Name: " & tmpProfile.Name & Environment.NewLine &
"GameMode: " & tmpProfile.GameMode, New Vector2(displayRect.X + 30, displayRect.Y + 20), Color.White, 0F, Vector2.Zero, 0.5F, SpriteEffects.None, 0F) "GameMode: " & tmpProfile.GameMode, New Vector2(displayRect.X + 30, displayRect.Y + 20), Color.White, 0F, Vector2.Zero, 1.0F, SpriteEffects.None, 0F)
SpriteBatch.Draw(_menuTexture, New Rectangle(displayRect.X + 30, displayRect.Y + 70, 32, 32), New Rectangle(0, 32, 32, 32), Color.White) SpriteBatch.Draw(_menuTexture, New Rectangle(displayRect.X + 30, displayRect.Y + 70, 32, 32), New Rectangle(0, 32, 32, 32), Color.White)
Dim errorText As String = "" Dim errorText As String = ""
@ -623,28 +702,49 @@ Public Class NewMainMenuScreen
Else Else
errorText = "The required GameMode does not exist!" errorText = "The required GameMode does not exist!"
End If End If
GetFontRenderer().DrawString(FontManager.GameJoltFont, errorText, New Vector2(displayRect.X + 70, displayRect.Y + 78), Color.White, 0F, Vector2.Zero, 0.5F, SpriteEffects.None, 0F) GetFontRenderer().DrawString(FontManager.InGameFont, errorText, New Vector2(displayRect.X + 70, displayRect.Y + 78), Color.White, 0F, Vector2.Zero, 1.0F, SpriteEffects.None, 0F)
End If End If
End If End If
End If End If
End Sub End Sub
Private Sub DrawOptionProfiles(IsGameJoltOptions As Boolean)
' Draw profiles.
For x = 0 To _OptionProfiles.Count - 1
Dim xOffset As Single = _screenOrigin.X + _screenOffset.X + x * 180 + ((x + 1) * 100)
_OptionProfiles(x).Draw(New Vector2(CInt(xOffset), CInt(_screenOrigin.Y)), CInt(_fadeInOptions * 255), (x = _selectedProfile), _menuTexture)
Next
If _fadeInOptions = 1.0F Then
' Draw arrow.
If _menuIndex <> 0 Then
SpriteBatch.Draw(_menuTexture, New Rectangle(CInt(_screenOrigin.X + _sliderPosition - 16), CInt(_screenOrigin.Y + 170), 32, 16), New Rectangle(32, 16, 32, 16), Color.White)
End If
End If
End Sub
Private Function GetSliderTarget(ByVal index As Integer) As Integer Private Function GetSliderTarget(ByVal index As Integer) As Integer
Return CInt(_screenOffset.X + index * 180 + 80) Return CInt(_screenOffset.X + index * 180 + 80)
End Function End Function
Public Overrides Sub ChangeTo() Public Overrides Sub ChangeTo()
If _profiles.Count = 0 Then If _MainProfiles.Count = 0 Then
'Dim t As New Threading.Thread(AddressOf LoadProfiles) 'Dim t As New Threading.Thread(AddressOf LoadMainProfiles)
't.IsBackground = True 't.IsBackground = True
't.Start() 't.Start()
LoadProfiles() LoadMainProfiles()
End If
If _OptionProfiles.Count = 0 Then
LoadOptionProfiles()
End If End If
End Sub End Sub
Private Sub LoadProfiles() Private Sub LoadMainProfiles()
_profiles.Add(New GameProfile("", False)) _MainProfiles.Add(New GameProfile("", False, True))
_MainProfiles.Add(New GameProfile("", False, False))
Dim files As String() = {"Apricorns.dat", "Berries.dat", "Box.dat", "Daycare.dat", "HallOfFame.dat", "ItemData.dat", "Items.dat", "NPC.dat", "Options.dat", "Party.dat", "Player.dat", "Pokedex.dat", "Register.dat", "RoamingPokemon.dat", "SecretBase.dat", "Statistics.dat"} Dim files As String() = {"Apricorns.dat", "Berries.dat", "Box.dat", "Daycare.dat", "HallOfFame.dat", "ItemData.dat", "Items.dat", "NPC.dat", "Options.dat", "Party.dat", "Player.dat", "Pokedex.dat", "Register.dat", "RoamingPokemon.dat", "SecretBase.dat", "Statistics.dat"}
For Each path As String In IO.Directory.GetDirectories(GameController.GamePath & "\Save\") For Each path As String In IO.Directory.GetDirectories(GameController.GamePath & "\Save\")
@ -658,16 +758,22 @@ Public Class NewMainMenuScreen
Next Next
If exists = True Then If exists = True Then
_profiles.Add(New GameProfile(path, False)) _MainProfiles.Add(New GameProfile(path, False, False))
End If End If
Next Next
GameModeManager.SetGameModePointer("Kolben") GameModeManager.SetGameModePointer("Kolben")
_profiles.Add(New GameProfile("", True)) _MainProfiles.Add(New GameProfile("", True, False))
_loading = False _loading = False
End Sub End Sub
Private Sub LoadOptionProfiles()
_OptionProfiles.Add(New GameProfile("", False, False, 0))
_OptionProfiles.Add(New GameProfile("", False, False, 1))
_OptionProfiles.Add(New GameProfile("", False, False, 2))
_OptionProfiles.Add(New GameProfile("", False, False, 3))
End Sub
Private Class GameProfile Private Class GameProfile
@ -675,9 +781,10 @@ Public Class NewMainMenuScreen
Private _loaded As Boolean = False Private _loaded As Boolean = False
Private _isLoading As Boolean = False Private _isLoading As Boolean = False
Private _failedGameJoltLoading As Boolean = False Private _failedGameJoltLoading As Boolean = False
Public _OptionsMenuIndex As Integer = -1
Private _path As String = "" Private _path As String = ""
Private _isNewGameButton As Boolean = False Private _isNewGameButton As Boolean = False
Private _IsOptionsMenuButton As Boolean = False
Private _name As String = "" Private _name As String = ""
Private _gameMode As String Private _gameMode As String
@ -693,7 +800,7 @@ Public Class NewMainMenuScreen
Private _surfing As Boolean = False Private _surfing As Boolean = False
Private _tempSurfSkin As String = "" Private _tempSurfSkin As String = ""
Private _fontSize As Single = 0.75F Private _fontSize As Single = 1.0F
Private _spriteIndex As Integer = 0 Private _spriteIndex As Integer = 0
Private _spriteDelay As Single = 1.5F Private _spriteDelay As Single = 1.5F
Private _logoBounce As Single = 0F Private _logoBounce As Single = 0F
@ -713,6 +820,17 @@ Public Class NewMainMenuScreen
Return _isGameJolt Return _isGameJolt
End Get End Get
End Property End Property
Public ReadOnly Property IsNewGameButton As Boolean
Get
Return _isNewGameButton
End Get
End Property
Public ReadOnly Property IsOptionsMenuButton As Boolean
Get
Return _IsOptionsMenuButton
End Get
End Property
Public ReadOnly Property Path() As String Public ReadOnly Property Path() As String
Get Get
@ -793,10 +911,28 @@ Public Class NewMainMenuScreen
_badges = 0 _badges = 0
End Sub End Sub
Public Sub New(ByVal path As String, ByVal isNewGameButton As Boolean) Public Sub New(ByVal path As String, ByVal isNewGameButton As Boolean, ByVal IsOptionsMenuButton As Boolean, Optional ByVal OptionsMenuIndex As Integer = -1)
If isNewGameButton Then If isNewGameButton Then
_isNewGameButton = True _isNewGameButton = True
_fontSize = 1.0F _fontSize = 1.0F
ElseIf IsOptionsMenuButton Then
_IsOptionsMenuButton = True
_fontSize = 1.0F
_sprite = TextureManager.GetTexture("Textures\UI\OptionsMenu")
Else
If OptionsMenuIndex <> -1 Then
_OptionsMenuIndex = OptionsMenuIndex
Select Case _OptionsMenuIndex
Case 0
_sprite = TextureManager.GetTexture("Textures\UI\OptionsMenu")
Case 1
_sprite = TextureManager.GetTexture("Textures\UI\OptionsMenu")
Case 2
_sprite = TextureManager.GetTexture("Textures\UI\OptionsMenu")
Case 3
_sprite = TextureManager.GetTexture("Textures\UI\OptionsMenu")
End Select
_sprite = TextureManager.GetTexture("Textures\UI\OptionsMenu")
Else Else
If path = "" Then If path = "" Then
_isGameJolt = True _isGameJolt = True
@ -813,6 +949,7 @@ Public Class NewMainMenuScreen
_loaded = True _loaded = True
End If End If
End If End If
End If
End Sub End Sub
Private Sub LoadContent(ByVal pokedata As String) Private Sub LoadContent(ByVal pokedata As String)
@ -852,7 +989,7 @@ Public Class NewMainMenuScreen
Case "name" Case "name"
_name = content _name = content
While FontManager.GameJoltFont.MeasureString(_name).X * _fontSize > 140 While FontManager.InGameFont.MeasureString(_name).X * _fontSize > 140
_fontSize -= 0.01F _fontSize -= 0.01F
End While End While
Case "badges" Case "badges"
@ -908,17 +1045,63 @@ Public Class NewMainMenuScreen
Next Next
Canvas.DrawRectangle(New Rectangle(CInt(offset.X), CInt(offset.Y), 160, 3), Screens.UI.ColorProvider.AccentColor(False, alpha)) Canvas.DrawRectangle(New Rectangle(CInt(offset.X), CInt(offset.Y), 160, 3), Screens.UI.ColorProvider.AccentColor(False, alpha))
End If End If
If _isNewGameButton Then If _isNewGameButton Then
Dim text As String = "New" & Environment.NewLine & "Game" Dim text As String = "New" & Environment.NewLine & "Game"
If alpha >= 250 And CurrentScreen.Identification = Identifications.MainMenuScreen Then If alpha >= 250 And CurrentScreen.Identification = Identifications.MainMenuScreen Then
FontRenderer.DrawString(FontManager.GameJoltFont, text, New Vector2(offset.X + 80 - (FontManager.GameJoltFont.MeasureString(text).X) / 2, FontRenderer.DrawString(FontManager.InGameFont, text, New Vector2(CInt(offset.X + 80 - (FontManager.InGameFont.MeasureString(text).X) / 2),
offset.Y + 80 - (FontManager.GameJoltFont.MeasureString(text).Y) / 2), New Color(255, 255, 255, alpha)) CInt(offset.Y + 80 - (FontManager.InGameFont.MeasureString(text).Y) / 2)), New Color(255, 255, 255, alpha))
Else Else
SpriteBatch.DrawString(FontManager.GameJoltFont, text, New Vector2(offset.X + 80 - (FontManager.GameJoltFont.MeasureString(text).X) / 2, SpriteBatch.DrawString(FontManager.InGameFont, text, New Vector2(CInt(offset.X + 80 - (FontManager.InGameFont.MeasureString(text).X) / 2),
offset.Y + 80 - (FontManager.GameJoltFont.MeasureString(text).Y) / 2), New Color(255, 255, 255, alpha)) CInt(offset.Y + 80 - (FontManager.InGameFont.MeasureString(text).Y) / 2)), New Color(255, 255, 255, alpha))
End If End If
ElseIf _IsOptionsMenuButton Then
Dim text As String = "Options"
If alpha >= 250 And CurrentScreen.Identification = Identifications.MainMenuScreen Then
FontRenderer.DrawString(FontManager.InGameFont, text, New Vector2(CInt(offset.X + 80 - (FontManager.InGameFont.MeasureString(text).X) / 2),
CInt(offset.Y + 132 - (FontManager.InGameFont.MeasureString(text).Y) / 2)), New Color(255, 255, 255, alpha))
Else
SpriteBatch.DrawString(FontManager.InGameFont, text, New Vector2(CInt(offset.X + 80 - (FontManager.InGameFont.MeasureString(text).X) / 2),
CInt(offset.Y + 132 - (FontManager.InGameFont.MeasureString(text).Y) / 2)), New Color(255, 255, 255, alpha))
End If
If _menuIndex = 0 Then
If isSelected Then
_logoBounce += 0.2F
Else
_logoBounce = 0F
End If
End If
SpriteBatch.Draw(_sprite, New Rectangle(CInt(offset.X + 40), CInt(offset.Y + 36 + Math.Sin(_logoBounce) * 8.0F), 80, 80), New Color(255, 255, 255, alpha))
ElseIf _OptionsMenuIndex <> -1 Then
Dim text As String = ""
Select Case _OptionsMenuIndex
Case 0
text = "Language"
Case 1
text = "Audio"
Case 2
text = "Controls"
Case 3
text = "Content Packs"
End Select
If alpha >= 250 And CurrentScreen.Identification = Identifications.MainMenuScreen Then
FontRenderer.DrawString(FontManager.InGameFont, text, New Vector2(CInt(offset.X + 80 - (FontManager.InGameFont.MeasureString(text).X) / 2),
CInt(offset.Y + 132 - (FontManager.InGameFont.MeasureString(text).Y) / 2)), New Color(255, 255, 255, alpha))
Else
SpriteBatch.DrawString(FontManager.InGameFont, text, New Vector2(CInt(offset.X + 80 - (FontManager.InGameFont.MeasureString(text).X) / 2),
CInt(offset.Y + 132 - (FontManager.InGameFont.MeasureString(text).Y) / 2)), New Color(255, 255, 255, alpha))
End If
If _menuIndex = 2 Or _menuIndex = 3 Then
If isSelected Then
_logoBounce += 0.2F
Else
_logoBounce = 0F
End If
End If
SpriteBatch.Draw(_sprite, New Rectangle(CInt(offset.X + 40), CInt(offset.Y + 36 + Math.Sin(_logoBounce) * 8.0F), 80, 80), New Color(255, 255, 255, alpha))
Else Else
If _loaded Then If _loaded Then
Dim frameSize As Size = New Size(CInt(_sprite.Width / 3), CInt(_sprite.Height / 4)) Dim frameSize As Size = New Size(CInt(_sprite.Width / 3), CInt(_sprite.Height / 4))
@ -938,17 +1121,18 @@ Public Class NewMainMenuScreen
SpriteBatch.Draw(_sprite, New Rectangle(CInt(offset.X + 17), CInt(offset.Y - 10), 128, 128), New Rectangle(frameSize.Width * _spriteOrder(_spriteIndex), frameSize.Height * 2, frameSize.Width, frameSize.Height), New Color(255, 255, 255, alpha)) SpriteBatch.Draw(_sprite, New Rectangle(CInt(offset.X + 17), CInt(offset.Y - 10), 128, 128), New Rectangle(frameSize.Width * _spriteOrder(_spriteIndex), frameSize.Height * 2, frameSize.Width, frameSize.Height), New Color(255, 255, 255, alpha))
If alpha >= 250 And CurrentScreen.Identification = Identifications.MainMenuScreen Then If alpha >= 250 And CurrentScreen.Identification = Identifications.MainMenuScreen Then
FontRenderer.DrawString(FontManager.GameJoltFont, _name, New Vector2(offset.X + 80 - (FontManager.GameJoltFont.MeasureString(_name).X * _fontSize) / 2, offset.Y + 120), New Color(255, 255, 255, alpha), 0F, Vector2.Zero, New Vector2(_fontSize), SpriteEffects.None, 0F) FontRenderer.DrawString(FontManager.InGameFont, _name, New Vector2(CInt(offset.X + 80 - (FontManager.InGameFont.MeasureString(_name).X * _fontSize) / 2), CInt(offset.Y + 120)), New Color(255, 255, 255, alpha), 0F, Vector2.Zero, New Vector2(_fontSize), SpriteEffects.None, 0F)
Else Else
SpriteBatch.DrawString(FontManager.GameJoltFont, _name, New Vector2(offset.X + 80 - (FontManager.GameJoltFont.MeasureString(_name).X * _fontSize) / 2, offset.Y + 120), New Color(255, 255, 255, alpha), 0F, Vector2.Zero, New Vector2(_fontSize), SpriteEffects.None, 0F) SpriteBatch.DrawString(FontManager.InGameFont, _name, New Vector2(CInt(offset.X + 80 - (FontManager.InGameFont.MeasureString(_name).X * _fontSize) / 2), CInt(offset.Y + 120)), New Color(255, 255, 255, alpha), 0F, Vector2.Zero, New Vector2(_fontSize), SpriteEffects.None, 0F)
End If End If
Else Else
If _menuIndex = 0 Then
If isSelected Then If isSelected Then
_logoBounce += 0.2F _logoBounce += 0.2F
Else Else
_logoBounce = 0F _logoBounce = 0F
End If End If
End If
Dim text As String = "Log in" Dim text As String = "Log in"
If _isLoading Then If _isLoading Then
text = "Loading..." text = "Loading..."
@ -957,9 +1141,9 @@ Public Class NewMainMenuScreen
SpriteBatch.Draw(_sprite, New Rectangle(CInt(offset.X + 46), CInt(offset.Y + 36 + Math.Sin(_logoBounce) * 8.0F), 68, 72), New Color(255, 255, 255, alpha)) SpriteBatch.Draw(_sprite, New Rectangle(CInt(offset.X + 46), CInt(offset.Y + 36 + Math.Sin(_logoBounce) * 8.0F), 68, 72), New Color(255, 255, 255, alpha))
If alpha >= 250 And CurrentScreen.Identification = Identifications.MainMenuScreen Then If alpha >= 250 And CurrentScreen.Identification = Identifications.MainMenuScreen Then
FontRenderer.DrawString(FontManager.GameJoltFont, text, New Vector2(offset.X + 80 - (FontManager.GameJoltFont.MeasureString(text).X * _fontSize) / 2, offset.Y + 120), New Color(255, 255, 255, alpha), 0F, Vector2.Zero, New Vector2(_fontSize), SpriteEffects.None, 0F) FontRenderer.DrawString(FontManager.InGameFont, text, New Vector2(CInt(offset.X + 80 - (FontManager.InGameFont.MeasureString(text).X * _fontSize) / 2), CInt(offset.Y + 120)), New Color(255, 255, 255, alpha), 0F, Vector2.Zero, New Vector2(_fontSize), SpriteEffects.None, 0F)
Else Else
SpriteBatch.DrawString(FontManager.GameJoltFont, text, New Vector2(offset.X + 80 - (FontManager.GameJoltFont.MeasureString(text).X * _fontSize) / 2, offset.Y + 120), New Color(255, 255, 255, alpha), 0F, Vector2.Zero, New Vector2(_fontSize), SpriteEffects.None, 0F) SpriteBatch.DrawString(FontManager.InGameFont, text, New Vector2(CInt(offset.X + 80 - (FontManager.InGameFont.MeasureString(text).X * _fontSize) / 2), CInt(offset.Y + 120)), New Color(255, 255, 255, alpha), 0F, Vector2.Zero, New Vector2(_fontSize), SpriteEffects.None, 0F)
End If End If
End If End If
End If End If
@ -1002,13 +1186,15 @@ Public Class NewMainMenuScreen
_isLoading = False _isLoading = False
_pokemonTextures.Clear() _pokemonTextures.Clear()
_sprite = TextureManager.GetTexture("Textures\UI\GameJolt\gameJoltIcon") _sprite = TextureManager.GetTexture("Textures\UI\GameJolt\gameJoltIcon")
_fontSize = 0.75F _fontSize = 1.0F
GameJolt.API.LoggedIn = False GameJolt.API.LoggedIn = False
End If End If
End Sub End Sub
Public Sub SelectProfile() Public Sub SelectProfile()
If _isNewGameButton Then If _isGameJolt And _loaded = False And GameJolt.API.LoggedIn = False Then
SetScreen(New GameJolt.LogInScreen(CurrentScreen))
ElseIf _isNewGameButton Then
World.IsMainMenu = False World.IsMainMenu = False
If GameModeManager.GameModeCount = 1 Then If GameModeManager.GameModeCount = 1 Then
' There's only the default GameMode available, so just load that one. ' There's only the default GameMode available, so just load that one.
@ -1018,15 +1204,10 @@ Public Class NewMainMenuScreen
' There is more than one GameMode, prompt a selection screen: ' There is more than one GameMode, prompt a selection screen:
SetScreen(New GameModeSelectionScreen(CurrentScreen)) SetScreen(New GameModeSelectionScreen(CurrentScreen))
End If End If
Else
If _isGameJolt And _loaded = False And GameJolt.API.LoggedIn = False Then
SetScreen(New GameJolt.LogInScreen(CurrentScreen))
Else Else
If _gameModeExists Then If _gameModeExists Then
GameModeManager.SetGameModePointer(_gameMode) GameModeManager.SetGameModePointer(_gameMode)
World.IsMainMenu = False World.IsMainMenu = False
If _isGameJolt Then If _isGameJolt Then
Core.Player.IsGameJoltSave = True Core.Player.IsGameJoltSave = True
Core.Player.LoadGame("GAMEJOLTSAVE") Core.Player.LoadGame("GAMEJOLTSAVE")
@ -1044,14 +1225,16 @@ Public Class NewMainMenuScreen
_loaded = False _loaded = False
_sprite = TextureManager.GetTexture("Textures\UI\GameJolt\gameJoltIcon") _sprite = TextureManager.GetTexture("Textures\UI\GameJolt\gameJoltIcon")
LoadGameJolt() LoadGameJolt()
Else 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." & Environment.NewLine & "Reaquire the GameMode to play on this profile.")
Else
_menuIndex = 2
'SetScreen(New NewOptionScreen(CurrentScreen))
End If
End If
End If End If
End If
End If
End If
End Sub End Sub
End Class End Class
@ -1072,7 +1255,7 @@ Public Class GameModeSelectionScreen
Public Sub New(ByVal currentScreen As Screen) Public Sub New(ByVal currentScreen As Screen)
Me.Identification = Identifications.GameModeSelectionScreen Me.Identification = Identifications.GameModeSelectionScreen
CanBePaused = True CanBePaused = False
CanChat = False CanChat = False
CanDrawDebug = True CanDrawDebug = True
CanGoFullscreen = True CanGoFullscreen = True
@ -1089,23 +1272,27 @@ Public Class GameModeSelectionScreen
Dim text = "Select a GameMode" + Environment.NewLine + "to start the new game with." Dim text = "Select a GameMode" + Environment.NewLine + "to start the new game with."
GetFontRenderer().DrawString(FontManager.GameJoltFont, text, New Vector2(30, 30), Color.White) GetFontRenderer().DrawString(FontManager.InGameFont, text, New Vector2(30, 30), Color.White)
Dim center = windowSize.Width - 250 Dim center = windowSize.Width - 250
For i = 0 To _gameModes.Length - 1 For i = 0 To _gameModes.Length - 1
Dim y = CType(i * (HEIGHT + GAP) + _offset + windowSize.Height / 2 - HEIGHT / 2, Integer) Dim y = CType(i * (HEIGHT + GAP) + _offset + windowSize.Height / 2 - HEIGHT / 2, Integer)
Dim halfWidth = CType(WIDTH / 2, Integer)
Dim color = Screens.UI.ColorProvider.LightColor Dim color = Screens.UI.ColorProvider.LightColor
Dim alphaColor = New Color(color.R, color.G, color.B, 0) Dim alphaColor = New Color(color.R, color.G, color.B, 0)
Dim halfWidth = CType(WIDTH / 2, Integer) If i = _index Then
color = Screens.UI.ColorProvider.AccentColor
alphaColor = New Color(color.R, color.G, color.B, 0)
End If
Canvas.DrawGradient(New Rectangle(center - halfWidth, y, 50, HEIGHT), alphaColor, color, True, -1) Canvas.DrawGradient(New Rectangle(center - halfWidth, y, 50, HEIGHT), alphaColor, color, True, -1)
Canvas.DrawGradient(New Rectangle(center + halfWidth - 50, y, 50, HEIGHT), color, alphaColor, True, -1)
Canvas.DrawRectangle(New Rectangle(center - halfWidth + 50, y, WIDTH - 100, HEIGHT), color) Canvas.DrawRectangle(New Rectangle(center - halfWidth + 50, y, WIDTH - 100, HEIGHT), color)
Canvas.DrawGradient(New Rectangle(center + halfWidth - 50, y, 50, HEIGHT), color, alphaColor, True, -1)
Dim displayText = _gameModes(i).Name Dim displayText = _gameModes(i).Name
Dim textSize = FontManager.GameJoltFont.MeasureString(displayText) Dim textSize = FontManager.InGameFont.MeasureString(displayText)
GetFontRenderer().DrawString(FontManager.GameJoltFont, displayText, New Vector2(center - halfWidth + 50, CType(y + HEIGHT / 2 - ((textSize.Y * 0.75F) / 2), Integer)), Color.White, 0F, Vector2.Zero, 0.75F, SpriteEffects.None, 0F) GetFontRenderer().DrawString(FontManager.InGameFont, displayText, New Vector2(center - halfWidth + 50, CType(y + HEIGHT / 2 - ((textSize.Y) / 2), Integer)), Color.White, 0F, Vector2.Zero, 1.0F, SpriteEffects.None, 0F)
Next Next
End Sub End Sub
@ -1119,7 +1306,7 @@ Public Class GameModeSelectionScreen
If _index < _gameModes.Length - 1 AndAlso Controls.Down(True, True, True, True, True, True) Then If _index < _gameModes.Length - 1 AndAlso Controls.Down(True, True, True, True, True, True) Then
_index += 1 _index += 1
End If End If
If Controls.Dismiss(True, True, True) Then If KeyBoardHandler.KeyPressed(KeyBindings.EscapeKey) Or KeyBoardHandler.KeyPressed(KeyBindings.BackKey1) Or KeyBoardHandler.KeyPressed(KeyBindings.BackKey2) Or MouseHandler.ButtonPressed(MouseHandler.MouseButtons.RightButton) Or ControllerHandler.ButtonPressed(Buttons.B) Then
SoundManager.PlaySound("select") SoundManager.PlaySound("select")
SetScreen(PreScreen) SetScreen(PreScreen)
End If End If