From db35572eb1070c2398b01d464e9b855ace0994cc Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Wed, 14 Jun 2023 19:10:04 +0200 Subject: [PATCH] =?UTF-8?q?Limit=20Pok=C3=A9mon=20names=20to=2012=20and=20?= =?UTF-8?q?others=20to=2020=20chars?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- P3D/Screens/NewGameScreen.vb | 2 +- P3D/Screens/Pokemon/NameObjectScreen.vb | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/P3D/Screens/NewGameScreen.vb b/P3D/Screens/NewGameScreen.vb index 91ff702e8..56b86e832 100644 --- a/P3D/Screens/NewGameScreen.vb +++ b/P3D/Screens/NewGameScreen.vb @@ -327,7 +327,7 @@ End If Dim skinRectangle As New Rectangle(0, CInt(skinFrameSize.Height * 2), CInt(skinFrameSize.Width), CInt(skinFrameSize.Height)) skinTexture = TextureManager.GetTexture(skinTexture2D, skinRectangle) - Core.SetScreen(New InputScreen(Core.CurrentScreen, skinNames(SkinIndex), InputScreen.InputModes.Name, skinNames(SkinIndex), 14, New List(Of Texture2D)({skinTexture}), AddressOf Me.ConfirmInput)) + Core.SetScreen(New InputScreen(Core.CurrentScreen, skinNames(SkinIndex), InputScreen.InputModes.Name, skinNames(SkinIndex), 20, New List(Of Texture2D)({skinTexture}), AddressOf Me.ConfirmInput)) End Sub Private Sub ConfirmInput(ByVal input As String) diff --git a/P3D/Screens/Pokemon/NameObjectScreen.vb b/P3D/Screens/Pokemon/NameObjectScreen.vb index 0d39be928..e556c7f5c 100644 --- a/P3D/Screens/Pokemon/NameObjectScreen.vb +++ b/P3D/Screens/Pokemon/NameObjectScreen.vb @@ -9,6 +9,7 @@ Public Class NameObjectScreen Private _pokemon As Pokemon ' Temporarly stores the Pokémon to rename. Private _currentText As String = "" ' The current Text in the textbox. Private _mainTexture As Texture2D ' The temporary texture. Loads "GUI\Menus\Menu". + Private _maxLength As Integer = 20 Private _index As Integer = 0 ' The button index (0 or 1). Private _askedRename As Boolean = False ' If the question to rename is answered or not. @@ -43,6 +44,7 @@ Public Class NameObjectScreen Me._pokemon = Pokemon Me._defaultName = Pokemon.GetDisplayName() Me._renamePokemon = True + Me._maxLength = 12 ' Load texture: Me._mainTexture = TextureManager.GetTexture("GUI\Menus\Menu") @@ -71,6 +73,7 @@ Public Class NameObjectScreen Me.CanBePaused = True Me.CanChat = False Me.CanMuteAudio = False + Me._maxLength = 20 Screen.PokemonImageView.Show(Texture) End Sub @@ -148,7 +151,7 @@ Public Class NameObjectScreen Canvas.DrawRectangle(New Rectangle(CInt(TextboxPosition().X), CInt(TextboxPosition().Y), 320, 24), Color.White) Dim t As String = Me._currentText - If t.Length < 20 Then + If t.Length < Me._maxLength Then t &= "_" End If Core.SpriteBatch.DrawString(FontManager.InGameFont, t, TextboxPosition(), Color.Black) @@ -196,7 +199,11 @@ Public Class NameObjectScreen _delay = 0.0F End If Else - KeyBindings.GetNameInput(Me._currentText, 20) + If _pokemon IsNot Nothing Then + KeyBindings.GetNameInput(Me._currentText, 12) + Else + KeyBindings.GetNameInput(Me._currentText, 20) + End If Me._currentText = Me.ReplaceInvalidChars(Me._currentText) @@ -265,9 +272,9 @@ Public Class NameObjectScreen Me._askedRename = True If ControllerHandler.IsConnected() = True Then If _pokemon IsNot Nothing Then - Core.SetScreen(New InputScreen(Me, Me._defaultName, InputScreen.InputModes.Pokemon, Me._defaultName, 14, New List(Of Texture2D), AddressOf Me.GetControllerInput)) + Core.SetScreen(New InputScreen(Me, Me._defaultName, InputScreen.InputModes.Pokemon, Me._defaultName, 12, New List(Of Texture2D), AddressOf Me.GetControllerInput)) Else - Core.SetScreen(New InputScreen(Me, Me._defaultName, InputScreen.InputModes.Name, Me._defaultName, 14, New List(Of Texture2D), AddressOf Me.GetControllerInput)) + Core.SetScreen(New InputScreen(Me, Me._defaultName, InputScreen.InputModes.Name, Me._defaultName, 20, New List(Of Texture2D), AddressOf Me.GetControllerInput)) End If End If End If