Fix incorrect character list in rename screen
Also added space and a failsafe for if the name ends with a space
This commit is contained in:
parent
b27136d6bf
commit
72d653f65f
|
@ -8,6 +8,7 @@
|
|||
Text = 0
|
||||
Numbers = 1
|
||||
Name = 2
|
||||
Pokemon = 3
|
||||
End Enum
|
||||
|
||||
Dim DefaultName As String = ""
|
||||
|
@ -63,7 +64,7 @@
|
|||
Select Case Me.InputMode
|
||||
Case InputModes.Text
|
||||
Me.InitializeText()
|
||||
Case InputModes.Name
|
||||
Case InputModes.Name, InputModes.Pokemon
|
||||
Me.InitializeName()
|
||||
Case InputModes.Numbers
|
||||
Me.InitializeNumbers()
|
||||
|
@ -101,7 +102,13 @@
|
|||
End Sub
|
||||
|
||||
Private Sub InitializeName()
|
||||
Dim chars() As String = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", " ", " ", " ", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", " ", "'", "-", "u", "v", "w", "x", "y", "z", " ", " ", " ", " ", "!", "?", "_"}
|
||||
Dim chars() As String
|
||||
If InputMode = InputModes.Name Then
|
||||
chars = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", " ", ".", ",", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", " ", "'", "-", "u", "v", "w", "x", "y", "z", " ", " ", " ", " ", "!", "?", "_"}
|
||||
Else
|
||||
chars = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", " ", " ", " ", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", " ", " ", " ", "u", "v", "w", "x", "y", "z", " ", " ", " ", " ", " ", " ", " "}
|
||||
End If
|
||||
|
||||
Dim x As Integer = 0
|
||||
Dim y As Integer = 0
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ Public Class NameObjectScreen
|
|||
''' <remarks>Only numbers and alphabetic characters are allowed (0-9, a-z, A-Z)</remarks>
|
||||
Private Function ReplaceInvalidChars(ByVal text As String) As String
|
||||
' Creating the char array:
|
||||
Dim chars() As Char = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray()
|
||||
Dim chars() As Char = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ".ToCharArray()
|
||||
|
||||
' Create a new string to store the "purified" text in. YOU SHALL NOT PASS, EXTENDED LATIN.
|
||||
Dim newText As String = ""
|
||||
|
@ -243,9 +243,17 @@ Public Class NameObjectScreen
|
|||
If _currentText <> "" Then
|
||||
If _renamePokemon = True Then
|
||||
If _pokemon.GetName() <> _currentText Then
|
||||
' Remove spaces at the end
|
||||
While _currentText.EndsWith(" ")
|
||||
_currentText = _currentText.Remove(_currentText.Length - 1, 1)
|
||||
End While
|
||||
_pokemon.NickName = _currentText
|
||||
End If
|
||||
Else
|
||||
' Remove spaces at the end
|
||||
While _currentText.EndsWith(" ")
|
||||
_currentText = _currentText.Remove(_currentText.Length - 1, 1)
|
||||
End While
|
||||
Me._acceptName(_currentText)
|
||||
End If
|
||||
|
||||
|
@ -255,7 +263,11 @@ Public Class NameObjectScreen
|
|||
Else
|
||||
Me._askedRename = True
|
||||
If ControllerHandler.IsConnected() = True Then
|
||||
Core.SetScreen(New InputScreen(Me, Me._defaultName, InputScreen.InputModes.Name, Me._defaultName, 14, New List(Of Texture2D), AddressOf Me.GetControllerInput))
|
||||
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))
|
||||
Else
|
||||
Core.SetScreen(New InputScreen(Me, Me._defaultName, InputScreen.InputModes.Name, Me._defaultName, 14, New List(Of Texture2D), AddressOf Me.GetControllerInput))
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
@ -270,7 +282,7 @@ Public Class NameObjectScreen
|
|||
End Sub
|
||||
|
||||
Public Sub GetControllerInput(ByVal input As String)
|
||||
Me._currentText = input
|
||||
Me._currentText = ReplaceInvalidChars(input)
|
||||
End Sub
|
||||
|
||||
End Class
|
Loading…
Reference in New Issue