Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/kerst2024' into feature/…
Browse files Browse the repository at this point in the history
…kerst2024
  • Loading branch information
mvriel committed Dec 20, 2024
2 parents 3734f25 + d299b66 commit 7a9a449
Show file tree
Hide file tree
Showing 8 changed files with 4,286 additions and 835 deletions.
10 changes: 9 additions & 1 deletion Assets/FirebaseWebGL/Scoreboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using UnityEngine.UI;
using Newtonsoft.Json.Linq;
using System.Linq;
using System.Text.RegularExpressions;

namespace Netherlands3D.Twin
{
Expand Down Expand Up @@ -51,14 +52,19 @@ void OnEnable()

void Start()
{

nameInputField.characterLimit = 10;
// Attach button click listener
submitButton.onClick.AddListener(() => SubmitScore());

// Listen for updates to the scoreboard
ListenForScoreboardUpdates();
}

public string SanitizeInput(string input)
{
return Regex.Replace(input, @"[^a-zA-Z0-9\s]", ""); // Allows only letters, numbers, and spaces
}

void SubmitScore()
{
string userName = nameInputField.text;
Expand All @@ -70,6 +76,8 @@ void SubmitScore()
return;
}

SanitizeInput(userName);

// Create a score entry
var scoreData = new Dictionary<string, object>
{
Expand Down
Loading

0 comments on commit 7a9a449

Please sign in to comment.