using singleton for playername now

This commit is contained in:
2023-02-22 21:20:54 +01:00
parent ca1957d618
commit a7932ce12b
5 changed files with 23 additions and 20 deletions

16
player_variables.cs Normal file
View File

@@ -0,0 +1,16 @@
using Godot;
using System;
using System.Text.RegularExpressions;
public partial class player_variables : Node
{
public static string PlayerName = "Yannik";
public static void ClearPlayerName() //normal getter setter crashes for some reason
{
PlayerName = Regex.Replace(PlayerName, @"\[[^]]+\]", "");
PlayerName = Regex.Replace(PlayerName, @"<[^>]*>", "");
if (PlayerName.Length > 12)
PlayerName = PlayerName.Substring(0, 12);
}
}