File tree Expand file tree Collapse file tree 2 files changed +34
-4
lines changed Expand file tree Collapse file tree 2 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -975,7 +975,20 @@ MonoBehaviour:
975
975
m_Calls : []
976
976
m_OnValueChanged :
977
977
m_PersistentCalls :
978
- m_Calls : []
978
+ m_Calls :
979
+ - m_Target : {fileID: 3432713757992463987}
980
+ m_TargetAssemblyTypeName : Unity.Multiplayer.Samples.BossRoom.Visual.LobbyJoiningUI,
981
+ Unity.Multiplayer.Samples.BossRoom.Client
982
+ m_MethodName : SanitizeJoinCodeInputText
983
+ m_Mode : 1
984
+ m_Arguments :
985
+ m_ObjectArgument : {fileID: 0}
986
+ m_ObjectArgumentAssemblyTypeName : UnityEngine.Object, UnityEngine
987
+ m_IntArgument : 0
988
+ m_FloatArgument : 0
989
+ m_StringArgument :
990
+ m_BoolArgument : 0
991
+ m_CallState : 2
979
992
m_CaretColor : {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
980
993
m_CustomCaretColor : 0
981
994
m_SelectionColor : {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412}
@@ -4298,7 +4311,7 @@ MonoBehaviour:
4298
4311
m_faceColor :
4299
4312
serializedVersion : 2
4300
4313
rgba : 4294967295
4301
- m_fontSize : 20.3
4314
+ m_fontSize : 33
4302
4315
m_fontSizeBase : 36
4303
4316
m_fontWeight : 400
4304
4317
m_enableAutoSizing : 1
@@ -5105,7 +5118,7 @@ MonoBehaviour:
5105
5118
m_faceColor :
5106
5119
serializedVersion : 2
5107
5120
rgba : 4294967295
5108
- m_fontSize : 20.3
5121
+ m_fontSize : 33
5109
5122
m_fontSizeBase : 36
5110
5123
m_fontWeight : 400
5111
5124
m_enableAutoSizing : 1
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
+ using System . Text . RegularExpressions ;
3
4
using Unity . Multiplayer . Samples . BossRoom . Shared . Infrastructure ;
4
5
using Unity . Multiplayer . Samples . BossRoom . Shared . Net . UnityServices . Lobbies ;
5
6
using UnityEngine ;
@@ -23,6 +24,9 @@ public class LobbyJoiningUI : MonoBehaviour
23
24
IDisposable m_Subscriptions ;
24
25
List < LobbyListItemUI > m_LobbyListItems = new List < LobbyListItemUI > ( ) ;
25
26
27
+ // Adding this here until it is available in the Lobby package itself
28
+ const string k_LobbyJoinCodeAlphabet = "ACDEFGHJKMNPRTWXY3467" ;
29
+
26
30
void Awake ( )
27
31
{
28
32
m_LobbyListItemPrototype . gameObject . SetActive ( false ) ;
@@ -57,9 +61,22 @@ void InjectDependenciesAndInitialize(
57
61
m_Subscriptions = localLobbiesRefreshedSub . Subscribe ( UpdateUI ) ;
58
62
}
59
63
64
+ /// <summary>
65
+ /// Added to the InputField component's OnValueChanged callback for the join code text.
66
+ /// </summary>
67
+ public void SanitizeJoinCodeInputText ( )
68
+ {
69
+ m_JoinCodeField . text = SanitizeJoinCode ( m_JoinCodeField . text ) ;
70
+ }
71
+
72
+ string SanitizeJoinCode ( string dirtyString )
73
+ {
74
+ return Regex . Replace ( dirtyString . ToUpper ( ) , $ "[^{ k_LobbyJoinCodeAlphabet } ]", "" ) ;
75
+ }
76
+
60
77
public void OnJoinButtonPressed ( )
61
78
{
62
- m_LobbyUIMediator . JoinLobbyWithCodeRequest ( m_JoinCodeField . text . ToUpper ( ) ) ;
79
+ m_LobbyUIMediator . JoinLobbyWithCodeRequest ( SanitizeJoinCode ( m_JoinCodeField . text ) ) ;
63
80
}
64
81
65
82
void PeriodicRefresh ( float _ )
You can’t perform that action at this time.
0 commit comments