增加steamid上报
This commit is contained in:
parent
a861d153c0
commit
aeffbb3d0f
@ -17,6 +17,7 @@ namespace Logic.CrashSight
|
|||||||
public static CrashSightManager Instance => new CrashSightManager();
|
public static CrashSightManager Instance => new CrashSightManager();
|
||||||
private const string CrashSightDeviceIdFallbackKey = "TH1_CrashSightDeviceId";
|
private const string CrashSightDeviceIdFallbackKey = "TH1_CrashSightDeviceId";
|
||||||
private static string _runtimeFallbackDeviceId;
|
private static string _runtimeFallbackDeviceId;
|
||||||
|
private static ulong _reportedSteamUserId;
|
||||||
private CrashSightManager() { }
|
private CrashSightManager() { }
|
||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
@ -31,6 +32,24 @@ namespace Logic.CrashSight
|
|||||||
CrashSightAgent.SetUserValue("DeviceId", deviceId);
|
CrashSightAgent.SetUserValue("DeviceId", deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void UpdateSteamUserId(ulong steamUserId)
|
||||||
|
{
|
||||||
|
if (steamUserId == 0 || !CrashSightAgent.IsInitialized || _reportedSteamUserId == steamUserId) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var value = steamUserId.ToString();
|
||||||
|
CrashSightAgent.SetUserId(value);
|
||||||
|
CrashSightAgent.SetUserValue("SteamId", value);
|
||||||
|
CrashSightAgent.SetUserValue("MemberId", value);
|
||||||
|
_reportedSteamUserId = steamUserId;
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"CrashSight SetSteamUserId failed: {e.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static string GetCrashSightDeviceId()
|
public static string GetCrashSightDeviceId()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@ -371,6 +371,7 @@ namespace TH1_Logic.Steam
|
|||||||
{
|
{
|
||||||
if (!TrySteamApi("RefreshLoginStatus.GetSteamID", SteamUser.GetSteamID, out _selfID)) return;
|
if (!TrySteamApi("RefreshLoginStatus.GetSteamID", SteamUser.GetSteamID, out _selfID)) return;
|
||||||
if (!TrySteamApi("RefreshLoginStatus.GetPersonaName", SteamFriends.GetPersonaName, out _selfName)) return;
|
if (!TrySteamApi("RefreshLoginStatus.GetPersonaName", SteamFriends.GetPersonaName, out _selfName)) return;
|
||||||
|
CrashSightManager.UpdateSteamUserId(_selfID.m_SteamID);
|
||||||
LogSystem.LogInfo($"Steam用户已登录: {_selfName} ({_selfID})");
|
LogSystem.LogInfo($"Steam用户已登录: {_selfName} ({_selfID})");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user