diff --git a/P3D/Screens/MainMenu/PressStartScreen.vb b/P3D/Screens/MainMenu/PressStartScreen.vb index c30e0f192..41b5c0802 100644 --- a/P3D/Screens/MainMenu/PressStartScreen.vb +++ b/P3D/Screens/MainMenu/PressStartScreen.vb @@ -8,7 +8,7 @@ Public Class PressStartScreen Inherits Screen - Private _fadeIn As Single = 1.0F + Private _fadeInMain As Single = 1.0F Private _introDelay As Single = 4.0F Private _logoFade As Single = 1.0F @@ -131,10 +131,10 @@ Public Class PressStartScreen End If Else If IsCurrentScreen() Then - If _fadeIn > 0.0F Then - _fadeIn = MathHelper.Lerp(0.0F, _fadeIn, 0.93F) - If _fadeIn - 0.01F <= 0.0F Then - _fadeIn = 0.0F + If _fadeInMain > 0.0F Then + _fadeInMain = MathHelper.Lerp(0.0F, _fadeInMain, 0.93F) + If _fadeInMain - 0.01F <= 0.0F Then + _fadeInMain = 0.0F End If End If Else @@ -202,27 +202,26 @@ Public Class PressStartScreen End If _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))) - _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))) + _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 * _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. Dim text As String = String.Empty If ControllerHandler.IsConnected() Then - text = "Press to start." + text = "Press" & " " & "to start." 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." 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) 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), - CInt(windowSize.Height - textSize.Y - 50), 40, 40), Color.White) + 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) End If End If End If @@ -230,7 +229,7 @@ Public Class PressStartScreen _logoRenderer.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 Public Overrides Sub ChangeTo() @@ -247,29 +246,32 @@ End Class Public Class NewMainMenuScreen - ' TODO: Replace old MainMenuScreen. - Inherits Screen - Private _screenOffset As Vector2 = New Vector2(20, 180) - Private _screenOffsetTarget 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(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 _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 _closingDisplay As Boolean = False Private _displayTextFade As Single = 0F - Private _sliderPosition As Single = 0F - Private _sliderTarget As Integer = 0 + Private _sliderPosition As Single = 0F 'Horizontal position of the main menu arrow + 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 _profiles As New List(Of GameProfile) - Private _selectedProfile As Integer = 0 - Private _yIndex As Integer = 0 - Private _menuIndex As Integer = 1 '0 = New Game, 1 = Profiles + Private _MainProfiles As New List(Of GameProfile) + Private _GameJoltProfiles As New List(Of GameProfile) + Private _OptionProfiles As New List(Of GameProfile) + 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 @@ -284,155 +286,198 @@ Public Class NewMainMenuScreen _menuTexture = TextureManager.GetTexture("GUI\Menus\MainMenu") _oldMenuTexture = TextureManager.GetTexture("GUI\Menus\Menu") - _screenOffset.X = CSng(windowSize.Width / 2 - 80) + _screenOffset.X = 0 _screenOffsetTarget.X = _screenOffset.X + _screenOffset.Y = 0 + _screenOffsetTarget.Y = _screenOffset.Y + _sliderTarget = GetSliderTarget(_selectedProfile) _sliderPosition = _sliderTarget _messageBox = New UI.MessageBox(Me) End Sub + Public Overrides Sub Update() PreScreen.Update() If _loading = False Then - If _fadeIn < 1.0F Then - _fadeIn = MathHelper.Lerp(1.0F, _fadeIn, 0.93F) - If _fadeIn + 0.01F >= 1.0F Then - _fadeIn = 1.0F - _sliderPosition = _sliderTarget + 'Shift the main menu vertically + Select Case _menuIndex + Case 0 + _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 Controls.Accept(True, False, False) Then - ' Click on profiles. - For x = 0 To _profiles.Count - 1 - Dim xOffset As Single = _screenOffset.X + x * 180 + ((x + 1) * 100 * (1 - _fadeIn)) - - If New Rectangle(CInt(xOffset), CInt(_screenOffset.Y), 160, 160).Contains(MouseHandler.MousePosition) Then - If _selectedProfile = x Then - ClickedProfile() - SoundManager.PlaySound("select") - Else - Dim diff As Integer = x - _selectedProfile - _screenOffsetTarget.X -= diff * 180 - - _selectedProfile = x - End If - Exit For - End If - Next - If _profiles(_selectedProfile).IsGameJolt AndAlso _profiles(_selectedProfile).Loaded Then - ' Click on gamejolt buttons - Dim _xOffset As Single = _screenOffset.X + (100 * (1 - _fadeIn)) - Dim r As New Vector2(_xOffset + 400, _screenOffset.Y + 200) - If New Rectangle(CInt(r.X), CInt(r.Y), 32, 32).Contains(MouseHandler.MousePosition) Then - ButtonChangeMale() - ElseIf New Rectangle(CInt(r.X), CInt(r.Y) + 48, 32, 32).Contains(MouseHandler.MousePosition) Then - ButtonChangeFemale() - ElseIf New Rectangle(CInt(r.X), CInt(r.Y) + 48 + 48, 32, 32).Contains(MouseHandler.MousePosition) Then - ButtonResetSave() - End If - End If - End If - If Controls.Dismiss(True, False, False) Then - ' Click on profiles. - For x = 0 To _profiles.Count - 1 - Dim xOffset As Single = _screenOffset.X + x * 180 + ((x + 1) * 100 * (1 - _fadeIn)) - - If New Rectangle(CInt(xOffset), CInt(_screenOffset.Y), 160, 160).Contains(MouseHandler.MousePosition) Then - If _selectedProfile = x Then - SoundManager.PlaySound("select") - DismissProfile() - End If - Exit For - End If - Next - End If - - If Controls.Right(True) And _selectedProfile < _profiles.Count - 1 Then - _selectedProfile += 1 - _screenOffsetTarget.X -= 180 - _yIndex = 0 - End If - If Controls.Left(True) And _selectedProfile > 0 Then - _selectedProfile -= 1 - _screenOffsetTarget.X += 180 - _yIndex = 0 - End If - If _profiles(_selectedProfile).IsGameJolt AndAlso _profiles(_selectedProfile).Loaded Then - If Controls.Down(True, True, False) Then - _yIndex += 1 - End If - If Controls.Up(True, True, False) Then - _yIndex -= 1 - End If - _yIndex = Clamp(_yIndex, 0, 3) - End If - - _selectedProfile = _selectedProfile.Clamp(0, _profiles.Count - 1) - - If _fadeIn = 1.0F Then - If Controls.Accept(False, True, True) Then - Select Case _yIndex - Case 0 - SoundManager.PlaySound("select") - ClickedProfile() - Case 1 - SoundManager.PlaySound("select") - ButtonChangeMale() - Case 2 - SoundManager.PlaySound("select") - ButtonChangeFemale() - Case 3 - SoundManager.PlaySound("select") - ButtonResetSave() - End Select - End If - If Controls.Dismiss(False, True, True) Then - SoundManager.PlaySound("select") - DismissProfile() - _yIndex = 0 - End If - ' Try to load the GameJolt profile once the player has logged in. - _profiles(0).LoadGameJolt() - End If - - If _profiles(_selectedProfile).Loaded = False Then - _closingDisplay = True - Else - _closingDisplay = False - End If - - _sliderTarget = GetSliderTarget(_selectedProfile) - If _sliderPosition < _sliderTarget Then - _sliderPosition = MathHelper.Lerp(_sliderTarget, _sliderPosition, 0.8F) - ElseIf _sliderPosition > _sliderTarget Then - _sliderPosition = MathHelper.Lerp(_sliderTarget, _sliderPosition, 0.8F) - 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 - 'SetScreen(New TransitionScreen(CurrentScreen, Me.PreScreen, Color.White, False)) - SetScreen(New PressStartScreen()) - End If - - If _fadeIn = 1.0F Then - If _closingDisplay Then - If _expandDisplay > 0.0F Then - _expandDisplay = MathHelper.Lerp(0.0F, _expandDisplay, 0.9F) - If _expandDisplay - 0.01F <= 0.0F Then - _expandDisplay = 0.0F - End If - End If - Else - If _expandDisplay < 1.0F Then - _expandDisplay = MathHelper.Lerp(1.0F, _expandDisplay, 0.9F) - If _expandDisplay + 0.01F >= 1.0F Then - _expandDisplay = 1.0F - End If - End If + 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 - UpdateScreenOffset() + 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 + End If + Else + If CurrentScreen.Identification = Identifications.MainMenuScreen Then + If Controls.Accept(True, False, False) Then + ' Click on profiles. + For x = 0 To _MainProfiles.Count - 1 + Dim xOffset As Single = _screenOrigin.X + _screenOffset.X + x * 180 + ((x + 1) * 100 * (1 - _fadeInMain)) + + If New Rectangle(CInt(xOffset), CInt(_screenOrigin.Y + _screenOffset.Y), 160, 160).Contains(MouseHandler.MousePosition) Then + If _selectedProfile = x Then + If CurrentScreen.Identification = Identifications.MainMenuScreen Then + ClickedProfile() + SoundManager.PlaySound("select") + End If + Else + If CurrentScreen.Identification = Identifications.MainMenuScreen Then + Dim diff As Integer = x - _selectedProfile + _screenOffsetTarget.X -= diff * 180 + + _selectedProfile = x + End If + Exit For + End If + End If + Next + If _MainProfiles(_selectedProfile).IsGameJolt AndAlso _MainProfiles(_selectedProfile).Loaded Then + ' Click on gamejolt buttons + Dim xOffset As Single = _screenOrigin.X + _screenOffset.X + (100 * (1 - _fadeInMain)) + 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 + ButtonChangeMale() + ElseIf New Rectangle(CInt(r.X), CInt(r.Y) + 48, 32, 32).Contains(MouseHandler.MousePosition) Then + ButtonChangeFemale() + ElseIf New Rectangle(CInt(r.X), CInt(r.Y) + 48 + 48, 32, 32).Contains(MouseHandler.MousePosition) Then + ButtonResetSave() + End If + End If + End If + If Controls.Dismiss(True, False, False) Then + ' Click on profiles. + For x = 0 To _MainProfiles.Count - 1 + Dim xOffset As Single = _screenOrigin.X + _screenOffset.X + x * 180 + ((x + 1) * 100 * (1 - _fadeInMain)) + + If New Rectangle(CInt(xOffset), CInt(_screenOrigin.Y + _screenOffset.Y), 160, 160).Contains(MouseHandler.MousePosition) Then + If _selectedProfile = x Then + SoundManager.PlaySound("select") + DismissProfile() + End If + Exit For + End If + Next + End If + If CurrentScreen.Identification = Screen.Identifications.MainMenuScreen Then + If Controls.Right(True) And _selectedProfile < _MainProfiles.Count - 1 Then + _selectedProfile += 1 + _screenOffsetTarget.X -= 180 + _GameJoltButtonIndex = 0 + End If + If Controls.Left(True) And _selectedProfile > 0 Then + _selectedProfile -= 1 + _screenOffsetTarget.X += 180 + _GameJoltButtonIndex = 0 + End If + End If + + If _MainProfiles(_selectedProfile).IsGameJolt AndAlso _MainProfiles(_selectedProfile).Loaded Then + If Controls.Down(True, True, False) Then + _GameJoltButtonIndex += 1 + End If + If Controls.Up(True, True, False) Then + _GameJoltButtonIndex -= 1 + End If + _GameJoltButtonIndex = Clamp(_GameJoltButtonIndex, 0, 3) + End If + + _selectedProfile = _selectedProfile.Clamp(0, _MainProfiles.Count - 1) + + If _fadeInMain = 1.0F Then + If Controls.Accept(False, True, True) Then + Select Case _GameJoltButtonIndex + Case 0 + SoundManager.PlaySound("select") + ClickedProfile() + Case 1 + SoundManager.PlaySound("select") + ButtonChangeMale() + Case 2 + SoundManager.PlaySound("select") + ButtonChangeFemale() + Case 3 + SoundManager.PlaySound("select") + ButtonResetSave() + End Select + End If + If Controls.Dismiss(False, True, True) Then + SoundManager.PlaySound("select") + DismissProfile() + _GameJoltButtonIndex = 0 + End If + ' Try to load the GameJolt profile once the player has logged in. + _MainProfiles(0).LoadGameJolt() + End If + + If _MainProfiles(_selectedProfile).Loaded = False Then + _closingDisplay = True + Else + _closingDisplay = False + End If + + _sliderTarget = GetSliderTarget(_selectedProfile) + If _sliderPosition < _sliderTarget Then + _sliderPosition = MathHelper.Lerp(_sliderTarget, _sliderPosition, 0.8F) + ElseIf _sliderPosition > _sliderTarget Then + _sliderPosition = MathHelper.Lerp(_sliderTarget, _sliderPosition, 0.8F) + 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 + Select Case _menuIndex + Case 0 + 'SetScreen(New TransitionScreen(CurrentScreen, Me.PreScreen, Color.White, False)) + If CurrentScreen.Identification = Identifications.MainMenuScreen Then + SetScreen(New PressStartScreen()) + End If + Case 1, 2 + _menuIndex = 0 + Case 3 + _menuIndex = 1 + End Select + End If + If _fadeInMain = 1.0F Then + If _closingDisplay Then + If _expandDisplay > 0.0F Then + _expandDisplay = MathHelper.Lerp(0.0F, _expandDisplay, 0.9F) + If _expandDisplay - 0.01F <= 0.0F Then + _expandDisplay = 0.0F + End If + End If + Else + If _expandDisplay < 1.0F Then + _expandDisplay = MathHelper.Lerp(1.0F, _expandDisplay, 0.9F) + If _expandDisplay + 0.01F >= 1.0F Then + _expandDisplay = 1.0F + End If + End If + End If + End If + End If + UpdateScreenOffset() + End If End If End Sub @@ -443,7 +488,7 @@ Public Class NewMainMenuScreen GameJoltSave.Gender = "0" 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 Private Sub ButtonChangeFemale() If GameJoltSave.Gender = "1" Then @@ -452,28 +497,29 @@ Public Class NewMainMenuScreen GameJoltSave.Gender = "1" 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 Private Sub ButtonResetSave() GameJoltSave.ResetSave() - _profiles(_selectedProfile).Sprite = GameJolt.Emblem.GetPlayerSprite(GameJolt.Emblem.GetPlayerLevel(GameJoltSave.Points), GameJoltSave.GameJoltID, GameJoltSave.Gender) - _profiles(_selectedProfile).SetToDefault() + _MainProfiles(_selectedProfile).Sprite = GameJolt.Emblem.GetPlayerSprite(GameJolt.Emblem.GetPlayerLevel(GameJoltSave.Points), GameJoltSave.GameJoltID, GameJoltSave.Gender) + _MainProfiles(_selectedProfile).SetToDefault() End Sub 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.") Else - _profiles(_selectedProfile).SelectProfile() + _MainProfiles(_selectedProfile).SelectProfile() End If End Sub Private Sub DismissProfile() - _profiles(_selectedProfile).UnSelectProfile() + _MainProfiles(_selectedProfile).UnSelectProfile() End Sub Private Sub UpdateScreenOffset() + _screenOrigin = New Vector2(CSng(ScreenSize.Width / 2 - 80 - 180), CSng(ScreenSize.Height / 2 - 80)) If _screenOffset.X > _screenOffsetTarget.X Then _screenOffset.X = MathHelper.Lerp(_screenOffsetTarget.X, _screenOffset.X, 0.93F) If _screenOffset.X - 0.01F <= _screenOffsetTarget.X Then @@ -504,20 +550,42 @@ Public Class NewMainMenuScreen PreScreen.Draw() If _loading = False Then - If _selectedProfile = 0 Then - DrawGradients(CInt(255 * _fadeIn), True) + Select Case _menuIndex + Case 0 + If _MainProfiles(_selectedProfile).IsGameJolt = True Then + DrawGradients(CInt(255 * _fadeInMain), True) + Else + 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 * _fadeIn), False) + DrawGradients(CInt(255 * _fadeInMain), False) End If End If If IsCurrentScreen() Then If _loading Then - Dim textSize As Vector2 = FontManager.GameJoltFont.MeasureString("Please wait..") - GetFontRenderer().DrawString(FontManager.GameJoltFont, "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) + Dim textSize As Vector2 = FontManager.InGameFont.MeasureString("Please wait..") + 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) Else - DrawProfiles() + DrawMainProfiles() + Select Case _menuIndex + Case 2 + DrawOptionProfiles(False) + Case 3 + DrawOptionProfiles(True) + End Select End If End If End Sub @@ -531,46 +599,58 @@ Public Class NewMainMenuScreen fontColor = Color.Black 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 - 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 SpriteBatch.DrawInterface(_oldMenuTexture, New Rectangle(r.X, r.Y, 32, 32), New Rectangle(144, 32 + y, 16, 16), Color.White) 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 - 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 SpriteBatch.DrawInterface(_oldMenuTexture, New Rectangle(r.X, r.Y + 48, 32, 32), New Rectangle(160, 32 + y, 16, 16), Color.White) 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 - 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 SpriteBatch.DrawInterface(_oldMenuTexture, New Rectangle(r.X, r.Y + 48 + 48, 32, 32), New Rectangle(176, 32 + y, 16, 16), Color.White) End Sub - Private Sub DrawProfiles() - ' Draw profiles. - For x = 0 To _profiles.Count - 1 - Dim xOffset As Single = _screenOffset.X + x * 180 + ((x + 1) * 100 * (1 - _fadeIn)) + Private Sub DrawMainProfiles() + Dim MoveOffset As Single = 0 + If _menuIndex = 0 Then + 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) - If _profiles(x).IsGameJolt AndAlso _profiles(x).Loaded AndAlso (x = _selectedProfile) Then - DrawGameJoltButtons(New Vector2(xOffset, _screenOffset.Y)) + Dim xmain As Boolean = x = _selectedProfile + If _menuIndex <> 0 Then + 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 Next - If _fadeIn = 1.0F Then + If _fadeInMain = 1.0F And _menuIndex = 0 Then ' Draw arrow. - SpriteBatch.Draw(_menuTexture, New Rectangle(CInt(_sliderPosition - 16), CInt(_screenOffset.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)) + 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) + 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. If _expandDisplay > 0F Then @@ -579,16 +659,15 @@ Public Class NewMainMenuScreen End If ' 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 distance As Integer = CInt(Math.Abs(_sliderTarget - _sliderPosition)) Dim dist As Double = distance / maxDistance - If _selectedProfile = 0 Then + If _selectedProfile = 1 Then dist = 1 - dist 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 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))) @@ -596,55 +675,76 @@ Public Class NewMainMenuScreen End If ' Draw profile info. - Dim tmpProfile = _profiles(_selectedProfile) + Dim tmpProfile = _MainProfiles(_selectedProfile) If _expandDisplay = 1.0F Then If tmpProfile.GameModeExists Then 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) Next - GetFontRenderer().DrawString(FontManager.GameJoltFont, "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) - GetFontRenderer().DrawString(FontManager.GameJoltFont, "Badges: " & tmpProfile.Badges.ToString() & 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) + 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, 1.0F, SpriteEffects.None, 0F) + GetFontRenderer().DrawString(FontManager.InGameFont, "Badges: " & tmpProfile.Badges.ToString() & Environment.NewLine & + "Play time: " & tmpProfile.TimePlayed & Environment.NewLine & + "Location: " & tmpProfile.Location, New Vector2(displayRect.X + 30, displayRect.Y + 150), Color.White, 0F, Vector2.Zero, 1.0F, SpriteEffects.None, 0F) Else - GetFontRenderer().DrawString(FontManager.GameJoltFont, "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) + 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, 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) Dim errorText As String = "" If tmpProfile.IsGameJolt() Then errorText = "Download failed. Press Accept to try again." & Environment.NewLine & Environment.NewLine & - "If the problem persists, please try again later" & Environment.NewLine & - "or contact us in our Discord server:" & Environment.NewLine & Environment.NewLine & - "http://www.discord.me/p3d" + "If the problem persists, please try again later" & Environment.NewLine & + "or contact us in our Discord server:" & Environment.NewLine & Environment.NewLine & + "http://www.discord.me/p3d" Else errorText = "The required GameMode does not exist!" 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 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 Return CInt(_screenOffset.X + index * 180 + 80) End Function Public Overrides Sub ChangeTo() - If _profiles.Count = 0 Then - 'Dim t As New Threading.Thread(AddressOf LoadProfiles) + If _MainProfiles.Count = 0 Then + 'Dim t As New Threading.Thread(AddressOf LoadMainProfiles) 't.IsBackground = True 't.Start() - LoadProfiles() + LoadMainProfiles() + End If + If _OptionProfiles.Count = 0 Then + LoadOptionProfiles() End If End Sub - Private Sub LoadProfiles() - _profiles.Add(New GameProfile("", False)) + Private Sub LoadMainProfiles() + _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"} For Each path As String In IO.Directory.GetDirectories(GameController.GamePath & "\Save\") @@ -658,16 +758,22 @@ Public Class NewMainMenuScreen Next If exists = True Then - _profiles.Add(New GameProfile(path, False)) + _MainProfiles.Add(New GameProfile(path, False, False)) End If Next GameModeManager.SetGameModePointer("Kolben") - _profiles.Add(New GameProfile("", True)) + _MainProfiles.Add(New GameProfile("", True, False)) _loading = False 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 @@ -675,9 +781,10 @@ Public Class NewMainMenuScreen Private _loaded As Boolean = False Private _isLoading As Boolean = False Private _failedGameJoltLoading As Boolean = False - + Public _OptionsMenuIndex As Integer = -1 Private _path As String = "" Private _isNewGameButton As Boolean = False + Private _IsOptionsMenuButton As Boolean = False Private _name As String = "" Private _gameMode As String @@ -693,7 +800,7 @@ Public Class NewMainMenuScreen Private _surfing As Boolean = False Private _tempSurfSkin As String = "" - Private _fontSize As Single = 0.75F + Private _fontSize As Single = 1.0F Private _spriteIndex As Integer = 0 Private _spriteDelay As Single = 1.5F Private _logoBounce As Single = 0F @@ -713,6 +820,17 @@ Public Class NewMainMenuScreen Return _isGameJolt End Get 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 Get @@ -793,24 +911,43 @@ Public Class NewMainMenuScreen _badges = 0 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 _isNewGameButton = True _fontSize = 1.0F + ElseIf IsOptionsMenuButton Then + _IsOptionsMenuButton = True + _fontSize = 1.0F + _sprite = TextureManager.GetTexture("Textures\UI\OptionsMenu") Else - If path = "" Then - _isGameJolt = True - _loaded = False - _sprite = TextureManager.GetTexture("Textures\UI\GameJolt\gameJoltIcon") - - LoadGameJolt() + 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 - _path = path + If path = "" Then + _isGameJolt = True + _loaded = False + _sprite = TextureManager.GetTexture("Textures\UI\GameJolt\gameJoltIcon") - LoadFromPlayerData(IO.File.ReadAllText(path & "\Player.dat")) - LoadContent(IO.File.ReadAllText(path & "\Party.dat")) + LoadGameJolt() + Else + _path = path - _loaded = True + LoadFromPlayerData(IO.File.ReadAllText(path & "\Player.dat")) + LoadContent(IO.File.ReadAllText(path & "\Party.dat")) + + _loaded = True + End If End If End If End Sub @@ -852,7 +989,7 @@ Public Class NewMainMenuScreen Case "name" _name = content - While FontManager.GameJoltFont.MeasureString(_name).X * _fontSize > 140 + While FontManager.InGameFont.MeasureString(_name).X * _fontSize > 140 _fontSize -= 0.01F End While Case "badges" @@ -908,17 +1045,63 @@ Public Class NewMainMenuScreen Next Canvas.DrawRectangle(New Rectangle(CInt(offset.X), CInt(offset.Y), 160, 3), Screens.UI.ColorProvider.AccentColor(False, alpha)) End If - If _isNewGameButton Then Dim text As String = "New" & Environment.NewLine & "Game" 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, - offset.Y + 80 - (FontManager.GameJoltFont.MeasureString(text).Y) / 2), New Color(255, 255, 255, alpha)) + FontRenderer.DrawString(FontManager.InGameFont, text, New Vector2(CInt(offset.X + 80 - (FontManager.InGameFont.MeasureString(text).X) / 2), + CInt(offset.Y + 80 - (FontManager.InGameFont.MeasureString(text).Y) / 2)), New Color(255, 255, 255, alpha)) Else - SpriteBatch.DrawString(FontManager.GameJoltFont, text, New Vector2(offset.X + 80 - (FontManager.GameJoltFont.MeasureString(text).X) / 2, - offset.Y + 80 - (FontManager.GameJoltFont.MeasureString(text).Y) / 2), New Color(255, 255, 255, alpha)) + SpriteBatch.DrawString(FontManager.InGameFont, text, New Vector2(CInt(offset.X + 80 - (FontManager.InGameFont.MeasureString(text).X) / 2), + CInt(offset.Y + 80 - (FontManager.InGameFont.MeasureString(text).Y) / 2)), New Color(255, 255, 255, alpha)) 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 If _loaded Then Dim frameSize As Size = New Size(CInt(_sprite.Width / 3), CInt(_sprite.Height / 4)) @@ -938,31 +1121,32 @@ 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)) 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 - 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 Else - If isSelected Then - _logoBounce += 0.2F - Else - _logoBounce = 0F + If _menuIndex = 0 Then + If isSelected Then + _logoBounce += 0.2F + Else + _logoBounce = 0F + End If End If - Dim text As String = "Log in" - If _isLoading Then - text = "Loading..." - End If + If _isLoading Then + text = "Loading..." + End If - 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 - 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) - 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) + 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 * _fontSize) / 2), CInt(offset.Y + 120)), New Color(255, 255, 255, alpha), 0F, Vector2.Zero, New Vector2(_fontSize), SpriteEffects.None, 0F) + Else + 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 Sub Public Sub LoadGameJolt() @@ -1002,13 +1186,15 @@ Public Class NewMainMenuScreen _isLoading = False _pokemonTextures.Clear() _sprite = TextureManager.GetTexture("Textures\UI\GameJolt\gameJoltIcon") - _fontSize = 0.75F + _fontSize = 1.0F GameJolt.API.LoggedIn = False End If End Sub 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 If GameModeManager.GameModeCount = 1 Then ' There's only the default GameMode available, so just load that one. @@ -1019,39 +1205,36 @@ Public Class NewMainMenuScreen SetScreen(New GameModeSelectionScreen(CurrentScreen)) End If Else - If _isGameJolt And _loaded = False And GameJolt.API.LoggedIn = False Then - SetScreen(New GameJolt.LogInScreen(CurrentScreen)) - Else - If _gameModeExists Then - GameModeManager.SetGameModePointer(_gameMode) + If _gameModeExists Then + GameModeManager.SetGameModePointer(_gameMode) + World.IsMainMenu = False + If _isGameJolt Then + Core.Player.IsGameJoltSave = True + Core.Player.LoadGame("GAMEJOLTSAVE") + GameJolt.Emblem.GetAchievedEmblems() - World.IsMainMenu = False - - If _isGameJolt Then - Core.Player.IsGameJoltSave = True - Core.Player.LoadGame("GAMEJOLTSAVE") - GameJolt.Emblem.GetAchievedEmblems() - - SetScreen(New JoinServerScreen(CurrentScreen)) - Else - Core.Player.IsGameJoltSave = False - Core.Player.LoadGame(IO.Path.GetFileName(_path)) - - SetScreen(New JoinServerScreen(CurrentScreen)) - End If + SetScreen(New JoinServerScreen(CurrentScreen)) Else - If Me.IsGameJolt Then - _loaded = False - _sprite = TextureManager.GetTexture("Textures\UI\GameJolt\gameJoltIcon") - LoadGameJolt() - Else - 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.") - End If + Core.Player.IsGameJoltSave = False + Core.Player.LoadGame(IO.Path.GetFileName(_path)) + SetScreen(New JoinServerScreen(CurrentScreen)) + End If + Else + If Me.IsGameJolt Then + _loaded = False + _sprite = TextureManager.GetTexture("Textures\UI\GameJolt\gameJoltIcon") + 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.") + Else + _menuIndex = 2 + 'SetScreen(New NewOptionScreen(CurrentScreen)) End If End If End If + End Sub End Class @@ -1072,7 +1255,7 @@ Public Class GameModeSelectionScreen Public Sub New(ByVal currentScreen As Screen) Me.Identification = Identifications.GameModeSelectionScreen - CanBePaused = True + CanBePaused = False CanChat = False CanDrawDebug = True CanGoFullscreen = True @@ -1089,23 +1272,27 @@ Public Class GameModeSelectionScreen 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 For i = 0 To _gameModes.Length - 1 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 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 - 50, y, 50, HEIGHT), color, alphaColor, True, -1) 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 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 End Sub @@ -1119,7 +1306,7 @@ Public Class GameModeSelectionScreen If _index < _gameModes.Length - 1 AndAlso Controls.Down(True, True, True, True, True, True) Then _index += 1 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") SetScreen(PreScreen) End If