SanAndreasUnity/Assets/Scripts/Facepunch/Utilities/SteamEx.cs

28 lines
870 B
C#
Raw Normal View History

2020-05-31 17:07:22 +00:00
#if STEAM
using Steamworks;
namespace Facepunch.Steam
{
public static class SteamEx
{
public static string Format(this CSteamID steamID)
{
if (steamID.GetEAccountType() == EAccountType.k_EAccountTypeInvalid ||
steamID.GetEAccountType() == EAccountType.k_EAccountTypeIndividual) {
uint accountID = steamID.GetAccountID().m_AccountID;
if (steamID.GetEUniverse() <= EUniverse.k_EUniversePublic) {
return string.Format("STEAM_0:{0}:{1}", accountID & 1, accountID >> 1);
} else {
return string.Format("STEAM_{2}:{0}:{1}", accountID & 1, accountID >> 1,
(int) steamID.GetEUniverse());
}
} else {
return steamID.ToString();
}
}
}
}
#endif