48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
![]() |
using UnityEngine;
|
||
|
using TMPro;
|
||
|
namespace TPSBR
|
||
|
{
|
||
|
|
||
|
public class PlayerWalletAddress : MonoBehaviour
|
||
|
{
|
||
|
string firstFourChars = "";
|
||
|
string lastFourChars = "";
|
||
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||
|
void Start()
|
||
|
{
|
||
|
if (PlayerPrefs.HasKey("WALLET_ADDRESS"))
|
||
|
{
|
||
|
GetTruncatedString();
|
||
|
this.GetComponent<TextMeshProUGUI>().text = firstFourChars + "......" + lastFourChars;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
public void GetTruncatedString()
|
||
|
{
|
||
|
string originalString = PlayerPrefs.GetString("WALLET_ADDRESS");
|
||
|
|
||
|
if (originalString.Length >= 4)
|
||
|
{
|
||
|
firstFourChars = originalString.Substring(0, 4);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
firstFourChars = originalString; // Or handle as needed if shorter
|
||
|
}
|
||
|
if (originalString.Length >= 4)
|
||
|
{
|
||
|
lastFourChars = originalString.Substring(originalString.Length - 4);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
lastFourChars = originalString; // Or handle as needed if shorter
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|