using UnityEngine;
///
/// Who is playing, as far as the server is concerned. For now a random id made once per install and kept in
/// PlayerPrefs; when real accounts arrive this is the one place to swap in the account id. Used as the "user"
/// the PCjs machines save their state under (see MonitorBrowser / afx-api), so each player gets their own
/// Windows 95 and Windows 3.1 that carry on from where they left them.
///
public static class AfxPlayer
{
const string Key = "afx_player_id";
static string id;
/// Stable per-install id: 32 hex characters, safe in URLs and file names.
public static string Id
{
get
{
if (string.IsNullOrEmpty(id))
{
id = PlayerPrefs.GetString(Key, "");
if (string.IsNullOrEmpty(id))
{
id = System.Guid.NewGuid().ToString("N");
PlayerPrefs.SetString(Key, id);
PlayerPrefs.Save();
}
}
return id;
}
}
}