From 144e7750c5866466d6404ce082d3b8b01f4a0a6a Mon Sep 17 00:00:00 2001 From: CaptainSegis Date: Tue, 31 Jan 2017 07:33:29 -0500 Subject: [PATCH] Partially implemented PartyScreen and SummaryScreen menus. "Give item" option not working yet. No JSON, only english localization. --- .gitignore | 3 +- 2.5DHero/2.5DHero/2.5DHero.vbproj | 19 +- 2.5DHero/2.5DHero/Core/Core.vb | 4 + 2.5DHero/2.5DHero/Core/FileSystem.vb | 26 + 2.5DHero/2.5DHero/Core/GameOptions.vb | 6 +- 2.5DHero/2.5DHero/Core/MainGameFunctions.vb | 8 +- 2.5DHero/2.5DHero/Debug/Logger.vb | 2 +- 2.5DHero/2.5DHero/Dialogues/TextBox.vb | 4 +- .../Classes/LOCAL_InventoryScreen.vb | 155 +++ .../Classes/LOCAL_PartyScreen.vb | 235 +++++ .../2.5DHero/Globalization/Localization.vb | 65 ++ .../Globalization/LocalizationManager.vb | 56 ++ .../2.5DHero/Globalization/Translation.vb | 144 +++ .../{Localization.vb => OldLocalization.vb} | 4 +- 2.5DHero/2.5DHero/Input/UI/ColorProvider.vb | 135 +++ 2.5DHero/2.5DHero/Input/UI/Controls/Button.vb | 97 ++ .../2.5DHero/Input/UI/Controls/Control.vb | 363 +++++++ .../2.5DHero/Input/UI/Controls/ControlList.vb | 94 ++ .../2.5DHero/Input/UI/Controls/Textbox.vb | 398 ++++++++ 2.5DHero/2.5DHero/Input/UI/MessageBox.vb | 95 ++ 2.5DHero/2.5DHero/Input/UI/SelectMenu.vb | 136 +++ .../2.5DHero/Overworld/OverworldCamera.vb | 8 +- 2.5DHero/2.5DHero/Overworld/RouteSign.vb | 2 +- 2.5DHero/2.5DHero/Player/Player.vb | 4 +- 2.5DHero/2.5DHero/Pokemon/Monster/Nature.vb | 19 +- 2.5DHero/2.5DHero/Pokemon/Monster/Pokemon.vb | 8 +- 2.5DHero/2.5DHero/Resources/FontManager.vb | 20 + .../2.5DHero/Resources/Sound/MusicManager.vb | 4 +- .../2.5DHero/Screens/Battle/BlackOutScreen.vb | 2 +- .../2.5DHero/Screens/GUI/DonationScreen.vb | 4 +- .../2.5DHero/Screens/GUI/ISelectionScreen.vb | 33 + .../Screens/Inventory/ApricornScreen.vb | 18 +- .../Screens/Inventory/ChoosePokemonScreen.vb | 2 +- .../Screens/Inventory/InventoryScreen.vb | 6 +- .../Screens/Inventory/ItemDetailScreen.vb | 30 +- .../Screens/MainMenu/MainMenuScreen.vb | 92 +- .../2.5DHero/Screens/MainMenu/PauseScreen.vb | 22 +- 2.5DHero/2.5DHero/Screens/MapScreen.vb | 26 +- 2.5DHero/2.5DHero/Screens/MenuScreen.vb | 30 +- 2.5DHero/2.5DHero/Screens/NewGameScreen.vb | 18 +- 2.5DHero/2.5DHero/Screens/OptionScreen.vb | 2 +- .../2.5DHero/Screens/Pokemon/PartyScreen.vb | 890 ++++++++++++++++++ .../2.5DHero/Screens/Pokemon/PokemonScreen.vb | 121 ++- .../Screens/Pokemon/PokemonStatusScreen.vb | 38 +- .../2.5DHero/Screens/Pokemon/SummaryScreen.vb | 792 ++++++++++++++++ .../Screens/Pokemon/TeachMovesScreen.vb | 2 +- 2.5DHero/2.5DHero/Screens/SaveScreen.vb | 8 +- 2.5DHero/2.5DHero/Screens/Screen.vb | 366 +++---- 2.5DHero/2.5DHero/Screens/TrainerScreen.vb | 14 +- 2.5DHero/2.5DHero/Screens/WindowScreen.vb | 8 +- 2.5DHero/2.5DHeroContent/Content.mgcb | 12 + .../Content/GUI/Menus/PokemonInfo.png | Bin 0 -> 3054 bytes 52 files changed, 4170 insertions(+), 480 deletions(-) create mode 100644 2.5DHero/2.5DHero/Core/FileSystem.vb create mode 100644 2.5DHero/2.5DHero/Globalization/Classes/LOCAL_InventoryScreen.vb create mode 100644 2.5DHero/2.5DHero/Globalization/Classes/LOCAL_PartyScreen.vb create mode 100644 2.5DHero/2.5DHero/Globalization/Localization.vb create mode 100644 2.5DHero/2.5DHero/Globalization/LocalizationManager.vb create mode 100644 2.5DHero/2.5DHero/Globalization/Translation.vb rename 2.5DHero/2.5DHero/HelperClasses/{Localization.vb => OldLocalization.vb} (98%) create mode 100644 2.5DHero/2.5DHero/Input/UI/ColorProvider.vb create mode 100644 2.5DHero/2.5DHero/Input/UI/Controls/Button.vb create mode 100644 2.5DHero/2.5DHero/Input/UI/Controls/Control.vb create mode 100644 2.5DHero/2.5DHero/Input/UI/Controls/ControlList.vb create mode 100644 2.5DHero/2.5DHero/Input/UI/Controls/Textbox.vb create mode 100644 2.5DHero/2.5DHero/Input/UI/MessageBox.vb create mode 100644 2.5DHero/2.5DHero/Input/UI/SelectMenu.vb create mode 100644 2.5DHero/2.5DHero/Screens/GUI/ISelectionScreen.vb create mode 100644 2.5DHero/2.5DHero/Screens/Pokemon/PartyScreen.vb create mode 100644 2.5DHero/2.5DHero/Screens/Pokemon/SummaryScreen.vb create mode 100644 2.5DHero/2.5DHeroContent/Content/GUI/Menus/PokemonInfo.png diff --git a/.gitignore b/.gitignore index fb9f7f891..5bd333d18 100644 --- a/.gitignore +++ b/.gitignore @@ -306,4 +306,5 @@ Temporary Items !2.5DHero/ !2.5DHero/2.5DHero/ !2.5DHero/2.5DHero/Debug/ -!2.5DHero/2.5DHero/Debug/**/* \ No newline at end of file +!2.5DHero/2.5DHero/Debug/**/* +/2.5DHero/2.5DHero/DataModel diff --git a/2.5DHero/2.5DHero/2.5DHero.vbproj b/2.5DHero/2.5DHero/2.5DHero.vbproj index 7f465fd6b..f6b242a87 100644 --- a/2.5DHero/2.5DHero/2.5DHero.vbproj +++ b/2.5DHero/2.5DHero/2.5DHero.vbproj @@ -113,6 +113,7 @@ + @@ -163,12 +164,17 @@ + + + + + - + @@ -179,6 +185,13 @@ + + + + + + + @@ -1603,6 +1616,7 @@ + @@ -1637,9 +1651,11 @@ + + @@ -1717,6 +1733,7 @@ + diff --git a/2.5DHero/2.5DHero/Core/Core.vb b/2.5DHero/2.5DHero/Core/Core.vb index 1f129736b..c7e958b02 100644 --- a/2.5DHero/2.5DHero/Core/Core.vb +++ b/2.5DHero/2.5DHero/Core/Core.vb @@ -1,6 +1,7 @@ Public Module Core Public SpriteBatch As CoreSpriteBatch + Public FontRenderer As SpriteBatch Public GraphicsDevice As GraphicsDevice Public GraphicsManager As GraphicsDeviceManager Public Content As ContentManager @@ -36,6 +37,7 @@ GraphicsDevice = GameInstance.GraphicsDevice Content = GameInstance.Content SpriteBatch = New CoreSpriteBatch(GraphicsDevice) + FontRenderer = New CoreSpriteBatch(GraphicsDevice) window = GameInstance.Window If CommandLineArgHandler.ForceGraphics = True Then @@ -173,6 +175,7 @@ SpriteBatch.EndBatch() Else SpriteBatch.BeginBatch() + FontRenderer.Begin() GraphicsDevice.DepthStencilState = DepthStencilState.Default @@ -202,6 +205,7 @@ Logger.DrawLog() SpriteBatch.EndBatch() + FontRenderer.End() Core.Render() End If diff --git a/2.5DHero/2.5DHero/Core/FileSystem.vb b/2.5DHero/2.5DHero/Core/FileSystem.vb new file mode 100644 index 000000000..198d0c0d4 --- /dev/null +++ b/2.5DHero/2.5DHero/Core/FileSystem.vb @@ -0,0 +1,26 @@ +Namespace GameCore + + ''' + ''' Contains accessors to paths of the game. + ''' + Class FileSystem + + Public Const PATH_GAMEMODES As String = "GameModes" + Public Const PATH_RESOURCES As String = "SharedResources" + Public Const PATH_LOCALIZATION As String = "Localization" + + Public Const PATH_TEXTURES As String = PATH_RESOURCES & "\Textures" + + ''' + ''' The path to the game folder. + ''' + ''' + Public Shared ReadOnly Property GamePath() As String + Get + Return My.Application.Info.DirectoryPath + End Get + End Property + + End Class + +End Namespace diff --git a/2.5DHero/2.5DHero/Core/GameOptions.vb b/2.5DHero/2.5DHero/Core/GameOptions.vb index 805497d29..81e12317a 100644 --- a/2.5DHero/2.5DHero/Core/GameOptions.vb +++ b/2.5DHero/2.5DHero/Core/GameOptions.vb @@ -60,7 +60,7 @@ Me.LoadOffsetMaps = CInt(value) Case "language" LanguageFound = True - Localization.Load(value) + OldLocalization.Load(value) Case "contentpack", "contentpacks" ContentPackManager.CreateContentPackFolder() If value <> "" Then @@ -106,7 +106,7 @@ Next If LanguageFound = False Then - Localization.Load("en") + OldLocalization.Load("en") End If End Sub @@ -134,7 +134,7 @@ "ShowGUI|" & Me.ShowGUI.ToNumberString() & vbNewLine & "GraphicStyle|" & Me.GraphicStyle.ToString() & vbNewLine & "LoadOffsetMaps|" & Me.LoadOffsetMaps.ToString() & vbNewLine & - "Language|" & Localization.LanguageSuffix & vbNewLine & + "Language|" & OldLocalization.LanguageSuffix & vbNewLine & "ViewBobbing|" & Me.ViewBobbing.ToNumberString() & vbNewLine & "GamePadEnabled|" & Me.GamePadEnabled.ToNumberString() & vbNewLine & "LightningEnabled|" & Me.LightingEnabled.ToNumberString() & vbNewLine & diff --git a/2.5DHero/2.5DHero/Core/MainGameFunctions.vb b/2.5DHero/2.5DHero/Core/MainGameFunctions.vb index 75c60edae..a299bc53e 100644 --- a/2.5DHero/2.5DHero/Core/MainGameFunctions.vb +++ b/2.5DHero/2.5DHero/Core/MainGameFunctions.vb @@ -107,10 +107,10 @@ stream.Dispose() End If - Core.GameMessage.SetupText(Localization.GetString("game_message_screenshot") & fileName, FontManager.MainFont, Color.White) + Core.GameMessage.SetupText(OldLocalization.GetString("game_message_screenshot") & fileName, FontManager.MainFont, Color.White) Core.GameMessage.ShowMessage(12, Core.GraphicsDevice) Catch ex As Exception - Logger.Log(Logger.LogTypes.ErrorMessage, "Basic.vb: " & Localization.GetString("game_message_screenshot_failed") & ". More information: " & ex.Message) + Logger.Log(Logger.LogTypes.ErrorMessage, "Basic.vb: " & OldLocalization.GetString("game_message_screenshot_failed") & ". More information: " & ex.Message) End Try End Sub @@ -124,7 +124,7 @@ Core.GraphicsManager.ToggleFullScreen() - Core.GameMessage.ShowMessage(Localization.GetString("game_message_fullscreen_on"), 12, FontManager.MainFont, Color.White) + Core.GameMessage.ShowMessage(OldLocalization.GetString("game_message_fullscreen_on"), 12, FontManager.MainFont, Color.White) Else Core.GraphicsManager.PreferredBackBufferWidth = 1200 Core.GraphicsManager.PreferredBackBufferHeight = 680 @@ -134,7 +134,7 @@ Core.GraphicsManager.ToggleFullScreen() - Core.GameMessage.ShowMessage(Localization.GetString("game_message_fullscreen_off"), 12, FontManager.MainFont, Color.White) + Core.GameMessage.ShowMessage(OldLocalization.GetString("game_message_fullscreen_off"), 12, FontManager.MainFont, Color.White) End If Core.GraphicsManager.ApplyChanges() diff --git a/2.5DHero/2.5DHero/Debug/Logger.vb b/2.5DHero/2.5DHero/Debug/Logger.vb index 3d8c1f4e5..27f647cc2 100644 --- a/2.5DHero/2.5DHero/Debug/Logger.vb +++ b/2.5DHero/2.5DHero/Debug/Logger.vb @@ -171,7 +171,7 @@ Public Class Logger Dim specs As String = "Operating system: " & My.Computer.Info.OSFullName & " [" & My.Computer.Info.OSVersion & "]" & vbNewLine & "Core architecture: " & architectureString & vbNewLine & "System time: " & My.Computer.Clock.LocalTime.ToString() & vbNewLine & - "System language: " & Globalization.CultureInfo.CurrentCulture.EnglishName & "(" & Globalization.CultureInfo.CurrentCulture.ThreeLetterWindowsLanguageName & ") / Loaded game language: " & Localization.LanguageSuffix & vbNewLine & + "System language: " & System.Globalization.CultureInfo.CurrentCulture.EnglishName & "(" & System.Globalization.CultureInfo.CurrentCulture.ThreeLetterWindowsLanguageName & ") / Loaded game language: " & OldLocalization.LanguageSuffix & vbNewLine & "Decimal separator: " & GameController.DecSeparator & vbNewLine & "Available physical memory: " & Math.Round((My.Computer.Info.TotalPhysicalMemory / Math.Pow(1024, 3)), 2).ToString() & " Gigabyte" & vbNewLine & "Available logical processors: " & Environment.ProcessorCount.ToString() diff --git a/2.5DHero/2.5DHero/Dialogues/TextBox.vb b/2.5DHero/2.5DHero/Dialogues/TextBox.vb index 1457a8bb0..230a816de 100644 --- a/2.5DHero/2.5DHero/Dialogues/TextBox.vb +++ b/2.5DHero/2.5DHero/Dialogues/TextBox.vb @@ -107,8 +107,8 @@ tokenEndIdx = possibleToken.IndexOf(">") If Not tokenEndIdx = -1 Then validToken = possibleToken.Substring(0, tokenEndIdx) - If Localization.LocalizationTokens.ContainsKey(validToken) = True Then - If Localization.LocalizationTokens.TryGetValue(validToken, token) = True Then + If OldLocalization.LocalizationTokens.ContainsKey(validToken) = True Then + If OldLocalization.LocalizationTokens.TryGetValue(validToken, token) = True Then Me.Text = Me.Text.Replace("<" & validToken & ">", token.TokenContent) End If End If diff --git a/2.5DHero/2.5DHero/Globalization/Classes/LOCAL_InventoryScreen.vb b/2.5DHero/2.5DHero/Globalization/Classes/LOCAL_InventoryScreen.vb new file mode 100644 index 000000000..9c53b2b95 --- /dev/null +++ b/2.5DHero/2.5DHero/Globalization/Classes/LOCAL_InventoryScreen.vb @@ -0,0 +1,155 @@ +Namespace Globalization.Classes + + ''' + ''' The translation provider class for the inventory UI. + ''' + Public Class LOCAL_InventoryScreen + + Inherits Translation + + Private Const C_INFO_ITEM_OPTION_USE As String = "Use" + Private Const C_INFO_ITEM_OPTION_GIVE As String = "Give" + Private Const C_INFO_ITEM_OPTION_TOSS As String = "Toss" + Private Const C_INFO_ITEM_OPTION_SELECT As String = "Select" + + Private Const C_MESSAGE_GIVE_ITEM As String = "Gave {0} a {1}." + Private Const C_MESSAGE_SWITCH_ITEM As String = "Switched {0}'s {1} with a {2}." + Private Const C_MESSAGE_EGG_ERROR As String = "Eggs cannot hold items." + + Private Const C_TECH_MACHINE_TITLE As String = "Technical Machine" + Private Const C_HIDDEN_MACHINE_TITLE As String = "Hidden Machine" + Private Const C_STANDARD_ITEM_TITLE As String = "{0} Item" + Private Const C_KEYITEM_TITLE As String = "Key Item" + Private Const C_POKEBALL_TITLE As String = "Poké Ball" + Private Const C_PLANT_TITLE As String = "Plant" + Private Const C_BATTLEITEM_TITLE As String = "Battle Item" + + ''' + ''' The title for the technical machine item category. + ''' + Public ReadOnly Property TECH_MACHINE_TITLE(ByVal itemCategory As String) As String + Get + Return GetTranslation(NameOf(C_TECH_MACHINE_TITLE), {itemCategory}) + End Get + End Property + + ''' + ''' The title for hidden machines in the technical item category. + ''' + Public ReadOnly Property HIDDEN_MACHINE_TITLE(ByVal itemCategory As String) As String + Get + Return GetTranslation(NameOf(C_HIDDEN_MACHINE_TITLE), {itemCategory}) + End Get + End Property + + ''' + ''' The title for standard items. + ''' + Public ReadOnly Property STANDARD_ITEM_TITLE(ByVal itemCategory As String) As String + Get + Return GetTranslation(NameOf(C_STANDARD_ITEM_TITLE), {itemCategory}) + End Get + End Property + + ''' + ''' The title for key items. + ''' + Public ReadOnly Property KEYITEM_TITLE(ByVal itemCategory As String) As String + Get + Return GetTranslation(NameOf(C_KEYITEM_TITLE), {itemCategory}) + End Get + End Property + + ''' + ''' The title for Pokéball items. + ''' + Public ReadOnly Property POKEBALL_TITLE(ByVal itemCategory As String) As String + Get + Return GetTranslation(NameOf(C_POKEBALL_TITLE), {itemCategory}) + End Get + End Property + + ''' + ''' The title for plant items. + ''' + Public ReadOnly Property PLANT_TITLE(ByVal itemCategory As String) As String + Get + Return GetTranslation(NameOf(C_PLANT_TITLE), {itemCategory}) + End Get + End Property + + ''' + ''' The title for battle items. + ''' + Public ReadOnly Property BATTLEITEM_TITLE(ByVal itemCategory As String) As String + Get + Return GetTranslation(NameOf(C_BATTLEITEM_TITLE), {itemCategory}) + End Get + End Property + + ''' + ''' Info panel, use option + ''' + Public ReadOnly Property INFO_ITEM_OPTION_USE As String + Get + Return GetTranslation(NameOf(C_INFO_ITEM_OPTION_USE)) + End Get + End Property + + ''' + ''' Info panel, give option + ''' + Public ReadOnly Property INFO_ITEM_OPTION_GIVE As String + Get + Return GetTranslation(NameOf(C_INFO_ITEM_OPTION_GIVE)) + End Get + End Property + + ''' + ''' Info panel, toss option + ''' + Public ReadOnly Property INFO_ITEM_OPTION_TOSS As String + Get + Return GetTranslation(NameOf(C_INFO_ITEM_OPTION_TOSS)) + End Get + End Property + + ''' + ''' Info panel, select option. + ''' + Public ReadOnly Property INFO_ITEM_OPTION_SELECT As String + Get + Return GetTranslation(NameOf(C_INFO_ITEM_OPTION_SELECT)) + End Get + End Property + + ''' + ''' The message displayed when giving an item to a Pokémon. + ''' + Public ReadOnly Property MESSAGE_GIVE_ITEM(ByVal pokemonName As String, ByVal itemName As String) As String + Get + Return GetTranslation(NameOf(C_MESSAGE_GIVE_ITEM), {pokemonName, itemName}) + End Get + End Property + + ''' + ''' The message displayed when switching an item for a Pokémon. + ''' + Public ReadOnly Property MESSAGE_SWITCH_ITEM(ByVal pokemonName As String, ByVal preItemName As String, ByVal itemName As String) As String + Get + Return GetTranslation(NameOf(C_MESSAGE_SWITCH_ITEM), {pokemonName, preItemName, itemName}) + End Get + End Property + + ''' + ''' Message for when giving an item to an egg + ''' + Public ReadOnly Property MESSAGE_EGG_ERROR As String + Get + Return GetTranslation(NameOf(C_MESSAGE_EGG_ERROR)) + End Get + End Property + + End Class + +End Namespace diff --git a/2.5DHero/2.5DHero/Globalization/Classes/LOCAL_PartyScreen.vb b/2.5DHero/2.5DHero/Globalization/Classes/LOCAL_PartyScreen.vb new file mode 100644 index 000000000..533c0cb32 --- /dev/null +++ b/2.5DHero/2.5DHero/Globalization/Classes/LOCAL_PartyScreen.vb @@ -0,0 +1,235 @@ +Namespace Globalization.Classes + + Public Class LOCAL_PartyScreen + + Inherits Translation + + Private Const C_LV_TEXT As String = "Lv. {0}" + + Private Const C_MENU_SUMMARY As String = "Summary" + Private Const C_MENU_SELECT As String = "Select" + Private Const C_MENU_SWITCH As String = "Switch" + Private Const C_MENU_ITEM As String = "Item" + Private Const C_MENU_BACK As String = "Back" + Private Const C_MENU_FIELDMOVE As String = "Field Move" + + Private Const C_MENU_ITEM_GIVE As String = "Give" + Private Const C_MENU_ITEM_TAKE As String = "Take" + + Private Const C_MENU_FIELDMOVE_FLY As String = "Fly" + Private Const C_MENU_FIELDMOVE_RIDE As String = "Ride" + Private Const C_MENU_FIELDMOVE_FLASH As String = "Flash" + Private Const C_MENU_FIELDMOVE_CUT As String = "Cut" + Private Const C_MENU_FIELDMOVE_TELEPORT As String = "Teleport" + Private Const C_MENU_FIELDMOVE_DIG As String = "Dig" + + Private Const C_MESSAGE_FIELDMOVE_ERROR As String = "You cannot use {0} here." + Private Const C_MESSAGE_MAILTAKEN As String = "The Mail was taken to your inbox on your PC." + Private Const C_MESSAGE_ITEMTAKEN As String = "Taken {0} from {1}." + + Private Const C_MESSAGE_SWITCH_ITEM_MAIL As String = "Gave {0} to {1} and took the Mail to the PC." + Private Const C_MESSAGE_SWITCH_ITEM As String = "Switched {0}'s {1} with a {2}." + Private Const C_MESSAGE_GIVE_ITEM As String = "Gave {0} a {1}." + Private Const C_MESSAGE_GIVE_ITEM_ERROR As String = "{0} cannot be given to a Pokémon." + + ''' + ''' The message displayed when giving an item to a Pokémon. + ''' + Public ReadOnly Property MESSAGE_GIVE_ITEM_ERROR(ByVal itemName As String) As String + Get + Return GetTranslation(NameOf(C_MESSAGE_GIVE_ITEM_ERROR), {itemName}) + End Get + End Property + + ''' + ''' The message displayed when giving an item to a Pokémon. + ''' + Public ReadOnly Property MESSAGE_GIVE_ITEM(ByVal pokemonName As String, ByVal itemName As String) As String + Get + Return GetTranslation(NameOf(C_MESSAGE_GIVE_ITEM), {pokemonName, itemName}) + End Get + End Property + + ''' + ''' A message that displays when the player switches the item on a Pokémon. + ''' + Public ReadOnly Property MESSAGE_SWITCH_ITEM(ByVal pokemonName As String, ByVal newItemName As String, ByVal oldItemName As String) As String + Get + Return GetTranslation(NameOf(C_MESSAGE_SWITCH_ITEM), {pokemonName, newItemName, oldItemName}) + End Get + End Property + + ''' + ''' A message that displays when the player switches the mail from a Pokémon with another item. + ''' + Public ReadOnly Property MESSAGE_SWITCH_ITEM_MAIL(ByVal itemName As String, ByVal pokemonName As String) As String + Get + Return GetTranslation(NameOf(C_MESSAGE_SWITCH_ITEM_MAIL), {itemName, pokemonName}) + End Get + End Property + + ''' + ''' A message that displays when the player took mail from a Pokémon. + ''' + Public ReadOnly Property MESSAGE_MAILTAKEN As String + Get + Return GetTranslation(NameOf(C_MESSAGE_MAILTAKEN)) + End Get + End Property + + ''' + ''' A message that displays when the player took an item from a Pokémon. + ''' + Public ReadOnly Property MESSAGE_ITEMTAKEN(ByVal itemName As String, ByVal pokemonName As String) As String + Get + Return GetTranslation(NameOf(C_MESSAGE_ITEMTAKEN), {itemName, pokemonName}) + End Get + End Property + + ''' + ''' A message that displays when the player cannot fly from the current position. + ''' + Public ReadOnly Property MESSAGE_FIELDMOVE_ERROR(ByVal fieldmove As String) As String + Get + Return GetTranslation(NameOf(C_MESSAGE_FIELDMOVE_ERROR), {fieldmove}) + End Get + End Property + + ''' + ''' The level literal. + ''' + Public ReadOnly Property LV_TEXT(ByVal level As String) As String + Get + Return GetTranslation(NameOf(C_LV_TEXT), {level}) + End Get + End Property + + ''' + ''' Menu entry, summary. + ''' + Public ReadOnly Property MENU_SUMMARY As String + Get + Return GetTranslation(NameOf(C_MENU_SUMMARY)) + End Get + End Property + + ''' + ''' Menu entry, select. + ''' + Public ReadOnly Property MENU_SELECT As String + Get + Return GetTranslation(NameOf(C_MENU_SELECT)) + End Get + End Property + + ''' + ''' Menu entry, switch. + ''' + Public ReadOnly Property MENU_SWITCH As String + Get + Return GetTranslation(NameOf(C_MENU_SWITCH)) + End Get + End Property + + ''' + ''' Menu entry, item. + ''' + Public ReadOnly Property MENU_ITEM As String + Get + Return GetTranslation(NameOf(C_MENU_ITEM)) + End Get + End Property + + ''' + ''' Menu entry, back. + ''' + Public ReadOnly Property MENU_BACK As String + Get + Return GetTranslation(NameOf(C_MENU_BACK)) + End Get + End Property + + ''' + ''' Menu entry, field move. + ''' + Public ReadOnly Property MENU_FIELDMOVE As String + Get + Return GetTranslation(NameOf(C_MENU_FIELDMOVE)) + End Get + End Property + + ''' + ''' Menu entry, give. + ''' + Public ReadOnly Property MENU_ITEM_GIVE As String + Get + Return GetTranslation(NameOf(C_MENU_ITEM_GIVE)) + End Get + End Property + + ''' + ''' Menu entry, take. + ''' + Public ReadOnly Property MENU_ITEM_TAKE As String + Get + Return GetTranslation(NameOf(C_MENU_ITEM_TAKE)) + End Get + End Property + + ''' + ''' Menu entry, fly. + ''' + Public ReadOnly Property MENU_FIELDMOVE_FLY As String + Get + Return GetTranslation(NameOf(C_MENU_FIELDMOVE_FLY)) + End Get + End Property + + ''' + ''' Menu entry, ride. + ''' + Public ReadOnly Property MENU_FIELDMOVE_RIDE As String + Get + Return GetTranslation(NameOf(C_MENU_FIELDMOVE_RIDE)) + End Get + End Property + + ''' + ''' Menu entry, flash. + ''' + Public ReadOnly Property MENU_FIELDMOVE_FLASH As String + Get + Return GetTranslation(NameOf(C_MENU_FIELDMOVE_FLASH)) + End Get + End Property + + ''' + ''' Menu entry, cut. + ''' + Public ReadOnly Property MENU_FIELDMOVE_CUT As String + Get + Return GetTranslation(NameOf(C_MENU_FIELDMOVE_CUT)) + End Get + End Property + + ''' + ''' Menu entry, teleport. + ''' + Public ReadOnly Property MENU_FIELDMOVE_TELEPORT As String + Get + Return GetTranslation(NameOf(C_MENU_FIELDMOVE_TELEPORT)) + End Get + End Property + + ''' + ''' Menu entry, dig. + ''' + Public ReadOnly Property MENU_FIELDMOVE_DIG As String + Get + Return GetTranslation(NameOf(C_MENU_FIELDMOVE_DIG)) + End Get + End Property + + End Class + +End Namespace diff --git a/2.5DHero/2.5DHero/Globalization/Localization.vb b/2.5DHero/2.5DHero/Globalization/Localization.vb new file mode 100644 index 000000000..e43d751e4 --- /dev/null +++ b/2.5DHero/2.5DHero/Globalization/Localization.vb @@ -0,0 +1,65 @@ +Imports Pokemon3D.DataModel.Json +Imports Pokemon3D.DataModel.Json.Localization + +Namespace Globalization + + ''' + ''' The content of a localization file. + ''' + Public Class Localization + + Private _lcid As String + + ''' + ''' The language specific LCID. + ''' + Public ReadOnly Property LCID As String + Get + Return _lcid + End Get + End Property + + Private _dictionary As New Dictionary(Of String, String) + + Private _filePath As String = "" + Private _hasLoaded As Boolean = False + + Public Sub New(ByVal filePath As String) + _filePath = filePath + + ' Take the lcid from the file name: + _lcid = IO.Path.GetFileNameWithoutExtension(_filePath) + End Sub + + ''' + ''' Returns the translation of this localization for a token. + ''' + Public Function GetTranslation(ByVal token As String) As String + If Not _hasLoaded Then 'Only load on demand. + Load() + End If + + If _dictionary.Keys.Contains(token) Then + Return _dictionary(token) + Else + Return Nothing + End If + End Function + + Private Sub Load() + + ''DO NOTHING LOL + + ' _hasLoaded = True + + ' Dim fileContent As String = IO.File.ReadAllText(_filePath) + ' Dim dataModel = JsonDataModel.FromString(Of LocalizationModel)(fileContent) + + ' For Each token In dataModel.Tokens + ' _dictionary.Add(token.Id, token.Val) + ' Next + End Sub + + End Class + +End Namespace \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Globalization/LocalizationManager.vb b/2.5DHero/2.5DHero/Globalization/LocalizationManager.vb new file mode 100644 index 000000000..500f23710 --- /dev/null +++ b/2.5DHero/2.5DHero/Globalization/LocalizationManager.vb @@ -0,0 +1,56 @@ +Namespace Globalization + + ''' + ''' A class to manage all localizations available for the game. + ''' They are marked with the LCID of the language. + ''' + ''' + ''' More Information: + ''' https://msdn.microsoft.com/en-us/goglobal/bb964664.aspx + ''' + Public Class LocalizationManager + + ' Private Constructor to prevent instances. + Private Sub New() : End Sub + + Private Const DATA_PATH As String = "Localization" + Private Shared _localList As Dictionary(Of String, Localization) + + Private Shared Sub Initialize() + _localList = New Dictionary(Of String, Localization)() + + Dim lookUpPath As String = IO.Path.Combine({GameCore.FileSystem.GamePath, GameCore.FileSystem.PATH_LOCALIZATION}) + + 'For Each file As String In IO.Directory.GetFiles(lookUpPath, "*.dat") + ' Dim localization As New Globalization.Localization(file) + ' _localList.Add(localization.LCID, localization) + 'Next + End Sub + + ''' + ''' Returns the current culture ISO code of the language used. + ''' + Private Shared Function GetLocaleId() As String + Return System.Globalization.CultureInfo.CurrentCulture.LCID.ToString() + End Function + + ''' + ''' Returns the localized string or Nothing, if no language or no token in that language exists. + ''' + Public Shared Function GetLocalString(ByVal token As String) As String + If _localList Is Nothing Then + Initialize() + End If + + Dim _lcid As String = GetLocaleId() + + If _localList.Keys.Contains(_lcid) Then + Return _localList(_lcid).GetTranslation(token) + Else + Return Nothing + End If + End Function + + End Class + +End Namespace \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Globalization/Translation.vb b/2.5DHero/2.5DHero/Globalization/Translation.vb new file mode 100644 index 000000000..6f41ad0db --- /dev/null +++ b/2.5DHero/2.5DHero/Globalization/Translation.vb @@ -0,0 +1,144 @@ +Imports System.Reflection + +Namespace Globalization + + ''' + ''' The base class for translation objects for UI elements. + ''' + Public MustInherit Class Translation + + '///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + '// Instructions how to use classes that inherit from this: // + '// Their type name must start with "LOCAL_". // + '// All constants delared private and with a name starting with "C_" are put in the dictionary. // + '// The "C_" and "LOCAL_" are not considered when looking up identifiers in external files. // + '// External files use "TypeName:Constant" as lookup (again, without "LOCAL_" and "C_"). // + '// For the class LOCAL_InventoryScreen and its constant C_INFO_ITEM_OPTION_USE, the lookup is: InventoryScreen:INFO_ITEM_OPTION_USE. // + '///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + ''' + ''' A token to be inserted in a translated text. + ''' + Protected Structure TranslationToken + Public Number As Integer + Public Data As String + End Structure + + Private _stringDic As Dictionary(Of String, String) + Private _typeName As String = "" + + Public Sub New() + _stringDic = New Dictionary(Of String, String)() + + ' Grab all constants in the class and add them to the dictionary. + ' Those are the raw values to translate. + Dim t As Type = Me.GetType() + + If Not t.Name.StartsWith("LOCAL_") Then + Throw New ArgumentException("The type used as localization class has to start with ""LOCAL_"".") + End If + + _typeName = t.Name.Remove(0, 6) 'Remove "LOCAL_". + + Dim constants = t.GetFields(BindingFlags.NonPublic Or BindingFlags.Static Or BindingFlags.FlattenHierarchy) _ + .Where(Function(fi) fi.IsLiteral AndAlso Not fi.IsInitOnly AndAlso fi.Name.StartsWith("C_")).ToArray() + + For Each cField In constants + Dim cValue As String = CType(cField.GetRawConstantValue(), String) + Dim cName As String = cField.Name.Remove(0, 2) 'Remove the C_ at the start of the constant name. + + AddTranslation(cName, cValue) + Next + End Sub + + ''' + ''' Adds an entry to the dictionary with a default english string. + ''' + Private Sub AddTranslation(ByVal identifier As String, ByVal englishDefault As String) + If englishDefault Is Nothing Then + Throw New ArgumentException("The default value must not be null.", NameOf(englishDefault)) + End If + + _stringDic.Add(identifier, englishDefault) + End Sub + + ''' + ''' Returns the translation for a UI string. + ''' + ''' The UI string identifier set with . + ''' The tokens to be inserted into the string. + Protected Function GetTranslation(ByVal identifier As String, ByVal tokens As String()) As String + Return GetTranslation(identifier, BuildTokens(tokens)) + End Function + + ''' + ''' Returns the translation for a UI string. + ''' + ''' The UI string identifier set with . + Protected Function GetTranslation(ByVal identifier As String) As String + ' Helper function for use without tokens. + Return GetTranslation(identifier, New TranslationToken() {}) + End Function + + Private Function BuildTokens(ByVal inputVars As Object()) As TranslationToken() + Dim tokens As New List(Of TranslationToken) + + For i = 0 To inputVars.Count - 1 + Dim var = inputVars(i) + tokens.Add(New TranslationToken() With + { + .Data = var.ToString(), + .Number = i + 1 + }) + Next + + Return tokens.ToArray() + End Function + + ''' + ''' Returns the translation for a UI string. + ''' + ''' The UI string identifier set with . + ''' The tokens inserted into the string. + Private Function GetTranslation(ByVal identifier As String, ByVal tokens As TranslationToken()) As String + ' Translation tokens use .Net's String.Format format: {numeric} + ' So the first token replaces "{0}". + + If identifier Is Nothing Then + Throw New ArgumentException("The identifier must not be null.", NameOf(identifier)) + End If + + 'Remove "C_" from the identifier: + identifier = identifier.Remove(0, 2) + + If Not _stringDic.Keys.Contains(identifier) Then + Throw New ArgumentException("The identifier is not present in the dictionary.", NameOf(identifier)) + End If + + ' The identifier for the files is: type name of the class (minus "LOCAL_") and the identifier. + Dim translatedString = LocalizationManager.GetLocalString(_typeName & ":" & identifier) + + If translatedString Is Nothing Then + ' Fallback string if no language translation is found. + translatedString = _stringDic(identifier) + End If + + ' Only attempt to replace tokens if possible: + If tokens IsNot Nothing AndAlso tokens.Length > 0 Then + tokens = tokens.OrderBy(Function(x) + Return x.Number + End Function).ToArray() + + Dim params As Object() = tokens.Select(Function(x) + Return x.Data + End Function).ToArray() + + translatedString = String.Format(translatedString, params) + End If + + Return translatedString + End Function + + End Class + +End Namespace diff --git a/2.5DHero/2.5DHero/HelperClasses/Localization.vb b/2.5DHero/2.5DHero/HelperClasses/OldLocalization.vb similarity index 98% rename from 2.5DHero/2.5DHero/HelperClasses/Localization.vb rename to 2.5DHero/2.5DHero/HelperClasses/OldLocalization.vb index 94f566d99..5b1c79fff 100644 --- a/2.5DHero/2.5DHero/HelperClasses/Localization.vb +++ b/2.5DHero/2.5DHero/HelperClasses/OldLocalization.vb @@ -1,4 +1,4 @@ -Public Class Localization +Public Class OldLocalization Public Shared LanguageSuffix As String = "en" Public Shared LocalizationTokens As Dictionary(Of String, Token) = New Dictionary(Of String, Token) @@ -6,7 +6,7 @@ Public Shared Sub Load(ByVal LanguageSuffix As String) LocalizationTokens.Clear() - Localization.LanguageSuffix = LanguageSuffix + OldLocalization.LanguageSuffix = LanguageSuffix Logger.Debug("Loaded language [" & LanguageSuffix & "]") diff --git a/2.5DHero/2.5DHero/Input/UI/ColorProvider.vb b/2.5DHero/2.5DHero/Input/UI/ColorProvider.vb new file mode 100644 index 000000000..a407f9b36 --- /dev/null +++ b/2.5DHero/2.5DHero/Input/UI/ColorProvider.vb @@ -0,0 +1,135 @@ +Namespace Screens.UI + + ''' + ''' A class that supplies color information based on the currently loaded profile. + ''' + Public Class ColorProvider + + Public Shared ReadOnly Property IsGameJolt() As Boolean + Get + If Not Core.Player Is Nothing Then + Return Core.Player.IsGameJoltSave + End If + Return False + End Get + End Property + + Private Shared ReadOnly _gradientColor As Color = New Color(42, 167, 198) + Private Shared ReadOnly _gameJolt_gradientColor As Color = New Color(45, 45, 45) + + Public Shared ReadOnly Property GradientColor() As Color + Get + Return GradientColor(IsGameJolt) + End Get + End Property + + Public Shared ReadOnly Property GradientColor(ByVal isGameJolt As Boolean) As Color + Get + If isGameJolt Then + Return _gameJolt_gradientColor + Else + Return _gradientColor + End If + End Get + End Property + + Public Shared ReadOnly Property GradientColor(ByVal isGameJolt As Boolean, ByVal alpha As Integer) As Color + Get + If isGameJolt Then + Return New Color(_gameJolt_gradientColor.R, _gameJolt_gradientColor.G, _gameJolt_gradientColor.B, alpha) + Else + Return New Color(_gradientColor.R, _gradientColor.G, _gradientColor.B, alpha) + End If + End Get + End Property + + Private Shared ReadOnly _mainColor As Color = New Color(84, 198, 216) + Private Shared ReadOnly _gameJolt_mainColor As Color = New Color(39, 39, 39) + + Public Shared ReadOnly Property MainColor() As Color + Get + Return MainColor(IsGameJolt) + End Get + End Property + + Public Shared ReadOnly Property MainColor(ByVal isGameJolt As Boolean) As Color + Get + If isGameJolt Then + Return _gameJolt_mainColor + Else + Return _mainColor + End If + End Get + End Property + + Public Shared ReadOnly Property MainColor(ByVal isGameJolt As Boolean, ByVal alpha As Integer) As Color + Get + If isGameJolt Then + Return New Color(_gameJolt_mainColor.R, _gameJolt_mainColor.G, _gameJolt_mainColor.B, alpha) + Else + Return New Color(_mainColor.R, _mainColor.G, _mainColor.B, alpha) + End If + End Get + End Property + + Private Shared ReadOnly _lightColor As Color = New Color(125, 204, 216) + Private Shared ReadOnly _gameJolt_lightColor As Color = New Color(70, 70, 70) + + Public Shared ReadOnly Property LightColor() As Color + Get + Return LightColor(IsGameJolt) + End Get + End Property + + Public Shared ReadOnly Property LightColor(ByVal isGameJolt As Boolean) As Color + Get + If isGameJolt Then + Return _gameJolt_lightColor + Else + Return _lightColor + End If + End Get + End Property + + Public Shared ReadOnly Property LightColor(ByVal isGameJolt As Boolean, ByVal alpha As Integer) As Color + Get + If isGameJolt Then + Return New Color(_gameJolt_lightColor.R, _gameJolt_lightColor.G, _gameJolt_lightColor.B, alpha) + Else + Return New Color(_lightColor.R, _lightColor.G, _lightColor.B, alpha) + End If + End Get + End Property + + Private Shared ReadOnly _accentColor As Color = New Color(30, 139, 227) + Private Shared ReadOnly _gameJolt_accentColor As Color = New Color(204, 255, 0) + + Public Shared ReadOnly Property AccentColor() As Color + Get + Return AccentColor(IsGameJolt) + End Get + End Property + + Public Shared ReadOnly Property AccentColor(ByVal isGameJolt As Boolean) As Color + Get + If isGameJolt Then + Return _gameJolt_accentColor + Else + Return _accentColor + End If + End Get + End Property + + Public Shared ReadOnly Property AccentColor(ByVal isGameJolt As Boolean, ByVal alpha As Integer) As Color + Get + If isGameJolt Then + Return New Color(_gameJolt_accentColor.R, _gameJolt_accentColor.G, _gameJolt_accentColor.B, alpha) + Else + Return New Color(_accentColor.R, _accentColor.G, _accentColor.B, alpha) + End If + End Get + End Property + + End Class + +End Namespace \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Input/UI/Controls/Button.vb b/2.5DHero/2.5DHero/Input/UI/Controls/Button.vb new file mode 100644 index 000000000..2f527bda6 --- /dev/null +++ b/2.5DHero/2.5DHero/Input/UI/Controls/Button.vb @@ -0,0 +1,97 @@ +Namespace UI.GameControls + + Public Class Button + + Inherits Control + + Private _setSelectedBackColor As Boolean = False + Private _setSelectedFontColor As Boolean = False + + Private _selectedBackColor As Color + Private _selectedFontColor As Color + + Private _image As Texture2D + + Public Property SelectedBackColor As Color + Get + Return _selectedBackColor + End Get + Set(value As Color) + _selectedBackColor = value + _setSelectedBackColor = True + End Set + End Property + + Public Property SelectedFontColor As Color + Get + Return _selectedFontColor + End Get + Set(value As Color) + _selectedFontColor = value + _setSelectedFontColor = True + End Set + End Property + + Public Property Image() As Texture2D + Get + Return _image + End Get + Set(value As Texture2D) + _image = value + End Set + End Property + + Public Sub New(ByVal screenInstance As Screen, ByVal font As SpriteFont) + MyBase.New(screenInstance) + + Me.Font = font + BorderWidth = 0 + Width = 160 + Height = 40 + End Sub + + Protected Overrides Sub DrawClient() + If Visible Then + 'Draw border: + If BorderWidth > 0 Then + SpriteBatch.DrawRectangle(New Rectangle(Position.X, 'X + Position.Y, 'Y + Width + (BorderWidth * 2), 'Width + Height + (BorderWidth * 2) 'Height + ), BorderColor) + End If + + Dim foreColor As Color = FontColor + Dim contentColor As Color = BackColor + + If IsFocused = True Or MouseInClientArea() Then + If _setSelectedBackColor Then + contentColor = _selectedBackColor + End If + If _setSelectedFontColor Then + foreColor = _selectedFontColor + End If + End If + + 'Draw content: + SpriteBatch.DrawRectangle(New Rectangle(Position.X + BorderWidth, Position.Y + BorderWidth, Width, Height), contentColor) + + 'Draw text: + Dim textSize As Vector2 = Font.MeasureString(TESTFORHEIGHTCHARS) + textSize.X = Font.MeasureString(Text).X + + Dim textPos As Vector2 = New Vector2(Position.X + BorderWidth + (Width / 2.0F) - ((textSize.X * FontSize) / 2.0F), Position.Y + BorderWidth + (Height / 2.0F) - ((textSize.Y * FontSize) / 2.0F)) + + If _image IsNot Nothing Then + textPos.X += _image.Width / 2.0F + 4 + + SpriteBatch.Draw(_image, New Rectangle(CInt(textPos.X - 12 - _image.Width), CInt(Position.Y + (Height / 2.0F) - (_image.Height / 2.0F)), _image.Width, _image.Height), New Color(255, 255, 255, foreColor.A)) + End If + + FontRenderer.DrawString(Font, Text, textPos, foreColor, 0F, Vector2.Zero, FontSize, SpriteEffects.None, 0F) + End If + End Sub + + End Class + +End Namespace \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Input/UI/Controls/Control.vb b/2.5DHero/2.5DHero/Input/UI/Controls/Control.vb new file mode 100644 index 000000000..53fdc241a --- /dev/null +++ b/2.5DHero/2.5DHero/Input/UI/Controls/Control.vb @@ -0,0 +1,363 @@ +Namespace UI.GameControls + + ''' + ''' The base class for all UI controls. + ''' + Public MustInherit Class Control + + Protected Const TESTFORHEIGHTCHARS As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz;:_-.,*~+'#1234567890?ß\/!""§$%&/()}][{" + + Private _text As String = String.Empty + + Private _isFocused As Boolean = False + Private _focusOnClick As Boolean = True + + 'Visuals: + Private _font As SpriteFont + Private _fontSize As Single = 1.0F + Private _fontColor As Color = Color.Black + Private _backColor As Color = Color.White + Private _borderColor As Color = Color.Black + Private _width As Integer = 120 + Private _height As Integer = -1 + Private _borderWidth As Integer = 1 + Private _position As Drawing.Point = New Drawing.Point(100, 100) + Private _visible As Boolean = True + + Private _createdScreenInstance As Screen + + ''' + ''' Returns the font renderer applicable to the situation. + ''' + ''' + Protected ReadOnly Property FontRenderer() As SpriteBatch + Get + If _createdScreenInstance.Equals(CurrentScreen) Then + Return Core.FontRenderer + Else + Return Core.SpriteBatch + End If + End Get + End Property + + Protected Sub New(ByVal createdScreenInstance As Screen) + _createdScreenInstance = createdScreenInstance + End Sub + + ''' + ''' The text property of this control. + ''' + ''' + Public Property Text() As String + Get + Return _text + End Get + Set(value As String) + _text = value + End Set + End Property + + ''' + ''' If the control is focused. + ''' + ''' + Public Property IsFocused() As Boolean + Get + Return _isFocused + End Get + Set(value As Boolean) + If value Then + OnFocused(New EventArgs()) + Else + OnDeFocused(New EventArgs()) + End If + End Set + End Property + + ''' + ''' The font that renders on this control. + ''' + ''' + Public Property Font() As SpriteFont + Get + Return _font + End Get + Set(value As SpriteFont) + _font = value + End Set + End Property + + ''' + ''' The width of this control. + ''' + ''' + Public Property Width() As Integer + Get + Return _width + End Get + Set(value As Integer) + _width = value + End Set + End Property + + ''' + ''' The height of this control. + ''' + ''' + Public Property Height As Integer + Get + Return _height + End Get + Set(value As Integer) + _height = value + End Set + End Property + + ''' + ''' The position of this control. + ''' + ''' + Public Property Position As Drawing.Point + Get + Return _position + End Get + Set(value As Drawing.Point) + _position = value + End Set + End Property + + ''' + ''' The font size of the font of this control. + ''' + ''' + Public Property FontSize As Single + Get + Return _fontSize + End Get + Set(value As Single) + _fontSize = value + End Set + End Property + + ''' + ''' The color of the font of this control. + ''' + ''' + Public Property FontColor() As Color + Get + Return _fontColor + End Get + Set(value As Color) + _fontColor = value + End Set + End Property + + ''' + ''' The border color of this control. + ''' + ''' + Public Property BorderColor() As Color + Get + Return _borderColor + End Get + Set(value As Color) + _borderColor = value + End Set + End Property + + ''' + ''' The background color of this control. + ''' + ''' + Public Property BackColor() As Color + Get + Return _backColor + End Get + Set(value As Color) + _backColor = value + End Set + End Property + + ''' + ''' The border width of this control. + ''' + ''' + Public Property BorderWidth() As Integer + Get + Return _borderWidth + End Get + Set(value As Integer) + _borderWidth = value + End Set + End Property + + ''' + ''' If this control gets focused when clicked on. + ''' + ''' + Public Property FocusOnClick() As Boolean + Get + Return _focusOnClick + End Get + Set(value As Boolean) + _focusOnClick = value + End Set + End Property + + ''' + ''' If the control is visible or not. + ''' + ''' + Public Property Visible() As Boolean + Get + Return _visible + End Get + Set(value As Boolean) + _visible = value + End Set + End Property + + ''' + ''' Draws the control. + ''' + Public Sub Draw() + If _visible = True Then + DrawClient() + End If + End Sub + + Protected Overridable Sub DrawClient() + 'Draw in client control. + End Sub + + ''' + ''' Updates the control. + ''' + Public Sub Update() + If Controls.Accept(True, False, False) = True Then + If MouseInClientArea() Then + If _focusOnClick Then + IsFocused = True + End If + If IsFocused Then + OnClick(New OnClickEventArgs(ActivationMethod.Click)) + End If + End If + End If + If IsFocused Then + If Controls.Accept(False, True, False) Then + OnClick(New OnClickEventArgs(ActivationMethod.Keyboard)) + ElseIf Controls.Accept(False, False, True) Then + OnClick(New OnClickEventArgs(ActivationMethod.Controller)) + End If + End If + + UpdateClient() + End Sub + + Protected Overridable Sub UpdateClient() + 'Update in client control. + End Sub + + Protected Overridable Function GetClientRectangle() As Rectangle + Return New Rectangle(Position.X, 'X + Position.Y, 'Y + Width + (BorderWidth * 2), 'Width + Height + (BorderWidth * 2) 'Height + ) + End Function + + Protected Function MouseInClientArea() As Boolean + Return GetClientRectangle().Contains(MouseHandler.MousePosition) + End Function + +#Region "Events" + + ''' + ''' The event that gets fired when the control gets focused. + ''' + ''' + ''' + Public Event Focused(ByVal sender As Object, ByVal e As EventArgs) + + ''' + ''' The event that gets fired when the control loses focus. + ''' + ''' + ''' + Public Event DeFocused(ByVal sender As Object, ByVal e As EventArgs) + + ''' + ''' The event that occurrs when the control gets clicked. + ''' + ''' + ''' + Public Event Click(ByVal sender As Object, ByVal e As EventArgs) + + ''' + ''' Raises the Focused event. + ''' + ''' + Protected Sub OnFocused(e As EventArgs) + _isFocused = True + + RaiseEvent Focused(Me, e) + End Sub + + ''' + ''' Raises the DeFocused event. + ''' + ''' + Protected Sub OnDeFocused(e As EventArgs) + _isFocused = False + + RaiseEvent DeFocused(Me, e) + End Sub + + Protected Sub OnClick(e As OnClickEventArgs) + RaiseEvent Click(Me, e) + End Sub + +#End Region + + End Class + + ''' + ''' The activation method for a click or similar event. + ''' + Public Enum ActivationMethod + Click + Keyboard + Controller + End Enum + + ''' + ''' Event arguments for a click event. + ''' + Public Class OnClickEventArgs + + Inherits EventArgs + + Private _method As ActivationMethod + + ''' + ''' Creates an instance of the OnClickEventArgs class. + ''' + ''' + Public Sub New(ByVal method As ActivationMethod) + _method = method + End Sub + + ''' + ''' The method used to initiate this click event. + ''' + ''' + Public ReadOnly Property ActivationMethod() As ActivationMethod + Get + Return _method + End Get + End Property + + End Class + +End Namespace \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Input/UI/Controls/ControlList.vb b/2.5DHero/2.5DHero/Input/UI/Controls/ControlList.vb new file mode 100644 index 000000000..5b463320c --- /dev/null +++ b/2.5DHero/2.5DHero/Input/UI/Controls/ControlList.vb @@ -0,0 +1,94 @@ +Namespace UI.GameControls + + ''' + ''' A list of controls. + ''' + Public Class ControlList + + Private _list As New List(Of Control) + + ''' + ''' Adds a control to the list. + ''' + ''' The control. + Public Sub Add(ByVal ctl As Control) + AddHandler ctl.Focused, AddressOf FocusedControl + _list.Add(ctl) + End Sub + + ''' + ''' Adds a range of controls to the list. + ''' + ''' The controls to add. + Public Sub AddRange(ByVal ctls As Control()) + For Each ctl In ctls + Add(ctl) + Next + End Sub + + ''' + ''' Removes a control from the list. + ''' + ''' The control. + Public Sub Remove(ByVal ctl As Control) + If _list.Contains(ctl) = True Then + RemoveHandler ctl.Focused, AddressOf FocusedControl + _list.Remove(ctl) + End If + End Sub + + Private Sub FocusedControl(ByVal sender As Object, ByVal e As EventArgs) + For Each ctl As Control In _list + If sender.Equals(ctl) = False Then + ctl.IsFocused = False + End If + Next + End Sub + + ''' + ''' Updates the control list to take control switching input. + ''' + Public Sub Update() + If (KeyBoardHandler.KeyPressed(Keys.Tab) Or + Controls.Down(True, False, False, False, True, True) Or + Controls.Up(True, False, False, False, True, True)) And + _list.Count > 0 Then + + If _list.Count = 1 Then + If _list(0).IsFocused = False Then + _list(0).IsFocused = True + End If + Else + Dim hasFocusedControl As Boolean = False + Dim controlListIndex As Integer = 0 + + For i = 0 To _list.Count - 1 + If _list(i).IsFocused Then + hasFocusedControl = True + controlListIndex = i + End If + Next + + If hasFocusedControl Then + Dim tabDirection As Integer = 1 + If Controls.ShiftDown(TriggerButtons:=False) = True Or Controls.Up(False, False, False, False, True, True) Then + tabDirection = -1 + End If + + Dim focusIndex As Integer = controlListIndex + tabDirection + If focusIndex = _list.Count Then + focusIndex = 0 + ElseIf focusIndex = -1 Then + focusIndex = _list.Count - 1 + End If + _list(focusIndex).IsFocused = True + Else + _list(0).IsFocused = True + End If + End If + End If + End Sub + + End Class + +End Namespace \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Input/UI/Controls/Textbox.vb b/2.5DHero/2.5DHero/Input/UI/Controls/Textbox.vb new file mode 100644 index 000000000..5a7c21899 --- /dev/null +++ b/2.5DHero/2.5DHero/Input/UI/Controls/Textbox.vb @@ -0,0 +1,398 @@ +Namespace UI.GameControls + + 'input from this class + 'carret jumping with customizable characters + 'deleting chars + 'capture to type + 'blacklist/whitelist for characters + 'MaxCount + make it depend on width of textbox if needed. + 'Support Ctrl+C and Ctrl+X, Ctrl+V is supported by GetInput + 'Support Ctrl+A to select all. + 'Password property + 'Pos1+End buttons + + ''' + ''' A textbox representation to handle and display keyboard input. + ''' + Public Class Textbox + + Inherits Control + + Dim _inputHandler As New KeyboardInput() + + 'Password: + Private _isPassword As Boolean = False + Private _passwordChar As Char = CChar("●") + + 'Characters: + Private _carretJumpmarks As Char() = " *²³+#°',.;-:><|!""§%&/()=?{[]}\@".ToCharArray() + Private _inputType As KeyboardInput.InputModifier = KeyboardInput.InputModifier.Latin255 + + 'Properties: + Private _canPaste As Boolean = True + Private _canCopyAndCut As Boolean = True + Private _maxLength As Integer = -1 + + Private _horizontalTextPadding As Integer = 1 + Private _verticalTextPadding As Integer = 1 + + Private _carretPosition As Integer = 0 + Private _selectionStart As Integer = 0 + Private _selectionLength As Integer = 0 + + Public Property IsPassword() As Boolean + Get + Return _isPassword + End Get + Set(value As Boolean) + _isPassword = value + End Set + End Property + + Public Property PasswordChar() As Char + Get + Return _passwordChar + End Get + Set(value As Char) + _passwordChar = value + End Set + End Property + + Public Property MaxLength() As Integer + Get + Return _maxLength + End Get + Set(value As Integer) + _maxLength = value + End Set + End Property + + Public Property CanPaste() As Boolean + Get + Return _canPaste + End Get + Set(value As Boolean) + _canPaste = value + End Set + End Property + + Public Property CanCopyAndCut() As Boolean + Get + Return _canCopyAndCut + End Get + Set(value As Boolean) + _canCopyAndCut = value + End Set + End Property + + Public Property CarretPosition() As Integer + Get + Return _carretPosition + End Get + Set(value As Integer) + _carretPosition = value.Clamp(0, Text.Length) + End Set + End Property + + Public Property SelectionStart() As Integer + Get + Return _selectionStart + End Get + Set(value As Integer) + _selectionStart = value.Clamp(0, Text.Length) + End Set + End Property + + Public Property SelectionLength() As Integer + Get + Return _selectionLength + End Get + Set(value As Integer) + _selectionLength = value.Clamp(_selectionStart, Text.Length) + End Set + End Property + + Public Property InputType() As KeyboardInput.InputModifier + Get + Return _inputType + End Get + Set(value As KeyboardInput.InputModifier) + _inputType = value + End Set + End Property + + Public Property HorizonzalTextPadding() As Integer + Get + Return _horizontalTextPadding + End Get + Set(value As Integer) + _horizontalTextPadding = value + End Set + End Property + + Public Property VerticalTextPadding() As Integer + Get + Return _verticalTextPadding + End Get + Set(value As Integer) + _verticalTextPadding = value + End Set + End Property + + Public Sub New(ByVal screenInstance As Screen, ByVal font As SpriteFont) + MyBase.New(screenInstance) + + Me.Font = font + End Sub + +#Region "Update" + + Protected Overrides Sub UpdateClient() + If IsFocused = True Then + If Controls.CtrlPressed() = True Then + 'Select All (Ctrl + A) + If KeyBoardHandler.KeyPressed(Keys.A) = True Then + SelectAll() + End If + 'Copy (Ctrl + C) + If KeyBoardHandler.KeyPressed(Keys.C) = True Then + Copy() + End If + 'Cut (Ctrl + X) + If KeyBoardHandler.KeyPressed(Keys.X) = True Then + Cut() + End If + End If + + Dim beforeTextCount As Integer = Text.Length + Dim beforeTextCarret As Integer = _carretPosition + + If _selectionLength > 0 Then + Dim testStr = _inputHandler.GetInput("w", 1, _inputType, True, True) + If testStr.Length <> 1 Then + Text = Text.Remove(SelectionStart, SelectionLength - SelectionStart) + _carretPosition = SelectionStart + SelectionLength = -1 + _inputHandler.GetInput(Text, _carretPosition, _inputType, True, True) + End If + Else + _inputHandler.GetInput(Text, _carretPosition, _inputType, True, True) + End If + + If beforeTextCount = Text.Length Then + _carretPosition = beforeTextCarret + End If + + If ControllerHandler.ButtonPressed(Buttons.A) Then + SetScreen(New InputScreen(CurrentScreen, "", InputScreen.InputModes.Name, Text, _maxLength, New List(Of Texture2D), AddressOf ControllerInputCallback)) + End If + + CropText() + + UpdateSelection() + End If + + _carretPosition = _carretPosition.Clamp(0, Text.Length) + End Sub + + Private Sub UpdateSelection() + If Controls.Left(True, True, False, False, True, True) Then + Dim carretJumpTo = _carretPosition - 1 + If KeyBoardHandler.KeyDown(Keys.LeftControl) Then + ' Find next jumpmark to the left: + Dim jumpTo As Integer = 0 + For i = 0 To _carretPosition - 1 + If _carretJumpmarks.Contains(Text(i)) Then + jumpTo = i + End If + Next + carretJumpTo = jumpTo + End If + + If SelectionLength > 0 Then + Dim diff = carretJumpTo - _carretPosition + + Else + _carretPosition = carretJumpTo + End If + End If + If Controls.Right(True, True, False, False, True, True) Then + If KeyBoardHandler.KeyDown(Keys.LeftControl) Then + ' Find next jumpmark to the right: + Dim jumpTo As Integer = Text.Length + For i = _carretPosition To Text.Length - 1 + If _carretJumpmarks.Contains(Text(i)) Then + jumpTo = i + Exit For + End If + Next + _carretPosition = jumpTo + 1 + Else + _carretPosition += 1 + End If + End If + End Sub + + Private Sub ControllerInputCallback(ByVal result As String) + Text = result + _selectionLength = 0 + _selectionStart = 0 + _carretPosition = Text.Length + + CropText() + UpdateSelection() + End Sub + + Protected Overrides Function GetClientRectangle() As Rectangle + Dim contentHeight As Integer = Height + If contentHeight < 0 Then + contentHeight = CInt(Font.MeasureString(TESTFORHEIGHTCHARS).Y * FontSize) + 2 + End If + + Return New Rectangle(Position.X, 'X + Position.Y, 'Y + Width + (BorderWidth * 2), 'Width + contentHeight + (BorderWidth * 2) 'Height + ) + End Function + + ''' + ''' Selects all text. + ''' + Public Sub SelectAll() + _carretPosition = Text.Length + _selectionStart = 0 + _selectionLength = Text.Length + End Sub + + Public Sub Deselect() + _selectionLength = 0 + End Sub + + ''' + ''' Copies any selected text. + ''' + Public Sub Copy() + If _selectionLength > 0 Then + Try + Windows.Forms.Clipboard.SetText(SelectedText) + Catch ex As Exception + Logger.Log(Logger.LogTypes.Message, "KeyboardInput.vb: An error occurred while copying text to the clipboard.") + End Try + End If + End Sub + + ''' + ''' Cuts any selected text. + ''' + Public Sub Cut() + If _selectionLength > 0 Then + Try + Windows.Forms.Clipboard.SetText(SelectedText) + Text = Text.Remove(_selectionStart, _selectionLength) + Deselect() + Catch ex As Exception + Logger.Log(Logger.LogTypes.Message, "KeyboardInput.vb: An error occurred while copying text to the clipboard.") + End Try + End If + End Sub + + ''' + ''' Returns the selected text. + ''' + ''' + Public ReadOnly Property SelectedText() As String + Get + If _selectionLength <= 0 Then + Return "" + End If + Return Text.Substring(_selectionStart, _selectionLength) + End Get + End Property + + ''' + ''' Crops the text based on the max amount of chars. + ''' + Private Sub CropText() + If _maxLength = -1 Then + 'We need to crop the text based on the width of the textbox here. + While CInt(Font.MeasureString(Text).X * FontSize) > Width - _horizontalTextPadding * 2 + Text = Text.Remove(Text.Length - 1, 1) + End While + Else + 'Just crop away chars that are over the limit. + If Text.Length > _maxLength Then + Text = Text.Remove(_maxLength) + End If + End If + End Sub + +#End Region + +#Region "Rendering" + + Protected Overrides Sub DrawClient() + Dim contentHeight As Integer = Height + If contentHeight < 0 Then + contentHeight = CInt(Font.MeasureString(TESTFORHEIGHTCHARS).Y * FontSize) + 2 + End If + + 'Draw border: + If BorderWidth > 0 Then + SpriteBatch.DrawRectangle(New Rectangle(Position.X, 'X + Position.Y, 'Y + Width + (BorderWidth * 2), 'Width + contentHeight + (BorderWidth * 2) 'Height + ), BorderColor) + End If + + 'Draw content: + SpriteBatch.DrawRectangle(New Rectangle(Position.X + BorderWidth, Position.Y + BorderWidth, Width, contentHeight), BackColor) + + Dim drawText As String = Text + If _isPassword = True Then + drawText = "" + For i = 0 To Text.Length - 1 + drawText &= _passwordChar.ToString() + Next + End If + + FontRenderer.DrawString(Font, drawText, New Vector2(Position.X + BorderWidth + _verticalTextPadding, Position.Y + BorderWidth + 1 + _horizontalTextPadding), FontColor, 0F, Vector2.Zero, FontSize, SpriteEffects.None, 0F) + + If IsFocused = True Then + 'Draw carret and selection: + ' Carret + Dim carretDrawPosition As Integer = 0 + Dim textSize = Font.MeasureString(drawText) + + If textSize.Y <= 0F Then + textSize.Y = Font.MeasureString(TESTFORHEIGHTCHARS).Y + End If + + If _carretPosition = Text.Length Then + carretDrawPosition = CInt(textSize.X * FontSize) + Else + carretDrawPosition = CInt(Font.MeasureString(drawText.Remove(_carretPosition)).X * FontSize) + End If + SpriteBatch.DrawLine(New Vector2(Position.X + carretDrawPosition + CInt(Math.Ceiling(FontSize)) + _verticalTextPadding + BorderWidth, Position.Y + BorderWidth + _horizontalTextPadding), + New Vector2(Position.X + carretDrawPosition + CInt(Math.Ceiling(FontSize)) + _verticalTextPadding + BorderWidth, Position.Y + textSize.Y * FontSize + BorderWidth + _horizontalTextPadding), 2.0F, BackColor.Invert()) + + ' Selection: + + Dim startPoint = SelectionStart + Dim endPoint = SelectionStart + SelectionLength + + If SelectionLength < 0 Then + startPoint = SelectionStart + SelectionLength + endPoint = SelectionStart + End If + + SpriteBatch.DrawRectangle(New Rectangle(Position.X + _verticalTextPadding + BorderWidth + startPoint * 10, Position.Y + BorderWidth + _horizontalTextPadding, (endPoint - startPoint) * 10, CInt(textSize.Y * FontSize)), New Color(0, 122, 230, 100)) + End If + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Input/UI/MessageBox.vb b/2.5DHero/2.5DHero/Input/UI/MessageBox.vb new file mode 100644 index 000000000..3a3b508cb --- /dev/null +++ b/2.5DHero/2.5DHero/Input/UI/MessageBox.vb @@ -0,0 +1,95 @@ +Namespace UI + + ''' + ''' Displays a message to the player. + ''' + Public Class MessageBox + + Inherits Screen + + Private _fadeIn As Single = 0F + + Private _closing As Boolean = False + + Private _text As String = "" + + Private _width As Integer = 500 + Private _height As Integer = 200 + + ''' + ''' Creates a new instance of the message box class. + ''' + ''' + Public Sub New(ByVal currentScreen As Screen) + PreScreen = currentScreen + Identification = Identifications.MessageBoxScreen + + CanBePaused = False + CanChat = False + CanDrawDebug = True + CanGoFullscreen = True + CanMuteMusic = True + CanTakeScreenshot = True + MouseVisible = True + End Sub + + ''' + ''' Displays the Message box. + ''' + ''' The text to display. + Public Sub Show(ByVal text As String) + _fadeIn = 0F + _text = text + _closing = False + + Dim fontSize As Vector2 = FontManager.GameJoltFont.MeasureString(_text) + If fontSize.X > 480 Then + _width = CInt(fontSize.X + 20) + End If + + SetScreen(Me) + End Sub + + Public Overrides Sub Draw() + PreScreen.Draw() + + Canvas.DrawRectangle(windowSize, New Color(0, 0, 0, CInt(140 * _fadeIn))) + + Canvas.DrawRectangle(New Rectangle(CInt(windowSize.Width / 2 - _width / 2 - (_width / 10) * (1 - _fadeIn)), + CInt(windowSize.Height / 2 - _height / 2 - (_height / 10) * (1 - _fadeIn)), + CInt(_width + (1 - _fadeIn) * (_width / 5)), + CInt(_height + (1 - _fadeIn) * (_height / 5))), New Color(0, 0, 0, CInt(255 * _fadeIn))) + + + Dim fontSizeMulti As Single = CSng(1 + (1 / 10) * (1 - _fadeIn)) * 0.75F + Dim fontSize As Vector2 = FontManager.GameJoltFont.MeasureString(_text) + GetFontRenderer().DrawString(FontManager.GameJoltFont, _text, New Vector2(windowSize.Width / 2.0F - (fontSize.X * fontSizeMulti) / 2.0F, + windowSize.Height / 2.0F - (fontSize.Y * fontSizeMulti) / 2.0F), New Color(255, 255, 255, CInt(255 * _fadeIn)), 0F, Vector2.Zero, fontSizeMulti, SpriteEffects.None, 0F) + End Sub + + Public Overrides Sub Update() + If _closing Then + If _fadeIn > 0.0F Then + _fadeIn = MathHelper.Lerp(0.0F, _fadeIn, 0.4F) + If _fadeIn - 0.01F <= 0.0F Then + _fadeIn = 0.0F + SetScreen(PreScreen) + End If + End If + Else + If _fadeIn < 1.0F Then + _fadeIn = MathHelper.Lerp(1.0F, _fadeIn, 0.95F) + If _fadeIn + 0.01F >= 1.0F Then + _fadeIn = 1.0F + End If + Else + If Controls.Dismiss(True, True, True) Or Controls.Accept(True, True, True) Then + _closing = True + End If + End If + End If + End Sub + + End Class + +End Namespace \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Input/UI/SelectMenu.vb b/2.5DHero/2.5DHero/Input/UI/SelectMenu.vb new file mode 100644 index 000000000..19998d8bf --- /dev/null +++ b/2.5DHero/2.5DHero/Input/UI/SelectMenu.vb @@ -0,0 +1,136 @@ +Namespace UI + + ''' + ''' A menu that displays multiple selectable options to the player. + ''' + Public Class SelectMenu + + ''' + ''' The event that gets fired upon selection. + ''' + ''' The menu that the item got selected on. + Public Delegate Sub ClickEvent(ByVal s As SelectMenu) + + Dim Items As New List(Of String) + Dim Index As Integer = 0 + Dim ClickHandler As ClickEvent = Nothing + Dim BackIndex As Integer = 0 + Public Visible As Boolean = True + Public Scroll As Integer = 0 + + Dim t1 As Texture2D + Dim t2 As Texture2D + + ''' + ''' Creates a new instance of a select menu. + ''' + ''' The items in the menu. + ''' The selected index. + ''' The method to call when the player selects an item. + ''' The index of the item to select when back is pressed. + Public Sub New(ByVal Items As List(Of String), ByVal Index As Integer, ByVal ClickHandle As ClickEvent, ByVal BackIndex As Integer) + Me.Items = Items + Me.Index = Index + Me.ClickHandler = ClickHandle + Me.BackIndex = BackIndex + If Me.BackIndex < 0 Then + Me.BackIndex = Me.Items.Count + Me.BackIndex + End If + Me.Visible = True + + t1 = TextureManager.GetTexture("GUI\Menus\General", New Rectangle(16, 16, 16, 16), "") + t2 = TextureManager.GetTexture("GUI\Menus\General", New Rectangle(32, 16, 16, 16), "") + + SetCursorDest() + cursorPos = cursorDest + End Sub + + Public Sub Update() + If Visible = True Then + cursorPos.Y = MathHelper.Lerp(cursorDest.Y, cursorPos.Y, 0.6F) + + If Controls.Up(True, True, True, True, True, True) = True Then + Me.Index -= 1 + If Me.Index < 0 Then + Me.Index = Me.Items.Count - 1 + End If + End If + If Controls.Down(True, True, True, True, True, True) = True Then + Me.Index += 1 + If Index > Items.Count - 1 Then + Index = 0 + End If + End If + + For i = Scroll To Me.Scroll + 8 + If i <= Me.Items.Count - 1 Then + If Controls.Accept(True, False, False) = True And i = Me.Index And New Rectangle(Core.windowSize.Width - 270, 66 * ((i + 1) - Scroll), 256, 64).Contains(MouseHandler.MousePosition) = True Or + Controls.Accept(False, True, True) = True And i = Me.Index Or Controls.Dismiss(True, True, True) = True And Me.BackIndex = Me.Index Then + + If Not ClickHandler Is Nothing Then + ClickHandler(Me) + End If + Me.Visible = False + End If + If Controls.Dismiss(True, True, True) = True Then + Me.Index = Me.BackIndex + If Not ClickHandler Is Nothing Then + ClickHandler(Me) + End If + Me.Visible = False + End If + If New Rectangle(Core.windowSize.Width - 270, 66 * ((i + 1) - Scroll), 256, 64).Contains(MouseHandler.MousePosition) = True And Controls.Accept(True, False, False) = True Then + Me.Index = i + End If + End If + Next + + If Index - Scroll > 8 Then + Scroll = Index - 8 + End If + If Index - Scroll < 0 Then + Scroll = Index + End If + SetCursorDest() + End If + End Sub + + Private cursorPos As Vector2 + Private cursorDest As Vector2 + + Public Sub Draw() + If Visible = True Then + For i = Scroll To Me.Scroll + 8 + If i <= Me.Items.Count - 1 Then + Dim Text As String = Items(i) + + Dim startPos As New Vector2(Core.windowSize.Width - 270, 66 * ((i + 1) - Scroll)) + + Core.SpriteBatch.Draw(t1, New Rectangle(CInt(startPos.X), CInt(startPos.Y), 64, 64), Color.White) + Core.SpriteBatch.Draw(t2, New Rectangle(CInt(startPos.X + 64), CInt(startPos.Y), 64, 64), Color.White) + Core.SpriteBatch.Draw(t2, New Rectangle(CInt(startPos.X + 128), CInt(startPos.Y), 64, 64), Color.White) + Core.SpriteBatch.Draw(t1, New Rectangle(CInt(startPos.X + 192), CInt(startPos.Y), 64, 64), Nothing, Color.White, 0.0F, New Vector2(0), SpriteEffects.FlipHorizontally, 0.0F) + + Core.SpriteBatch.DrawString(FontManager.MainFont, Text, New Vector2(startPos.X + 128 - (FontManager.MainFont.MeasureString(Text).X * 1.4F) / 2, startPos.Y + 15), Color.Black, 0.0F, Vector2.Zero, 1.4F, SpriteEffects.None, 0.0F) + End If + Next + End If + + Dim cPosition As Vector2 = New Vector2(cursorPos.X + 128, cursorPos.Y - 40) + Dim t As Texture2D = TextureManager.GetTexture("GUI\Menus\General", New Rectangle(0, 0, 16, 16), "") + Core.SpriteBatch.Draw(t, New Rectangle(CInt(cPosition.X), CInt(cPosition.Y), 64, 64), Color.White) + End Sub + + Private Sub SetCursorDest() + cursorDest = New Vector2(Core.windowSize.Width - 270, 66 * ((Index + 1) - Scroll)) + End Sub + + Public ReadOnly Property SelectedItem() As String + Get + Return Items(Me.Index) + End Get + End Property + + End Class + +End Namespace \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Overworld/OverworldCamera.vb b/2.5DHero/2.5DHero/Overworld/OverworldCamera.vb index b0200ddb9..584945232 100644 --- a/2.5DHero/2.5DHero/Overworld/OverworldCamera.vb +++ b/2.5DHero/2.5DHero/Overworld/OverworldCamera.vb @@ -231,9 +231,9 @@ Public Class OverworldCamera _freeCameraMode = Not _freeCameraMode If _freeCameraMode = False Then - Core.GameMessage.ShowMessage(Localization.GetString("game_message_free_camera_off"), 12, FontManager.MainFont, Color.White) + Core.GameMessage.ShowMessage(OldLocalization.GetString("game_message_free_camera_off"), 12, FontManager.MainFont, Color.White) Else - Core.GameMessage.ShowMessage(Localization.GetString("game_message_free_camera_on"), 12, FontManager.MainFont, Color.White) + Core.GameMessage.ShowMessage(OldLocalization.GetString("game_message_free_camera_on"), 12, FontManager.MainFont, Color.White) End If End If End If @@ -336,12 +336,12 @@ Public Class OverworldCamera If _thirdPerson = True Then Screen.Level.OwnPlayer.Opacity = 1.0F If showMessage = True Then - Core.GameMessage.ShowMessage(Localization.GetString("game_message_third_person_on"), 12, FontManager.MainFont, Color.White) + Core.GameMessage.ShowMessage(OldLocalization.GetString("game_message_third_person_on"), 12, FontManager.MainFont, Color.White) End If Else Yaw = GetAimYawFromDirection(_playerFacing) If showMessage = True Then - Core.GameMessage.ShowMessage(Localization.GetString("game_message_third_person_off"), 12, FontManager.MainFont, Color.White) + Core.GameMessage.ShowMessage(OldLocalization.GetString("game_message_third_person_off"), 12, FontManager.MainFont, Color.White) End If End If End If diff --git a/2.5DHero/2.5DHero/Overworld/RouteSign.vb b/2.5DHero/2.5DHero/Overworld/RouteSign.vb index ee3dc1c17..7edef8c8a 100644 --- a/2.5DHero/2.5DHero/Overworld/RouteSign.vb +++ b/2.5DHero/2.5DHero/Overworld/RouteSign.vb @@ -54,7 +54,7 @@ Public Class RouteSign ''' Public Sub Draw() If Me._show = True Then - Dim placeString As String = Localization.GetString("Places_" & Me._text, Me._text) + Dim placeString As String = OldLocalization.GetString("Places_" & Me._text, Me._text) 'Get the point to render the text to. Dim pX As Integer = CInt(316 / 2) - CInt(FontManager.InGameFont.MeasureString(placeString).X / 2) diff --git a/2.5DHero/2.5DHero/Player/Player.vb b/2.5DHero/2.5DHero/Player/Player.vb index 1e4fa9b0c..9e0d2449d 100644 --- a/2.5DHero/2.5DHero/Player/Player.vb +++ b/2.5DHero/2.5DHero/Player/Player.vb @@ -515,7 +515,7 @@ SandBoxMode = False End If - Localization.ReloadGameModeTokens() + OldLocalization.ReloadGameModeTokens() If GameModeManager.ActiveGameMode.IsDefaultGamemode = False Then MusicManager.LoadMusic(True) @@ -555,7 +555,7 @@ Dim outputString As String = newFilePrefix - Core.GameMessage.ShowMessage(Localization.GetString("game_message_continue_autosave") & " """ & outputString & """", 12, FontManager.MainFont, Color.White) + Core.GameMessage.ShowMessage(OldLocalization.GetString("game_message_continue_autosave") & " """ & outputString & """", 12, FontManager.MainFont, Color.White) newFilePrefix = "" End If diff --git a/2.5DHero/2.5DHero/Pokemon/Monster/Nature.vb b/2.5DHero/2.5DHero/Pokemon/Monster/Nature.vb index d90ea86ef..65de8968d 100644 --- a/2.5DHero/2.5DHero/Pokemon/Monster/Nature.vb +++ b/2.5DHero/2.5DHero/Pokemon/Monster/Nature.vb @@ -1,6 +1,7 @@ Public Class Nature Private Enum StatNames + HP Attack Defense SpAttack @@ -12,16 +13,18 @@ Dim stat As StatNames = StatNames.Attack Select Case StatName.ToLower() + Case "hp" + stat = StatNames.HP Case "attack", "atk" - Stat = StatNames.Attack + stat = StatNames.Attack Case "defense", "def" - Stat = StatNames.Defense - Case "spattack", "spatk", "specialattack" - Stat = StatNames.SpAttack - Case "spdefense", "spdef", "specialdefense" - Stat = StatNames.SpDefense - Case "speed" - Stat = StatNames.Speed + stat = StatNames.Defense + Case "spattack", "spatk", "specialattack", "sp. atk" + stat = StatNames.SpAttack + Case "spdefense", "spdef", "specialdefense", "sp. def" + stat = StatNames.SpDefense + Case "speed", "spe" + stat = StatNames.Speed End Select Select Case Nature diff --git a/2.5DHero/2.5DHero/Pokemon/Monster/Pokemon.vb b/2.5DHero/2.5DHero/Pokemon/Monster/Pokemon.vb index 4e5647c9e..99d122d70 100644 --- a/2.5DHero/2.5DHero/Pokemon/Monster/Pokemon.vb +++ b/2.5DHero/2.5DHero/Pokemon/Monster/Pokemon.vb @@ -2087,8 +2087,8 @@ Public Class Pokemon Return "Egg" Else If Me.NickName = "" Then - If Localization.TokenExists("pokemon_name_" & Me.Name) = True Then - Return Localization.GetString("pokemon_name_" & Me.Name) + If OldLocalization.TokenExists("pokemon_name_" & Me.Name) = True Then + Return OldLocalization.GetString("pokemon_name_" & Me.Name) Else Return Me.Name End If @@ -2102,8 +2102,8 @@ Public Class Pokemon ''' Returns the properly translated name of a Pokémon if defined in the language files. ''' Public Function GetName() As String - If Localization.TokenExists("pokemon_name_" & Me.Name) = True Then - Return Localization.GetString("pokemon_name_" & Me.Name) + If OldLocalization.TokenExists("pokemon_name_" & Me.Name) = True Then + Return OldLocalization.GetString("pokemon_name_" & Me.Name) Else Return Me.Name End If diff --git a/2.5DHero/2.5DHero/Resources/FontManager.vb b/2.5DHero/2.5DHero/Resources/FontManager.vb index ad526706b..645a69e31 100644 --- a/2.5DHero/2.5DHero/Resources/FontManager.vb +++ b/2.5DHero/2.5DHero/Resources/FontManager.vb @@ -116,4 +116,24 @@ Public Class FontManager End Get End Property + Private Shared loadedGameJoltFont As SpriteFont = Nothing + Private Shared hasLoadedGameJoltFont As Boolean = False + + Public Shared ReadOnly Property GameJoltFont() As SpriteFont + Get + If hasLoadedGameJoltFont = True Then + While loadedGameJoltFont Is Nothing + 'Idle around + End While + Return loadedGameJoltFont + Else + hasLoadedGameJoltFont = True + loadedGameJoltFont = Content.Load(Of SpriteFont)("SharedResources\Fonts\GameJolt") + loadedGameJoltFont.DefaultCharacter = " "c + Return loadedGameJoltFont + End If + End Get + End Property + + End Class diff --git a/2.5DHero/2.5DHero/Resources/Sound/MusicManager.vb b/2.5DHero/2.5DHero/Resources/Sound/MusicManager.vb index 22bda5596..d5dc6a250 100644 --- a/2.5DHero/2.5DHero/Resources/Sound/MusicManager.vb +++ b/2.5DHero/2.5DHero/Resources/Sound/MusicManager.vb @@ -310,12 +310,12 @@ If MediaPlayer.IsMuted = True Then MediaPlayer.Pause() - Core.GameMessage.ShowMessage(Localization.GetString("game_message_music_off"), 12, FontManager.MainFont, Color.White) + Core.GameMessage.ShowMessage(OldLocalization.GetString("game_message_music_off"), 12, FontManager.MainFont, Color.White) Else If SongExistFlag = True Then MediaPlayer.Resume() End If - Core.GameMessage.ShowMessage(Localization.GetString("game_message_music_on"), 12, FontManager.MainFont, Color.White) + Core.GameMessage.ShowMessage(OldLocalization.GetString("game_message_music_on"), 12, FontManager.MainFont, Color.White) End If End If End Sub diff --git a/2.5DHero/2.5DHero/Screens/Battle/BlackOutScreen.vb b/2.5DHero/2.5DHero/Screens/Battle/BlackOutScreen.vb index 99f8e6b6c..165de92bb 100644 --- a/2.5DHero/2.5DHero/Screens/Battle/BlackOutScreen.vb +++ b/2.5DHero/2.5DHero/Screens/Battle/BlackOutScreen.vb @@ -5,7 +5,7 @@ Dim BattleScreen As BattleSystem.BattleScreen Dim index As Integer = 0 Dim textIndex As Integer = 0 - Dim Text() As String = {Localization.GetString("black_out_screen_line1"), vbNewLine, " ", Localization.GetString("black_out_screen_line2"), Localization.GetString("black_out_screen_line3"), Localization.GetString("black_out_screen_line4"), Localization.GetString("black_out_screen_line5")} + Dim Text() As String = {OldLocalization.GetString("black_out_screen_line1"), vbNewLine, " ", OldLocalization.GetString("black_out_screen_line2"), OldLocalization.GetString("black_out_screen_line3"), OldLocalization.GetString("black_out_screen_line4"), OldLocalization.GetString("black_out_screen_line5")} Dim ready As Boolean = False Dim delay As Single = 0.2F diff --git a/2.5DHero/2.5DHero/Screens/GUI/DonationScreen.vb b/2.5DHero/2.5DHero/Screens/GUI/DonationScreen.vb index 646b5ee28..013babedb 100644 --- a/2.5DHero/2.5DHero/Screens/GUI/DonationScreen.vb +++ b/2.5DHero/2.5DHero/Screens/GUI/DonationScreen.vb @@ -65,8 +65,8 @@ Core.SpriteBatch.DrawString(FontManager.MainFont, t, New Vector2(CInt(Core.windowSize.Width / 2) - 180, 100), Color.Black) Canvas.DrawRectangle(New Rectangle(CInt(Core.windowSize.Width / 2) - 285, 0, 570, 57), New Color(56, 56, 56)) - Core.SpriteBatch.DrawString(FontManager.MainFont, Localization.GetString("donation_screen_donators") & ": ", New Vector2(CInt(Core.windowSize.Width / 2) - FontManager.MainFont.MeasureString("Donators:").X / 2, 20), Color.White) - Core.SpriteBatch.DrawString(FontManager.MainFont, Localization.GetString("donation_screen_backadvice"), New Vector2(CInt(Core.windowSize.Width / 2) - FontManager.MainFont.MeasureString("Press E to close").X / 2, 640), Color.White) + Core.SpriteBatch.DrawString(FontManager.MainFont, OldLocalization.GetString("donation_screen_donators") & ": ", New Vector2(CInt(Core.windowSize.Width / 2) - FontManager.MainFont.MeasureString("Donators:").X / 2, 20), Color.White) + Core.SpriteBatch.DrawString(FontManager.MainFont, OldLocalization.GetString("donation_screen_backadvice"), New Vector2(CInt(Core.windowSize.Width / 2) - FontManager.MainFont.MeasureString("Press E to close").X / 2, 640), Color.White) End Sub End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/GUI/ISelectionScreen.vb b/2.5DHero/2.5DHero/Screens/GUI/ISelectionScreen.vb new file mode 100644 index 000000000..17fc590be --- /dev/null +++ b/2.5DHero/2.5DHero/Screens/GUI/ISelectionScreen.vb @@ -0,0 +1,33 @@ +Namespace Screens.UI + + Public Interface ISelectionScreen + + ''' + ''' The modes of this screen. + ''' + Enum ScreenMode As Integer + [Default] = 0 + ''' + ''' Used to select a single Item for another screen. + ''' + Selection = 1 + End Enum + + ''' + ''' The current of the screen. + ''' + Property Mode As ScreenMode + + ''' + ''' The event that gets fired when a selection is done on the screen. + ''' + Event SelectedObject(ByVal params As Object()) + + ''' + ''' If the user can exit the screen when in selection mode. + ''' + Property CanExit As Boolean + + End Interface + +End Namespace diff --git a/2.5DHero/2.5DHero/Screens/Inventory/ApricornScreen.vb b/2.5DHero/2.5DHero/Screens/Inventory/ApricornScreen.vb index 0af84dd8a..ca674f307 100644 --- a/2.5DHero/2.5DHero/Screens/Inventory/ApricornScreen.vb +++ b/2.5DHero/2.5DHero/Screens/Inventory/ApricornScreen.vb @@ -52,16 +52,16 @@ Me.Buttons.Clear() Me.Labels.Clear() - Me.Labels.Add(New Label(Localization.GetString("apricorn_screen_apricorns"), New Vector2(80, 128), FontManager.MainFont)) + Me.Labels.Add(New Label(OldLocalization.GetString("apricorn_screen_apricorns"), New Vector2(80, 128), FontManager.MainFont)) Select Case Me.State Case States.Wait - Me.Labels.Add(New Label(Localization.GetString("apricorn_screen_producing").Replace("~", vbNewLine), New Vector2(100, 200), FontManager.MainFont)) - Me.Labels.Add(New Label(Localization.GetString("apricorn_screen_backadvice"), New Vector2(100, 260), Color.DarkGray, FontManager.MainFont)) + Me.Labels.Add(New Label(OldLocalization.GetString("apricorn_screen_producing").Replace("~", vbNewLine), New Vector2(100, 200), FontManager.MainFont)) + Me.Labels.Add(New Label(OldLocalization.GetString("apricorn_screen_backadvice"), New Vector2(100, 260), Color.DarkGray, FontManager.MainFont)) Case States.CanGive Dim T As Texture2D = TextureManager.GetTexture("Items\ItemSheet") - Me.Labels.Add(New Label(Localization.GetString("apricorn_screen_choose_apricorns"), New Vector2(100, 200), FontManager.MainFont)) + Me.Labels.Add(New Label(OldLocalization.GetString("apricorn_screen_choose_apricorns"), New Vector2(100, 200), FontManager.MainFont)) Dim RedApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(85), FontManager.MainFont, T, New Rectangle(240, 72, 24, 24), New Vector2(98, 240), New Size(48, 48), "85") Dim BlueApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(89), FontManager.MainFont, T, New Rectangle(336, 72, 24, 24), New Vector2(98, 304), New Size(48, 48), "89") Dim YellowApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(92), FontManager.MainFont, T, New Rectangle(384, 72, 24, 24), New Vector2(98, 368), New Size(48, 48), "92") @@ -70,15 +70,15 @@ Dim BlackApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(99), FontManager.MainFont, T, New Rectangle(48, 96, 24, 24), New Vector2(162, 240), New Size(48, 48), "99") Dim PinkApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(101), FontManager.MainFont, T, New Rectangle(72, 96, 24, 24), New Vector2(162, 304), New Size(48, 48), "101") - Dim GiveButton As ButtonIcon = New ButtonIcon(AddressOf Me.Give, Localization.GetString("apricorn_screen_ok"), FontManager.MainFont, mainTexture, New Rectangle(48, 128, 16, 16), New Vector2(162, 496), New Size(48, 48), "OK") + Dim GiveButton As ButtonIcon = New ButtonIcon(AddressOf Me.Give, OldLocalization.GetString("apricorn_screen_ok"), FontManager.MainFont, mainTexture, New Rectangle(48, 128, 16, 16), New Vector2(162, 496), New Size(48, 48), "OK") GiveButton.Enabled = False - Dim ClearButton As ButtonIcon = New ButtonIcon(AddressOf Me.ClearApricorns, Localization.GetString("apricorn_screen_clear"), FontManager.MainFont, mainTexture, New Rectangle(64, 128, 16, 16), New Vector2(162, 432), New Size(48, 48), "Clear") + Dim ClearButton As ButtonIcon = New ButtonIcon(AddressOf Me.ClearApricorns, OldLocalization.GetString("apricorn_screen_clear"), FontManager.MainFont, mainTexture, New Rectangle(64, 128, 16, 16), New Vector2(162, 432), New Size(48, 48), "Clear") Buttons.AddRange({RedApricorn, BlueApricorn, YellowApricorn, GreenApricorn, WhiteApricorn, BlackApricorn, PinkApricorn, ClearButton, GiveButton}) Case States.CanTake - Dim TakeButton As ButtonIcon = New ButtonIcon(AddressOf Me.Take, Localization.GetString("apricorn_screen_take"), FontManager.MainFont, mainTexture, New Rectangle(48, 128, 16, 16), New Vector2(98, 450), New Size(48, 48)) + Dim TakeButton As ButtonIcon = New ButtonIcon(AddressOf Me.Take, OldLocalization.GetString("apricorn_screen_take"), FontManager.MainFont, mainTexture, New Rectangle(48, 128, 16, 16), New Vector2(98, 450), New Size(48, 48)) Buttons.AddRange({TakeButton}) - Me.Labels.Add(New Label(Localization.GetString("apricorn_screen_ready"), New Vector2(100, 200), FontManager.MainFont)) + Me.Labels.Add(New Label(OldLocalization.GetString("apricorn_screen_ready"), New Vector2(100, 200), FontManager.MainFont)) End Select End If End Sub @@ -316,7 +316,7 @@ Private Sub Take() Me.State = States.CanGive - Dim text As String = Core.Player.Name & Localization.GetString("apricorn_screen_obtain") + Dim text As String = Core.Player.Name & OldLocalization.GetString("apricorn_screen_obtain") If CInt(Apricorns(0)) > 0 Then Core.Player.Inventory.AddItem(159, CInt(Apricorns(0))) diff --git a/2.5DHero/2.5DHero/Screens/Inventory/ChoosePokemonScreen.vb b/2.5DHero/2.5DHero/Screens/Inventory/ChoosePokemonScreen.vb index 4f0ddf26d..0d1ca2a64 100644 --- a/2.5DHero/2.5DHero/Screens/Inventory/ChoosePokemonScreen.vb +++ b/2.5DHero/2.5DHero/Screens/Inventory/ChoosePokemonScreen.vb @@ -178,7 +178,7 @@ Dim mPressed As Boolean = False Private Sub ShowMenu() Me.MenuID = 0 - ChooseBox.Show({"Select", Localization.GetString("pokemon_screen_summary"), Localization.GetString("pokemon_screen_back")}, 0, {}) + ChooseBox.Show({"Select", OldLocalization.GetString("pokemon_screen_summary"), OldLocalization.GetString("pokemon_screen_back")}, 0, {}) End Sub Public Overrides Sub Draw() diff --git a/2.5DHero/2.5DHero/Screens/Inventory/InventoryScreen.vb b/2.5DHero/2.5DHero/Screens/Inventory/InventoryScreen.vb index fb2a299b5..b726559e7 100644 --- a/2.5DHero/2.5DHero/Screens/Inventory/InventoryScreen.vb +++ b/2.5DHero/2.5DHero/Screens/Inventory/InventoryScreen.vb @@ -243,9 +243,9 @@ Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\BagPack"), New Rectangle(592, 126, 48, 48), New Rectangle(24 * bagIndex, 150, 24, 24), Color.White) - Core.SpriteBatch.DrawString(FontManager.InGameFont, Localization.GetString("inventory_menu_bag"), New Vector2(646, 134), Color.Black) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("inventory_menu_backadvice"), New Vector2(1200 - FontManager.MiniFont.MeasureString(Localization.GetString("inventory_menu_backadvice")).X - 330, 580), Color.DarkGray) - Core.SpriteBatch.DrawString(FontManager.MainFont, Localization.GetString("inventory_menu_items") & ":" & vbNewLine & Localization.GetString("item_category_" & Me.bagIdentifier.ToString()), New Vector2(640, 446), Color.Black) + Core.SpriteBatch.DrawString(FontManager.InGameFont, OldLocalization.GetString("inventory_menu_bag"), New Vector2(646, 134), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("inventory_menu_backadvice"), New Vector2(1200 - FontManager.MiniFont.MeasureString(OldLocalization.GetString("inventory_menu_backadvice")).X - 330, 580), Color.DarkGray) + Core.SpriteBatch.DrawString(FontManager.MainFont, OldLocalization.GetString("inventory_menu_items") & ":" & vbNewLine & OldLocalization.GetString("item_category_" & Me.bagIdentifier.ToString()), New Vector2(640, 446), Color.Black) Canvas.DrawScrollBar(New Vector2(555, 120), cItems.Count, 6, scrollIndex(bagIndex), New Size(4, 390), False, TextureManager.GetTexture(mainTexture, New Rectangle(112, 12, 1, 1)), TextureManager.GetTexture(mainTexture, New Rectangle(113, 12, 1, 1))) diff --git a/2.5DHero/2.5DHero/Screens/Inventory/ItemDetailScreen.vb b/2.5DHero/2.5DHero/Screens/Inventory/ItemDetailScreen.vb index dda453922..fb0eb6e11 100644 --- a/2.5DHero/2.5DHero/Screens/Inventory/ItemDetailScreen.vb +++ b/2.5DHero/2.5DHero/Screens/Inventory/ItemDetailScreen.vb @@ -70,7 +70,7 @@ Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(CInt(Core.windowSize.Width / 2) - 180 + offSetX, 240 + offSetY, 320, 64)) Core.SpriteBatch.DrawString(FontManager.InGameFont, Text, New Vector2(CInt(Core.windowSize.Width / 2) - (FontManager.InGameFont.MeasureString(Text).X / 2) - 10 + offSetX, 276 + offSetY), Color.Black) - If MenuItems(i) = Localization.GetString("item_detail_screen_trash") Then + If MenuItems(i) = OldLocalization.GetString("item_detail_screen_trash") Then Dim trashText As String = trashValue & "/" & Core.Player.Inventory.GetItemAmount(Me.Item.ID) Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(CInt(Core.windowSize.Width / 2) + 180 + offSetX, 240 + offSetY, 128, 64)) @@ -93,7 +93,7 @@ If Controls.Down(True, True, False, True) = True Then If Controls.ShiftDown() = True Then - If MenuItems(index) = Localization.GetString("item_detail_screen_trash") Then + If MenuItems(index) = OldLocalization.GetString("item_detail_screen_trash") Then trashValue += 1 End If Else @@ -102,7 +102,7 @@ End If If Controls.Up(True, True, False, True) = True Then If Controls.ShiftDown() = True Then - If MenuItems(index) = Localization.GetString("item_detail_screen_trash") Then + If MenuItems(index) = OldLocalization.GetString("item_detail_screen_trash") Then trashValue -= 1 End If Else @@ -123,7 +123,7 @@ index = CInt(MathHelper.Clamp(index, 0, MenuItems.Count - 1)) - If MenuItems(index) = Localization.GetString("item_detail_screen_trash") Then + If MenuItems(index) = OldLocalization.GetString("item_detail_screen_trash") Then If Controls.Right(True, False, True, False) = True Then trashValue += 1 End If @@ -136,13 +136,13 @@ If Controls.Accept() = True Then Select Case MenuItems(index) - Case Localization.GetString("item_detail_screen_use") + Case OldLocalization.GetString("item_detail_screen_use") Item.Use() - Case Localization.GetString("item_detail_screen_give") - Core.SetScreen(New ChoosePokemonScreen(Core.CurrentScreen, Me.Item, AddressOf GiveItem, Localization.GetString("item_detail_screen_give_item") & Me.Item.Name, True)) - Case Localization.GetString("item_detail_screen_trash") + Case OldLocalization.GetString("item_detail_screen_give") + Core.SetScreen(New ChoosePokemonScreen(Core.CurrentScreen, Me.Item, AddressOf GiveItem, OldLocalization.GetString("item_detail_screen_give_item") & Me.Item.Name, True)) + Case OldLocalization.GetString("item_detail_screen_trash") Core.Player.Inventory.RemoveItem(Me.Item.ID, trashValue) - Case Localization.GetString("item_detail_screen_back") + Case OldLocalization.GetString("item_detail_screen_back") Core.SetScreen(Me.PreScreen) End Select End If @@ -169,9 +169,9 @@ TextBox.reDelay = 0.0F - Dim t As String = Localization.GetString("pokemon_screen_give_item_1") & Item.Name & Localization.GetString("pokemon_screen_give_item_2") & Pokemon.GetDisplayName() & Localization.GetString("pokemon_screen_give_item_3") + Dim t As String = OldLocalization.GetString("pokemon_screen_give_item_1") & Item.Name & OldLocalization.GetString("pokemon_screen_give_item_2") & Pokemon.GetDisplayName() & OldLocalization.GetString("pokemon_screen_give_item_3") If Not reItem Is Nothing Then - t &= Localization.GetString("pokemon_screen_give_item_4") & reItem.Name & Localization.GetString("pokemon_screen_give_item_5") + t &= OldLocalization.GetString("pokemon_screen_give_item_4") & reItem.Name & OldLocalization.GetString("pokemon_screen_give_item_5") Else t &= "." End If @@ -183,14 +183,14 @@ Private Sub CreateMenuItems() If Item.CanBeUsed = True And canUse = True Then - MenuItems.Add(Localization.GetString("item_detail_screen_use")) + MenuItems.Add(OldLocalization.GetString("item_detail_screen_use")) End If If Item.CanBeHold = True Then - MenuItems.Add(Localization.GetString("item_detail_screen_give")) + MenuItems.Add(OldLocalization.GetString("item_detail_screen_give")) End If If Item.ItemType <> Game.Items.ItemTypes.KeyItems And Item.CanBeTossed = True Then - MenuItems.Add(Localization.GetString("item_detail_screen_trash")) + MenuItems.Add(OldLocalization.GetString("item_detail_screen_trash")) End If - MenuItems.Add(Localization.GetString("item_detail_screen_back")) + MenuItems.Add(OldLocalization.GetString("item_detail_screen_back")) End Sub End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/MainMenu/MainMenuScreen.vb b/2.5DHero/2.5DHero/Screens/MainMenu/MainMenuScreen.vb index aee09f7d6..2ab971265 100644 --- a/2.5DHero/2.5DHero/Screens/MainMenu/MainMenuScreen.vb +++ b/2.5DHero/2.5DHero/Screens/MainMenu/MainMenuScreen.vb @@ -46,7 +46,7 @@ Me.CanBePaused = False Me.MouseVisible = True Me.CanChat = False - Me.currentLanguage = Localization.LanguageSuffix + Me.currentLanguage = OldLocalization.LanguageSuffix Screen.TextBox.Showing = False Screen.PokemonImageView.Showing = False @@ -324,13 +324,13 @@ Dim Text As String = "" Select Case i Case 0 - Text = Localization.GetString("main_menu_continue") + Text = OldLocalization.GetString("main_menu_continue") Case 1 - Text = Localization.GetString("main_menu_load_game") + Text = OldLocalization.GetString("main_menu_load_game") Case 2 - Text = Localization.GetString("main_menu_new_game") + Text = OldLocalization.GetString("main_menu_new_game") Case 3 - Text = Localization.GetString("main_menu_quit_game") + Text = OldLocalization.GetString("main_menu_quit_game") Case 7 Text = "Play online" End Select @@ -643,11 +643,11 @@ End If Next - Me.tempLoadDisplay = Localization.GetString("load_menu_name") & ": " & dispName & vbNewLine & - Localization.GetString("load_menu_gamemode") & ": " & dispGameMode & vbNewLine & - Localization.GetString("load_menu_badges") & ": " & dispBadges & vbNewLine & - Localization.GetString("load_menu_location") & ": " & Localization.GetString("Places_" & dispLocation) & vbNewLine & - Localization.GetString("load_menu_time") & ": " & dispPlayTime + Me.tempLoadDisplay = OldLocalization.GetString("load_menu_name") & ": " & dispName & vbNewLine & + OldLocalization.GetString("load_menu_gamemode") & ": " & dispGameMode & vbNewLine & + OldLocalization.GetString("load_menu_badges") & ": " & dispBadges & vbNewLine & + OldLocalization.GetString("load_menu_location") & ": " & OldLocalization.GetString("Places_" & dispLocation) & vbNewLine & + OldLocalization.GetString("load_menu_time") & ": " & dispPlayTime End If Core.SpriteBatch.DrawInterfaceString(FontManager.MiniFont, tempLoadDisplay, New Vector2(CInt(Core.ScreenSize.Width / 2) - 252, 416), Color.Black) @@ -656,11 +656,11 @@ Dim Text As String = "" Select Case i Case 0 - Text = Localization.GetString("load_menu_load") + Text = OldLocalization.GetString("load_menu_load") Case 1 - Text = Localization.GetString("load_menu_delete") + Text = OldLocalization.GetString("load_menu_delete") Case 2 - Text = Localization.GetString("load_menu_back") + Text = OldLocalization.GetString("load_menu_back") End Select If i = loadMenuIndex(1) Then @@ -944,9 +944,9 @@ Dim Text As String = "" Select Case i Case 0 - Text = Localization.GetString("language_menu_apply") + Text = OldLocalization.GetString("language_menu_apply") Case 1 - Text = Localization.GetString("language_menu_back") + Text = OldLocalization.GetString("language_menu_back") End Select If i = languageMenuIndex(1) Then @@ -988,7 +988,7 @@ Core.GameOptions.SaveOptions() Me.menuIndex = 0 Case 1 - Localization.Load(currentLanguage) + OldLocalization.Load(currentLanguage) Me.menuIndex = 0 End Select End If @@ -1008,7 +1008,7 @@ languageMenuIndex(2) = CInt(MathHelper.Clamp(languageMenuIndex(2), 0, Languages.Count - 4)) If languageMenuIndex(0) <> currentIndex Then - Localization.Load(Languages(languageMenuIndex(0))) + OldLocalization.Load(Languages(languageMenuIndex(0))) End If If Controls.Right(True, True, False) = True Then @@ -1027,7 +1027,7 @@ Core.GameOptions.SaveOptions() Me.menuIndex = 0 Case 1 - Localization.Load(currentLanguage) + OldLocalization.Load(currentLanguage) Me.menuIndex = 0 End Select End If @@ -1071,7 +1071,7 @@ Dim textColor As Color = Color.Gray If EnabledPackNames.Contains(Name) = True Then - Name &= " (" & Localization.GetString("pack_menu_enabled") & ")" + Name &= " (" & OldLocalization.GetString("pack_menu_enabled") & ")" textColor = Color.Black End If @@ -1090,9 +1090,9 @@ Dim Text As String = "" Select Case i Case 0 - Text = Localization.GetString("pack_menu_apply") + Text = OldLocalization.GetString("pack_menu_apply") Case 1 - Text = Localization.GetString("pack_menu_back") + Text = OldLocalization.GetString("pack_menu_back") End Select If i = packsMenuIndex(1) Then @@ -1108,17 +1108,17 @@ Dim Text As String = "" Select Case i Case 2 - Text = Localization.GetString("pack_menu_up") + Text = OldLocalization.GetString("pack_menu_up") Case 3 - Text = Localization.GetString("pack_menu_down") + Text = OldLocalization.GetString("pack_menu_down") Case 4 If isSelectedEnabled = True Then - Text = Localization.GetString("pack_menu_toggle_off") + Text = OldLocalization.GetString("pack_menu_toggle_off") Else - Text = Localization.GetString("pack_menu_toggle_on") + Text = OldLocalization.GetString("pack_menu_toggle_on") End If Case 5 - Text = Localization.GetString("pack_menu_information") + Text = OldLocalization.GetString("pack_menu_information") End Select If i = packsMenuIndex(1) Then @@ -1277,7 +1277,7 @@ Next If hasMP3 = True Or hasWMA = True And hasXNB = True Then - PInfoContent = Localization.GetString("pack_menu_songs") + PInfoContent = OldLocalization.GetString("pack_menu_songs") End If End If If System.IO.Directory.Exists(contentPackPath & "Sounds") = True Then @@ -1301,7 +1301,7 @@ PInfoContent &= ", " End If - PInfoContent &= Localization.GetString("pack_menu_sounds") + PInfoContent &= OldLocalization.GetString("pack_menu_sounds") End If End If @@ -1324,7 +1324,7 @@ PInfoContent &= ", " End If - PInfoContent &= Localization.GetString("pack_menu_textures") + PInfoContent &= OldLocalization.GetString("pack_menu_textures") Exit For End If End If @@ -1365,10 +1365,10 @@ Dim CanvasTexture As Texture2D = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), "") Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(CInt(Core.ScreenSize.Width / 2) - 256, 160, 480, 64), True) - Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("pack_menu_name") & ": " & PInfoName, New Vector2(CInt(Core.ScreenSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(Localization.GetString("pack_menu_name") & ": " & PInfoName).X / 2), 195), Color.Black) + Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, OldLocalization.GetString("pack_menu_name") & ": " & PInfoName, New Vector2(CInt(Core.ScreenSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(OldLocalization.GetString("pack_menu_name") & ": " & PInfoName).X / 2), 195), Color.Black) Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(CInt(Core.ScreenSize.Width / 2) - 256, 288, 480, 224), True) - Core.SpriteBatch.DrawInterfaceString(FontManager.MiniFont, Localization.GetString("pack_menu_version") & ": " & PInfoVersion & vbNewLine & Localization.GetString("pack_menu_by") & ": " & PInfoAuthor & vbNewLine & Localization.GetString("pack_menu_content") & ": " & PInfoContent & vbNewLine & Localization.GetString("pack_menu_description") & ": " & PInfoDescription.Replace("
", vbNewLine), New Vector2(CInt(Core.ScreenSize.Width / 2) - 220, 323), Color.Black) + Core.SpriteBatch.DrawInterfaceString(FontManager.MiniFont, OldLocalization.GetString("pack_menu_version") & ": " & PInfoVersion & vbNewLine & OldLocalization.GetString("pack_menu_by") & ": " & PInfoAuthor & vbNewLine & OldLocalization.GetString("pack_menu_content") & ": " & PInfoContent & vbNewLine & OldLocalization.GetString("pack_menu_description") & ": " & PInfoDescription.Replace("
", vbNewLine), New Vector2(CInt(Core.ScreenSize.Width / 2) - 220, 323), Color.Black) For i = 0 To 1 If i = packInfoIndex Then @@ -1377,17 +1377,17 @@ CanvasTexture = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), "") End If - Dim Text As String = Localization.GetString("pack_menu_back") + Dim Text As String = OldLocalization.GetString("pack_menu_back") Select Case i Case 0 If isEnabled = True Then - Text = Localization.GetString("pack_menu_toggle_off") + Text = OldLocalization.GetString("pack_menu_toggle_off") Else - Text = Localization.GetString("pack_menu_toggle_on") + Text = OldLocalization.GetString("pack_menu_toggle_on") End If Case 1 - Text = Localization.GetString("pack_menu_back") + Text = OldLocalization.GetString("pack_menu_back") End Select Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(CInt(Core.ScreenSize.Width / 2) - 180 + (200 * i), 550, 128, 64), True) @@ -1505,15 +1505,15 @@ Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(CInt(Core.ScreenSize.Width / 2 - 352), 172, 704, 96), Color.White, True) - Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("delete_menu_delete_confirm"), New Vector2(CInt(Core.ScreenSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(Localization.GetString("delete_menu_delete_confirm")).X / 2), 200), Color.Black) + Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, OldLocalization.GetString("delete_menu_delete_confirm"), New Vector2(CInt(Core.ScreenSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(OldLocalization.GetString("delete_menu_delete_confirm")).X / 2), 200), Color.Black) Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, """" & SaveNames(loadMenuIndex(0)) & """ ?", New Vector2(CInt(Core.ScreenSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString("""" & SaveNames(loadMenuIndex(0)) & """ ?").X / 2), 240), Color.Black) For i = 0 To 1 - Dim Text As String = Localization.GetString("delete_menu_delete") + Dim Text As String = OldLocalization.GetString("delete_menu_delete") If i = 1 Then - Text = Localization.GetString("delete_menu_cancel") + Text = OldLocalization.GetString("delete_menu_cancel") End If If i = deleteIndex Then @@ -1665,11 +1665,11 @@ Dim dispAuthor As String = GameMode.Author Dim dispContentPath As String = GameMode.ContentPath - Me.tempGameModesDisplay = Localization.GetString("gamemode_menu_name") & ": " & dispName & vbNewLine & - Localization.GetString("gamemode_menu_version") & ": " & dispVersion & vbNewLine & - Localization.GetString("gamemode_menu_author") & ": " & dispAuthor & vbNewLine & - Localization.GetString("gamemode_menu_contentpath") & ": " & dispContentPath & vbNewLine & - Localization.GetString("gamemode_menu_description") & ": " & dispDescription + Me.tempGameModesDisplay = OldLocalization.GetString("gamemode_menu_name") & ": " & dispName & vbNewLine & + OldLocalization.GetString("gamemode_menu_version") & ": " & dispVersion & vbNewLine & + OldLocalization.GetString("gamemode_menu_author") & ": " & dispAuthor & vbNewLine & + OldLocalization.GetString("gamemode_menu_contentpath") & ": " & dispContentPath & vbNewLine & + OldLocalization.GetString("gamemode_menu_description") & ": " & dispDescription End If Core.SpriteBatch.DrawInterfaceString(FontManager.MiniFont, tempGameModesDisplay, New Vector2(CInt(Core.ScreenSize.Width / 2) - 252, 416), Color.Black) @@ -1681,13 +1681,13 @@ CanvasTexture = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), "") End If - Dim Text As String = Localization.GetString("gamemode_menu_back") + Dim Text As String = OldLocalization.GetString("gamemode_menu_back") Select Case i Case 0 - Text = Localization.GetString("gamemode_menu_create") + Text = OldLocalization.GetString("gamemode_menu_create") Case 1 - Text = Localization.GetString("gamemode_menu_back") + Text = OldLocalization.GetString("gamemode_menu_back") End Select Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(CInt(Core.ScreenSize.Width / 2) - 180 + (200 * i), 550, 128, 64), True) diff --git a/2.5DHero/2.5DHero/Screens/MainMenu/PauseScreen.vb b/2.5DHero/2.5DHero/Screens/MainMenu/PauseScreen.vb index 262987c3d..2394d6b1c 100644 --- a/2.5DHero/2.5DHero/Screens/MainMenu/PauseScreen.vb +++ b/2.5DHero/2.5DHero/Screens/MainMenu/PauseScreen.vb @@ -47,9 +47,9 @@ Me.PreScreen.Draw() Canvas.DrawRectangle(New Rectangle(0, 0, Core.ScreenSize.Width, Core.ScreenSize.Height), New Color(0, 0, 0, 150)) - Dim pX As Integer = CInt(Core.ScreenSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(Localization.GetString("pause_menu_title")).X / 2) - Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("pause_menu_title"), New Vector2(pX - 7, CInt(Core.ScreenSize.Height / 6.8) + 3), Color.Black) - Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("pause_menu_title"), New Vector2(pX - 10, CInt(Core.ScreenSize.Height / 6.8)), Color.White) + Dim pX As Integer = CInt(Core.ScreenSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(OldLocalization.GetString("pause_menu_title")).X / 2) + Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, OldLocalization.GetString("pause_menu_title"), New Vector2(pX - 7, CInt(Core.ScreenSize.Height / 6.8) + 3), Color.Black) + Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, OldLocalization.GetString("pause_menu_title"), New Vector2(pX - 10, CInt(Core.ScreenSize.Height / 6.8)), Color.White) If Me.menuIndex = 0 Then DrawMenu() @@ -58,7 +58,7 @@ End If If Me.canCreateAutosave = False Then - Dim text As String = Localization.GetString("pause_menu_autosave_fail") + Dim text As String = OldLocalization.GetString("pause_menu_autosave_fail") Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, text, New Vector2(9, Core.ScreenSize.Height - FontManager.InGameFont.MeasureString(text).Y), Color.Black) Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, text, New Vector2(5, Core.ScreenSize.Height - FontManager.InGameFont.MeasureString(text).Y - 4), Color.White) @@ -92,9 +92,9 @@ Dim Text As String = "" Select Case i Case 0 - Text = Localization.GetString("pause_menu_back_to_game") + Text = OldLocalization.GetString("pause_menu_back_to_game") Case 1 - Text = Localization.GetString("pause_menu_quit_to_menu") + Text = OldLocalization.GetString("pause_menu_quit_to_menu") End Select If i = mainIndex Then @@ -170,19 +170,19 @@ #Region "QuitMenu" Private Sub DrawQuit() - Dim pX As Integer = CInt(Core.ScreenSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(Localization.GetString("pause_menu_confirmation")).X / 2) - Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("pause_menu_confirmation"), New Vector2(pX - 7, CInt(Core.ScreenSize.Height / 6.8) + 3 + 110), Color.Black) - Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("pause_menu_confirmation"), New Vector2(pX - 10, CInt(Core.ScreenSize.Height / 6.8) + 110), Color.White) + Dim pX As Integer = CInt(Core.ScreenSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(OldLocalization.GetString("pause_menu_confirmation")).X / 2) + Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, OldLocalization.GetString("pause_menu_confirmation"), New Vector2(pX - 7, CInt(Core.ScreenSize.Height / 6.8) + 3 + 110), Color.Black) + Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, OldLocalization.GetString("pause_menu_confirmation"), New Vector2(pX - 10, CInt(Core.ScreenSize.Height / 6.8) + 110), Color.White) For i = 0 To 1 Dim Text As String = "" Dim x As Integer = 0 Select Case i Case 0 - Text = Localization.GetString("pause_menu_no") + Text = OldLocalization.GetString("pause_menu_no") x = -200 Case 1 - Text = Localization.GetString("pause_menu_yes") + Text = OldLocalization.GetString("pause_menu_yes") x = 200 End Select diff --git a/2.5DHero/2.5DHero/Screens/MapScreen.vb b/2.5DHero/2.5DHero/Screens/MapScreen.vb index 2aa7c5840..5d7685e87 100644 --- a/2.5DHero/2.5DHero/Screens/MapScreen.vb +++ b/2.5DHero/2.5DHero/Screens/MapScreen.vb @@ -471,14 +471,14 @@ End If If Me.hoverText <> "" And Me.pokehoverText <> "" Then - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("pokemon_name_" & Me.pokehoverText) & " at " & Localization.GetString("Places_" & Me.hoverText), New Vector2(Me.CursorPosition.X + 32, Me.CursorPosition.Y - 29), Color.Black) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("pokemon_name_" & Me.pokehoverText) & " at " & Localization.GetString("Places_" & Me.hoverText), New Vector2(Me.CursorPosition.X + 29, Me.CursorPosition.Y - 32), Color.White) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("pokemon_name_" & Me.pokehoverText) & " at " & OldLocalization.GetString("Places_" & Me.hoverText), New Vector2(Me.CursorPosition.X + 32, Me.CursorPosition.Y - 29), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("pokemon_name_" & Me.pokehoverText) & " at " & OldLocalization.GetString("Places_" & Me.hoverText), New Vector2(Me.CursorPosition.X + 29, Me.CursorPosition.Y - 32), Color.White) ElseIf Me.hoverText <> "" And Me.pokehoverText = "" Then - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("Places_" & Me.hoverText), New Vector2(Me.CursorPosition.X + 32, Me.CursorPosition.Y - 29), Color.Black) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("Places_" & Me.hoverText), New Vector2(Me.CursorPosition.X + 29, Me.CursorPosition.Y - 32), Color.White) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("Places_" & Me.hoverText), New Vector2(Me.CursorPosition.X + 32, Me.CursorPosition.Y - 29), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("Places_" & Me.hoverText), New Vector2(Me.CursorPosition.X + 29, Me.CursorPosition.Y - 32), Color.White) End If - Dim regionString As String = Localization.GetString(Me.currentRegion(0).ToString().ToUpper() & Me.currentRegion.Remove(0, 1)) + Dim regionString As String = OldLocalization.GetString(Me.currentRegion(0).ToString().ToUpper() & Me.currentRegion.Remove(0, 1)) If Me.regions.Count > 1 Then regionString &= " (Press the Shift/Shoulder Buttons to switch between regions.)" End If @@ -497,32 +497,32 @@ r = New Rectangle(116, 0, 12, 12) End If Core.SpriteBatch.Draw(Me.objectsTexture, New Rectangle(Core.windowSize.Width - 170, 100, 24, 24), r, New Color(255, 255, 255, 220)) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("map_screen_cities"), New Vector2(Core.windowSize.Width - 137, 103), Color.Black) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("map_screen_cities"), New Vector2(Core.windowSize.Width - 140, 100), Color.White) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("map_screen_cities"), New Vector2(Core.windowSize.Width - 137, 103), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("map_screen_cities"), New Vector2(Core.windowSize.Width - 140, 100), Color.White) ' Routes: r = New Rectangle(104, 12, 12, 12) If drawObjects(1) = False Then r = New Rectangle(116, 12, 12, 12) End If Core.SpriteBatch.Draw(Me.objectsTexture, New Rectangle(Core.windowSize.Width - 170, 130, 24, 24), r, New Color(255, 255, 255, 220)) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("map_screen_routes"), New Vector2(Core.windowSize.Width - 137, 133), Color.Black) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("map_screen_routes"), New Vector2(Core.windowSize.Width - 140, 130), Color.White) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("map_screen_routes"), New Vector2(Core.windowSize.Width - 137, 133), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("map_screen_routes"), New Vector2(Core.windowSize.Width - 140, 130), Color.White) ' Places: r = New Rectangle(104, 24, 12, 12) If drawObjects(2) = False Then r = New Rectangle(116, 24, 12, 12) End If Core.SpriteBatch.Draw(Me.objectsTexture, New Rectangle(Core.windowSize.Width - 170, 160, 24, 24), r, New Color(255, 255, 255, 220)) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("map_screen_places"), New Vector2(Core.windowSize.Width - 137, 163), Color.Black) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("map_screen_places"), New Vector2(Core.windowSize.Width - 140, 160), Color.White) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("map_screen_places"), New Vector2(Core.windowSize.Width - 137, 163), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("map_screen_places"), New Vector2(Core.windowSize.Width - 140, 160), Color.White) ' Roaming: r = New Rectangle(111, 64, 17, 16) If drawObjects(3) = False Then r = New Rectangle(111, 80, 17, 16) End If Core.SpriteBatch.Draw(Me.objectsTexture, New Rectangle(Core.windowSize.Width - 170, 190, 24, 24), r, New Color(255, 255, 255, 220)) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("map_screen_roaming"), New Vector2(Core.windowSize.Width - 137, 193), Color.Black) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("map_screen_roaming"), New Vector2(Core.windowSize.Width - 140, 190), Color.White) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("map_screen_roaming"), New Vector2(Core.windowSize.Width - 137, 193), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("map_screen_roaming"), New Vector2(Core.windowSize.Width - 140, 190), Color.White) End Sub Private Sub DrawCursor() diff --git a/2.5DHero/2.5DHero/Screens/MenuScreen.vb b/2.5DHero/2.5DHero/Screens/MenuScreen.vb index 09cbfffc8..679d21d5f 100644 --- a/2.5DHero/2.5DHero/Screens/MenuScreen.vb +++ b/2.5DHero/2.5DHero/Screens/MenuScreen.vb @@ -14,19 +14,19 @@ Dim newOptions As New List(Of String) If Core.Player.hasPokedex = True Then - newOptions.Add(Localization.GetString("game_menu_pokedex")) + newOptions.Add(OldLocalization.GetString("game_menu_pokedex")) End If If Screen.Level.IsBugCatchingContest = True Then - newOptions.AddRange({Screen.Level.BugCatchingContestData.GetSplit(2) & " x" & Core.Player.Inventory.GetItemAmount(177), Localization.GetString("game_menu_bag"), Localization.GetString("game_menu_trainer_card"), Localization.GetString("End Contest")}) + newOptions.AddRange({Screen.Level.BugCatchingContestData.GetSplit(2) & " x" & Core.Player.Inventory.GetItemAmount(177), OldLocalization.GetString("game_menu_bag"), OldLocalization.GetString("game_menu_trainer_card"), OldLocalization.GetString("End Contest")}) Else If Core.Player.Pokemons.Count > 0 Then - newOptions.Add(Localization.GetString("game_menu_party")) + newOptions.Add(OldLocalization.GetString("game_menu_party")) End If - newOptions.AddRange({Localization.GetString("game_menu_bag"), Localization.GetString("game_menu_trainer_card"), Localization.GetString("game_menu_save")}) + newOptions.AddRange({OldLocalization.GetString("game_menu_bag"), OldLocalization.GetString("game_menu_trainer_card"), OldLocalization.GetString("game_menu_save")}) End If - newOptions.AddRange({Localization.GetString("game_menu_options"), Localization.GetString("game_menu_exit")}) + newOptions.AddRange({OldLocalization.GetString("game_menu_options"), OldLocalization.GetString("game_menu_exit")}) Options = newOptions.ToArray() Me.index = Player.Temp.MenuIndex @@ -36,7 +36,7 @@ PreScreen.Draw() If Me.IsCurrentScreen() = True Then - If Core.Player.IsGamejoltSave = True Then + 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 End If @@ -67,21 +67,21 @@ Else drawRight = False Select Case nextAction - Case Localization.GetString("game_menu_pokedex") + Case OldLocalization.GetString("game_menu_pokedex") Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New PokedexSelectScreen(Me), Color.White, False)) - Case Localization.GetString("game_menu_party") - Core.SetScreen(New PokemonScreen(Me, Player.Temp.PokemonScreenIndex)) - Case Localization.GetString("game_menu_bag") + Case OldLocalization.GetString("game_menu_party") + Core.SetScreen(New PartyScreen(Me, Player.Temp.PokemonScreenIndex)) + Case OldLocalization.GetString("game_menu_bag") Core.SetScreen(New InventoryScreen(Me)) - Case Localization.GetString("game_menu_trainer_card") + Case OldLocalization.GetString("game_menu_trainer_card") Core.SetScreen(New TrainerScreen(Me)) Case "Pokégear" Core.SetScreen(New GameJolt.PokegearScreen(Me, GameJolt.PokegearScreen.EntryModes.MainMenu, {})) - Case Localization.GetString("game_menu_save") + Case OldLocalization.GetString("game_menu_save") Core.SetScreen(New SaveScreen(Me)) - Case Localization.GetString("game_menu_options") + Case OldLocalization.GetString("game_menu_options") Core.SetScreen(New OptionScreen(Me)) - Case Localization.GetString("game_menu_exit") + Case OldLocalization.GetString("game_menu_exit") Core.SetScreen(Me.PreScreen) Case Screen.Level.BugCatchingContestData.GetSplit(2) & " x" & Core.Player.Inventory.GetItemAmount(177) ShowBalls() @@ -110,7 +110,7 @@ End If If Controls.Dismiss() = True Then - nextAction = Localization.GetString("game_menu_exit") + nextAction = OldLocalization.GetString("game_menu_exit") drawRight = True End If diff --git a/2.5DHero/2.5DHero/Screens/NewGameScreen.vb b/2.5DHero/2.5DHero/Screens/NewGameScreen.vb index 44c789a02..51360be57 100644 --- a/2.5DHero/2.5DHero/Screens/NewGameScreen.vb +++ b/2.5DHero/2.5DHero/Screens/NewGameScreen.vb @@ -49,7 +49,7 @@ BattleSystem.GameModeAttackLoader.Load() - Localization.ReloadGameModeTokens() + OldLocalization.ReloadGameModeTokens() If GameModeManager.ActiveGameMode.IsDefaultGamemode = False Then MusicManager.LoadMusic(True) @@ -107,7 +107,7 @@ End If If Me.Dialogues.Count < 3 Then Me.Dialogues.Clear() - Me.Dialogues.AddRange({Localization.GetString("new_game_oak_1"), Localization.GetString("new_game_oak_2"), Localization.GetString("new_game_oak_3")}) + Me.Dialogues.AddRange({OldLocalization.GetString("new_game_oak_1"), OldLocalization.GetString("new_game_oak_2"), OldLocalization.GetString("new_game_oak_3")}) End If End Sub @@ -228,16 +228,16 @@ Select Case Index Case 5 - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("new_game_your_name") & ":", New Vector2(TextboxPosition.X, TextboxPosition.Y - 24), Color.White) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("new_game_your_name") & ":", New Vector2(TextboxPosition.X, TextboxPosition.Y - 24), Color.White) DrawTextBox() If enterCorrectName = True Then - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("new_game_name_too_short"), New Vector2(TextboxPosition.X, TextboxPosition.Y + 30), Color.DarkRed) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("new_game_name_too_short"), New Vector2(TextboxPosition.X, TextboxPosition.Y + 30), Color.DarkRed) End If Case 4 Canvas.DrawRectangle(New Rectangle(CInt(TextboxPosition.X - 5), CInt(TextboxPosition.Y - 24), 138, 42), New Color(0, 0, 0, 80)) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("new_game_choose_skin") & ":" & vbNewLine & skinNames(SkinIndex), New Vector2(TextboxPosition.X, TextboxPosition.Y - 24), Color.White) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("new_game_choose_skin") & ":" & vbNewLine & skinNames(SkinIndex), New Vector2(TextboxPosition.X, TextboxPosition.Y - 24), Color.White) Canvas.DrawScrollBar(New Vector2(TextboxPosition.X, TextboxPosition.Y + 48), startSkins.Count, 1, SkinIndex, New Size(128, 4), True, TextureManager.GetTexture(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(112, 12, 1, 1)), TextureManager.GetTexture(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(113, 12, 1, 1))) End Select @@ -537,13 +537,13 @@ Select Case True Case WeirdNames.Contains(name.ToLower()) - Return Localization.GetString("new_game_oak_weird_name_1") & name & Localization.GetString("new_game_oak_weird_name_2") + Return OldLocalization.GetString("new_game_oak_weird_name_1") & name & OldLocalization.GetString("new_game_oak_weird_name_2") Case KnownNames.Contains(name.ToLower()) - Return Localization.GetString("new_game_oak_known_name_1") & name & Localization.GetString("new_game_oak_known_name_2") + Return OldLocalization.GetString("new_game_oak_known_name_1") & name & OldLocalization.GetString("new_game_oak_known_name_2") Case OwnNames.Contains(name.ToLower()) - Return Localization.GetString("new_game_oak_same_name_1") & name & Localization.GetString("new_game_oak_same_name_2") + Return OldLocalization.GetString("new_game_oak_same_name_1") & name & OldLocalization.GetString("new_game_oak_same_name_2") End Select - Return Localization.GetString("new_game_oak_name_1") & name & Localization.GetString("new_game_oak_name_2") + Return OldLocalization.GetString("new_game_oak_name_1") & name & OldLocalization.GetString("new_game_oak_name_2") End Function End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/OptionScreen.vb b/2.5DHero/2.5DHero/Screens/OptionScreen.vb index 06abf550d..ac8ca6740 100644 --- a/2.5DHero/2.5DHero/Screens/OptionScreen.vb +++ b/2.5DHero/2.5DHero/Screens/OptionScreen.vb @@ -72,7 +72,7 @@ Core.SpriteBatch.DrawString(FontManager.InGameFont, Me.CurrentPath, New Vector2(80, 130), Color.Black) If savedOptions = False Then - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("option_screen_warning"), New Vector2(90 + FontManager.InGameFont.MeasureString(Localization.GetString("option_screen_title")).X, 138), Color.DarkRed) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("option_screen_warning"), New Vector2(90 + FontManager.InGameFont.MeasureString(OldLocalization.GetString("option_screen_title")).X, 138), Color.DarkRed) End If For Each C As Control In ControlList diff --git a/2.5DHero/2.5DHero/Screens/Pokemon/PartyScreen.vb b/2.5DHero/2.5DHero/Screens/Pokemon/PartyScreen.vb new file mode 100644 index 000000000..430e04b0b --- /dev/null +++ b/2.5DHero/2.5DHero/Screens/Pokemon/PartyScreen.vb @@ -0,0 +1,890 @@ +Imports net.Pokemon3D.Game.Screens.UI +Public Class PartyScreen + + Inherits Screen + Implements ISelectionScreen + + Private Const POKEMON_TITLE As String = "Pokémon" + + Private _translation As Globalization.Classes.LOCAL_PartyScreen + + ''' + ''' Cursor index -> pointing to Pokémon (0-5). + ''' + Private _index As Integer = 0 + + Private _texture As Texture2D + Private _menuTexture As Texture2D + + 'Animation: + Private _closing As Boolean = False + + Private _enrollY As Single = 0F + Private _interfaceFade As Single = 0F + Private _cursorPosition As New Vector2 + Private _cursorDest As New Vector2 + + 'Pokémon animation: + Private Class PokemonAnimation + Public _shakeV As Single + Public _shakeLeft As Boolean + Public _shakeCount As Integer + End Class + + Private _pokemonAnimations As New List(Of PokemonAnimation) + + Private _menu As UI.SelectMenu + + Private _isSwitching As Boolean = False + Private _switchIndex As Integer = -1 + + 'Message display: + Private _messageDelay As Single = 0F + Private _messageText As String = "" + + Public Sub New(ByVal currentScreen As Screen, ByVal PokeIndex As Integer) + Identification = Identifications.PartyScreen + PreScreen = currentScreen + IsDrawingGradients = True + + _translation = New Globalization.Classes.LOCAL_PartyScreen() + + _index = PokeIndex + _texture = TextureManager.GetTexture("GUI\Menus\General") + _menuTexture = TextureManager.GetTexture("GUI\Menus\PokemonInfo") + + If _index >= Core.Player.Pokemons.Count Then + _index = 0 + End If + _cursorDest = GetBoxPosition(_index) + _cursorPosition = _cursorDest + + For i = 0 To Core.Player.Pokemons.Count - 1 + _pokemonAnimations.Add(New PokemonAnimation()) + Next + + CheckForLegendaryEmblem() + CheckForOverkillEmblem() + + _menu = New UI.SelectMenu({""}.ToList(), 0, Nothing, 0) + _menu.Visible = False + End Sub + + Public Overrides Sub Draw() + PreScreen.Draw() + + DrawGradients(CInt(255 * _interfaceFade)) + + DrawBackground() + DrawPokemonArea() + + If _messageDelay > 0F Then + Dim textFade As Single = 1.0F + If _messageDelay <= 1.0F Then + textFade = _messageDelay + End If + + Canvas.DrawRectangle(New Rectangle(CInt(Core.windowSize.Width / 2 - 150), CInt(Core.windowSize.Height - 200), 300, 100), New Color(0, 0, 0, CInt(150 * textFade * _interfaceFade))) + + Dim text As String = _messageText.CropStringToWidth(FontManager.ChatFont, 250) '''??? + Dim size As Vector2 = FontManager.ChatFont.MeasureString(text) + + SpriteBatch.DrawString(FontManager.ChatFont, text, New Vector2(CSng(Core.windowSize.Width / 2 - size.X / 2), CSng(Core.windowSize.Height - 150 - size.Y / 2)), New Color(255, 255, 255, CInt(255 * textFade * _interfaceFade))) + End If + End Sub + + Private Sub DrawBackground() + Dim mainBackgroundColor As Color = Color.White + If _closing Then + mainBackgroundColor = New Color(255, 255, 255, CInt(255 * _interfaceFade)) + End If + + Dim halfWidth As Integer = CInt(Core.windowSize.Width / 2) + Dim halfHeight As Integer = CInt(Core.windowSize.Height / 2) + + Canvas.DrawRectangle(New Rectangle(halfWidth - 400, halfHeight - 232, 260, 32), New Color(84, 198, 216, mainBackgroundColor.A)) + Canvas.DrawRectangle(New Rectangle(halfWidth - 140, halfHeight - 216, 16, 16), New Color(84, 198, 216, mainBackgroundColor.A)) + SpriteBatch.Draw(_menuTexture, New Rectangle(halfWidth - 140, halfHeight - 232, 16, 16), New Rectangle(32, 16, 16, 16), mainBackgroundColor) + SpriteBatch.Draw(_menuTexture, New Rectangle(halfWidth - 124, halfHeight - 216, 16, 16), New Rectangle(32, 16, 16, 16), mainBackgroundColor) + + SpriteBatch.DrawString(FontManager.ChatFont, POKEMON_TITLE, New Vector2(halfWidth - 390, halfHeight - 228), mainBackgroundColor) + + For y = 0 To CInt(_enrollY) Step 16 + For x = 0 To 800 Step 16 + SpriteBatch.Draw(_menuTexture, New Rectangle(halfWidth - 400 + x, halfHeight - 200 + y, 16, 16), New Rectangle(0, 0, 4, 4), mainBackgroundColor) + Next + Next + + Dim modRes As Integer = CInt(_enrollY) Mod 16 + If modRes > 0 Then + For x = 0 To 800 Step 16 + SpriteBatch.Draw(_menuTexture, New Rectangle(halfWidth - 400 + x, CInt(_enrollY + (halfHeight - 200)), 16, modRes), New Rectangle(0, 0, 4, 4), mainBackgroundColor) + Next + End If + End Sub + + Private Sub DrawPokemonArea() + For i = 0 To Core.Player.Pokemons.Count - 1 + DrawPokemon(i) + Next + + Canvas.DrawBorder(3, New Rectangle(CInt(_cursorPosition.X) - 3, CInt(_cursorPosition.Y) - 3, 300, 82), New Color(200, 80, 80, CInt(200 * _interfaceFade))) + + If _isSwitching Then + Dim switchPosition As Vector2 = GetBoxPosition(_switchIndex) + + Canvas.DrawBorder(3, New Rectangle(CInt(switchPosition.X) - 6, CInt(switchPosition.Y) - 6, 306, 88), New Color(80, 80, 200, CInt(200 * _interfaceFade))) + End If + End Sub + + Private Sub DrawPokemon(ByVal index As Integer) + Dim position As Vector2 = GetBoxPosition(index) + + Dim p As Pokemon = Core.Player.Pokemons(index) + + Dim backColor As Color = New Color(0, 0, 0, CInt(100 * _interfaceFade)) + If p.IsShiny And p.IsEgg() = False Then + backColor = New Color(57, 59, 29, CInt(100 * _interfaceFade)) + End If + + Canvas.DrawGradient(New Rectangle(CInt(position.X), CInt(position.Y), 32, 76), New Color(0, 0, 0, 0), backColor, True, -1) + Canvas.DrawRectangle(New Rectangle(CInt(position.X) + 32, CInt(position.Y), 228, 76), backColor) + Canvas.DrawGradient(New Rectangle(CInt(position.X) + 260, CInt(position.Y), 32, 76), backColor, New Color(0, 0, 0, 0), True, -1) + + If p.IsEgg() Then + Dim percent As Integer = CInt((p.EggSteps / p.BaseEggSteps) * 100) + Dim shakeMulti As Single = 1.0F + If percent <= 33 Then + shakeMulti = 0.2F + ElseIf percent > 33 And percent <= 66 Then + shakeMulti = 0.5F + Else + shakeMulti = 0.8F + End If + + 'menu image: + SpriteBatch.Draw(p.GetMenuTexture(), New Rectangle(CInt(position.X) + 80 + 32, CInt(position.Y) + 6 + 32, 64, 64), Nothing, New Color(255, 255, 255, CInt(255 * _interfaceFade)), + _pokemonAnimations(index)._shakeV * shakeMulti, New Vector2(16, 16), SpriteEffects.None, 0F) + + 'name: + GetFontRenderer().DrawString(FontManager.MiniFont, p.GetDisplayName(), New Vector2(position.X + 156, position.Y + 27), New Color(255, 255, 255, CInt(255 * _interfaceFade))) + Else + Dim shakeMulti As Single = CSng((p.HP / p.MaxHP).Clamp(0.2F, 1.0F)) + + 'menu image: + SpriteBatch.Draw(p.GetMenuTexture(), New Rectangle(CInt(position.X) + 2 + 32, CInt(position.Y) - 4 + 32, 64, 64), Nothing, New Color(255, 255, 255, CInt(255 * _interfaceFade)), + _pokemonAnimations(index)._shakeV * shakeMulti, New Vector2(16, 16), SpriteEffects.None, 0F) + + + 'Item: + If p.Item IsNot Nothing Then + SpriteBatch.Draw(p.Item.Texture, New Rectangle(CInt(position.X) + 42, CInt(position.Y) + 36, 24, 24), New Color(255, 255, 255, CInt(255 * _interfaceFade))) + End If + + 'name: + GetFontRenderer().DrawString(FontManager.MiniFont, p.GetDisplayName(), New Vector2(position.X + 78, position.Y + 5), New Color(255, 255, 255, CInt(255 * _interfaceFade))) + + 'Gender symbol: + Select Case p.Gender + Case Pokemon.Genders.Male + SpriteBatch.Draw(_menuTexture, New Rectangle(CInt(position.X + FontManager.MiniFont.MeasureString(p.GetDisplayName()).X + 86), CInt(position.Y + 9), 7, 13), New Rectangle(25, 0, 7, 13), New Color(255, 255, 255, CInt(255 * _interfaceFade))) + Case Pokemon.Genders.Female + SpriteBatch.Draw(_menuTexture, New Rectangle(CInt(position.X + FontManager.MiniFont.MeasureString(p.GetDisplayName()).X + 85), CInt(position.Y + 9), 9, 13), New Rectangle(32, 0, 9, 13), New Color(255, 255, 255, CInt(255 * _interfaceFade))) + End Select + + 'Level: + GetFontRenderer().DrawString(FontManager.MiniFont, _translation.LV_TEXT(p.Level.ToString()), New Vector2(position.X + 4, position.Y + 56), New Color(255, 255, 255, CInt(255 * _interfaceFade))) + + 'HP Bar: + SpriteBatch.Draw(_menuTexture, New Rectangle(CInt(position.X) + 78, CInt(position.Y) + 32, 135, 15), New Rectangle(0, 32, 90, 10), New Color(255, 255, 255, CInt(220 * _interfaceFade))) + '108 pixels: + With p + Dim hpV As Double = .HP / .MaxHP + Dim hpWidth As Integer = CInt((104 * _interfaceFade) * hpV) + Dim hpColorX As Integer = 0 + If hpV < 0.5F Then + hpColorX = 5 + If hpV < 0.1F Then + hpColorX = 10 + End If + End If + If .HP > 0 And hpWidth = 0 Then + hpWidth = 1 + End If + If hpWidth > 0 Then + Dim drawColor As Color = New Color(255, 255, 255, CInt(220 * _interfaceFade)) + + SpriteBatch.Draw(_menuTexture, New Rectangle(CInt(position.X) + 78 + 24, CInt(position.Y) + 35, 2, 8), New Rectangle(hpColorX, 42, 2, 6), drawColor) + + SpriteBatch.Draw(_menuTexture, New Rectangle(CInt(position.X) + 78 + 24 + 2, CInt(position.Y) + 35, hpWidth, 8), New Rectangle(hpColorX + 2, 42, 1, 6), drawColor) + + SpriteBatch.Draw(_menuTexture, New Rectangle(CInt(position.X) + 78 + 24 + 2 + hpWidth, CInt(position.Y) + 35, 2, 8), New Rectangle(hpColorX + 3, 42, 2, 6), drawColor) + End If + End With + + 'HP display: + GetFontRenderer().DrawString(FontManager.MiniFont, p.HP & " / " & p.MaxHP, New Vector2(position.X + 110, position.Y + 50), New Color(255, 255, 255, CInt(255 * _interfaceFade))) + End If + + If _menu.Visible Then + _menu.Draw() + End If + End Sub + + Protected Overrides Function GetFontRenderer() As SpriteBatch + If IsCurrentScreen() And _interfaceFade + 0.01F >= 1.0F Then + Return FontRenderer + Else + Return SpriteBatch + End If + End Function + + Private Function GetBoxPosition(ByVal index As Integer) As Vector2 + Dim position As New Vector2 + + '292 x 76 + Dim halfWidth As Integer = CInt(Core.windowSize.Width / 2) + Dim halfHeight As Integer = CInt(Core.windowSize.Height / 2) + + position.Y = CSng((Math.Floor(index / 2) * 128) + (halfHeight - 200) + 42) + + If index Mod 2 = 0 Then + position.X = halfWidth - 328 + Else + position.X = halfWidth + 36 + End If + + Return position + End Function + + Public Overrides Sub Update() + If _pokemonAnimations.Count > 0 Then + Dim animation As PokemonAnimation = _pokemonAnimations(_index) + If animation._shakeLeft Then + animation._shakeV -= 0.035F + If animation._shakeV <= -0.4F Then + animation._shakeCount -= 1 + animation._shakeLeft = False + End If + Else + animation._shakeV += 0.035F + If animation._shakeV >= 0.4F Then + animation._shakeCount -= 1 + animation._shakeLeft = True + End If + End If + End If + + If _messageDelay > 0F Then + _messageDelay -= 0.1F + If _messageDelay <= 0F Then + _messageDelay = 0F + End If + End If + + If _closing Then + If _interfaceFade > 0F Then + _interfaceFade = MathHelper.Lerp(0, _interfaceFade, 0.8F) + If _interfaceFade < 0F Then + _interfaceFade = 0F + End If + End If + If _enrollY > 0 Then + _enrollY = MathHelper.Lerp(0, _enrollY, 0.8F) + If _enrollY <= 0 Then + _enrollY = 0 + End If + End If + If _enrollY <= 2.0F Then + SetScreen(PreScreen) + End If + Else + Dim maxWindowHeight As Integer = 400 + If _enrollY < maxWindowHeight Then + _enrollY = MathHelper.Lerp(maxWindowHeight, _enrollY, 0.8F) + If _enrollY >= maxWindowHeight Then + _enrollY = maxWindowHeight + End If + End If + If _interfaceFade < 1.0F Then + _interfaceFade = MathHelper.Lerp(1, _interfaceFade, 0.95F) + If _interfaceFade > 1.0F Then + _interfaceFade = 1.0F + End If + End If + + If _menu.Visible Then + _menu.Update() + Else + If Controls.Down(True, True, False, True, True, True) And _index < Core.Player.Pokemons.Count - 2 Then + _index += 2 + _cursorDest = GetBoxPosition(_index) + End If + If Controls.Up(True, True, False, True, True, True) And _index > 1 Then + _index -= 2 + _cursorDest = GetBoxPosition(_index) + End If + If Controls.Left(True) And _index > 0 Then + _index -= 1 + _cursorDest = GetBoxPosition(_index) + End If + If Controls.Right(True) And _index < Core.Player.Pokemons.Count - 1 Then + _index += 1 + _cursorDest = GetBoxPosition(_index) + End If + + Player.Temp.PokemonScreenIndex = _index + + _cursorPosition.X = MathHelper.Lerp(_cursorDest.X, _cursorPosition.X, 0.8F) + _cursorPosition.Y = MathHelper.Lerp(_cursorDest.Y, _cursorPosition.Y, 0.8F) + + If Controls.Accept() Then + If _isSwitching Then + _isSwitching = False + + If _switchIndex <> _index Then + Dim p1 As Pokemon = Core.Player.Pokemons(_switchIndex) + Dim p2 As Pokemon = Core.Player.Pokemons(_index) + + Core.Player.Pokemons(_switchIndex) = p2 + Core.Player.Pokemons(_index) = p1 + End If + Else + _cursorPosition = _cursorDest + CreateMainMenu() + End If + End If + + If Controls.Dismiss() And CanExit Then + If _isSwitching Then + _isSwitching = False + Else + _closing = True + End If + End If + End If + End If + End Sub + + Private Sub CreateMainMenu() + If Mode = ISelectionScreen.ScreenMode.Default Then + CreateNormalMenu(_translation.MENU_SUMMARY) + ElseIf Mode = ISelectionScreen.ScreenMode.Selection + CreateSelectionMenu() + End If + End Sub + + Private Sub CreateSelectionMenu() + Dim items As New List(Of String) + items.Add(_translation.MENU_SELECT) + items.Add(_translation.MENU_SUMMARY) + items.Add(_translation.MENU_BACK) + + _menu = New UI.SelectMenu(items, 0, AddressOf SelectSelectionMenuItem, items.Count - 1) + End Sub + + Private Sub SelectSelectionMenuItem(ByVal selectMenu As UI.SelectMenu) + Select Case selectMenu.SelectedItem + Case _translation.MENU_SELECT + 'When a Pokémon got selected in Selection Mode, raise the selected event and close the screen. + FireSelectionEvent(_index) + _closing = True + Case _translation.MENU_SUMMARY + SetScreen(New SummaryScreen(Me, Core.Player.Pokemons.ToArray(), _index)) + End Select + End Sub + + Private Sub CreateNormalMenu(ByVal selectedItem As String) + Dim p As Pokemon = Core.Player.Pokemons(_index) + + Dim items As New List(Of String) + items.Add(_translation.MENU_SUMMARY) + + If p.IsEgg() = False Then + If CanUseMove(p, "Fly", Badge.HMMoves.Fly) Or + CanUseMove(p, "Ride", Badge.HMMoves.Ride) Or + CanUseMove(p, "Flash", Badge.HMMoves.Flash) Or + CanUseMove(p, "Cut", Badge.HMMoves.Cut) Or + CanUseMove(p, "Teleport", -1) Or + CanUseMove(p, "Dig", -1) Then + + items.Add(_translation.MENU_FIELDMOVE) + End If + End If + + items.Add(_translation.MENU_SWITCH) + + If p.IsEgg() = False Then + items.Add(_translation.MENU_ITEM) + End If + + items.Add(_translation.MENU_BACK) + + _menu = New UI.SelectMenu(items, items.IndexOf(selectedItem), AddressOf SelectedMainMenuItem, items.Count - 1) + End Sub + + Private Sub CreateFieldMoveMenu() + Dim p As Pokemon = Core.Player.Pokemons(_index) + + Dim items As New List(Of String) + If CanUseMove(p, "Fly", Badge.HMMoves.Fly) Then + items.Add(_translation.MENU_FIELDMOVE_FLY) + End If + If CanUseMove(p, "Ride", Badge.HMMoves.Ride) Then + items.Add(_translation.MENU_FIELDMOVE_RIDE) + End If + If CanUseMove(p, "Flash", Badge.HMMoves.Flash) Then + items.Add(_translation.MENU_FIELDMOVE_FLASH) + End If + If CanUseMove(p, "Cut", Badge.HMMoves.Cut) Then + items.Add(_translation.MENU_FIELDMOVE_CUT) + End If + If CanUseMove(p, "Teleport", -1) Then + items.Add(_translation.MENU_FIELDMOVE_TELEPORT) + End If + If CanUseMove(p, "Dig", -1) Then + items.Add(_translation.MENU_FIELDMOVE_DIG) + End If + + items.Add(_translation.MENU_BACK) + + _menu = New UI.SelectMenu(items, 0, AddressOf SelectedFieldMoveMenuItem, items.Count - 1) + End Sub + + Private Sub CreateItemMenu() + Dim p As Pokemon = Core.Player.Pokemons(_index) + + Dim items As New List(Of String) + + items.Add(_translation.MENU_ITEM_GIVE) + If p.Item IsNot Nothing Then + items.Add(_translation.MENU_ITEM_TAKE) + End If + items.Add(_translation.MENU_BACK) + + _menu = New UI.SelectMenu(items, 0, AddressOf SelectedItemMenuItem, items.Count - 1) + End Sub + + Private Function CanUseMove(ByVal p As Pokemon, ByVal moveName As String, ByVal hmMove As Integer) As Boolean + If GameController.IS_DEBUG_ACTIVE Then + Return True + End If + If p.IsEgg() = False Then + If hmMove > -1 Then + If Badge.CanUseHMMove(CType(hmMove, Badge.HMMoves)) = False Then + Return False + End If + + For Each a As BattleSystem.Attack In p.Attacks + If a.Name.ToLower() = moveName.ToLower() Then + Return True + End If + Next + End If + End If + Return False + End Function + + Private Function CanUseMove(ByVal p As Pokemon, ByVal moveName As String, ByVal hmMove As Badge.HMMoves) As Boolean + Return CanUseMove(p, moveName, CInt(hmMove)) + End Function + + Private Sub SelectedMainMenuItem(ByVal selectMenu As UI.SelectMenu) + Select Case selectMenu.SelectedItem + Case _translation.MENU_SUMMARY + SetScreen(New SummaryScreen(Me, Core.Player.Pokemons.ToArray(), _index)) + Case _translation.MENU_FIELDMOVE + CreateFieldMoveMenu() + Case _translation.MENU_SWITCH + _switchIndex = _index + _isSwitching = True + Case _translation.MENU_ITEM + CreateItemMenu() + End Select + End Sub + + Private Sub SelectedFieldMoveMenuItem(ByVal selectMenu As UI.SelectMenu) + Select Case selectMenu.SelectedItem + Case _translation.MENU_FIELDMOVE_FLY + UseFly() + Case _translation.MENU_FIELDMOVE_RIDE + UseRide() + Case _translation.MENU_FIELDMOVE_FLASH + UseFlash() + Case _translation.MENU_FIELDMOVE_CUT + UseCut() + Case _translation.MENU_FIELDMOVE_TELEPORT + UseTeleport() + Case _translation.MENU_FIELDMOVE_DIG + UseDig() + Case _translation.MENU_BACK + CreateNormalMenu(_translation.MENU_FIELDMOVE) + End Select + End Sub + + Private Sub SelectedItemMenuItem(ByVal selectMenu As UI.SelectMenu) + Select Case selectMenu.SelectedItem + Case _translation.MENU_ITEM_GIVE + + '''DO NOTHING LOL + + 'Dim selScreen As New NewInventoryScreen(Core.CurrentScreen) + 'selScreen.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection + 'selScreen.CanExit = True + + 'AddHandler selScreen.SelectedObject, AddressOf GiveItemHandler + + 'Core.SetScreen(selScreen) + Case _translation.MENU_ITEM_TAKE + Dim p As Pokemon = Core.Player.Pokemons(_index) + + If p.Item.IsMail And p.Item.AdditionalData <> "" Then + ShowMessage(_translation.MESSAGE_MAILTAKEN) + + Core.Player.Mails.Add(Items.MailItem.GetMailDataFromString(p.Item.AdditionalData)) + + p.Item = Nothing + Else + ShowMessage(_translation.MESSAGE_ITEMTAKEN(p.Item.Name, p.GetDisplayName())) + + Core.Player.Inventory.AddItem(p.Item.ID, 1) + p.Item = Nothing + End If + Case _translation.MENU_BACK + CreateNormalMenu(_translation.MENU_ITEM) + End Select + End Sub + + ''' + ''' A handler method to convert the incoming object array. + ''' + Private Sub GiveItemHandler(ByVal params As Object()) + GiveItem(CInt(params(0))) + End Sub + + Private Sub GiveItem(ByVal itemID As Integer) + Dim i As Item = Item.GetItemByID(itemID) + + If i.CanBeHold Then + Dim p As Pokemon = Core.Player.Pokemons(_index) + + Core.Player.Inventory.RemoveItem(itemID, 1) + + Dim message As String = "" + + Dim reItem As Item = p.Item + If reItem IsNot Nothing Then + If reItem.IsMail And reItem.AdditionalData <> "" Then + Core.Player.Mails.Add(Items.MailItem.GetMailDataFromString(reItem.AdditionalData)) + + message = _translation.MESSAGE_SWITCH_ITEM_MAIL(i.Name, p.GetDisplayName()) + Else + Core.Player.Inventory.AddItem(reItem.ID, 1) + + message = _translation.MESSAGE_SWITCH_ITEM(p.GetDisplayName(), i.Name, reItem.Name) + End If + Else + message = _translation.MESSAGE_GIVE_ITEM(p.GetDisplayName(), i.Name) + End If + + p.Item = i + + ShowMessage(message) + Else + ShowMessage(_translation.MESSAGE_GIVE_ITEM_ERROR(i.Name)) + End If + End Sub + + Private Sub ShowMessage(ByVal text As String) + _messageDelay = CSng(text.Length / 1.75) + _messageText = text + End Sub + + Public Overrides Sub SizeChanged() + _cursorDest = GetBoxPosition(_index) + _cursorPosition = _cursorDest + End Sub + +#Region "Emblems" + + Private Sub CheckForLegendaryEmblem() + 'This sub checks if Ho-Oh, Lugia and Suicune are in the player's party. + Dim hasHoOh As Boolean = False + Dim hasLugia As Boolean = False + Dim hasSuicune As Boolean = False + + For Each p As Pokemon In Core.Player.Pokemons + Select Case p.Number + Case 245 + hasSuicune = True + Case 249 + hasLugia = True + Case 250 + hasHoOh = True + End Select + Next + + If hasSuicune And hasLugia And hasHoOh Then + GameJolt.Emblem.AchieveEmblem("legendary") + End If + End Sub + + Private Sub CheckForOverkillEmblem() + If Core.Player.Pokemons.Count = 6 Then + Dim has100 As Boolean = True + For i = 0 To 5 + If Core.Player.Pokemons(i).Level < 100 Then + has100 = False + Exit For + End If + Next + If has100 Then + GameJolt.Emblem.AchieveEmblem("overkill") + End If + End If + End Sub + +#End Region + +#Region "Field Moves" + + 'TEMPORARY + Private Sub UseFlash() + ChooseBox.Showing = False + Core.SetScreen(Me.PreScreen) + If Core.CurrentScreen.Identification = Identifications.MenuScreen Then + Core.SetScreen(Core.CurrentScreen.PreScreen) + End If + If Screen.Level.IsDark = True Then + Dim s As String = "version=2" & vbNewLine & + "@text.show(" & Core.Player.Pokemons(_index).GetDisplayName() & " used~Flash!)" & vbNewLine & + "@environment.toggledarkness" & vbNewLine & + "@sound.play(Battle\Effects\effect_thunderbolt)" & vbNewLine & + "@text.show(The area got lit up!)" & vbNewLine & + ":end" + PlayerStatistics.Track("Flash used", 1) + CType(Core.CurrentScreen, OverworldScreen).ActionScript.StartScript(s, 2) + Else + Dim s As String = "version=2" & vbNewLine & + "@text.show(" & Core.Player.Pokemons(_index).GetDisplayName() & " used~Flash!)" & vbNewLine & + "@sound.play(Battle\Effects\effect_thunderbolt)" & vbNewLine & + "@text.show(The area is already~lit up!)" & vbNewLine & + ":end" + CType(Core.CurrentScreen, OverworldScreen).ActionScript.StartScript(s, 2) + End If + End Sub + + Private Sub UseFly() + If Level.CanFly = True Or GameController.IS_DEBUG_ACTIVE = True Or Core.Player.SandBoxMode = True Then + ChooseBox.Showing = False + Core.SetScreen(Me.PreScreen) + If Core.CurrentScreen.Identification = Identifications.MenuScreen Then + Core.SetScreen(Core.CurrentScreen.PreScreen) + End If + + If Screen.Level.CurrentRegion.Contains(",") = True Then + Dim regions As List(Of String) = Screen.Level.CurrentRegion.Split(CChar(",")).ToList() + Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New MapScreen(Core.CurrentScreen, regions, 0, {"Fly", Core.Player.Pokemons(_index)}), Color.White, False)) + Else + Dim startRegion As String = Screen.Level.CurrentRegion + Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New MapScreen(Core.CurrentScreen, startRegion, {"Fly", Core.Player.Pokemons(_index)}), Color.White, False)) + End If + Else + TextBox.Show("You cannot Fly~from here!", {}, True, False) + End If + End Sub + + Private Sub UseCut() + Dim grassEntities = Grass.GetGrassTilesAroundPlayer(2.4F) + If grassEntities.Count > 0 Then + ChooseBox.Showing = False + Core.SetScreen(Me.PreScreen) + If Core.CurrentScreen.Identification = Identifications.MenuScreen Then + Core.SetScreen(Core.CurrentScreen.PreScreen) + End If + + PlayerStatistics.Track("Cut used", 1) + TextBox.Show(Core.Player.Pokemons(_index).GetDisplayName() & "~used Cut!", {}, True, False) + Core.Player.Pokemons(_index).PlayCry() + For Each e As Entity In grassEntities + Screen.Level.Entities.Remove(e) + Next + Else + TextBox.Show("There is nothing~to be Cut!", {}, True, False) + End If + End Sub + + Private Sub UseRide() + If Screen.Level.Riding = True Then + Screen.Level.Riding = False + Screen.Level.OwnPlayer.SetTexture(Core.Player.TempRideSkin, True) + Core.Player.Skin = Core.Player.TempRideSkin + + ChooseBox.Showing = False + Core.SetScreen(Me.PreScreen) + If Core.CurrentScreen.Identification = Identifications.MenuScreen Then + Core.SetScreen(Core.CurrentScreen.PreScreen) + End If + + If Screen.Level.IsRadioOn = False OrElse GameJolt.PokegearScreen.StationCanPlay(Screen.Level.SelectedRadioStation) = False Then + MusicManager.PlayMusic(Level.MusicLoop) + End If + Else + If Screen.Level.Surfing = False And Screen.Camera.IsMoving() = False And Screen.Camera.Turning = False And Level.CanRide() = True Then + ChooseBox.Showing = False + Core.SetScreen(Me.PreScreen) + If Core.CurrentScreen.Identification = Identifications.MenuScreen Then + Core.SetScreen(Core.CurrentScreen.PreScreen) + End If + + Screen.Level.Riding = True + Core.Player.TempRideSkin = Core.Player.Skin + + Dim skin As String = "[POKEMON|" + If Core.Player.Pokemons(_index).IsShiny = True Then + skin &= "S]" + Else + skin &= "N]" + End If + skin &= Core.Player.Pokemons(_index).Number & PokemonForms.GetOverworldAddition(Core.Player.Pokemons(_index)) + + Screen.Level.OwnPlayer.SetTexture(skin, False) + + SoundManager.PlayPokemonCry(Core.Player.Pokemons(_index).Number) + + TextBox.Show(Core.Player.Pokemons(_index).GetDisplayName() & " used~Ride!", {}, True, False) + PlayerStatistics.Track("Ride used", 1) + + If Screen.Level.IsRadioOn = False OrElse GameJolt.PokegearScreen.StationCanPlay(Screen.Level.SelectedRadioStation) = False Then + MusicManager.PlayMusic("ride", True) + End If + Else + TextBox.Show("You cannot Ride here!", {}, True, False) + End If + End If + End Sub + + Private Sub UseDig() + If Screen.Level.CanDig = True Or GameController.IS_DEBUG_ACTIVE = True Or Core.Player.SandBoxMode = True Then + ChooseBox.Showing = False + Core.SetScreen(Me.PreScreen) + If Core.CurrentScreen.Identification = Identifications.MenuScreen Then + Core.SetScreen(Core.CurrentScreen.PreScreen) + End If + + Dim setToFirstPerson As Boolean = Not CType(Screen.Camera, OverworldCamera).ThirdPerson + + Dim s As String = "version=2 +@text.show(" & Core.Player.Pokemons(_index).GetDisplayName() & " used Dig!) +@level.wait(20) +@camera.activatethirdperson +@camera.reset +@camera.fix +@player.turnto(0) +@sound.play(destroy) +:while:>" & (Screen.Camera.Position.Y - 1.4).ToString().ReplaceDecSeparator() & " +@player.turn(1) +@player.warp(~,~-0.1,~) +@level.wait(1) +:endwhile +@screen.fadeout +@camera.defix +@player.warp(" & Core.Player.LastRestPlace & "," & Core.Player.LastRestPlacePosition & ",0)" & vbNewLine & +"@player.turnto(2)" + + If setToFirstPerson = True Then + s &= vbNewLine & "@camera.deactivatethirdperson" + End If + s &= vbNewLine & +"@level.update +@screen.fadein +:end" + + PlayerStatistics.Track("Dig used", 1) + CType(Core.CurrentScreen, OverworldScreen).ActionScript.StartScript(s, 2) + Else + TextBox.Show("Cannot use Dig here.", {}, True, False) + End If + End Sub + + Private Sub UseTeleport() + If Screen.Level.CanTeleport = True Or GameController.IS_DEBUG_ACTIVE = True Or Core.Player.SandBoxMode = True Then + ChooseBox.Showing = False + Core.SetScreen(Me.PreScreen) + If Core.CurrentScreen.Identification = Identifications.MenuScreen Then + Core.SetScreen(Core.CurrentScreen.PreScreen) + End If + + Dim setToFirstPerson As Boolean = Not CType(Screen.Camera, OverworldCamera).ThirdPerson + + Dim yFinish As String = (Screen.Camera.Position.Y + 2.9F).ToString().ReplaceDecSeparator() + + Dim s As String = "version=2 +@text.show(" & Core.Player.Pokemons(_index).GetDisplayName() & "~used Teleport!) +@level.wait(20) +@camera.activatethirdperson +@camera.reset +@camera.fix +@player.turnto(0) +@sound.play(teleport) +:while:<" & yFinish & " +@player.turn(1) +@player.warp(~,~+0.1,~) +@level.wait(1) +:endwhile +@screen.fadeout +@camera.defix +@player.warp(" & Core.Player.LastRestPlace & "," & Core.Player.LastRestPlacePosition & ",0) +@player.turnto(2)" + + If setToFirstPerson = True Then + s &= vbNewLine & "@camera.deactivatethirdperson" + End If + s &= vbNewLine & +"@level.update +@screen.fadein +:end" + + PlayerStatistics.Track("Teleport used", 1) + CType(Core.CurrentScreen, OverworldScreen).ActionScript.StartScript(s, 2) + Else + TextBox.Show("Cannot use Teleport here.", {}, True, False) + End If + End Sub + +#End Region + + Private _mode As ISelectionScreen.ScreenMode = ISelectionScreen.ScreenMode.Default + Private _canExit As Boolean = True + + Public Event SelectedObject(params() As Object) Implements ISelectionScreen.SelectedObject + + Private Sub FireSelectionEvent(ByVal pokemonIndex As Integer) + RaiseEvent SelectedObject(New Object() {pokemonIndex}) + End Sub + + ''' + ''' The current mode of this screen. + ''' + Public Property Mode As ISelectionScreen.ScreenMode Implements ISelectionScreen.Mode + Get + Return _mode + End Get + Set(value As ISelectionScreen.ScreenMode) + _mode = value + End Set + End Property + + ''' + ''' If the user can quit the screen in selection mode without choosing an item. + ''' + Public Property CanExit As Boolean Implements ISelectionScreen.CanExit + Get + Return _canExit + End Get + Set(value As Boolean) + _canExit = value + End Set + End Property + +End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/Pokemon/PokemonScreen.vb b/2.5DHero/2.5DHero/Screens/Pokemon/PokemonScreen.vb index 8e6c6c943..b93fa846b 100644 --- a/2.5DHero/2.5DHero/Screens/Pokemon/PokemonScreen.vb +++ b/2.5DHero/2.5DHero/Screens/Pokemon/PokemonScreen.vb @@ -2,7 +2,7 @@ Inherits Screen - Dim index As Integer = 0 + Dim _index As Integer = 0 Dim MainTexture As Texture2D Dim yOffset As Single = 0 Dim MenuID As Integer = 0 @@ -14,7 +14,7 @@ Me.PreScreen = currentScreen MainTexture = TextureManager.GetTexture("GUI\Menus\Menu") - Me.index = PokeIndex + Me._index = PokeIndex If Core.Player.Pokemons.Count = 6 Then Dim has100 As Boolean = True @@ -39,9 +39,9 @@ Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(60, 100, 800, 480)) Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(60, 100, 480, 64)) - Core.SpriteBatch.DrawString(FontManager.InGameFont, Localization.GetString("pokemon_screen_choose_a_pokemon"), New Vector2(142, 132), Color.Black) + Core.SpriteBatch.DrawString(FontManager.InGameFont, OldLocalization.GetString("pokemon_screen_choose_a_pokemon"), New Vector2(142, 132), Color.Black) Core.SpriteBatch.Draw(MainTexture, New Rectangle(78, 124, 48, 48), New Rectangle(96, 16, 18, 18), Color.White) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("pokemon_screen_backadvice"), New Vector2(1200 - FontManager.MiniFont.MeasureString(Localization.GetString("pokemon_screen_backadvice")).X - 330, 580), Color.DarkGray) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("pokemon_screen_backadvice"), New Vector2(1200 - FontManager.MiniFont.MeasureString(OldLocalization.GetString("pokemon_screen_backadvice")).X - 330, 580), Color.DarkGray) For i = 0 To Core.Player.Pokemons.Count - 1 DrawPokemonTile(i, Core.Player.Pokemons(i)) @@ -54,7 +54,7 @@ If ChooseBox.Showing = True Then Dim Position As New Vector2(0, 0) - Select Case Me.index + Select Case Me._index Case 0, 2, 4 Position = New Vector2(606, 566 - ChooseBox.Options.Count * 48) Case 1, 3, 5 @@ -102,16 +102,15 @@ Select Case MenuID Case 0 Select Case ChooseBox.Options(ChooseBox.index) - Case Localization.GetString("pokemon_screen_summary") + Case OldLocalization.GetString("pokemon_screen_summary") ChooseBox.Showing = False - Core.SetScreen(New PokemonStatusScreen(Me, index, {}, Core.Player.Pokemons(index), True)) - Case Localization.GetString("pokemon_screen_switch") - switchIndex = index + Case OldLocalization.GetString("pokemon_screen_switch") + switchIndex = _index ChooseBox.Showing = False - Case Localization.GetString("pokemon_screen_item") - ChooseBox.Show({Localization.GetString("pokemon_screen_item_give"), Localization.GetString("pokemon_screen_item_take"), Localization.GetString("pokemon_screen_item_back")}, 0, {}) + Case OldLocalization.GetString("pokemon_screen_item") + ChooseBox.Show({OldLocalization.GetString("pokemon_screen_item_give"), OldLocalization.GetString("pokemon_screen_item_take"), OldLocalization.GetString("pokemon_screen_item_back")}, 0, {}) Me.MenuID = 1 - Case Localization.GetString("pokemon_screen_back") + Case OldLocalization.GetString("pokemon_screen_back") ChooseBox.Showing = False Case "Flash" Me.UseFlash() @@ -141,10 +140,10 @@ ShowMenu() Else Dim p1 As Pokemon = Core.Player.Pokemons(switchIndex) - Dim p2 As Pokemon = Core.Player.Pokemons(index) + Dim p2 As Pokemon = Core.Player.Pokemons(_index) Core.Player.Pokemons(switchIndex) = p2 - Core.Player.Pokemons(index) = p1 + Core.Player.Pokemons(_index) = p1 switchIndex = -1 Screen.Level.OverworldPokemon.ForceTextureChange() @@ -156,28 +155,28 @@ End Sub Private Sub TakeItem() - If Core.Player.Pokemons(index).IsEgg() = False Then - If Core.Player.Pokemons(index).Item Is Nothing Then - TextBox.Show(Core.Player.Pokemons(index).GetDisplayName() & Localization.GetString("pokemon_screen_doesnt_hold_item"), {}) + If Core.Player.Pokemons(_index).IsEgg() = False Then + If Core.Player.Pokemons(_index).Item Is Nothing Then + TextBox.Show(Core.Player.Pokemons(_index).GetDisplayName() & OldLocalization.GetString("pokemon_screen_doesnt_hold_item"), {}) Else - If Core.Player.Pokemons(index).Item.AdditionalData <> "" Then + If Core.Player.Pokemons(_index).Item.AdditionalData <> "" Then TextBox.Show("The Mail was taken~to your inbox on~your PC. You can view~the content there.", {}, False, False) - Dim i As Item = Core.Player.Pokemons(index).Item - Core.Player.Pokemons(index).Item = Nothing + Dim i As Item = Core.Player.Pokemons(_index).Item + Core.Player.Pokemons(_index).Item = Nothing Core.Player.Mails.Add(Items.MailItem.GetMailDataFromString(i.AdditionalData)) Me.MenuID = 0 ChooseBox.Showing = False Else - Dim i As Item = Core.Player.Pokemons(index).Item + Dim i As Item = Core.Player.Pokemons(_index).Item Core.Player.Inventory.AddItem(i.ID, 1) - Core.Player.Pokemons(index).Item = Nothing + Core.Player.Pokemons(_index).Item = Nothing TextBox.TextColor = TextBox.PlayerColor - TextBox.Show(" took the~item from " & Core.Player.Pokemons(index).GetDisplayName() & "!*" & Core.Player.Inventory.GetMessageReceive(i, 1)) + TextBox.Show(" took the~item from " & Core.Player.Pokemons(_index).GetDisplayName() & "!*" & Core.Player.Inventory.GetMessageReceive(i, 1)) Me.MenuID = 0 ChooseBox.Showing = False @@ -190,7 +189,7 @@ Private Sub GiveItem(ByVal ItemID As Integer) Dim Item As Item = Item.GetItemByID(ItemID) - Dim Pokemon As Pokemon = Core.Player.Pokemons(index) + Dim Pokemon As Pokemon = Core.Player.Pokemons(_index) If Pokemon.IsEgg() = False Then If Item.CanBeHold = True Then @@ -210,10 +209,10 @@ TextBox.reDelay = 0.0F - Dim t As String = Localization.GetString("pokemon_screen_give_item_1") & Item.Name & Localization.GetString("pokemon_screen_give_item_2") & Pokemon.GetDisplayName() & Localization.GetString("pokemon_screen_give_item_3") + Dim t As String = OldLocalization.GetString("pokemon_screen_give_item_1") & Item.Name & OldLocalization.GetString("pokemon_screen_give_item_2") & Pokemon.GetDisplayName() & OldLocalization.GetString("pokemon_screen_give_item_3") If Not reItem Is Nothing Then If reItem.AdditionalData = "" Then - t &= Localization.GetString("pokemon_screen_give_item_4") & reItem.Name & Localization.GetString("pokemon_screen_give_item_5") + t &= OldLocalization.GetString("pokemon_screen_give_item_4") & reItem.Name & OldLocalization.GetString("pokemon_screen_give_item_5") Else t &= "*The Mail was taken~to your inbox on~your PC. You can view~the content there." End If @@ -252,34 +251,34 @@ Private Sub ShowMenu() Me.MenuID = 0 - ChooseBox.Show({Localization.GetString("pokemon_screen_summary"), Localization.GetString("pokemon_screen_switch"), Localization.GetString("pokemon_screen_item"), Localization.GetString("pokemon_screen_back")}, 0, {}) + ChooseBox.Show({OldLocalization.GetString("pokemon_screen_summary"), OldLocalization.GetString("pokemon_screen_switch"), OldLocalization.GetString("pokemon_screen_item"), OldLocalization.GetString("pokemon_screen_back")}, 0, {}) - If (PokemonHasMove(Core.Player.Pokemons(index), "Cut") = True And Badge.CanUseHMMove(Badge.HMMoves.Cut) = True And Core.Player.Pokemons(index).IsEgg() = False) OrElse GameController.IS_DEBUG_ACTIVE = True OrElse Core.Player.SandBoxMode Then + If (PokemonHasMove(Core.Player.Pokemons(_index), "Cut") = True And Badge.CanUseHMMove(Badge.HMMoves.Cut) = True And Core.Player.Pokemons(_index).IsEgg() = False) OrElse GameController.IS_DEBUG_ACTIVE = True OrElse Core.Player.SandBoxMode Then Dim options As List(Of String) = ChooseBox.Options.ToList() options.Insert(1, "Cut") ChooseBox.Options = options.ToArray() End If - If (PokemonHasMove(Core.Player.Pokemons(index), "Flash") = True And Badge.CanUseHMMove(Badge.HMMoves.Flash) = True And Core.Player.Pokemons(index).IsEgg() = False) OrElse GameController.IS_DEBUG_ACTIVE = True OrElse Core.Player.SandBoxMode Then + If (PokemonHasMove(Core.Player.Pokemons(_index), "Flash") = True And Badge.CanUseHMMove(Badge.HMMoves.Flash) = True And Core.Player.Pokemons(_index).IsEgg() = False) OrElse GameController.IS_DEBUG_ACTIVE = True OrElse Core.Player.SandBoxMode Then Dim options As List(Of String) = ChooseBox.Options.ToList() options.Insert(1, "Flash") ChooseBox.Options = options.ToArray() End If - If (PokemonHasMove(Core.Player.Pokemons(index), "Ride") = True And Badge.CanUseHMMove(Badge.HMMoves.Ride) = True And Core.Player.Pokemons(index).IsEgg() = False) OrElse GameController.IS_DEBUG_ACTIVE = True OrElse Core.Player.SandBoxMode Then + If (PokemonHasMove(Core.Player.Pokemons(_index), "Ride") = True And Badge.CanUseHMMove(Badge.HMMoves.Ride) = True And Core.Player.Pokemons(_index).IsEgg() = False) OrElse GameController.IS_DEBUG_ACTIVE = True OrElse Core.Player.SandBoxMode Then Dim options As List(Of String) = ChooseBox.Options.ToList() options.Insert(1, "Ride") ChooseBox.Options = options.ToArray() End If - If (PokemonHasMove(Core.Player.Pokemons(index), "Dig") = True And Core.Player.Pokemons(index).IsEgg() = False) OrElse GameController.IS_DEBUG_ACTIVE = True OrElse Core.Player.SandBoxMode Then + If (PokemonHasMove(Core.Player.Pokemons(_index), "Dig") = True And Core.Player.Pokemons(_index).IsEgg() = False) OrElse GameController.IS_DEBUG_ACTIVE = True OrElse Core.Player.SandBoxMode Then Dim options As List(Of String) = ChooseBox.Options.ToList() options.Insert(1, "Dig") ChooseBox.Options = options.ToArray() End If - If (PokemonHasMove(Core.Player.Pokemons(index), "Teleport") = True And Core.Player.Pokemons(index).IsEgg() = False) OrElse GameController.IS_DEBUG_ACTIVE = True OrElse Core.Player.SandBoxMode Then + If (PokemonHasMove(Core.Player.Pokemons(_index), "Teleport") = True And Core.Player.Pokemons(_index).IsEgg() = False) OrElse GameController.IS_DEBUG_ACTIVE = True OrElse Core.Player.SandBoxMode Then Dim options As List(Of String) = ChooseBox.Options.ToList() options.Insert(1, "Teleport") ChooseBox.Options = options.ToArray() End If - If (PokemonHasMove(Core.Player.Pokemons(index), "Fly") = True And Badge.CanUseHMMove(Badge.HMMoves.Fly) = True And Core.Player.Pokemons(index).IsEgg() = False) OrElse GameController.IS_DEBUG_ACTIVE = True OrElse Core.Player.SandBoxMode Then + If (PokemonHasMove(Core.Player.Pokemons(_index), "Fly") = True And Badge.CanUseHMMove(Badge.HMMoves.Fly) = True And Core.Player.Pokemons(_index).IsEgg() = False) OrElse GameController.IS_DEBUG_ACTIVE = True OrElse Core.Player.SandBoxMode Then Dim options As List(Of String) = ChooseBox.Options.ToList() options.Insert(1, "Fly") ChooseBox.Options = options.ToArray() @@ -288,31 +287,31 @@ Private Sub NavigateMain() If Controls.Right(True, False) Then - index += 1 + _index += 1 End If If Controls.Left(True, False) Then - index -= 1 + _index -= 1 End If If Controls.Down(True, False, False) Then - index += 2 + _index += 2 End If If Controls.Up(True, False, False) Then - index -= 2 + _index -= 2 End If If KeyBoardHandler.KeyPressed(Keys.End) = True Then - index = 5 + _index = 5 End If If KeyBoardHandler.KeyPressed(Keys.Home) = True Then - index = 0 + _index = 0 End If - If index < 0 Then - index = 0 - ElseIf index > Core.Player.Pokemons.Count - 1 Then - index = Core.Player.Pokemons.Count - 1 + If _index < 0 Then + _index = 0 + ElseIf _index > Core.Player.Pokemons.Count - 1 Then + _index = Core.Player.Pokemons.Count - 1 End If - Player.Temp.PokemonScreenIndex = Me.index + Player.Temp.PokemonScreenIndex = Me._index End Sub Private Sub DrawEmptyTile(ByVal i As Integer) @@ -336,13 +335,13 @@ Next .Draw(BorderTexture, New Rectangle(CInt(p.X) + 320, CInt(p.Y), 32, 96), New Rectangle(32, 0, 16, 48), Color.White) - .DrawString(FontManager.MiniFont, Localization.GetString("pokemon_screen_EMPTY"), New Vector2(CInt(p.X + 72), CInt(p.Y + 18)), Color.Black) + .DrawString(FontManager.MiniFont, OldLocalization.GetString("pokemon_screen_EMPTY"), New Vector2(CInt(p.X + 72), CInt(p.Y + 18)), Color.Black) End With End Sub Private Sub DrawPokemonTile(ByVal i As Integer, ByVal Pokemon As Pokemon) Dim BorderTexture As Texture2D - If i = index Then + If i = _index Then If Pokemon.Status = net.Pokemon3D.Game.Pokemon.StatusProblems.Fainted Then BorderTexture = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 128, 48, 48), "") Else @@ -403,7 +402,7 @@ End If Dim offset As Single = CSng(Math.Sin(yOffset)) - If i = index Then + If i = _index Then offset *= 3 End If If Pokemon.Status = net.Pokemon3D.Game.Pokemon.StatusProblems.Fainted Then @@ -433,7 +432,7 @@ Next If Pokemon.IsEgg() = False Then - .DrawString(FontManager.MiniFont, Localization.GetString("Lv.") & space & Pokemon.Level, New Vector2(CInt(p.X + 14), CInt(p.Y + 64)), Color.Black) + .DrawString(FontManager.MiniFont, OldLocalization.GetString("Lv.") & space & Pokemon.Level, New Vector2(CInt(p.X + 14), CInt(p.Y + 64)), Color.Black) End If Dim StatusTexture As Texture2D = BattleStats.GetStatImage(Pokemon.Status) @@ -446,7 +445,7 @@ End Sub Public Overrides Sub ChangeTo() - Me.index = Player.Temp.PokemonScreenIndex + Me._index = Player.Temp.PokemonScreenIndex End Sub Private Function PokemonHasMove(ByVal p As Pokemon, ByVal moveName As String) As Boolean @@ -470,7 +469,7 @@ End If If Screen.Level.IsDark = True Then Dim s As String = "version=2" & vbNewLine & - "@text.show(" & Core.Player.Pokemons(index).GetDisplayName() & " used~Flash!)" & vbNewLine & + "@text.show(" & Core.Player.Pokemons(_index).GetDisplayName() & " used~Flash!)" & vbNewLine & "@environment.toggledarkness" & vbNewLine & "@sound.play(Battle\Effects\effect_thunderbolt)" & vbNewLine & "@text.show(The area got lit up!)" & vbNewLine & @@ -479,7 +478,7 @@ CType(Core.CurrentScreen, OverworldScreen).ActionScript.StartScript(s, 2) Else Dim s As String = "version=2" & vbNewLine & - "@text.show(" & Core.Player.Pokemons(index).GetDisplayName() & " used~Flash!)" & vbNewLine & + "@text.show(" & Core.Player.Pokemons(_index).GetDisplayName() & " used~Flash!)" & vbNewLine & "@sound.play(Battle\Effects\effect_thunderbolt)" & vbNewLine & "@text.show(The area is already~lit up!)" & vbNewLine & ":end" @@ -497,10 +496,10 @@ If Screen.Level.CurrentRegion.Contains(",") = True Then Dim regions As List(Of String) = Screen.Level.CurrentRegion.Split(CChar(",")).ToList() - Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New MapScreen(Core.CurrentScreen, regions, 0, {"Fly", Core.Player.Pokemons(index)}), Color.White, False)) + Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New MapScreen(Core.CurrentScreen, regions, 0, {"Fly", Core.Player.Pokemons(_index)}), Color.White, False)) Else Dim startRegion As String = Screen.Level.CurrentRegion - Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New MapScreen(Core.CurrentScreen, startRegion, {"Fly", Core.Player.Pokemons(index)}), Color.White, False)) + Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New MapScreen(Core.CurrentScreen, startRegion, {"Fly", Core.Player.Pokemons(_index)}), Color.White, False)) End If Else TextBox.Show("You cannot Fly~from here!", {}, True, False) @@ -517,8 +516,8 @@ End If PlayerStatistics.Track("Cut used", 1) - TextBox.Show(Core.Player.Pokemons(index).GetDisplayName() & "~used Cut!", {}, True, False) - Core.Player.Pokemons(index).PlayCry() + TextBox.Show(Core.Player.Pokemons(_index).GetDisplayName() & "~used Cut!", {}, True, False) + Core.Player.Pokemons(_index).PlayCry() For Each e As Entity In grassEntities Screen.Level.Entities.Remove(e) Next @@ -554,18 +553,18 @@ Core.Player.TempRideSkin = Core.Player.Skin Dim skin As String = "[POKEMON|" - If Core.Player.Pokemons(index).IsShiny = True Then + If Core.Player.Pokemons(_index).IsShiny = True Then skin &= "S]" Else skin &= "N]" End If - skin &= Core.Player.Pokemons(index).Number & PokemonForms.GetOverworldAddition(Core.Player.Pokemons(index)) + skin &= Core.Player.Pokemons(_index).Number & PokemonForms.GetOverworldAddition(Core.Player.Pokemons(_index)) Screen.Level.OwnPlayer.SetTexture(skin, False) - SoundManager.PlayPokemonCry(Core.Player.Pokemons(index).Number) + SoundManager.PlayPokemonCry(Core.Player.Pokemons(_index).Number) - TextBox.Show(Core.Player.Pokemons(index).GetDisplayName() & " used~Ride!", {}, True, False) + TextBox.Show(Core.Player.Pokemons(_index).GetDisplayName() & " used~Ride!", {}, True, False) PlayerStatistics.Track("Ride used", 1) If Screen.Level.IsRadioOn = False OrElse GameJolt.PokegearScreen.StationCanPlay(Screen.Level.SelectedRadioStation) = False Then @@ -588,7 +587,7 @@ Dim setToFirstPerson As Boolean = Not CType(Screen.Camera, OverworldCamera).ThirdPerson Dim s As String = "version=2 -@text.show(" & Core.Player.Pokemons(index).GetDisplayName() & " used Dig!) +@text.show(" & Core.Player.Pokemons(_index).GetDisplayName() & " used Dig!) @level.wait(20) @camera.activatethirdperson @camera.reset @@ -633,7 +632,7 @@ Dim yFinish As String = (Screen.Camera.Position.Y + 2.9F).ToString().ReplaceDecSeparator() Dim s As String = "version=2 -@text.show(" & Core.Player.Pokemons(index).GetDisplayName() & "~used Teleport!) +@text.show(" & Core.Player.Pokemons(_index).GetDisplayName() & "~used Teleport!) @level.wait(20) @camera.activatethirdperson @camera.reset diff --git a/2.5DHero/2.5DHero/Screens/Pokemon/PokemonStatusScreen.vb b/2.5DHero/2.5DHero/Screens/Pokemon/PokemonStatusScreen.vb index 0d8c49cba..a9ff5fad9 100644 --- a/2.5DHero/2.5DHero/Screens/Pokemon/PokemonStatusScreen.vb +++ b/2.5DHero/2.5DHero/Screens/Pokemon/PokemonStatusScreen.vb @@ -169,26 +169,26 @@ If Me.Pokemon.EggSteps = 0 Then DrawPage1() End If - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("poke_status_screen_stats_page"), New Vector2(676, 138), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("poke_status_screen_stats_page"), New Vector2(676, 138), Color.Black) TexturePositionPage = New Vector2(32, 96) Case 1 DrawPage2() - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("poke_status_screen_details_page"), New Vector2(676, 138), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("poke_status_screen_details_page"), New Vector2(676, 138), Color.Black) TexturePositionPage = New Vector2(32, 112) Case 2 If Me.Pokemon.EggSteps = 0 Then DrawPage3() End If - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("poke_status_screen_moves_page"), New Vector2(676, 138), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("poke_status_screen_moves_page"), New Vector2(676, 138), Color.Black) TexturePositionPage = New Vector2(80, 96) End Select Core.SpriteBatch.Draw(MainTexture, New Rectangle(574, 132, 96, 32), New Rectangle(CInt(TexturePositionPage.X), CInt(TexturePositionPage.Y), 48, 16), Color.White) If Me.AttackToggle = False Then - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("poke_status_screen_backadvice"), New Vector2(1200 - FontManager.MiniFont.MeasureString(Localization.GetString("poke_status_screen_backadvice")).X - 360, 580), Color.DarkGray) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("poke_status_screen_backadvice"), New Vector2(1200 - FontManager.MiniFont.MeasureString(OldLocalization.GetString("poke_status_screen_backadvice")).X - 360, 580), Color.DarkGray) Else - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("poke_status_screen_closeadvice"), New Vector2(1200 - FontManager.MiniFont.MeasureString(Localization.GetString("poke_status_screen_closeadvice")).X - 360, 580), Color.DarkGray) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("poke_status_screen_closeadvice"), New Vector2(1200 - FontManager.MiniFont.MeasureString(OldLocalization.GetString("poke_status_screen_closeadvice")).X - 360, 580), Color.DarkGray) End If End Sub @@ -265,7 +265,7 @@ Core.SpriteBatch.Draw(MainTexture, New Rectangle(180, 376, 12, 20), r, Color.White) End If - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("Level") & ": " & Me.Pokemon.Level & vbNewLine & Localization.GetString("poke_status_screen_number") & Pokemon.Number & vbNewLine & vbNewLine & Localization.GetString("poke_status_screen_nature") & ":" & vbNewLine & Me.Pokemon.Nature.ToString(), New Vector2(76, 410), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("Level") & ": " & Me.Pokemon.Level & vbNewLine & OldLocalization.GetString("poke_status_screen_number") & Pokemon.Number & vbNewLine & vbNewLine & OldLocalization.GetString("poke_status_screen_nature") & ":" & vbNewLine & Me.Pokemon.Nature.ToString(), New Vector2(76, 410), Color.Black) Dim StatusTexture As Texture2D = BattleStats.GetStatImage(Pokemon.Status) If Not StatusTexture Is Nothing Then @@ -310,25 +310,25 @@ Dim redText As String = vbNewLine & vbNewLine Dim blueText As String = vbNewLine & vbNewLine - Dim blackText As String = Localization.GetString("HP") & vbNewLine & vbNewLine + Dim blackText As String = OldLocalization.GetString("HP") & vbNewLine & vbNewLine For i = 0 To 4 Dim statText As String = "" Dim stat As String = "" Select Case i Case 0 - statText = Localization.GetString("Attack") + statText = OldLocalization.GetString("Attack") stat = "Attack" Case 1 - statText = Localization.GetString("Defense") + statText = OldLocalization.GetString("Defense") stat = "Defense" Case 2 - statText = Localization.GetString("Special_Attack") + statText = OldLocalization.GetString("Special_Attack") stat = "SpAttack" Case 3 - statText = Localization.GetString("Special_Defense") + statText = OldLocalization.GetString("Special_Defense") stat = "SpDefense" Case 4 - statText = Localization.GetString("Speed") + statText = OldLocalization.GetString("Speed") stat = "Speed" End Select @@ -373,7 +373,7 @@ barX = CInt((currentExp / NextLvExp) * 150).Clamp(0, 150) End If - .DrawString(FontManager.MiniFont, Localization.GetString("poke_status_screen_all_exp") & ": " & Pokemon.Experience & vbNewLine & Localization.GetString("poke_status_screen_nxt_lv") & ": " & NextLvExp - currentExp, New Vector2(240, 504), Color.Black) + .DrawString(FontManager.MiniFont, OldLocalization.GetString("poke_status_screen_all_exp") & ": " & Pokemon.Experience & vbNewLine & OldLocalization.GetString("poke_status_screen_nxt_lv") & ": " & NextLvExp - currentExp, New Vector2(240, 504), Color.Black) Dim i As Integer = 0 For x = 0 To barX - 1 @@ -407,7 +407,7 @@ ' Capture Information: Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(220, 196, 320, 96)) With Core.SpriteBatch - .DrawString(FontManager.MiniFont, Localization.GetString("poke_status_screen_OT") & ": " & Pokemon.OT & " /" & Pokemon.CatchTrainerName & vbNewLine & vbNewLine & Pokemon.CatchMethod & vbNewLine & Pokemon.CatchLocation, New Vector2(238, 214), Color.DarkBlue) + .DrawString(FontManager.MiniFont, OldLocalization.GetString("poke_status_screen_OT") & ": " & Pokemon.OT & " /" & Pokemon.CatchTrainerName & vbNewLine & vbNewLine & Pokemon.CatchMethod & vbNewLine & Pokemon.CatchLocation, New Vector2(238, 214), Color.DarkBlue) End With ' Item: @@ -415,10 +415,10 @@ If Me.Pokemon.EggSteps = 0 Then If Not Pokemon.Item Is Nothing Then Core.SpriteBatch.Draw(Pokemon.Item.Texture, New Rectangle(232, 338, 24, 24), Color.White) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("poke_status_screen_Item") & ": " & Pokemon.Item.Name, New Vector2(262, 342), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("poke_status_screen_Item") & ": " & Pokemon.Item.Name, New Vector2(262, 342), Color.Black) Core.SpriteBatch.DrawString(FontManager.MiniFont, Pokemon.Item.Description.CropStringToWidth(FontManager.MiniFont, 300), New Vector2(234, 360), Color.Black) Else - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("poke_status_screen_Item") & ": " & Localization.GetString("poke_status_screen_no_item"), New Vector2(262, 342), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("poke_status_screen_Item") & ": " & OldLocalization.GetString("poke_status_screen_no_item"), New Vector2(262, 342), Color.Black) End If End If @@ -426,7 +426,7 @@ Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(220, 484, 320, 96)) If Me.Pokemon.EggSteps = 0 Then With Core.SpriteBatch - .DrawString(FontManager.MiniFont, Localization.GetString("poke_status_screen_ability") & ": " & Me.Pokemon.Ability.Name & vbNewLine & vbNewLine & Me.Pokemon.Ability.Description.CropStringToWidth(FontManager.MiniFont, 300), New Vector2(234, 500), Color.Black) + .DrawString(FontManager.MiniFont, OldLocalization.GetString("poke_status_screen_ability") & ": " & Me.Pokemon.Ability.Name & vbNewLine & vbNewLine & Me.Pokemon.Ability.Description.CropStringToWidth(FontManager.MiniFont, 300), New Vector2(234, 500), Color.Black) End With Else With Core.SpriteBatch @@ -485,7 +485,7 @@ acc = "-" End If - .DrawString(FontManager.MiniFont, Localization.GetString("poke_status_screen_power") & ": " & power & vbNewLine & Localization.GetString("poke_status_screen_accuracy") & ": " & acc & vbNewLine & vbNewLine & t, New Vector2(CInt(572 - 300 + AttackPos), 218), Color.Black) + .DrawString(FontManager.MiniFont, OldLocalization.GetString("poke_status_screen_power") & ": " & power & vbNewLine & OldLocalization.GetString("poke_status_screen_accuracy") & ": " & acc & vbNewLine & vbNewLine & t, New Vector2(CInt(572 - 300 + AttackPos), 218), Color.Black) .Draw(A.GetDamageCategoryImage(), New Rectangle(CInt(572 - 150 + AttackPos), 222, 56, 28), Color.White) End With @@ -523,7 +523,7 @@ c = Color.IndianRed End If - .DrawString(FontManager.MiniFont, Localization.GetString("PP") & " " & A.CurrentPP & " / " & A.MaxPP, New Vector2(400, CInt(p.Y + 58)), c) + .DrawString(FontManager.MiniFont, OldLocalization.GetString("PP") & " " & A.CurrentPP & " / " & A.MaxPP, New Vector2(400, CInt(p.Y + 58)), c) .Draw(TextureManager.GetTexture("GUI\Menus\Types", A.Type.GetElementImage(), ""), New Rectangle(270, CInt(p.Y + 54), 48, 16), Color.White) End With diff --git a/2.5DHero/2.5DHero/Screens/Pokemon/SummaryScreen.vb b/2.5DHero/2.5DHero/Screens/Pokemon/SummaryScreen.vb new file mode 100644 index 000000000..8e929dbe8 --- /dev/null +++ b/2.5DHero/2.5DHero/Screens/Pokemon/SummaryScreen.vb @@ -0,0 +1,792 @@ +Public Class SummaryScreen + + Inherits Screen + + Private _party As Pokemon() + + Private _pageIndex As Integer = 0 + Private _partyIndex As Integer = -1 + Private _selectedPokemon As Pokemon = Nothing + + Private _texture As Texture2D + + 'Pointer + Private _pointerDest As Integer = 0 + Private _pointerPos As Single = 0F + + 'Fade in animation: + Private _fadeIn As Single = 0F + Private _interfaceFade As Single = 0F + + 'Pixel animation: + Private _pixelFade As Single = 0F + Private pixeledPokemonTexture As Texture2D + + 'Enroll animation: + Private _enrollY As Single = 0F + + Private _closing As Boolean = False + + 'Y offset for Pokémon draw: + Dim _yOffset As Integer = 0 + + 'Page animation: + Private _pageFade As Single = 1.0F + Private _pageClosing As Boolean = False + Private _pageOpening As Boolean = False + + 'Move display: + Private _moveIndex As Integer = 0 + Private _moveSelected As Boolean = False + Private _moveFade As Single = 0F + Private _moveSelectionFade As Single = 0F + Private _moveSelectorPosition As Single = 0F + + 'Move switching: + Private _switchingMoves As Boolean = False + Private _switchMoveIndex As Integer = -1 + + Public Sub New(ByVal currentScreen As Screen, ByVal party As Pokemon(), ByVal partyIndex As Integer) + PreScreen = currentScreen + Identification = Identifications.SummaryScreen + + _texture = TextureManager.GetTexture("GUI\Menus\General") + + _pageIndex = Player.Temp.PokemonScreenIndex + _partyIndex = partyIndex + _party = party + + SetPointerDest(_partyIndex) + GetYOffset() + _pointerPos = _pointerDest + _moveSelectorPosition = GetMoveSelectorDest(_moveIndex) + End Sub + + Public Sub New(ByVal currentScreen As Screen, ByVal selectedPokemon As Pokemon) + PreScreen = currentScreen + Identification = Identifications.SummaryScreen + + _texture = TextureManager.GetTexture("GUI\Menus\General") + + _pageIndex = Player.Temp.PokemonScreenIndex + _selectedPokemon = selectedPokemon + + SetPointerDest(_partyIndex) + GetYOffset() + _pointerPos = _pointerDest + _moveSelectorPosition = GetMoveSelectorDest(_moveIndex) + End Sub + + Private Function GetMoveSelectorDest(ByVal moveIndex As Integer) As Single + Return 172 + moveIndex * 96 + End Function + + Public Overrides Sub Draw() + PreScreen.Draw() + + DrawGradients(CInt(255 * _interfaceFade)) + + DrawMain() + + If GetPokemon().IsEgg() = False Then + Select Case _pageIndex + Case 0 + DrawPage1() + Case 1 + DrawPage2() + End Select + Else + DrawEgg() + End If + End Sub + + Public Overrides Sub Render() + + _pixelFade = 1 'Remove when pixel fading effect is properly implemented. + + Dim pixelSize As Integer = CInt(256 * _pixelFade).Clamp(16, 256) + If pixelSize = 256 Or Core.GraphicsManager.IsFullScreen = True Then + pixeledPokemonTexture = GetPokemon().GetTexture(True) + Else + Dim pixeled As New RenderTarget2D(GraphicsDevice, pixelSize, pixelSize, False, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents) + GraphicsDevice.SetRenderTarget(pixeled) + GraphicsDevice.Clear(Color.Transparent) + Dim s As New SpriteBatch(GraphicsDevice) + s.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise) + s.Draw(GetPokemon().GetTexture(True), New Rectangle(0, 0, pixelSize, pixelSize), Color.White) + s.End() + + Dim dePixeled As New RenderTarget2D(GraphicsDevice, 256, 256, False, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents) + GraphicsDevice.SetRenderTarget(dePixeled) + GraphicsDevice.Clear(Color.Transparent) + s = New SpriteBatch(GraphicsDevice) + s.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise) + s.Draw(pixeled, New Rectangle(0, 0, 256, 256), Color.White) + s.End() + pixeledPokemonTexture = dePixeled + + GraphicsDevice.SetRenderTarget(Nothing) + End If + End Sub + + Private Sub DrawMain() + 'Draw pointer and team: + Dim mainBackgroundColor As Color = Color.White + If _closing = True Then + mainBackgroundColor = New Color(255, 255, 255, CInt(255 * _interfaceFade)) + End If + + If _partyIndex > -1 Then + For i = 0 To _party.Count - 1 + Dim pokemonPos As Double = GetPointerDest(i) - 16 + + Core.SpriteBatch.Draw(_party(i).GetMenuTexture(), New Rectangle(CInt(pokemonPos), 16, 64, 64), mainBackgroundColor) + Next + + SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\PokemonInfo"), New Rectangle(CInt(_pointerPos), 80, 32, 16), New Rectangle(0, 16, 32, 16), mainBackgroundColor) + End If + + Dim onePixelLineColor As Color = New Color(84, 198, 216) + If _closing = True Then + onePixelLineColor.A = CByte(255 * _interfaceFade) + End If + + Canvas.DrawRectangle(New Rectangle(50, 96, CInt(Math.Ceiling((Core.windowSize.Width - 100) / 16) * 16), 1), onePixelLineColor) + + 'Draw background: + Dim t As Texture2D = TextureManager.GetTexture("GUI\Menus\PokemonInfo") + + For y = 0 To CInt(_enrollY) Step 16 + For x = 0 To Core.windowSize.Width - 100 Step 16 + SpriteBatch.Draw(t, New Rectangle(50 + x, y + 97, 16, 16), New Rectangle(0, 0, 4, 4), mainBackgroundColor) + Next + Next + + Dim modRes As Integer = CInt(_enrollY) Mod 16 + If modRes > 0 Then + For x = 0 To Core.windowSize.Width - 100 Step 16 + SpriteBatch.Draw(t, New Rectangle(50 + x, CInt(_enrollY + 97), 16, modRes), New Rectangle(0, 0, 4, 4), mainBackgroundColor) + Next + End If + + 'If the moves are selected and the second page is open, draw a gray backdrop: + If _pageIndex = 1 And _moveSelected = True Then + Canvas.DrawRectangle(New Rectangle(50, 96, CInt(Math.Ceiling((Core.windowSize.Width - 100) / 16) * 16), CInt(Math.Ceiling((Core.windowSize.Height - 146) / 16) * 16) + 1), New Color(0, 0, 0, CInt(40 * _moveFade))) + If _partyIndex > -1 Then + SpriteBatch.Draw(t, New Rectangle(CInt(_pointerPos), 80, 32, 16), New Rectangle(0, 16, 32, 16), New Color(0, 0, 0, CInt(40 * _moveFade))) + End If + End If + + Dim shinyGradientColor As Color = New Color(0, 0, 0, CInt(30 * _fadeIn)) + If GetPokemon().IsShiny = True And GetPokemon().IsEgg() = False Then + shinyGradientColor = New Color(232, 195, 75, CInt(30 * _fadeIn)) + End If + + Canvas.DrawRectangle(New Rectangle(50, 96, 50, CInt(Math.Ceiling((_enrollY) / 16) * 16) + 1), shinyGradientColor) + Canvas.DrawGradient(New Rectangle(100, 96, 250, CInt(Math.Ceiling((_enrollY) / 16) * 16) + 1), shinyGradientColor, New Color(shinyGradientColor.ToVector3()) With {.A = 0}, True, -1) + + 'Draw Pokémon preview: + If _enrollY >= 160 Then + Dim height As Integer = CInt(_enrollY - 160).Clamp(0, 256) + Dim pokemonTexture = GetPokemon().GetTexture(True) + Dim textureHeight As Integer = CInt(pixeledPokemonTexture.Height * (height / 256)) + + Dim pokemonTextureOffset As Integer = 32 + If GetPokemon().IsEgg() = True Then + pokemonTextureOffset = 64 + End If + + SpriteBatch.Draw(pixeledPokemonTexture, New Rectangle(70 + 10, 160 - _yOffset + pokemonTextureOffset + 10, 256, height), New Rectangle(0, 0, pixeledPokemonTexture.Width, textureHeight), New Color(0, 0, 0, 150)) + SpriteBatch.Draw(pixeledPokemonTexture, New Rectangle(70, 160 - _yOffset + pokemonTextureOffset, 256, height), New Rectangle(0, 0, pixeledPokemonTexture.Width, textureHeight), Color.White) + End If + + 'Draw main infos: + Canvas.DrawRectangle(New Rectangle(50, 108, 250, 32), New Color(0, 0, 0, CInt(100 * _interfaceFade))) + Canvas.DrawGradient(New Rectangle(300, 108, 50, 32), New Color(0, 0, 0, CInt(100 * _interfaceFade)), New Color(0, 0, 0, 0), True, -1) + Canvas.DrawRectangle(New Rectangle(50, 140, 250, 32), New Color(0, 0, 0, CInt(70 * _interfaceFade))) + Canvas.DrawGradient(New Rectangle(300, 140, 50, 32), New Color(0, 0, 0, CInt(70 * _interfaceFade)), New Color(0, 0, 0, 0), True, -1) + + SpriteBatch.DrawString(FontManager.ChatFont, GetPokemon().GetDisplayName(), New Vector2(60, 112), New Color(255, 255, 255, CInt(220 * _fadeIn))) + + If GetPokemon().IsEgg() = False Then + SpriteBatch.DrawString(FontManager.ChatFont, "Lv. " & GetPokemon().Level, New Vector2(100, 144), New Color(255, 255, 255, CInt(220 * _fadeIn))) + + 'Draw shiny star: + If GetPokemon().IsShiny = True Then + SpriteBatch.Draw(t, New Rectangle(69, 430, 18, 18), New Rectangle(16, 0, 9, 9), New Color(255, 255, 255, CInt(255 * _fadeIn))) + End If + + 'Draw gender: + Select Case GetPokemon().Gender + Case Pokemon.Genders.Male + SpriteBatch.Draw(t, New Rectangle(240, 111, 14, 26), New Rectangle(25, 0, 7, 13), New Color(255, 255, 255, CInt(220 * _fadeIn))) + Case Pokemon.Genders.Female + SpriteBatch.Draw(t, New Rectangle(238, 111, 18, 26), New Rectangle(32, 0, 9, 13), New Color(255, 255, 255, CInt(220 * _fadeIn))) + End Select + + 'Draw Catch ball: + If GetPokemon().CatchBall IsNot Nothing Then + SpriteBatch.Draw(GetPokemon().CatchBall.Texture, New Rectangle(65, 144, 24, 24), New Color(255, 255, 255, CInt(255 * _fadeIn))) + End If + End If + + Canvas.DrawRectangle(New Rectangle(50, 458, 250, 32), New Color(0, 0, 0, CInt(100 * _interfaceFade))) + Canvas.DrawGradient(New Rectangle(300, 458, 50, 32), New Color(0, 0, 0, CInt(100 * _interfaceFade)), New Color(0, 0, 0, 0), True, -1) + Canvas.DrawRectangle(New Rectangle(50, 490, 250, 32), New Color(0, 0, 0, CInt(70 * _interfaceFade))) + Canvas.DrawGradient(New Rectangle(300, 490, 50, 32), New Color(0, 0, 0, CInt(70 * _interfaceFade)), New Color(0, 0, 0, 0), True, -1) + Canvas.DrawRectangle(New Rectangle(50, 522, 250, 32), New Color(0, 0, 0, CInt(100 * _interfaceFade))) + Canvas.DrawGradient(New Rectangle(300, 522, 50, 32), New Color(0, 0, 0, CInt(100 * _interfaceFade)), New Color(0, 0, 0, 0), True, -1) + Canvas.DrawRectangle(New Rectangle(50, 554, 250, 32), New Color(0, 0, 0, CInt(70 * _interfaceFade))) + Canvas.DrawGradient(New Rectangle(300, 554, 50, 32), New Color(0, 0, 0, CInt(70 * _interfaceFade)), New Color(0, 0, 0, 0), True, -1) + Canvas.DrawRectangle(New Rectangle(50, 586, 250, 32), New Color(0, 0, 0, CInt(100 * _interfaceFade))) + Canvas.DrawGradient(New Rectangle(300, 586, 50, 32), New Color(0, 0, 0, CInt(100 * _interfaceFade)), New Color(0, 0, 0, 0), True, -1) + + SpriteBatch.DrawString(FontManager.ChatFont, "Type", New Vector2(60, 462), New Color(255, 255, 255, CInt(220 * _interfaceFade))) + SpriteBatch.DrawString(FontManager.ChatFont, "Item", New Vector2(60, 494), New Color(255, 255, 255, CInt(220 * _interfaceFade))) + SpriteBatch.DrawString(FontManager.ChatFont, "Dex No.", New Vector2(60, 526), New Color(255, 255, 255, CInt(220 * _interfaceFade))) + + SpriteBatch.DrawString(FontManager.ChatFont, "OT", New Vector2(60, 558), New Color(255, 255, 255, CInt(220 * _interfaceFade))) + SpriteBatch.DrawString(FontManager.ChatFont, GetPokemon().CatchTrainerName, New Vector2(144, 558), New Color(255, 255, 255, CInt(220 * _fadeIn))) + + SpriteBatch.DrawString(FontManager.ChatFont, "ID No.", New Vector2(60, 590), New Color(255, 255, 255, CInt(220 * _interfaceFade))) + SpriteBatch.DrawString(FontManager.ChatFont, GetPokemon().OT, New Vector2(144, 590), New Color(255, 255, 255, CInt(220 * _fadeIn))) + + Dim pokedexNo As String = "???" + + If GetPokemon().IsEgg() = False Then + 'Type images draw: + Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\Types"), New Rectangle(144, 466, 48, 16), GetPokemon().Type1.GetElementImage(), New Color(255, 255, 255, CInt(255 * _fadeIn))) + If GetPokemon().Type2.Type <> Element.Types.Blank Then + Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\Types"), New Rectangle(202, 466, 48, 16), GetPokemon().Type2.GetElementImage(), New Color(255, 255, 255, CInt(255 * _fadeIn))) + End If + 'Item: + If GetPokemon().Item IsNot Nothing Then + SpriteBatch.Draw(GetPokemon().Item.Texture, New Rectangle(144, 494, 24, 24), New Color(255, 255, 255, CInt(220 * _fadeIn))) + SpriteBatch.DrawString(FontManager.ChatFont, GetPokemon().Item.Name, New Vector2(170, 494), New Color(255, 255, 255, CInt(220 * _fadeIn))) + Else + SpriteBatch.DrawString(FontManager.ChatFont, "None", New Vector2(144, 494), New Color(255, 255, 255, CInt(220 * _fadeIn))) + End If + + 'Get dex no: + For Each pokedex In Core.Player.Pokedexes + If pokedex.IsActivated = True Then + If pokedex.HasPokemon(GetPokemon().Number, True) Then + pokedexNo = pokedex.GetPlace(GetPokemon().Number).ToString() + End If + End If + Next + While pokedexNo.Length < 3 + pokedexNo = "0" & pokedexNo + End While + Else + SpriteBatch.DrawString(FontManager.ChatFont, "???", New Vector2(144, 462), New Color(255, 255, 255, CInt(220 * _fadeIn))) + SpriteBatch.DrawString(FontManager.ChatFont, "???", New Vector2(144, 494), New Color(255, 255, 255, CInt(220 * _fadeIn))) + End If + + 'Pokedex no. + SpriteBatch.DrawString(FontManager.ChatFont, pokedexNo, New Vector2(144, 526), New Color(255, 255, 255, CInt(220 * _fadeIn))) + End Sub + + Private Sub DrawPage1() + With GetPokemon() + 'Draw stats: + Dim colors As Color() = {New Color(120, 239, 155), New Color(241, 227, 154), New Color(255, 178, 114), New Color(151, 217, 205), New Color(137, 154, 255), New Color(213, 128, 255)} + Dim statNames As String() = {"HP", "Attack", "Defense", "Sp. Atk", "Sp. Def", "Speed"} + Dim statValues As String() = { .HP & " / " & .MaxHP, CStr( .Attack), CStr( .Defense), CStr( .SpAttack), CStr( .SpDefense), CStr( .Speed)} + Dim evStats As Single() = { .EVHP, .EVAttack, .EVDefense, .EVSpAttack, .EVSpDefense, .EVSpeed} + Dim ivStats As Single() = { .IVHP, .IVAttack, .IVDefense, .IVSpAttack, .IVSpDefense, .IVSpeed} + + For y = 0 To 5 + Dim fadeColor As Integer = 100 + If y Mod 2 = 1 Then + fadeColor = 70 + End If + + Dim statColor As Color = colors(y) + statColor.A = CByte(255 * _interfaceFade * _pageFade) + + Dim yOffset As Integer = 32 + Dim height As Integer = 32 + If y = 0 Then + yOffset = 0 + height = 64 + End If + + Canvas.DrawRectangle(New Rectangle(450, 172 + y * 32 + yOffset, 250, height), New Color(0, 0, 0, CInt(fadeColor * _interfaceFade * _pageFade))) + Canvas.DrawRectangle(New Rectangle(450, 172 + y * 32 + yOffset, 6, height), statColor) + SpriteBatch.DrawString(FontManager.ChatFont, statNames(y), New Vector2(466, 176 + y * 32 + yOffset), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade))) + + Dim natureStatMulti As Single = Nature.GetMultiplier( .Nature, statNames(y)) + Dim multiColor As Color = New Color(255, 255, 255, CInt(200 * _fadeIn * _pageFade)) + + If natureStatMulti > 1.0F Then + multiColor = New Color(255, 180, 180, CInt(200 * _fadeIn * _pageFade)) + ElseIf natureStatMulti < 1.0F Then + multiColor = New Color(180, 180, 255, CInt(200 * _fadeIn * _pageFade)) + End If + SpriteBatch.DrawString(FontManager.ChatFont, statValues(y), New Vector2(580, 176 + y * 32 + yOffset), multiColor) + Next + + Dim pokeInfoTexture = TextureManager.GetTexture("GUI\Menus\PokemonInfo") + + 'HP Bar: + SpriteBatch.Draw(pokeInfoTexture, New Rectangle(555, 210, 135, 15), New Rectangle(0, 32, 90, 10), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade))) + '108 pixels: + Dim hpV As Double = .HP / .MaxHP + Dim hpWidth As Integer = CInt((104 * _fadeIn) * hpV) + Dim hpColorX As Integer = 0 + If hpV < 0.5F Then + hpColorX = 5 + If hpV < 0.1F Then + hpColorX = 10 + End If + End If + If .HP > 0 And hpWidth = 0 Then + hpWidth = 1 + End If + If hpWidth > 0 Then + Dim drawColor As Color = Color.White + If _closing = True Then + drawColor = New Color(255, 255, 255, CInt(220 * _fadeIn)) + End If + drawColor.A = CByte(drawColor.A * _pageFade) + + SpriteBatch.Draw(pokeInfoTexture, New Rectangle(555 + 24, 213, 2, 8), New Rectangle(hpColorX, 42, 2, 6), drawColor) + + SpriteBatch.Draw(pokeInfoTexture, New Rectangle(555 + 24 + 2, 213, hpWidth, 8), New Rectangle(hpColorX + 2, 42, 1, 6), drawColor) + + SpriteBatch.Draw(pokeInfoTexture, New Rectangle(555 + 24 + 2 + hpWidth, 213, 2, 8), New Rectangle(hpColorX + 3, 42, 2, 6), drawColor) + End If + + 'Draw ability: + Canvas.DrawRectangle(New Rectangle(450, 458, 350, 32), New Color(0, 0, 0, CInt(100 * _interfaceFade * _pageFade))) + Canvas.DrawRectangle(New Rectangle(450, 490, 350, 64), New Color(0, 0, 0, CInt(70 * _interfaceFade * _pageFade))) + + SpriteBatch.DrawString(FontManager.ChatFont, "Ability", New Vector2(460, 462), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade))) + SpriteBatch.DrawString(FontManager.ChatFont, .Ability.Name, New Vector2(570, 462), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade))) + SpriteBatch.DrawString(FontManager.ChatFont, .Ability.Description.CropStringToWidth(FontManager.ChatFont, 1.0F, 300), New Vector2(460, 496), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade))) + + 'Draw nature: + Canvas.DrawRectangle(New Rectangle(450, 586, 350, 32), New Color(0, 0, 0, CInt(100 * _interfaceFade * _pageFade))) + SpriteBatch.DrawString(FontManager.ChatFont, "Nature", New Vector2(460, 590), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade))) + SpriteBatch.DrawString(FontManager.ChatFont, .Nature.ToString(), New Vector2(570, 590), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade))) + + 'EXP: + Canvas.DrawRectangle(New Rectangle(816, 458, 300, 32), New Color(0, 0, 0, CInt(100 * _interfaceFade * _pageFade))) + SpriteBatch.DrawString(FontManager.ChatFont, "Exp. Points", New Vector2(826, 462), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade))) + SpriteBatch.DrawString(FontManager.ChatFont, .Experience.ToString(), New Vector2(980, 462), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade))) + + If .Level < CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) Then + Canvas.DrawRectangle(New Rectangle(816, 490, 300, 64), New Color(0, 0, 0, CInt(70 * _interfaceFade * _pageFade))) + SpriteBatch.DrawString(FontManager.ChatFont, "To Next Lv.", New Vector2(826, 494), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade))) + + If .NeedExperience( .Level + 1) - .Experience > 0 Then + SpriteBatch.DrawString(FontManager.ChatFont, CStr( .NeedExperience( .Level + 1) - .Experience), New Vector2(980, 494), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade))) + + 'EXP Bar: + Dim expV As Double = ( .Experience - .NeedExperience( .Level)) / ( .NeedExperience( .Level + 1) - .NeedExperience( .Level)) + If .Level = 1 Then + expV = .Experience / .NeedExperience(2) + End If + Dim expWidth As Integer = CInt((107 * _fadeIn) * expV) + If .Experience > .NeedExperience( .Level) And expWidth = 0 Then + expWidth = 1 + End If + If .Experience > .NeedExperience( .Level + 1) Then + expWidth = 107 + expV = 1.0F + End If + + Dim expLow As New Color(47, 204, 208, CInt(220 * _interfaceFade * _pageFade)) + Dim expToColor As New Color(CInt(MathHelper.Lerp(47, 7, CSng(expV))), CInt(MathHelper.Lerp(204, 48, CSng(expV))), CInt(MathHelper.Lerp(208, 216, CSng(expV))), CInt(220 * _interfaceFade * _pageFade)) + + SpriteBatch.Draw(pokeInfoTexture, New Rectangle(796 + 96, 507 + 24, 141, 12), New Rectangle(0, 48, 94, 8), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade))) + If expWidth > 0 Then + Canvas.DrawGradient(New Rectangle(827 + 96, 510 + 24, expWidth, 6), expLow, expToColor, True, -1) + End If + End If + End If + + 'Draw EV/IV stats: + 'Base diagramm: + Canvas.DrawRectangle(New Rectangle(816, 172, 298, 224), New Color(0, 0, 0, CInt(70 * _interfaceFade * _pageFade))) + + Canvas.DrawLine(New Color(0, 0, 0, CInt(100 * _interfaceFade * _pageFade)), New Vector2(816, 172), New Vector2(816, 396), 2D) + Canvas.DrawLine(New Color(0, 0, 0, CInt(100 * _interfaceFade * _pageFade)), New Vector2(1116, 172), New Vector2(1116, 396), 2D) + Canvas.DrawLine(New Color(0, 0, 0, CInt(100 * _interfaceFade * _pageFade)), New Vector2(814, 396), New Vector2(1116, 396), 2D) + + For i = 0 To 5 + 'Axis: + Dim c As Color = colors(i) + + Canvas.DrawLine(New Color(c.R, c.G, c.B, CInt(220 * _interfaceFade * _pageFade)), New Vector2(823 + i * 56, 396), New Vector2(823 + i * 56, 396 - (224 * _fadeIn)), 3D) + + If i < 5 Then + Dim EVcurrentPointM As Double = evStats(i) / 256 + Dim EVnextPointM As Double = evStats(i + 1) / 256 + + Canvas.DrawLine(New Color(255, 255, 255, CInt(255 * _interfaceFade * _pageFade)), New Vector2(824 + i * 56, 396 - CSng((224 * _fadeIn) * EVcurrentPointM)), New Vector2(824 + (i + 1) * 56, 396 - CSng((224 * _fadeIn) * EVnextPointM)), 2D) + + Dim IVcurrentPointM As Double = ivStats(i) / 31 + Dim IVnextPointM As Double = ivStats(i + 1) / 31 + + Canvas.DrawLine(New Color(84, 198, 216, CInt(255 * _interfaceFade * _pageFade)), New Vector2(824 + i * 56, 396 - CSng((224 * _fadeIn) * IVcurrentPointM)), New Vector2(824 + (i + 1) * 56, 396 - CSng((224 * _fadeIn) * IVnextPointM)), 2D) + End If + Next + End With + End Sub + + Private Sub DrawPage2() + With GetPokemon() + 'Draw moves: + For i = 0 To 3 + Dim pos As New Vector2(450, 172 + i * 96) + Dim c As Color = New Color(255, 255, 255, CInt(255 * _interfaceFade * _pageFade)) + + Core.SpriteBatch.Draw(_texture, New Rectangle(CInt(pos.X), CInt(pos.Y), 64, 64), New Rectangle(16, 16, 16, 16), c) + Core.SpriteBatch.Draw(_texture, New Rectangle(CInt(pos.X) + 64, CInt(pos.Y), 64 * 3, 64), New Rectangle(32, 16, 16, 16), c) + Core.SpriteBatch.Draw(_texture, New Rectangle(CInt(pos.X) + 64 * 4, CInt(pos.Y), 64, 64), New Rectangle(16, 16, 16, 16), c, 0.0F, Vector2.Zero, SpriteEffects.FlipHorizontally, 0.0F) + + If .Attacks.Count - 1 >= i Then + SpriteBatch.DrawString(FontManager.ChatFont, .Attacks(i).Name, New Vector2(pos.X + 24, pos.Y + 8), New Color(0, 0, 0, CInt(220 * _fadeIn * _pageFade))) + Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\Types"), New Rectangle(CInt(pos.X + 26), CInt(pos.Y + 36), 48, 16), .Attacks(i).Type.GetElementImage(), New Color(255, 255, 255, CInt(255 * _fadeIn * _pageFade))) + SpriteBatch.DrawString(FontManager.ChatFont, "PP " & .Attacks(i).CurrentPP & " / " & .Attacks(i).MaxPP, New Vector2(pos.X + 130, pos.Y + 32), New Color(0, 0, 0, CInt(220 * _fadeIn * _pageFade))) + End If + Next + + '*******MOVE SELECTED SECTION******* + + 'Draw move selector: + Canvas.DrawBorder(3, New Rectangle(450, CInt(_moveSelectorPosition), 64 * 5, 64), New Color(200, 80, 80, CInt(200 * _interfaceFade * _pageFade * _moveFade))) + + 'Draw move switch selector: + If _switchingMoves = True Then + Canvas.DrawBorder(3, New Rectangle(447, CInt(GetMoveSelectorDest(_switchMoveIndex) - 3), 64 * 5 + 6, 70), New Color(80, 80, 200, CInt(200 * _interfaceFade * _pageFade * _moveFade))) + End If + + 'Draw selected move info: + Canvas.DrawRectangle(New Rectangle(800, 172, 350, 32), New Color(0, 0, 0, CInt(100 * _interfaceFade * _pageFade * _moveFade))) + Canvas.DrawRectangle(New Rectangle(800, 204, 350, 32), New Color(0, 0, 0, CInt(70 * _interfaceFade * _pageFade * _moveFade))) + Canvas.DrawRectangle(New Rectangle(800, 236, 350, 32), New Color(0, 0, 0, CInt(100 * _interfaceFade * _pageFade * _moveFade))) + Canvas.DrawRectangle(New Rectangle(800, 268, 350, 32), New Color(0, 0, 0, CInt(70 * _interfaceFade * _pageFade * _moveFade))) + Canvas.DrawRectangle(New Rectangle(800, 300, 350, 32), New Color(0, 0, 0, CInt(100 * _interfaceFade * _pageFade * _moveFade))) + Canvas.DrawRectangle(New Rectangle(800, 332, 350, 128), New Color(0, 0, 0, CInt(70 * _interfaceFade * _pageFade * _moveFade))) + + 'Type: + SpriteBatch.DrawString(FontManager.ChatFont, "Type:", New Vector2(810, 176), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade * _moveFade))) + Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\Types"), New Rectangle(924, 182, 48, 16), .Attacks(_moveIndex).Type.GetElementImage(), New Color(255, 255, 255, CInt(255 * _fadeIn * _pageFade * _moveFade))) + + SpriteBatch.DrawString(FontManager.ChatFont, "PP:", New Vector2(810, 208), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade * _moveFade))) + SpriteBatch.DrawString(FontManager.ChatFont, .Attacks(_moveIndex).CurrentPP & " / " & .Attacks(_moveIndex).MaxPP, New Vector2(924, 208), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade * _moveFade))) + + 'Stats: + SpriteBatch.DrawString(FontManager.ChatFont, "Category:", New Vector2(810, 240), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade * _moveFade))) + Core.SpriteBatch.Draw( .Attacks(_moveIndex).GetDamageCategoryImage(), New Rectangle(924, 241, 48, 24), New Color(255, 255, 255, CInt(255 * _fadeIn * _pageFade * _moveFade))) + + SpriteBatch.DrawString(FontManager.ChatFont, "Power:", New Vector2(810, 272), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade * _moveFade))) + + Dim power As String = .Attacks(_moveIndex).Power.ToString() + If .Attacks(_moveIndex).Power <= 0 Then + power = "-" + End If + + SpriteBatch.DrawString(FontManager.ChatFont, power, New Vector2(924, 272), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade * _moveFade))) + + Dim accuracy As String = .Attacks(_moveIndex).Accuracy.ToString() + If .Attacks(_moveIndex).Accuracy <= 0 Then + accuracy = "-" + End If + + SpriteBatch.DrawString(FontManager.ChatFont, "Accuracy:", New Vector2(810, 304), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade * _moveFade))) + SpriteBatch.DrawString(FontManager.ChatFont, accuracy, New Vector2(924, 304), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade * _moveFade))) + + 'Description: + SpriteBatch.DrawString(FontManager.ChatFont, .Attacks(_moveIndex).Description.CropStringToWidth(FontManager.ChatFont, 300), New Vector2(820, 336), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade * _moveFade))) + End With + End Sub + + Private Sub DrawEgg() + Dim s As String = "" + Dim percent As Integer = CInt((GetPokemon().EggSteps / GetPokemon().BaseEggSteps) * 100) + If percent <= 33 Then + s = "It looks like this Egg will" & vbNewLine & "take a long time to hatch." + ElseIf percent > 33 And percent <= 66 Then + s = "It's getting warmer and moves" & vbNewLine & "a little. It will hatch soon." + Else + s = "There is strong movement" & vbNewLine & "noticeable. It will hatch soon!" + End If + + Canvas.DrawRectangle(New Rectangle(450, 172, 350, 32), New Color(0, 0, 0, CInt(100 * _fadeIn))) + Canvas.DrawRectangle(New Rectangle(450, 204, 350, 96), New Color(0, 0, 0, CInt(70 * _fadeIn))) + + SpriteBatch.DrawString(FontManager.ChatFont, "The Egg Watch", New Vector2(460, 176), New Color(255, 255, 255, CInt(220 * _fadeIn))) + SpriteBatch.DrawString(FontManager.ChatFont, s, New Vector2(460, 228), New Color(255, 255, 255, CInt(220 * _fadeIn))) + End Sub + + Private Sub GetYOffset() + Dim t As Texture2D = GetPokemon().GetTexture(True) + _yOffset = -1 + + Dim cArr(t.Width * t.Height - 1) As Color + t.GetData(cArr) + + For y = 0 To t.Height - 1 + For x = 0 To t.Width - 1 + If cArr(x + y * t.Height) <> Color.Transparent Then + _yOffset = y + Exit For + End If + Next + + If _yOffset <> -1 Then + Exit For + End If + Next + End Sub + + Public Overrides Sub Update() + If _closing = True Then + If _fadeIn > 0F Then + _fadeIn = MathHelper.Lerp(0, _fadeIn, 0.8F) + If _fadeIn < 0F Then + _fadeIn = 0F + End If + End If + If _interfaceFade > 0F Then + _interfaceFade = MathHelper.Lerp(0, _interfaceFade, 0.8F) + If _interfaceFade < 0F Then + _interfaceFade = 0F + End If + End If + If _enrollY > 0 Then + _enrollY = MathHelper.Lerp(0, _enrollY, 0.8F) + If _enrollY <= 0 Then + _enrollY = 0 + End If + End If + If _enrollY <= 2.0F Then + Core.SetScreen(PreScreen) + End If + Else + Dim enrollYDest As Integer = Core.windowSize.Height - 146 + If _enrollY < enrollYDest Then + _enrollY = MathHelper.Lerp(enrollYDest, _enrollY, 0.8F) + If _enrollY >= enrollYDest Then + _enrollY = enrollYDest + End If + End If + If _fadeIn < 1.0F Then + _fadeIn = MathHelper.Lerp(1.0F, _fadeIn, 0.95F) + If _fadeIn > 1.0F Then + _fadeIn = 1.0F + End If + End If + If _interfaceFade < 1.0F Then + _interfaceFade = MathHelper.Lerp(1.0F, _interfaceFade, 0.95F) + If _interfaceFade > 1.0F Then + _interfaceFade = 1.0F + End If + End If + If _pixelFade < 1.0F Then + _pixelFade += 0.03F + If _pixelFade >= 1.0F Then + _pixelFade = 1.0F + End If + End If + + If _pageOpening = False And _pageClosing = False And _partyIndex > -1 And _moveSelected = False Then + If _party.Length > 1 Then + If Controls.Left(True, True, False, True, False, True) Or ControllerHandler.ButtonPressed(Buttons.LeftShoulder) Then + _partyIndex -= 1 + If _partyIndex = -1 Then + _partyIndex = _party.Count - 1 + End If + GetYOffset() + SetPointerDest(_partyIndex) + End If + If Controls.Right(True, True, False, True, False, True) Or ControllerHandler.ButtonPressed(Buttons.RightShoulder) Then + _partyIndex += 1 + If _partyIndex = _party.Count Then + _partyIndex = 0 + End If + GetYOffset() + SetPointerDest(_partyIndex) + End If + End If + End If + If _moveSelected = False Then + If GetPokemon().IsEgg() = False Then + If Controls.Down(True, True, False, True, True, True) = True Then + If _pageIndex = 0 Then + _pageClosing = True + _pageOpening = False + End If + End If + If Controls.Up(True, True, False, True, True, True) = True Then + If _pageIndex = 1 Then + _pageClosing = True + _pageOpening = False + End If + End If + If Controls.Accept() = True And _pageIndex = 1 Then + _moveSelected = True + End If + End If + If Controls.Dismiss() = True Then + _closing = True + End If + Else + If Math.Abs(_moveSelectorPosition - GetMoveSelectorDest(_moveIndex)) < 32.0F Then + If Controls.Down(True, True, True, True, True, True) = True Then + _moveIndex += 1 + + If _moveIndex > GetPokemon().Attacks.Count - 1 Then + _moveIndex = 0 + End If + End If + If Controls.Up(True, True, True, True, True, True) = True Then + _moveIndex -= 1 + + If _moveIndex < 0 Then + _moveIndex = GetPokemon().Attacks.Count - 1 + End If + End If + End If + If Controls.Accept() = True And _pageIndex = 1 And GetPokemon().IsEgg() = False Then + If _switchingMoves = True Then + Dim switchingMove As BattleSystem.Attack = GetPokemon().Attacks(_switchMoveIndex) + GetPokemon().Attacks.RemoveAt(_switchMoveIndex) + GetPokemon().Attacks.Insert(_moveIndex, switchingMove) + + _switchingMoves = False + _switchMoveIndex = -1 + Else + If GetPokemon().Attacks.Count > 1 Then + _switchingMoves = True + _switchMoveIndex = _moveIndex + End If + End If + End If + If Controls.Dismiss() = True Then + If _switchingMoves = True Then + _switchingMoves = False + _switchMoveIndex = -1 + Else + _moveSelected = False + End If + End If + End If + End If + + _moveIndex = _moveIndex.Clamp(0, GetPokemon().Attacks.Count - 1) + If _moveSelectorPosition <> GetMoveSelectorDest(_moveIndex) Then + _moveSelectorPosition = MathHelper.Lerp(GetMoveSelectorDest(_moveIndex), _moveSelectorPosition, 0.8F) + If Math.Abs(_moveSelectorPosition - GetMoveSelectorDest(_moveIndex)) < 0.05F Then + _moveSelectorPosition = GetMoveSelectorDest(_moveIndex) + End If + End If + + If _pageClosing = True Then + If _pageFade >= 0F Then + _pageFade -= 0.07F + If _pageFade <= 0F Then + _pageFade = 0F + _pageClosing = False + _pageOpening = True + If _pageIndex = 0 Then + _pageIndex = 1 + Else + _pageIndex = 0 + End If + End If + End If + End If + If _pageOpening = True Then + If _pageFade <= 1.0F Then + _pageFade += 0.07F + If _pageFade >= 1.0F Then + _pageFade = 1.0F + _pageClosing = False + _pageOpening = False + End If + End If + End If + + If _pageIndex = 0 Then + _moveSelected = False + _moveIndex = 0 + _moveFade = 0F + _switchingMoves = False + _switchMoveIndex = -1 + Else + If _moveSelected = True And _moveFade <= 1.0F Then + _moveFade = MathHelper.Lerp(1.0F, _moveFade, 0.8F) + If _moveFade >= 0.95F Then + _moveFade = 1.0F + End If + ElseIf _moveSelected = False And _moveFade > 0F Then + _moveFade = MathHelper.Lerp(0.0F, _moveFade, 0.8F) + If _moveFade <= 0.05F Then + _moveFade = 0F + End If + End If + End If + + If _pointerPos < _pointerDest Then + _pointerPos = MathHelper.Lerp(_pointerDest, _pointerPos, 0.8F) + If _pointerPos >= _pointerDest Then + _pointerPos = _pointerDest + End If + ElseIf _pointerPos > _pointerDest Then + _pointerPos = MathHelper.Lerp(_pointerDest, _pointerPos, 0.8F) + If _pointerPos <= _pointerDest Then + _pointerPos = _pointerDest + End If + End If + End Sub + + Private Function GetPointerDest(ByVal partyIndex As Integer) As Integer + Dim pointerX As Double = Core.ScreenSize.Width / 2 + + If _party.Length Mod 2 = 0 Then + 'Even: + Dim half As Integer = CInt(_party.Length / 2) + + If partyIndex < _party.Length / 2 Then + pointerX -= (8 + 64 * (half - partyIndex) + 16 * ((half - 1) - partyIndex)) + Else + pointerX += (8 + (64 + 16) * (partyIndex - half)) + End If + Else + 'Odd: + Dim half As Integer = CInt(Math.Floor(_party.Length / 2)) + + If partyIndex < half Then + pointerX -= (16 + 64) * (half - partyIndex) + ElseIf partyIndex > half Then + pointerX += (16 + 64) * (partyIndex - half) + End If + End If + + Return CInt(pointerX) + End Function + + Private Sub SetPointerDest(ByVal partyIndex As Integer) + _fadeIn = 0F + _pixelFade = 0F + _pointerDest = GetPointerDest(partyIndex) + + If GetPokemon().IsEgg() = False Then + GetPokemon().PlayCry() + End If + End Sub + + Private Function GetPokemon() As Pokemon + If _partyIndex > -1 Then + Return _party(_partyIndex) + Else + Return _selectedPokemon + End If + End Function + +End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/Pokemon/TeachMovesScreen.vb b/2.5DHero/2.5DHero/Screens/Pokemon/TeachMovesScreen.vb index c064e2762..4fa48435e 100644 --- a/2.5DHero/2.5DHero/Screens/Pokemon/TeachMovesScreen.vb +++ b/2.5DHero/2.5DHero/Screens/Pokemon/TeachMovesScreen.vb @@ -168,7 +168,7 @@ c = Color.IndianRed End If - .DrawString(FontManager.MiniFont, Localization.GetString("PP") & " " & A.CurrentPP & " / " & A.MaxPP, New Vector2(p.X + 130, CInt(p.Y + 58)), c) + .DrawString(FontManager.MiniFont, OldLocalization.GetString("PP") & " " & A.CurrentPP & " / " & A.MaxPP, New Vector2(p.X + 130, CInt(p.Y + 58)), c) .Draw(TextureManager.GetTexture("GUI\Menus\Types", A.Type.GetElementImage(), ""), New Rectangle(CInt(p.X), CInt(p.Y + 54), 48, 16), Color.White) End With diff --git a/2.5DHero/2.5DHero/Screens/SaveScreen.vb b/2.5DHero/2.5DHero/Screens/SaveScreen.vb index 4d42c7a90..bd6a9d63e 100644 --- a/2.5DHero/2.5DHero/Screens/SaveScreen.vb +++ b/2.5DHero/2.5DHero/Screens/SaveScreen.vb @@ -15,7 +15,7 @@ Me.PreScreen = currentScreen Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu") - ChooseBox.Show({Localization.GetString("save_screen_yes"), Localization.GetString("save_screen_no")}, 0, {}) + ChooseBox.Show({OldLocalization.GetString("save_screen_yes"), OldLocalization.GetString("save_screen_no")}, 0, {}) SaveGameHelpers.ResetSaveCounter() End Sub @@ -36,7 +36,7 @@ "again in order to prevent data corruption.", New Vector2(188, 240), Color.Black) Else If ready = True Then - .DrawString(FontManager.InGameFont, Localization.GetString("save_screen_success"), New Vector2(188, 186), Color.DarkBlue) + .DrawString(FontManager.InGameFont, OldLocalization.GetString("save_screen_success"), New Vector2(188, 186), Color.DarkBlue) Else If SaveGameHelpers.GameJoltSaveDone() = False And savingStarted = True Then If SaveGameHelpers.StartedDownloadCheck = True Then @@ -45,7 +45,7 @@ .DrawString(FontManager.InGameFont, "Saving, please wait" & LoadingDots.Dots, New Vector2(188, 186), Color.Black) End If Else - .DrawString(FontManager.InGameFont, Localization.GetString("save_screen_title"), New Vector2(188, 186), Color.Black) + .DrawString(FontManager.InGameFont, OldLocalization.GetString("save_screen_title"), New Vector2(188, 186), Color.Black) End If End If @@ -57,7 +57,7 @@ End If Next - .DrawString(FontManager.MiniFont, Localization.GetString("save_screen_name") & ": " & Core.Player.Name & vbNewLine & vbNewLine & Localization.GetString("save_screen_badges") & ": " & Core.Player.Badges.Count.ToString() & vbNewLine & vbNewLine & Localization.GetString("save_screen_money") & ": " & Core.Player.Money & vbNewLine & vbNewLine & Localization.GetString("save_screen_time") & ": " & TimeHelpers.GetDisplayTime(TimeHelpers.GetCurrentPlayTime(), True), New Vector2(192, 350), Color.DarkBlue) + .DrawString(FontManager.MiniFont, OldLocalization.GetString("save_screen_name") & ": " & Core.Player.Name & vbNewLine & vbNewLine & OldLocalization.GetString("save_screen_badges") & ": " & Core.Player.Badges.Count.ToString() & vbNewLine & vbNewLine & OldLocalization.GetString("save_screen_money") & ": " & Core.Player.Money & vbNewLine & vbNewLine & OldLocalization.GetString("save_screen_time") & ": " & TimeHelpers.GetDisplayTime(TimeHelpers.GetCurrentPlayTime(), True), New Vector2(192, 350), Color.DarkBlue) End If End With diff --git a/2.5DHero/2.5DHero/Screens/Screen.vb b/2.5DHero/2.5DHero/Screens/Screen.vb index b3a499797..9a1ed0491 100644 --- a/2.5DHero/2.5DHero/Screens/Screen.vb +++ b/2.5DHero/2.5DHero/Screens/Screen.vb @@ -1,4 +1,4 @@ -''' +''' ''' The base class for all screens in the game. ''' Public MustInherit Class Screen @@ -15,8 +15,8 @@ Public MustInherit Class Screen PokedexViewScreen PokedexSearchScreen PokedexHabitatScreen - PokemonScreen - PokemonStatusScreen + PartyScreen + SummaryScreen InventoryScreen BerryScreen TrainerScreen @@ -85,258 +85,131 @@ Public MustInherit Class Screen RegisterBattleScreen StatisticsScreen MapPreviewScreen + KeyBindingScreen + MessageBoxScreen + PressStartScreen + CharacterSelectionScreen + GameModeSelectionScreen + + 'TEMPORARY, OLD + PokemonScreen IntroScreen + PokemonStatusScreen End Enum #Region "Shared values" - Private Shared _globalCamera As Camera - Private Shared _globalBasicEffect As BasicEffect - Private Shared _globalLevel As Level - Private Shared _globalSkyDome As SkyDome - Private Shared _globalTextBox As New TextBox - Private Shared _globalChooseBox As New ChooseBox - Private Shared _globalPokemonImageView As New PokemonImageView - ''' - ''' A global camera instance that carries over screen instances. + ''' A global camera instance, that carries over screen instances. ''' Public Shared Property Camera() As Camera - Get - Return _globalCamera - End Get - Set(value As Camera) - _globalCamera = value - End Set - End Property ''' - ''' A global level instance that carries over screen instances. + ''' A global level instance, that carries over screen instances. ''' Public Shared Property Level() As Level - Get - Return _globalLevel - End Get - Set(value As Level) - _globalLevel = value - End Set - End Property ''' - ''' A global BasicEffect instance that carries over screen instances. + ''' A global BasicEffect instance, that carries over screen instances. ''' Public Shared Property Effect() As BasicEffect - Get - Return _globalBasicEffect - End Get - Set(value As BasicEffect) - _globalBasicEffect = value - End Set - End Property ''' - ''' A global SkyDome instance that carries over screen instances. + ''' A global SkyDome instance, that carries over screen instances. ''' Public Shared Property SkyDome() As SkyDome - Get - Return _globalSkyDome - End Get - Set(value As SkyDome) - _globalSkyDome = value - End Set - End Property ''' - ''' A global TextBox instance that carries over screen instances. + ''' A global TextBox instance, that carries over screen instances. ''' - Public Shared Property TextBox() As TextBox - Get - Return _globalTextBox - End Get - Set(value As TextBox) - _globalTextBox = value - End Set - End Property + Public Shared Property TextBox() As TextBox = New TextBox() ''' - ''' A global ChooseBox instance that carries over screen instances. + ''' A global ChooseBox instance, that carries over screen instances. ''' - Public Shared Property ChooseBox() As ChooseBox - Get - Return _globalChooseBox - End Get - Set(value As ChooseBox) - _globalChooseBox = value - End Set - End Property + Public Shared Property ChooseBox() As ChooseBox = New ChooseBox() ''' - ''' A global PokemonImageView instance that carries over screen instances. + ''' A global PokemonImageView instance, that carries over screen instances. ''' - Public Shared Property PokemonImageView() As PokemonImageView - Get - Return _globalPokemonImageView - End Get - Set(value As PokemonImageView) - _globalPokemonImageView = value - End Set - End Property + Public Shared Property PokemonImageView() As PokemonImageView = New PokemonImageView() #End Region #Region "Fields" - Private _preScreen As Screen = Nothing - Private _identification As Identifications = Identifications.MainMenuScreen ' Some default value I guess... - - Private _mouseVisible As Boolean = False - Private _canBePaused As Boolean = True - Private _canMuteMusic As Boolean = True - Private _canChat As Boolean = True - Private _canTakeScreenshot As Boolean = True - Private _canDrawDebug As Boolean = True - Private _canGoFullscreen As Boolean = True - ''' ''' A value to store the screen that underlies the current screen in. ''' - Public Property PreScreen() As Screen - Get - Return Me._preScreen - End Get - Set(value As Screen) - Me._preScreen = value - End Set - End Property + Public Property PreScreen() As Screen = Nothing ''' ''' The ID of the screen. ''' - Public Property Identification() As Identifications - Get - Return Me._identification - End Get - Set(value As Identifications) - Me._identification = value - End Set - End Property + Public Property Identification() As Identifications = Identifications.MainMenuScreen ''' - ''' Whether the mouse cursor is visible on the screen. + ''' Wether the mouse is visible on the screen. ''' - ''' The default value is "False". - Public Property MouseVisible() As Boolean - Get - Return Me._mouseVisible - End Get - Set(value As Boolean) - Me._mouseVisible = value - End Set - End Property + Public Property MouseVisible() As Boolean = False ''' - ''' Whether the game can be paused when pressing the Escape key. + ''' Wether the game can be paused when pressing Escape. ''' - ''' The default value is "True". - Public Property CanBePaused() As Boolean - Get - Return Me._canBePaused - End Get - Set(value As Boolean) - Me._canBePaused = value - End Set - End Property + Public Property CanBePaused() As Boolean = True ''' - ''' Whether the game can be muted by pressing the M key (default). + ''' Wether the game can be muted by pressing M (default). ''' - ''' The default value is "True". - Public Property CanMuteMusic() As Boolean - Get - Return Me._canMuteMusic - End Get - Set(value As Boolean) - Me._canMuteMusic = value - End Set - End Property + Public Property CanMuteMusic() As Boolean = True ''' - ''' Whether the ChatScreen can be opened by pressing the T key (default). + ''' Wether the ChatScreen can be opened by pressing T (default). ''' - ''' The default value is "True". - Public Property CanChat() As Boolean - Get - Return Me._canChat - End Get - Set(value As Boolean) - Me._canChat = value - End Set - End Property + Public Property CanChat() As Boolean = True ''' - ''' Whether a screenshot can be taken by pressing the F2 key (default). + ''' Wether a screenshot can be taken by pressing F2 (default). ''' - ''' The default value is "True". - Public Property CanTakeScreenshot() As Boolean - Get - Return Me._canTakeScreenshot - End Get - Set(value As Boolean) - Me._canTakeScreenshot = value - End Set - End Property + Public Property CanTakeScreenshot() As Boolean = True ''' - ''' Whether the debug information can be drawn on the screen. + ''' Wether the debug information can be drawn on the screen. ''' - ''' The default value is "True". - Public Property CanDrawDebug() As Boolean - Get - Return Me._canDrawDebug - End Get - Set(value As Boolean) - Me._canDrawDebug = value - End Set - End Property + Public Property CanDrawDebug() As Boolean = True ''' - ''' Whether the game can switch its fullscreen state by pressing the F11 key (default). + ''' Wether the game can switch its fullscreen state by pressing F11 (default). ''' - ''' The default value is "True". - Public Property CanGoFullscreen() As Boolean - Get - Return Me._canGoFullscreen - End Get - Set(value As Boolean) - Me._canGoFullscreen = value - End Set - End Property + Public Property CanGoFullscreen() As Boolean = True - Public UpdateFadeOut As Boolean = False ' Sets if the screen gets updated during its set as a FadeOut screen on the TransitionScreen. - Public UpdateFadeIn As Boolean = False ' Sets if the screen gets updated during its set as a FadeIn screen on the TransitionScreen. + ''' + ''' Wether this screen draws gradients. + ''' + Protected Property IsDrawingGradients() As Boolean = False + + ''' + ''' If this screen completely overlays its PreScreen. + ''' + Public Property IsOverlay() As Boolean = False + + Public UpdateFadeOut As Boolean = False 'Sets if the screen gets updated during its set as a FadeOut screen on the TransitionScreen. + Public UpdateFadeIn As Boolean = False 'Sets if the screen gets updated during its set as a FadeIn screen on the TransitionScreen. #End Region ''' - ''' Sets all default fields of the screen instance. + ''' Copies variables from another screen. ''' - ''' The ID of the screen. - ''' Sets if the mouse cursor is visible on the screen. - ''' Sets if the PauseScreen can be opened by pressing the Escape key. - ''' Sets if the M key (default) can mute the music. - ''' Sets if the T key (default) can open the chat screen. - ''' Sets if the F2 key (default) can take a screenshot. - ''' Sets if the debug information can be drawn on this screen. - ''' Sets if the F11 key (default) can sets the game to fullscreen (or back). - Private Sub Setup(ByVal Identification As Identifications, ByVal MouseVisible As Boolean, ByVal CanBePaused As Boolean, ByVal CanMuteMusic As Boolean, ByVal CanChat As Boolean, ByVal CanTakeScreenshot As Boolean, ByVal CanDrawDebug As Boolean, ByVal CanGoFullscreen As Boolean) - Me.Identification = Identification - Me.MouseVisible = MouseVisible - Me.CanBePaused = CanBePaused - Me.CanChat = CanChat - Me.CanDrawDebug = CanDrawDebug - Me.CanGoFullscreen = CanGoFullscreen - Me.CanMuteMusic = CanMuteMusic - Me.CanTakeScreenshot = CanTakeScreenshot + ''' The source screen. + Protected Sub CopyFrom(ByVal scr As Screen) + _mouseVisible = scr._mouseVisible + _canBePaused = scr._canBePaused + _canMuteMusic = scr._canMuteMusic + _canChat = scr._canChat + _canTakeScreenshot = scr._canTakeScreenshot + _canDrawDebug = scr._canDrawDebug + _canGoFullscreen = scr._canGoFullscreen End Sub ''' @@ -350,7 +223,7 @@ Public MustInherit Class Screen ''' ''' The base render function of the screen. Used to render models above sprites. ''' - Public Overridable Overloads Sub Render() + Public Overridable Overloads Sub Render() End Sub @@ -381,8 +254,9 @@ Public MustInherit Class Screen ''' ''' Returns if this screen instance is the currently active screen (set in the global Basic.CurrentScreen). ''' - Public Function IsCurrentScreen() As Boolean - If Core.CurrentScreen.Identification = Me.Identification Then ' If the screen stored in the CurrentScreen field has the same ID as this screen, return true. + ''' + Public Function IsCurrentScreen() As Boolean + If CurrentScreen.Identification = Identification Then 'If the screen stored in the CurrentScreen field has the same ID as this screen, return true. Return True Else Return False @@ -408,22 +282,22 @@ Public MustInherit Class Screen ''' ''' An event that is getting raised when the Escape button is getting pressed. The PauseScreen is getting brought up if the CanBePaused field is set to true. ''' - Public Overridable Sub EscapePressed() - ' If the game can be paused on this screen, open the PauseScreen. - If Core.CurrentScreen.CanBePaused = True Then - Core.SetScreen(New PauseScreen(Core.CurrentScreen)) + Public Overridable Sub EscapePressed() + 'If the game can be paused on this screen, open the PauseScreen. + If CurrentScreen.CanBePaused = True Then + SetScreen(New PauseScreen(CurrentScreen)) End If End Sub ''' - ''' Draws Xbox controls on the bottom right of the screen. + ''' Draws XBOX controls on the bottom right of the screen. ''' ''' The button types and descriptions. ''' Calculates the position and calls DrawGamePadControls(Descriptions,Position) - Friend Sub DrawGamePadControls(ByVal Descriptions As Dictionary(Of Microsoft.Xna.Framework.Input.Buttons, String)) - Dim x As Integer = Core.windowSize.Width ' Store the X position at the start of the controls render. + Public Sub DrawGamePadControls(ByVal Descriptions As Dictionary(Of Buttons, String)) + Dim x As Integer = windowSize.Width 'Store the x position of the start of the controls render. - ' Loop through the buttons and add to the X location: + 'Loop through the buttons and add to the x location. For i = 0 To Descriptions.Count - 1 Select Case Descriptions.Keys(i) Case Buttons.A, Buttons.B, Buttons.X, Buttons.Y, Buttons.Start, Buttons.LeftStick, Buttons.RightStick, Buttons.LeftTrigger, Buttons.RightTrigger @@ -432,33 +306,33 @@ Public MustInherit Class Screen x -= 64 + 4 End Select - ' Add to the X location for the length of the string and a separator: + 'Add to the x location for the length of the string and a separator. x -= CInt(FontManager.MainFont.MeasureString(Descriptions.Values(i)).X) + 16 Next - ' Finally, render the buttons: - DrawGamePadControls(Descriptions, New Vector2(x, Core.windowSize.Height - 40)) + 'Finally, render the buttons: + DrawGamePadControls(Descriptions, New Vector2(x, windowSize.Height - 40)) End Sub ''' - ''' Generic void to render Xbox Gamepad controls on the screen. + ''' Generic void to render XBOX Gamepad controls on the screen. ''' ''' The button types and descriptions. ''' The position to draw the buttons. - Friend Sub DrawGamePadControls(ByVal Descriptions As Dictionary(Of Microsoft.Xna.Framework.Input.Buttons, String), ByVal Position As Vector2) - ' Only if a Gamepad is connected and the screen is active, render the buttons: - If GamePad.GetState(PlayerIndex.One).IsConnected = True And Core.GameOptions.GamePadEnabled = True And Me.IsCurrentScreen() = True Then - ' Transform the position to integers and store the current drawing position: + Public Sub DrawGamePadControls(ByVal Descriptions As Dictionary(Of Buttons, String), ByVal Position As Vector2) + 'Only if a Gamepad is connected and the screen is active, render the buttons: + If GamePad.GetState(PlayerIndex.One).IsConnected = True And Core.GameOptions.GamePadEnabled = True And IsCurrentScreen() = True Then + 'Transform the position to integers and store the current drawing position: Dim x As Integer = CInt(Position.X) Dim y As Integer = CInt(Position.Y) - ' Loop through the button list: + 'Loop through the button list: For i = 0 To Descriptions.Count - 1 - Dim t As String = "GUI\GamePad\xboxController" ' Store the texture path. - Dim width As Integer = 32 ' Store the width of the image. - Dim height As Integer = 32 ' Store the height of the image. + Dim t As String = "GUI\GamePad\xboxController" 'Store the texture path. + Dim width As Integer = 32 'Store the width of the image. + Dim height As Integer = 32 'Store the height of the image. - ' Get the correct button image and size (currently, all buttons use the same size of 32x32 pixels). + 'Get the correct button image and size (currently, all buttons use the same size of 32x32 pixels). Select Case Descriptions.Keys(i) Case Buttons.A t &= "ButtonA" @@ -484,38 +358,84 @@ Public MustInherit Class Screen t &= "Start" End Select - ' Draw the buttons (first, the "shadow" with a black color, then the real button): - Core.SpriteBatch.Draw(TextureManager.GetTexture(t), New Rectangle(x + 2, y + 2, width, height), Color.Black) - Core.SpriteBatch.Draw(TextureManager.GetTexture(t), New Rectangle(x, y, width, height), Color.White) + 'Draw the buttons (first, the "shadow" with a black color, then the real button). + SpriteBatch.Draw(TextureManager.GetTexture(t), New Rectangle(x + 2, y + 2, width, height), Color.Black) + SpriteBatch.Draw(TextureManager.GetTexture(t), New Rectangle(x, y, width, height), Color.White) - ' Add the button width and a little offset to the drawing position: + 'Add the button width and a little offset to the drawing position: x += width + 4 - ' Draw the button description (again, with a shadow): - Core.SpriteBatch.DrawString(FontManager.MainFont, Descriptions.Values(i), New Vector2(x + 3, y + 7), Color.Black) - Core.SpriteBatch.DrawString(FontManager.MainFont, Descriptions.Values(i), New Vector2(x, y + 4), Color.White) + 'Draw the button description (again, with a shadow): + SpriteBatch.DrawString(FontManager.MainFont, Descriptions.Values(i), New Vector2(x + 3, y + 7), Color.Black) + SpriteBatch.DrawString(FontManager.MainFont, Descriptions.Values(i), New Vector2(x, y + 4), Color.White) - ' Add the text width and the offset for the next button description to the drawing position: + 'Add the text width and the offset for the next button description to the drawing position: x += CInt(FontManager.MainFont.MeasureString(Descriptions.Values(i)).X) + 16 Next End If End Sub + ''' + ''' Renders fading gradients. + ''' + ''' The alpha to draw the gradients at. + Protected Sub DrawGradients(ByVal alpha As Integer) + DrawGradients(alpha, Screens.UI.ColorProvider.IsGameJolt) + End Sub + + Protected Sub DrawGradients(ByVal alpha As Integer, ByVal isGameJolt As Boolean) + Dim canDrawGradients As Boolean = True + Dim s As Screen = Me + + While s.PreScreen IsNot Nothing And canDrawGradients = True + If s._isOverlay = False Then + s = s.PreScreen + If s.IsDrawingGradients = True Then + canDrawGradients = False + End If + Else + Exit While + End If + End While + + If canDrawGradients = True Then + Dim c As Color = Screens.UI.ColorProvider.GradientColor(isGameJolt, 0) + Dim cA As Color = Screens.UI.ColorProvider.GradientColor(isGameJolt, alpha) + + Canvas.DrawGradient(New Rectangle(0, 0, CInt(windowSize.Width), 200), cA, c, False, -1) + Canvas.DrawGradient(New Rectangle(0, CInt(windowSize.Height - 200), CInt(windowSize.Width), 200), c, cA, False, -1) + End If + End Sub + ''' ''' Returns the screen status of the current screen. Override this function to return a screen state. ''' - Public Overridable Function GetScreenStatus() As String - ' // Return the generic "not implemented" message: - Return "Screen state not implemented for screen class: " & Me.Identification.ToString() + ''' + Public Overridable Function GetScreenStatus() As String + '// Return the generic "not implemented" message: + Return "Screen state not implemented for screen class: " & Identification.ToString() End Function ''' ''' Returns the minimum size for the screen size to display a large interface before switching to the small size. ''' + ''' ''' The default size is 800x620 pixels. Public Overridable Function GetScreenScaleMinimum() As Size - ' // Default size: 800x620 pixels. + '// Default size: 800x620 pixels. Return New Size(800, 620) End Function + ''' + ''' Returns the spritebatch that should render a font. + ''' + ''' + Protected Overridable Function GetFontRenderer() As SpriteBatch + If IsCurrentScreen() Then + Return FontRenderer + Else + Return SpriteBatch + End If + End Function + End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/TrainerScreen.vb b/2.5DHero/2.5DHero/Screens/TrainerScreen.vb index 594fd4a23..3b18febc1 100644 --- a/2.5DHero/2.5DHero/Screens/TrainerScreen.vb +++ b/2.5DHero/2.5DHero/Screens/TrainerScreen.vb @@ -56,13 +56,13 @@ DrawContent() DrawBadges() - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("trainer_screen_backadvice"), New Vector2(1200 - FontManager.MiniFont.MeasureString(Localization.GetString("trainer_screen_backadvice")).X - 330, 580), Color.DarkGray) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("trainer_screen_backadvice"), New Vector2(1200 - FontManager.MiniFont.MeasureString(OldLocalization.GetString("trainer_screen_backadvice")).X - 330, 580), Color.DarkGray) End Sub Private Sub DrawHeader() Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48)), 2, New Rectangle(60, 100, 480, 64)) Core.SpriteBatch.Draw(mainTexture, New Rectangle(78, 124, 60, 48), New Rectangle(108, 112, 20, 16), Color.White) - Core.SpriteBatch.DrawString(FontManager.InGameFont, Localization.GetString("trainer_screen_trainer_card"), New Vector2(154, 132), Color.Black) + Core.SpriteBatch.DrawString(FontManager.InGameFont, OldLocalization.GetString("trainer_screen_trainer_card"), New Vector2(154, 132), Color.Black) End Sub Private Sub DrawContent() @@ -108,14 +108,14 @@ Dim EmblemName As String = Core.GameJoltSave.Emblem Core.SpriteBatch.DrawString(FontManager.MiniFont, "Current Emblem: """ & EmblemName(0).ToString().ToUpper() & EmblemName.Substring(1, EmblemName.Length - 1) & """ (" & CStr(Core.GameJoltSave.AchievedEmblems.IndexOf(EmblemName) + 1) & "/" & Core.GameJoltSave.AchievedEmblems.Count & ") - use arrow keys to change.", New Vector2(80, 333), Color.Black) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("trainer_screen_money") & ": " & vbNewLine & vbNewLine & Localization.GetString("trainer_screen_pokedex") & ": " & vbNewLine & vbNewLine & Localization.GetString("trainer_screen_time") & ": ", New Vector2(610, 220), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("trainer_screen_money") & ": " & vbNewLine & vbNewLine & OldLocalization.GetString("trainer_screen_pokedex") & ": " & vbNewLine & vbNewLine & OldLocalization.GetString("trainer_screen_time") & ": ", New Vector2(610, 220), Color.Black) With Core.Player Core.SpriteBatch.DrawString(FontManager.MiniFont, "$" & .Money & vbNewLine & vbNewLine & Pokedex.CountEntries(Core.Player.PokedexData, {2, 3}) & " /" & Pokedex.CountEntries(Core.Player.PokedexData, {1, 2, 3}) & vbNewLine & vbNewLine & TimeHelpers.GetDisplayTime(TimeHelpers.GetCurrentPlayTime(), True), New Vector2(700, 220), Color.DarkBlue) End With Else Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48)), 2, New Rectangle(572, 100, 288, 288)) - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("trainer_screen_name") & ": " & vbNewLine & vbNewLine & Localization.GetString("trainer_screen_points") & ": " & vbNewLine & vbNewLine & Localization.GetString("trainer_screen_money") & ": " & vbNewLine & vbNewLine & Localization.GetString("trainer_screen_pokedex") & ": " & vbNewLine & vbNewLine & Localization.GetString("trainer_screen_time") & ": ", New Vector2(108, 220), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("trainer_screen_name") & ": " & vbNewLine & vbNewLine & OldLocalization.GetString("trainer_screen_points") & ": " & vbNewLine & vbNewLine & OldLocalization.GetString("trainer_screen_money") & ": " & vbNewLine & vbNewLine & OldLocalization.GetString("trainer_screen_pokedex") & ": " & vbNewLine & vbNewLine & OldLocalization.GetString("trainer_screen_time") & ": ", New Vector2(108, 220), Color.Black) Dim displayPoints As Integer = Core.Player.Points If Core.Player.IsGameJoltSave = True Then @@ -133,7 +133,7 @@ Private Sub DrawBadges() If Core.Player.Badges.Count > 0 Then - Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("trainer_screen_collected_badges") & ": " & Core.Player.Badges.Count, New Vector2(108, 450), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MiniFont, OldLocalization.GetString("trainer_screen_collected_badges") & ": " & Core.Player.Badges.Count, New Vector2(108, 450), Color.Black) Dim selectedRegion As String = Badge.GetRegion(CInt(index.Y)) Dim badgesCount As Integer = Badge.GetBadgesCount(selectedRegion) @@ -142,10 +142,10 @@ Dim badgeID As Integer = Badge.GetBadgeID(selectedRegion, i) Dim c As Color = Color.White - Dim t As String = Badge.GetBadgeName(badgeID) & Localization.GetString("trainer_screen_badge") + Dim t As String = Badge.GetBadgeName(badgeID) & OldLocalization.GetString("trainer_screen_badge") If Badge.PlayerHasBadge(badgeID) = False Then c = Color.Black - t = Localization.GetString("trainer_screen_empty_badge") + t = OldLocalization.GetString("trainer_screen_empty_badge") End If Core.SpriteBatch.Draw(Badge.GetBadgeTexture(badgeID), New Rectangle(60 + (i + 1) * 64, 480, 50, 50), c) diff --git a/2.5DHero/2.5DHero/Screens/WindowScreen.vb b/2.5DHero/2.5DHero/Screens/WindowScreen.vb index cd630219a..5afb0aadd 100644 --- a/2.5DHero/2.5DHero/Screens/WindowScreen.vb +++ b/2.5DHero/2.5DHero/Screens/WindowScreen.vb @@ -6,7 +6,7 @@ Public MustInherit Class WindowScreen Inherits Screen ' Shared controller to check if any other window screen is drawing a gradient already. If so, don't draw another gradient on top: - Public Shared IsDrawingGradients As Boolean = False + Public Shared IsDrawingGradientsWindow As Boolean = False Const STARTWINDOWSINK As Integer = -35 @@ -130,9 +130,9 @@ Public MustInherit Class WindowScreen ''' Updates the fade in of the gradients. ''' Public Overrides Sub Update() - If Me._drawingGradient = False And IsDrawingGradients = False Then + If Me._drawingGradient = False And IsDrawingGradientsWindow = False Then Me._drawingGradient = True - IsDrawingGradients = True + IsDrawingGradientsWindow = True End If If _closing = True Then @@ -219,7 +219,7 @@ Public MustInherit Class WindowScreen Public Overrides Sub ChangeFrom() MyBase.ChangeFrom() If Me._drawingGradient = True Then - IsDrawingGradients = False + IsDrawingGradientsWindow = False End If End Sub diff --git a/2.5DHero/2.5DHeroContent/Content.mgcb b/2.5DHero/2.5DHeroContent/Content.mgcb index ea9670d37..23be29843 100644 --- a/2.5DHero/2.5DHeroContent/Content.mgcb +++ b/2.5DHero/2.5DHeroContent/Content.mgcb @@ -928,6 +928,18 @@ /processorParam:TextureFormat=Color /build:Content/GUI/Menus/pokegear.png +#begin Content/GUI/Menus/PokemonInfo.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Content/GUI/Menus/PokemonInfo.png + #begin Content/GUI/Menus/Types.png /importer:TextureImporter /processor:TextureProcessor diff --git a/2.5DHero/2.5DHeroContent/Content/GUI/Menus/PokemonInfo.png b/2.5DHero/2.5DHeroContent/Content/GUI/Menus/PokemonInfo.png new file mode 100644 index 0000000000000000000000000000000000000000..80a8bd04ee93eb379781606a47a2ebb394a8e279 GIT binary patch literal 3054 zcmVHA}`zML-qgw3wudK zK~#9!?VWFIQ`Z@XpL4IBI0=wYhopo*ZQ7Dj&?-8hD^N^36xI%{Nomwglcq|`CO%B+ zq|%B?-KwFYt`b_Oeb|Rq=_a&Iz(gmys#4KVM+*dP{L4~G(sWJeAV5&kVsL85_Pu8x zd~af#Bn~7Yw(~yH)w%DneXn!h-+9k_j*m{%FORqDwkU(#R{(8Mlxy!@y_nI^=)rS^ z(n)@0V z(^OcN9(qB@ZULmX`gGg3Y+vG}Nhh4{mT$yhvp1*2=QA4g<4+h*KE`iX;!1{2XBX-q$LnrKdT6$1~qmwyl-*rk&zQ%ht*{ zz;X6hj+*q4^M!2383pJ_OTCV?)a&%~v`C?8(mKh{>5)Y1q1U7v$b|@?k|MO*>eHja zpflfyF<3eyfeg+TA>>RTNOhJ@YVi!y@>A@v)AENqL;yK33K%9)QyJcy;?$xvB}vwo zdjc34D?U^Xh5e!W)Oi3s!6Ovm77PQ&JXEAf4>^8l4nQRh`?L)I@`zVo`4xs?ICBAp z2DD)q+C2x@zU^fU!*CCsbjSk~1VIplETy5jeMv)e`;u{9L&o`2h%pYwtpYv)K51xf ze@H|yjRfF0zd5Pus8c5*$aeuWG`Fu#bG}Qnh#=1e;5h%tC~s+Y-XkK&Hvu#>x39_I ze3v64f;N)asEdWc%MVgHAMv3E`WyS_P_)?-{m6_L6!@^asG#sc)yRFdx!|K zO#lte?dvAl`7R%d2(nB7j`I)R!ux*c+*3p_#i)kn_D6t!PSO1z9q+yOu3ju_2gf6T zb%6kZK!8`aZ+{wS1eOCO@@U4N?*MNBf6eAE=~+}$!z^N zyyjNa*4BEqY}rCE807EozDs?5JfmoKNZw3Pn-enO!TrKP28+qMm_*UQywSGjoU zqPTW!EYD^Eq-KRm;q&=8eE2XsckZOFu8#HV*JGL{(P)&`)>iuZ`Z)IQW3;rkh--5k z4{*XsRuUB+4`pR#w6(RdXU`ty&YeqLT^*&RrNrZLnwpyE>gpmEjp0!qd4gl(M7Dl0 z!x^gF6v1mjaqZZ6D_g&q>13xfootnP6&0Qtz9L#%TKM=>3wPadCkAlp#0h$PF7uD~ z-zWIhmqa2F3dL6;PR z#{{i8`-ffGDS+FK-KL^nL^W|xmd4Yk)Zbbamo8n_v6x0{&AFaZ)l*!^rOTIfOl#sm zXKAUjkAF;|T>w#r-_d6}b`x5IGElRM;jRj(@}mn1viJMWTQ?8jUf^w@pVU47IzbpP*#pix@L!q2nr%7@qqV7)7Y7aiWKRPjpTdCExlnTsR2xAB6Jz zz%WrUoAA-y44m9e*V+F{FOZqVz^7T!1pu!CP(BZ{`T@eH_G0yPVic92|96tY+4J$; z|1@gOuPIOwj6yG8_gAi)k2?`jqf}xP zF{}d9UQ4z|`<(l_dyhp0K+scaFzV}r3E8o^t& z1anpuMv<5Bg)Tye{(|i-p{VX8dlH+=mi1E&uX?(U$VW(`$URrq|qDG@+6qLjig47$3y z+^WKC62J#QEzuZ;ZzdQ9*f!W2O`O6N4fwwCJ?xevc*2?)o3;}<{tjkwDFf~MvCbSo zg~LR9&!Vgl=gxPtYu7Gj&YUR%NQ)L1E?jV{KFGc#aODPy9{m|cMO8u<9*7+J6L@D( zSa}cn$RA&jrV~dm%o)A9yA)HzP^!4@8 z)6*lK9)-Po_fBR)IJE)@22fL^Zcj9KH#{-* zIe;)abIN8<(3KL&py?@~*gqR{VHI{skq98$DXCsK2G=^jUpT*ur~Oy;)I7lJfwEFq zScO?QwLcYmq|eW6pFQ=T{2kx!*s(+A0Wz>;$&wLQwrt$EF{l4F=>o>UNb@9qzd!d! z0pi}VO$Mcxe!o92CeRF@&v)HCfY_;aUtiy#!;>AK4-vp4yR zRt`>=4;KkU0C`SNPtS-VkQ`td*sk;4GM^%V+PZbCE-x>aW;Dr}n$n8;pO!VBG?TR4hhk+8*$JZT*0H!&M zH~oU@JMWQ+py_ItEM0?|bBE*r)73U-`q4QYNDY|-7#{QXrB9K1*#_V|LD~f$Ha#jEy*ZIk%^zmc2JI{CL_AoHr`O+OsFO1&aUPJ`b zSOBiWM-oB4_Te=(HN%!GSFTKXziZdm*AH9fI;yd;F~#wja)MlB?%cUtym)a$JDr-E z8ag^USh;c~$BrEvEbHs**|%?BO1Ws!qWp*enIb{HI3Gx{-IhO+^MOGTq&t7#zJ2+T z1LU&^(p!Ey9UUDh-9UQFce?>s4Cx}si!J~dHuMiyC+h)H?VMi^;P&xjjRZ0eFl6V$ zXlXDB6mFdKBsm*b{boWIg^rWq7KLWhs^5$P*tBVrcrgPLu}xgIZ4Z|c0c4-Rk@5Te z6SDF*+qQ=r6oBj#n3=rZCT_TW0>vI8{rTjb0AyGkQ_j|06_#GNDd%5K+X!_{Q2|J$B$yCKc9R<_6f{DzCRyX w5+(?OAP9mW2!bF8f*=TjAP9mW2>HtY0ecc-O;}LwoB#j-07*qoM6N<$f($IcBme*a literal 0 HcmV?d00001