2016-09-07 18:50:38 +02:00
|
|
|
|
Public Class SaveScreen
|
|
|
|
|
|
|
|
|
|
Inherits Screen
|
|
|
|
|
|
|
|
|
|
Dim ready As Boolean = False
|
|
|
|
|
Dim delay As Single = 15.0F
|
|
|
|
|
Dim mainTexture As Texture2D
|
|
|
|
|
|
|
|
|
|
Dim savingStarted As Boolean = False
|
|
|
|
|
Dim saveSessionFailed As Boolean = False
|
|
|
|
|
Dim backupFileLocation As String = ""
|
|
|
|
|
|
2017-12-27 00:14:25 +01:00
|
|
|
|
Private Yslide As Integer = 0
|
|
|
|
|
Private YslideMAX As Integer = CInt(Core.windowSize.Height / 2) + 270
|
|
|
|
|
|
|
|
|
|
Dim menuTexture As Texture2D
|
|
|
|
|
Dim _closing As Boolean = False
|
|
|
|
|
Dim _opening As Boolean = True
|
|
|
|
|
|
2016-09-07 18:50:38 +02:00
|
|
|
|
Public Sub New(ByVal currentScreen As Screen)
|
2017-12-27 00:14:25 +01:00
|
|
|
|
Yslide = YslideMAX
|
|
|
|
|
|
2016-09-07 18:50:38 +02:00
|
|
|
|
Me.Identification = Identifications.SaveScreen
|
|
|
|
|
Me.PreScreen = currentScreen
|
|
|
|
|
|
|
|
|
|
Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu")
|
2017-12-27 00:14:25 +01:00
|
|
|
|
Me.menuTexture = TextureManager.GetTexture("GUI\Menus\SaveBook")
|
2016-09-07 18:50:38 +02:00
|
|
|
|
ChooseBox.Show({Localization.GetString("save_screen_yes"), Localization.GetString("save_screen_no")}, 0, {})
|
|
|
|
|
|
|
|
|
|
SaveGameHelpers.ResetSaveCounter()
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Public Overrides Sub Draw()
|
|
|
|
|
Me.PreScreen.Draw()
|
|
|
|
|
|
2017-12-27 00:14:25 +01:00
|
|
|
|
Dim halfWidth As Integer = CInt(Core.windowSize.Width / 2)
|
|
|
|
|
Dim halfHeight As Integer = CInt(Core.windowSize.Height / 2)
|
|
|
|
|
|
|
|
|
|
Dim Delta_X As Integer = halfWidth - 350
|
|
|
|
|
Dim Delta_Y As Integer = halfHeight - 220 + Yslide
|
2016-09-07 18:50:38 +02:00
|
|
|
|
If Core.Player.IsGameJoltSave = True Then
|
|
|
|
|
GameJolt.Emblem.Draw(GameJolt.API.username, Core.GameJoltSave.GameJoltID, Core.GameJoltSave.Points, Core.GameJoltSave.Gender, Core.GameJoltSave.Emblem, New Vector2(CSng(Core.windowSize.Width / 2 - 256), 30), 4, Core.GameJoltSave.DownloadedSprite)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
With Core.SpriteBatch
|
2017-12-27 00:14:25 +01:00
|
|
|
|
.Draw(menuTexture, New Rectangle(Delta_X, Delta_Y, 700, 440), Color.White)
|
|
|
|
|
|
2016-09-07 18:50:38 +02:00
|
|
|
|
If saveSessionFailed = True Then
|
2017-12-27 00:14:25 +01:00
|
|
|
|
.DrawString(FontManager.InGameFont, "Saving failed!", New Vector2(Delta_X + 90, Delta_Y + 50), Color.Red)
|
2017-02-05 17:48:23 +01:00
|
|
|
|
|
2017-07-27 05:47:04 +02:00
|
|
|
|
If Core.GameOptions.Extras.Contains("Backup Save Feature") Then
|
2017-12-27 00:14:25 +01:00
|
|
|
|
.DrawString(FontManager.MiniFont,
|
2018-01-07 18:01:32 +01:00
|
|
|
|
"Press Dismiss to close this" & Environment.NewLine &
|
|
|
|
|
"screen and try to save again" & Environment.NewLine &
|
|
|
|
|
"in order to prevent data" & Environment.NewLine &
|
|
|
|
|
"corruption." & Environment.NewLine & Environment.NewLine & Environment.NewLine &
|
|
|
|
|
"Your save has been backed" & Environment.NewLine &
|
|
|
|
|
"up in the event of the" & Environment.NewLine &
|
2017-12-27 00:14:25 +01:00
|
|
|
|
"Gamejolt API being down.", New Vector2(Delta_X + 90, Delta_Y + 100), Color.Black)
|
|
|
|
|
.DrawString(FontManager.MiniFont,
|
2018-01-07 18:01:32 +01:00
|
|
|
|
"You may safely quit the" & Environment.NewLine &
|
|
|
|
|
"game now or try to save" & Environment.NewLine &
|
|
|
|
|
"again later." & Environment.NewLine & Environment.NewLine & Environment.NewLine &
|
|
|
|
|
"The backup save can be" & Environment.NewLine &
|
|
|
|
|
"found in the Backup Save" & Environment.NewLine &
|
2017-12-27 00:14:25 +01:00
|
|
|
|
"folder", New Vector2(Delta_X + 390, Delta_Y + 100), Color.Black)
|
2017-02-05 17:48:23 +01:00
|
|
|
|
Else
|
2017-09-02 04:05:38 +02:00
|
|
|
|
.DrawString(FontManager.MiniFont,
|
2018-01-07 18:01:32 +01:00
|
|
|
|
"Press Dismiss to close this" & Environment.NewLine &
|
|
|
|
|
"screen and try to save again" & Environment.NewLine &
|
|
|
|
|
"in order to prevent data" & Environment.NewLine &
|
|
|
|
|
"corruption." & Environment.NewLine & Environment.NewLine & Environment.NewLine &
|
|
|
|
|
"If the problem persists, the" & Environment.NewLine &
|
|
|
|
|
"GameJolt servers could be" & Environment.NewLine &
|
|
|
|
|
"down for maintenance right" & Environment.NewLine &
|
2017-12-27 00:14:25 +01:00
|
|
|
|
"now.", New Vector2(Delta_X + 90, Delta_Y + 100), Color.Black)
|
2018-01-07 18:01:32 +01:00
|
|
|
|
.DrawString(FontManager.MiniFont, "Please try again later," & Environment.NewLine &
|
|
|
|
|
"or contact us here:" & Environment.NewLine & Environment.NewLine &
|
|
|
|
|
"Discord server" & Environment.NewLine &
|
|
|
|
|
"www.discord.me/p3d" & Environment.NewLine & Environment.NewLine &
|
|
|
|
|
"Official Forum" & Environment.NewLine &
|
2017-12-27 00:14:25 +01:00
|
|
|
|
"pokemon3d.net/forum/news", New Vector2(Delta_X + 390, Delta_Y + 100), Color.Black)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim text As String = String.Empty
|
|
|
|
|
If ControllerHandler.IsConnected() Then
|
|
|
|
|
text = "Press to continue"
|
|
|
|
|
Else
|
|
|
|
|
text = "Press " & KeyBindings.BackKey1.ToString() & " to continue"
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim textSize As Vector2 = FontManager.GameJoltFont.MeasureString(text)
|
|
|
|
|
|
|
|
|
|
GetFontRenderer().DrawString(FontManager.MiniFont, text, New Vector2(Delta_X + 610 - textSize.X / 2.0F,
|
|
|
|
|
Delta_Y + 350 - textSize.Y / 2.0F), Color.DarkBlue)
|
|
|
|
|
|
|
|
|
|
If ControllerHandler.IsConnected() Then
|
|
|
|
|
SpriteBatch.Draw(TextureManager.GetTexture("GUI\GamePad\xboxControllerButtonB"), New Rectangle(CInt(Delta_X + 610 - textSize.X / 2 + FontManager.MiniFont.MeasureString("Press ").X),
|
|
|
|
|
CInt(Delta_Y + 350 - textSize.Y / 2), 20, 20), Color.White)
|
2017-02-05 17:48:23 +01:00
|
|
|
|
End If
|
2017-12-27 00:14:25 +01:00
|
|
|
|
|
2016-09-07 18:50:38 +02:00
|
|
|
|
Else
|
|
|
|
|
If ready = True Then
|
2017-12-27 00:14:25 +01:00
|
|
|
|
.DrawString(FontManager.InGameFont, "Saved the game.", New Vector2(Delta_X + 90, Delta_Y + 50), Color.DarkBlue)
|
2016-09-07 18:50:38 +02:00
|
|
|
|
Else
|
|
|
|
|
If SaveGameHelpers.GameJoltSaveDone() = False And savingStarted = True Then
|
|
|
|
|
If SaveGameHelpers.StartedDownloadCheck = True Then
|
2017-12-27 00:14:25 +01:00
|
|
|
|
.DrawString(FontManager.InGameFont, "Validating data" & LoadingDots.Dots, New Vector2(Delta_X + 90, Delta_Y + 50), Color.Black)
|
2016-09-07 18:50:38 +02:00
|
|
|
|
Else
|
2017-12-27 00:14:25 +01:00
|
|
|
|
.DrawString(FontManager.InGameFont, "Saving, please wait" & LoadingDots.Dots, New Vector2(Delta_X + 77, Delta_Y + 50), Color.Black)
|
2016-09-07 18:50:38 +02:00
|
|
|
|
End If
|
|
|
|
|
Else
|
2017-12-27 00:14:25 +01:00
|
|
|
|
.DrawString(FontManager.InGameFont, "Would you like to", New Vector2(Delta_X + 90, Delta_Y + 50), Color.Black)
|
|
|
|
|
.DrawString(FontManager.InGameFont, "save the game?", New Vector2(Delta_X + 90, Delta_Y + 80), Color.Black)
|
2016-09-07 18:50:38 +02:00
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
For i = 0 To Core.Player.Pokemons.Count - 1
|
2022-04-16 20:17:09 +02:00
|
|
|
|
Dim Pos As New Vector2(Delta_X + 390 + (i Mod 3) * 80, Delta_Y + 50 + CInt(Math.Floor(i / 3)) * 80)
|
2018-05-03 04:58:10 +02:00
|
|
|
|
Dim pokeTexture = Core.Player.Pokemons(i).GetMenuTexture()
|
2022-04-16 20:17:09 +02:00
|
|
|
|
.Draw(pokeTexture, New Rectangle(CInt(Pos.X), CInt(Pos.Y), 64, 64), Color.White)
|
2016-09-07 18:50:38 +02:00
|
|
|
|
|
|
|
|
|
If Not Core.Player.Pokemons(i).Item Is Nothing And Core.Player.Pokemons(i).IsEgg() = False Then
|
2017-12-27 00:14:25 +01:00
|
|
|
|
.Draw(Core.Player.Pokemons(i).Item.Texture, New Rectangle(CInt(Pos.X) + 36, CInt(Pos.Y) + 36, 32, 32), Color.White)
|
2016-09-07 18:50:38 +02:00
|
|
|
|
End If
|
|
|
|
|
Next
|
|
|
|
|
|
2022-04-16 20:17:09 +02:00
|
|
|
|
.DrawString(FontManager.MainFont, Localization.GetString("save_screen_name") & ": " & Core.Player.Name & Environment.NewLine & Environment.NewLine & Localization.GetString("save_screen_badges") & ": " & Core.Player.Badges.Count.ToString() & Environment.NewLine & Environment.NewLine & Localization.GetString("save_screen_money") & ": " & Core.Player.Money & Environment.NewLine & Environment.NewLine & Localization.GetString("save_screen_time") & ": " & TimeHelpers.GetDisplayTime(TimeHelpers.GetCurrentPlayTime(), True), New Vector2(Delta_X + 400, Delta_Y + 215), Color.DarkBlue)
|
2016-09-07 18:50:38 +02:00
|
|
|
|
End If
|
|
|
|
|
End With
|
2017-12-27 00:14:25 +01:00
|
|
|
|
Screen.ChooseBox.Draw(New Vector2(Delta_X + 115, Delta_Y + 155), False, 1.5F)
|
2016-09-07 18:50:38 +02:00
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Public Overrides Sub Update()
|
|
|
|
|
Screen.ChooseBox.Update()
|
|
|
|
|
|
2017-12-27 00:14:25 +01:00
|
|
|
|
If _opening Then
|
|
|
|
|
If Yslide < 5 Then
|
|
|
|
|
Yslide = 0
|
|
|
|
|
_opening = False
|
|
|
|
|
Else
|
|
|
|
|
Yslide = CInt(MathHelper.Lerp(Yslide, 0, 0.1F))
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Exit Sub
|
|
|
|
|
ElseIf _closing Then
|
|
|
|
|
If Yslide < CInt(YslideMAX * 0.91) Then
|
|
|
|
|
Yslide = CInt(MathHelper.Lerp(Yslide, YslideMAX, 0.1F))
|
|
|
|
|
Else
|
|
|
|
|
_closing = False
|
|
|
|
|
Core.SetScreen(Me.PreScreen)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
2016-09-07 18:50:38 +02:00
|
|
|
|
If Core.Player.IsGameJoltSave = True Then
|
|
|
|
|
If SaveGameHelpers.GameJoltSaveDone() = True Then
|
|
|
|
|
ready = True
|
|
|
|
|
|
|
|
|
|
If SaveGameHelpers.EncounteredErrors = True Then
|
|
|
|
|
Me.saveSessionFailed = True
|
|
|
|
|
Else
|
2017-01-07 19:09:16 +01:00
|
|
|
|
If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID.ToString() & "\Encrypted\Encrypted.dat")) Then
|
|
|
|
|
File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID.ToString() & "\Encrypted\Encrypted.dat")
|
|
|
|
|
End If
|
2016-09-07 18:50:38 +02:00
|
|
|
|
SoundManager.PlaySound("save")
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
SaveGameHelpers.ResetSaveCounter()
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If saveSessionFailed = False Then
|
|
|
|
|
If ChooseBox.Showing = False Then
|
|
|
|
|
If ready = True Then
|
|
|
|
|
If Me.delay <= 0.0F Then
|
2017-12-27 00:14:25 +01:00
|
|
|
|
_closing = True
|
|
|
|
|
'Core.SetScreen(Me.PreScreen)
|
2016-09-07 18:50:38 +02:00
|
|
|
|
Else
|
|
|
|
|
Me.delay -= 0.2F
|
|
|
|
|
If delay <= 0.0F Then
|
|
|
|
|
delay = 0.0F
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If ChooseBox.readyForResult = True And savingStarted = False Then
|
|
|
|
|
If ChooseBox.result = 0 Then
|
|
|
|
|
If ready = False Then
|
|
|
|
|
Core.Player.SaveGame(False)
|
|
|
|
|
|
|
|
|
|
savingStarted = True
|
|
|
|
|
|
|
|
|
|
If Core.Player.IsGameJoltSave = False Then
|
|
|
|
|
ready = True
|
|
|
|
|
SoundManager.PlaySound("save")
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
Else
|
|
|
|
|
delay = 0.0F
|
|
|
|
|
ready = True
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Controls.Dismiss() And ready = False Then
|
Fix audio engine & contentpacks (#35)
* Replaced existing Gen 2 SFX with better sounding ones (no ugly reverb)
Replaced MediaPlayer with NAudio(and NAudio.Vorbis) for playing music in order to fix random stopping issues.
The game now directly loads .ogg files instead of the .wma/.xnb combination from before.
ContentPacks are now able to replace Music and SFX again (I haven't added a menu yet for choosing ContentPacks).
To make older GameModes work with current versions, you can add the GameMode property EnterType and set it to "1", this will make the game use the older 2D NewGameScreen.
* Delete GameController.vb
* Add gamecontroller.vb back
* Fix sfx missing
* Battleintro doodle now doesn't loop anymore (for no trainer)
Changed the shutter sound (aka Large Door sound) to something more large door-y
Made the enter sound slightly louder
The enter sound now plays when going through any warp to or from an indoor map (including falling through holes)
The flying sound effect is played earlier in the animation after selecting a location
Changed played sound effect when using the Escape Rope to "teleport" instead of "destroy"
The bump noise now also plays when bumping into something in first person
Fixed small gap between the end of the intro song and the start of the main song
Replaced some songs with better songs
* Fixed some more intro issues
* Forgot to change a thing
* Fixed an error where the main music would play, ignoring the muted musicmanager.
* fix indenting in musicmanager
* The music player will now only start playback on a new song if the music player is not muted, fixed the end time calculation of the intro of a song after muting, Music can't be unmuted now as long as a sound effect plays that stops the music.
* Fixed league restplace position, fixed sound effects sharing the volume slider of the music, sound effects are now also muted when pressing M, changed music on/off popup to audio on/off, removed bump delay in first person, added more control on whether played songs should be looping or not.
* Fixed some more scripts that turn on thirdperson mode but don't check if it was on before or set it back to what it was before afterwards, also fixed a small error in creditsscreen.vb.
* Fixed indenting error in musicmanager.vb, fixed an error of mine where the loopsong parameter would be seen as the playintro parameter.
* Added more music commands, added quite some menu select noises, will add more later
* More select sound effects!
* Fix music not resuming after soundeffect
* Trainer using item now plays the single_heal soundeffect
* Pokémon cries now sound louder
* Possibly fixing crash when playing Pokémon cry at volume higher than 0.71
* Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720.
* Sound effects now sound louder
* Revert "Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720."
This reverts commit 8c9296ed1a82144d17f303a52c3f2e9e65a5bfea.
* Fixed the cause of why the title screen music plays even when the game is muted
* Tabs to spaces
* Revert
Co-authored-by: darkfire006 <blazer257@live.com>
Co-authored-by: JappaWakkaP3D <66885565+JappaWakkaP3D@users.noreply.github.com>
Co-authored-by: JappaWakkaP3D <jasper.speelman@outlook.com>
Co-authored-by: Vitaly Mikhailov <personal@aragas.org>
2020-07-09 19:59:42 +02:00
|
|
|
|
SoundManager.PlaySound("select")
|
2016-09-07 18:50:38 +02:00
|
|
|
|
ChooseBox.Showing = False
|
2017-12-27 00:14:25 +01:00
|
|
|
|
_closing = True
|
|
|
|
|
'Core.SetScreen(Me.PreScreen)
|
2016-09-07 18:50:38 +02:00
|
|
|
|
End If
|
|
|
|
|
Else
|
|
|
|
|
If Controls.Dismiss() = True Then
|
Fix audio engine & contentpacks (#35)
* Replaced existing Gen 2 SFX with better sounding ones (no ugly reverb)
Replaced MediaPlayer with NAudio(and NAudio.Vorbis) for playing music in order to fix random stopping issues.
The game now directly loads .ogg files instead of the .wma/.xnb combination from before.
ContentPacks are now able to replace Music and SFX again (I haven't added a menu yet for choosing ContentPacks).
To make older GameModes work with current versions, you can add the GameMode property EnterType and set it to "1", this will make the game use the older 2D NewGameScreen.
* Delete GameController.vb
* Add gamecontroller.vb back
* Fix sfx missing
* Battleintro doodle now doesn't loop anymore (for no trainer)
Changed the shutter sound (aka Large Door sound) to something more large door-y
Made the enter sound slightly louder
The enter sound now plays when going through any warp to or from an indoor map (including falling through holes)
The flying sound effect is played earlier in the animation after selecting a location
Changed played sound effect when using the Escape Rope to "teleport" instead of "destroy"
The bump noise now also plays when bumping into something in first person
Fixed small gap between the end of the intro song and the start of the main song
Replaced some songs with better songs
* Fixed some more intro issues
* Forgot to change a thing
* Fixed an error where the main music would play, ignoring the muted musicmanager.
* fix indenting in musicmanager
* The music player will now only start playback on a new song if the music player is not muted, fixed the end time calculation of the intro of a song after muting, Music can't be unmuted now as long as a sound effect plays that stops the music.
* Fixed league restplace position, fixed sound effects sharing the volume slider of the music, sound effects are now also muted when pressing M, changed music on/off popup to audio on/off, removed bump delay in first person, added more control on whether played songs should be looping or not.
* Fixed some more scripts that turn on thirdperson mode but don't check if it was on before or set it back to what it was before afterwards, also fixed a small error in creditsscreen.vb.
* Fixed indenting error in musicmanager.vb, fixed an error of mine where the loopsong parameter would be seen as the playintro parameter.
* Added more music commands, added quite some menu select noises, will add more later
* More select sound effects!
* Fix music not resuming after soundeffect
* Trainer using item now plays the single_heal soundeffect
* Pokémon cries now sound louder
* Possibly fixing crash when playing Pokémon cry at volume higher than 0.71
* Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720.
* Sound effects now sound louder
* Revert "Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720."
This reverts commit 8c9296ed1a82144d17f303a52c3f2e9e65a5bfea.
* Fixed the cause of why the title screen music plays even when the game is muted
* Tabs to spaces
* Revert
Co-authored-by: darkfire006 <blazer257@live.com>
Co-authored-by: JappaWakkaP3D <66885565+JappaWakkaP3D@users.noreply.github.com>
Co-authored-by: JappaWakkaP3D <jasper.speelman@outlook.com>
Co-authored-by: Vitaly Mikhailov <personal@aragas.org>
2020-07-09 19:59:42 +02:00
|
|
|
|
SoundManager.PlaySound("select")
|
2016-09-07 18:50:38 +02:00
|
|
|
|
ChooseBox.Showing = False
|
2017-12-27 00:14:25 +01:00
|
|
|
|
_closing = True
|
|
|
|
|
'Core.SetScreen(Me.PreScreen)
|
2016-09-07 18:50:38 +02:00
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
End Class
|