Files
Rhyculator/Assets/Script/ShowUID.cs
T
2026-10-24 11:55:22 +08:00

37 lines
767 B
C#

using UnityEngine;
using UnityEngine.UI;
public class ShowUID : MonoBehaviour
{
public Text displayText;
void Start()
{
int uid = PlayerPrefs.GetInt("UID", 0);
string type = PlayerPrefs.GetString("Type", "");
string uidHex;
if (uid != 0 && !string.IsNullOrEmpty(type))
{
char typeChar = type switch
{
"R" => '0',
"A" => 'a',
"B" => 'b',
"D" => 'f',
_ => '?'
};
string uidHexPart = uid.ToString("X8");
uidHex = $"{typeChar}x{uidHexPart}";
}
else
{
uidHex = "0x00000000";
}
displayText.text = "UID: " + uidHex;
}
}