增加steamid上报

This commit is contained in:
wuwenbo 2026-06-05 11:56:51 +08:00
parent a861d153c0
commit aeffbb3d0f
2 changed files with 20 additions and 0 deletions

View File

@ -17,6 +17,7 @@ namespace Logic.CrashSight
public static CrashSightManager Instance => new CrashSightManager();
private const string CrashSightDeviceIdFallbackKey = "TH1_CrashSightDeviceId";
private static string _runtimeFallbackDeviceId;
private static ulong _reportedSteamUserId;
private CrashSightManager() { }
public void Initialize()
@ -31,6 +32,24 @@ namespace Logic.CrashSight
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()
{
try

View File

@ -371,6 +371,7 @@ namespace TH1_Logic.Steam
{
if (!TrySteamApi("RefreshLoginStatus.GetSteamID", SteamUser.GetSteamID, out _selfID)) return;
if (!TrySteamApi("RefreshLoginStatus.GetPersonaName", SteamFriends.GetPersonaName, out _selfName)) return;
CrashSightManager.UpdateSteamUserId(_selfID.m_SteamID);
LogSystem.LogInfo($"Steam用户已登录: {_selfName} ({_selfID})");
}
else